Search completed in 1.43 seconds.
AudioScheduledSourceNode: ended event - Web APIs
The
ended event of the AudioScheduledSourceNode interface is fired when the source node has stopped playing. Bubbles No Cancelable No Interface Event Event handler property AudioScheduledSourceNode.on
ended Usage notes This event occurs when a AudioScheduledSourceNode has stopped playing, either because it's reached a predetermined stop time, the full duration of the audio has been performed, or because the entire buffer has been played. ...
... Interface Event Event handler property AudioScheduledSourceNode.on
ended Usage notes This event occurs when a AudioScheduledSourceNode has stopped playing, either because it's reached a predetermined stop time, the full duration of the audio has been performed, or because the entire buffer has been played. ...
...nt occurs when a AudioScheduledSourceNode has stopped playing, either because it's reached a predetermined stop time, the full duration of the audio has been performed, or because the entire buffer has been played. Examples In this simple example, an event listener for the
ended event is set up to enable a "Start" button in the user interface when the node stops playing: node.addEventListener('
ended', () => { document.getElementById("startButton").disabled = false; }) You can also set up the event handler using the AudioScheduledSourceNode.on
ended property: node.on
ended = function() { document.getElementById("startButton").disabled = false; } For an example of the
ended event in use, see our audio-buffer example on GitHub. Specifications Specification Status Comment ...
...ton").disabled = false; }) You can also set up the event handler using the AudioScheduledSourceNode.on
ended property: node.on
ended = function() { document.getElementById("startButton").disabled = false; } For an example of the
ended event in use, see our audio-buffer example on GitHub. Specifications Specification Status Comment Web Audio APIThe definition of 'on
ended' in that specification. Working Draft Initial specification. ...
HTMLMediaElement: ended event - Web APIs
The
ended event is fired when playback or streaming has stopped because the end of the media was reached or because no further data is available. This event occurs based upon HTMLMediaElement (<audio> and <video>) fire
ended when playback of the media reaches the end of the media. Bubbles No Cancelable No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.on
ended Specification HTML5 media This event is also defined in Media Capture and Streams and Web Audio API Examples These examples add an event listener for the HTMLMediaElement's
ended event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const...
...rs.on
ended Specification HTML5 media This event is also defined in Media Capture and Streams and Web Audio API Examples These examples add an event listener for the HTMLMediaElement's
ended event, then post a message when that event handler has reacted to the event firing. ...
...ese examples add an event listener for the HTMLMediaElement's
ended event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('
ended', (event) => { console.log('Video stopped either because 1) it was over, ' + 'or 2) no further data is available.'); }); Using the on
ended event handler property: const video = document.querySelector('video'); video.on
ended = (event) => { console.log('Video stopped either because 1) it was over, ' + 'or 2) no further data is available.'); }; Specifications Specification Status HTML Living StandardThe definition of '
ended media event' in that specification. Living Standard HTML5The definit...
...andler property: const video = document.querySelector('video'); video.on
ended = (event) => { console.log('Video stopped either because 1) it was over, ' + 'or 2) no further data is available.'); }; Specifications Specification Status HTML Living StandardThe definition of '
ended media event' in that specification. Living Standard HTML5The definition of '
ended media event' in that specification. Recommendation ...
MediaStream.ended - Web APIs
Specifications No longer part of any specification. ...
... Specifications No longer part of any specification. ...
... Specifications No longer part of any specification. ...
...only property of the MediaStream interface returns a Boolean value which is true if the stream has been completely read, or false if the end of the stream has not been reached. This value once the
ended event has been fired. This property has been removed from the specification; you should instead rely on the
ended event or check the value of MediaStreamTrack.readyState to see if its value is "
ended" for the track or tracks you want to ensure have finished playing. Syntax var has
Ended = MediaStream.
ended; Value A Boolean value that returns true if the end of the stream has been reached. Specifications No longer part of any specification. This property was part of earlier drafts of the Media Capture and Streams specification. ...
MediaStreamTrack: ended event - Web APIs
The
ended event of the MediaStreamTrack interface is fired when playback or streaming has stopped because the end of the media was reached or because no further data is available. Bubbles No Cancelable No Interface Event Event handler property MediaStreamTrack.on
ended Usage notes
ended events fire when the media stream track's source permanently stops sending data on the stream. There are various ways this can happen, including: There is no more data left to send. The user revoked the permissions needed for the data to be sent. The hardware generating the source data has been removed or ejected. A remote peer has permanently stopped sending data; pausing media does not generate an
ended event. Examples This example sets up an ev...
...on the stream. There are various ways this can happen, including: There is no more data left to send. The user revoked the permissions needed for the data to be sent. The hardware generating the source data has been removed or ejected. A remote peer has permanently stopped sending data; pausing media does not generate an
ended event. ...
...oked the permissions needed for the data to be sent. The hardware generating the source data has been removed or ejected. A remote peer has permanently stopped sending data; pausing media does not generate an
ended event. Examples This example sets up an event handler for the
ended event, which changes an on-screen icon to indicate that the track is no longer active. ...
...s not generate an
ended event. Examples This example sets up an event handler for the
ended event, which changes an on-screen icon to indicate that the track is no longer active. track.addEventListener('
ended', () => { let statusElem = document.getElementById("status-icon"); statusElem.src = "/images/stopped-icon.png"; }) You can also set up the event handler using the MediaStreamTrack.on
ended property: track.on
ended = function() { let statusElem = document.getElementById("status-icon"); statusElem.src = "/images/stopped-icon.png"; } Specifications Specification Status Comment Media Capture and StreamsThe definition of '
ended' in that specification. Candidate Recommendation Initial specification. ...
JSExtendedClass
Obsolete since JavaScript 1.8.5This 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. JSExt
endedClass is an ext
ended version of JSClass with additional hooks. A C/C++ program can use a JSExt
endedClass with the JS_InitClass and JS_NewObject APIs to create objects that have custom methods and properties implemented in C/C++. Syntax struct JSExt
endedClass { JSClass base; JSEqualityOp equality; JSObjectOp outerObject; JSObjectOp innerObject; JSIteratorOp iteratorObject;// Added in SpiderMonkey 1.8 JSObjectOp wrappedObject; // Added in SpiderMonkey 1.8 ...and additional reserved fields. }; Name Typ...
...al. Creates and returns a new iterator. wrappedObject JSObjectOp Added in SpiderMonkey 1.8 Optional. If non-null, an object of this class may serve as a wrapper for another object. Wrappers sometimes transparently behave like the object they wrap. For example, an object and its wrappers are all equal under ===. Description To implement a custom class that uses any of the JSExt
endedClass callbacks: Create a JSExt
endedClass and populate both the base fields and the ext
ended fields. Ensure that the additional reserved fields at the end of the JSExt
endedClass are NULL. JSClass and JSExt
endedClass structs should usually be global, and in this case the compiler automatically initializes these fields to NULL. (This is a feature of the C and C++ languages.) Otherwise, use memset...
... a JSExt
endedClass and populate both the base fields and the ext
ended fields. Ensure that the additional reserved fields at the end of the JSExt
endedClass are NULL. JSClass and JSExt
endedClass structs should usually be global, and in this case the compiler automatically initializes these fields to NULL. (This is a feature of the C and C++ languages.) Otherwise, use memset. Set the JSCLASS_IS_EXT
ENDED flag in myExt
endedClass.base.flags. Pass &myExt
endedClass.base to functions like JS_InitClass or JS_NewObject that require a JSClass *. See Also bug 571789 ...
OscillatorNode.onended - Web APIs
}; Example The following example shows basic usage of an AudioContext to create an oscillator node. For an applied example, check out our Violent Theremin demo (see app.js for relevant code). ...
...}; Example The following example shows basic usage of an AudioContext to create an oscillator node. For an applied example, check out our Violent Theremin demo (see app.js for relevant code). ...
... relevant code). // create web audio api context var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); // create Oscillator node var oscillator = audioCtx.createOscillator(); oscillator.type = 'square'; oscillator.frequency.value = 440; // value in hertz oscillator.start(); // start the tone playing oscillator.stop(5); // the tone will stop again in 5 seconds. oscillator.on
ended = function() { console.log('Your tone has now stopped playing!'); } Properties None. Specifications Specification Status Comment Web Audio APIThe definition of 'on
ended' in that specification. Working Draft ...
510 Not Extended - HTTP
The HyperText Transfer Protocol (HTTP) 510 Not Ext
ended 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 supported for the request, then the server responds with the 510 status code. ...
...onse status code is sent in the context of the HTTP Extension Framework, defined in RFC 2774. ...
...n that specification a client may send a request that contains an extension declaration, that describes the extension to be used. ...
AudioScheduledSourceNode.onended - Web APIs
The on
ended event handler for the AudioScheduledSourceNode interface specifies an EventHandler to be executed when the
ended event occurs on the node. This event is sent to the node when the concrete interface (such as AudioBufferSourceNode, OscillatorNode, or ConstantSourceNode) determines that it has stopped playing. The
ended event is only sent to a node configured to loop automatically when the node is stopped using its stop() method. This is the case, for example, when using an AudioBufferSourceNode with its loop property set to true. Syntax AudioScheduledSourceNode.on
ended = EventHandler; Value A function which is called by the browser when the
ended event occurs on the AudioScheduledSourceNode. The function receives as input a single parameter, which is an object of type Event d...
...rSourceNode with its loop property set to true. Syntax AudioScheduledSourceNode.on
ended = EventHandler; Value A function which is called by the browser when the
ended event occurs on the AudioScheduledSourceNode. The function receives as input a single parameter, which is an object of type Event describing the event that occurred. Examples In this simple example, an event listener for the
ended event is set up to enable a "Start" button in the user interface when the node stops playing. node.on
ended = function(event) { document.getElementById("startButton").disabled = false; } Specifications Specification Status Comment Web Audio APIThe definition of 'on
ended' in that specification. Working Draft Initial specification. ...
MediaStreamTrack.onended - Web APIs
The MediaStreamTrack.on
ended event handler is used to specify a function which serves as an EventHandler to be called when the
ended event occurs on the track. This event occurs when the track will no longer provide data to the stream for any reason, including the end of the media input being reached, the user revoking needed permissions, the source device being removed, or the remote peer ending a connection. Syntax MediaStreamTrack.on
ended = function; Value A function to serve as an EventHandler for the
ended event. The event handler function receives a single parameter: the event object, which is a simple Event object. ...
...g reached, the user revoking needed permissions, the source device being removed, or the remote peer ending a connection. Syntax MediaStreamTrack.on
ended = function; Value A function to serve as an EventHandler for the
ended event. The event handler function receives a single parameter: the event object, which is a simple Event object. Examples This example sets up an event handler for the
ended event which changes an on-screen icon to indicate that the track is no longer active. track.on
ended = function(event) { let statusElem = document.getElementById("status-icon"); statusElem.src = "/images/stopped-icon.png"; } Specifications Specification Status Comment Media Capture and StreamsThe definition of 'MediaStreamTrack.on
ended' in that specification. ...
JSExtendedClass.outerObject
Obsolete since JavaScript 1.8.5This 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. JSExt
endedClass.outerObject and .innerObject are callbacks for split objects. Callback syntax typedef JSObject * (*JSObjectOp)(JSContext *cx, JSObject *obj); Name Type Description cx JSContext * A context. obj JSObject * The object being queried. Description See split objects. ...
JSExtendedClass.wrappedObject
cle covers features introduced in SpiderMonkey 1.8 Callback for objects that wrap other objects. Syntax typedef JSObject * (*JSObjectOp)(JSContext *cx, JSObject *obj); Name Type Description cx JSContext * The context in which the object is being unwrapped. obj JSObject * The object to unwrap. Description If a class has the JSCLASS_IS_EXT
ENDED bit set in its JSClass.flags and has a non-null JSExt
endedClass.wrappedObject, then objects of that class may be wrappers. In a few cases the JavaScript engine will pretend the wrapper isn't there, instead operating on the object it wraps. In these cases the engine calls the JSExt
endedClass.wrappedObject callback to get the wrapped object. Most classes do not implement wrappedObject. The specifi...
GlobalEventHandlers.onended - Web APIs
The on
ended property of the GlobalEventHandlers mixin is the EventHandler for processing
ended events. The
ended event is fired when playback has stopped because the end of the media was reached. Syntax element.on
ended = handlerFunction; var handlerFunction = element.on
ended; handlerFunction is either null or a JavaScript function specifying the handler for the event. Specification Specification Status Comment HTML Living StandardThe definition of 'on
ended' in that specification. Living Standard ...
HTMLMediaElement.ended - Web APIs
The HTMLMediaElement.
ended indicates whether the media element has
ended playback. Syntax var is
Ended = HTMLMediaElement.
ended Value A Boolean which is true if the media contained in the element has finished playing. If the source of the media is a MediaStream, this value is true if the value of the stream's active property is false. Example var obj = document.createElement('video'); console.log(obj.
ended); // false Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.
ended' in that specification. Living Standard HTML5The definition of 'HTMLMediaElement.
ended' in that specification. Recommendation ...
Recommended Drag Types - Web APIs
tDataAt(), 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. It is recomm
ended to always add data of the text/plain type as a fallback for applications or drop targets that do not support 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 t...
msExtendedCode - Web APIs
ard 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. In the event of an error, the media element's error event will be fired. The element's error property will then contain an msExt
endedCode read-only property with platform-specific error code information. msExt
endedCode is a read-only proprietary property specific to Internet Explorer and Microsoft Edge. Value Type: long; The platform specific error code. Example var video1 = object.getElementById("video1"); video1.addEventListener('error', function () { var error = video1.error.msExt
endedCode; //... }, false); video.
Index - Web APIs
atency The outputLatency read-only property of the AudioContext Interface provides an estimation of the output latency of the current audio context. 134 AudioContext.resume() API, Audio, AudioContext, Method, Reference, Web Audio API, resume The resume() method of the AudioContext interface resumes the progression of time in an audio context that has previously been susp
ended. 135 AudioContext.suspend() API, Audio, AudioContext, Method, Reference, Web Audio API, suspend The suspend() method of the AudioContext Interface suspends the progression of time in the audio context, temporarily halting audio hardware access and reducing CPU/battery usage in the process -- this is useful if you want an application to power down the audio hardware when it wi...
...PI, Audio, AudioScheduledSourceNode, Interface, Media, Reference, Web Audio API, sound The AudioScheduledSourceNode interface--part of the Web Audio API--is a parent interface for several types of audio source node interfaces which share the ability to be started and stopped, optionally at specified times. Specifically, this interface defines the start() and stop() methods, as well as the on
ended event handler. 182 AudioScheduledSourceNode.on
ended API, Audio, AudioBufferSourceNode, AudioScheduledSourceNode, ConstantSourceNode, Event Handler, Media, OscillatorNode, Property, Web Audio API, on
ended The on
ended event handler for the AudioScheduledSourceNode interface specifies an EventHandler to be executed when the
ended event occurs on the node. This event is sent to t...
...PI, play, sound, start undefined 184 AudioScheduledSourceNode.stop() API, Audio, AudioScheduledSourceNode, Media, Method, Reference, Web Audio API, sound, stop The stop() method on AudioScheduledSourceNode schedules a sound to cease playback at the specified time. If no time is specified, then the sound stops playing immediately. 185 AudioScheduledSourceNode:
ended event Audio, HTML DOM, HTMLMediaElement, Media, Media Streams API, Reference, Video, Web Audio API,
ended, events The
ended event of the AudioScheduledSourceNode interface is fired when the source node has stopped playing. 186 AudioTrack Audio, AudioTrack, HTML, HTML DOM, Interface, Media, Reference, track The AudioTrack interface represents a single audio track fro...
...And 39 more matches
WebIDL bindings
ngs/Bindings.conf, is basically a Python dict that maps interface names to information about the interface, called a descriptor. There are all sorts of possible options here that handle various edge cases, but most descriptors can be very simple. 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 app
ended 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 exported 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 MyInterf...
...the type is not in the header file one gets by replacing '::' with '/' and appending '.h', then add a corresponding 'headerFile' annotation (or HeaderFile annotation to the .webidl file). If you don't have to set any annotations, then you don't need to add an entry either and the code generator will simply assume the defaults here. Note that using a 'headerFile' annotation is generally not recomm
ended. If you do use it, you will need to make sure your header includes all the headers needed for your Func annotations. Add external interface entries to Bindings.conf for whatever non-WebIDL interfaces your new interface has as arguments or return values. Implement a WrapObject override on mozilla::dom::MyInterface that just calls through to mozilla::dom::MyInterface_Binding::Wrap. Note that if ...
...urn value of functions that return it should return an nsAutoPtr. C++ reflections of WebIDL constructs C++ reflections of WebIDL operations (methods) A WebIDL operation is turned into a method call on the underlying C++ object. The return type and argument types are determined as described below. In addition to those, all methods that are allowed to throw will get an ErrorResult& argument app
ended to their argument list. Non-static methods that use certain WebIDL types like any or object will get a JSContext* argument prep
ended to the argument list. Static methods will be passed a const GlobalObject& for the relevant global and can get a JSContext* by calling Context() on it. The name of the C++ method is simply the name of the WebIDL operation with the first letter converted to uppercase...
...And 28 more matches
IAccessible2
other-licenses/ia2/Accessible2.idlNot scriptable Please add a summary to this article. ...
... other-licenses/ia2/Accessible2.idlNot scriptable Please add a summary to this article. ...
... other-licenses/ia2/Accessible2.idlNot scriptable Please add a summary to this article. ...
...And 24 more matches
WebAssembly - JavaScript
AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsWebAssemblyChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0CompileErrorChrome Full support ...
... 7.0nodejs Full support 8.0.0CompileErrorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...And 19 more matches
WebAssembly
AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsWebAssemblyChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0CompileErrorChrome Full support ...
... 7.0nodejs Full support 8.0.0CompileErrorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...And 19 more matches
Index - Archive of obsolete content
monetization or other reasons, change several search-related settings at install time. While this is generally considered acceptable behavior, considerable care must be taken to avoid violating the Mozilla add-on guidelines or creating an adverse user experience. 296 Security best practices in extensions Add-ons, Best practices, Extensions, Guide, Security This document is int
ended as a guide for developers to promote best practices in securing your extension. Your goal is to keep your users safe. Some items mentioned are strict guidelines, meaning that if you don't follow them then your add-on will not be approved on Mozilla add-ons. Other items are recommendations. The difference will be clearly flagged. 297 Session store API Add-ons, Extensions, Firefox, G...
...een resolving conflicts, finding a good time to land, watching the tree, and marking bugs as fixed, it takes around half a day. 362 SpiderMonkey coding conventions JavaScript, SpiderMonkey The SpiderMonkey project owners enforce coding conventions pretty strictly during code reviews. 363 Autodial for Windows NT Necko, Outdated_articles This document is int
ended to explain how the autodial helper feature implemented for bug 93002 works and why it works that way. 364 Automated testing tips and tricks Developing Mozilla No summary! 365 Automatic Mozilla Configurator Administration, Configuration management, enterprise No summary! 366 Enabling quicklaunch for all users Administration, Configuration ma...
...led by Dehydra while compiling. See the Dehydra object reference for details on the available object properties. 418 Dehydra Object Reference Dehydra represents C++ types and variables as JavaScript objects. The objects are designed to distill that type system to the minimum such that it can be easy to match on. 419 Installing Dehydra Dehydra It is recomm
ended that you use SpiderMonkey revision AURORA_BASE_20110705 when building Dehydra. 420 Using Dehydra As GCC compiles file, Dehydra calls functions in the user analysis script with information about the code being compiled. For more information, see the function reference and the object reference. 421 Developing New Mozilla Features Developing Mozilla, Outdated_art...
...And 17 more matches
WebAssembly.Table - JavaScript
me for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsTableChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Table() constructorChrome Full support ...
....0nodejs Full support 8.0.0Table() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...And 9 more matches
HTML documentation index - HTML: Hypertext Markup Language
that slot attribute's value. 29 spellcheck Global attributes, HTML, Reference The spellcheck global attribute is an enumerated attribute defines whether the element may be checked for spelling errors. 30 style Global attributes, HTML, Reference The style global attribute contains CSS styling declarations to be applied to the element. Note that it is recomm
ended for styles to be defined in a separate file or files. This attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes. 31 tabindex Global attributes, HTML, Reference The tabindex global attribute indicates that its element can be focused, and where it participates in sequential keyboard navigation (usually with th...
... The HTML <area> element defines a hot-spot region on an image, and optionally associates it with a hypertext link. This element is used only within a <map> element. 61 <article>: The Article Contents element Element, HTML, HTML sections, Reference, Web The HTML <article> element represents a self-contained composition in a document, page, application, or site, which is int
ended 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...
...ent, HTML, HTML document metadata, HTML:Metadata content, Reference The HTML <base> element specifies the base URL to use for all relative URLs in a document. 66 <basefont> Element, Fonts, HTML, Layout, Obsolete, Reference, Style, Web, basefont The obsolete HTML Base Font element (<basefont>) sets a default font face, size, and color for the other elements which are desc
ended from its parent element. 67 <bdi>: The Bidirectional Isolate element BDI, BiDi, Directionality, Element, HTML, HTML text-level semantics, HTML:Flow content, HTML:Palpable Content, HTML:Phrasing content, Internationalization, Left-to-Right, Reference, Right-to-left, Text, Web, direction, i18n, ltr, rtl The HTML Bidirectional Isolate element (<bdi>) tells the browser's bidirec...
...And 7 more matches
WebAssembly.Module - JavaScript
e for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsModuleChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Module() constructorChrome Full support ...
...0nodejs Full support 8.0.0Module() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...And 7 more matches
HTML elements reference - HTML: Hypertext Markup Language
d heading elements to identify sections of content. Element Description <address> The HTML <address> 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 int
ended 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 ab...
...t content elements to organize blocks or sections of content placed between the opening <body> and closing </body> tags. Important 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 ext
ended quotation. Usually, this is rendered visually by indentation (see Notes for how to change it). A URL for the source of the quotation may be given using the cite attribute, while a text representation of the source can be given using the <cite> element. <dd> The HTML <dd> element provides the description, definition, or value for the preceding term (<dt>) in a description list (<dl>)...
...L <br> element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant. <cite> The HTML Citation element (<cite>) is used to describe a reference to a cited creative work, and must include the title of that work. <code> The HTML <code> element displays its contents styled in a fashion int
ended to indicate that the text is a short fragment of computer code. <data> The HTML <data> element links a given piece of content with a machine-readable translation. If the content is time- or date-related, the <time> element must be used. <dfn> The HTML Definition element (<dfn>) is used to indicate the term being defined within the context of a definition phrase or sent...
...And 6 more matches
Web audio codec guide - Web media technologies
tent-encumbered format, AAC support is somewhat less predictable. For example, Firefox only supports AAC if support is provided by the operating system or an external library. ...
...bandwidth and storage capacity, and may not be a good choice outside very specific use cases. ...
...c reproduction--you need to choose another format. ...
...And 6 more matches
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 recomm
ended add-ons list on AMO and lets the user click a button to install an add-on from the list. Importing the repository code module Before you can use the Add-on Repository API, you need to import the code module: Components.utils.import("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 recomm...
...can use the Add-on Repository API, you need to import the code module: Components.utils.import("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 recomm
ended add-ons is not included by default; see bug 628785. To make the service work for the time being, you can use code like this when your extension starts up: var prefsService = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService); var prefBranch = prefsService.getBranch("extensions."); var recUrl = ""; try { recUrl = ...
... bug 628785. ...
...And 5 more matches
Index
tificate (Z), the set of candidate issuer certificates might have different issuer names (referring to the second or higher issuer level). As a consequence, it will be necessary to try multiple different alternative routes while searching for (Z), in a recursive manner. Only the newer verification engine (internally named libPKIX) is capable of doing that properly. It's worth mentioning the Ext
ended Validation (EV) principle, which is an effort by software vendors and CAs to define a stricter set of rules for issuing certificates for web site certificates. Instead of simply verifying that the requester of a certificate is in control of an administrative email address at the desired web site's domain, it's required that the CA performs a verification of real world identity documents (such as ...
... -G Arguments Option arguments modify an action and are lowercase. -B Bypass CA signature checks. -P dbprefix Specify the prefix used on the NSS security database files (for example, my_cert8.db and my_key3.db). This option is provided as a special case. Changing the names of the certificate and key databases is not recomm
ended. -a Use ASCII format or allow the use of ASCII format for input and output. This formatting follows RFC #1113. -c crl-gen-file Specify script file that will be used to control crl generation/modification. See crl-cript-file format below. If options -M|-G is used and -c crl-script-file is not specified, crlutil will read s...
...9.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. Changing the names of the certificate and key databases is not recomm
ended. -installdir root-installation-directory Specify the root installation directory relative to which files will be installed by the -jar option. This directory should be one below which it is appropriate to store dynamic library files, such as a server's root directory. -libfile library-file Specify a path to a library file containing...
...And 5 more matches
Document - Web APIs
t sets available on the document. Document.timelineRead only Returns timeline as a special instance of DocumentTimeline that is automatically created on page load. Document.undoManager Read only ... Document.visibilityStateRead only Returns a string denoting the visibility state of the document. Possible values are visible, hidden, prerender, and unloaded. The Document interface is ext
ended with the ParentNode interface: ParentNode.childElementCount Read only Returns the number of children of this ParentNode which are elements. ParentNode.children Read only Returns a live HTMLCollection containing all of the Element objects that are children of this ParentNode, omitting all of its non-element nodes. ParentNode.firstElementChild Read only Returns the first node which is bo...
...Returns the first node which is both a child of this ParentNode and is also an Element, or null if there is none. ParentNode.lastElementChild Read only Returns the last node which is both a child of this ParentNode and is an Element, or null if there is none. Extensions for HTMLDocument The Document interface for HTML documents inherits from the HTMLDocument interface or, since HTML5, is ext
ended for such documents. Document.cookie Returns a semicolon-separated list of the cookies for that document or sets a single cookie. Document.defaultViewRead only Returns a reference to the window object. Document.designMode Gets/sets the ability to edit the whole document. Document.dirRead only Gets/sets directionality (rtl/ltr) of the document. Document.domain Gets/sets the domain of ...
... the paste event. Document.onreadystatechange Represents the event handling code for the readystatechange event. Document.onselectionchange Is an EventHandler representing the code to be called when the selectionchange event is raised. Document.onvisibilitychange Is an EventHandler representing the code to be called when the visibilitychange event is raised. The Document interface is ext
ended with the GlobalEventHandlers interface: GlobalEventHandlers.onabort Is an EventHandler representing the code to be called when the abort event is raised. GlobalEventHandlers.onanimationcancel An EventHandler called when an animationcancel event is sent, indicating that a running CSS animation has been canceled. GlobalEventHandlers.onanimationend An EventHandler called when an animatione...
...And 5 more matches
WebAssembly.Memory - JavaScript
e for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsMemoryChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Memory() constructorChrome Full support ...
...0nodejs Full support 8.0.0Memory() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...And 5 more matches
Debugging on Mac OS X
enable Notarization are planned. As a result, it is not possible to attach a debugger to these official Firefox releases on macOS 10.14+ without disabling System Integrity Protection (SIP). This is due to Notarization requiring Hardened Runtime to be enabled with the com.apple.security.get-task-allow entitlement disallowed. Rather than disabling SIP (which has security implications), it is recomm
ended to debug with try builds or local builds. The differences are explained below. try Server Builds In most cases, developers needing to debug a build as close as possible to the production environment should use a try build. These builds enable Hardened Runtime and only differ from production builds in that they are not Notarized which should not otherwise affect functionality, (other than the ab...
... the dmg generated by the "Rpk" shippable build job. A debugger can be attached to Firefox processes of these builds. try builds use the developer.entitlements.xml file from the source tree while production builds use production.entitlements.xml. On macOS 10.15+, downloaded try builds will not launch by default because Notarization is required. To workaround this problem, remove the quarantine ext
ended attribute from the downloaded Nightly: $ xattr -r -d com.apple.quarantine /Path/to/Nightly.app Local Builds Local builds of mozilla-central do not enable Hardened Runtime and hence do not have debugging restrictions. As a result, some functionality will be permitted on local builds, but blocked on production builds which have Hardened Runtime enabled. Bug 1522409 was filed to automate codesi...
...er.entitlements.xml file from the tree. This requires creating a codesigning identity. Disabling System Integrity Protection (SIP) If debugging a production build is required, follow Apple's documented steps for disabling System Integrity Protection (SIP). Note that disabling SIP bypasses Hardened Runtime restrictions which can mask some bugs that only occur with Hardened Runtime so it is recomm
ended to test fixes with SIP enabled. Disabling SIP has system security implications that should be understood before taking this step. Creating an Xcode project If you try to create a new Xcode project in an existing directory then Xcode will delete its existing contents (Xcode will warn you beforehand). To work around that, the steps below have you initialize the project outside the Mozilla source...
...And 4 more matches
sslfnc.html
ites are turned off by default, disallowing all cipher suites. Therefore, an application cannot use NSS to perform any cryptographic operations until after it enables appropriate cipher suites by calling one of the SSL Export Policy Functions. NSS_NoDB_Init Performs tasks required to run Network Security Services without setting up configuration files. Important: This NSS function is not int
ended for use with SSL, which requires that the certificate and key database files be opened. Syntax #include "nss.h" SECStatus NSS_NoDB_Init(char *reserved); Parameter This function has the following parameter: reserved Should be NULL.. Returns The function returns one of these values: If successful, SECSuccess. If unsuccessful, SECFailu...
...as long as the current application program is running. This function must be called once for each default value you want to change from the factory setting. To change a value in a socket that is already open, use SSL_OptionSet. Keep the following in mind when deciding on the operating parameters you want to use with a particular socket: Enabling the SSL_REQUIRE_CERTIFICATE option is not recomm
ended. If the client has no certificate and this option is enabled, the client's connection terminates with an error. The user is likely to think something is wrong with either the client or the server, and is unlikely to realize that the problem is the lack of a certificate. It is better to allow the SSL handshake to complete and then have your application return an error message to the client that in...
... an external 16-bit integer named SSL_NumImplementedCiphers. The macro SSL_IS_SSL2_CIPHER can be used to determine whether a particular value is an SSL2 or an SSL3 cipher. WARNING: Using the external array SSL_ImplementedCiphers[] directly is deprecated. It causes dynamic linking issues at run-time after an update of NSS because the actual size of the array changes between releases. The recomm
ended way of accessing the array is through the SSL_GetImplementedCiphers() and SSL_GetNumImplementedCiphers() accessors. By default, all SSL2 and 12 SSL3/TLS cipher suites are enabled. However, this does not necessarily mean that they are all permitted. The SSL_CipherPrefSetDefault function cannot override cipher suite policy settings that are not permitted; see SSL Export Policy Functions for detai...
...And 4 more matches
Index
the idea of the future is always evolving in time as things change and we learn more. 6 GC Rooting Guide SpiderMonkey No summary! 7 GCIntegration Developing Mozilla, Firefox, Garbage collection, Intermediate, Intro, JSAPI, NeedsUpdate, SpiderMonkey, Tools, memory The SpiderMonkey garbage collector (GC) will be changing a lot in the future. This page is int
ended to explain the changes that are happening, with a focus on how they will affect Gecko code that uses JSAPI. At a high level, there are three issues to be aware of: 8 Getting SpiderMonkey source code Guide, SpiderMonkey You can get the SpiderMonkey source code in gzipped form or directly from the Mercurial repository. 9 Hacking Tips SpiderMonkey This page ...
...ct is returned by the JS_SaveExceptionState function, and is passed to functions JS_RestoreExceptionState and JS_DropExceptionState. 100 JSExnType JSAPI Reference, Reference, Reference(2), SpiderMonkey These types are part of a JSErrorFormatString structure. They define which error to throw in case of a runtime error. JSEXN_NONE marks an unthrowable error. ...
...opExceptionState. 100 JSExnType JSAPI Reference, Reference, Reference(2), SpiderMonkey These types are part of a JSErrorFormatString structure. They define which error to throw in case of a runtime error. JSEXN_NONE marks an unthrowable error. 101 JSExt
endedClass JSAPI Reference, Obsolete, SpiderMonkey To implement a custom class that uses any of the JSExt
endedClass callbacks: 102 JSExt
endedClass.outerObject JSAPI Reference, Obsolete, SpiderMonkey See split objects. 103 JSExt
endedClass.wrappedObject JSAPI Reference, Obsolete, SpiderMonkey If a class has the JSCLASS_IS_EXT
ENDED bit set in its JSClass.flags and has a non-null JSExt
endedClass.wrappedObject, then objects of that class may be wrappers. In a few cases...
...And 4 more matches
SourceBuffer - Web APIs
ddle" alignment-baseline="middle">SourceBuffer</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties SourceBuffer.appendWindowEnd Controls the timestamp for the end of the append window. SourceBuffer.appendWindowStart Controls the timestamp for the start of the append window. This is a timestamp range that can be used to filter what media data is app
ended to the SourceBuffer. Coded media frames with timestamps within this range will be app
ended, whereas those outside the range will be filtered out. SourceBuffer.audioTracks Read only A list of the audio tracks currently contained inside the SourceBuffer. SourceBuffer.buffered Read only Returns the time ranges that are currently buffered in the SourceBuffer. SourceBuffer.mode Controls how th...
...whereas those outside the range will be filtered out. SourceBuffer.audioTracks Read only A list of the audio tracks currently contained inside the SourceBuffer. SourceBuffer.buffered Read only Returns the time ranges that are currently buffered in the SourceBuffer. SourceBuffer.mode Controls how the order of media segments in the SourceBuffer is handled, in terms of whether they can be app
ended in any order, or they have to be kept in a strict sequence. SourceBuffer.textTracks Read only A list of the text tracks currently contained inside the SourceBuffer. SourceBuffer.timestampOffset Controls the offset applied to timestamps inside media segments that are subsequently app
ended to the SourceBuffer. SourceBuffer.trackDefaults Specifies the default values to use if kind, label, and...
... SourceBuffer.updating Read only A boolean indicating whether the SourceBuffer is currently being updated -- i.e. ...
...And 4 more matches
Event reference
technical reasons or because the permission was denied. select Some text is being selected. wheel A wheel button of a pointing device is rotated in any direction. Drag & Drop events Event Name Fired When drag An element or text selection is being dragged (fired continuously every 350ms). dragend A drag operation is being
ended (by releasing a mouse button or hitting the escape key). dragenter A dragged element or text selection enters a valid drop target. dragstart The user starts dragging an element or text selection. dragleave A dragged element or text selection leaves a valid drop target. dragover An element or text selection is being dragged over a valid drop target (...
... media up to its end without stopping for content buffering. complete The rendering of an OfflineAudioContext is terminated. durationchange The duration attribute has been updated. emptied The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.
ended Playback has stopped because the end of the media was reached. loadeddata The first frame of the media has finished loading. loadedmetadata The metadata has been loaded. pause Playback has been paused. play Playback has begun. playing Playback is ready to start after having been paused or delayed due to lack of data. ratechan...
...playing Playback is ready to start after having been paused or delayed due to lack of data. ratechange The playback rate has changed. seeked A seek operation completed. seeking A seek operation began. stalled The user agent is trying to fetch media data, but data is unexpectedly not forthcoming. suspend Media data loading has been susp
ended. 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. Progress events Event Name Fired When abort Progression has been terminated (not due to an error). error Progression has failed. ...
...And 4 more matches
Advanced text formatting - Learn web development
somewhere else, you should wrap it inside a <blockquote> element to signify this, and include a URL pointing to the source of the quote inside a cite attribute. ...
... Inline quotations Inline quotations work in exactly the same way, except that they use the <q> element. ...
...ndented paragraph, as an indicator that it is a quote; the paragraph above the quotation is there to demonstrate that. Inline quotations Inline quotations work in exactly the same way, except that they use the <q> element. For example, the below bit of markup contains a quotation from the MDN <q> page: <p>The quote element -- <code><q></code> -- is <q cite="/docs/Web/HTML/Element/q">int
ended for short quotations that don't require paragraph breaks.</q></p> Browser default styling will render this as normal text put in quotes to indicate a quotation, like so: Citations The content of the cite attribute sounds useful, but unfortunately browsers, screenreaders, etc. don't really do much with it. There is no way to get the browser to display the contents of cite, without writing you...
...And 3 more matches
nss tech note3
6, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x01 In addition to Netscape's own Cert Type extension, NSS recognizes various X.509 extensions. The X.509 key usage extension has OID { 2 5 29 0F } encoded in hex as 0x55, 0x1d, 0x0f. If present, this extension directly determines the values of the 8 key usages defined above. If absent, the cert is assumed to be valid for all key usages. The X.509v3 ext
ended Key usage extension as OID { 2 5 29 37 } encoded in hex as 0x55, 0x1d, 0x25. That extension contains a sequence of OIDs, each of which signifies one or more Cert Types, depending on the presence or absence of of the True Basic Constraints extension; that is, the interpretation of the ext
ended Key Usage extension is controlled by whether the cert is a CA cert, or not. The following table shows t...
... 2 5 29 37 } encoded in hex as 0x55, 0x1d, 0x25. That extension contains a sequence of OIDs, each of which signifies one or more Cert Types, depending on the presence or absence of of the True Basic Constraints extension; that is, the interpretation of the ext
ended Key Usage extension is controlled by whether the cert is a CA cert, or not. The following table shows the OIDs recognized in the ext
ended key usage extension, and how they map to cert types and key usages for CA and non-CA certs. ...
...which signifies one or more Cert Types, depending on the presence or absence of of the True Basic Constraints extension; that is, the interpretation of the ext
ended Key Usage extension is controlled by whether the cert is a CA cert, or not. The following table shows the OIDs recognized in the ext
ended key usage extension, and how they map to cert types and key usages for CA and non-CA certs. ...
...And 3 more matches
A Web PKI x509 certificate primer
for CA certificates). It can also be used to express the maximum depth of the trust path from the CA. Key usage This extension is used to constrain the purpose for the key in the certificate. More than one key usage can be asserted. Examples of key usages are: digitalSignature, keyEncipherment, dataEncipherment, keyCertSign, and cRLSign. For CA certificates the keyCertSign bit must be set. Ext
ended key usages This is another bitfield to constrain the usages of the key of the certificate. Its is directed mostly at what type of application the certificate was issued for. Examples of ext
ended key usages are: serverAuth, clientAuth, and OCSPSigning. For end-entity certificates for PKI this extension is required to exist with the serverAuth bit asserted. Name constraints This is an extension ...
... this command: openssl req -new -key key.pem -days 1096 -extensions v3_ca -batch -out example.csr -utf8 -subj '/CN=www.example.com' This creates a new Certificate Signing Request (CSR) that will be valid for 3 years. 3. Write extensions file by creating a new file with name openssl.ss.cnf with the following contents: basicConstraints = CA:FALSE subjectAltName =DNS:www.example.com ext
endedKeyUsage =serverAuth 4. Self-sign csr (using SHA256) and append the extensions described in the file "openssl x509 -req -sha256 -days 3650 -in example.csr -signkey key.pem -set_serial $ANY_INTEGER -extfile openssl.ss.cnf -out example.pem" You can now use example.pem as your certfile CAs included in Firefox When you visit a secure website, Firefox will validate the website's certific...
...-key intkey.pem -days 2922 -extensions v3_ca -batch -out int.csr - utf8 -subj '/C=US/O=Orgname/OU=SomeInternalName2' Make a new Certificate Signing Request (CSR) that will be valid for 8 years. ...
...And 3 more matches
nsISelectionController
tendForDelete Will extend the selection one character cell forward in the document. This method is used internally for handling delete key. void characterExtendForDelete(); Parameters None. characterMove() Will move the selection one character forward/backward in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is ext
ended is considered the "focus" point, or the last point adjusted by the selection. void characterMove( in boolean forward, in boolean extend ); Parameters forward Forward or backward if PR_FALSE. extend Should it collapse the selection or extend it? checkVisibility() Checks if textnode and offsets are actually rendered in the current precontext. boolean checkVisibili...
...OMNode to test. startOffset Offset in DOM to first char of textnode to test. endOffset Offset in DOM to last char of textnode to test. Return value true if visible, false if not. completeMove() Will move page view to the top or bottom of the document this will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is ext
ended is considered the "focus" point, or the last point adjusted by the selection. void completeMove( in boolean forward, in boolean extend ); Parameters forward Forward or backward if PR_FALSE. extend Should it collapse the selection or extend it? completeScroll() Will move page view to the top or bottom of the document. void completeScroll( in boolean forward ); ...
...mplement. nsISelection getSelection( in short type ); Parameters type Will hold the type of selection. (SelectionType) Return value Will hold the return value. intraLineMove() Will move the selection to the front of the line or end of the line in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is ext
ended is considered the "focus" point, or the last point adjusted by the selection. void intraLineMove( in boolean forward, in boolean extend ); Parameters forward Forward or backward if PR_FALSE. extend Should it collapse the selection or extend it? lineMove() Will move the selection one line forward/backward in the document. This will also have the effect of collaps...
...And 3 more matches
WebGLRenderingContext.bufferData() - Web APIs
Buffer used for pixel transfer operations. size A GLsizeiptr setting the size in bytes of the buffer object's data store. srcData Optional An ArrayBuffer, SharedArrayBuffer or one of the ArrayBufferView typed array types that will be copied into the data store. If null, a data store is still created, but the content is uninitialized and undefined. ...
... data store. srcData Optional An ArrayBuffer, SharedArrayBuffer or one of the ArrayBufferView typed array types that will be copied into the data store. If null, a data store is still created, but the content is uninitialized and undefined. usage A GLenum specifying the int
ended usage pattern of the data store for optimization purposes. ...
...tore is still created, but the content is uninitialized and undefined. usage A GLenum specifying the int
ended usage pattern of the data store for optimization purposes. Possible values: gl.STATIC_DRAW: The contents are int
ended to be specified once by the application, and used many times as the source for WebGL drawing and image specification commands. gl.DYNAMIC_DRAW: The contents are int
ended to be respecified repeatedly by the application, and used many times as the source for WebGL drawing and image specification commands. gl.STREAM_DRAW: The contents are int
ended to be specified once by the application, and used at most a few times as the source for WebGL drawing and image specification commands. When using a WebGL 2 context, the following values are available additionally: ...
...And 3 more matches
ARIA: listbox role - Accessibility
r may select one or more items which are static and, unlike HTML <select> elements, may contain images. Description The listbox role is used to identify an element that creates a list from which a user may select one or more static items, similar to the HTML <select> element. Unlike <select>, a listbox can contain images. Each child of a listbox should have a role of option. It is highly recomm
ended to use the HTML select element, or a group of radio buttons if only one item can be selected, or a group of checkboxes if multiple items can be selected, because there is a lot of keyboard interactivity to manage focus for all the descendants, and native HTML elements provide this functionality for you for free. Elements with the role listbox have an implicit aria-orientation value of vertical. ...
...ng with that entire string). If the current item has an associated context menu, Shift+F10 will launch that menu. If list items are checkable, Space can be used to toggle checkboxes. For selectable list items, Space toggles their selection, Shift+Space can be used to select contiguous items, Ctrl+Arrow moves without selecting, and Ctrl+Space can be used to select non-contiguous items. It is recomm
ended that a checkbox, link or other method be used 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 posi...
... 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. ...
...And 3 more matches
WebAssembly.Instance - JavaScript
for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsInstanceChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Instance() constructorChrome Full support ...
...odejs Full support 8.0.0Instance() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...And 3 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
bled While not appropriate for all elements, you can use the disabled attribute to temporarily disable input to an element that is normally operable by the user. Typically, elements with the disabled="true" attribute will appear as either transparent or pale gray. Note: With attributes like hidden, collapsed, and disabled, which take Boolean values, setting disabled="false" in XUL can have unint
ended consequences. This is because there may be cases where a script or CSS rule will be written in such a way that they treat the value as true unconditionally if any value has been set. So when changing the attribute's value using a DOM function for example, do not use setAttribute('disabled', false) -- instead, use removeAttribute('disabled'). tooltiptext Use the tooltiptext attribute to display ...
...ot element used to define an ordinary window. This displays the same kind of window used for the Firefox browser window, the bookmark manager window, and many other windows. You can generally use the window element as your root element. page For sidebar panels and other XUL documents that are opened within inline frames, use the page element as the root element. Apart from having a different int
ended purpose than the window element, it is functionally no different. Root elements for dialog windows dialog Use the dialog element when creating options dialogs, confirmation dialogs, etc. This element takes a number of attributes, and can easily be made to display controls (buttons, etc) using widgets and layouts native to whatever platform it is running on. For example, Windows places the OK ...
... base.xul Appending elements When defining an XUL document to open as an overlay, use an overlay element as the root element. Save the text of Listing 24 as overlayDocument.xul in the same directory as base.xul. Here, we'll open base.xul in the Firefox window. overlayDocument.xul gets read in at the same time as base.xul, resulting in what we see in Figure 19, where overlayDocument.xul gets app
ended to the end of base.xul. <?xml version="1.0" encoding="UTF-8"?> <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <button label="Button 1"/> <button label="Button 2"/> <button label="Button 3"/> </overlay> Listing 24: overlayDocument.xul Figure 19: Output from listings 23 and 24 Merging and inserting elements By inserting id attributes into the elements ...
...And 2 more matches
Images, Tables, and Mysterious Gaps - Archive of obsolete content
d designs that are suddenly blowing apart in recent browsers. There's another obvious fix, which is to make sure your document doesn't trigger the "standards"rendering mode. You can do this by using a DOCTYPE that will trigger either "quirks" mode or "almost standards" mode, or not having a DOCTYPE appear in your document at all. The lack of a DOCTYPE will prevent validation, and so is not recomm
ended. For authors who are working with legacy documents, a "quirks" mode DOCTYPE is the best choice. In cases where an author is writing a new document or trying to migrate a design to be as standards-based as possible, then "almost standards" mode is probably a better choice. Of course, documents authored in XHTML Strict or HTML Strict will trigger the "standards" rendering mode, so we're going to g...
...nother cell of the table. Within the textthere is an icon <img src="icon2.gif"> that indicates a link to another site. It's very worldly. Lorem ipsum, dolor sit amet...</p></td></tr></table> As we see in Figure 8, that works well in some cases but not so well in others. The thin red line shows that the single-pixel spacer GIF is now only making the cell one pixel tall, as the designer int
ended. Unfortunately, the buttons in the top cell are all now block-level and so end up stacked on top of one another instead of being shown side-by-side. One potential solution is to add a class to any image that needs to be block-level and then write the rule to match. td img.decoration {display: block;} <td><img src="reddot.gif" class="decoration"></td> Depending on the design, though, that coul...
...hown side-by-side. One potential solution is to add a class to any image that needs to be block-level and then write the rule to match. td img.decoration {display: block;} <td><img src="reddot.gif" class="decoration"></td> Depending on the design, though, that could lead to a lot of classes added for this one simple effect. This would be especially true if there are many single-pixel cells int
ended to create cool stacked lines, or something like that. If you have markup that lends itself well to this approach, you could class the table rows instead of the images. Thus you might have: tr.decoration img {display: block;} ...along with the following change in the markup: <tr class="decoration"><td style="background: red;"> <img src="smallred.gif" height="1" width="1"> </td></tr> The result...
...And 2 more matches
Using XPInstall to Install Plugins - Archive of obsolete content
do not have to be digitally signed with a code-signing certificate. XPI Packages make use of different APIs from within install.js, although the concept is the same. XPInstall for Mozilla-based browsers is analogous to SmartUpdate in Netscape Communicator 4.x browsers. Porting SmartUpdate deployments to XPInstall is trivial after gaining some familiarity with the new XPInstall API. The Recomm
ended Installation Process XPInstall provides a cohesive API to accomplish rapid installation and setup of plugin software for end-users. The benefit of using XPInstall is to provide a streamlined installation mechanism. This section discusses what an ideal XPInstall Package will do, as well as points out some of the JavaScript API calls that you will make to accomplish these install tasks. An ideal X...
...efreshPlugins API. By refreshing your plugin, you're ensuring that the plugin is available for use immediately, without obliging the user to restart their browser. This is one of the chief advantages of a smooth XPInstall experience. The First Install Problem The First Install Problem refers to the conditions arising when a plugin arrives on a user's machine before a browser arrives. The recomm
ended install process addresses this issue, which is to install to a secondary location after installing to the current browser. In a nutshell, the first install problem can be summed up by the question: how can a browser which is installed on a user's machine after a given plugin has already been installed by the user benefit from the existing installation rather than download the same plugin again? I...
...d in the specification for these registry keys. On Windows, the Windows Registry keys mentioned above follow a nomenclature using the concept of a Plugin Identifier as the name of the key under the MozillaPlugins subkey. The Plugin Identifier (or PLID) is a useful concept that is also applicable when initializing the installation via the initInstall API. A Breakdown of the APIs Used The recomm
ended plugin installation process makes use of the XPInstall APIs to install to the current browser's Plugins directory, install to a secondary location, and to write to the Windows System Registry to disclose this secondary location. This section traces some of the XPInstall APIs that can do this. A complete template of an XPI Package is also presented in this section. Not all the work needs to be don...
...And 2 more matches
Archived Mozilla and build documentation - Archive of obsolete content
ort 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! ant script to assemble an extension This ant script helps to package an extension Archived SpiderMonkey docs This section contains old SpiderMonkey documentation. Autodial for Windows NT This document is int
ended to explain how the autodial helper feature implemented for bug 93002 works and why it works that way. Automated testing tips and tricks Automatic Mozilla Configurator Ankh8 Automatically Handle Failed Asserts in Debug Builds As of 2004-12-8, it is now possible to automatically handle failed asserts in debug builds of Mozilla for Windows. ...
...ng handy pointers to useful resources, bookmarks in Mozilla can be used to make the address bar itself a power tool. Searches, lookups, package tracking, and even word definitions can all be retrieved from user-customized bookmarks. Building TransforMiiX standalone calICalendarView An object implementing calICalendarView is generally int
ended to serve as a way of manipulating a set of DOM nodes corresonding to a visual representation of calIEvent and calITodo objects. Because of this close association between methods and attributes on the one hand, and content on the other, calICalendarView implementations are particularly well suited to XBL. There is, however, no practical obstacle to the interface being implemented...
...tion Framework: for powerful, easy to develop cross-platform applications Mozilla Crypto FAQ In this document I try to answer some frequently asked questions about the Mozilla web browser and mail/news client and its support for SSL, S/MIME, and related features based on cryptographic technology. Note that this document is for your information only and is not int
ended 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. Mozprocess mozprocess provides python process management via an operating system and platform transpare...
...And 2 more matches
RDF in Mozilla FAQ - Archive of obsolete content
pped. How do I create a datasource from an RDF/XML file? You can either create an RDF/XML datasource using the RDF service's GetDataSource() method: // Get the RDF service var RDF = Components .classes["@mozilla.org/rdf/rdf-service;1"] .getService(Components.interfaces.nsIRDFService); // ...and from it, get the datasource. ...
...ager var ds = Components .classes["@mozilla.org/rdf/datasource;1?name=xml-datasource"] .createInstance(Components.interfaces.nsIRDFDataSource); // The nsIRDFRemoteDataSource interface has the interfaces // that we need to setup the datasource. var remote = ds.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); // Be sure that your web server will deliver this as text/xml (recomm
ended) or text/rdf! remote.Init("http://www.mozilla.org/some-rdf-file.rdf"); // Make it load! Note that this will happen asynchronously. By setting // aBlocking to true, we could force it to be synchronous, but this // is generally 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 Yo...
...and Init() it with the datasource and resource as parameters. Note that this will fail if the resource isn't already a container. XUL Templates XUL templates are created by specifying a datasources attribute on an element in a XUL document. There are two "forms" that XUL templates may be written in. ...
...And 2 more matches
Introducing a complete toolchain - Learn web development
handcode the HTML, use "vanilla JavaScript" (meaning no frameworks or intermediary languages), and manually upload it all to a server for hosting. However, more complicated 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 int
ended -- 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 support 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 fi...
...t of the box, eslint is going to complain that it can't find the configuration file if you run it. The configuration file supports multiple formats but for this project we'll use .eslintrc.json (the leading period means the file is hidden by default). eslint is installed via npm, so as per discussions in Chapter 2, you have the choice to install this tool locally or globally. Using both is recomm
ended: For projects you intend to share, you should always include eslint as a local dependency so that anyone making their own copy can follow the rules you've applied to the project. You should also consider having eslint installed globally so that you can quickly use it to check any file you want. For the sake of simplicity, in this chapter we're not going to explore all the features of eslint...
...ing commas (a newer feature of ECMAScript that will cause errors in older browsers). You can find more about configuring Prettier in its documentation. Next up, we'll configure eslint -- create another file in the root of your will-it-miss directory called .eslintrc.json, and give it the following contents: { "env": { "es6": true, "browser": true }, "extends": "eslint:recomm
ended", "parserOptions": { "ecmaVersion": 6, "sourceType": "module" }, "rules": { "no-console": 0 } } The above eslint configuration says that we want to use the "recomm
ended" eslint settings, that we're going to allow usage of ES6 features (such as map() or Set()), that we can use module import statements, and that using console.log() is allowed. However, in the project's ...
...And 2 more matches
Add-on Repository
The Add-on Repository is responsible for finding available add-ons; it provides an interface for interacting with the addons.mozilla.org (AMO) site. Its API provides URLs that can be visited to browse the repository's add-ons. The API also offers two ways to search for and retrieve an array of Addon instances: retrieveRecomm
endedAddons(), which returns a list of recomm
ended add-ons, and searchAddons(), which performs a search of the repository. These searches are asynchronous; results are passed to the provided 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 tim...
...ication 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. ...
...at a time. A new search will immediately fail if the AddonRepository is already handling another search request. To import the Add-on Repository code module, use: Components.utils.import("resource://gre/modules/AddonRepository.jsm"); Method overview string getRecomm
endedURL() string getSearchURL(in string searchTerms) void cancelSearch() void retrieveRecomm
endedAddons(in integer maxResults, in SearchCallback callback) void searchAddons(in string searchTerms, in integer maxResults, in SearchCallback callback) Properties Property Type Description homepageURL string The URL of the repository site's home page. isSearching boolean true if a search is currently in progress; otherwise false. M...
...And 2 more matches
Index
ncy. 793 nsINavHistoryObserver Developing Mozilla, Extensions, Interfaces, Interfaces:Scriptable, Places, XPCOM, XPCOM API Reference, XPCOM Interface Reference The specified page and all its visits are about to be deleted. 794 nsINavHistoryQuery Developing Mozilla, Extensions, Interfaces, Places, XPCOM, XPCOM API Reference The nsINavHistoryQuery is not int
ended to be a super-general query mechanism. This was designed so that most queries can be done in only one SQL query. This is important because, if the user has their profile on a networked drive, query latency can be non-negligible 795 nsINavHistoryQueryOptions Developing Mozilla, Extensions, Interfaces, Interfaces:Scriptable, Places, XPCOM Interface Reference You can ask for the...
...terfaces, Interfaces:Scriptable, XPCOM, XPCOM Interface Reference Identifiers for programming languages. 844 nsIProgressEventSink Interfaces, Interfaces:Scriptable, XPCOM, XPCOM Interface Reference 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 int
ended to be displayed to the user in some meaningful way. 845 nsIPrompt Interfaces, Interfaces:Scriptable, XPCOM, XPCOM API Reference, XPCOM Interface Reference Normally you would use the prompt service as it is more flexible, but sometimes a callback will request an nsIPrompt via nsIInterfaceRequestor.getInterface(). To get an instance, call the nsIWindowWatcher.getNewPrompter(). ...
...ce. nsIRequestObserver contains two methods. So, in all the three methods - onDataAvailable(), nsIRequestObserver.onStartRequest() and nsIRequestObserver.onStopRequest() have to be implemented. 924 nsIStringBundle Interfaces, Interfaces:Scriptable, XPCOM, XPCOM API Reference, XPCOM Interface Reference This interface is used by XUL:stringbundle to retrieve strings. It is recomm
ended that you use the methods of XUL:stringbundle to access these functions unless necessary. Alternatively, a string bundle can be created within a javascript context with nsIStringBundleService. 925 nsIStringBundleOverride Interfaces, Interfaces:Scriptable, String bundles, XPCOM, XPCOM Interface Reference Implemented by: @mozilla.org/intl/stringbundle/text-override;1. To create ...
...And 2 more matches
Timing element visibility with the Intersection Observer API - Web APIs
ers, all we need to do is remove the ads from the set of visible ads (visibleAds) and mark them as inactive. To do so, we begin by saving the set of visible ads into a variable known as previouslyVisibleAds to be sure we can restore them when the user tabs back into the document, and we then empty the visibleAds set so they won't be treated as visible. Then, for each of the ads that are being susp
ended, we call our updateAdTimer() function, which handles updating the ad's total visible time counter, then we set their dataset.lastViewStarted property to 0, which indicates that the tab's timer isn't running. If the document has just become visible, we reverse this process: first we go through previouslyVisibleAds and set each one's dataset.lastViewStarted to the current document's time (in milli...
...e title and then we append the HTML from contents to that. Finally, nextArticleID is incremented (so that the next element gets a new unique ID) and we return the new <article> element to the caller. Creating an ad The loadRandomAd() function simulates loading an ad and adding it to the page. If you don't pass a value for replaceBox, a new element is created to contain the ad; the ad is then app
ended to the page. if you specify a replaceBox, that box is treated as an existing ad element; instead of creating a new one, the existing element is changed to contain the new ad's style, content, and other data. This avoids the risk of lengthy layout work being done when you update the ad, which could happen if you first delete the old element then insert a new one. function loadRandomAd(replaceBox)...
...ads would come from a database or, more likely, an advertising service from which you fetch ads using an API. However, our needs are simple: each ad is represented by an object with three properties: a background color (bgcolor), a title (title), and a body text string (body). Then we define several variables: adBox This will be set to the element that represents the ad. For new ads being app
ended to the page, this is created using Document.createElement(). When replacing an existing ad, this is set to the specified ad element (replaceBox). title Will hold the <h2> element representing the ad's title. body Will hold the <p> representing the ad's body text. timerElem Will hold the <div> element which contains the time the ad has been visible so far. A random ad is selected by comput...
...And 2 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
toggled on and off by the handler for click events on the button, whose label is appropriately set to either "Enter WebXR" or "Exit WebXR". This is done by the onXRButtonClick() event handler. async function onXRButtonClick(event) { if (!xrSession) { navigator.xr.requestSession(SESSION_TYPE) .then(sessionStarted); } else { await xrSession.end(); if (xrSession) { session
Ended(); } } } This begins by looking at the value of xrSession to see if we already have a XRSession object representing an ongoing WebXR session. If we don't, the click represents a request to enable WebXR mode, so we check to see if the desired WebXR session type is supported. If it is, we call sessionStarted() to begin running the scene in the WebXR session. If we already have an ongoing se...
... a request to enable WebXR mode, so we check to see if the desired WebXR session type is supported. If it is, we call sessionStarted() to begin running the scene in the WebXR session. If we already have an ongoing session, on the other hand, we call its end() method to stop the session. The last thing we do in this code is to check to see if xrSession is still non-NULL. If it is, we call session
Ended(), the handler for the end event. This code should not be necessary, but there appears to be an issue in which at least some browsers are not correctly firing the end event. By running the event handler directly, we complete the close-out process manually in this situation. Starting up the WebXR session The sessionStarted() function handles actually setting up and starting the session, by setti...
...ing and installing the GLSL code for the vertex and fragment shaders, and attaching the WebGL layer to the WebXR session before kicking off the rendering loop. It gets called as the handler for the promise returned by isSessionSupported(). ...
...And 2 more matches
<details>: The Details disclosure element - HTML: Hypertext Markup Language
t was toggled open */ } else { /* the element was toggled closed */ } }); Examples A simple disclosure example This example shows a <details> element with no provided summary. <details> <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 recomm
ended.</p> </details> In this situation, the browser will use a default summary string (usually "Details"). Here's what your browser does with it: Providing a summary This example adds a summary to the above example by using the <summary> element inside <details>, like this: <details> <summary>System Requirements</summary> <p>Requires a computer running an operating system. The computer mus...
...oes with it: Providing a summary This example adds a summary to the above example by using the <summary> element inside <details>, like this: <details> <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. An input device as well as some form of output device is recomm
ended.</p> </details> The result from this HTML is this: Creating an open disclosure box To start the <details> box in its open state, add the Boolean open attribute: <details open> <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. An input device as well as some form of...
...lt from this HTML is this: Creating an open disclosure box To start the <details> box in its open state, add the Boolean open attribute: <details open> <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. An input device as well as some form of output device is recomm
ended.</p> </details> This results in: Customizing the appearance Now let's apply some CSS to customize the appearance of the disclosure box. 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; } details > p { border-r...
...And 2 more matches
HTTP response status codes - HTTP
ore the response if the request is already finished. 101 Switching Protocol This code is sent in response to an Upgrade request header from the client, and indicates the protocol the server is switching to. 102 Processing (WebDAV) This code indicates that the server has received and is processing the request, but no response is available yet. 103 Early Hints This status code is primarily int
ended to be used with the Link header, letting the user agent start preloading resources while the server prepares a response. Successful responses 200 OK The request has succeeded. The meaning of the success depends on the HTTP method: GET: The resource has been fetched and is transmitted in the message body. HEAD: The entity headers are in the message body. PUT or POST: The resource des...
...eceived by the server 201 Created The request has succeeded and a new resource has been created as a result. This is typically the response sent after POST requests, or some PUT requests. 202 Accepted The request has been received but not yet acted upon. It is noncommittal, since there is no way in HTTP to later send an asynchronous response indicating the outcome of the request. It is int
ended for cases where another process or server handles the request, or for batch processing. 203 Non-Authoritative Information This response code means the returned meta-information is not exactly the same as is available from the origin server, but is collected from a local or a third-party copy. This is mostly used for mirrors or backups of another resource. Except for that specific case, the "200...
...est 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 300 Multiple Choice The request has more than one possible response. The user-agent or user should choose one of them. (There is no standardized way of choosing one of the responses, but HTML links to the possibilities are recomm
ended so the user can pick.) 301 Moved Permanently The URL of the requested resource has been changed permanently. The new URL is given in the response. 302 Found This response code means that the URI of requested resource has been changed temporarily. Further changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests. 303 See Other Th...
...And 2 more matches
The "codecs" parameter in common media types - Web media technologies
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 support ext
ended 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 5: Codec...
...rios in which resources are constrained, or resource use needs to be controlled to minimize the odds of the media performing poorly. 42 40 Baseline Profile (BP) Similar to CBP but with more data loss protections and recovery capabilities. This is not as widely used as it was before CBP was introduced. All CBP streams are considered to also be BP streams. 42 00 Ext
ended Profile (XP) Designed for streaming video over the network, with high compression capability and further improvements to data robustness and stream switching. 58 00 Main Profile (MP) The profile used for standard-definition digital television being broadcast in MPEG-4 format. Not used for high-definition television broadcasts. This profile's importance has faded since the i...
...6E 10 High 4:2:2 Intra Profile The Hi422 Profile with all-intra-frame use. 7A 10 High 4:4:4 Intra Profile The High 4:4:4 Profile constrained to use only intra frames. F4 10 CAVLC 4:4:4 Intra Profile The High 4:4:4 Profile constrained to all-intra use, and to using only CAVLC entropy coding. 44 00 Scalable Baseline Profile Int
ended for use with video conferencing as well as surveillance and mobile uses, the SVC Baseline Profile is based on AVC's Constrained Baseline profile. The base layer within the stream is provided at a high quality level, with some number of secondary substreams that offer alternative forms of the same video for use in various constrained environments. These may include any combination of reduced resol...
...And 2 more matches
Install Manifests - Archive of obsolete content
ve malformed ids. You should not use a real email address for your id, however, as it might attract spam. Note: The id property is optional in a WebExtension. If you do not provide an id, the Add-ons site will generate an id for your add-on automatically. Examples <em:id>extensionname@example.org</em:id> <em:id>{daf44bf7-a45e-4450-979c-91cf07434c3d}</em:id> name The name of the add-on; int
ended for display in the UI. Examples <em:name>My Extension</em:name> targetApplication An object specifying an application targeted by this add-on. This means that the add-on will work with the application identified by the id property (<em:id>) specified (for a comprehensive list of application IDs and valid min/maxVersions for them see Valid application versions for add-on developers), from the...
...ootstrapped extensions. contributor The name(s) of additional contributors. You may specify more than one of this value to specify multiple contributors. Examples <em:contributor>John Doe</em:contributor> <em:contributor>John Doe</em:contributor> <em:contributor>Jane Doe</em:contributor> <em:contributor>Elvis Presley</em:contributor> creator The name of the creator/principal developer - int
ended for display in the user interface. Examples <em:creator>John Doe</em:creator> or <em:creator>CoolExtension Team</em:creator> description A short description of the add-on - int
ended for display in the user interface. This description should fit on one short line of text. Examples <em:description>Advanced foo tools.</em:description> developer The name(s) of co-developers. You may specify...
... than one of this value to specify multiple developers. Examples <em:developer>Jane Doe</em:developer> <em:developer>Koos van der Merwe</em:developer> hasEmbeddedWebExtension If present and given the value "true", this indicates that this add-on contains an embedded WebExtension. <em:hasEmbeddedWebExtension>true</em:hasEmbeddedWebExtension> homepageURL A link to the add-on's home page - int
ended for display in the user interface. Examples <em:homepageURL>https://www.example.com/</em:homepageURL> iconURL A chrome:// URL to an icon to display in the add-ons list. The icon will be displayed at 32x32 in Firefox 3.6 and lower. In Firefox 4.0 and later the icon can be up to 48x48 pixels in size. If this property is not specified, a default icon is used. <em:iconURL>chrome://myext/skin/ico...
...m:updateKey> updateURL A link to a custom Update Manifest file that specifies available updates to the add-on. The format is described below. If enabled, the add-on manager periodically checks with this Manifest file to determine if newer versions are available. When not included, the add-on manager will still check for updates on AMO, using the ID of the extension. Note: It is strongly recomm
ended that the updateURL be an HTTPS (secure) link. Non-secure update URLs can be hijacked by a malicious update.rdf file, enabling malware to infiltrate the user's computer. Alternatively, you could host your extension on AMO and leave out the updateURL completely. This provides secure updates automatically. For security reasons, Gecko 1.9 applications require that if you specify an updateURL, it mu...
Menu - Archive of obsolete content
tBefore(newItems, target) item(target) popupOn(node) remove(target) replace(target, newItems) reset() set(items) show(anchorNode) add(items) Adds items to the menu. The position at which the items are added is at Jetpack's discretion. This method and set() are the recomm
ended methods of adding items to a menu. Parameters items A single menuitem or an array of menuitems. clear() Removes all items from the menu, even items not added by the feature. contextOn(node) Binds the menu to a given node as its context menu. Parameters node The menu is attached to this node, which may be either a raw DOM node or a DOM node wrapped by jQuery. hide(...
... the existing item to replace. See Targets. If no such target exists, the call silently fails. newItems A single menuitem or an array of menuitems. reset() Reverts all the changes to the menu that the feature has made. For menus that the feature creates, this is equivalent to clear(). set(items) Equivalent to calling reset() and then add(items). This method and add() are the recomm
ended methods of adding items to a menu. Parameters items A single menuitem or an array of menuitems. show(anchorNode) Shows the menu immediately. Parameters anchorNode The menu will pop up on this node, which may be either a raw DOM node or a DOM node wrapped by jQuery. Menuitems Menus in Jetpack contain Menuitem objects, including both built-in Firefox menus and menu...
...built-in Firefox menus and menus that features create. No Menuitem constructor is exposed, because Jetpack automatically boxes simple JavaScript objects into Menuitem objects. Creating menuitems To pass a new menuitem into the API, pass one of the following types: null A simple menu separator. (Note that any falsey value will suffice, including undefined, null, and the empty string. null is recomm
ended because it stands out.) function A menuitem that will update itself when its menu is shown. The function is invoked just before the item's menu is shown and when the items array of the item's menu is retrieved. It must return a non-function menuitem. If the item belongs to a context menu, the function is called as function(context) and otherwise function(). context is an object describing the con...
...certain menuitem is part of Firefox or provided by a feature, she does not know where to turn when she has problems with it. If many features' menus are local to one area, the user need not hunt and peck through many menus trying to find a particular item of a feature. No one likes it when add-ons clutter her Tools menu willy-nilly. It's less code. (OK, slightly less.) This is only a recomm
ended practice; developers are of course free to do as they wish. jetpack.menu.file The browser's File menu. A jetpack.Menu object. jetpack.menu.edit The browser's Edit menu. A jetpack.Menu object. jetpack.menu.view The browser's View menu. A jetpack.Menu object. jetpack.menu.history The browser's History menu. A jetpack.Menu object. jetpack.menu.bookmarks The browser's Bookmarks menu. A jetpack.Menu o...
confirm - Archive of obsolete content
onfirm Displays a modal confirmation 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, ext
ended confirm() method is supported starting with Gecko 1.8. It accepts any number of parameters up to 8. Previous Gecko versions only support the first, one-parameter method and will throw an error on occuring the ext
ended 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 ty...
...dard 'Yes' and 'No' buttons. Warning: do not make any assumptions on the button placement - the underlying implementation can freely decide where each of the three buttons is placed. The following examples show the result of calling confirm() with three buttons 0='A', 1='B' and 2='C'. Firefox on Linux Mozilla Application Suite on Win32 It is therefore recomm
ended to only use two buttons wherever possible, and to keep in mind that button 1 has the same return value as "window closed" (see below). aButton0Title Custom title for button 0. aButton1Title Custom title for button 1. aButton2Title Custom title for button 2. aCheckMsg A string to display as a checkbox label. aCheckState ...
...hird button Previous versions of the XPInstall API stated the return value of confirm() to be a Boolean. ...
...all API stated the return value of confirm() to be a Boolean. ...
Index - Archive of obsolete content
toolbar buttons and other user interface objects. The following articles provide details about implementing and working with toolbars. 956 Creating toolbar buttons (Customize Toolbar Window) Add-ons, Extensions, Firefox 3, Toolbars, XUL This article explains how to add a toolbar button to a Toolkit application (such as Firefox, Thunderbird, or Kompozer) using overlays. Its int
ended audience is extension developers with a basic knowledge of XUL and CSS. 957 Custom toolbar button Add-ons, Extensions, SeaMonkey, Toolbars, XUL, thunderbird This page tells you step-by-step how to make a custom toolbar button in Firefox, SeaMonkey 2.0, Thunderbird or Sunbird. (For SeaMonkey 1.x, see the page Custom Toolbar Button:SeaMonkey.) 958 Code Samples Ad...
... XUL The XULBrowserWindow object provides methods and properties that let the browser update the user interface of the enclosing XUL window. In order to do so it implements the following interfaces: 999 XUL Template Primer - Bindings Outdated articles, Outdated_articles, XUL This document expands on the XUL Template Primer by introducing the <bindings> element in the ext
ended XUL template syntax. 1000 XUL Tutorial Tutorials, XUL, XUL_Tutorial This tutorial describes XUL, the XML User-interface Language. This language was created for the Mozilla application and is used to describe its user interface. 1001 Accesskey display rules Localization Each controls of XUL can have an accesskey which is specified by accesskey attribute or...
...s for the user's platform. 1116 dialogheader XUL Elements, XUL Reference A heading row for a dialog box. This element should be placed inside a dialog element. The header may have a title and a description. 1117 dropmarker XUL Elements, XUL Reference A dropmarker is a button with an arrow which will reveal more details when pressed. A dropmarker is not int
ended to be used as a separate element, but as part of another element. For instance the menulist and the popup type of datepicker use a dropmarker, that when pressed, will reveal a popup menu. 1118 editor XUL Elements, XUL Reference A frame which is expected to contain an editable document. Set the value of the editortype attribute to html to create an editor document. Mozilla pro...
.... The user can adjust the position of the scroll bar by clicking arrows on either end of the scroll bar or by dragging the scroll bar thumb around. 1172 scrollbox NeedsContent, Reference, Reference(2), XUL Elements, XUL Reference A box that has additional functions that can be used to scroll the content. Note that a scrollbox doesn't cause scrollbars to be displayed. It is int
ended to be used when an application wants to be able to adjust the scroll position itself. If you just want scrollbars to appear, add style='overflow: auto;'. This may also be used with any other container element. 1173 scrollcorner XUL Elements, XUL Reference This element is used for the small box where the horizontal and vertical scrollbars meet. 1174 separator XU...
HTML: A good basis for accessibility - Learn web development
ures 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 importance of using semantic HTML (sometimes called POSH, or Plain Old Semantic HTML). This means using the correct HTML elements for their int
ended purpose as much as possible. You might wonder why this is so important. 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 site could be marked up like this: <div>Play video</div> But as you'll see in greater detail later on, it makes sense to use the correct eleme...
...This is nearly always a bad idea, as it can cause major confusion. Use it only if you really need to, for example, if the layout shows things in a very different visual order to the source code, and you want to make things work more log...
...velopers to add in extra semantics to their markup to improve screen reader accessibility where needed. To find out more about how it works, read our WAI-ARIA Basics article. Other text alternative mechanisms Images also have another mechanisms available for providing descriptive text. For example, there is a longdesc attribute that is meant to point to a separate web document containing an ext
ended description of the image, for example: <img src="dinosaur.png" longdesc="dino-info.html"> This sounds like a good idea, especially for infographics like big charts with lots of information on them that could perhaps be represented as an accessible data table instead (see Accessible data tables). However, longdesc is not supported consistently by screen readers, and the content is completely ina...
...uttons by setting href to "#" or "javascript:void(0)" to prevent the page from refreshing. These values cause unexpected behavior when copying or dragging links, opening links in a new tab or window, bookmarking, and when JavaScript is still downloading, errors out, or is disabled. This also conveys incorrect semantics to assistive technologies (e.g., screen readers). In these cases, it is recomm
ended to use a <button> instead. In general you should only use an anchor for navigation using a proper URL. External links and linking to non-HTML resources Links that open in a new tab or window via the target="_blank" declaration and links to whose href value points to a file resource should include an indicator about the behavior that will occur when the link is activated. People experiencing lo...
HTML: A good basis for accessibility - Learn web development
ures 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 importance of using semantic HTML (sometimes called POSH, or Plain Old Semantic HTML). This means using the correct HTML elements for their int
ended purpose as much as possible. You might wonder why this is so important. 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 site could be marked up like this: <div>Play video</div> But as you'll see in greater detail later on, it makes sense to use the correct eleme...
...This is nearly always a bad idea, as it can cause major confusion. Use it only if you really need to, for example, if the layout shows things in a very different visual order to the source code, and you want to make things work more log...
...velopers to add in extra semantics to their markup to improve screen reader accessibility where needed. To find out more about how it works, read our WAI-ARIA Basics article. Other text alternative mechanisms Images also have another mechanisms available for providing descriptive text. For example, there is a longdesc attribute that is meant to point to a separate web document containing an ext
ended description of the image, for example: <img src="dinosaur.png" longdesc="dino-info.html"> This sounds like a good idea, especially for infographics like big charts with lots of information on them that could perhaps be represented as an accessible data table instead (see Accessible data tables). However, longdesc is not supported consistently by screen readers, and the content is completely ina...
...uttons by setting href to "#" or "javascript:void(0)" to prevent the page from refreshing. These values cause unexpected behavior when copying or dragging links, opening links in a new tab or window, bookmarking, and when JavaScript is still downloading, errors out, or is disabled. This also conveys incorrect semantics to assistive technologies (e.g., screen readers). In these cases, it is recomm
ended to use a <button> instead. In general you should only use an anchor for navigation using a proper URL. External links and linking to non-HTML resources Links that open in a new tab or window via the target="_blank" declaration and links to whose href value points to a file resource should include an indicator about the behavior that will occur when the link is activated. People experiencing lo...
CSS FAQ - Learn web development
choose whether to show the document using a mode that is more compatible with Web standards or with old browser bugs. Using a correct and modern DOCTYPE declaration at the start of your HTML will improve browser standards compliance. Modern browsers have two main rendering modes: Quirks Mode: also called backwards-compatibility mode, allows legacy webpages to be rendered as their authors int
ended, following the non-standard rendering rules used by older browsers. Documents with an incomplete, incorrect, or missing DOCTYPE declaration or a known DOCTYPE declaration in common use before 2001 will be rendered in Quirks Mode. Standards Mode: the browser attempts to follow the W3C standards strictly. New HTML pages are expected to be designed for standards-compliant browsers, and as a result,...
...PE declaration will be rendered with Standards Mode. Gecko-based browsers, have a third Almost Standards Mode that has only a few minor quirks. This is a list of the most commonly used DOCTYPE declarations that will trigger Standards or Almost Standards mode: <!DOCTYPE html> /* This is the HTML5 doctype. ...
...tyle when you want to apply the styling rules to many blocks and elements within the page, or when you currently only have element to style with that style, but you might want to add more later. Use an id-specific style when you need to restrict the applied styling rules to one specific block or element. This style will only be used by the element with that particular id. It is generally recomm
ended to use classes as much as possible, and to use ids only when absolutely necessary for specific uses (like to connect label and form elements or for styling elements that must be semantically unique): Using classes makes your styling extensible -- even if you only have one element to style with a particular ruleset now, you might want to add more later. Classes allow you to style multiple elem...
...lculated can be found in the CSS 2.1 Specification chapter 6.4.3. What do the -moz-*, -ms-*, -webkit-*, -o-* and -khtml-* properties do? These properties, called prefixed properties, are extensions to the CSS standard. They allow use of experimental and non-standard features in browsers without polluting the regular namespace, preventing future incompatibilities to arise when the standard is ext
ended. The use of such properties on production websites is not recomm
ended -- they have already created a huge web compatibility mess. For example, many developers only using the -webkit- prefixed version of a property when the non-prefixed version is supported across all browsers meant that a feature relying on that property would break in non-webkit-based browsers, completely needlessly. This probl...
Sending form data - Learn web development
and a body that can contain information necessary for the server to process the specific request. The GET method The GET method is the method used by the browser to ask the server to send back a given resource: "Hey server, I want to get this resource." In this case, the browser sends an empty body. Because the body is empty, if a form is sent using this method the data sent to the server is app
ended to the URL. Consider the following form: <form action="http://www.foo.com" method="GET"> <div> <label for="say">What greeting do you want to say?</label> <input name="say" id="say" value="Hi"> </div> <div> <label for="to">Who do you want to say it to?</label> <input name="to" id="to" value="Mom"> </div> <div> <button>Send my greetings</button> </div> </form> Sin...
.../label> <input name="say" id="say" value="Hi"> </div> <div> <label for="to">Who do you want to say it to?</label> <input name="to" id="to" value="Mom"> </div> <div> <button>Send my greetings</button> </div> </form> Since the GET method has been used, you'll see the URL www.foo.com/?say=Hi&to=Mom appear in the browser address bar when you submit the form. The data is app
ended to the URL as a series of name/value pairs. After the URL web address has
ended, we include a question mark (?) followed by the name/value pairs, each one separated by an ampersand (&). In this case we are passing two pieces of data to the server: say, which has a value of Hi to, which has a value of Mom The HTTP request looks like this: GET /?say=Hi&to=Mom HTTP/2.0 Host: foo.com Note: Y...
... on GitHub -- see get-method.html (see it live also). The POST method The POST method is a little different. It's the method the browser uses to talk to the server when asking for a response that takes into account the data provided in the body of the HTTP request: "Hey server, take a look at this data and send me back an appropriate result." If a form is sent using this method, the data is app
ended to the body of the HTTP request. Let's look at an example -- this is the same form we looked at in the GET section above, but with the method attribute set to POST. <form action="https://www.foo.com" method="POST"> <div> <label for="say">What greeting do you want to say?</label> <input name="say" id="say" value="Hi"> </div> <div> <label for="to">Who do you want to say it to?</...
...We'll discuss these headers later on. Note: Yo...
Accessibility API cross-reference
ows GRIP n/a n/a n/a Probably a group box (titledbox in mozilla) GROUPING PANEL PANEL group <fieldset>, <div> A heading for a section of the page. In ARIA, the heading level is expressed with the aria-level attribute. heading <h1> ... <h6> <H1> ... <H6>. ...
... ROW_HEADER ROW_HEADER, TABLE_ROW_HEADER rowheader <th scope=row> vertical or horizontal scrollbar SCROLLBAR SCROLL_BAR SCROLL_BAR scrollbar A landmark region that contains a collection of items and objects that, as a whole, combine to create a search facility. search A type of textbox int
ended for specifying search criteria. searchbox A renderable structural containment unit in a document or application. section (abstract role) <section> <Sect> A structure that labels or summarizes the topic of its related section. sectionhead (abstract role) A form widget that allows ...
... available to javaScript as document.activeElement Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. n/a n/a aria-atomic Indicates whether inputting text could trigger display of one or more predictions of the user's int
ended value for an input and specifies how predictions would be presented if they are made. n/a n/a aria-autocomplete The control cannot accept input at this time. Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. BUSY BUSY BUSY aria-busy ...
... n/a n/a aria-controls Indicates the element that represents the current item within a container or set of related elements. n/a n/a aria-current Identifies the element (or elements) that describes the object. n/a n/a aria-describedby Identifies the element that provides a detailed, ext
ended description for the object. n/a n/a aria-details This is for expandable items that are not expanded, such as folded tree branches or accordions COLLAPSED COLLAPSED COLLAPSED aria-expanded=false Different from XUL's collapsed="true" attribute which indicates something is hidden This is the default button or menu item DEFA...
Configuring Build Options
lt software to be unusable. Build options, including options not usable from the command-line, may appear in "confvars.sh" files in the source tree. Using a mozconfig configuration file The choice of which Mozilla application to build and other configuration options can be configured in a mozconfig file. (It is possible to manually call configure with command-line options, but this is not recomm
ended). The mozconfig file should be in your source directory (that is, /mozilla-central/mozconfig or /comm-central/mozconfig). Create a blank mozconfig file: echo "# My first mozilla config" > 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 c...
...rations (see below for a full example). Note that in the export 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: export MOZCONFIG=$HOME/mozilla/mozconfig-firefox Calling the file .mozconfig (with a leading dot) is also supported, but this is not recomm
ended because it may make the file harder to find. This will also help when troubleshooting because people will want to know which build options you have selected and will assume that you have put them in your mozconfig file. mozconfig contains two types of options: Options prefixed with mk_add_options are passed to client.mk. The most important of these is MOZ_OBJDIR, which controls where your a...
...pplication you are building and what you will be using the build for. If you want to use the build regularly, you will want a release build without extra debugging information; if you are a developer who wants to hack the source code, you probably want a non-optimized build with extra debugging macros. There are many options recognized by the configure script which are special-purpose options int
ended for embedders or other special situations, and should not be used to build the full suite/XUL applications. The full list of options can be obtained by running ./configure --help. Warning: Do not use a configure option unless you know what it does. The default values are usually the right ones. Each additional option you add to your mozconfig file reduces the chance that your build will com...
...o speed up builds. This saves a considerable amount of time directly after a clobber build, so pulling in new updates and rebasing is less time-consuming. Example mozconfig Files Mozilla's official builds use mozconfig files from the appropriate directory within each repository. Warning: These mozconfig files are taken from production builds and are provided as examples only. It is recomm
ended to use the default build options, and only change the properties from the list above as needed. The production builds aren't really appropriate for local builds. Firefox, Debugging Build (Mac OS X 64bits) Thunderbird, Debugging Build (Linux 64 bits) Building multiple applications from the same source tree It is possible to build multiple applications from the same source tree, a...
InstallListener
Listeners are notified of an AddonInstall's progress. They may be registered to hear events from all AddonInstalls through addInstallListener or to a single AddonInstall through addListener. ...
...NewInstall(in AddonInstall install) void onDownloadStarted(in AddonInstall install) void onDownloadProgress(in AddonInstall install) void onDownload
Ended(in AddonInstall install) void onDownloadCancelled(in AddonInstall install) void onDownloadFailed(in AddonInstall install) void onInstallStarted(in AddonInstall install) void onInstall
Ended(in AddonInstall install, in Addon addon) void onInstallCancelled(in AddonInstall install) void onInstallFailed(in AddonInstall install) void onExternalInstall(in Addon install, in Addon existingAddon, in boolean needsRestart) Methods onNewInstall() Called when a new instance of AddonInstall is created, primarily so UI can display some kind of progress for all i...
... representing the install onDownloadProgress() Called as data is received during a download. Check the progress property for the amount of data downloaded and the maxProgress property for the total data expected. A listener may return false to cancel the download. void onDownloadProgress( in AddonInstall install ) Parameters install The AddonInstall representing the install onDownload
Ended() Called when downloading completes successfully for an add-on install. Only called for add-ons that need to be downloaded. void onDownload
Ended( in AddonInstall install ) Parameters install The AddonInstall representing the install onDownloadCancelled() Called when downloading is cancelled. Only called for add-ons that need to be downloaded. void onDownloadCancelled( in AddonInsta...
...d-ons that need to be downloaded. void onDownloadFailed( in AddonInstall install ) Parameters install The AddonInstall representing the install onInstallStarted() Called when installation of an add-on begins. A listener may return false to cancel the install. void onInstallStarted( in AddonInstall install ) Parameters install The AddonInstall representing the install onInstall
Ended() Called when installation of an add-on is complete. The newly installed add-on may require a restart in order to become active. void onInstall
Ended( in AddonInstall install in Addon addon ) Parameters install The AddonInstall representing the install addon The Addon addon that has been installed onInstallCancelled() Called when installation is cancelled. void onInstallCancelled(...
CustomizableUI.jsm
t 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 import it yourself: Components.utils.import("resource:///modules/CustomizableUI.jsm"); Introduction The module is int
ended 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 CustomizableUI through a listener mechanism. Areas Areas are parts of the user interface in whic...
...ced. CustomizableUI assumes that each area it is told about is present in every browser window. CustomizableUI is aware of two types of areas: toolbars and the menu panel. Areas are registered using the registerArea method and unregistered using the unregisterArea method. When a customizable toolbar's XBL binding is constructed (generally, that is when a <toolbar customizable="true"/> node is app
ended to the document and isn't invisible), the binding will call into CustomizableUI and register the toolbar's node as being one of the concrete instances of its area. For each area, CustomizableUI keeps track of a list of the widgets they contain, generally refered to as 'placements'. This is analogous to the old currentset attribute. If consumers make a change to the placements in an area, Customi...
... previous reset, restoring the state of the UI to the state prior to the reset. This can only be called immediately after reset(). If any of the UI is changed after calling reset(), then undoReset will be a no-op. removeExtraToolbar() Remove a custom toolbar added in a previous version of Firefox or using an add-on. NB: only works on the customizable toolbars generated by the toolbox itself. Int
ended for use from CustomizeMode, not by other consumers. Parameters aToolbarId the ID of the toolbar to remove getPlacementOfWidget() Get the placement of a widget. This is by far the best way to obtain information about what the state of your widget is. The internals of this call are cheap (no DOM necessary) and you will know where the user has put your widget. Parameters aWidgetId the I...
... an area to check for overflowable-ness Return value true if the area is overflowable, false otherwise setToolbarVisibility() Set a toolbar's visibility state in all windows. Parameters aToolbarId the ID of the toolbar whose visibility should be adjusted aIsVisible whether the toolbar should be visible getPlaceForItem() Obtain a string indicating the place of an element. This is int
ended for use from customize mode. You should generally use getPlacementOfWidget instead, which is cheaper because it does not use the DOM. Parameters aElement the DOM node whose place we need to check Return value "toolbar" if the node is in a toolbar, "panel" if it is in the menu panel, "palette" if it is in the (visible!) customization palette, undefined otherwise. isBuiltinToolbar() ...
Localizing with Koala
roject by going to File > New > New Project From Template... Choose "koala" in the Categories list. Choose "koala" in the Templates list. Choose a name for your project (e.g. l10n.kpf). Choose the directory in which the project will live in (e.g. C:\mozilla\l10n on Windows, /home/user/mozilla/l10n on Linux or /Users/user/mozilla/l10n on Mac OS X). Due to a bug in Koala (bug 21930), it is recomm
ended that you don't choose a path that contains spaces (like C:\Documents and Settings\user\...). Click "Open" to create the project. Koala will check for Mercurial. Make sure that your Mercurial installation is in your system's $PATH. Setup wizard will open. Configure the Application Choose "Firefox" as the application. Version: 3.6. Appname: browser. Included locale: en-US (this is the origin...
...http://bitbucket.org/mozillal10n/x-testing or http://hg.mozilla.org/releases/l10n-....9.2/x-testing. New localizations: URL: If you already have a repository set up by l10n-drivers (on BitBucket), t...
... e.g. http://bitbucket.org/mozillal10n/x-testing or http://hg.mozilla.org/releases/l10n-....9.2/x-testing. New localizations: URL: 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 recomm
ended to use Mercurial locally to version your local files. Just type a single dot (".") in the URL field to enable Mercurial support 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 ...
...l support 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 (recomm
ended), Koala will ask you if you wish to clone the remote repository. Click "OK" (even if you're creating a new localization and there is no remote repository). Existing localizations: if Koala fails to clone the remote repository, you will need to do it manually. Just open the console and issue the following commands: C:\Users\stas> cd C:\mozilla\l10n\locale\x-testing C:\mozilla\l10n\locale\x-testin...
Gecko Profiler FAQ
don't know. I think Julian Seward has done some measurements on this, I think. [ehsan] Try clicking the toolbar icon for the extension, expanding the Settings section, and enter the secret cheat code "," in the Threads field and click on "Apply (Restart Profiler)". This will capture all of the threads that the Gecko Profiler has been hooked to. This mode is usually recomm
ended when you want to find a thread you want to do more focused profiling on, so that you can find its name and then construct a more useful thread filter string based on the found thread name. How can I run (micro-?) benchmarks on the memory allocator to see if changes in it (or entire allocator replacements) are slower/faster? What you *don't* want to do is writing a micro-b...
...is going to affect and compare things before and after. [mstange] This question is more about benchmarking than about profiling. If you want to measure things, please measure without the profiler running, because the profiler can add its own overhead. How do we find performance regressions caused by third-party and system addons, especially ones that only show up after ext
ended uptime? By running into them. I wish I had a better answer to this question. In general, the Gecko Profiler is a profiling tool that helps you figure out what happens inside the browser as a performance issue is happening, it doesn't help with reproducing the performance issues in the first place. TaskTracer: how to diagnose dispatch delays? (a demo) TaskTrac...
... Currently not. Some functions (reflow, painting, JS excecution) insert the URL of the associated document into the call stack frame, so you can get a rough idea, but we don't have instrumentation at the tab/document/eventqueue level. For isolated profiles I recommend profiling a separate browser instance with only the tab that you're interested in. What are the recomm
ended native profilers across all OS's? Mac: Instruments; Linux: perf, zoom, callgrind; Windows: Concurrency Visualizer, VTune, xperf When to use Gecko profiler vs. native profilers? Gecko profiler: If you need JS callstacks or Gecko-specific instrumentation, or need to use any of its nifty UI features. Native profilers: If you're interested in lower-lev...
... ...
JSAPI reference
JSClass.flags JSClass.call JSClass.construct struct JSFunctionSpec struct JSPropertySpec JS_InitClass JS_LinkConstructorAndPrototype Added in SpiderMonkey 17 JS::PropertySpecNameIsSymbol Added in SpiderMonkey 38 JS::PropertySpecNameEqualsId Added in SpiderMonkey 38 JS::PropertySpecNameToPermanentId Added in SpiderMonkey 38 JS_GetReservedSlot JS_SetReservedSlot struct JSExt
endedClass Obsolete since JavaScript 1.8.5 struct JSObjectOps Obsolete since JavaScript 1.8.5 struct JSXMLObjectOps Obsolete since JavaScript 1.8.5 struct JSProperty Obsolete since JSAPI 16 Adding native properties and methods to classes: JSNative struct JSFunctionSpec JS_FS Added in SpiderMonkey 1.8 JS_FN Added in SpiderMonkey 1.8 JS_SYM_FN Added in SpiderMonkey 38 JS_FNINFO Added in Spid...
... JSClass method types: JSPropertyOp JSStrictPropertyOp Added in SpiderMonkey 1.9.3 JSDeletePropertyOp Added in SpiderMonkey 24 JSEnumerateOp JSNewEnumerateOp JSResolveOp JSConvertOp JSFinalizeOp JSHasInstance...
... JSIteratorOp Obsolete since JSAPI 26 JSEqualityOp Obsolete since JavaScript 1.8.5 JSObjectOp Obsolete since JavaScript 1.8.5 JSObjectOps method types: In JS 1.8.5, JSObjectOps has been made private. JSNewObjectMapOp Obsolete since JavaScript 1.8.5 JSObjectMapOp Obsolete since JavaScript 1.8.5 JSLookupPropOp Obsolete s...
... These stub functions can be used when creating a custom JSClass: JS_PropertyStub JS_StrictPropertyStub Added in SpiderMonkey 1.9.3 JS_ConvertStub Obsolete since JSAPI 37 JS_DeletePropertyStub Obsolete since JSAPI 37 JS_EnumerateStub Obsolete since JSAPI 37 JS_FinalizeStub Obsolete since JSAPI 15 JS_ResolveStub Obsolete since JSAPI 37 JSExt
endedClass method types: In JS 1.8.5, JSExt
endedClass has made private. JSIteratorOp Obsolete since JSAPI 26 JSEqualityOp Obsolete since JavaScript 1.8.5 JSObjectOp Obsolete since JavaScript 1.8.5 JSObjectOps method types: In JS 1.8.5, JSObjectOps has been made private. JSNewObjectMapOp Obsolete since JavaScript 1.8.5 JSObjectMapOp Obsolete since JavaScript 1.8.5 JSLookupPropOp Obsolete since JavaScript 1.8.5 JSDefinePropOp Obsole...
Components.utils.Sandbox
l = gBrowser.selectedTab.linkedBrowser.contentPrincipal; var sandbox = Components.utils.Sandbox(principal); Expanded principal An expanded principal is specified as an array of the principals it subsumes. Each item in the array should be an nsIPrincipal, a DOM window, or a URI. So this can be simply an array with a single element. ...
...ncipal An expanded principal is specified as an array of the principals it subsumes. Each item in the array should be an nsIPrincipal, a DOM window, or a URI. So this can be simply an array with a single element. For example the content principal above can be made expanded/ext
ended like so: var principal = [gBrowser.selectedTab.linkedBrowser.contentPrincipal]; // this is now an expanded (aka ext
ended) principal var sandbox = Components.utils.Sandbox(principal); Null principal You can create a null principal using code like: Cc["@mozilla.org/nullprincipal;1"].createInstance(Ci.nsIPrincipal); From Firefox 37 onwards, you can also specify the null principal by simply passing null as the principal argument. options The constructor accepts an optional parameter. This parameter is an object w...
...cripts should pass the window they're running in as this parameter, in order to ensure that the script is cleaned up at the same time as the content itself. sandboxName A string value which identifies the sandbox in about:memory (and possibly other places in the future). This property is optional, but very useful for tracking memory usage of add-ons and other JavaScript compartments. A recomm
ended value for this property is an absolute path to the script responsible for creating the sandbox. As of Gecko 13 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10), if you don't specify a sandbox name it will default to the caller's filename. sandboxPrototype A prototype object for the sandbox. The sandbox will inherit the contents of this object if it's provided. Passing a content window o...
...pt responsible for creating the sandbox. As of Gecko 13 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10), if you don't specify a sandbox name it will default to the caller's filename. sandboxPrototype A prototype object for the sandbox. The sandbox will inherit the contents of this object if it's provided. Passing a content window object, setting wantXrays:true (default) and using an ext
ended principal provides a clean, isolated execution environment in which javascript 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...
nsICookieService
remains until we can find a better home for it. Methods getCookieString() Get the complete cookie string associated with the URI. string getCookieString( in nsIURI aURI, in nsIChannel aChannel ); Parameters aURI The URI of the document for which cookies are being queried. aChannel The channel used to load the document. this parameter may be null, but it is strongly recomm
ended that a non-null value be provided 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 ns...
...StringFromHttp( 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 used to load the document. this parameter may be null, but it is strongly recomm
ended that a non-null value be provided to ensure that the cookie privacy preferences are honored. Return value Returns the resulting cookie string. setCookieString() Set the cookie string associated with the URI. Note: Should be able to allow null aPrompt, since nsIPrompt can be queried from aChannel. void setCookieString( in nsIURI aURI, in nsIPrompt aPrompt, in string aCookie, in...
...ookieString( in nsIURI aURI, in nsIPrompt aPrompt, in string aCookie, in nsIChannel aChannel ); Parameters aURI The URI of the document for which cookies are being queried. aPrompt The prompt to use for all user-level cookie notifications. aCookie The cookie string to set. aChannel The channel used to load the document. this parameter may be null, but it is strongly recomm
ended 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 supported, and setCookieS...
...he user originally typed in or clicked on to initiate the load of the document referenced by aURI. aPrompt The prompt to use for all user-level cookie notifications. aCookie The cookie string to set. aServerTime The expiry information of the cookie (the Date header from the HTTP response). aChannel The channel used to load the document. this parameter may be null, but it is strongly recomm
ended that a non-null value be provided to ensure that the cookie privacy preferences are honored. See also nsICookie nsICookie2 ...
nsIRequest
listed in descending order of precedence. Constant Value Description LOAD_BYPASS_CACHE 1 << 9 Force an end-to-end download of content data from the origin server. This flag is used for a shift-reload. LOAD_FROM_CACHE 1 << 10 Load from the cache, bypassing protocol specific validation logic. This flag is used when browsing via history. ...
...Consider, for example, a HTTP response with a "Cache-control: no-cache" header. According to RFC2616, this response must be validated before it can be taken from a cache. ...
...pending. isPending is true when there is an outstanding asynchronous event that will make the request no longer be pending. Requests do not necessarily start out pending; in some cases, requests have to be explicitly initiated (for example nsIChannel implementations are only pending once asyncOpen returns successfully). Requests can become pending multiple times during their lifetime. Note: Susp
ended 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 transport and will resume the delivery of data to any open streams. void resume(); Parameters None. suspend() Suspends the current request. This may have ...
...ng any underlying transport 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 transport (in order to free up resources), although any open streams remain logically opened and will continue delivering data when the transport is resumed. Calling cancel() on a susp
ended request must not send any notifications (such as onstopRequest) until the request is resumed. Note: Some implementations are unable to immediately suspend, and may continue to deliver events already posted to an event queue. In general, callers should be capable of handling events even after suspending a request. void suspend(); Parameters None. ...
Mozilla
unless the C++ object's class info has the flag nsIXPCScriptable::DONT_SHARE_PROTOTYPE set, but lets assume that's not the case here). js-ctypes js-ctypes allows application and extension code to call back and forth to native code written in C. C++ support is possible through vtable pointers see Using COM from js-ctypes. For a discussion on ext
ended C++ support see bug 505907. 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. Localization at Mozill...
... Preferences The preference system makes it possible to store data for Mozilla applications using a key/value pairing system. These articles provide information about how to use the preference system. Productization guide Productization is the choice of ''default'' search engines, content and protocol handlers, bookmarks, links to recomm
ended sites on the in-product pages, etc. The web services that make up the productization of Mozilla software are often specific to a local market. For example, a search provider can deliver a very good quality of search results -- but only in a specific country or language, and we have to take this into account when considering default search engines for a locale. Hence there is...
... going away (see bug 214675), so a new standalone Profile Manager application has been created, which works with any XULRunner application, and has many features not found in Firefox's built-in version. Redis Tips This document is a collection of some examples and tips for using redis, the open-source data structure server. It is int
ended primarily for developers, and deliberately omits some topics that will be important in any redis deployment, like security and backups. SeaMonkey SeaMonkey is Mozilla's all in one internet suite. These pages document SeaMonkey's MailNews component and also provide links to documentation about the MailNews backend which is also used ...
... Microsoft's symbol server so the documentation there can be useful. Virtualenv virtualenv is software for isolating python package environments (e.g. import paths). It is written by Mozilla's own Ian Bicking. Creating a virtualenv installs setuptools (or optionally distribute) into the virtual environment. It is recomm
ended 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...
HTMLMediaElement - Web APIs
dia element is allowed to have a remote playback UI. HTMLMediaElement.duration Read only A read-only double-precision floating-point value indicating the total duration of the media in seconds. If no media data is available, the returned value is NaN. If the media is of indefinite length (such as streamed live media, a WebRTC call's media, or similar), the value is +Infinity. HTMLMediaElement.
ended Read only Returns a Boolean that indicates whether the media element has finished playing. HTMLMediaElement.error Read only Returns a MediaError object for the most recent error, or null if there has not been an error. HTMLMediaElement.loop A Boolean that reflects the loop HTML attribute, which indicates whether the media element should start over when it reaches the end. HTMLMediaElement...
... play or not, or an empty string if the media cannot be played. HTMLMediaElement.fastSeek() Directly seeks to the given time. HTMLMediaElement.load() Resets the media to the beginning and selects the best available source from the sources provided using the src attribute or the <source> element. HTMLMediaElement.mozCaptureStream() [enter description] HTMLMediaElement.mozCaptureStreamUntil
Ended() [enter description] HTMLMediaElement.mozGetMetadata() Returns Object, which contains properties that represent metadata from the playing media resource as {key: value} pairs. A separate copy of the data is returned each time the method is called. This method must be called after the loadedmetadata event fires. HTMLMediaElement.pause() Pauses the media playback. HTMLMediaElement.play()...
...media, and estimates that enough data has been loaded to play the media up to its end without having to stop for further buffering of content. durationchange Fired when the duration attribute has been updated. emptied Fired when the media has become empty; for example, when the media has already been loaded (or partially loaded), and the HTMLMediaElement.load() method is called to reload it.
ended Fired when playback stops when end of the media (<audio> or <video>) is reached or because no further data is available. error Fired when the resource could not be loaded due to an error. loadeddata Fired when the first frame of the media has finished loading. loadedmetadata Fired when the metadata has been loaded loadstart Fired when the browser has started to load a resource. pause F...
...ed due to lack of data progress Fired periodically as the browser loads a resource. ratechange Fired when the playback rate has changed. seeked Fired when a seek operation completes seeking Fired when a seek operation begins stalled Fired when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming. suspend Fired when the media data loading has been susp
ended. timeupdate Fired when the time indicated by the currentTime attribute has been updated volumechange Fired when the volume has changed. waiting Fired when playback has stopped because of a temporary lack of data Specifications Specification Status Comment Encrypted Media ExtensionsThe definition of 'Encrypted Media Extensions' in that specification. Recomme...
NotificationEvent - Web APIs
Opera Full support 37Safari ? WebView Android No support NoChrome Android Full support 42Firefox Android ...
... Opera Full support 37Safari ? WebView Android No support NoChrome Android Full support 42Firefox Android ...
... Opera No support NoSafari ? WebView Android No support NoChrome Android Full support 48Firefox Android ...
... Opera Full support 37Safari ? WebView Android No support NoChrome Android Full support 42Firefox Android ...
SourceBuffer.mode - Web APIs
Segment timestamps are generated automatically for the segments that observe this order. The mode value is initially set when the SourceBuffer is created using MediaSource.addSourceBuffer(). ...
...Segment timestamps are generated automatically for the segments that observe this order. The mode value is initially set when the SourceBuffer is created using MediaSource.addSourceBuffer(). ...
...Segment timestamps are generated automatically for the segments that observe this order. The mode value is initially set when the SourceBuffer is created using MediaSource.addSourceBuffer(). ...
...ns The following exceptions may be thrown when setting a new value for this property. Exception Explanation InvalidAccessError An attempt was made to set the value to segments when the initial value is sequence. InvalidStateError The SourceBuffer object is being updated (i.e. its SourceBuffer.updating property is currently true), the last media segment app
ended to this SourceBuffer is incomplete, or this SourceBuffer has been removed from the MediaSource. Example This snippet sets the sourceBuffer mode to 'sequence' if it is currently set to 'segments', thus setting the play order to the sequence in which media segments are app
ended. var curMode = sourceBuffer.mode; if (curMode == 'segments') { sourceBuffer.mode = 'sequence'; } Specification...
Web Audio API best practices - Web APIs
mean a user-initiated event, normally a click event. Browser vendors decided that Web Audio contexts should not be allowed to automatically play audio; they should instead be started by a user. This is because autoplaying audio can be really annoying and obtrusive. But how do we handle this? When you create an audio context (either offline or online) it is created with a state, which can be susp
ended, running, or closed. When working with an AudioContext, if you create the audio context from inside a click event the state should automatically be set to running. Here is a simple example of creating the context from inside a click event: const button = document.querySelector('button'); button.addEventListener('click', function() { const audioCtx = new AudioContext(); }, false); If howev...
...ontext from inside a click event the state should automatically be set to running. ...
...tton = document.querySelector('button'); button.addEventListener('click', function() { const audioCtx = new AudioContext(); }, false); If however, you create the context outside of a user gesture, its state will be set to susp
ended and it will need to be started after user interaction. We can use the same click event example here, test for the state of the context and start it, if it is susp
ended, using the resume() method. ...
...ts state will be set to susp
ended and it will need to be started after user interaction. We can use the same click event example here, test for the state of the context and start it, if it is susp
ended, using the resume() method. const audioCtx = new AudioContext(); const button = document.querySelector('button'); button.addEventListener('click', function() { // check if context is in susp
ended state (autoplay policy) if (audioCtx.state === 'susp
ended') { audioCtx.resume(); } }, false); You might instead be working with an OfflineAudioContext, in which case you can resume the susp
ended audio context with the startRendering() method. User control If your website or application contains sound, you should allow the user control over it, otherwise again, it will become a...
Migrating from webkitAudioContext - Web APIs
rgument passed to start() to know whether playback has started or not. If you need to compare this attribute to PLAYING_STATE, you can compare the value of AudioContext.currentTime to the first argument passed to start() to know whether playback has started or not. ...
...hich is the most significant use case of playbackState), there is a new
ended event which you can use to know when playback is finished. Please see this code example: // Old webkitAudioContext code: var src = context.createBufferSource(); // Some time later... var isFinished = (src.playbackState == src.FINISHED_STATE); // New AudioContext code: var src = context.createBufferSource(); function
endedHandler(event) { isFinished = true; } var isFinished = false; src.on
ended =
endedHandler; The exact same changes have been applied to both AudioBufferSourceNode and OscillatorNode, so you can apply the same techniques to both kinds of nodes. Removal of AudioContext.activeSourceCount The activeSourceCount attribute has been removed from AudioContext. If you need to count the number of playin...
... Code using the activeSourceCount attribute of the AudioContext, like this snippet: var src0 = context.createBufferSource(); var src1 = context.createBufferSource(); // Set buffers and other parameters... src0.start(0); src1.start(0); // Some time later... ...
...nd of the array, // and set a handler to make sure it gets removed when the // AudioBufferSourceNode reaches its end. // First argument is the AudioBufferSourceNode to start, other arguments are // the argument to the |start()| method of the AudioBufferSourceNode. function startSource() { var src = arguments[0]; var startArgs = Array.prototype.slice.call(arguments, 1); src.on
ended = function() { sources.splice(sources.indexOf(src), 1); } sources.push(src); src.start.apply(src, startArgs); } function activeSources() { return sources.length; } var src0 = context.createBufferSource(); var src0 = context.createBufferSource(); // Set buffers and other parameters... startSource(src0, 0); startSource(src1, 0); // Some time later, query the ...
Using the Web Audio API - Web APIs
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.webkitAudioContext; const audioContext = new AudioContext(); So what's going on when we do this? A BaseAudioContext is created for us automatically and ext
ended to an online audio context. We'll want this because we're looking to play live sound. Note: If you just want to process audio data, for instance, buffer and stream it but not play it, you might want to look into creating an OfflineAudioContext. Loading sound Now, the audio context we've created needs some sound to play through it. There are a few ways to do this with the API. Let's begin wit...
...track.connect(audioContext.destination); A good way to visualise these nodes is by drawing an audio graph so you can visualize it. This is what our current audio graph looks like: Now we can add the play and pause functionality. ...
... these nodes is by drawing an audio graph so you can visualize it. This is what our current audio graph looks like: Now we can add the play and pause functionality. ...
... play or pause track depending on state if (this.dataset.playing === 'false') { audioElement.play(); this.dataset.playing = 'true'; } else if (this.dataset.playing === 'true') { audioElement.pause(); this.dataset.playing = 'false'; } }, false); We also need to take into account what to do when the track finishes playing. Our HTMLMediaElement fires an
ended event once it's finished playing, so we can listen for that and run code accordingly: audioElement.addEventListener('
ended', () => { playButton.dataset.playing = 'false'; }, false); Modifying sound Let's delve into some basic modification nodes, to change the sound that we have. This is where the Web Audio API really starts to come in handy. First of all, let's change the volume. This can...
Accessibility documentation index - Accessibility
se developed with JavaScript) more accessible to people with disabilities. It supplements HTML so that interactions and widgets commonly used in applications can be passed to assistive technologies 3 ARIA Screen Reader Implementors Guide ARIA, Accessibility This is just a guide. Live region markup is a complex area which is somewhat open to interpretation. The following is int
ended 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 int
ended meaning while supporting live regions as an area for screen readers to innovate and compete. 4 ARIA Test Cases ARIA, Accessibility For each example we test the "Expe...
...ML, HTML 4, JAWS, NeedsContent, aria-labelledby, label, solution, trouble shoot, troubleshoot The solution is in an ARIA attribute called aria-labelledby. Its parameter is a string that consists of the IDs of the HTML elements you want to concatenate into a single accessible name. 12 How to file ARIA-related bugs ARIA, Bugzilla The state of ARIA technology has always dep
ended on the community. 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 properti...
...ts on a page that provide equivalent functionality to an HTML form. 64 ARIA: grid role ARIA, HTML The grid role is for a widget that contains one or more rows of cells. The position of each cell is significant and can be focused using keyboard input. 65 ARIA: gridcell role ARIA, HTML The gridcell role is used to make a cell in a grid or treegrid. It is int
ended to mimic the functionality of the HTML td element for table-style grouping of information. 66 ARIA: heading role ARIA, ARIA Role, ARIA heading, Reference The heading role defines this element as a heading to a page or section. To give the page more structure, a level should also be provided to indicate relationships between sections. 67 ARIA: img role ARIA, ARI...
..., by nature, offer the same keyboard functionality that their desktop counterparts do. This document describes techniques to make JavaScript widgets accessible with the keyboard. 94 Mobile accessibility checklist Accessibility, Firefox OS, Guidelines, Mobile, checklist This document provides a concise checklist of accessibility requirements for mobile app developers. It is int
ended to continuously evolve as more patterns arise. 95 Understanding the Web Content Accessibility Guidelines WCAG, 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 Accessibility Guidelines 2.0 or 2.1 (or just WCAG, for the p...
Variable fonts guide - CSS: Cascading Style Sheets
the keyword bold (or any other keyword). This can generally be resolved fairly easily, but does require an extra step in writing your CSS: font-weight: 375; font-variation-settings: 'wght' 375; The following live example's CSS can be edited to allow you to play with font weight values. Width Width (represented by the wdth tag) defines the design axis of how narrow or wide (condensed or ext
ended, in typographic terms) the letterforms can be. This is typically set in CSS using the font-stretch property, with values expressed as a percentage above or below 'normal' (100%), any number greater than 0 is technically valid--though it is far more likely that the range would fall closer to the 100% mark, such as 75%-125%. If a number value supplied is outside the range encoded in the font, the b...
...eights, showing the typeface design more in line with the original intent. While this was originally done to compensate for the ink and paper printing process (very thin lines at small sizes often didn't print, giving the letterforms a broken appearance), it translates well to digital displays when compensating for screen quality and physical size rendering. Optical size values are generally int
ended to be automatically applied corresponding to font-size, but can also be manipulated using the lower-level font-variation-settings syntax. There is a new attribute, font-optical-sizing, created to support variable fonts in CSS. When using font-optical-sizing, the only allowed values are auto or none -- so this attribute only allows for turning optical sizing on or off. However when using font-var...
...nts in CSS. When using font-optical-sizing, the only allowed values are auto or none -- so this attribute only allows for turning optical sizing on or off. However when using font-variation-settings: 'opsz' <num>, you can supply a numeric value. In most cases you would want to match the font-size (the physical size the type is being rendered) with the opsz value (which is how optical sizing is int
ended to be applied when using auto). The option to provide a specific value is provided so that should it be necessary to override the default -- for legibility, aesthetic, or some other reason -- a specific value can be applied. font-optical-sizing: auto; font-variation-settings: 'opsz' 36; The following live example's CSS can be edited to allow you to play with optical size values. Custom axes...
...stom axes are just that: they can be any axis of design variation that the typeface designer imagines. There may be some that become fairly common -- or even become registered -- but only time will tell. Grade Grade may become one of the more common custom axes as it has a known history in typeface design. The practice of designing different grades of a typeface was often done in reaction to int
ended use and printing technique. The term 'grade' refers to the relative weight or density of the typeface design, but differs from traditional 'weight' in that the physical space the text occupies does not change, so changing the text grade doesn't change the overall layout of the text or elements around it. This makes grade a useful axis of variation as it can be varied or animated without causing r...
HTTP Index - HTTP
ontent-Encoding entity header is used to compress the media-type. When present, its value indicates which encodings were applied to the entity-body. It lets the client know how to decode in order to obtain the media-type referenced by the Content-Type header. 72 Content-Language HTTP, Headers, Reference The Content-Language entity header is used to describe the language(s) int
ended for the audience, so that it allows a user to differentiate according to the users' own preferred language. 73 Content-Length HTTP, Headers, Reference The Content-Length entity header indicates the size of the entity-body, in bytes, sent to the recipient. 74 Content-Location HTTP, Reference, header The Content-Location header indicates an alternate locati...
...nsecure-requests CSP, Content-Security-Policy, Directive, HTTP, Reference, Requests, Security, Upgrade, upgrade-insecure-requests The HTTP Content-Security-Policy (CSP) upgrade-insecure-requests directive instructs user agents to treat all of a site's insecure URLs (those served over HTTP) as though they have been replaced with secure URLs (those served over HTTPS). This directive is int
ended for web sites with large numbers of insecure legacy URLs that need to be rewritten. 106 CSP: worker-src CSP, Content-Security-Policy, Directive, HTTP, Reference, Security The HTTP Content-Security-Policy (CSP) worker-src directive specifies valid sources for Worker, SharedWorker, or ServiceWorker scripts. 107 Content-Security-Policy-Report-Only CSP, HTTP, HTTPS...
..., Reference, WebSockets The HTTP 101 Switching Protocols response code indicates the protocol the server is switching to as requested by a client which sent the message including the Upgrade request header. 220 103 Early Hints Draft, HTTP, Informational, NeedsCompatTable, NeedsContent, Status code The HTTP 103 Early Hints information response status code is primarily int
ended to be used with the Link header to allow the user agent to start preloading resources while the server is still preparing a response. 221 200 OK HTTP, Status code, Success The HTTP 200 OK success status response code indicates that the request has succeeded. A 200 response is cacheable by default. 222 201 Created HTTP, Reference, Status code, Success The ...
...ion header. 223 202 Accepted HTTP, Reference, Status code, Success response The HyperText Transfer Protocol (HTTP) 202 Accepted response status code indicates that the request has been received but not yet acted upon. It is non-committal, meaning that there is no way for the HTTP to later send an asynchronous response indicating the outcome of processing the request. It is int
ended for cases where another process or server handles the request, or for batch processing. 224 203 Non-Authoritative Information HTTP, HTTP Status Code, Reference, Status code, Successful response The HTTP 203 Non-Authoritative Information response status indicates that the request was successful but the enclosed payload has been modified by a transforming proxy from that of the...
Date.parse() - JavaScript
The Date.parse() method parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC or NaN if the string is unrecognized or, in some cases, contains illegal date values (e.g. 2015-02-31). It is not recomm
ended to use Date.parse as until ES5, parsing of strings was entirely implementation dependent. There are still many differences in how different hosts parse date strings, therefore date strings should be manually parsed (a library can help if many different formats are to be accommodated). 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 Direct call: ...
... 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 Direct call: Date.parse(dateString) Implicit call: new Date(dateString) Parameters dateString A string representing a simplification of the ISO 8601 calendar date ext
ended format. (Other formats may be used, but results are implementation-dependent.) Return value A number representing the milliseconds elapsed since January 1, 1970, 00:00:00 UTC and the date obtained by parsing the given string representation of a date. If the argument doesn't represent a valid date, NaN is returned. Description The parse() method takes a date string (such as "2011-10-10T14:48:...
...e string (such as "2011-10-10T14:48:00") and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC. This function is useful for setting date values based on string values, for example in conjunction with the setTime() method and the Date object. Date Time String Format The standard string representation of a date time string is a simplification of the ISO 8601 calendar date ext
ended format. (See the section Date Time String Format in the ECMAScript specification for more details.) For example, "2011-10-10" (date-only form), "2011-10-10T14:48:00" (date-time form), or "2011-10-10T14:48:00.000+09:00" (date-time form with milliseconds and time zone) can be passed and will be parsed. When the time zone offset is absent, date-only forms are interpreted as a UTC time and date-time...
...new Date('foo-bar 2014').toString(); // returns: "Invalid Date" Date.parse('foo-bar 2014'); // returns: NaN Differences in assumed time zone This section contains implementation-specific behavior that can be inconsistent across 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 ext
ended 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 supported 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 form...
WebAssembly.CompileError - JavaScript
AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsCompileErrorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0CompileError() constructorChrome Full support ...
...s Full support 8.0.0CompileError() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.LinkError - JavaScript
or AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsLinkErrorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0LinkError() constructorChrome Full support ...
...dejs Full support 8.0.0LinkError() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.RuntimeError - JavaScript
AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsRuntimeErrorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0RuntimeError() constructorChrome Full support ...
...s Full support 8.0.0RuntimeError() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
Web video codec guide - Web media technologies
general codec options, the encoder could be configured to reduce the frame rate, to clean up noise, and/or to reduce the overall resolution of the video during encoding. Effect of codec configuration on encoded output The algorithms used do encode video typically use one or more of a number of general techniques to perform their encoding. Generally speaking, any configuration option that is int
ended to reduce the output size of the video will probably have a negative impact on the overall quality of the video, or will introduce certain types of artifacts into the video. It's also possible to select a lossless form of encoding, which will result in a much larger encoded file but with perfect reproduction of the original video upon decoding. In addition, each encoder utility may have variatio...
...ks within the image Supported frame sizes Up to 8,192 x 4,320 pixels Supported color modes Some of the more common or interesting profiles: Profile Color depths Chroma subsampling Constrained Baseline (CBP) 8 4:2:0 Baseline (BP) 8 4:2:0 Ext
ended (XP) 8 4:2:0 Main (MP) 8 4:2:0 High (HiP) 8 4:0:0 (greyscale) and 4:2:0 Progressive High (ProHiP) 8 4:0:0 (greyscale) and 4:2:0 High 10 (Hi10P) 8 to 10 4:0:0 (greyscale) and 4:2:0 High 4:2:2 (Hi422P) 8 to 10 4:...
...or each of your videos? The ability to provide a fallback option vastly simplifies the decision-making process. Are there any browsers you're willing to sacrifice compatibility with? How old is the oldest version of web browser you need to support? For example, do you need to work on every browser shipped in the past five yeras, or just the past one year? In the sections below, we offer recomm
ended codec selections for specific use cases. For each use case, you'll find up to two reccommendations. If the codec which is considered best for the use case is proprietary or may require royalty payments, then two options are provided: first, an open and royalty-free option, followed by the proprietary one. If you are only able to offer a single version of each video, you can choose the format tha...
..., you'll find up to two reccommendations. If the codec which is considered best for the use case is proprietary or may require royalty payments, then two options are provided: first, an open and royalty-free option, followed by the proprietary one. If you are only able to offer a single version of each video, you can choose the format that's most appropriate for your needs.The first one is recomm
ended as being a good combnination of quality, performance, and compatibility. The second option will be the most broadly compatible choice, at the expense of some amount of quality, preformance, and/or size. Recommendations for everyday videos First, let's look at the best options for videos presented on a typical web site such as a blog, informational site, small business web site where videos are ...
systemLanguage - SVG: Scalable Vector Graphics
in BCP 47. systemLanguage is often used in conjunction with the <switch> element. If the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. Note: If several alternative language objects are enclosed in a <switch> and none of them matches, this may lead to situations where no content is displayed. It is thus recomm
ended to include a "catch-all" choice at the end of such a <switch> which is acceptable in all cases. The attribute evaluates to "true" if one of the language tags indicated by user preferences is a case-insensitive match or prefix (followed by a "-") of one of the language tags given in the value of this parameter. Otherwise it evaluates to "false". Note: The prefix matching rule does not imply that...
...ands a language with a certain tag, that the user will also understand all languages with the tag as prefix. If the attribute is not present, then it implicitly evaluates to "true". If a null string or empty string value is given, the attribute evaluates to "false". The prefix rule simply allows the use of prefix tags if this is the case. ...
...In this case, the attribute should only include en. ...
...In this case, the attribute should only include en. ...
SVG documentation index - SVG: Scalable Vector Graphics
ered. 15 SVG Core Attributes Attribute, Intermediate, Reference, SVG The SVG core attributes are all the common attributes that can be specified on any SVG element. 16 SVG Event Attributes Advanced, Attribute, Draft, Landing, NeedsUpdate, SVG Event attributes always have their name starting with "on" followed by the name of the event for which they are int
ended. They specifies some script to run when the event of the given type is dispatched to the element on which the attributes are specified. 17 SVG Presentation Attributes Attribute, Beginner, Draft, Reference, SVG SVG presentation attributes are CSS properties that can be used as attributes on SVG elements. 18 SVG Styling Attributes Attribute, Beginner, NeedsExampl...
...ix Filters, SVG, SVG Attribute the kernelMatrix attribute defines the list of numbers that make up the kernel matrix for the <feConvolveMatrix> element. 117 kernelUnitLength Filters, NeedsCompatTable, NeedsExample, SVG, SVG Attribute The kernelUnitLength attribute has two meanings based on the context it's used in. For lighting filter primitives, it indicates the int
ended distance for the x and y coordinates, for <feConvolveMatrix>, it indicates the int
ended distance between successive columns and rows in the kernel matrix. 118 kerning Deprecated, SVG, SVG Attribute The kerning attribute indicates whether the spacing between glyphs should be adjusted based on kerning tables that are included in the relevant font (i.e., enable auto-kerning) or ...
... image is managed. 232 unicode-range Deprecated, SVG, SVG Attribute The unicode-range attribute defines the range of ISO 10646 characters possibly covered by the glyphs in a font. 233 units-per-em Deprecated, SVG, SVG Attribute The units-per-em attribute specifies the number of coordinate units on the "em square", an abstract square whose height is the int
ended distance between lines of type in the same type size. 234 v-alphabetic Deprecated, SVG, SVG Attribute The v-alphabetic attribute defines indicates the alignment coordinate for glyphs to achieve alphabetic baseline alignment. 235 v-hanging Deprecated, SVG, SVG Attribute The v-hanging attribute indicates the alignment coordinate for glyphs to achieve hangin...
...ines a clipping path, to be used by the clip-path property. 304 <color-profile> Element, NeedsExample, Reference, SVG The <color-profile> element allows describing the color profile used for the image. 305 <cursor> Deprecated, Element, NeedsExample, Reference, SVG The <cursor> SVG element can be used to define a platform-independent custom cursor. A recomm
ended approach for defining a platform-independent custom cursor is to create a PNG image and define a cursor element that references the PNG image and identifies the exact position within the image which is the pointer position (i.e., the hot spot). 306 <defs> SVG, SVG Container The <defs> element is used to store graphical objects that will be used at a later time. Objects create...
Adding Events and Commands - Archive of obsolete content
more advanced event handling, you should read about Event Propagation. In a nutshell, events propagate from the root of the DOM tree all the way down to the target element and then all the way up back to the root, in the capture and bubble phases, respectively. You can capture and cancel events during any of these phases, provided that they aren't canceled before they reach the point where you int
ended to capture them. The addEventListener method allows you to control the phase where you want to handle an event, with the last argument of the function. In general, you should avoid adding event handlers in the capturing phase, or canceling events. This can lead to unexpected behavior for the user since most events have a default behavior associated to them. Custom events This is a very powerfu...
...manage through JavaScript. The broadcaster element can help you out in these cases. First you need to add a broadcaster element to your XUL code, as a child of a broadcasterset element. <broadcasterset id="xulschoolhello-broadcasterset"> <broadcaster id="xulschoolhello-online-broadcaster" /> </broadcasterset> These elements are completely invisible, so you can put them anywhere. It is recomm
ended that you have them at the top of the XUL code, along with script declarations and other invisible elements with as popupset and commandset. Then you need to identify which of your XUL elements will be linked to this broadcaster, using the observes attribute: <menuitem id="xulschoolhello-hello-menu-item" label="&xulschoolhello.hello.label;" accesskey="&xulschoolhello.helloItem.accesskey;" ...
...he DOM or not. For example, if you have a customizable toolbar, you can't be sure if a given button is present or not, so it's easier to use a broadcaster. This way you only need to set values to the broadcaster instead of having to check if the button is there or not. Commands The command element is a specialized type of broadcaster, meant to be used with the oncommand event. This is the recomm
ended way of centralizing common UI behavior in Firefox and extensions. Commands are heavily used in Firefox, as a quick look into the DOM Inspector should show. Their behavior is identical as broadcaster elements, but they should be used when oncommand is one of the shared attributes. Our menu example is in fact better suited for a command. <commandset id="xulschoolhello-commandset"> <command id="...
The Essentials of an Extension - Archive of obsolete content
atch, 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 Reporter. 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 recomm
ended, 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 a disabled state. The chrome.manifest File Chrome is the set of user interface elements of the application window that are outside of a window's content area. Toolbars, menu bars, p...
...is the id of the menu element that corresponds to the Add-ons menu item in the main menu. We'll see later how we can find out things like the ids of browser elements, but for now let's look at the elements that compose the Hello World menu. For the classic menu, we added the Hello World menu right in the "root" of the menu so that it would be very easy for you to spot it, but this is not a recomm
ended practice. Imagine if all extensions added menus to the top menu; having a few extensions would make it look like an airplane dashboard, full of knobs and switches. In the case of the unified menu, things are a little more difficult due to lack of options. If your menu item fits in the Web Developer section, it is recomm
ended that you add it there. Otherwise, the root menu might be your only recou...
...ne if all extensions added menus to the top menu; having a few extensions would make it look like an airplane dashboard, full of knobs and switches. In the case of the unified menu, things are a little more difficult due to lack of options. If your menu item fits in the Web Developer section, it is recomm
ended that you add it there. Otherwise, the root menu might be your only recourse. ...
User Notifications and Alerts - Archive of obsolete content
The "remember password" prompt is the one that shows up the most often. They are thin boxes that appear from beneath the tab list and above the page content, with some text and maybe a few buttons. This kind of notification is implemented with a notificationbox. This kind on notification is very easy to implement, it doesn't interrupt the user and is easy to read and dismiss, so it is our recomm
ended way of displaying alerts and notifications. There's a catch, though: these notifications are inside the current tab, so switching tabs will make a notification disappear. The notification shows up again when you come back to the tab that displayed it. This means that these notifications make the most sense when they are related to the page currently being displayed, such as a page trying to insta...
...e.getString("xulschoolhello.greeting.label"); alertsService.showAlertNotification( "chrome://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 recomm
ended that you use a medium, fixed size. The main disadvantage of using alerts is that support for the Alerts Service is not guaranteed for all platforms and Firefox versions. Support for Windows has existed since Firefox 2. For Mac OS X, support 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...
...tab events in order to know when to re-display your alert. Another problem you need to take into account is that transparency of 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 recomm
ended location for an alert, because it normally doesn't block the part of the content where the user is reading, or the most important parts of page content, such as menus and titles. Remember this is not a recomm
ended 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 alert...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
and I could prove otherwise every time. Like other designers and html whizzes, I became a master at manipulating and troubleshooting tables, nesting them in intricate ways to produce any layout or effect that could be imagined. I remember one project for Lycos where we had nested tables 10 levels deep. I counted them myself. It wasn't that every level was absolutely necessary to reproduce the int
ended design effects. But each table ensured the flexibility we needed if certain modules and pieces of content appeared or disappeared. When you get to that point, the amount of markup you have to sift through to find anything becomes ridiculous. Until this redesign, Wired News wasn't even using CSS to style the content inside tables. The sheer amount [sic] of redundant <font> tags inside every cell w...
... units that would require too much to cover here. But positioning did allow the center column to fall first in the markup. It also guarantees each column will start in the same vertical position. To be fair, I did note two disadvantages of positioning. When one or more columns is positioned absolutely, there is no way to ensure a footer would always appear at the bottom of the longest column. We
ended up confining the footer to the width of the center column to avoid any possible overlap. The other disadvantage comes into play at small browser window sizes. While floats automatically reconfigure if they don't fit within the window width, absolute positioned columns always remain in the same place, even if it means content in one column begins to overlap another column. Both of these put togeth...
...would invalidate our markup. We don't make any claims about past archived content, but we've taken many efforts to make sure even stories from a few years ago are as valid as possible. While conversion to XHTML and CSS definitely shaved off development time that would have normally been spent manipulating the code, it didn't come entirely easy or without cost. Our engineer, Aaron Jones, actually
ended up rebuilding the majority of our Vignette templates from scratch. I ran into a steep learning curve, not with the Web standards themselves, but with the quirky rendering behaviors and inconsistencies in various browsers. Our writers and editors must get used to some new rules when generating the day's stories. Our management also has to accept the fact that some older or smaller browsers may be ...
JavaScript Client API - Archive of obsolete content
Client may be downloaded) a separate, conspicuous, and reasonably detailed privacy policy detailing how data collected or transmitted by your Third Party Client is managed and protected; (b) that your Third Party Client will only store data in encrypted form on the Firefox Sync servers operated by Mozilla; (c) that you and your Third Party Client will use the Firefox Sync APIs solely for their int
ended purpose; (d) that your Third Party Client will not hide or mask its identity as it uses the Services and/or Firefox Sync APIs, including by failing to follow required identification conventions; and (e) that you and your Third Party Client will not use the Firefox Sync APIs for any application or service that replicates or attempts to replicate the Services or Firefox Sync experience unless such ...
...mponents, including 3rd party extensions, to supplement the set of engines and synchronize their own data. A word of warning: the JavaScript Client API is still a young component and is continuing to evolve. Therefore, developers outside of the Sync core should know that their code could require significant refactoring in future releases. Before developing against the JavaScript API, it is recomm
ended to speak to developers of the API. See https://wiki.mozilla.org/Services/Sync for their contact information. To create a custom Sync engine to synchronize a new data you, you'll need to define an engine object that extends the base SyncEngine object. This involves writing types that extend the Store, Tracker, and Record types as well. It will be very helpful to look at an existing sync engine f...
...unique ID (unique among all records in the store) called GUID. Depending of what type of data you're working with, you might already have GUIDs built into your data that you can make use of (note that GUIDs must be allowed to change and should be URL friendly). If not, you may have to invent your own mapping from data objects to GUIDs as long as it's consistent. ...
Mozilla Application Framework in Detail - Archive of obsolete content
ed footprints and it minimizes download size for desktop browsers. Speed: Gecko has been designed for speed and is several times faster than previous versions of Internet browsing software. Standards Support: Gecko is the first browser technology to fully implement the latest W3C standards and enables developers to build rich, dynamic web pages and web-based applications that look and run as int
ended across a variety of platforms and devices. This saves developers time and money while allowing them to deliver state-of-the-art content and web applications. Gecko features full support for open Internet standards such as CSS1, HTML 4.0, DOM1, RDF, XML and JavaScript. Modular, Embeddable: Gecko's modular architecture enables developers to add or remove modules with little effort, fitting the sof...
...braries, that can be accessed from the browser or scripted from any Mozilla application. Applications that want to access the various Mozilla XPCOM libraries (networking, security, DOM, etc.) use a special layer of XPCOM called XPConnect, which reflects the library interfaces into JavaScript (or other languages). XPConnect glues the front end to the C++-based components in XPCOM, and it can be ext
ended to include scripting support for other languages: PyXPCOM already offers support for Python, Java is supported by JavaXPCOM, and there are efforts underway to add Perl and Ruby language support for XPConnect. On the developer side, XPCOM lets you to write components in C++, JavaScript, Python, or other languages for which special bindings have been created, and compile and run those components on...
...The technology that makes this possible, XPInstall, allows application developers to write JavaScript installations that manage special cross-platform installation archives (called XPIs, or "zippies"), in which packages such as new skins for the browser, patches, browser extensions, new Gecko-based applications, and third party standalone applications are ...
Mozilla Crypto FAQ - Archive of obsolete content
In this document I try to answer some frequently asked questions about the Mozilla web browser and mail/news client and its support for SSL, S/MIME, and related features based on cryptographic technology. Note that this document is for your information only and is not int
ended 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. 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 ...
.... of cryptographic software are the Export Administration Regulations (EAR), also known as 15 CFR chapter VII subchapter C, or 15 CFR Parts 730-774. ("CFR" stands for "Code of Federal Regulations.") The Export Administration Regulations were created by the Bureau of Export Administration (BXA) and were designed primarily to implement the requirements of the Export Administration Act of 1979 (as am
ended), also known as 50 USC appendices 2401-2420. ("USC" stands for "United States Code.") The EAA was passed as temporary legislation; however the President of the United States has periodically issued orders to continue the EAA and EAR, exercising authority under the International Emergency Economic Powers Act, also known as 50 USC 1701-1706. For more information see 15 CFR Part 730, section 730.2 ...
...o continue the EAA and EAR, exercising authority under the International Emergency Economic Powers Act, also known as 50 USC 1701-1706. For more information see 15 CFR Part 730, section 730.2 (concerning statutory authority for the EAR), and the document "Principal Statutory Authority for the Export Administration Regulations", which contains copies of the Export Administration Act of 1979 (as am
ended), the International Emergency Economic Powers Act (as am
ended), and related legislation and executive orders. I thought export of encryption software from the U.S. was governed by the International Traffic in Arms Regulations. What happened to the ITAR? The ITAR still exist, but are no longer used in the context of export control of encryption software; for this purpose they have been replaced ...
accesskey - Archive of obsolete content
y when listening to key events) Although the value is case insensitive, a letter with the case matching the accesskey attribute will be used if both cases exist in the label. Otherwise, if the label has two or more characters which are same as its accesskey, the first of those characters in the label will be underlined. If a label doesn't have the specified character, the character will be app
ended to the label with parentheses. For example, when an accesskey of an 'Open' label is 'A', the generated label will be 'Open (A)'. However, if the last character of the label is an ellipsis or a colon, the accesskey text is inserted before them. This allows a label of 'Open...' with an accesskey of 'A', to have a generated label of 'Open (A)...'. Similarly, when the label is 'Your Name:' and the ac...
...label is 'A', the generated label will be 'Open (A)'. However, if the last character of the label is an ellipsis or a colon, the accesskey text is inserted before them. This allows a label of 'Open...' with an accesskey of 'A', to have a generated label of 'Open (A)...'. Similarly, when the label is 'Your Name:' and the accesskey is 'B', the generated label will be 'Your Name (B):'. ...
...For consistency, this occurs for languages such as Japanese even if the labels have their accesskey characters. For example, when an the accesskey for an 'OK' button is 'O', and the accesskey for the button labeled '?????' (which means 'cancel') is 'C', the labels will be 'OK(O)' and '?????(C)'. ...
MenuModification - Archive of obsolete content
el of the menuitem, and the second argument is a value to associate with the item. This value be set as the menuitem's value attribute and can be used for whatever purpose is desired. Note how in this example, the menu does not have a child menupopup. The appendItem method will create a menupopup element if it doesn't already exist. If the menu already has a menupopup, the new menuitem will be app
ended to this existing one. While the appendItem method always adds the new item to the end of the menu, the insertItemAt method may be used in a similar fashion to insert an item into the menu elsewhere. menu.insertItemAt(0, "Delete", "delete"); In this example, the insertItemAt method is used to insert a new 'Delete' item at the beginning of the menu's popup. The first argument is the index where...
...trap.js in a bootstrapped addon) The addSubMenu function is called during the popupshowing event, which will be fired when an attempt to open the menu is made. This function retrieves a reference to the popup with the id 'file-popup'. A new element is created using the createElement method. The createElement method takes one argument, the tag of the element to create. This menu is created and app
ended to the popup. The label is set appropriately, and now, as we have a menu, we can use the appendItem method to append two items to the submenu. The effect is that a submenu with two items is added dynamically to the menu. The appendChild method is available for all elements, and is used to add new nodes within another node. The appendItem method is specific to menus, as well as some other specifi...
...ck if a node has any children. The first time the function is called, the hasChildNodes method will return false, however the second time, the method will return true as the items have already been added to the menu. Removing Items from a Menu To remove an item from the menu, use the removeItemAt method. It takes a single argument, the index of the item to remove. In this example, an item is app
ended to a menu, and then immediately removed again. menu.appendItem("Open", ""); menu.removeItemAt(menu.itemCount - 1); The itemCount property holds the number of items within the menu. To remove all of the items from a menu, you may wish to simply remove the menupopup directly, instead of removing each item individually. ...
Simple Query Syntax - Archive of obsolete content
ectly inside the <template> element. You can see that this code is much simpler than the full syntax. To understand how this works, let's examine how the builder processes a simple query. First, it evaluates the default query as above, except that no variables are used, or at least, not ones that are used externally. In reality, the builder could be considered to convert a simple query into an ext
ended query, so that it can be processed in the same way. After the default query statements are evaluated, the data network will look something like this: (?1 = http://www.xulplanet.com/rdf/myphotos, ?2 = http://www.xulplanet.com/ndeakin/images/t/palace.jpg) (?1 = http://www.xulplanet.com/rdf/myphotos, ?2 = http://www.xulplanet.com/ndeakin/images/t/canal.jpg) (?1 = http://www.xulplanet.com/rdf/myph...
...e a country set to 'http://www.daml.org/2001/09/countries/iso#IT'. Photos that do not have this country will not have any content generated for them. The attribute has a namespace that, when expanded, becomes 'http://www.xulplanet.com/rdf/country'. This syntax is much like how predicates are the specifed in the RDF/XML. This form of attribute syntax on a rule is equivalent to a <triple> in the ext
ended syntax. In fact, the builder will internally convert the attribute into the same compiled form that would be used for a <triple>. The equivalent triple for the above example might be: <triple subject="?photo" predicate="http://www.xulplanet.com/rdf/country" object="http://www.daml.org/2001/09/countries/iso#IT"/> Adjusting Simple Query Conditions The simple syntax is limited in...
...etElementById("photosList").builder.rebuild(); } This version of the applyFilter function only needs to set or remove the attribute on the rule as necessary. Note that the namespace aware functions (with the suffix NS) need to be used to set or remove attributes with namespaces. This example assumes that the rule has been given an id of 'filterRule'. Note that the menulist itself must use the ext
ended syntax since it doesn't iterate over the children of a resource. Filtering Using Multiple Tests As mentioned earlier, you can filter by several criteria by using multiple attributes. For instance: <rule id="filterRule" dc:title="Obelisk" r:country="http://www.daml.org/2001/09/countries/iso#IT"> This rule filters on two criteria which must both match. Rules will apply all the attr...
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
We assume that you're also familiar with the basics of creating Firefox extensions and have the Hello World extension working. Another tutorial, which walks you through the entire process from the beginning, is also available. Creating an overlay The first step is to create an overlay for the document containing the toolbar you wish to enhance. ...
...ar on all windows that mailWindowOverlay.xul is applied to (i.e. Main window and View Message window). This needs to be looked into. Adding the toolbar button Toolkit applications have customizable toolbars; therefore, it's common practice for extensions to add their toolbar buttons to the toolbar palette, rather than adding them directly to the toolbar. The latter is possible, but is not recomm
ended and is harder to implement. Adding a button to the toolbar palette is very easy. Just add code like this to your overlay: <toolbarpalette id="BrowserToolbarPalette"> <toolbarbutton id="myextension-button" class="toolbarbutton-1" label="&toolbarbutton.label;" tooltiptext="&toolbarbutton.tooltip;" oncommand="MyExtension.onToolbarButtonCommand(event);"/> </toolbarpalette> Notes: The...
...barPalette chrome://calendar/content/calendar.xul Sunbird - Main window calendarToolbarPalette More information XulPlanet.com references: <toolbarbutton>, <toolbaritem>. How to adjust toolbar button's label position A forum thread about adding an item to the toolbar (instead of just adding it to palette) right after an extension is installed. Note that this is not recomm
ended. There is another page on mdc with information about adding buttons to various windows in SeaMonkey. Includes useful information about overlays for ChatZilla. ...
Introduction to SSL - Archive of obsolete content
The SSL Handshake The new Internet Engineering Task Force (IETF) standard protocol called Transport 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 support TLS. Most other Red Hat products plan to support the protocol in future versions. This document is primarily int
ended for administrators of Red Hat server products, but the information it contains may also be useful for developers of applications that support 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...
...RSA Key Exchange Table 1 lists the cipher suites supported by SSL that use the RSA key-exchange algorithm. Unless otherwise indicated, all ciphers listed in the table are supported by both SSL 2.0 and SSL 3.0. Cipher suites are listed from strongest to weakest. Table 1. Cipher Suites Supported by the SSL Protocol That Use the RSA Key-Exchange Algorithm Strength Category and Recomm
ended Use Cipher Suites Strongest Cipher Suite Permitted for deployments within the United States only. This cipher suite is appropriate for banks and other institutions that handle highly sensitive data. Red Hat Console does not support this cipher suite. Triple DES With 168-Bit Encryption and SHA-1 Message Authentication Triple DES is the strongest cipher supported by SSL,...
...two classified ciphers developed by the federal government: Fortezza KEA and SKIPJACK. Fortezza ciphers for SSL use the Key Exchange Algorithm (KEA) instead of the RSA key-exchange algorithm mentioned in the preceding section, and use Fortezza cards and DSA for client authentication. Table 2. Cipher Suites Supported by Red Hat When Using Fortezza for SSL 3.0 Strength Category and Recomm
ended Use Cipher Suites Strong Fortezza Cipher Suites Permitted for deployments within the United States only. These cipher suites support encryption that is strong enough for most business or government needs. Red Hat Console does not support these cipher suites. RC4 With 128-bit Encryption and SHA-1 Message Authentication Like RC4 with 128-bit encryption and MD5 message authentication,...
Summary of Changes - Archive of obsolete content
This section outlines all of the element and practice updates described in this article. For a complete discussion of these items, see the sections in which they are described. ...
...1 margin-left: auto; margin-right: auto; for block-level elements deprecated bgcolor CSS1 background-color: ; non-standard EMBED HTML 4.01 OBJECT deprecated APPLET HTML 4.01 OBJECT non-standard MARQUEE HTML 4.01 DIV plus scripting non-standard BGSOUND HTML 4.01 OBJECT Proprietary or Deprecated Feature W3C Feature or Recomm
ended Replacement IE5+ id_attribute_value document.all.id_attribute_value document.all[id_attribute_value] DOM level 2: document.getElementById(id_attribute_value) IE5+ FormName.InputName.value DOM level 1: document.forms["FormName"].InputName.value IE5+ InputName.value DOM level 1: document.forms["FormName"].InputName.value ...
......e3-textContent IE5+ ElemRef.style.pixelTop DOM level 2: parseInt(ElemRef.style.top, 10) IE5+ ElemRef.style.pixelLeft = x; ElemRef.style.pixelTop = y; DOM level 2: ElemRef.style.left = x + "px"; ElemRef.style.top = y + "px"; IE5+ new ActiveXObject("Microsoft.XMLHTTP") new XMLHttpRequest() Proprietary or Deprecated Feature W3C Feature or Recomm
ended Replacement ...
Browser Detection and Cross Browser Support - Archive of obsolete content
f different strategies in use for detecting browsers is unlimited. As a member of the Netscape Evangelism team who has spent over a year investigating existing web content, I can say without a doubt that most compatibility problems found on the web today are due to a lack of understanding of the standards combined with inadequate and inappropriate browser detection strategies. This article is int
ended to provide an overview of browser detection strategies and best practices. For more specific Gecko recommendations, please see the Gecko Compatibility Handbook Gecko Although many web developers are aware of Firefox, Mozilla, and Netscape browsers, far fewer are aware that these browsers are members of an entire family of user agents based upon the Gecko layout engine which includes the commerc...
...ding the operating system being used, etc. Since the earliest browser detection techniques were based upon looking for a Netscape based browser and only provided customized content to browsers which used the Mozilla/version user agent string, other browser vendors standardized on using Mozilla/version to signal that they were compatible with a particular Netscape version. Since other browsers pret
ended to be Netscape browsers and encoded their version information in a non-standard fashion in the user agent comment area, the task of determining which browser was being used became more complicated than it should have been. Netscape Navigator 2 introduced the ability to run JavaScript in web browsers. As browser evolution continued, differences in the implementation of scripting and the objects s...
... more strictly adhers to the Standards). For new content, we recommend that you use a DOCTYPE which will invoke Standards mode in Gecko and Internet Explorer 6. This will ensure that your designs work similarly in these browsers as well as in any other browsers which support the Standards. Provide support for unknown browsers Always provide content and code paths for unknown browsers. The recomm
ended approach is to assume that any unknown browser supports the basic standards of HTML and CSS and to a certain extent JavaScript and the W3C DOM. This will guarantee that your content will be supported today and in the future by any browser which supports the standards. Limit the use of vendor/version specific features Authoring content which is standards compliant is the easiest way to support t...
Index - MDN Web Docs Glossary: Definitions of Web-related terms
mponent to make a "blackbox" out of the object. Because of this, a user of that class only needs to know its interface (that is, the data and functions exposed outside the class), not the hidden implementation. 130 Encryption Cryptography, Glossary, Privacy, Security In cryptography, encryption is the conversion of cleartext into a coded text or ciphertext. A ciphertext is int
ended to be unreadable by unauthorized readers. 131 Endianness Coding, CodingScripting, Glossary Endian and endianness (or "byte-order") describe how computers organize the bytes that make up numbers. 132 Engine CodingScripting, Glossary, NeedsContent The JavaScript engine is an interpreter that parses and executes a JavaScript program. 133 Entity ...
...t, reflows, and garbage collection. This means that long-running JavaScript functions can block the thread, leading to an unresponsive page and a bad user experience. 262 MathML CodingScripting, Glossary, MathML, Mathematical Markup Language, XML MathML (an XML application) is an open standard for representing mathematical expressions in webpages. In 1998 the W3C first recomm
ended MathML for representing mathematical expressions in the browser. MathML has other applications also including scientific content and voice synthesis. 263 Media Disambiguation, Glossary The term media is an overloaded one when talking about the web; it takes on different meanings depending on the context. 264 Media (Audio-visual presentation) Audio, Glossary, Me...
...The World Wide Web--commonly referred to as WWW, W3, or the Web--is an interconnected system of public webpages accessible through the Internet. The Web is not the same as the Internet: the Web is one of many applications built on top of the Internet. 505 Wrapper CodingScripting, Glossary, Wrapper In programming languages such as JavaScript, a wrapper is a function that is int
ended to call one or more other functions, sometimes purely for convenience, and sometimes adapting them to do a slightly different task in the process. 506 XForms CodingScripting, Glossary, Obsolete, XForms XForms is a convention for building Web forms and processing form data in the XML format. 507 XHR (XMLHttpRequest) API, Beginner, CodingScripting, Glossary, XMLH...
Responsive design - Learn web development
steps and CSS building blocks.) Objective: To understand the fundamental concepts and history of responsive design. Historic website layouts At one point in history you had two options when designing a website: You could create a liquid site, which would stretch to fill the browser window or a fixed width site, which would be a fixed size in pixels. These two approaches t
ended to result in a website that looked its best on the screen of the person designing the site! The liquid site resulted in a squashed design on smaller screens (as seen below) and unreadably long line lengths on larger ones. Note: See this simple liquid layout: example, source code. When viewing the example, drag your browser window in and out to see how this looks at different sizes. The fi...
...ction: example, source code. The viewport meta tag If you look at the HTML source of a responsive page, you will usually see the following <meta> tag in the <head> of the document. <meta name="viewport" content="width=device-width,initial-scale=1"> This meta tag tells mobile browsers that they should set the width of the viewport to the device width, and scale the document to 100% of its int
ended size, which shows the document at the mobile-optimized size that you int
ended. Why is this needed? Because mobile browsers tend to lie about their viewport width. This meta tag exists because when the original iPhone launched and people started to view websites on a small phone screen, most sites were not mobile optimized. The mobile browser would, therefore, set the viewport width to 960 pixel...
...p layout. Other mobile browsers (e.g. on Google Android) did the same thing. Users could zoom in and pan around the website to view the bits they were interested in, but it looked bad. You will still see this today if you have the misfortune to come across a site that does not have a responsive design. The trouble is that your responsive design with breakpoints and media queries won't work as int
ended on mobile browsers. If you've got a narrow screen layout that kicks in at 480px viewport width or less, and the viewport is set at 960px, you'll never see your narrow screen layout on mobile. By setting width=device-width you are overriding Apple's default width=960px with the actual width of the device, so your media queries will work as int
ended. So you should always include the above line of ...
Index - Learn web development
b content should be recognized as a paragraph, list, heading, link, image, multimedia player, form, or one of many other available elements or even a new element that you define. 225 HTML Cheatsheet Beginner, Draft, Guide, HTML While using HTML it can be very handy to have an easy way to remember how to use HTML tags properly and how to apply them. MDN provides you with an ext
ended HTML documentation as well as a deep instructional HTML how-to. However, in many cases we just need some quick hints as we go. That's the whole purpose of the cheatsheet, to give you some quick accurate ready to use code snippets for common usages. 226 HTML Tables <td>, <th>, <tr>, Article, Beginner, CodingScripting, Guide, HTML, Landing, Module, Tables A very common task in ...
...ages can be included, and how to embed video, audio, and even entire webpages. 244 Adding vector graphics to the Web Beginner, Graphics, Guide, HTML, Images, Learn, Raster, SVG, Vector, iframe, img This article has provided you with a quick tour of what vector graphics and SVG are, why they are useful to know about, and how to include SVG inside your webpages. It was never int
ended to be a full guide to learning SVG, just a pointer so you know what SVG is if you meet it in your travels around the Web. So don't worry if you don't feel like you are an SVG expert yet. We've included some links below that might help you if you wish to go and find out more about how it works. 245 From object to iframe -- other embedding technologies Article, Beginner, CodingScript...
...or building scalable, interactive web applications. Many modern companies use frameworks as a standard part of their tooling, so many front-end development jobs now require framework experience. 270 Accessibility in React Accessibility, Beginner, Frameworks, JavaScript, Learn, React, client-side, focus management, keyboard In our final tutorial article, we'll focus on (pun int
ended) accessibility, including focus management in React, which can improve usability and reduce confusion for both keyboard-only and screenreader users. 271 Adding a new todo form: Vue events, methods, and models Beginner, Forms, Frameworks, JavaScript, Learn, Methods, client-side, events, models, vue Excellent. We can now add todo items to our form! Our app is now starting to fe...
Test your skills: Loops - Learn web development
se of it, and we'd like you to do some research into what DOM APIs you need to successfully answer the questions. A good starting place is our Manipulating documents tutorial. Loops 1 In our first looping task we want you start by creating a simple loop that goes through all the items in the provided myArray and prints them out on the screen inside list items (i.e., <li> elements), which are app
ended to the provided list. Download the starting point for this task to work in your own editor or in an online editor. Loops 2 In this next task, we want you to write a simple program that, given a name, searches an array of objects containing names and 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 ...
...ditor. Loops 2 In this next task, we want you to write a simple program that, given a name, searches an array of objects containing names and 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; int
ended 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 report 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 --...
... contains a name to search for para -- contains a reference to a paragraph, which will be used to report 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; int
ended to be used as an iterator. para -- contains a reference to a paragraph, which will be used to report the results. isPrime() -- a function that, when passed a number, returns true if the number is a prime number, and false if not. You need to use a loop to go through the numbers 2 to 500 backwards (1 is not counted as a prime number), and run the provided isPrime() function on them. For each n...
Getting started with React - Learn web development
is an extra step in the development process, but many developers in the React community think that the readability of JSX is worthwhile. Plus, popular tooling makes the JSX-to-JavaScript compilation part of its setup process. You don't have to configure compilation yourself unless you want to. Because JSX is a blend of HTML and JavaScript, some developers find it intuitive. Others say that its bl
ended nature makes it confusing. Once you're comfortable with it, however, it will allow you to build user interfaces more quickly and intuitively, and allow others to better understand your codebase at a glance. To read more about JSX, check out the React team's JSX In Depth article. Setting up your first React app There are many ways to use React, but we're going to use the command-line interface ...
...ibed above. It's possible to add React 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 recomm
ended that you use the long-term support (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 ...
...ands mentioned in this tutorial. Gitbash (which comes as part of the git for Windows toolset) or Windows Subsystem for Linux (WSL) are both suitable. See Command line crash course for more information on these, and on terminal commands in general. Also bear in mind that React and ReactDOM produce apps that only work on a fairly modern set of browsers -- IE9+ by way of some polyfills. It is recomm
ended that you use a modern browser like Firefox, Safari, or Chrome when working through these tutorials. Also, see the following for more information: "What is npm" on nodejs.org "Introducing npx" on the npm blog The create-react-app documentation Initializing your app create-react-app takes one argument: the name you'd like to give your app. create-react-app uses this name to make a new dire...
Getting started with Svelte - Learn web development
e a quick introduction to the Svelte framework. We will see how Svelte works and what sets it apart from the rest of the frameworks and tools we've seen so far. Then we will learn how to setup our development environment, create a sample app, understand the structure of the project, and see how to run it locally and build it for production. Prerequisites: At minimum, it is recomm
ended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. Svelte is a compiler that generates minimal and highly optimized JavaScript code from our sources; you'll need a terminal with node + npm installed to compile and build your app. Objective: To setup a local Svelte development environment, create and build ...
...y more in-depth. It should take you about 30 minutes to complete. Use cases Svelte can be used to develop small pieces of an interface or whole applications. You can either start from scratch letting Svelte drive your UI or you can incrementally integrate it into an existing application. Nevertheless, Svelte is particularly appropriate to tackle the following situations: Web applications int
ended for low power devices: Applications built with Svelte have smaller bundle sizes, which is ideal for devices with slow network connections and limited processing power. Less code means less KB to download, parse, execute, and keep hanging around in memory. Highly interactive pages or complex visualizations: If you are building data-visualizations that need to display a large number of DOM element...
...lienate 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 import 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 recomm
ended that you use the long-term support (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 of npm, 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 gi...
Handling common accessibility problems - Learn web development
decide to remove the default focus styling using CSS, make sure you replace it with something else that fits in with your design better -- it is a very valuable accessiblity tool, and should not be removed. Building in keyboard accessibility Sometimes it is not possible to avoid losing keyboard accessibility. You might have inherited a site where the semantics are not very good (perhaps you've
ended up with a horrible CMS that generates buttons made with <div>s), or you are using a complex control that does not have keyboard accessibility built in, like the HTML5 <video> element (amazingly, Opera is the only browser that allows you to tab through the <video> element's default browser controls). You have a few options here: Create custom controls using <button> elements (which we can tab t...
...en you've only got a single table on a page; you could try WebAIM's table test page instead. Have a look at the WAI-ARIA live regions example we saw earlier, and note how the screen reader will keep reading out the constantly updating section as it updates. User testing As mentioned above, you can't rely on automated tools alone for determining accessibility problems on your site. It is recomm
ended that when you draw up your testing plan, you should include some accessibility user groups if at all possible (see our User Testing section earlier on in the course for some more context). Try to get some screenreader users involved, some keyboard-only users, some non-hearing users, and perhaps other groups too, as suits your requirements. Accessibility testing checklist The following list prov...
...ty user groups if at all possible (see our User Testing section earlier on in the course for some more context). Try to get some screenreader users involved, some keyboard-only users, some non-hearing users, and perhaps other groups too, as suits your requirements. Accessibility testing checklist The following list provides a checklist for you to follow to make sure you've carried out the recomm
ended accessibility testing for your project: Make sure your HTML is as semantically correct as possible. Validating it is a good start, as is using an Auditing tool. Check that your content makes sense when the CSS is turned off. Make sure your functionality is keyboard accessible. Test using Tab, Return/Enter, etc. Make sure your non-text content has text alternatives. An Auditing tool is good ...
Eclipse CDT Manual Setup
se associates with your files, and that in turn will significantly degrade the quality of the code assistance that Eclipse will provide after it next re-indexes the code. These requirements aren't a very good fit with the typical Mozilla developer's wish to minimize build times, implying parallelized, silenced builds. The consequences of the above observations are this: It is strongly recomm
ended that you invoke your normal (re)builds from the command line, externally of Eclipse. Below we will configure Eclipse's build step so that you use it only occasionally to manually trigger a special "build" (actually a fast script that fakes a build) purely for the purposes of setting/updating the compiler options that Eclipse associates with each source file. (Not using Eclipse to invoke your ...
...Something like $HOME/eclipse-workspaces/mozilla-tree-1, for example. After selecting an appropriate directory, click OK, then close the "Welcome" tab when the main Eclipse window opens. Before you proceed any further, check that ...
...ly parsed once section below to understand why this step is important for people who have their object directory outside their source tree.) Getting code assistance working You're now ready to get code assistance working. :-) Build option discovery This section requires that you have already built your mozilla source tree (so that you have an object directory for it), and it is strongly recomm
ended that the object directory is up to date so that the just-print-mozilla-build.py script runs quickly. As explained in the Code assistance section above, to provide good code assistance Eclipse CDT needs to collect build information for the source files by processing a build log from a full, clean build made using -j1 -w. Since such a non-parallel, full build would take a very long time, we're goi...
Storage access policy: Block cookies from trackers
proaches 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 to improve web compatibility, Firefox currently includes some heuristics to grant storage access automatically to third parties that receive user interaction. These heuristics are int
ended to allow some third-party integrations that are common on the web to continue to function. They are int
ended to be temporary and will be removed in a future version of Firefox. They should not be relied upon for current and future web development. Third-party storage access may be granted to resources that have been classified as tracking resources when a user gesture triggers a pop-up window th...
...le.com, foo.example.com, and example.com. When storage access is granted to tracker.example on example.com, all resources loaded from tracker.example on any top-level document loaded from example.com are immediately given storage access. This includes all resources loaded in the main context of the page, embedded <iframe>s, and resources loaded within embedded <iframe>s. Storage access is not ext
ended to other resources loaded on example.com (e.g. other-tracker.example), nor to other first parties on which tracker.example is embedded (e.g. example.org). Storage access grants extend into the first level of nested contexts, but no further. This means that <iframe>s embedded in the main context of the page and loaded from a domain classified as a tracker will have full access to all storage loca...
... storage access on multiple first parties, and the storage permission for each party expires independently. The above heuristics will also serve to extend the lifetime of a third-party storage permission on origins that have already been granted access. Each time the heuristic is activated, or a success call to the Storage Access API is made, the pre-existing storage access expiration will be ext
ended by 30 days, counting from the time the previous access was granted. Please note that in the future we expect to make changes to how long storage access will remain valid for. As mentioned before, the way to know that you will be able to use storage as a third-party going forward will be using the Storage Access API. Debugging We encourage site owners to test their sites, particularly those th...
Introduction to Layout in Mozilla
notifications Passes these to the style set object, who in turn passes to the frame constructor Frame constructor creates frames ConstructFrameInternal recursively walks content tree, resolves style and creates frames Either created by tag (<...
...ace Content sink maintains stack of "live" elements More buffering and fixup occurs here InsertChildAt, AppendChildTo, RemoveChildAt Frame Construction Content sink uses nsIDocument interface to notify of ?s in content model ContentApp
ended, ContentInserted, ContentRemoved PresShell is registered as document observer Receives ContentApp
ended, etc. notifications Passes these to the style set object, who in turn passes to the frame constructor Frame constructor creates frames ConstructFrameInternal recursively walks content tree, resolves style and creates frames Either created by tag (<select>) or by display type (<p>) Frame manager maintains mapping from content to frame Style Resolution Comp...
...responsiveness trade-off Frame construction runs to completion CSS parsing runs to completion Reflow runs to completion (mostly) Painting runs to completion Future (?) Tech Talks Content model and DOM - jst, jkeiser ...
Fonts for Mozilla 2.0's MathML engine
is required for some characters. Mozilla has general support for the common delimiters and arrows that have the necessary Unicode assignments. For other characters, Mozilla has font-specific support. 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. ...
...They are available under the SIL Open Font License and should be installed for best MathML rendering. ...
...f these products installed, Mozilla will be able to display some MathML reasonably even without STIX fonts. The font contains the necessary glyphs for stretchy operators but Mozilla does not yet make use of all of these. The license allows you to "use this font as permitted by the EULA for the product in which this font is included to display and print content", so consulting your lawyer is recomm
ended if considering installing this on systems without the associated product. Reset old preferences If users have previously changed the "font.mathfont-family" preference for a previous version of Mozilla, then it is best to reset this to the default value. To do this, enter the URL "about:config", "Filter" for "mathfont", and "Reset" to the default value through the context menu on the preference...
Mozilla Web Developer FAQ
PHA (U+03B1). If you are using a legacy encoding that cannot represent that character, you can use a numeric character reference: α. Likewise, to use a dingbat, you should use the appropriate Unicode character instead of trying to apply a dingbat font to an ASCII character. For example, to represent :), you should use WHITE SMILING FACE (U+263A). Why isn't Mozilla rendering my page as I int
ended? So my page isn't standards-compliant, but good browsers should render pages as the author int
ended anyway! Authors are supposed to communicate their intentions using the Web standards. Otherwise, finding out the intentions of each particular author would require psychic abilities which can't be implemented in software. Even in cases where a human could deduce the intention, doing so in software...
...e also other XHTML user agents that do not support externally defined character entities (other than the five pre-defined ones). Since non-validating XML processors are not required to support externally defined character entities (other than the five pre-defined ones), the use of externally defined character entities (other than the five pre-defined ones) is inherently unsafe in XML documents int
ended for the Web. The best practice is to use straight UTF-8 instead of entities. (Numeric character references are safe, too.) document.write() is not supported. The stream that is going into the parser can't be tampered with in mid-parse. Things that look like XML comments are treated as XML comments--even inside script or style elements. Elements need to be in the XHTML namespace in order ...
...ing processing instructions. I didn't find the answer I was looking for. Where should I ask? Try asking in the newsgroup relevant to your question in the comp.infosystems.www.authoring.* hierarchy or, if your question is about JavaScript/ECMAScript or the DOM, in comp.lang.javascript (after reading the group FAQs first, of course). Please do not ask Web authoring questions in the newsgroups int
ended for discussion about the development of Mozilla. comp.infosystems.www.authoring.html Web Authoring FAQ comp.infosystems.www.authoring.stylesheets FAQ ciwas stylesheet authoring FAQ comp.lang.javascript FAQ Original Document Information Author(s): Henri Sivonen (Please, no authoring questions to this address.) Last Updated Date: May 12, 2007 Copyright Information: Henri Sivonen ...
Python binding for NSS
if None is returned from the password callback the password prompting is terminated. nss.nss_shutdown_context now called from InitContext destructor, this assures the context is shutdown even if the programmer forgot to. It's still best to explicitly shut it down, this is just failsafe. Support was added for shutdown callbacks. ...
...ded optional family parameter. This is necessary for utilizing PR_GetAddrInfoByName(). NetworkAddress initialized via a string paramter are now initalized via PR_GetAddrInfoByName using family. Add NetworkAddress.address property to return the address sans the port as a string. NetworkAddress.str() includes the port. For IPv6 the a hex string must be enclosed in brackets if a port is app
ended to it, the bracketed hex address with app
ended with a port is unappropriate in some circumstances, hence the new address property to permit either the address string with a port or without a port. Fix the implementation of the NetworkAddress.family property, it was returning bogus data due to wrong native data size. HostEntry objects now support iteration and indexing of their NetworkAd...
...nality NetworkAddress initialized via a string paramter is now deprecated. AddrInfo should be used instead. NetworkAddress.set_from_string is now deprecated. AddrInfo should be used instead. NetworkAddress.hostentry is deprecated. It was a bad idea, NetworkAddress objects can support both IPv4 and IPv6, but a HostEntry object can only support IPv4. Plus the implementation depd
ended on being able to perform a reverse DNS lookup which is not always possible. HostEntry.get_network_addresses() and HostEntry.get_network_address() are now deprecated. In addition their port parameter is now no longer respected. HostEntry objects now support iteration and indexing of their NetworkAddress and that should be used to access their NetworkAddress objects instead. Internal...
Introduction to the JavaScript shell
es of code comprising the specified object. help([command ...]) Displays brief help information about the specified commands, or about all available functions if none are specified. intern(string) Internalizes the specified string into the atom table. Every string has a unique identifier, called an atom. This system makes it easier to do comparisons between strings. Note: This function is int
ended only for use when testing the JavaScript engine. line2pc([function, ] line) Returns the program counter value corresponding to the specified line of code. If function is specified, line is an offset into the specified function. load(filename1 [filename]) Loads the JavaScript files with the specified names. Note: For loading non-JavaScript files, use read(). options([option ...]) Lets you s...
...ll. status defaults to 0 if omitted. read(filename[, type]) Reads and returns the contents of file. If type is "binary" returns an Uint8Array, otherwise returns an UTF-8 decoded string. readline() Reads a single line of input from stdin, returning it to the caller. You can use this to create interactive shell programs in JavaScript. Reflect.parse() See Parser API. Note: This function is int
ended 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 supported. Returns true on success, false if the sleep was interru...
... 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 supported. 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_ReportError() function. Note: This function is int
ended 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 specified by pc in the function function is about to be executed, the expression is evaluated. This is a powerful debugging mechanism when used in concert with line2pc(). For example, if you want to display a message when ...
JSObjectOp
t 1.8.5This feature is obsolete. ...
...te. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. ...
...k in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. ...
SpiderMonkey 24
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. -- 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 Ext
ended Support Release 24" package on hg release Platform support SpiderMonkey 24 is supported on all the platforms where Firefox 24 runs. Compiling it requires a C++ compiler, and the JSAPI can only be used from C++ code. (This change was motivated by garbage collector improvements, which lean quite heavily on C++'s support for RAII through constructors and destructors.) If you are compiling with...
... embedders relying on embeddability in C projects will have to convert to C++, or implement their own adapter code. The following features in earlier versions of SpiderMonkey have been dropped. E4X, an extension to ECMAScript adding XML support, has been removed. The extension eventually became an evolutionary dead end, as TC39 chose not to incorporate it into ECMAScript proper. It is recomm
ended that you embed a separate XML parser, or include an XML parsing implementation written in JavaScript, as an alternative. JaegerMonkey has been removed and replaced by IonMonkey SpiderMonkey 24 is not binary-compatible with previous releases, nor is it source-code compatible. Many JSAPI types, functions, and callback signatures have changed, though most of them still have the same names and do ...
...se 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 support for versions of Visual Studio prior to 2010. In the meantime MOZ_CUSTOM_STDINT_H is int
ended 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 JS_GetArrayPrototype provides access to the original value of Array.prototype. New C++ helpers While JSAPI remains a C API, the engine is now implemented in C++. Some C++ helpers have been introduced into the API, to help embedders writi...
SpiderMonkey 31
o 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. The download url is outdated and SpiderMonkey not RELEASE alone! Get it here mozilla-esr31 You will find it in "Firefox Ext
ended Support Release 31" package on hg release Platform support SpiderMonkey 31 is supported 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 supported version is MSVC10/2010: MSVC8/9 support has been dropped. SpiderMonkey 31 includes a just-in...
...uage, just not as fast. Migrating to SpiderMonkey 31 The first change most embedders will notice is that SpiderMonkey must now be initialized before it can be used, using the newly-repurposed 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 recomm
ended 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 support 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...
...executing any JS script. Once this method has been successfully called, it's okay to call JS_NewRuntime and all the other existing SpiderMonkey APIs as usual. Once all JSAPI operation has completed, the corresponding JS_ShutDown method uninitializes SpiderMonkey, cleaning up memory and allocations performed by JS_Init. It is not required to call JS_ShutDown at present, but it is strongly recomm
ended: calling it may be required in a future SpiderMonkey release. JavaScript shell changes Detail added/removed methods here... On POSIX platforms, building a threadsafe shell no longer requires NSPR. Embedders still need to build with NSPR, as the new wrappers require using SpiderMonkey internal functions which are not exposed to the public API. Known Issues Detail any known issues here... Fut...
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. ...
...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 important 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 recomm
ended 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 urls Keys are like urls with paths separated by a colon, ':' (this is convention only) Use a common prefix for all keys in your app (like a domain) Be careful about possible name collisions Key names should make it obvi...
... like ptu:identity:<email>. ...
Animated PNG graphics
Authors 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 support for animated images. It is int
ended to be a replacement for simple animated images that have traditionally used the GIF format, while adding support 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 ...
...an unsigned short shall be a 16-bit unsigned integer in network byte order with the range 0 to (2^16)-1; and a byte shall be an 8-bit unsigned integer with the range 0 to (2^8)-1. Error handling APNG is designed to allow incremental display of frames before the entire image has been read. This implies that some errors may not be detected until partway through the animation. It is strongly recomm
ended that when any error is encountered decoders should discard all subsequent frames, stop the animation, and revert to displaying the default image. A decoder which detects an error before the animation has started should display the default image. An error message may be displayed to the user if appropriate. Structure An APNG stream is a normal PNG stream as defined in the PNG Specification, with...
...ransparent black before rendering the next frame. 2 APNG_DISPOSE_OP_PREVIOUS The frame's region of the output buffer is to be reverted to the previous contents before rendering the next frame. If the first 'fcTL' chunk uses a dispose_op of APNG_DISPOSE_OP_PREVIOUS it should be treated as APNG_DISPOSE_OP_BACKGROUND. blend_op<code> specifies whether the frame is to be alpha bl
ended into the current output buffer content, or whether it should completely replace its region in the output buffer. Valid values for <code>blend_op are: Value Constant Description 0 APNG_BLEND_OP_SOURCE All color components of the frame, including alpha, overwrite the current contents of the frame's output buffer region. 1 APNG_BLEND_OP_OVER The frame ...
XUL Accessibility
UL control elements are mapped to accessibility API. It is much in progress. AT API General rules This section holds some rules applied to generating accessible name and description. ...
...applied to generating accessible name and description. ...
...xt from element subtree if the child node is hidden then it's ignored excepting the case when the element used as label is hidden itself If the child node is text node then its rendered value is app
ended If the child node is element then if it implements nsIDOMXULLabeledControlElement then the value of label property is app
ended otherwise if it's a label element then then value attribute is app
ended otherwise append tooltiptext attribute append the accessible value Searching specific element in neighbour of the element search inside the element subtree go up through parents (max level is 5) and search inside theirs subtrees if the element is anonymous then search in whole anonymous subtree, here the attribute anonid is used instead of id attribute Accessible properties This section de...
mozIStorageService
nal The directory to put the backup into. If this is not specified, the backup is placed in the same directory as the original file. Return value An nsIFile object representing the newly-created backup file. openDatabase() Opens a database connection to the specified file. The specified file is created if it does not already exist. ...
...And then the database can be opened again with the mozIStorageService.openDatabase() method. ...
...he type of storage requested. Valid values are "profile" and "memory". Return value A new mozIStorageConnection providing access to the requested database. Exceptions thrown NS_ERROR_INVALID_ARG If aStorageKey is invalid. openUnsharedDatabase() Opens a database connection to the specified file without using a shared cache. If this method throws NS_ERROR_FILE_CORRUPTED, it's recomm
ended that you 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 inde...
nsIDocShell
Parameters aStream The input stream that provides access to the data to be loaded. This must be a blocking, threadsafe stream implementation. aURI The URI representing the stream, or null. aContentType The type (MIME) of data being loaded (empty if unknown). aContentCharset The charset of the data being loaded (empty if unknown). aLoadInfo This is the ext
ended load info for this load. This most often will be null, but if you need to do additional setup for this load you can get a loadInfo object by calling createLoadInfo(). Once you have this object you can set the needed properties on it and then pass it to loadStream. Native code only!loadURI Loads a given URI. This will give priority to loading the requested URI in the object implementing this inte...
...ill give priority to loading the requested URI in the object implementing this interface. If it can not be loaded here however, the URL dispatcher will go through its normal process of content loading. void loadURI( in nsIURI uri, in nsIDocShellLoadInfo loadInfo, in unsigned long aLoadFlags, in boolean firstParty ); Parameters uri The URI to load. loadInfo This is the ext
ended load info for this load. This most often will be null, but if you need to do additional setup for this load you can get a loadInfo object by calling createLoadInfo(). Once you have this object you can set the needed properties on it and then pass it to loadURI. aLoadFlags Flags to modify load behaviour. Flags are defined in nsIWebNavigation. Note that using flags outside LOAD_FLAGS_MASK i...
...e if you want to get the current URI, use the read-only property on nsIWebNavigation. void setCurrentURI( in nsIURI aURI ); Parameters aURI The URI to load. suspendRefreshURIs() Cancel the XPCOM timers for each meta-refresh URI in this docshell, and this docshell's children, recursively. The meta-refresh timers can be restarted using resumeRefreshURIs(). If the timers are already susp
ended, this has no effect. void suspendRefreshURIs(); Parameters None. tabToTreeOwner() Tells the docshell to offer focus to its tree owner. This is currently only necessary for embedding chrome. void tabToTreeOwner( in boolean forward, out boolean tookFocus ); Parameters forward Whether to tab forwards or backwards. tookFocus Whether or not an element was successfully focused. ...
nsIEffectiveTLDService
in full, including the implicit "*" rule. Therefore, if you call getPublicSuffix("a.b.c.nonexistent"), you will get back "nonexistent" - this "TLD" is not in the public suffix list, but the implicit "*" rule means that it is returned. This is the right answer for e.g. cookie setting and domain highlighting, but you should check whether it's the right answer for your application. It is not recomm
ended to use this interface for determining whether a given string "is a domain name". That question is unanswerable with 100% accuracy using the PSL, because what is a domain name is a property of the DNS, which is different for different people. Is "mail.intranet" actually a domain name? Depends who you ask - for some people it is, others not. Is "pretty.flowers" a domain name, according to getPublic...
...quested aAdditionalParts value. NS_ERROR_HOST_IS_IP_ADDRESS This exception is thrown if aURI is a numeric IPv4 or IPv6 address. NS_ERROR_UNEXPECTED Or other error returned by nsIIDNService.normalize() when the hostname contains characters disallowed in URIs. getBaseDomainFromHost() Returns the base domain of a host string. Otherwise identical to getBaseDomain(). Note: It is strongly recomm
ended that you use getBaseDomain() if a suitable nsIURI is available. Only use this method if this is not the case. ACString getBaseDomainFromHost( in AUTF8String aHost, in PRUint32 aAdditionalParts Optional ); Parameters aHost The host string to be analyzed. aAdditionalParts Optional The number of domain name parts to be returned in addition to the public suffix. Return value An ACStr...
...ostname in aURI is empty. NS_ERROR_HOST_IS_IP_ADDRESS This exception is thrown if aURI is a numeric IPv4 or IPv6 address. NS_ERROR_UNEXPECTED Or other error returned by nsIIDNService.normalize() when the hostname contains characters disallowed in URIs. getPublicSuffixFromHost() Returns the public suffix of a host string. Otherwise identical to getPublicSuffix(). Note: It is strongly recomm
ended to use getBaseDomain() if a suitable nsIURI is available. Only use this method if this is not the case. ACString getPublicSuffixFromHost( in AUTF8String aHost ); Parameters aHost The host string to be analyzed. Return value An ACString containing the public suffix. Exceptions thrown NS_ERROR_INVALID_ARG This exception is thrown if aHost is empty. NS_ERROR_UNEXPECTED This except...
nsIFile
is attribute is undefined. Changing the permissions of a nsIFile operates on the underlying filesystem. As of Gecko 1.7, changing the permissions of a non-existent file has undefined behavior. persistentDescriptor ACString On some platforms, the value of nsIFile.path may be insufficient to uniquely identify the file on the local file system. The persistent descriptor is int
ended to be used whenever a nsIFile needs to be serialized to disk and later recovered. This string is not int
ended for display to users. Note: The value of the followLinks attribute is not encoded in the persistent descriptor. target AString This attribute exposes the full target of the nsIFile - the full path with any symbolic links dereferenced. Accessor to the stri...
...LETE_ON_CLOSE 0x80000000 Optional parameter used by openNSPRFileDesc Methods append() This function is used for constructing a descendant of the current nsIFile. Note: This method does not return a new nsIFile; it modifies the object it was called on. If the old nsIFile should be retained, use clone(). void append( in AString node ); Parameters node A string which is int
ended to be a child node of the nsIFile. This string must not contain a path separator character. Exceptions thrown NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that aNode incorrectly contains a path separator character. Native code only! appendNative This method is used for constructing a descendant of the current nsIFile. [native character encoding variant] void appendNative( in ACStri...
...not contain a path separator character. Exceptions thrown NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that aNode incorrectly contains a path separator character. Native code only! appendNative This method is used for constructing a descendant of the current nsIFile. [native character encoding variant] void appendNative( in ACString node ); Parameters node A string that is int
ended to be a child node of the current nsIFile. This string must not contain a path separator character. This string must be encoded using the native character encoding. Exceptions thrown NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that aNode incorrectly contains a path separator character. clone() This method creates a clone of the nsIFile. (It does NOT clone the file itself; see the copy meth...
nsIJSON
16LE", "UTF-16BE", "UTF-32LE" and "UTF-32BE" are supported. 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 int
ended for use only by code processing legacy data. When the original instance requiring this function is removed, this method will be removed. Thus, this deprecated method should not be used. jsval legacyDecode( in AString str ); Parameters str The JSON string to decode. Return value The original JavaScript object, reconstructed from the JSON string. legacyDecodeFromStream() Decodes...
... used. jsval legacyDecode( in AString str ); Parameters str The JSON string to decode. Return value The original JavaScript object, reconstructed from the JSON string. legacyDecodeFromStream() Decodes a JSON string, read from a stream. This method accepts slightly more than the exact JSON syntax; details of extra accepted syntax are deliberately not described. This method is int
ended for use only by code processing legacy data. When the original instance requiring this function is removed, this method will be removed. Thus, this deprecated method should not be used. jsval legacyDecodeFromStream( in nsIInputStream stream, in long contentLength ); Parameters stream The nsIInputStream from which to read the JSON string to decode. contentLength The length of th...
...IInputStream from which to read the JSON string to decode. contentLength The length of the string to decode. Return value The original JavaScript object, reconstructed from the JSON string. legacyDecodeToJSVal() Decodes a JSON string to a jsval. This method accepts slightly more than the exact JSON syntax; details of extra accepted syntax are deliberately not described. This method is int
ended for use only by code processing legacy data. When the original instance requiring this function is removed, this method will be removed. Thus, this deprecated method should not be used. Note: This method may only be used from native code, and provides a way to decode a JSON string to a jsval for use in your native code. Don't forget to GCroot the result before using it. jsval legacyDecodeToJ...
nsIWebProgressListener
channel. The degree of security is expressed by STATE_SECURE_HIGH, STATE_SECURE_MED, or STATE_SECURE_LOW. Security strength flags These flags describe the security strength and accompany STATE_IS_SECURE in a call to the onSecurityChange() method. These flags are mutually exclusive. These flags are not meant to provide a precise description of data transfer security. These are instead int
ended as a rough indicator that may be used to, for example, color code a security indicator or otherwise provide basic data transfer security feedback to the user. Constant Value Description STATE_SECURE_HIGH 0x00040000 This flag indicates a high degree of security. STATE_SECURE_MED 0x00010000 This flag indicates a medium degree of security. STATE...
...0000 This flag indicates a medium degree of security. STATE_SECURE_LOW 0x00020000 This flag indicates a low degree of security. State identity flags These flags describe the level of identity verification in a call to the onSecurityChange() method. Constant Value Description STATE_IDENTITY_EV_TOPLEVEL 0x00100000 State bits for EV == Ext
ended Validation == High Assurance. The topmost document uses an EV cert. Location Change flags Constant Value Description LOCATION_CHANGE_SAME_DOCUMENT 0x00000001 This flag is on when aWebProgress did not load a new document. For example, the location change is due to an anchor scroll or a pushState/popState/replaceState. LOCATION_CHANGE_ERROR_PAG...
... Error status code associated with the state change. This parameter should be ignored unless aStateFlags includes the STATE_STOP bit. The status code indicates success or failure of the request associated with the state change. Note: aStatus may be a success code even for server generated errors, such as the HTTP 404 File Not Found error. In such cases, the request itself should be queried for ext
ended error information (for example for HTTP requests see nsIHttpChannel. onStatusChange() Notification that the status of a request has changed. The status message is int
ended to be displayed to the user (for example, in the status bar of the browser). void onStatusChange( in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage ); Parameters a...
XPIDL
to converge towards WebIDL in the future. Note: Starting in Gecko 9.0, the older xpidl utility, which was previously used to generate C++ header files, typelib information, and so forth has been replaced with pyxpidl in the Gecko SDK. pyxpidl has been used for some time now, but now the older tool has been fully retired. Writing XPIDL interface files XPIDL closely resembles OMG IDL, with ext
ended syntax to handle IIDs and additional types. Some examples are in the xpcom/base and xpcom/ds directories of the Mozilla tree. XPIDL:Syntax (Now up to date again) XPIDL syntax (Out of date) XPIDL Author's Guide (Not as out of date) Explanation of IDL semantics A full guide to the syntax can be found at XPIDL:Syntax, which is written in an ABNF form. An xpidl file is essentially just a ser...
...s 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 nsISupports in some fashion. However, it is generally not recomm
ended 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 accessed; it must be unique, and the uuid must be generate...
...with NS_Free. For interface pointers, the callee does the AddRef on behalf of the caller, and the caller must call Release. For inout parameters, the callee must clean up the old data if it chooses to replace it. Buffers must be deallocated with NS_Free, and interface pointers must be Release'd. Afterwards, the above rules for out apply. Shared out-parameters should not be freed, as they are int
ended to refer to constant string literals. Resources (mostly outdated) Some unsorted notes including a keyword list xpidl is a tool for generating C++ headers, Java interfaces, XPConnect typelibs, and HTML documentation from XPIDL files Generating xpt files on Windows A Google groups post with instructions on how to use variable-length argument lists using XPIDL. ...
Examples of web and XML development using the DOM - Web APIs
of the table. However, stopEvent also calls an event object method, event.stopPropagation, which keeps the event from bubbling any further up into the DOM. Note that the table itself has an onclick event handler that ought to display a message when the table is clicked. But the stopEvent method has stopped propagation, and so after the data in the table is updated, the event phase is effectively
ended, and an alert box is displayed to confirm this. <!DOCTYPE html> <html lang="en"> <head> <title>Event Propagation</title> <style> #t-daddy { border: 1px solid red } #c1 { background-color: pink; } </style> <script> function stopEvent(ev) { c2 = document.getElementById("c2"); c2.innerHTML = "hello"; // this ought to keep t-daddy from getting the click. ev.stopPropagation(); alert("eve...
...s This example uses DOM methods to display all the properties of the window.onload event object and their values in a table. It also shows a useful technique of using a for..in loop to iterate over the properties of an object to get their values. The properties of event objects differs greatly between browsers, the WHATWG DOM Standard lists the standard properties, however many browsers have ext
ended these greatly. Put the following code into a blank text file and load it into a variety of browsers, you'll be surprised at the different number and names of properties. You might also like to add some elements in the page and call this function from different event handlers. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <title>Show Event properties</title> <style> table { bo...
...(-1); text = 'Row ' + row.rowIndex + ' Cell ' + i; cell.appendChild(document.createTextNode(text)); } </script> Notes A table's innerHTML property should never be used to modify a table, although you can use it to write an entire table or the content of a cell. If DOM Core methods document.createElement and Node.appendChild are used to create rows and cells, IE requires that they are app
ended to a tbody element, whereas other browsers will allow appending to a table element (the rows will be added to the last tbody element). There are a number of other convenience methods belonging to the table interface that can be used for creating and modifying tables. ...
HTMLElement: animationend event - Web APIs
nd event is not fired. ...
...ets an element that's being animated and listens for the animationend event: const animated = document.querySelector('.animated'); animated.addEventListener('animationend', () => { console.log('Animation
ended'); }); The same, but using the onanimationend event handler property: const animated = document.querySelector('.animated'); animated.onanimationend = () => { console.log('Animation
ended'); }; Live example HTML <div class="animation-example"> <div class="container"> <p class="animation">You chose a cold night to visit our planet.</p> </div> <button class="activate" type="button">Activate animation</button> <div class="event-log"></div> </div> CSS .container { height: 3rem; } .event-log { width: 25rem; height: 2rem; border: 1px solid black; ...
...g.textContent = `${animationEventLog.textContent}'animation started' `; }); animation.addEventListener('animationiteration', () => { iterationCount++; animationEventLog.textContent = `${animationEventLog.textContent}'animation iterations: ${iterationCount}' `; }); animation.addEventListener('animationend', () => { animationEventLog.textContent = `${animationEventLog.textContent}'animation
ended'`; animation.classList.remove('active'); applyAnimation.textContent = "Activate animation"; }); animation.addEventListener('animationcancel', () => { animationEventLog.textContent = `${animationEventLog.textContent}'animation canceled'`; }); applyAnimation.addEventListener('click', () => { animation.classList.toggle('active'); animationEventLog.textContent = ''; iterationCount = 0; ...
PushEvent - Web APIs
16Disabled Full support 16Disabled Disabled From version 16: this feature is behind the Enable service workers preference. ...
... 16Disabled Full support 16Disabled Disabled From version 16: this feature is behind the Enable service workers preference. ...
... 16Disabled Full support 16Disabled Disabled From version 16: this feature is behind the Enable service workers preference. ...
Touch events - Web APIs
tions together. After drawing the line, we call Array.splice() to replace the previous information about the touchpoint with the current information in the ongoingTouches array. Handling the end of a touch When the user lifts a finger off the surface, a touchend event is sent. We handle this by calling the handleEnd() function below. Its job is to draw the last line segment for each touch that
ended and remove the touchpoint from the ongoing touch list. function handleEnd(evt) { evt.preventDefault(); log("touchend"); var el = document.getElementById("canvas"); var ctx = el.getContext("2d"); var touches = evt.changedTouches; for (var i = 0; i < touches.length; i++) { var color = colorForTouch(touches[i]); var idx = ongoingTouchIndexById(touches[i].identifier); if (i...
...s prevents the corresponding mouse events from firing, it's common to call preventDefault() on touchmove rather than touchstart. That way, mouse events can still fire and things like links will continue to work. Alternatively, some frameworks have taken to refiring touch events as mouse events for this same purpose. (This example is oversimplified and may result in strange behavior. ...
...hZoom on a page is to call preventDefault() on the second touch in a series. This behavior is not well defined in the touch events spec and results in different behavior for different browsers (i.e., iOS will prevent zooming but still allow panning with both fingers; Android will allow zooming but not panning; Opera and Firefox currently prevent all panning and zooming.) Currently, it's not recomm
ended to depend on any particular behavior in this case, but rather to depend on meta viewport to prevent zooming. Specifications Specification Status Comment Touch Events - Level 2The definition of 'Touch' in that specification. Draft Added radiusX, radiusY, rotationAngle, force properties Touch EventsThe definition of 'Touch' in that specification. Recommen...
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
urement information transport. Things RTP doesn't do RTP itself doesn't provide every possible feature, which is why other protocols are also used by WebRTC. Some of the more noteworthy things RTP doesn't include: Editor's note: we should add information about where these deficiencies are compensated for, if they are at all. RTP does not guarantee quality-of-service (QoS). While RTP is int
ended for use in latency-critical scenarios, it doesn't inherently offer any features that ensure QoS. Instead, it only offers the information necessary to allow QoS to be implemented elsewhere in the stack. RTP doesn't handle allocation or reservation of resources that may be needed. Where it matters for WebRTC purposes, these are dealt with in a variety of places within the WebRTC infrastructure. ...
...ck is re-enabled. The audio transceiver's direction is set to "sendrecv", indicating that it should return to both sending and receiving streamed audio, instead of only sending. Just like when hold was engaged, this triggers negotiation again, resulting in your code sending a new offer to the remote peer. ...
...iver's direction is set to "sendrecv", indicating that it should return to both sending and receiving streamed audio, instead of only sending. Just like when hold was engaged, this triggers negotiation again, resulting in your code sending a new offer to the remote peer. ...
Writing WebSocket servers - Web APIs
cation describes this in detail. ...
...-----------------------------+ |F|R|R|R| opcode|M| Payload len | Ext
ended payload length | |I|S|S|S| (4) |A| (7) | (16/64) | |N|V|V|V| |S| | (if payload len==126/127) | | |1|2|3| |K| | | +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - + | Ext
ended payload length continued, if payload len == 127 | + - - - - - - - - - - - - - - - +-------------------------------+ | |Masking-key, if MASK set to 1 | +-------------------------------+-------------------------------+ | Masking-key (continued) | Payload Data | +-------------------------------- - - - - - - - - - - - - -...
... then naturally you'll need extra code on the server. Let's imagine we're using a subprotocol json. In this subprotocol, all data is passed as JSON. If the client solicits this protocol and the server wants to use it, the server needs to have a JSON parser. Practically speaking, this will be part of a library, but the server needs to pass the data around. Tip: To avoid name conflict, it's recomm
ended to make your subprotocol name part of a domain string. If you are building a custom chat app that uses a proprietary format exclusive to Example Inc., then you might use this: Sec-WebSocket-Protocol: chat.example.com. Note that this isn't required, it's just an optional convention, and you can use any string you wish. Related WebSocket handshake library in C++ Writing WebSocket client appli...
Web Video Text Tracks Format (WebVTT) - Web APIs
on separate lines, starting with the string NOTE. You'll find more about these in the below section. It is important 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 be used to add information to a WebVTT file. Comments are int
ended for those reading the file and are not seen by users. Comments may contain newlines but cannot contain a blank line, which is equivalent to two consecutive newlines. A blank line signifies the end of a comment. A comment cannot contain the string "-->", the ampersand character (&), or the less-than sign (<). If you wish to use such characters, you need to escape them using for example & for ...
...rs. Comments may contain newlines but cannot contain a blank line, which is equivalent to two consecutive newlines. A blank line signifies the end of a comment. A comment cannot contain the string "-->", the ampersand character (&), or the less-than sign (<). If you wish to use such characters, you need to escape them using for example & for ampersand and < for less-than. It is also recomm
ended that you use the greater-than escape sequence (>) instead of the greater-than character (>) to avoid confusion with tags. A comment consists of three parts: The string NOTE. A space or a newline. Zero or more characters other than those noted above. Example 4 - Common WebVTT example NOTE This is a comment Example 5 - Multi-line comment NOTE One comment that is spanning more than on...
...he subtitles to be displayed. The payload text may contain newlines but it cannot contain a blank line, which is equivalent to two consecutive newlines. A blank line signifies the end of a cue. A cue text payload cannot contain the string "-->", the ampersand character (&), or the less-than sign (<). Instead use the escape sequence "&" for ampersand and "<" for less-than. It is also recomm
ended that you use the greater-than escape sequence ">" instead of the greater-than character (>) to avoid confusion with tags. If you are using the WebVTT file for metadata these restrictions do not apply. In addition to the three escape sequences mentioned above, there are fours others. They are listed in the table below. Table 6 - Escape sequences Name Character Esca...
Advanced techniques: Creating and sequencing audio - Web APIs
em, whereby we look ahead at when the notes are going to play and push them into a queue. We can start them at a precise time with the currentTime property and also take into account any changes. Note: This is a much stripped down version of Chris Wilson's A Tale Of Two Clocks article, which goes into this method in much more detail. There's no point repeating it all here, but it's highly recomm
ended to read this article and use this method. Much of the code here is taken from his metronome example, which he references in said article. Let's start by setting up our default BPM (beats per minute), which will also be user-controllable via -- you guessed it -- another range input. let tempo = 60.0; const bpmControl = document.querySelector('#bpm'); bpmControl.addEventListener('input', functio...
... this.dataset.playing = 'true'; ...
... this.dataset.playing = 'true'; } else { window.clearTimeout(timerID); ...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
scope.setInterval(function[, delay]); var intervalID = scope.setInterval(code, [delay]); Parameters func A function to be executed every delay milliseconds. The function is not passed any arguments, and no return value is expected. code An optional syntax allows you to include a string instead of a function, which is compiled and executed every delay milliseconds. This syntax is not recomm
ended for the same reasons that make using eval() a security risk. delayOptional The time, in milliseconds (thousandths of a second), the timer should delay in between executions of the specified function or code. See Delay restrictions below for details on the permitted range of delay values. arg1, ..., argN Optional Additional arguments which are passed through to the function specified by func o...
...dular version of it (Daemon) see JavaScript Daemons Management. This more complex version is nothing but a big and scalable collection of methods for the Daemon constructor. However, the Daemon constructor itself is nothing but a clone of MiniDaemon with an added support for init and onstart functions declarable during the instantiation of the daemon. So the MiniDaemon framework remains the recomm
ended way for simple animations, because Daemon without its collection of methods is essentially a clone of it. minidaemon.js /*\ |*| |*| :: MiniDaemon :: |*| |*| Revision #2 - September 26, 2014 |*| |*| /docs/Web/API/Window.setInterval |*| https://developer.mozilla.org/User:fusionchess |*| https://github.com/madmurphy/minidaemon.js |*| |*| This framework is released under the GNU Lesser Genera...
...on. Note also that the actual amount of time that elapses between calls to the callback may be longer than the given delay; see Reasons for delays longer than specified in WindowOrWorkerGlobalScope.setTimeout() for examples. Ensure that execution duration is shorter than interval frequency If there is a possibility that your logic could take longer to execute than the interval time, it is recomm
ended that you recursively call a named function using setTimeout(). For example, if using setInterval() to poll a remote server every 5 seconds, network latency, an unresponsive server, and a host of other issues could prevent the request from completing in its allotted time. As such, you may find yourself with queued up XHR requests that won't necessarily return in order. In these cases, a recursive...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
cope.setTimeout(function[, delay, arg1, arg2, ...]); var timeoutID = scope.setTimeout(function[, delay]); var timeoutID = scope.setTimeout(code[, delay]); Parameters function A function to be executed after the timer expires. code An alternative syntax that allows you to include a string instead of a function, which is compiled and executed when the timer expires. ...
... arg1, ..., argN Optional Additional arguments which are passed through to the function specified by function. Note: Passing additional parameters to the function in the first syntax does not work in Internet Explorer 9 and below. If you want to enable this functionality on that browser, you must use a polyfill (see the Polyfill section). ...
... after 1 second because of the binding setTimeout(myBoundMethod, 1.5*1000, "1"); // prints "one" after 1.5 seconds Notes Timeouts are cancelled using clearTimeout(). To call a function repeatedly (e.g., every N milliseconds), consider using setInterval(). Passing string literals Passing a string instead of a function to setTimeout() has the same associated problems as using eval. // Recomm
ended window.setTimeout(function() { alert('Hello World!'); }, 500); // Not recomm
ended window.setTimeout("alert('Hello World!');", 500); A string passed to setTimeout is evaluated in the global context, so local symbols in the context where setTimeout() was called will not be available when the string is evaluated as code. Reasons for delays longer than specified There are a number of reasons w...
XRSystem: requestSession() - Web APIs
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. The supported modes are: immersive-ar The session's output will be given exclusive access to the immersive device, but the rendered content will be bl
ended with the real-world environment. The session's environmentBlendMode indicates the method to be used to blend the content together. Important: 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 immersiv...
... session's environmentBlendMode indicates the method to be used to blend the content together. Important: 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 int
ended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected to be opaque if possible, but might be additive if 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 ...
...e covered in more detail in Permissions and security in WebXR Device API. Examples Creating an immersive VR session The following example calls requestSession() requesting an "immersive-vr" session. If the Promise resolves, it sets up a session and initiates the animation loop. navigator.xr.requestSession("immersive-vr") .then((xrSession) => { xrSession.addEventListener('end', onXRSession
Ended); // Do necessary session setup here. // Begin the session's animation loop. xrSession.requestAnimationFrame(onXRAnimationFrame); }).catch(function(error) { // "immersive-vr" sessions are not supported console.warn("'immersive-vr' isn't supported, or an error occurred activating VR!"); }); Verifying WebXR support and using a button to start VR mode The following example shows how to u...
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
ce. This can happen for display environments which use superscaling or anti-aliasing techniques to improve perceived image quality. Syntax let nativeScaling = XRWebGLLayer.getNativeFramebufferScaleFactor(session); Parameters session The XRSession for which to return the native framebuffer scaling factor. ...
...erceived image quality. Syntax let nativeScaling = XRWebGLLayer.getNativeFramebufferScaleFactor(session); Parameters session The XRSession for which to return the native framebuffer scaling factor. Return value A floating-point value which, when multiplied by the XRSession's recomm
ended framebuffer dimensions, results in the XR device's native frame buffer resolution. If the session has
ended, this function returns 0.0. ...
...oating-point value which, when multiplied by the XRSession's recomm
ended framebuffer dimensions, results in the XR device's native frame buffer resolution. If the session has
ended, this function returns 0.0. Usage notes The scaling factor returned by this function will be 1.0 if the native resolution of the XR device and the resolution of the XR device match. In any case, multiplying the recomm
ended resolution as identified by the XRSession by this value will result in the actual native resolution of the XR hardware. The recomm
ended WebGL frame buffer resolution is the best possible estimate of the resolution necessary to contain all of fthe XRViews needed by the device while at the same time providing typical applications an acceptable balance of image quality and performance. For example...
ARIA: gridcell role - Accessibility
<div role="gridcell">Potato</div> <div role="gridcell">Cabbage</div> <div role="gridcell">Onion</div> Elements that have role="gridcell" applied to them must be the child of an element with a role of row. <div role="row"> <div role="gridcell">Jane</div> <div role="gridcell">Smith</div> <div role="gridcell">496-619-5098</div> ... </div> 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 ARIA. ...
...27</div> </div> </div> ... </div> Describing the position of gridcells when the overall structure is unknown In situations where the table-style grouping of content does not provide information about the columns and rows, gridcells must have their positions programatically described by using aria-describedby. The ids provided for aria-describedby should correspond to parent elements int
ended to be the rows and columns. By referencing the parent elements with roles of rowheader or columnheader applied to them via aria-describedby, it allows assistive technology to understand the position and relationship of the gridcell element to the rest of the table-style grouping of content. Interactive grids and treegrids Editable cells Both td elements and elements with a role of gridcell ap...
...ed ARIA roles and properties have poor support 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 recomm
ended to use the utilize native HTML table markup instead of recreating a table's form and functionality with ARIA and JavaScript. ...
negative - CSS: Cascading Style Sheets
When defining custom counter styles, the negative descriptor lets you alter the representations of negative counter values, by providing a way to specify symbols to be app
ended or prep
ended to the counter representation when the value is negative. Syntax /* <symbol> values */ negative: "-"; /* Prepends '-' if value is negative */ negative: "(" ")"; /* Surrounds value by '(' and ')' if it is negative */ Values first <symbol> This symbol will be prep
ended to the representation when the counter is negative. ...
... prep
ended to the counter representation when the value is negative. Syntax /* <symbol> values */ negative: "-"; /* Prepends '-' if value is negative */ negative: "(" ")"; /* Surrounds value by '(' and ')' if it is negative */ Values first <symbol> This symbol will be prep
ended to the representation when the counter is negative. second <symbol> If present, this symbol will be app
ended to the representation when the counter is negative. Description If the counter value is negative, the symbol provided as value for the descriptor is prep
ended to the counter representation; and a second symbol if specified, will be app
ended to the representation. ...
...If the negative descriptor is specified for other systems that don't support negative counter values, then the descriptor is ignored. ...
@counter-style - CSS: Cascading Style Sheets
thumbs { system: cyclic; symbols: "\1F44D"; suffix: " "; } ul { list-style: thumbs; } The initial version of CSS defined a set of useful counter styles. However, although more styles were added to this set of predefined styles over the years, this system proved too restrictive to fulfill the needs of worldwide typography. ...
...pen-
ended manner, by allowing authors to define their own counter styles when the pre-defined styles aren't fitting their needs. Syntax Descriptors Each @counter-style is identified by a name and has a set of descriptors. system Specifies the algorithm to be used for converting the integer value of a counter to a string representation. negative Lets the author specify symbols to be app
ended or prep
ended to the counter representation if the value is negative. prefix Specifies a symbol that should be prep
ended to the marker representation. Prefixes are added to the representation in the final stage, so in the final representation of the counter, it comes before the negative sign. ...
...Suffixes come after the marker representation. range Defines the range of values over which the counter style is applicable. If a counter style is used to represent a counter value outside of its ranges, the counter style will drop back to its fallback style. pad Is used when you need the marker representations to be of a minimum length. ...
will-change - CSS: Cascading Style Sheets
The will-change CSS property hints to browsers how an element is expected to change. Browsers may set up optimizations before an element is actually changed. These kinds of optimizations can increase the responsiveness of a page by doing potentially expensive work before they are actually required. Important: will-change is int
ended to be used as a last resort, in order to try to deal with existing performance problems. It should not be used to anticipate performance problems. /* Keyword values */ will-change: auto; will-change: scroll-position; will-change: contents; will-change: transform; /* Example of <custom-ident> */ will-change: opacity; /* Example of <custom-ident> */ will-change: left, top; /* Example of two <animateable-feature> */ /* Global values */ will...
...keep the optimizations for much longer time than it would have otherwise. So it is a good practice to switch will-change on and off using script code before and after the change occurs. Don't apply will-change to elements to perform premature optimization. If your page is performing well, don't add the will-change property to elements just to wring out a little more speed. will-change is int
ended to be used as something of a last resort, in order to try to deal with existing performance problems. It should not be used to anticipate performance problems. Excessive use of will-change will result in excessive memory use and will cause more complex rendering to occur as the browser attempts to prepare for the possible change. This will lead to worse performance. Give it sufficient time ...
... last resort, in order to try to deal with existing performance problems. It should not be used to anticipate performance problems. Excessive use of will-change will result in excessive memory use and will cause more complex rendering to occur as the browser attempts to prepare for the possible change. This will lead to worse performance. Give it sufficient time to work. This property is int
ended 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 important to give the browser some time to actually do the optimizations. Find some way to predict at least slightly ahead of time tha...
Live streaming web audio and video - Developer guides
ns which are used by JavaScript libraries such as DASH.js. This approach allows us to download chunks of the video stream using XHR and "append" the chunks to the stream that's played by the <video> element. So for example, if we detect that the network is slow, we can start requesting lower quality (smaller) chunks for the next segment. This technology also allows an advertising segment to be app
ended/inserted into the stream. Note: you can also use WebM with the MPEG DASH adaptive streaming system. HLS HLS or HTTP Live Streaming is a protocol invented by Apple Inc and supported on iOS, Safari and the latest versions of Android browser / Chrome. HLS is also adaptive. HLS can also be decoded using JavaScript, which means we can support the latest versions of Firefox, Chrome and Internet E...
...S HLS or HTTP Live Streaming is a protocol invented by Apple Inc and supported on iOS, Safari and the latest versions of Android browser / Chrome. HLS is also adaptive. HLS can also be decoded using JavaScript, which means we can support the latest versions of Firefox, Chrome and Internet Explorer 10+. See this HTTP Live Streaming JavaScript player. At the start of the streaming session, an ext
ended M3U (m3u8) playlist is downloaded. This contains the metadata for the various sub-streams that are provided. Streaming File Format Support Browser DASH HLS Opus (Audio) Firefox 32 ? [1] ? [2] ? 14+ Safari 6+ ? Chrome 24+ ? [1] ? Opera 20+ ? [1] Internet Explorer 10+ ? 11 ? [2] ...
...ing like Flumotion (open source streaming software). For RTMP transfer you can use the Nginx RTMP Module. SHOUTcast SHOUTcast is a cross-platform proprietary technology for streaming media. Developed by Nullsoft, it allows digital audio content in MP3 or AAC format to be broadcast. For web use, SHOUTcast streams are transmitted over HTTP. Note: SHOUTcast URLs may require a semi-colon to be app
ended to them. Icecast The Icecast server is an open source technology for streaming media. Maintained by the Xiph.org Foundation, it streams Ogg Vorbis/Theora as well as MP3 and AAC format via the SHOUTcast protocol. Note: SHOUTcast and Icecast are among the most established and popular technologies, but there are many more streaming media systems available. Streaming Services Although you can in...
Date and time formats used in HTML - HTML: Hypertext Markup Language
ings in HTML, the specification requires that all years be given using the modern (or proleptic) Gregorian calendar. While user interfaces may allow entry of dates using other calendars, the underlying value always uses the Gregorian calendar. While the Gregorian calendar wasn't created until the year 1582 (replacing the similar Julian calendar), for HTML's purposes, the Gregorian calendar is ext
ended 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 supported, so HTML doesn't support years 1 B.C.E. (1 B.C.) or earlier. A year is normally 365 days long, except ...
...ng the number of seconds to be zero, because the seconds are optional when zero, and the normalized string minimizes the length of the string. Global date and time strings A global date and time string specifies a date and time as well as the time zone in which it occurs. A valid global date and time string is the same format as a local date and time string, except it has a time zone string app
ended to the end, following the time. Time zone offset string A time zone offset string specifies the offset in either a positive or a negative number of hours and minutes from the standard time base. There are two standard time bases, which are very close to the same, but not exactly the same: For dates after the establishment of Coordinated Universal Time (UTC) in the early 1960s, the time base ...
... Time (UTC) in the early 1960s, the time base is Z and the offset indicates a particular time zone's offset from the time at the prime meridian at 0o longitude (which passes through the Royal Observatory at Greenwich, England). For dates prior to UTC, the time base is instead expressed in terms of UT1, which is the contemporary Earth solar time at the prime meridian. The time zone string is app
ended immediately following the time in the date and time string. You can specify simply "Z" as the time zone offset string to indicate that the time is specified in UTC. Otherwise, the time zone string is constructed as follows: A character indicating the sign of the offset: the plus character ("+", or U+002B) for time zones to the east of the prime meridian or the minus character ("-", or U+002D) ...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
ams of unknown duration, web radio, media incoming from WebRTC, and so forth), this value is +Infinity. loop A Boolean attribute: if specified, the audio player will automatically seek back to the start upon reaching the end of the audio. muted A Boolean attribute that indicates whether the audio will be initially silenced. Its default value is false. preload This enumerated attribute is int
ended to provide a hint to the browser about what the author thinks will lead to the best user experience. It may have one of the following values: none: Indicates that the audio should not be preloaded. metadata: Indicates that only audio metadata (e.g. length) is fetched. auto: Indicates that the whole audio file can be downloaded, even if the user is not expected to use it. empty string: A...
... media up to its end without stopping for content buffering. complete The rendering of an OfflineAudioContext is terminated. durationchange The duration attribute has been updated. emptied The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.
ended Playback has stopped because the end of the media was reached. loadeddata The first frame of the media has finished loading. loadedmetadata The metadata has been loaded. pause Playback has been paused. play Playback has begun. playing Playback is ready to start after having been paused or delayed due to lack of data. ratecha...
...laying Playback is ready to start after having been paused or delayed due to lack of data. ratechange The playback rate has changed. seeked A seek operation completed. seeking A seek operation began. stalled The user agent is trying to fetch media data, but data is unexpectedly not forthcoming. suspend Media data loading has been susp
ended. 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 support the same file types and audio codecs; you can provide multiple sources inside nested <source> elements, and the browser will then use th...
<input type="password"> - HTML: Hypertext Markup Language
round the pattern text. If the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. 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. Use of a pattern is strongly recomm
ended for password inputs, in order to help ensure that valid passwords using a wide assortment of character classes are selected and used by your users. With a pattern, you can mandate case rules, require the use of some number of digits and/or punctuation characters, and so forth. See the section Validation for details and an example. placeholder The placeholder attribute is a string that provides ...
...utocomplete="current-password"> Making the password mandatory To tell the user's browser that the password field must have a valid value before the form can be submitted, simply specify the Boolean required attribute. <label for="userPassword">Password: </label> <input id="userPassword" type="password" required> <input type="submit" value="Submit"> Specifying an input mode If your recomm
ended (or required) password syntax rules would benefit from an alternate text entry interface than the standard keyboard, you can use the inputmode attribute to request a specific one. The most obvious use case for this is if the password is required to be numeric (such as a PIN). Mobile devices with virtual keyboards, for example, may opt to switch to a numeric keypad layout instead of a full keyboar...
...However, given that the text is obscured, the usefulness of these is somewhat limited. Validation If your application has character set restrictions or any other requirement for the actual content of the entered password, you can use the pattern attribute to establish a regular expression to be used to automatically ensu...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
y. This attribute is mainly useful when linking to external stylesheets -- it allows the user agent to pick the best adapted one for the device it runs on. Notes: In HTML 4, this can only be a simple white-space-separated list of media description literals, i.e., media types and groups, where defined and allowed as values for this attribute, such as print, screen, aural, braille. HTML5 ext
ended this to any kind of media queries, which are a superset of the allowed values of HTML 4. Browsers not supporting CSS3 Media Queries won't necessarily recognize the adequate link; do not forget to set fallback links, the restricted set of media queries defined in HTML 4. referrerpolicy A string indicating which referrer to use when fetching the resource: no-referrer means that the ...
...ibute is used to define the type of the content linked to. The value of the attribute should be a MIME type such as text/html, text/css, and so on. The common use of this attribute is to define the type of stylesheet being referenced (such as text/css), but given that CSS is the only stylesheet language used on the web, not only is it possible to omit the type attribute, but is actually now recomm
ended practice. It is also used on rel="preload" link types, to make sure the browser only downloads file types that it supports. Non-standard attributes methods The value of this attribute provides information about the functions that might be performed on an object. The values generally are given by the HTTP protocol when it is used, but it might (for similar reasons as for the title attribut...
... HTML 4.01 SpecificationThe definition of '<link>' in that specification. Recommendation ...
<video>: The Video Embed element - HTML: Hypertext Markup Language
within the element's playback area. Note that the absence of this attribute does not imply that the video will always be played in fullscreen. poster A URL for an image to be shown while the video is downloading. If this attribute isn't specified, nothing is displayed until the first frame is available, then the first frame is shown as the poster frame. preload This enumerated attribute is int
ended to provide a hint to the browser about what the author thinks will lead to the best user experience with regards to what content is loaded before the video is played. It may have one of the following values: none: Indicates that the video should not be preloaded. metadata: Indicates that only video metadata (e.g. length) is fetched. auto: Indicates that the whole video file can be downloa...
... media up to its end without stopping for content buffering. complete The rendering of an OfflineAudioContext is terminated. durationchange The duration attribute has been updated. emptied The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.
ended Playback has stopped because the end of the media was reached. loadeddata The first frame of the media has finished loading. loadedmetadata The metadata has been loaded. pause Playback has been paused. play Playback has begun. playing Playback is ready to start after having been paused or delayed due to lack of data. progres...
... due to lack of data. progress Fired periodically as the browser loads a resource. ratechange The playback rate has changed. seeked A seek operation completed. seeking A seek operation began. stalled The user agent is trying to fetch media data, but data is unexpectedly not forthcoming. suspend Media data loading has been susp
ended. 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 support the same video formats; you can provide multiple sources inside nested <source> elements, and the browser will then use the first one it...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
y. 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 for it. What types of content can be preloaded? Many different content types can be preloaded. The possible as attribute values are: audio: Audio file, as typically used in <audio>. document: An HTML document int
ended to be embedded by a <frame> or <iframe>. embed: A resource to be embedded inside an <embed> element. fetch: Resource to be accessed by a fetch or XHR request, such as an ArrayBuffer or JSON file. font: Font file. image: Image file. object: A resource to be embedded inside an <object> element. script: JavaScript file. style: CSS stylesheet. track: WebVTT file. worker: A JavaScript web wor...
...ript.src = "myscript.js"; document.body.appendChild(preloadedScript); This is useful when you want to preload a script, but then defer execution until exactly when you need it. Other resource preloading mechanisms Other preloading features exist, but none are quite as fit for purpose as <link rel="preload">: <link rel="prefetch"> has been supported in browsers for a long time, but it is int
ended for prefetching resources that will be used in the next navigation/page load (e.g. when you go to the next page). This is fine, but isn't useful for the current page! In addition, browsers will give prefetch resources a lower priority than preload ones -- the current page is more important than the next. See Link prefetching FAQ for more details. <link rel="prerender"> renders a specified webpag...
... -- the current page is more important than the next. See Link prefetching FAQ for more details. <link rel="prerender"> renders a specified webpage in the background, speeding up its load if the user navigates to it. Because of the potential to waste users bandwidth, Chrome treats prerender as a NoState prefetch instead. <link rel="subresource"> was supported in Chrome a while ago, and was int
ended to tackle the same issue as preload, but it had a problem: there was no way to work out a priority for the items (as didn't exist back then), so they all got fetched with fairly low priority. There are a number of script-based resource loaders out there, but they don't have any power over the browser's fetch prioritization queue, and are subject to much the same performance problems. Specifica...
Evolution of HTTP - HTTP
ent 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 file was send back with the description of the problem contained in it, for human consumption. ...
...er type of documents. There were no status or error codes: in case of a problem, a specific HTML file was send back with the description of the problem contained in it, for human consumption. ...
...ion like address books, e-mail, or the geographic position of the user, the need to have TLS became ubiquitous even outside the e-commerce use case. Using HTTP for complex applications The original vision of Tim Berners-Lee for the Web wasn't a read-only medium. He envisioned a Web where people can add and move documents remotely, a kind of distributed file system. Around 1996, HTTP has been ext
ended to allow authoring, and a standard called WebDAV was created. It has been further ext
ended for specific applications like CardDAV to handle address book entries and CalDAV to deal with calendars. But all these *DAV extensions had a flaw: they had to be implemented by the servers to be used, which was quite complex. Their use on Web realms stayed confidential. In 2000, a new pattern for using HTT...
Using HTTP cookies - HTTP
y used for three purposes: Session management Logins, shopping carts, game scores, or anything else the server should remember Personalization User preferences, themes, and other settings Tracking Recording and analyzing user behavior Cookies were once used for general client-side storage. While this was legitimate when they were the only way to store data on the client, it is now recomm
ended to use modern storage APIs. Cookies are sent with every request, so they can worsen performance (especially for mobile data connections). Modern APIs for client storage are the Web Storage API (localStorage and sessionStorage) and IndexedDB. To see stored cookies (and other storage that a web page can use), you can enable the Storage Inspector in Developer Tools and select Cookies from the stor...
...et on, not the server. If your site authenticates users, it should regenerate and resend session cookies, even ones that already exist, whenever the user authenticates. This technique helps prevent session fixation attacks, where a third party can reuse a user's session. Restrict access to cookies There are a couple of ways to ensure that cookies are sent securely and are not accessed by unint
ended parties or scripts: the Secure attribute and the HttpOnly attribute. A cookie with the Secure attribute is sent to the server only with an encrypted request over the HTTPS protocol, never with unsecured HTTP, and therefore can't easily be accessed by a man-in-the-middle attacker. Insecure sites (with http: in the URL) can't set cookies with the Secure attribute. However, do not assume that Secur...
...ng history and habits based on cookies sent to it by the same browser when accessing multiple sites. Firefox, by default, blocks third-party cookies that are known to contain trackers. Third-party cookies (or just tracking cookies) may also be blocked by other browser settings or extensions. Cookie blocking can cause some third-party components (such as social media widgets) to not function as int
ended. Cookie-related regulations Legislation or regulations that cover the use of cookies include: The General Data Privacy Regulation (GDPR) in the European Union The ePrivacy Directive in the EU The California Consumer Privacy Act These regulations have global reach, because they apply to any site on the World Wide Web that is accessed by users from these jurisdictions (the EU and Californi...
Content-Security-Policy - HTTP
s valid sources for loading media using the <audio> , <video> and <track> elements. object-src Specifies valid sources for the <object>, <embed>, and <applet> elements. Elements controlled by object-src are perhaps coincidentally considered legacy HTML elements and are not receiving new standardized features (such as the security attributes sandbox or allow for <iframe>). Therefore it is recomm
ended to restrict this fetch-directive (e.g., explicitly set object-src 'none' if possible). prefetch-src Specifies valid sources to be prefetched or prerendered. script-src Specifies valid sources for JavaScript. script-src-elem Specifies valid sources for JavaScript <script> elements. script-src-attr Specifies valid sources for JavaScript inline event handlers. style-src Specifies val...
..., etc. Reporting directives Reporting directives control the reporting process of CSP violations. See also the Content-Security-Policy-Report-Only header. report-uri Instructs the user agent to report attempts to violate the Content Security Policy. These violation reports consist of JSON documents sent via an HTTP POST request to the specified URI. Though the report-to directive is int
ended to replace the deprecated report-uri directive, report-to is not supported in most browsers yet. So for compatibility with current browsers while also adding forward compatibility when browsers get report-to support, you can specify both report-uri and report-to: Content-Security-Policy: ...; report-uri https://endpoint.example.com; report-to groupname In browsers that support report-to, the ...
...specify an allow-list of Trusted Types policies. Trusted Types allows applications to lock down DOM XSS injection sinks to only accept non-spoofable, typed values in place of strings. upgrade-insecure-requests Instructs user agents to treat all of a site's insecure URLs (those served over HTTP) as though they have been replaced with secure URLs (those served over HTTPS). This directive is int
ended for web sites with large numbers of insecure legacy URLs that need to be rewritten. CSP in workers Workers are in general not governed by the content security policy of the document (or parent worker) that created them. To specify a content security policy for the worker, set a Content-Security-Policy response header for the request which requested the worker script itself. The exception to t...
Introduction - JavaScript
aboration between multiple computers). Inside a host environment (for example, a web browser), JavaScript can be connected to the objects of its environment to provide programmatic control over them. JavaScript contains a standard library of objects, such as Array, Date, and Math, and a core set of language elements such as operators, control structures, and statements. Core JavaScript can be ext
ended for a variety of purposes by supplementing it with additional objects; for example: Client-side JavaScript extends the core language by supplying objects to control a browser and its Document Object Model (DOM). For example, client-side extensions allow an application to place elements on an HTML form and respond to user events such as mouse clicks, form input, and page navigation. Server-sid...
... the article JavaScript technologies overview. JavaScript documentation versus the ECMAScript specification The ECMAScript specification is a set of requirements for implementing ECMAScript. It is useful if you want to implement standards-compliant language features in your ECMAScript implementation or engine (such as SpiderMonkey in Firefox, or V8 in Chrome). The ECMAScript document is not int
ended 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 supports all functionality outlined in the ECMAScript specification. The J...
...ion. 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 Firefox, so using the most recent version of Firefox is recomm
ended. The Web Console tool built into Firefox is useful for experimenting with JavaScript; you can use it into two modes: single-line input mode, and multi-line input mode. Single-line input in the Web Console The Web Console shows you information about the currently loaded Web page, and also includes a JavaScript interpreter that you can use to execute JavaScript expressions in the current page. ...
JavaScript modules - JavaScript
square.js Note: All of the examples in this guide have basically the same structure; the above should start getting pretty familiar. The modules directory's two modules are described below: canvas.js -- contains functions related to setting up the canvas: create() -- creates a canvas with a specified width and height inside a wrapper <div> with a specified ID, which is itself app
ended inside a specified parent element. Returns an object containing the canvas's 2D context and the wrapper's ID. createReportList() -- creates an unordered list app
ended inside a specified wrapper element, which can be used to output report data into. Returns the list's ID. square.js -- contains: name -- a constant containing the string 'square'. draw() -- draws a square on a speci...
...t('./modules/square.js').then((Module) => { let square1 = new Module.Square(myCanvas.ctx, myCanvas.listId, 50, 50, 100, 'blue'); square1.draw(); square1.reportArea(); square1.reportPerimeter(); }) }); Note that, because the promise fulfillment returns a module object, the class is then made a subfeature of the object, hence we now need to access the constructor with Module. ...
... If you try to load the HTML file locally (i.e. with a file:// URL), you'll run into CORS errors due to JavaScript module security requirements. You need to do your testing through a server. GitHub pages is ideal as it also serves .js files with the correct MIME type. ...
Inheritance and the prototype chain - JavaScript
cript Let's look at what happens behind the scenes in a bit more detail. In JavaScript, as mentioned above, functions are able to have properties. All functions have a special property named prototype. Please note that the code below is free-standing (it is safe to assume there is no other JavaScript on the webpage other than the below code). For the best learning experience, it is highly recomm
ended that you open a console, navigate to the "console" tab, copy-and-paste in the below JavaScript code, and run it by pressing the Enter/Return key. (The console is included in most web browser's Developer Tools. More information is available for Firefox Developer Tools, Chrome DevTools, and Edge DevTools.) function doSomething(){} console.log( doSomething.prototype ); // It does not matter how yo...
...le.log(inst.bar_prop) Support 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 supported in IE8 and below. However, as Microsoft has discontinued ext
ended support for systems running these old browsers, this should not be a concern for most applications. Additionally, the slow object initialization can be a performance black hole if using the second argument because each object-descriptor property has its own separate descriptor object. When dealing with hundreds of thousands of object descriptors in the form of object, there can arise a serious is...
...xist it checks Object.getPrototypeOf(Object.getPrototypeOf(o)).someProp, and so on. In conclusion It is essential to understand the prototypal inheritance model before writing complex code that makes use of it. Also, be aware of the length of the prototype chains in your code and break them up if necessary to avoid possible performance problems. Further, the native prototypes should never be ext
ended unless it is for the sake of compatibility with newer JavaScript features. ...
Codecs used by WebRTC - Web media technologies
m to stop sending data temporarily--a capability known as Discontinuous Transmission (DTX). In RFC 3389, a method for providing an appropriate filler to use during silences. Comfort Noise is used with G.711, and may potentially be used with other codecs that don't have a built-in CN feature. Opus, for example, has its own CN capability; as such, using RFC 3389 CN with the Opus codec is not recomm
ended. An audio sender is never required to use discontinuous transmission or comfort noise. Opus The Opus format, defined by RFC 6716 is the primary format for audio in WebRTC. The RTP payload format for Opus is found in RFC 7587. You can find more general information about Opus and its capabilities, and how other APIs can support Opus, in the corresponding section of our guide to audio codecs used...
...s support of in-band stereo signals allows support for stereo without complicating the demultiplexing process. The entire range of bit rates supported by Opus (6 kbps to 510 kbps) is supported in WebRTC, with the bit rate allowed to be dynamically changed. Higher bit rates typically improve quality. ...
...licating the demultiplexing process. The entire range of bit rates supported by Opus (6 kbps to 510 kbps) is supported in WebRTC, with the bit rate allowed to be dynamically changed. Higher bit rates typically improve quality. Bit rate recommendations Given a 20 millisecond frame size, the following table shows the recomm
ended bit rates for various forms of media. Media type Recomm
ended bit rate range Narrow-band speech (NB) 8 to 12 kbps Wide-band speech (WB) 16 to 20 kbps Full-band speech (FB) 28 to 40 kbps Full-band monaural music (FB mono) 48 to 64 kbps Full-band stereo music (FB stereo) 64 to 128 kbps The bit rate may be adjusted at any time. In order to avoid network congestion, the average audio bit rat...
begin - SVG: Scalable Vector Graphics
se. The element's animation start time is defined relative to the begin or active end of another animation. A valid syncbase-value consists of an ID reference to another animation element followed by a dot and either begin or end to identify whether to synchronize with the beginning or active end of the referenced animation element. An optional offset value as defined in <offset-value> can be app
ended. <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 supported events for that element. All valid events (not necessarily supported by all e...
...re: focus, blur, focusin, focusout, activate, auxclick, click, dblclick, mousedown, mouseenter, mouseleave, mousemove, mouseout, mouseover, mouseup, wheel, beforeinput, input, keydown, keyup, compositionstart, compositionupdate, compositionend, load, unload, abort, error, select, resize, scroll, beginEvent, endEvent, and repeatEvent. An optional offset value as defined in <offset-value> can be app
ended. <repeat-value> This value defines a qualified repeat event. The element animation start time is defined relative to the time that the repeat event is raised with the specified iteration value. A valid repeat value consists of an element ID followed by a dot and the function repeat() with an integer value specifying the number of repetitions as parameter. An optional offset value as defined in...
...lue defines a qualified repeat event. The element animation start time is defined relative to the time that the repeat event is raised with the specified iteration value. A valid repeat value consists of an element ID followed by a dot and the function repeat() with an integer value specifying the number of repetitions as parameter. An optional offset value as defined in <offset-value> can be app
ended. <accessKey-value> This value defines an access key that should trigger the animation. The element animation will begin when the user presses the specified key. A valid accessKey-value consists of the function accessKey() with the character to be input as parameter. An optional offset value as defined in <offset-value> can be app
ended. <wallclock-sync-value> This value defines the animation ...
end - SVG: Scalable Vector Graphics
base. The element's animation end time is defined relative to the begin or active end of another animation. A valid syncbase-value consists of an ID reference to another animation element followed by a dot and either begin or end to identify whether to synchronize with the beginning or active end of the referenced animation element. An optional offset value as defined in <offset-value> can be app
ended. <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 supported events for that element. All valid events (not necessarily supported by all eleme...
...: focus, blur, focusin, focusout, activate, auxclick, click, dblclick, mousedown, mouseenter, mouseleave, mousemove, mouseout, mouseover, mouseup, wheel, beforeinput, input, keydown, keyup, compositionstart, compositionupdate, compositionend, load, unload, abort, error, select, resize, scroll, beginEvent, endEvent, and repeatEvent . An optional offset value as defined in <offset-value> can be app
ended. <repeat-value> This value defines a qualified repeat event. The element animation end time is defined relative to the time that the repeat event is raised with the specified iteration value. A valid repeat value consists of an element ID followed by a dot and the function repeat() with an integer value specifying the number of repetitions as parameter. An optional offset value as defined in <...
...value defines a qualified repeat event. The element animation end time is defined relative to the time that the repeat event is raised with the specified iteration value. A valid repeat value consists of an element ID followed by a dot and the function repeat() with an integer value specifying the number of repetitions as parameter. An optional offset value as defined in <offset-value> can be app
ended. <accessKey-value> This value defines an access key that should trigger the end of the animation. The element animation will end when the user presses the specified key. A valid accessKey-value consists of the function accessKey() with the character to be input as parameter. An optional offset value as defined in <offset-value> can be app
ended. <wallclock-sync-value> This value defines the a...
kernelUnitLength - SVG: Scalable Vector Graphics
The kernelUnitLength attribute has two meanings based on the context it's used in. For lighting filter primitives, it indicates the int
ended distance for the x and y coordinates, for <feConvolveMatrix>, it indicates the int
ended distance between successive columns and rows in the kernel matrix. Three elements are using this attribute: <feConvolveMatrix>, <feDiffuseLighting>, and <feSpecularLighting> feConvolveMatrix For the <feConvolveMatrix>, kernelUnitLength indicates the int
ended distance in current filter units (i.e., units as determined by the value of primitiveUnits attribute) between successive columns and rows, respectively, in the kernelMatrix. By specifying value(s) for kernelUnitLength, the kernel becomes defined in a scalable, abstract coordinate system. If the attribute is no...
...will be used instead. Value <number-optional-number> Default value Pixel in offscreen bitmap Animatable Yes <number-optional-number> The first number is the x value. The second number is the y value. If the x value is not specified, it defaults to the same value as x. feDiffuseLighting For the <feDiffuseLighting>, kernelUnitLength indicates the int
ended distance in current filter units (i.e., units as determined by the value of attribute primitiveUnits) for the x and y coordinate, respectively, in the surface normal calculation formulas. The first number is the x value. The second number is the y value. If the y value is not specified, it defaults to the same value as x. By specifying value(s) for kernelUnitLength, the kernel becomes defined in...
... image offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. If a negative or zero value is specified the default value will be used instead. Value <number-optional-number> Default value Pixel in offscreen bitmap Animatable Yes feSpecularLighting For the <feSpecularLighting>, kernelUnitLength indicates the int
ended distance in current filter units (i.e., units as determined by the value of attribute primitiveUnits) for the x and y coordinate, respectively, in the surface normal calculation formulas. The first number is the x value. The second number is the y value. If the y value is not specified, it defaults to the same value as x. By specifying value(s) for kernelUnitLength, the kernel becomes defined in...
Content Processes - Archive of obsolete content
n the SDK was first designed, Firefox was being refactored towards a multiprocess model. In this model, the UI would be rendered in one process (called the chrome process), whereas each tab and each add-on would run in their own dedicated process (called content and add-on processes, respectively). The project behind this refactor was known as Electrolysis, or E10s. Although E10s has now been susp
ended, 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 important 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 multiproces...
...rcumvent 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. A few Notes on Security As we stated earlier, the SDK was designed with multiprocess support in mind, despite the fact that work on implementing this in Firefox has currently been susp
ended. Since both add-on modules and content scripts are currently loaded in sandboxes rather than separate processes, and sandboxes can communicate with each other directly (using imports/exports), you might be wondering why we have to go through all the trouble of passing messages between add-on and content scripts. The reason for this extra complexity is that the code for add-on modules and content ...
JavaScript Daemons Management - Archive of obsolete content
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 support for init and onstart functions declarable during the instantiation of the daemon. So the MiniDaemon framework will remain the recomm
ended 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 callback functions (see The "this" problem for details). Advantages of this approch: abstraction passage of this object to JavaScript timers...
...mers (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 support for init and onstart functions (declarable during the instantiation of the daemon). So the MiniDaemon framework will remain the recomm
ended way for simple animations, because Daemon without its collection of methods is essentially a clone of it. /*\ |*| |*| ******************************* |*| * daemon.js * |*| ******************************* |*| |*| ver. 1.0 rev. 2 |*| |*| daemon.js - A JAVASCRIPT HIGHLY SCALABLE DAEMONS MANAGER. |*| |*| https://developer.mozilla.org/docs/JavaScript/Timers/Daemon...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
" rule means that you cannot prohibit it from any particular country. The "No discrimination may be made based on field of endeavor" rule means that you cannot prevent it from being used in warfare. The "No additional licensing can be required when redistributing" rule means that you cannot prohibit the software's use from anyone who does not buy a separate license. Because the OSS license is int
ended to foster source-code reuse and mutual development, it avoids restrictions on source-code duplication, distribution, and modification to the greatest extent possible. Types of OSS licenses and their characteristics The details of OSS licenses vary from one license to the next. I'll look at three representative licenses here, and explain some of their features and relevant points. Most attempts...
...GPL LGPL -> GPL or LGPL MPL -> MPL Modified BSD -> other license Dual license -> either one or both sides of a dual license Beware of mixed licenses When using existing source code, check to see whether there is a different license mixed in the source. Depending on the license, mixing them may be prohibited. For example, source code with a plain GPL or MPL license cannot be linked to or am
ended with other source code using any other kind of license. This is because the MPL and GPL include provisions contradicting this. However, source code that is dual-licensed with either the MPL or GPL allows additions or linkages with GPL source code. OSS licensing today and in the future Finally, let's look at the current state of affairs in OSS licensing and some of the issues it faces. Non-lice...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
them together to actually build an extension. An easier method of building a Firefox/Thunderbird Addon for developers who are well-acquainted with IDEs like Netbeans, Eclipse, etc. is to use Netbeans (IDE from Sun Microsystems) and Foxbeans (Plugin for Netbeans, by TeeSoft). Setting up your development environment In order to develop (and test) extensions in a most convenient way it is recomm
ended to apply some changes to Firefox. In the following you will find a brief description how to do so; a more detailed one can be found under Setting up an extension development environment. Create a development profile If you want to partition your everyday browsing environment from your development environment in Firefox, set up a second profile for development. To create this dev profile start F...
...ning an operations check against those changes. The part "Operations checks on revised source files" discusses the general procedure to follow from source-file revision to operations check. What if something's not working right? If your extension isn't working according to plan, first see if there's an error being displayed on the Errors panel of the Error Console. If you set things up as recomm
ended in the section "Setting up your development environment", XUL and JavaScript errors will appear here. See the part "JavaScript debugging techniques" for useful tips on that subject5. If Firefox freezes up, you'll need to terminate the Firefox process from the task manager. Phase 3: Adding multilingual support The clock window that we created in Phase 2 displays everything in English. In Phase...
Local Storage - Archive of obsolete content
It is very common for an extension to require some kind of local persistent storage. We recommend that you at least keep an error log, so that you can request error data from your users when you encounter problems that are hard to debug. We'll discuss logging in this section, but first let's look at the right (or at least, common and scalable) way of managing local files. It is strongly recomm
ended that you keep your local files inside the Firefox profile directory. Otherwise you may run into problems if the same extension is installed in multiple profiles. The common practice is to create a directory with the name of your project at the root of the profile folder, and keep your files inside. The structure could be something like this: s435L.default (your profile directory) XULScho...
...l need to understand 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 ext
ended to support 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 exper...
The Box Model - Archive of obsolete content
rs by default): If you use a vbox instead, it looks like this: The orientation of boxes (and most XUL elements) can be controlled using the orient attribute or the -moz-box-orient CSS property. With these you can make an hbox have vertical orientation and viceversa, although that isn't very useful. The CSS property may be useful on some occasions, but using the orient attribute is not recomm
ended because it mixes content and presentation. Flexibility An HTML div is as big as its contents unless you override its dimensions using CSS. This is similarly the case for XUL, except there are two flexibility directions to consider. An hbox is as big as its contents horizontally, but it will occupy all the available space vertically. You can make an hbox flexible horizontally with the CSS prope...
...s 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-width, min-height and max-height. The latter are recomm
ended 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 recomm
ended that you use proportional units (em, %) instead of absolute units (px) whenever possible. Using the former allo...
Setting up an extension development environment - Archive of obsolete content
application as this new developer profile. Development profile The use of a separate user profile for development can be advantageous, averting performance degradation from development related settings, and further isolating personal data (such as bookmarks, extensions, and settings) from your testing environment. You could be running two instances of Firefox simultaneously. Note: For an ext
ended guide on how to set up even more user profiles, take a look at Multiple Firefox profiles. This particularly comes in handy for the use of all currently available Firefox versions. It even allows the running of simultaneous versions, at the same time. To quickly achieve our task of creating just a developer profile, we will start the application with the parameters: /path/to/Firefox -no-remote ...
...type about:config in the Location Bar. You can also use the Extension Developer's Extension, which provides a menu interface for Firefox settings. Accessing Thunderbird development preferences To change preference settings in Thunderbird, open the "Preferences" (Unix) or "Options" (Windows) interface. On the "Advanced" page, select the "General" tab then click the "Config Editor" button. Recomm
ended development preferences Not all preferences are defined by default, and are therefore not listed by default. You will have to create new (boolean) entries for them. For more information about Mozilla preferences, refer to the mozillaZine article on "about:config". Tip: You can install either the Developer Profile or DevPrefs add-ons to handle setting these preferences automatically, and skip t...
CSS3 - Archive of obsolete content
s . Each of these modules is now an independent part of the language and moves towards standardization at its own pace. While some modules are already W3C Recommendations, other still are early Working Drafts. New modules are also added when new needs are identified. Formally, there is no CSS3 standard per se . Each module being standardized independently, the standard CSS consists of CSS2.1 am
ended and ext
ended by the completed modules, not necessary all with the same level number. At each point of time, a snapshot of the CSS standard can be defined, listing CSS2.1 and the mature modules. The W3 consortium periodically publishes such snapshots, like in 2007, 2010, 2015, 2017, and 2018. Though today no module with a level greater than 3 is standardized, this will change in the future. Some...
...to any element using the CSS transform and transform-origin properties. The supported transforms are: matrix(), translate(), translateX(), translateY(), scale(), scaleX(), scaleY(), rotate(), skewX(), and skewY(). the support of tri-dimensional transforms to be applied to any element by adding the CSS transform-style, perspective, perspective-origin, and backface-visibility properties and ext
ended the transform property with the following transforms are: matrix 3d(), translate3d(), translateZ(), scale3d(), scaleZ(), rotate3d(), rotateX(), rotateY(), rotateZ(), and perspective(). Note: this specification is a merge of CSS 2D-Transforms, CSS 3D-Transforms and SVG transforms. CSS Transitions Working Draft Allows the definition of transitions effects ...
JXON - Archive of obsolete content
Algorithm #4: a very minimalist way The following is another possible way to do the conversion. It is very close to the Parker convention, too. With this algorithm, all Element nodes that contain other child Element, Text, or CDATASection nodes in the same level are treated as instances of Boolean, Number, String, or Date Constructors. So...
...tion if you want to automate the creation of an XML document. It is a bad choice, however, if you want to re-build an XML document previously converted into JSON. Although the bidirectional conversion is very faithful (except for CDATASection nodes, which will be converted into Text nodes), the process is unnecessarily costly. In fact, if your goal is to edit an XML document, it is strongly recomm
ended to work on it rather than create new ones. The Parker Convention The functions listed above for the conversion of an XML document to JSON (often called "JXON algorithms") are more or less freely based on the Parker Convention (especially regarding the transformation of tags names into object properties names, the recognition of the typeof of all the collected text content of each tag and the ab...
Installing Dehydra - Archive of obsolete content
Prerequisites Mercurial 1.0 is needed to access source repositories. Make sure that the mq extension is enabled. SpiderMonkey provides scripting capabilities for Dehydra. GCC 4.5, with the package gcc-4.5-plugin-dev installed. (Alternately, build from source) A modern Linux distribution. Dehydra is not supported on Mac OS X. Building SpiderMonkey It is recomm
ended that you use SpiderMonkey revision AURORA_BASE_20110705 when building Dehydra. cd $HOME hg clone http://hg.mozilla.org/mozilla-central/ cd mozilla-central hg update AURORA_BASE_20110705 cd js/src autoconf-2.13 mkdir $HOME/obj-js cd $HOME/obj-js $HOME/mozilla-central/js/src/configure --enable-optimize --disable-debug make It has to be checked whether later/newer branches (like AURORA_BASE_20120131) are working, too. ...
...cl.diff cd gcc-4.5.3 patch -p0 < ../finish_decl.diff # build GCC cd .. mkdir gcc-objdir mkdir gcc-dist cd gcc-objdir ../gcc-4.5.3/configure --disable-bootstrap --enable-languages=c,c++ --prefix=$PWD/../gcc-dist make 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 recomm
ended 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 export 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 per...
New Skin Notes - Archive of obsolete content
f a story book, small text columns do seem reasonable, but I don't think this is nice for technical documentation which requires usage of tables, etc... Wikipedia's side bar is smaller, btw, probably for the same reasons. Since I manage a number of sites for which I must respect quality standards at 800 pixels width for compatibility (we accept break 640 compatibility nowadays except for sites int
ended for PDAs/PPCs), I find myself needing to use ctrl+- with the devmo wikki currently, not to change my global settings of course, which are fine and factory-default, working well with the other sites I visit regularily or manage... Thanks again --mmondor Future Fixes In l10n versions there all heading links are wrong - main link and documentation leads to english Devmo, and DevNews and Webwatch...
... which are fine and factory-default, working well with the other sites I visit regularily or manage... Thanks again --mmondor Future Fixes In l10n versions there all heading links are wrong - main link and documentation leads to english Devmo, and DevNews and Webwatch should be hidden or localized too. --Gandalf 01:30, 29 Aug 2005 (PDT) We'll revisit this later. Tab links are currently as int
ended. --dria No, they're not. When I'm on polish devmo and I click on Documentation or main Devmo logo I'm redirected to english version. It's a bug. --Gandalf 00:39, 31 Aug 2005 (PDT) Link URL fixed for wiki skin only. Tab text will currently remain untranslated ("Documentation"). DevNews and WebWatch are not currently being localised so shall remain as they are, with link to english wiki. --dria ...
The new nsString class implementation (1999) - Archive of obsolete content
In fact, it's very unlikely this is really the page you want. If you happen to see dbaron lying around somewhere, please direct him here so he can fix this message. In the meantime, try the XPCOM string guide--but note that that article bears a warning of its own! This document is int
ended to briefly describe the new nsString class architecture, and discuss the implications on memory management, optimizations, internationalization and usage patterns. Disclaimer: I absolutely hate string classes. No one has ever devised one that more than 2 programmers can agree on. So, why then am I proposing this? Well, nsString has served us well so far, but it's in need of a facelift. And XPCOM has really taken off, so nsString needs to be brought into alignment. Justification The nsString class i...
...etMalloc(). Our nsStrImpl uses an allocator pattern so that programmers can install their own policy, but this may also make allocation simpler in a multiprocess environment. I'm wondering if this is sufficient, namely, that a string can return it's own (shared) allocator for this purpose. Our minimalistic nsIMemoryAgent interface is just rich enough to support the nsString idiom, and could be ext
ended to serve as the general memory allocation idiom. Here's it's API: class nsIMemoryAgent : nsISupports { void* New(nsInt32 aSize)=0; //used for both alloc and realloc void* Delete(void* aPtr)=0; }; Internationalization The new nsStrImpl/nsString implementation addresses at least two of the primary concerns of our i18n team. First, nsStrImpl offers charset conversion hooks for use during const...
addDirectory - Archive of obsolete content
forceUpdate); Parameters The addDirectory method has the following parameters: registryName The pathname in the Client Version Registry for the root directory of the files that are to be installed.This parameter can be an absolute pathname (beginning with a /) or a relative pathname, (not beginning with a slash). An absolute pathname is used as specified. A relative pathname is app
ended to the registry name of the package as specified by the package parameter to the initInstall method.This parameter can also be null, in which case the xpiSourcePath parameter is used as a relative pathname.Note that the registry pathname is not the location of the software on the computer; it is the location of information about the software inside the Client Version Registry. version ...
...DirSpec An object representing a directory. The file is installed under this directory on the user's computer. You create this object by passing a string representing the directory to the getFolder method. subdir The name of a directory to append to localDirSpec, using '/' as the path separator regardless of the platform.If subdir is missing, null, or "", the filenames are app
ended directly to the folder name specified by localDirSpec. flags An optional field; reserved for future use. Pass 0 as the default value. Returns An integer error code. For a list of possible values, see Return Codes. In some situations, addDirectory may return other errors. Description The addDirectory method puts the files in the specified directory in a temporary location. To move ...
Introduction to XUL - Archive of obsolete content
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 support the basic DOM Level 1 Core APIs. XUL documents support an ext
ended set, much as HTML documents support DOM Level 1 HTML APIs. Mozilla's XUL content models also support 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 to XUL: XUL elements. Namespace declarations for XUL (and HTML, if H...
...owser environment. These are currently nonstandard, of course, and subject to change for now. Individual extensions are described in individual documents dedicated to the features requiring the extensions. DOM Extensions Since XUL is not the same thing as HTML, while XUL documents will support the DOM Level 1 Core API, they will not support the DOM Level 1 HTML API. However, Mozilla supports ext
ended DOM functionality for the XUL content model, patterned after the HTML extensions. At this time these additional DOM methods are available, though the code is of course the most accurate place to look for this information. These interfaces can be found in the directory mozilla/rdf/content/public/idl. XULDocument XULDocument extends Document in a fashion similar to HTMLDocument's extension inter...
Multiple Queries - Archive of obsolete content
ww.xulplanet.com/rdf/myphotos" xmlns:dc="http://purl.org/dc/elements/1.1/"> <template> <rule dc:title="Canal"> <button uri="rdf:*" image="rdf:*" label="View" orient="vertical"/> </rule> <rule> <image uri="rdf:*" src="rdf:*"/> </rule> </template> </hbox> The result to the user in this example is the same as the previous example. You can also mix simple and ext
ended queries in one template, although you may prefer to use the same style in all queries for consistency. However, if you are going to be using a number of queries, the template builder is more efficient when using multiple queries using the simple query syntax. This is because all simple queries will iterate over the same data, usually the children of an RDF container. So the builder only performs ...
...e in all queries for consistency. However, if you are going to be using a number of queries, the template builder is more efficient when using multiple queries using the simple query syntax. This is because all simple queries will iterate over the same data, usually the children of an RDF container. So the builder only performs this step once and filters the data for each query. When using the ext
ended query syntax, the manner in which the graph is navigated may be different for every query, so no optimization can be done. The builder needs to process every condition of every query. If, for example, you have six queries, each with a <member> condition, the builder will need to construct the children six times. You probably won't notice any difference for small amounts of data such as the photos...
Complete - Archive of obsolete content
tional 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 support XPI files.) The extension does not contain any useful functions. It is just an ext
ended 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 supports Firefox, Thunder...
...epend on the locale or theme locale Files for each locale skin Files for each theme Version checks Firefox etc. check extensions for compatibility before installing them. These version checks depend on the version numbers specified in the install.rdf file. There are two approaches: pessimistic and optimistic. The approach that is normally recomm
ended is pessimistic. The extension is assumed to fail in any future version of the application. To adopt this approach, set the maxVersion to the latest actual version where you have tested your extension. The problem with this approach is that you have to release a new XPI every time there is a new release of any of the applications it supports. If you delay releasing a new XPI, you risk annoying use...
Accesskey display rules - Archive of obsolete content
an accesskey of "Open" is 'A', the generated label will be "Open (A)". However, if the last character of the label is an ellipsis or a colon, the accesskey text is inserted before them. I.e., when an accesskey of "Open..." is 'A', the generated label will be "Open (A)...". And also when an accesskey of "Your Name:" is 'B', the generated label will be "Your Name (B):". This document calls the app
ended text "accesskey text". Always appends accesskey text The basic rules are enough for Western locales. However, in some locales, e.g., Japanese localized build, its most UI labels don't have alphabets but alphabets are used to accesskey. For coherence of the labels on such localized builds, the accesskey text is always app
ended even if the labels have their accesskey characters. E.g., when an acces...
...d even if the labels have their accesskey characters. E.g., when an accesskey of "OK" is 'O' and an accesskey of "?????" (means "cancel") is 'C', the labels will be "OK(O)" and "?????(C)" on Japanese localized build. XUL elements check "intl.menuitems.alwaysappendaccesskeys" pref value whether they should append accesskey text always. If the value is "true" (string), the accesskey text will be app
ended always. Don't change the pref value from your XUL applications. And also Note that there are no spaces between the original labels and accesskey text in the above Japanese example. Because typically, Japanese language doesn't use spaces as word separator. This is controled by "intl.menuitems.insertseparatorbeforeaccesskeys" pref value. If the value is "true" (string), a spece will be inserted bef...
Manipulating Lists - Archive of obsolete content
These functions are bit simpler and will do the right thing. The appendItem() function is used to append a new item to the end a list. ...
...le for several other XUL elements and work in the same manner. In fact, these methods are part of the nsIDOMXULSelectControlElement interface so any XUL elements which implement this interface have these methods. This includes the menulist, radiogroup and tabs elements. For example, to add a new item to a menulist, you can use the same syntax as for a listbox. The right kind of element will be app
ended in each situation. List Selection The nsIDOMXULSelectControlElement interface provides two additonal properties, selectedIndex and selectedItem. The former returns the index of the selected item while the latter returns the selected element. For instance the selectedItem of a menulist will be the menuitem that is selected. If no item is selected, selectedIndex will return -1, while selectedItem...
XUL accessibility guidelines - Archive of obsolete content
n and choose which columns to display. Because column headers and the column picker, in the upper right hand corner of the tree, can not receive focus, they are not operable with a keyboard. In the bookmark manager this functionality is available under the view menu which is accessible to a keyboard user. Toolbarbuttons By default, toolbar buttons cannot receive focus with a keyboard. The recomm
ended way of fixing this is that all functionality associated with a toolbar be duplicated elsewhere in the application, such as in a menu item or context menu. In cases where duplication of functionality is not possible (such as a window without a menu bar), toolbar buttons can be made focusable by adding the special CSS rule -moz-user-focus: normal. (Firefox's "Print Preview" window uses this fallbac...
... because it yields little or no visual change. Alternative text Provide alternative text for meaningful images. Alternative text is not needed when an image serves a purely decorative function. Use the "alt" attribute to describe HTML images and use the "tooltiptext" attribute on XUL elements that use images (i.e. image elements, buttons with images). For toolbar buttons with images it is recomm
ended to use both a text label in the label attribute and image alt text in the tooltiptext attribute. View the code examples below. <image src="stop.png" tooltiptext="Stop" /> <html:img src="stop.jpg" alt="Stop" /> <html:img src="decorative_image.jpg" alt="" /> <!-- In HTML the alt attribute is required. --> <toolbarbutton label="Stop" image="stop.png" tooltiptext="Stop loading the page" /> Title...
window - Archive of obsolete content
--> <window id="rootWnd" title="Register Online!" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox> <hbox> <image src="application_form.png"/> <description>Register Online!</description> </hbox> <groupbox align="start"> <caption label="Your Information"/> <radiogroup> <vbox> <hbo...
...n the window. This is used to hide chrome when showing in-browser UI such as the about:addons page, and causes the toolbars to be hidden, with only the tab strip (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 int
ended 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 supported 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...
XULRunner 1.8.0.1 Release Notes - Archive of obsolete content
ets the system requirements. The system requirements for XULRunner are the same as the system requirements for Firefox. Installing XULRunner Mozilla provides XULRunner for Windows, Mac OS X, and Linux, in English: Download XULRunner for Windows Download XULRunner for Mac OS X Download XULRunner for Linux Windows Unpack the ZIP file to a new directory using a archive tool (7zip is recomm
ended). The following directory is recomm
ended: C:\Program Files\Mozilla XULRunner\1.8.0.1 . To register XULRunner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. Linux Unpack the tarball to a n...
...LRunner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. Linux Unpack the tarball to a new directory using tar -xzf xulrunner-1.8.0.1.en-US.linux-i686.tar.gz. The following directory is recomm
ended: /opt/xulrunner/1.8.0.1 . Register XULRunner with the system by running xulrunner --register-global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). Uninstalling XULRunner Windows/Linux From a command prompt, run xulrunner --unregister-global or xulrunner --unregister-user to unregister XULRunner just as you registered it during in...
XULRunner 1.8.0.4 Release Notes - Archive of obsolete content
s the system requirements. The system requirements for XULRunner are the same as the system requirements for Firefox. Installing XULRunner Mozilla provides XULRunner for Windows, Mac OS X, and Linux, in English: Download XULRunner for Windows Download XULRunner for Mac OS X Download XULRunner for Linux Windows Unpack the ZIP file to a new directory using an archive tool (7zip is recomm
ended). The following directory is recomm
ended: C:\Program Files\Mozilla XULRunner\1.8.0.4 . To register XULRunner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. Linux Unpack the tarball to a ...
...unner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. Linux Unpack the tarball to a new directory using tar -xzf xulrunner-1.8.0.4.en-US.linux-i686.tar.gz. The following directory is recomm
ended: /opt/xulrunner/1.8.0.4 . Register XULRunner with the system by running xulrunner --register-global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). Uninstalling XULRunner Linux From a command prompt, run xulrunner --unregister-global or xulrunner --unregister-user to unregister XULRunner just as you registered it during installat...
XULRunner 1.9.1 Release Notes - Archive of obsolete content
ts the system requirements. The system requirements for XULRunner are the same as the system requirements for Firefox. Installing XULRunner Mozilla provides XULRunner for Windows, Mac OS X, and Linux, in English: Download XULRunner for Windows Download XULRunner for Mac OS X Download XULRunner for Linux Windows Unpack the ZIP file to a new directory using an archive tool (7zip is recomm
ended). The following directory is recomm
ended: C:\Program Files\Mozilla XULRunner\1.9.1 . To register XULRunner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. Linux Unpack the tarball to a new...
...unner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. Linux Unpack the tarball to a new directory using tar -xjf xulrunner-1.9.1.19.en-US.linux-i686.tar.bz2. The following directory is recomm
ended: /opt/xulrunner/1.9.1 . Register XULRunner with the system by running xulrunner --register-global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). Uninstalling XULRunner Linux From a command prompt, run xulrunner --unregister-global or xulrunner --unregister-user to unregister XULRunner just as you registered it during installation...
XULRunner 1.9.2 Release Notes - Archive of obsolete content
uter meets the system requirements. The system requirements for XULRunner are the same as the system requirements for Firefox. Installing XULRunner Mozilla provides XULRunner for Windows, Mac OS X, and Linux, in English: Download XULRunner for Windows Download XULRunner for Mac OS X Download XULRunner for Linux Windows Unpack the ZIP file to a new directory using an archive tool (7zip is recomm
ended). The following directory is recomm
ended: C:\Program Files\Mozilla XULRunner\1.9.2 . To register XULRunner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. Linux Unpack the tarball to a new direc...
...r XULRunner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. Linux Unpack the tarball to a new directory using tar -xjf xulrunner-3.6.26.en-US.linux-i686.tar.bz2. The following directory is recomm
ended: /opt/xulrunner/1.9.2 . Register XULRunner with the system by running xulrunner --register-global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). Uninstalling XULRunner Linux From a command prompt, run xulrunner --unregister-global or xulrunner --unregister-user to unregister XULRunner just as you registered it during installation. Re...
XULRunner 1.9 Release Notes - Archive of obsolete content
s the system requirements. The system requirements for XULRunner are the same as the system requirements for Firefox. Installing XULRunner Mozilla provides XULRunner for Windows, Mac OS X, and Linux, in English: Download XULRunner for Windows Download XULRunner for Mac OS X Download XULRunner for Linux Windows Unpack the ZIP file to a new directory using an archive tool (7zip is recomm
ended). The following directory is recomm
ended: C:\Program Files\Mozilla XULRunner\1.9 . To register XULRunner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. Linux Unpack the tarball to a new ...
...ner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. Linux Unpack the tarball to a new directory using tar -xjf xulrunner-1.9.0.17.en-US.linux-i686.tar.bz2. The following directory is recomm
ended: /opt/xulrunner/1.9 . Register XULRunner with the system by running xulrunner --register-global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). Uninstalling XULRunner Linux From a command prompt, run xulrunner --unregister-global or xulrunner --unregister-user to unregister XULRunner just as you registered it during installation.
XULRunner 2.0 Release Notes - Archive of obsolete content
r for Windows, Mac OS X, and Linux, in English. The releases directory can be found here. Specific runtimes can be found at: Download XULRunner for Windows Download XULRunner for Mac OS X Download XULRunner for 32-bit Linux Download XULRunner for 64-bit Linux (Warning: links may become out-of-date at times). Windows Unpack the ZIP file to a new directory using an archive tool (7zip is recomm
ended). The following directory is recomm
ended: C:\Program Files\Mozilla XULRunner\2.0 . To register XULRunner with the system, open a command prompt and run xulrunner.exe --register-global (to register for all users) or xulrunner.exe --register-user (to register for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. XULRunner 2.0 is a universal binary contain...
...r for one user only). Mac OS X Open the .pkg file within the installer and follow the directions. XULRunner 2.0 is a universal binary containing i386 and x86_64 architectures. XULRunner 1.9.2 and earlier versions had PowerPC (ppc) and i386 architectures. Linux (32-bit) Unpack the tarball to a new directory using tar -xjf xulrunner-2.0.en-US.linux-i686.tar.bz2. The following directory is recomm
ended: /opt/xulrunner/2.0 . Register XULRunner with the system by running xulrunner --register-global (to install for all users, must be run as root) or xulrunner --register-user (to install for one user only). Linux (64-bit) Unpack the tarball to a new directory using tar -xjf xulrunner-2.0.en-US.linux-x86_64.tar.bz2. The following directory is recomm
ended: /opt/xulrunner/2.0 . Register XULRunner wi...
application/http-index-format specification - Archive of obsolete content
e. The syntax of DATA is defined by the syntax spec for every NUMBER type. If a NUMBER is encountered that a parser does not understand the parser is required to ignore that line. There is no line length limit. All lines must be terminated by a carriage return followed by a line feed. NUMBER codes 100 A human readable comment line. Machine parsers should ignore this data. This data is not int
ended for display to the end user and is only meant as a comment to make the file format clear to a human interpreter. 101 Pre formatted human readable information line. This data is int
ended for the end user of the file format data if there is one. This data should be presented to the user when they are viewing data drawn from the file. 102 A human readable information line in HTML format. This ...
...This data should be presented to the user when they are viewing data drawn from the file. This data should be parsed as HTML. ...
Syndicating content with RSS - Archive of obsolete content
ertise the RSS feed in a more direct way, the HTML <a> element can be used. This mimics the <link> element discussed above. Linking from the the HTML web page where the data in an RSS feed is also contained makes the RSS feed available for use: <a rel="alternate" type="application/rss+xml" href="http://example.com/feed">...</a> Feed icons RSS (and other) feeds use a special icon. ...
... 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). ...
Introduction to Public-Key Cryptography - Archive of obsolete content
certificates stored in Firefox determine what other certificates that copy of Firefox can authenticate. An administrator can implement some aspects of corporate security policies by controlling the CA certificates stored in each user's copy of Firefox. Contents of a Certificate The contents of certificates are organized according to the X.509 v3 certificate specification, which has been recomm
ended by the International Telecommunications Union (ITU), an international standards body, since 1988. Users don't usually need to be concerned about the exact contents of a certificate. However, system administrators working with certificates may need some familiarity with the information provided here. Certificate Data Formats Certificate requests and certificates can be created, stored, and inst...
...ertificate management strategy. For example, an administrator may wish to be notified automatically when a certificate is about to expire, so that an appropriate renewal process can be completed in plenty of time without causing the certificate's subject any inconvenience. The renewal process may involve reusing the same public-private key pair or issuing a new one. A driver's license can be susp
ended even if it has not expired-for example, as punishment for a serious driving offense. Similarly, it's sometimes necessary to revoke a certificate before it has expired-for example, if an employee leaves a company or moves to a new job within the company. Certificate revocation can be handled in several different ways. For some organizations, it may be sufficient to set up servers so that the auth...
CSS - Archive of obsolete content
Normally, a <xul:stack> will change its size so that all of its child elements are completely visible. For example, moving a child of the stack far to the right will widen the stack so the child remains visible.-moz-text-blinkThe -moz-text-blink non-standard Mozilla CSS extension specifies the blink mode.-moz-window-shadowThe -moz-window-shadow CSS property specifies whether a windo...
...ree values indicating the minimum number of characters in a hyphenated word. If the word does not meet the required minimum number of characters in the word, before the hyphen, or after the hyphen, then the word is not hyphenated.-ms-hyphenate-limit-linesThe -ms-hyphenate-limit-lines CSS property is a Microsoft extension specifying the maximum number of consecutive lines in an element that may be
ended with a hyphenated word.-ms-hyphenate-limit-zoneThe -ms-hyphenate-limit-zone CSS property is a Microsoft extension specifying the width of the hyphenation zone.-ms-ime-alignThe -ms-ime-align CSS property is a Microsoft extension aligning the Input Method Editor (IME) candidate window box relative to the element on which the IME composition is active. The extension is implemented in Microsoft Edge ...
Writing JavaScript for XHTML - Archive of obsolete content
old alert() method is gone. The code looks something like this: <script type="text/javascript"> //<!-- window.alert("Hello World!"); //--> </script> Solution: The CDATA Trick This problem usually arises, when inline scripts are included in comments. This was common practice in HTML, to hide the scripts from browsers not capable of JS. In the age of XML comments are what they were int
ended: comments. Before processing the file, all comments will be stripped from the document, so enclosing your script in them is like throwing your lunch in a Piranha pool. Moreover, there's really no point to commenting out your scripts -- no browser written in the last ten years will display your code on the page. The easy solution is to do away with the commenting entirely: <script type="text/jav...
...tml+xml somewhere, we are safe to send the content as XML. In PHP, for example, you would write something like this: if( strpos( $_SERVER['HTTP_ACCEPT'], "application/xhtml+xml" ) ) { header( "Content-type: application/xhtml+xml" ); echo '<?xml version="1.0" ?>'."\n"; } else { header( "Content-type: text/html" ); } This distinction also sends the XML declaration, which is strongly recomm
ended, when the document is an XML file. If the content is sent as HTML, an XML declaration would break IE's Doctype switch, so we don't want it there. For completeness here is the Accept field, that Firefox 2.0.0.9 sends with its requests: Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Further Reading You will find several useful articl...
Using the Right Markup to Invoke Plugins - Archive of obsolete content
This article is about how to invoke a plugin with the correct use of HTML. It discusses the object element and the embed element, with details about using the most apt HTML to invoke Java in a web page as well. The Object Element: W3C Standards and Cross-Browser Issues The object element is part of the HTML 4.01 specification, and is the recomm
ended mechanism to invoke plugins. Its use is subject to a few caveats that this section outlines. Traditionally, the object element has been used differently by Microsoft Internet Explorer and by Mozilla-based browsers such as Netscape 7. In IE, the object element is used to invoke a plugin that is built on the ActiveX architecture. Here's an example of this kind of usage for IE: <!-- IE ONLY CODE --> <object classid="clsid:D27CDB6E-AE6D-11cf...
...d browsers should stop if they can display the outermost element, or else keep going inwards till they can find something to display. IE displays everything as if they are in series, and not nested. ...
Audio for Web games - Game development
In the context of your game world you may have loops and samples that are played in different circumstances, and it can be useful to be...
... In the context of your game world you may have loops and samples that are played in different circumstances, and it can be useful to be able to synchronize with other tracks for a more seamless exper...
Unconventional controls - Game development
But imagine going even further -- in this article we will explore various unconventional ways to control your web game, some more unconventional than others. TV remote Playing games on a TV screen doesn't always have to be done through consoles. There's already a Gamepad API working on the desktop computers, so we can imitate the experience, but we can go even further. ...
...ain Rogers: Battle at Andromeda was adjusted to work on a huge TV. Interestingly enough, the first Captain Rogers game (Asteroid Belt of Sirius) was optimized for low-end, small-screen, cheap smartphones running Firefox OS, so you can see the difference three years can make -- you can read the whole story in our Building games for Firefox OS TV Hacks post. Using a TV remote to control the game
ended up being surprisingly easy, because the events fired by the controller are emulating conventional keyboard keys. Captain Rogers had the keyboard controls implemented already: this.cursors = this.input.keyboard.createCursorKeys(); //... if(this.cursors.right.isDown) { // move player right } It works out of the box. The cursors are the four directional arrow keys on the keyboard, and these ha...
Gecko FAQ - Gecko Redirect 1
ator 1.0, was developed rapidly by a small team that was passionate about creating the next killer app, and they succeeded. Now that the web has evolved, a new generation layout engine was needed upon which future products could be built. Gecko enables a pioneering new class of dynamic content that is more interactive and offers greater presentation control to Web developers, using open and recomm
ended 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 a...
...er software. These developers can pick and choose the browser components they want from among those that Gecko offers, and package these components alongside their own within their finished products. ...
Advanced styling effects - Learn web development
ce page. Note: Blend modes are also very new, and slightly less well supported than filters. There is no support as yet in Edge, and Safari only supports some of the blend mode options. background-blend-mode Again, let's look at some examples so we can understand this better. ...
... Note: Don't worry if you don't understand some of the layout properties above, like position, top, bottom, z-index, etc. We will cover these in detail in our CSS Layout module. CSS shapes While it is true that everything in CSS is a rectangular box, and images are a physical rectangular box, we can m...
Overflowing content - Learn web development
irst example is a box that has been restricted by setting a height. Then we add content that exceeds the allocated space. The content overflows the box and falls into the paragraph below. The second example is a word in a box. The box has been made too small for the word and so it breaks out of the box. You might wonder why CSS works in such a messy way, displaying content outside of its int
ended container. Why not hide overflowing content? Why not scale the size of the container to fit all the content? Wherever possible, CSS does not hide content. This would cause data loss. The problem with data loss is that you might not notice. Website visitors may not notice. If the submit button on a form disappears and no one can complete the form, this could be a big problem! Instead, CSS overflo...
... Remove some content from the box below. Notice how the scrollbars remain, even if there is no need for scrolling. In the example above, we only need to scroll on the y axis, however we get scrollbars in both axes. To just scroll on the y axis, you could use the overflow-y property, setting overflow-y: scroll. You can also scroll on the x axis using overflow-x, although this is not a recomm
ended way to accommodate long words! If you have a long word in a small box, you might consider using the word-break or overflow-wrap properties. In addition, some of the methods discussed in Sizing items in CSS may help you create boxes that scale better with varying amounts of content. As with scroll, you get a scrollbar in the scrolling dimension whether or not there is enough content to cause a ...
Fundamental text and font styling - Learn web development
serif Fonts that have serifs (the flourishes and other small details you see at the ends of the strokes in some typefaces) My big red elephant sans-serif Fonts that don't have serifs. My big red elephant monospace Fonts where every character has the same width, typically used in code listings. My big red elephant cursive Fonts that are int
ended to emulate handwriting, with flowing, connected strokes. My big red elephant fantasy Fonts that are int
ended to be decorative. My big red elephant Font stacks Since you can't guarantee the availability of the fonts you want to use on your webpages (even a web font could fail for some reason), you can supply a font stack so that the browser has multiple fonts it can choos...
...l, sans-serif; } Line height The line-height property sets the height of each line of text -- this can take most length and size units, but can also take a unitless value, which acts as a multiplier and is generally considered the best option -- the font-size is multiplied to get the line-height. ...
The HTML5 input types - Learn web development
implement different validation behavior, you can use the pattern attribute, and you can also custom the error messages; we'll talk how to use these features in the Client-side form validation article later on. Note: If the data entered is not an email address, the :invalid pseudo-class will match, and the validityState.typeMismatch property will return true. Search field Search fields are int
ended to be used to create search boxes on pages and apps. This type of field is set by using the value search for the type attribute: <input type="search" id="search" name="search"> The main difference between a text field and a search field is how the browser styles its appearance. Often, search fields are rendered with rounded corners; they also sometimes display an "(X)", which clears the field o...
...sage-wise, sliders are less accurate than text fields. Therefore, they are used to pick a number whose precise value is not necessarily important. A slider is created using the <input> with its type attribute set to the value range. The slider-thumb can be moved via mouse or touch, or with the arrows of the keypad. It's important to properly configure your slider. To that end, it's highly recomm
ended that you set the min, max, and step attributes which set the minimum, maximum and increment values, respectively. Let's look at the code behind the above example, so you can see how its done. First of all, the basic HTML: <label for="price">Choose a maximum house price: </label> <input type="range" name="price" id="price" min="50000" max="500000" step="100" value="250000"> <output class="price-...
Front-end web developer - Learn web development
h module are designed to test your knowledge of the subject matter. Completing the assessments confirms that you are ready to move on to the next module. Modules Introduction to HTML (15-20 hour read/exercises) Multimedia and embedding (15-20 hour read/exercises) HTML tables (5-10 hour read/exercises) Styling and layout with CSS Time to complete: 90-120 hours Prerequisites It is recomm
ended that you have basic HTML knowledge before starting to learn CSS. You should at least study Introduction to HTML first. How will I know I'm ready to move on? The assessments in each module are designed to test your knowledge of the subject matter. Completing the assessments confirms that you are ready to move on to the next module. Modules CSS first steps (10-15 hour read/exercises) CSS bu...
...he assessments confirms that you are ready to move on to the next module. Modules CSS first steps (10-15 hour read/exercises) CSS building blocks (35-45 hour read/exercises) Styling text (15-20 hour read/exercises) CSS layout (30-40 hour read/exercises) Additional resources CSS layout cookbook Interactivity with JavaScript Time to complete: 135-185 hours Prerequisites It is recomm
ended that you have basic HTML knowledge before starting to learn JavaScript. You should at least study Introduction to HTML first. How will I know I'm ready to move on? The assessments in each module are designed to test your knowledge of the subject matter. Completing the assessments confirms that you are ready to move on to the next module. Modules JavaScript first steps (30-40 hour read/exer...
JavaScript basics - Learn web development
f you master these fundamentals, you have a head start on coding in other languages too! Important: 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 recomm
ended, dive deeper for the explanation) or the let keyword, followed by the name you give to the variable: let myVariable; Note: A semicolon at the end of a line indicates where a statement ends. It is only required when you need to separate statements on a single line. However, some people believe it's good practice to have semicolons at the end of each statement. There are other rules for when you...
...w. See Expressions and operators for a complete list. Note: Mixing data types can lead to some strange results when performing calculations. Be careful that you are referring to your variables correctly, and getting the results you expect. For example, enter '35' + '25' into your console. Why don't you get the result you expected? Because the quote marks turn the numbers into strings, so you've
ended up concatenating strings rather than adding numbers. If you enter, 35 + 25 you'll get the total of the two numbers. Conditionals Conditionals are code structures used to test if an expression returns true or not. A very common form of conditionals is the if ... else statement. For example: let iceCream = 'chocolate'; if(iceCream === 'chocolate') { alert('Yay, I love chocolate ice cream!'); ...
The web and web standards - Learn web development
look more like the web we know today. Web standards Web standards are the technologies we use to build web sites. These standards exist as long technical documents called specifications, which detail exactly how the technology should work. These documents are not very useful for learning how to use the technologies they describe (this is why we have sites like MDN Web Docs), but instead are int
ended to be used by software engineers to implement these technologies (usually in web browsers). For example, the HTML Living Standard describes exactly how HTML (all the HTML elements, and their associated APIs, and other surrounding technologies) should be implemented. Web standards are created by standards bodies -- institutions that invite groups of people from different technology companies to ...
...d the "raw" technologies that can be used to build web pages (such as HTML, CSS, and JavaScript), you'll soon start to come across various tools that can be used to make your work easier or more efficient. Examples include: The developer tools inside modern browsers that can be used to debug your code. Testing tools that can be used to run tests to show whether your code is behaving as you int
ended it to. Libraries and frameworks built on top of JavaScript that allow you to build certain types of web site much more quickly and effectively. So-called "Linters", which take a set of rules, look at your code, and highlight places where you haven't followed the rules properly. Minifiers, which remove all the whitespace from your code files to make it so that they are smaller and therefore do...
HTML Cheatsheet - Learn web development
However, in many cases we just need some quick hints as we go. That's the whole purpose of the cheatsheet, to give you some quick accurate ready to use code snippets for common usages. Remember that HTML tags must be used for their semantic, not their appearance. ...
...e entire width of a webpage. They also take up a full line of a webpage; they do not fit together side-by-side. Instead, they stack like paragraphs in an essay or toy blocks in a tower. Usage Code snippet Result A simple paragraph <p>I'm a paragraph</p> <p>I'm another paragraph</p> I'm a paragraph I'm another paragraph An ext
ended quotation <blockquote>The blockquote element indicates an ext
ended quotation.</blockquote> The blockquote element indicates an ext
ended quotation. Aditional information <details><summary>Html Cheatsheet</summary><p>Inline elements</p><p>Block elements</p></details> Html Cheatsheet Inline elements Block elements An unordered list <ul...
From object to iframe — other embedding technologies - Learn web development
ample 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 the border. Using this isn't really recomm
ended any more, as the same effect can be better achieved using border: none; in your CSS. src This 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 b...
... Now let's look at an <object> example that embeds a PDF into a page (see the live example and the source code): <object data="mypdf.pd...
Introduction to web APIs - Learn web development
ent.querySelector('.volume'); const audioSource = audioCtx.createMediaElementSource(audioElement); Next up we include a couple of event handlers that serve to toggle between play and pause when the button is pressed and reset the display back to the beginning when the song has finished playing: // play/pause audio playBtn.addEventListener('click', function() { // check if context is in susp
ended state (autoplay policy) if (audioCtx.state === 'susp
ended') { audioCtx.resume(); } // if track is stopped, play it if (this.getAttribute('class') === 'paused') { audioElement.play(); this.setAttribute('class', 'playing'); this.textContent = 'Pause' // if track is playing, stop it } else if (this.getAttribute('class') === 'playing') { audi...
... Next, we create a GainNode object using the AudioContext.createGain() metho...
What went wrong? Troubleshooting JavaScript - Learn web development
are spelling errors in your code that actually cause the program not to run at all, or stop working part way through -- you will usually be provided with some error messages too. These are usually okay to fix, as long as you are familiar with the right tools and know what the error messages mean! Logic errors: These are errors where the syntax is actually correct but the code is not what you int
ended it to be, meaning that program runs successfully but gives incorrect results. These are often harder to fix than syntax errors, as there usually isn't an error message to direct you to the source of the error. Okay, so it's not quite that simple -- there are some other differentiators as you drill down deeper. But the above classifications will do at this early stage in your career. We'll look ...
... SyntaxError: expected expression, got 'string' or SyntaxError: unterminated string literal These errors generally mean that you've left off a string value's opening or closing quote mark. In the first error above, string would be replaced with the unexpected character(s) that the browser found instead of a quote mark at the start of a string. The second error means that the string has not been
ended with a quote mark. For all of these errors, think about how we tackled the examples we looked at in the walkthrough. When an error arises, look at the line number you are given, go to that line and see if you can spot what's wrong. Bear in mind that the error is not necessarily going to be on that line, and also that the error might not be caused by the exact same problem we cited above! Note:...
Properly configuring server MIME types - Learn web development
ded 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 reported 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 int
ended to help guide a web browser in how the content is to be processed and displayed. Examples of MIME types are: text/html for normal web pages text/plain for plain text text/css for Cascading Style Sheets 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 Regis...
...stered 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 important? If the web server or application reports an incorrect MIME type for content, a web browser has no way, according to the HTTP specification, of knowing that the author actually int
ended the content to be processed and displayed in a way different from that implied by the reported MIME 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 co...
Website security - Learn web development
administration rights, access all data on the server, or destroy/modify the data to make it unusable. SQL injection types include Error-based SQL injection, SQL injection based on boolean errors, and Time-based SQL injection. This vulnerability is present if user input that is passed to an underlying SQL statement can change the meaning of the statement. For example, the following code is int
ended to list all users with a particular name (userName) that has been supplied from an HTML form: statement = "SELECT * FROM users WHERE name = '" + userName + "';" If the user specifies a real name, the statement will work as int
ended. However, a malicious user could completely change the behavior of this SQL statement to the new statement in the following example, by simply specifying the text in...
...and disclosure). In this attack, a malicious user attempts to access parts of the web server file system that they should not be able to access. This vulnerability occurs when the user is able to pass filenames that include file system navigation characters (for example, ../../). The solution is to sanitize input before using it. File Inclusion. In this attack, a user is able to specify an "unint
ended" file for display or execution in data passed to the server. When loaded, this file might be executed on the web server or the client-side (leading to an XSS attack). The solution is to sanitize input before using it. Command Injection. Command injection attacks allow a malicious user to execute arbitrary system commands on the host operating system. The solution is to sanitize user input before...
Getting started with Ember - Learn web development
Previous Overview: Client-side JavaScript frameworks Next In our first Ember article we will look at how Ember works and what it's useful for, install the Ember toolchain locally, create a sample app, and then do some initial setup to get it ready for development. Prerequisites: At minimum, it is recomm
ended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn how to install Ember, and create a starter app. Introducing Ember Ember is a component-service framework that focuses on the overall web applicati...
...board access to demos Re-enable Outline on focusable elements Ember has a strong commitment to being accessible by default and there is an entire section of the Ember Guides on accessibility on what it means for website / app design. That said, because this tutorial is a focus on the JavaScript side of making a small web application, TodoMVC's value comes from providing pre-made CSS and recomm
ended HTML structure, which eliminates small differences between implementations, allowing for easier comparison. Later on in the tutorial, we'll focus on adding code to our application to fix some of TodoMVC's biggest faults. Installing the Ember tooling Ember uses a command-line interface (CLI) tool for building and scaffolding parts of your application. You'll need node and npm installed bef...
Accessibility in React - Learn web development
Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To learn about implementing keyboard accessibility in React. Including keyboard users At this point, we've accomplished all of the features we set out to implement. ...
...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 Rea...
TypeScript support in Svelte - Learn web development
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. Prerequisites: At minimum, it is recomm
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 configure and use TypeScript when developing Svelte applications. Note that our application is fully functional and porting it to TypeScript is c...
...Svelte" by James Birtles, which has been discontinued. In case you have it installed, you should uninstall it and install the official Svelte extension instead. Anyway, assuming you are inside the VS Code application, from the root of your project's folder, type code . (the trailing dot tells VS code to open the current folder) to open the code editor. VS Code will tell you that there are recomm
ended extensions to install. Clicking Install all will install Svelte for VS Code. We can also see that the setupTypeScript.js file made a couple of changes to our project. The main.js file has been renamed to main.ts, which means that VS Code can provide hover-information on our svelte components: We also get type-checking for free. If we pass an unknown property in the options parameter of t...
Adding a new todo form: Vue events, methods, and models - Learn web development
on the client, there's no server to handle the postback. We also lose all local state on page refresh. To prevent the browser from posting to the server, we need to stop the event's default action from bubbling up through the page (Event.preventDefault(), in vanilla JavaScript). Vue has a special syntax called event modifiers that can handle this for us right in our template. Modifiers are app
ended to the end of an event with a dot like so: @event.modifier. Here is a list of event modifiers: .stop: Stops the event from propagating. Equivalent to Event.stopPropagation() in regular JavaScript events. .prevent: Prevents the event's default behavior. Equivalent to Event.preventDefault(). .self: Triggers the handler only if the event was dispatched from this exact element. {.key}...
...available in App.vue, we need to add an item representing it to the ToDoItems array. This can be done by pushing a new to-do item object to the array containing our new data. Update your addToDo() method like so: addToDo(toDoLabel) { this.ToDoItems.push({id:uniqueId('todo-'), label: toDoLabel, done: false}); } Try testing your form again, and you should see new to-do items get app
ended to the end of the list. Let's make a further improvement before we move on. If you submit the form while the input is empy, todo items with no text still get added to the list. To fix that, we can prevent the todo-added event from firing when name is empty. Since name is already being trimmed by the .trim directive, we only need to test for the empty string. Go back to your ToDoForm comp...
Handling common JavaScript problems - Learn web development
l want to be mindful of, such as: Basic syntax and logic problems (again, check out Troubleshooting JavaScript). Making sure variables, etc. are defined in the correct scope, and you are not running into conflicts between items declared in different places (see Function scope and conflicts). Confusion about this, in terms of what scope it applies to, and therefore if its value is what you int
ended. You can read What is "this"? for a light introduction; you should also study examples like this one, which shows a typical pattern of saving a this scope to a separate variable, then using that variable in nested functions so you can be 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), ...
... this case, transforming one flavor of JavaScript into another). So for example, we talked about arrow functions (see arrow-function.html live, and see the source code) earlier in the article, which only work in the newest browsers: () => { ... } We could transpile this across to a traditional old-fashioned anonymous function, so it would work in older browsers: function() { ... } The recomm
ended tool for JavaScript transpiling is currently Babel. This offers transpilation capabilities for language features that are appropriate for transpilation. For features that can't just be easily transpiled into an older equivalent, Babel also offers polyfills to provide support. The easiest way to give Babel a try is to use the online version, which allows you to enter your source code on the left,...
Command line crash course - Learn web development
s that start with mdn- and end with .bak. Terminal -- considered harmful? We've alluded to this before, but to be clear -- you need to be careful with the terminal. Simple commands do not carry too much danger, but as you start putting together more 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 int
ended 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 important, 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 h...
...age and help information. Try this now: prettier Your output should look something like this: Usage: prettier [options] [file/glob ...] By default, output is written to stdout. Stdin is read if it is piped to Prettier and no files are given. ... It's always worth at the very least skimming over the usage information, even if it is long. It'll help you to understand better how the tool is int
ended to be used. Playing with Prettier Let's have a quick play with Prettier, so you can see how it works. First of all, create a new directory somewhere on your file system that is easy to find. Maybe a directory called prettier-test on your Desktop. Now save the following code in a new file called index.js, inside your test directory: const myObj = { a:1,b:{c:2}} function printMe(obj){console.l...
Accessibility/LiveRegionDevGuide
e event types, namely EVENT_OBJECT_SHOW and EVENT_OBJECT_HIDE. Text Changed The text changed events are quite similar in AT-SPI and IAccessible2 with both having an insert and delete or removal events. The text changed event type in AT-SPI has a similar scheme as the object:children-changed events. In this case, the root event string is object:text-changed with ":delete" and ":insert" being app
ended to complete the event type. In IAccessible2, there are two distinct event types - IA2_EVENT_TEXT_REMOVED and IA2_EVENT_TEXT_INSERTED. The text associated with an AT-SPI text changed event is directly in the event object. The event.any_data field holds the entire text string while event.detail1 is the start index while event.detail2 is the text string length. In IAccessible2, IAccessibleText::get_...
...t 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 should be presented. In this case the start index is 0 and the end index/run length is the length of the text - 1. container-channel The channel property defines two channels - 'main' and 'alert'. It was originally int
ended to give web developers a means to force a live region message to go to a separate output device. For instance, a 'main' channel message might go to the speech generator while an 'alert' channel message might be sent to a Braille device. However, the channel property is also significant for single output applications that rely on speech output only. In this case, 'main' channel messages are queued...
Mozilla’s UAAG evaluation report
No directional navigation, or navigation to links by name 9.8 Text search. (P2) VG Provides forward and reverse text search capability from the element with the current focus/selection, with and without case sensitivity Very slow on larger documents. Needs improvement. 9.9 Structured navigation. (P2) P DOM Inspector provides some capability, but not really int
ended for end users (Tasks, Tools, DOM Inspector) 9.10 Configure important elements. (P3) NI The navigational elements aren't user configurable Guideline 10. Orient the user. Checkpoint Title Status Notes/plans Checkpoint Title Status Notes/plans 10.1 Table orientation. (P1) NI We don't make use of scope, headers, axis, or an...
... 10.4 Highlight special elements. (P2) G Use system colors by default (classic theme) Underlines links by default Does not have UI to highlight non-link and non-form elements that have event handlers Can have user CSS for user styling of elements with event handlers 10.5 Outline view. (P2) P DOM Inspector provides a type of outline view, although it is not int
ended for end users Page info (Ctrl+I) gives lists of links, media, forms/elements Can use a user style sheet to implement an outline Bug 127030 has been filed for an outline view. 10.6 Provide link information. (P3) G Only uses color to indicate whether a link has been visted by default Context menu properties provides link information, but does not provide the size of t...
Choosing the right memory allocator
This is the /js/ subtree of the source code. Also, all consumers of the JSAPI must use these routines for allocati...
...This is the /js/ subtree of the source code. ...
Old Thunderbird build
While you can build Thunderbird on older hardware it can take quite a bit of time to compile on slower machines with less RAM. Good internet connection for the initial source download. ...
...tory of the comm-central checkout that contains the following line: ac_add_options --enable-application=mail You can create a file with this line by doing this: cd comm-central echo 'ac_add_options --enable-application=mail' > mozconfig If you omit this line, the build system will build Firefox instead. Other build configuration options can be added to this file, although it's strongly recomm
ended that you only use options that you fully understand. For example, to create a debug build instead of a release build, that file would contain: ac_add_options --enable-debug For more on configuration options, see the page Configuring build options. Note that if you use an MOZ_OBJDIR it cannot be a sibling folder to your source directory. Use an absolute path to be sure! Building Thunderbird B...
Simple Instantbird build
ment version of Instantbird. For additional, more detailed information, see the build documentation. This should be kept in sync with Simple Thunderbird build, you might want to take a look at that page too. Build prerequisites Hardware Requirements: While you can build Instantbird on older hardware it can take quite a bit of time to compile on slower machines, and having 8GB of RAM is recomm
ended (though you can probably still get away with 4Gb). Good internet connection for the initial source download. Setup: Depending on your Operating System you will need to carry out a different process to prepare your machine. So firstly complete the instructions for your OS and then continue following these build instructions. Windows Build Prerequisites GNU/Linux Build Prerequisites Mac OS...
.... Then run python client.py checkout to ensure you are up-to-date. The source code requires 1.5GB of free space or more. Build configuration By default, the build system creates a release build of Instantbird roughly equivalent to the official Instantbird release builds. If that's not exactly what you want, there are many build configuration options to choose from, although it's strongly recomm
ended that you only use options that you fully understand. The normal way to specify build options is to place them in a file called '.mozconfig' at the root of your mozilla source tree, i.e. your comm-central repo. For example, to create a debug build instead of a release build, that file would contain: ac_add_options --enable-debug For more on configuration options, see the page Configuring build ...
Simple Thunderbird build
While you can build Thunderbird on older hardware it can take quite a bit of time to compile on slower machines with less RAM. ...
...ntral checkout that contains the following line: ac_add_options --enable-application=comm/mail You can create a file with this line by doing this in the source/ directory: echo 'ac_add_options --enable-application=comm/mail' > mozconfig If you omit this line, the build system will build Firefox instead. Other build configuration options can be added to this file, although it's strongly recomm
ended that you only use options that you fully understand. For example, to create a debug build instead of a release build, that file would also contain the line: ac_add_options --enable-debug Each of these ac_add_options entries needs to be on its own line. For more on configuration options, see the page Configuring build options. Note that if you use an MOZ_OBJDIR it cannot be a sibling folder to ...
SVG Guidelines
=" M5,5 L1,1z "> can be cut down to this: <path d="M5,5 L1,1z"> Similarly, this polygon: <polygon points=" 0,0 4,4 4,0 "/> can be cut down to this: <polygon points="0,0 4,4 4,0"/> Line breaks You should only use line breaks for logical separation or if they help make the file readable. You should avoid line breaks between every single element or within attribute values. It's recomm
ended to put the attributes on the same line as their tag names, if possible. You should also put the shortest attributes first, so they are easier to spot. Unused tags and attributes Editor metadata Vector editors (Inkscape, Adobe Illustrator, Sketch) usually add a bunch of metadata in SVG files while saving them. Metadata can mean many things, including: The typical "Created with editor" comme...
...th 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 supported 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 recomm
ended 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 the use of CDATA sections CDATA sections are used to avoid parsing some text as HTML. Most of time, CDATA isn't needed, for example, the content in <style> tags...
Multiple Firefox profiles
istory. It takes little time to set up a new profile, and once it is complete, all of your Firefox versions will update separately and can be run simultaneously. Available browser development channels There are four available browser channels, each at a different level of stability and development. The four channels are Release, Beta, Developer Edition, and Nightly. The Release channel is recomm
ended for most users, as it is the "official release" channel. However, for those more adventurous, you can try one of the other three channels to see what is coming in Firefox and play around with emerging features. The Beta channel contains the features that are expected to be in the next release of Firefox and are in final stages of testing. Aurora contains experimental features, which are not yet a...
...d prompt: Alt-F2 if you use GNOME Shell or KDE Plasma, consult your desktop environment documentation for other environments. Run firefox --new-instance --ProfileManager. macOS Run the Terminal application, which is found in Applications/Utilities. Type or paste in the path to Firefox, followed by .app/Contents/MacOS/firefox. For example, if Firefox is installed in the recomm
ended location, you would enter /Applications/Firefox.app/Contents/MacOS/firefox. If you have the path to your desired profile handy, enter a space character, followed by -profile followed by another space character, followed by the full path to the profile folder you wish to launch into. This will launch Firefox immediately. Otherwise, enter a space character followed by --profilemanager. This wil...
Sqlite.jsm
before), the old statement object is reused. This saves time associated with parsing the SQL statement and creating a new statement object. The downside is the cached statement object lingers in the opened connection, taking up memory. When a statement is executed via execute(), the underlying statement object is thrown away as soon as the statement finishes execution. executeCached() is recomm
ended for statements that will be executed many times. execute() is recomm
ended for statements that will be executed seldomly or once. Please note that callers don't need to prepare statements manually before execution. Just call executeCached() and the statement will be prepared for you automatically. Parameters can be bound to the statement by defining the params argument. This argument can be an a...
...onRow is not defined, the full results of the operation are buffered before the caller is notified of statement completion. For INSERT, UPDATE, and DELETE statements, this is not relevant. However, it can have drastic implications for SELECT statements. If your SELECT statement could return lots of data, this buffering of returned rows could result in excessive memory usage. Therefore, it's recomm
ended to use onRow with SELECT statements. Along with a result row, onRow is passed a cancel function as its second argument. Consumers of this API can call the cancel function should they want to immediately abort the execution of the statement. When cancelled, subsequent rows will not be processed and no more onRow invocations will be made. If an exception is thrown by the onRow handler, the ...
Localization sign-off reviews
nly evaluates new L10n work. This is done by generating a diff between the new release revision being considered and the previously approved release revision. focuses on technical accuracy and completion of L10n work, not translation quality. evaluates new release revisions, not entire L10n repos. does not need to be approved before revision merge between release channels, although it is recomm
ended. Sign-off review criteria Since the scope of each QA review process varies, the criteria used to evaluate a localizer's work also varies. In principle, they share basic elements, but sign-off reviews are only for evaluating the changes between your latest approved revision and the new revision you've submitted for release approval. Hence, unless a localizer makes a change within the new revision...
... of tool-originated corruption This is common. Most bugs filed from sign-offs are caused by a tool corrupting your localization's files. Newly translated strings that shouldn't have been translated Self-explanatory enough, right? Access key changes We ensure that when access keys are changed that they are consistent with the keyboard layout for that particular locale and not bl
ended between two or more distinct layouts. How it all works A large part of the review process takes place before you even submit your request for a sign-off review. To put it simply, when we receive your request, we expect that you have spent time testing your work and making sure all strings have been localized and that your changes are relatively functional. Your review request symbolically repr...
Investigating leaks using DMD heap scan mode
the set of all live blocks of malloc-allocated memory and their allocation stacks, and allows you to log these blocks, and the values stored in them, to a file. When combined with cycle collector logging, this can be used to investigate leaks of refcounted cycle collected objects, by figuring out what holds a strong reference to a leaked object. When should you use this? DMD heap scan mode is int
ended to be used to investigate leaks of cycle collected (CCed) objects. DMD heap scan mode is a "tool of last resort" that should only be used when all other avenues have been tried and failed, except possibly ref count logging. It is particularly useful if you have no idea what is causing the leak. If you have a patch that introduces a leak, you are probably better off auditing all of the strong refe...
..."tool of last resort" that should only be used when all other avenues have been tried and failed, except possibly ref count logging. It is particularly useful if you have no idea what is causing the leak. If you have a patch that introduces a leak, you are probably better off auditing all of the strong references that your patch creates before trying this. The particular steps given below are int
ended for the case where the leaked object is alive all the way through shutdown. You could modify these steps for leaks that go away in shutdown by collecting a CC and DMD log prior to shutdown. However, in that case it may be easier to use refcount logging, or rr with a conditional breakpoint set on calls to Release() for the leaking object, to see what object actually does the release that causes th...
Scroll-linked effects
n of sticky positioning relies on the scroll event listener to reposition the "toolbar" div. As the scroll event listener runs in the JavaScript on the browser's main thread, it will be asynchronous relative to the user-visible scrolling. Therefore, with asynchronous scrolling, the event handler will be delayed relative to the user-visible scroll, and so the div will not stay visually fixed as int
ended. Instead, it will move with the user's scrolling, and then "snap" back into position when the scroll event handler runs. This constant moving and snapping will result in a jittery visual effect. One way to implement this without the scroll event listener is to use the CSS property designed for this purpose: <body style="height: 5000px"> <div id="toolbar" style="position: sticky; top: 0px; margi...
...f the scroll position is within 200 pixels of the top of the "snaptarget" div. If it is, then it triggers an animation to "snap" the scroll position to the top of the div. As this animation is driven by JavaScript on the browser's main thread, it can be interrupted by other JavaScript running in other tabs or other windows. Therefore, the animation can end up looking janky and not as smooth as int
ended. Instead, using the CSS snap-points property will allow the browser to run the animation asynchronously, providing a smooth visual effect to the user. <body style="height: 5000px"> <style> body, /* blink currently has bug that requires declaration on `body` */ html { scroll-snap-type: y proximity; } .snaptarget { scroll-snap-align: start; position: relative; ...
Performance
milar to Valgrind, but it runs faster because it uses static source code instrumentation. LSAN is part of Mozilla's continuous integration testing, with most tests running through it as part of the AddressSanitizer (a.k.a. ASAN) test jobs. Apple tools Apple provides some tools for Mac OS X that report similar problems to those reported by LSAN and Valgrind. The "leaks" tool is not recomm
ended for use with SpiderMonkey or Firefox, because it gets confused by tagged pointers and thinks objects have leaked when they have not (see bug 390944). Leak Gauge Leak Gauge is a tool that can be used to detect certain kinds of leaks in Gecko, including those involving documents, window objects, and docshells. LogAlloc LogAlloc is a tool that dumps a log of memory allocations in...
... Profiling with Shark (obsolete - replaced by Instruments) How to use Apple's Shark tool to profile Mozilla code. Investigating CSS Performance How to figure out why restyle is taking so long Power profiling Power profiling overview This page provides an overview of relevant information, including details about hardware, what can be measured, and recomm
ended approaches. It should be the starting point for anybody new to power profiling. tools/power/rapl (Mac, Linux) tools/power/rapl is a command-line utility in the Mozilla codebase that uses the Intel RAPL interface to gather direct power estimates for the package, cores, GPU and memory. powermetrics (Mac-only) powermetrics is a command-line utility that gathers and displays a wid...
A brief guide to Mozilla preferences
It provides a general overview of Mozilla preferences, including where preferences are stored, a file-by-file analysis of preference loading sequence, and information on editing preferences. What is a preference? A preference is any value or defined behavior that can be set (presumably, one setting is preferable to another). Preference changes via user interface usually take effect immediately. The values are saved to the user profile (in prefs.js), for both Firefox and Thunderbird. A preference is read from a file, and can call up to four methods: pref(), user_pref(), sticky_pref() and lockPref(). ...
... preferences which are different from the default. The exception to this is a preference read using sticky_pref() - these preference will be written whenever the preference has a user value even when it is the same as the default. Modifying preferences Advanced users can set named preferences via the advanced preferences editor, by typing about:config in the Location Bar. This UI is not recomm
ended for most users. Programmatic changes to preferences can be made using the Preferences.jsm module from JS code, or the mozilla::Preferences static class methods from C++ code. Changing defaults A systems administrator can modify the default preferences in two ways: The administrator may add an all-companyname.js preference file (install_directory/browser/defaults/preferences/all-companyname.j...
Research and prep
It is one of the most customizable and localizable parts of the product l10n process, as it goes beyond string translation. We believe that localization teams are in the best position to provide recommendations on what local providers we can use for web services because you're in the market, work in the language, and know your users. ...
... that means, please contact milos@mozilla.com or Milos on IRC. RSS Readers and Content handlers Productization for RSS readers and content handlers applies only to Firefox desktop. Your selections for default RSS readers and content handlers should follow these guidelines: Be translated in your language (because it makes the application unusable if it's not in your language Provide for the int
ended user experience (e.g., minimal to no advertisements within the user experience) No more than three (if possible) choices. Choosing based on popularity is fine. Examples from various localizations Some examples from en-US Web Service Provider Rationale Global Search Google Best user experience and broadest results. e-Commerce Search Amazon Broad s...
McCoy
ile 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. ...
...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. Signing from command line Currently there is no support to run McCoy from command line under Windows, but it is planned to add this support in the future. ...
Introduction to NSPR
by NSPR differ widely in the mechanisms they use to support thread priorities. In general, an NSPR thread of higher priority has a statistically better chance of running relative to threads of lower priority. However, because of the multiple strategies to provide execution vehicles for threads on various host platforms, priorities are not a clearly defined abstraction in NSPR. At best they are int
ended to specify a preference with respect to the amount of CPU time that a higher-priority thread might expect relative to a lower-priority thread. This preference is still subject to resource availability, and must not be used in place of proper synchronization. For more information on thread synchronization, see NSPR Thread Synchronization. The issue is further muddied by inconsistent offerings fro...
...ocks and Monitors In general, a monitor is a conceptual entity composed of a mutex, one or more condition variables, and the monitored data. Monitors in this generic sense should not be confused with the monitor type used in Java programming. In addition to PRLock, NSPR provides another mutex type, PRMonitor, which is reentrant and can have only one associated condition variable. PRMonitor is int
ended for use with Java and reflects the Java approach to thread synchronization. To access the data in the monitor, the thread performing the access must hold the mutex, also described as being "in the monitor." Mutual exclusion guarantees that only one thread can be in the monitor at a time and that no thread may observe or modify the monitored data without being in the monitor. Monitoring is about...
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: important; int
ended 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 executio...
...ution time to affect NSPR's log service for your application. all The name all enables all log modules. To enable all log module calls to PR_LOG, set the variable as follows: set NSPR_LOG_MODULES=all:5 timestamp Including timestamp results in a timestamp of the form "2015-01-15 21:24:26.049906 UTC - " prefixing every logged line. append Including append results in log entries being app
ended to the existing contents of the file referenced by NSPR_LOG_FILE. If not specified, the existing contents of NSPR_LOG_FILE will be lost as a new file is created with the same filename. sync The name sync enables unbuffered logging. This ensures that all log messages are flushed to the operating system as they are written, but may slow the program down. bufsize:size The name bufsize:size sets...
Building NSS
on many different platforms and has many options, it may be complex to build. Please read these instructions carefully before attempting to build. Build environment NSS needs a C and C++ compiler. It has minimal dependencies, including only standard C and C++ libraries, plus zlib. For building, you also need make. Ideally, also install gyp and ninja and put them on your path. This is recomm
ended, as the build is faster and more reliable. Windows NSS compilation on Windows uses the same shared build system as Mozilla Firefox. You must first install the Windows Prerequisites, including MozillaBuild. You can also build NSS on the Windows Subsystem for Linux, but the resulting binaries aren't usable by other Windows applications. Get the source NSS and NSPR use Mercurial for source cont...
...ariety 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. USE_64 0 Build for a 32-bit environment/ABI. This is the default. 1 Build for a 64-bit environment/ABI. This is recomm
ended. USE_ASAN 0 Do not create an AddressSanitizer build. This is the default. 1 Create an AddressSanitizer build. Unit testing NSS contains extensive unit tests. Scripts to run these are found in the tests directory. Run the standard suite by: HOST=localhost DOMSUF=localdomain USE_64=1 nss/tests/all.sh Unit test configuration NSS tests are configured using environment var...
NSS 3.20 release notes
vices (NSS) 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 ext
ended to support 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 SSLDHEGroupTyp...
...fault minimum size of the library. New Types in sslt.h SSLDHEGroupType - Enumerates the set of DHE parameters embedded in NSS that can be used with function SSL_DHEGroupPrefSet New Macros in ssl.h SSL_ENABLE_SERVER_DHE - A socket option user to enable or disable DHE ciphersuites for a server socket Notable Changes in NSS 3.20 The TLS library has been ext
ended to support 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 support session tickets while using...
NSS 3.21 release notes
butions 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. ...
...nge in sslerr.h SSL_ERROR_RX_SHORT_DTLS_READ - error code for failure to include a complete DTLS record in a UDP packet SSL_ERROR_NO_SUPPORTED_SIGNATURE_ALGORITHM - error code for when no valid signature and hash algorithm is available SSL_ERROR_UNSUPPORTED_SIGNATURE_ALGORITHM - error code for when an unsupported signature and hash algorithm is configured SSL_ERROR_MISSING_EXT
ENDED_MASTER_SECRET - error code for when the ext
ended master secret is missing after having been negotiated SSL_ERROR_UNEXPECTED_EXT
ENDED_MASTER_SECRET - error code for receiving an ext
ended master secret when previously not negotiated in sslt.h SSL_ENABLE_EXT
ENDED_MASTER_SECRET - configuration to enable the TLS ext
ended master secret extension (RFC 7627) ssl_preinfo_version - used w...
NSS 3.28.3 release notes
nged to include an additional attribute. That size increase caused crashes or malfunctioning with applications that use that data structure directly, or indirectly through ECPublicKey, ECPrivateKey, NSSLOWKEYPublicKey, NSSLOWKEYPrivateKey, or potentially other data structures that reference ECParams. The change has been reverted to the original state in bug 1334108. SECKEYECPublicKey had been ext
ended with a new attribute, named "encoding". If an application passed type SECKEYECPublicKey to NSS (as part of SECKEYPublicKey), the NSS library read the uninitialized attribute. With this NSS release SECKEYECPublicKey.encoding is deprecated. NSS no longer reads the attribute, and will always set it to ECPoint_Undefined. See bug 1340103. Compatibility NSS 3.28.3 shared libraries are backward compat...
... exceptions mentioned above), will work with NSS 3.28.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. If you had compiled your application against header files of NSS 3.28, NSS 3.28.1 or NSS 3.28.2, it it recomm
ended that you recompile your application against NSS 3.28.3, at the time you upgrade to NSS 3.28.3. Please note that NSS 3.29 also contained the incorrect change. You should avoid using NSS 3.29, and rather use NSS 3.29.1 or a newer version. See also the separate release notes for NSS 3.29.1 Feedback Bugs discovered should be reported by filing a bug report with bugzilla.mozilla.org (product NSS). ...
NSS 3.29.1 release notes
nged to include an additional attribute. That size increase caused crashes or malfunctioning with applications that use that data structure directly, or indirectly through ECPublicKey, ECPrivateKey, NSSLOWKEYPublicKey, NSSLOWKEYPrivateKey, or potentially other data structures that reference ECParams. The change has been reverted to the original state in bug 1334108. SECKEYECPublicKey had been ext
ended with a new attribute, named "encoding". If an application passed type SECKEYECPublicKey to NSS (as part of SECKEYPublicKey), the NSS library read the uninitialized attribute. With this NSS release SECKEYECPublicKey.encoding is deprecated. NSS no longer reads the attribute, and will always set it to ECPoint_Undefined. See bug 1340103. Note that NSS 3.28.3 from the older NSS 3.28.x branch has also...
...s mentioned above), will work with NSS 3.29.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. 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 recomm
ended 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 reported by filing a bug report with bugzilla.mozilla.org (product NSS). ...
NSS 3.48 release notes
8_RTM. NSS 3.48 requires NSPR 4.24 or newer. NSS 3.48 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_48_RTM/src/ Other releases are available in NSS Releases. Notable Changes in NSS 3.48 TLS 1.3 is the default maximum TLS version. See Bug 1573118 for details. TLS ext
ended master secret is enabled by default, where possible. See Bug 1575411 for details. The master password PBE now uses 10,000 iterations by default when using the default sql (key4.db) storage. Because using an iteration count higher than 1 with the legacy dbm (key3.db) storage creates files that are incompatible with previous versions of NSS, applications that wish to enable it for key3.db are req...
...re 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 support NEON Bug 1575411 - Enable TLS ext
ended 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 variable warnings from certdata.perl Bug...
NSS Tools certutil
/.netscape). On Windows NT the default is the current directory. The cert8.db and key3.db database files must reside in the same directory. -P dbprefix Specify the prefix used on the cert8.db and key3.db files (for example, my_cert8.db and my_key3.db). This option is provided as a special case. Changing the names of the certificate and key databases is not recomm
ended. -e Check a certificate's signature during the process of validating a certificate. -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. ...
...heRed Hat Certificate System Administration Guide. -5 Add a Netscape certificate type extension to a certificate that is being created or added to the database. Netscape certificate type extensions are described in Standard X.509 v3 Certificate Extensions in Appendix A.3 of theRed Hat Certificate System Administration Guide. -6 Add an ext
ended key usage extension to a certificate that is being created or added to the database. Ext
ended key usage extensions are described in Standard X.509 v3 Certificate Extensions in Appendix A.3 of theRed Hat Certificate System Administration Guide. -7 emailAddrs Add a comma-separated list of email addresses to the subject alternative name extension of a certificate or cer...
certutil
t 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 option is provided as a special case. Changing the names of the certificate and key databases is not recomm
ended. -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 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 val...
...abase. There are several available keywords: o sslClient o sslServer o smime o objectSigning o sslCA o smimeCA o objectSigningCA o critical X.509 certificate extensions are described in RFC 5280. -6 | --extKeyUsage keyword,keyword Add an ext
ended key usage extension to a certificate that is being created or added to the database. Several keywords are available: o serverAuth o clientAuth o codeSigning o emailProtection o timeStamp o ocspResponder o stepUp o critical X.509 certificate extensions are ...
GCIntegration - SpiderMonkey Redirect 1
At a high level, there are three issues to be aware of: Interactions between the garbage collector and the cycle collector Incremental garbage collection Moving garbage collection The APIs for GC/CC interaction and incremental GC are already in place. Development of moving GC (both generational and compacting) is under way, but only in the JavaScript shell so far. We're still thinking about how the APIs for moving GC should work. ...
...If a pointer doesn't fit one of these categories, then it probably requires a write barrier. Before the pointer is modified (except initializing writes, which don't need a barrier), you should call IncrementalReferenceBarrier() or IncrementalValueBarrier(), passing it the value the pointer held before the write. There are several examples of this usage in XPConnect. The js::ObjectPtr class is int
ended to serve as a drop-in replacement for JSObject *. It has an assignment operator that automatically invokes a write barrier. So far, though, there hasn't been much use for this class--there aren't many places outside of SpiderMonkey where a write barrier is required. Read barriers "Weak pointers" are a major complication to the scheme described above. For the purposes of this article, a weak poi...
64-bit Compatibility
SUword, JSWord (let's not use these, kthx) The following types are 32-bit on 32-bit platforms. For all intents and purposes they are also 32-bit on 64-bit platforms: intN, uintN JSIntn, JSUintn, JSBool General Problems with Pointers When performing bitwise operations on pointer values, make sure that both operands are 64-bit. The compiler can implicitly sign or zero extend operands with unint
ended side effects. For example, consider this code: #define POINTER_TAGBITS 3 static inline uintptr_t UnmaskPointer(uintptr_t v) { return v & ~POINTER_TAGBITS; } The value 3 will be inverted to 0xFFFFFFFC, then zero-ext
ended to 0x00000000FFFFFFFC - a subtle and nasty bug, assuming it is unint
ended. The best way to fix this is to make types explicit, such as: const uintptr_t POINTER_TAGBITS = ...
...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. ...
Bytecode Descriptions
tup the script suspends itself: the "initial yield". Later, when resuming execution, rval, gen and resumeKind will receive the values passed in by JSOp::Resume. resumeKind is the GeneratorResumeKind stored as an Int32 value. This instruction must appear only in scripts for generators and async generators. gen must be the generator object for the current frame. It must not have been previously susp
ended. The resume point indicated by resumeIndex must be the next instruction in the script, which must be AfterYield. Implements: GeneratorStart, steps 4-7. Format: JOF_RESUMEINDEX AfterYield Operands: (uint32_t icIndex) Bytecode emitted after yield expressions. This is useful for the Debugger and AbstractGeneratorObject::isAfterYieldOrAwait. It's treated as jump target op so that the Baseline Inte...
... Int32 value. If it is Next, continue to the next instruction. If resumeKind is Throw or Return, these completions are handled by throwing an exception. See GeneratorThrowOrReturn. Resume Stack: gen, val, resumeKind => rval Resume execution of a generator, async function, or async generator. This behaves something like a call instruction. It pushes a stack frame (the one saved when gen was susp
ended, rather than a fresh one) and runs instructions in it. Once gen returns or yields, its return value is pushed to this frame's stack and execution continues in this script. This instruction is emitted only for the resumeGenerator self-hosting intrinsic. It is used in the implementation of %GeneratorPrototype%.next, .throw, and .return. gen must be a susp
ended generator object. resumeKind must be i...
Exact Stack Rooting
Introduction This guide explains the basics of interacting with the GC from SpiderMonkey. Since the GC may move GCThings, it very important that SpiderMonkey know about each and every GCPointer in the system. 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. GCPointers can be stored as a property of a GCThing, on the CHeap, or in the CStack. These three storage regions have different lifetime and overhead characteristics and thus require different management strategies for efficient space and CPU utilization. ...
... GC. Instead, every pointer on the CStack should be considered part of the RootSet. To that end, we have a special "Rooting" mechanism for stack pointers that is very efficiently able to add and remove GCPointers to the RootedSet. The downside of this efficiency is that GCPointers must be added to and removed from this RootedSet tracking structure in LIFO order. For this reason it is highly recomm
ended that this rooting mechanism only be used on the CStack. js::Rooted<T> typedef js::Rooted<T> RootedT; -> RootedObject, RootedString, RootedScript, etc. Because of the LIFO restriction, using this interface manually is extremely cumbersome. Instead, SpiderMonkey has a convenient suite of C++ RAII classes to do this for you, called js::RootedT: RootedString str1(cx, JS_ValueToString(cx, val)); ...
Statistics API
Overview Each time a garbage collection occurs, SpiderMonkey keeps track of how long each phase of the collection took, along with some related data. There are several ways to get access to this data: The environment variable MOZ_GCTIMER controls text dumping of GC stats. MOZ_GCTIMER may be none, stderr, stdout, or a filename. If a filename is given, data is app
ended to that file. When logging to a file is used in combination with multi-process firefox (e10s) it is necessary to set security.sandbox.content.level = 0, otherwise the content process will crash. The browser preference javascript.options.mem.log controls dumping of human-readable GC stats messages to the developer console. The browser preference javascript.options.mem.notify controls emission of JSON encoded GC stats...
... total_time: number (milliseconds) - The amount of wall time that this GC consumed. Note: this is the sum of all the slice durations, not end time - start time. compartments_collected: integer - The number of compartments that were collected by the GC. compartment_count: integer - The number of compartments that were present in the system at the end of the GC. max_pause:...
Tracing JIT
e itself contains a hot PC that has not yet been traced, the trace monitor may be asked to begin nested recording. This is the same as normal recording mode, except that the outermost recorder is placed on a deferred-abort stack. When the innermost recorder completes -- successfully or otherwise -- every recorder on the deferred abort stack is aborted. This process is called deep aborting the susp
ended recorders. Executing When the monitor 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 po...
... expiring a timer or any similar abnormal condition -- the monitor returns to monitoring mode. Some other terminology may be helpful when reading the code: The term guard denotes a condition that is checked by an executing trace to confirm that some assumptions made during recording still hold. If guard's condition fails to hold, the guard either jumps to an exit or, if the guard has been ext
ended, jumps to a sub-trace that has been recorded under the opposite assumption as the guard was checking. For example, when recording any conditional branch in the SpiderMonkey bytecode, a guard will be incorported into the trace that checks the branch is taken the same way during execution as it was during recording. If this guard fails once, the trace will exit. If it fails enough times to become h...
JIT Optimization Strategies
Provide a repository of JIT Optimization Strategy information which the JIT Coach tool can parse to display in its UI. 2. ...
...Provide a repository of JIT Optimization Strategy information which the JIT Coach tool can parse to display in its UI. 2. ...
JSClass.flags
bsolete since JSAPI 16 The resolve hook expects to receive the starting object in the prototype chain passed in via the *objp in/out parameter. (This is meaningful only if the JSCLASS_NEW_RESOLVE flag is also set.) JSCLASS_CONSTRUCT_PROTOTYPE Obsolete since JSAPI 11 Instructs JS_InitClass to invoke the constructor when creating the class prototype. JSCLASS_IS_EXT
ENDED Obsolete since JSAPI 17Indicates that this JSClass is really a JSExt
endedClass. JSCLASS_MARK_IS_TRACE Obsolete since JSAPI 5 Indicates that the mark hook implements the new JSTraceOp signature instead of the old JSMarkOp signature. This is recomm
ended for all new code that needs custom marking. SpiderMonkey reserves a few other flags for its internal use. They a...
...ld JSMarkOp signature. This is recomm
ended for all new code that needs custom marking. SpiderMonkey reserves a few other flags for its internal use. They are JSCLASS_IS_ANONYMOUS, JSCLASS_IS_GLOBAL, JSCLASS_IS_PROXY, and JSCLASS_HAS_CACHED_PROTO. JSAPI applications should not use these flags. ...
JS_SuspendRequest
t may not be accessed by any other thread. Suspends the calling thread's current request, if any, to allow the thread to block or perform time-consuming calculations. Syntax jsrefcount JS_SuspendRequest(JSContext *cx); void JS_ResumeRequest(JSContext *cx, jsrefcount saveDepth); Name Type Description cx JSContext * The context whose current request is to be susp
ended or resumed. saveDepth jsrefcount (only in JS_ResumeRequest) The valued returned by the matching JS_SuspendRequest call. Description In JS_THREADSAFE builds, when a multi-threaded application is in a request but needs to block or perform lengthy computation that can race safely with the garbage collector, it should call JS_SuspendRequest before the time-consuming operation a...
... and JS_ResumeRequest after. For more information about thread safety and requests, see JS_THREADSAFE. JS_SuspendRequest suspends any currently active requests associated with the context cx. This allows the runtime to perform garbage collection if needed and allows other threads to access objects that the calling thread had locked. The return value is the number of nested requests that were susp
ended. It may be 0. JS_ResumeRequest resumes the previously susp
ended requests. The saveDepth argument must be the value returned by the matching JS_SuspendRequest call. If saveDepth is nonzero and garbage collection is underway, JS_ResumeRequest blocks until the garbage collector is done. JSAPI 1.7 and earlier JS_SuspendRequest and JS_ResumeRequest are available only in JS_THREADSAFE builds. In Spid...
SpiderMonkey 1.8.5
avaScript to machine code, for a significant speed increase. It is supported 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. Support for ext
ended class methods (in particular, JSEqualityOp) has been removed. Multithreaded JS programs that race against the same objects are now explicitly not supported. 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 supported. SpiderMonkey 1.8.5 includes a new conf...
...ls encoding jsint; e.g. so that JSVAL_IS_INT was true. While this was never specified behaviour, it is no longer true; numeric values which are integers are frequently encoded as jsdouble inside the jsval. Embedders must be careful when converting numbers from jsvals into C. Note also that SpiderMonkey can now fit a full 32-bit integer (jsint) inside a jsval without promoting to a jsdouble. JSExt
endedClass JSExt
endedClass 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 supported two types of native functions -- JSNative and JSFastNative. The so-called "Slow Natives" ar...
SpiderMonkey 1.8
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. New macros JS_FS, JS_FN, and JS_FS_END are recomm
ended for populating JSFunctionSpec arrays. JS_NewObjectWithGivenProto is exactly like JS_NewObject except that it doesn't use a default prototype object if you pass NULL. Instead the object is created with no prototype. JS_AlreadyHasOwnProperty and friends are new functions for examining an object without triggering resolve hooks. It was possible to configure SpiderMonkey 1.7 to treat C/C++ char st...
...NONFUNFIX, which bans anonymous functions from appearing anyplace where a statement could appear, such as in the argument to eval(). Functions that were JS_THREADSAFE-only in SpiderMonkey 1.7 (JS_BeginRequest, for example) are now present, but do nothing, in non-JS_THREADSAFE builds. This is to help applications share and reuse code regardless of whether they use threads. There are two new JSExt
endedClass hooks, JSExt
endedClass.iteratorObject and JSExt
endedClass.wrappedObject. Both are documented but obscure. Many new memory management features have been added as well. The new function JS_SetScriptStackQuota limits the size of the JavaScript stack. Two new functions, JS_SetGCZeal and JS_DumpHeap, aim to help developers debug GC-related problems. These functions are only present in DEBUG...
Split object
But the association is not fixed. An outer object may be associated with different inner objects at different times. This feature is complicated. Programs other than Mozilla that embed SpiderMonkey should avoid using split objects. ...
...But the association is not fixed. An outer object may be associated with different inner objects at different times. This feature is complicated. Programs other than Mozilla that embed SpiderMonkey should avoid using split objects. ...
The Publicity Stream API
hen an user-initiated activity deemed attractive to potential consumers occurs. This spawns a doorhanger which allows the user to specify which users can view the activity, and (following successful login and authorization with the stream server) registers the activity in a stream at [ADDRESS]. This stream can be pulled down by getPublicityStream() and helps determine the results for getUserRecomm
endedApps(). example use cases: 'Adam got a high score in Mafia Wars', 'Bethany bought a plane ticket to the Caribbean', etc. activity is an object, formatted as per the FIXME: deadLinkActivity Streams open specification. onsuccess is a callback that will be invoked with no arguments if the activity is successfully posted. onerror is an error callback that will be invoked if the publicity fails...
...d arguments are missing, or if unsupported 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 recomm
ended that applications consume the publicity stream in any way (please use your own server for any in-app social aspects). It is suggested that the list be processed and condensed into an attractive, cohesive format for users (eg., multiple tweets show as 'Adam tweeted 4 times'). onsuccess will be called with a single argument: a json list of the current user's socially relevant app activity in the ...
XPCOM changes in Gecko 2.0
st run by looking up what platform you're on and changing the preferences at that time. Category registration Prior to Gecko 2, extensions could listen for the xpcom-startup and app-startup notifications during startup, and perform actions during those. This is no longer the case. The earliest startup notification extensions can receive now is profile-after-change, which has always been the recomm
ended notification to observe. That's because it's among the earliest notifications that occurs after the profile folder (and therefore preferences and other services) is available. What you need to change If your extension currently observes either xpcom-startup or app-startup, you need to update your code to observe profile-after-change instead. Typically, extensions observed app-startup because in t...
... their components, and continuing the startup process, all without having to restart the browser. Electrolysis content processes can simply read the component registrations during startup. XPCNativeWrapper changes You can't disable XPCNativeWrappers from your manifest Specifying xpcnativewrappers=no in your manifest (that is, XPCNativeWrapper automation) is no longer supported. This was always int
ended to be a short-term workaround to allow extensions to continue to work while their authors updated their code to use XPCNativeWrappers. If your add-on depends upon XBL bindings attached to content objects--for example, the ability to call functions or get and set properties created by the XBL binding--you will need to use the XPCNativeWrapper property wrappedJSObject to access wrapped objects. If ...
Using XPCOM Utilities to Make Things Easier
that names the module. In a debugging environment, this string will be printed to the screen when the component library is loaded or unloaded. You should pick a name that makes sense and helps you 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 recomm
ended argument) a constructor for the given object static const nsModuleComponentInfo components[] = { { "Pretty Class Name", CID, CONTRACT_ID, Constructor }, // ... }; The important thing to note in the fictitious listing above is that it can support multiple components in a module. Modules such as the networking libraries in Gecko ("necko") have over 50 components declared in a...
... iid2 = NS_ISUPPORTS_IID; In order to use NS_IMPL_ISUPPORTSn, you must be sure that a member variable of type nsrefcnt is defined and named mRefCnt in your class. But why even bother when you can use another macro? Declaration Macros NS_DECL_NSISUPPORTS declares AddRef, Release, and QueryInterface for you, and it also defines the mRefCnt required by NS_IMPL_ISUPPORTS. Furthermore, NS_DECL_ app
ended with any interface name in all caps will declare all of the methods of that interface for you. For example, NS_DECL_NSIFOO will declare all of the methods of nsIFoo provided that it exists and that nsIFoo.h was generated by the XPIDL compiler. Consider the following real class: class myEnumerator : public nsISimpleEnumerator { public: NS_DECL_ISUPPORTS NS_DECL_NSISIMPLEENUMERATOR ...
Mozilla internal string guide
There are a number of additional string classes: Classes which exist primarily as constructor...
...rminated Latin1 char* string. Latin1 to UTF-16 converters These converters are very dangerous because they will produce wrong results for non-ASCII UTF-8 or windows-1252 input into a meaningless UTF-16 string. You should avoid ASCII to UTF-16 conversions unless your strings are guaranteed to be ASCII or Latin1 in the sense of the byte value being the Unicode scalar value. Every byte is zero-ext
ended into a 16-bit code unit. It is correct to use these on most HTTP header values, but it's always wrong to use these on HTTP response bodies! (Use mozilla::Encoding to deal with response bodies.) NS_ConvertASCIItoUTF16(nsACString) - a nsAutoString which holds a temporary buffer containing the value of the Latin1 to UTF-16 conversion. CopyASCIItoUTF16(nsACString, nsAString) - does an in-place c...
NS_OVERRIDE
If there is no base class method with the same signature, a compiler with static-checking enabled will fail to compile. NS_OVERRIDE is declared in nscore.h, beginning with Gecko 2.0. It was introduced in bug 500870. ...
...A compiler with static-checking enabled will issue the following error: test.cpp:8: error: NS_OVERRIDE function B::GetFoo(nsIFoo**) does not override a base class method with the same name and signature. ...
mozIRegistry
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 properly titled so that everybody knows it is the place to come to in order to find out how they are supposed to link together the various XPCOM components that together form the Mozilla browser. The information below is int
ended to tell you everything you need to know about how to do that. Summary Clients will rely on nsRepository to create instances of a given class. Clients requiring dynamic "binding" of CLSIDs will be required to use some higher-level services (TBD) to figure out the CLSIDs they should use. The intent is that such services themselves be built on top of the new mozIRegistry interface. We are proposi...
...ly the same function as is currently provided by libreg (aka "netscape registry") as declared in mozilla/modules/libreg/include/NSReg.h. Clients will obtain this interface via the service manager (see mozilla/xpcom/public/nsIServiceManager.h). mozRegistry This is the simplistic implementation of the mozIRegistry interface. It is built as a simple C wrapper for the functions in NSReg.h. It is int
ended to provide a (slightly) lighter-weight implementation that is entirely compatible with current libreg usage. mozRDFRegistry This is an RDF-based mozIRegistry implementation that will provide additional capabilities. Note that these additional capabilities will not be utilized by nsRepository. It is envisioned that there will be multiple flavors of underlying RDF data sources corresponding to th...
nsIAccessibleStates
0000 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 Supports multiple selection. STATE_EXTSELECTABLE 0x02000000 Supports ext
ended 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_IMP...
... 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_IMPORTANT STATE_ALERT_MEDIUM Currently unused. STATE_INVALID STATE_ALERT_HIGH Indicates a validation failure. STATE_CHECKABLE STATE_MARQUEED Ext
ended state constants Ext
ended state flags (for now non-MSAA, for Java and Gnome/ATK support) Constant Value Description EXT_STATE_SUPPORTS_AUTOCOMPLETION 0x00000001 For editable areas that have any kind of auto completion. EXT_STATE_DEFUNCT 0x00000002 Object no longer exists. EXT_STATE_SELECTABLE_TEXT 0x00000004 For text which is selectable, object must implement nsIAccessibleText. EXT_STAT...
nsIComponentRegistrar
factory to be used to instantiate a particular class identified by ClassID, and creates an association of class name and ContractID with the class. void registerFactory( in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFactory aFactory ); Parameters aClass The ClassID of the class being registered. aClassName The name of the class being registered. This value is int
ended as a human-readable name for the class and need not be globally unique. (unused) aContractID The ContractID of the class being registered. May be null if no ContractID is needed. aFactory The nsIFactory instance of the class being registered. If aFactory is null, the contract will be associated with a previously registered ClassID. registerFactoryLocation() Registers a factory to be used to inst...
...n of the component containing the factory implementation is specified instead of the factory instance. void registerFactoryLocation( in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFile aFile, in string aLoaderStr, in string aType ); Parameters aClass The ClassID of the class being registered. aClassName The name of the class being registered. This value is int
ended as a human-readable name for the class and need not be globally unique. aContractID The ContractID of the class being registered. aFile A component file. This file must have an associated loader and export the required symbols, which the loader specifies. aLoaderStr Opaque loader specific string. This value is passed into the nsIModule.registerSelf() callback and must be forwarded unmodified when...
nsIDownloadProgressListener
ormation for the download. See nsIWebProgressListener.onStateChange() for details. This can also be one of the nsIDownloadManager.Constants. aDownload The download whose state changed. onStatusChange() Obsolete since Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Called when the status of a download request has changed. The received status message is int
ended to be displayed visibly to the user. Note: If source and destination are identical, which is possible in case of file URLs or chrome URLs, this is called even in Gecko 1.9.2. In such a situation no further event handlers are called and the stop flag is set; if there are more pending downloads in such a situation not yet started they never start. In normal situations this is never called. The me...
...us, in wstring aMessage, in nsIDownload aDownload ); Parameters aWebProgress The nsIWebProgress instance used by the Download Manager to monitor downloads. aRequest The nsIRequest that changed state. This parameter will not be null. aStatus The new state information for the download. See nsIWebProgressListener.onStateChange() for details. aMessage A user-readable status message int
ended to be displayed visibly on the screen. aDownload The download whose status changed. Example var dm = Components.classes["@mozilla.org/download-manager;1"] .getService(Components.interfaces.nsIDownloadManager); dm.addListener({ onSecurityChange : function(prog, req, state, dl) { }, onProgressChange : function(prog, req, prog, progMax, tProg, tProgMax, dl) { }, onStateChange : ...
nsIFilePicker
olean If true, the file is added to the operating system's "recent documents" list (if the operating system has one; nothing happens if there is no such concept on the user's platform). This attribute has no effect if private browsing mode is in effect. defaultExtension AString The extension for the type of files you want to work with. On some platforms, this is automatically app
ended to filenames the user enters, if required. Specify it without a leading dot, for example "jpg". defaultString AString The filename, including extension, that should be suggested to the user as a default. This should be set before calling open() or show(). Exceptions thrown NS_ERROR_FAILURE If you try to read this attribute. displayDirectory ...
...mpc, *.oga, *.ogg, *.ra, *.ram, *.snd, *.wav and *.wma filters for file extensions. filterVideo 0x200 Corresponds to the *.avi, *.divx, *.flv, *.m4v, *.mkv, *.mov, *.mp4, *.mpeg, *.mpg, *.ogm, *.ogv, *.ogx, *.rm, *.rmvb, *.smil, *.webm, *.wmv and *.xvid filters for file extensions. Methods appendFilter() Appends a custom file extension filter to the dialog. The filter app
ended first will be used to display the nsIFilePicker dialog, the user may then select another from the list. void appendFilter( in AString title, in AString filter ); Parameters title The title of the filter. filter The filter string. Multiple extensions may be included, separated by a semicolon and a space. Example Some example filter strings: "*.ics" "*.txt; *.doc; *.rtf" appen...
nsILocalFile
hether or not the nsILocalFile will automatically resolve symbolic links. By default, this value is false on all non-UNIX systems. As of Mozilla 1.7, this attribute is ignored on UNIX systems. persistentDescriptor ACString On some platforms, the value of nsIFile.path may be insufficient to uniquely identify the file on the local file system. The persistent descriptor is int
ended to be used whenever a nsILocalFile needs to be serialized to disk and later recovered. This string is not int
ended for display to users. Note: The value of the followLinks attribute is not encoded in the persistent descriptor. Constants Constant Value Description DELETE_ON_CLOSE 0x80000000 Optional parameter used by openNSPRFileDesc(). Methods...
...scriptor() Returns a relative file path in an opaque, cross platform format. It is therefore not a native path. ACString getRelativeDescriptor( in nsILocalFile fromFile ); Parameters fromFile The file from which the descriptor is relative. There is no defined result if this parameter is null. Return value An opaque string value with undefined character encoding. This string is not int
ended for display to users. The result returned from this method may be used with setRelativeDescriptor() to initialize a nsILocalFile instance. initWithFile() Initializes this object with another file. void initWithFile( in nsILocalFile aFile ); Parameters aFile The file this becomes equivalent to. initWithNativePath() Used to set the full path that this nsILocalFile references. All cur...
nsIMacDockSupport
ckMenu = nativeMenu; This replaces the default menu with this one menuitem that says "Show Most Recent Window". Notice the activateApplication(true), if this is not done then Firefox will not be activated. The result of this code is shown below. Notice how the "New Window" and "New Private Window" menuitem's are missing. ...
...t is recomm
ended to manipulate the default menu item which is on the hidden window of Firefox. Note: The hidden window of Firefox (Services.appShel.hiddenDOMWindow) loads on browser startup, so if you would like to access it on startup of the browser make sure to check and wait for the window to be loaded. This can be done by adding a event listenr for load of the hidden window. This is the recomm
ended way to add to the native menu, just maniuplate the default menu DOM element. var macMenuItem = Services.appShell.hiddenDOMWindow.document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menuitem'); macMenuItem.setAttribute('label', 'Show Most Recent Window'); macMenuItem.setAttribute('id', 'myMacMenuItem'); macMenuItem.addEventListener('command', function(){ va...
nsIMicrosummaryObserver
des methods for observing changes to micrummaries. 1.0 66 Introduced Gecko 1.8 Obsolete Gecko 6.0 Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Warning: Microsummary support was removed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Method overview void onContentLoaded(in nsIMicrosummary microsummary); void onElementApp
ended(in nsIMicrosummary microsummary); void onError(in nsIMicrosummary microsummary); Methods onContentLoaded() Called when an observed microsummary updates its content. Since an observer might watch multiple microsummaries at the same time, the microsummary whose content has been updated gets passed to this handler. void onContentLoaded( in nsIMicrosummary microsummary ); Parameters microsu...
...osummary); Methods onContentLoaded() Called when an observed microsummary updates its content. Since an observer might watch multiple microsummaries at the same time, the microsummary whose content has been updated gets passed to this handler. void onContentLoaded( in nsIMicrosummary microsummary ); Parameters microsummary The microsummary whose content has just been updated. onElementApp
ended() Called when an element is app
ended to a microsummary set. void onElementApp
ended( in nsIMicrosummary microsummary ); Parameters microsummary The microsummary that has just been app
ended to the set. onError() Called when an observed microsummary encounters an error during an update. void onError( in nsIMicrosummary microsummary ); Parameters microsummary The microsumary which could not ...
nsIMutableArray
insertElementAt( in nsISupports element, in unsigned long index, in boolean weak ); Parameters element The element to insert. 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. If the position is equal to the current length of the array, the new element is app
ended. An index lower than 0 or higher than the current length of the array is invalid and will be ignored. 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 support nsIWeakReference. removeElementAt() Remove an element at a specific position, moving all elements stored at a...
...at the given position. void replaceElementAt( in nsISupports element, in unsigned long index, in boolean weak ); Parameters element The new element to insert. index The position in the array. If the position is lower than the current length of the array, an existing element will be replaced. If the position is equal to the current length of the array, the new element is app
ended. If the position is higher than the current length of the array, empty elements are app
ended followed by the new element at the specified position. An index lower than 0 is invalid and will be ignored. weak Whether or not to store the new element using a weak reference. Exceptions thrown NS_ERROR_FAILURE When a weak reference is requested, but the element does not support nsIWea...
nsINavBookmarksService
Attribute Type Description bookmarksMenuFolder long long The item ID of the Bookmarks Menu folder. Read only. Note: Renamed from bookmarksRoot in Gecko 1.9 placesRoot long long The item ID of the top-level folder that contains bookmarks, tags and all other Places data. This contains administrative data as well as user data, and is therefore not recomm
ended for use in queries. Read only. tagsFolder long long The item ID of the top-level folder that contains the tag "folders". Read only. Note: Renamed from tagRoot in Gecko 1.9 toolbarFolder long long The item ID of the personal toolbar folder. Read only. Note: Renamed from toolbarRoot in Gecko 1.9 unfiledBookmarksFolder long long The item ID of the Unfiled...
...eters aItemId The ID of the item to set the GUID of. aGUID The GUID string. setItemIndex() This method changes the index for a item. This method does not change the indices of any other items in the same folder, so ensure that the new index does not already exist, or change the index of other items accordingly, otherwise the indices will become corrupted. Warning: This is API is int
ended for scenarios such as folder sorting, where the caller manages the indices of all items in the folder. You must always ensure each index is unique after a reordering. void setItemIndex( in long long aItemId, in long aNewIndex ); Parameters aItemId The ID of the item to modify. aNewIndex The new index. Exceptions thrown If aNewIndex is out of bounds. setItemLastModified() ...
nsIProtocolProxyService
ould be used to wait for the PAC file to finish loading. Otherwise, the consumer may choose to treat the result as type "direct" if desired. See nsIProxiedProtocolHandler.newProxiedChannel(). asyncResolve() This method is an asychronous version of the resolve method. Unlike resolve, this method is guaranteed not to block the calling thread waiting for DNS queries to complete. This method is int
ended as a substitute for resolve when the result is not needed immediately. nsICancelable asyncResolve( in nsIURI aURI, in unsigned long aFlags, in nsIProtocolProxyCallback aCallback ); 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_ f...
...if it is a HTTP proxy and the nsIProtocolHandler for the queried URI does not permit proxying via HTTP. If a nsIProtocolHandler disallows all proxying, then filters will never have a chance to intercept proxy requests for such URLs. Note: It is possible to construct filters that compete with one another in undesirable ways. This API does not attempt to protect against such problems. It is recomm
ended that any extensions that choose to call this method make their position value configurable at runtime (perhaps via the preferences service). void registerFilter( in nsIProtocolProxyFilter aFilter, in unsigned long aPosition ); Parameters aFilter The nsIProtocolProxyFilter instance to be registered. aPosition The position of the filter. unregisterFilter() This method may be used to...
nsITelemetry
entData); 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 reporting service or the self-support service is enabled. canRecordExt
ended boolean A flag indicating if Telemetry is allowed to record ext
ended data. Returns false if the user has not opted into "ext
ended 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 readonly boolean A flag indicating whether Telemetry is recording release...
...COUNT 0 For storing a numeric value. SCALAR_TYPE_STRING 1 For storing a string value. SCALAR_TYPE_BOOLEAN 2 For storing a boolean value. Dataset Types Constant Value Description DATASET_RELEASE_CHANNEL_OPTOUT 0 The basic dataset that is on-by-default on all channels. DATASET_RELEASE_CHANNEL_OPTIN 1 The ext
ended dataset that is opt-in on release, opt-out on pre-release channels. Methods getHistogramById() Get an histogram by id for histograms registered in Histograms.json. jsval getHistogramById( in ACString id ); Parameters id Unique identifier from toolkit/components/telemetry/Histograms.json. Return value The returned jsval object has the following functions: add(value) - Adds ...
nsITextInputProcessor
up event, just do this: var keyEvent = new KeyboardEvent("", { key: "a", code: "KeyA", keyCode: KeyboardEvent.DOM_VK_A }); var doDefault = TIP.keyup(keyEvent); startComposition(), flushPendingComposition(), commitComposition(), commitCompositionWith(), and cancelComposition() can take a KeyboardEvent which causes modifying the composition state. Specifying a keyboard event is strongly recomm
ended if the TextInputProcessor emulates input from keyboard. For example: TIP.setPendingCompositionString("a"); TIP.appendClauseToPendingComposition("a".length, TIP.ATTR_RAW_CLAUSE); TIP.setCaretPosition("a".length); // This means that the first composition character is inputted by a keypress of "a" key. var AKeyEvent = new KeyboardEvent("", { key: "a", code: "KeyA", keyCode: KeyboardEvent.DOM_VK_...
...alue is computed from key value automatically if you don't initialize this value. But the computation doesn't emulate the mapping of native key event handling completely because it has some special cases depending on platform or selected keyboard layout. Therefore, if you need to emulate PC keyboard on specific platform, you may need to specify this explicitly. location Optional. It's not recomm
ended to specify this explicitly since this value should be linked with code attribute value. The automatic computation can compute the best value for this. repeat Optional. When you emulate auto-repeat caused by long keypress, you can specify this true. Modifier state management This section describes how to manage modifier state. Each nsITextInputProcessor instance manages modifier state intern...
Storage
Z_STORAGE_SERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<mozIStorageConnection> dbConn; rv = dbService->OpenDatabase(dbFile, getter_AddRefs(dbConn)); NS_ENSURE_SUCCESS(rv, rv); Note: MOZ_STORAGE_SERVICE_CONTRACTID is defined in storage/build/mozStorageCID.h. Warning: It may be tempting to give your database a name ending in '.sdb' for sqlite database, but this is not recomm
ended. This extension is treated specially by Windows as a known extension for an 'Application Compatibility Database' and changes are backed up by the system automatically as part of system restore functionality. This can result in significantly higher overhead file operation. Closing a connection To close a connection on which only synchronous transactions were performed, use the mozIStorageConnec...
...set of bindings bound to it before execution asynchronously. Executing a Statement You may execute statements either synchronously (which is supported in Firefox Gecko 1.8 and 1.9) or asynchronously (starting in Gecko 1.9.1). If your code needs to work with applications based on Gecko 1.8 or 1.9, you should the technique covered in the section Synchronously below. Otherwise, it's strongly recomm
ended that you use asynchronous execution, for performance reasons. Asynchronously Gecko 1.9.1 introduced support for asynchronous execution of a statement by calling mozIStorageStatement.executeAsync() on the statement. Multiple statements can be executed in a transaction by calling mozIStorageConnection.executeAsync() on the connection and passing in an array of statements. Both of these methods ...
Autoconfiguration in Thunderbird
erbird Knowledge Base. the configuration file description and definition the original project page on the Mozilla wiki for background, design, implementation and project details This document describes how Autoconfiguration in Thunderbird works, and what to do to allow mail servers to be autoconfigured. Mechanisms Thunderbird gets the server settings via different means, each of which is int
ended for different cases: ISPDB The ISPDB is a central database, currently hosted by the Thunderbird project, but free to use for any client. It contains settings for the world's largest ISPs. Most ISPs with a market share of more than 0.1% are included. This allows to autoconfigure almost 50% of our user's email accounts. It was added because we cannot assume that all big ISPs (including Micro...
...nfiguration, as described below. For more complicated setups, for example when the login name does not appear in the email address, the XML file can also be generated by the ISP. In such complicated cases, this is the only way to allow an automatic setup. Configuration file on harddisk Local administrators may place a configuration file in the Thunderbird installation folder. This is mainly int
ended for companies who install Thunderbird on their employees' computers and want to enable easy account 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.<domai...
Index
o 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 support. 32 Index Index Found 72 pages: 33 LDAP Support Administration, enterprise, thunderbird This document is int
ended to "fill in the gaps" about how Enterprise customers can leverage and customize LDAP support in Mozilla Thunderbird. It is not int
ended 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 T...
... distribution site where you can host your extension for free. Your extension will be hosted on Mozilla's mirror network. Mozilla's site also provides users with easier installation and will automatically make new versions available to users of your existing versions when you upload them. In addition Mozilla Update allows users to comment and provide feedback on your extension. It is highly recomm
ended that you use AMO to distribute your extensions. 83 Creating a Custom Column Add-ons, Extensions, thunderbird In this example we will be developing a small extension that will be adding a column that will display the "Reply-To:" field of an email (if it exists, it if often not set). If you are unfamiliar with the setup and creation of an extension please read Building a Thunde...
Debugger.Frame - Firefox Developer Tools
e eval method recognizes the following properties: url The filename or URL to which we should attributecode. If this property is omitted, the URL defaults to "debugger eval code". lineNumber The line number at which the evaluated code should be claimed to begin withinurl. evalWithBindings(code,bindings, [options]) Like eval, but evaluatecode in the environment of this frame, ext
ended with bindings from the objectbindings. For each own enumerable property ofbindings namedname whose value isvalue, include a variable in the environment in whichcode is evaluated namedname, whose value isvalue. Eachvalue must be a debuggee value. (This is not like a with statement:code may access, assign to, and delete the introduced bindings without having any effect on thebindings object.) Thi...
...y effect on thebindings object.) This method allows debugger code to introduce temporary bindings that are visible to the given debuggee code and which refer to debugger-held debuggee values, and do so without mutating any existing debuggee environment. Note that, like eval, declarations in thecode passed to evalWithBindings affect the environment of this frame, even as that environment is ext
ended by bindings visible withincode. (In the terms used by the ECMAScript specification, the VariableEnvironment of the execution context for the eval code is the VariableEnvironment of the execution context that this frame represents, and thebindings appear in a new declarative environment, which is the eval code's LexicalEnvironment.) If implementation restrictions prevent SpiderMonkey from extendin...
Debugger.Object - Firefox Developer Tools
statements at the global level, not an indirect eval. Regardless ofcode being strict mode code, variable declarations incode affect the referent global object. Theoptions argument is as for Debugger.Frame.prototype.eval. executeInGlobalWithBindings(code,bindings, [options]) Like executeInGlobal, but evaluatecode using the referent as the variable object, but with a lexical environment ext
ended with bindings from the objectbindings. For each own enumerable property ofbindings namedname whose value isvalue, include a variable in the lexical environment in whichcode is evaluated namedname, whose value isvalue. Eachvalue must be a debuggee value. (This is not like a with statement:code may access, assign to, and delete the introduced bindings without having any effect on thebindings object...
... effect on thebindings object.) This method allows debugger code to introduce temporary bindings that are visible to the given debuggee code and which refer to debugger-held debuggee values, and do so without mutating any existing debuggee environment. Note that, like executeInGlobal, any declarations it contains affect the referent global object, even ascode is evaluated in an environment ext
ended according tobindings. (In the terms used by the ECMAScript specification, the VariableEnvironment of the execution context forcode is the referent, and thebindings appear in a new declarative environment, which is the eval code's LexicalEnvironment.) Theoptions argument is as for Debugger.Frame.prototype.eval. asEnvironment() If the referent is a global object, return the Debugger.Environme...
Debugger.Object - Firefox Developer Tools
t the referent global object. (In the terms used by the ECMAScript specification, the VariableEnvironment of the execution context for the eval code is the referent.) Theoptions argument is as for Debugger.Frame.prototype.eval. evalInGlobalWithBindings(code,bindings, [options]) Like evalInGlobal, but evaluatecode using the referent as the variable object, but with a lexical environment ext
ended with bindings from the objectbindings. For each own enumerable property ofbindings namedname whose value isvalue, include a variable in the lexical environment in whichcode is evaluated namedname, whose value isvalue. Eachvalue must be a debuggee value. (This is not like a with statement:code may access, assign to, and delete the introduced bindings without having any effect on thebindings object...
...oduce temporary bindings that are visible to the given debuggee code and which refer to debugger-held debuggee values, and do so without mutating any existing debuggee environment. Note that, like evalInGlobal, if the code passed to evalInGlobalWithBindings is not strict mode code, then any declarations it contains affect the referent global object, even ascode is evaluated in an environment ext
ended according tobindings. (In the terms used by the ECMAScript specification, the VariableEnvironment of the execution context for non-strict eval code is the referent, and thebindings appear in a new declarative environment, which is the eval code's LexicalEnvironment.) Theoptions argument is as for Debugger.Frame.prototype.eval. asEnvironment() If the referent is a global object, return the...
Web Console Helpers - Firefox Developer Tools
The commands The JavaScript command line provided by the Web Console offers a few built-in helper functions that make certain tasks easier. $(selector, element) Looks up a CSS selector string selector , returning the first node desc
ended from element that matches. If unspecified, element defaults to document. Equivalent to document.querySelector() or calls the $ function in the page, if it exists. See the QuerySelector code snippet. $$(selector, element) Looks up a CSS selector string selector, returning an array of DOM nodes desc
ended from element that match. If unspecified, element defaults to document. This is like for document.querySelectorAll(), but returns an array instead of a NodeList. $0 The currently-inspected element in the page. $_ Stores the result of the last exp...
.... --clipboard) are included. --filename string The name to use in saving the file. The file should have a ".png" extension. --fullpage boolean If included, the full webpage will be saved. With this parameter, even the parts of the webpage which are outside the current bounds of the window will be included in the screenshot. When used, "-fullpage" will be app
ended to the file name. --selector string The CSS query selector for a single element on the page. When supplied, only this element will be included in the screenshot. :unblock (Starting in Firefox 80) Followed by an unquoted string, removes blocking for URLs containing that string. In the Network Monitor, the string is removed from the Request Blocking sidebar. No erro...
The JavaScript input interpreter - Firefox Developer Tools
e iframe like this: cd("#frame1"); Now you'll see that the global window's document is the iframe: And you can call the function defined in the iframe: Helper commands The JavaScript command line provided by the Web Console offers a few built-in helper functions that make certain tasks easier. $(selector, element) Looks up a CSS selector string selector , returning the first node desc
ended from element that matches. If unspecified, element defaults to document. Equivalent to document.querySelector() or calls the $ function in the page, if it exists. See the QuerySelector code snippet. $$(selector, element) Looks up a CSS selector string selector, returning an array of DOM nodes desc
ended from element that match. If unspecified, element defaults to document. This is like for d...
.... --clipboard) are included. --filename string The name to use in saving the file. The file should have a ".png" extension. --fullpage boolean If included, the full webpage will be saved. With this parameter, even the parts of the webpage which are outside the current bounds of the window will be included in the screenshot. When used, "-fullpage" will be app
ended to the file name. --selector string The CSS query selector for a single element on the page. When supplied, only this element will be included in the screenshot. Please refer to the Console API for more information about logging from content. ...
about:debugging - Firefox Developer Tools
d Extensions The permanently installed extensions are listed in the next section, Extensions. For each one, you see something like the following: The Inspect button, and the Extension ID and Internal UUID fields are the same as for temporary extensions. Just as it does with temporarily loaded extensions, the link next to Manifest URL opens the loaded manifest in a new tab. Note: It's recomm
ended that you use the Browser Toolbox, not the Add-on Debugger, for debugging WebExtensions. See Debugging WebExtensions for all the details. The Add-ons section in about:debugging lists all web extensions that are currently installed. Next to each entry is a button labeled Inspect. Note: This list may include add-ons that came preinstalled with Firefox. If you click Inspect, the Add-on Debugger...
... 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...
AudioContext.resume() - Web APIs
The resume() method of the AudioContext interface resumes the progression of time in an audio context that has previously been susp
ended. This method will cause an INVALID_STATE_ERR exception to be thrown if called on an OfflineAudioContext. Syntax completePromise = audioContext.resume(); Parameters None. Return value A Promise that resolves when the context has resumed. The promise is rejected if the context has already been closed. Example The following snippet is taken from our AudioContext states demo (see it running live.) When the suspend/resume button is clicked, the AudioContext.state is queried -- if it is running, suspend() is called; if it is susp
ended, resume() is called. In each case, the text label of the button is updated as appropriate once the promise resolves. susr...
....state is queried -- if it is running, suspend() is called; if it is susp
ended, resume() is called. In each case, the text label of the button is updated as appropriate once the promise resolves. susresBtn.onclick = function() { if(audioCtx.state === 'running') { audioCtx.suspend().then(function() { susresBtn.textContent = 'Resume context'; }); } else if(audioCtx.state === 'susp
ended') { audioCtx.resume().then(function() { susresBtn.textContent = 'Suspend context'; }); } } Specifications Specification Status Comment Web Audio APIThe definition of 'resume()' in that specification. Working Draft ...
AudioContext.suspend() - Web APIs
udioContext(); audioCtx.suspend().then(function() { ... }); Returns A Promise that resolves with void. The promise is rejected if the context has already been closed. ...
....state is queried -- if it is running, suspend() is called; if it is susp
ended, resume() is called. In each case, the text label of the button is updated as appropriate once the promise resolves. susresBtn.onclick = function() { if(audioCtx.state === 'running') { audioCtx.suspend().then(function() { susresBtn.textContent = 'Resume context'; }); } else if(audioCtx.state === 'susp
ended') { audioCtx.resume().then(function() { susresBtn.textContent = 'Suspend context'; }); } } Specifications Specification Status Comment Web Audio APIThe definition of 'close()' in that specification. Working Draft ...
AudioContext - Web APIs
The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode. An audio context controls both the creation of the nodes it contains and the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context. It's recomm
ended to create one AudioContext and reuse it instead of initializing a new one each time, and it's OK to use a single AudioContext for several different audio source and pipeline concurrently. <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; ...
...ntext.createMediaStreamTrackSource() Creates a MediaStreamTrackAudioSourceNode associated with a MediaStream representing an media stream track. AudioContext.getOutputTimestamp() Returns a new AudioTimestamp object containing two audio timestamp values relating to the current audio context. AudioContext.resume() Resumes the progression of time in an audio context that has previously been susp
ended/paused. AudioContext.suspend() Suspends the progression of time in the audio context, temporarily halting audio hardware access and reducing CPU/battery usage in the process. Examples Basic audio context declaration: var audioCtx = new AudioContext(); Cross browser variant: var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var oscilla...
AudioScheduledSourceNode - Web APIs
You can't create an AudioScheduledSourceNode object directly. ...
...les the node to begin playing the constant sound at the specified time. If no time is specified, the node begins playing immediately. stop() Schedules the node to stop playing at the specified time. If no time is specified, the node stops playing at once. Events Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface:
ended Fired when the source node has stopped playing, either because it's reached a predetermined stop time, the full duration of the audio has been performed, or because the entire buffer has been played. Also available using the on
ended event handler property. Specification Specification Status Comment Web Audio APIThe definition of 'AudioScheduledSourceNode' in that spec...
AudioWorkletProcessor.process - Web APIs
at the construction of the node (see AudioWorkletNodeOptions). If there is no active node connected to the n-th input of the node, inputs[n] will be an empty array (zero input channels available). The number of channels in each input may vary, depending on channelCount and channelCountMode properties. outputs An array of outputs that is similar to the inputs parameter in structure. It is int
ended to be filled during the execution of the process() method. Each of the output channels is filled with zeros by default -- the processor will output silence unless the output arrays are modified. parameters An object containing string keys and Float32Array values. For each custom AudioParam defined using the parameterDescriptors getter, the key in the object is a name of that AudioParam, and t...
...lementing such a node should return true from the process method as long as it produces an output. The method should return false as soon as it's known that it will no longer produce an output. For example, take the AudioBufferSourceNode -- the processor behind such a node should return true from the process method while the buffer is playing, and start returning false when the buffer playing has
ended (there's no way to call play on the same AudioBufferSourceNode again). A node that transforms its input. A processor implementing such a node should return false from the process method to allow the presence of active input nodes and references to the node to determine whether it can be garbage-collected. An example of a node with this behaviour is the GainNode. As soon as there are no inputs co...
Background Tasks API - Web APIs
ow.requestIdleCallback() makes it possible to become actively engaged in helping to ensure that the browser's event loop runs smoothly, by allowing the browser to tell your code how much time it can safely use without causing the system to lag. If you stay within the limit given, you can make the user's experience much better. Getting the most out of idle callbacks Because idle callbacks are int
ended to give your code a way to cooperate with the event loop to ensure that the system is utilized to its full potential without over-tasking it, resulting in lag or other performance problems, you should be thoughtful about how you go about using them. Use idle callbacks for tasks which don't have high priority. Because you don't know how many callbacks have been established, and you don't know h...
...will include any idle callbacks being executed; if the event loop uses all available time, you're out of luck (again, unless you've used a timeout). Idle callbacks should do their best not to overrun the time allotted. While the browser, your code, and the Web in general will continue to run normally if you go over the specified time limit (even if you go way over it), the time restriction is int
ended to ensure that you leave the system enough time to finish the current pass through the event loop and get on to the next one without causing other code to stutter or animation effects to lag. Currently, timeRemaining() has an upper limit of 50 milliseconds, but in reality you will often have less time than that, since the event loop may already be eating into that time on complex sites, with brow...
BaseAudioContext.createScriptProcessor() - Web APIs
best buffer size for the given environment, which will be a constant power of 2 throughout the lifetime of the node. This value controls how frequently the audioprocess event is dispatched and how many sample-frames need to be processed each call. Lower values for bufferSize will result in a lower (better) latency. Higher values will be necessary to avoid audio breakup and glitches. It is recomm
ended 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 supported. numberOfOutputChannels Integer specifying the number of channels for this node's output, defaults to 2. Values of...
... Working Draft ...
CSS Object Model (CSSOM) - Web APIs
CSS Typed Object Model CSSImageValue CSSKeywordValue CSSMathInvert CSSMathMax CSSMathMin CSSMathNegate CSSMathProduct CSSMathSum CSSMathValue CSSMatrixComponent CSSNumericArray CSSNumericValue CSSPerspective CSSPositionV...
...bsolete CSSOM interfaces CSSPrimitiveValue CSSValue CSSValueList Tutorials Determining the dimensions of elements (it needs some updating as it was made in the DHTML/Ajax era). Managing screen orientation Specifications Specification Status Comment CSS Typed OM Level 1 Working Draft CSS Painting API Level 1 Working Draft Ext
ended the CSS interface with the paintWorklet static property. CSS Object Model (CSSOM) View Module Working Draft Defined the Screen and MediaQueryList interfaces and the MediaQueryListEvent event and MediaQueryListListener event listener. CSS Object Model (CSSOM) Working Draft Ext
ended the CSS interface and provides the base for the modern CSSOM specification. Sc...
A basic ray-caster - Web APIs
So every update, the raycaster looks to see if you've pressed any keys lately, to conserve calculations by not casting if you're idle. If you have, then the canvas is cleared, the ground and sky are drawn, the camera position and/or orientation are updated, and the rays are cast out. ...
...n and/or orientation are updated, and the rays are cast out. As the rays intersect walls, then they render a vertical sliver of canvas in the color of the wall they've hit, bl
ended with a darker version of the color according to the distance to the wall. The height of the sliver is also modulated by the distance from the camera to the wall, and is drawn centered over the horizon line. The code I
ended up with is a regurgitated amalgam of the raycaster chapters from an old Andre LaMotheTricks of the Game Programming Gurus book (ISBN: 0672305070), and a java raycaster I found online, filtered through my compulsion to rename everything so it makes sense to me, and all the tinkering that had to be done to make things work well. Results The canvas in Safari 2.0.1 performed surprisingly well. With...
Applying styles and colors - Web APIs
Note also that only start and final endpoints of a path are affected: if a path is closed with closePath(), there's no start and final endpoint; instead, all endpoints in the path are connected to their attached previous and next segment using the current setting of the lineJoin style, whose default value is miter, with the effect of automatically extending the...
...For lines which are at large angles with each other, this point is not far from the inside connection point. However, as the angles between each line decreases, the distance (miter length) between these points increases exponentially. The miterLimit property determines how far the outside connection point can be placed from the inside connection point. If two lin...
console.assert() - Web APIs
able in Web Workers. Syntax console.assert(assertion, obj1 [, obj2, ..., objN]); console.assert(assertion, msg [, subst1, ..., substN]); // C-like message formatting Parameters assertion Any boolean expression. If the assertion is false, the message is written to the console. obj1 ... objN A list of JavaScript objects to output. The string representations of each of these objects are app
ended together in the order listed and output. msg A JavaScript string containing zero or more substitution strings. subst1 ... substN JavaScript objects with which to replace substitution strings within msg. This parameter gives you additional control over the format of the output. Examples The following code example demonstrates the use of a JavaScript object following the assertion: const er...
...umber: 3, errorMsg: "the # is not even"} // the # is 4 // the # is 5 // Assertion failed: {number: 5, errorMsg: "the # is not even"} Note that, while a string containing a substitution string works as a parameter for console.log in Node and many, if not most, browsers... console.log('the word is %s', 'foo'); // output: the word is foo ...the use of such a string does not currently work as int
ended as a parameter for console.assert in all browsers: console.assert(false, 'the word is %s', 'foo'); // correct output in Node.js and some browsers // (e.g. Firefox v60.0.2): // Assertion failed: the word is foo // incorrect output in some browsers // (e.g. Chrome v67.0.3396.87): // Assertion failed: the word is %s foo See Outputting text to the console in the documentation of console fo...
Console.timeEnd() - Web APIs
Stops a timer that was previously started by calling console.time(). See Timers in the documentation for details and examples. Note: This feature is available in Web Workers. Syntax console.timeEnd(label); Parameters label The name of the timer to stop. Once stopped, the elapsed time is automatically displayed in the Web Console along with an indicator that the time has
ended. Examples console.time("answer time"); alert("Click to continue"); console.timeLog("answer time"); alert("Do a bunch of other stuff..."); console.timeEnd("answer time"); The output from the example above shows the time taken by the user to dismiss the first alert box, followed by the time it took for the user to dismiss the second alert: Notice that the timer's name is displayed when the timer value is...
... Specifications Specification Status Comment Console APIThe definition of 'console.timeEnd()' in that specification. Living Standard Initial definition ...
Element.innerHTML - Web APIs
TML5 specifies that a <script> tag inserted with innerHTML should not execute. However, there are ways to execute JavaScript without using <script> elements, so there is still a security risk whenever you use innerHTML to set strings over which you have no control. For example: const name = "<img src='x' onerror='alert(1)'>"; el.innerHTML = name; // shows the alert For that reason, it is recomm
ended that you do not use innerHTML when inserting plain text; instead, use Node.textContent. This doesn't parse the passed content as HTML, but instead inserts it as raw text. Warning: If your project is one that will undergo any form of security review, using innerHTML most likely will result in your code being rejected. For example, if you use innerHTML in a browser extension and submit the extens...
...ctor(".log"); var time = new Date(); var timeStr = time.toLocaleTimeString(); logElem.innerHTML += timeStr + ": " + msg + "<br/>"; } log("Logging mouse events inside this container..."); The log() function creates the log output by getting the current time from a Date object using toLocaleTimeString(), and building a string with the timestamp and the message text. Then the message is app
ended to the box with the class "log". We add a second method that logs information about MouseEvent based events (such as mousedown, click, and mouseenter): function logEvent(event) { var msg = "Event <strong>" + event.type + "</strong> at <em>" + event.clientX + ", " + event.clientY + "</em>"; log(msg); } Then we use this as the event handler for a number of mouse events on the box...
HTMLAnchorElement - Web APIs
text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, HTMLElement, and implements those from HTMLHyperlinkElementUtils. Element.accessKey Is a DOMString representing a single character that switches input focus to the hyperlink. HTMLAnchorElement.download Is a DOMString indicating that the linked resource is int
ended to be downloaded 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 representing the fragment identifier, including the leading hash mark ('#'), if any, in the referenced URL. HTMLHyperlinkElementUtils.host Is a USVString represen...
...perlinkElementUtils.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 HTML attribute, indicating the language of the linked resource. HTMLAnchorElement.media Is a DOMString that reflects the media HTML attribute, indicating the int
ended 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 referenc...
HTMLElement: transitionend event - Web APIs
re is no transition, and none of the transition events are fired. If the transitioncancel event is fired, the transitionend event will not fire. ...
...ment that has a transition defined and adds a listener to the transitionend event: const transition = document.querySelector('.transition'); transition.addEventListener('transitionend', () => { console.log('Transition
ended'); }); The same, but using the ontransitionend: const transition = document.querySelector('.transition'); transition.ontransitionend = () => { console.log('Transition
ended'); }; Live example In the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">Hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform background; transition-duration: 2s; transition-delay: 1s; } .transition:hover { ...
HTMLMediaElement: suspend event - Web APIs
The suspend event is fired when media data loading has been susp
ended. Bubbles No Cancelable No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onsuspend Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's suspend event, then post a message when that event handler has reacted to the event firing. ...
...lEventHandlers.onsuspend Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's suspend event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('suspend', (event) => { console.log('Data loading has been susp
ended.'); }); Using the onsuspend event handler property: const video = document.querySelector('video'); video.onsuspend = (event) => { console.log('Data loading has been susp
ended.'); }; Specifications Specification Status HTML Living StandardThe definition of 'suspend media event' in that specification. Living Standard HTML5The definition of 'suspend media even...
Drag Operations - Web APIs
or instance, a drop target that accepts links would check for the type text/uri-list. During a drop event, a listener would retrieve the data being dragged and insert it at the drop location. The drag data's types property 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 Recomm
ended 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 support 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...
...reenY properties will be set to the screen coordinates where the drop occurred. After the dragend event has finished propagating, the drag and drop operation is complete. [1]: In Gecko, dragend is not dispatched if the source node is moved or removed during the drag (e.g. on drop or dragover). Bug 460801 See also HTML Drag and Drop API (Overview) Dragging and Dropping Multiple Items Recomm
ended Drag Types HTML5 Living Standard: Drag and Drop ...
HTML Drag and Drop API - Web APIs
ng example. function dragstart_handler(ev) { // Add different types of drag data ev.dataTransfer.setData("text/plain", ev.target.innerText); ev.dataTransfer.setData("text/html", ev.target.outerHTML); ev.dataTransfer.setData("text/uri-list", ev.target.ownerDocument.location.href); } For a list of common data types used in drag-and-drop (such as text, HTML, links, and files), see Recomm
ended Drag Types. For more information about drag data, see Drag Data. Define the drag image By default, the browser supplies an image that appears beside the pointer during a drag operation. However, an application may define a custom image with the setDragImage() method, as shown in the following example. function dragstart_handler(ev) { // Create an image and then use it for the drag image. ...
...ly): http://jsfiddle.net/9C2EF/ Dragging and dropping files (All browsers): https://jsbin.com/hiqasek/ A parking project using the Drag and Drop API: https://park.glitch.me/ (You can edit here) Specifications Specification Status Comment HTML Living Standard Living Standard See also Drag Operations Dragging and Dropping Multiple Items Recomm
ended Drag Types HTML5 Living Standard: Drag and Drop Drag and Drop interoperability data from CanIUse ...
MediaSource.readyState - Web APIs
The readyState read-only property of the MediaSource interface returns an enum representing the state of the current MediaSource. The three possible values are: closed: The source is not currently attached to a media element. open: The source is attached to a media element and ready to receive SourceBuffer objects.
ended: The 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. Example The following snippet is from a simple example written by Nick Desaulniers (view the full demo live, or download the source for further investigation.) if ('MediaSource' in window && MediaSource.isTypeSupported(mimeCodec)) { var mediaSource = new MediaSource; //c...
... Recommendation Initial definition. ...
MediaSource - Web APIs
diaSource.sourceBuffers -- the list of objects providing the selected video track, enabled audio tracks, and shown/hidden text tracks. MediaSource.readyState Read only Returns an enum representing the state of the current MediaSource, whether it is not currently attached to a media element (closed), attached and ready to receive SourceBuffer objects (open), or attached but the stream has been
ended via MediaSource.endOfStream() (
ended.) MediaSource.duration Gets and sets the duration of the current media being presented. Event handlers MediaSource.onsourceclose The event handler for the sourceclose event. MediaSource.onsource
ended The event handler for the source
ended event. MediaSource.onsourceopen The event handler for the sourceopen event. Methods Inherits methods from its...
...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); //
ended }); sourceBuffer.appendBuffer(buf); }); }; function fetchAB (url, cb) { console.log(url); var xhr = new XMLHttpRequest; xhr.open('get', url); xhr.responseType = 'arraybuffer'; xhr.onload = function () { cb(xhr.response); }; xhr.send(); }; Specifications Specification Status Comment Media Source ExtensionsThe definition of 'MediaSource' in tha...
active - Web APIs
Syntax var isActive = MediaStream.active; Value A Boolean value which is true if the stream is currently active; otherwise, the value is false. ...
... Syntax var isActive = MediaStream.active; Value A Boolean value which is true if the stream is currently active; otherwise, the value is false. ...
MediaStreamTrack - Web APIs
camera that settings can't be modified), false otherwise. MediaStreamTrack.readyState Read only Returns an enumerated value giving the status of the track. This will be one of the following values: "live" which indicates that an input is connected and does its best-effort in providing real-time data. In that case, the output of data can be switched on or off using the enabled attribute. "
ended" which indicates that the input is not giving any more data and will never provide new data. MediaStreamTrack.remote Read only Returns a Boolean with a value of true if the track is sourced by a RTCPeerConnection, false otherwise. Methods MediaStreamTrack.applyConstraints() Lets the application specify the ideal and/or ranges of acceptable values for any number of the available con...
...r the track; the returned value matches the constraints last set using applyConstraints(). MediaStreamTrack.getSettings() Returns a MediaTrackSettings object containing the current values of each of the MediaStreamTrack's constrainable properties. MediaStreamTrack.stop() Stops playing the source associated to the track, both the source and the track are deassociated. The track state is set to
ended. Events Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface:
ended Sent when playback of the track ends (when the value readyState changes to
ended). Also available using the on
ended event handler property. mute Sent to the MediaStreamTrack when the value of the muted property is changed to true, indicating that...
Node.appendChild() - Web APIs
e. If the given child is a reference to an existing node in the document, appendChild() moves it from its current position to the new position (there is no requirement to remove the node from its parent node before appending it to some other node). This means that a node can't be in two points of the document simultaneously. So if the node already has a parent, the node is first removed, then app
ended at the new position. 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.app...
...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 supports 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 app
ended 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() returning the child element: let aBlock = document.createElement('block').appendChild( document.createElement('b') ); Sets aBlock to <b></b> only, which is probably not what you want. Example // Create a new paragraph e...
PublicKeyCredentialCreationOptions.user - Web APIs
The user property of the PublicKeyCredentialCreationOptions dictionary is an object describing the user account for which the credentials are generated (via navigator.credentials.create()). Syntax userAccount = publicKeyCredentialCreationOptions.user Properties displayName A DOMString which is human readable and int
ended for display. It may be the full name of the user (e.g. "John Doe"). This is not int
ended to store the login of the user (see name below). icon Optional An URL as a USVString value which points to an image resource which can be the avatar image for the user. id A BufferSource uniquely identifying a given user. This an opaque identifier which can be used by the authenticator to link the user account with its corresponding credentials. This value will later be used w...
...BufferSource uniquely identifying a given user. This an opaque identifier which can be used by the authenticator to link the user account with its corresponding credentials. This value will later be used when fetching the credentials in AuthenticatorAssertionResponse.userHandle. name A DOMString giving a human-readable name for the user's identifier (e.g. "jdoe@example.com").This property is int
ended for display and may be use to distinguish different account with the same displayName. Examples var publicKey = { challenge: new Uint8Array(26) /* this actually is given from the server */, rp: { name: "Example CORP", id : "login.example.com" }, user: { // To be changed for each user id: new Uint8Array.from(window.atob("LAEGMLKJNRLKGNAMLAFALFKA="), c=>c.charCodeAt(0));...
RTCPeerConnection: icecandidate event - Web APIs
This is a more reliable approach than looking at the individual ICE messages for one indicating that the ICE session is finished. E...
... This is a more reliable approach than looking at the individual ICE messages for one indicating that the ICE session is finished. ...
SVGSVGElement - Web APIs
SVGZoomAndPan, SVGFitToViewBox, and WindowEventHandlers. SVGSVGElement.suspendRedraw() Takes a time-out value which indicates that redraw shall not occur until: the corresponding unsuspendRedraw() call has been made, an unsuspendRedrawAll() call has been made, or its timer has timed out. In environments that do not support interactivity (e.g., print media), then redraw shall not be susp
ended. Calls to suspendRedraw() and unsuspendRedraw() should, but need not be, made in balanced pairs. To suspend redraw actions as a collection of SVG DOM changes occur, precede the changes to the SVG DOM with a method call similar to: const suspendHandleID = suspendRedraw(maxWaitMilliseconds) and follow the changes with a method call similar to: unsuspendRedraw(suspendHandleID) Note that mu...
...efined within the SVG document fragment corresponding to this <svg> element, causing the animation clock corresponding to this document fragment to stand still until it is unpaused. SVGSVGElement.unpauseAnimations() Unsuspends (i.e., unpauses) currently running animations that are defined within the SVG document fragment, causing the animation clock to continue from the time at which it was susp
ended. SVGSVGElement.animationsPaused() Returns true if this SVG document fragment is in a paused state. SVGSVGElement.getCurrentTime() Returns the current time in seconds relative to the start time for the current SVG document fragment. If getCurrentTime() is called before the document timeline has begun (for example, by script running in a <script> element before the document's SVGLoad event is d...
ScriptProcessorNode - Web APIs
ioContext.createScriptProcessor() method is called (both are defined by AudioContext.createScriptProcessor()'s bufferSize parameter). The buffer size must be a power of 2 between 256 and 16384, that is 256, 512, 1024, 2048, 4096, 8192 or 16384. Small numbers lower the latency, but large number may be necessary to avoid audio breakup and glitches. If the buffer size is not defined, which is recomm
ended, the browser will pick one that its heuristic deems appropriate. Number of inputs 1 Number of outputs 1 Channel count mode "max" Channel count 2 (not used in the default count mode) Channel interpretation "speakers" Properties Inherits properties from its parent, AudioNode. ScriptProcessorNode.bufferSize Read only Returns a...
... Working Draft ...
Service Worker API - Web APIs
They will also allow access to push notifications and background sync APIs. Service worker concepts and usage A service worker is an event-driven worker registered against an origin and a path. ...
...e a while to complete, the service worker spec provides a waitUntil method, once this is called oninstall or onactivate, it passes a promise. Functional events are not dispatched to the service worker until the promise is successfully resolved. For a complete tutorial to show how to build up your first basic example, read Using Service Workers. Other use case ideas Service workers are also int
ended to be used for such things as: Background data synchronization. Responding to resource requests from other origins. Receiving centralized updates to expensive-to-calculate data such as geolocation or gyroscope, so multiple pages can make use of one set of data. Client-side compiling and dependency management of CoffeeScript, less, CJS/AMD modules, etc. for development purposes. Hooks for b...
SourceBuffer.appendWindowEnd - Web APIs
The default value of appendWindowEnd is positive infinity. Syntax var myAppendWindowEnd = sourceBuffer.appendWindowEnd; sourceBuffer.appendWindowEnd = 120.0; Value A double, indicating the end time of the append window, in seconds. ...
... The default value of appendWindowEnd is positive infinity. Syntax var myAppendWindowEnd = sourceBuffer.appendWindowEnd; sourceBuffer.appendWindowEnd = 120.0; Value A double, indicating the end time of the append window, in seconds. ...
SourceBuffer.appendWindowStart - Web APIs
The default value of appendWindowStart is the presentation start time, which is the beginning time of the playable media. ...
... The default value of appendWindowStart is the presentation start time, which is the beginning time of the playable media. ...
SubtleCrypto.encrypt() - Web APIs
SA-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 supports three different AES modes: CTR (Counter Mode) CBC (Cipher Block Chaining) GCM (Galois/Counter Mode) It's strongly recomm
ended 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 result to deduce information about the secret key. While it's possible to add authentication to CTR and CBC modes, they do not provide it b...
...acks, in which an attacker can ask the system to decrypt arbitrary messages, and use the result to deduce information about the secret key. While it's possible to add authentication to CTR and CBC modes, they do not provide it by default and when implementing it manually one can easily make minor, but serious mistakes. GCM does provide built-in authentication, and for this reason it's often recomm
ended over the other two AES modes. RSA-OAEP The RSA-OAEP public-key encryption system is specified in RFC 3447. AES-CTR This represents AES in Counter Mode, as specified in NIST SP800-38A. AES-CBC This represents AES in Cipher Block Chaining Mode, as specified in NIST SP800-38A. AES-GCM This represents AES in Galois/Counter Mode, as specified in NIST SP800-38D. One major difference between th...
Transferable - Web APIs
property; it is merely a tag indicating objects 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 ext
ended attribute). The ArrayBuffer, MessagePort, 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 ...
...he 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. Living Standard Replaced Transferable interface with [Transferable] Web IDL ext
ended attribute. HTML5The definition of 'Transferable' in that specification. Recommendation Initial definition. ...
WebRTC API - Web APIs
Telephone Networks (PTSNs). They're primarily used to send tone dialing sounds--or packets representing those tones--across the network to the remote peer. Interfaces RTCDTMFSender Manages the encoding and transmission of Dual-Tone Multi-Frequency (DTMF) signaling for an RTCPeerConnection. RTCDTMFToneChangeEvent Used by the tonechange event to indicate that a DTMF tone has either begun or
ended. This event does not bubble (except where otherwise stated) and is not cancelable (except where otherwise stated). Events tonechange Either a new DTMF tone has begun to play over the connection, or the last tone in the RTCDTMFSender's toneBuffer has been sent and the buffer is now empty. The event's type is RTCDTMFToneChangeEvent. Guides Introduction to WebRTC protocols This article i...
...-to-peer communication of arbitrary data, audio, or video--or any combination thereof--into a browser application. In this article, we'll look at the lifetime of a WebRTC session, from establishing the connection all the way through closing the connection when it's no longer needed. Establishing a connection: The perfect negotiation pattern Perfect negotiation is a design pattern which is recomm
ended for your signaling process to follow, which provides transparency in negotiation while allowing both sides to be either the offerer or the answerer, without significant coding needed to differentiate the two. Signaling and two-way video calling A tutorial and example which turns a WebSocket-based chat system created for a previous example and adds support for opening video calls among participa...
Lighting a WebXR setting - Web APIs
scene, the VR or AR use case adds additional areas of concern when writing your shaders. In this section, we provide some basic mixed reality lighting guidelines to consider as you construct, render, and light your scene. While some of these are also useful in any other 3D setting, most are specific to virtual reality and, in some cases even more so, to augmented reality. Since your scene is int
ended to represent a setting a person or their avatar can exist within, you should try to achieve some degree of consistency and realism in terms of the positioning and presentation of your light sources. Obviously, there are exceptions to this guideline, such as when your scene represents an otherworldly or alien setting, or when your goal is to create an unsettling visual effect. Realism in light so...
...re exceptions, such as the ambient lighting that simply adds a baseline amount of lighting to your setting, and the sun, which is a directional light (that is, a light source where every light ray is parallel, coming from somewhere in the sky and ending somewhere within your scene). Try to place light sources in realistic locations for the setting and the mood you're trying to create. A scene int
ended to feel like a naturally-lit, real-world setting doesn't have studio lighting. It has sunlight, possibly light reflected off of objects or water within the scene, and so forth, but not lamps directed at the faces of objects or people in the scene. Realism in player interactions with light If your light source is located within the scene, you probably should try to ensure the viewer's avatar can...
Starting up and shutting down a WebXR session - Web APIs
the session ends. The shutdown of an XRSession can happen either due to the session itself deciding it's time to shut down (such as if the user turns off their XR device), because the user has clicked a button to end the session, or some other situation as appropriate for your application. Here we discuss both how to request a shutdown of the WebXR session and how to detect when the session has
ended, whether by your request or otherwise. Shutting down the session To cleanly shut down the WebXR session when you're done with it, you should call the session's end() method. This returns a promise you can use to know when the shutdown is complete. async function shutdownXR(session) { if (session) { await session.end(); /* At this point, WebXR is fully shut down */ } } When shutd...
...returns to its caller, the WebXR session is fully and safely shut down. If you have work that must be done when the session ends, such as releasing resources and the like, you should do that work in your end event handler rather than in your main code body. That way, you handle the cleanup regardless of whether the shutdown was automatically or manually triggered. Detecting when the session has
ended As previously established, you can detect when the WebXR session has
ended--whether because you've called its end() method, the user turned off their headset, or some sort of irresolvable error occurred in the XR system--by watching for the end event to be sent to the XRSession. session.onend = (event) => { /* the session has shut down */ freeResources(); }; Here, when the session has end...
Web Audio API - Web APIs
hones or electric instruments, and get mixed down into a single, complicated wave. Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. A common modification is multiplying the samples by a value to make them louder or quieter (as is the case with GainNode). Once the sound has been sufficiently processed for the int
ended effect, it can be linked to the input of a destination (AudioContext.destination), which sends the sound to the speakers or headphones. This last connection is only necessary if the user is supposed to hear the audio. A simple, typical workflow for web audio would look something like this: Create audio context Inside the context, create sources -- such as <audio>, oscillator, stream Create ...
...s the methods forEach(), get(), has(), keys(), and values(), as well as a size property. BaseAudioContext The BaseAudioContext interface acts as a base definition for online and offline audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively. You wouldn't use BaseAudioContext directly -- you'd use its features via one of these two inheriting interfaces. The
ended event The
ended event is fired when playback has stopped because the end of the media was reached. Defining audio sources Interfaces that define audio sources for use in the Web Audio API. AudioScheduledSourceNode The AudioScheduledSourceNode is a parent interface for several types of audio source node interfaces. It is an AudioNode. OscillatorNode The OscillatorNode interface repres...
Web Authentication API - Web APIs
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 important to understand that they sit between two components that are outside the browser: Server - the Web Authentication API is int
ended 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. This is a new concept in authentication: when authenticating using passwords, the password is stored in a user's brain and no other de...
...ir that is stored in an authenticator. The authenticator may be embedded into an operating system, such as Windows Hello, or may be a physical token, such as a USB or Bluetooth Security Key. Registration A typical registration process has six steps, as illustrated in Figure 1 and described further below. This is a simplification of the data required for the registration process that is only int
ended to provide an overview. The full set of required fields, optional fields, and their meanings for creating a registration request can be found in the PublicKeyCredentialCreationOptions dictionary. Likewise, the full set of response fields can be found in the PublicKeyCredential interface (where PublicKeyCredential.response is the AuthenticatorAttestationResponse interface). Note most JavaScript pr...
XRPermissionDescriptor.mode - Web APIs
The session's environmentBlendMode indicates the method to be used to blend the content together. Important: 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 immersiv...
... session's environmentBlendMode indicates the method to be used to blend the content together. Important: 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 int
ended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected to be opaque if possible, but might be additive if 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 ...
ARIA annotations - Accessibility
ed to the difference between these two above -- aria-describedby is for textual descriptions, whereas aria-details is for more complex sets of details. But what does this actually mean? aria-describedby is appropriate for associating an element with a simple text description, where you don't have much in the way of meaningful semantics contained within. ...
...Content marked up with aria-describedb...
ARIA: contentinfo role - Accessibility
The 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 statements. This section is commonly called a footer. <div role="contentinfo"> <h2>Footer</h2> <!-- footer content --> </div> This is a website footer. Using the <footer> element instead is recomm
ended: <footer> <h2>Footer</h2> <!-- footer content --> </footer> Description The contentinfo role is a landmark used to identify a page footer. Landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. Pages should only include one top-level contentinfo landmark role per page. Each page should only include one contentinfo landmark, created by either using the ...
... <ul> <li><a href="#">Web Technologies</a></li> <li><a href="#">Learn Web Development</a></li> <li><a href="#">About MDN</a></li> <li><a href="#">Feedback</a></li> </ul> <p>(C) 2005-2018 Mozilla and individual contributors. Content is available under <a href="#">these licenses</a>.</p> </div> </body> Accessibility concerns Use sparingly Landmark roles are int
ended 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. One contentinfo landmark per page The <body> element There should be only one contentinfo landmark per document, used as the immediate descendant of the <body> element. Mega-footers Do not nest additional <f...
ARIA: form role - Accessibility
Using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. Inputs are not forms You do not need to declare ro...
...mplete="email" autocapitalize="off" autocorrect="off" spellcheck="false" type="text"> <label for="comment">Comment</label> <textarea id="comment" name="comment"></textarea> <input value="Comment" type="submit"> </div> It is recomm
ended to use <form> instead. <form id="send-comment" aria-label="Add a comment"> .... </form> Accessibility concerns Use sparingly Landmark roles are int
ended 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. Inputs are not forms You do not need to declare role="form" on every form element (inputs, text areas, selects, etc.). It should be declared on the HTML element that wraps the form elements. Ideally, use the <f...
ARIA: Navigation Role - Accessibility
y 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 important sections of a page. Like the HTML <nav> element, navigation landmarks provide a way to identify groups (e.g. lists) of links that are int
ended 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 preferable to use the HTML5 <nav> element to define a navigation landmark. If the HTML5 nav element technique is not being used, use a role="navigatio...
...pt features None. Examples <div role="navigation" aria-label="Customer service"> <ul> <li><a href="#">Help</a></li> <li><a href="#">Order tracking</li> <li><a href="#">Shipping & Delivery</a></li> <li><a href="#">Returns</a></li> <li><a href="#">Contact us</a></li> <li><a href="#">Find a store</a></li> </ul> </div> Accessibility concerns Landmark roles are int
ended 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 <nav> element will automatically communicate a section has a role of navigation. If at all possible, prefer using it instead. Labeling landmarks Mul...
ARIA: tab role - Accessibility
Specifications Specification Status Accessible ...
...ted panel grandparent.parentNode .querySelector(`#${target.getAttribute("aria-controls")}`) .removeAttribute("hidden"); } Best practices It is recomm
ended to use a button element with the role tab for their built-in functional and accessible features instead, as opposed to needing to add them yourself. For controlling tab key functionality for elements with the role tab, it is recomm
ended to set all non-active elements to tabindex=-1, and to set the active element to tabindex=0. Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'tab' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'tabs' in that specification. Working Draft Precedence order What...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
ce or QueryService if it's being implemented on a different object than IAccessible is. Support a scrollTo method which takes a text index, and a getClippedBounds and getUnclippedBounds method which takes a start and end index. Publish your custom interface. No way for assistive technology to know when scrolling has stopped. Fire the EVENT_SYSTEM_SCROLLINGEND event to indicate when scrolling has
ended (try not to fire too many of these, wait until scrolling has truly stopped). There is no need to support EVENT_SYSTEM_SCROLLINGSTART, it is not used by assistive technology. No support for document formatting or "DOM" as requested by some vendors: support a custom interface that gives them the formatting information they are requesting. Dueling text equivalents Problem: There are three kinds ...
...the interfaces used in the two trees (IAccessible and ISimpleDOMNode). If there is no MSAA node for a DOM node, pAccessible->QueryInterface(IID_IAccessible) will return null. A Variety of Implementations for IAccessible There are two main kinds of classes in Mozilla's accessibility class hierarchy, platform-specifc and cross-platform. All of the platform-specific classes have the word "Wrap" app
ended to them. The Wrap classes contain implementations and interfaces specific to MSAA or ATK. These platform-specific classes inherit from cross-platform classes, where the most of the implementation is done. For example, nsAccessibleWrap inherits from nsAccessible. Every accessible object in the MSAA tree has an implementation dertived from nsAccessible, which exposes accessibility information throu...
Accessibility Information for Web Authors - Accessibility
ssion list. How-to's Key-navigable custom DHTML widgets in Mozilla & IE This document discusses how to use tabindex, element.focus() and onkeypress to make custom DHTML widgets such as menus or tree views keyboard accessible. Accessible Web Page Authoring IBM has put together a simple, practical resource for web authors to learn accessibility the fast and painless way. Highly recomm
ended, an excellent resource. Dive Into Accessibility by Mark Pilgrim An excellent, easy-to-understand resource (available in English and in 9 other languages) on accessible website authoring, which goes into greater depth. In 30 days, you will know why your website should be accessible and how to make it more accessible. Automated Checking & Repair Cynthia says(TM) from HiSoftware(R) Compa...
.... You can install a custom WAVE toolbar in Firefox for a quick, easy and convenient evaluation of web pages directly within Firefox. You can also add a WAVE bookmarklet in Firefox or even WAVE direct links for checking a webpage. HTML advanced validator (Firefox extension) by Marc Gueury This HTML Validator (based on W3C Tidy and on OpenSP for SGML validation) is a powerful, versatile, ext
ended HTML validator. It's free. It works off-line and that is a major advantage over other accessibility checkers. No document upload needed and no additional application to launch; everything is accessible within the Firefox browser. This HTML advanced validator Firefox extension is very resourceful and highly customizable. It's an extension add-on to Firefox 2.x and Firefox 3.x. It not only check...
Web accessibility for seizures and physical reactions - Accessibility
tegrates with the event loop defined in HTML. [HTML] for the MediaQueryList object. See the MDN document, MediaQueryList for more information. Personalization Help and Support The requirement for the literal property is taken from section 23 Non-literal Text and Images Requirement: Some users cannot understand non-literal text and icons such as metaphors, idioms etc. The literal property is int
ended to identify text or images as non-literal and allows the author to explain non-literal text and images to users. Transitions (for CSS and SVG) The following is from the Web Animations model CSSWG.org drafts The Web Animations model is int
ended to provide the features necessary for expressing CSS Transitions [CSS-TRANSITIONS-1], CSS Animations [CSS-ANIMATIONS-1], and SVG [SVG11]. See Also MDN...
...undation of America Working Group. GPII Accessibility Master List Gregg Vanderheiden Ph.D. Editor Harding Along with the PEAT tool, is generaly recognized to be one of the two "gold standards" for analyzing flashes Harding Flash and Pattern Analyzer ISO IEC 61966-2-2:2003(en) Multimedia systems and equipment -- Colour measurement and management -- Part 2-2: Colour management -- Ext
ended RGB colour space -- scRGB Photosensitive Epilepsy Analysis Tool Along with the Harding tool, is generaly recognized to be one of the two "gold standards" for analyzing flashes Trace Research and Development Center Using PEAT To Create Seizureless Web Animations W3C CSS Color Module Level 3 Personalization Semantics Explainer 1.0. Working Draft Personalization Tools 1.0 Working Draft...
-moz-force-broken-image-icon - CSS: Cascading Style Sheets
Syntax Values <integer> A value of 1 means that the broken image icon is shown even if the image has an alt attribute. When the value 0 is used the image will act as usual and only display the alt attribute. Note: Even if the value is set to 1 the alt attribute will still be displayed, alongside the broken image icon. ...
...A proper alt attribute should be used instead. Specifications Not part of any standard. ...
range - CSS: Cascading Style Sheets
range: infinite 6, 10 infinite; Values auto The range depends on the counter system: For cyclic, numeric, and fixed systems, the range is negative infinity to positive infinity. For alphabetic and symbolic systems, the range is 1 to positive infinity. For additive systems, the range is 0 to positive infinity. For extends systems, the range is whatever auto would produce for the ext
ended system; if extending a complex predefined style (?7 Complex Predefined Counter Styles), the range is the style's defined range. [ [ | infinite ]{2} ]# Defines a comma-separated list of ranges. For each individual range, the first value is the lower bound and the second value is the upper bound. A range is inclusive, that means it always contains both, the lower and upper bound numbers. If i...
...lower and upper bounds specified as integers. If value is auto, then for cyclic, numeric, and fixed system, the range will be from negative infinity to positive infinity. For alphabetic and symbolic systems, range will be from 1 to positive infinity. For additive systems, auto will result in the range 0 to positive infinity. For extends systems, the range is whatever auto will produce for the ext
ended system. When range is specified as integers, the value infinite can be used to denote infinity. If infinite is specified as the first value in a range, then it is interpreted as negative infinity. If used as upper bound, it is taken as positive infinity. Formal definition Related at-rule@counter-styleInitial valueautoComputed valueas specified Formal syntax [ [ <integer> | infinite ]{2} ]# |...
suffix - CSS: Cascading Style Sheets
It may be a <string>, <image>, or <custom-ident>. Formal definition Related at-rule@counter-styleInitial value". ...
...It may be a <string>, <image>, or <custom-ident>. Formal definition Related at-rule@counter-styleInitial value". ...
Using CSS animations - CSS: Cascading Style Sheets
element to the style that gets animated after the fact. Receiving the events The events get delivered to the listener() function, which is shown below. function listener(event) { var l = document.createElement("li"); switch(event.type) { case "animationstart": l.innerHTML = "Started: elapsed time is " + event.elapsedTime; break; case "animationend": l.innerHTML = "
Ended: elapsed time is " + event.elapsedTime; break; case "animationiteration": l.innerHTML = "New loop started at time " + event.elapsedTime; break; } document.getElementById("output").appendChild(l); } This code, too, is very simple. It simply looks at the event.type to determine which kind of animation event occurred, then adds an appropriate note to the <ul> (unordered l...
... } This code, too, is very simple. It simply looks at the event.type to determine which kind of animation event occurred, then adds an appropriate note to the <ul> (unordered list) we're using to log these events. The output, when all is said and done, looks something like this: Started: elapsed time is 0 New loop started at time 3.01200008392334 New loop started at time 6.00600004196167
Ended: elapsed time is 9.234000205993652 Note that the times are very close to, but not exactly, those expected given the timing established when the animation was configured. Note also that after the final iteration of the animation, the animationiteration event isn't sent; instead, the animationend event is sent. The HTML Just for the sake of completeness, here's the HTML that displays the page c...
OpenType font features guide - CSS: Cascading Style Sheets
implementation inconsistencies, but in many cases the first example will match the second. The typefaces shown are Playfair Display, Source Serif Pro, IBM Plex Serif, Dancing Script, and Kokoro (all available and free to use, most are on Google Fonts and other services). Kerning (font-kerning) This refers to the spacing between specific glyph pairings. This is generally on by default (as recomm
ended by the OpenType specification). It should be noted that if letter-spacing is also set on your text, that is applied after kerning. Alternates (font-variant-alternates) Fonts can supply a number of different alternatives for various glyphs, such as different styles of lower case 'a' or more or less elaborate swashes in a script typeface. This property can activate an entire set of alternates o...
...ing 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 string of glyphs with only the OpenType set 'jis78' enabled. Uncheck the box below and you'll see more characters displayed. Note: these glyphs were copied out of a font sample and are not int
ended as prose. Font variant shorthand (font-variant) This is the shorthand syntax for defining all of the above. Setting a value of normal resets all properties to their initial value. Setting a value of none sets font-variant-ligatures to none and all other properties to their initial value. (Meaning that if kerning is on by default, it will still be on even with a value of none being supplied her...
image-rendering - CSS: Cascading Style Sheets
image-rendering: initial; image-rendering: unset; Values auto The scaling algorithm is UA dependent. Since version 1.9 (Firefox 3.0), Gecko uses bilinear resampling (high quality). smooth The image should be scaled with an algorithm that maximizes the appearance of the image. In particular, scaling algorithms that "smooth" colors are acceptable, such as bilinear interpolation. This is int
ended for images such as photos. high-quality Identical to smooth, but with a preference for higher-quality scaling. If system resources are constrained, images with high-quality should be prioritized over those with any other value, when considering which images to degrade the quality of and to what degree. crisp-edges The image must be scaled with an algorithm that preserves contrast and edges ...
...nsidering which images to degrade the quality of and to what degree. crisp-edges The image must be scaled with an algorithm that preserves contrast and edges in the image, and which does not smooth colors or introduce blur to the image in the process. Suitable algorithms include nearest-neighbor and other non-smoothing scaling algorithms such as 2xSaI and hqx-family algorithms. This value is int
ended for pixel-art images, such as in browser games. pixelated When scaling the image up, the nearest-neighbor algorithm must be used, so that the image appears to be composed of large pixels. When scaling down, this is the same as auto. Note: The values optimizeQuality and optimizeSpeed present in an early draft (and coming from its SVG counterpart image-rendering) are defined as synonyms for th...
Cross-browser audio basics - Developer guides
HTML attributes We can specify a number of attributes with the audio tag to further determine the way audio is initialized. autoplay Specifying autoplay will cause the audio to start playing as soon as possible and without any user interaction -- in short, the audio will autoplay. <audio autoplay> ... </audio> Note: This value is often ignored on mobile platforms, and its use is not recomm
ended unless really necessary. Auto-playing audio (and video) is usually really annoying. Plus browsers have policies that will block autoplay entirely in many situations. See the Autoplay guide for media and Web Audio APIs for details. loop The loop attribute will ensure that upon getting to the end of the audio clip, the audio clip will loop back to the beginning and start playing again. <audio l...
...ata, although it is expected to resume once data becomes available. play The play event is initiated after the play() method is returned or when the autoplay attribute has caused playback to begin. This is when the state of the media switches from paused to playing. pause The pause event is triggered after the pause() method is returned. This is when the states switch from playing to paused.
ended The
ended event is initiated when the end of the media is reached. myAudio.addEventListener("
ended", function() { //do something once audio track has finished playing }); volumechange The volumechange event signifies that the volume has changed; that includes being muted. An Audio Player with Feedback Consider this snippet of HTML: <audio id="my-audio"> <source src="https://udn.reality...
Video player styling basics - Developer guides
"dual functionality" buttons (such as the play/pause button) are in the correct "state" and display the correct image. ...
...ses the default controls, the defined Media API events -- such as play and pause -- are raised so this can be taken advantage of to ensure that the custom control buttons are kept in sync. ...
Web Audio playbackRate explained - Developer guides
changed. Note: Try out this example live, and try adjusting the playback rate control to see the effect. defaultPlaybackRate and ratechange In addition to playbackRate, we also have a defaultPlaybackRate property available, which lets us set the default playback rate: the playback rate to 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 support Chrome 20+ ? Firefox 20+ ? IE 9+ ? Safari 6+ ? Opera 15+ ? Mobile Chrome (Android) ? Mobile Firef...
...change, which fires every time the playbackRate changes. Browser support 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 recomm
ended that you limit the range to between 0.5 and 4. The pitch of the audio track does not change when playBackRate is altered. Negative values will not cause the media to play in reverse. IE9+ switches to the default playback rate when an
ended event is fired. Firefox generates a ratechange event when the media source is substituted. On iOS 7 you can only affect the playbackRate when the media ...
Audio and Video Delivery - Developer guides
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. ...
... tag --> <a href="videofile.mp4">download video</a> </video> The code above creates a video player of dimensions 640x480 pixels, displaying a poster image until the video is played. We instruct the video to autoplay but to be muted by default. Note: The autoplay attribute may be ignored by some mobile browsers. Also, the autoplay feature can be controversial when misused. It's strongly recomm
ended that you read the Autoplay guide for media and Web Audio APIs to learn how to use autoplay wisely.. For further info see <video> element and Creating a cross-browser video player. Audio and Video Fallback You can create a more comprehensive Fallback using Flash. Using flashmediaelement.swf is one way. <audio controls> <source src="audiofile.mp3" type="audio/mpeg"> <source src="audiofile.
Audio and video manipulation - Developer guides
nymous"> <source src="https://udn.realityripple.com/samples/5b/8cd6da9c65.webm" type="video/webm"> <source src="https://udn.realityripple.com/samples/6f/08625b424a.m4v" type="video/mp4"> </video> <canvas id="my-canvas" width="480" height="270"></canvas> JavaScript This code handles altering the frames. ...
...t codecs It's also possible to manipulate audio at a low level using JavaScript. This can be useful should you want to create audio codecs. Libraries currently exist for the following formats : AAC: AAC.js ALAC: alac.js FLAC: flac.js MP3: mp3.js Opus: Opus.js Vorbis: vorbis.js Note: At Audiocogs, you can Try out a few demos; Audiocogs also provides a framework, Aurora.js, which is int
ended to help you author your own codecs in JavaScript. Examples Various Web Audio API (and other) examples THREE.js Video Cube example Convolution Effects in Real-Time ...
Media events - Developer guides
uration of the media. This is sent, for example, when the media has loaded enough that the duration is known. emptied The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it. encrypted The user agent has encountered initialization data in the media data.
ended Sent when playback completes. error Sent when an error occurs. The element's error attribute contains more information. See HTMLMediaElement.error for details. loadeddata The first frame of the media has finished loading. loadedmetadata The media's metadata has finished loading; all attributes now contain as much useful information as they're going to. ...
...ailable in the media element's buffered attribute. ratechange Sent when the playback speed changes. seeked Sent when a seek operation completes. seeking Sent when a seek operation begins. stalled Sent when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming. suspend Sent when loading of the media is susp
ended; this may happen either because the download has completed or because it has been paused for any other reason. timeupdate The time indicated by the element's currentTime attribute has changed. volumechange Sent when the audio volume changes (both when the volume is set and when the muted attribute is changed). waiting Sent when the requested operation (such as ...
Introduction to HTML5 - Developer guides
ually indicating the character set that is used. In previous versions of HTML, it was done using a very complex <meta> element. Now, it is very simple: <meta charset="UTF-8"> Place this right after your <head>, as some browsers restart the parsing of an HTML document if the declared character set is different from what they had anticipated. Also, if you are not currently using UTF-8, it's recomm
ended that you switch to it in your web pages, as it simplifies character handling in documents using different scripts. Note that HTML5 restricts character sets to those compatible with ASCII and using at least 8 bits. This was done to tighten security and prevent some types of attacks. Using the new HTML5 parser The parsing rules of HTML5, which analyze the meaning of mark-up, have been more preci...
...it meant that all browsers behaved differently, which is no longer the case. Now, faced with errors in the mark-up, all compliant browsers must behave exactly in the same way. This requirement helps web developers quite a bit. While it is true that all modern browsers now use these HTML5 parsing rules, non-HTML5-compliant browsers are still used by some. Keep in mind that it's still highly recomm
ended that one writes valid mark-up, as such code is easier to read and maintain, and it greatly decreases the prominence of incompatibilities that exists in various older browsers. Don't worry -- you don't have to change anything on your website. The web browsers' developers have done everything for you! ...
HTML5 - Developer guides
HTML5. Downloadable HTML5 Guide A quick guide to HTML5, including the common HTML tags as well as the new HTML5 tags. Downloadable in PDF and PNG formats. HTML5 Cheat Sheet A handy HTML 5 cheat sheet for beginners who want to master HTML 5, its elements, event attributes and compatibility. HTML5-compliant parser The parser, which turns the bytes of an HTML document into a DOM, has been ext
ended and now precisely defines the behavior to use in all cases, even when faced with invalid HTML. This leads to far greater predictability and interoperability between HTML5-compliant browsers. Connectivity Web Sockets Allows creating a permanent connection between the page and the server and to exchange non-HTML data through that means. Server-sent events Allows a server to push events to a...
...r runs changes orientation. This can be used as an input device (e.g., to make games that react to the position of the device) or to adapt the layout of a page to the orientation of the screen (portrait or landscape). Pointer Lock API Allows locking the pointer to the content, so games and similar application don't lose focus when the pointer reaches the window limit. StylIng CSS has been ext
ended to be able to style elements in a much more complex way. This is often referred as CSS3, though CSS is not a monolithic specification any more and the different modules are not all at level 3: some are at level 1 and others at level 4, with all the intermediate levels covered. New background styling features It is now possible to put shadows on elements using box-shadow, multiple backgrounds,...
Using HTML sections and outlines - Developer guides
duced 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. They are int
ended to enhance the limited semantics of earlier versions of HTML, which included only the <div> tag as a generic mechanism for grouping related content. For example, <div class="navigation"> does not suggest any meaning about its content to a browser; only a human reading the HTML source can divine the meaning of a class like navigation. By contrast, the <nav> sectioning element more clearly describe...
...escribes 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 important for developers to use these semantic elements in line with their int
ended 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 navigation links that appear often on a site. You can have primary and secondary me...
Developer guides
content. Most of what you see on screen in your browser is described, fundamentally, using HTML. CSS learning area Cascading Style Sheets (CSS) is a stylesheet language used to define the presentation of a document written in HTML. Audio and video delivery We can deliver audio and video on the web in several ways, ranging from 'static' media files to adaptive live streams. This article is int
ended as a starting point for exploring the various delivery mechanisms of web-based media and compatibility with popular browsers. Audio and video manipulation The beauty of the web is that you can combine technologies to create new forms. Having native audio and video in the browser means we can use these data streams with technologies such as <canvas>, WebGL or Web Audio API to modify audio and vi...
...icode text standard. It describes how the browser should order characters while rendering Unicode text. This guide covers the algorithm in general and how it applies to content you create--especially when you build properly localized and internationalized content. Using FormData objects The FormData object lets you compile a set of key/value pairs to send using XMLHttpRequest. It's primarily int
ended for sending form data, but can be used independently from forms to transmit keyed data. The transmission is in the same format that the form's submit() method would use to send the data if the form's encoding type were set to "multipart/form-data". User input and controls Modern web user input goes beyond simple mouse and keyboard: think of touchscreens for example. This article provides recomm...
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
ts background, and any decorations on the text. color The color to use when drawing the text and any text decorations (such as the addition of under- or overlines, strike-through lines, and so forth. background-color The text's background color. text-shadow Configures a shadow effect to apply to text. Among the options for the shadow is the shadow's base color (which is then blurred and bl
ended with the background based on the other parameters). See Text drop shadows in Fundamental text and font styling to learn more. text-decoration-color By default, text decorations (such as underlines, strikethroughs, etc) use the color property as their colors. However, you can override that behavior and use a different color for them with the text-decoration-color property. text-emphasis-color ...
...r names have been defined, letting you use these keywords instead of numeric representations of colors if you choose to do so and there's a keyword representing the exact color you want to use. Color keywords include the standard primary and secondary colors (such as red, blue, or orange), shades of gray (from black to white, including colors like darkgray and lightgrey), and a variety of other bl
ended colors including lightseagreen, cornflowerblue, and rebeccapurple. See Color keywords in <color> for a list of all available color keywords. RGB values There are three ways to represent an RGB color in CSS. Hexadecimal string notation Hexadecimal string notation represents a color using hexadecimal digits to represent each of the color components (red, green, and blue). It may also include a...
<blockquote>: The Block Quotation element - HTML: Hypertext Markup Language
Usually, this is rendered visually by indentation (see Notes for how to change it). A URL for the source of the quotation may be given using the cite attribute, while a text representation of the source can be given using the <cite> 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. Content categories Flow content, sectioning root, palpable content. ...
...e mandatory. Permitted parents Any element that accepts flow content. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLQuoteElement Attributes This element's attributes include the global attributes. cite A URL that designates a source document or message for the information quoted. This attribute is int
ended to point to information explaining the context or the reference for the quote. Usage notes To change the indentation applied to the quoted text, use the CSS margin-left and/or margin-right properties, or the margin shorthand property. To include shorter quotes inline rather than in a separate block, use the <q> (Quotation) element. Example This example demonstrates the use of the <blockquot...
<button>: The Button element - HTML: Hypertext Markup Language
button is a submit button (it's inside/associated with a <form> and doesn't have type="button"), this attribute specifies the HTTP method used to submit the form. Possible values: post: The data from the form are included in the body of the HTTP request when sent to the server. Use when the form contains information that shouldn't be public, like login credentials. get: The form data are app
ended to the form's action URL, with a ? as a separator, and the resulting URL is sent to the server. Use this method when the form has no side effects, like search forms. If specified, this attribute overrides the method attribute of the button's form owner. formnovalidate HTML5 If the button is a submit button, this Boolean attribute specifies that the form is not to be validated when it is s...
...tanding Success Criterion 4.1.2 | W3C Understanding WCAG 2.0 Size and Proximity Size Interactive elements such as buttons should provide an area large enough that it is easy to activate them. This helps a variety of people, including people with motor control issues and people using non-precise forms of input such as a stylus or fingers. A minimum interactive size of 44x44 CSS pixels is recomm
ended. Understanding Success Criterion 2.5.5: Target Size | W3C Understanding WCAG 2.1 Target Size and 2.5.5 | Adrian Roselli Quick test: Large touch targets - The A11Y Project Proximity Large amounts of interactive content -- including buttons -- placed in close visual proximity to each other should have space separating them. This spacing is beneficial for people who are experiencing motor co...
<input type="image"> - HTML: Hypertext Markup Language
lt value if the attribute is not specified. text/plain. If this attribute is specified, it overrides the enctype attribute of the element's form owner. formmethod HTML5 Specifies the HTTP method that the browser uses to submit the form. Possible values are: post: The data from the form is included in the body of the form and is sent to the server. get: The data from the form is app
ended to the form attribute URI, with a '?' as a separator, and the resulting URI is sent to the server. Use this method when the form has no side-effects and contains only ASCII characters. If specified, this attribute overrides the method attribute of the element's form owner. formnovalidate HTML5 A Boolean attribute specifying that the form is not to be validated when it is submitted. If thi...
...ent). If there is no parent, this option behaves the same as _self. Using the x and y data points When you submit a form using a button created with <input type="image">, two extra data points are submitted to the server automatically by the browser -- x and y. You can see this in action in our X Y coordinates example. When you click on the image to submit the form, you'll see the data app
ended to the URL as parameters, for example ?x=52&y=55. If the image input has a name attribute, then keep in mind that the specified name is prefixed on every attribute, so if the name is position, then the returned coordinates would be formatted in the URL as ?position.x=52&position.y=55. This, of course, applies to all other attributes as well. These are the X and Y coordinates of the image that th...
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
dio"/> range A control for entering a number whose exact value is not important. Displays as a range widget defaulting to the middle value. Used in conjunction min and max to define the range of acceptable values. <input type="range" name="range" min="0" max="25"/> HTML5 reset A button that resets the contents of the form to default values. Not recomm
ended. <input type="reset" name="reset"/> search A single-line text field for entering search strings. Line-breaks are automatically removed from the input value. May include a delete icon in supporting browsers that can be used to clear the field. Displays a search icon instead of enter key on some devices with dynamic keypads. <input type="search" name="search"/>...
... Understanding Success Criterion 2.5.5: Target Size | W3C Understanding WCAG 2.1 Target Size and 2.5.5 | Adrian Roselli Quick test: Large touch targets - The A11Y Project ...
<q>: The Inline Quotation 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. ...
... HTMLQuoteElement Usage note: Most modern browsers will automatically add quotation marks around text inside a <q> element. A style rule may be needed to add quotation marks in older browsers. Attributes This element includes the global attributes. cite The value of this attribute is a URL that designates a source document or message for the information quoted. This attribute is int
ended to point to information explaining the context or the reference for the quote. Example <p>According to Mozilla's website, <q cite="https://www.mozilla.org/about/history/details/">Firefox 1.0 was released in 2004 and became a big success.</q></p> Specifications Specification Status Comment HTML Living StandardThe definition of '<q>' in that specification. ...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
ontent in the cell element is aligned to a character. Typical values include a period (.) to align numbers or monetary values. If align is not set to char, this attribute is ignored. charoff This attribute is used to shift column data to the right of the character specified by the char attribute. Its value specifies the length of this shift. height This attribute is used to define a recomm
ended cell height. Use the CSS height property instead. scope This enumerated attribute defines the cells that the header (defined in the <th>) element relates to. Only use this attribute with the <th> element to define the row or column for which it is a header. valign This attribute specifies how a text is vertically aligned inside a cell. Possible values for this attribute are: baseline:...
...tead of the bottom. If characters don't descend below the baseline, the baseline value achieves the same effect as bottom. bottom: Positions the text near the bottom of the cell. middle: Centers the text in the cell. and top: Positions the text near the top of the cell. To achieve a similar effect, use the CSS vertical-align property. width This attribute is used to define a recomm
ended cell width. Use the CSS width property instead. Examples See <table> for examples on <td>. Specifications Specification Status Comment HTML Living StandardThe definition of 'td element' in that specification. Living Standard HTML5The definition of 'td element' in that specification. Recommendation ...
<template>: The Content Template element - HTML: Hypertext Markup Language
the table var clone2 = template.content.cloneNode(true); td = clone2.querySelectorAll("td"); td[0].textContent = "0384928528"; td[1].textContent = "Acme Kidney Beans 2"; tbody.appendChild(clone2); } else { // Find another way to add the rows to the table because // the HTML template element is not supported. } The result is the original HTML table, with two new rows app
ended 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="container"></div> <template id="template"> <div>Click me</div> </templat...
...secondClone is an HTMLDivElement instance, clicking on it works as one would expect. Specifications Specification Status Comment HTML Living StandardThe definition of 'template element' in that specification. Living Standard HTML5The definition of 'template element' i...
<th> - HTML: Hypertext Markup Language
xt-align property, Unimplemented in CSS3. charoff Obsolete since HTML5 This attribute is used to shift column data to the right of the character specified by the char attribute. Its value specifies the length of this shift. Note: Do not use this attribute as it is obsolete in the latest standard. height Deprecated since HTML4, Obsolete since HTML5 This attribute is used to define a recomm
ended cell height. Note: Do not use this attribute as it is obsolete in the latest standard: use the CSS height property instead. valign Obsolete since HTML5 This attribute specifies how a text is vertically aligned inside a cell. Possible values for this attribute are: baseline: Positions the text near the bottom of the cell and aligns it with the baseline of the characters instead of the bot...
...the same effect as bottom. bottom: Positions the text near the bottom of the cell. middle: Centers the text in the cell. and top: Positions the text near the top of the cell. Note: Do not use this attribute as it is obsolete in the latest standard: use the CSS vertical-align property instead. width Deprecated since HTML4, Obsolete since HTML5 This attribute is used to define a recomm
ended cell width. Additional space can be added with the cellspacing and cellpadding properties and the width of the <col> element can also create extra width. But, if a column's width is too narrow to show a particular cell properly, it will be widened when displayed. Note: Do not use this attribute as it is obsolete in the latest standard: use the CSS width property instead. Examples See <table...
Global attributes - HTML: Hypertext Markup Language
atibility purposes. The multiple aria-* attributes, used for improving accessibility. ...
...n enumerated attribute defines whether the element may be checked for spelling errors. It may have the following values: true, which indicates that the element should be, if possible, checked for spelling errors; false, which indicates that the element should not be checked for spelling errors. style Contains CSS styling declarations to be applied to the element. Note that it is recomm
ended for styles to be defined in a separate file or files. This attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes. tabindex An integer attribute indicating if the element can take input focus (is focusable), if it should participate to sequential keyboard navigation, and if so, at what position. It can take several values: a...
Using the application cache - HTML: Hypertext Markup Language
ers only update an application 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 recomm
ended best practice. Important: 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. F...
...st must be comprised of zero or more of the following lines: Blank line You may use blank lines comprised of zero or more space and tab characters. Comment Comments consist of zero or more tabs or spaces followed by a single # character, followed by zero or more characters of comment text. Comments may only be used on their own lines (after the initial CACHE MANIFEST line), and cannot be app
ended to other lines. This means that you cannot specify fragment identifiers. Section header Section headers specify which section of the cache manifest is being manipulated. There are three possible section headers: Section header Description CACHE: Switches to the explicit section of the cache manifest (this is the default section). NETWORK: Switches to the o...
HTTP caching - HTTP
st to the origin server for validation before releasing a cached copy. Cache-Control: no-cache Private and public caches The "public" directive indicates that the response may be cached by any cache. 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 int
ended 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 important 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...
...ers should consider the user agent when deciding whether to serve the page from cache. If you are serving different content to mobile users, it can help you to avoid that a cache may mistakenly serve a desktop version of your site to your mobile users. In addition, it can help Google and other search engines to discover the mobile version of a page, and might also tell them that no Cloaking is int
ended. Vary: User-Agent Because the User-Agent header value is different ("varies") for mobile and desktop clients, caches will not be used to serve mobile content mistakenly to desktop users or vice versa. ...
Compression in HTTP - HTTP
or both loss-less or lossy compression, like webp, and usually lossy algorithm can be configured to compress more or less, which then of course leads to less or more quality. For better performance of a Web site, it is ideal to compress as much as possible, while keeping an acceptable level of quality. For images, an image generated by a tool could be not optimized enough for the Web; it is recomm
ended to use tools that will compress as much as possible with the required quality. There are numerous tools that are specialized for this. Lossy compression algorithms are usually more efficient than loss-less ones. As compression works better on a specific kind of files, it usually provides nothing to compress them a second time. In fact, this is often counter productive as the cost of the overhe...
... the browser the algorithm it has chosen. As content negotiation has been used to choose a representation based on its encoding, the server must send a Vary header containing at least Accept-Encoding alongside this header in the response; that way, caches will be able to cache the different representations of the resource. As compression brings significant performance improvements, it is recomm
ended to activate it for all files, but already compressed ones like images, audio files and videos. Apache supports compression and uses mod_deflate; for nginx there is ngx_http_gzip_module; for IIS, the <httpCompression> element. Hop-by-hop compression Hop-by-hop compression, though similar to end-to-end compression, differs by one fundamental element: the compression doesn't happen on the resourc...
Content-Language - HTTP
The Content-Language entity header is used to describe the language(s) int
ended for the audience, so that it allows a user to differentiate according to the users' own preferred language. For example, if "Content-Language: de-DE" is set, it says that the document is int
ended for German language speakers (however, it doesn't indicate the document is written in German. For example, it might be written in English as part of a language course for German speakers. If you want to indicate which language the document is written in, use the lang attribute instead). If no Content-Language is specified, the default is that the content is int
ended for all language audiences. Multiple language tags are also possible, as well as applying the Content-Language header to various media types and not only to ...
...in The global lang attribute is used on HTML elements to indicate the language of an entire HTML document or parts of it. <html lang="de"> Do not use this meta element like this for stating a document language: <!-- /!\ This is bad practice --> <meta http-equiv="content-language" content="de"> Indicating a target audience for a resource The Content-Language header is used to specify the int
ended audience of the page, and can indicate that this is more than one language. Content-Language: de, en Specifications Specification Title RFC 7231, section 3.1.3.2: Content-Language Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content ...
CSP: object-src - HTTP
ecifies valid sources for the <object>, <embed>, and <applet> elements. To set allowed types for <object>, <embed>, and <applet> elements, use the plugin-types directive. Elements controlled by object-src are perhaps coincidentally considered legacy HTML elements and aren't receiving new standardized features (such as the security attributes sandbox or allow for <iframe>). Therefore it is recomm
ended to restrict this fetch-directive (e.g. explicitly set object-src 'none' if possible). CSP version 1 Directive type Fetch directive default-src fallback Yes. If this directive 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 <sourc...
...o 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 attempts to load from any subdomain of example.com using the current protocol. <scheme-source> A schema such as 'http:' or 'https:'. The colon is required, single quotes shouldn't be used. You can also specify data schemas (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
Index - HTTP
ontent-Encoding entity header is used to compress the media-type. When present, its value indicates which encodings were applied to the entity-body. It lets the client know how to decode in order to obtain the media-type referenced by the Content-Type header. 24 Content-Language HTTP, Headers, Reference The Content-Language entity header is used to describe the language(s) int
ended for the audience, so that it allows a user to differentiate according to the users' own preferred language. 25 Content-Length HTTP, Headers, Reference The Content-Length entity header indicates the size of the entity-body, in bytes, sent to the recipient. 26 Content-Location HTTP, Reference, header The Content-Location header indicates an alternate locati...
...e specifies valid sources for stylesheets. 49 CSP: upgrade-insecure-requests CSP, Directive, HTTP, Reference, Security The HTTP Content-Security-Policy (CSP) upgrade-insecure-requests directive instructs user agents to treat all of a site's insecure URLs (those served over HTTP) as though they have been replaced with secure URLs (those served over HTTPS). This directive is int
ended for web sites with large numbers of insecure legacy URLs that need to be rewritten. 50 CSP: worker-src CSP, Directive, HTTP, Reference, Security The HTTP Content-Security-Policy (CSP) worker-src directive specifies valid sources for Worker, SharedWorker, or ServiceWorker scripts. 51 report-to CSP, HTTP, report-to The Report-To HTTP response header field i...
Firefox user agent string reference - HTTP
rsion 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"). from Firefox 10 on mobile, geckotrail is the same as firefoxversion. The recomm
ended way of sniffing for Gecko-based browsers (if you have to sniff for the browser engine instead of using feature detection) is by the presence of the "Gecko" and "rv:" strings, since some other browsers include a "like Gecko" token. For other products based on Gecko, the string can take one of two forms, where the tokens have the same meaning except those noted below: Mozilla/5.0 (platform; rv:ge...
...s, vendors, and extensions Prior to Firefox 4 and Gecko 2.0, it was possible for extensions to add user agent parts through the general.useragent.extra.identifier preferences, (see the obsolete User Agent Strings Reference). But that has not been possible since bug 581008. In the past, specific plug-ins, add-ons or extensions added user agent parts to notify sites they were installed. The recomm
ended way to do this, if it's absolutely necessary (remember that it slows down every request) is to set a custom HTTP header. See Also Firefox OS User Agent String (blog post w/bug 777710 reference) Final User Agent string for Firefox 4 (blog post) Recommendations on sniffing the UA string for cross-browser support window.navigator.userAgent Add Android version to Fennec UA String (bug 1169772...
HTTP Public Key Pinning (HPKP) - HTTP
d pin for a backup key which isn't yet used in production. This allows for changing the server's public key without breaking accessibility for clients that have already noted the pins. This is important for example when the former key gets compromised. Extracting the Base64 encoded public key information Note: While the example below shows how to set a pin on a server certificate, it is recomm
ended to place the pin on the intermediate certificate of the CA that issued the server certificate, to ease certificates renewals and rotations. First you need to extract the public key information from your certificate or key file and encode them using Base64. The following commands will help you extract the Base64 encoded information from a key file, a certificate signing request, or a certificat...
... header The concrete steps necessary to deliver the HPKP header depend on the web server you use. Note: These examples use a max-age of two months and include all subdomains. It is advised to verify that this setup will work for your server. 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 recomm
ended. Apache Adding a line similar to the following to your webserver's config will enable HPKP on your Apache. This requires mod_headers enabled. Header always set Public-Key-Pins "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includeSubDomains" Nginx Adding the following line and inserting the appropriate pin-sha256="..." values will enable HPKP on your ngin...
A re-introduction to JavaScript (JS tutorial) - JavaScript
m the block it is enclosed in. let a; let name = 'Simon'; The following is an example of scope with a variable declared with let: // myLetVariable is *not* visible out here for (let myLetVariable = 0; myLetVariable < 5; myLetVariable++) { // myLetVariable is only visible in here } // myLetVariable is *not* visible out here const allows you to declare variables whose values are never int
ended to change. The variable is available from the block it is declared in. const Pi = 3.14; // variable Pi is set Pi = 1; // will throw an error because you cannot change a constant variable. var is the most common declarative keyword. It does not have the restrictions that the other two keywords have. This is because it was traditionally the only way to declare a variable in JavaScript. A variab...
... for iterable objects such as arrays: for (const currentValue of a) { // Do something with currentValue } You could also iterate over an array using a for...in loop, however this does not iterate over the array elements, but the array indices. Furthermore, if someone added new properties to Array.prototype, they would also be iterated over by such a loop. Therefore this loop type is not recomm
ended for arrays. Another way of iterating over an array that was added with ECMAScript 5 is forEach(): ['dog', 'cat', 'hen'].forEach(function(currentValue, index, array) { // Do something with currentValue or array[index] }); If you want to append an item to an array simply do it like this: a.push(item); Arrays come with a number of methods. See also the full documentation for array methods. ...
Control flow and error handling - JavaScript
} finally { closeMyFile(); // Always close the resource } If the finally block returns a value, this value becomes the return value of the entire try...catch...finally production, regardless of any return statements in the try and catch blocks: function f() { try { console.log(0); throw 'bogus'; } catch(e) { console.log(1); return true; // this return statement is susp
ended // until finally block has completed console.log(2); // not reachable } finally { console.log(3); return false; // overwrites the previous "return" console.log(4); // not reachable } // "return false" is executed now console.log(5); // not reachable } console.log(f()); // 0, 1, 3, false Overwriting of return values by the finally block also applie...
... // while f() executes, the `finally` block returns false, // which overwrites the `throw` inside the above `catch` console.log('caught outer "bogus"'); } // OUTPUT /...
SyntaxError: function statement requires a name - JavaScript
ode is placed correctly in this context at all. Examples Statements vs expressions A function statement (or function declaration) requires a name, this won't work: function () { return 'Hello world'; } // SyntaxError: function statement requires a name You can use a function expression (assignment) instead: var greet = function() { return 'Hello world'; }; Or, you function is maybe int
ended to be an IIFE (Immediately Invoked Function Expression), which is a function that runs as soon as it is defined. You will need a few more braces in this case: (function () { })(); Labeled functions If you are using function labels, you will still need to provide a function name after the function keyword. This doesn't work: function Greeter() { german: function () { return "Moin"; } ...
...Labeled functions If you are using function labels, you will still need to provide a function name after the function keyword. This doesn't work: function Greeter() { german: function () { return "Moin"; } } // SyntaxError: function statement requires a name This would work, for example: function Greeter() { german: function g() { return "Moin"; } } Object methods If you int
ended to create a method of an object, you will need to create an object. The following syntax without a name after the function keyword is valid then. var greeter = { german: function () { return "Moin"; } }; Callback syntax Also, check your syntax when using callbacks. Brackets and commas can get difficult easily. promise.then( function() { console.log("success"); }); function()...
Functions - JavaScript
rguments need to be indicated with (). For only one argument, the parentheses are not required. (like foo => 1) statements or expression Multiple statements need to be enclosed in brackets. A single expression requires no brackets. The expression is also the implicit return value of the function. The Function constructor Note: Using the Function constructor to create functions is not recomm
ended since it needs the function body as a string which may prevent some JS engine optimizations and can also cause other problems. As all other objects, Function objects can be created using the new operator: new Function (arg1, arg2, ... argN, functionBody) arg1, arg2, ... argN Zero or more names to be used by the function as formal parameters. Each must be a proper JavaScript identifier. ...
... Invoking the Function constructor as a function (without using the new operator) has the same effect as invoking it as a constructor. The GeneratorFunction constructor Note: GeneratorFunction is not a global object, but could be obtained from generator function instance (see GeneratorFunction for more detail). Note: Using the GeneratorFunction constructor to create functions is not recomm
ended since it needs the function body as a string which may prevent some JS engine optimizations and can also cause other problems. As all other objects, GeneratorFunction objects can be created using the new operator: new GeneratorFunction (arg1, arg2, ... argN, functionBody) arg1, arg2, ... argN Zero or more names to be used by the function as formal argument names. Each must be a string tha...
Array.prototype.filter() - JavaScript
he callback's this value. Otherwise, the value undefined will be used as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. filter() does not mutate the array on which it is called. The range of elements processed by filter() is set before the first invocation of callback. Elements which are app
ended to the array (from callback) after the call to filter() begins will not be visited by callback. If existing 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 be...
...rant', 'destruction','elite', 'present'] const modifiedWords = words.filter( (word, index, arr) => { arr[index+1] +=' extra' return word.length < 6 }) console.log(modifiedWords) // Notice there are three words below length 6, but since they've been modified one is returned // ["spray"] // Appending new words words = ['spray', 'limit', 'exuberant', 'destruction','elite', 'present'] const app
endedWords = words.filter( (word, index, arr) => { arr.push('new') return word.length < 6 }) console.log(app
endedWords) // Only three fits the condition even though the `words` itself now has a lot more words with character length less than 6 // ["spray" ,"limit" ,"elite"] // Deleting words words = ['spray', 'limit', 'exuberant', 'destruction', 'elite', 'present'] const deleteWords = words.filter...
Function.prototype.bind() - JavaScript
l method [[Call]] on [[BoundTargetFunction]], with following arguments Call(boundThis, ...args). Where boundThis is [[BoundThis]], args is [[BoundArguments]], followed by the arguments passed by the function call. A bound function may also be constructed using the new operator. Doing so acts as though the target function had instead been constructed. The provided this value is ignored, while prep
ended arguments are provided to the emulated function. Polyfill Because older browsers are generally also slower browsers, it is far more critical than most people recognize to create performance polyfills to make the browsing experience in outdated browsers slightly less horrible. Thus, presented below are two options for Function.prototype.bind() polyfills: The first one is much smaller and mor...
...he bind() method. The methods shown below are not the best way to do things, and probably should not be used in any production environment. Bound functions are automatically suitable for use with the new operator to construct new instances created by the target function. When a bound function is used to construct a value, the provided this is ignored. ...
WebAssembly.CompileError() constructor - JavaScript
for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsCompileError() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Instance() constructor - JavaScript
efox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsInstance() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Instance.prototype.exports - JavaScript
for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsexportsChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.LinkError() constructor - JavaScript
fox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsLinkError() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Memory() constructor - JavaScript
irefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsMemory() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0shared flagChrome Full support ...
WebAssembly.Memory.prototype.buffer - JavaScript
e for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsbufferChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Memory.prototype.grow() - JavaScript
ome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsgrowChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Module() constructor - JavaScript
irefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsModule() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Module.customSections() - JavaScript
droidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jscustomSectionsChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Module.exports() - JavaScript
for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsexportsChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Module.imports() - JavaScript
for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsimportsChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.RuntimeError() constructor - JavaScript
for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsRuntimeError() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Table() constructor - JavaScript
Firefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsTable() constructorChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Table.prototype.get() - JavaScript
rome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsgetChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Table.prototype.grow() - JavaScript
ome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsgrowChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Table.prototype.length - JavaScript
e for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jslengthChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.Table.prototype.set() - JavaScript
rome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jssetChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.compile() - JavaScript
for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jscompileChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.instantiate() - JavaScript
AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsinstantiateChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
WebAssembly.validate() - JavaScript
for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.jsvalidateChrome Full support 57Edge Full support 16Firefox Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android ...
...ari Full support 11WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Notes Full support 52Notes Notes Disabled in the Firefox 52 Ext
ended Support Release (ESR).Opera Android Full support 43Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0Legend Full support ...
async function - JavaScript
ely constructed with each reentrant step through the function. The return value forms the final link in the chain. In the following example, we successively await two promises. Progress moves through function foo in three stages. The first line of the body of function foo is executed synchronously, with the await expression configured with the pending promise. Progress through foo is then susp
ended and control is yielded back to the function that called foo. Some time later, when the first promise has either been fulfilled or rejected, control moves back into foo. The result of the first promise fulfilment (if it was not rejected) is returned from the await expression. Here 1 is assigned to result1. Progress continues, and the second await expression is evaluated. Again, progress through f...
...ol is yielded back to the function that called foo. Some time later, when the first promise has either been fulfilled or rejected, control moves back into foo. The result of the first promise fulfilment (if it was not rejected) is returned from the await expression. Here 1 is assigned to result1. Progress continues, and the second await expression is evaluated. Again, progress through foo is susp
ended and control is yielded. Some time later, when the second promise has either been fulfilled or rejected, control re-enters foo. The result of the second promise resolution is returned from the second await expression. Here 2 is assigned to result2. Control moves to the return expression (if any). The default return value of undefined is returned as the resolution value of the current promise. a...
break - JavaScript
of a labeled statement. The break statement needs to be nested within the referenced label. The labeled statement can be any block statement; it does not have to be preceded by a loop statement. A break statement, with or without a following label, cannot be used within the body of a function that is itself nested within the current loop, switch, or label statement that the break statement is int
ended to break out of. Examples break in while loop The following function has a break statement that terminates the while loop when i is 3, and then returns the value 3 * x. function testBreak(x) { var i = 0; while (i < 6) { if (i == 3) { break; } i += 1; } return i * x; } break in labeled blocks The following code uses break statements with labeled blocks. A break st...
...reak statement must always be nested within any label it references. block_1: { console.log('1'); break block_2; // SyntaxError: label not found } block_2: { console.log('2'); } break within functions SyntaxErrors are also generated in the following code examples which use break statements within functions that are nested within a loop, or labeled block that the break statements are int
ended to break out of. function testBreak(x) { var i = 0; while (i < 6) { if (i == 3) { (function() { break; })(); } i += 1; } return i * x; } testBreak(1); // SyntaxError: Illegal break statement block_1: { console.log('1'); ( function() { break block_1; // SyntaxError: Undefined label 'block_1' })(); } Specifications Specification ...
with - JavaScript
See the "Ambiguity Contra" paragraph in the "Description" section below for details. The with statement extends the scope chain for a statement. Syntax with (expression) statement expression Adds the given expression to the scope chain used when evaluating the statement. The parentheses around the expression are required. statement Any statement. To execute multiple statements, use a block statement ({ ... }) to group those statements. Description JavaScript looks up an unqualified name by searching a scope chain associated with the execution context of the script or function containing that unqualified name. ...
...f the script or function containing that unqualified name. The 'with' statement adds the given object to the head of this scope chain during the evaluation of its statement body. If an unqualified name used in the body matches a property in the scope chain, then the name is bound to the property and the object containing the property. Otherwise a ReferenceError is thrown. Using with is not recomm
ended, and is forbidden in ECMAScript 5 strict mode. The recomm
ended alternative is to assign the object whose properties you want to access to a temporary variable. Performance pro & contra Pro: The with statement can help reduce file size by reducing the need to repeat a lengthy object reference without performance penalty. The scope chain change required by 'with' is not computationally expensive.
Authoring MathML - MathML
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 important 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 int
ended 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-integrated in HTML5 and in particular you can use usual Web features like CSS, DOM, Javascript or SVG. This is out of the scope of this document but anyone with basic kn...
...or 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 supported by browsers. It's recomm
ended 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 support Unfortunately, some browsers are not able to render MathML equations or only have a limited support. Hence you will need to use a MathML polyfill to pro...
Autoplay guide for media and Web Audio APIs - Web media technologies
n started up. Note: This approach doesn't differentiate between autoplay 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 recomm
ended that you use the autoplay attribute whenever possible, because support 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 foun...
...lay 'src' https://example.media"> </iframe> Example: Disabling autoplay Setting the autoplay feature policy to 'none' disables autoplay entirely for the document or <iframe> and all nested frames. The HTTP header is: Feature-Policy: autoplay 'none' Using the <iframe>'s allow attribute: <iframe src="mediaplayer.html" allow="autoplay 'none'"> </iframe> Best practices Tips and recomm
ended best practices to help you make the most of working with autoplay are offered here. Handling autoplay failure with media controls A common use case for autoplay is to automatically begin to play a video clip that goes along with an article, an advertisement, or a preview of the page's main functionality. To autoplay videos like these, you have two options: don't have an audio track, or have an ...
Digital audio concepts - Web media technologies
ound, and what parts of the audio frequencies we hear are most important 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 int
ended) understanding of psychoacoustics, it's possible to design a compression method that will minimize the compressed size of the audio while maximizing the percieved fidelity of the sound. An algorithm employing psychoacoustics may use any of the techniques mentioned here, and will almost certainly apply others as well. All of this means there is a fundamental question that has to be asked and answ...
...incoming signal. In addition, some codecs support special limited frequency bandwidth channels, such as the LFE channel, which inherently limit the frequency range available. In the case of LFE, the audio frequency bandwidth is limited to a frequency range suitable for use by a subwoofer or similar audio experience enhancement device. Some codecs offer special profiles which are specifically int
ended for particular usage scenarios, such as VoIP; these profiles may also include by default restrictions to the audio frequency bandwidth. Joint stereo Normally, stereo sound is represented by audio frames which contain one sample per channel. This results in audio frames which require 2?sampleSize bits each, where sampleSize is the number of bits each audio sample takes. Therefore, for a 16-bit s...
Media container formats (file types) - Web media technologies
nd desktop browser compatibility is implied if a browser is listed here. Support is also implied only for the container itself, not for any specific codecs. [2] Available only if available on the underlying operating system's media framework. [3] Requires Web Media Extensions to be installed. 3GP The 3GP or 3GPP media container is used to encapsulate audio and/or video that is specifically int
ended for transmission over cellular networks for consumption on mobile devices. The format was designed for use on 3G mobile phones, but can still be used on more modern phones and networks. However, the improved bandwidth availability and increased data caps on most networks has reduced the need for the 3GP format. However, this format is still used for slower networks and for lower-performance phone...
... MP3 Yes1 [1] Firefox only supports 3GP on OpenMAX-based devices, which currently means the Boot to Gecko (B2G) platform. [2] Firefox support for AAC relies upon the operating system's media infrastructure, so it is available as long as the OS supports it. ADTS Audio Data Transport Stream (ADTS) is a container format specified by MPEG-4 Part 3 for audio data, int
ended to be used for streamed audio, such as for Internet radio. It is, essentially, an almost bare stream of AAC audio data, comprised of ADTS frames with a minimal header. ADTS media MIME types Audio audio/aac[1] audio/mpeg[1] [1] The MIME type used for ADTS depends on what kind of audio frames are contained within. If ADTS frames are used, the audio/aac MIME t...
Image file type and format guide - Web media technologies
In this guide, we'll cover the image file types generally supported 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 recomm
ended as browser support 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 ...
... A single TIFF file can contain multiple images; this may be used to represent multi-page documents, for example (such as a multi-page scanned document, or a received fax). However, software reading TIFF files is only required to support the first image. TIFF supports a variety of color spaces, not just RGB. These include CMYK, YCbCr, and others, making TIFF a good choice for storing images int
ended for print, film, or television media. Long ago, some browsers supported TIFF images in web content; today, however, you need to use special libraries or browser add-ons to do so. As such, TIFF files are not useful within the context of web content, but it's common to provide downloadable TIFF files when distributing photos and other artwork int
ended for precision editing or printing. M...
The building blocks of responsive design - Progressive web apps (PWAs)
ning elements and make a mess of the layout. This is pretty horrible, but generally this kind of problem is easily fixed with some simple CSS: img, video { max-width: 100%; } This tells the replaced elements to remain constrained inside their container's widths, no matter what. However, if they aren't as wide as their containers, they will not stretch to fill them. In the snapshot example, we
ended up with slightly different code: x-card:nth-child(1) video, x-card:nth-child(2) img { width: 100%; ... } This is because in our case, we do in fact want the video and image to stretch to always fill their containers no matter what -- a subtle but important difference from max-width -- and therefore always be the same size. The video always resizes dynamically, but the screen captures take...
...th <source> alternatives selectable via media query results. Another proposal, srcset, was put forward by Apple and takes a slightly different approach, instead providing a new srcset attribute for <img> inside which image references are placed along with "hints" that the browser can use to work out which image is most suitable to display given its viewport size, resolution, etc. These are not int
ended to be mutually exclusive. This all sounds good. But those solutions are definitely not ready for production yet -- both are in a very early stage of standardization, and have no support across browsers. Currently we have to rely on various polyfills and other solutions, none of which are perfect for all situations, so you need to decide which one is right for your particular situation. Some avai...
SVG Event Attributes - SVG: Scalable Vector Graphics
They specifies some script to run when the event of the given type is dispatched to the element on which the attributes are specified. For every event type that the browser supports, SVG supports that as an event attribute, following the same requirements as for HTML event attributes. The global event attributes are available on all SVG elements. Other event attributes are available on a case by case basis for each elements. All event attribute are not animatable. ...
... onbegin, onend, onrepeat Document Event Attributes onabort, onerror, onresize, onscroll, onunload Document Element Event Attributes oncopy, oncut, onpaste Global Event Attributes oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncuechange, ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, on
ended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ont...
edgeMode - SVG: Scalable Vector Graphics
trix For <feConvolveMatrix>, edgeMode determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image. Value duplicate | wrap | none Default value duplicate Animatable Yes duplicate This value indicates that the input image is ext
ended along each of its borders as necessary by duplicating the color values at the given edge of the input image. wrap This value indicates that the input image is ext
ended by taking the color values from the opposite edge of the image. none This value indicates that the input image is ext
ended with pixel values of zero for R, G, B and A. feGaussianBlur For <feGaussianBlur>, edgeMode determines...
...aussianBlur For <feGaussianBlur>, edgeMode determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image. Value duplicate | wrap | none Default value none Animatable Yes duplicate This value indicates that the input image is ext
ended along each of its borders as necessary by duplicating the color values at the given edge of the input image. wrap This value indicates that the input image is ext
ended by taking the color values from the opposite edge of the image. none This value indicates that the input image is ext
ended with pixel values of zero for R, G, B and A. Specifications Specification Status Comme...
stroke-linecap - SVG: Scalable Vector Graphics
On a zero length subpath, the stroke consists of a full circle centered at the subpath's point. Example html,body,svg { height:100% } <svg viewBox="0 0 6 4" xmlns="http://www.w3.org/2000/svg"> <!-- Effect of the "round" value --> <path d="M1,1 h4" stroke="black" stroke-linecap="round" /> <!-- Effect of the "round" v...
...On a zero length subpath, the stroke consists of a square with its width equal to the stroke width, centered at the subpath's point. Example html,body,svg { height:100% } <svg viewBox="0 0 6 4" xmlns="http://www.w3.org/2000/svg"> <!-- Effect of the "square" value --> <path d=...
Paths - SVG: Scalable Vector Graphics
d 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 important when drawing SVGs. While creating complex paths using an XML editor or text editor is not recomm
ended, 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 instantiated (for example, creating a class, naming and locating it) by a specific letter. For instance, let's ...
...e curves move toward the right, the control points become spread out horizontally. As the curves move downward, they become further separated from the end points. The thing to note here is that the curve starts in the direction of the first control point, and then bends so that it arrives along the direction of the second control point. Several Bezier curves can be stringed together to create ext
ended, smooth shapes. Often, the control point on one side of a point will be a reflection of the control point used on the other side to keep the slope constant. In this case, a shortcut version of the cubic Bezier can be used, designated by the command S (or s). S x2 y2, x y (or) s dx2 dy2, dx dy S produces the same type of curve as earlier--but if it follows another S command or a C command, t...
Transport Layer Security - Web security
ists these names as well as information about compatibility and security levels. Configuring your server Correctly configuring your server is crucial. In general, you should try to limit cipher support to the newest ciphers possible which are compatible with the browsers you want to be able to connect to your site. ...
... The Mozilla OpSec guide to TLS configurations provides more information on recomm
ended configurations. To assist you in configuring your site, Mozilla provides a helpful TLS configuration generator that will generate configuration files for the following Web servers: Apache Nginx Lighttpd HAProxy Amazon Web Services CloudFormation Elastic Load Balancer Using the configurator is a recomm
ended way to create the configuration to meet your needs; then copy and paste it into the appropriate file on your server and restart the server to pick up the changes. The configuration file may need some adjustments to include custom settings, so be sure to review the generated configuration before using it; installing the configuration file without ensuring any references to domain names and the lik...
Using custom elements - Web Components
or() { // Always call super first in constructor super(); // Element functionality written in here ... } } This is just a simple example, but there is more you can do here. It is possible to define specific lifecycle callbacks inside the class, which run at specific points in the element's lifecycle. For example, connectedCallback is invoked each time the custom element is app
ended into a document-connected element, while attributeChangedCallback is invoked when one of the custom element's attributes is added, removed, or changed. You'll learn more about these in the Using the lifecycle callbacks section below. There are two types of custom elements: Autonomous custom elements are standalone -- they don't inherit from standard HTML elements. You use these on a page by ...
...ul> element as normal, but specify the name of the custom element inside the is attribute. Note: Again, you can see the full JavaScript source code here. Using the lifecycle callbacks You can define several different callbacks inside a custom element's class definition, which fire at different points in the element's lifecycle: connectedCallback: Invoked each time the custom element is app
ended into a document-connected element. This will happen each time the node is moved, and may happen before the element's contents have been fully parsed. Note: connectedCallback may be called once your element is no longer connected, use Node.isConnected to make sure. disconnectedCallback: Invoked each time the custom element is disconnected from the document's DOM. adoptedCallback: Invo...
Introduction to using XPath in JavaScript - XPath
G_TYPE, BOOLEAN_TYPE), but, if the returned result type is a node-set then it will only be an UNORDERED_NODE_ITERATOR_TYPE. To determine that type after evaluation, we use the resultType property of the XPathResult object. The constant values of this property are defined in the appendix. None Yet =====Any_Type Example===== <pre> </pre> Examples Within an HTML Document The following code is int
ended to be placed in any JavaScript fragment within or linked to the HTML document against which the XPath expression is to be evaluated. To extract all the <h2> heading elements in an HTML document using XPath, the xpathExpression is simply '//h2'. Where, // is the Recursive Descent Operator that matches elements with the nodeName h2 anywhere in the document tree. The full code for this is: link to ...
...g to a particular element using a form such as [namespace-uri()='http://www.w3.org/1999/xhtml' and name()='p' and @id='_myid']. This circumvents the problem of an XPath query not being able to detect the default namespace on a regularly labeled element. Getting specifically namespaced elements and attributes regardless of prefix If one wishes to provide flexibility in namespaces (as they are int
ended) by not necessarily requiring a particular prefix to be used when finding a namespaced element or attribute, one must use special techniques. While one can adapt the approach in the above section to test for namespaced elements regardless of the prefix chosen (using local-name() in combination with namespace-uri() instead of name()), a more challenging situation occurs, however, if one wishes to...
WebAssembly Concepts - WebAssembly
This article explains the concepts behind how WebAssembly works including its goals, the problems it solves, and how it runs inside the web browser's rendering engine. What is WebAssembly? WebAssembly is a new type of code that can be run in modern web browsers and provides new features and major gains in performance. It is not primarily int
ended to be written by hand, rather it is designed to be an effective compilation target for 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 i...
...iting, and a number of other domains that demand native performance (see WebAssembly use cases for more ideas). Additionally, the cost of downloading, parsing, and compiling very large JavaScript applications can be prohibitive. Mobile and other resource-constrained platforms can further amplify these performance bottlenecks. WebAssembly is a different language from JavaScript, but it is not int
ended as a replacement. Instead, it is designed to complement and work alongside JavaScript, allowing web developers to take advantage of both languages' strong points: JavaScript is a high-level language, flexible and expressive enough to write web applications. It has many advantages -- it is dynamically typed, requires no compile step, and has a huge ecosystem that provides powerful frameworks, l...
2015 MDN Fellowship Program - Archive of obsolete content
can provide any necessary supporting 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 information about our 2015 Fellows! ...
Classes and Inheritance - Archive of obsolete content
operator, and how to override methods in subclasses. The SDK uses a special constructor internally, known as Class, to create constructors that behave properly with respect to inheritance. The last section shows how to work with the Class constructor. It is possible to read this section on its own. However, to fully appreciate how Class works, and the problem it is supposed to solve, it is recomm
ended that you read the entire article. Constructors Before the ECMASCript 6 standard, a JavaScript class was defined by creating a constructor function for that class. To illustrate this, let's define a simple constructor for a class Shape: function Shape(x, y) { this.x = x; this.y = y; } We can now use this constructor to create instances of Shape: let shape = new Shape(2, 3); shape ins...
Private Properties - Archive of obsolete content
A namespace is simply an object on which one or more private properties are defined. The SDK uses namespaces internally to implement private properties. The final section explains how to work with the particular namespace implementation used by the SDK. It is possible to read this section on its own, but to fully appreciate how namespaces work, and the problem they set out to solve, it is recomm
ended to read the entire article. Using Prefixes A common technique to implement private properties is to prefix each private property name with an underscore. Consider the following example: function Point(x, y) { this._x = x; this._y = y; } The properties _x and _y are int
ended to be private, and should only be accessed by member functions. To make a private property readable/writable f...
Program ID - Archive of obsolete content
ed for a variety of purposes. For example: addons.mozilla.org uses it to distinguish between new add-ons and updates to existing add-ons, and the simple-storage module uses it to figure out which stored data belongs to which add-on. When you create an XPI with jpm xpi: if the package.json does not include an id field, then the ID written into the install.rdf is the value of the name field prep
ended with "@". if the package.json does include an id field, and it contains "@", then this is written into the install.rdf as the add-on ID. if the package.json does include an id field, and it does not contain "@", then jpm xpi raises an error and the XPI will not be built. ...
request - Archive of obsolete content
ue pairs representing headers to send with the request. content string,object The content to send to the server. If content is a string, it should be URL-encoded (use encodeURIComponent). If content is an object, it should be a collection of name/value pairs. Nested objects & arrays should encode safely. For GET and HEAD requests, the query string (content) will be app
ended to the URL. For POST and PUT requests, it will be sent as the body of the request. contentType string The type of content to send to the server. This explicitly sets the Content-Type header. The default value is application/x-www-form-urlencoded. overrideMimeType string Use this string to override the MIME type returned by the server in the response...
/loader - Archive of obsolete content
resolve The optional resolve option enables you to completely customize module resolution logic. resolve is assigned a function that takes: the ID of the module passed into require() the ID of the module that called require() On each require() call, the supplied function is then cal...
frame/hidden-frame - Archive of obsolete content
It is also useful in the construction of APIs that load web content for intermittent display, such as panel. Usage The module exports 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. ...
platform/xpcom - Archive of obsolete content
t contract ID, then: Components.classes["@me.org/myComponent"] will return the old factory, while: xpcom.factoryByContract("@me.org/myComponent") will return the new one. Parameters contract : string Contract ID of the factory or service to retrieve. Returns object : The factory or service identified by the contract ID. Unknown This is the base class for all XPCOM objects. It is not int
ended to be used directly but you can subclass it, either using standard JavaScript inheritance or using the SDK's heritage module, to create new implementations of XPCOM interfaces. For example, this subclass implements the nsIRequest interface: var { Class } = require('sdk/core/heritage'); var { Unknown } = require('sdk/platform/xpcom'); var Request = Class({ extends: Unknown, interfaces: [ 'ns...
ui/frame - Archive of obsolete content
ments: the message itself and a targetOrigin. The targetOrigin argument can be either the URI of the document hosted by the target, or the wildcard "*". If you use the URI, then the message will only be dispatched to the window whose document matches that URI. If you know the target URI, you should use it, as this is more secure: it prevents another window from intercepting messages that were int
ended for someone else. From frame to add-on To send a message from a frame script to the add-on, use window.parent.postMessage(). This takes two arguments, the message itself and a target origin. If the frame script initiates the conversation, you need to specify "*" as the origin: window.parent.postMessage("ping", "*"); If the frame script has received a message from the add-on already, it can u...
cfx to jpm - Archive of obsolete content
id anything with IDs when using cfx, then the value in your add-on's package.json will be something like "jid1-F3BoogbjQJE67A", and the corresponding ID in the install.rdf will be "jid1-F3BoogbjQJE67A@jetpack". ID handling with jpm When you create an XPI with jpm xpi: if the package.json does not include an id field, then the ID written into the install.rdf is the value of the name field prep
ended with "@". if the package.json does include an id field, and it contains "@", then this is written into the install.rdf as the add-on ID. if the package.json does include an id field, and it does not contain "@", then jpm xpi raises an error and the XPI will not be built. What you need to do All this means that: if your package.json contains an id field, and its value does not contain "@", th...
package.json - Archive of obsolete content
tation. lib String representing the top-level module directory provided in this add-on. Defaults to "lib". Note: This is deprecated along with cfx and is not available when using jpm. license The name of the license under which the add-on is distributed, with an optional URL in parentheses. Defaults to "MPL-2.0". Note: It is recomm
ended that you use an SPDX license ID. locales An object holding JSON objects referenced by a locale name that use the following keys: title, description and homepage. These JSON objects will be used to localizations for the add-on's meta data shown within the Add-ons Manager. See the documentation for how to localize the add-on's meta data. main A st...
HTML in XUL for rich tooltips - Archive of obsolete content
hild(injectHTML); } } window.addEventListener('load', htmltip.onLoad, false); In the XUL overlay, xmlns:html is used to enable HTML tags to be used inside the XUL. Our enhanced XUL tooltip is an element that is written ahead of time, and it contains an HTML div element whose type attribute lowers its privileges to being that content element, although it is an element of chrome. This is recomm
ended for security reasons, especially if remote HTML is to be inserted. A number of menuitems have a tooltip attribute pointing to the same tooltip. That tooltip is empty now, but we will use the mouseover event to dynamically populate the tooltip (which is about to be shown) with a different message for each menuitem. This is done by calling the onMouseTooltip function, which will take the tooltipHT...
HTML to DOM - Archive of obsolete content
ses["@mozilla.org/feed-unescapehtml;1"] .getService(Components.interfaces.nsIScriptableUnescapeHTML) .parseFragment(aHTMLString, false, null, body)); return body; } It works by creating a content-level (this is safer than chrome-level) <div> in the current page, then parsing the HTML fragment and attaching that fragment to the <div>. The <div> is returned, and it is never actually app
ended to the current page. The returned <body> object is of type Element Here is a sample that counts the number of paragraphs in a string: var DOMPars = HTMLParser('<p>foo</p><p>bar</p>'); alert(DOMPars.getElementsByTagName('p').length); If HTMLParser() returns the element name html (instead of body), you have all document object with its complete functions list, therefore you can retrieve info wi...
Running applications - Archive of obsolete content
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 support 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. ...
SVG General - Archive of obsolete content
nd some simple, general information on SVG markup. Hopefully, enough to get you creating some SVG images. You will also find some general purpose scripting helpers, that should make scripting SVG a little easier. SVG Template Here is a basic markup template to start building an SVG document: <svg xmlns="http://www.w3.org/2000/svg"> <!-- SVG elements go here --> </svg> Note: It is recomm
ended that you do not use DTD's with SVG documents. The tutorial and authoring guidelines have more information. Dynamic scripting helper This little helper script can be used to simplify creation of SVG elements in script. SVG requires you to use setAttributeNS to add attributes to a newly created SVG DOM element. No properties like HTML. SVG IMAGE also requires the use of XLINK for the href attr...
Communication between HTML and your extension - Archive of obsolete content
meant is that everytime the extension went looking for the element, it wasn't there yet. As a last ditch effort I tried setting a timeout using setTimeout when I got the event in the extension to wait a few milliseconds before looking for the desired element. This was non-optimal and the timeout wasn't very reliable for some reason. Sometimes I would get the timeout, sometimes I would'nt. What I
ended up with Some helpful information on the irc channel led me to believe that a custom event might help. I started to research custom events on Google but everything that I found was far too complicated for what I wanted to achieve. Eventually I put the creation of the custom event into the stateChanged function that was handling the receipt of the AJAX request. After the HTML component was update w...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
argantuan! - project. Many intelligent developers have been driven to the brink of insanity trying to build it for the first time. If you're not an experienced C++ developer, I wouldn't even bother. Stick to JavaScript. On Windows Platforms The first time I built Mozilla I used this guide. I can't even remember why anymore, but I got stuck in a number of places, and the whole affair
ended up taking far longer than I originally expected. Much furniture was smashed, much hair torn out by the roots. Here's a comprehensive looking guide that's gotten good reviews. Follow every step methodically and you'll probably be alright. Focus on the fact that once you get the build working, it'll probably work effortlessly from then on. Maybe. On Other Platforms On other platforms,...
Displaying web content in an extension without security issues - Archive of obsolete content
ent document, it cannot access the chrome documents above it. This means for example that JavaScript code top.location.href = "about:blank" will only unload the content document but won't have any effect on the chrome. Note: This has really nothing to do with the source of the document. If you open "chrome://foo/content/foo.xul" in the browser, it will open as a content document despite having ext
ended privileges. This also means that you won't be able to establish a security boundary between your extension and untrusted data if your extension opens as a tab in the browser -- so displaying your extension in a browser tab is a bad choice. Note: Dynamic changes of the "type" attribute have no effect, the frame type is read out when the frame element is inserted into the document and never again. ...
Extension Etiquette - Archive of obsolete content
ually worth their download weight. They allow for easy identification among other extensions in the Extensions manager. Coding practices Namespace conflicts There are many namespaces which extensions often must share with other consumers, be they other add-ons, web code, or the browser itself. These often include areas such as: Object prototypes, such as String.prototype, which are often ext
ended to add methods to native objects. Global variables, such as top-level declarations on scripts loaded into shared windows or web pages. Expando properties of shared objects, such as document objects, or DOM nodes. IDs and class names in HTML and XUL documents, when extensions add elements to web pages or browser windows. chrome: or resource: packages, which are often defined in chrome.manifest...
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
oz-image-region: rect(0px, 24px, 24px, 0px); } toolbar[iconsize="small"] #xulschoolhello-hello-world-button { list-style-image: url("chrome://xulschoolhello-os/skin/toolbar.png"); -moz-image-region: rect(0px, 16px, 16px, 0px); } Several CSS rules apply by default to all toolbar buttons. These add the button-like look you want. If for some reason you want to override these styles (not recomm
ended), you'll need the following rule: -moz-appearance: none; -moz-appearance can be used in many cases where you want to strip the native look out of an element. This will save you a lot of time trying to remove all the CSS rules that give the buttons a native look. You'll probably still need to override a couple other CSS rules to get a completely plain look. The Customize Toolbars Dialog Firef...
Adding windows and dialogs - Archive of obsolete content
ving to reinvent the wheel and write all their XUL and JS code all over again. Whenever you need a new dialog, you should ask yourself if it can be implemented using these common dialogs, and use them whenever it is possible. They have been thoroughly tested for OS integration, accessbility and localization, so you save yourself a lot of work and favor them. Using the Prompt Service is the recomm
ended way to create common dialogs in an extension. Read the article and its examples carefully, because there are many useful functions to use in the Prompt Service. There are some equivalent, simpler functions that are available in the window object, but those are meant for unprivileged HTML JavaScript code. Alert The alert is the simplest form of dialog. All it does is display a text message that ...
Connecting to Remote Content - Archive of obsolete content
er use nsIXSLTProcessor.transformToDocument() or nsIXSLTProcessor.transformToFragment() methods to transform the XML document. The nsIXSLTProcessor.transformToDocument() method returns a DOM Document with the results of the transformation, whereas, the nsIXSLTProcessor.transformToFragment() method returns a DOM DocumentFragment node. In this example code, the first child of the XUL document is app
ended to a XUL element after the transformation. request.onload = function(aEvent) { let responseXML = aEvent.target.responseXML; let xulNode; // transform the XML document to a XUL document xulDocument = xsltProcessor.transformToDocument(responseXML); // append the XUL node to a XUL element xulNode = document.adoptNode(xulDocument.firstChild); document.getElementById("foo").appendChil...
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
document.body.appendChild(parseHTML(document, xhr.responseText, true, xhr.channel.URI)); See Also Displaying web content in an extension without security issues How to create a DOM tree Node.textContent Node.appendChild() element.setAttribute() document.createElement() document.createTextNode() Original Document Information Author(s): Kris M...
Handling Preferences - Archive of obsolete content
r preferences: the file user.js in the user's profile directory holds additional preferences the user has set. This file is never written to by Firefox, but you may wish to set preferences manually in this file to override other settings. Lockfile settings: these preferences are stored in a file that usually has the name mozilla.cfg or netscape.cfg. The file may be located on a network. It is int
ended to be used by an administrator or ISP to set settings centrally. In addition, certain preferences may be locked such that users cannot change them. Locked preferences are disabled in the Preferences window. Firefox exposes its most common high-level preferences through the Preferences window and other parts of its UI. In reality there are thousands of other preferences Firefox handles that are ...
Introduction - Archive of obsolete content
n user experience and powerful 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 recomm
ended that you aim to support 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 lay...
XPCOM Objects - Archive of obsolete content
is an index to static objects and class definitions available through XPCOM. The string between the brackets is just an identifier, in this case corresponding to the Observer service. You'll usually know what string to use by reading examples and documentation. There is no comprehensive list of these (that we know of), and that's understandable since it would be a very long list, and it can be ext
ended by add-ons. If you want to see the list in your current Firefox installation, just run the following code in the Error Console: var str = ""; for (var i in Components.classes) { str += i + "\n" }; str A run on Firefox 3.6.2 with a few extensions installed yields 876 strings. That's quite a lot. Luckily, you'll only need to know a handful of those for extension development. The @mozilla.org/...
Security best practices in extensions - Archive of obsolete content
Your goal is to keep your users safe. Some items mentioned are strict guidelines, meaning that if you don't follow them then your add-on will not be approved on Mozilla add-ons. Other items are recommendations. The difference will be clearly flagged. This is written from the perspective of a Firefox extension, but most items apply to extensions for other Mozilla-based applications such as Thunderbird or SeaMonkey. Web content handling In general the best way to ensure that the browser is not compromised when you load content is to make sure it does not have those privileges. ...
Add-ons - Archive of obsolete content
do almost anything. There is a down side to this: poorly written extensions can have a severe impact on the browsing experience, including on the overall performance of Firefox itself. This article offers some best practices and suggestions that can not only improve the performance and speed of your extension, but also of Firefox itself. Security best practices in extensions This document is int
ended as a guide for developers to promote best practices in securing your extension. Your goal is to keep your users safe. Some items mentioned are strict guidelines, meaning that if you don't follow them then your add-on will not be approved on Mozilla add-ons. Other items are recommendations. The difference will be clearly flagged. Setting up an extension development environment This article provi...
XUL user interfaces - Archive of obsolete content
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 support XUL and JavaScript in pages, so it is not possible to show the demonstration here. It looks something like this: XUL demonstration Da...
dischargingtimechange - Archive of obsolete content
n None Properties The event callback doesn't receive any event objects, but properties can be 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 susp
ended. Returns positive infinity if the battery is charging, if the implementation is unable to report 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', functio...
Defining Cross-Browser Tooltips - Archive of obsolete content
al 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 to use the title attribute. The Solution The most obvious solution is to use the alt and title attributes for their int
ended purposes, instead of adhering to their historical misuses. A quick check of various user agents showed that title attribute contents were displayed as a "tooltip" in: Gecko-based browsers (Mozilla Firefox, Netscape 6+, etc.) Internet Explorer 5.5+/Win Internet Explorer 5.x/Mac Safari Opera 6.x+ Of these, only IE/Win treated alt text as a "tooltip"; the other browsers did not reproduce th...
Autodial for Windows NT - Archive of obsolete content
A Brief History of Autodial on Windows In the consumer versions of Windows, (Windows 95, Windows 98, Windows ME) autodial for all applications is controlled from the Control Panel, in the Internet Options applet, under the tab Connections. If you turn on the autodial feature, Windows will automatically dial whenever any application tries to access a network address that can't be reached. ...
Bookmark Keywords - Archive of obsolete content
ar to the keyword you plan to use. That way, if you ever forget the keyword you've assigned to a bookmark, you only have to glance at the bookmark's title to remember the keyword. However, the two should not be a case-sensitive match-- that is, if your keyword is av, then your title should be "Av" or "AV" or anything besides "av." (See Bugzilla entry 119201 for details.) Since this bookmark is int
ended to look up Bugzilla entries, we'll call it "BZ," as shown in Figure 3. Here's where the power starts to show up. Switch to the "Location:" field and go all the way to the end. Replace the bug's number (82839) with the string %s. You should end up with the result shown in Figure 4, without the red highlighting. The %s is a little flag that means "insert user input here." It doesn't have to go at...
Building TransforMiiX standalone - Archive of obsolete content
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 supported. It is recomm
ended 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(.exe) will be in exte...
Creating a Firefox sidebar extension - Archive of obsolete content
etailed information about structuring, packaging, and deploying extensions. Packages Extensions to Firefox are installed with packages ("Bundles"). An extension package usually contains a "content" provider, which contains the XUL code and application logic. Optionally locales and skins can be included. Most additions are provided with a default tree structure, although not required it is recomm
ended to use this structure. Here the package for the sidebar is created, the files included are listed below. Example 1. Package structure emptysidebar \- chrome |- content |- locale | \- en-US \- skin Create all folders, except for skin. It is not used for this tutorial. The locale holds the locale, only the en-US locale is created. It is listed in Example 2. The locale includes th...
Getting Started - Archive of obsolete content
a zip archive. However, if your application doesn't detect classic.jar as a standard zip archive, rename the file classic.zip and continue extraction. Classic.jar locations Linux: folder_with_seamonkey/chrome/classic.jar Windows: folder_with_seamonkey\chrome\classic.jar For Mac OS X: folder_with_seamonkey/chrome/classic.jar Copy classic.jar to another easily accessible folder -- Classic is recomm
ended -- extract the contents of that folder, being sure to maintain the directory structure. Directories Inside classic.jar is one directory, skin. 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 mana...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
s Linux: /usr/lib/MozillaFirefox/chrome/classic.jar or /usr/lib/firefox-*.*.*/chrome/classic.jar Windows: \Program Files\Mozilla Firefox\chrome\classic.jar For Mac OS X: Go to your applications folder Control click application icon(Firefox icon), choose Show Package Contents. Go to contents/MacOS/Chrome/classic.jar Copy classic.jar to another easily accessible folder -- Classic is recomm
ended -- extract the contents of that folder, being sure to maintain the directory structure. Directories Inside classic.jar is one directory, skin, as well as two files, preview.png and icon.png. skin skin simply contains another directory, classic which holds all the good stuff. skin\classic classic contains the following directories. skin\classic\browser browser contains all the toolbar ic...
Creating regular expressions for a microsummary generator - Archive of obsolete content
pages themselves. In order to restrict our regular expression to URLs that start with our example URL, we prepend a caret (^) to the regular expression: ^http://cgi\.ebay\.com/ws/eBayISAPI\.dll\?ViewItem&item=280018439106 When a caret is the first character of a regular expression, it signifies that the expression must be found at the beginning of the string being matched. Now that we've prep
ended a caret to our regular expression, it will only match URLs that look like the example URL right from the start. Matching Multiple URLs But this expression still only matches the URL for a single auction item page. It won't work with any other auction item. To make it match other items, we have to remove the unique parts of it that match the specific item, leaving behind only those parts which a...
Exception logging in JavaScript - Archive of obsolete content
In versions of Firefox prior to Firefox 3, all JavaScript exceptions were always logged into the Error Console if they remained unhandled 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 unint
ended consequence of logging "expected" errors at length into the console. JavaScript code is sometimes designed to throw exceptions to report a result condition back to the C++ caller. These might be perfectly normal circumstances, but the exceptions were dutifully logged nonetheless. Exception reporting in Firefox 3 Firefox 3 improves reporting of unhandled exceptions by establishing a set of rules that...
Repackaging Firefox - Archive of obsolete content
an extension (for that, try this section of the Mozilla Developer Center), here is a basic tutorial to get you started, and some tips specific for creating a DEX. If you already have an extension that you want to bundle with Firefox, and don't 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 recomm
ended 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 "Important 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. ...
Creating a Help Content Pack - Archive of obsolete content
<rdf:Description nc:panelid="toc" nc:datasources="chrome://help/locale/help-toc.rdf chrome://foo/locale/help/glossary.rdf"/> </rdf:li> Each of the different data source types (toc, index, glossary, and search) may be used multiple times (and in the case of platform-specific information, must be used multiple times). However, it is recomm
ended you use a space-separated list of URIs for nc:datasources instead of separate entries, as separate entries will require a slightly longer time to load. The Glossary File The glossary file has the simplest format of all the data sources you'll need because there's only one level of content. (The index, table of contents, and search data sources are more likely to be nested, complicating their fo...
JavaScript crypto - Archive of obsolete content
In the add case, the module will be placed in the NSS secmod.db database and will be loaded automatically on application restart. In the delete case, the module is removed from the NSS secmod.db. This function will issue a user prompt to confirm the operation before the add or delete actually occurs. Parameters moduleName Name of the module. libraryFullPath The filename of the library prep
ended with its full path. cryptoMechanismFlags A bit vector indicating all cryptographic mechanisms should be turned on by default (see below). cipherFlags A bit vector indicating all SSL or S/MIME cipher functions supported by the module (see below). Mechanism flag definitions In general, most tokens should not set any of the cipher flags. Setting these flags means you want your token to supply...
Content - Archive of obsolete content
Note: This page documents the Jetpack Prototype, which is no longer under active development. Read the experiment report for what we learned from it and the blog post announcing the first SDK release for what we're up to next! Page modifications Greasemonkey! Execute callbacks when certain pages are opened SiteBoost Allows a jetpack to empower a domain with ext
ended abilities beyond those native to web pages ...
Clipboard - Archive of obsolete content
rs 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 imported for use. jetpack.future.import("clipboard"); Methods set(contentstringflavorstring) stringWrites data from Jetpack to the clipboard. This is the recomm
ended 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 'plain' (text/unicode) and 'html' (which is HTML).string"text" Here's an example of how to use the method to set the clipb...
Clipboard Test - Archive of obsolete content
f 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 imported for use. jetpack.future.import("clipboard"); Methods set(contentstringflavorstring)Writes data from Jetpack to the clipboard. This is the recomm
ended 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 'plain' (text/unicode) and 'html' (which is HTML).string"text" Here's an example of how to use the method to set th...
Clipboard - Archive of obsolete content
f 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 imported for use. jetpack.future.import("clipboard"); Methods set(contentstringflavorstring)Writes data from Jetpack to the clipboard. This is the recomm
ended 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 'plain' (text/unicode) and 'html' (which is HTML).string"text" Here's an example of how to use the method to set the...
Clipboard - Archive of obsolete content
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 imported for use. jetpack.future.import("clipboard"); Methods set(contentstringflavorstring) stringWrites data from Jetpack to the clipboard. This is the recomm
ended 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 'plain' (text/unicode) and 'html' (which is HTML).string"text" Here's an example of how to use the method to set the clipbo...
jspage - Archive of obsolete content
itch($type(f)){case"object":d=Hash.toQueryString(f,e);break;case"array":var c={};f.each(function(h,g){c[g]=h; });d=Hash.toQueryString(c,e);break;default:d=e+"="+encodeURIComponent(f);}if(f!=undefined){b.push(d);}});return b.join("&");}});Hash.alias({keyOf:"indexOf",hasValue:"contains"}); var Event=new Native({name:"Event",initialize:function(a,f){f=f||window;var k=f.document;a=a||f.event;if(a.$ext
ended){return a;}this.$ext
ended=true;var j=a.type; var g=a.target||a.srcElement;while(g&&g.nodeType==3){g=g.parentNode;}if(j.test(/key/)){var b=a.which||a.keyCode;var m=Event.Keys.keyOf(b);if(j=="keydown"){var d=b-111; if(d>0&&d<13){m="f"+d;}}m=m||String.fromCharCode(b).toLowerCase();}else{if(j.match(/(click|mouse|menu)/i)){k=(!k.compatMode||k.compatMode=="CSS1Compat")?k.html:k.body; var i={x:a.pageX||...
statusBar - Archive of obsolete content
ry. Namespace: jetpack.statusBar Methods copyBackground embedIframe append The append Methods adds a new Item to the statusbar. Many of the options are optional. Syntax jetpack.statusBar.append(options); Possible Options are: url width (string/length) The width of the Panel-Item html (string) The html Code which will be used inside the Item onLoad (event) This Event fires when the Item was app
ended. Its acutally not implemented in the current Version. onReady (event) Occurs when the Item was loaded onUnload (event) Triggers when the Item was removed. Example jetpack.statusBar.append({ html: 'Hello <i>World</i>!', onReady: function(widget){ $(widget).click(function(){ jetpack.tabs.open("http://www.jogkey.de"); }); } }); ...
Microsummary XML grammar reference - Archive of obsolete content
ficant; it is not considered part of the regular expression, and it does not affect evaluation of the expressions. The following example identifies a generator as being able to summarize all pages on the www.example.com web site except pages named about.html: <pages> <include> ^http://www\.example\.com/ </include> <exclude>/about\.html</exclude> </pages> Note: Regular expressions int
ended to match the beginnings of page URLs should start with the caret (^) to ensure they do not inadvertently match URLs which merely contain the URLs they intend to match. For example, the regular expression http://www\.example\.com/ matches both the URL http://www.example.com/ and the URL http://www.evil.com/http://www.example.com/, but the regular expression ^http://www\.example\.com/ matches only ...
Modularization techniques - Archive of obsolete content
676} To initialize an ID struct you declare them like this: ID = {0x221ffe10, 0xae3c, 0x11d1, {0xb6, 0x6c, 0x00, 0x80, 0x5f, 0x8a, 0x26, 0x76}}; Why the b66c couplet gets broken up and grouped with the last set of bytes is probably a footnote somewhere. On Windows you can use the programs uuidgen and guidgen, which ship with Visual C++, to generate IDs. A Simple Example It is recomm
ended that you use XPIDL to define your interfaces. This sample code should be updated to reflect this, but it gives you a good basic understanding of COM from the C++ perspective. File nsISample.h nsISample.h defines an extremely simple interface and its interface ID (IID). The important things to notice are that the interface inherits from nsISupports, and all member functions are pure virtual met...
Plug-n-Hack Phase2 - Archive of obsolete content
This will allow the tools to obtain information directly from the browser, and even use the browser as an extension of the tool. If you are interested in working on this aspect then please get in touch. ...
Space Manager Detailed Design - Archive of obsolete content
eal with the coordinate space of the Space Manager, the parts that deal with the regions managed by the Space Manager, and the parts that manage float impact intervals. The class nsSpaceManager is declared in the file nsSpaceManger.h. The class is only used in the layout module and cannot be exported outside of that module (nor does it need to be). It is not a general purpose class, and is not int
ended 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. The space manager * defines a coordinate space with an origin at (0, 0) that grows down * and to the right. */ class nsSpaceManager { public: nsSpaceManager(nsIPresShell* aPresShell, nsIFrame* aFrame); ~nsSpaceManager(); void* operator new(...
Supporting per-window private browsing - Archive of obsolete content
To do this, observe the last-pb-context-exiting notification and set the data field of the nsISupportsPRBool subject to true. var os = Components.classes["@mozilla.org/observer-service;1"] .getService(Components.interfaces.nsIObserverService); os.addObserver(function (aSubject, aTopic, aData) { aSubject.QueryInterface(Components.interfaces.nsISupportsPRBool); // if an...
Table Layout Regression Tests - Archive of obsolete content
e. While the information on the layout debugger is still useful, the testing information is much less relevant now than it has been, as the "rtest" testing framework described here has been superseded by the reftest framework. It is unclear whether or how well rtest continues to work and whether it is still used or not. Subject Overview Changes in layout, parser and content code can have unint
ended side effects, also known as regressions. It is good style to check for these unwanted regressions and fixing them before checkin rather than causing Bugzilla avalanches. Prerequisites In order to run these tests, you will need to have: Make sure that your build is a debug build (in short you need ac_add_options --enable-debug in your .mozconfig file). to build the layoutdebugger itself, bui...
Tamarin Roadmap - Archive of obsolete content
The roadmap is a living document representing current best thinking and is subject to change. Comments or questions are welcome and encouraged via the tamarin-devel mailing list. ...
Tamarin mercurial commit hook - Archive of obsolete content
The hook is located in the tamarin-redux repository in the file utils/hooks/tamarin-commit-hook.py This is a simple mercurial hook that checks the following filetypes ('.cpp', '.h', '.as', '.abs', '.py') for the following: Tabs anywhere in the line Trailing whitespace Windows line endings (\r\n) "MARK_SECURITY_CHANGE" - Looks for this text and warns user as security changes should NOT be checked into the public tamarin-redux repository. ...
Venkman Introduction - Archive of obsolete content
nt will be set. In this way, fbreak allows one to set breakpoints in files that are not yet loaded, as well as set breakpoints that are triggered when a file is loaded. The Interactive Session View Another basic view in Venkman is the actual Interactive Session View, which allows you to interact with the debugger from a command line. Commands are entered in the text box, and responses are app
ended to the end of the output. Type /commands in the input area (the text box) to list all of the commands available. The /help command can be used to get additional information about a specific command. You can type /help next, for example, to see how to use the next command. The input area supports command history and tab-completion for command names. Command history remembers the last 20 commands ...
Using Breakpoints in Venkman - Archive of obsolete content
When you set a breakpoint in a debugging application such as Venkman, you can take advantage of the suspension to examine variables, objects, and other featues of the execution. This article describes breakpoints in JavaScript and how to use Venkman to set and examine breakpoints. ...
Anonymous Content - Archive of obsolete content
for a given piece of content is the first encountered with a selector whose node set matches the element when doing a depth-first walk of the content template. Note that children elements are never cloned when content is generated from a template. Handling DOM changes Insertion points continuing to be used as elements are inserted or removed from the DOM. Whenever an element is inserted or app
ended, all insertion points are checked following all the same rules that applied when first placing explicit children during anonymous content generation. If no insertion point is found for the newly-inserted child, then the binding is no longer a fit for the bound element, and all anonymous content will be destroyed. Whenever an element is removed, it simply disappears from its insertion point along...
Example Sticky Notes - Archive of obsolete content
="25px" cy="12px" r="12" fill="#FF0000" transform="translate(0,0)"/> <svg:circle cx="25px" cy="12px" r="12" fill="#00FF00" transform="translate(7,12)"/> <svg:circle cx="25px" cy="12px" r="12" fill="#0000FF" transform="translate(-7,12)"/> </svg:g> </svg:svg> <children/> </content> <implementation> <!-- Here and futher CDATA wrappers around JavaScript code are not mandatory but recomm
ended. This way you protect yourselve from < and > signs breaking your XML layout. It also speeds up the parsing as the engine doesn't go through CDATA sections but simply skip on them. --> <constructor><![CDATA[ /** * The code below will be called one time only after * the binding is successfully prepared and bound. * "this" in this context refers to the bound element. */ // your code goes...
browser.type - Archive of obsolete content
eved more conveniently using window.content. content-targetable One browser among many for content. The content that is loaded inside the browser is not allowed to access the chrome above it. This is the preferred value for any browser element in an application, which will use multiple browsers of equal privileges, and is unselected at the moment. chrome (default behaviour): A browser, int
ended to be used for loading privileged content using a chrome:// URI. Don't use for content from web, as this may cause serious security problems! See also More information in the XUL tutorial and iframe ...
disablefastfind - Archive of obsolete content
<< XUL Reference homedisablefastfindType: booleanPut disablefastfind="true" on the root element of a XUL document, which is int
ended 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 supported by the content (such as in the Add-ons manager tab). ...
panel.flip - Archive of obsolete content
le to flip horizontally makes sense. This attribute, set to both, permits that behavior. You will not normally have to use this attribute, since it's automatically applied to arrow panels. An arrow panel can also specify a value of slide, which causes the arrow to "slide" instead of flipping when the panel doesn't have room. A sliding panel will have the start (or end) position ext
ended such that the panel can be the requested size, meaning the arrow will no longer be at the start (or end) of the panel - i.e., the arrow will appear to have been slid along the panel to ensure the arrow is still pointing at the anchor. In this image, the panel has flip="slide" and has a width which is greater than the distance from the anchor to the right of the screen (or window), ...
textbox.type - Archive of obsolete content
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, min, max, increment, wraparound, hidespinbuttons, and textbox.value. password A textbox that hides what is typed, used for entering passwords. search A textbox int
ended for searching. The command event will fire as the user modifies the value. A listener for the command event should update search results. If the searchbutton attribute is set to true, the command event is only fired if the user presses the search button or presses the Enter key. You may specify grey text to appear when the search box is empty using the emptytext attribute, and a timeout may be se...
wait-cursor - Archive of obsolete content
<< XUL Reference home wait-cursor Type: boolean Set this attribute to true to have the cursor switch to a waiting cursor while the mouse is hovering over the element. Usually, you would only use this on the window element or other top-level elements. In order to revert to the normal cursor state call the method removeAttribute("wait-cursor") when the process effectively has
ended otherwise the wait cursor might never disappear. See also https://developer.mozilla.org/docs/Talk:XUL/Attribute/Wait-cursor This seems to work instead of trying to set a wait-cursor attribute: window.setCursor('wait') and window.setCursor('auto') ...
Writing to Files - Archive of obsolete content
When writing text files, characters are writing using a chosen character set, encoded automatically. The default character set is 'UTF-8' but this can be changed using an additional, yet optional, argument to the newOutputStream method. See below for more details about this. Creating and Appending to Files A number of flags control whether a new file is created when writing or whether data is app
ended to an existing file. These flags should be included in addition to the 'text' or 'binary' flags when using the newOutputStream method. The default when writing is to create a new file when the file to write to does not exist, and replace the existing file if it does. However, there are three flags that can be used to control this behaviour. append if used, always write data to the end of the...
How to implement a custom XUL query processor component - Archive of obsolete content
else { return 0; } } }; var components = [TemplateQueryProcessor]; function NSGetModule(compMgr, fileSpec) { return XPCOMUtils.generateModule(components); } Our sample query processor is very simple. A few explanatory notes: We are using a the getBindingFor rather than getBindingObjectFor to simplify the code. The variable passed into getBindingFor still has the "?" prep
ended 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 support f...
loadGroup - Archive of obsolete content
The argument should be an array of objects, one for each document to load. The objects may be defined in script and contain a URI property for the URL of the page to load. ...
showPopup - Archive of obsolete content
-1. To have a popup appear relative to another element yet still offset by some number of pixels, determine the actual screen position of the element using the boxObject.screenX and boxObject.screenY properties of the element, and use those as the x and y arguments offset by the desired values. The popupType should be one of the strings popup, context, or tooltip. Each type of popup is int
ended to be displayed only temporarily; they are not expected to be displayed permanently. ...
maxWidth - Archive of obsolete content
<< XUL Reference maxWidth Type: integer Gets and sets the value of the maxwidth attribute. Note: Prior to Gecko 6.0, you could use this on <input> elements; this was never int
ended, was a violation of the HTML specification, and has been fixed. Use the size to set the maximum width of input fields. ...
tree-splitter - Archive of obsolete content
<< XUL Reference home tree-splitter This splitter is int
ended to be used in tree columns (in-between treecol elements). The splitter will be drawn with no width so that it isn't visible, however, the columns may still be resized. ...
Building Menus With Templates - Archive of obsolete content
f children the template-driven button has. If you press this button before opening the menu, there will be one child (the template itself). However, after the menu has been opened, there will be two children, one is the template and the other is the generated menupopup. Note that the generated content does not get removed again when the menu is closed again; this extra feature of menus is only int
ended to be a performance enhancement to speed up the time it takes to display a window by avoiding extra generation that can be put off until later. You might be wondering why we couldn't just put the datasources attribute on the menupopup instead and not have a menupopup inside the action body. You can actually do this, however, you no longer receive the performance benefit as the entire content will...
Building Trees - Archive of obsolete content
<treecell label="rdf:http://purl.org/dc/elements/1.1/title"/> <treecell label="rdf:http://purl.org/dc/elements/1.1/date"/> </treerow> </treeitem> </treechildren> </template> </tree> Note: The tree columns (treecols) are declared outside the template as static content, since they only need to be declared once. This template uses the simple rule syntax. The ext
ended syntax could also be used. When using the tree builder, the uri attribute must be declared on the treeitem element. Here, the simple RDF query syntax is used, so the member variable is rdf:*. The remaining tags have a similar syntax to a tree, but have only a single row. This row is used as the template data by the tree builder. Instead of generating content, the builder uses the cell attributes ...
Containment Properties - Archive of obsolete content
ribute, and two generated because the starting resource is a container with two children. Effectively, the containment attribute allows you to specify additional predicates that provide children. You can specify multiple predicates in the containment attribute by separating them with spaces. Each will be applied in sequence. The containment attribute also applies to member tests when using the ext
ended template syntax. That is, in addition to iterating over the children, it will iterate over the predicates listed in the containment attribute. For example, the following is equivalent to the previous example, except that the full query syntax is used. <vbox datasources="template-guide-ex3.rdf" ref="http://www.xulplanet.com/rdf/A" containment="http://www.xulplanet.com/rdf/related...
Filtering - Archive of obsolete content
d a filter, otherwise we remove it. The code is fairly straightforward. A new <triple> element is created and the object attribute is set to the value to filter by. For example, the resulting triple for the Netherlands might be: <triple subject="?photo" predicate="http://www.xulplanet.com/rdf/country" object="http://www.daml.org/2001/09/countries/iso#NL"/> This triple is then app
ended to the query. The triple is given an id so that it can be found later if a different filter is applied. Naturally, we only want to apply one filter at a time, so we can just reuse the same triple for each filter. When removing the filter, we only need to remove the triple from the query. This example only adds one triple, but you could add others, or add <member> elements. Whether a triple or mem...
Sorting Results - Archive of obsolete content
container, however, the template builder orders the results in the order the items appear in the Seq. For instance, the photos are listed in the same order in this example as they appear in the Seq in the datasource. This method of sorting a Seq works best for the simple query syntax since it is obvious how the starting ref relates to the end member results (they are just the children), or for ext
ended syntax queries that follow a similar pattern. For more complex queries, this natural sorting will not work, because the sort service assumes that the starting ref resource is the container and the end results are the children. In this case, the natural order of the results will just be the order that the template builder generates the results. For ascending or descending sorts, this doesn't matte...
Special Condition Tests - Archive of obsolete content
>, so the first rule will match and a captioned <groupbox> will be created. On the next pass, the parent container will be the element with the uri attribute from the previous pass, in this case, the <groupbox> The first rule will not match in this case, but the second rule will match and a label will be created. The result can be seen if you try the example. ...
textbox (Toolkit autocomplete) - Archive of obsolete content
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, min, max, increment, wraparound, hidespinbuttons, and textbox.value. password A textbox that hides what is typed, used for entering passwords. search A textbox int
ended for searching. The command event will fire as the user modifies the value. A listener for the command event should update search results. If the searchbutton attribute is set to true, the command event is only fired if the user presses the search button or presses the Enter key. You may specify grey text to appear when the search box is empty using the emptytext attribute, and a timeout may be se...
Textbox (XPFE autocomplete) - Archive of obsolete content
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, min, max, increment, wraparound, hidespinbuttons, and textbox.value. password A textbox that hides what is typed, used for entering passwords. search A textbox int
ended for searching. The command event will fire as the user modifies the value. A listener for the command event should update search results. If the searchbutton attribute is set to true, the command event is only fired if the user presses the search button or presses the Enter key. You may specify grey text to appear when the search box is empty using the emptytext attribute, and a timeout may be se...
The Joy of XUL - Archive of obsolete content
enefits of XUL will be explored followed by an examination of supporting 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 int
ended 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. In fact, many developers invest a significant amount of effort to achieve these results in their DHTML web applications but at the cost of complexity and performance and without any supporting standards. ...
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
sed');"/> <handler event="mouseup" button="1" action="alert('Middle button pressed')"/> <handler event="click" button="2" action="alert('Right button pressed');"/> </handlers> Handling Key Events For key events, you can use a number of attributes similar to those for the key element to match a specific key and match only when certain modifer keys are pressed. The previous example could be ext
ended so that the checked property of the check box is changed when the space bar is pressed. <handlers> <handler event="keypress" key=" " action="this.checked=!checked"/> </handlers> You can also use the keycode attribute to check for non-printable keys. The section on keyboard shortcuts provides more information. The modifier keys can be checked by adding a modifiers attribute. This should be set ...
Adding Labels and Images - Archive of obsolete content
<description> This longer section of text is displayed. </description> You can set 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 int
ended for labels of controls, such as text fields. The control attribute is only supported for labels. The description element is int
ended 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 ...
Element Positioning - Archive of obsolete content
ou may need to have more control over the 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 recomm
ended 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...
Manifest Files - Archive of obsolete content
n where the files may be installed to. An extension is packaged up into an XPI file. XPI is short for XPInstall and is used by Mozilla to install components. Like a JAR file, an XPI file is just a ZIP file with a different extension, so you can create and view XPI files with a ZIP utility. Firefox's extension manager handles installing extensions packaged into XPI files automatically. It is recomm
ended to upload extensions to the Mozilla Add-ons site, where users can locate them for installation. While they may be installed from any site, other sites are not configured to allow installations by default. It is also possible to use a install script written in JavaScript to install files. This allows you to copy files to any location and perform other file management tasks. However, applications i...
Modifying a XUL Interface - Archive of obsolete content
"400"> <button label="Copy" oncommand="this.parentNode.appendChild(this.nextSibling.cloneNode(true));"/> <vbox> <button label="First"/> <button label="Second"/> </vbox> </hbox> When the Copy button is pressed.. we retrieve the nextSibling of the button, which will be the vbox element. a copy of this element is made using the cloneNode() function and the copy is app
ended using appendChild(). Note that some elements, such as listbox and menulist provide some additional specialized modification functions which you should use instead when you can. These are described in the next section. Manipulating Basic Elements The main XUL elements such as buttons, checkboxes and radio buttons may be manipulated using a number of script properties. The properties available are...
More Button Features - Archive of obsolete content
e View <button type="menu" label="Device"> <menupopup> <menuitem label="Printer"/> <menuitem label="Mouse"/> <menuitem label="Keyboard"/> </menupopup> </button> In this example, the user may click the button to pop up a menu containing three items. Note that selecting one of these menu items does not change the label on the button, unlike a menulist. This type of button is int
ended to be used like a menu, with scripts attached to each item to perform a task. We'll see more on menus later. You can also set the type attribute to the value menu-button. This also creates a button with a menu, but the appearance will be different. The image to the right shows the difference. The left one is a 'menu' and the second one is a 'menu-button'. It has an arrow indicating the presence o...
Tree View Details - Archive of obsolete content
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 support a single parent level with an inner child level, but it could be ext
ended to support 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> <treechildren/> </tree> </window> We use a simple tree here with no data ...
Using Spacers - Archive of obsolete content
uttons are placed inside a div element. Flexibility is meaningless here as the buttons are not directly in a box. The effect would be the same if the flex attributes were left out. Example 6 because the flex values are the same on both buttons, they will flex equally. This would work just as well with flex values of one instead of 145. There's no difference in this case. It is recomm
ended that you use lower numbers for readability. Note that other factors, such as the button labels and button minimum sizes, will affect the actual sizes of the buttons. For instance, a button won't shrink less than the space needed to fit its label. Specifying a flex value of 0 has the same effect as leaving the flex attribute out entirely. It means that the element is not flexible at all. You may ...
XBL Inheritance - Archive of obsolete content
this section, we'll look at how to extend existing XBL definitions. Inheritance Sometimes you may want to create an XBL widget that is similar to an existing one. For example, let's say you want to create an XBL button with a popup. One way to create this is to duplicate the existing XBL code for buttons. However, it would be better to simply extend the existing button code. Any binding can be ext
ended with another. The child binding can add properties, methods and event handlers. The child binding will have all the features it defines in addition to the features from the binding it inherits from (and any that binding inherits from and so on up the tree). To extend an existing binding, add an extends attribute on to the binding tag. For example, the following binding creates a textbox which add...
Writing Skinnable XUL and CSS - Archive of obsolete content
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 import another skin file are calledderived skin files. CSS files that don't import another skin file are calledbase skin files. There is one notable exception to this rule. Skin files that don't import any other skin files, but that are only int
ended to be used in the context of another component's skin are also considered derived skin files, since they are implicitly importing information from the other component's skin. These sorts of files are typically used with reusable overlayable widgets (e.g., the sidebar). Your CSS file should never import another skin file if your file is loaded by a XUL overlay. CSS files that are used by XUL over...
XUL FAQ - Archive of obsolete content
Mozilla's markup language for describing application's user interface. Other FAQs you may be interested in: Extension FAQ, ... If your question is not answered here, you can try looking for the answer in the XUL documentation or ask in the XUL newsgroup. Are there decent visual editors for laying out XUL applications? There are no production-quality visual editors available for XUL. The recomm
ended way is to edit XUL by hand, possibly with the help of a good text or XML editor. Ted Mielczarek's Live XUL Editor (also part of Extension Developer's Extension) often proves useful. A list of projects (dead and active) aiming to create a XUL IDE/editor is at wikimo:XUL:IDE. Troubleshooting prefwindow-based options windows This ought to be on a separate page, Preferences System Troubleshooting.
XUL element attributes - Archive of obsolete content
appear only once. wait-cursor Type: boolean Set this attribute to true to have the cursor switch to a waiting cursor while the mouse is hovering over the element. Usually, you would only use this on the window element or other top-level elements. In order to revert to the normal cursor state call the method removeAttribute("wait-cursor") when the process effectively has
ended otherwise the wait cursor might never disappear. width Type: string (representing an integer) The preferred width of the element. The value should not include a unit as all values are in pixels. The actual displayed width may be different if the element or its contents have a minimum or maximum width, or the size is adjusted by the flexibility or alignment of its parent. The CSS width p...
XUL Template Primer - Bindings - Archive of obsolete content
The <bindings> element is used to create additional,optional variable bindings, in addition to those that are specified in a rule's <conditions>. This is different from the variables specified in the rule's conditions, where a value must be found for each variable for the rule to match. ...
The Implementation of the Application Object Model - Archive of obsolete content
ocuments 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% support for CSS2, for example, but we've ext
ended 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 inside Web pages. By enforcing this distin...
XUL Coding Style Guidelines - Archive of obsolete content
arkups 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 recomm
ended 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 any parsing error for now, however, it might cause future maintenance headache: convert HTML files to XUL files. use the XML declaration. use Namespace. case sensitivity. use chrome URLs. JavaScript code shall be moved o...
browser - Archive of obsolete content
eved more conveniently using window.content. content-targetable One browser among many for content. The content that is loaded inside the browser is not allowed to access the chrome above it. This is the preferred value for any browser element in an application, which will use multiple browsers of equal privileges, and is unselected at the moment. chrome (default behaviour): A browser, int
ended to be used for loading privileged content using a chrome:// URI. Don't use for content from web, as this may cause serious security problems! Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. canGoBack Type: boolean This read-only property is true if there is a page to go back to...
iframe - Archive of obsolete content
eved more conveniently using window.content. content-targetable One browser among many for content. The content that is loaded inside the browser is not allowed to access the chrome above it. This is the preferred value for any browser element in an application, which will use multiple browsers of equal privileges, and is unselected at the moment. chrome (default behaviour): A browser, int
ended to be used for loading privileged content using a chrome:// URI. Don't use for content from web, as this may cause serious security problems! transparentType: one of the values belowSet the background of an iframe as transparent.transparentThis results in the iframe's background being transparent. This can be used to workaround things like bug 540911 Inherited from XUL element align,...
menupopup - Archive of obsolete content
-1. To have a popup appear relative to another element yet still offset by some number of pixels, determine the actual screen position of the element using the boxObject.screenX and boxObject.screenY properties of the element, and use those as the x and y arguments offset by the desired values. The popupType should be one of the strings popup, context, or tooltip. Each type of popup is int
ended to be displayed only temporarily; they are not expected to be displayed permanently. sizeTo( width, height ) Return type: no return value Changes the current size of the popup to the new width and height. Related Elements menu, menubar, menuitem, menulist, menuseparator Interfaces nsIAccessibleProvider, nsIDOMXULPopupElement ...
panel - Archive of obsolete content
le to flip horizontally makes sense. This attribute, set to both, permits that behavior. You will not normally have to use this attribute, since it's automatically applied to arrow panels. An arrow panel can also specify a value of slide, which causes the arrow to "slide" instead of flipping when the panel doesn't have room. A sliding panel will have the start (or end) position ext
ended such that the panel can be the requested size, meaning the arrow will no longer be at the start (or end) of the panel - i.e., the arrow will appear to have been slid along the panel to ensure the arrow is still pointing at the anchor. In this image, the panel has flip="slide" and has a width which is greater than the distance from the anchor to the right of the screen (or window), ...
scrollbox - Archive of obsolete content
If you just want scrollbars to appear, add style='overflow: auto;'. This may also be used with any other container element. Examples The following shows the XUL for a bunch of labels. They come out in a box. ...
splitter - Archive of obsolete content
Child(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes The following classes may be used to style the element. These classes should be used instead of changing the style of the element directly since they will fit more naturally with the user's selected theme. tree-splitter This splitter is int
ended to be used in tree columns (in-between treecol elements). The splitter will be drawn with no width so that it isn't visible, however, the columns may still be resized. <tree id="tree1" flex="1" height="300" enableColumnDrag="true"> <treecols> <treecol id="name" label="Name" flex="1"/> <splitter class="tree-splitter"/> <treecol id="id" label="ID" flex="1"/> <splitter class="tre...
tabbrowser - Archive of obsolete content
tabs. goHome() Return type: no return value Load the user's home page into the browser. gotoIndex( index ) Return type: no return value Navigate to the page in the history with the given index. Use a positive number to go forward and a negative number to go back. loadGroup( group ) Not in Firefox Return type: the first tab Loads a group of pages into multiple tabs. They are either app
ended or replaced depending on the state of the preference browser.tabs.loadGroup. The argument should be an array of objects, one for each document to load. The objects may be defined in script and contain a URI property for the URL of the page to load. A referrerURI property may also be optionally used to set the referrer page. This function returns a reference to the first tab loaded. loadOneTab( ...
textbox - Archive of obsolete content
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, min, max, increment, wraparound, hidespinbuttons, and textbox.value. password A textbox that hides what is typed, used for entering passwords. search A textbox int
ended for searching. The command event will fire as the user modifies the value. A listener for the command event should update search results. If the searchbutton attribute is set to true, the command event is only fired if the user presses the search button or presses the Enter key. You may specify grey text to appear when the search box is empty using the emptytext attribute, and a timeout may be se...
tooltip - Archive of obsolete content
-1. To have a popup appear relative to another element yet still offset by some number of pixels, determine the actual screen position of the element using the boxObject.screenX and boxObject.screenY properties of the element, and use those as the x and y arguments offset by the desired values. The popupType should be one of the strings popup, context, or tooltip. Each type of popup is int
ended to be displayed only temporarily; they are not expected to be displayed permanently. sizeTo( width, height ) Return type: no return value Changes the current size of the popup to the new width and height. Related TBD ...
Application Update - Archive of obsolete content
ppress prompting for incompatibilities only if there are VersionInfo // updates available to installed addons that resolve them, not newer // versions. pref("app.update.incompatible.mode", 0); Update Server Follow the instructions here to setup an update server for your XULRunner application to query. I opted for the simpler approach of not using the update php script. HTTPS is recomm
ended but not required (yet). update.xml The format is outlined here Process As best I can tell here's how the update process works. At the scheduled interval the application checks the update server for update.xml, search for the correct one using the Software name, versions, build id's, channels, and other information like locales. If the update.xml file doesn't exist there is no update. Upd...
Building XULRunner with Python - Archive of obsolete content
must be built with the same version of C as Python and with Python 2.5 that is MSVC71. Both must use the same version of the C runtime library MSVCRT?.DLL or crashes will ensue. The alternative is to build Python with MSVC8 as well asMozilla, but that may be problematic. It might also be possible to use the Open Source MinGW compiler with the correct MSVC run time but that is apparently not recomm
ended. Apply any Service Packs and for MSVC71 SP 1 is available. The matching platform SDK is also needed and for MSVC71 that is .NET Framework SDK 1.1. The latest Mozilla Build system is easy to use. Install the included Python distro usingpython25\python-2.5.msi. It doesn't need to be installed for the build but will be useful later when installing Python packages which look for entries in the Wind...
XULRunner FAQ - Archive of obsolete content
Is XULRunner a browser? No. You can use XULRunner to make a browser (mybrowser example or Firefox), but there is no such thing as "the XULRunner browser". Is XULRunner a development tool? Not particularly; XULRunner is a Internet technology runtime. XULRunner can be used to make development tools (the AJAX Toolkit Framework, for example). In the future there will be a XULRunner Developer Kit which will contain various development tools. How does XULRunner compare to other runtimes like Java or .NET (or Python or ...)? The goal of XULRunner is to facilitate development and deployment of Internet applications. ...
XULRunner/Old Releases - Archive of obsolete content
1.9.2.x XULRunner releases These builds are built from the stable 1.9.2 branch. Nightly builds of XULRunner 1.9.0.x These builds are built from the stable 1.9 branch. Community contributed builds of XULRunner 1.8.1.3 These builds are contributed by the Eclipse ATF community and are int
ended for embedding. The Windows and Linux builds will run normal XULRunner applications, but the Mac build uses Cocoa widgets and will not run XULRunner applications. XULRunner 1.8.0.4 This is the last official stable developer preview release from the 1.8.0 branch. It has known security holes and should not be used in applications that deal with public web content. ...
XUL Application Packaging - Archive of obsolete content
identifier. This is typically a date identifier, and should be different for every released version of an application. REQUIRED Example: BuildID=20060201 ID Specifies the unique application ID REQUIRED The application ID, like extension IDs, can be formatted either like an email ApplicationName@vendor.tld or a UUID {12345678-1234-1234-1234-123456789abc}. The email format is recomm
ended for newly developed applications. Example: ID=TestApplication@example.tld Vendor Specifies the application vendor OPTIONAL Example: Vendor=Grinch Productions Profile Specifies the path to use for the application's profile, based within the user's application data directory OPTIONAL Example: Profile=MyAppData The [Gecko] section The Gecko section specifies what version o...
calICalendarView - Archive of obsolete content
Because of this close association between methods and attributes on the one hand, and content on the other, calICalendarView implementations are particularly well suited to XBL. There is, however, no practical obstacle to the interface being implemented by any javascript object associated with a group of DOM nodes, even non-anonymous XUL nodes. In the vast majority of cases, the DOM corresponding to an implementation of calICalendarView will be rather complex. ...
Gecko Compatibility Handbook - Archive of obsolete content
w well it displays in a browser, authors have developed many techniques which take advantage of idiosyncracies in particular browsers to achieve the desired effect. This is of particular importance since the early implementations of CSS found in Internet Explorer 4 and Netscape Navigator 4 had many bugs. In order to achieve the desired effects on a page, authors wrote HTML and JavaScript which dep
ended upon these bugs in order to work properly. This can cause problems in Gecko browsers since it implements the standards strictly. The old "code to the bugs" approach will not work for Netscape 6.x, Netscape 7.x and other Mozilla based browsers. Example - Putting forms in Tables Invalid HTML to eliminate line break in <FORM>. In older browsers, this results in the TD cell tightly wrapping aroun...
Mozilla release FAQ - Archive of obsolete content
that does all the behind-the-scenes stuff NSPR = Netscape Portable RunTime -- An abstraction layer over the local OS GTK = A free GUI toolkit native to Unix Qt = Another GUI toolkit XP = Cross Platform XPFE = Cross-platform frontend based on NGLayout M[number] = Milestone release [number] (no longer used) I'm wondering how to do XXX with Navigator 3.x... The Mozilla newsgroups are int
ended to be used by people who will be working with Mozilla, either in an organizational fashion, suggesting features, or coding. Visit Netscape's website for help on that software. I went and made a suggestion and people were rude to me. Why? If you posted it to the mailing list/newsgroups, remember that on Usenet, people are not always polite to each other. Some people are just rude, and some people ...
Mozilla.dev.apps.firefox-2006-09-29 - Archive of obsolete content
hey are downloaded. Binding tab bar to new theme Discussion about how to bind a new theme to a tab bar without losing its original binding. The Distributor University students working on Cache Distribution project - looking for help for how to tap the http requests. There have been no responses so far. Can't view Keith Olbermann Videos A user inability to launch videos, worked fine for others,
ended up being a Flash version problem. Firefox 2 on Windows Vista Discussion about the "state of affairs" of Firefox 2 on Windows Vista RC1 - update for RC1 listed in Update History as 'Install Pending' right-click "Copy email address" - bug 353102 A proposed Bug Fix to the 'Copy email address' bug how to use the RSS feeds discovery & parsing tool in another open source project? A user looking to ...
2006-09-29 - Archive of obsolete content
hey are downloaded. Binding tab bar to new theme Discussion about how to bind a new theme to a tab bar without losing its original binding. The Distributor University students working on Cache Distribution project - looking for help for how to tap the http requests. There have been no responses so far. Can't view Keith Olbermann Videos A user inability to launch videos, worked fine for others,
ended up being a Flash version problem. Firefox 2 on Windows Vista Discussion about the "state of affairs" of Firefox 2 on Windows Vista RC1 - update for RC1 listed in Update History as 'Install Pending' right-click "Copy email address" - bug 353102 A proposed Bug Fix to the 'Copy email address' bug how to use the RSS feeds discovery & parsing tool in another open source project? A user looking to ...
2006-11-03 - Archive of obsolete content
g.cc make[1]: Leaving directory `/cygdrive/c/mozilla/obj-i686-pc-cygwin' make: *** [build] Error 2 He also noted that he is using make 3.80-1. On November 1st Gavin Sharp responded Phil's question. He said that the problem that Phil is experiencing is a known issue. He also mentioned that AirBag doesn't build with msvc 7.1. (http://www.google.com/url?sa=D&q=htt...tail%3Fid%3D64) Gavin recomm
ended that phil should add |ac_add_options --disable-airbag| to his .mozconfig. new Windows compatibility issue? Originally posted on November 1st: Dale Dale has set up a windows machine in order to perform Mozilla builds but has been unsuccessful to do so. According to him he has followed the Windows Build Requirements recomm
ended by mozilla. He also noted that he has had different results (erro...
2006-10-20 - Archive of obsolete content
This is a Xulrunner 1.8.0.4 application. Benjamin Smedberg would like to know what paths were used. Started Wed, Oct 18 2006 9:38 am - A XulRunner developer, Frank, discusses his desire to make xul/browser based applications. He wants to be able to build applications that will run inside the browser. ...
2006-10-13 - Archive of obsolete content
Summary: mozilla.dev.security - October 7, 2006 to October 13, 2006 Return to mozilla-dev-security Announcements None during this week. Discussions Ext
ended Privileges Prompt Mitchi asked if it was possible to revoke the checkbox auto approving some scripts. Boris Zbarsky replyied, stating that you have to edit the prefs.js file. Meetings None during this week. ...
2006-11-03 - Archive of obsolete content
Summary: mozilla.dev.security - October 28, 2006 to November 3, 2006 Return to mozilla-dev-security Announcements None during this week. Discussions Ext
ended Validation Certificates Major discussion this week started by Gervase Markham about security certificates, more specifically Ext
ended Validation Certificates. The aim of the group is to develop a new, higher standard for the validation which is done before certificate issuance, called Ext
ended Validation. The idea was that such certs would be presented differently in the UI, to give the CAs a reason to go to the extra effort, and to give customers a reason to buy them. In IE 7 at least, the use of an EV certificate is tied to the green background in the URL bar. A decision has to be made as to the usefulness of Exte...
2006-11-10 - Archive of obsolete content
Summary: mozilla.dev.security - November 4, 2006 to November 10, 2006 Return to mozilla-dev-security Announcements None during this week. Discussions Why now? (Was: Ext
ended Validation Certificates) A continuation of last week's discussion on Ext
ended Validation Certificates, the there post was getting unruly at 147 replies. Good Ideas A splinter off of the Ext
ended Validation Certificates discussion going over whether or not fraudulent websites may get these certificates and if so how to prevent this from happening. Meetings None during this week. ...
2006-11-17 - Archive of obsolete content
Summary: mozilla.dev.security - November 11, 2006 to November 17, 2006 Return to mozilla-dev-security Announcements None during this week. Discussions How to Detect Firefox Updates Externally? micahc asked if there is an easier way to detect if Firefox is installed and fully patched on any given machine, externally. Ext
ended Validation Certificates A note as to how Opera is handling Ext
ended Validation Certificates http://labs.opera.com/news/2006/10/09/ Fwd: RE: Mozilla questions regarding the EV standard Gervase Markham posted a summary of questions emailed to Kelvin Yiu about the Ext
ended Validation Certificates. Meetings None during this week. ...
2006-11-24 - Archive of obsolete content
Summary: mozilla.dev.security - November 18, 2006 to November 24, 2006 Return to mozilla-dev-security Announcements None during this week. Discussions Continuing Discussions on the Ext
ended Validation Certificates Large amount of activity this week regarding the Ext
ended Validation certificates, Duane posted several snippets of interesting debates as to whether or not the protocol should be introduced. Mozilla backing off from "ext
ended validation"? Yet more people disgruntled by EV proposal Mozilla, Opera and co only tout open standards as it suits them In addition Eddy Nigg posted an alternative proposal for the use of Ext
ended Validation certificates EV certificates / another proposal Meetings None during this week. ...
2006-09-30 - Archive of obsolete content
Summary: mozilla.dev.tech.xpcom - Sept 30- Oct 5, 2006 Announcements Build a xpcom component on Mac OS X Benjamin Smedberg confirmed that this tutorial http://www.iosart.com/firefox/xpcom/ is misleading as it uses the standalone glue (-DXPCOM_GLUE) for components, which is not recomm
ended. Developers should use this sample instead: http://developer.mozilla.org/en/docs/XPCOM_Glue Discussions Dynamic load overlay A short discussion about the possibilities of loading and unloading xul overlay runtime Reading binary data from file Discusses about the code to read binary data from file How to build xpcom component on Mac OS X Discusses about the Make file code used to build xpcom components on Mac OS X successfully Meetings None during this week. ...
NPN_GetAuthenticationInfo - Archive of obsolete content
returns an error code. For possible values, see Error Codes. Description Plugin which implement their own HTTP networking stack (such as the Java plugin) may want to use the standard HTTP auth prompts and password managed of the browser. This function allows the plugin to ask the browser for HTTP authentication information for a domain. Unless the plugin has special networking needs, it is recomm
ended to use the standard network APIs, such as NPN_GetURLNotify/NPN_PostURLNotify. See also NPN_SetValueForURL, NPN_GetValueForURL ...
NPN_GetURL - Archive of obsolete content
, or mailto. target Name of the target window or frame, or one of the following special target names. Values: _blank or _new: Load the link in a new blank unnamed window. Safest target, even though, when used with a mailto or news URL, this creates an extra blank the browser instance. _self or _current: Load the link into the same window the plug-in instance occupies. Not recomm
ended; if target refers to the window or frame containing the instance, the instance is destroyed and the plug-in may be unloaded. Use with NPN_GetURL() only if you want to terminate the plug-in. _parent: Load the link into the immediate <frameset> parent of the plug-in instance's document. If the plug-in instance's document has no parent, the default is _self. _top: Load the link into the plug-i...
NPP_Destroy - Archive of obsolete content
deleted, typically because the user has left the page containing the instance, closed the window, or quit the browser. You should delete any private instance-specific information stored in the plug-in's instance->pdata at this time. If this function is deleting the last instance of a plug-in, NP_Shutdown is subsequently called. Use NP_Shutdown to delete any data allocated in NP_Initialize and int
ended to be shared by all instances of a plug-in. Use the optional save parameter if you want to save and reuse some state or other information. Upon the user's return to the page, this information is passed to the new plug-in instance when it is created with NPP_New. Avoid trying to save critical data with this function. Ownership of the buf field of the NPSavedData structure passes from the plug-in...
The First Install Problem - Archive of obsolete content
" file myfile.typ doesn't contain enough resource information to load the correct mimetype handling component (DLL), specifying "type" is an additional mechanism. Unlike UUIDs, PLIDs are human readable, and not lengthy "garbled" strings. (It should be noted that the "classid" attribute discussion here is a potential future direction; it doesn't yet work, at least as of Firefox 3.6.8. The recomm
ended <object> attribute to set is still either "type" or "data".) Advantage: We now no longer have ambiguity in determining which plugin handles what mimetype, because now the plugin has been invoked using the classid attribute of the OBJECT tag, which is in compliance with the HTML 4.01 specification for use of the OBJECT tag. (Original proposal by Arun K. Ranganathan <aruner@netscape.com>) ...
XEmbed Extension for Mozilla Plugins - Archive of obsolete content
r modern plugin development because very few modern applications that want to take advantage of the capabilities of newer toolkits use Xt. Also, when included with builds of Mozilla that are based on Gtk 1.2 or Gtk 2.x, the Xt code that hosts the plugins is at best hacky and has been the source for many minor problems including inconsistent focus behavior as well as occasional crashes. It's recomm
ended that you have a look at the Gecko Plugin API Reference since this document will include information that assumes that you are already familiar with the way that plugins are currently hosted as well as the APIs. Key Differences All 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_Set...
Proposal - Archive of obsolete content
ould become standards in the future. 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. Name Description Status Easy News Topics Easy News Topics (ENT) is int
ended to be a very simple standard for describing how topic information can be introduced into an RSS2.0 news feed. Draft Exists ICBM Let's you add latitude and longitude info to an item. Spec Exists iTunes RSS iTunes Extension Modules used for IPradio/podcasting. Spec Exists Media RSS RSS Extension Module used for IPTV and IPradio/podcasting. Spec Exists Newsgator Feed Extension Created to mak...
Encryption and Decryption - Archive of obsolete content
Decryption is the process of transforming encrypted information so that it is intelligible again. A cryptographic algorithm, also called a cipher, is a mathematical function used for encryption or decryption. In most cases, two related functions are employed, one for encryption and the other for decryption. ...
SSL and TLS - Archive of obsolete content
ablish 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 supports ECC cipher suites as well as RSA. Note: Longer RSA keys are required to provide security as computing capabilities increase. The recomm
ended 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 3072 or 4096 bits) if possible. As PKIs using RSA keys and certificates transition to other cryptographic systems like ECC, servers should cont...
Threats - Archive of obsolete content
ut its privacy is compromised. For example, someone could learn your credit card number, record a sensitive conversation, or intercept classified information. Tampering. Information in transit is changed or replaced and then sent on to the recipient. For example, someone could alter an order for goods or change a person's resume. Impersonation. Information passes to a person who poses as the int
ended recipient. Impersonation can take two forms: Spoofing. A person can pretend to be someone else. For example, a person can pretend to have the email address jdoe@example.net, or a computer can identify itself as a site called www.example.net when it is not. This type of impersonation is known as spoofing. Misrepresentation. A person or organization can misrepresent itself. For example, su...
Vulnerabilities - Archive of obsolete content
e exploited to negatively impact confidentiality, integrity, and/or availability. There are many ways in which vulnerabilities can be categorized. This article uses three high-level vulnerability categories: software flaws, security configuration issues, and software feature misuse. These categories are described below. Vulnerability Categories A software flaw vulnerability is caused by an unint
ended error in the design or coding of software. An example is an input validation error, such as user-provided input not being properly evaluated for malicious character strings and overly long values associated with known attacks. Another example is a race condition error that allows the attacker to perform a specific action with elevated privileges. A security configuration setting is an element of...
Security - Archive of obsolete content
ems at risk. Digital SignaturesEncryption and decryption address the problem of eavesdropping, one of the three Internet security issues mentioned at the beginning of this document. But encryption and decryption, by themselves, do not address another problem: tampering.Encryption and DecryptionEncryption is the process of transforming information so it is unintelligible to anyone but the int
ended recipient. Decryption is the process of transforming encrypted information so that it is intelligible again.Introduction to Public-Key CryptographyPublic-key cryptography and related standards and techniques underlie the security features of many products such as signed and encrypted email, single sign-on, and Secure Sockets Layer (SSL) communications. This document introduces the basic concepts ...
Solaris 10 Build Prerequisites - Archive of obsolete content
ded packages from the OS install DVD, so that DVD has to be available. The installer will try to install the SUNWsmbaS package, which is not available in newer 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 recomm
ended compiler, but the compiler you installed will work fine, so you should tell the installer to use the compiler anyway. Run . /opt/jdsbld/bin/env.sh to import 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...
Table Reflow Internals - Archive of obsolete content
reflow Table paginated reflow Review of Reflow Reflow process starts when An html document starts loading (the frame tree contains only viewport, 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, app
ended, 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 viewport frame), Which reflows it children, etc. Ususally it starts when the pres shell processes its...
The Basics of Web Services - Archive of obsolete content
C was developed by Useful Inc, along with Microsoft. Warning: XML-RPC support was removed from Firefox starting with Firefox 3. Introducing SOAP SOAP, a web service, is listed as a W3C standard, and is similar in ways to XML-RPC. SOAP also has backing from IBM, as well as Microsoft. Warning: SOAP support was removed from Firefox starting with Firefox 3. SOAP or XML-RPC? Briefly, SOAP was int
ended to fill gaps in XML-RPC. An example is, it is easier to send a multi-dimensional array with SOAP rather then with XML-RPC. SOAP also has more features then XML-RPC, but XML-RPC on its own, has its uses. ...
Building a Theme - Archive of obsolete content
. Your theme will be hosted on Mozilla's mirror network to guarantee your download even though it might be very popular. Mozilla's site also provides users easier installation, and will automatically make your newer versions available to users of your existing versions when you upload them. In addition, Mozilla Add-ons allows users to comment and provide feedback on your theme. It is highly recomm
ended that you use Mozilla Add-ons to distribute your themes! Visit https://addons.mozilla.org/developers/ to create an account and begin distributing your themes! Note: Your theme will be passed faster and downloaded more if you have a good description and some screenshots of the theme in action. Themes ______________________________ ...
Using Firebug and jQuery (Screencast) - Archive of obsolete content
sion jQuery JavaScript Library jQuery Selector Documentation Digg Learning jQuery: jQuerify Bookmarklet If you wish to use Greasemonkey instead of a bookmarklet, then by all means, please do so. You can use the ability to quickly analyze and inspect a page that Firebug and jQuery affords you, using the results to build a Greasemonkey script, instead of a simple bookmarklet. I only really int
ended this to be a quick introduction to the subject, so please feel free to explore it more! More Tips: Here are some more jQuery selectors that you can use on a Digg Post: $("li.c-bury > div").remove(); - Remove all buried comments, but none of the direct replies. $("div.c-body").show(); - Show all comments, even ones that've been buried. ...
Using IO Timeout And Interrupt On NT - Archive of obsolete content
owing the rule of thumb, both threads would close the socket. The first <tt>PR_Close()</tt> would succeed, but the second <tt>PR_Close()</tt> would be freeing freed memory. A solution that may work is to use a lock to ensure only one thread can be using that socket at all times. Once there is a timeout or interrupt error, the file descriptor is no longer usable. Suppose the file descriptor is int
ended to be used for the life time of the process, for example, the logging file, this is really not acceptable. A possible solution is to add a <tt>PR_DisableInterrupt()</tt> function to turn off interrupts when accessing such file descriptors. A related known bug is that timeout and interrupt don't work for <tt>PR_Connect()</tt> on NT. This bug is due to a different limitation in our NT implementati...
Using the W3C DOM - Archive of obsolete content
s, new content, for traversing the content tree and for handling events dispatched as the user interacts with the document itself. Manipulating Document Style and Content Changing an Element's Style Using the DOM The following table describes standards-based methods for accessing and updating style rules defined for various HTML elements in a web page. See the W3C DOM 2 Recommendation, CSS2 Ext
ended Interface. DOM level 2 provides for the assignment of new values to the CSS properties of an element using the ElemRef.style object reference. You can get a reference to the element to which that style corresponds by using the DOM's getElementById or one of the other methods described in the DOM access section above. Deprecated coding practices Appropriate DOM 2 replacements ...
-moz-stack-sizing - Archive of obsolete content
Normally, a <xul:stack> will change its size so that all of its child elements are completely visible. For example, moving a child of the stack far to the right will widen the stack so the child remains visible. /* Keyword values */ -moz-stack-sizing: auto; -moz-stack-sizing: ignore; /* Global values */ -moz-stack-sizing: inherit; -moz-stack-sizing: initial; -moz-stack-sizing: unset; If you wish to prevent the stack from resizing automatically to accommodate its children, you can set -moz-stack-sizing to ignore on the child element. The property is set not on the stack itself, but on the stack's children. This lets you ignore certain children, but not others. ...
-ms-hyphenate-limit-lines - Archive of obsolete content
Initial valueno-limitApplies toblock container elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values no-limit Indicates that hyphenation is not limited based on the number of consecutive hyphenated lines. In the flow above the consecutive hyphenated lines limit would be an infinitely large positive number. <integer> Indicates the maximum number of successive hyphenated lines. ...
:-moz-system-metric(images-in-menus) - Archive of obsolete content
The :-moz-system-metric(images-in-menus) CSS pseudo-class matches an element if the computer's user interface supports images in menus. This selector is int
ended for use mainly by theme developers. Note: Since Firefox 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. ...
:-moz-system-metric(mac-graphite-theme) - Archive of obsolete content
:-moz-system-metric(mac-graphite-theme) will match an element if the user has chosen the "Graphite" appearance in the "Appearance" prefpane of the Mac OS X System Preferences. This selector is int
ended for use mainly by theme developers. Note: Since Firefox 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. Examples Demo ...
:-moz-system-metric(scrollbar-end-backward) - Archive of obsolete content
The :-moz-system-metric(scrollbar-end-backward) CSS pseudo-class will match an element if the computer's user interface includes a backward arrow button at the end of scrollbars. This selector is int
ended for use mainly by theme developers. Note: Since Firefox 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. Specifications Not part of any specification. ...
:-moz-system-metric(scrollbar-end-forward) - Archive of obsolete content
The :-moz-system-metric(scrollbar-end-forward) CSS pseudo-class will match an element if the computer's user interface includes a forward arrow button at the end of scrollbars. This selector is int
ended for use mainly by theme developers. Note: Since Firefox 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. Specifications Not part of any specification. ...
:-moz-system-metric(scrollbar-start-backward) - Archive of obsolete content
The :-moz-system-metric(scrollbar-start-backward) CSS pseudo-class will match an element if the computer's user interface includes a backward arrow button at the start of scrollbars. This selector is int
ended for use mainly by theme developers. Note: Since Firefox 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. Specifications Not part of any specification. ...
:-moz-system-metric(scrollbar-start-forward) - Archive of obsolete content
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. This selector is int
ended for use mainly by theme developers. Note: Since Firefox 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. Specifications Not part of any specification. ...
:-moz-system-metric(windows-default-theme) - Archive of obsolete content
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. This selector is int
ended for use mainly by theme developers. Note: Since Firefox 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. 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 backgroun...
The global XML object - Archive of obsolete content
l XML Object E4X-capable JavaScript engines put a new property on the global object. The XML object has several properties that allow you to customize parsing and serialization of E4X. XML elements will remember the settings of the XML object from the time of their creation. Extending XML.prototype XML.prototype and XMLList.prototype (XMLList.prototype is actually just XML.prototype) cannot be ext
ended in the same conventional way as other constructors such as Object. You can only define methods in XML.prototype and not fields. To add a method to XML.prototype, define XML.prototype.function::methodName or XML.prototype.function::[methodNameString]. The following example defines the fooCount() method, which returns the amount of <foo> elements in the XML: XML.prototype.function::fooCount = funct...
ArrayBuffer.transfer() - Archive of obsolete content
If newByteLength is undefined, the byteLength of the oldBuffer is used. This operation leaves oldBuffer in a detached state. Syntax ArrayBuffer.transfer(oldBuffer [, newByteLength]); Parameters oldBuffer An ArrayBuffer object from which to transfer. newByteLength The byte length of the new ArrayBuffer object. Return value A new ArrayBuffer object. ...
VBArray.toArray - Archive of obsolete content
e! This object is a Microsoft extension and is only supported in Internet Explorer. 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 app
ended 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). After translation, the JavaScript array contains: 1, 2, 3, 4, 5, 6, 7, 8, 9. There is currently no way to convert a JavaScript array into a VBArray. Example The followin...
@cc_on - Archive of obsolete content
s 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 support conditional compilation to ignore it. It is strongly recomm
ended that you use the @cc_on statement in a comment, so that browsers that do not support 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 @*/ /*@ document.write("JavaScript version: " + @_jscript_version + "."...
New in JavaScript 1.8 - Archive of obsolete content
The following is a changelog for JavaScript 1.8. This version was included in Firefox 3 and is part of Gecko 1.9. See bug 380236 for a tracking development bug for JavaScript 1.8. Using JavaScript 1.8 In order to use some of the new features of JavaScript 1.8 in HTML, use: <script type="application/javascript;version=1.8"> ... your code ... </script> Another way (not recomm
ended) to do this is to use the deprecated <script> language attribute and define it as "JavaScript1.8". When using the JavaScript shell, JavaScript XPCOM components, or XUL <script> elements, the latest JS version (JS1.8 in Mozilla 1.9) is used automatically (bug 381031, bug 385159). The features that require the use of the new keywords "yield" and "let" require you to specify version 1.7 or higher because existing ...
Object.prototype.unwatch() - Archive of obsolete content
int set with the watch() method. Syntax obj.unwatch(prop) Parameters prop The name of a property of the object to stop watching. Return value undefined. Description The JavaScript debugger has functionality similar to that provided by this method, as well as other debugging options. For information on the debugger, see Venkman. By default, this method is inherited by every object desc
ended from Object. Note: The reason for unwatch() to take the property name prop as its only parameter is due to the "single handler allowing" behavior of the watch() method. Examples See watch(). Specifications Not part of any standard. ...
Object.prototype.watch() - Archive of obsolete content
A watchpoint can filter (or nullify) the value assignment, by returning a modified newval (or by returning oldval). If you delete a property for which a watchpoint has been set, that watchpoint does not disappear. If you later recreate the property, the watchpoint is still in effect. To remove a watchpoint, use the unwatch() method. By default, the watch method is inherited by every object desc
ended from Object. The JavaScript debugger has functionality similar to that provided by this method, as well as other debugging options. For information on the debugger, see Venkman. In Firefox, handler is only called from assignments in script, not from native code. For example, window.watch('location', myHandler) will not call myHandler if the user clicks a link to an anchor within the current doc...
Archived JavaScript Reference - Archive of obsolete content
bject instead.Array.unobserve()The Array.unobserve() method was used to remove observers set by Array.observe(), but has been deprecated and removed from Browsers. You can use the more general Proxy object instead.ArrayBuffer.transfer()The static ArrayBuffer.transfer() method returns a new ArrayBuffer whose contents have been taken from the oldBuffer's data and then is either truncated or zero-ext
ended by newByteLength. If newByteLength is undefined, the byteLength 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.protot...
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
gular 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 supports XHTML if it is served with MIME media type text/html rather than the recomm
ended 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 authoring and displaying XML. Proper XHTML is an application of XML and as su...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
e.append( "dump.txt", s ); } formProcessor.proxy = true; </script> The first function, formHandler, performs some first-level validation using the validateComments function. If it passes validation, the formProcessor server-side function is invoked which does the same validation check using the shared validateComments function. Finally, the comment information is assembled into a string and app
ended to the dump file. Database Access For more robust data management, Jaxer comes with the ability to manage data in either a SQLite database which is included in Jaxer, or a mySQL database, and is extensible to others. Much like the file I/O namespace, database access in Jaxer can be as simple or complicated as you want or need it to be. For debugging, Jaxer will also sen...
Reference - Archive of obsolete content
so my question is , what the heck is going on here ... IS Function same as Object. is Function an instance of Object or is Object an instace of Function ? note that the Methods and properties for Object in this reference are also available for Function and vice versa ... --Aaike82 18:54, 18 August 2006 (PDT) Actual Answer: Object > (Function, everything else). Everything in JavaScript is desc
ended from Object, including functions. All functions in JavaScript (that is, every object that has an internal [[Call]] or [[Construct]] property) are functions as well as objects (including the Function object itself). The reason Object instanceof Function evaluates to true is because Object can be used as a constructor function. A subset of the "Object > (Function, everything else)" chain could be O...
Describing microformats in JavaScript - Archive of obsolete content
makes use of the adr microformat to define an address. The adr microformat is defined as follows: var adr_definition = { mfVersion: 0.8, mfObject: adr, className: "adr", properties: { "type" : { plural: true, types: ["work", "home", "pref", "postal", "dom", "intl", "parcel"] }, "post-office-box" : { }, "street-address" : { plural: true }, "ext
ended-address" : { }, "locality" : { }, "region" : { }, "postal-code" : { }, "country-name" : { } } }; The properties are quite simple here. The type property indicates the type of address represented by the object (work, home, and so forth). Since the plural property is true, multiple types can be specified. This allows an address to be marked as being, for exam...
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
to the selectors, like this: a:hover {color: red;} a.nav:hover {color: red;} In an attempt to avoid causing problems for legacy documents, browsers based on Mozilla 1.0 and later (Netscape 7+) include code that causes bare pseudo-classes to be restricted only to links if the document is rendered in "quirks" mode. In browsers based on the engine found in Mozilla 1.3b and later, this quirk is ext
ended to cover selectors that combine a bare class selector with the :hover pseudo-class (see bug 169078 for details). Named Anchor Problems In addition to the effects described previously, there are two other relatively common effects that authors may not expect. One is easily fixed by validation, but the other is a little more subtle. First, there is the problem of authors who open a named anchor ...
Mozilla's DOCTYPE sniffing - Archive of obsolete content
osoft//DTD Internet Explorer 3.0 HTML Strict//EN". The public identifier "-//Microsoft//DTD Internet Explorer 3.0 Tables//EN". The public identifier "-//Sun Microsystems Corp.//DTD HotJava HTML//EN". The public identifier "-//Sun Microsystems Corp.//DTD HotJava Strict HTML//EN". The public identifier "-//IETF//DTD HTML 2.1E//EN". The public identifier "-//O'Reilly and Associates//DTD HTML Ext
ended 1.0//EN". The public identifier "-//O'Reilly and Associates//DTD HTML Ext
ended Relaxed 1.0//EN". The public identifier "-//O'Reilly and Associates//DTD HTML 2.0//EN". The public identifier "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN". The public identifier "-//Spyglass//DTD HTML 2.0 Ext
ended//EN". The public identifier "+//Silmaril//DTD HTML Pro v0r11 19970101//EN". The public identifier...
Parsing microformats in JavaScript - Archive of obsolete content
Methods dateTimeGetter() Specifically retrieves a date from a microformat node. After getting the text, it is normalized into an ISO 8601 date. normalizedDate = Microformats.parser.dateTimeGetter(propnode, parentnode); Parameters propnode The DOM node to check. ...
The Business Benefits of Web Standards - Archive of obsolete content
hs. In such an increasingly heterogeneous environment, testing each web page in every configuration is impossible. Coding to standards is then the only practical solution. In a ground breaking development MicroSoft have announced a new meta tag that can be used in sites to trigger IE 8 into Web Standards mode. At the same time in non standards mode existing legacy sites will still be seen as int
ended. Although in some ways a controversial move - the announcement has attracted widespread support from leading developers and standards advocates, led by Jeffrey Zeldman. Legacy User Agents: Netscape 4 and IE4 The only drawback in using CSS is that older browsers (specifically IE4 and NS4) will not be able to render as int
ended. In some cases, where a significant portion of the audience is runnin...
Common causes of memory leaks in extensions - Extensions
l. In overlay code you may use an unload event listener: addEventListener("unload", function() { Services.obs.removeObserver(myObserver, "private-browsing"); }, false); In bootstrap.js (restartless add-ons) unregister your observer in your shutdown function: function shutdown() { // ... ...
2D collision detection - Game development
braries. Separating Axis Theorem This is a collision algorithm that can detect a collision between any two *convex* polygons. It's more complicated to implement than the above methods but is more powerful. The complexity of an algorithm like this means we will need to consider performance optimization, covered in the next section. Implementing SAT is out of scope for this page so see the recomm
ended tutorials below: Separating Axis Theorem (SAT) explanation Collision detection and response Collision detection Using the Separating Axis Theorem SAT (Separating Axis Theorem) Separating Axis Theorem Collision Performance While some of these algorithms for collision detection are simple enough to calculate, it can be a waste of cycles to test *every* entity with every other entity. Usua...
Bounding volume collision detection with THREE.js - Game development
Helper (previously BoundingBoxHelper, which has been deprecated). This helper takes a Mesh and calculates a bounding box volume for it (including its child meshes). This results in a new box Mesh representing the bounding box, which shows the bounding box's shape, and can passed to the previously seen setFromObject method in order to have a bounding box matching the Mesh. BoxHelper is the recomm
ended way to handle 3D collisions with bounding volumes in Three.js. You will miss sphere tests, but the tradeoffs are well worth it. The advantages of using this helper are: It has an update() method that will resize its bounding box Mesh if the linked Mesh rotates or changes its dimensions, and update its position. It takes into account the child meshes when computing the size of the bounding b...
Randomizing gameplay - Game development
ball.body.velocity.x = -1*5*(paddle.x-ball.x); } It's a little bit of magic -- the new velocity is higher, the larger the distance between the center of the paddle and the place where the ball hits it. Also, the direction (left or right) is determined by that value -- if the ball hits the left side of the paddle it will bounce left, whereas hitting the right side will bounce it to the right. It
ended up that way because of a little bit of experimentation with the given values, you can do your own experimentation and see what happens. It's not completely random of course, but it does make the gameplay a bit more unpredictable and therefore more interesting. Compare your code You can check the finished code for this lesson in the live demo below, and play with it to understand better how it w...
Visual typescript game engine - Game development
Luanch debugger configuration comes with this project. Physics engine based on Matter.js. Multiplatform video chat (for all browsers) implemented. SocketIO used for session staff. MultiRTC2 used for data transfer also for video chat. MultiRTC3 alias 'broadcaster' used for video chat. ...
Plug-in Development Overview - Gecko Plugin API Reference
ities. To make the user feel that the plug-in is part of the the browser user interface, your plug-in can emulate the browser behavior by providing status line messages. Use the NPN_Status method to display a message on the status line. For information about using this method, see Version, UI, and Status Information. Making Plug-ins Scriptable Scriptable plug-ins are plug-ins that have been ext
ended to provide methods that can be called from JavaScript and the DOM when accessed through the object or embed element. Consider the following example, where a media player plug-in can be controlled with an advanceToNextSong() method called inside the script element: <object id="myPlugin" type="audio/wav" data="music.wav"> </object> <script type="application/javascript"> var thePlugin = d...
Encryption - MDN Web Docs Glossary: Definitions of Web-related terms
Encryption is a cryptographic primitive: it transforms a plaintext message into a ciphertext using a cryptographic algorithm called a cipher. Encryption in modern ciphers is performed using a specific algorithm and a secret, called the key. Since the algorithm is often public, the key must stay secret if the encryption stays secure. Without knowing the secret, the reverse operation, decryption, is mathematically hard to perform. ...
MathML - MDN Web Docs Glossary: Definitions of Web-related terms
MathML (an XML application) is an open standard for representing mathematical expressions in webpages. In 1998 the W3C first recomm
ended MathML for representing mathematical expressions in the browser. MathML has other applications also including scientific content and voice synthesis. ...
MitM - MDN Web Docs Glossary: Definitions of Web-related terms
A Man-in-the-middle attack (MitM) intercepts a communication between two systems. For example, a Wi-Fi router can be compromised. Comparing this to physical mail: If you're writing letters to each other, the mailman can intercept each letter you mail. They open it, read it, eventually modify it, and then repackage the letter and only then send it to whom you int
ended to sent the letter for. The original recipient would then mail you a letter back, and the mailman would again open the letter, read it, eventually modify it, repackage it, and give it to you. You wouldn't know there's a man in the middle in your communication channel - the mailman is invisible to you and to your recipient. In physical mail and in online communication, MITM attacks are tough to defend. A few tips: Don't...
Mutable - MDN Web Docs Glossary: Definitions of Web-related terms
e Immutable. Lets understand this with an example: var immutableString = "Hello"; // In the above code, a new object with string value is created. immutableString = immutableString + "World"; // We are now appending "World" to the existing value. On appending the "immutableString" with a string value, following events occur: Existing value of "immutableString" is retrieved "World" is app
ended to the existing value of "immutableString" The resultant value is then allocated to a new block of memory "immutableString" object now points to the newly created memory space Previously created memory space is now available for garbage collection. Learn more General knowledge Immutable object on Wikipedia ...
Time to interactive - MDN Web Docs Glossary: Definitions of Web-related terms
Time to Interactive (TTI) is a non-standardized web performance 'progress' metric defined as the point in time when the last Long Task finished and was followed by 5 seconds of network and main thread inactivity. TTI, proposed by the Web Incubator Community Group in 2018, is int
ended to provide a metric that describes when a page or application contains useful content and the main thread is idle and free to respond to user interactions, including having event handlers registered. Caveat: TTI is derived by leveraging information from the Long Tasks API. Although available in some performance monitoring tools, TTI is not a part of any official web specification at the time of writing. ...
Unicode - MDN Web Docs Glossary: Definitions of Web-related terms
et, other programs and computers would display the text incorrectly, or damage it during processing. If you've ever seen text where characters like curly quotes ("") were replaced with gibberish like A,AGBP, then you've seen this problem, known as Mojibake. The most common Unicode character encoding on the Web is UTF-8. Other encodings exist, like UTF-16 or the obsolete UCS-2, but UTF-8 is recomm
ended. Learn more Unicode on Wikipedia The Unicode Standard: A Technical Introduction ...
Wrapper - MDN Web Docs Glossary: Definitions of Web-related terms
In programming languages such as JavaScript, a wrapper is a function that is int
ended to call one or more other functions, sometimes purely for convenience, and sometimes adapting them to do a slightly different task in the process. For example, SDK Libraries for AWS are examples of wrappers. Learn more General knowledge Wrapper function on Wikipedia ...
Accessible multimedia - Learn web development
information such as who spoke the words, if the people were angry or sad, and what mood the music is currently creating. Subtitles -- Include translations of the audio dialog, for users that don't understand the language being spoken. Descriptions -- These include descriptions for blind people who can't see the video, for example what the scene looks like. Chapter titles -- Chapter markers int
ended to help the user navigate the media resource Implementing HTML5 video text tracks Text tracks for displaying with HTML5 video need to be written in WebVTT, a text format containing multiple strings of text along with metadata such as what time in the video you want each text string to be displayed, and even limited styling/positioning information. These text strings are called cues. A typical...
Backgrounds and borders - Learn web development
repeat-x -- repeat horizontally. repeat-y -- repeat vertically. repeat -- the default; repeat in both directions. Try these values out in the example below. We have set the value to no-repeat so you will only see one star. Try out the different values -- repeat-x and repeat-y -- to see what their effects are. Sizing the background image In the example above, we have a large image that has
ended up being cropped as it is larger than the element it is a background of. In this case we could use the background-size property, which can take length or percentage values, to size the image to fit inside the background. You can also use keywords: cover -- the browser will make the image just large enough so that it completely covers the box area while still retaining its aspect ratio. In thi...
Cascade and inheritance - Learn web development
no other styling is set). Normal declarations in user style sheets (custom styles set by a user). Normal declarations in author style sheets (these are the styles set by us, the web developers). Important declarations in author style sheets Important declarations in user style sheets It makes sense for web developers' stylesheets to override user stylesheets, so the design can be kept as int
ended, but sometimes users have good reasons to override web developer styles, as mentioned above -- this can be achieved by using !important in their rules. Test your skills! We have covered a lot in this article, but can you remember the most important information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: the Cascade...
Type, class, and ID selectors - Learn web development
ts that have the class applied are highlighted. Targeting classes on particular elements You can create a selector that will target specific elements with the class applied. In this next example we will highlight a <span> with a class of highlight differently to an <h1> heading with a class of highlight. We do this by using the type selector for the element I want to target, with the class app
ended using a dot, with no white space in between. This approach reduces the scope of a rule as the rule will only apply to that particular element & class combination; so you would need to add another selector if you decided the rule should apply to other elements too. Target an element if it has more than one class applied You can apply multiple classes to an element and target them individuall...
Floats - Learn web development
ing: 1em; } This example works by creating what is known as a block formatting context (BFC). This is like a mini layout inside your page, inside which everything is contained, therefore our floated element is contained inside the BFC and the background runs behind both items. This will usually work, however, in certain cases you might find unwanted scrollbars or clipped shadows due to unint
ended consequences of using overflow. display: flow-root The modern way of solving this problem is to use the value flow-root of the display property. This exists only to create a BFC without using hacks -- there will be no unint
ended consequences when you use it. Remove overflow: auto from your .wrapper rule and add display: flow-root. Assuming you have a supporting browser, the box will clear. .wr...
Legacy layout methods - Learn web development
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. ...
Practical positioning examples - Learn web development
gain (smoothly due to the transition). Clicking the label again unchecks the checkbox, which hides the panel again. So there you have it -- a rather clever JavaScript-free way to create a toggling button effect. This will work in IE9 and above (the smooth transition will work in IE10 and above.) This effect does have some concerns -- this is a bit of an abuse of form elements, as they weren't int
ended for this purpose. In addition, the effect is not great in terms of accessibility; the label is not focusable by default, and the non-semantic use of the form elements could cause issues with screen readers. JavaScript and a link or button might be more appropriate, but it is still fun to experiment with. Summary So that rounds off our look at positioning -- by now, you should have an idea of ho...
CSS layout - Learn web development
nment 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. Legacy layout methods Grid systems are a very common feature used in CSS layouts, and before CSS Grid Layout they t
ended 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. Supporting older browsers In this module we recommend using ...
What is CSS? - Learn web development
nt. CSS is constantly developing, with new 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. A website built in 2000, using the limited CSS available then, should still be usable in a browser today! As a newcomer to CSS, it is likely that you will find the CSS specs overwhelming -- they are int
ended for engineers to use to implement support 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 support (see below), and the specs. Browser support Once CSS has...
Styling lists - Learn web development
on both sides.</li> <li>Wash and chop the salad.</li> <li>Fill pita with salad, hummus, and fried halloumi.</li> </ol> <h2>Ingredient description list</h2> <p>Paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference.</p> <dl> <dt>Hummus</dt> <dd>A thick dip/sauce generally made from chick peas bl
ended with tahini, lemon juice, salt, garlic, and other ingredients.</dd> <dt>Pita</dt> <dd>A soft, slightly leavened flatbread.</dd> <dt>Halloumi</dt> <dd>A semi-hard, unripened, brined cheese with a higher-than-usual melting point, usually made from goat/sheep milk.</dd> <dt>Green salad</dt> <dd>That green healthy stuff that many of us just use to garnish kebabs.</dd> </dl> If you go to ...
Learn to style HTML using CSS - Learn web development
u should also be familiar with using computers and using the web passively (i.e., just looking at it, consuming the content). You should have a basic work environment set up as detailed in Installing basic software and understand how to create and manage files, as detailed in Dealing with files -- both of which are parts of our Getting started with the web complete beginner's module. It is recomm
ended that you work through Getting started with the web before proceeding with this topic. However, doing so isn't absolutely necessary as much of what is covered in the CSS basics article is also covered in our CSS first steps module, albeit in a lot more detail. Modules This topic contains the following modules, in a suggested order for working through them. You should definitely start with the fi...
What text editors are available? - Learn web development
If you aren't sure which features you want, or your favorite editor lacks those features out of the box, look for an extensible editor. The best editors provide many plugins, and ideally a way to look for and install new plugins automatically. If you like lots of features and your editor is slowing down because of all your plugins, try using an IDE (integrated development e...
Basic native form controls - Learn web development
t corner of the image represents the coordinate (0, 0)). The coordinates are sent as two key/value pairs: The X value key is the value of the name attribute followed by the string ".x". The Y value key is the value of the name attribute followed by the string ".y". So for example when you click on the image at coordinate (123, 456) and it submits via the get method, you'll see the values app
ended to the URL as follows: http://foo.com?pos.x=123&pos.y=456 This is a very convenient way to build a "hot map". How these values are sent and retrieved is detailed in the Sending form data article. File picker There is one last <input> type that came to us in early HTML: the file input type. Forms are able to send files to a server (this specific action is also detailed in the Sending form data...
HTML forms in legacy browsers - Learn web development
available between the starting and ending tag of the <button> element instead of the content of the value attribute when clicked. This was only an issue if that value needed to be sent, such as when data processing depends on which button a user clicked. Some very old browsers did not use submit as the default value for the type attribute. While resolved in all modern browsers, it is still recomm
ended to always set the type attribute on <button> elements. <!-- Clicking this button sent "<em>Do A</em>" instead of "A" in some cases --> <button type="submit" name="IWantTo" value="A"> <em>Do A</em> </button> Choosing one solution or the other is up to you based on your project's constraints. Let go of CSS One of the big issues with HTML Forms is styling form widgets with CSS. Form controls ...
How to structure a web form - Learn web development
ML structures used with forms Beyond the structures specific to web forms, it's good to remember that form markup is just HTML. This means that you can use all the power of HTML to structure a web form. As you can see in the examples, it's common practice to wrap a label and its widget with a <li> element within a <ul> or <ol> list. <p> and <div> elements are also commonly used. Lists are recomm
ended for structuring multiple checkboxes or radio buttons. In addition to the <fieldset> element, it's also common practice to use HTML titles (e.g. <h1>, <h2>) and sectioning (e.g. <section>) to structure complex forms. Above all, it is up to you to find a comfortable coding style that results in accessible, usable forms. Each separate section of functionality should be contained in a separate <sec...
HTML basics - Learn web development
he following: A space between it and the element name (or the previous attribute, if the element already has one or more attributes). The attribute name followed by an equal sign. The attribute value wrapped by opening and closing quotation marks. Note: Simple attribute values that don't contain ASCII whitespace (or any of the characters " ' ` = < > ) can remain unquoted, but it is recomm
ended that you quote all attribute values, as it makes the code more consistent and understandable. Nesting elements You can put elements inside other elements too -- this is called nesting. If we wanted to state that our cat is very grumpy, we could wrap the word "very" in a <strong> element, which means that the word is to be strongly emphasized: <p>My cat is <strong>very</strong> grumpy.</p> Yo...
Creating hyperlinks - Learn web development
ou can check the navigation-menu-marked-up directory to see the correct answer. E-mail links It's possible to create links or buttons that, when clicked, open a new outgoing email message rather than linking to a resource or page. This is done using the <a> element and the mailto: URL scheme. In its most basic and commonly used form, a mailto: link simply indicates the email address of the int
ended recipient. For example: <a href="mailto:nowhere@mozilla.org">Send email to nowhere</a> This results in a link that looks like this: Send email to nowhere. In fact, the email address is optional. If you omit it and your href is simply "mailto:"), a new outgoing email window will be opened by the user's email client with no destination address. This is often useful as "Share" links that users c...
Debugging HTML - Learn web development
types of error that you'll come across: Syntax errors: These are spelling errors in your code that actually cause the program not to run, like the Rust error shown above. These are usually easy to fix as long as you are familiar with the language's syntax and know what the error messages mean. Logic errors: These are errors where the syntax is actually correct, but the code is not what you int
ended it to be, meaning that the program runs incorrectly. These are often harder to fix than syntax errors, as there isn't an error message to direct you to the source of the error. HTML itself doesn't suffer from syntax errors because browsers parse it permissively, meaning that the page still displays even if there are syntax errors. Browsers have built-in rules to state how to interpret incorrect...
Getting started with HTML - Learn web development
website</a> However, as soon as we add the title attribute in this way, there are problems: <a href=https://www.mozilla.org/ title=The Mozilla homepage>favorite website</a> As written above, the browser misinterprets the markup, mistaking the title attribute for three attributes: a title attribute with the value The, and two Boolean attributes, Mozilla and homepage. Obviously, this is not int
ended! It will cause errors or unexpected behavior, as you can see in the live example below. Try hovering over the link to view the title text! Always include the attribute quotes. It avoids such problems, and results in more readable code. Single or double quotes? In this article you will also notice that the attributes are wrapped in double quotes. However, you might see single quotes in some H...
Structuring a page of content - Learn web development
footer containing copyright information and credits. You need to add a suitable wrapper for: The header The navigation menu The main content The welcome text The image sidebar The footer You should also: Apply the provided CSS to the page by adding another <link> element just below the existing one provided at the start. Hints and tips Use the W3C Nu HTML Checker to catch unint
ended mistakes in your HTML, CSS, and SVG -- mistakes you might have otherwise missed -- so that you can fix them. You don't need to know any CSS to do this assessment; you just need to put the provided CSS inside an HTML element. The provided CSS is designed so that when the correct structural elements are added to the markup, they will appear green in the rendered page. If you are getting stuck an...
Adding vector graphics to the Web - Learn web development
solution, so that solution is not saved over the user code if(solution.value === 'Show solution') { userEntry = textarea.value; } else { solutionEntry = textarea.value; } updateCode(); }; Summary This article has provided you with a quick tour of what vector graphics and SVG are, why they are useful to know about, and how to include SVG inside your webpages. It was never int
ended to be a full guide to learning SVG, just a pointer so you know what SVG is if you meet it in your travels around the Web. So don't worry if you don't feel like you are an SVG expert yet. We've included some links below that might help you if you wish to go and find out more about how it works. In the last article of this module we will explore responsive images in detail, looking at the tools HT...
Images in HTML - Learn web development
orting 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 recomm
ended -- title has a number of accessibility problems, mainly based around the fact that screen reader support is very unpredictable and most browsers won't show it unless you are hovering with a mouse (so e.g. no access to keyboard users). If you are interested in more information about this, read The Trials and Tribulations of the Title Attribute by Scott O'Hara. It is better to include such support...
Responsive images - Learn web development
s a set number of pixels wide and a set number of pixels tall, as we saw when we looked at vector graphics). This is called the resolution switching problem. Conversely, it is unnecessary to display a large image on a screen significantly smaller than the size it was meant for. Doing so can waste bandwidth; in particular, mobile users don't want to waste bandwidth by downloading a large image int
ended for desktop, when a small image would do for their device. Ideally, you would have multiple resolutions available and serve the appropriate size depending upon the device accessing the data on the website. To make things more complicated, some devices have high resolution screens that need larger images than you might expect to display nicely. This is essentially the same problem, but in a sligh...
Video and audio content - Learn web development
ised not to use autoplaying video (or audio) on your sites, because users can find it really annoying. loop Makes the video (or audio) start playing again whenever it finishes. This can also be annoying, so only use if really necessary. muted Causes the media to play with the sound turned off by default. poster The URL of an image which will be displayed before the video is played. It is int
ended to be used for a splash screen or advertising screen. preload Used for buffering large files; it can take one of three values: "none" does not buffer the file "auto" buffers the media file "metadata" buffers only the metadata for the file You can find the above example available to play live on Github (also see the source code.) Note that we haven't included the autoplay attrib...
Structuring the web with HTML - Learn web development
ld have at least basic familiarity with using computers and using the web passively (i.e. just looking at it, consuming the content). You should have a basic work environment set up as detailed in Installing basic software, and understand how to create and manage files, as detailed in Dealing with files -- both are parts of our Getting started with the web complete beginner's module. It is recomm
ended that you work through Getting started with the web before attempting this topic, however, it isn't absolutely necessary; much of what is covered in the HTML basics article is also covered in our Introduction to HTML module, albeit in a lot more detail. After learning HTML, you can then move on to learning about more advanced topics such as: CSS, and how to use it to style HTML (for example al...
Introduction to events - Learn web development
oking at the fixed result in show-video-box-fixed.html (also see the source code here). Note: Why bother with both capturing and bubbling? Well, in the bad old days when browsers were much less cross-compatible than they are now, Netscape only used event capturing, and Internet Explorer used only event bubbling. When the W3C decided to try to standardize the behavior and reach a consensus, they
ended up with this system that included both, which is the one modern browsers implemented. Note: As mentioned above, by default all event handlers are registered in the bubbling phase, and this makes more sense most of the time. If you really want to register an event in the capturing phase instead, you can do so by registering your handler using addEventListener(), and setting the optional third p...
Making decisions in your code — conditionals - Learn web development
not necessarily a bad thing, but it might not be what you want -- often you want to run one block of code or the other, not both. As a final point, you may sometimes see if...else statements written without the curly braces, in the following shorthand style: if (condition) code to run if condition is true else run some other code instead This is perfectly valid code, but using it is not recomm
ended -- it is much easier to read the code and work out what is going on if you use the curly braces to delimit the blocks of code, and use multiple lines and indentation. A real example To understand this syntax better, let's consider a real example. Imagine a child being asked for help with a chore by their mother or father. The parent might say "Hey sweetheart! If you help me by going and doing t...
Fetching data from the server - Learn web development
above. This is achieved by using APIs like XMLHttpRequest or -- more recently -- the Fetch API. These technologies allow web pages to directly handle making HTTP requests for specific resources available on a server and formatting the resulting data as needed before it is displayed. Note: In the early days, this general technique was known as Asynchronous JavaScript and XML (AJAX), because it t
ended to use XMLHttpRequest to request XML data. This is normally not the case these days (you'd be more likely to use XMLHttpRequest or Fetch to request JSON), but the result is still the same, and the term "Ajax" is still often used to describe the technique. The Ajax model involves using a web API as a proxy to more intelligently request data rather than just having the browser reload the entire...
Manipulating documents - Learn web development
er Network'; We should also change the URL the link is pointing to, so that it doesn't go to the wrong place when it is clicked on. Add the following line, again at the bottom: link.href = 'https://developer.mozilla.org'; Note that, as with many things in JavaScript, there are many ways to select an element and store a reference to it in a variable. Document.querySelector() is the recomm
ended modern approach, which is convenient because it allows you to select elements using CSS selectors. The above querySelector() call will match the first <a> element that appears in the document. If you wanted to match and do things to multiple elements, you could use Document.querySelectorAll(), which matches every element in the document that matches the selector, and stores references to them in ...
Video and Audio APIs - Learn web development
. On the second click, the button will be toggled back again -- the "play" icon will be shown again, and the video will be paused with HTMLMediaElement.pause(). Stopping the video Next, let's add functionality to handle stopping the video. Add the following addEventListener() lines below the previous one you added: stop.addEventListener('click', stopMedia); media.addEventListener('
ended', stopMedia); The click event is obvious -- we want to stop the video by running our stopMedia() function when the stop button is clicked. We do however also want to stop the video when it finishes playing -- this is marked by the
ended event firing, so we also set up a listener to run the function on that event firing too. Next, let's define stopMedia() -- add the following function be...
Arrays - Learn web development
n() you can specify different separators, whereas toString() always uses a comma. (Try running Step 4 with a different character than a comma.) let dogNames = ['Rocket','Flash','Bella','Slugger']; dogNames.toString(); // Rocket,Flash,Bella,Slugger Adding and removing array items We've not yet covered adding and removing array items -- let us look at this now. We'll use the myArray array we
ended up with in the last section. If you've not already followed that section, create the array first in your console: let myArray = ['Manchester', 'London', 'Liverpool', 'Birmingham', 'Leeds', 'Carlisle']; First of all, to add or remove an item at the end of an array we can use push() and pop() respectively. Let's use push() first -- note that you need to include one or more items that you want ...
Test your skills: Strings - Learn web development
d available string properties/methods to trim down the original quote to "I do not like green eggs and ham.", and store it in a variable called revisedQuote. 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. Strings 3 In the next string task, you are given the same quote that you
ended up with in the previous task, but it is somewhat broken! We want you to fix and update it, like so: Change the casing to correct sentence case (all lowercase, except for upper case first letter). Store the new quote in a variable called fixedQuote. In fixedQuote, replace "green eggs and ham" with another food that you really don't like. There is one more small fix to do -- add a full stop on...
Working with JSON - Learn web development
. Use another 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 app
ended is important, 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 ...
The business case for web performance - Learn web development
tors (KPI) as objectives can hiltie performance objectives that are also business objectives. KPIs can be both a set of important 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 int
ended action, such as completing a purchase or signing up for a newsletter. When a business site is slow, it can prevent users from completing their int
ended task. This can lead to low conversion rates. Time on Site The average time that your users in aggregate spend on your site. When a site performance slowly, users are more likely to abandon the site prematurely which can lead to low time on site...
Introduction to the server side - Learn web development
ferences and information -- for example reusing stored credit card details to streamline subsequent payments. It can even allow interaction with users of the site, sending notifications and updates via email or through other channels. All of these capabilities enable much deeper engagement with users. In the modern world of web development, learning about server-side development is highly recomm
ended. What is server-side website programming? Web browsers communicate with web servers using the HyperText Transfer Protocol (HTTP). When you click a link on a web page, submit a form, or run a search, an HTTP request is sent from your browser to the target server. The request includes a URL identifying the affected resource, a method that defines the required action (for example to get, delete, ...
Server-side web frameworks - Learn web development
eating web apps with similar constraints. For example, Django was created to support development of a newspaper website, so it's good for blogs and other sites that involve publishing things. By contrast, Flask is a much lighter-weight framework and is great for creating web apps running on embedded devices. Opinionated vs unopinionated: An opinionated framework is one in which there are recomm
ended "best" ways to solve a particular problem. Opinionated frameworks tend to be more productive when you're trying to solve common problems, because they lead you in the right direction, however they are sometimes less flexible. Batteries included vs. get it yourself: Some web frameworks include tools/libraries that address every problem their developers can think "by default", while more lightwe...
Server-side website programming - Learn web development
l of these using different static pages would be extremely inefficient, so instead such sites display static templates (built using HTML, CSS, and JavaScript), and then dynamically update the data displayed inside those templates when needed, such as when you want to view a different product on Amazon. In the modern world of web development, learning about server-side development is highly recomm
ended. Learning pathway Getting started with server-side programming is usually easier than client-side development, because dynamic websites tend to perform a lot of very similar operations (retrieving data from a database and displaying it in a page, validating user-entered data and saving it in a database, checking user permissions and logging users in, etc.), and are constructed using web framewo...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
functionality in our app. Here we'll get the todo counter to update to show the correct number of todos still to complete, and correctly apply styling to completed todos (i.e. where the checkbox has been checked). We'll also wire up our "Clear completed" button. Along the way, we'll learn about using conditional rendering in our templates. Prerequisites: At minimum, it is recomm
ended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To continue our learning about components classes, start looking at conditional rendering, and ...
Ember interactivity: Events, classes and state - Learn web development
orks Next At this point we'll start adding some interactivity to our app, providing the ability to add and display new todo items. Along the way, we'll look at using events in Ember, creating component classes to contain JavaScript code to control interactive features, and setting up a service to keep track of the data state of our app. Prerequisites: At minimum, it is recomm
ended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn how to create component classes and use events to control interactivity, and keep trac...
Ember resources and troubleshooting - Learn web development
Previous Overview: Client-side JavaScript frameworks Next Our final Ember article provides you with a list of resources that you can use to go further in your learning, plus some useful troubleshooting and other information. Prerequisites: At minimum, it is recomm
ended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To provide further resource links and troubleshooting information. Further resources Ember.JS Guides Tutorial: Super Rentals Ember.JS API Documentation Ember.JS Discord S...
Routing in Ember - Learn web development
Previous Overview: Client-side JavaScript frameworks Next In this article we learn about routing, or URL-based filtering as it is sometimes referred to. We'll use it to provide a unique URL for each of the three todo views -- "All", "Active", and "Completed". Prerequisites: At minimum, it is recomm
ended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn about implementing routing in Ember. URL-based filtering Ember comes with a routing system that has a tight integration with the browser URL. T...
Ember app structure and componentization - Learn web development
Previous Overview: Client-side JavaScript frameworks Next In this article we'll get right on with planning out the structure of our TodoMVC Ember app, adding in the HTML for it, and then breaking that HTML structure into components. Prerequisites: At minimum, it is recomm
ended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn how to structure an Ember app, and then break that structure into components. Planning out the layout of the TodoMVC app In the last article we set up a new Ember project...
Starting our Svelte Todo list app - Learn web development
start developing our To-Do list app features, which we'll go on to in subsequent articles. We want our users to be able to browse, add and delete tasks, and also to mark them as complete. This will be the basic functionality that we'll be developing in this tutorial series, plus we'll look at some more advanced concepts along the way too. Prerequisites: At minimum, it is recomm
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: To learn how to create a Svelte component, render it inside another component, pass data into it using props, and save its state. Code along with us Git Clo...
Componentizing our Svelte app - Learn web development
Client-side JavaScript frameworks Next In the last article we started developing our Todo list app. The central objective of this article is to look at how to break our app into manageable components and share information between them. We'll componentize our app, then add more functionality to allow users to update existing components. Prerequisites: At minimum, it is recomm
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: To learn how to break our app into components and share information among them. Code along with us Git Clone the github repo (if you haven't already done it...
Deployment and next steps - Learn web development
avaScript frameworks In the previous article we learning about Svelte's TypeScript support, and how to use it to make your application more robust. 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 recomm
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 porti...
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
his article we will add the app's final features and further componentize our app. We will learn how to deal with reactivity issues related to updating objects and arrays. To avoid common pitfalls, we'll have to dig a little deeper into Svelte's reactivity system. We'll also look at solving some accessibility focus issues, and more besides. Prerequisites: At minimum, it is recomm
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 some advanced Svelte techniques involving solving reactivity issues, keyboard accessibility problems to do with component lifecycle, and more. We'll foc...
Working with Svelte stores - Learn web development
ced techniques for dealing with reactivity, working with DOM nodes, and exposing component functionality. 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. Prerequisites: At minimum, it is recomm
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 use Svelte stores Using stores we will create an Alert component that shows notifications on screen, which can receive messages from any componen...
Dynamic behavior in Svelte: working with variables and props - Learn web development
ous Overview: Client-side JavaScript frameworks Next Now that we have our markup and styles ready we can start developing the required features for our Svelte To-Do list app. In this article we'll be using variables and props to make our app dynamic, allowing us to add and delete todos, mark them as complete, and filter them by status. Prerequisites: At minimum, it is recomm
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 and put into practice some basic Svelte concepts, like creating components, passing data using props, render JavaScript expressions into our markup, modify the...
Getting started with Vue - Learn web development
rary like JQuery to Vue. With this method, you can use a lot of the core features of Vue, such as the attributes, custom components, and data-management. Development Script (Unoptimized, but includes console warnings. Great for development <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> Production Script (Optimized version, minimal console warnings. It is recomm
ended that you specify a version number when including Vue on your site so that any framework updates do not break your live site without you knowing.) <script src="/static/external/29/29296ccacaa9ed35ed168fc51e36f54fd6f8db9c7786bbf38cc59a27229ba5c2.svg"></script> However, this approach has some limitations. To build more complex apps, you'll want to use the Vue NPM package. This will let you us...
Understanding client-side JavaScript frameworks - Learn web development
e end of our React journey (for now at least), we'll add the finishing touches to the main areas of functionality in our Todo list app. This includes allowing you to edit existing tasks and filtering the list of tasks between all, completed, and incomplete tasks. We'll look at conditional UI rendering along the way. 6. Accessibility in React In our final tutorial article, we'll focus on (pun int
ended) accessibility, including focus management in React, which can improve usability and reduce confusion for both keyboard-only and screen reader users. 7. React resources Our final article provides you with a list of React resources that you can use to go further in your learning. Ember tutorials Note: Ember tutorials last tested in May 2020, with Ember/Ember CLI version 3.18.0. If you need ...
Git and GitHub - Learn web development
ing a terminal window. In fact, it is probably useful for you to get to know at least the basics of git terminal commands, even if you intend to use a GUI. A GitHub account. If you haven't already got one, sign up now using the provided link. In terms of prerequisite knowledge, you don't need to know anything about web development, Git/GitHub or VCSes to start this module. However, it is recomm
ended that you know some coding so that you have reasonable computer literacy, and some code to store in your repositories! It is also preferrable that you have some basic terminal knowledge, so for example moving between directories, creating files, and modifying the system PATH. Note: Github is not the only site/toolset you can use with Git. There are other alternatives such as GitLab that you cou...
Mozilla accessibility architecture
es for the directory structure: Interfaces, both internally-used cross-platform and toolkit-specific interfaces exist in accessible/public. The implementations for each kind of object (document, text, table, edit box, button, etc.) exist in accessible/src. Code and interfaces for specific toolkits should go in the appropriate directoy. Toolkit specific implementations should have "Wrap" app
ended to the class name. For example, document specific code for each toolkit goes in nsDocAccessibleWrap: public nsDocAccessible. Directory Purpose accessible/public common interfaces shared by all toolkits accessible/public/msaa Custom COM interfaces that we use to extend MSAA's IAccessible accessible/public/atk ...
Accessibility information for UI designers and developers
rtunity to review the input before submitting it. Use default controls Controls that are built into browsers come with a lot of accessibility for free. For example, the select element displays an ideal mobile interface on mobile operating systems like Android and iOS. On desktop with a keyboard, it lets people type a character, say 'K', to jump directly to options starting with 'K'. It is recomm
ended to use native controls, visibly or under the hood. Links vs buttons To keep your interface in line with user expectations, use links for interactions that go somewhere (on the current page or another page) and buttons for interactions that do something (like submit a form or open an overlay). Links can be styled as buttons and vice versa, but designers are advised to avoid this where possible.
Embedding API for Accessibility
ased on the URL. If we can find a clean way to present it to the user, this would be extremely useful. For example, settings per URL would allow a user to accept scripts from their known benign web pages, but not others. Users may want similarity abilities with applets, background images, style sheets, etc. We have a permissions system for cookies and images based on URL's. Perhaps it can be ext
ended to store accessibility preferences. This is a UI issue we'll need to settle before we know where to go with the embedding accessibility interface. ...
Gecko info for Windows accessibility vendors
ormation is provided, in a format that reads "L#, n of m with c" where # represents the level that the outline item is at, and c represents the number of children. The n of m position relates to the position within the current outline level. Finally, true descriptions are now exposed with the text "Description: " prepending the description. This makes it clear that the description is truly int
ended to be read. Neither "Description:" or "of" in the above strings is ever localized, so they should be parsed out. DHTML Accessibility is Supported This means that you may encounter roles that are not typically in HTML content. Be prepared for new combinations of roles and states in content, such as ROLE_SLIDER, ROLE_PROGRESSBAR and STATE_REQUIRED. In addition, check the STATE_FOCUSABLE...
Information for users
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 keyboards. Planning Ahead for Accessibility This document is int
ended to help testers and designers understand and plan what still needs to be added to our UI for full usable accessibility. Please give us feedback on the discussion list! Firefox Accessibility skins and themes At the excellent Access Firefox website, you will find many valuable resources, including a list of Firefox themes that have been specially designed for those with low vision: them...
Links and Resources
ge accessibility validation service that identifies accessibility errors and reports accessibility warnings about webpage related to Section 508 standards and/or the WCAG guidelines. HTML advanced validator (Firefox extension) by Marc Gueury This advanced HTML Validator (based on W3C Tidy and on OpenSP for SGML validation - just like W3C HTML validator) is a free, powerful, versatile, ext
ended HTML validator. It can work offline. It can also report accessibility errors and warnings according to selectable accessibility guidelines (Section 508, WCAG Priorities 1, 2 or 3). Its accessibility report is viewable in the View Source window. This HTML advanced validator may also be downloaded from Firefox Add-ons: HTML Validator. Open Source Assistive Technology Projects NonVisual D...
Adding phishing protection data providers
n 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.reportGenericURL Not currently used; int
ended for use in reporting other issues with the phishing protection service. browser.safebrowsing.provider.idnum.reportErrorURL An URL to which the user is directed in order to report a safe page that is incorrectly being reported as a phishing site. browser.safebrowsing.provider.idnum.reportPhishURL An URL to which the user is directed in order to report a phishing site that isn't detected ...
What to do and what not to do in Bugzilla
the bug, it may be reopened only if the original reporter provides more info, or confirms someone else's steps to reproduce. If the bug is long, when enough info is provided a new bug should be filed and the original bug marked as a duplicate of it. Resolving bugs as INVALID You should resolve a bug as INVALID if the issue described in the bug is clearly not a Mozilla bug or if the issue is int
ended behavior. The exceptions are bugs in other software which we have to work around and bugs that involve certain core Gecko modules. Bugs covered by this exception should not be INVALIDated by anyone other than the module owner or module peer; for bugs involving modules like Layout or Content, attach a test case to the bug and then CC one of the owners or peers. Reports of problems with specific we...
Creating MozSearch plugins
It should only be used if your intention is to distribute the search plugin packaged in a Firefox extension, or if you are creating plugins meant to be shipped by default in a Firefox build. ...
Debugging JavaScript
It should give pointers to tools, aids and tricks which make debugging your code easier. Web Console This is the first place to go when you're debugging a web page; open the Web console using the Web Console option in the Web Developer menu. This shows any JavaScript errors in your app, as well as any logging calls from the console API. Browser Console The Browser Console lets you see all JavaScript errors and logging in the browser, including from Firefox code. ...
Debugging on Windows
e directory where Visual Studio caches downloaded symbols; in VC++ 10 open the menu to Tools > Options > Debugging > Symbols and copy the field "Cache symbols in this directory". In a command window, run symchk.exe /r C:\windows\SysWOW64\ /s "SRV*<your cache symbols directory>\MicrosoftPublicSymbols*http://msdl.microsoft.com/download/symbols" Note the "\MicrosoftPublicSymbols" app
ended to the cache directory configured in Visual Studio. Downloading all symbols can take a long time; you can replace C:\windows\SysWOW64\ with the name of a single .DLL to download symbols only for the specific libraries you are trying to debug. Unfortunately, it's hard to know which symbols to download without having VS hang and seeing the "Downloading symbols for <library>" status at the bo...
Makefile - variables
] Inhibit Makefile.in deps that would allow $obj/Makefile to be generated. NO_SUBMAKEFILE_RULE [pending/redundant?] Inhibit Makefile generation within subdirectories. NO_ Variable Description NO_PROFILE_GUIDED_OPTIMIZE Inhibit PGO builds NO_DIST_INSTALL Note: Values will be app
ended to the EXPORT variable when present. OS_ Variable Description OS_ARCH Platform type OS_TARGET Target binary type if building on an intermediate platform(building mobile binaries on GNU/Linux). HOST_ Variable Description HOST_CMSRCS A list of .m sources to compile ...
How Mozilla's build system works
pers who need to work on Mozilla's build system. The contents below will explain the basic concepts and terminology of the build system and how to do common tasks such as compiling components and creating jar files. For many developers, typing mach build to build the tree is sufficient to work with the source tree. This document explains how the build system works. Note: This document is not int
ended for developers who just want to build Mozilla. For that, see the Build Documentation. Phases When you type mach build to build the tree, three high-level phases occur within the build system: System detection and validation Preparation of the build backend Invocation of the build backend Phase 1: configure Phase 1 centers around the configure script. The configure script is a bash shell...
Simple SeaMonkey build
You can build a bleeding-edge, development version of SeaMonkey using the commands below. For complete information, see the build documentation. Build prerequisites Hardware Requirements: The SeaMonkey build process is both I/O- and CPU-intensive, and can take a long time to build even on modern hardware. Minimum and recomm
ended hardware requirements for Mozilla development are: Recomm
ended: 8GB of RAM (having only 4GB RAM and 4GB swap may give memory errors during compile) 35 GB free disk space. This will accomodate Visual Studio 2013 Community Edition, the required SDKs, the MozillaBuild package, the Mercurial source repository and enough free disk space to compile. A fast SSD is recomm
ended; the Firefox build process is I/O-intensive. High speed internet Installing build to...
pymake
pport it) are an implementation of the make tool which are mostly compatible with makefiles written for GNU make. 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 recomm
ended. 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. Note: On Windows, you must take special care to be able to switch back and forth between gmake and pymake on the same object dir. See Gmake vs. Pymake for more information. Anywhere you would normally type make, instead type python /path/to/srcdir/bu...
The Firefox codebase: CSS Guidelines
viour. CSS selectors When targetting the root element of a page, using :root is the most performant way of doing so. Reflows and style flushes See Performance best practices for Firefox front-end engineers for more information about this. Misc Text aliasing When convenient, avoid setting the opacity property on text as it will cause text to be aliased differently. HDPI support It's recomm
ended to use SVG since it keeps the CSS clean when supporting multiple resolutions. See the SVG Guidelines for more information on SVG usage. However, if only 1x and 2x PNG assets are available, you can use this @media query to target higher density displays (HDPI): @media (min-resolution: 1.1dppx) ...
Callgraph
This can be used for performing static analysis based on the relationship between functions and methods. For instance, given the C++ code: int foo() { return good(); } int good() { return evil() ? 0 : 1; } The callgraph would be foo() -> good() -> evil(). Given the knowledge that evil() does evil things, one could then determine foo() also does evil things. The Callgraph project uses gcc and Treehydra to generate information about function and method calls at compile time, and aggregates it into a sqlite database. ...
ESLint
You can limit running it to a specific directory with: ./mach lint -l eslint browser/components Or work directory changes: ./mach lint -l eslint -w Or outgoing commits only: ./mach lint -l eslint -o See ./mach eslint --help for more options when running eslint. VCS Hooks Hooks are available for Mercurial & Git, see using a vcs hook for more details. Editor Integration It is highly recomm
ended that you integrate eslint into your editor. This lets you see errors in real time, and can help you fix issues before you compile or run tests, reducing the time to develop patches. See the ESLint user guide for which plugins to install in your editor. Prior to Firefox 55 the location for the eslint binary used to be tools/lint/eslint/node_modules/.bin, since Bug 1305023, node_modules is now l...
Eclipse CDT
anced code assistance (inheritance/call graph explorer, jump to definition, refactoring, autocomplete, syntax highlighting, and so on). System requirements Eclipse will use a lot of memory to fully index the Mozilla source tree to provide code assistance features (easily 4 GB of RAM, although this will drop to just over 1 GB if you restart after indexing is complete). Therefore, it is not recomm
ended for use if your machine only has 4 GB of RAM. Installing Eclipse Regarding llvm4eclipsecdt, do not install or select this toolchain for Mozilla development. This plugin is int
ended mainly for managed projects but we use an unmanaged project for Mozilla (since it has its own build system). Using this plugin will result in parts of the UI described below being hidden or disabled. Download "Ecl...
Interface Compatibility
nd 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 supported: all @status markings have been removed, and extensions that use binary components will need to recompile for each major version they wish to support. JS-ctypes is the recomm
ended 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 support 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...
Listening to events on all tabs
d for future use. aStatus Error status code associated with the state change; this indicates whether or not the request was successful. This parameter should be ignored unless aStateFlags includes the STATE_STOP bit. NOTE: aStatus may be a success code even for server generated errors, such as the HTTP 404 File Not Found error. In such cases, the request itself should be queried for ext
ended error information (e.g., for HTTP requests see nsIHttpChannel). onStatusChange Notification that the status of a request has changed. The status message is int
ended to be displayed to the user (e.g., in the status bar of the browser). void onStatusChange( nsIDOMXULElement aBrowser, nsIWebProgress aWebProgress, nsIRequest aRequest, nsresult aStatus, PRUnichar *aMessage ); Parameters ...
Displaying Places information using views
Here's the bridge! result.addObserver(view.QueryInterface(Components.interfaces.nsINavHistoryResultObserver)); tree.view = view.QueryInterface(Components.interfaces.nsITreeView); In fact this is how the built-in tree view works. It runs code similar to the above when you set its place property or call its load method. While you are free to set up your tree view in this manner, it's not recomm
ended if you are using the built-in view. Doing so circumvents updating the view's place attribute, causing it to fall out of sync with the view's query result. Use the view's load method or place property instead and let it do the work for you. If, on the other hand, you are writing a custom tree view, you will need to write similar code at some point. Menu view You can display Places information in...
Experimental features in Firefox
like making it available on contenteditable content. See also bug 1205133 for details. Release channel Version added Enabled by default? Nightly 75 Yes Developer Edition 75 No Beta 75 No Release 75 No Preference name dom.forms.inputmode <link rel="preload"> The <link> element's rel attribute is int
ended to help provide performance gains by letting you download resources earlier in the page lifecycle, ensuring that they're available earlier and are less likely to block page rendering. Read Preloading content with rel="preload" for more details. For more details on the status of this feature, see bug 1639607. Release channel Version added Enabled by default? Nightly ...
Message manager overview
the GPPMM, you can broadcast messages to the CIPMM and all CPMMs. With a PPMM, you can send a message to its corresponding CPMM. With a CPMM, you can send messages to the parent process: these messages are received first by the corresponding PPMM, then by the GPPMM. From Firefox 38 onwards, you can also use a parent process message manager to load a script into a child process. This is the recomm
ended way to load a script that executes just once per child process, which is something you might want to do if you are interacting with some global service (for example, adding listeners to observer notifications or registering a content policy). Parent process Global parent process message manager Description The global parent process message manager (GPPMM) is global to the pare...
Process scripts
Chrome-privileged pages or things running in the parent process may require special treatment. If the above doesn't work try this: function contentMMFromContentWindow_Method2(aContentWindow) { return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDocShell) .Qu...
Message manager overview
rs: With the GPPMM, you can broadcast messages to all CPMMs. With a PPMM, you can send a message to its corresponding CPMM. With a CPMM, you can send messages to the parent process: these messages are received first by the corresponding PPMM, then by the GPPMM. From Firefox 38 onwards, you can also use a parent process message manager to load a script into a child process. This is the recomm
ended way to load a script that executes just once per child process, which is something you might want to do if you are interacting with some global service (for example, adding listeners to observer notifications or registering components). Accessing process message managers You can access the global parent process manager with code like this: // parent process let parentProcessMessageManager = Cc...
HTMLIFrameElement.executeScript()
equest = instanceOfHTMLIframeElement.executeScript(script, options); Return value A DOMRequest object that returns an onsuccess handler if the script is successfully executed against the loaded content, or an onerror handler if not. Parameters script The script to be executed. options Optional Optionally, you can provide an origin or URL for the script to be executed against. It's recomm
ended that you include an origin or URL, in order to ensure that the script is being executed in the expected context: origin: an origin, e.g. http://example.com url: a URL, e.g. http://example.com/index.html Note: The options parameter does not currently seem to have much effect. The script seems to execute even if a URL/origin is specified. Examples var request1 = browser.executeScrip...
mozbrowsersecuritychange
tracking_content: Indicates that the tracking content has been blocked from loading. mixedState A DOMString representing the current loading state of mixed active content. Possible values are: loaded_mixed_active_content: Indicates that the mixed active content has been loaded. blocked_mixed_active_content: Indicates that the mixed active content has been blocked from loading. ext
endedValidation A Boolean indicating if the current SSL certificate is an Ext
ended Validation certificate (true) or not (false). trackingContent A Boolean indicating if tracking content is present on the current page (true) or not (false). mixedContent A Boolean indicating if mixed content is present on the current page (true) or not (false). Example var browser = document.querySelector("iframe...
Browser API
t 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 support the requirement of a browser <iframe>, the HTMLIFrameElement DOM interface has been ext
ended 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 reloading of the <iframe> element content. HTMLIFrameElement.stop() Allows stopping of the <iframe>...
Embedding the editor
g solution that will fulfill them. Finally, steps towards that final solution are described. Embedding applications Here are some embedding scenarios that 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 int
ended 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 support 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 funct...
Embedding Tips
er::GetInterface (or the do_GetInterface() helper method). How do I save a document or data to disk? Query for the nsIWebBrowserPersist interface implemented on the web browser object and call the saveURI() or saveDocument() methods on that. Alternatively, create a standalone webbrowser persist object and call the nsIWebBrowserPersist interface on that to save URIs and documents. This is recomm
ended if you intend anything other than the uri or document your browser is looking at. Register your own nsIWebProgressListener object to listen for progress and state notifications. How do I save / upload a document / data to a web or ftp site? Again, use the webbrowser persist object, but specify a remote location as the target URI. Your web progress listener must also implement nsIAuthPrompt if ...
Gecko SDK
as the XULRunner SDK, is a set of XPIDL files, headers and tools to develop XPCOM components which can then in turn e.g. be accessed from XUL using JavaScript. Note that in order to develop such components, you do not need the full sources of e.g. Firefox, since you do not access parts of the front end from within a component. Furthermore, since a component contains basic functionality, it is int
ended to run with every product of the Mozilla platform. Therefore it makes no sense to use a particular product to build general functionality. That's the reason why the Gecko SDK was devised. Do not confuse the Gecko/XULRunner SDK with XULRunner itself. The Gecko SDK is a collection of header files and tools used to develop general XPCOM components which add functionality to the existing platform, w...
HTML parser threading
runnable is dispatched to the parser thread to call to mark the parser uninterrupted and to call nsHtml5StreamParser::ParseAvailableData() on the parser thread. mTokenizerMutex is released. Speculative Loads When the tree builder on the parser thread encounters HTML script, stylesheet link, video (with a poster frame), base or img or SVG script, style or image elements, preload operations are app
ended to a speculative load queue. There speculative load operations are flushed to the main thread (via the staging area) whenever tree ops are flushed and also whenever nsHtml5StreamParser::ParseAvailableData() is about to stop working. That is, when the parser thread is parsing speculatively, speculative loads continue to be flushed to the main thread even though tree ops accumulate into the specula...
Script security
er front end in JavaScript has benefits: it can be much quicker to develop in JavaScript than in C++, and contributors do not need to learn C++. However, JavaScript is a highly dynamic, malleable language, and without help it's difficult to write system-privileged code that interacts safely with untrusted web content. From the point of view of chrome code, the script security model in Gecko is int
ended to provide that help to make writing secure, system-privileged JavaScript a realistic expectation. Security policy Gecko implements the following security policy: Objects that are same-origin are able to access each other freely. For example, the objects associated with a document served from https://example.org/ can access each other, and they can also access objects served from https://exa...
Getting from Content to Layout
ndingRestyles hashtable. A list of restyle roots (places in the content tree where all descendants need to be restyled but nothing on the parent chain does) are also stored. The restyles accumulated in the RestyleTracker are dispensed with from various method on the PresShell that involve reflow and flushing notifications. Frame Construction Regardless of whether content nodes are inserted/app
ended/deleted, frames can be created and destroyed, based on whatever is optimal for the changes in the content tree. "Frame construction items" are queued for each change. These items are then examined in relation to the location in the content tree that is being modified and either the relevant frames are created/destroyed or the logic moves up to the parent frame. To give a trivial example of whe...
How to add a build-time test
be a list of subdirectories of the current directory which contain xpcshell tests. You can of course just use the onetests_type directory here, but if you want to subdivide your tests by functionality, separate directories is the way to go. Reference the test dir in a parent makefile (<tt>yourmoduledir/Makefile.in</tt>): ifdef ENABLE_TESTS DIRS += tests_type endif (Optional, but recomm
ended) Add the new makefile to allmakefiles.sh (TODO: need more details about this) Reconfigure (e.g. with <tt>make -f client.mk configure</tt>) make/make check in <tt>yourmodule</tt> ...
How to Report a Hung Firefox
If that's not you, or you just want to fix a Firefox hang without reporting 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. ...
IME handling guide
underline is called "selected clause"). Basically, composition string and each clause style is rendered by Gecko. And the drop down menu is created by IME. Each clause is represented with selection in the editor. From chrome script, you can check it with nsISelectionController. In native code, you can access it with either nsISelectionController or mozilla::SelectionType (the latter is recomm
ended because of type safer). And editor sets these IME selections from mozilla::TextRangeType which are sent by mozilla::WidgetCompositionEvent as mozilla::TextRangeArray. Following table explains the mapping between them. Selection types of each clause of composition string or caret nsISelectionController mozilla::SelectionType mozilla::TextRangeType Caret SELECTI...
IPDL Best Practices
Lifetime Management Ensure IPDL deletes your protocol All protocols must be deleted. Period. Are you sending the __delete__ message to trigger protocol deletion? This one is easy to miss, as the corresponding Recv__delete__ function has a stub implementation automatically generated in the base class. Simply calling delete on a pointer to an actor is not enough. ...
Integrated Authentication
e 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 supports a whitelist of sites that are permitted to engage in SPNEGO authentication with the browser. This list is int
ended 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); where, site-list is a comma-separated list of URL prefixes or domains of the form: site-list = "mydomain.com, https:...
JavaScript-DOM Prototypes in Mozilla
nstructor, we also want users to be able to extend interfaces, like Node. Node is a DOM interface, but there are no pure Node instances; there are lots of different classes that implement Node (HTMLImageElement, HTMLDocument, ProcessingInstruction, et c.). But the fact that an instance of a Node will never exist in Mozilla does not mean that the Node interface is useless, in fact, Node can be ext
ended just as we've been doing. If you think back to the HTMLImageElement examples above, those examples let you define new properties on all image elements. By modifying the Node top-level object, you can do similar things to all objects that implement Node. This means you can add a property to every node in a DOM tree by doing something like this: Node.prototype.foo = bar; Again, modifying host ob...
Http.jsm
ue is the key and the second is the value. For example: [["key1", "value1"], ["key2", "value2"]]. Submitting post data httpRequest allows attaching data to the post requests. The data can be specified via postData option. postData can be of 2 different types: a string or an array of parameters. When null/undefined is given, no post data will be attached. If a string is given the data will be app
ended to the request as is. In case an array of parameters is given, it will be treated as an array of key-value pairs. The elements of the array will be URL-encoded and "application/x-www-form-urlencoded; charset=utf-8" will be enforced as the content type. Http.jsm only forces the content type if the post data is an Array, and it serializes it automatically. If the provided postdata is a string, the ...
JNI.jsm
ppShell has the fully-qualified class name of org.mozilla.gecko.GeckoAppShell. The signature for this would be Lorg.mozilla.gecko.GeckoAppShell; but we pass here without the L and ;. We can use dot notification here for the parent class. However if it was a subclass such as GeckoInterface (org.mozilla.gecko.GeckoAppShell.GeckoInterface), then this will cause a crash. Therefore, it is always recomm
ended to use slash notation. So for GeckoAppShell we would pass here "org/mozilla/gecko/GeckoAppShell" and for GeckoInterface we would use "org/mozilla/gecko/GeckoAppShell$GeckoInterface". aDeclares optional If this is omitted, then aFullyQualifiedName must be an array type. If this is provided, then aFullyQualifiedName must be a class name. A required object that contains up to five fields of key n...
OS.File for the main thread
ppend: true}).then(valOpen => { console.log('valOpen:', valOpen); var txtToAppend = 'append some text \n'; var txtEncoded = new TextEncoder().encode(txtToAppend); valOpen.write(txtEncoded).then(valWrite => { console.log('valWrite:', valWrite); valOpen.close().then(valClose => { console.log('valClose:', valClose); console.log('successfully app
ended'); }); }); }); Global object OS.File Method overview Promise<File> open(in string path, [optional] in object mode, [optional] in object options); Promise<object> openUnique(in string path, [optional] in object options); Promise<void> copy(in string sourcePath, in string destPath, [optional] in object options); Promise<bool> exists(in string path)...
OSFile.jsm
What are the relationships with the HTML5 File API? None, really. ...
Promise.jsm
the Promises/A+ proposal until Gecko 25: Components.utils.import("resource://gre/modules/commonjs/promise/core.js"); // Gecko 17 to 20 Components.utils.import("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 import this module from the above paths, the recomm
ended way for loading it is through the Add-on SDK loader. Introduction For an introduction to promises, you may start from the Add-on SDK documentation, keeping in mind that only the core subset is implemented in this module. A promise is an object representing a value that may not be available yet. Internally, a promise can be in one of three states: Pending, when the final value is not availa...
Application Translation with Mercurial
will be disabled. You can create translation patches, but creating language packs for the application, binary repacks of the application (changing the localization of the program), and compiling the application likely won't work. You are now in the Mozilla development environment which emulates a Linux environment. Now go to the directory where you want to put the source code. It's highly recomm
ended to put it onto the fastest hard drive in the device. File paths here work starting with a slash (/) followed by the drive letter, and then the directory structure like on Windows, but using slashes (/) instead of backslashes (\). So let's go to C:\Mozilla by typing cd /c/Mozilla/ Create a new directory for the source code: mkdir mozilla-aurora Initialize the new directory as new repository:...
Bootstrapping a new locale
translating the value in the parameters (e.g. Untrusted Connection in the example above), like so (example for Polish): <!ENTITY certerror.pagetitle "Niezaufane polaczenie"> Once you have translated all the <!ENTITY> strings in this file, you should save your work and open the next .dtd or .property file. You will need to go through each and every file to in every directory in ab-CD. Recomm
ended order of localization For recomm
ended order of localization, refer to the localization "phase list" which 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...
Localization content best practices
n entities "useBookmark.label" and "useBookmark.accesskey", if you change to "chooseBookmark.label" due to a string change, change the access key entity to "chooseBookmark.accesskey" to match it. String freeze Some repositories are considered to be string-frozen. This means that string changes are not allowed to land, and each case must be evaluated before landing. As a general rule, it's recomm
ended to fix strings on the trunk/master repository, and create ad-hoc patches for string frozen repositories that don't involve string changes. Note that even removing strings is considered a breakage. In the case of Firefox and Thunderbird, string frozen repositories are: mozilla-aurora, mozilla-beta, mozilla-release. Bugzilla and l10n Do I need l10n feedback? Feedback from l10n-drivers is not ne...
Localizing extension descriptions
ll.rdf and PATH_TO_LOCALIZATION_FILE is the chrome path to the localization file you added to earlier): pref("extensions.EXTENSION_ID.description", "PATH_TO_LOCALIZATION_FILE"); Localizable strings The following add-on metadata can be localized using this process: name description creator homepageURL Localizable lists In cases where multiple values can exist, a numeric index is app
ended to the end of the preference name: extensions.EXTENSION_ID.contributor.1=FIRST_LOCALIZED_CONTRIBUTOR_NAME extensions.EXTENSION_ID.contributor.2=SECOND_LOCALIZED_CONTRIBUTOR_NAME extensions.EXTENSION_ID.contributor.3=THRID_LOCALIZED_CONTRIBUTOR_NAME pref("extensions.EXTENSION_ID.contributor.1", "PATH_TO_LOCALIZATION_FILE"); pref("extensions.EXTENSION_ID.contributor.2", "PATH_TO_LOCALIZATION_FILE...
Localizing extension metadata on addons.mozilla.org
support 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 Question" template, follow the instructions to upload the text of your AMO page. On the Properties page you can specify the location of the worker in order to restrict to people living in the country where the language is spoken. The Reward is up to you, but $5-10 per translation seems to work well. Localization codes AMO offers 33 localizations, including English. Here is a list of the codes: ...
Localizing without a specialized tool
value in the parameters (e.g. Untrusted Connection in the example above), like so (example for Polish): <!ENTITY certerror.pagetitle "Niezaufane polaczenie"> Once you have translated all the <!ENTITY> strings in this file, you should save your work and open the next .dtd or .properties file. You will need to go through each and every file to in every directory in the x-testing directory. Recomm
ended order of localization For recomm
ended order of localization, refer to the localization "phase list" which 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* s...
Patching a Localization
ization directory. cd ~/localization-workdir/gl Create a patch (also known as a diff) using the diff command. hg diff This command creates a patch and lists your modifications through displaying the differences in a unified patch's files. These modifications are printed to stdout (standard output). Visually inspect your modifications. A good patch only contains those changes that you int
ended to make. If it contains more, you'll likely regress something else. Alternatively, you can select specific files for diff to evaluate and print (see below). The command will only print the differences found in the selected files. hg diff browser/chrome/browser/browser.dtd Attach the patch to an existing bug for reference or review or create a new one if one doesn't currently exist. hg ...
Localization prerequisites
you should be just fine, and on Windows, MozillaBuild should get you everything you need. Tools A recent POSIX Shell Python 2.5 or newer. Perl 5.6 or higher Older perl versions may work if you upgrade File::Spec to version 0.8 GNU make 3.79.1 or higher. Other varieties of "make" will not work. autoconf-2.13 - Autoconf 2.5x will not work. zip 2.3 (or higher) Mercurial 1.2 or higher recomm
ended. Needed for development of Firefox 3.5/SeaMonkey 2.0/Thunderbird 3.0 and later. A text editor. You can try one of these: Notepad++ or Notepad2 on Windows, vim, gedit or Kate on GNU/Linux, BBEdit on Mac OS X. To verify that they work, open a shell. Linux users should know, on the Mac, you find Terminal in Applications/Utilities. On Windows, MozillaBuild offers a start-shell-l10...
Release phase
by generating a diff between the new release revision being considered and the previously approved release revision. Focus is still on technical accuracy and completion of L10n work; not translation quality. Release revisions are evaluated, not entire L10n repos. Sign-offs do not need to be approved before revision merge between release channels, although it is recomm
ended. There is a specific process to follow in Bugzilla for requesting these reviews: File a bug requesting the review. Attach your files to the bug. Once attached, open the attachment details. In the attachment details, select the ? from the dropdown menu next to the review flag or the appropriate approval flags (see image). This will display a text box to assign the r...
Translation phase
Mozilla applications and Mozilla websites are essentially the same. This tutorial should provide you with all of the technical information you need to secure and maintain your tool independence. Productization Productization is an essential part of localizing Mozilla products. This is where you research and select the search plugins, content and protocol handlers, bookmarks, and links to recomm
ended sites on the in-product pages that your locale's users will find in their Mozilla products. This tutorial will walk you through performing these productization tasks, creating productization patches, and submitting them for review. << PreviousNext >> ...
Localization technical reviews
e is specified, which is used as description for the built language packs. region.properties Though locales might like to specify changes from the beginning, the region.properties files will be reverted to en-US. Changes will be discussed in productization bugs filed for each locale. Search plugins Similar to the region.properties files, the list.txt file should be reverted to en-US and am
ended accordingly as the search plugin productization bugs are completed. For this initial review, all XML files should be removed. String lengths in pipnss.properties There are some character limits in the security/manager/chrome/pipnss/pipnss.properties file that you should be aware of. It is best to look into each of these files to see if the localizer's strings might be too long. This is somethi...
Creating localizable web applications
part Third part\n"); Snippet 4. Good (even better): # L10n: You can indent lines to your liking. echo _("Long text\n" . "Second part\n" . "Third part\n"); The solution in snippet 3 doesn't allow to use code indentation for "Second part" and "Third part". If you indent "Second part", the resulting string (interpreted by PHP and Gettext) will end up indented as well. It is thus recomm
ended to use the solution from snippet 4. Consider the following example: Snippet 5. Bad indentation: PHP code: # L10n: This will be wrongly indented. echo _("Long text Second part Third part\n"); PHP output: Long text Second part Third part messages.po: #. L10n: This will be wrongly indented. msgid "" "Long text\n" " Second part\n" " Third part\n" ...
Localization formats
Read more about gettext on Wikipedia and on MDC. Wiki Blogging, documentation, and other types of Mozilla...
Writing localizable code
in the cvsroot repository and the ease of localization. Use a good chrome directory structure For a particular module mod, a target path jar:ab-CD.jar!/locale/ab-CD/mod/foo.dtd has been widely tested and is a good place for your files referenced as chrome://mod/locale/foo.dtd. Using a directory structure like this eases the localization process without the source code and is especcially recomm
ended to extension authors. JAR Manifests can make this easy. l10n impact On frozen trees, there is the rule to not check in l10n-impact changes. So what does that mean? l10n-impact is any change to mozilla/@mod@/locales; Localizers find out if they have to catch up on changes by doing bonsai queries, just as everybody else does. No change means that this query result is empty. any changed or new...
MathML Accessibility in Mozilla
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 support is provided by the development version of Orca. We try to keep in sync with WebKit/ATK/Orca developments. At the moment, it is recomm
ended to use a Nightly build to ensure that the accessible tree expected by Orca is correctly exposed. AccessFu: MathML support in Android and Firefox OS is currently being implemented in our AccessFu module and a patch is available on bug 1163374. The table gives the output in mode "utterance" and description spoken last. Note that this is still very experimental. MathML Windows Mac ...
Using the viewport meta tag to control layout on mobile browsers
n these screens, web developers may want to design images - or whole layouts - at a higher scale than their final size and then scale them down using CSS or viewport properties. This is consistent with the CSS 2.1 specification, which says: If the pixel density of the output device is very different from that of a typical computer display, the user agent should rescale pixel values. It is recomm
ended that the pixel unit refer to the whole number of device pixels that best approximates the reference pixel. It is recomm
ended that the reference pixel be the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm's length. For web developers, this means that the size of a page is much smaller than the actual pixel count and browsers may size ...
Mozilla DOM Hacking Guide
ntation, 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 important for the DOM. By "correct behavior", I mean "the int
ended 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 JavaScript and XPConnect. Before we begin the explanation of Class I...
Mozilla Port Blocking
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 (recomm
ended 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 Mozilla's port blocking at Run time Users can modify the default port blocking through the addition of preferences containing comma delimited lists of port numbers to the user.js file (for single users with the user_pref(...) command) in the user'...
DMD
nnec with DMD enabled, you will need to do a few things. First, you will need to push the libdmd.so library to the device so that it can by dynamically loaded by Fennec. You can do this by running: adb push $OBJDIR/dist/bin/libdmd.so /sdcard/ Second, you will need to make an executable wrapper for Fennec which sets an environment variable before launching it. (If you are familiar with the recomm
ended "--es env0" method for setting environment variables when launching Fennec, note that you cannot use this method here because those are processed too late in the startup process. If you are not familiar with that method, you can ignore this parenthetical note.) First make the executable wrapper on your host machine using the editor of your choice. Name the file dmd_fennec and enter this as the co...
Productization guide
The web services that make up the productization of Mozilla software are often specific to a local market. For example, a search provider can deliver a very good quality of search results -- but only in a specific country or language, and we have to take this into account when considering default search engines for a locale. Hence there is a need to customize the set of default web services on a per-locale basis in order to ensure a good user experience across all locales. ...
Profile Manager
regardless of whether this launch option was checked. Locked profiles Some profiles may be shown as locked in the main window. Such profiles are currently being used by an instance of Firefox. If you attempt to perform any operation on a locked profile, you'll get a warning; if you choose to continue despite the warning, you may encounter errors or corrupt a profile. It's strongly recomm
ended to avoid operations on locked profiles. If you need to do something with a locked profile, close the instance of Firefox which is using the profile first. Backing up and restoring profiles Profile Manager offers two different mechanisms for backing up and restoring profiles. Backup folder Profile Manager has a local backup folder where it can manage profile backups. This is the easiest ...
L20n HTML Bindings
<head> ... <script src="l20n.js"></script> </head> Create Manifest Use a localization manifest to define available languages and their resource files. ...
L20n Javascript API
he original language of the Context instance and will be used as the last fallback locale if other locales are registered. If it is undefined, or if registerLocales hasn't been called at all, the Context instance will create 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 app
ended 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 supported by the Context instance. If you don't call this function, L20n will use the built-in Intl.prioritizeLocales negotiator. ctx.registerLocaleNegotiator(function(available, request...
MailNews automated testing
. xpcshell-tests are 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 Ext
ended Framework supports: 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 injectio...
MailNews
or "Mail and Newsgroups". MailNews is the back end of the messaging parts of SeaMonkey and Thunderbird. It provides a number of functions and capabilities, including: Communications protocols - SMTP, POP3, IMAP, NNTP Message Management, including search and filtering Message Composition Address Book The MailNews code lives in the mailnews/ directory of comm-central. AsyncTestUtils ext
ended framework The AsyncTestUtils Ext
ended 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 in...
About NSPR
riables) implemented by NSPR. Additionally, NSPR provides synchronization methods more suited for use by Java. The Java-like facilities include monitor reentrancy, implicit and tightly bound notification capabilities with the ability to associate the synchronization objects dynamically. I/O NSPR's I/O is a slightly augmented BSD sockets model that allows arbitrary layering. It was originally int
ended to export synchronous I/O methods only, relying on threads to provide the concurrency needed for complex applications. That method of operation is preferred though it is possible to configure the network I/O channels as non-blocking in the traditional sense. Network addresses Part of NSPR deals with manipulation of network addresses. NSPR defines a network address object that is Internet Protoc...
NSPR Contributor Guide
es. For purposes of this paper, a "new library" is defined as a libary under the mozilla/nsprpub/lib directory tree and built as a separate library. These libraries exist, for the most part, as "legacy" code from NSPR 1.0. [Note that the current NSPR module owners do not now nor never have been involved with NSPR 1.0.]. Such is life. That said: There are some libraries that implement functions int
ended for use with applications using NSPR, such as ...nsprpub/lib/libc/plgetopt.*. generally useful platform abstractions you agree to sustain, bug fix May rely on the NSPR API May NOT rely on any other library API New Platform Ports all NSPR API items must be implemented platform specific headers in pr/include/md/_platformname.[h!cfg] platform specific code in pr/src/md/platform/*.c make...
NSPR build instructions
ues that are different from most open source projects. If the OS vendor provides a compiler (for example, Sun and HP), NSPR uses that compiler instead of GCC by default. NSPR build generates a debug build by default. --disable-debug --enable-optimize Specify these two options to generate an optimized (release) build. These two options can actually be used independently, but it's not recomm
ended. --enable-64bit On a dual 32-bit/64-bit platform, NSPR build generates a 32-bit build by default. To generate a 64-bit build, 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 ...
Optimizing Applications For NSPR
his has disastrous implications on the generally accepted programming practice of taking the address of a stack variable and giving that address to another thread. Consider that the Windows stack is swapped in and out with each thread switch. The thread that created a stack variable sees his own stack variables correctly across thread switches. However, another thread does not see the data as int
ended because the stack has been swapped out to the shadow stack and the current thread's stack now occupies the Windows stack. This can be difficult to diagnose. For complete cross platform portability, do not take the address of a stack variable and make that address available to another thread. For more details, see the memo on Automatic Addresses. Windows 3.1 does not support 64 bit file offsets.
Atomic Operations
nctions is consistent across all supported 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 recomm
ended that clients use the NSPR API for atomic operations. These functions operate on 32-bit integers: PR_AtomicIncrement PR_AtomicDecrement PR_AtomicSet PR_AtomicAdd These functions implement a simple stack data structure: PR_CreateStack PR_StackPush PR_StackPop PR_DestroyStack ...
Locks
monitor around the data. In general, a monitor is a conceptual entity composed of a mutex, one or more condition variables, and the monitored data. Monitors in this generic sense should not be confused with monitors used in Java programming. In addition to PRLock, NSPR provides another mutex type, PRMonitor, which is reentrant and can have only one associated condition variable. PRMonitor is int
ended for use with Java and reflects the Java approach to thread synchronization. For an introduction to NSPR thread synchronization, including locks and condition variables, see Introduction to NSPR. For reference information on NSPR condition variables, see Condition Variables. Lock Type PRLock Lock Functions PR_NewLock creates a new lock object. PR_DestroyLock destroys a specified lock o...
Long Long (64-bit) Integers
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 supports 64-bit integers. ...
Network Addresses
This chapter describes the NSPR types and functions used to manipulate network addresses. Network Address Types and Constants Network Address Functions The API described in this chapter recognizes the emergence of Internet Protocol Version 6 (IPv6). To facilitate the transition to IPv6, it is recomm
ended 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. Typically, the only numeric declarations required are the well-known port numbers that are part of the PRNetAddr structure. Network Address Types and Constants PRHostEnt PRProtoEnt PR_NETDB_BUF_SIZE Network address func...
PRThreadPriority
. Only one thread at a time typically has this priority. PR_PRIORITY_LAST Placeholder Description In general, an NSPR thread of higher priority has a statistically better chance of running relative to threads of lower priority. However, because of the multiple strategies NSPR uses to implement threading on various host platforms, NSPR priorities are not precisely defined. At best they are int
ended to specify a preference in the amount of CPU time that a higher-priority thread might expect relative to a lower-priority thread. This preference is still subject to resource availability and must not be used in place of proper synchronization. See Also Setting Thread Priorities. ...
PR_CALLBACK
Used to define pointers to functions that will be implemented by the client but called from a (different) shared library. Syntax #include <prtypes.h>type PR_CALLBACKimplementation Description Functions that are implemented in an application (or shared library) that are int
ended to be called from another shared library (such as NSPR) must be declared with the PR_CALLBACK attribute. Normally such functions are passed by reference (pointer to function). The PR_CALLBACK attribute is included as part of the function's definition between its return value type and the function's name. ...
PR EnumerateAddrInfo
as part of the PRNetAddr structure. This parameter is not checked for validity. result 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 not NULL. Returns The function returns the value you should specify in the enumPtr parameter for the next call of the enumerator. If the function returns NULL, the enumeration is
ended. Description PR_EnumerateAddrInfo is a stateless enumerator. The principle input, the PRAddrInfo structure, is not modified. ...
PR_EnumerateHostEnt
dity. 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 the enumIndex parameter for the next call of the enumerator. If the function returns 0, the enumeration is
ended. If unsuccessful, the function returns -1. You can retrieve the reason for the failure by calling PR_GetError. Description PR_EnumerateHostEnt is a stateless enumerator. The principle input, the PRHostEnt structure, is not modified. ...
PR_GetRandomNoise
size requested. A return value of zero means that PR_GetRandomNoise is not implemented on this platform, or there is no available noise to be returned at the time of the call. Description PR_GetRandomNoise provides a random value, depending on platform. The length of the random value is dependent on the platform and its ability to provide a random value at that moment. PR_GetRandomNoise is int
ended to provide a "seed" value for a another random number generator that may be suitable for cryptographic operations. This implies that the random value provided may not be, by itself, cryptographically secure. The value generated by PR_GetRandomNoise is at best, extremely difficult to predict and is as nondeterministic as the underlying platfrom permits. ...
PR_NETDB_BUF_SIZE
Recomm
ended size to use when specifying a scratch buffer for PR_GetHostByName, PR_GetHostByAddr, PR_GetProtoByName, or PR_GetProtoByNumber. Syntax #include <prnetdb.h> #if defined(AIX) || defined(OSF1) #define PR_NETDB_BUF_SIZE sizeof(struct protoent_data) #else #define PR_NETDB_BUF_SIZE 1024 #endif ...
An overview of NSS Internals
tificate (Z), the set of candidate issuer certificates might have different issuer names (referring to the second or higher issuer level). As a consequence, it will be necessary to try multiple different alternative routes while searching for (Z), in a recursive manner. Only the newer verification engine (internally named libPKIX) is capable of doing that properly. It's worth mentioning the Ext
ended Validation (EV) principle, which is an effort by software vendors and CAs to define a stricter set of rules for issuing certificates for web site certificates. Instead of simply verifying that the requester of a certificate is in control of an administrative email address at the desired web site's domain, it's required that the CA performs a verification of real world identity documents (such as ...
NSS Certificate Download Specification
trusted CA certificates to the local database. application/x-x509-email-cert The certificate being downloaded is a user certificate belonging to another user for use with S/MIME. If a certificate chain is being imported then the first certificate in the chain must be the user certificate, and any subsequent certificates will be added as untrusted CA certificates to the local database. This is int
ended to allow people or CAs to post their e-mail certificates on web pages for download by other users who want to send them encrypted mail. Note: the browser checks that the size of the object being downloaded matches the size of the encoded certificates. Therefore it is important to ensure that no extra characters, such as NULLs or LineFeeds are added at the end of the object. Importing Certifica...
HTTP delegation
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 app
ended 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 use. Once NSS is finished providing all details, it will request to initiate the actual network communication (SEC_HttpRequest_TrySendAndReceiveFcn). The application should try to reuse e...
HTTP delegation
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 app
ended 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 use. Once NSS is finished providing all details, it will request to initiate the actual network communication (SEC_HttpRequest_TrySendAndReceiveFcn). The application should try to reuse e...
JSS 4.4.0 Release Notes
Documentation Build instructions for JSS at https://hg.mozilla.org/projects/jss/file/tip/README 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 recomm
ended. JSS 4.3.1 requires NSPR 4.7.1 or higher though NSPR 3.13 is recomm
ended. JSS only supports 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. Furthermo...
NSS 3.12.6 release notes
New functions in cert.h CERTDistNames: Duplicate distinguished name array. CERT_DistNamesFromCertList: Generate an array of Distinguished names from a list of certs. in ocsp.h CERT_CacheOCSPResponseFromSideChannel: This function is int
ended for use when OCSP responses are provided via a side-channel, i.e. TLS OCSP stapling (a.k.a. the status_request extension). in ssl.h SSL_GetImplementedCiphers SSL_GetNumImplementedCiphers SSL_HandshakeNegotiatedExtension New error codes ...
NSS_3.12_release_notes.html
_UNKNOWN_AIA_LOCATION_TYPE SEC_ERROR_BAD_HTTP_RESPONSE SEC_ERROR_BAD_LDAP_RESPONSE SEC_ERROR_FAILED_TO_ENCODE_DATA SEC_ERROR_BAD_INFO_ACCESS_LOCATION SEC_ERROR_LIBPKIX_INTERNAL New mechanism flags (see secmod.h) PUBLIC_MECH_AES_FLAG PUBLIC_MECH_SHA256_FLAG PUBLIC_MECH_SHA512_FLAG PUBLIC_MECH_CAMELLIA_FLAG New OIDs (see secoidt.h) new EC Signature oids SEC_OID_ANSIX962_ECDSA_SIGNATURE_RECOMM
ENDED_DIGEST SEC_OID_ANSIX962_ECDSA_SIGNATURE_SPECIFIED_DIGEST SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE More id-ce and id-pe OIDs from RFC 3280 SEC_OID_X509_HOLD_INSTRUCTION_CODE SEC_OID_X509_DELTA_CRL_INDICATOR SEC_OID_X509_ISSUING_DISTRIBUTION_POINT SEC_OID_X509_CERT_ISSUER SEC_OID...
NSS 3.14 release notes
New in NSS 3.14 The sections that follow discuss specific changes in NSS 3.14 in more detail. Support for TLS 1.1 (RFC 4346) has been added (https://bugzilla.mozilla.org/show_bug.cgi?id=565047). To better support TLS 1.1 and future versions of TLS, a new version range API was introduced to allow applications to specify the desired minimum and maximum versions. These functions are int
ended to replace the now-deprecated use of the SSL_ENABLE_SSL3 and SSL_ENABLE_TLS socket options. The following functions have been added to the libssl library included in NSS 3.14 SSL_VersionRangeGet (in ssl.h) SSL_VersionRangeGetDefault (in ssl.h) SSL_VersionRangeGetSupported (in ssl.h) SSL_VersionRangeSet (in ssl.h) SSL_VersionRangeSetDefault (in ssl.h)...
NSS 3.15.4 release notes
t 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_Recomm
endedCanFalseStart SSL_SetCanFalseStartCallback New Types CERT_REV_M_FORCE_POST_METHOD_FOR_OCSP: When this flag is used, libpkix will never attempt to use the HTTP GET method for OCSP requests; it will always use POST. New PKCS #11 Mechanisms None. Notable Changes in NSS 3.15.4 Reordered the cipher suites offered in SSL/TLS client hello messages to match modern best practices. Updated the set o...
NSS 3.15 release notes
ctions 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_SetStapledOCSPResponses - Set's a stapled OCSP response for a TLS server socket to return when clients send the status_request extension. in ocsp.h CERT_PostOCSPRequest - Primarily int
ended for testing, permits the sending and receiving of raw OCSP request/responses. in secpkcs7.h SEC_PKCS7VerifyDetachedSignatureAtTime - Verifies a PKCS#7 signature at a specific time other than the present time. in xconst.h CERT_EncodeNameConstraintsExtension - Matching function for CERT_DecodeNameConstraintsExtension, added in NSS 3.10. in secitem...
NSS 3.22.3 release notes
.3 requires NSPR 4.12 or newer. NSS 3.22.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_22_3_RTM/src/ New in NSS 3.22.3 New Functionality No new functionality is introduced in this release. Bugs fixed in NSS 3.22.3 Bug 1243641 - Increase compatibility of TLS ext
ended master secret, don't send an empty TLS extension last in the handshake Compatibility NSS 3.22.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.22.3 shared libraries without recompiling or relinking. Furthermore, applications that restrict their use of NSS APIs to the functions listed in...
NSS 3.22 release notes
force 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 force NSS to restrict the application to certain cryptographic algorithms and protocols. A complete list can be found in NSS Config Options. New Functions in pk11pub.h PK11_SignWithMechanism - This function is an ext
ended version PK11_Sign(). PK11_VerifyWithMechanism - This function is an ext
ended 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 supported for RSA in addition to CKM_RSA_PKCS. The CK_RSA_PKCS_PSS mechanism takes a parameter ...
NSS 3.23 release notes
dangerous practice) call this with the highest version number that they possibly support. This gives them access to the version downgrade protection from TLS 1.3. Notable Changes in NSS 3.23 The copy of SQLite shipped with NSS has been updated to version 3.10.2 (bug 1234698) The list of TLS extensions sent in the TLS handshake has been reordered to increase compatibility of the Ext
ended Master Secret with servers (bug 1243641) The build time environment variable NSS_ENABLE_ZLIB has been renamed to NSS_SSL_ENABLE_ZLIB (Bug 1243872). The build time environment variable NSS_DISABLE_CHACHAPOLY was added, which can be used to prevent compilation of the ChaCha20/Poly1305 code. The following CA certificates were Removed CN = Staat der Nederlanden Root CA SHA-256 Fing...
NSS 3.24 release notes
nitCheapArena - Initializes an arena that was created on the stack. (See PORTCheapArenaPool.) PORT_DestroyCheapArena - Destroys an arena that was created on the stack. (See PORTCheapArenaPool.) New types In sslt.h SSLExtraServerCertData - Optionally passed as an argument to SSL_ConfigServerCert. This struct contains supplementary information about a certificate, such as the int
ended type of the certificate, stapled OCSP responses, or Signed Certificate Timestamps (used for certificate transparency). In secport.h PORTCheapArenaPool - A stack-allocated arena pool, to be used for temporary arena allocations. New macros In pkcs11t.h CKM_TLS12_MAC In secoidt.h SEC_OID_TLS_ECDHE_PSK - This OID governs the use of the TLS_ECDHE_PSK_WITH_AES_1...
NSS 3.29.2 release notes
TTPS 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 int
ended value. See Bug 1340841 for details. Compatibility NSS 3.29.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.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 co...
NSS 3.41 release notes
SHA-256 Fingerprint: A6C51E0DA5CA0A9309D2E4C0E40C2AF9107AAE8203857FE198E3E769E343085C CN = Certplus Root CA G1 SHA-256 Fingerprint: 152A402BFCDF2CD548054D2275B39C7FCA3EC0978078B0F0EA...
NSS 3.46 release notes
oot CA 2 root certificate SHA-256 Fingerprint: F09B122C7114F4A09BD4EA4F4A99D558B46E4C25CD81140D29C05613914C3841 Upcoming changes to default TLS configuration The next NSS team plans to make two changes to the default TLS configuration in NSS 3.47, which will be released in October: TLS 1.3 will be the default maximum TLS version. See Bug 1573118 for details. TLS ext
ended master secret will be enabled by default, where possible. See Bug 1575411 for details. Bugs fixed in NSS 3.46 Bug 1572164 - Don't unnecessarily free session in NSC_WrapKey Bug 1574220 - Improve controls after errors in tstcln, selfserv and vfyserv cmds Bug 1550636 - Upgrade SQLite in NSS to a 2019 version Bug 1572593 - Reset advertised extensions in ssl_ConstructExtensions Bug 1415118 -...
NSS 3.47 release notes
https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_47_RTM/src/ Other releases are available in NSS Releases. Upcoming changes 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 ext
ended master secret will be enabled by default, where possible. See Bug 1575411 for details. Notable Changes in NSS 3.47 Bug 1152625 - Support AES HW acceleration on ARMv8 Bug 1267894 - Allow per-socket run-time ordering of the cipher suites presented in ClientHello Bug 1570501 - Add CMAC to FreeBL and PKCS #11 libraries Bugs fixed in NSS 3.47 Bug 1459141 - Make softoken CBC padding remova...
NSS 3.52 release notes
rror. Bug 1624864 - Allow building of gcm-arm32-neon on non-armv7 architectures. Bug 1624402 - Fix compilation error in Firefox Android. Bug 1624130 - Require CK_FUNCTION_LIST structs to be packed. Bug 1624377 - Fix clang warning for unknown argument '-msse4'. Bug 1623374 - Support new PKCS #11 v3.0 Message Interface for AES-GCM and ChaChaPoly. Bug 1623184 - Fix freebl_cpuid for querying Ext
ended Features. Bug 1622555 - Fix argument parsing in lowhashtest. Bug 1620799 - Introduce NSS_DISABLE_GCM_ARM32_NEON to build on arm32 without NEON support. Bug 1619102 - Add workaround option to include both DTLS and TLS versions in DTLS supported_versions. Bug 1619056 - Update README: TLS 1.3 is not experimental anymore. Bug 1618915 - Fix UBSAN issue in ssl_ParseSessionTicket. Bug 1618739 - Do...
Release notes for recent versions of NSS
The current Stable release of NSS is 3.56, which was released on 21 August 2020. (NSS 3.56 release notes) The current ESR releases of NSS are 3.44.4 (NSS 3.44.4 release notes), int
ended for Firefox ESR 68, which was released on 19 May 2020, and 3.53.1 (NSS 3.53.1 release notes), int
ended for Firefox ESR 78, which was released on 16 June 2020. Past releases NSS 3.56 release notes NSS 3.55 release notes NSS 3.54 release notes NSS 3.53.1 release notes NSS 3.53 release notes NSS 3.52.1 release notes NSS 3.44.4 release notes NSS 3.52 release notes NSS 3.51.1 release notes NSS 3.51 release notes NSS 3.50 release notes NSS 3.49.2 release notes NSS 3.49.1 release notes NSS 3.49 release notes NSS 3.48.1 release notes NSS 3.48 release notes NSS 3.47.1 release notes NSS 3.47...
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 recomm
ended approach is to store and transport 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_ME...
nss tech note7
ons and you always pass pointers to these data types to NSS functions and never examine the members of these structures. The strength of an RSA key pair is measured by the size of its modulus because given the modulus and public exponent, the best known algorithm for computing the private exponent is to factor the modulus. At present 1024 bit and 2048 bit RSA keys are the most common and recomm
ended. To prevent denial-of-service attacks with huge public keys, NSS disallows modulus size greater than 8192 bits. How are these keys created in NSS? There are a few possibilities. RSA key pairs may be generated inside a crypto module (also known as a token). Use PK11_GenerateKeyPair() to generate a key pair in a crypto module. Key pairs may be generated elsewhere, exported in encrypted form, ...
nss tech note8
rver session caches to coexist. As part of that work, I decided that each cache would have its own variables containing the SSL2 and SSL3 session durations. This means that client cache session lifetimes are separate from server session cache lifetimes, and that each server session cache may have its own lifetimes. So, in NSS 3.4, the global variables ssl3_sid_timeout and ssl_sid_timeout were int
ended to become the definitions for the client cache only, and each server cache had its own new pair of variables for ssl2 and ssl3 session lifetimes, i.e., cache->ssl2Timeout and cache->ssl3Timeout. The server cache initialization function was int
ended to no longer alter the variables ssl3_sid_timeout and ssl_sid_timeout, but rather to set the server cache's variables. Since all the callers of the s...
PKCS11 Implement
evice that can have a PIN set on it. Because it's a general access device, NSS never prompts for the PIN, even though it's possible to set a PIN with C_SetPIN. If the PIN is set successfully, the CFK_LOGIN_REQUIRED flag should change to TRUE. The NSS uses this combination of flags for its internal token when the key database password is NULL. These are not standard PKCS #11 semantics; they are int
ended 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 supported by a token. C_GetMechanismInfo The NSS currently doesn't call C_GetMechanismInfo. This functio...
NSS_Initialize
in order to prevent the need for C_Finalize. This call will be emulated instead. NSS_INIT_RESERVED - Currently has no effect, but may be used in the future to trigger better cooperation between PKCS#11 modules used by both NSS and the Java SunPKCS11 provider. This should occur after a new flag is defined for C_Initialize by the PKCS#11 working group. NSS_INIT_COOPERATE - Sets the above four recomm
ended options for applications that use both NSS and the Java SunPKCS11 provider. Return value NSS_Initialize returns SECSuccess on success, or SECFailure on failure. Examples #include <nss.h> SECStatus rv; const char *configdir; configdir = ...; /* application-specific */ rv = NSS_Initialize(configdir, "", "", SECMOD_DB, NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE); See also NSS_Init, NSS_InitRe...
NSS tools : certutil
created or added to the database. There are several available keywords: + sslClient + sslServer + smime + objectSigning + sslCA + smimeCA + objectSigningCA + critical X.509 certificate extensions are described in RFC 5280. -6 | --extKeyUsage keyword,keyword Add an ext
ended key usage extension to a certificate that is being created or added to the database. Several keywords are available: + serverAuth + clientAuth + codeSigning + emailProtection + timeStamp + ocspResponder + stepUp + critical X.509 certificate extensions are described in RFC 5...
NSS tools : crlutil
. 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 dbprefix Specify the prefix used on the NSS security database files (for example, my_cert8.db and my_key3.db). This option is provided as a special case. Changing the names of the certificate and key databases is not recomm
ended. -a Use ASCII format or allow the use of ASCII format for input and output. This formatting follows RFC #1113. -c crl-gen-file Specify script file that will be used to control crl generation/modification. See crl-cript-file format below. If options -M|-G is used and -c crl-script-file is not specified, crlutil will read script data from standard input. -d directory Specify the database ...
NSS tools : modutil
ey3.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. Changing the names of the certificate and key databases is not recomm
ended. -installdir root-installation-directory Specify the root installation directory relative to which files will be installed by the -jar option. This directory should be one below which it is appropriate to store dynamic library files, such as a server's root directory. -libfile library-file Specify a path to a library file containing the implementation of the PKCS #11 interface module that...
NSS tools : pk12util
-cert-key-len certKeyLength Specify the desired length of the symmetric key to be used to encrypt the certificates and other meta-data. -n certname Specify the nickname of the cert and private key to export. -P prefix Specify the prefix used on the certificate and key databases. This option is provided as a special case. Changing the names of the certificate and key databases is not recomm
ended. -r Dumps all of the data in raw (binary) form. This must be saved as a DER file. The default is to return information in a pretty-print ASCII format, which displays the information about the certificates and public keys in the p12 file. -v Enable debug logging when importing. -w p12filePasswordFile Specify the text file containing the pkcs #12 file password. -W p12filePassword Specify...
gtstd.html
in tokens: The Generic Crypto Services token performs all cryptographic operations, such as encryption, decryption, and hashing. The Communicator Certificate DB token handles all communication with the certificate and key database files (called certX.db and keyX.db, respectively, where X is a version number) that store certificates and keys. The FORTEZZA module is int
ended for use with FORTEZZA hardware tokens. The FIPS 140-1 module is compliant with the FIPS 140-1 government standard for implementations of cryptographic modules. Many products sold to the U.S. government must comply with one or more of the FIPS standards. The FIPS 140-1 module includes a single, built-in FIPS 140-1 Certificate DB token (see Figure 2.1), which handles both cryptographic operation...
sslintro.html
udes five parts: Initialization Configuration Communication Functions Used by Callbacks Cleanup Although the details differ somewhat for client and server applications, the concepts and many of the functions are the same for both. WARNING: Some 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 int
ended 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 supported for application use. Initialization Initialization includes setting up configuration files, setting global defaults, and setting up cal...
NSS Tools crlutil
uments -B Bypass CA signature checks. -P dbprefix Specify the prefix used on the NSS security database files (for example, my_cert8.db and my_key3.db). This option is provided as a special case. Changing the names of the certificate and key databases is not recomm
ended. -a Use ASCII format or allow the use of ASCII format for input and output. This formatting follows RFC #1113. -c crl-gen-file Specify script file that will be used to control crl generation/modification. See crl-cript-file format below. If options -M|-G is used and -c crl-script-file ...
NSS Tools modutil
Unix, the Security Module Database Tool defaults to the user's Netscape directory. Windows NT has no default directory, so -dbdir must be used to specify a directory. -dbprefix prefix Specify the prefix used on the cert8.db and key3.db files (for example, my_cert8.db and my_key3.db). This option is provided as a special case. Changing the names of the certificate and key databases is not recomm
ended. -libfile library-file Specify a path to the DLL or other library file containing the implementation of the PKCS #11 interface module that is being added to the 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 space...
NSS Tools pk12util
d keys. If not specified the directory defaults to $HOME/.netscape (when $HOME exists in the environment), or to ./.netscape (when $HOME does not exist in the environment). -P prefix Specify the prefix used on the cert8.db and key3.db files (for example, my_cert8.db and my_key3.db). This option is provided as a special case. Changing the names of the certificate and key databases is not recomm
ended. -h tokenname Specify the name of the token to import into or export from -v Enable debug logging when importing -k slotPasswordFile Specify the text file containing the slot's password -K slotPassword Specify a slot's password -w p12filePasswordFile Specify the text file containing the pkcs 12 file's password -W p12filePassword Specify the pkcs 12 file's password -c key-cip...
NSS tools : crlutil
-G Arguments Option arguments modify an action and are lowercase. -B Bypass CA signature checks. -P dbprefix Specify the prefix used on the NSS security database files (for example, my_cert8.db and my_key3.db). This option is provided as a special case. Changing the names of the certificate and key databases is not recomm
ended. -a Use ASCII format or allow the use of ASCII format for input and output. This formatting follows RFC #1113. -c crl-gen-file Specify script file that will be used to control crl generation/modification. See crl-cript-file format below. If options -M|-G is used and -c crl-script-file is not specified, crlutil will read s...
NSS tools : modutil
9.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. Changing the names of the certificate and key databases is not recomm
ended. -installdir root-installation-directory Specify the root installation directory relative to which files will be installed by the -jar option. This directory should be one below which it is appropriate to store dynamic library files, such as a server's root directory. -libfile library-file Specify a path to a library file containing...
NSS tools : pk12util
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 Specify the prefix used on the certificate and key databases. This option is provided as a special case. Changing the names of the certificate and key databases is not recomm
ended. -h tokenname Specify the name of the token to import into or export from. -v Enable debug logging when importing. -k slotPasswordFile Specify the text file containing the slot's password. -K slotPassword Specify the slot's password. -w p12filePasswordFile Specify the text file containing the pkcs #12 file password. ...
NSS tools : signtool
fy Same as -v option. who Same as -w option. exclude Same as -x option. notime Same as -z option. value is ignored, but = sign must be present. jarfile Same as -Z option. outfile Name of a file to which output and error messages will be redirected. This option has no command-line equivalent. Ext
ended Examples The following example will do this and that Listing Available Signing Certificates You use the -L option to list the nicknames for all available certificates and check which ones are signing certificates. signtool -L using certificate directory: /u/jsmith/.netscape S Certificates - ------------ BBN Certificate Services CA Root 1 IBM World Registry CA VeriSig...
NSS tools : signver
n the old format. -a Sets that the given signature file is in ASCII format. -i input_file Gives the input file for the object with signed data. -o output_file Gives the output file to which to write the results. -s signature_file Gives the input file for the digital signature. -v Enables verbose output. Ext
ended Examples Verifying a Signature The -V option verifies that the signature in a given signature file is valid when used to sign the given object (from the input file). signver -V -s signature_file -i signed_file -d sql:/home/my/sharednssdb signatureValid=yes Printing Signature Data The -A option prints all of the information contained in a signature file. Using the -o option...
Installing Pork
Elsa (the C++ parser in Pork) has a hard time with some of the new features used in later GCC C++ headers. Our recent work has gotten Mozilla to compile with GCC 4.2. GCC 4.3 should also work fairly well, but there may be 5 or so files that Elsa can't parse. ...
Rhino overview
the standard, and Rhino version 1.6R1 release notes for details on the implementation in Rhino. In addition, Rhino has implemented JavaAdapters, which allows JavaScript to implement any Java interface or extend any Java class with a JavaScript object. See the enum.js example for more information. Numerous books and tutorials on JavaScript are available. JavaScript: The Definitive Guide is recomm
ended, and contains a chapter on Rhino. Deprecated Language Features Several language features introduced in JavaScript 1.2 are now deprecated. These features allow "computational reflection": that is, the ability for a script to determine and influence aspects of the way it is evaluated. These features are generally not broadly useful, yet they impose significant constraints on implementations that ...
Rhino serialization
sible to serialize JavaScript objects, including functions and scripts. However, serialization of code in compilation mode has some significant limitations. Serialization provides a way to save the state of an object and write it out to a file or send it across a network connection. Simple serialization example The Rhino shell has two new top-level functions, serialize and deserialize. ...
Rhino shell
es define the corresponding environment variable names. input - the process input. If it is not java.io.InputStream, it is converted to string and sent to the process as its input. If not specified, no input is provided to the process. output - the process output instead of java.lang.System.out. If it is not instance of java.io.OutputStream, the process output is read, converted to a string, app
ended to the output property value converted to string and put as the new value of the output property. err - the process error output instead of java.lang.System.err. If it is not instance of java.io.OutputStream, the process error output is read, converted to a string, app
ended to the err property value converted to string and put as the new value of the err property. seal(object) Seal the specif...
Shumway
Shumway options. Note: If your applet runs at an abnormal speed, try toggling "Turbo" at the bottom of 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 int
ended for problems with integrating Shumway into Firefox. End-users and less involved developers may report issues by hovering over "Shumway" within Flash content, clicking "Report Problems", and filling the form. Performance and compatibility issues with Flash content should be reported through GitHub. From the main page for Shumway at GitHub, click on "Issues" and browse the outstanding issues for...
Rebranding SpiderMonkey (1.8.5)
It also allows these instructions to apply to a wide range platforms without introducing more software dependencies. Save the file and exit the editor. You may now perform the build and installation of your custom branded SpiderMonkey library: make Note: Depending on your system you may need administrative rights to perform the installation: make install The following information isn't te...
SpiderMonkey Build Documentation
s 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. Support for JS_THREADSAFE was recently removed, and threadsafe builds are now enabled by default. The js-config script, described below, is the recomm
ended 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 SpiderMonkey somewhere other than the default, you must use the configure --prefix option, as described above. Failure to do so may break your js-config.
Creating JavaScript tests
There are two large SpiderMonkey test suites: jstests (in js/src/tests) and jit-tests (in js/src/jit-test). See Running Automated JavaScript Tests for details. In which test suite does your new test belong? jit-tests are int
ended to test the implementation of the JIT. Only add tests to these suites which test jit correctness or functionality. jstests is int
ended for tests of language-visible functionality. Please put tests of functionality into jstests even if related tests are in jit-tests, since jstests are closer to (and more easily converted to) test262 tests. (In fact, the test262 test suite is run as part of jstests.) Practical differences between the two test suites: jstest New jstest files should be put the code in the appropriate subdirectory of js/src/tests/non262/, o...
Future directions
e cleanup and organization is still required. Practical coding bits Experimental language features New language features (ES6+) and APIs often get added to SpiderMonkey while the spec is still being drafted, or before the feature has stabilized. This is good, because it helps the spec work. For these features: Do not add vendor prefixes. See http://hsivonen.iki.fi/vendor-prefixes/ for an ext
ended argument. Disable the feature before the Beta channel. Nightly and Aurora are the good channels for experimental work. NSPR The plan is to make SpiderMonkey not depend on NSPR. No fundamental blockers currently exist, but ctypes is still using NSPR's runtime library loading facilities. Directories and filenames See https://wiki.mozilla.org/JS_engine_modularization. ...
Hacking Tips
Use the VIXL Debugger in the simulator (arm64) Set a breakpoint (see the comments above about masm.breakpoint()) and run with the environment variable USE_DEBUGGER=1. This will then drop you into a simple debugger provided with VIXL, the ARM simulator technology used for arm64 simulation. Use the Simulator Debugger for arm32 The same instructions for a...
SpiderMonkey Internals: Thread Safety
tThread(cx); JS_BeginRequest(cx); /* ... do stuff ... */ JS_EndRequest(cx); JS_ClearContextThread(cx); It isn't a bottleneck; multiple threads are allowed to be in requests on the same JSRuntime at once. See JS_BeginRequest. The most obvious effect of a request is: at any given moment there can either be multiple threads in active requests, or one thread doing GC and all requests susp
ended. A call to JS_GC() will block until the latter becomes possible. In other words, GC waits until each other thread is either outside JSAPI (in which case we don't care what it's doing) or else in JSAPI, but blocked, waiting for GC to finish. Threads must not do anything that would affect GC while outside a request. And obviously you shouldn't block or otherwise dilly-dally while in a request; it p...
JSAPI User Guide
m JS object from a script is when you only need an object to exist as long as the script that uses it is executing. To create objects that persist across script calls, you can embed the object code in your application instead of using a script. Note: You can also use scripts to create persistent objects, too. To create a custom object using a script: Define and spec the object. What is it int
ended to do? What are its data members (properties)? What are its methods (functions)? Does it require a run time constructor function? Code the JS script that defines and creates the object. For example: function myfun(){ var x = newObject(); . . . } NOTE: Object scripting using JavaScript occurs outside the context of embedding the JS engine in your applications. For more information about object sc...
JS::Value
lar, note that it is an error to call val.toObject() when val.isNull(). The now-deprecated jsval methods allowed JSVAL_TO_OBJECT(val) when JSVAL_IS_NULL(val), but this was a source of constant bugs. val.toObject() is only permitted when val.isObject(). An assertion is thrown in the case that the type is not correct (val.isX() is called for each val.toX(), where X is the type). It is highly recomm
ended that you develop and test with an --enable-debug build to detect most JS::Value misuse. Debug builds will assert correct JSAPI use in many other instances as well. JS::Value is subject to garbage collection A JS::Value can refer to a string or object located in SpiderMonkey's garbage-collected heap. The garbage collector is designed to automatically free unreachable memory. It is rather eager ...
JSClass
e. hasInstance JSHasInstanceOp Pointer to an optional hasInstance method for this object. If you do not provide a method for hasInstance, set this pointer to NULL. construct JSNative This is called when a script uses an object as though it were a constructor: new obj(). If objects of your class shouldn't be callable this way, use NULL. Most custom objects are not int
ended to be used as constructors. xdrObject JSXDRObjectOp Implements object serialization. If you do not use JSXDR, set this pointer to NULL. Obsolete since JSAPI 13 trace JSTraceOp The GC trace hook. Description Use JSClass to define a custom class of JavaScript objects. A JSClass has a name, flags, and several callback functions for advanced customizatio...
JSGetObjectOps
is! API compatibility requires a JSClass *clasp parameter to JS_NewObject, etc. Most host objects do not need to implement the larger JSObjectOps, and can share the common JSScope code and data used by the native (js_ObjectOps, see jsobj.c) ops. Further extension to preserve API compatibility: if this function returns a pointer to JSXMLObjectOps.base, not to JSObjectOps, then the engine calls ext
ended hooks needed for E4X. JSClass hooks JSClass offerd following hook: The JSClass.getObjectOps hook is called each time an object is created. It returns a pointer to a JSObjectOps which is then used as a virtual table for operations on the new object. See Also MXR ID Search for JSHasInstanceOp JSClass JS_HasInstance bug 571789 ...
JSIteratorOp
ect *obj, JSBool keysonly); Name Type Description cx JSContext * Pointer to the JS context in which the iterator creation should take place. obj JSObject * Pointer to the object to iterate over. keysonly JSBool If true, the iterator should yield keys only, not [key, value] pairs. Description The JavaScript engine calls the JSExt
endedClass.iteratorObject callback to create an iterator object for a given object. The callback should return an iterator object or NULL if an error or exception occurred on cx. See Also bug 909178 ...
JS_ClearContextThread
browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Transfer a JSContext from one thread to another. Syntax jsword JS_ClearContextThread(JSContext *cx); jsword JS_SetContextThread(JSContext *cx); Name Type Description cx JSContext * The context to transfer from one thread to another. There must not be any active or susp
ended requests using this context. Description An application that creates or uses a JSContext in one thread, then uses or destroys it in another thread, must use JS_ClearContextThread and JS_SetContextThread to transfer the JSContext safely from one thread to the other. The rules for using JSContexts in multiple threads are: Each JSContext may only be used by one thread at a time. Each re...
JS_DestroyContext
t was being used by cx's global object. JS_DestroyContextNoGC does not perform garbage collection. JS_DestroyContextMaybeGC may or may not perform garbage collection; the engine makes an educated guess as to whether enough memory would be reclaimed to justify the work. In a JS_THREADSAFE build, it does not matter whether the calling thread is in a request on cx. However, there must not be any susp
ended requests on cx. If JS_SetContextCallback has been called, this calls the callback. See Also MXR ID Search for JS_DestroyContext MXR ID Search for JS_DestroyContextNoGC MXR ID Search for JS_DestroyContextMaybeGC JS_NewContext bug 737364 ...
JS_EnumerateDiagnosticMemoryRegions
unction to use. Callback syntax typedef bool (* JSEnumerateDiagnosticMemoryCallback)(void *ptr, size_t length); Name Type Description ptr void * Pointer to the allocated memory. length size_t Length of the allocated memory. Description JS_EnumerateDiagnosticMemoryRegions enumerates memory regions that contain diagnostic information int
ended to be included in crash report minidumps. See Also MXR ID Search for JS_EnumerateDiagnosticMemoryRegions MXR ID Search for JSEnumerateDiagnosticMemoryCallback bug 662646 ...
JS_ExecuteScript
erms, the script is executed in a new execution context, but that context is not initialized quite as described in any of the three cases in ECMA 262-3 ?10.2. Instead: The scope chain is initialized to contain obj, followed by its parent, then its parent's parent, etc. until NULL is reached. Variable initialization is performed. If the JSOPTION_VAROBJFIX option is in effect (recomm
ended), then the last object in the scope chain is used as the variable object. Otherwise obj is used. The this value is obj. scopeChain JS::AutoObjectVector & An explicit scope chain. scopeChain must not include the global object on it; that's implicit. It needs to contain the other objects that should end up on the scripts's scope chain. Objects in the vector should b...
JS_ExecuteScriptVersion
erms, the script is executed in a new execution context, but that context is not initialized quite as described in any of the three cases in ECMA 262-3 ?10.2. Instead: The scope chain is initialized to contain obj, followed by its parent, then its parent's parent, etc. until NULL is reached. Variable initialization is performed. If the JSOPTION_VAROBJFIX option is in effect (recomm
ended), then the last object in the scope chain is used as the variable object. Otherwise obj is used. The this value is obj. script JSObject * The compiled script to execute. rval jsval * Out parameter. On success, *rval receives the value from the last executed expression statement processed in the script. version JSVersion Version for the sc...
JS_GetFlatStringChars
ork in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. This article covers features introduced in SpiderMonkey 1.8.5 Get the chars of a flat string. Use JS_FlattenString to flatten the string. Syntax const jschar * JS_GetFlatStringChars(JSFlatString *str); Name Type Description str JSFlatString * The flatt
ended string returned by JS_FlattenString. Description JSFlatString *fstr = JS_FlattenString(cx, str); if (!fstr) return JS_FALSE; const jschar *chars = JS_GetFlatStringChars(fstr) JS_ASSERT(chars); See also JS_FlattenString bug 1037869 ...
JS_InitClass
s.construct) on it. However, the prototype object will eventually be finalized (JSClass.finalize). This inconsistency can cause problems; for example, if the finalizer calls JS_GetPrivate(), expecting that the constructor called JS_SetPrivate(), it may find that the private data is NULL. The JSCLASS_CONSTRUCT_PROTOTYPE flag is one way to avoid this inconsistency. Warning: If the class is a JSExt
endedClass, make sure that the additional reserved fields at the end of the JSExt
endedClass are NULL. JSExt
endedClass structs should usually be global, and in this case the compiler automatically initializes these fields to NULL. (This is a feature of the C and C++ languages.) Otherwise, use memset. See Also MXR ID Search for JS_InitClass JS_GetClass JS_InstanceOf ...
JS_NewContext
see JSContext. For sample code that creates and initializes a JSContext, see JSAPI User Guide. The stackchunksize parameter does not control the JavaScript stack size. (The JSAPI does not provide a way to adjust the stack depth limit.) Passing a large number for stackchunksize is a mistake. In a DEBUG build, large chunk sizes can degrade performance dramatically. The usual value of 8192 is recomm
ended. The application must call JS_DestroyContext when it is done using the context. Before a JSRuntime may be destroyed, all the JSContexts associated with it must be destroyed. The new JSContext initially has no global object. The new JSContext is associated with the calling thread. No other thread may use it or destroy it. See Also MXR ID Search for JS_NewContext JS_DestroyContext JS_Cont...
JS_NewRuntime
fore making any other API calls except JS_Init. JS_NewRuntime allocates memory for the JSRuntime and initializes certain internal runtime structures. maxbytes specifies the number of allocated bytes after which garbage collection is run. If parentRuntime is specified, the resulting runtime shares significant amounts of read-only state (the self-hosting and initial atoms compartments). It is recomm
ended to make use of this for every runtime in a process after the first one. The returned JSRuntime can be used from the calling thread only. (The engine may use helper threads internally, though.) On success, JS_NewRuntime returns a pointer to the newly created runtime, which the caller must later destroy using JS_DestroyRuntime. Otherwise it returns NULL. Notes Ordinarily, JS_NewRuntime should b...
JS_SetOptions
Warn on dubious practice. MXR ID Search for JSOPTION_EXTRA_WARNINGS JSOPTION_WERROR Convert warnings to errors. MXR ID Search for JSOPTION_WERROR JSOPTION_VAROBJFIX Make JS_EvaluateScript() use the last object on its obj param's scope chain (that is, the global object) as the ECMA "variables object". This flag is recomm
ended. 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. MXR ID Search for JSOPTION_VAROBJFIX JSOPTION_PRIVATE_IS_NSISUPPORTS Mozilla extension. The context's private da...
JS_ShutDown
ed with JS_NewRuntime must have been destroyed with JS_DestroyRuntime, every JSContext created with JS_NewContext must have been destroyed with JS_DestroyContext, and so on. Calling this method before all other resources have been destroyed has undefined behavior. Failure to call this method, at present, has no adverse effects other than leaking memory. This may not always be the case; it's recomm
ended that all embedders call this method when all other JSAPI operations have completed, to be future-proof. It is currently not possible to initialize SpiderMonkey multiple times (that is, calling JS_Init, then other JSAPI methods, then JS_ShutDown in that order, then doing so again). This restriction may eventually be lifted. Implementation note: This method has been used to clean up memory allocate...
JS_THREADSAFE
he JSAPI is actually pretty unlikely to trigger GC, especially if the calling thread has not been using up a lot of memory. In a multithreaded program, even if the calling thread has been idle, other threads may be active or may call JS_GC(). The above rules mean that at any given moment, there can be either (a) multiple threads in active requests, or (b) one thread doing GC and all requests susp
ended. When one thread calls JS_GC or otherwise finds that garbage collection is necessary, it must wait for all other threads that are in requests to pause before garbage collection can occur. To keep this wait time to a minimum, applications must avoid long-running requests. The recomm
ended technique in SpiderMonkey 1.8 and later is to periodically call JS_YieldRequest from an operation callback. Sh...
Parser API
parse() makes it possible to construct user-specified data from the parser, rather than the default Node objects. Builder objects may contain any of the callback methods described in this section. Each callback can produce any custom, user-defined datatype; these are referred to below as CustomExpression, CustomStatement, etc. Note: Because this library uses null for optional nodes, it is recomm
ended that user-defined datatypes not use null as a representation of an AST node. If the loc option is enabled (see the Reflect.parse() options above), then each callback is provided with the source location information of the parsed node as an extra parameter. All builder callbacks are optional. When a callback is missing, the default format is used, but the provided builder methods are still used ...
SpiderMonkey 1.8.7
ls encoding jsint; e.g. so that JSVAL_IS_INT was true. While this was never specified behaviour, it is no longer true; numeric values which are integers are frequently encoded as jsdouble inside the jsval. Embedders must be careful when converting numbers from jsvals into C. Note also that SpiderMonkey can now fit a full 32-bit integer (jsint) inside a jsval without promoting to a jsdouble. JSExt
endedClass JSExt
endedClass 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 supported two types of native functions -- JSNative and JSFastNative. The so-called "Slow Natives" ar...
SpiderMonkey 1.8.8
se 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 support for versions of Visual Studio prior to 2010. In the meantime MOZ_CUSTOM_STDINT_H is int
ended 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 introduced into the API, to help embedders writing C++ projects. Please note that SpiderMonkey...
SpiderMonkey 17
se 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 support for versions of Visual Studio prior to 2010. In the meantime MOZ_CUSTOM_STDINT_H is int
ended 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 introduced into the API, to help embedders writing C++ projects. Please note that SpiderMonkey...
SpiderMonkey 38
nguage 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. -- Sep 17, 2015 The download url is outdated and SpiderMonkey not RELEASE alone! Get it here mozilla-esr38 You will find it in "Firefox Ext
ended Support Release 38" package on hg release Platform support SpiderMonkey 38 is supported 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 supported version is MSVC10/2010. SpiderMonkey 38 includes a just-in-time compiler (JIT) that compiles...
TPS Bookmark Lists
k list at the position of the named bookmark, causing that bookmark to be positioned below this separator) Example: { separator: true } Bookmark lists and phase actions Following are the functions you can use in phase actions related to bookmarks: Bookmarks.add - The bookmark items in the list are added to the end of their parent folder in the specified order. That is, the first item is app
ended to its parent folder, then the second, and so forth. after and before properties are ignored. Bookmarks.verify - The bookmark items in the list are verified to be present. Within each folder, the second item in the list is assumed to be immediately after the first item, and so forth. If the second item in a given folder is not directly after the first item in that folder, it's an error. after and...
Web Replay
nce during both replay and recording, many of the hottest atomics (refcounts, GC counters, and so forth) are associated with non-deterministic components and are not recorded. IPC integration Communication between the chrome process and a recording or replaying process -- hereafter referred to as the child process -- is managed via a separate middleman content process. The child process is ext
ended so that it can communicate with the middleman, using a special bidirectional channel and messages separate from IPDL state. Middleman process The middleman is the same as a normal content process, except that it spawns and communicates with the child process, and avoids creating any documents itself. Using the middleman provides the following advantages: IPDL communication is greatly simpli...
Zest
The language is written in JSON, but we do not expect people to write Zest in this format - it is designed to be a visual language. The core language does not define any graphical representation - that is expected to be defined by the tools that integrate Zest. It is completely free, open source and can be included in any tool whether open or closed, free or commercial. ...
Mozilla Projects
ot just the debugging experience but the entire web development experience. To that end, this document will be revised over time as we find new and better ways of helping developers. Zest Zest is an experimental specialized scripting language (also known as a domain-specific language) developed by the Mozilla security team and is int
ended to be used in web oriented security tools. The language is written in JSON, but we do not expect people to write Zest in this format - it is designed to be a visual language. The core language does not define any graphical representation - that is expected to be defined by the tools that integrate Zest. It is completely free, open source and can be included in any...
Using RAII classes in Mozilla
RAII classes are useful when two operations (e.g., Lock/Unlock, AddRef/Release, PushState/PopState) must be paired. Ensuring RAII classes are not used as temporaries A common mistake when using RAII classes is to accidentally forget to name object, which causes its scope to be different from what is int
ended. For example, instead of writing: AutoLock lock(mMutex); which causes the lock to be held until the end of the block, one might write: AutoLock(mMutex); which erroneously causes the lock to be released at the end of the statement. We have two techniques for avoiding this problem: static analysis and runtime assertions. Static Analysis Static analysis passes are run on our testing infrastructure using our clang plugin, you can also run them locally Marking a RAII class ...
Secure Development Guidelines
g APIs Similar to libc str*cpy and str*cat Some are potentially dangerous Function name Comments PL_strcpy, PL_strcat These functions don't verify whether the destination buffer is large enough. PL_strncpy This function doesn't null terminate. PL_strncat This function is confusing because the size argument is the maximum number of bytes being app
ended, not the size of the buffer. This can lead to security bugs. PL_strncpyz This function copies a string and guarantees null termination. PL_strcatn The size argument for this function is the size of the buffer and it guarantees zero termination. Using the Mozilla API Mozilla C++ style strings are less prone to buffer overflows and 0-termination issues Every strin...
Gecko events
Is Supported: yes EVENT_DOCUMENT_RELOAD The document contents...
Gecko states
LECTABLE 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 Supports multiple selection STATE_EXTSELECTABLE Supports ext
ended selection STATE_REQUIRED Indicates that user interaction is required. STATE_IMPORTANT Isn;t used. STATE_INVALID Indicates a validation failure. EXT_STATE_SUPPORTS_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 selectable, object must implement nsIAccessibleText EXT_STATE_E...
AT APIs Support
Keyboard User Interface and API Fortunately, Gecko uses the standard keyboard API's for each supported platform. The Mozilla keyboard shortcuts for content are similar to what is used in other browsers. Here is a list of Firefox keyboard shortcuts. Test Tools Here you will find a list of tools to test accessibility Gecko-based applications. MSAA MSAA SDK tools - version 1.3 is recomm
ended instead of 2.0 because it includes source code for the tools IAccessible2 Accessibility Probe -- includes MSAA support as well ATK/AT-SPI Accerciser - interactive Python accessibility explorer for the GNOME desktop Gecko DOM Inspector has an ability to test Gecko accessibility layer, supports base features. Firebug Screen Readers Here's a list of scr...
History Service Design
uilt with performance in mind, and constantly tested against large databases. Database indexes are quite important, 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 (int
ended as URIs) are stored into a table shared by both History and Bookmarks, every url is unique in this table and is associated with a place id, commonly used as the foreign key on other tables. This table has common attributes for a page like typed, hidden and frecency. Certain scheme are excluded from history, so they will never be added, for example: about, view-source, chrome. If a page can be ad...
Places Developer Guide
Redirect, sessionId); // Add a visit to a URL, with a page title and visited time // via nsIBrowserHistory. var browserHistory = histsvc.QueryInterface(Ci.nsIBrowserHistory); var ourURI = uri("http://www.mozilla.com"); var pageTitle = "Mozilla"; var visitDate = Date.now() * 1000; // in microseconds browserHistory.addPageWithDetails(ourURI, "Mozilla", visitDate); // Add a visit to a URL, with ext
ended behavior information // via nsIGlobalHistory3. var globalHistory = Cc["@mozilla.org/browser/global-history;2"]. getService(Ci.nsIGlobalHistory2); var ourURI = uri("http://www.mozilla.com"); var isRedirect = false; var isTopLevel = true; globalHistory.addURI(ourURI, isRedirect, isTopLevel, referrerURI); globalHistory.setPageTitle(ourURI, "Mozilla"); Deleting from History // Pl...
Querying Places
ay contain duplicate entries for URLs, each with a different date. The nodes are of type RESULT_TYPE_VISIT, and provide a session ID for each visit. This session ID is the same for all pages that were reached by clicking links. A new session starts when the user types a new URL or follows a bookmark (XXX link to more details about what constitutes a session). RESULTS_AS_FULL_VISIT: This is an ext
ended version of RESULT_TYPE_VISIT. The results are of type RESULT_TYPE_FULL_VISIT and have additional information about the visit, such as the referring visit, and how the transition happened (typed, redirect, link, etc). Not yet implemented -- see bug 320831. Basic Query Search Parameters const unsigned long TIME_RELATIVE_EPOCH = 0 const unsigned long TIME_RELATIVE_TODAY = 1 const unsigned lon...
Retrieving part of the bookmarks tree
bookmarks toolbar: var bookmarksService = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getService(Components.interfaces.nsINavBookmarksService); var toolbarFolder = bookmarksService.toolbarFolder; The placesRoot is the root folder in the whole Places hierarchy. It contains administrative data as well as user data, and is therefore not recomm
ended for use in querying. Configure the query To get a hierarchical bookmarks result, pass the folder ID to setFolders in your query object: query.setFolders([toolbarFolder], 1); Run the query The executeQuery and executeQueries functions will return an nsINavHistoryResult object containing the results of your query: var result = historyService.executeQuery(query, options); Get the results When you ...
Using the Places history service
n be reconstructed at any time. The "session ID" allows these paths to be reconstructed more easily. When the user starts browsing (for example, by typing in a link or following a bookmark), a new session ID is created. New visits get the same session ID as their referrer. This means that one "session" is comprised of going to a new page, and following a bunch of links or redirects. A session is
ended when a new URL is typed in or selected from bookmarks. These session IDs allow the dotted lines separating related pages in the history view to be easily computed. Creating the history service The Places history service's contract ID is "@mozilla.org/browser/nav-history-service;1": var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"] ...
Interfacing with the XPCOM cycle collector
This is a quick overview of the cycle collector introduced into XPCOM for Firefox 3, including a description of the steps involved in modifying an existing C++ class to participate in XPCOM cycle collection. If you have a class that you think is involved in a cyclical-ownership leak, this page is for you. The int
ended audience is Mozilla C++ developers. What the cycle collector does The cycle collector spends most of its time accumulating (and forgetting about) pointers to XPCOM objects that might be involved in garbage cycles. This is the idle stage of the collector's operation, in which special variants of nsAutoRefCnt register and unregister themselves very rapidly with the collector, as they pass through a "suspicious" refcount event (from N+1 to N, for nonzero N). Periodically ...
Introduction to XPCOM for the DOM
a pointer to the nsIContent interface implemented by the nsHTMLAnchorElement object. However there is no such getter. I had to use the second solution: nsCOMPtr<nsIContent> content = getter_AddRefs(NS_STATIC_CAST(nsIContent*, this)); // Or, if you want to do the refcounting yourself, nsIContent *content = NS_STATIC_CAST(nsIContent*, this); The second form should be used with care, and is recomm
ended only for advanced XPCOM'ers. The use of XPCOM and nsCOMPtr's described until now covers about 80% of what you need to know to read the code, and even write some. I could go on about do_GetService, explain the implementation of QueryInterface, etc, but I feel this is not worth the trouble. For the more advanced topics of XPCOM, please see the XPCOM project page. The next section is a tutorial on...
XPConnect wrappers
ed in via some IDL-declared interface, creating an XPCWrappedJS, and is now being returned to JavaScript via some other interface. In order 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 recomm
ended using __exposedProps__ to expose objects from chrome to content. This is now deprecated and we are in the process of removing support for it. If you need to make objects or functions defined in chrome code accessible to content, use Components.utils.cloneInto or Components.utils.exportFunction. ...
NS_GetMemoryManager
yManager( nsIMemory** aResult ); Parameters aResult [out] A reference to the XPCOM Memory Manager. Return Values The NS_GetMemoryManager function returns NS_OK if successful. Otherwise, it returns an error code. Remarks The object returned is a singleton that is valid until NS_ShutdownXPCOM is called. The interface pointer should be Release'd when it is no longer needed. Any code, int
ended to be used exclusively with Mozilla 1.8 and above, may use NS_Alloc, NS_Realloc, and NS_Free instead to access the XPCOM Memory Manager's methods. History This function was finalized for Mozilla 0.9.7. See bug 112262 for details. See Also nsIMemory, NS_Alloc ...
XPCOM glue classes
If there is no base class method with the same signature, a compiler with static-checking enabled will fail to compile.NS_POSTCONDITIONMacroNS_PRECONDITIONMacronsACStringThe nsACString abstract class represents a character string composed of single-byte storage units. This class is typically used to represent ASCII or UTF-8 character arrays.nsACString (External)Cl...
amIInstallCallback
toolkit/mozapps/extensions/amIInstallTrigger.idlScriptable A callback function that web pages can implement to be notified when triggered installs complete. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview void onInstall
Ended(in AString aUrl, in PRInt32 aStatus); Methods onInstall
Ended() Called when an install completes or fails. void onInstall
Ended( in AString aUrl, in PRInt32 aStatus ); Parameters aUrl The url of the add-on being installed. aStatus 0 if the install was successful or negative if not. ...
imgIContainer
ntSize aViewportSize, 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 ext
ended to this area by clamping image sample coordinates. Otherwise, the image will be automatically tiled as necessary. aSubimage The area of the image, in pixels, that we are allowed to sample from. aViewportSize The size (in CSS pixels) of the viewport that would be available for the full image to occupy, if we were drawing the full image. (Note that we might not actually be drawing t...
mozIColorAnalyzer
esentativeColor(in nsIURI imageURI, in mozIRepresentativeColorCallback callback); Methods findRepresentativeColor() Given an image URI, find the most representative color for that image based on the frequency of each color. Preference is given to colors that are more interesting. It avoids the background color if it can be discerned and ignores sufficiently transparent colors. This is int
ended to be used on favicon images. Larger images take longer to process, especially those with a larger number of unique colors. If imageURI points to an image that has more than 128^2 pixels, this method will fail for performance reasons before analyzing it. void findRepresentativeColor( in nsIURI imageURI, in mozIRepresentativeColorCallback callback ); Parameters imageURI A URI po...
mozIStorageAsyncStatement
e for asynchronous execution. (mozIStorageStatement can be used for both synchronous and asynchronous purposes.) This specialization for asynchronous operation allows us to avoid needing to acquire synchronization primitives also used by the asynchronous execution thread. In contrast, mozIStorageStatement may need to acquire the primitives and consequently can cause the main thread to lock for ext
ended intervals while the asynchronous thread performs some long-running operation. Inherited interface mozIStorageBaseStatement ...
mozIStorageBindingParamsArray
(). Method overview void addParams(in mozIStorageBindingParams aParameters); mozIStorageBindingParams newBindingParams(); Attributes Attribute Type Description length unsigned long The number of mozIStorageBindingParams objects in the array. Methods addParams() Adds the specified set of parameters to the end of the array. The app
ended parameters will be used when mozIStorageStatement.executeAsync() is called. void addParams( in mozIStorageBindingParams aParameters ); Parameters aParameters The mozIStorageBindingParams object containing the parameters to append to the array. newBindingParams() Creates and returns a new, empty, mozIStorageBindingParams object to which you can add parameters and their values for bindi...
mozIStorageVacuumParticipant
cceeded); Attributes Attribute Type Description databaseConnection mozIStorageConnection A connection to the database file to be vacuumed. expectedDatabasePageSize long The expected page size, in bytes, for the database. The vacuum manager will try to correct the page size when the browser is idle, using this value as a target. Valid page sizes are in the range 512 to 65,536. The recomm
ended value is mozIStorageConnection::DEFAULT_PAGE_SIZE. Note: If the database is using the WAL journal node and the current page size is not the expected one, the journal node will be changed to TRUNCATE because WAL doesn't allow page size changes. The vacuum manager will try to restore WAL mode, but this will only work reliably if the participant properly resets statements. If the attempt to restore ...
nsIAccessible
nt. Focus and selection In order to focus an accessible or get focused child accessible use nsIAccessible.takeFocus() and nsIAccessible.focusedChild. To select an accessible you can use nsIAccessible.setSelected(), nsIAccessible.takeSelection() and nsIAccessible.extendSelection(). Actions You can prepare actions on some accessibles (for example on button accessible). The following methods are int
ended for this nsIAccessible.actionCount, nsIAccessible.getActionName(), nsIAccessible.getActionDescription() and nsIAccessible.doAction(). Descriptions nsIAccessible.description and nsIAccessible.help provides additional text information about accessible. Attributes Many accessibles exposes attributes to provide more details that cannot be fit into existing API methods, please refer to attributes docu...
nsIAccessibleEvent
cation is about to enter drag-and-drop mode. EVENT_DRAGDROP_END 0x0023 0x0020 An application is about to exit drag-and-drop mode. EVENT_DIALOG_START 0x0024 0x0021 A dialog box has been displayed. EVENT_DIALOG_END 0x0025 0x0022 A dialog box has been closed. EVENT_SCROLLING_START 0x0026 0x0023 Scrolling has started on a scroll bar. EVENT_SCROLLING_END 0x0027 0x0024 Scrolling has
ended on a scroll bar. EVENT_MINIMIZE_START 0x0028 0x0025 A window object is about to be minimized or maximized. EVENT_MINIMIZE_END 0x0029 0x0026 A window object has been minimized or maximized. EVENT_DOCUMENT_LOAD_COMPLETE 0x002B 0x0027 The loading of the document has completed. EVENT_DOCUMENT_RELOAD 0x002C 0x0028 The document contents are being reloaded. EVENT_DOCUMENT_LOAD_STOPPED ...
nsIAppStartup
It also helps in quitting applications as well. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISupports Last changed in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6) Implemented by: @mozilla.org/toolkit/app-startup;1. ...
nsIArray
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. 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 int
ended the array to be modified, it would have returned an nsIMutableArray! null is a valid entry in the array, and as such any nsISupports parameters may be null, except where noted. Method overview nsISimpleEnumerator enumerate(); unsigned long indexOf(in unsigned long startIndex, in nsISupports element); void queryElementAt(in unsigned long index, in nsIIDRef uuid, [iid_is(uuid), retval] out n...
nsIAuthModule
netwerk/base/public/nsIAuthModule.idlScriptable This interface is int
ended to be used as server and client authentication service. Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void getNextToken([const] in voidPtr aInToken, in unsigned long aInTokenLength, out voidPtr aOutToken, out unsigned long aOutTokenLength); void init(in string aServiceName, in unsigned long aServiceFlags, in wstring aDomain, in wstring aUsername, in wstring aPassword); void unwrap([const] in voidPtr aInToken, in unsigned long aInTokenLength, out voidPtr aOutToken, out unsigned long aOutTokenLength); void wrap([const] in voidPtr aInToken, in unsigned long aInTokenLength, in boolean confidential, out voidPtr aOutToken, out unsig...
nsIClipboardDragDropHookList
widget/public/nsIClipboardDragDropHookList.idlScriptable This interface is an internal Gecko component. It provides basic operations such as adding, removing and enumerating clipboard hooks for the nsIClipboardDragDropHooks interface. Inherits from: nsISupports Last changed in Gecko 1.7 Note: This interface is not int
ended for direct use by embedders; it is an implementation detail. You should access these capabilities indirectly by sending commands using the nsIClipboardDragDropHooks interface. Within Gecko, this interface is used by calling get_Interface on a docshell. Method overview void addClipboardDragDropHooks(in nsIClipboardDragDropHooks aHooks); nsISimpleEnumerator getHookEnumerator(); void removeClipboardDragDropHooks(in nsIClipboardDragDro...
nsIClipboardDragDropHooks
he drag from starting. boolean allowStartDrag( in nsIDOMEvent event ); Parameters event The DOM event (drag gesture). Return value true if the drag can proceed. Otherwise, false to show the drag is canceled (Does not go to Operating System). onCopyOrDrag() Alters the flavors or data presented to the OS. Used for drag and copy actions. Because this can be called many times, it is highly recomm
ended that the implementation be very efficient so user feedback is not negatively impacted. boolean onCopyOrDrag( in nsIDOMEvent aEvent, in nsITransferable trans ); Parameters aEvent The DOM event (drag drop). null if triggered by copy. trans The transferable holding the list of flavors and the data for each flavor. Return value true to indicate that copy/drag can proceed. Otherwise, false to i...
nsICollection
dex); void QueryElementAt(in PRUint32 index, in nsIIDRef uuid, [iid_is(uuid),retval] out nsQIResult result); void RemoveElement(in nsISupports item); void SetElementAt(in PRUint32 index, in nsISupports item); Methods AppendElement() Appends a new item to the collection. void AppendElement( in nsISupports item ) Parameters item nsISupports item to be app
ended to the list. Clear() Removes all items from the collection. void Clear(); Parameters None. Count() Returns the number of items in the collection. PRUint32 Count(); Parameters None. Return value Number of items in the list. Enumerate() Returns an nsIEnumerator that lets you iterate over the items in the collection. nsIEnumerator Enumerate(); Parameters None. Return value An nsIEnumerator. GetE...
nsICookieManager
An optional interface for accessing or removing the cookies that are in the cookie list. netwerk/cookie/nsICookieManager.idlScriptable Please add a summary to this article. Last changed in Gecko 1.7 Inherits from: nsISupports This interface is int
ended to be used as a service. It is implemented by the @mozilla.org/cookiemanager;1 component, but should generally be accessed via Services.cookies Method overview void remove(in AUTF8String aHost, in ACString aName, in AUTF8String aPath, in boolean aBlocked, in jsval aOriginAttributes); void removeAll(); Attributes Attribute Type Description enumerator nsISimpleEnumerator Called to enumerate through each cookie in the cookie list. The objects enumerated over are of type...
nsIDOMEvent
nBubbleArg, in boolean cancelableArg ); Parameters eventTypeArg Specifies the event type. This type may be any event type currently defined in this specification or a new event type. The string must be an XML name. Any new event type must not begin with any upper, lower, or mixed case version of the string "DOM". This prefix is reserved for future DOM event sets. It is also strongly recomm
ended that third parties adding their own events use their own prefix to avoid confusion and lessen the probability of conflicts with other new events. canBubbleArg Specifies whether or not the event can bubble. cancelableArg Specifies whether or not the event's default action can be prevented. Violates the XPCOM interface guidelines IsDispatchStopped() boolean IsDispatchStopped(); Par...
nsIDOMGlobalPropertyInitializer
the content-document-global-created notification. Method overview jsval init(in nsIDOMWindow window); Methods init() jsval init( in nsIDOMWindow window ); Parameters window The window to which the global property is being attached. Return value The initialized global property. Ensure that you never return any internal XPCOM objects to untrusted code. It is also recomm
ended to use __exposedProps__ to control which members are exposed. ...
nsIDOMHTMLSourceElement
DOMString The type attribute gives the type of the media resource, to help the user agent determine if it can play this media resource before fetching it. If specified, its value must be a valid MIME type. The codecs parameter may be specified and might be necessary to specify exactly how the resource is encoded. media Unimplemented DOMString The media attribute gives the int
ended 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 support the <code>video</code> element. </video> This example specifies that a video object with...
nsIDOMNSHTMLDocument
Thunderbird 3.3 / SeaMonkey 2.1) void write( [optional] in DOMString text ); Parameters text The string to write to the document. writeln() Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) void writeln( [optional] in DOMString text ); Parameters text The string to write to the document. A newline is automatically app
ended. Implemented by Classes that implement this interface: nsHTMLDocument class: content/html/document/src/nsHTMLDocument.h ...
nsIDOMXULElement
ing Gets/sets the value of the element's class attribute. collapsed boolean true if the element's collapsed attribute is the string "true", otherwise false. Removes the attribute if you set it to false. contextMenu DOMString Gets/sets the value of the element's contextmenu attribute. controllers nsIControllers Read only. Returns an nsIControllers object that additional controllers may be app
ended to so as to provide focus-specific actions for commands. database nsIRDFCompositeDataSource Read only. Returns the template builder's database, if it is an RDF template. datasources DOMString Gets/sets the value of the element's datasources attribute. dir DOMString Gets/sets the value of the element's dir attribute. flex DOMString Gets/sets the value of the element's flex attribute. fle...
nsIEditorDocShell
Inherits from: nsISupports Last changed in Gecko 1.7 Use nsIEditingSession.makeWindowEditable() and nsIEditingSession.getEditorForWindow() from out side. Method overview void makeEditable(in boolean inWaitForUriLoad); Attributes Attribute Type Description editable boolean This docShell is editable. Read only. editor nsIEditor Gets or sets the editor for the content document. hasEditingSession boolean This docShell has an editing session. Read only. ...
nsIFaviconService
y to re-load the icon from the net (or more likely the cache). If the icon is in the failed favicon cache we won't do anything. Use aForceReload to force a reload of the data. This will remove the favicon from the failed cache. If it then fails again, it will be re-added to the failed cache. SetFaviconUrlForPage() and setFaviconData() will take any URL you provide and save it. This function is int
ended for automatic usage, and will only save favicons for "good" URLs, as defined by what gets added to history. For "bad" URLs, this function will succeed and do nothing. This function will also ignore the error page favicon URI (chrome://global/skin/icons/warning-16.png). Icons that fail to load will automatically be added to the failed favicon cache. This function will not save favicons for non-boo...
nsIFeedResult
rsed before the error occurred. doc nsIFeedContainer The parsed feed or entry. null if a non-feed was processed. headers nsIProperties The HTTP response headers that accompanied the feed. stylesheet nsIURI An XSLT stylesheet available to transform the source of the feed. Some feeds include this information in a processing instruction. It's generally int
ended for use by clients designed to work with specific feeds. uri nsIURI The address from which the feed was fetched. version AString The version of the feed; null if a non-feed is processed. This value will be one of the following: atom, rss2, rss09, rss091, rss091userland, rss092, rss1, atom03, atomEntry, rssItem Methods registerExtensionPrefix() Registers a pr...
nsIHttpChannelInternal
netwerk/protocol/http/nsIHttpChannelInternal.idlScriptable An internal interface for HTTP channels. Using features exposed by this interface is not recomm
ended, as it will change in unpredictable ways. 66 Introduced Gecko 1.0 Inherits from: nsISupports Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Method overview void getRequestVersion(out unsigned long major, out unsigned long minor); void getResponseVersion(out unsigned long major, out unsigned long minor); void HTTPUpgrade(in ACString aProtocolName, in nsIHttpUpgradeListener aListener); void setCookie(in string aCookieHeader); void setupFallbackChannel(in string aFallbackKey); Attributes Attribute Type Description canceled boolean Returns true if and only if th...
nsIIdleService
ou can add the same observer twice. Most implementations need to poll the OS for idle info themselves, meaning your notifications could arrive with a delay up to the length of the polling interval in that implementation. Current implementations use a delay of 5 seconds. Gecko 1.9.2 note Starting in Gecko 1.9.2, there is a once a day notification sent out if the user remains idle for an ext
ended period: 'idle-daily'. The data parameter for the notification contains the current user idle time. void addIdleObserver( in nsIObserver observer, in unsigned long time ); Parameters observer The nsIObserver to be notified. time The amount of time in seconds the user should be idle before the observer should be notified. removeIdleObserver() Remove an observer registered with addI...
nsILoginInfo
e, "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 app
ended. 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. password AString The p...
nsILoginManagerCrypto
cessfully decrypted (for example, if it was encrypted with some other key). AString decrypt( in AString cipherText ); Parameters cipherText The string to be decrypted. Return value The decrypted string. encrypt() Encrypts the specified string, returning the ciphertext value. Note: The current implemention of this inferface simply uses NSS/PSM's "Secret Decoder Ring" service. It is not recomm
ended for general purpose encryption/decryption. Can throw if the user cancels entry of their master password. AString encrypt( in AString plainText ); Parameters plainText The string to be encrypted. Return value The encrypted string. ...
nsILoginMetaInfo
3 / SeaMonkey 2.1) You can specifically modify these values by passing changes into nsILoginManager.modifyLogin() using an nsIPropertyBag2 object as the input. Metadata properties are ignored when comparing logins. Attributes Attribute Type Description guid AString The GUID to uniquely identify the login. This can be any arbitrary string, but a format as created by nsIUUIDGenerator is recomm
ended. For example, "{d4e1a1f6-5ea0-40ee-bff5-da57982f21cf}" timeCreated unsigned long long The time, in Unix Epoch milliseconds, when the login was first created. timeLastUsed unsigned long long The time, in Unix Epoch milliseconds, when the login was last submitted in a form or used to begin an HTTP auth session. timePasswordChanged unsigned long long The time, in Unix Epoch milliseconds, whe...
nsIMsgFolder
eam); copyDataDone() void copyDataDone(); setJunkScoreForMessages() void setJunkScoreForMessages(in nsISupportsArray aMessages, in ACString aJunkScore); applyRetentionSettings() void applyRetentionSettings(); fetchMsgPreviewText() Get the beginning of the message bodies for the passed in keys and store them in the msg hdr property "preview". This is int
ended for new mail alerts, title tips on folders with new messages, and perhaps titletips/message preview in the thread pane. boolean fetchMsgPreviewText([array, size_is (aNumKeys)] in nsMsgKey aKeysToFetch, in unsigned long aNumKeys, in boolean aLocalOnly, in nsIUrlListener aUrlListener); addKeywordsToMessages()...
nsIMsgMessageService
in nsIUrlListener aUrlListener, out nsIURI aURL, in boolean canonicalLineEnding, in nsIMsgWindow aMsgWindow); Parameters aMessageURI Url representing the message to spool out to disk. aFile The file you want the message saved to. aGenerateDummyEnvelope Usually false. Set to true if you want the message app
ended at the end of the file. aUrlListener A nsIUrlListener for being notified when the copy is finished. canonicalLineEnding aMsgWindow nsIMsgWindow for progress and status feedback Return values aURL The new nsIURI of the saved message. Note: This operation may be obsolete. You always can use streamMessage to get the eml string representation of the message and then write it using File I...
nsIMsgSearchCustomTerm
*/ readonly attribute ACString id; name /// name to display in term list. This should be localized. ...
nsINavBookmarkObserver
ch change, but the observer is guaranteed that onEndUpdateBatch() will be called at the completion of changes. During a batch the observer should do its best to reduce the work done to handle notifications, since multiple changes are going to happen in a short timeframe. void onBeginUpdateBatch(); Parameters None. onEndUpdateBatch() This method notifies this observer that a batch transaction has
ended. void onEndUpdateBatch(); Parameters None. onFolderAdded() Obsolete since Gecko 1.9 (Firefox 3) Notify this observer that a bookmark folder has been added. void onFolderAdded( in PRInt64 folder, in PRInt64 parent, in PRInt32 index ); Parameters folder The id of the folder that was added. parent The id of the folder's parent. index The fol...
nsINavHistoryContainerResultNode
ot the node can have children, and may be used whether the container is open or closed. When the container is closed, the result is an exact answer if the node can be populated easily (for example, for bookmark folders). If it can't be populated easily (for complex history queries, for example), the result is always true. When the container is open, the result is always accurate. This value is int
ended to be used to see if the "+" should be drawn next to a tree item, indicating that the item can be opened. Read-only. remoteContainerType Obsolete since Gecko 1.9 AUTF8String A string representing the remote container service API that is responsible for this container. If there is no such API, this value is an empty string. Read only. The container may be a RESULT_TYPE_REMOTE_CONTAINER node tha...
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: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) The nsINavHistoryQuery is not int
ended to be a super-general query mechanism. This was designed so that most queries can be done in only one SQL query. This is important because, if the user has their profile on a networked drive, query latency can be non-negligible Method overview nsINavHistoryQuery clone(); void getFolders([optional ]out unsigned long count, [retval,array,size_is(count)] out long long folders); void getTransitions(...
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 int
ended to be displayed to the user in some meaningful way. Inherits from: nsISupports 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 int
ended 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 sink...
nsIScriptableUnescapeHTML
is to true if the fragment is an XML string; otherwise set it to false. baseURI Pointer to the base URI against which to resolve any URIs included in the fragment. This parameter is ignored if isXML is false. element The nsIDOMElement to be used as the context node for the purposes of the fragment parsing algorithm. Return value An nsIDOMDocumentFragment of the element with the new text app
ended. Exceptions thrown NS_ERROR_FAILURE Unable to append the text to the element. unescape() Convents HTML source into plain text. This is equivalent to calling nsIParserUtils::convertToPlainText(src, nsIDocumentEncoder::OutputSelectionOnly | nsIDocumentEncoder::OutputAbsoluteLinks, 0). You should call nsIParserUtils::convertToPlainText() instead of calling this method. AString unescape( ...
nsIScriptableUnicodeConverter
InputStream(in AString aString); Attributes Attribute Type Description charset string Current character set. Throws NS_ERROR_UCONV_NOCONV if the requested charset is not supported. Methods ConvertFromUnicode() Converts the data from Unicode to one Charset. Returns the converted string. After converting, Finish should be called and its return value app
ended to this return value. ACString ConvertFromUnicode( in AString aSrc ); Finish() Returns the terminator string. Should be called after ConvertFromUnicode() and app
ended to that function's return value. ACString Finish(); ConvertToUnicode() Converts the data from one Charset to Unicode. AString ConvertToUnicode( in ACString aSrc ); convertFromByteArray() Converts an array of bytes to...
nsISelection
romDocument(); extend() Extends the selection by moving the selection end to the specified nsIDOMNode and offset, preserving the selection begin position. The new selection end result will always be from the anchorNode to the new focusNode, regardless of direction. void extend( in nsIDOMNode parentNode, in long offset ); Parameters parentNode The node where the selection will be ext
ended to. offset Where in the node to place the offset in the new selection end. Native code only!extendNative void extendNative( in nsINode parentNode, in long offset ); Parameters parentNode offset getRangeAt() Returns the nsIDOMRange at the specified index. nsIDOMRange getRangeAt( in long index ); Parameters index Return value The nsIDOMRange requested modify() Modi...
nsISessionStore
rn value The string value that was previously assigned to aKey using nsISessionStore.setWindowValue(), or an empty string if no value is set for that key. If the previously saved value was originally a complex data (ie a JavaScript object) it can then be deserialized using JSON.parse cf. nsISessionStore.setWindowValue(). init() Initializes the session store service. Note: This function is int
ended for use only by the browser; extensions shouldn't call it. void init( in nsIDOMWindow aWindow ); Parameters aWindow The window for which to initialize the service. persistTabAttribute() Sets the name of a tab attribute to be saved and restored for all XUL tabs. Note: At present, there's no way to pick and choose tabs to set persistent attributes for. This method affects all tabs indi...
nsIStringBundle
Alternatively, a string bundle can be created within a javascript context with nsIStringBundleService. ...
nsIThreadInternal
ttribute may be read from any thread but must only be set on the thread corresponding to this thread object. The observer will be released on the thread corresponding to this thread object after all other events have been processed during a call to Shutdown. Methods popEventQueue() Reverts a call to PushEventQueue(). When an event queue is popped, any events remaining in the queue are app
ended to the elder queue. void popEventQueue(); Parameters None. pushEventQueue() Causes any events currently enqueued on the thread to be suppressed until PopEventQueue() is called. In addition, any new events dispatched to the thread are only processed if they are accepted by the specified filter. If the filter is null, all new events are accepted. Calls to pushEventQueue() may be nested, and...
nsIThreadPool
/set the amount of time in milliseconds that a thread must be idle before it becomes eligible to be destroyed. listener nsIThreadPoolListener An optional listener that will be notified when a thread is created or destroyed in the course of the thread pool's operation. A listener will only receive notifications about threads created after the listener is set so it is recomm
ended that the consumer set the listener before dispatching the first event. A listener that receives an nsIThreadPoolListener.onThreadCreated() notification is guaranteed to always receive the corresponding nsIThreadPoolListener.onThreadShuttingDown() notification. The thread pool takes ownership of the listener and releases it when the shutdown() method is called. Threads created after the listen...
nsIToolkitProfileService
leService); Prior to Gecko 1.9.1 only the built-in profile manager was able to access the toolkit profile service. To access the built-in profile manager in versions of Firefox up to 4.0 and Thunderbird up to 3.3 you can launch with the -profilemanager command line flag. Future versions will require the separate Profile Manager application. Warning: This service is synchronous so it is recomm
ended that you use OS.File to find the profile directory via OS.Constants.Path.profileDir. OS.File is available from Gecko 18 (Firefox 18.0 / Thunderbird 18.0 / SeaMonkey 2.15). Method overview nsIToolkitProfile createProfile(in nsILocalFile aRootDir, in AUTF8String aName); void flush(); nsIToolkitProfile getProfileByName(in AUTF8String aName); nsIProfileLock lo...
nsITransferable
kURLMime text/x-moz-url A Mozilla URL object; this is a text string containing the URL, a newline (\n), then the title of the page. kURLDataMime text/x-moz-url-data A string containing only a URL. kURLDescriptionMime text/x-moz-url-desc A string containing only a description. kURLPrivateMime text/x-moz-url-priv The same as kURLDataMIme, except int
ended for private use only. kNativeImageMime application/x-moz-nativeimage An image in Gecko's native internal image storage format. kNativeHTMLMime application/x-moz-nativehtml HTML in Gecko's native internal storage format. kHTMLContext text/_moz_htmlcontext Along with kHTMLInfo, this is used to provide the context for a fragment of HTML source. Contains t...
nsITreeView
operties: function(index) { return "dummy"; } Obsolete since Gecko 22 (Firefox 22 / Thunderbird 22 / SeaMonkey 2.19)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. ...
nsIUploadChannel
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 support both streams that already have headers (for example, Content-Type and Content-Length) information prep
ended 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, in ACString aContentType, in long aContentLength ); Parameters aStream The stream to be uploaded by this...
nsIWebNavigation
ags Flags modifying load behaviour. This parameter is a bitwise combination of the load flags defined above. (Undefined bits are reserved for future use.) Generally you will pass LOAD_FLAGS_NONE for this parameter. referrer The referring URI. If this argument is null, then the referring URI will be inferred internally. postData If the URI corresponds to a HTTP request, then this stream is app
ended directly to the HTTP request headers. It may be prefixed with additional HTTP headers. This stream must contain a \r\n sequence separating any HTTP headers from the HTTP request body. This parameter may be null. headers If the URI corresponds to a HTTP request, then any HTTP headers contained in this stream are set on the HTTP request. The HTTP header stream is formatted as: ( HEADER \r\n )* Th...
nsIWebProgressListener2
uriloader/base/nsIWebProgressListener2.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9 (Firefox 3) Inherits from: nsIWebProgressListener Method overview void onProgressChange64(in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long long aCurSelfProgress, in long long aMaxSelfProgress, in long long aCurTotalProgress, in long long aMaxTotalProgress); boolean onRefreshAttempted(in nsIWebProgress aWebProgress, in nsIURI aRefreshURI, in long aMillis, in boolean aSameURI); Methods onProgressChange64() Notification that the progress has changed for one of the requests associated with aWebProgress. ...
nsIXULTemplateBuilder
ven ID. getResultForContent() Retrieves the result corresponding to a generated element, or null is there isn't one. nsIXULTemplateResult getResultForContent( in nsIDOMElement aElement ); Parameters aContent Element to result the result of Return value The result for the specified element. hasGeneratedContent() Determines whether or not the node has content generated for it. This method is int
ended to be called only by the RDF query processor. If aTag is set, the content must have a tag name that matches aTag. aTag may be ignored for builders that don't generate real DOM content. boolean hasGeneratedContent( in nsIRDFResource aNode, in nsIAtom aTag ); Parameters aNode Node to check. aTag Tag that must match. Return value Returns true if the node has content generated for it; otherwise...
Getting Started Guide
ample above would look like this How to QueryInterface into an nsCOMPtr. // The best way to |QueryInterface| into an |nsCOMPtr|... nsresult rv; nsCOMPtr<nsIFoo> foo(do_QueryInterface(bar, &rv)); // Or, if you don't care about the |nsresult| nsCOMPtr<nsIFoo> foo(do_QueryInterface(bar)); nsCOMPtr happily calls AddRef and Release implicitly. This same favor is not ext
ended to QueryInterface. nsCOMPtr does not QueryInterface on assignment without your explicit permission in the form of the do_QueryInterface directive. You need never worry about hidden queries. However, be aware that if you should have queried but didn't, e.g., when assigning in a raw pointer where C++ allows the assignment, but XPCOM wouldn't, nsCOMPtr will assert at runtime. Use do_QueryInterface w...
Reference Manual
o learn). Is there a getter_doesnt_AddRef( nsCOMPtr& ) for getters that return non-AddRefed results through a parameter? No, there isn't. Once upon a time, there was, but it went away for three reasons: It is against the rules of XPCOM for a getter to return a non-AddRefed interface pointer through a parameter (if you see it, report a bug). getter_doesnt_AddRef had complex ramifications that
ended up making nsCOMPtrs either bigger or slower than raw XPCOM interface pointers. You can still call such a getter and put the result into an nsCOMPtr with a temporary, e.g., // Calling a getter that (illegally) doesn't |AddRef| its result... nsIFoo* temp; nsresult rv = GetFoo_WithoutAddRef(&temp); // Note to self: must report |GetFoo_WithoutAddRef| as a bug, all gette...
Xptcall Porting Guide
in32 version is somewhat tighter because the __declspec(naked) feature allows for very small stubs. However, the __stdcall requires the callee to clean up the stack, so it is imperative that the interface information scheme allow the code to determine the correct stack pointer fixup for return without fail, else the process will crash. I opted to use inline assembler for the gcc Linux x86 port. I
ended up with larger stubs than I would have preferred rather than battle the compiler over what would happen to the stack before my asm code began running. I believe that the non-assembly parts of these files can be copied and reused with minimal (but not zero) platform specific tweaks. Feel free to copy and paste as necessary. Please remember that safety and reliability are more important than speed ...
xpidl
L and glib. Using xpidl To add an IDL file to the build, use the XPIDLSRCS makefile variable. For testing purposes, or one-off interface compilation, xpidl can be run from the command line: Usage: ./xpidl -m mode [-w] [-v] [-t version number] [-d filename.pp] [-I path] [-o basename | -e filename.ext] filename.idl -a emit annotations to typelib -w turn on warnings (recomm
ended) -v verbose mode (NYI) -t create a typelib of a specific version number -I add entry to start of include path for ``#include "nsIThing.idl" -o use basename (e.g. ``/tmp/nsIThing) for output -e use explicit output filename -d write dependencies (requires -e) -m specify output mode: header Generate C++ header (.h) ...
XUL Overlays
e is superimposed over the original, and the Mozilla icon replaces the Netscape icon. Overlay positioning XUL overlays also support 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 app
ended to the end of the menu like the other kids. <overlay id="main-overlay" 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"> <menu id="file_menu"> <menuitem name="Example One"/> <menuitem name="Example Two"/> <menuitem name="Example Three"/> <menuitem name=...
LDAP Support
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. For large companies, there may be a large number of users in the directory with the same name. ...
Mailnews and Mail code review requirements
reviewing patches to the mozilla/mailnews and mozilla/mail directories. Thunderbird and SeaMonkey are the primary users of the code in mozilla/mailnews. Thunderbird's front-end code is stored in mozilla/mail. (A fair amount of this code is forked from code in the mailnews/ directory). Mailnews and Mail review rules Patches affecting Thunderbird User Experience or Interfaces Note: It is recomm
ended that when working on bugs that affect user experience or interfaces, that ui-review is obtained at an early stage in the patch development process. Getting early ui-reviews this reduces the chance that work is rejected due to needing further user experience changes, and hence is aimed at saving time for the developer and reviewers. All patches that affect user experience or interfaces on Thun...
Thunderbird Configuration Files
by default, so you need to create it before you can start adding your preferences. user.js This is the additional preferences file for Thunderbird and is located in your profile folder. The file does not exist by default, so you need to create it before you can start adding your preferences. In almost all cases, edits made using the user.js can be done via the Config Editor, which is the recomm
ended method. Windows users: If you know how to create a file, just skip this section. Before you can create the file, you must make sure that you can see the file type extensions in Windows. Start Explorer (just click on the My Computer icon on your desktop) and select Tools > Folder Options. Click the View tab and uncheck the Hide extensions for known file types option. Now, go to your profile folde...
Building a Thunderbird extension 3: install manifest
m:id>: This element contains the version id of the application that this add on is developed for. It is 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 int
ended to work. Do not use a wildcard (such as "*"). See Valid Application Versions for a list of the supported version numbers and formats. <em:maxVersion>5.0.*</em:maxVersion>: This element indicates the most recent version of Thunderbird for which the extension is int
ended to work. This cannot be higher than the currently available version. "5.0.*" indicates that the extension works with Thunderbird...
Demo Addon
such as working with Gloda. You can download it at the bottom of the page. How to use After installing the demo add-on in Thunderbird, right click on the toolbar and choose "Customize". Drag the "Demo" button into the toolbar. Afterwards, just click that button to show the demo overview. All three demos are explained in the following sections. Only the interesting parts are shown, it's recomm
ended that you download the add-on and have a look at its files. The basics The interesting parts covered in this article are in the content folder. The toolbar button and its functionality are defined in overlay.xul and overlay.js. We make use of fixIterator(). It is a handy library that keeps your code cleaner and simpler. It lets you iterate over any collection and transforms your collection elem...
Virtualenv
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. ...
Declaring types
ss a pointer to the tm struct var jsString = timeStr.readString(); // Convert the C string to JavaScript The last line converts the C string returned by the libc asctime() function into a JavaScript string by calling the CData readString() method. For another example see here: GetCursorPos Opaque structures An opaque structure is one whose content fields are not known, or are not int
ended to be accessed directly. They can also be used to handle forward declarations, by declaring a structure as opaque if it needs to include a structure that has yet to be declared. You can then define the fields in the opaque structure later by calling the CType object's define() method. For example: var someStructure = ctypes.StructType("someStructure"); var anotherStruct = ctypes.StructType("ano...
Standard OS Libraries
x11 - X11 js-ctypes snippets that can be copied and pasted to scratchpad XCB All the above methods, GDK, GTK, and X11/Xlib are meant to be used on the main thread. If you would like to do stuff off of the main thread, in ChromeWorker's, then you should use XCB. XCB is thread safe. Resources for XCB GitHub :: Noitidart - ostypes / o...
Working with ArrayBuffers
Method 1, but instead manually goes through the array and sets the ImageData array. The cast takes a couple of milliseconds, roughly the same as Method 1. However, the manual Method A, in the preceding example, takes ~1300 ms. Method B takes ~1400 ms, for an array length of 52,428,800 (which is image size of 1280 x 1024 pixels). Method 3: Transfer byte array by calling memcpy This is the recomm
ended method, as it only takes a couple of milliseconds, even for large arrays. Notice that the following example does not cast the pixelBuffer. Passing an ArrayBuffer object to pointer type will pass the pointer to buffer (Based on //github.com/RealityRipple/UXP/blob/master/js/src/ctypes/CTypes.cpp#3080). Further, it returns dataPointer, and there is no extra allocation (Based on //github.com/RealityR...
CData
ovides a way to get a pointer to the actual data of the C value represented by the CData object. CData address() Parameters None. Return value A CData object of the pointer type ctypes.PointerType(dataObject.constructor) whose value points to the C object referred to by the object. toSource() Returns the string "t(arg)", where t and arg are implementation-defined JavaScript expressions int
ended to represent the type of the CData object and its value, respectively. String toSource() Parameters None. Return value A string that, ideally, should be able to be evaluated to produce a new CData object containing a copy of the original object. However, this only works if the object's type happens to be bound to an appropriate name in scope. In theory, in other words, the following JavaSc...
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. ...
Plug-in Development Overview - Plugins
ities. To make the user feel that the plug-in is part of the the browser user interface, your plug-in can emulate the browser behavior by providing status line messages. Use the NPN_Status method to display a message on the status line. For information about using this method, see Version, UI, and Status Information. Making Plug-ins Scriptable Scriptable plug-ins are plug-ins that have been ext
ended to provide methods that can be called from JavaScript and the DOM when accessed through the object or embed element. Consider the following example, where a media player plug-in can be controlled with an advanceToNextSong() method called inside the script element: <object id="myPlugin" type="audio/wav" data="music.wav"> </object> <script type="application/javascript"> var thePlugin = d...
Plugin Roadmap for Firefox - Plugins
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 supports the Flash plugin. March 2017 Starting with Firefox 52 in March 2017, plugins other than Adobe Flash are no longer supported in Firefox. Firefox Ext
ended Support Release 52 will continue to support 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 performanc...
Accessibility Inspector - Firefox Developer Tools
Fall", and the color contrast ratio, 3.46, appears in the information bar above it. Color contrast Contrast ratio information is particularly useful when you are designing the color palette for your website because if the contrast is not sufficient, readers with visual impairments such as low vision or color blindness will be unable to read the text. See Color contrast for details about recomm
ended contrast ratios. For example: The color contrast in the image above is 2.86, so potentially not enough contrast to make it easy to read. Notice the warning symbol that indicates that the contrast fails to meet the acceptable contrast ratio. As of Firefox 65, viewing this information for some foreground text that has a complex background image (e.g. a gradient) gives you a range of color cont...
Debugger.Source - Firefox Developer Tools
he 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 WebAssembly.Module with the string "> wasm" app
ended. sourceMapURL If the instance refers to JavaScript source, if this source was produced by a minimizer or translated from some other language, and we know the URL of a source map document relating the source positions in this source to the corresponding source positions in the original source, then this property's value is that URL. Otherwise, this is null. (On the web, the translator may ...
Debugger - Firefox Developer Tools
whether asm.js code running inside this Debugger instance's debuggee globals is invisible to Debugger API handlers and breakpoints. Setting this to false inhibits the ahead-of-time asm.js compiler and forces asm.js code to run as normal JavaScript. This is an accessor property with a getter and setter. It is initially false in a freshly created Debugger instance. Setting this flag to true is int
ended for uses of subsystems of the Debugger API (e.g, Debugger.Source) for purposes other than step debugging a target JavaScript program. allowWasmBinarySource A boolean value indicating whether WebAssembly sources will be available in binary form. The WebAssembly text generation will be disabled. collectCoverageInfo A boolean value indicating whether code coverage should be enabled inside ea...
Deprecated tools - Firefox Developer Tools
rl + 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 browsers, such as Firefox for Android. It was also int
ended to support 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. C...
Throttling - Firefox Developer Tools
o throttle your network speed to emulate various different network speed conditions. Simply choose an option from the menu, and it will persist across reloads. The characteristics emulated are: Download speed Upload speed Minimum latency The table below lists the numbers associated with each network type, but please do not rely on this feature for exact performance measurements; it's int
ended to give an approximate idea of the user experience in different conditions. The speeds are expressed in multiples of bits per second. Selection Download speed Upload speed Minimum latency (ms) GPRS 50 Kbps 20 Kbps 500 Regular 2G 250 Kbps 50 Kbps 300 Good 2G 450 Kbps 150 Kbps 150 Regular 3G 750 Kbps 250 Kbp...
Allocations - Firefox Developer Tools
n between the allocation profile of a site and its responsiveness is the cost of garbage collection (GC). With a garbage-collected language, like JavaScript, the runtime periodically needs to walk the heap looking for objects that are no longer reachable, and then freeing the memory they occupy. While GC events like this are executing, the JavaScript engine must be paused, so your program is susp
ended and will be completely unresponsive. To reduce the impact on responsiveness, SpiderMonkey (the JavaScript engine in Firefox) can perform GC in small increments, letting the program run in between. Sometimes, though, it needs to perform a full non-incremental collection, and the program has to wait for it to finish. GC events are shown as red markers in the Waterfall view, and are a big red flag...
Waterfall - Firefox Developer Tools
ck the Waterfall for long green markers. Garbage collection Red markers in the Waterfall represent garbage collection (GC) events, in which SpiderMonkey (the JavaScript engine in Firefox) walks the heap looking for memory that's no longer reachable and subsequently releasing it. GC is relevant to performance because while it's running the JavaScript engine must be paused, so your program is susp
ended and will be completely unresponsive. To help reduce the length of pauses, SpiderMonkey implements incremental GC: this means that it can perform garbage collection in fairly small increments, letting the program run in between. Sometimes, though, it needs to perform a full non-incremental collection, and the program has to wait for it to finish. In trying to avoid GC events, and especially n...
Responsive Design Mode - Firefox Developer Tools
r connection. In Responsive Design Mode, you can instruct the browser to emulate, very approximately, the characteristics of various different types of networks. The characteristics emulated are: Download speed Upload speed Minimum latency The table below lists the numbers associated with each network type, but please do not rely on this feature for exact performance measurements; it's int
ended to give an approximate idea of the user experience in different conditions. Selection Download speed Upload speed Minimum latency (ms) GPRS 50 KB/s 20 KB/s 500 Regular 2G 250 KB/s 50 KB/s 300 Good 2G 450 KB/s 150 KB/s 150 Regular 3G 750 KB/s 250 KB/s 100 Good 3G 1.5 MB/s 750 KB/s 40 ...
Taking screenshots - Firefox Developer Tools
tions (e.g. --clipboard) are included. --filename string The name to use in saving the file. The file should have a ".png" extension. --fullpage boolean If included, the full webpage will be saved. With this parameter, even the parts of the webpage which are outside the current bounds of the window will be included in the screenshot. When used, "-fullpage" will be app
ended to the file name. --selector string A CSS selector that selects a single element on the page. When supplied, only this element and its descendants will be included in the screenshot. Note: If you capture an image to a filename like test.png, and then you capture to that same filename, the new image will overwrite the old image. So if you're using the up-arrow history scrol...
Tips - Firefox Developer Tools
ot <filename.png> --fullpage saves a screenshot to your downloads directory using the optional file name. If no filename is included, the file name will be in this format: Screen Shot date at time.png The --fullpage parameter is optional. If you include it, the screenshot will be of the whole page, not just the section visible in the browser windows. The file name will have -fullpage app
ended to it as well. See Web Console Helpers for all parameters. In the console output: Click on the inspector icon () next to an element in the output to select it within the Inspector. Check "Enable persistent logs" in the settings to keep logged messages from before even after navigation. Check "Enable timestamps" in the settings to show timestamps besides the logged messages. Debugger S...
Console messages - Firefox Developer Tools
Password fields present on an insecure (http://) iframe. This is a security risk that allows user login credentials to be stolen. iframes containing login forms must be served over HTTPS, not HTTP. The site specified an invalid Strict-Transport-Security header. See HTTP Strict Transport Security for more details. This site makes use of a SHA-1 Certificate; it's recomm
ended you use certificates with signature algorithms that use hash functions stronger than SHA-1. The site uses a certificate whose signature uses the SHA-1 hash algorithm. SHA-1 is still still widely used in certificates, but it is starting to show its age. Web sites and Certification Authorities are encouraged to switch to stronger hash algorithms in future. See the Weak Signature Al...
Animation.playState - Web APIs
returns and sets an enumerated value describing the playback state of an animation. This property is read-only for CSS Animations and Transitions. Syntax var currentPlayState = Animation.playState; Animation.playState = newState; Value idle The current time of the animation is unresolved and there are no pending tasks. running The animation is running. paused The animation was susp
ended and the Animation.currentTime property is not updating. finished The animation has reached one of its boundaries and the Animation.currentTime property is not updating. Previously, Web Animations defined a pending value to indicate that some asynchronous operation such as initiating playback was yet to complete. This is now indicated by the separate Animation.pending property. Example In th...
AudioProcessingEvent - Web APIs
ata[sample] = inputData[sample]; // add noise to each output sample outputData[sample] += ((Math.random() * 2) - 1) * 0.2; } } } getData(); // wire up play button playButton.onclick = function() { source.connect(scriptNode); scriptNode.connect(audioCtx.destination); source.start(); } // When the buffer source stops playing, disconnect everything source.on
ended = function() { source.disconnect(scriptNode); scriptNode.disconnect(audioCtx.destination); } ...
BaseAudioContext.state - Web APIs
The state read-only property of the BaseAudioContext interface returns the current state of the AudioContext. Syntax baseAudioContext.state; Value A DOMString. Possible values are: susp
ended: The audio context has been susp
ended (with the AudioContext.suspend() method.) running: The audio context is running normally. closed: The audio context has been closed (with the AudioContext.close() method.) Example The following snippet is taken from our AudioContext states demo (see it running live.) The AudioContext.onstatechange hander is used to log the current state to the console every time it changes. audioCtx.onstatechange = function() { console.log(audioCtx.state); } Specifications Specification Status Comment Web Audio APIThe definition of 'state' in...
BlobBuilder - Web APIs
ring data, [optional] in String endings); Blob getBlob([optional] in DOMString contentType); File getFile(in DOMString name, [optional] in DOMString contentType); Methods append() Appends the contents of the specified JavaScript object to the Blob being built. If the value you specify isn't a Blob, ArrayBuffer, or String, the value is coerced to a string before being app
ended to the blob. void append( in ArrayBuffer data ); void append( in Blob data ); void append( in String data, [optional] in String endings ); Parameters data The data to append to the Blob being constructed. endings Specifies how strings containing \n are to be written out. This can be "transparent" (endings unchanged) or "native" (endings changed to match host OS filesystem conv...
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. ...
CSSMediaRule - Web APIs
ntax is described using the WebIDL format. interface CSSMediaRule : CSSConditionRule { readonly attribute MediaList media; } Properties As a CSSConditionRule, and therefore both a CSSGroupingRule and a CSSRule, CSSMediaRule also implements the properties of these interfaces. It has the following specific property: CSSMediaRule.media Read only Specifies a MediaList representing the int
ended destination medium for style information. Methods As a CSSConditionRule, and therefore both a CSSGroupingRule and a CSSRule, CSSMediaRule also implements the methods of that interface. It has no specific methods. Specifications Specification Status Comment CSS Conditional Rules Module Level 3The definition of 'CSSMediaRule' in that specification. Candidate Reco...
CacheStorage - Web APIs
ther a match for the request is found in the CacheStorage. If so, serve that. If not, fetch the request from the network, then also open the cache created in the first block and add a clone of the request to it using Cache.put (cache.put(event.request, response.clone()).) If this fails (e.g. because the network is down), return a fallback response. Finally, return whatever the custom response
ended up being equal to, using FetchEvent.respondWith. self.addEventListener('install', function(event) { event.waitUntil( caches.open('v1').then(function(cache) { return cache.addAll([ '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg', '/sw-test/galler...
CanvasRenderingContext2D.clearRect() - Web APIs
Make sure to call beginPath() before starting to draw new items after calling clearRect(). Syntax void ctx.clearRect(x, y, width, height); The clearRect() method sets the pixels in a rectangular area to transparent black (rgba(0,0,0,0)). The rectangle's corner is at (x, y), and its size is specified by width and height. ...
CanvasRenderingContext2D - Web APIs
instead. Blink only CanvasRenderingContext2D.isContextLost() Inspired by the same WebGLRenderingContext method it returns true if the Canvas context has been lost, or false if not. WebKit only CanvasRenderingContext2D.webkitBackingStorePixelRatio The backing store size in relation to the canvas element. See High DPI Canvas. CanvasRenderingContext2D.webkitGetImageDataHD Int
ended for HD backing stores, but removed from canvas specifications. CanvasRenderingContext2D.webkitPutImageDataHD Int
ended for HD backing stores, but removed from canvas specifications. Gecko only Prefixed APIs CanvasRenderingContext2D.mozCurrentTransform Sets or gets the current transformation matrix, see CanvasRenderingContext2D.currentTransform. CanvasRenderingContext2D.mozCur...
Manipulating video using canvas - Web APIs
watching the video and computing the visual effect. The timer callback The timer callback is called initially when the video starts playing (when the "play" event occurs), then takes responsibility for establishing itself to be called periodically in order to launch the keying effect for each frame. processor.timerCallback = function timerCallback() { if (this.video.paused || this.video.
ended) { return; } this.computeFrame(); let self = this; setTimeout(function() { self.timerCallback(); }, 0); }, The first thing the callback does is check to see if the video is even playing; if it's not, the callback returns immediately without doing anything. Then it calls the computeFrame() method, which performs the chroma-keying effect on the current video...
console.debug() - Web APIs
sole at the "debug" log level. The message is only displayed to the user if the console is configured to display debug output. Note: This feature is available in Web Workers. Syntax console.debug(obj1 [, obj2, ..., objN]); console.debug(msg [, subst1, ..., substN]); Parameters obj1 ... objN A list of JavaScript objects to output. The string representations of each of these objects are app
ended together in the order listed and output to the console. msg A JavaScript string containing zero or more substitution strings, which are replaced with subst1 through substN in consecutive order. subst1 ... substN JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. See Using string substitutions in console fo...
Console.error() - Web APIs
sole.error(obj1 [, obj2, ..., objN]); console.error(msg [, subst1, ..., substN]); console.exception(obj1 [, obj2, ..., objN]); console.exception(msg [, subst1, ..., substN]); Note: console.exception() is an alias for console.error(); they are functionally identical. Parameters obj1 ... objN A list of JavaScript objects to output. The string representations of each of these objects are app
ended together in the order listed and output. msg A JavaScript string containing zero or more substitution strings. subst1 ... substN JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. See Outputting text to the console in the documentation of console for details. Specifications Specification St...
Console.info() - Web APIs
nformational message to the Web Console. In Firefox, a small "i" icon is displayed next to these items in the Web Console's log. Note: This feature is available in Web Workers. Syntax console.info(obj1 [, obj2, ..., objN]); console.info(msg [, subst1, ..., substN]); Parameters obj1 ... objN A list of JavaScript objects to output. The string representations of each of these objects are app
ended together in the order listed and output. msg A JavaScript string containing zero or more substitution strings. subst1 ... substN JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. See Outputting text to the console in the documentation of console for details. Specifications Specification St...
console.log() - Web APIs
console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects. Note: This feature is available in Web Workers. Syntax console.log(obj1 [, obj2, ..., objN]); console.log(msg [, subst1, ..., substN]); Parameters obj1 ... objN A list of JavaScript objects to output. The string representations of each of these objects are app
ended together in the order listed and output. Please be warned that if you log objects in the latest versions of Chrome and Firefox what you get logged on the console is a reference to the object, which is not necessarily the 'value' of the object at the moment in time you call console.log(), but it is the value of the object at the moment you open the console. msg A JavaScript string containing zer...
Console.timeLog() - Web APIs
Specifications Specification Status Comment Console APIThe definition of 'console.timeLog()' in that specification. Living Standard Initial definition ...
Console.warn() - Web APIs
o the Web Console. Note: This feature is available in Web Workers.Note: In Chrome and Firefox, warnings have a small exclamation point icon next to them in the Web Console log. Syntax console.warn(obj1 [, obj2, ..., objN]); console.warn(msg [, subst1, ..., substN]); Parameters obj1 ... objN A list of JavaScript objects to output. The string representations of each of these objects are app
ended together in the order listed and output. msg A JavaScript string containing zero or more substitution strings. subst1 ... substN JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. See Outputting text to the console in the documentation of console for details. Specifications Specification St...
ConstantSourceNode - Web APIs
nt interface, AudioScheduledSourceNode, and adds the following properties: offset An AudioParam which specifies the value that this source continuously outputs. The default value is 1.0. Event handlers Inherits event handlers from its parent interface, AudioScheduledSourceNode. Some browsers' implementations of this event handler are part of the AudioScheduledSourceNode interface. on
ended Fired whenever the ConstantSourceNode data has stopped playing. Methods Inherits methods from its parent interface, AudioScheduledSourceNode. Some browsers' implementations of these methods are part of the AudioScheduledSourceNode interface. start() Schedules a sound to playback at an exact time. stop() Schedules a sound to stop playback at an exact time. Example In the article Co...
DOMTokenList.supports() - Web APIs
Syntax let trueOrFalse = element.supports(token) Parameters token A DOMString containing the token to query for. Returns A Boolean indicating whether the token was found. ...
DataTransferItem.webkitGetAsEntry() - Web APIs
s a list element in this example, as you'll see shortly. Once the current item is in the list, the item's isDirectory property is checked. If the item is a directory, we need to recurse into that directory. The first step is to create a FileSystemDirectoryReader to handle fetching the directory's contents. That's done by calling the item's createReader() method. Then a new <ul> is created and app
ended to the parent list; this will contain the directory's contents in the next level down in the list's hierarchy. After that, directoryReader.readEntries() is called to read in all the entries in the directory. These are each, in turn, passed into a recursive call to scanFiles() to process them. Any of them which are files are simply inserted into the list; any which are directories are inserted in...
Document: animationend event - Web APIs
original target for this event is the Element that had the animation applied. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. For full details on this event please see the page on HTMLElement: animationend. Examples This example listens for the animationend event: document.addEventListener('animationend', () => { console.log('Animation
ended'); }); The same, but using the onanimationend event handler property: document.onanimationend = () => { console.log('Animation
ended'); }; See a live example of this event. Specifications Specification Status Comment CSS Animations Working Draft Initial definition ...
Document.bgColor - Web APIs
of the current document. Syntax color = document.bgColor document.bgColor =color Parameters color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000"). Example document.bgColor = "darkblue"; Notes The default value for this property in Firefox is white (#ffffff in hexadecimal). document.bgColor is deprecated in DOM Level 2 HTML. The recomm
ended alternative is use of the CSS style background-color which can be accessed through the DOM with document.body.style.backgroundColor. Another alternative is document.body.bgColor, although this is also deprecated in HTML 4.01 in favor of the CSS alternative. ...
Document.cookie - Web APIs
bout Cookies and Security. Notes Starting with Firefox 2, a better mechanism for client-side storage is available - WHATWG DOM Storage. You can delete a cookie by simply updating its expiration time to zero. Keep in mind that the more cookies you have, the more data will be transferred between the server and the client for each request. This will make each request slower. It is highly recomm
ended for you to use WHATWG DOM Storage if you are going to keep "client-only" data. RFC 2965 (Section 5.3, "Implementation Limits") specifies that there should be no maximum length of a cookie's key or value size, and encourages implementations to support arbitrarily large cookies. Each browser's implementation maximum will necessarily be different, so consult individual browser documentation. The ...
Document: copy event - Web APIs
The copy event fires when the user initiates a copy action through the browser's user interface. Bubbles Yes Cancelable Yes Interface ClipboardEvent Event handler property oncopy The original target for this event is the Element that was the int
ended target of the copy action. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. For full details on this event please see the page on the Element: copy event. Examples document.addEventListener('copy', (event) => { console.log('copy action initiated') }); Specifications Specification Status Clipboard API and events Working Draft ...
Document.createElementNS() - Web APIs
This particular example is actually an XUL document with embedded XHTML, however, the recommendation still applies. Specifications Specification Status Comment DOMThe definition of 'Document.createElementNS()' in that specification. Living Standard ...
Document.createEvent() - Web APIs
Listen for the event. elem.addEventListener('build', function (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 recomm
ended way to create event object instances. Gecko supports some non-standard event object aliases, which are listed below. Event Module Standard event object Gecko also supports Text event module TextEvent TextEvents Keyboard event module KeyboardEvent KeyEvents Basic events module Event Events Specifications Specification ...
Document: cut event - Web APIs
The cut event is fired when the user has initiated a "cut" action through the browser's user interface. Bubbles Yes Cancelable Yes Interface ClipboardEvent Event handler property oncut The original target for this event is the Element that was the int
ended target of the cut action. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. For full details on this event please see the page on the Element: cut event. Examples document.addEventListener('cut', (event) => { console.log('cut action initiated') }); Specifications Specification Status Clipboard API and events Working Draft ...
Document: dragend event - Web APIs
Bubbles Yes Cancelable No Default action Varies Interface DragEvent Event handler property ondragend Examples See the drag event for example code or this JSFiddle demo. ...
Document.fgColor - Web APIs
= document.fgColor; document.fgColor = color; Parameters color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000"). Example document.fgColor = "white"; document.bgColor = "darkblue"; Notes The default value for this property in Mozilla Firefox is black (#000000 in hexadecimal). document.fgColor is deprecated in DOM Level 2 HTML. The recomm
ended alternative is the CSS property color (e.g., document.body.style.color = "red"). Another alternative is document.body.text, although this is deprecated in HTML 4.01 in favor of the CSS alternative above. ...
Document: paste event - Web APIs
The paste event is fired when the user has initiated a "paste" action through the browser's user interface. Bubbles Yes Cancelable Yes Interface ClipboardEvent Event handler property onpaste The original target for this event is the Element that was the int
ended target of the paste action. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. For full details on this event please see the page on the Element: paste event. Examples document.addEventListener('paste', (event) => { console.log('paste action initiated') }); Specifications Specification Status Clipboard API and events Working Draft ...
Document: scroll event - Web APIs
scroll events are not fired while scrolling is taking place; they are only fired after the scrolling has completed. See Bootstrap issue #16202. Safari and WKWebViews are not affected by this bug. Examples Scroll event throttling Since scroll events can fire at a high rate, the event handler shouldn't execute computationally expensive operations such as DOM modifications. Instead, it is recomm
ended to throttle the event using requestAnimationFrame(), setTimeout(), or a CustomEvent, as follows. Note, however, that input events and animation frames are fired at about the same rate, and therefore the optimization below is often unnecessary. This example optimizes thescroll event for requestAnimationFrame. // Reference: http://www.html5rocks.com/en/tutorials/speed/animations/ let last_known_...
Document: transitionend event - Web APIs
target for this event is the Element that had the transition applied. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. For full details on this event please see the page on HTMLElement: transitionend. Examples This code adds a listener to the transitionend event: document.addEventListener('transitionend', () => { console.log('Transition
ended'); }); The same, but using the ontransitionend property instead of addEventListener(): document.ontransitionend = () => { console.log('Transition
ended'); }; See a live example of this event. Specifications Specification Status Comment CSS TransitionsThe definition of 'transitionend' in that specification. Working Draft Initial definition. ...
Document: transitionstart event - Web APIs
The difference is transitionstart and transitionrun is that transitionrun fires when the transition is created (i.e. at the start of any delay) and transitionstart fires when the actual animation has begun (i.e. at the end of any delay). Bubbles Yes Cancelable No Interface TransitionEvent Event handler property GlobalEventHandlers.ontransitionstart The original target for this event is the Element that had the transition applied. ...
Document.vlinkColor - Web APIs
s that the user has visited in the document. Syntax color = document.vlinkColor document.vlinkColor = color Parameters color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000"). Notes The default value for this property in Mozilla Firefox is purple (#551a8b in hexadecimal). Document.vlinkColor is deprecated in DOM Level 2 HTML. The recomm
ended alternative is to get/set the color of the CSS :visited pseudo-class on HTML <a> elements (e.g., a:visited {color:red;}). Another alternative is document.body.vLink, although this is deprecated in HTML 4.01 in favor of the CSS alternative. ...
Document Object Model (DOM) - Web APIs
In particular, the Element interface is enhanced to become HTMLElement and various subclasses, each representing one of (or a family of closely related) elements. The HTML DOM API provides access to various browser features such as tabs and windows, CSS styles and stylesheets, browser history, and so forth. These interfaces are...
DragEvent - Web APIs
possible to create a useful DataTransfer object from script, since DataTransfer objects have a processing and security model that is coordinated by the browser during drag-and-drops. DragEvent() Creates a synthetic and untrusted DragEvent. Event types drag This event is fired when an element or text selection is being dragged. dragend This event is fired when a drag operation is being
ended (by releasing a mouse button or hitting the escape key). dragenter This event is fired when a dragged element or text selection enters a valid drop target. dragexit This event is fired when an element is no longer the drag operation's immediate selection target. dragleave This event is fired when a dragged element or text selection leaves a valid drop target. dragover This event is fired ...
EXT_color_buffer_float - Web APIs
f WebGL and adds the ability to render a variety of floating point formats. 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 WebGL 2 contexts only. For WebGL 1, see the EXT_color_buffer_half_float and WEBGL_color_buffer_float extensions. Ext
ended methods The following sized formats become color-renderable: gl.R16F, gl.RG16F, gl.RGBA16F, gl.R32F, gl.RG32F, gl.RGBA32F, gl.R11F_G11F_B10F. Color-renderable means: The WebGLRenderingContext.renderbufferStorage() method now accepts these formats. Framebuffers with attached textures of these formats may now be FRAMEBUFFER_COMPLETE. Examples gl must be a WebGL2RenderingContext. ...
EXT_color_buffer_half_float - Web APIs
ilable to WebGL 1 contexts only. For WebGL 2, use the EXT_color_buffer_float extension. The OES_texture_half_float extension implicitly enables this extension. Constants ext.RGBA16F_EXT RGBA 16-bit floating-point color-renderable format. ext.RGB16F_EXT RGB 16-bit floating-point color-renderable format. ext.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT ? ext.UNSIGNED_NORMALIZED_EXT ? Ext
ended methods This extension extends WebGLRenderingContext.renderbufferStorage(): The internalformat parameter now accepts ext.RGBA16F_EXT and ext.RGBA16F_EXT. Examples var ext = gl.getExtension('EXT_color_buffer_half_float'); gl.renderbufferStorage(gl.RENDERBUFFER, ext.RBGA16F_EXT, 256, 256); Specifications Specification Status Comment EXT_color_buffer_half_floatThe ...
Element.classList - Web APIs
function() { return nextIndex<that.length ? {value: nextIndex++, done: false} : {done: true}; }}; }; })(window.DOMTokenList.prototype, window.document.createElement("div").classList); })(window); Caveats The polyfill is limited in functionality. It's currently unable to polyfill out-of-document-elements (e.g. elements created by document.createElement before they are app
ended to a parent node) in IE6-7. However, it should work just fine in IE9. A major discrepancy between the polyfilled version of classList and the W3 specs is that for IE6-8, there is no way to create an immutable object (an object whose properties cannot be directly modified). In IE9, however, it is possible through extending the prototype, freezing the visible object, and overwritting native proper...
Element.getClientRects() - Web APIs
es 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 "viewport" that the resulting rectangles are relative to is the viewport 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, Microsoft int
ended this method to return a TextRectangle object 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 ...
Element.insertAdjacentHTML() - Web APIs
ample // <div id="one">one</div> var d1 = document.getElementById('one'); d1.insertAdjacentHTML('afterend', '<div id="two">two</div>'); // At this point, the new structure is: // <div id="one">one</div><div id="two">two</div> Notes Security considerations When inserting HTML into a page by using insertAdjacentHTML(), be careful not to use user input that hasn't been escaped. It is not recomm
ended you use insertAdjacentHTML() when inserting plain text; instead, use the Node.textContent property or the Element.insertAdjacentText() method. This doesn't interpret the passed content as HTML, but instead inserts it as raw text. Specification Specification Status Comment DOM Parsing and SerializationThe definition of 'Element.insertAdjacentHTML()' in that specificat...
Element: scroll event - Web APIs
scroll events are not fired while scrolling is taking place; they are only fired after the scrolling has completed. See Bootstrap issue #16202. Safari and WKWebViews are not affected by this bug. Examples Scroll event throttling Since scroll events can fire at a high rate, the event handler shouldn't execute computationally expensive operations such as DOM modifications. Instead, it is recomm
ended to throttle the event using requestAnimationFrame(), setTimeout(), or a CustomEvent, as follows. Note, however, that input events and animation frames are fired at about the same rate, and therefore the optimization below is often unnecessary. This example optimizes thescroll event for requestAnimationFrame. // Reference: http://www.html5rocks.com/en/tutorials/speed/animations/ let last_known_...
Element.setAttribute() - Web APIs
on"); b.setAttribute("disabled", ""); This demonstrates two things: The first call to setAttribute() above shows changing the name attribute's value to "helloButton". You can see this using your browser's page inspector (Chrome, Edge, Firefox, Safari). To set the value of a Boolean attribute, such as disabled, you can specify any value. An empty string or the name of the attribute are recomm
ended values. All that matters is that if the attribute is present at all, regardless of its actual value, its value is considered to be true. The absence of the attribute means its value is false. By setting the value of the disabled attribute to the empty string (""), we are setting disabled to true, which results in the button being disabled. DOM methods dealing with element's attributes: Not...
ExtendableEvent - Web APIs
balScope. It is not available when it is a Window, or the scope of another kind of worker. Constructor ExtendableEvent() Creates a new ExtendableEvent object. Properties Doesn't implement any specific properties, but inherits properties from its parent, Event. Methods Inherits methods from its parent, Event. ExtendableEvent.waitUntil() Extends the lifetime of the event. It is int
ended to be called in the install EventHandler for the installing worker and on the activate EventHandler for the active worker. Examples This code snippet is from the service worker prefetch sample (see prefetch example live.) The code calls ExtendableEvent.waitUntil() in ServiceWorkerGlobalScope.oninstall, delaying treating the ServiceWorkerRegistration.installing worker as installed until the p...
FileReader.readAsBinaryString() - Web APIs
start reading the contents of the specified Blob or File. When the read operation is finished, the readyState becomes DONE, and the loadend is triggered. At that time, the result attribute contains the raw binary data from the file. Note that this method was once removed from the File API specification, but re-introduced for backward compatibility. Using FileReader.readAsArrayBuffer() is recomm
ended. Syntax instanceOfFileReader.readAsBinaryString(blob); Parameters blob The Blob or File from which to read. Example var canvas = document.createElement('canvas'); var height = 200; var width = 200; canvas.width = width; canvas.height = height; var ctx = canvas.getContext('2d'); ctx.strokeStyle = '#090'; ctx.beginPath(); ctx.arc(width/2, height/2, width/2 - width/10, 0, Math.PI*2); ...
FileSystemDirectoryReader.readEntries() - Web APIs
s a list element in this example, as you'll see shortly. Once the current item is in the list, the item's isDirectory property is checked. If the item is a directory, we need to recurse into that directory. The first step is to create a FileSystemDirectoryReader to handle fetching the directory's contents. That's done by calling the item's createReader() method. Then a new <ul> is created and app
ended to the parent list; this will contain the directory's contents in the next level down in the list's hierarchy. After that, directoryReader.readEntries() is called to read in all the entries in the directory. These are each, in turn, passed into a recursive call to scanFiles() to process them. Any of them which are files are simply inserted into the list; any which are directories are inserted in...
FileSystemEntry.toURL() - Web APIs
be (depending on the browser's implementation) something like "filesystem:http://my-awesome-website.woot/temporary/awesomesauce.jpg". Code that makes use of this might look like this: let img = document.createElement("img"); img.src = imageFileEntry.toURL(); document.body.appendChild(img); Assuming the scenario mentioned before the code, the result would be HTML that looks like this being app
ended to the end of the document: <img src="filesystem:http://my-awesome-website.woot/temporary/awesomesauce.jpg"> 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 ExplorerOperaSafariAndro...
FileSystemEntry - Web APIs
}, onError); }, onError); Properties This interface provides the following properties. filesystem Read only A FileSystem object representing the file system in which the entry is located. fullPath Read only A USVString object which provides the full, absolute path from the file system's root to the entry; it can also be thought of as a path which is relative to the root directory, prep
ended with a "/" character. isDirectory Read only A Boolean which is true if the entry represents a directory; otherwise, it's false. isFile Read only A Boolean which is true if the entry represents a file. If it's not a file, this value is false. name Read only A USVString containing the name of the entry (the final part of the path, after the last "/" character). Methods This interface de...
FileSystemEntrySync - Web APIs
remove() raises (FileException); DirectoryEntrySync getParent(); Attributes Attribute Type Description filesystem readonly FileSystemSync The file system where the entry resides. fullpath readonly DOMString The full absolute path from the root to the entry. An absolute path is a relative path from the root directory, prep
ended with a '/'. isDirectory readonly boolean True if FileSystemEntrySync is a directory. isFile readonly boolean True if the FileSystemEntrySync is a file. name readonly DOMString The name of the entry, excluding the path leading to it. Methods getMetadata() Look up metadata about this entry. [ todo: specify what kind of metadata ] Metadata ...
File and Directory Entries API - Web APIs
Because this is a non-standard API, whose specification is not currently on a standards track, it's important 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 int
ended 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. The Firefox implementation of the File and Directory Entries API is very limited; there is no support for creating files. Only for accessing files w...
Using FormData Objects - Web APIs
The transmitted data is in the same format that the form's submit() method would use to send the data if the form's encoding type were set to multipart/form-data. ...
FormData.get() - Web APIs
value A FormDataEntryValue containing the value. If the key doesn't exist, the method returns null. Example The following line creates an empty FormData object: var formData = new FormData(); If we add two username values using FormData.append: formData.append('username', 'Chris'); formData.append('username', 'Bob'); The following get() function will only return the first username value app
ended: formData.get('username'); // Returns "Chris" Specifications Specification Status Comment XMLHttpRequestThe definition of 'get()' in that specification. Living Standard ...
Gamepad.id - Web APIs
ome information about the controller. The exact syntax is not strictly specified, but in Firefox it will contain three pieces of information separated by dashes (-): Two 4-digit hexadecimal strings containing the USB vendor and product id of the controller The name of the controller as provided by the driver. For example, a PS2 controller returned 810-3-USB Gamepad. This information is int
ended to allow you to find a mapping for the controls on the device as well as display useful feedback to the user. Syntax readonly attribute DOMString id; Example window.addEventListener("gamepadconnected", function() { var gp = navigator.getGamepads()[0]; gamepadInfo.innerHTML = "Gamepad connected at index " + gp.index + ": " + gp.id + "."; }); Value A string. Specifications ...
Using the Gamepad API - Web APIs
Gamepad object's properties are as follows: id: A string containing some information about the controller. This is not strictly specified, but in Firefox it will contain three pieces of information separated by dashes (-): two 4-digit hexadecimal strings containing the USB vendor and product id of the controller, and the name of the controller as provided by the driver. This information is int
ended to allow you to find a mapping for the controls on the device as well as display useful 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...
GeolocationPositionError - Web APIs
f position returned an internal error. 3 TIMEOUT The time allowed to acquire the geolocation, defined by PositionOptions.timeout information was reached before the information was obtained. GeolocationPositionError.message Read only Secure context Returns a human-readable DOMString describing the details of the error. Specifications note that this is primarily int
ended for debugging use and not to be shown directly in a user interface. Methods The GeolocationPositionError interface neither implements nor inherits any method. Specifications Specification Status Comment Geolocation APIThe definition of 'GeolocationPositionError' in that specification. Recommendation Initial specification. ...
GlobalEventHandlers.onanimationcancel - Web APIs
-self: center; color: white; font: bold 1.4em "Lucida Grande", "Open Sans", sans-serif; } Leaving out some bits of the CSS that don't matter for the discussion here, let's take a look at the styles for the box that we're animating. First is the box itself, with all its properties, including animation, defined. We go ahead and describe the animation in-place here because the animation is int
ended to begin as soon as the page loads, rather than based on an event. #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788FF; margin: 0; position: relative; background-color: #2233FF; display: flex; justify-content: center; animation: 5s ease-in-out 0s infinite alternate both slideBox; } The animation's keyframes are described next...
GlobalEventHandlers.ondragend - Web APIs
urce element's background color for enter events ev.currentTarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragLeave"); // Change the source element's border back to white ev.currentTarget.style.background = "white"; } function dragend_handler(ev) { console.log("dragEnd"); // Change the target element's background color to visually indicate // the drag
ended. var el=document.getElementById("target"); el.style.background = "pink"; } function dragexit_handler(ev) { console.log("dragExit"); // Change the source element's border back to green to signify a dragexit event ev.currentTarget.style.background = "green"; } function init() { // Set handlers for the source's enter/leave/end/exit events var el=document.getElementById("source"); el.ondrag...
GlobalEventHandlers.ondragenter - Web APIs
urce element's background color for enter events ev.currentTarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragLeave"); // Change the source element's border back to white ev.currentTarget.style.background = "white"; } function dragend_handler(ev) { console.log("dragEnd"); // Change the target element's background color to visually indicate // the drag
ended. var el=document.getElementById("target"); el.style.background = "pink"; } function dragexit_handler(ev) { console.log("dragExit"); // Change the source element's border back to green to signify a dragexit event ev.currentTarget.style.background = "green"; } function init() { // Set handlers for the source's enter/leave/end/exit events var el=document.getElementById("source"); el.ondrag...
GlobalEventHandlers.ondragexit - Web APIs
urce element's background color for enter events ev.currentTarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragLeave"); // Change the source element's border back to white ev.currentTarget.style.background = "white"; } function dragend_handler(ev) { console.log("dragEnd"); // Change the target element's background color to visually indicate // the drag
ended. var el=document.getElementById("target"); el.style.background = "pink"; } function dragexit_handler(ev) { console.log("dragExit"); // Change the source element's border back to green to signify a dragexit event ev.currentTarget.style.background = "green"; } function init() { // Set handlers for the source's enter/leave/end/exit events var el=document.getElementById("source"); el.ondrag...
GlobalEventHandlers.ondragleave - Web APIs
nt's background color for enter events ev.currentTarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragLeave"); // Change the source element's background color back to white ev.currentTarget.style.background = "white"; } function dragend_handler(ev) { console.log("dragEnd"); // Change the target element's background color to visually indicate // the drag
ended. var el=document.getElementById("target"); el.style.background = "pink"; } function dragexit_handler(ev) { console.log("dragExit"); // Change the source element's background color back to green to signify a dragexit event ev.currentTarget.style.background = "green"; } function init() { // Set handlers for the source's enter/leave/end/exit events var el=document.getElementById("source"); ...
GlobalEventHandlers - Web APIs
raised. GlobalEventHandlers.ondrop Is an EventHandler representing the code to be called when the drop event is raised. GlobalEventHandlers.ondurationchange Is an EventHandler representing the code to be called when the durationchange event is raised. GlobalEventHandlers.onemptied Is an EventHandler representing the code to be called when the emptied event is raised. GlobalEventHandlers.on
ended Is an EventHandler representing the code to be called when the
ended event is raised. GlobalEventHandlers.onformdata Is an EventHandler for processing formdata events, fired after the entry list representing the form's data is constructed. GlobalEventHandlers.ongotpointercapture Is an EventHandler representing the code to be called when the gotpointercapture event type is raised. GlobalEven...
HTMLAnchorElement.download - Web APIs
The value, if any, specifies the default file name for use in labeling the resource in a local file system. If the name is not a valid file name in the underlying OS, the browser will adjust it. Note: This value might not be used for download. This value cannot be used to determine whether the download will occur. ...
HTMLAreaElement - Web APIs
single character that switches input focus to the control. HTMLAreaElement.alt Is a DOMString that reflects the alt HTML attribute, containing alternative text for the element. HTMLAreaElement.coords Is a DOMString that reflects the coords HTML attribute, containing coordinates to define the hot-spot region. HTMLAreaElement.download Is a DOMString indicating that the linked resource is int
ended to be downloaded 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 ...
msAudioCategory - Web APIs
No If msAudioDeviceType is not explicitly set, msAudioDeviceType will be set to Communications. For hardware audio offload to be automatically applied, the audio category must be set to ForegroundOnlyMedia or BackgroundCapableMedia. Hardware audio offload optimizes audio rendering which can improve function...
HTMLElement: animationcancel event - Web APIs
g.textContent = `${animationEventLog.textContent}'animation started' `; }); animation.addEventListener('animationiteration', () => { iterationCount++; animationEventLog.textContent = `${animationEventLog.textContent}'animation iterations: ${iterationCount}' `; }); animation.addEventListener('animationend', () => { animationEventLog.textContent = `${animationEventLog.textContent}'animation
ended'`; animation.classList.remove('active'); applyAnimation.textContent = "Activate animation"; }); animation.addEventListener('animationcancel', () => { animationEventLog.textContent = `${animationEventLog.textContent}'animation canceled'`; }); applyAnimation.addEventListener('click', () => { animation.classList.toggle('active'); animationEventLog.textContent = ''; iterationCount = 0; ...
HTMLElement: animationiteration event - Web APIs
g.textContent = `${animationEventLog.textContent}'animation started' `; }); animation.addEventListener('animationiteration', () => { iterationCount++; animationEventLog.textContent = `${animationEventLog.textContent}'animation iterations: ${iterationCount}' `; }); animation.addEventListener('animationend', () => { animationEventLog.textContent = `${animationEventLog.textContent}'animation
ended'`; animation.classList.remove('active'); applyAnimation.textContent = "Activate animation"; }); animation.addEventListener('animationcancel', () => { animationEventLog.textContent = `${animationEventLog.textContent}'animation canceled'`; }); applyAnimation.addEventListener('click', () => { animation.classList.toggle('active'); animationEventLog.textContent = ''; iterationCount = 0; ...
HTMLElement: animationstart event - Web APIs
g.textContent = `${animationEventLog.textContent}'animation started' `; }); animation.addEventListener('animationiteration', () => { iterationCount++; animationEventLog.textContent = `${animationEventLog.textContent}'animation iterations: ${iterationCount}' `; }); animation.addEventListener('animationend', () => { animationEventLog.textContent = `${animationEventLog.textContent}'animation
ended'`; animation.classList.remove('active'); applyAnimation.textContent = "Activate animation"; }); animation.addEventListener('animationcancel', () => { animationEventLog.textContent = `${animationEventLog.textContent}'animation canceled'`; }); applyAnimation.addEventListener('click', () => { animation.classList.toggle('active'); animationEventLog.textContent = ''; iterationCount = 0; ...
HTMLElement: transitionstart event - Web APIs
The transitionstart event is fired when a CSS transition has actually started, i.e., after any transition-delay has
ended. Bubbles Yes Cancelable No Interface TransitionEvent Event handler property ontransitionstart Examples This code adds a listener to the transitionstart event: element.addEventListener('transitionstart', () => { console.log('Started transitioning'); }); The same, but using the ontransitionstart property instead of addEventListener(): element.ontransitionrun = () => { console.log('Started transitioning'); }; Live example In the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">Hover over me</div> <div class="message"></div> .tr...
HTMLImageElement.decode() - Web APIs
ting a new HTMLImageElement, setting its source to the full-resolution image's URL, then using decode() to get a promise which is resolved once the full-resolution image is ready for use. At that time, you can then replace the low-resolution image with the full-resolution one that's now available. Examples The following example shows how to use the decode() method to control when an image is app
ended to the DOM. Without a Promise-returning method, you would add the image to the DOM in a load event handler, such as by using the img.onload event handler, and by handling the error in the error event's handler. const img = new Image(); img.src = 'nebula.jpg'; img.decode() .then(() => { document.body.appendChild(img); }) .catch((encodingError) => { // Do something with the error. }) Specifi...
HTMLImageElement.useMap - Web APIs
d symbol, "#") of the <map> element which defines the image map to apply to the image. You can learn more about client-side image maps in our learning article Add a hitmap on top of an image. Usage notes The string value of useMap must be a valid anchor for a <map> element. In other words, this string should be the value of the appropriate <map>'s name attribute with a pound or hash symbol prep
ended to it. Consider a <map> that looks like this: <map name="mainmenu-map"> <area shape="circle" coords="25, 25, 75, 75" href="/index.html" alt="Return to home page"> <area shape="rect" coords="25, 25, 100, 150" href="/index.html" alt="Shop"> </map> Given the image map named mainmenu-map, the image which uses it should look something like the following: <img src="menubox.png" usemap="#mainme...
HTMLMediaElement.autoplay - Web APIs
de autoplay in order to prevent disruptive audio or video from playing without permission or in the background. Do not rely on autoplay actually starting playback and instead use play event. Examples ... <video id="video" controls> <source src="https://player.vimeo.com/external/250688977.sd.mp4?s=d14b1f1a971dde13c79d6e436b88a6a928dfe26b&profile_id=165"> </video> *** Disable autoplay (recomm
ended) *** false is the default value document.querySelector('#video').autoplay = false; Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.autoplay' in that specification. Living Standard No change from HTML5 HTML5The definition of 'HTMLMediaElement.autoplay' in that specification. Recommendati...
HTMLMediaElement.seekToNextFrame() - Web APIs
this method include filtering and editing of video content. This method returns immediately, returning a Promise, whose fulfillment handler is called when the seek operation is complete. In addition, a seeked event is sent to let interested parties know that a seek has taken place. If the seek fails because the media is already at the last frame, a seeked event occurs, followed immediately by an
ended event. If there is no video on the media element, or the media isn't seekable, nothing happens. Syntax var seekCompletePromise = HTMLMediaElement.seekToNextFrame(); HTMLMediaElement.seekToNextFrame(); Return value A Promise which is fulfilled once the seek operation has completed. Firefox 49 returns undefined instead of a promise, and performs the seek operation synchronously. Specific...
HTMLSelectElement.add() - Web APIs
dds an element to the collection of option elements for this select element. Syntax collection.add(item[, before]); Parameters item is an HTMLOptionElement or HTMLOptGroupElement before is optional and an element of the collection, or an index of type long, representing the item item should be inserted before. If this parameter is null (or the index does not exist), the new element is app
ended to the end of the collection. Exceptions A DOMError of the type HierarchyRequestError if the item passed to the method is an ancestor of the HTMLSelectElement. Examples Creating Elements from Scratch var sel = document.createElement("select"); var opt1 = document.createElement("option"); var opt2 = document.createElement("option"); opt1.value = "1"; opt1.text = "Option: Value 1"; opt2.
HTMLSourceElement - Web APIs
94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLSourceElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, HTMLElement. HTMLSourceElement.media Is a DOMString reflecting the media HTML attribute, containing the int
ended type of the media resource. HTMLSourceElement.sizes Is a DOMString representing image sizes between breakpoints HTMLSourceElement.src Is a DOMString reflecting the src HTML attribute, containing the URL for the media resource. The HTMLSourceElement.src property has a meaning only when the associated <source> element is nested in a media element that is a <video> or an <audio> element. It ha...
HTMLStyleElement.media - Web APIs
Syntax medium = style.media style.media = medium Parameters medium is a string describing a single medium or a comma-separated list. ...
HTMLStyleElement - Web APIs
x="411" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLStyleElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, HTMLElement, and implements LinkStyle. HTMLStyleElement.media Is a DOMString representing the int
ended destination medium for style information. HTMLStyleElement.type Is a DOMString representing the type of style being applied by this statement. HTMLStyleElement.disabled Is a Boolean value representing whether or not the stylesheet is disabled (true) or not (false). LinkStyle.sheet Read only Returns the StyleSheet object associated with the given element, or null if there is none HTMLStyle...
HTMLTableElement.insertRow() - Web APIs
) in a given <table>, and returns a reference to the new row. If a table has multiple <tbody> elements, by default, the new row is inserted into the last <tbody>. To insert the row into a specific <tbody>: let specific_tbody = document.getElementById(tbody_id); let row = specific_tbody.insertRow(index) Note: insertRow() inserts the row directly into the table. The row does not need to be app
ended separately as would be the case if Document.createElement() had been used to create the new <tr> element. Syntax var newRow = HTMLTableElement.insertRow(index); HTMLTableElement is a reference to an HTML <table> element. Parameters index Optional The row index of the new row. If index is -1 or equal to the number of rows, the row is app
ended as the last row. If index is greater than the ...
HTMLTableElement - Web APIs
child of the <table> element. HTMLTableElement.deleteCaption() Removes the first <caption> that is a child of the element. HTMLTableElement.insertRow() Returns an HTMLTableRowElement representing a new row of the table. It inserts it in the rows collection immediately before the <tr> element at the given index position. If necessary a <tbody> is created. If the index is -1, the new row is app
ended to the collection. If the index is smaller than -1 or greater than the number of rows in the collection, a DOMException with the value IndexSizeError is raised. HTMLTableElement.deleteRow() Removes the row corresponding to the index given in parameter. If the index value is -1 the last row is removed; if it smaller than -1 or greater than the amount of rows in the collection, a DOMException wit...
HTMLTableRowElement.insertCell() - Web APIs
The HTMLTableRowElement.insertCell() method inserts a new cell (<td>) into a table row (<tr>) and returns a reference to the cell. Note: insertCell() inserts the cell directly into the row. The cell does not need to be app
ended separately with Node.appendChild() as would be the case if Document.createElement() had been used to create the new <td> element. You can not use insertCell() to create a new <th> element though. Syntax var newCell = HTMLTableRowElement.insertCell(index); HTMLTableRowElement is a reference to an HTML <tr> element. Parameters index Optional index is the cell index of the new cell. If index is -1 or equal to the number of cells, the cell is app
ended as the last cell in the row. If index is greater than the number of cells, an IndexSizeError exception will res...
Ajax navigation example - Web APIs
nal Server Error", 501: "Not Implemented", 502: "Bad Gateway", 503: "Service Unavailable", 504: "Gateway Timeout", 505: "HTTP Version Not Supported", 506: "Variant Also Negotiates (Experimental)", 507: "Insufficient Storage", 508: "Loop Detected", 509: "Unassigned", 510: "Not Ext
ended", 511: "Network Authentication Required" }; var oReq, bIsLoading = false, bUpdateURL = false; oLoadingBox.id = "ajax-loader"; oCover.onclick = abortReq; oLoadingImg.src = "data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOg...
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. ...
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. ...
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. ...
IDBLocaleAwareKeyRange - Web APIs
Methods This interface inherits all the methods of its parent interface, IDBKeyRange. Properties This interface inherits all the properties of its parent interface, IDBKeyRange. ...
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. ...
Browser storage limits and eviction criteria - Web APIs
e Quota Management API handles quota management for AppCache, IndexedDB, WebSQL, and File System API. Different types of data storage Even in the same browser, using the same storage method, there are different classes of data storage to understand. This section discusses the different ones you might find in different browsers. Storage comes in two types: Persistent: This is data that is int
ended to be kept around for a long time. This will only be evicted if the user chooses to (for example, in Firefox you can choose to delete all stored data or only stored data from selected origins by going to Preferences and using the options under Privacy & Security > Cookies & Site Data). Temporary: This is data that doesn't need to persist for a very long time. This will be evicted under a least r...
Using IndexedDB - Web APIs
eeded if it is needed to support 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 recomm
ended to use it in production code. It may be preferable to not support a browser than to claim to support it and fail: if (!window.indexedDB) { console.log("Your browser doesn't support 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("MyTest...
IndexedDB API - Web APIs
Like most web storage solutions, IndexedDB follows a same-origin policy. So while you can access stored data within a domain, you cannot access data across different domains. Synchronous and asynchronous Operations performed using IndexedDB are done asynchronously, so as not to block applications. IndexedDB originally included both synchronous and asynchronous APIs. The synchronous API was int
ended for use only with Web Workers but was removed from the spec because it was unclear whether it was needed. However, the synchronous API may be reintroduced if there is enough demand from web developers. Storage limits and eviction criteria There are a number of web technologies that store data of one kind or another on the client side (i.e. on your local disk). IndexedDB is most commonly talked ...
IntersectionObserver.IntersectionObserver() - Web APIs
voked. options Optional An optional object which customizes the observer. If options isn't specified, the observer uses the document's viewport 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 int
ended target, whose bounding rectangle will be considered the viewport. Any part of the target not visible in the visible area of the root is not considered visible. rootMargin A string which specifies a set of offsets to add to the root's bounding_box when calculating intersections, effectively shrinking or growing the root for calculation purposes. The syntax is approximately the same as that for...
Intersection Observer API - Web APIs
s "0px". This causes the observer to watch for changes in the intersection between the target element's bounds and those of the viewport, without any added (or subtracted) space. The list of visibility ratio thresholds, threshold, is constructed by the function buildThresholdList(). The threshold list is built programmatically in this example since there are a number of them and the number is int
ended to be adjustable. Once options is ready, we create the new observer, calling the IntersectionObserver() constructor, specifying a function to be called when intersection crosses one of our thresholds, handleIntersect(), and our set of options. We then call observe() on the returned observer, passing into it the desired target element. We could opt to monitor multiple elements for visibility int...
Key Values - Web APIs
s. VK_BACK (0x08) kVK_Delete (0x33) GDK_KEY_BackSpace (0xFF08) Qt::Key_Backspace (0x01000003) KEYCODE_DEL (67) "Clear" The Clear key. Removes the currently selected input. VK_CLEAR (0x0C) VK_OEM_CLEAR (0xFE) kVK_ANSI_KeypadClear (0x47) GDK_KEY_Clear (0xFF0B) Qt::Key_Clear (0x0100000B) KEYCODE_CLEAR (28) "Copy" The Copy key (on certain ext
ended keyboards). APPCOMMAND_COPY GDK_KEY_Copy (0x1008FF57) Qt::Key_Copy (0x010000CF) "CrSel" [3] The Cursor Select key, CrSel. VK_CRSEL (0xF7) GDK_KEY_3270_CursorSelect (0xFD1C) "Cut" The Cut key (on certain ext
ended keyboards). APPCOMMAND_CUT GDK_KEY_Cut (0x1008FF58) Qt::Key_Cut (0x010000D0) "Delete" [2] The Delete ...
KeyboardEvent.key - Web APIs
pressed key has a printed representation, the returned value is a non-empty Unicode character string containing the printable representation of the key. If the pressed key is a control or special character, the returned value is one of the pre-defined key values. If the KeyboardEvent represents the press of a dead key, the key value must be "Dead". Some specialty keyboard keys (such as the ext
ended keys for controlling media on multimedia keyboards) don't generate key codes on Windows; instead, they trigger WM_APPCOMMAND events. These events get mapped to DOM keyboard events, and are listed among the "Virtual key codes" for Windows, even though they aren't actually key codes. If the key cannot be identified, the returned value is Unidentified. KeyboardEvent sequence Every KeyboardEvent ...
Keyboard API - Web APIs
a physical keyboard that is attached to a device running a browser. It provides several capabilities. Keyboard mapping provides an interface for retrieving the string generated by particular physical key on a keyboard to correctly identify that key to a user. Keyboard locking enables a web page to capture keys that are normally reserved by the user agent or the underlying operating system. The int
ended use of the Keyboard API is by web applications such as games or remote access apps that provide a full-screen immersive experience. Keyboard API concepts and usage Keyboard mapping On physical keyboards, the code attribute contains the physical location of the key that was pressed, and the key attribute contains the string generated by pressing the key at that physical location on the keyboar...
LocalFileSystemSync - Web APIs
The methods are implemented by worker objects. About this document This document was last updated on March 2, 2012 and follows the W3C Specifications (Working Draft) drafted on April 19, 2011. This specification is more or less abandonned, failing to get significant traction. Basic concepts You can request access to a sandboxed file system by requesting LocalFileSystemSync object from within a web worker. ...
MediaDevices.getUserMedia() - Web APIs
err) { console.log(err.name + ": " + err.message); }); // always check for errors at the end. Using the new API in older browsers Here's an example of using navigator.mediaDevices.getUserMedia(), with a polyfill to cope with older browsers. Note that this polyfill does not correct for legacy differences in constraints syntax, which means constraints won't work well across browsers. It is recomm
ended to use the adapter.js polyfill instead, which does handle constraints. // Older browsers might not implement mediaDevices at all, so we set an empty object first if (navigator.mediaDevices === undefined) { navigator.mediaDevices = {}; } // Some browsers partially implement mediaDevices. We can't just assign an object // with getUserMedia as it would overwrite existing properties. // Here, we ...
MediaDevices.ondevicechange - Web APIs
nd is a single string that includes both the media type and the direction the media flows, such as "audioinput" or "videooutput". This line, then, pulls out the type ("audio" or "video") and direction ("input" or "output") so they can be used to construct the string displayed in the list. Once the string is assembled, containing the device's name in bold and the direction in parentheses, it's app
ended to the appropriate list by calling appendChild() on either audioList or videoList, as appropriate based on the device type. Handling device list changes We call updateDeviceList() in two places. The first is in the getUserMedia() promise's fulfillment handler, to initially fill out the list when the stream is opened. The second is in the event handler for devicechange: navigator.mediaDevices.o...
MediaDevices - Web APIs
ts = { audio: false, video: true }; var errorElement = document.querySelector('#errorMsg'); navigator.mediaDevices.getUserMedia(constraints) .then(function(stream) { var videoTracks = stream.getVideoTracks(); console.log('Got stream with constraints:', constraints); console.log('Using video device: ' + videoTracks[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 supported by your device.'); } else if (error.name === 'PermissionDeniedError') { ...
MediaError.message - Web APIs
& message.length) { s += " " + message; } displayErrorMessage("<strong>Error " + err.code + ":</strong> " + s + "<br>"); }; This gets the MediaError object describing the error from the error property on the HTMLAudioElement representing the audio player. The error's code attribute is checked to determine a generic error message to display, and, if message is not empty, it's app
ended to provide additional details. Then the resulting text is output to the log. Result You can try out this example below, and can see the example in action outside this page here. Specifications Specification Status Comment HTML Living StandardThe definition of 'MediaError.message' in that specification. Living Standard Initial definition ...
MediaSource.activeSourceBuffers - Web APIs
Specifications Specification Status Comment Media Source ExtensionsThe definition of 'activeSourceBuffers' in that specification. Recommendation Initial definition. ...
MediaSource.duration - Web APIs
Specifications Specification Status Comment Media Source ExtensionsThe definition of 'duration' in that specification. Recommendation Initial definition. ...
MediaSource.sourceBuffers - Web APIs
Specifications Specification Status Comment Media Source ExtensionsThe definition of 'sourceBuffers' in that specification. Recommendation Initial definition. ...
MediaStream - Web APIs
t. You can create an empty stream, a stream which is based upon an existing stream, or a stream that contains a specified list of tracks (specified as an array of MediaStreamTrack objects). Properties This interface inherits properties from its parent, EventTarget. MediaStream.active Read only A Boolean value that returns true if the MediaStream is active, or false otherwise. MediaStream.
ended Read only A Boolean value set to true if the end of the stream has been reached. This has been removed from the specification; you should instead check the value of MediaStreamTrack.readyState to see if its value is
ended for the track or tracks you want to ensure have finished playing. MediaStream.id Read only A DOMString containing 36 characters denoting a universally unique identifie...
MediaStreamTrack.readyState - Web APIs
treamTrack.readyState read-only property returns an enumerated value giving the status of the track. Syntax const state = track.readyState Value It takes one of the following values: "live" which indicates that an input is connected and does its best-effort in providing real-time data. In that case, the output of data can be switched on or off using the MediaStreamTrack.enabled property. "
ended" which indicates that the input is not giving any more data and will never provide new data. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'MediaStreamTrack.readyState' in that specification. Candidate Recommendation Initial specification. ...
MediaStreamTrack.stop() - Web APIs
Since multiple tracks may use the same source (for example, if two tabs are using the device's microphone), the source itself isn't necessarily immediately stopped. It is instead disassociated from the track and the track object is stopped. Once no media tracks are using the source, the source may actually be completely stopped. Immediately after calling stop(), the readyState property is set to
ended. Examples Stopping a video stream In this example, we see a function which stops a streamed video by calling stop() on every track on a given <video>. function stopStreamedVideo(videoElem) { const stream = videoElem.srcObject; const tracks = stream.getTracks(); tracks.forEach(function(track) { track.stop(); }); videoElem.srcObject = null; } This works by obtaining the video e...
Using the MediaStream Recording API - Web APIs
ton is pressed, and finalize the Blob ready for use somewhere else in our application. stop.onclick = function() { mediaRecorder.stop(); console.log(mediaRecorder.state); console.log("recorder stopped"); record.style.background = ""; record.style.color = ""; } Note that the recording may also stop naturally if the media stream ends (e.g. if you were grabbing a song track and the track
ended, or the user stopped sharing their microphone). Grabbing and using the blob When recording has stopped, the state property returns a value of "inactive", and a stop event is fired. We register an event handler for this using mediaRecorder.onstop, and finalize our blob there from all the chunks we have received: mediaRecorder.onstop = function(e) { console.log("recorder stopped"); const cl...
MediaTrackConstraints.deviceId - Web APIs
, and/or exact (mandatory) device IDs which are acceptable as the source of media content. Device IDs are unique for a given origin, and are guaranteed to be the same across browsing sessions on the same origin. However, the value of the deviceId is determined by the source of the track's content, and there's no particular format mandated by the specification (although some kind of GUID is recomm
ended). That means that a given track will only return one value for the deviceId when you call getCapabilities(). Because of this, there's no use for the device ID when calling MediaStreamTrack.applyConstraints(), since there is only one possible value; however, you can record a deviceId and use it to ensure that you get the same source for multiple calls to getUserMedia(). An exception to the rule...
MediaTrackConstraints.groupId - Web APIs
makes it possible to use the group ID to ensure that the audio and input devices are on the same headset by retrieving the group ID of the input device and specifying it when asking for an output device, perhaps. However, the value of the groupId is determined by the source of the track's content, and there's no particular format mandated by the specification (although some kind of GUID is recomm
ended). That means that a given track will only return one value for the groupId when you call getCapabilities(), and keep in mind that this value will change for each browsing session. Because of this, there's no use for the group ID when calling MediaStreamTrack.applyConstraints(), since there is only one possible value, and you can't use it to ensure the same group is used across multiple browsing ...
Transcoding assets for Media Source Extensions - Web APIs
ented.mp4 In both cases, Chrome may require an extra movie flag to be set: -movflags frag_keyframe+empty_moov+default_base_moof Having a properly fragmented MP4 file is all you need to get started. If you wish to employ adaptive bitrate streaming, you'll have to create encodings at multiple resolutions. While MSE is flexible enough to allow you to make your implementation, it's highly recomm
ended to use an existing DASH client as DASH is a well-specified application protocol. Creating Content for DASH Given that you have ffmpeg and Bento4's utilities accessible through your $PATH, you can run Bento4's mp4-dash-encode.py Python script to generate multiple encodings of your content at various resolutions. Bento4's mp4-dash.py Python script can then be used to generate the corresponding MP...
Media Capture and Streams API (Media Stream) - Web APIs
diaTrackSupportedConstraints 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 overconstrained removetrack started unmuted Guides and tutorials 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 ...
Microsoft API extensions - Web APIs
rHover Media APIs HTMLVideoElement.msFrameStep() HTMLVideoElement.msHorizontalMirror HTMLVideoElement.msInsertVideoEffect() HTMLVideoElement.msIsLayoutOptimalForPlayback HTMLVideoElement.msIsStereo3D HTMLVideoElement.msZoom HTMLAudioElement.msAudioCategory HTMLAudioElement.msAudioDeviceType HTMLMediaElement.msClearEffects() HTMLMediaElement.msInsertAudioEffect() MediaError.msExt
endedCode MSGraphicsTrust msGraphicsTrustStatus msIsBoxed msPlayToDisabled msPlayToPreferredSourceUri msPlayToPrimary msPlayToSource msRealTime msSetMediaProtectionManager msSetVideoRectangle msStereo3DPackingMode msStereo3DRenderMode onMSVideoFormatChanged onMSVideoFrameStepCompleted onMSVideoOptimalLayoutChanged msFirstPaint Pinned Sites APIs MSSiteModeEvent mssitemodejumplist...
msPlayToPreferredSourceUri - Web APIs
s web pages and Microsoft Store apps to play Digital Rights Management (DRM) protected content. The app specifies a preferred Uniform Resource Identifier (URI). This URI can point to a cloud based media server allowing streaming directly from the cloud, which can be DRM protected, instead of streaming content from the Windows machine which must be unprotected content. A forward slash ("/") is app
ended to the URI string when it is sent over the network to a PlayTo device. This is done to conform to URI standards. Example <video src="http://www.contoso.com/videos/video.mp4" msPlayToPreferredSourceUri="http://www.contoso.com/catalogid=1234" /> var video = document.createElement('video'); document.body.appendChild(video); video.src = "http://www.contoso.com/videos/video.mp4"; ...
MutationObserver.observe() - Web APIs
) on a node that's already being observed by the same MutationObserver, all existing observers are automatically removed from all targets being observed before the new observer is activated. 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 int
ended 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 wo...
MutationObserverInit - Web APIs
ype of the options parameter on the MutationObserver.observe() method. Properties At a minimum, one of childList, attributes, and/or characterData must be true when you call observe(). Otherwise, a TypeError exception will be thrown. subtree Optional Set to true to extend monitoring to the entire subtree of nodes rooted at target. All of the other MutationObserverInit properties are then ext
ended to all of the nodes in the subtree instead of applying solely to the target node. The default value is false. childList Optional Set to true to monitor the target node (and, if subtree is true, its descendants) for the addition of new child nodes or removal of existing child nodes. The default value is false. attributes Optional Set to true to watch for changes to the value of attributes on t...
Navigator.registerProtocolHandler() - Web APIs
s the https scheme. Older browsers also supported 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 recomm
ended to always set the title, since browsers that support 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...
NavigatorID.userAgent - Web APIs
sions of a browser. New browsers may start using the same UA, or part of it, as an older browser: you really have no guarantee that the browser agent is indeed the one advertised by this property. Also keep in mind that users of a browser can change the value of this field if they want (UA spoofing). Browser identification based on detecting the user agent string is unreliable and is not recomm
ended, as the user agent string is user configurable. For example: In Firefox, you can change the preference general.useragent.override in about:config. Some Firefox extensions do that; however, this only changes the HTTP header that gets sent, and doesn't affect browser detection performed by JavaScript code. Opera 6+ allows users to set the browser identification string via a menu. Microsoft Int...
Node.insertBefore() - Web APIs
lement = document.getElementById('parentElement') // Get the parent's first child let theFirstChild = parentElement.firstChild // Create a new element let newElement = document.createElement("div") // Insert the new element before the first child parentElement.insertBefore(newElement, theFirstChild) When the element does not have a first child, then firstChild is null. The element is still app
ended to the parent, after the last child. Since the parent element did not have a first child, it did not have a last child, either. Consequently, the newly inserted element is the only element. Specifications Specification Status Comment DOMThe definition of 'Node.insertBefore' in that specification. Living Standard Fixes errors in the insertion algorithm ...
Node.nextSibling - Web APIs
odes, or returns null if the specified node is the last child in the parent element. Syntax nextNode = node.nextSibling 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 refer to a whitespace text node rather than the actual element the author int
ended to get. See Whitespace in the DOM and W3C DOM 3 FAQ: Why are some Text nodes empty? for more information. Element.nextElementSibling may be used to obtain the next element skipping any whitespace nodes, other between-element text, or comments. Example <div id="div-1">Here is div-1</div> <div id="div-2">Here is div-2</div> <script> var el = document.getElementById('div-1').nextSibling, i...
Node.previousSibling - Web APIs
ementById("b1").previousSibling); // <img id="b0"> console.log(document.getElementById("b2").previousSibling.id); // "b1" 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 refer to a whitespace text node rather than the actual element the author int
ended to get. See Whitespace in the DOM and W3C DOM 3 FAQ: Why are some Text nodes empty? for more information. To navigate the opposite way through the child nodes list use Node.nextSibling. Specifications Specification Status Comment DOMThe definition of 'Node.previousSibling' in that specification. Living Standard No change Document Object Model (DOM) ...
Node.rootNode - Web APIs
See Whitespace in the DOM and W3C DOM 3 FAQ: Why are some Text nodes empty? for more information. ...
Notification.renotify - Web APIs
The renotify read-only property of the Notification interface specifies whether the user should be notified after a new notification replaces an old one, as specified in the renotify option of the Notification() constructor. Syntax var renotify = Notification.renotify; Value A Boolean. false is the default; true makes the notification renotify the user. Examples The following snippet is int
ended to fire a notification that renotifies the user after it has been replaced; a simple options object is created, and then the notification is fired using the Notification() constructor. var options = { body: 'Do you like my body?', renotify: true } var n = new Notification('Test notification',options); console.log(n.renotify) // should log true Specifications Specification Sta...
Notification.silent - Web APIs
of the Notification interface specifies whether the notification should be silent, i.e., no sounds or vibrations should be issued, regardless of the device settings. This is specified in the silent option of the Notification() constructor. Syntax var silent = Notification.silent; Value A Boolean. false is the default; true makes the notification silent. Examples The following snippet is int
ended to fire a silent notification; a simple options object is created, and then the notification is fired using the Notification() constructor. var options = { body: 'Do you like my body?', silent: true } var n = new Notification('Test notification', options); console.log(n.silent) // should log true Specifications Specification Status Comment Notifications APIThe def...
Notification.vibrate - Web APIs
s. The vibrate read-only property of the Notification interface specifies a a vibration pattern for the device's vibration hardware to emit when the notification fires. This is specified in the vibrate option of the Notification() constructor. Syntax var vibrate = Notification.vibrate; Value A vibration pattern, as specified in the Vibration API spec. Examples The following snippet is int
ended to create a notification that also triggers a device vibration; a simple options object is created, and then the notification is fired using the Notification() constructor. var options = { body: 'Do you like my body?', vibrate: [200, 100, 200] } var n = new Notification('Test notification',options); console.log(n.vibrate) // should log [200,100,200] Specifications Specification ...
OES_element_index_uint - Web APIs
upport for gl.UNSIGNED_INT types to WebGLRenderingContext.drawElements(). 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. Ext
ended methods This extension extends WebGLRenderingContext.drawElements(): The type parameter now accepts gl.UNSIGNED_INT. Examples var ext = gl.getExtension('OES_element_index_uint'); gl.drawElements(gl.POINTS, 8, gl.UNSIGNED_INT, 0); Specifications Specification Status Comment OES_element_index_uintThe definition of 'OES_element_index_uint' in that specification. ...
OES_texture_float - Web APIs
art of the WebGL API and exposes floating-point pixel types for 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 only available to WebGL1 contexts. In WebGL2, the functionality of this extension is available on the WebGL2 context by default. Ext
ended methods This extension extends WebGLRenderingContext.texImage2D() and WebGLRenderingContext.texSubImage2D(): The type parameter now accepts gl.FLOAT. The pixels parameter now accepts an ArrayBufferView of type Float32Array. Limitation: Linear filtering Linear filtering on floating-point textures is not allowed with this extension. If you set the magnification or minification filter in the...
OES_texture_half_float - Web APIs
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 constant in WebGL2 is gl.HALF_FLOAT. Constants ext.HALF_FLOAT_OES Half floating-point type (16-bit). Ext
ended methods This extension extends WebGLRenderingContext.texImage2D() and WebGLRenderingContext.texSubImage2D(): The type parameter now accepts ext.HALF_FLOAT_OES. Limitation: Linear filtering Linear filtering on half floating-point textures is not allowed with this extension. If you set the magnification or minification filter in the WebGLRenderingContext.texParameter() method to one of gl.LI...
OfflineAudioContext.resume() - Web APIs
The resume() method of the OfflineAudioContext interface resumes the progression of time in an audio context that has been susp
ended. The promise resolves immediately because the OfflineAudioContext does not require the audio hardware. If the context is not currently susp
ended or the rendering has not started, the promise is rejected with InvalidStateError. Syntax OfflineAudioContext.resume().then(function() { ... }); Parameters None. Returns A Promise resolving to void. Exceptions The promise is rejected when the following exception is encountered. InvalidStateError if the context is not currently susp
ended or the rendering has not started. Specifications Specification Status Comment Web Audio APIThe definition of 'resume()' in that specification. Wo...
OfflineAudioContext - Web APIs
the specified time and returns a promise. OfflineAudioContext.startRendering() Starts rendering the audio, taking into account the current connections and the current scheduled changes. This page covers both the event-based version and the promise-based version. Deprecated methods OfflineAudioContext.resume() Resumes the progression of time in an audio context that has previously been susp
ended. Note: The resume() method is still available -- it is now defined on the BaseAudioContext interface (see BaseAudioContext.resume()) and thus can be accessed by both the AudioContext and OfflineAudioContext interfaces. Events Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface: complete Fired when the rendering ...
OscillatorNode - Web APIs
). The default value is 0. OscillatorNode.type A string which specifies the shape of waveform to play; this can be one of a number of standard values, or custom to use a PeriodicWave to describe a custom waveform. Different waves will produce different tones. Standard values are "sine", "square", "sawtooth", "triangle" and "custom". The default is "sine". Event handlers OscillatorNode.on
ended Sets the event handler for the
ended event, which fires when the tone has stopped playing. Methods Inherits methods from its parent, AudioScheduledSourceNode, and adds the following: OscillatorNode.setPeriodicWave() Sets a PeriodicWave which describes a periodic waveform to be used instead of one of the standard waveforms; calling this sets the type to custom. This replaces the now-obsole...
ParentNode.append() - Web APIs
method inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inserted as equivalent Text nodes. Differences from Node.appendChild(): ParentNode.append() allows you to also append DOMString objects, whereas Node.appendChild() only accepts Node objects. ParentNode.append() has no return value, whereas Node.appendChild() returns the app
ended Node object. ParentNode.append() can append several nodes and strings, whereas Node.appendChild() can only append one node. Syntax // [Throws, Unscopable] ParentNode.append(...nodesOrDOMStrings) // returns undefined Parameters nodes A set of Node or DOMString objects to insert. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. Exam...
PasswordCredential.additionalData - Web APIs
and sent to the remote endpoint with the credentials. Syntax passwordCredential.additionalData = formData formData = passwordCredential.additionalData passwordCredential.additionalData = urlSearchParams ulrSearchParams = passwordCredential.additionalData Value One of a FormData instance, a URLSearchParams instance, or null. Example The following example creates a FormData object with an app
ended CSRF token. It then stores the form object in the additionalData parameter, before sending it to server in a call to fetch. //The options object was previously created. navigator.credentials.get(options).then(function(creds) { if (creds.type == 'password') { var form = new FormData(); var csrf_token = document.querySelector('csrf_token').value; form.append('csrf_token', csrf_token)...
PasswordCredential - Web APIs
ies from its ancestor, Credential. PasswordCredential.additionalData Secure context One of a FormData instance, a URLSearchParams instance, or null. The data in the objects will be added to the request body and sent to the remote endpoint with the credentials. PasswordCredential.iconURL Read only Secure context A USVString containing a URL pointing to an image for an icon. This image is int
ended for display in a credential chooser. The URL must be accessible without authentication. PasswordCredential.idName Secure context A USVString containing the name that will be used for the ID field when submitting the current object to a remote endpoint via fetch. This property defaults to 'username', but may be overridden to match whatever the backend service expects. PasswordCredential.name R...
PaymentAddress.region - Web APIs
address is located. This region has different names in different countries, such as: state, province, oblast, prefecture, or county. Usage notes In some countries, like Belgium, it's uncommon for people to provide a region as part of their postal address. In such cases, the browser returns an empty string as the value of region. However, the address should still be acceptable to use for its int
ended purpose (e.g., to ship a product). However, always verify addresses to make sure what the user provides is usable. Specifications Specification Status Comment Payment Request APIThe definition of 'PaymentAddress.region' in that specification. Candidate Recommendation Initial definition. ...
PaymentAddress - Web APIs
rance. Note: Properties for which values were not specified contain empty strings. Obsolete properties The following properties are obsolete and should no longer be used, but may still be present in some browser versions. PaymentAddress.languageCode Read only A DOMString indicating the language code of the address. This identifies the language in which the address is given, and is int
ended to aid in localization of the display of the address. Methods PaymentAddress.toJSON() A standard serializer that returns a JSON representation of the PaymentAddress object's properties. Examples 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 c...
PaymentRequest.PaymentRequest() - Web APIs
oose from. If this sequence is blank, it indicates the merchant cannot ship to the current shipping address. The default shipping option may be indicated in this sequence. modifiers Modifiers for specific payment methods; for example, adjusting the total amount based on the payment method. This parameter contains the following fields: additionalDisplayItems An array of items to be app
ended to the details.displayItems property. This property is commonly used to add a discount or surcharge line item indicating the different amount in details.modifiers.total. data A JSON-serializable object that provides optional information that might be needed by the supported payment methods. This has to conform to the structure defined in the BasicCardRequest dictionary. total A total ...
performance.setResourceTimingBufferSize() - Web APIs
Note: This feature is available in Web 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. ...
PerformanceEventTiming - Web APIs
mouseleave mouseout mouseover mouseup pointerover pointerenter pointerdown pointerup pointercancel pointerout pointerleave gotpointercapture lostpointercapture touchstart touchend touchcancel Properties PerformanceEventTiming.processingStart Returns the time at which event dispatch started. PerformanceEventTiming.processingEnd Returns the time at which the event dispatch
ended. PerformanceEventTiming.cancelable Returns the associated event's cancelable attribute. PerformanceEventTiming.target Returns the associated event's last target, if it is not removed. Methods PerformanceEventTiming.toJSON() Converts the PerformanceEventTiming object to JSON. Examples The following example shows how to use the API for all events: const observer = new PerformanceObser...
Using the Performance API - Web APIs
e. The DOMHighResTimeStamp type (a double) is used by all performance interfaces to hold such time values. Additionally, there must be a way to create a timestamp for a specific point in time; this is done with the now() method. Web performance interfaces are defined in a suite of standards. The base interface for these standards is the Performance interface and its methods and properties are ext
ended by different standards. This guide describes how to use the Performance interfaces that are defined in the High-Resolution Time standard. Other web performance guides (listed in the See also section) describe how to use additional methods and properties of the Performance interface. High precision timing High precision timing is achieved by using the DOMHighResTimeStamp type for time values. Th...
Performance Timeline - Web APIs
fied name and optionally the performance type. getEntriesByType() Returns the recorded performance entries based on the specified performance type. PerformanceEntry interface The PerformanceEntry interface encapsulates a single performance entry -- that is, a single data point or metric in the performance timeline. This interface has the following four properties, and these properties are ext
ended (with additional constraints) by other interfaces (such as PerformanceMark): name The name of the performance entry when the metric was created. entryType The type of performance metric (for example, "mark"). startTime A high resolution timestamp representing the starting time for the performance entry. duration A high resolution timestamp representing the time value of the duration of ...
Using Pointer Events - Web APIs
ogether. After drawing the line, we call Array.splice() to replace the previous information about the touch point with the current information in the ongoingTouches array. Handling the end of a touch When the user lifts a finger off the surface, a pointerup event is sent. We handle this event by calling the handleEnd() function below. Its job is to draw the last line segment for the touch that
ended and remove the touch point from the ongoing touch list. function handleEnd(evt) { log("pointerup"); var el = document.getElementsByTagName("canvas")[0]; var ctx = el.getContext("2d"); var color = colorForTouch(evt); var idx = ongoingTouchIndexById(evt.pointerId); if (idx >= 0) { ctx.lineWidth = 4; ctx.fillStyle = color; ctx.beginPath(); ctx.moveTo(ongoingTouches[idx]...
PublicKeyCredentialCreationOptions.rp - Web APIs
nts to an image resource which can be the logo/icon of the relying party. id A DOMString uniquely identifying a relying party. The default value of this property is the domain of the current document (e.g. "login.example.com"). It may be overridden with a suffix of the current domain (e.g. "example.com"). name A DOMString giving a human-readable name for the relying party. This property is int
ended for display (e.g. "Example CORP"). Examples var publicKey = { challenge: /* from the server */, rp: { name: "Example CORP", id : "login.example.com", icon: "https://login.example.com/login.ico" }, user: { id: new Uint8Array(16), name: "jdoe@example.com", displayName: "John Doe" }, pubKeyCredParams: [ { type: "public-key", alg: -7 } ] }...
PushEvent.data - Web APIs
16Disabled Full support 16Disabled Disabled From version 16: this feature is behind the Enable service workers preference. ...
PushMessageData.arrayBuffer() - Web APIs
d webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetarrayBuffer ExperimentalChrome Full support 50Edge Full support <=79Firefox Full support 44Notes Full support 44Notes Notes Ext
ended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.IE No support NoOpera Full support 37Safari No support NoWebView Android No support NoChrome Android Full supp...
PushMessageData.blob() - Web APIs
iAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetblob ExperimentalChrome Full support 50Edge Full support <=79Firefox Full support 44Notes Full support 44Notes Notes Ext
ended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.IE No support NoOpera Full support 37Safari No support NoWebView Android No support NoChrome Android Full supp...
PushMessageData.json() - Web APIs
iAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetjson ExperimentalChrome Full support 50Edge Full support <=79Firefox Full support 44Notes Full support 44Notes Notes Ext
ended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.IE No support NoOpera Full support 37Safari No support NoWebView Android No support NoChrome Android Full supp...
PushMessageData.text() - Web APIs
iAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internettext ExperimentalChrome Full support 50Edge Full support <=79Firefox Full support 44Notes Full support 44Notes Notes Ext
ended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.IE No support NoOpera Full support 37Safari No support NoWebView Android No support NoChrome Android Full supp...
PushSubscription.getKey() - Web APIs
rOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetgetKey()Chrome Full support 42Edge Full support 16Firefox Full support 44Notes Full support 44Notes Notes Ext
ended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.IE No support NoOpera Full support 29Safari No support NoWebView Android No support NoChrome Android Full supp...
PushSubscription.options - Web APIs
erOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetoptionsChrome Full support 42Edge Full support 16Firefox Full support 44Notes Full support 44Notes Notes Ext
ended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.IE No support NoOpera Full support 29Safari No support NoWebView Android No support NoChrome Android Full supp...
Web Push API Notifications best practices - Web APIs
s, Push, and Service Worker APIs) are part of the rising noise that product developers 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 recomm
ended products. The dark side Their novelty provides a new and unexploited opportunity 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 ...
RTCRtpParameters - Web APIs
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 supported by the sender or receiver. ...
Range.extractContents() - Web APIs
Range.extractContents() method moves contents of the Range from the document tree into a DocumentFragment. Event listeners added using DOM Events are not retained during extraction. HTML attribute events are retained or duplicated as they are for the Node.cloneNode() method. HTML id attributes are also cloned, which can lead to an invalid document if a partially-selected node is extracted and app
ended to the document. Partially selected nodes are cloned to include the parent tags necessary to make the document fragment valid. Syntax documentFragment = range.extractContents(); Example Basic example var range = document.createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); var documentFragment = range.extractContents(); document.body.appendChild(documentFragment);...
Request.mode - Web APIs
eb 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 supporting navigation. The navigate value is int
ended 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 value of the mode property for that Request is s...
Using the Resource Timing API - Web APIs
ulate the amount of time the following phases take: redirection (redirectStart and redirectEnd ), DNS lookup (domainLookupStart and domainLookupEnd), TCP handshake (connectStart and connectEnd), and response (responseStart and 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. function calculate_load_times() { // Check performance support if (performance === undefined) { console.log("= Calculate Load Times: performance NOT supported"); return; } // Get a list of "resource" performance entries ...
SVGAnimationElement: endEvent event - Web APIs
The endEvent event of the SVGAnimationElement interface is fired when at the active end of the animation is reached. Note: This event is not raised at the simple end of each animation repeat. This event may be raised both in the course of normal (i.e. scheduled or interactive) timeline play, as well as in the case that the element was
ended with a DOM method. Bubbles No Cancelable No Interface TimeEvent Event handler property onend 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"> <animateMotion path="M 0 0 H 300 Z" dur="5s" repeatCount="indefinite" /> ...
SVGLengthList - Web APIs
from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to insert before is before the removal of the item. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is app
ended to the end of the list. Exceptions: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only. replaceItem(in SVGLength newItem, in unsigned long index) SVGLength Replaces an existing item in the list with a new item. If newItem is already in a list, it is removed...
SVGNumberList - Web APIs
its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to insert before is before the removal of the item. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is app
ended to the end of the list. Exceptions: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only. replaceItem(in SVGNumber newItem, in unsigned long index) SVGNumber Replaces an existing item in the list with a new item. If newItem is already in a list, it is re...
SVGPathSegList - Web APIs
evious list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to insert before is before the removal of the item. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is app
ended to the end of the list. Exceptions: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list cannot be modified. replaceItem(in SVGPathSeg newItem, in unsigned long index) SVGPathSeg Replaces an existing item in the list with a new item.
SVGPointList - Web APIs
from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to insert before is before the removal of the item. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is app
ended to the end of the list. Exceptions: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only. replaceItem(in SVGPoint newItem, in unsigned long index) SVGPoint Replaces an existing item in the list...
SVGStringList - Web APIs
from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to insert before is before the removal of the item. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is app
ended to the end of the list. Exceptions: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only. replaceItem(in DOMString newItem, in unsigned long index) DOMString Replaces an existing item in the list with a new item. If newItem is already in a list, it is re...
SVGTransformList - Web APIs
from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to insert before is before the removal of the item. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is app
ended to the end of the list. Exceptions: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only. replaceItem(in SVGTransform newItem, in unsigned long index) SVGTransform Replaces an existing item in the list with a new item. If newItem is already in a list, it...
StyleSheet - Web APIs
epresents a single style sheet. CSS style sheets will further implement the more specialized CSSStyleSheet interface. Properties StyleSheet.disabled Is a Boolean representing whether the current stylesheet has been applied or not. StyleSheet.href Read only Returns a DOMString representing the location of the stylesheet. StyleSheet.media Read only Returns a MediaList representing the int
ended destination medium for style information. StyleSheet.ownerNode Read only Returns a Node associating this style sheet with the current document. StyleSheet.parentStyleSheet Read only Returns a StyleSheet including this one, if any; returns null if there aren't any. StyleSheet.title Read only Returns a DOMString representing the advisory title of the current style sheet. StyleSheet.typeRe...
TextDecoder.prototype.encoding - Web APIs
The TextDecoder.prototype.encoding read-only property returns a DOMString containing the name of the decoding algorithm used by the specific decoder. It can be one of the following values: The recomm
ended encoding for the Web: 'utf-8'. The legacy single-byte encodings: 'ibm866', 'iso-8859-2', 'iso-8859-3', 'iso-8859-4', 'iso-8859-5', 'iso-8859-6', 'iso-8859-7', 'iso-8859-8'', 'iso-8859-8i', 'iso-8859-10', 'iso-8859-13', 'iso-8859-14', 'iso-8859-15', 'iso-8859-16', 'koi8-r', 'koi8-u', 'macintosh', 'windows-874', 'windows-1250', 'windows-1251', 'windows-1252', 'windows-1253', 'windows-1254', 'windows-1255', 'windows-1256', 'windows-1257', 'windows-1258', or 'x-mac-cyrillic'. The legacy multi-byte Chinese (simplified) encodings: 'gbk', 'gb18030', and 'hz-gb-2312'. The legacy multi-byte C...
Using Touch Events - Web APIs
el set of features, yet they support 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 time; for example, the time elapsed between the touch's start and the touch's end, or the time lapse between two consecutive taps int
ended to create a double-tap gesture. The directionality of a swipe (for example left to right, right to left, etc.) is another factor to consider. The touch list(s) an application uses depends on the semantics of the application's gest...
TransformStream - Web APIs
ult: controller.enqueue(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 int
ended as a polyfill for unsupported 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() {retur...
TypeInfo - Web APIs
Properties TypeInfo.typeName Read only Returns a DOMString indicating the type's name. TypeInfo.typeNamespace Read only Returns a DOMString indicating the type's namespace within the schema. Methods TypeInfo.isDerivedFrom() Returns a Boolean. ...
UIEvent.isChar - Web APIs
alse. Some keystroke combinations may raise events but not produce any character (example: ctrl-alt-?). When this is the case, isChar returns false. It is used when event handlers need to do something like echo the input on the screen. Example In this snippet, which is part of an event handler, the event is checked to see if it generates a character; if it does, the value of UIEvent.which is app
ended to a string which buffers the typed characters. if (event.isChar) { characterBuffer += e.which; } Specification This property is not part of any specification. ...
URLSearchParams.append() - Web APIs
Note: This feature is available in Web Workers. Syntax URLSearchParams.append(name, value) Parameters name The name of the parameter to append. value The value of the parameter to append. Return value Void. Examples let url = new URL('https://example.com?foo=1&bar=2'); let params = new URLSearchParams(url.search.slice(1)); //Add a second foo parameter. ...
USBDevice - Web APIs
t resolves with a USBTransferInResult when a command or status operation has been transmitted to the USB device. USBDevice.controlTransferOut() Returns a Promise that resolves with a USBTransferOutResult when a command or status operation has been transmitted from the USB device. USBDevice.close() Returns a Promise that resolves when all open interfaces are released and the device session has
ended. USBDevice.isochronousTransferIn() Returns a Promise that resolves with a USBIsochronousInTransferResult when time sensitive information has been transmitted to the USB device. USBDevice.isochronousTransferOut() Returns a Promise that resolves with a USBIsochronousOutTransferResult when time sensitive information has been transmitted from the USB device. USBDevice.open() Returns a Promise t...
WEBGL_color_buffer_float - Web APIs
ailable to WebGL 1 contexts only. For WebGL 2, use the EXT_color_buffer_float extension. The OES_texture_float extension implicitly enables this extension. Constants ext.RGBA32F_EXT RGBA 32-bit floating-point color-renderable format. ext.RGB32F_EXT ( ) RGB 32-bit floating-point color-renderable format. ext.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT ? ext.UNSIGNED_NORMALIZED_EXT ? Ext
ended methods This extension extends WebGLRenderingContext.renderbufferStorage(): The internalformat parameter now accepts ext.RGBA32F_EXT and ext.RGB32F_EXT ( ). Examples var ext = gl.getExtension('WEBGL_color_buffer_float'); gl.renderbufferStorage(gl.RENDERBUFFER, ext.RBGA32F_EXT, 256, 256); Specifications Specification Status Comment WEBGL_color_buffer_floatThe def...
WEBGL_depth_texture - Web APIs
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 constant in WebGL2 is gl.UNSIGNED_INT_24_8. Constants This extension adds a new constant: ext.UNSIGNED_INT_24_8_WEBGL Unsigned integer type for 24-bit depth texture data. Ext
ended methods This extension extends WebGLRenderingContext.texImage2D(): The format and internalformat parameters now accept gl.DEPTH_COMPONENT and gl.DEPTH_STENCIL. The type parameter now accepts gl.UNSIGNED_SHORT, gl.UNSIGNED_INT, and ext.UNSIGNED_INT_24_8_WEBGL. The pixels parameter now accepts an ArrayBufferView of type Uint16Array and Uint32Array. This extension extends WebGLRenderingConte...
WebGLRenderingContext.lineWidth() - Web APIs
bGLRenderingContext.lineWidth() method of the WebGL API sets the line width of rasterized lines. The webgl spec, based on the OpenGL ES 2.0/3.0 specs points out that the minimum 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 recomm
ended 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 support 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. R...
Using WebGL extensions - Web APIs
: Extensions that are written by the ANGLE library authors. OES_ and KHR_: Extensions that mirror functionality from OpenGL ES (OES) or OpenGL API extensions approved by the respective architecture review boards (Khronos). OVR_: Extensions that optimize for virtual reality. EXT_: Extensions that mirror other OpenGL ES or OpenGL API extensions. WEBGL_: Extensions that are WebGL-specific and int
ended 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 supports querying what extensions are available. var available_extensions = gl.getSupportedExtensions(); The WebGLRenderingContext.getSupportedExtensions() meth...
WebGL best practices - Web APIs
This page tackles recommendations across the spectrum 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 reported in the Web Console as a JavaScript warning with a descriptive message. ...
WebRTC connectivity - Web APIs
ting) The caller calls RTCPeerConnection.createOffer() to create an offer. The caller calls RTCPeerConnection.setLocalDescription() to set that offer as the local description (that is, the description of the local end of the connection). After setLocalDescription(), the caller asks STUN servers to generate the ice candidates The caller uses the signaling server to transmit the offer to the int
ended receiver of the call. The recipient receives the offer and calls RTCPeerConnection.setRemoteDescription() to record it as the remote description (the description of the other end of the connection). The recipient does any setup it needs to do for its end of the call: capture its local media, and attach each media tracks into the peer connection via RTCPeerConnection.addTrack() The recipient th...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
Because WebRTC doesn't mandate a specific transport mechanism for signaling during the negotiation of a new peer connection, it's highly flexible. However, despite that flexibility in transport and communication of signaling messages, there's still a recomm
ended design pattern you should follow when possible, known as perfect negotiation. This article introduces WebRTC perfect negotiation, describing how it works and why it's the recomm
ended 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. This was due to a small number of issues with the API and some potential...
A simple RTCDataChannel sample - Web APIs
age(event) { var el = document.createElement("p"); var txtNode = document.createTextNode(event.data); el.appendChild(txtNode); receiveBox.appendChild(el); } This method simply performs some basic DOM injection; it creates a new <p> (paragraph) element, then creates a new Text node containing the message text, which is received in the event's data property. This text node is app
ended as a child of the new element, which is then inserted into the receiveBox block, thereby causing it to draw in the browser window. Disconnecting the peers When the user clicks the "Disconnect" button, the disconnectPeers() method previously set as that button's handler is called. function disconnectPeers() { // Close the RTCDataChannels if they're open. sendChannel.close(); rec...
Using DTMF with WebRTC - Web APIs
ften 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. ...
Improving compatibility using WebRTC adapter.js - Web APIs
ations. 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 support. 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 supporting browsers, use of this adapter is generally recomm
ended. The adapter is provided under a BSD-style license. What adapter.js does For each version of each browser that supports 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 RTCPee...
Inputs and input sources - Web APIs
intersects any objects in the scene, whether thye're virtual or real-world. See Targeting and hit detection for a more detailed look at what's involved.. Presenting hand-held objects An input source's gripSpace property identifies an XRSpace describing the origin and orienation to use when rendering an object so that it appears to be held in the same hand as its input source. This space is int
ended to be used when drawing a model of the handheld WebXR input controller represented by the objecXRInputSource, but can just as well be used to draw any object, such as a ball, a tool, or a weapon. We covered the grip space above, but let's see how it can be used to draw objects representative of the hand or in the hand. Since the origin of the grip space is located at the center of the hand's gri...
WebXR Device API - Web APIs
en buttons are pressed or released. XRInputSourcesChangeEvent Sent to indicate that the set of available input sources has changed for the XRSession. XRReferenceSpaceEvent Sent when the state of an XRReferenceSpace changes. XRSessionEvent Sent to indicate that the state of an XRSession has changed. For example, if the position and/or orient Extensions to the WebGL API The WebGL API is ext
ended by the WebXR specification to augment the WebGL context to allow it to be used to render views for display by a WebXR device. WebGLRenderingContextBase.makeXRCompatibile() Configures the WebGL context to be compatible with WebXR. If the context was not initially created with the xrCompatible property set to true, you must call makeXRCompatible() prior to attempting to use the WebGL context fo...
Example and tutorial: Simple synth keyboard - Web APIs
n have a small bit of space drawn between octaves), and set its class name to "octave" For each key in the octave, we check to see if the note's name has more than one character. We skip these, because we're leaving out the sharp notes in this example. If the note's name is only one character, then we call createKey(), specifying the note string, octave, and frequency. The returned element is app
ended to the octave element created in step 4. When each octave element has been built, it's app
ended to the keyboard. Once the keyboard has been constructed, we scroll the note "B" in octave 5 into view; this has the effect of ensuring that middle-C is visible along with its surrounding keys. Then a new custom waveform is built using AudioContext.createPeriodicWave(). This waveform will be used an...
Web audio spatialization basics - Web APIs
g away from them, etc. This is done by setting the different properties of the PannerNode object instance in relation to that movement, to emulate spacialization. Note: The experience is much better if you use headphones, or have some kind of surround sound system to plug your computer into. Creating an audio listener So let's begin! The BaseAudioContext (the interface the AudioContext is ext
ended from) has a listener property that returns an AudioListener object. This represents the listener of the scene, usually your user. You can define where they are in space and in which direction they are facing. They remain static. The pannerNode can then calculate its sound position relative to the position of the listener. Let's create our context and listener and set the listener's position to e...
Using the Web Speech API - Web APIs
lue of the SpeechRecognition.grammars property. We also set a few other properties of the recognition instance before we move on: SpeechRecognition.continuous: Controls whether continuous results are captured (true), or just a single result each time recognition is started (false). SpeechRecognition.lang: Sets the language of the recognition. Setting this is good practice, and therefore recomm
ended. SpeechRecognition.interimResults: Defines whether the speech recognition system should return interim results, or just final results. Final results are good enough for this simple demo. SpeechRecognition.maxAlternatives: Sets the number of alternative potential matches that should be returned per result. This can sometimes be useful, say if a result is not completely clear and you want to disp...
Using the Web Storage API - Web APIs
(note that, as with objects, integer keys will be automatically converted to strings). You can access these values like an object, or with the Storage.getItem() and Storage.setItem() methods. These three lines all set the (same) colorSetting entry: localStorage.colorSetting = '#a4509b'; localStorage['colorSetting'] = '#a4509b'; localStorage.setItem('colorSetting', '#a4509b'); Note: It's recomm
ended to use the Web Storage API (setItem, getItem, removeItem, key, length) to prevent the pitfalls associated with using plain objects as key-value stores. The two mechanisms within Web Storage are as follows: sessionStorage 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 res...
Using Web Workers - Web APIs
ften useful to divide computationally complex tasks among multiple workers, which may then perform those tasks on multiple-processor cores. Other types of worker In addition to dedicated and shared web workers, there are other types of worker available: ServiceWorkers essentially act as proxy servers that sit between web applications, and the browser and network (when available). They are int
ended to (amongst other things) enable the creation of effective offline experiences, intercepting network requests and taking appropriate action based on whether the network is available and updated assets reside on the server. They will also allow access to push notifications and background sync APIs. Chrome Workers are a Firefox-only type of worker that you can use if you are developing add-ons and...
Web Workers API - Web APIs
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 int
ended, 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 server. They will also allow access to push notifications and background sync APIs. Chrome Workers are a Firefox-only type of worker that you can use if you are developing add-ons and want...
Window: animationend event - Web APIs
The original target for this event is the Element that had the animation applied. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. For full details on this event please see the page on HTMLElement: animationend. Examples This example listens for the animationend event: window.addEventListener('animationend', () => { console.log('Animation
ended'); }); The same, but using the onanimationend event handler property: window.onanimationend = () => { console.log('Animation
ended'); }; See a live example of this event. Specifications Specification Status Comment CSS Animations Working Draft Initial definition ...
Window.console - Web APIs
Examples Logging to console The first example logs text to the console. console.log("An error occurred while loading the content"); The next example logs an object to the console, with the object's fields expandable using disclosure widgets: console.dir(someObject); See Usage in console for more thorough examples. ...
Window: copy event - Web APIs
The copy event fires when the user initiates a copy action through the browser's user interface. Bubbles Yes Cancelable Yes Interface ClipboardEvent Event handler property oncopy The original target for this event is the Element that was the int
ended target of the copy action. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. For full details on this event please see the page on the Element: copy event. Examples window.addEventListener('copy', (event) => { console.log('copy action initiated') }); Specifications Specification Status Clipboard API and events Working Draft ...
Window: cut event - Web APIs
The cut event is fired when the user has initiated a "cut" action through the browser's user interface. Bubbles Yes Cancelable Yes Interface ClipboardEvent Event handler property oncut The original target for this event is the Element that was the int
ended target of the cut action. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. For full details on this event please see the page on the Element: cut event. Examples window.addEventListener('cut', (event) => { console.log('cut action initiated') }); Specifications Specification Status Clipboard API and events Working Draft ...
Window.external - Web APIs
However, this is now deprecated, and the contained methods are now dummy functions that do nothing as per spec. Methods The External object has the following methods: Method Description AddSearchProvider(descriptionURL) Dummy function; does nothing. See Autodiscovery of search plugins. IsSearchProviderInstalled() Dummy function; does nothing. ...
window.location - Web APIs
Example #6: Using bookmarks without changing the hash property: <!doctype html> <html> <head> <meta charset="UTF-8"/> <title>MDN Example</title> <script> function showNode (oNode) { document.documentElement.scrollTop = oNode.offsetTop; document.documentElement.scrol...
Window.open() - Web APIs
ar. If windowFeatures is non-empty, location detaults to off. status If this feature is on, then the new secondary window has a status bar. If windowFeatures is non-empty, status detaults to off. 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 recomm
ended 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 viewport. 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 func...
Window: paste event - Web APIs
The paste event is fired when the user has initiated a "paste" action through the browser's user interface. Bubbles Yes Cancelable Yes Interface ClipboardEvent Event handler property onpaste The original target for this event is the Element that was the int
ended target of the paste action. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. For full details on this event please see the page on the Element: paste event. Examples window.addEventListener('paste', (event) => { console.log('paste action initiated') }); Specifications Specification Status Clipboard API and events Working Draft ...
window.postMessage() - Web APIs
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 int
ended receiver of the message containing the password, to prevent interception of the password by a malicious third party. Always provide a specific targetOrigin, not *, if you know where the other window's document should be located. Failing to provide a specific target discloses the data you send to any interested malicious site. transfer Optional Is a sequence of Transferable objects that are tran...
Window.prompt() - Web APIs
Full support 1IE Full support 4Notes Full support 4Notes Notes This function has no effect in the Modern UI/Metro version of Internet Explorer for Windows 8. It does not display a prompt to the user, and always returns undefined. It is not clear whether this is a bug or int
ended behavior. Desktop versions of IE do implement this function.Opera Full support 3Notes Full support 3Notes Notes Starting with Opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.Safari Full support 1WebView ...
window.requestIdleCallback() - Web APIs
Functions are generally called in first-in-first-out order; however, callbacks which have a timeout specified may be called out-of-order if necessary in order to run them before the timeout elapses. You can call requestIdleCallback() within an idle callback function to schedule another callback to take place no sooner than the next pass through the event loop. A timeout option is strongly recomm
ended for required work, as otherwise it's possible multiple seconds will elapse before the callback is fired. Syntax var handle = window.requestIdleCallback(callback[, options]) Return value An ID which can be used to cancel the callback by passing it into the window.cancelIdleCallback() method. Parameters callback A reference to a function that should be called in the near future, when the e...
Window.status - Web APIs
However, the HTML standard now requires setting window.status to have no effect on the text displayed in the status bar. ...
Window: transitionend event - Web APIs
inal target for this event is the Element that had the transition applied. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. For full details on this event please see the page on HTMLElement: transitionend. Examples This code adds a listener to the transitionend event: window.addEventListener('transitionend', () => { console.log('Transition
ended'); }); The same, but using the ontransitionend property instead of addEventListener(): window.ontransitionend = () => { console.log('Transition
ended'); }; See a live example of this event. Specifications Specification Status Comment CSS TransitionsThe definition of 'transitionend' in that specification. Working Draft Initial definition. ...
Window: transitionstart event - Web APIs
Bubbles Yes Cancelable No Interface TransitionEvent Event handler property GlobalEventHandlers.ontransitionstart The original target for this event is the Element that had the transition applied. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. For full details on this event please see the page on HTMLElement: transitionstart. ...
Sending and Receiving Binary Data - Web APIs
l); var abyte = filestream.charCodeAt(x) & 0xff; // throw away high-order byte (f7) The example above fetches the byte at offset x within the loaded binary data. The valid range for x is from 0 to filestream.length-1. See downloading binary streams with XMLHttpRequest for a detailed explanation. See also downloading files. Sending binary data The send method of the XMLHttpRequest has been ext
ended to enable easy transmission of binary data by accepting an ArrayBuffer, Blob, or File object. The following example creates a text file on-the-fly and uses the POST method to send the "file" to the server. This example uses plain text, but you can imagine the data being a binary file instead. var oReq = new XMLHttpRequest(); oReq.open("POST", url, true); oReq.onload = function (oEvent) { // U...
Using XMLHttpRequest - Web APIs
pen</policyname> to allAccess to give specific sites cross-site access. This is no longer supported. Firefox 5 note Versions of Firefox prior to Firefox 5 could use netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); to request cross-site access. This is no longer supported, even though it produces no warning and permission dialog is still presented. The recomm
ended way to enable cross-site scripting is to use the Access-Control-Allow-Origin HTTP header in the response to the XMLHttpRequest. XMLHttpRequests being stopped If you conclude with an XMLHttpRequest receiving status=0 and statusText=null, this means the request was not allowed to be performed. It was UNSENT. A likely cause for this is when the XMLHttpRequest origin (at the creation of the XMLHttp...
XMLHttpRequest.setRequestHeader() - Web APIs
The XMLHttpRequest method setRequestHeader() sets the value of an HTTP request header. When using setRequestHeader(), you must call it after calling open(), but before calling send(). If this method is called several times with the same header, the values are merged into one single request header. Each time you call setRequestHeader() after the first time you call it, the specified text is app
ended to the end of the existing header's content. If no Accept header has been set using this, an Accept header with the type "*/*" is sent with the request when send() is called. For security reasons, some headers can only be controlled by the user agent. These headers include the forbidden header names and forbidden response header names. Note: For your custom fields, you may encounter a "not all...
XMLHttpRequest.upload - Web APIs
out because a reply did not arrive within the time interval specified by the XMLHttpRequest.timeout. loadend onloadend The upload finished. This event does not differentiate between success or failure, and is sent at the end of the upload regardless of the outcome. Prior to this event, one of load, error, abort, or timeout will already have been delivered to indicate why the upload
ended. Specifications Specification Status Comment XMLHttpRequest Living Standard WHATWG living standard ...
XRBoundedReferenceSpace.boundsGeometry - Web APIs
XR hardware. In order to reduce the risk of the room boundaries being used for fingerprinting purposes, each point in the boundsGeometry array may be rounded or adjusted by some amount. The specification recommends that browsers shift the points to the nearest 5 centimeters (while avoiding going outside the physical limitations of the hardware). Boundary size XRBoundedReferenceSpace is not int
ended to be used for very large bounded areas. Instead, it's meant to be used for one-room spaces with no more than around 15 meters of available movement space in any direction from the native origin. That said, the bounds extend upward indefinitely, since the bounds are defined in only two dimensions. If you need to create a multi-room space, or a space which is very large or needs to have varying f...
XREnvironmentBlendMode - Web APIs
rs a way to create an AR presentation using a VR device. Alpha blending can also be used by non-wearable devices that provide AR modes, such as phones or tablets using cameras to capture the real world for use in AR apps. Since the real world is being digitally presented, the brightness of each pixel can be controlled, whether it's reality or the rendered XR image, the user's environment can be bl
ended with the virtual environment with each pixel having its color and brightness precisely controlled. In this mode, the XRSession's renderState.baseLayer property provides relative weights of the artificial layer during the compositing process. Pixels whose alpha value is 1.0 are rendered fully opaque, totally obscuring the real world, while pixels with an alpha of 1.0 are totally transparent, leav...
XRHandedness - Web APIs
t means the input source is a hand-held device of some sort, so it should be rendered visibly if possible. If gripSpace is non-null, the function proceeds to get the pose for the gripSpace transformed into the current reference space. Assuming that's then valid, a function called myRenderHandObject() is called with the grip's pose and the value of handedness. WIth these values in hand (no pun int
ended), myRenderHandObject() can draw the appropriate model positioned and formed for the correct hand. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRHandedness' in that specification. Working Draft Initial definition. ...
XRInputSource.handedness - Web APIs
t means the input source is a hand-held device of some sort, so it should be rendered visibly if possible. If gripSpace is non-null, the function proceeds to get the pose for the gripSpace transformed into the current reference space. Assuming that's then valid, a function called myRenderHandObject() is called with the grip's pose and the value of handedness. WIth these values in hand (no pun int
ended), myRenderHandObject() can draw the appropriate model positioned and formed for the correct hand. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRInputSource.handedness' in that specification. Working Draft Initial definition. ...
XRInputSource.targetRayMode - Web APIs
er the ray. Example This fragment of code shows part of a function to be called once every frame. It looks for inputs which have a non-NULL targetRaySpace. Inputs which have a value for this property represent inputs that project a target ray outward from the user. For each such input, this example looks for inputs whose targetRayMode is tracked-pointer, indicating that the input is in fact int
ended to represent a targeting device rather than a gazing device, screen tap, or mouse click. For tracked pointers, a function myRenderTargetRayAsBeam() is called to render a beam from the input controller's virtual position outward in the direction it's pointing. The code should continue to perform tasks such as drawing controllers or any objects representative of the user's hands' positions in the ...
XRInputSource.targetRaySpace - Web APIs
n you need. Example This fragment of code shows part of a function to be called once every frame. It looks for inputs which have a non-NULL targetRaySpace. Inputs which have a value for this property represent inputs that project a target ray outward from the user. For each such input, this example looks for inputs whose targetRayMode is tracked-pointer, indicating that the input is in fact int
ended to represent a targeting device rather than a gazing device, screen tap, or mouse click. For tracked pointers, a function myRenderTargetRayAsBeam() is called to render a beam from the input controller's virtual position outward in the direction it's pointing. The code should continue to perform tasks such as drawing controllers or any objects representative of the user's hands' positions in the ...
XRRigidTransform.matrix - Web APIs
8]a[12]a[1]a[5]a[9]a[13]a[2]a[6]a[10]a[14]a[3]a[7]a[11]a[15]]\begin{bmatrix} a[0] & a[4] & a[8] & a[12]\\ a[1] & a[5] & a[9] & a[13]\\ a[2] & a[6] & a[10] & a[14]\\ a[3] & a[7] & a[11] & a[15]\\ \end{bmatrix} The first time matrix is requested, it gets computed; after that, it's should be cached to avoid slowing down to compute it every time you need it. Creating the matrix In this section, int
ended for more advanced readers, we cover how the API calculates the matrix for the specified transform. It begins by allocating a new matrix and writing a 4x4 identity matrix into it: [1000010000100001]\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1 \end{bmatrix} This is a transform that will not change either the orientation or position of any point, vector, or object ...
XRRigidTransform.position - Web APIs
nsform.position; Value A read-only DOMPointReadOnly indicating the 3D position component of the transform matrix. The units are meters. Note: The w component of the point is always 1.0. ...
XRSession: end event - Web APIs
An end event is fired at an XRSession object when the WebXR session has
ended, either because the web application has chosen to stop the session, or because the user agent terminated the session. Bubbles No Cancelable No Interface XRSessionEvent Event handler XRSession.onend Example To be informed when a WebXR session comes to an end, you can add a handler to your XRSession instance using addEventListener(), like this: XRSession.addEventListener("end", function(event) { /* the session has shut down */ }); Alternatively, you can use the XRSession.onend event handler property to establish a handler for the end event: XRSession.onend = function(event) { /* the session has shut down */ } Specifications Specification Stat...
XRSession.environmentBlendMode - Web APIs
rs a way to create an AR presentation using a VR device. Alpha blending can also be used by non-wearable devices that provide AR modes, such as phones or tablets using cameras to capture the real world for use in AR apps. Since the real world is being digitally presented, the brightness of each pixel can be controlled, whether it's reality or the rendered XR image, the user's environment can be bl
ended with the virtual environment with each pixel having its color and brightness precisely controlled. In this mode, the XRSession's renderState.baseLayer property provides relative weights of the artificial layer during the compositing process. Pixels whose alpha value is 1.0 are rendered fully opaque, totally obscuring the real world, while pixels with an alpha of 1.0 are totally transparent, leav...
XRSession.onend - Web APIs
The onend attribute of the XRSession object is the event handler for the end event, which is dispatched after the XR session ends and all related hardware-specific routines are completed. Syntax XRSession.onend = function(event) { ... }; Example XRSession.onend = function(event) { console.log("The XR session has
ended") } Specifications Specification Status Comment WebXR Device APIThe definition of 'XRSession.onend' in that specification. Working Draft Initial definition. ...
XRSession.requestAnimationFrame() - Web APIs
rFrame) { xrSession.requestAnimationFrame(onXRAnimationFrame) renderFrame(time, xrFrame) } function renderFrame(time, xrFrame) { // Shared rendering logic. } // Assumed to be called by a user gesture event elsewhere in code. function startXRSession() { navigator.xr.requestSession('immersive-vr').then((session) => { xrSession = session xrSession.addEventListener('end', onXRSession
Ended) // Do necessary session setup here. // Begin the session's animation loop. xrSession.requestAnimationFrame(onXRAnimationFrame) }) } function onXRSession
Ended() { xrSession = null } Specifications Specification Status Comment WebXR Device APIThe definition of 'XRSession.requestAnimationFrame' in that specification. Working Draft Initial definit...
XRSession.updateRenderState() - Web APIs
e sessions, so the value is null by default for immersive sessions. The default value is otherwise ? * 0.5 (half of the value of pi). Return value None. Exceptions This method may throw any of the following exceptions. These are true exceptions, since this method does not return a promise. InvalidStateError This may occur for one of the following reasons: The XRSession has already
ended, so you cannot change its render state. The baseLayer specified in newState was created by an XRSession other than the one on which updateRenderState() was called. The inlineVerticalFieldOfView property was set, but the session is immersive and therefore does not allow this property to be used. Examples This example creates a WebGL context that is compatible with an immersive XR device...
XRSession - Web APIs
ates 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 Description end Sent to the XRSession object after the WebXR session has
ended and all hardware-related functions have completed. The event is represented by an object of type XRSessionEvent. Also available through the onend event handler property. inputsourceschange An event of type XRInputSourcesChangeEvent sent to the XRSession when the list of active XR input sources has changed. Also available through the oninputsourceschange event handler property.
XRSessionEvent() - Web APIs
session The XRSession to which the event is to be delivered. Return value A newly-created XRSessionEvent object representing an object of the specfied type and configured as described by the eventInitDict parameter. Event types The following events are represented using the XRSessionEvent interface, and are permitted values for its type property. end Fired at the session when it has
ended, after being terminated by the application or the user agent. visibilitychange Fired at the session whenever its visibility state changes. Examples This example creates a listiener that watches for the visibility state of the session to change. It reacts by calling a function mySessionVisible() with a Boolean indicating whether or not the session is visible; this function might, for instance...
XRSessionEvent - Web APIs
vent, XRSessionEvent provides the folllowing: session Read only The XRSession to which the event refers. Methods While XRSessionEvent defines no methods, it inherits methods from its parent interface, Event. Session event types The following events are represented using the XRSessionEvent interface, and are permitted values for its type property. end Fired at the session when it has
ended, after being terminated by the application or the user agent. visibilitychange Fired at the session whenever its visibility state changes. Examples This example creates a listiener that watches for the visibility state of the session to change. It reacts by calling a function mySessionVisible() with a Boolean indicating whether or not the session is visible; this function might, for instance...
XRSessionMode - Web APIs
The WebXR Device API's XRSessionMode 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 bl
ended with the real-world environment. The session's environmentBlendMode indicates the method to be used to blend the content together. Important: 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 int
ended to be overlaid or integrated into the surrounding environment. The...
XRTargetRayMode - Web APIs
eir hand. Examples This fragment of code shows part of a function to be called once every frame. It looks for inputs which have a non-NULL targetRaySpace. Inputs which have a value for this property represent inputs that project a target ray outward from the user. For each such input, this example looks for inputs whose targetRayMode is tracked-pointer, indicating that the input is in fact int
ended to represent a targeting device rather than a gazing device, screen tap, or mouse click. For tracked pointers, a function myRenderTargetRayAsBeam() is called to render a beam from the input controller's virtual position outward in the direction it's pointing. The code should continue to perform tasks such as drawing controllers or any objects representative of the user's hands' positions in the ...
XRWebGLLayer - Web APIs
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. Static methods getNativeFramebufferScaleFactor() Returns the scaling factor that can be used to scale the resolution of the recomm
ended WebGL framebuffer resolution to the rendering device's native resolution. Examples Binding the layer to a WebGL context This snippet, taken from Drawing a frame in Movement, orientation, and motion: A WebXR example, shows how the XRWebGLLayer is obtained from the XRSession object's rendering state and is then bound as the current rendering WebGL framebuffer by calling the WebGL bindFrameBuffe...
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 int
ended 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 int
ended meaning while supporting 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 q...
Using the alert role - Accessibility
ent.getElementById("formInstruction").setAttribute("role", "alert"); Example 4: Making an element with an alert role visible If an element already has role="alert" and is initially hidden using CSS, making it visible will cause the alert to fire as if it was just added to the page. This means that an existing alert can be "reused" multiple times. Note: In most cases this approach is not recomm
ended, because it's not ideal to hide error or alert text that is currently not applicable. Users of older assistive technology may still be able to perceive the alert text even when the alert does not currently applies, causing users to incorrectly believe that there is a problem. .hidden { display:none; } <p id="expirationWarning" role="alert" class="hidden">Your log in session will expire in 2 ...
Using the aria-invalid attribute - Accessibility
The snippet below shows a very simple validation function, which only checks for the presence of a particular character (in the real world, validation will likely be more sophisticated): function checkValidity(aID, aSearchTerm, aMsg){ var elem = document.getElementById(aID); var invalid = (elem.value.indexOf(aSearchTerm) < 0); if (invalid) { elem.setAttribute("aria-invalid...
Using the aria-labelledby attribute - Accessibility
is used to link a LABEL to an INPUT. Assistive technology, such as screen readers, use this attribute to catalog the objects in a document so that users can navigate between them. Without an element ID, the assistive technology cannot catalog the object. aria-labelledby is very similar to aria-describedby: A label provides essential information about an object, while a description provides ext
ended 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 suppor...
Using the group role - Accessibility
Description This technique demonstrates how to use the group role and describes the effect it has on browsers and assistive technology. The group role is used to identify a set of user interface objects which, in contrast with a region, are not int
ended to be included in a table of contents or a page summary (such as the structures that are dynamically created by a script or assistive technologies); a group should not be considered a major perceivable section on a page. When the role is added to an element, the browser will send out an accessible group event to assistive technology products which can then notify the user about it. A group should be used to form a logical collection of items with related functionality, such as children in a tree widget forming a collection of siblings...
Using the link role - Accessibility
s technique demonstrates how to use the link role and describes the effect it has on browsers and assistive 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 recomm
ended that you use a native <a> element rather than the link role, as native elements are more widely supported by older user agents and assistive technology. Native <a> elements also support 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...
How to file ARIA-related bugs - Accessibility
If you notice an implementation issue, please take a little time and let the developers know. Here's where to file bugs: When finding a bug, please also update the relevant compatibility tables in the examples page. ...
ARIA: application role - Accessibility
</div> This defines this div element and all of its descendants to be treated like they are part of a desktop application. Description The application role indicates to assistive technologies that this part of the web content contains elements that do not conform to any other known HTML element or WAI-ARIA widget. Any sort of special interpretation of HTML structures and widgets should be susp
ended, and control should be completely handed over to the browser and web application to handle mouse, keyboard, or touch interaction. In this mode, the web author is completely responsible for handling any and all keyboard input, focus management, and other interactions and cannot assume assistive technologies would do any processing on their end. If the web application encompassed by the applicati...
ARIA: Comment role - Accessibility
.</p> <p><time datetime="2019-03-30T19:29">March 30 2019, 19:29</time></p> <div role="comment" data-author="marcus"> <h3>Marcus replied</h3> <p class="comment-text">I don't know about that. I think the cowbell could distract from the solo.</p> <p><time datetime="2019-03-30T21:02">March 30 2019, 21:02</time></p> </div> </div> Accessibility concerns Landmark roles are int
ended 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. Specifications Will be part of WAI-ARIA 1.3, which is still being drafted. Screen reader support TBD ...
ARIA: Complementary role - Accessibility
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 <aside> element will automatically communicate a section has a role of complementary. If at all possible, prefer using it instead. Labeling landmarks...
ARIA: feed role - Accessibility
e 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 Supporting the following, or a similar, interface is recomm
ended 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 blog posts, the convention is to tab into the nested fee...
ARIA: Mark role - Accessibility
0T19:29">March 30 2019, 19:29</time></p> </div> The related comment is marked up using an HTML structure wrapped with a <div> containing role="comment". To associate the comment with the text being commented, we need to wrap the commented text with an element containing the aria-details attribute, the value of which should be the ID of the comment. Accessibility concerns Landmark roles are int
ended 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 <mark> element will automatically communicate a section has a role of mark. If at all possible, prefer using it instead. Specifications Will be part...
ARIA: Region role - Accessibility
will be the id of the element used to title the section. Keyboard Interactions None. Required JavaScript features None. Examples <div role="region" aria-labelledby="region-heading"> <h2 id="region-heading">This heading's <code>id</code> attribute helps this region have an accessible name</h2> <!-- region content --> </div> Accessibility concerns Use sparingly! Landmark roles are int
ended 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. Only use the region role if no other relevant content sectioning element or landmark role applies. If multiple regions exist on a page, it may be worth reinvestigating the page's overall st...
ARIA: row role - Accessibility
ope. Unlike a plain cell, the rowheader role establishes a relationship between it and all cells in the corresponding row. States and properties aria-expanded state The aria-expanded attribute, which defines the state of the row, can take one of three values, or be omitted: aria-expanded="true: Row is currently expanded. aria-expanded="false": Row is currently collapsed. aria-exp
ended="undefined" or the attribute is missing: The row is neither expandable nor collapsible. If the element with the aria-expanded attribute controls the expansion of another grouping container that is not 'owned by' the element, the author should reference the container by using the aria-controls attribute. aria-selected state Only relevant if the row is in an interactive container, such as a...
ARIA: search role - Accessibility
earch, each should have a unique label. While there is a input of type search, there is HTML element that defines a search landmark. Examples <form id="search" role="search"> <label for="search-input">Search this site</label> <input type="search" id="search-input" name="search" spellcheck="false"> <input value="Submit" type="submit"> </form> Accessibility concerns Landmark roles are int
ended 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 support. Labeling landmarks Multiple landmarks ...
ARIA: Suggestion role - Accessibility
una</span> <span role="insertion">purple Tyrannosaurus Rex called Tiny</span> </span>. </p> <div id="comment-source">Suggested by Chris, <time datetime="2019-03-30T19:29">March 30 2019, 19:29</time></div> Browsers tend to provide a default black strikethrough for deletions, and a black underline for insertions, but you'll probably want to use Accessibility concerns Landmark roles are int
ended 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 <ins> and <del> element will automatically communicate a section has a role of insertion or deletion. If at all possible, prefer using the HTML elemen...
ARIA: button role - Accessibility
ue of an aria-label or element referenced by an aria-labelledby attribute, or description, if included. Best practices If a link performs the action of a button, giving the element role="button" 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 recomm
ended 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 supported by all user agents and assistive technology and provide keyboard and focus requirements by default, without need for additional customization. Specifications Specification Status ...
ARIA: checkbox role - Accessibility
r on how assistive technology should handle this technique. The information provided above is one of those opinions and therefore not normative. 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 recomm
ended to use the native HTML checkbox using form control instead of recreating a checkbox's functionality with JavaScript and ARIA. ...
ARIA: textbox role - Accessibility
ample, in a combobox, 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 int
ended value. It supports 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-has...
WAI-ARIA Roles - Accessibility
form roleThe form landmark role can be used to identify a group of elements on a page that provide equivalent functionality to an HTML form.ARIA: grid roleThe grid role is for a widget that contains one or more rows of cells. The position of each cell is significant and can be focused using keyboard input.ARIA: gridcell roleThe gridcell role is used to make a cell in a grid or treegrid. It is int
ended to mimic the functionality of the HTML td element for table-style grouping of information.ARIA: heading roleThe heading role defines this element as a heading to a page or section. To give the page more structure, a level should also be provided to indicate relationships between sections.ARIA: img roleThe ARIA img role can be used to identify multiple elements inside page content that should be c...
Basic form hints - Accessibility
edby="descriptionRevert">Revert</button> <div id="descriptionRevert">Reverting will undo any changes that have been made since the last save.</div> Note: The aria-describedby attribute is used for other purposes, in addition to form controls. Required and invalid fields Note: Now that required is available to more than 97% of users globally, it is no longer recomm
ended that you use both required and aria-required. Web developers typically use presentational strategies to indicate required or invalid fields. Assistive technologies (ATs) cannot necessarily infer this information from the presentation. ARIA provides attributes for indicating that form controls are required or invalid: The aria-required property can be applied to a form element, to indicate to...
Cognitive accessibility - Accessibility
be checked for errors before submission, and the user should be given the opportunity to correct them. The user should be able to review, confirm, and correct information before final submission. Also, be sure to include a confirmation checkbox in addition to a submit button. If a submission causes a legal or financial transaction to occur, provide a stated time within which the request can be am
ended or canceled by the user. Provide help Context-sensitive help should be made available. If a form requires text input, provide form instructions describing the purpose and the necessary input. Include spell checking and suggestions for long-form text input, as well as links to help and support material. If a specific data format is expected for input, provide an example. Notes The ab...
Mobile accessibility checklist - Accessibility
Colour Colour contrast MUST comply with WCAG 2.1 AA level requirements: Contrast ratio of 4.5:1 for normal text (less than 18 point or 14 point bold.) Contrast ratio of 3:1 for large text (at least 18 point or 14 point bold.) Information conveyed via colour MUST be also available by other means too (underlined text for links, etc.) Visibility Content hiding techniques such as zero opacity, z-index order and off-screen placement MUST NOT be used exclusively to handle visibility. ...
Web Accessibility: Understanding Colors and Luminance - Accessibility
GB color space. This is because the companies behind the evolution of digital technology set the standards, and these standards still retain a powerful presence today. This is evolving, and new methods for measuring color involve measurements using other color spaces, but color measurements in the RGB color space still predominates, and this includes video production. The RGB color model is ext
ended to include "alpha" -- RGBA -- to allow specification of the opacity of a color. There's movement towards adopting the use of HSL color values rather than RGB values is CSS Color Module 3 (see section 4.2.4), the rationale being that RGB is hardware-oriented, reflecting the use of CRTs, and that RGB is non-intuitive. That said, HSL colors incorporate lightness, not luminance, and this is a signi...
Perceivable - Accessibility
ptions for prerecorded video (AA) Audio descriptions should be provided for prerecorded video, but only where the existing audio does not convey the full meaning expressed by the video. 1.2.6 Provide sign language equivalent to prerecorded audio (AAA) An equivalent sign language video should be provided for any prerecorded content containing audio. 1.2.7 Provide ext
ended video with audio descriptions (AAA) Where audio descriptions cannot be provided (see 1.2.5) due to video timing issues (e.g., there are no suitable pauses in the content in which to insert the audio descriptions), an alternative version of the video should be provided that includes inserted pauses (and audio descriptions). 1.2.8 Provide an alternative for prerecorded media (AAA) ...
Robust - Accessibility
o pass this criterion, make sure that your HTML is as valid as possible. Use the W3C validator to validate your markup. See Debugging HTML for a practical guide. 4.1.2 Name, Role, Value (A) The name and role of user interface components (e.g. form inputs, buttons, links, etc.) should be programmatically determinable. When using semantic elements correctly for their int
ended purpose, this criterion should be passed automatically. When scripting custom components, you will need to use WAI-ARIA roles and other features to make sure your controls will be interpreted and are able to be used as int
ended, e.g. not only by sighted mouse users, but also by screenreader users, keyboard-only users, etc. See HTML: A good basis for accessibility and WAI-ARIA basics. ...
Text labels and names - Accessibility
and <area> elements, as well as <input> elements where type=image and <object> elements where the type starts with image/. The typical way to do this is with the alt attribute. Be sure that the description conveys what is shown in the image. Example <img src="milkweed.jgp" alt="Black and white close-up photo of milkweed flowers"> Interactive elements must be labeled If an element is int
ended for users to interact with it, it should have a label. Interactive elements include links (<a>), form elements, buttons, and any element that has a handler for mouse or keyboard events. The way to label an element depends on its type: for form elements, use a <label>; for links, buttons and clickable elements, the text content of the element typically provides the label. If no other option exists...
Understanding the Web Content Accessibility Guidelines - Accessibility
However, we are not lawyers, and none of this constitutes legal advice. If you are worried about the legal implications of web accessibility, we'd recommend that you check the specific legislation governing accessibility for the web/public resources in your country or locale, and seek the advice of a qualified la...
Accessibility
developers who want to make their styled <div> and <span> based widgets accessible have lacked the proper techniques. Keyboard accessibility is part of the minimum accessibility requirements which a developer should be aware of. ARIA A collection of articles to learn how to use ARIA to make your HTML documents more accessible. Assistive technology (AT) development A collection of articles int
ended for AT developers Mobile accessibility checklist This document provides a concise checklist of accessibility requirements for mobile app developers. Cognitive accessibility When creating web content, be aware of how you can ensure that it is accessible to people cognitive impairments. Accessibility for seizure disorders Some types of visual web content can induce seizures in people with cer...
-webkit-box-reflect - CSS: Cascading Style Sheets
To achieve reflection on the Web, the standard way is to use the CSS element() function. Syntax Values above, below, right, left Are keywords indicating in which direction the reflection is to happen. <length> Indicates the size of the reflection. <image> Describes the mask to be applied to the reflection. Formal definition Initial valuenoneApplies toall elem...
:-moz-broken - CSS: Cascading Style Sheets
The :-moz-broken CSS pseudo-class is a Mozilla extension that matches elements representing broken image links. Note: This selector is mainly int
ended to be used by theme developers. Syntax :-moz-broken Examples HTML <img src="broken.jpg" alt="This image is broken. :-("> CSS :-moz-broken { background: bisque; padding: 8px; } Result Specifications Not part of any standard. ...
:-moz-loading - CSS: Cascading Style Sheets
The :-moz-loading CSS pseudo-class is a Mozilla extension that matches elements that can't be displayed because they have not started loading, such as images that haven't started to arrive yet. Note that images that are in the process of loading are not matched by this pseudo-class. Note: This selector is mainly int
ended to be used by theme developers. Syntax :-moz-loading Examples Setting a background for images that are loading :-moz-loading { background-color: #aaa; background-image: url(loading-animation.gif) center no-repeat; } Specifications Not part of any standard. ...
:-moz-suppressed - CSS: Cascading Style Sheets
The :-moz-suppressed CSS pseudo-class is a Mozilla extension that matches elements representing images that were suppressed because loading images from the specified site has been blocked. Note: This selector is mainly int
ended to be used by theme developers. Syntax :-moz-suppressed Examples Styling elements that have been blocked :-moz-suppressed { background: yellow; padding: 8px; } Specifications Not part of any standard. ...
:-moz-user-disabled - CSS: Cascading Style Sheets
The :-moz-user-disabled CSS pseudo-class is a Mozilla extension that matches elements representing images that were not loaded because images have been entirely disabled by the user's preferences. Note: This selector is mainly int
ended to be used by theme developers. Syntax :-moz-user-disabled Examples Styling user-disabled elements :-moz-user-disabled { background-color: lightgray; padding: 8px; } Specifications Not part of any standard. ...
speak-as - CSS: Cascading Style Sheets
k-as is specified as auto, then the effective value of speak-as will be determined based on the value of the system descriptor: If the value of system is alphabetic, the effective value of speak-as will be spell-out. If system is cyclic, the effective value of speak-as will be bullets. If system is extends, the value of speak-as will be the same as if speak-as: auto is specified on the ext
ended style. For all other cases, specifying auto has the same effect as specifying speak-as: numbers. bullets A phrase or an audio cue defined by the user agent for representing an unordered list item will be read out. numbers The numerical value of the counter will be read out in the document language. words The user agent will generate a counter value as normal and read it out as a word ...
system - CSS: Cascading Style Sheets
wo parts: a normal counter symbol and a non-negative integer weight. The additive tuples must be specified in the descending order of their weights or the system is invalid. extends Allows authors to use the algorithm of another counter style, but alter its other aspects. If a counter style rule is using the extends system, any unspecified descriptors, and their values will be taken from the ext
ended counter style specified. If the specified counter style name in extends, is not a currently defined counter style name, it will instead extend from the decimal counter style. It must not contain a symbols or additive-symbols descriptor, or else the counter style rule is invalid. If one more more counter styles defenitions form a cycle with their extends values, the browser will treat all the p...
@import - CSS: Cascading Style Sheets
rting CSS rules conditionally @import url("fineprint.css") print; @import url("bluish.css") speech; @import "common.css" screen; @import url('landscape.css') screen and (orientation:landscape); Specifications Specification Status Comment CSS Cascading and Inheritance Level 4The definition of 'the @import rule' in that specification. Candidate Recommendation Ext
ended the syntax to support the @supports syntax. CSS Cascading and Inheritance Level 3The definition of '@import' in that specification. Candidate Recommendation Media QueriesThe definition of '@import' in that specification. Recommendation Ext
ended the syntax to support any media query and not only simple media types. CSS Level 2 (Revision 1)The definition of '...
@media - CSS: Cascading Style Sheets
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 all devices. print Int
ended for paged material and documents viewed on a screen in print preview mode. (Please see paged media for information about formatting issues that are specific to these formats.) screen Int
ended primarily for screens. speech Int
ended for speech synthesizers. Deprecated media types: CSS2.1 and Media Queries 3 defined several additional media types (tty, tv, projection, handheld, braille, emboss...
viewport-fit - CSS: Cascading Style Sheets
viewport fills the screen. Syntax /* Keyword values */ viewport-fit: auto; viewport-fit: contain; viewport-fit: cover; Values auto This value doesn't affect the initial layout viewport, and the whole web page is viewable. contain The viewport is scaled to fit the largest rectangle inscribed within the display. cover The viewport is scaled to fill the device display. It is highly recomm
ended to make use of the safe area inset variables to ensure that important 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 viewport-fit descriptor, one must keep in mind that not all device displays are rectangular, and should therefore make use of the safe area ins...
Handling content breaks in multicol - CSS: Cascading Style Sheets
ing the orphans property to control the number of lines left at the bottom of a column. You can change that value to see the effect on the breaking of the content. When things 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 int
ended. 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 support 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 support which features. In most cases, the fallback to breaks not being contro...
Spanning and Balancing Columns - CSS: Cascading Style Sheets
le. For this reason, some care should be taken when deciding to make an element a spanner and ensure this scenario is accounted for. Additionally, if a spanning element appears later in the content it can cause unexpected or unwanted behaviour when there is not enough content to create columns after the spanner. Use spanning carefully and test at various breakpoints to make sure you get the int
ended effect. Column Filling and Balancing A balanced set of columns is where all columns have approximately the same amount of content. Filling and balancing comes into play when the amount of content does not match the amount of space provided, such as when a height is declared on the container. The initial value of multicol for column-fill is balance. The value of balance means all columns are as...
Using multi-column layouts - CSS: Cascading Style Sheets
irst column and creating as many columns as necessary, possibly overflowing to the right. Therefore, if the height is constrained, by setting the CSS height or max-height properties on a multi-column block, each column is allowed to grow to that height and no further before adding new column. This mode is also much more efficient for layout. Column Gaps There is a gap between columns. The recomm
ended default is 1em. This size can be changed by applying the column-gap property to the multi-column block: Example 6 HTML <div id="column_gap"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute i...
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
ant to include very old browsers with flexbox support then you can include the vendor prefixes in your CSS in addition to the unprefixed version. This is becoming less and less of a requirement today as support is widespread. .wrapper { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; } Autoprefixer Online is a useful way to see which prefixes are recomm
ended, depending on how many versions you wish to go back with browser support. You can also check Can I Use for information about when prefixes were removed in browsers to make your decision. Useful fallback techniques Given that flexbox usage is initiated with value of the display property, when needing to support very old browsers which do not support flexbox at all, fallbacks can be created by ov...
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
to test using Feature Queries for support of the new spec then we'd suggest testing for scroll-snap-align as this property did not exist in the old implementation. However, these properties shouldn't cause any problems to non-supporting browsers due to the way that browsers simply ignore CSS that they do not understand. Why are there two versions of scroll snap? Finally, you might wonder why we
ended up in a scenario where two versions exist at all. This is the reality of developing new CSS -- it can't be developed in a vacuum away from browser implementations. At some point browsers need to implement a spec to show that it works, and to discover any problems that only become apparent when the spec is in use alongside other properties in the real world. In such cases we can end up with implem...
Comments - CSS: Cascading Style Sheets
eral lines */ /* The comment below is used to disable specific styling */ /* span { color: blue; font-size: 1.5em; } */ Notes The /* */ comment syntax is used for both single and multiline comments. There is no other way to specify comments in external style sheets. However, when using the <style> element, you may use <!-- --> to hide CSS from older browsers, although this is not recomm
ended. As with most programming languages that use the /* */ comment syntax, comments cannot be nested. In other words, the first instance of */ that follows an instance of /* closes the comment. Specifications CSS 2.1 Syntax and basic data types #comments ...
Questions about CSS - CSS: Cascading Style Sheets
lement is placed between the TITLE statement and the BODY statement. An imported style sheet, using the CSS @import notation to automatically import 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 recomm
ended that browsers provide ways for the viewer to override the style attributes in some respects. Since it's likely that different browsers will choose to implement CSS1 somewhat differently, the Web page creator must test the page with different browsers. ...
Using media queries - CSS: Cascading Style Sheets
to its <link> tag will still download even if the query returns false. Nevertheless, its contents will not apply unless and until the result of the query changes to true. 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 all devices. print Int
ended for paged material and documents viewed on a screen in print preview mode. (Please see paged media for information about formatting issues that are specific to these formats.) screen Int
ended primarily for screens. speech Int
ended for speech synthesizers. Deprecated media types: CSS2.1 and Media Queries 3 defined several additional media types (tty, tv, projection, handheld, braille, emboss...
Visual formatting model - CSS: Cascading Style Sheets
thing that requires scrolling in the inline dimension too. Box generation Box generation is the part of the CSS visual formatting model that creates boxes from the document's elements. Generated boxes are of different types, which affect their visual formatting. The type of the box generated depends on the value of the CSS display property. Initially defined in CSS2, the display property is ext
ended in the CSS Display Module Level 3. In addition, some of the terminologies around the display have been updated and clarified in the years since CSS2. CSS takes your source document and renders it onto a canvas. To do this, it generates an intermediary structure, the box tree, which represents the formatting structure of the rendered document. Each box in the box tree represents its corresponding...
background-attachment - CSS: Cascading Style Sheets
://mdn.mozillademos.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 ext
ended to support 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. ...
background-clip - CSS: Cascading Style Sheets
d-image on the root element is none and its background-color is transparent, user agents must instead propagate the computed values of the background properties from that element's first HTML <body> child element. The used values of that <body> element's background properties are their initial values, and the propagated values are treated as if they were specified on the root element. It is recomm
ended that authors of HTML documents specify the canvas background for the <body> element rather than the HTML element. Syntax /* Keyword values */ background-clip: border-box; background-clip: padding-box; background-clip: content-box; background-clip: text; /* Global values */ background-clip: inherit; background-clip: initial; background-clip: unset; Values border-box The background extend...
background-image - CSS: Cascading Style Sheets
les/11991/startransparent.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 ext
ended to support 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-size - CSS: Cascading Style Sheets
he CSS3 Image Values gradient specification. .gradient-example { width: 50px; height: 100px; background-image: linear-gradient(blue, red); /* Not safe to use */ background-size: 25px; background-size: 50%; background-size: auto 50px; background-size: auto 50%; /* Safe to use */ background-size: 25px 50px; background-size: 50% 50%; } Note that it's particularly not recomm
ended to use a pixel dimension and an auto dimension with a <gradient>, because it's impossible to replicate rendering in versions of Firefox prior to 8, and in browsers not implementing Firefox 8's rendering, without knowing the exact size of the element whose background is being specified. Formal definition Initial valueauto autoApplies toall elements. It also applies to ::first-letter and ::first-...
background - CSS: Cascading Style Sheets
CSS .warning { 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 ext
ended to support 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 ...
border-style - CSS: Cascading Style Sheets
hest priority: if any other conflicting border is set, it won't be displayed. dotted Displays a series of rounded dots. The spacing of the dots is not defined by the specification and is implementation-specific. The radius of the dots is half the computed value of the same side's border-width. dashed Displays a series of short square-
ended dashes or line segments. The exact size and length of the segments are not defined by the specification and are implementation-specific. solid Displays a single, straight, solid line. double Displays two straight lines that add up to the pixel size defined by border-width. groove Displays a border with...
calc() - CSS: Cascading Style Sheets
% -8px) will be parsed as a percentage followed by a negative length -- an invalid expression -- while calc(50% - 8px) is a percentage followed by a subtraction operator and a length. Likewise, calc(8px + -50%) is treated as a length followed by an addition operator and a negative percentage. The * and / operators do not require whitespace, but adding it for consistency is both allowed and recomm
ended. Division by zero results in an error being generated by the HTML parser. Math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified. It is permitted to nest calc() functions, in which case the inner ones are treated as simple...
<color> - CSS: Cascading Style Sheets
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 supported by early browsers, it wasn't until SVG 1.0 and CSS Colors Level 3 that they were formally defined. They are called the ext
ended 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 silver #c0c0c0 gray #808080 white #ffffff maroon #800000 red #ff0000...
cross-fade() - CSS: Cascading Style Sheets
olor or highlighting a particular area of the page by combining an image with a radial gradient. Syntax Important: The specification and current implementations have different syntaxes. The specification syntax is explained first. Specification syntax The cross-fade() function takes a list of images with a percentage defining how much of each image is retained in terms of opacity when it is bl
ended with the other images. The percent value must be coded without quotes, must contain the "%" symbol, and its value must be between 0% and 100%. The function can be used in CSS anywhere an ordinary image reference can be used. Cross-fade percentages Think of the percentage as an opacity value for each image. This means a value of 0% means the image is fully transparent while a value of 100% make...
<frequency-percentage> - CSS: Cascading Style Sheets
percentage values 90% Positive percentage +90% Positive percentage with leading + -90% Negative percentage -- not valid for all properties that use percentages Invalid percentage values 90 % No space is allowed between the number and the unit Valid frequency values 12Hz Positive integer 4.3Hz Non-integer 14KhZ The unit is case-insensitive, though non-SI capitalization is not recomm
ended. +0Hz Zero, with a leading + and a unit -0kHz Zero, with a leading - and a unit Invalid frequency values 12.0 This is a <number>, not an <frequency>, because it is missing a unit. 7 Hz No space is allowed between the number and the unit. 0 Although unitless zero is an allowable <length>, it's an invalid <frequency>. Specifications Specification Status Comm...
<frequency> - CSS: Cascading Style Sheets
e regardless of unit, the unit may not be omitted. In other words, 0 is invalid and does not represent 0Hz or 0kHz. Though the units are case-insensitive, it is good practice to use a capital "H" for Hz and kHz, as specified in the SI. Examples Valid frequency values 12Hz Positive integer 4.3Hz Non-integer 14KhZ The unit is case-insensitive, though non-SI capitalization is not recomm
ended. +0Hz Zero, with a leading + and a unit -0kHz Zero, with a leading - and a unit Invalid frequency values 12.0 This is a <number>, not an <frequency>, because it is missing a unit. 7 Hz No space is allowed between the number and the unit. 0 Although unitless zero is an allowable <length>, it's an invalid <frequency>. Specifications Specification Status Comm...
grid-template - CSS: Cascading Style Sheets
id-template-areas to the strings listed, grid-template-rows to the track sizes following each string (filling in auto for any missing sizes), and splicing in the named lines defined before/after each size, and grid-template-columns to the track listing specified after the slash (or none, if not specified). Note: The repeat() function isn't allowed in these track listings, as the tracks are int
ended to visually line up one-to-one with the rows/columns in the "ASCII art". Note: The grid shorthand accepts the same syntax, but also resets the implicit grid properties to their initial values. Use grid (as opposed to grid-template) to prevent these values from cascading in seperately. Formal definition Initial valueas each of the properties of the shorthand:grid-template-columns: nonegrid-t...
image-orientation - CSS: Cascading Style Sheets
image will be used to rotate the image appropriately. <angle> Obsolete since Gecko 63 The <angle> of rotation to apply to the image. It is rounded to the nearest 90deg (0.25turn). flip Obsolete since Gecko 63 The image is flipped horizontally (i.e., reflected) after the rotation given by the <angle> value is applied. If no <angle> is given, 0deg is used. Description This property is int
ended only to be used for the purpose of 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, ...
ime-mode - CSS: Cascading Style Sheets
sabled value. Formal definition Initial valueautoApplies totext fieldsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | normal | active | inactive | disabled Examples Disabling input method support This example disables input method support for a form field. In the past, this was commonly used on fields that entered data into databases which didn't support ext
ended character sets. <input type="text" name="name" value="initial value" style="ime-mode: disabled"> Note: You shouldn't rely on disabling IME to prevent ext
ended characters from passing through your form. Even with IME disabled, users can still paste ext
ended characters into your form's fields. Specifications Specification Status Comment CSS Basic User Interface Mod...
<number> - CSS: Cascading Style Sheets
There is no unit associated with numbers. Interpolation When animated, values of the <number> CSS data type are interpolated as real, floating-point numbers. ...
overflow - CSS: Cascading Style Sheets
ari) 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. -moz-hidden-unscrollable Int
ended mainly for internal use and by themes. Disables scrolling of XML root elements, <html>, and <body> with the keyboard's arrow keys and the mouse wheel. [1] As of Firefox 63, this feature is behind a feature preference setting. In about:config, set layout.css.overflow.moz-scrollbars.enabled to true Description Overflow options include clipping, showing scrollbars, or displaying the content flo...
pointer-events - CSS: Cascading Style Sheets
hrough" the parent and target whatever is underneath). Elements with pointer-events: none will still receive focus through sequential keyboard navigation using the Tab key. We would like to provide finer grained control (than just auto and none) in HTML for which parts of an element will cause it to "catch" pointer events, and when. To help us in deciding how pointer-events should be further ext
ended for HTML, if you have any particular things that you would like to be able to do with this property, then please add them to the Use Cases section of this wiki page (don't worry about keeping it tidy). Formal definition Initial valueautoApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | none | visiblePainted | visibleFill | visibleStroke | ...
text-underline-offset - CSS: Cascading Style Sheets
ues */ text-underline-offset: inherit; text-underline-offset: initial; text-underline-offset: unset; The text-underline-offset property is specified as a single value from the list below. Values auto The browser chooses the appropriate offset for underlines. <length> Specifies the offset of underlines as a <length>, overriding the font file suggestion and the browser default. It is recomm
ended to use em units so the offset scales with the font size. <percentage> Specifies the offset of underlines as a <percentage> of 1 em in the element's font. A percentage inherits as a relative value, and so therefore scales with changes in the font. For a given application of this property, the offset is constant across the whole box that the underline is applied to, even if there are child elemen...
<time-percentage> - CSS: Cascading Style Sheets
es 50% +50% Optional plus sign -50% Negative percentages are not valid for all properties that accept percentages Invalid percentages 50 % Space not allowed between the space and the percentage sign Valid times 12s Positive integer -456ms Negative integer 4.3ms Non-integer 14mS The unit is case-insensitive, although capital letters are not recomm
ended. +0s Zero with a leading + and a unit -0ms Zero with a leading - and a unit Invalid times 0 Although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 This is a <number>, not a <time>, because it's missing a unit. 7 ms No space is allowed between the number and the unit. Specifications Specification Status Comment ...
<time> - CSS: Cascading Style Sheets
nits s Represents a time in seconds. Examples: 0s, 1.5s, -60s. ms Represents a time in milliseconds. Examples: 0ms, 150.25ms, -60000ms. Note: Conversion between s and ms follows the logical 1s = 1000ms. Examples Valid times 12s Positive integer -456ms Negative integer 4.3ms Non-integer 14mS The unit is case-insensitive, although capital letters are not recomm
ended. +0s Zero with a leading + and a unit -0ms Zero with a leading - and a unit Invalid times 0 Although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 This is a <number>, not a <time>, because it's missing a unit. 7 ms No space is allowed between the number and the unit. Specifications Specification Status Comment ...
transform-style - CSS: Cascading Style Sheets
ansformable elementsInheritednoComputed valueas specifiedAnimation typediscreteCreates stacking contextyes Formal syntax flat | preserve-3d Examples Transform style demonstration In this example we have a 3D cube created using transforms. The parent container of the cube faces has transform-style: preserve-3d set on it by default, so it is transformed in the 3D space and you can see it as int
ended. We also provide a checkbox allowing you to toggle between this, and transform-style: flat. In this alternative state, the cube faces are all flattened onto the plane of their parent, and you might not be able to see them at all, depending on the browser you are using. HTML <section id="example-element"> <div class="face front">1</div> <div class="face back">2</div> <div class="face righ...
unicode-bidi - CSS: Cascading Style Sheets
a block of content contains both left-to-right and right-to-left text, the user-agent uses a complex Unicode algorithm to decide how to display the text. The unicode-bidi property overrides this algorithm and allows the developer to control the text embedding. The unicode-bidi and direction properties are the only properties that are not affected by the all shorthand. Note: This property is int
ended for Document Type Definition (DTD) designers. Web designers and similar authors should not override it. /* Keyword values */ unicode-bidi: normal; unicode-bidi: embed; unicode-bidi: isolate; unicode-bidi: bidi-override; unicode-bidi: isolate-override; unicode-bidi: plaintext; /* Global values */ unicode-bidi: inherit; unicode-bidi: initial; unicode-bidi: unset; Syntax Values normal The ele...
url() - CSS: Cascading Style Sheets
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 @font-face block, and @counter-style/symbol In CSS Level 1, the url() functional notation described only true URLs. In CSS Level 2, the definition of url() was ext
ended to describe any URI, including URNs. CSS Values and Units Level 3 returned to the narrower, initial definition. Now, url() denotes only true <url>s. Syntax Values <string> <url> A url, which is a relative or absolute address, or pointer, to the web resource to be included, or a data uri, optionally in single or double quotes. Quotes are required if the URL includes parentheses, white...
<url> - CSS: Cascading Style Sheets
operties, such as background-image, cursor, and list-style. URI or URL? There is a difference between a URI and a URL. A URI simply identifies a resource. A URL is a type of URI, and describes the location of a resource. A URI can be either a URL or a name (URN) of a resource. In CSS Level 1, the url() functional notation described only true URLs. In CSS Level 2, the definition of url() was ext
ended to describe any URI, whether a URL or a URN. Confusingly, this meant that url() could be used to create a <uri> CSS data type. This change was not only awkward but, debatably, unnecessary, since URNs are almost never used in actual CSS. To alleviate the confusion, CSS Level 3 returned to the narrower, initial definition. Now, url() denotes only true <url>s. Syntax The <url> data type is specif...
WAI ARIA Live Regions/API Support - Developer guides
ect attribute "event-from-input", which will be set to "true" or "false". If it is not present, then something went wrong and Mozilla was not able to provide this information. This information is available only for EVENT_SHOW, EVENT_HIDE, IA2_EVENT_TEXT_INSERTED and IA2_EVENT_TEXT_REMOVED. For ATK/AT-SPI, this information is retrieved by checking the event name. If the event name has ":system" app
ended to it, then it is /not/ from user input. The ":system" string is calculated for children-changed and text-changed events. Why is this useful? The majority of AJAX pages do not provide live region markup, but still need to be as usable as possible. It is difficult for a screen reader to decide when to interrupt a user with changes on a page. If the screen reader automatically reads too much, then ...
Ajax - Developer guides
ject can be set to change the expected response type from the server. Possible values are the empty string (default), arraybuffer, blob, document, json, and text. The response property will contain the entity body according to responseType, as an ArrayBuffer, Blob, Document, JSON, or string. This article will show some Ajax I/O techniques. XML The Extensible Markup Language (XML) is a W3C-recomm
ended general-purpose markup language for creating special-purpose markup languages. It is a simplified subset of SGML, capable of describing many different kinds of data. Its primary purpose is to facilitate the sharing of data across different systems, particularly systems connected via the Internet. Parsing and serializing XML How to parse an XML document from a string, a file or via javascript an...
Adding captions and subtitles to HTML5 video - Developer guides
ithub, and also view the example live. HTML5 and Video Captions Before diving into how to add captions to the video player, there are a number of things that we will first mention, which you should be aware of before we start. Captions versus subtitles Captions and subtitles are not the same thing: they have significantly different audiences, and convey different information, and it is recomm
ended that you read up on the differences if you are not sure what they are. They are however implemented in the same way technically, so the material in this article will apply to both. For this article we will refer to the text tracks displayed as subtitles, as their content is aimed at hearing people who have difficulty understanding the language of the film, rather than deaf or hard-of-hearing peo...
Creating a cross-browser video player - Developer guides
reen = document.getElementById('fs'); Using these handles, events can now be attached to each of the custom control buttons making them interactive. Most of these buttons require a simple click event listener to be added, and a Media API defined method and/or attributes to be called/checked on the video. Play/Pause playpause.addEventListener('click', function(e) { if (video.paused || video.
ended) video.play(); else video.pause(); }); When a click event is detected on the play/pause button, the handler first of all checks if the video is currently paused or has
ended (via the Media API's paused and
ended attributes); if so, it uses the play() method to playback the video. Otherwise the video must be playing, so it is paused using the pause() method. Stop stop.addEventListener('clic...
Overview of events and handlers - Developer guides
e registration method for the function which will handle those data structures a method called addEventListener which expects as arguments a string event type name and the handler function. Finally, browsers define a large number of objects as event emitters and define a wide variety of event types generated by the objects. Button event handler demo For example, browser <button> elements are int
ended to emit events named 'click' in response to a mouse click or, when displayed in touch sensitive surfaces, to a finger tap. We could define in the HTML page a button as: <button id="buttonOne">Click here to emit a 'click' event</button> and, in our JavaScript code, we could first define a function to listen to that 'click' event: var example_click_handler = function (ev){ var objKind = (ev ...
Introduction to Web development - Developer guides
Whether you're just getting started with Web development, or are just expanding your horizons into new realms of Web awesomeness, the links here should help you get started. For another (overlapping) set of links to learning resources, see the MDN Learning pages. Note: The recomm
ended resources on this page are subject to change. Documentation topics HTML The basics of Hypertext Mark-up Langage (HTML) -- what exactly is HTML? 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 -- ...
Localizations and character encodings - Developer guides
content is expected to declare its encoding, in which case the fallback encoding does not participate in the processing of content. Additionally, there is a small number of locales where in the 1990s there wasn't an obvious single region-specific encoding and heuristic detection among multiple legacy encodings was introduced to Web browsers. This has then had the effect that Web authors have dep
ended on heuristic detection being present, so Firefox still has heuristic detection in these locales. Finding canonical encoding names The text below refers to canonical names of encodings. The canonical names are the values to the right of the equals sign in unixcharset.properties. Specifying the fallback encoding As of Firefox 28, this section is obsolete, since the preference intl.charset.defau...
HTML attribute: rel - HTML: Hypertext Markup Language
te, it indicates that the referenced document is the same content in a different format. For example, with type="application/rss+xml" it creates a hyperlink referencing a syndication feed. <link rel="alternate" type="application/atom+xml" href="posts.xml" title="Blog"> Both the hreflang and type attributes specify links to versions of the document in an alternative format and language, int
ended for other media: <link rel=alternate href="/fr/html/print" hreflang=fr type=text/html media=print title="French HTML (for printing)"> <link rel=alternate href="/fr/pdf" hreflang=fr type=application/pdf title="French PDF"> author Indicates the author of the current document or article. Relevant for <link>, <a>, and <area> elements, the author keyword creates a hyperlink. With <a> and <...
<a>: The Anchor element - HTML: Hypertext Markup Language
MDN / Understanding WCAG, Guideline 2.4 explanations Understanding Success Criterion 2.4.1 Size and proximity Size Interactive elements, like links, should provide an area large enough that it is easy to activate them. This helps a variety of people, including those with motor control issues and those using imprecise inputs such as a touchscreen. A minimum size of 44x44 CSS pixels is recomm
ended. Text-only links in prose content are exempt from this requirement, but it's still a good idea to make sure enough text is hyperlinked to be easily activated. Understanding Success Criterion 2.5.5: Target Size Target Size and 2.5.5 Quick test: Large touch targets Proximity Interactive elements, like links, placed in close visual proximity should have space separating them. Spacing helps ...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
bbr> in tandem with <dfn> to more formally define an abbreviation, as shown here. HTML <p><dfn id="html"><abbr title="HyperText Markup Language">HTML</abbr> </dfn> is a markup language used to create the semantics and structure of a web page.</p> <p>A <dfn id="spec">Specification</dfn> (<abbr title="Specification">spec</abbr>) is a document that outlines in detail how a technology or API is int
ended to function and how it is accessed.</p> Result Accessibility concerns Spelling out the acronym or abbreviation in full the first time it is used on a page is beneficial for helping people understand it, especially if the content is technical or industry jargon. Example <p>JavaScript Object Notation (<abbr>JSON</abbr>) is a lightweight data-interchange format.</p> This is especially helpf...
<acronym> - HTML: Hypertext Markup Language
nother: Some browsers, like Internet Explorer, do not style it differently than a <span> element. Opera, Firefox, Chrome, and some others add a dotted underline to the content of the element. A few browsers not only add a dotted underline, but also put it in small caps; to avoid this styling, adding something like font-variant: none in the CSS takes care of this case. It is therefore recomm
ended that web authors either explicitly style this element, or accept some cross-browser variation. Specifications Specification Status Comment HTML 4.01 SpecificationThe definition of '<acronym>' in that specification. Recommendation Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to...
<article>: The Article Contents element - HTML: Hypertext Markup Language
Examples include: a forum post, a magazine or newspaper article, or a blog entry. 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. ...
<basefont> - HTML: Hypertext Markup Language
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 supports the global attributes. color This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. ...
<code>: The Inline Code element - HTML: Hypertext Markup Language
By default, the content text is displayed using the user agent's default monospace font. 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. ...
<datalist>: The HTML Data List 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. Permitted content Either phrasing content or zero or more <option> elements. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content. ...
<element>: The Custom Element element (Obsolete) - HTML: Hypertext Markup Language
It was removed in favor of a JavaScript-driven approach for creating new custom elements. Note: This element has been removed from the specification. See this for more information from the editor of the specification. Content categories Transparent content. Permitted content ??? Tag omission None, both the starting and ending tag are mandatory. Permitted parent elements ??? DOM interface HTMLElement Attributes This element includes the global attributes. ...
<form> - HTML: Hypertext Markup Language
elements with type=file. text/plain: Introduced by HTML5 for debugging purposes. This value can be overridden by formenctype attributes on <button>, <input type="submit">, or <input type="image"> elements. method The HTTP method to submit the form with. Possible (case insensitive) values: post: The POST method; form data sent as the request body. get: The GET method; form data app
ended to the action URL with a ? separator. Use this method when the form has no side-effects. dialog: When the form is inside a <dialog>, closes the dialog on submission. This value is overridden by formmethod attributes on <button>, <input type="submit">, or <input type="image"> elements. novalidate This Boolean attribute indicates that the form shouldn't be validated when submitted. If thi...
<header> - HTML: Hypertext Markup Language
cendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, navigation or region Permitted ARIA roles group, presentation or none DOM interface HTMLElement Usage notes The <header> element is not sectioning content and therefore does not introduce a new section in the outline. That said, a <header> element is int
ended to usually contain the surrounding section's heading (an h1-h6 element), but this is not required. Historical Usage Although the <header> element didn't make its way into specifications until HTML5, it actually existed at the very beginning of HTML. As seen in the very first website, it was originally used as the <head> element. At some point, it was decided to use a different name. This allowe...
<img>: The Image Embed element - HTML: Hypertext Markup Language
, indicating a set of source sizes. Each source size consists of: A media condition. This must be omitted for the last item in the list. A source size value. Media Conditions describe properties of the viewport, not of the image. For example, (max-height: 500px) 1000px proposes to use a source of 1000px width, if the viewport is not higher than 500px. Source size values specify the int
ended display size of the image. User agents use the current source size to select one of the sources supplied by the srcset attribute, when those sources are described using width (w) descriptors. The selected source size affects the intrinsic size of the image (the image's display size if no CSS styling is applied). If the srcset attribute is absent, or contains no values with a width descriptor, the...
<input type="checkbox"> - HTML: Hypertext Markup Language
eckbox, the same thing happens as if the checkbox were unchecked -- no data is submitted to represent the checkbox. Validation Checkboxes do support validation (offered to all <input>s). However, most of the ValidityStates will always be false. If the checkbox has the required attribute, but is not checked, then ValidityState.valueMissing will be true. Examples The following example is an ext
ended version of the "multiple checkboxes" example we saw above -- it has more standard options, plus an "other" checkbox that when checked causes a text field to appear to enter a value for the "other" option. This is achieved with a simple block of JavaScript. The example also includes some CSS to improve the styling. HTML <form> <fieldset> <legend>Choose your interests</legend> <div> ...
<input type="datetime-local"> - HTML: Hypertext Markup Language
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 support 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 int
ended 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 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 curr...
<input type="file"> - HTML: Hypertext Markup Language
set the value of a file picker from a script -- doing something like the following has no effect: const input = document.querySelector("input[type=file]"); input.value = "foo"; When a file is chosen using an <input type="file">, the real path to the source file is not shown in the input's value attribute for obvious security reasons. Instead, the filename is shown, with C:\fakepath\ app
ended to the beginning of it. There are some historical reasons for this quirk, but it is supported across all modern browsers, and in fact is defined in the spec. Examples In this example, we'll present a slightly more advanced file chooser that takes advantage of the file information available in the HTMLInputElement.files property, as well as showing off a few clever tricks. Note: You can see...
<input type="search"> - HTML: Hypertext Markup Language
of entries to be displayed in the <input> element's natively-provided drop-down menu of previous search queries. The value must be a non-negative decimal number. If not provided, or an invalid value is given, the browser's default maximum number of entries is used. Using search inputs <input> elements of type search are very similar to those of type text, except that they are specifically int
ended for handling search terms. They are basically equivalent in behavior, but user agents may choose to style them differently by default (and, of course, sites may use stylesheets to apply custom styles to them). Basic example <form> <div> <input type="search" id="mySearch" name="q"> <button>Search</button> </div> </form> This renders like so: q is the most common name given to sea...
<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>. ...
<menu> - HTML: Hypertext Markup Language
tion. This might be in the form of an unordered list of <li> elements, or, if the element has no <li> element children, flow content describing available commands. This value is the default if the attribute is missing. Usage notes The <menu> and <ul> elements both represent an unordered list of items. The key difference is that <ul> primarily contains items for display, whilst <menu> is int
ended for interactive items, to act on. An HTML menu can be used to create context menus (typically activated by right-clicking another element) or toolbars. Context menus consist of a <menu> element which contains <menuitem> elements for each selectable option in the menu, <menu> elements for submenus within the menu, and <hr> elements for separator lines to break up the menu's content into sections...
Standard metadata names - HTML: Hypertext Markup Language
it by default. viewport-fit auto, contain or cover The auto value doesn't affect the initial layout viewport, and the whole web page is viewable. The contain value means that the viewport is scaled to fit the largest rectangle inscribed within the display. The cover value means that the viewport is scaled to fill the device display. It is highly recomm
ended to make use of the safe area inset variables to ensure that important content doesn't end up outside the display. Notes: Though unstandardized, this declaration is respected by most mobile browsers due to de-facto dominance. The default values may vary between devices and browsers. To learn about this declaration in Firefox for Mobile, see this article. ...
<nav>: The Navigation Section element - HTML: Hypertext Markup Language
ing and ending tag are mandatory. Permitted parents Any element that accepts flow content. Implicit ARIA role navigation Permitted ARIA roles No role permitted DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes It's not necessary for all links to be contained in a <nav> element. <nav> is int
ended only for major block of navigation links; typically the <footer> element often has a list of links that don't need to be in a <nav> element. A document may have several <nav> elements, for example, one for site navigation and one for intra-page navigation. aria-labelledby can be used in such case to promote accessibility, see example. User agents, such as screen readers targeting disabled users...
<p>: The Paragraph element - HTML: Hypertext Markup Language
By default, browsers separate paragraphs with a single blank line. Alternate separation methods, such as first-line indentation, can be achieved with CSS: HTML <p>Separating paragraphs with blank lines is easiest for readers to scan, but they can also be separated by indenting their first lines. This is often used to take up less space, such as to save paper in print.</p> <p>Writing that is int
ended to be edited, such as school papers and rough drafts, uses both blank lines and indentation for separation. In finished works, combining both is considered redundant and amateurish.</p> <p>In very old writing, paragraphs were separated with a special character: ?, the <i>pilcrow</i>. Nowadays, this is considered claustrophobic and hard to read.</p> <p>How hard to read? See for yourself: <butt...
<shadow>: The obsolete Shadow Root element - HTML: Hypertext Markup Language
You might have used it if you have created multiple shadow roots under a shadow host. It is not useful in ordinary HTML. Content categories Transparent content Permitted content Flow content Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts flow content. Permitted ARIA roles None DOM interface HTMLShadowElement Attributes This element includes the global attributes. ...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
--and it must be placed before any flow content or <track> element. A <picture> element, and it must be placed before the <img> element. Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLSourceElement Attributes This element includes the global attributes. media Media query of the resource's int
ended media; this should be used only in a <picture> element. sizes Is a list of source sizes that describes the final rendered width of the image represented by the source. Each source size consists of a comma-separated list of media condition-length pairs. This information is used by the browser to determine, before laying the page out, which image defined in srcset to use. Please note that sizes...
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
e that both are valid and semantic elements in HTML5 and that it's a coincidence that they both have the same default styling (boldface) in most browsers (although some older browsers actually underline <strong>). Each element is meant to be used in certain types of scenarios, and if you want to bold text simply for decoration, you should instead actually use the CSS font-weight property. The int
ended meaning or purpose of the enclosed text should be what determines which element you use. Communicating meaning is what semantics are all about. <em> vs. <strong> Adding to the confusion is the fact that while HTML 4 defined <strong> as simply indicating a stronger emphasis, HTML 5 defines <strong> as representing "strong importance for its contents." This is an important distinction to make. W...
<tr>: The Table Row element - HTML: Hypertext Markup Language
S This simple CSS just adds a solid black border around the table and around each of its cells, including those specified using both <th> and <td>. That way, both header and data cells are easily demarcated. table { border: 1px solid black; } th, td { border: 1px solid black; } Result Row and column spanning Now, let's introduce another column that shows the date the user's membership
ended, along with a super-heading above the "joined" and "canceled" dates called "Membership Dates". This involves adding both row and column spans to the table, so that the heading cells can wind up in the right places. Result Let's actually look at the output first this time: Notice how the heading area here is actually two rows, one with "Name", "ID", "Membership Dates", and "Balance" headings,...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
y include important 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 int
ended to be used when the user is navigating the media resource. metadata Tracks used by scripts. Not visible to the user. label A user-readable title of the text track which is used by the browser when listing available text tracks. src Address of the track (.vtt file). Must be a valid URL. This attribute must be specified and its URL value must have the same origin as ...
<xmp> - HTML: Hypertext Markup Language
Note: Do not use this element. It has been deprecated since HTML3.2 and was not implemented in a consistent way. It was completely removed from the language in HTML5. Use the <pre> element or, if semantically adequate, the <code> element instead. ...
dir - HTML: Hypertext Markup Language
as 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 supports these properties. As the directionality of the text is semantically related to its content and not to its presentation, it is recomm
ended 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 support CSS or has the CSS deactivated. The auto value should be used for data with an unknown directionality, like data coming from user input, eventually stored in a database. Browsers might allow users to change the dir...
lang - HTML: Hypertext Markup Language
The lang global attribute helps define the language of an element: the language that non-editable elements are written in, or the language that the editable elements should be written in by the user. The attribute contains a single "language tag" in the format defined in Tags for Identifying Languages (BCP47). The default value of lang is unknown, therefore it is recomm
ended to always specify this attribute with the appropriate value. 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 attribute value is the empty string (lang=""), the language is set to unknown; if the language tag is not valid according to BCP...
style - HTML: Hypertext Markup Language
This attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes. 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. Usage note: This attribute must not be used to convey semantic information. Even if all styling is removed, a page should remain semantically correct. ...
tabindex - HTML: Hypertext Markup Language
nt with the elements in a logical sequence. If you set the tabindex attribute on a <div>, then its child content cannot be scrolled with the arrow keys unless you set tabindex on the content, too. Check out this fiddle to understand the scrolling effects of tabindex. Accessibility concerns Avoid using the tabindex attribute in conjunction with non-interactive content to make something int
ended to be interactive focusable by keyboard input. An example of this would be using a <div> element to describe a button, instead of the <button> element. Interactive components authored using non-interactive elements are not be listed in the accessibility tree. This prevents assistive technology from being able to navigate to and manipulate those components. The content should be semantically desc...
Link types - HTML: Hypertext Markup Language
ive link to this one. For example, a blog entry could link to a monthly index page this way. Note: Although recognized, the singular archive is incorrect and must be avoided. <a>, <area>, <link> <form> author Defines a hyperlink to a page describing the author or providing a way to contact the author. Note: This may be a mailto: hyperlink, but this is not recomm
ended on public pages as robot harvesters will quickly lead to a lot of spam sent to the address. In that case, it is better to lead to a page containing a contact form. Although recognized, the rev attribute on <a>, <area> or<link> elements with a link type of made is incorrect and should be replaced by the rel attribute with this link type. <a>, <area>, <link> <form> bookmark ...
Quirks Mode and Standards Mode - HTML: Hypertext Markup Language
whether to handle it in quirks mode or standards mode. To ensure that your page uses full standards mode, make sure that your page has a DOCTYPE like in this example: <!DOCTYPE html> <html lang="en"> <head> <meta charset=UTF-8> <title>Hello World!</title> </head> <body> </body> </html> The DOCTYPE shown in the example, <!DOCTYPE html>, is the simplest possible, and the one recomm
ended by HTML5. Earlier versions of the HTML standard recomm
ended other variants, but all existing browsers today will use full standards mode for this DOCTYPE, even the dated Internet Explorer 6. There are no valid reasons to use a more complicated DOCTYPE. If you do use another DOCTYPE, you may risk choosing one which triggers almost standards mode or quirks mode. Make sure you put the DOCTYPE right...
Microformats - HTML: Hypertext Markup Language
pe": ["h-card"], "properties": { "name": ["Mozilla Foundation"], "url": ["http://mozilla.org/"] } }] } }] } Note: the nested h-card has implied 'name' and 'url' properties, just like any other root-class-name-only h-card on an <a href> would. h-entry The h-entry microformat represents episodic or datestamped content on the web. h-entry is often used with content int
ended to be syndicated, e.g. blog posts. Example h-entry as a blog post: <article class="h-entry"> <h1 class="p-name">Microformats are amazing</h1> <p>Published by <a class="p-author h-card" href="http://example.com">W. Developer</a> on <time class="dt-published" datetime="2013-06-13 12:00:00">13<sup>th</sup> June 2013</time></p> <p class="p-summary">In which I extoll the virtues of using...
Resource URLs - HTTP
View Page Source or View Selection Source), you will find it requires viewsource.css through a resource: URI. Resources that have to be exposed to web content have been moved to a new location named resource://content-accessible/, which is isolated and only contains non-sensitive resources. In this way we can keep essential resources exposed and have most threats eliminated. Note: It is recomm
ended that web and extension developers don't try to use resource URLs anymore. Their usage was hacky at best, and most usage won't work any more. Specifications resource: is not defined in any specification. ...
Basics of HTTP - HTTP
-server communication flow. On top of these basic concepts, numerous extensions have been developed over the years that add updated functionality and semantics with new HTTP methods or headers. Articles Overview of HTTP Describes what HTTP is and its role in web architecture, including its position in the protocol stack. Evolution of HTTP HTTP was created in the early 1990s and has been ext
ended several times. This article goes through its history and describes HTTP/0.9, HTTP/1.0, HTTP/1.1, and the modern HTTP/2, as well as novelties introduced over the years. Resources and URIs A brief introduction to the concept of resources, identifiers, and locations on the web. Identifying resources on the Web Describes how web resources are referenced and how to locate them. Data URIs A speci...
Content negotiation - HTTP
d to indicate the language preference of the user. It is a list of values with quality factors (like: "de, en;q=0.7"). A default value is often set according the language of the graphical interface of the user agent, but most browsers allow to set different language preferences. Due to the configuration-based entropy increase, a modified value can be used to fingerprint the user, it is not recomm
ended to change it and a Web site cannot trust this value to reflect the actual wish of the user. Site designers must not be over-zealous by using language detection via this header as it can lead to a poor user experience: They should always provide a way to overcome the server-chosen language, e.g., by providing a language menu on the site. Most user-agents provide a default value for the Accept-L...
Accept-Charset - HTTP
ect and transmitting it would allow fingerprinting. If the server cannot serve any 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 recomm
ended, and now each content-type may have its own default. UTF-8 is now well-supported 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...
Accept-Language - HTTP
response 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). This header is a hint to be used when the server has no way of determining the language via another way, like a specific URL, that is controlled by an explicit user decision. It is recomm
ended that the server never overrides an explicit decision. The content of the Accept-Language is often out of the control of the user (like when traveling and using an Internet Cafe in a different country); the user may also want to visit a page in another language than the locale of their user interface. If the server cannot serve any matching language, it can theoretically send back a 406 (Not Acce...
Cache-Control - HTTP
rectives (instructions) for caching in both requests and responses. A given directive in a request does not mean the same directive should be in the response. Header type General header Forbidden header name no CORS-safelisted response header yes Syntax Caching directives have the following rules to be valid: Case-insensitive, but lowercase is recomm
ended. Multiple directives are comma-separated. Some directives have an optional argument, which can be either a token or a quoted-string. (See spec for definitions) Cache request directives Standard Cache-Control directives that can be used by the client in an HTTP request. Cache-Control: max-age=<seconds> Cache-Control: max-stale[=<seconds>] Cache-Control: min-fresh=<seconds> Cache-Control: no-...
CSP: base-uri - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: child-src - HTTP
o 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 attempts to load from any subdomain of example.com using the current protocol. <scheme-source> A schema such as 'http:' or 'https:'. The colon is required, single quotes shouldn't be used. You can also specify data schemas (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: connect-src - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: default-src - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: font-src - HTTP
o 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 attempts to load from any subdomain of example.com using the current protocol. <scheme-source> A schema such as 'http:' or 'https:'. The colon is required, single quotes shouldn't be used. You can also specify data schemas (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: form-action - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: frame-ancestors - HTTP
cess store.example.com using https:. If no URL scheme is specified for a host-source and the iframe is loaded from an https URL, the URL for the page loading the iframe must also be https, per the W3C spec on matching source expressions. <scheme-source> A scheme such as http: or https:. The colon is required and scheme should not be quoted. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: frame-src - HTTP
o 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 attempts to load from any subdomain of example.com using the current protocol. <scheme-source> A schema such as 'http:' or 'https:'. The colon is required, single quotes shouldn't be used. You can also specify data schemas (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: img-src - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: manifest-src - HTTP
o 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 attempts to load from any subdomain of example.com using the current protocol. <scheme-source> A schema such as 'http:' or 'https:'. The colon is required, single quotes shouldn't be used. You can also specify data schemas (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: media-src - HTTP
o 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 attempts to load from any subdomain of example.com using the current protocol. <scheme-source> A schema such as 'http:' or 'https:'. The colon is required, single quotes shouldn't be used. You can also specify data schemas (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: navigate-to - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: prefetch-src - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: report-uri - HTTP
The deprecated HTTP Content-Security-Policy (CSP) report-uri directive instructs the user agent to report attempts to violate the Content Security Policy. These violation reports consist of JSON documents sent via an HTTP POST request to the specified URI. Though the report-to directive is int
ended to replace the deprecated report-uri directive, report-to isn't supported in most browsers yet. So for compatibility with current browsers while also adding forward compatibility when browsers get report-to support, you can specify both report-uri and report-to: Content-Security-Policy: ...; report-uri https://endpoint.com; report-to groupname In browsers that support report-to, the report-uri directive will be ignored. The directive has no effect in and of itself, but only gains meaning in ...
CSP: script-src-attr - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: script-src-elem - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: script-src - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: style-src-attr - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: style-src-elem - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: style-src - HTTP
il.example.com. 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. <scheme-source> A scheme such as http: or https:. The colon is required. Unlike other values below, single quotes shouldn't be used. You can also specify data schemes (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
CSP: upgrade-insecure-requests - HTTP
The HTTP Content-Security-Policy (CSP) upgrade-insecure-requests directive instructs user agents to treat all of a site's insecure URLs (those served over HTTP) as though they have been replaced with secure URLs (those served over HTTPS). This directive is int
ended for web sites with large numbers of insecure legacy URLs that need to be rewritten. The upgrade-insecure-requests directive is evaluated before block-all-mixed-content and if it is set, the latter is effectively a no-op. It is recomm
ended 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 n...
CSP: worker-src - HTTP
o 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 attempts to load from any subdomain of example.com using the current protocol. <scheme-source> A schema such as 'http:' or 'https:'. The colon is required, single quotes shouldn't be used. You can also specify data schemas (not recomm
ended). data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also 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' Refer...
Content-Type - HTTP
e of the resource or the data. charset The character encoding standard. boundary For multipart entities the boundary directive is required, which consists of 1 to 70 characters from a set of characters known to be very robust through email gateways, and not ending with white space. It is used to encapsulate the boundaries of the multiple parts of the message. Often, the header boundary is prep
ended with two dashes and the final boundary has two dashes app
ended at the end. Examples Content-Type in HTML forms In a POST request, resulting from an HTML form submission, the Content-Type of the request is specified by the enctype attribute on the <form> element. <form action="/" method="post" enctype="multipart/form-data"> <input type="text" name="description" value="some text"> <input t...
Forwarded - HTTP
The Host request header field as received by the proxy. proto=<http|https> Indicates which protocol was used to make the request (typically "http" or "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 app
ended 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 supports 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.
Public-Key-Pins - HTTP
Optional If this optional parameter is specified, this rule applies to all of the site's subdomains as well. report-uri="<uri>" Optional If this optional parameter is specified, pin validation failures are reported 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 recomm
ended. Public-Key-Pins: pin-sha256="cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs="; pin-sha256="M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE="; max-age=5184000; includeSubDomains; report-uri="https://www.example.org/hpkp-report" In this example, pin-sha256="cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=" pins the server's public key used in production. The second pin declaration pin-sha256="M8Hz...
Strict-Transport-Security - HTTP
for a max-age of 1 year. This blocks access to pages or sub domains that can only be served over HTTP. Strict-Transport-Security: max-age=31536000; includeSubDomains In the following example, max-age is set to 2 years, raised from what was a former limit max-age of 1 year. Note that 1 year is acceptable for a domain to be included in browsers' HSTS preload lists. 2 years is, however, the recomm
ended goal as a website's final HSTS configuration as explained on https://hstspreload.org. It also suffixed with preload which is necessary for inclusion in most major web browsers' HSTS preload lists, e.g. Chromium, Edge, & Firefox. Strict-Transport-Security: max-age=63072000; includeSubDomains; preload Specifications Specification Status Comment HTTP Strict Transport S...
Vary - HTTP
ers should consider the user agent when deciding whether to serve the page from cache. For example, if you are serving different content to mobile users, it can help you to avoid that a cache may mistakenly serve a desktop version of your site to your mobile users. It can help Google and other search engines to discover the mobile version of a page, and might also tell them that no Cloaking is int
ended. Vary: User-Agent Specifications Specification Title RFC 7231, section 7.1.4: Vary Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content ...
X-XSS-Protection - HTTP
trong 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 support 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 support legacy browsers, it is recomm
ended 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; report=<reporting-uri> 0 Disables XSS filtering. 1 Enables XSS filtering (usually default in browsers). If a cross-site ...
HTTP headers - HTTP
lt behavior without the header), or if it should be handled like a download and the browser should present a "Save As" dialog. Message body information Content-Length The size of the resource, in decimal number of bytes. Content-Type Indicates the media type of the resource. Content-Encoding Used to specify the compression algorithm. Content-Language Describes the human language(s) int
ended for the audience, so that it allows a user to differentiate according to the users' own preferred language. Content-Location Indicates an alternate location for the returned data. Proxies Forwarded Contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request. X-Forwarded-For Identifies the originating IP ...
An overview of HTTP - HTTP
eam into appropriate Event objects, delivering them to the event handlers that have been registered for the events' type if known, or to the onmessage event handler if no type-specific event handler was established. Conclusion HTTP is an extensible protocol that is easy to use. The client-server structure, combined with the ability to simply add headers, allows HTTP to advance along with the ext
ended capabilities of the Web. Though HTTP/2 adds some complexity, by embedding HTTP messages in frames to improve performance, the basic structure of messages has stayed the same since HTTP/1.0. Session flow remains simple, allowing it to be investigated, and debugged with a simple HTTP message monitor. ...
103 Early Hints - HTTP
Syntax 103 Early Hints Specifications Specification Status Comments RFC 8297: 103 Early Hints IETF RFC 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. No compatibility data found. ...
202 Accepted - HTTP
n accepted for processing, but the processing has not been completed; in fact, processing may not have started yet. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place. 202 is non-committal, meaning that there is no way for the HTTP to later send an asynchronous response indicating the outcome of processing the request. It is int
ended for cases where another process or server handles the request, or for batch processing. Status 202 Accepted Specifications Specification Title RFC 7231, section 6.3.3: 202 Accepted Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content ...
301 Moved Permanently - HTTP
ders. A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is sent to the new URL). Even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents align with it - you can still find this type of bugged software out there. It is therefore recomm
ended to use the 301 code only as a response for GET or HEAD methods and to use the 308 Permanent Redirect for POST methods instead, as the method change is explicitly prohibited with this status. Status 301 Moved Permanently Example Client request GET /index.php HTTP/1.1 Host: www.example.org Server response HTTP/1.1 301 Moved Permanently Location: http://www.example.org/index.asp Specificatio...
302 Found - HTTP
rowser redirects to this page but search engines don't update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is not sent to the new URL). Even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents conform here - you can still find this type of bugged software out there. It is therefore recomm
ended to set the 302 code only as a response for GET or HEAD methods and to use 307 Temporary Redirect instead, as the method change is explicitly prohibited in that case. In the cases where you want the method used to be changed to GET, use 303 See Other instead. This is useful when you want to give a response to a PUT method that is not the uploaded resource but a confirmation message such as: 'you ...
414 URI Too Long - HTTP
The HTTP 414 URI Too Long response status code indicates that the URI requested by the client is longer than the server is willing to interpret. There are a few rare conditions when this might occur: when a client has improperly converted a POST request to a GET request with long query information, when the client has desc
ended into a loop of redirection (for example, a redirected URI prefix that points to a suffix of itself), or when the server is under attack by a client attempting to exploit potential security holes. Status 414 URI Too Long Specifications Specification Title RFC 7231, section 6.5.12: 414 URI Too Long Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content ...
HTTP
een two requests. Though often based on a TCP/IP layer, it can be used on any reliable transport 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 int
ended uses. HTTP Cache Caching is very important for fast Web sites. This article describes different methods of caching and how to use HTTP Headers to control them. HTTP Cookies How cookies work is defined by RFC 6265. When serving an HTTP request, a server can send a Set-Cookie HTTP header with the response. The client then returns the cookie's value with every request to the same server in the f...
Closures - JavaScript
s of using closures in this particular instance, we could instead rewrite it to avoid using closure as follows: function MyObject(name, message) { this.name = name.toString(); this.message = message.toString(); } MyObject.prototype = { getName: function() { return this.name; }, getMessage: function() { return this.message; } }; However, redefining the prototype is not recomm
ended. The following example instead appends to the existing prototype: function MyObject(name, message) { this.name = name.toString(); this.message = message.toString(); } MyObject.prototype.getName = function() { return this.name; }; MyObject.prototype.getMessage = function() { return this.message; }; In the two previous examples, the inherited prototype can be shared by all objects and th...
Equality comparisons and sameness - JavaScript
on of doing a type check upfront in 11.9.6.1, the Strict Equality Algorithm is a subset of the Abstract Equality Algorithm, because 11.9.6.2-7 correspond to 11.9.3.1.a-f. A model for understanding equality comparisons? Prior to ES2015, you might have said of double equals and triple equals that one is an "enhanced" version of the other. For example, someone might say that double equals is an ext
ended version of triple equals, because the former does everything that the latter does, but with type conversion on its operands. E.g., 6 == "6". (Alternatively, someone might say that double equals is the baseline, and triple equals is an enhanced version, because it requires the two operands to be the same type, so it adds an extra constraint. Which one is the better model for understanding depends ...
Details of the object model - JavaScript
he 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 reports property (whose value defaults to an empty array, int
ended 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, int
ended 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 property with the value "sales", indicating that all salespersons...
Grammar and types - JavaScript
on("[]"). var unusualPropertyNames = { '': 'An empty string', '!': 'Bang!' } console.log(unusualPropertyNames.''); // SyntaxError: Unexpected string console.log(unusualPropertyNames['']); // An empty string console.log(unusualPropertyNames.!); // SyntaxError: Unexpected token ! console.log(unusualPropertyNames['!']); // Bang! Enhanced Object literals In ES2015, object literals are ext
ended to support setting the prototype at construction, shorthand for foo: foo assignments, defining methods, making super calls, and computing property names with expressions. 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, // Sh...
Iterators and generators - JavaScript
ole.log(sequence.next().value); // 8 console.log(sequence.next(true).value); // 0 console.log(sequence.next().value); // 1 console.log(sequence.next().value); // 1 console.log(sequence.next().value); // 2 You can force a generator to throw an exception by calling its throw() method and passing the exception value it should throw. This exception will be thrown from the current susp
ended context of the generator, as if the yield that is currently susp
ended were instead a throw value statement. If the exception is not caught from within the generator, it will propagate up through the call to throw(), and subsequent calls to next() will result in the done property being true. Generators have a return(value) method that returns the given value and finishes the generator itself. ...
Using Promises - JavaScript
// Forgot to terminate chain with a catch! The first mistake is to not chain things together properly. This happens when we create a new promise but forget to return it. As a consequence, the chain is broken, or rather, we have two independent chains racing. This means doFourthThing() won't wait for doSomethingElse() or doThirdThing() to finish, and will run in parallel with them, likely unint
ended. Separate chains also have separate error handling, leading to uncaught errors. The second mistake is to nest unnecessarily, enabling the first mistake. Nesting also limits the scope of inner error handlers, which--if unint
ended--can lead to uncaught errors. A variant of this is the promise constructor anti-pattern, which combines nesting with redundant use of the promise constructor to wrap cod...
Memory Management - JavaScript
n algorithms rely on is the concept of reference. Within the context of memory management, an object is said to reference another object if the former has access to the latter (either implicitly or explicitly). For instance, a JavaScript object has a reference to its prototype (implicit reference) and to its properties values (explicit reference). In this context, the notion of an "object" is ext
ended to something broader than regular JavaScript objects and also contain function scopes (or the global lexical scope). Reference-counting garbage collection This is the most naive garbage collection algorithm. This algorithm reduces the problem from determining whether or not an object is still needed to determining if an object still has any other objects referencing it. An object is said to be ...
About the JavaScript reference - JavaScript
he JavaScript reference serves as a repository of facts about the JavaScript language. The entire language is described here in detail. As you write JavaScript code, you'll refer to these pages often (thus the title "JavaScript reference"). If you're learning JavaScript, or need help understanding some of its capabilities or features, check out the JavaScript guide. The JavaScript language is int
ended to be used within some larger environment, be it a browser, server-side scripts, or similar. For the most part, this reference attempts to be environment-agnostic and does not target a web browser environment. Where to find JavaScript information JavaScript documentation of core language features (pure ECMAScript, for the most part) includes the following: The JavaScript guide The JavaScrip...
TypeError: invalid assignment to const "x" - JavaScript
re-assignment, and it can't be redeclared. In JavaScript, constants are declared using the const keyword. Examples Invalid redeclaration Assigning a value to the same constant name in the same block-scope will throw. const COLUMNS = 80; // ... COLUMNS = 120; // TypeError: invalid assignment to const `COLUMNS' Fixing the error There are multiple options to fix this error. Check what was int
ended to be achieved with the constant in question. Rename If you meant to declare another constant, pick another name and re-name. This constant name is already taken in this scope. const COLUMNS = 80; const WIDE_COLUMNS = 120; const, let or var? Do not use const if you weren't meaning to declare a constant. Maybe you meant to declare a block-scoped variable with let or global variable with var. ...
SyntaxError: a declaration in the head of a for-of loop can't have an initializer - JavaScript
d in for-of loops. You might want a for loop that does allow an initializer. Examples Invalid for-of loop let iterable = [10, 20, 30]; for (let value = 50 of iterable) { console.log(value); } // SyntaxError: a declaration in the head of a for-of loop can't // have an initializer Valid for-of loop You need to remove the initializer (value = 50) in the head of the for-of loop. Maybe you int
ended to make 50 an offset value, in that case you could add it to the loop body, for example. let iterable = [10, 20, 30]; for (let value of iterable) { value += 50; console.log(value); } // 60 // 70 // 80 ...
SyntaxError: missing = in const declaration - JavaScript
s, you must specify its value in the same statement in which it's declared (which makes sense, given that it can't be changed later). Examples Missing const initializer Unlike var or let, you must specify a value for a const declaration. This throws: const COLUMNS; // SyntaxError: missing = in const declaration Fixing the error There are multiple options to fix this error. Check what was int
ended to be achieved with the constant in question. Adding a constant value Specify the constant value in the same statement in which it's declared: const COLUMNS = 80; const, let or var? Do not use const if you weren't meaning to declare a constant. Maybe you meant to declare a block-scoped variable with let or global variable with var. Both don't require an initial value. let columns; ...
SyntaxError: missing name after . operator - JavaScript
essage SyntaxError: missing name after . operator Error type SyntaxError What went wrong? The dot operator (.) is used for property access. You will have to specify the name of the property that you want to access. For computed property access, you might need to change your property access from using a dot to using square brackets. These will allow you to compute an expression. Maybe you int
ended to do concatenation instead? A plus operator (+) is needed in that case. Please see the examples below. Examples Property access Property accessors in JavaScript use either the dot (.) or square brackets ([]), but not both. Square brackets allow computed property access. var obj = { foo: { bar: "baz", bar2: "baz2" } }; var i = 2; obj.[foo].[bar] // SyntaxError: missing name after . operator ...
Warning: unreachable code after return statement - JavaScript
semicolon-less return statement but including an expression directly after. When an expression exists after a valid return statement, a warning is given to indicate that the code after the return statement is unreachable, meaning it can never be run. Why should I have semicolons after return statements? In the case of semicolon-less return statements, it can be unclear whether the developer int
ended to return the statement on the following line, or to stop execution and return. The warning indicates that there is ambiguity in the way the return statement is written. Warnings will not be shown for semicolon-less returns if these statements follow it: throw break var function Examples Invalid cases function f() { var x = 3; x += 4; return x; // return exits the function imme...
Arrow function expressions - JavaScript
e braces ({}) is parsed as a sequence of statements (i.e. foo is treated like a label, not a key in an object literal). You must wrap the object literal in parentheses: var func = () => ({ foo: 1 }); Line breaks An arrow function cannot contain a line break between its parameters and its arrow. var func = (a, b, c) => 1; // SyntaxError: expected expression, got '=>' However, this can be am
ended by putting the line break after the arrow or using parentheses/braces as seen below to ensure that the code stays pretty and fluffy. You can also put line breaks between arguments. var func = (a, b, c) => 1; var func = (a, b, c) => ( 1 ); var func = (a, b, c) => { return 1 }; var func = ( a, b, c ) => 1; // no SyntaxError thrown Parsing order Although the arrow in an arrow func...
Array.prototype.every() - JavaScript
rwise, the value undefined will be used as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. every does not mutate the array on which it is called. The range of elements processed by every is set before the first invocation of callback. Therefore, callback will not run on elements that are app
ended to the array after the call to every begins. If existing elements of the array are changed, their value as passed to callback will be the value at the time every visits them. Elements that are deleted are not visited. every acts like the "for all" quantifier in mathematics. In particular, for an empty array, it returns true. (It is vacuously true that all elements of the empty set satisfy any gi...
Array.prototype.findIndex() - JavaScript
uments: The value of the element The index of the element The Array object being traversed If a thisArg parameter is passed to findIndex(), it will be used as the this inside each invocation of the callback. If it is not provided, then undefined is used. The range of elements processed by findIndex() is set before the first invocation of callback. callback will not process the elements app
ended to the array after the call to findIndex() begins. If an existing, unvisited element of the array is changed by callback, its value passed to the callback will be the value at the time findIndex() visits the element's index. Elements that are deleted are still visited. Polyfill // https://tc39.github.io/ecma262/#sec-array.prototype.findindex if (!Array.prototype.findIndex) { Object.definePro...
Array.prototype.forEach() - JavaScript
x of the element the Array object being traversed If a thisArg parameter is provided to forEach(), it will be used as callback's this value. The thisArg value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. The range of elements processed by forEach() is set before the first invocation of callback. Elements which are app
ended to the array after the call to forEach() begins will not be visited by callback. If existing elements of the array are changed or deleted, their value as passed to callback will be the value at the time forEach() visits them; elements that are deleted before being visited are not visited. If elements that are already visited are removed (e.g. using shift()) during the iteration, later elements wi...
Array.prototype.map() - JavaScript
se, the value undefined will be used as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. map does not mutate the array on which it is called (although callback, if invoked, may do so). The range of elements processed by map is set before the first invocation of callback. Elements which are app
ended to the array after the call to map begins will not be visited by callback. If existing elements of the array are changed, their value as passed to callback will be the value at the time map visits them. Elements that are deleted after the call to map begins and before being visited are not visited. Due to the algorithm defined in the specification, if the array which map was called upon is spars...
Array.prototype.some() - JavaScript
l be used as the callback's this value. Otherwise, the value undefined will be used as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. some() does not mutate the array on which it is called. The range of elements processed by some() is set before the first invocation of callback. Elements app
ended to the array after the call to some() begins will not be visited by callback. If an existing, unvisited element of the array is changed by callback, its value passed to the visiting callback will be the value at the time that some() visits that element's index. Elements that are deleted are not visited. Caution: Calling this method on an empty array returns false for any condition! Polyfill ...
BigInt - JavaScript
ype.toString() Returns a string representing the specified object in the specified radix (base). Overrides the Object.prototype.toString() method. BigInt.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 recomm
ended to only use BigInt when values greater than 253 are reasonably expected and not to coerce between the two types. Cryptography The operations supported 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 ca...
Date.prototype.toISOString() - JavaScript
The timezone is always zero UTC offset, as denoted by the suffix "Z". 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.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. ...
Date.prototype.toJSON() - JavaScript
tribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.toJSON() Return value A string representation of the given date. Description Date instances refer to a specific point in time. Calling toJSON() returns a string (using toISOString()) representing the Date object's value. This method is generally int
ended to, by default, usefully serialize Date objects during JSON serialization. Examples Using toJSON() var jsonDate = (new Date()).toJSON(); var backToDate = new Date(jsonDate); console.log(jsonDate); //2015-10-26T07:46:36.611Z Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.toJSON' in that specification. ...
Date - JavaScript
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 Ext
ended Format. Date.prototype.toJSON() Returns a string representing the Date using toISOString(). Int
ended 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 o...
Function - JavaScript
e name of the function. Instance methods Function.prototype.apply(thisArg [, argsArray]) Calls a function and sets its this to the provided thisArg. Arguments can be passed as an Array object. Function.prototype.bind(thisArg[, arg1[, arg2[, ...argN]]]) Creates a new function which, when called, has its this set to the provided thisArg. Optionally, a given sequence of arguments will be prep
ended to arguments provided the newly-bound function is called. Function.prototype.call(thisArg[, arg1, arg2, ...argN]) Calls a function and sets its this to the provided value. Arguments can be passed as they are. Function.prototype.toString() Returns a string representing the source code of the function. Overrides the Object.prototype.toString method. Examples Difference between Function cons...
Intl.Locale.prototype.collation - JavaScript
characters (used in Chinese) compat A previous version of the ordering, for compatibility dict Dictionary style ordering (such as in Sinhala) The direct collation type has been deprected. Do not use. ...
Intl.Locale.prototype.numberingSystem - JavaScript
d cultures around the world. As with most internationalization schemas, the numeral systems that can be represented in a Locale object by numberingSystem are standardized by Unicode. A table of the standard Unicode numeral systems can be seen below. ...
Math.clz32() - JavaScript
The ctrz function below fills in all the high bits with the lowest filled bit, then negates the bits to erase all higher set bits so that clz can then be used. var clz = Math.clz32; function ctrz(integer){ // count trailing zeros // 1. fill in all the higher bits after the first one integer |= in...
Object.prototype.isPrototypeOf() - JavaScript
For example, check if baz object descends from Foo.prototype: if (Foo.prototype.isPrototypeOf(baz)) { // do something safe } Specifications Specification ECMAScript (ECMA-262)The definition of 'Object.prototype.isPrototypeOf' in that specification. ...
Object.prototype.toLocaleString() - JavaScript
otype.toLocaleString() Number: Number.prototype.toLocaleString() Date: Date.prototype.toLocaleString() TypedArray: TypedArray.prototype.toLocaleString() BigInt: BigInt.prototype.toLocaleString() Examples Array toLocaleString() override On Array objects, toLocaleString() can be used to print array values as a string, optionally with locale-specific identifiers (such as currency symbols) app
ended to them: For example: const testArray = [4, 7, 10]; let euroPrices = testArray.toLocaleString('fr', { style: 'currency', currency: 'EUR'}); // "4,00 EUR,7,00 EUR,10,00 EUR" Date toLocaleString() override On Date objects, toLocaleString() is used to print out date displays more suitable for specific locales: For example: const testDate = new Date(Date.now()); // "Date Fri May 29 2020 18:04:...
Object.prototype.toString() - JavaScript
n/interactive-examples and send us a pull request. Syntax obj.toString() Return value A string representing the object. Description Every object has a toString() method that is automatically called when the object is to be represented as a text value or when an object is referred to in a manner in which a string is expected. By default, the toString() method is inherited by every object desc
ended from Object. If this method is not overridden in a custom object, toString() returns "[object type]", where type is the object type. The following code illustrates this: const o = new Object(); o.toString(); // returns [object Object] Note: Starting in JavaScript 1.8.5, toString() called on null returns [object Null], and undefined returns [object Undefined], as defined in the 5th Edition of ...
Object.prototype.valueOf() - JavaScript
used as a shorthand for valueOf, e.g. in +new Number()). Also see Using unary plus. Description JavaScript calls the valueOf method to convert an object to a primitive value. You rarely need to invoke the valueOf method yourself; JavaScript automatically invokes it when encountering an object where a primitive value is expected. By default, the valueOf method is inherited by every object desc
ended from Object. Every built-in core object overrides this method to return an appropriate value. If an object has no primitive value, valueOf returns the object itself. You can use valueOf within your own code to convert a built-in object into a primitive value. When you create a custom object, you can override Object.prototype.valueOf() to call a custom method instead of the default Object method.
String.prototype.concat() - JavaScript
new string containing the combined text of the strings provided. Description The concat() function concatenates the string arguments to the calling string and returns a new string. Changes to the original string or the returned string don't affect the other. If the arguments are not of the type string, they are converted to string values before concatenating. Performance It is strongly recomm
ended that the assignment operators (+, +=) are used instead of the concat() method. Examples Using concat() The following example combines strings into a new string. let hello = 'Hello, ' console.log(hello.concat('Kevin', '. Have a nice day.')) // Hello, Kevin. Have a nice day. let greetList = ['Hello', ' ', 'Venkat', '!'] "".concat(...greetList) // "Hello Venkat!" "".concat({}) // [object O...
String.prototype.localeCompare() - JavaScript
alent yielding a neutral value of zero 'a'.localeCompare('a'); // 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 support for ext
ended arguments The locales and options arguments are not supported in all browsers yet. To check whether an implementation supports them, use the "i" argument (a requirement that illegal language tags are rejected) and look for a RangeError exception: function localeCompareSupportsLocales() { try { 'foo'.localeCompare('bar', 'i'); } catch (e) { return e.name === 'RangeError'; } retu...
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. ...
Symbol.match - JavaScript
s function is also used to identify if objects have the behavior of regular expressions. For example, the methods String.prototype.startsWith(), String.prototype.endsWith() and String.prototype.includes(), check if their first argument is a regular expression and will throw a TypeError if they are. Now, if the match symbol is set to false (or a Falsy value), it indicates that the object is not int
ended to be used as a regular expression object. Property attributes of Symbol.match Writable no Enumerable no Configurable no Examples Disabling the isRegExp check The following code will throw a TypeError: '/bar/'.startsWith(/bar/); // Throws TypeError, as /bar/ is a regular expression // and Symbol.
TypedArray.prototype.filter() - JavaScript
s value. Otherwise, the value undefined will be passed for use as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. filter() does not mutate the typed array on which it is called. The range of elements processed by filter() is set before the first invocation of callback. Elements which are app
ended to the typed array after the call to filter() begins will not be visited by callback. If existing elements of the typed array are changed, or deleted, their value as passed to callback will be the value at the time filter() visits them; elements that are deleted are not visited. Examples Filtering out all small values The following example uses filter() to create a filtered typed array that ha...
TypedArray.prototype.find() - JavaScript
, the index of the element, and the typed array object being traversed. If a thisArg parameter is provided to find, it will be used as the this for each invocation of the callback. If it is not provided, then undefined is used. find does not mutate the typed array on which it is called. The range of elements processed by find is set before the first invocation of callback. Elements that are app
ended to the typed array after the call to find begins will not be visited by callback. If an existing, unvisited element of the typed array is changed by callback, its value passed to the visiting callback will be the value at the time that find visits that element's index; elements that are deleted are not visited. Examples Find a prime number in a typed array The following example finds an elemen...
TypedArray.prototype.findIndex() - JavaScript
the element, and the typed array object being traversed. If a thisArg parameter is provided to findIndex, it will be used as the this for each invocation of the callback. If it is not provided, then undefined is used. findIndex does not mutate the typed array on which it is called. The range of elements processed by findIndex is set before the first invocation of callback. Elements that are app
ended to the typed array after the call to findIndex begins will not be visited by callback. If an existing, unvisited element of the typed array is changed by callback, its value passed to the visiting callback will be the value at the time that findIndex visits that element's index; elements that are deleted are not visited. Polyfill TypedArray.prototype.findIndex = Array.prototype.findIndex = Arr...
TypedArray.prototype.forEach() - JavaScript
), it will be passed to callback when invoked, for use as its this value. Otherwise, the value undefined will be passed for use as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. The range of elements processed by forEach() is set before the first invocation of callback. Elements that are app
ended to the typed array after the call to forEach() begins will not be visited by callback. If the values of existing elements of the typed array are changed, the value passed to callback will be the value at the time forEach() visits them; elements that are deleted before being visited are not visited. forEach() executes the callback function once for each typed array element; unlike every() and som...
TypedArray.prototype.map() - JavaScript
ue undefined will be passed for use as its this value. The this value ultimately observable by mapFn is determined according to the usual rules for determining the this seen by a function. map() does not mutate the typed array on which it is called (although mapFn, if invoked, may do so). The range of elements processed by map() is set before the first invocation of mapFn. Elements which are app
ended to the array after the call to map() begins will not be visited by mapFn. If existing elements of the typed array are changed, or deleted, their value as passed to mapFn will be the value at the time map() visits them; elements that are deleted are not visited. Examples Mapping a typed array to a typed array of square roots The following code takes a typed array and creates a new typed array c...
Property accessors - JavaScript
example, if it has a reference to a Function instance as its value). There are two ways to access properties: dot notation and bracket notation. Dot notation In the object.property syntax, the property must be a valid JavaScript identifier. (In the ECMAScript standard, the names of properties are technically "IdentifierNames", not "Identifiers", so reserved words can be used but are not recomm
ended). For example, object.$1 is valid, while object.1 is not. const variable = object.property_name; object.property_name = value; const object = {}; object.$1 = 'foo'; console.log(object.$1); // 'foo' object.1 = 'bar'; // SyntaxError console.log(object.1); // SyntaxError Here, the method named createElement is retrieved from document and is called. document.createElement('pre') ...
void operator - JavaScript
(0);"> Click here to do nothing </a> <a href="javascript:void(document.body.style.backgroundColor='green');"> Click here for green background </a> Note: javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers. Non-leaking Arrow Functions Arrow functions introduce a short-hand braceless syntax that returns an expression. This can cause unint
ended side effects by returning the result of a function call that previously returned nothing. To be safe, when the return value of a function is not int
ended to be used, it can be passed to the void operator to ensure that (for example) changing APIs do not cause arrow functions' behaviors to change. button.onclick = () => void doSomething(); This ensures the return value of doSomething changing fr...
yield - JavaScript
xt() method, that value becomes the value returned by the generator's current yield operation. Between the generator's code path, its yield operators, and the ability to specify a new starting value by passing it to Generator.prototype.next(), generators offer enormous power and control. Unfortunately, next() is asymmetric, but that can't be helped: It always sends a value to the currently susp
ended yield, but returns the operand of the following yield. Examples Using yield The following code is the declaration of an example generator function. function* countAppleSales () { let saleList = [3, 7, 5] for (let i = 0; i < saleList.length; i++) { yield saleList[i] } } Once a generator function is defined, it can be used by constructing an iterator as shown. let appleStore = coun...
for...in - JavaScript
onsider 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 that for...in is built for iterating object properties, not recomm
ended for use with arrays, and options like Array.prototype.forEach() and for...of exist, what might be the use of for...in at all? It may be most practically used for debugging purposes, being an easy way to check the properties of an object (by outputting to the console or otherwise). Although arrays are often more practical for storing data, in situations where a key-value pair is preferred for wor...
import - JavaScript
usage and there is a low likelihood that you will need the code you are importing. When the module you are importing does not exist at load time When the import specifier string needs to be constructed dynamically. (Static import only supports static specifiers.) When the module being imported has side effects, and you do not want those side effects unless some condition is true. (It is recomm
ended not to have any side effects in a module, but you sometimes cannot control this in your module dependencies.) Use dynamic import only when necessary. The static form is preferable for loading initial dependencies, and can benefit more readily from static analysis tools and tree shaking. To dynamically import a module, the import keyword may be called as a function. When used this way, it retur...
var - JavaScript
d, declaring a variable anywhere in the code is equivalent to declaring it at the top. This also means that a variable can appear to be used before it's declared. This behavior is called "hoisting", as it appears that the variable 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 recomm
ended 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 important 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 re...
iarc_rating_id - Web app manifests
Note: The same code can be shared across multiple participating storefronts, as long as the distributed product remains the same (i.e., doesn't serve totally different code paths on different storefronts). ...
icons - Web app manifests
d 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 support. purpose Defines the purpose of the image, for example if the image is int
ended 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 information in the icon is discarded and only the alpha data is used. The icon can then be used by the use...
related_applications - Web app manifests
Type Array Mandatory No The related_applications field is an array of objects specifying native applications that are installable by, or accessible to, the underlying platform -- for example, a native Android application obtainable through the Google Play Store. Such applications are int
ended to be alternatives to the manifest's website that provides similar/equivalent functionality -- like the native app equivalent. Note: Developer can specify that the native applications are preferred over the web application by setting prefer_related_applications to true. Examples "related_applications": [ { "platform": "play", "url": "https://play.google.com/store/apps/details?id=com.example.app1", "id": "com.example.app1" }, { "platform": "itunes", ...
screenshots - Web app manifests
Examples "screenshots" : [ { "src": "screenshot1.webp", "sizes": "1280x720", "type": "image/webp" }, { "src": "screenshot2.webp", "sizes": "1280x720", "type": "image/webp" } ] Specification Specification Status Comment Feedback Web App ManifestThe definition of 'screenshots' in that specification. ...
Performance fundamentals - Web Performance
s just as much as its runtime performance. Gecko is optimized to load a wide variety of content efficiently: the entire Web! Many years of improvements targeting this content, like parallel HTML parsing, intelligent scheduling of reflows and image decoding, clever layout algorithms, etc., translate just as well to improving Web applications on Firefox. ...
Navigation and resource timings - Web Performance
imings have to do with the entire navigation, not this single asset. Client-side web applications may seem faster than this one with transfer sizes under 10000 and decoded body sizes under 30000, but that doesn't mean JavaScript, CSS, or media assets aren't adding bloat. Checking compression ratios is important but ensure to also check duration and the time between when the DOMContentLoaded event
ended and when the DOM is complete, as running JavaScript on the main thread for long periods of time can lead to a non-responsive user interface. Request time The API doesn't provide every measurement you may desire. For example, how long did the request take? We can use measurements we do have, to get our answer. To measure the response time, subtract the request start time from the response start...
Web Performance
real user monitoring (RUM) are two approaches for monitoring and providing insight into web performance. In this article we define and compare these two performance monitoring approaches.Populating the page: how browsers worka developer should strive to achieve these two goals. ...
Add to Home screen - Progressive web apps (PWAs)
age or IndexedDB to store its data. In our example app, we've just used a service worker to store all necessary files. The service worker is registered against the site with the final code block in the index.js file. We then cache all the site's assets using the Cache API, and serve them from the cache instead of the network using the code in the sw.js file. A2HS on desktop While originally int
ended to improve user experience on mobile OSes, there is movement to make PWAs installable on desktop platforms too. Note: At the time of writing, the functionality described below was only supported in newer versions of Chrome -- by default on Windows, and behind the #enable-desktop-pwas flag on macOS. Adding an install button To make our PWA installable on desktop, we first added a button to ou...
Progressive web app structure - Progressive web apps (PWAs)
We will start with analyzing the js13kPWA application, why it is built that way, and what benefits it brings. Architecture of an app There are two main, different approaches to rendering a website -- on the server or on the client. They both have their advantages and disadvantages, and you can mix the two approaches to some degree. Server-side rendering (SSR) means a website is rendered on the server, so it offers quicker first load, but navigating between pages requires downloading new HTML content. ...
How to make PWAs installable - Progressive web apps (PWAs)
system. background_color: A color used as the app's default background, used during install and on the splash screen. A minimal web manifest must have at least a name and an icons field with at least one icon defined; that icon must have at least the src, sizes, and type sub-fields as well. Beyond that, everything is optional, though the description, short_name, and start_url fields are recomm
ended. There are even more fields you can use than listed above -- be sure to check the Web App Manifest 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 ...
Progressive web apps (PWAs)
e detail. Progressive loadingIn 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.Progressive web app structureNow that we know the theory behind PWAs, let's look at the recomm
ended structure of an actual app. We will start with analyzing the js13kPWA application, why it is built that way, and what benefits it brings.PWA developer guideIn the articles listed here, you'll find guides about every aspect of development specific to the greation of progressive web applications (PWAs).Structural overview of progressive web appsIn this structural overview, we'll look at the feature...
Web API reference - Web technology reference
ate graphical and audio effects using APIs such as WebGL and Web Audio. Each individual interface across all APIs is listed in the index. There's also a listing of all available events in the event reference. Document Object Model The DOM is an API that allows access to and modification of the current document. It allows manipulation of document Node and Element. HTML, XML and SVG have ext
ended it to manipulate their specific elements. Device APIs This set of APIs allows access to various hardware features available to Web pages and applications. E.g. Ambient Light Sensor API, Geolocation API, Pointer Lock API, Proximity API, Device Orientation API, Screen Orientation API, Vibration API. Communication APIs These APIs let Web pages and applications communicate with other pages or dev...
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 p...
color-interpolation - SVG: Scalable Vector Graphics
alpha compositing. Note: For filter effects, the color-interpolation-filters property controls which color space is used. The color-interpolation property chooses between color operations occurring in the sRGB color space or in a (light energy linear) linearized RGB color space. Having chosen the appropriate color space, component-wise linear interpolation is used. When a child element is bl
ended into a background, the value of the color-interpolation property on the child determines the type of blending, not the value of the color-interpolation on the parent. For gradients which make use of the href or the deprecated xlink:href attribute to reference another gradient, the gradient uses the property's value from the gradient element which is directly referenced by the fill or stroke prope...
externalResourcesRequired - SVG: Scalable Vector Graphics
hics elements or container elements which specifically need the availability of external resources in order to render properly. Usage notes Value false | true Default value false Animatable No true This value indicates that resources external to the current document are required. If an external resource is not available, progressive rendering is susp
ended, the document's SVGLoad event is not fired and the animation timeline does not begin until that resource and all other required resources become available, have been parsed and are ready to be rendered. false This value indicates that resources external to the current document are optional. Document rendering can proceed even if external resources are unavailable to the current element and its ...
filter - SVG: Scalable Vector Graphics
0" filter="url(#blur)" /> </svg> Usage notes Value none | <filter-function-list> Default value none Animatable Yes For a description of the values see the css filter property. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'filter' in that specification. Working Draft Ext
ended the values by several special filter functions. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'filter' in that specification. Recommendation 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-dat...
glyph-name - SVG: Scalable Vector Graphics
The glyph names can be used in situations where Unicode character numbers do not provide sufficient information to access the correct glyph, such as when there are multiple glyphs per Unicode character. The glyph names can be referenced in kerning definitions created by <hkern> and <vkern> elements. Only one element is using this attribute: <glyph> Context notes Value <name># Default value None Animatable No <name># This value specifies a comma-separated list of names for the glyph. ...
order - SVG: Scalable Vector Graphics
on for the kernel matrix. The values provided must be <integer>s greater than zero. Values that are not integers will be truncated, i.e. rounded to the closest integer value towards zero. The first number, indicates the number of columns in the matrix. The second number, indicates the number of rows in the matrix. If no second number is not provided, it defaults to the first number. It is recomm
ended that only small values (e.g., 3) be used; higher values may result in very high CPU overhead and usually do not produce results that justify the impact on performance. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'order' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1...
rendering-intent - SVG: Scalable Vector Graphics
colors that have the same saturation but fall just inside the gamut. saturation This value leaves colors that fall inside the gamut unchanged. This method usually converts out of gamut colors to colors that have the same lightness but fall just inside the gamut. absolute-colorimetric This value disables white point matching when converting colors. Note: This option is generally not recomm
ended. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'rendering-intent' in that specification. Recommendation Initial definition ...
requiredExtensions - SVG: Scalable Vector Graphics
escaped. requiredExtensions is often used in conjunction with the <switch> element. If the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. Note: If several extension reference objects are enclosed in a <switch> and none of them matches, this may lead to situations where no content is displayed. It is thus recomm
ended to include a "catch-all" choice at the end of such a <switch> which is acceptable in all cases. If the attribute is not present, then it implicitly evaluates to "true". If a null string or empty string value is given, the attribute evaluates to "false". The IRI names for the extension should include versioning information, such as "http://example.org/SVGExtensionXYZ/1.0", so that script writers...
units-per-em - SVG: Scalable Vector Graphics
This is the size of the design grid on which glyphs are laid out. Note: This value is almost always necessary as nearly every other attribute requires the definition of a design grid. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value 1000 Animatable No <number> This value indicates the the number of coordinate units on the em square. ...
xlink:arcrole - SVG: Scalable Vector Graphics
Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'xlink:arcrole' in that specification. Recommendation Initial definition ...
SVG Attribute reference - SVG: Scalable Vector Graphics
e, accumulate Event Attributes Animation Event Attributes onbegin, onend, onrepeat Document Event Attributes onabort, onerror, onresize, onscroll, onunload Global Event Attributes oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncuechange, ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, on
ended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ont...
<cursor> - SVG: Scalable Vector Graphics
Note: The CSS cursor property should be used instead of this element. The <cursor> SVG element can be used to define a platform-independent custom cursor. A recomm
ended approach for defining a platform-independent custom cursor is to create a PNG image and define a cursor element that references the PNG image and identifies the exact position within the image which is the pointer position (i.e., the hot spot). The PNG format is recomm
ended because it supports the ability to define a transparency mask via an alpha channel. If a different image format is used, this format should support the definition of a transparency mask (two options: provide an explicit alpha channel or use a particular pixel color to indicate transparency). If the transparency mask can be determined, the mask ...
<feColorMatrix> - SVG: Scalable Vector Graphics
+ [ shift of r5 ] If, say, we want to make a completely black image redder, we can make the r5 a positive real number x, boosting the redness on every pixel of the new image by x. An identity matrix looks like this: R G B A W R' | 1 0 0 0 0 | G' | 0 1 0 0 0 | B' | 0 0 1 0 0 | A' | 0 0 0 1 0 | In it, every new value is exactly 1 times its old value, with nothing else added. It is recomm
ended to start manipulating the matrix from here. Usage context CategoriesFilter primitive elementPermitted contentAny number of the following elements, in any order:<animate>, <set> Attributes Global attributes Core attributes Presentation attributes Filter primitive attributes class style Specific attributes in type values DOM Interface This element implements the SVGFEColorMatri...
<feComposite> - SVG: Scalable Vector Graphics
y values and different clearing of the background.</desc> <defs> <desc>Define two sets of six filters for each of the six compositing operators. The first set wipes out the background image by flooding with opaque white. ...
<feSpecularLighting> - SVG: Scalable Vector Graphics
ent of the Phong lighting model. The resulting image depends on the light color, light position and surface geometry of the input bump map. The result of the lighting calculation is added. The filter primitive assumes that the viewer is at infinity in the z direction. This filter primitive produces an image which contains the specular reflection part of the lighting calculation. Such a map is int
ended to be combined with a texture using the add term of the arithmetic <feComposite> method. Multiple light sources can be simulated by adding several of these light maps before applying it to the texture image. Usage context CategoriesFilter primitive elementPermitted contentExactly one light source element first and any number of descriptive elements in any order. Attributes Global attributes ...
Namespaces crash course - SVG: Scalable Vector Graphics
don't belong to the same XML dialect as the element). Parameters such as xlink:href require the namespace name that was assigned to that prefix (http://www.w3.org/1999/xlink for XLink). Hence to get the value of the xlink:href parameter of an <a> element in SVG you would write: elt.getAttributeNS('http://www.w3.org/1999/xlink', 'href'); For setting parameters that have a namespace, it is recomm
ended (but not required) that you also include their prefix in the second parameter so that the DOM can later be more easily converted back to XML (if for instance you want to send it back to the server). For example: elt.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', 'otherdoc.svg'); As a final example, here's a demonstration of how you should dynamically create an <image> element usin...
SVG animation with SMIL - SVG: Scalable Vector Graphics
Firefox 4 introduced support 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. Animating attributes of an element The following example animates the cx attribute of a circle. ...
Getting started - SVG: Scalable Vector Graphics
and injected into the HTML DOM. With this method, replacement technologies can be implemented for browsers which normally can't process SVG. See this dedicated article which deals with the topic in-depth. How SVG handles sizes and units will be explained on the next page. SVG file types SVG files come in two flavors. Normal SVG files are simple text files containing SVG markup. The recomm
ended filename extension for these files is ".svg" (all lowercase). Due to the potentially massive size SVG files can reach when used for some applications (e.g., geographical applications), the SVG specification also allows for gzip-compressed SVG files. The recomm
ended filename extension for these files is ".svgz" (all lowercase). Unfortunately, it is very problematic to get gzip-compressed SVG file...
Certificate Transparency - Web security
is that the server operator can customise the CT log sources providing the SCTs sent via the TLS extension/stapled OCSP response. Browser Requirements Google Chrome requires CT log inclusion for all certificates issues with a notBefore date of after 30 April 2018. Users will be prevented from visiting sites using non-compliant TLS certificates. Chrome had previously required CT inclusion for Ext
ended Validation (EV) and Symantec-issued certificates. Apple requires a varying number of SCTs in order for Safari and other servers to trust server certificates. Firefox does not currently check or require the use of CT logs for sites that users visit. The Expect-CT header can be used to request that a browser always enforces the requirement for certificate transparency (e.g. in Chrome, even if th...
Web security
and reliability of data. This article provides an overview of TLS 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 int
ended server, and to exchange sensitive data. HTTP Strict-Transport-Security The Strict-Transport-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 C...
HTML Imports - Web Components
. 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 Imports 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 Imports is int
ended to be the packaging mechanism for web components, but you can also use HTML Imports by itself. You import an HTML file by using a <link> tag in an HTML document like this: <link rel="import" href="myfile.html"> The import link type is new. Specification Specification Status Comment HTML Imports Working Draft Initial definition. ...
Using templates and slots - Web Components
loneNode(true)); } } ); The key point to note here is that we append a clone of the template content to the shadow root, created using the Node.cloneNode() method. And because we are appending its contents to a shadow DOM, we can include some styling information inside the template in a <style> element, which is then encapsulated inside the custom element. This wouldn't work if we just app
ended 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-supported in browsers; the Shadow DOM API is supported by default in Fi...
XML Index - XML: Extensible Markup Language
1 XML: Extensible Markup Language Draft, Landing, Web, XML The Extensible Markup Language is a strict serialisation of the Document Object Model. 2 XML Index Index, Web, XML Found 4 pages: 3 XML introduction Beginner, Introduction, XML XML is a markup language similar to HTML. It stands for Extensible Markup Language and is a W3C recomm
ended specification as a general purpose markup language. This means, unlike other markup languages, XML is not predefined so you must define your own tags. The primary purpose of the language is the sharing of data across different systems, such as the Internet. 4 xml:base HTML BaseElement, NeedsSpecTable, SVG, xml:base xml:base is like the HTML BaseElement but can specify the bas...
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
essor(); Specifying the stylesheet Before you can use it, you must import a stylesheet with the XSLTProcessor.importStylesheet() method. It has a single parameter, which is the DOM Node of the XSLT stylesheet to import. Note: The import is live, meaning that if you alter the stylesheet DOM after importing it, this will be reflected in the processing. Rather than modifying the DOM it is recomm
ended to use stylesheet parameters which are usually 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-tran...