Search completed in 1.31 seconds.
Index - Web APIs
the animation is canceled, since in both of those scenarios, the animation is ready to be started again. 78 Animation.reverse() API, Animation, Interface, Method, Reference, Web Animations, reverse, waapi, web animations api The Animation.reverse() method of the Animation Interface reverses the playback direction, meaning the animation ends at its beginning. If called on an un
played animation, the whole animation is
played backwards. If called on a paused animation, the animation will continue in reverse. 79 Animation.startTime API, Animation, Interface, Property, Reference, Web Animations, startTime, web animations api The Animation.startTime property of the Animation interface is a double-precision floating-point value which indicates the scheduled tim...
...ified attribute, or null if no prefix is specified. 103 AudioBuffer API, AudioBuffer, Interface, Reference, Web Audio API The AudioBuffer interface represents a short audio asset residing in memory, created from an audio file using the AudioContext.decodeAudioData() method, or from raw data using AudioContext.createBuffer(). Once put into an AudioBuffer, the audio can then be
played by being passed into an AudioBufferSourceNode. 104 AudioBuffer() API, Audio, AudioBuffer, Buffer, Constructor, Media, Reference, Web Audio, Web Audio API, sound The AudioBuffer constructor of the Web Audio API creates a new AudioBuffer object. 105 AudioBuffer.copyFromChannel() API, Audio, AudioBuffer, Copying, Frames, Method, Reference, Samples, Web Audio, Web ...
... Reference, Web Audio API The AudioBufferSourceNode interface is an AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being
played from disk or the network. 113 AudioBufferSourceNode.AudioBufferSourceNode() API, Audio, AudioBufferSourceNode, Constructor, Media, Reference, Web Audio API The AudioBufferSourceNode() constructor creates a new AudioBufferSourceNode object instance. 114 AudioBufferSourceNode.buffer API, Audio, AudioBufferSourceNode, Buffer, Media, Property, Reference, Web Audio ...
...And 39 more matches
Index - Archive of obsolete content
. 81 dev/panel Enables you to extend the Firefox Developer Tools. 82 event/core The event/core module allows the creation of APIs to broadcast and subscribe to events. 83 event/target Create objects that broadcast events. 84 frame/hidden-frame Creates Firefox frames (i.e. XUL <iframe> elements) that are not dis
played to the user. 85 frame/utils Provides helper functions for working with platform internals like frames and browsers. 86 fs/path Provides access to the local filesystem with the NodeJS path module API. 87 io/byte-streams Provides streams for reading and writing bytes. 88 io/file Provides access to the local file...
...estconfig.txt file defines groups of tests to run (e.g. sunspider, scimark, language). By default the time for each test is output. Use the --memory flag to capture the maximum private bytes memory (high water mark) for a test. By default each test is run a single time. To run each test multiple times use the --iterations flag. When the number of iterations is greater than 2 all times are dis
played in [], faster time is dis
played in the output column, and the 95% confidence interval is calculated. The 95% confidence interval is the calculated percentage of the mean value to fall within 95% of the measured results. For example if the mean is 100 and the 95% confidence interval is 2%, 95% of the expected values should fall between 98 and 102. To compare two vms against each other export AV...
... 1170 List of commands XUL The following lists commands which might be usable by <command> or command dispatchers/controllers. 1171 Menus Add-ons, Extensions, NeedsContent, Reference, Reference(2), XUL An extension will often wish to attach a new command to a menu. To do this, the new menu will need to be laid over the existing menu which the item should be dis
played upon. For more information about how to use an overlay to modify a menu, see Using Menus and Popups in Extensions 1172 Methods XUL Methods, XUL Reference No summary! 1173 acceptDialog XUL Methods, XUL Reference No summary! 1174 addItemToSelection XUL Methods, XUL Reference No summary! 1175 addPane XUL Methods, XUL Refer...
...And 29 more matches
Index - Archive of obsolete content
439 List of commands XUL The following lists commands which might be usable by <command> or command dispatchers/controllers. 440 Menus Add-ons, Extensions, NeedsContent, Reference, Reference(2), XUL An extension will often wish to attach a new command to a menu. To do this, the new menu will need to be laid over the existing menu which the item should be dis
played upon. For more information about how to use an overlay to modify a menu, see Using Menus and Popups in Extensions 441 Methods XUL Methods, XUL Reference No summary! 442 acceptDialog XUL Methods, XUL Reference No summary! 443 addItemToSelection XUL Methods, XUL Reference No summary! 444 addPane XUL Methods, XUL Reference...
...ecked to see if it has a datasources attribute. If so, a template builder will be created for the element and attached to the element. If the element is a <tree> element and has the flags attribute set to "dont-build-content", a tree builder will be created. Otherwise, a content builder will be created. Both types of builder share much of the same code except for how they generate output to be dis
played. Both types of builders implement the nsIXULTemplateBuilder interface, while the tree builder also implements the nsIXULTreeBuilder interface.</tree> 946 Template Logging Debugging problems with a template can be difficult as many problems are logic errors that are often not possible to determine automatically. For example, if you spell a value wrong, no data may be returned...
... 1017 Commands Tutorials, XUL, XUL_Tutorial A command is an operation which may be invoked. 1018 Content Panels Tutorials, XUL, XUL_Tutorial In this section, we'll look at how to add panels that can display HTML pages or other XUL files. 1019 Creating Dialogs Tutorials, XUL, XUL_Tutorial A XUL application will often require dialogs to be dis
played. This section describes how one might construct them. 1020 Creating a Skin Tutorials, XUL, XUL_Tutorial This section describes how to create a simple skin. For simplicity, we'll only apply it to the find files dialog. 1021 Creating a Window Tutorials, XUL, XUL_Tutorial We're going to be creating a simple find files utility throughout this tutorial. ...
...And 22 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
fox. We can also read in a stylesheet that we had set up ourselves. The XUL box model In principle, XUL lays out all UI components using combinations of two kinds of boxes: horizontal and vertical. As shown in Listing 3, elements can be laid out horizontally using the hbox (horizontal box) element or vertically using the vbox (vertical box) element. When this file is opened in Firefox, it is dis
played as shown in Figure 1. <label value="Horizontal layout"/> <hbox> <button label="horizontal1"/> <button label="horizontal2"/> </hbox> <label value="Vertical layout"/> <vbox> <button label="vertical1"/> <button label="vertical2"/> </vbox> <label value="mixed"/> <hbox> <button label="mixed1"/> <vbox> <button label="mixed2"/> <button label="mixed3"/> </vbox> <button label="mix...
...ositive integer as a value, which is a growth multiple on the axis of the parent element's orient attribute. For example, flex="1" indicates that the element should extend to fill that axis; if there are two elements with flex="1" in a row, they are adjusted to be of equal size. You can assign flex="2" (or higher values) as a size multiplier for elements. In Listing 4, the second label will be dis
played twice as big as the first (Figure 3). <hbox> <label value="label1" flex="1" style="border: 1px solid;"/> <label value="label2" flex="2" style="border: 1px solid;"/> </hbox> Listing 4: Growing with flex Figure 3: Output of Listing 4 ordinal Within a XUL box, elements will ordinarily be laid out following their order of appearance in the source code (laid out left to right or top to bot...
..." style="min-width: 10em;"/> Listing 7: Setting the size of a button using CSS markup hidden and collapsed The hidden and collapsed attributes act as switches to turn off the display of elements. Setting hidden="true" disables display of that element. This has the same effect as setting display: none in CSS. You would use this to set a hidden or absent state, for example items that aren't dis
played in contextual menus. Setting collapsed="true" sets an element's height and width to 0, but the element is treated as being present. This is equivalent to setting visibility: collapse in CSS. Use this to "roll up" sidebars that aren't currently in use. disabled While not appropriate for all elements, you can use the disabled attribute to temporarily disable input to an element that is normally ...
...And 9 more matches
Box Objects - Archive of obsolete content
bes the box object, which holds display and layout related information about a XUL box as well as some details about XUL layout. About Mozilla Layout Mozilla divides things into two sets of trees, the content tree and the layout tree. The content tree stores the nodes as they are found in the source code. The layout tree holds a different tree of nodes for each individual component that can be dis
played. The layout tree holds the structure as the nodes are expected to be dis
played There is not necessarily a one to one relationship between content and layout nodes. Some content nodes may have several layout objects, for example, each line of a paragraph has a separate layout object. Conversely, some content nodes have no layout objects at all. For instance, the key element doesn't have any layout...
...Similarly, any element that has been hidden will not have a layout object either. The DOM is generally used only to get and modify information pertaining to the content or structure of the document. It's relatively simple to determine what kind of content tree node will be created for a given element. ...
...me, the attributes on an element, various CSS properties, the elements and layout objects around the element, and the XBL associated with an element (XBL is described in a later section). Unless you change the style for an element, most XUL elements will usually use the box layout object or one of its subtypes. Recall that all XUL elements are types of boxes, that is the box is the base of all dis
played XUL elements. However, there are a number of subtypes, about 25 or so, for specific XUL elements. Some of these subtypes, such as the stack or listbox are needed for more complex layouts than the basic box, while others such as the button are used only to add extra mouse and key event handling. The layout object associated with an element can be removed and a completely different type of object c...
...And 8 more matches
Theme changes in Firefox 2 - Archive of obsolete content
of the URL field. browser/preferences/preferences.css File that skins the preferences window. browser/safebrowsing/browser-protection.css New file; CSS for the window that appears to warn the user that a site may be fraudulent, as well as the URL bar icon that indicates a site may be fraudulent. browser/safebrowsing/close16x16.png New file; this is the icon dis
played in the safe browsing warning window as a close box for the window. browser/safebrowsing/dim.png New file; this is a graphic overlaid on top of the contents of the window to "dim" it when the safe browsing warning window is dis
played. It should use translucency to allow the window contents to be visible through it. browser/safebrowsing/tail.png New file; this is the "tail" ...
... browser/search-bar-background-mid.png New file; the background for the middle part of the search bar. ...
...translucency to allow the window contents to be visible through it. browser/safebrowsing/tail.png New file; this is the "tail" of the talk-bubble style window used to indicate that a site may be fraudulent. browser/safebrowsing/warning16x16.png New file; this is the 16x16 pixel version of the warning icon dis
played in the URL bar when the safe browsing warning window is dis
played. browser/safebrowsing/warning24x24.png New file; this is the warning icon that's dis
played inside the safe browsing warning window. browser/search-bar-background-mid.png New file; the background for the middle part of the search bar. The ends of the bar are now skinned separately. browser/search-bar-background.png Removed file. browser/Search-bar.png ...
...And 8 more matches
Trees - Archive of obsolete content
ree. The second part, the tree body, contains the data to appear in the tree and is created with a treechildren tag. The tree is unique in that the body of the tree consists only of a single widget which draws all of the data in the tree. This contrasts with the listbox, where individual listitem and listcell tags are used to specify the rows in the listbox. In a tree, all of the data to be dis
played is supplied by a separate object, called a tree view. When it comes time to display a cell, the tree widget will call out to this tree view to determine what to display, which in turn will be drawn by the tree. The tree is smart enough to only ask for information from the view for those rows that need to be dis
played. This allows the view to be optimized such that it only needs to load the data f...
...pplied by a separate object, called a tree view. When it comes time to display a cell, the tree widget will call out to this tree view to determine what to display, which in turn will be drawn by the tree. The tree is smart enough to only ask for information from the view for those rows that need to be dis
played. This allows the view to be optimized such that it only needs to load the data for dis
played content. For instance, a tree might have thousands of rows, yet most of them will be scrolled off the border of the tree, hidden from view. This means that the tree is scalable to any number of rows without any performance problems. Of course, this is independant of the performance of the view object itself. A tree view is an object which implements the nsITreeView interface. This interface cont...
...you may implement. These functions will be called by the tree as necessary to retrieve data and state about the tree. For instance, the getCellText() function will be called to get the label for a particular cell in the tree. An advantage of using a tree view is that it allows the view to store the data in a manner which is more suitable for the data, or to load the data on demand as rows are dis
played. This allows more flexibility when using trees. Naturally, having to implement a tree view with thirty or so properties and methods for every tree can be very cumbersome, especially for simple trees. Fortunately, XUL provides a couple of built-in view implementations which do most of the hard work for you. For most trees, especially when you first start to use trees, you will use one of these bu...
...And 7 more matches
Client-side storage - Learn web development
Client-side storage? Elsewhere in the MDN learning area we talked about the difference between static sites and dynamic sites. Most major modern web sites are dynamic -- they store data on the server using some kind of database (server-side storage), then run server-side code to retrieve needed data, insert it into static page templates, and serve the resulting HTML to the client to be dis
played by the user's browser. Client-side storage works on similar principles, but has different uses. It consists of JavaScript APIs that allow you to store data on the client (i.e. on the user's machine) and then retrieve it when needed. This has many distinct uses, such as: Personalizing site preferences (e.g. showing a user's choice of custom widgets, color scheme, or font size). Persisting pre...
...In this function we remove the name item from web storage using removeItem(), then again run nameDisplayCheck() to update the display. Add this to the bottom: // run function when the 'Forget' button is clicked forgetBtn.addEventListener('click', function() { // Remove the stored name from web storage...
...iles. You'll see that the HTML is pretty simple: a web site with a header and footer, as well as a main content area that contains a place to display notes, and a form for entering new notes into the database. The CSS provides some simple styling to make it clearer what is going on. The JavaScript file contains five declared constants containing references to the <ul> element the notes will be dis
played in, the title and body <input> elements, the <form> itself, and the <button>. Rename your JavaScript file to index.js. You are now ready to start adding code to it. Database initial set up Now let's look at what we have to do in the first place, to actually set up a database. Below the constant declarations, add the following lines: // Create an instance of a db object for us to stor...
...And 5 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
rn the values specified in this attribute. Explainer, examples loop A Boolean attribute; if specified, the browser will automatically seek back to the start upon reaching the end of the video. muted A Boolean attribute that indicates the default setting of the audio contained in the video. If set, the audio will be initially silenced. ...
...n this attribute. Explainer, examples loop A Boolean attribute; if specified, the browser will automatically seek back to the start upon reaching the end of the video. muted A Boolean attribute that indicates the default setting of the audio contained in the video. If set, the audio will be initially silenced. Its default value is false, meaning that the audio will be
played when the video is
played. ...
...d, the browser will automatically seek back to the start upon reaching the end of the video. muted A Boolean attribute that indicates the default setting of the audio contained in the video. If set, the audio will be initially silenced. Its default value is false, meaning that the audio will be
played when the video is
played. playsinline A Boolean attribute indicating that the video is to be
played "inline", that is 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 dis
played until the first frame is available, then the first frame is shown as the poster frame. preload This enumerat...
...And 5 more matches
Creating a Help Content Pack - Archive of obsolete content
e marks the start point in the RDF graph described by the file, and the Help Viewer searches for this element in order to query for further information (stored in child elements) about the content pack being parsed. nc:title is where you specify the title (e.g., "Mozilla Firefox Help") for the Help Window. This attribute is required. nc:defaulttopic will hold the rdf:ID of the topic you want dis
played when the viewer first loads if none has been specified. This attribute also specifies what topic is loaded when the user hits the Home button in the viewer. We'll get to exactly how to fill in this attribute later. This attribute is optional, with fallback to the value welcome. nc:base contains the base URL relative to which the Help content referenced in the descriptor file is located. For exam...
...on nc:panelid="index" nc:datasources="chrome://foo/locale/help/glossary.rdf"/> </rdf:li> </rdf:Seq> The Help Viewer UI may or may not provide a panel for each of these data sources. In Firefox 1.0 each data source had a panel. Starting with Firefox 1.1 and the Mozilla 1.8 platform, only the table of contents data source will be dis
played. The glossary and index data sources will be hidden - information found only in them will not be dis
played unless the user conducts a search of the Help pack that would return glossary or index results.XXX this sentence is ugly - a little rewording help here would be nice A data source description is pretty much the same no matter which type you're defining, and the syntax is pretty simple. Each...
...le rewording help here would be nice A data source description is pretty much the same no matter which type you're defining, and the syntax is pretty simple. Each panel is specified by one rdf:Description element with the following attributes: nc:panelid specifies the name of the panel, which may be any one of glossary, search, toc, or index. The data source specified by toc will always be dis
played, while the other data sources may only be available by searching through the loaded content pack. nc:datasources is a space-separated list of RDF datasources used in construction of the structure of referenced topics. Generally, each item in the list will be a URI to an RDF file, but if you're more familiar with RDF you can also refer to a specific node within the RDF file using its rdf:ID attri...
...And 4 more matches
Venkman Introduction - Archive of obsolete content
Pretty Print is enabled you will see a green check mark on the toolbar button, and the menu item will be checked as well. The Loaded Scripts View The Loaded Scripts View is in the top left portion of the window. When a file is loaded by the browser it will appear in this view, and when unloaded it will be removed. Files are listed in alphabetical order, grouped by file type. File names are dis
played after a color coded, single letter icon representing the file extension. Figure 6 shows the table of icon and file types. At the time if this writing, the order and grouping of file names cannot be changed. Icon File type .js .html, .htm .xul .xml All other files JavaScript function Figure 6. Icons...
...ion. Figure 6 shows the table of icon and file types. At the time if this writing, the order and grouping of file names cannot be changed. Icon File type .js .html, .htm .xul .xml All other files JavaScript function Figure 6. Icons in the Script View The "special" function name __toplevel__ is dis
played for scripts that are not part of an actual function. Clicking on a file name brings you to the top of that file, while clicking on a function name brings you to the start of that function. The Line column in this view displays the line number that this function starts on. The column picker for this view (the box on the top right) can be used to display a Length column. This column displays the ...
...ead Only property p Permanent (cannot be deleted) A Alias to another property a Argument to a function v Declared with var Figure 8. Property flags Properties of both scope and this objects are listed alphabetically, grouped by data type. Figure 9 shows which icons represent which data types. Properties which are of the type Object are dis
played with the name of their constructor function in curly braces as their value. You can locate the source code of the constructor by selecting "Find Constructor" from the property's context menu. You can find the place where the object was instantiated with the "Find Creator" command. By default, properties of type function are not dis
played, in order to conserve space in the view. If you would like ...
...And 4 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
ncSessions Examples (example needed) Attributes accesskey Type: character This should be set to a character that is used as a shortcut key. This should be one of the characters that appears in the label attribute for the element. alwaysopenpopup Obsolete since Gecko 1.9.1 Type: boolean Note: Applies to: Thunderbird and SeaMonkeyIf true, the autocomplete popup will be dis
played even when there are no matches. If false, the default value, the popup will be hidden. This attribute is obsolete as of Gecko 1.9.1; to control the display of the popup, use the minresultsforpopup attribute instead. autocompletesearch New in Thunderbird 2Requires SeaMonkey 1.1 Type: space-separated list of values A space-separated list of search component names, each of ...
...o: Thunderbird and SeaMonkeyIf set to true, the best match will be filled into the textbox as the user types. If false, the default, the value will not be filled in until the user selects an item. As of Gecko 1.9.1, this attribute is now always specified in lower case. autoFillAfterMatch Obsolete since Gecko 1.9.1 Type: boolean If set to true, the entire text of the best match will be dis
played at the end of the input. If false, only the text that hasn't been entered yet will be filled in. The textbox.autoFill attribute must be set to true to use this feature. As of Gecko 1.9.1, this attribute is superseded by the completedefaultindex attribute. autofill New in Thunderbird 3 Requires SeaMonkey 2.0 Type: boolean If set to true, the best match will be filled into...
... The maximum number of characters that the textbox allows to be entered. maxrows Type: integer The number of rows to show in the results list at a time. A scrollbar will appear so the user can scroll through the remaining items. minResultsForPopup Obsolete since Gecko 1.9.1 Type: integer The minimum number of results that must be returned for the popup to be dis
played. The default value is 1. A zero value will always open the popup unless the textbox is empty. This can be used to display additional items that are not autocomplete results. As of Gecko 1.9.1, this attribute is now always specified in lower case. minresultsforpopup New in Thunderbird 3Requires SeaMonkey 2.0 Type: integer The minimum number of results that must be returne...
...And 4 more matches
simple-prefs - Archive of obsolete content
ou define. Type-Specific Attributes These are settings that are only applicable to certain preference types. They are documented along with the preference types themselves. Preference Types The setting types map to the inline settings types used by the Add-on Manager. All the inline preferences are supported. Type Description Example Specification bool Dis
played as a checkbox and stores a boolean. { "description": "Does it have tentacles?", "type": "bool", "name": "hasTentacles", "value": true, "title": "Tentacles" } boolint Dis
played as a checkbox and stores an integer. A boolint is presented to the user as a checkbox, but instead of storing true or false, the "on" or "off" checkbox states are mapped...
...ties in the specification. To provide this mapping the boolint requires two mandatory attributes called "on" and "off", both of which are supplied as strings. Note that even so, the "value" property is supplied as an integer. ...
...ty is supplied as an integer. { "type": "boolint", "name": "myBoolint", "on": "1", "off": "2", "value": 1, "title": "My Boolint" } integer Dis
played as a textbox and stores an integer. { "description": "How many eyes?", "type": "integer", "name": "eyeCount", "value": 8, "title": "Eye count" } string Dis
played as a textbox and stores a string. ...
...And 3 more matches
Video and audio content - Learn web development
's especially critical for people who have epilepsy.) You must either use the controls attribute to include the browser's own control interface, or build your interface using the appropriate JavaScript API. At a minimum, the interface must include a way to start and stop the media, and to adjust the volume. The paragraph inside the <video> tags This is called fallback content -- this will be dis
played if the browser accessing the page doesn't support the <video> element, allowing us to provide a fallback for older browsers. This can be anything you like; in this case, we've provided a direct link to the video file, so the user can at least access it some way regardless of what browser they are using. The embedded video will look something like this: You can try the example live here (see ...
...the rest of the page is loading. You are advised 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 dis
played before the video is
played. It is intended 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 t...
...spoken in the audio/video? Well, thanks to HTML video, you can. To do so we use the WebVTT file format and the <track> element. Note: "Transcribe" means "to write down spoken words as text." The resulting text is a "transcript." WebVTT is a format for writing text files containing multiple strings of text along with metadata such as the time in the video at which each text string should be dis
played, and even limited styling/positioning information. These text strings are called cues, and there are several kinds of cues which are used for different purposes. The most common cues are: subtitles Translations of foreign material, for people who don't understand the words spoken in the audio. captions Synchronized transcriptions of dialog or descriptions of significant sounds, to let peopl...
...And 3 more matches
Web Replay
er -> Web Replay -> Load Recording in New Tab' menu item will start a new tab which replays the recording to the end. The developer tools can be used to interact with this tab in the same way as a recording tab, though playing forward to the end will pause the tab instead of allowing further recording. Save Recording and Replay on a Different Machine (partially implemented) Recordings can be re
played on a different machine from the one which recorded them. This requires using the same build of firefox and a reasonably similar version of the operating system; otherwise the tab will probably crash. This feature has had little testing or polishing and there is not yet a good definition of 'reasonably similar'. Time Travel Features This section describes extensions to the developer tools that...
...e from the recording in any othe way in this mode. default false. devtools.recordreplay.logging When enabled, Firefox will log Web Replay's internal actions to the terminal, which is helpful when debugging hangs and crashes. default false Architecture There are several main components to the project: The record/replay infrastructure records enough information during recording so that the re
played process can run and produce the same observable behaviors. IPC integration allows a replaying process to communicate with the chrome process using IPDL and shared memory. The rewind infrastructure allows a replaying process to restore a previous state, while still maintaining communication with the chrome process. Debugger integration allows the JS debugger to read the information it needs fro...
... originates from two sources: intra-thread and inter-thread. Intra-thread non-deterministic behaviors are non-deterministic even in the absence of actions by other threads, and inter-thread non-deterministic behaviors are those affected by interleaving execution with other threads, and which always behave the same given the same interleaving. Intra-thread non-determinism is recorded and later re
played for each thread. These behaviors mainly originate from system calls (i/o and such). Inter-thread non-determinism is handled by first assuming the program is data race free: shared memory accesses which would otherwise race are either protected by locks or use APIs that perform atomic operations. If we record and later replay the order in which threads acquire locks (and, by extension, release ...
...And 3 more matches
Install Manifests - Archive of obsolete content
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 - intended 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 dis
played 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/icon.png</em:iconURL> Note: For the above example to work you will also have to add a skin package line to your chrome.manifest file. See Chrome Registration#skin. Alternatively you can place your ico...
...o work you will also have to add a skin package line to your chrome.manifest file. See Chrome Registration#skin. Alternatively you can place your icon in the directory specified in your content package line. Gecko 1.9.2 note Starting in Gecko 1.9.2 (Firefox 3.6), you can also simply include your icon, named icon.png, in the base directory of the add-on. This allows your add-on's icon to be dis
played even when the add-on is disabled, or if the manifest is missing an iconURL entry. icon64URL A chrome:// URL to a 64x64 pixel icon to display in the add-on's details view . If this property is not specified, the smaller icon above will be used. <em:icon64URL>chrome://myext/skin/icon64.png</em:icon64URL> Note: For the above example to work you will also have to add a skin package line to you...
... to work you will also have to add a skin package line to your chrome.manifest file. See Chrome Registration#skin. Alternatively you can place your icon in the directory specified in your content package line. Gecko 2.0 note Starting in Gecko 2.0 (Firefox 4.0), you can also simply include your icon, named icon64.png, in the base directory of the add-on. ...
...And 2 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
nsion development, but I recommend it as a way to work more efficiently. Preference Description Value nglayout.debug.disable_xul_cache (not present in Firefox 3.5+) Ordinarily, Firefox will cache XUL documents after they have been read in once, to speed subsequent displays. Disabling this cache forces XUL documents to be reloaded any every time they are dis
played. True browser.dom.window.dump.enabled (not present in Firefox 3.5+) Enables use of the dump method for debugging. Refer to the "JavaScript debugging methods" sidebar. True javascript.options.showInConsole (present in Firefox 3.5+) Outputs JavaScript errors to the error console. True javascript.options.strict (present in Firefox 3.5+) ...
...s://addons.mozilla.org/firefox/addon/7434 Developing extensions: What you need to know Let's delve into chrome, something you'll need to know about in order to develop extensions. Chrome What is chrome? "Chrome"is the word used to describe all the GUI structural elements that go into an XUL application. For example, in the Firefox browser window, everything other than the web page being dis
played in the content area is chrome. Extensions also can be considered XUL applications with chrome. Three kinds of packages make up chrome The content package This package is used to contain the main XUL and JavaScript source files. Most extensions consist of a single content package2 The locale package This package is used to contain language data that can be translated. To make an extension's G...
..."1.0"?> <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <Description about="urn:mozilla:install-manifest"> <!-- Unique ID for extension. Can be in e-mail address format or GUID format --> <em:id>helloworld@xuldev.org</em:id> <!-- Indicates that this add-on is an extension --> <em:type>2</em:type> <!-- Extension name dis
played in Add-on Manager --> <em:name>Hello, World!</em:name> <!-- Extension version number. There is a version numbering scheme you must follow --> <em:version>0.1</em:version> <!-- Brief description dis
played in Add-on Manager --> <em:description>My first extension.</em:description> <!-- Name of extension's primary developer. Change to your name --> <em:creator>Gomita</em:c...
...And 2 more matches
User Notifications and Alerts - Archive of obsolete content
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 recommended 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 dis
played it. This means that these notifications make the most sense when they are related to the page currently being dis
played, such as a page trying to install an add-on, or a site you just entered a password on. Notification boxes are very easy to create, and are very customizable: let nb = gBrowser.getNotificationBox(); let acceptButton = new Object(); let declineButton = new Object(); let messag...
...box elements can be obtained from the gBrowser object. In this case we don't pass any arguments to getNotificationBox so that we get the notification box that corresponds to the tab currently on display. The appendNotification method takes the message, id, image (32x32), level and buttons. The level argument determines the "strength" of the message, indicated by its background color when it is dis
played. You should look for the level that better fits your message, and use the lowest applicable level, to prevent the user from getting used to dismissing high-level notifications. The buttons are represented by simple JS data objects. This is all explained in detail in the notificationbox page. Notification boxes are designed to be easily dismissed. All notifications have an additional close button...
...hould take into account that it's possible that none of your custom buttons will be clicked. Also, clicking on any of your custom buttons will cause the notification to be immediately closed, so you should only use notification boxes for single-step processes. The Alerts Service This is a very good option when you want to alert users about events without requiring input from them. ...
...And 2 more matches
XUL element attributes - Archive of obsolete content
s needed. equalsize Type: one of the values below This attribute can be used to make the children of the element equal in size. always For a horizontally oriented element, this will make all of its children have the width of the widest child. For a vertically oriented element, this will make its children all have the height of the tallest child. never All of the children are dis
played at the size required by the content or as specified by the width and height attributes or the CSS width and height properties. flags Type: space-separated list of the values below A set of flags used for miscellaneous purposes. Two flags are defined, which may be the value of this attribute. dont-test-empty: For template generated content, the builder will not check that a contai...
... within the same container. Once the default sizes of elements in a box are calculated, the remaining space in the box is divided among the flexible elements, according to their flex ratios. Specifying a flex value of 0 has the same effect as leaving the flex attribute out entirely. height Type: string (representing an integer) The preferred height of the element in pixels. The actual dis
played height may be different if the element or its contents have a minimum or maximum height. The CSS height property may also be used. hidden Type: boolean If set to true, the element is not dis
played. This is similar to setting the CSS display property to 'none'. id Type: unique id A unique identifier so that you can identify the element with. You can use this as a parameter to g...
... an attribute changes in the broadcaster it is also changed in the observer. ordinal Type: string (representing an integer) An integer which specifies the position of the element within its parent. By default, elements appear in the order they appear in the XUL code. The ordinal attribute can be used to change the order. Note the default ordinal for elements is 1. You can retrieve the dis
played order by using the properties of the boxObject of the container. orient Type: one of the values below Used to specify whether the children of the element are oriented horizontally or vertically. The default value depends on the element. You can also use the -moz-box-orient style property. horizontal Child elements of the element are placed next to each other in a row in the order t...
...And 2 more matches
XUL accessibility guidelines - Archive of obsolete content
us and move it if necessary. function moveFocus(element) { if(element == document.commandDispatcher.focusedElement) { document.commandDispatcher.advanceFocus(); return true; } return false; } Changing focus unexpectedly can confuse or disorient users. A common example of this occurrence in the US is with phone number form fields. US phone numbers are often dis
played on the web in two main formats XXX-XXX-XXXX or (XXX) XXX-XXXX. To enforce this pattern some forms provide three form fields. The problem occurs when a developer decides to add functionality that jumps the user to the second form field once 3 digits have been entered into the first form field. This behavior is then repeated for the next form field. Users who are used to navigating form fields them...
...xt="Stop loading the page" /> Title Provide unique titles to window container elements such as windows, wizards, and dialogs. Titles provide users the most basic information about the application. The title is often the first thing spoken by a screen reader when an application is opened or activated. Users can also refer back to the title to get a sense of where they are located. Titles are dis
played in the top bar of an application. View code examples below. <dialog id="print_dialog" title="Print" ...> <window id="mywindow" title="My Application" ...> <wizard id="reg_window" title="Register your software" ...> Form labels Labels are not automatically associated to form elements. Use the control attribute to bind a text label (from a label element) to a form...
...ogy is that it allows people with even the most severe physical limitations to use computers. Some users use mouth sticks or movement detection devices such as eye tracking to type. This process can be slow. Other users need time to cognitively process what is happening in the application. Testing human computer interaction Ensure that help documentation is up to date. Verify that alerts are dis
played through appropriate XUL elements. Ensure the user is informed of any user based errors and that instruction and opportunity for reperforming error causing actions is allowed. Ensure that users have control of response time. Media Audio Informative audio files such as podcasts can be made accessible by supplying a word-for-word transcript. Transcripts should identify the speakers and describe o...
...And 2 more matches
menulist - Archive of obsolete content
To create the drop-down, put a menupopup inside the menulist containing the choices as menuitem elements. The command event may be used to execute code when the menulist selection changes. More information is available in the XUL tutorial. ...
...To create the drop-down, put a menupopup inside the menulist containing the choices as menuitem elements. The command event may be used to execute code when the menulist selection changes. More information is available in the XUL tutorial. ...
...f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disableautoselect Type: boolean If this attribute is true or omitted,...
...And 2 more matches
tabbrowser - Archive of obsolete content
Note: Starting in Firefox 3 (XULRunner/Gecko 1.9), this is only used in the main Firefox window and cannot be used in other XUL windows by third-party applications or extensions. ...
...arkupDocumentViewer This read-only property contains the nsIMarkupDocumentViewer which is responsible for drawing the document. securityUI Type: nsISecureBrowserUI The read-only property holds an object which may be used to determine the security level of the loaded document. selectedBrowser Type: browser element This read-only property returns the currently dis
played browser element. selectedTab Type: tab element A reference to the currently selected tab, which will always be one of the tab elements in the tabs element. Assign a value to this property to modify the currently selected tab. sessionHistory Type: nsISHistory This read-only property contains the nsISHistory object which holds the session history. tabContainer Type...
... in Firefox 3.6; it adds the relatedToCurrent parameter, and allows the parameters to be specified by name, in any order. loadTabs( uris, loadInBackground, replace ) loadTabs( uris, params ) Return type: no return value Loads a set of URIs, specified by the array uris, into tabs. If loadInBackground is true, the tabs are loaded in the background, and if replace is true, the currently dis
played tabs are replaced with the specified URIs instead of adding new tabs. The properties of params are following: boolean inBackground boolean replace boolean allowThirdPartyFixup tab targetTab number newIndex object postDatas number userContextId NOTE: This is the XUL method on <browser> / <tabbrowser>, not the global function in chrome://browser/content/browser.js. Please check ...
...And 2 more matches
toolbar - Archive of obsolete content
the browsing context (window, <iframe> or tab) with the specified name. If the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">window.open() method. More information is available in the XUL tutorial. Note: Starting in Gecko 1.9.1, toolbar items are moved from the toolbarpalette and added to the toolbar when a toolbar is first dis
played. In earlier versions, a copy of each item was created and placed on the toolbar. This means that the palette now only contains items not already in the toolbar. This introduces a potential compatibility problem for extensions that depend on being able to identify all possible toolbar items by looking in the toolbarpalette. Attributes autohide, currentset, customindex, customizable, defaultse...
...r> </toolbox> Attributes autohide Type: boolean When set to true, the toolbar will be invisible unless the Alt key is pressed by the user. When set to false, the default, the toolbar is visible. This only has an effect on Windows and needs to be combined with type="menubar" and a menubar element. currentset Not in SeaMonkey 1.x Type: comma-separated string The current set of dis
played items on the toolbar. This will be modified when the user customizes the toolbar. The value of this attribute should be a comma-separated list of item IDs from the toolbarpalette or, additionally, any of the following strings: "separator", "spring", "spacer". customindex Not in SeaMonkey 1.x Type: integer This value is the index of the toolbar in the list of the custom toolbars. The valu...
...olbar in the list of the custom toolbars. The value is updated automatically by the toolbar customization dialog. customizable Not in SeaMonkey 1.x Type: boolean Set this attribute to true on toolbars that can be customized. This causes the set of buttons to be persisted across sessions. defaultset Not in SeaMonkey 1.x Type: comma-separated list of item ids The default set of dis
played items on the toolbar. This should be set to a comma-separated list of item IDs from the toolbarpalette. For example, back-button,forward-button,print-button. grippyhidden SeaMonkey only Type: boolean When set to true, the grippy will be hidden. When set to false, the default, the grippy will be shown. grippytooltiptext SeaMonkey only Type: string The text to appear on the toolti...
...And 2 more matches
tree - Archive of obsolete content
Unlike other elements, the data to display inside the tree is not specified using tags, but is determined from a view object. ...
...ion Content tree nsITreeView, nsITreeContentView Yes This tree has treeitem elements placed within the treechildren element. In this situation, a content view (which implements the interface nsITreeContentView) which is a more specialized type of view, uses the treeitem elements and their descendants to determine the data to display in the tree. However, the treeitems are not dis
played directly; they are used only as data to the content view. However, the content view will automatically update the tree if treeitems are changed. RDF tree nsITreeView, nsIXULTreeBuilder No This tree is generated from an RDF datasource. It is used when a tree has a datasources attribute, and has dont-build-content in its flags attribute. For this tree, the data comes directly from...
...tters in the item's label. This is done incrementally, so typing more letters with select more specific items. This feature may be disabled by setting this attribute to true. editable Type: boolean Indicates that the cells of the tree may be edited. enableColumnDrag Type: boolean When set to true, the user may drag the column headers around to change the order in which they are dis
played. flags Type: space-separated list of the values below A set of flags used for miscellaneous purposes. Two flags are defined, which may be the value of this attribute. dont-test-empty: For template generated content, the builder will not check that a container is empty. dont-build-content: This flag may be used on a tree to indicate that content elements should not be generated. This...
...And 2 more matches
Handling different text directions - Learn web development
modes? A writing mode in CSS refers to whether the text is running horizontally or vertically. The writing-mode property lets us switch from one writing mode to another. You don't need to be working in a language which uses a vertical writing mode to want to do this -- you could also change the writing mode of parts of your layout for creative purposes. In the example below we have a heading dis
played using writing-mode: vertical-rl. The text now runs vertically. Vertical text is common in graphic design, and can be a way to add a more interesting look and feel to your web design. The three possible values for the writing-mode property are: horizontal-tb: Top-to-bottom block flow direction. Sentences run horizontally. vertical-rl: Right-to-left block flow direction. Sentences run vertic...
... The three possible values for the writing-mode property are: horizontal-tb: Top-to-bottom block flow direction. Sentences run horizontally. vertical-rl: Right-to-left block flow direction. Sentences run vertically. vertical-lr: Left-to-right block flow direction. Sentences run vertically. So the writing-mode property is in reality setting the direction in which block-level elements are dis
played on the page -- either from top-to-bottom, right-to-left, or left-to-right. This then dictates the direction text flows in sentences. Writing modes and block and inline layout We have already discussed block and inline layout, and the fact that some things display as block elements and others as inline elements. As we have seen described above, block and inline is tied to the writing mode of the...
...r left-to-right. This then dictates the direction text flows in sentences. Writing modes and block and inline layout We have already discussed block and inline layout, and the fact that some things display as block elements and others as inline elements. As we have seen described above, block and inline is tied to the writing mode of the document, and not the physical screen. Blocks are only dis
played from the top to the bottom of the page if you are using a writing mode that displays text horizontally, such as English. If we look at an example this will become clearer. In this next example I have two boxes that contain a heading and a paragraph. The first uses writing-mode: horizontal-tb, a writing mode that is written horizontally and from the top of the page to the bottom. The second uses ...
...And 2 more matches
How to build custom form controls - Learn web development
ugh JavaScript. --> <div class="select" tabindex="0"> <!-- This container will be used to display the current value of the control --> <span class="value">Cherry</span> <!-- This container will contain all the options available for our control. Because it's a list, it makes sense to use the ul element. ...
... not exactly required, however it's imperative to ensure active state is visible, especially to keyboard users, that we use it as a default value. */ box-shadow: 0 0 3px 1px #227755; } Now, let's handle the list of options: /* The .select selector here helps to make we only select element inside our control. */ .select .optList { /* This will make sure our list of options will be dis
played below the value and out of the HTML flow */ position : absolute; top : 100%; left : 0; } We need an extra class to handle when the list of options is hidden. This is necessary in order to manage the differences between the active state and the open state that do not exactly match. .select .optList.hidden { /* This is a simple way to hide the list in an accessible way; ...
...sn't work. We'll discuss options to consider and cover the basics in our example (a full discussion of solving this issue for all scenarios would require a book). Just remember, it is vital make your script generic and reusable. In our example, if our JavaScript code isn't running, we'll fall back to displaying a standard <select> element. We include our control and the <select>; which one is dis
played depends on the class of the body element, with the class of the body element being updated by the script that makes the control function, when it loads successfully To achieve this, we need two things: First, we need to add a regular <select> element before each instance of our custom control. There is a benefit to having this "extra" select even if our JavaScript works as hoped: we will use th...
...And 2 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
s than setInterval()/setTimeout(). Interestingly, it is available in Internet Explorer 10 and above. So, unless you need to support older versions of IE, there is little reason to not use requestAnimationFrame(). A simple example Enough with the theory! Let's build your own personal requestAnimationFrame() example. You're going to create a simple "spinner animation"--the kind you might see dis
played in an app when it is busy connecting to the server, etc. Note: In a real world example, you should probably use CSS animations to run this kind of simple animation. However, this kind of example is very useful to demonstrate requestAnimationFrame() usage, and you'd be more likely to use this kind of technique when doing something more complex such as updating the display of a game on each frame...
...ou want to create an old school, 8-bit-style animation? This was a problem, for example, in the Monkey Island-inspired walking animation from our Drawing Graphics article: In this example, you have to animate both the position of the character on the screen, and the sprite being shown. There are only 6 frames in the sprite's animation. If you showed a different sprite frame for every frame dis
played on the screen by requestAnimationFrame(), Guybrush would move his limbs too fast and the animation would look ridiculous. This example therefore throttles the rate at which the sprite cycles its frames using the following code: if (posX % 13 === 0) { if (sprite === 5) { sprite = 0; } else { sprite++; } } So the code only cycles the sprite once every 13 animation frames. ...Actual...
...ake it appear to move slower by only increasing rotateCount by one on each frame, instead of two. Active learning: a reaction game For the final section of this article, you'll create a 2-player reaction game. The game will have two players, one of whom controls the game using the A key, and the other with the L key. When the Start button is pressed, a spinner like the one we saw earlier is dis
played for a random amount of time between 5 and 10 seconds. After that time, a message will appear saying "PLAYERS GO!!" -- once this happens, the first player to press their control button will win the game. Let's work through this: First of all, download the starter file for the app. This contains the finished HTML structure and CSS styling, giving us a game board that shows the two players'...
...And 2 more matches
Website security - Learn web development
urns the injected scripts to a browser. A reflected XSS vulnerability occurs when user content that is passed to the server is returned immediately and unmodified for display in the browser. Any scripts in the original user content will be run when the new page is loaded. For example, consider a site search function where the search terms are encoded as URL parameters, and these terms are dis
played along with the results. An attacker can construct a search link that contains a malicious script as a parameter (e.g., http://mysite.com?q=beer<script%20src="http://evilsite.com/tricky.js"></script>) and email it to another user. If the target user clicks this "interesting link", the script will be executed when the search results are dis
played. As discussed earlier, this gives the attacker all t...
...s this "interesting link", the script will be executed when the search results are dis
played. As discussed earlier, this gives the attacker all the information they need to enter the site as the target user, potentially making purchases as the user or sharing their contact information. A persistent XSS vulnerability occurs when the malicious script is stored on the website and then later redis
played unmodified for other users to execute unwittingly. For example, a discussion board that accepts comments that contain unmodified HTML could store a malicious script from an attacker. When the comments are dis
played, the script is executed and can send to the attacker the information required to access the user's account. This sort of attack is extremely popular and powerful, because the attack...
...d to access the user's account. This sort of attack is extremely popular and powerful, because the attacker might not even have any direct engagement with the victims. While the data from POST or GET requests is the most common source of XSS vulnerabilities, any data from the browser is potentially vulnerable, such as cookie data rendered by the browser, or user files that are uploaded and dis
played. The best defense against XSS vulnerabilities is to remove or disable any markup that can potentially contain instructions to run the code. For HTML this includes elements, such as <script>, <object>, <embed>, and <link>. The process of modifying user data so that it can't be used to run scripts or otherwise affect the execution of server code is known as input sanitization. Many web framework...
...And 2 more matches
PopupNotifications.jsm
to the user. Notification show( browser, id, message, anchorID, mainAction, secondaryActions, options ); Parameters browser The XUL <xul:browser> element with which the notification is associated. This must not be null; you can, however, simply specify gBrowser.selectedBrowser to associate it with the current tab. id A unique ID string for the type of notification being dis
played. For example, Geolocation related notifications have the ID "geolocation". Only one notification for each ID can be visible at a time; if one with the specified ID already exists, it will be replaced with the newer notification. message A string to display in the notification panel. anchorID The ID of the element that should serve as the anchor for the notification popup (that is, the element...
...ties for the notification. See Notification options below for details. Return value Returns the Notification object corresponding to the added notification. Notification actions Notification action objects describe the user interface for actions associated with the notification. The main action is used to describe the button presented in the notification panel, while secondary actions are dis
played in the drop-down menu associated with the button. A notification action object must contain the following properties: label A text label describing the action. accessKey A string indicating the keystroke that will trigger the action. callback A JavaScript function to be invoked when the action is selected by the user. Notification options The notification options object lets you furth...
...meter set to true will be removed when they would have otherwise been dismissed (i.e. any time the popup is closed due to user interaction). removeOnDismissal Notifications with this parameter set to true will be removed when they would have otherwise been dismissed (that is, any time the popup is closed due to user interaction). popupIconURL A string specifying the URL of the image to be dis
played in the popup. This is normally specified in CSS using list-style-image and the .popup-notification-icon[popupid=...] selector. learnMoreURL A string URL. Setting this property will make the prompt display a "Learn More" link that, when clicked, opens the URL in a new tab. Notification events If you specify an event callback using the options parameter when calling show(), the callback functi...
...And 2 more matches
Plug-in Basics - Plugins
ugin object that represents the plug-in that is configured for the specified MIME type. You might need to know which plug-in is configured for a MIME type, for example, to dynamically create an object element on the page if the user has a plug-in configured for the MIME type. The following example uses JavaScript to determine whether the Adobe Flash plug-in is installed. If it is, a movie is dis
played. // Can we display Adobe Flash movies? var mimetype = navigator.mimeTypes["application/x-shockwave-flash"]; if (mimetype) { // Yes, so can we display with a plug-in? var plugin = mimetype.enabledPlugin; if (plugin) { // Yes, so show the data in-line document.writeln("Here\'s a movie: <object data='mymovie.swf' height='100' width='100'></object>"); } else { // No, s...
...native window on a web page. Windowed plug-ins are opaque and always come to the top HTML section of a web page. A windowless plug-in need not be drawn in a native window; it is drawn in its own drawing target. Windowless plug-ins can be opaque or transparent, and can be invoked in HTML sections. Whether a plug-in is windowed or windowless depends on how you define it. The way plug-ins are dis
played on the web page is determined by the HTML element that invokes them. This is up to the content developer or web page author. Depending on the element and its attributes, a plug-in can be visible or hidden, or can appear as part of a page or as a full page in its own window. A web page can display a windowed or windowless plug-in in any HTML display mode; however, the plug-in must be visible for i...
...plug-in must be visible for its window type to be meaningful. For information about the way HTML determines plug-in display mode, see "Using HTML to Display Plug-ins." Using HTML to Display Plug-Ins When a user browses to a web page that invokes a plug-in, how the plug-in appears (or does not appear) depends on two factors: The way the developer writes the plug-in determines whether it is dis
played in its own window or is windowless. The way the content provider uses HTML elements to invoke the plug-in determines its display mode: whether it is embedded in a page, is part of a section, appears on its own separate page, or is hidden. This section discusses using HTML elements and display modes. For information about windowed and windowless operation, see Windowed and Windowless Plug-ins. ...
...And 2 more matches
AudioBufferSourceNode - Web APIs
The AudioBufferSourceNode interface is an AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being
played from disk or the network. To play sounds which require accurate timing but must be streamed from the network or
played from disk, use a AudioWorkletNode to implement its playback. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" vi...
.../text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} An AudioBufferSourceNode has no inputs and exactly one output, which has the same number of channels as the AudioBuffer indicated by its buffer property. If there's no buffer set--that is, if buffer is null--the output contains a single channel of silence (every sample is 0). An AudioBufferSourceNode can only be
played once; after each call to start(), you have to create a new node if you want to play the same sound again. Fortunately, these nodes are very inexpensive to create, and the actual AudioBuffers can be reused for multiple plays of the sound. Indeed, you can use these nodes in a "fire and forget" manner: create the node, call start() to begin playing the sound, and don't even bother to hold a referenc...
...Channel count defined by the associated AudioBuffer Constructor AudioBufferSourceNode() Creates and returns a new AudioBufferSourceNode object. An AudioBufferSourceNode can be instantiated using the AudioContext.createBufferSource() method. Properties Inherits properties from its parent, AudioNode. AudioBufferSourceNode.buffer An AudioBuffer that defines the audio asset to be
played, or when set to the value null, defines a single channel of silence (in which every sample is 0.0). AudioBufferSourceNode.detune Is a k-rate AudioParam representing detuning of playback in cents. This value is compounded with playbackRate to determine the speed at which the sound is
played. Its default value is 0 (meaning no detuning), and its nominal range is -? to ?. AudioBufferSourceNode.lo...
...And 2 more matches
HTMLMediaElement - Web APIs
t the browser has buffered (if any) at the moment the buffered property is accessed. HTMLMediaElement.controller Is a MediaController object that represents the media controller assigned to the element, or null if none is assigned. HTMLMediaElement.controls Is a Boolean that reflects the controls HTML attribute, indicating whether user interface items for controlling the resource should be dis
played. HTMLMediaElement.controlsList Read only Returns a DOMTokenList that helps the user agent select what controls to show on the media element whenever the user agent shows its own set of controls. The DOMTokenList takes one or more of three possible values: nodownload, nofullscreen, and noremoteplayback. HTMLMediaElement.crossOrigin A DOMString indicating the CORS setting for this media elemen...
...number between 512 and 16384. Using any other size results in an exception being thrown. The best time to set a new length is after the loadedmetadata event fires, when the audio info is known, but before the audio has started or MozAudioAvailable events have begun firing. HTMLMediaElement.mozSampleRate Read only Returns a double representing the number of samples per second that will be
played. For example, 44100 samples per second is the sample rate used by CD audio. HTMLMediaElement.muted Is a Boolean that determines whether audio is muted. true if the audio is muted and false otherwise. HTMLMediaElement.networkState Read only Returns a unsigned short (enumeration) indicating the current state of fetching the media over the network. HTMLMediaElement.paused Read only Returns a...
...ue if the audio is muted and false otherwise. HTMLMediaElement.networkState Read only Returns a unsigned short (enumeration) indicating the current state of fetching the media over the network. HTMLMediaElement.paused Read only Returns a Boolean that indicates whether the media element is paused. HTMLMediaElement.playbackRate Is a double that indicates the rate at which the media is being
played back. HTMLMediaElement.
played Read only Returns a TimeRanges object that contains the ranges of the media source that the browser has
played, if any. HTMLMediaElement.preload Is a DOMString that reflects the preload HTML attribute, indicating what data should be preloaded, if any. Possible values are: none, metadata, auto. HTMLMediaElement.preservesPitch Is a Boolean that determines if t...
...And 2 more matches
Ordering Flex Items - CSS: Cascading Style Sheets
ine relates to writing modes. The row-related examples above demonstrate how row and row-reverse work in a left-to-right language such as English. If you are working in a right-to-left language like Arabic then row would start on the right, row-reverse on the left. This can seem like a neat way to display things in reverse order however you should be mindful that the items are only visually dis
played in reverse order. The specification says the following on this matter: "Note: The reordering capabilities of flex layout intentionally affect only the visual rendering, leaving speech order and navigation based on the source order. This allows authors to manipulate the visual presentation while leaving the source order intact for non-CSS UAs and for linear models such as speech and sequential n...
...an see how the tab order continues to follow the order that the items are listed in the source. In the same way that changing the value of flex-direction does not change the order in which items are navigated to, changing this value does not change paint order. It is a visual reversal of the items only. The order property In addition to reversing the order in which flex items are visually dis
played, you can target individual items and change where they appear in the visual order with the order property. The order property is designed to lay the items out in ordinal groups. What this means is that items are assigned an integer that represents their group. The items are then placed in the visual order according to that integer, lowest values first. If more than one item has the same integer ...
...al order according to that integer, lowest values first. If more than one item has the same integer value, then within that group the items are laid out as per source order. As an example, I have 5 flex items, and assign order values as follows: Source item 1: order: 2 Source item 2: order: 3 Source item 3: order: 1 Source item 4: order: 3 Source item 5: order: 1 These items would be dis
played on the page in the following order: Source item 3: order: 1 Source item 5: order: 1 Source item 1: order: 2 Source item 2: order: 3 Source item 4: order: 3 You can play around with the values in this live example below and see how that changes the order. Also, try changing flex-direction to row-reverse and see what happens -- the start line is switched so the ordering begins from the o...
...And 2 more matches
Creating a cross-browser video player - Developer guides
ch informs the browser that it should initially only attempt to load the metadata from the video file rather than the entire video file. This provides the player with data such as video duration and format. Note: IE9 behaves differently than most other browsers when a poster attribute is set. Most browsers interpret the presence of a poster attribute to mean that the specified image is to be dis
played until the user chooses to play the video. IE9 will only use the specified poster image in this way if preload="none" is set; otherwise, it will take the first still of the video and display that instead. Three different video sources are provided for the player: MP4, WebM, and Ogg. Using these different source formats gives the best chance of being supported across all browsers that support HTM...
...source formats gives the best chance of being supported across all browsers that support HTML5 video. For further information on video formats and browser compatibility, see supported media formats. For browsers that do not support HTML5 video, a Flash player is provided that will allow playback of the MP4 video source, provided the end user has Flash installed. In addition a download link is dis
played to allow users to download the MP4 video file, should they wish to (providing those without Flash installed with a method of viewing the video, a fallback for a fallback if you like). The code above would allow playback of the video in most browsers, using the browser's default control set. The next step is to define a custom control set, also in HTML, which will be used to control the video. T...
...deo, it's time to set up the custom controls. ...
...And 2 more matches
<table>: The Table element - HTML: Hypertext Markup Language
t accepts flow content Implicit ARIA role table Permitted ARIA roles Any DOM interface HTMLTableElement Attributes This element includes the global attributes. Deprecated attributes align This enumerated attribute indicates how the table must be aligned inside the containing document. It may have the following values: left: the table is dis
played on the left side of the document; center: the table is dis
played in the center of the document; right: the table is dis
played on the right side of the document. Set margin-left and margin-right to auto or margin to 0 auto to achieve an effect that is similar to the align attribute. bgcolor The background color of the table. It is a 6-digit hexadecimal RGB code, prefixed by a '#'. ...
...used. To achieve a similar effect, use the CSS background-color property. border This integer attribute defines, in pixels, the size of the frame surrounding the table. If set to 0, the frame attribute is set to void. To achieve a similar effect, use the CSS border shorthand property. cellpadding This attribute defines the space between the content of a cell and its border, dis
played or not. If the cellpadding's length is defined in pixels, this pixel-sized space will be applied to all four sides of the cell's content. If the length is defined using a percentage value, the content will be centered and the total vertical space (top and bottom) will represent this value. The same is true for the total horizontal space (left and right). To achieve a similar effect, apply the b...
...ft of the table and the first column, the right of the table and the last column and the bottom of the table and the last row. To achieve a similar effect, apply the border-spacing property to the <table> element. border-spacing does not have any effect if border-collapse is set to collapse. frame This enumerated attribute defines which side of the frame surrounding the table must be dis
played. ...
...And 2 more matches
panel - Archive of obsolete content
File: data.url("get-text.js") }); // Create a button require("sdk/ui/button/action").ActionButton({ id: "show-panel", label: "Show Panel", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onClick: handleClick }); // Show the panel when the user clicks the button. function handleClick(state) { textEntryPanel.show(); } // When the panel is dis
played it generated an event called // "show": we will listen for that event and when it happens, // send our own "show" event to the panel's script, so the // script can prepare the panel for display. textEntryPanel.on("show", function() { textEntryPanel.port.emit("show"); }); // Listen for messages called "text-entered" coming from // the content script. The message payload is the text the user // ...
...: data.url("text-entry.html") }); // Create a button require("sdk/ui/button/action").ActionButton({ id: "show-panel", label: "Show Panel", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onClick: handleClick }); // Show the panel when the user clicks the button. function handleClick(state) { textEntryPanel.show(); } // When the panel is dis
played it generated an event called // "show": we will listen for that event and when it happens, // send our own "show" event to the panel's script, so the // script can prepare the panel for display. textEntryPanel.on("show", function() { textEntryPanel.port.emit("show"); }); // Listen for messages called "text-entered" coming from // the content script. The message payload is the text the user // ...
... If the panel's content is packaged along with your add-on and specified using an HTML file in your data directory, you can style it by embedding CSS directly in the HTML file or by referencing a CSS file stored under data: <!DOCTYPE HTML> <html> <head> <link href="panel-style.css" type="text/...
...ontentScriptOptions object Read-only value exposed to content scripts under addon.options property. Any kind of jsonable value (object, array, string, etc.) can be used here. Optional. contextMenu boolean New in Firefox 33 Whether to show a context menu when the user context-clicks in the panel. The context menu will be the same one that's dis
played in web pages. Optional, defaults to false. onMessage function Include this to listen to the panel's message event. onShow function Include this to listen to the panel's show event. onHide function Include this to listen to the panel's hide event. Panel The Panel object represents a floating modal dialog that can b...
Extension Versioning, Update and Compatibility - Archive of obsolete content
out what is new in an updated version of your add-on. This is visible when the user gets an add-on update notification and should be used to give a quick overview of what new features have been added and any security issues that have been resolved. In order to do this you must add an updateInfoURL entry to the update manifest (see the example above). The page at this URL will be retrieved and dis
played to the user. Since it is being dis
played outside of a normal webpage context it is heavily sanitized, which means there are few formatting options available and scripting and images aren't allowed. The information page retrieved must currently be totally valid XHTML, including being delivered with the MIME type application/xhtml+xml (Important: see Problems section) You may include %APP_LOCALE%...
...s are interpreted normally: h1, h2 and h3 for general headings p, div, pre and blockquote for block formatting ul, ol, li, dl, dt and dd for lists b, i, em, strong, u, q, sub, sup and code for text formatting br and hr for line breaking The head, style and script tags and any of their contents are completely stripped. ...
...See image below. The problem is because of MIME type that should be set in the server fo...
...See image below. The problem is because of MIME type that should be set in the server for xhtml extension. If you are running Apache Server, you might consider adding AddType application/xhtml+xml .xhtml to the .htacess file. ...
The Essentials of an Extension - Archive of obsolete content
re just notation, and they're just common practice. As long as your id has some uniqueness to it, it's OK to use either form. <em:name>XUL School Hello World</em:name> <em:description>Welcome to XUL School!</em:description> <em:version>0.1</em:version> <em:creator>Appcoast</em:creator> <em:homepageURL>https://developer.mozilla.org/docs/XUL_School</em:homepageURL> This is the data that is dis
played before and after the extension is installed, that you can see in the Add-ons Manager. There are many other tags that can be added, for contributors and translators. The full specification of the install.rdf file has all the details. Since extensions can be translated to multiple languages, it is often necessary to translate the extension's description, or even its name. A localized description a...
...on your location bar and press ENTER. Surprised? You just opened the Downloads window in a Firefox tab! You can access any chrome file by just typing its URI in the location bar. This can come in handy if you want to inspect script files that are part of Firefox, other extensions, or your own. Most of these files are opened as text files, with the exception of XUL files, which are executed and dis
played like you would normally see them on a window. Content There are 2 files in the content directory. Let's look at the XUL file first. XUL files are XML files that define the user interface elements in Firefox and Firefox extensions. XUL was inspired by HTML, so you'll see many similarities between the two. However, XUL is also an improvement over HTML, having learned from many of the mistakes ma...
...(Document Object Model) in order to manipulate the XUL document. First we get a reference of the stringbundle element in the document. This is a special element that allows us to obtain localized strings dynamically, by only providing a "key" that identifies the string. This is what we do on the second line. We call the getString method of the bundle element and get the localized message to be dis
played. We then call the window.alert function with the message, just like we would do in an HTML document. Locale There are two types of locale files: DTD and properties, and in this example we use them both. DTD is the most efficient way of showing text in XUL, so you should use it whenever possible. It is somewhat inflexible so it can't be used for dynamically generated text, hence the need for an ...
...path in the location bar and inspect the file if you're curious. This covers all of the files in the Hello World extension. Now you should have an idea of the basics involved in extension development, so now we'll jump right in and set up a development environment. But first, a little exercise. Exercise Make the following changes to the example extension: Edit the welcome message that is dis
played in the alert window. Move the Hello World menu to the Tools menu, where it belongs. Repackage the XPI. Issue the following command from within the extension root directory on Linux or Mac OS X: zip -r ../xulschoolhello2.xpi * On Windows, use a ZIP tool to compress all files and subdirectories within the extension root directory. Name the file with extension .xpi Re-install the XPI. You can...
Defining Cross-Browser Tooltips - Archive of obsolete content
appear as a "tooltip" above images, but that's not how it was meant to be used. Learn how to define "tooltips" in a cross-browser, standards-friendly way. Authors are used to using the alt attribute to create "tooltips" in Web browsers. The classic example is a "tooltip" of an image; when the user pauses the mouse pointer over an image, the contents of the alt attribute are dis
played as a "tooltip." Gecko-based browsers such as Mozilla, Netscape 6+, and Compuserve 7 do not support this behavior. See bug 25537 for a lengthy, sometimes passionate discussion of Gecko's behavior in this regard. The Problem According to the HTML 4.01 definition of the alt attribute: alt = text CS For user agents that cannot display images, forms, or applets, this attribute specifies alternat...
...5537 for a lengthy, sometimes passionate discussion of Gecko's behavior in this regard. The Problem According to the HTML 4.01 definition of the alt attribute: alt = text CS For user agents that cannot display images, forms, or applets, this attribute specifies alternate text. The language of the alternate text is specified by the lang attribute. ...
... CS For user agents that cannot display images, forms, or applets, this attribute specifies alternate text. The language of the alternate text is specified by the lang attribute. In other words, alt text should only be dis
played when a user agent cannot display the primary content of the element (e.g., a text-mode browser that cannot display images). In a visual browser, the image should be dis
played and the alt text should not. This assumes that the browser can find the image and that it supports the image format used; if either of these is not true, and the image cannot be dis
played, then the alt text should be dis
played in place of the missing image. On the other hand, the HTML 4.01 definition of the title attribute states: title = text CS This attribute offers advisory information ab...
...hese 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 intended purposes, instead of adhering to their historical misuses. A quick check of various user agents showed that title attribute contents were dis
played 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 this behavior. Authors who are faced with the prospect of editing a large collection of legacy documents should be able to convert their documents usi...
Tamarin Build System Documentation - Archive of obsolete content
When all of the slave machines are free they all start the first build phase simultaneously. ...
... When all of the slave machines are free they all start the first build phase simultaneously. ...
... When all of the slave machines are free they all start the first build phase simultaneously. ...
....mozilla.org/build_trigger/requestbuild.cfm Enter the repository url, revision number, email address, and description. ...
textbox (Toolkit autocomplete) - Archive of obsolete content
mber of characters that the textbox allows to be entered. maxrows Type: integer The number of rows to show in the results list at a time. A scrollbar will appear so the user can scroll through the remaining items. minresultsforpopup New in Thunderbird 3Requires SeaMonkey 2.0 Type: integer The minimum number of results that must be returned for the popup to be dis
played. The default value is 1. New in Thunderbird 3Requires SeaMonkey 2.0 A zero value will always open the popup. This can be used to display additional items that are not autocomplete results. nomatch Type: boolean This attribute will be set to true if the last search resulted in no matches. Overview An onchange attribute is an event listener to the object for the Event change. A chang...
...there.is.only.xul"> <script type="text/javascript"> function myFunction(e){ /* Do something cool here or just say the below */ alert(e.target.nodeName); } </script> <textbox id="find-text" onchange="return myFunction(event);"/> </window> oninput Type: script code This event is sent when a user enters text in a textbox. This event is only called when the text dis
played would change, thus it is not called when the user presses non-displayable keys. onsearchbegin Type: script code This event handler is called when the autocomplete search begins. Note: For Firefox 12 and above, this event handler must be set as an initial attribute. onsearchcomplete New in Thunderbird 3Requires SeaMonkey 2.0 Type: script code This event handler is called when t...
...not specified, the comment column doesn't appear. showimagecolumn Type: boolean If true, an image column appears in the popup. There is no default styling of this image, but the class name returned by the results appears in the property list for the column. If this attribute is not specified, the image column doesn't appear. size Type: integer The number of characters that can be dis
played in the textbox. tabindex Type: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. tabscrolling New in Thunderbird 3Requires SeaMonkey 2.0 Type: boolean If true, the user may cycle through the results list by pressing the Tab key. If false,...
... to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. completeDefaultIndex New in Thunderbird 3Requires SeaMonkey 2.0 Type: boolean Gets and sets the value of the completedefaultindex attribute. controller Type: nsIAutoCompleteController Returns the controller for the ...
Custom Tree Views - Archive of obsolete content
Note: The tree-related interfaces changed in Gecko 1.8. ...
...d in the tree. Creating a Custom View So far, we have only been using the built-in content tree view. In this section, we will look at creating a custom view. This is necessary when the page has a lot of data or that data is highly nested. For instance, 5000 rows of treeitems would load too slowly. You might also implement a custom view when you want to perform computations on the data to be dis
played. Since the view can store and retrieve the data in the most suitable manner for the kind of data used, the tree can be used even when there are hundreds of thousands of rows to be dis
played. Note: The tree-related interfaces changed in Gecko 1.8. See Tree Widget Changes for details. To implement a custom view, you will need to create an object which implements the nsITreeView interface. You can...
... and treecell elements will have no purpose since the custom view will get its data from elsewhere. Thus, you can just leave the treechildren element empty. The following example shows this: <tree id="my-tree" flex="1"> <treecols> <treecol id="namecol" label="Name" flex="1"/> <treecol id="datecol" label="Date" flex="1"/> </treecols> <treechildren/> </tree> To assign data to be dis
played in the tree, the view object needs to be created which is used to indicate the value of each cell, the total number of rows plus other optional information. The tree will call methods of the view to get the information that it needs to display. In general, although the tree view has thirty or so functions that may be implemented, you only need to implement the ones that the tree will call. Three...
...e getCellText() function. The setView() function has been called in the onload() handler for the window, but you could also set the view later if you wish. You can change the view at any time. One thing to note is that the getCellText() function is only called when necessary to display the contents. In the 10,000 row example above, getCellText() is only called for the cells that are currently dis
played. In the image, only seven rows are dis
played, the last only partially, so getCellText() will be called only 14 times, one for each row and column. It is called for other rows when the user scrolls through them. This makes the tree much more efficient. Note that the view object is also available for trees using the built-in content view. You can use this to get the cell labels and other informati...
Property Files - Archive of obsolete content
For this purpose, property files can be used. ...
...alongside the DTD files with a .properties extension. Properties in the file are declared with the syntax name=value. An example is shown below: notFoundAlert=No files were found matching the criteria. deleteAlert=Click OK to have all your files deleted. resultMessage=%2$S files found in the %1$S directory. Here, the property file contains three properties. These would be read by a script and dis
played to the user. A property file can also include comments. A line that begins with a hash sign ('#') is treated as a comment: # This is a comment welcomeMessage=Hello, world! # This is another comment goodbyeMessage=Come back soon! Stringbundles You could write the code to read properties yourself, however XUL provides the stringbundle element which does this for you. The element has a number of fu...
...stringbundle id="strings" src="strings.properties"/> </stringbundleset> Including this element will read the properties from the file 'strings.properties' in the same directory as the XUL file. Use a chrome URL to read a file from the locale: <stringbundleset id="stringbundleset"> <stringbundle id="strings" src="chrome://myplugin/locale/strings.properties"/> </stringbundleset> Like other non-dis
played elements, you should declare all your stringbundles inside a stringbundleset element so that they are all kept together. Getting a String from the Bundle This stringbundle element has a number of properties. The first is getString which can be used in a script to read a string from the bundle. var strbundle = document.getElementById("strings"); var nofilesfound=strbundle.getString("notFoundAlert"...
...om the bundle. var strbundle = document.getElementById("strings"); var nofilesfound=strbundle.getString("notFoundAlert"); alert(nofilesfound); This example first gets a reference to the bundle using its id Then, it looks up the string 'notFoundAlert' in the property file. The function getString() returns the value of the string or null if the string does not exist. Finally, the string is dis
played in an alert box. Text Formatting The next method is getFormattedString(). This method also gets a string with the given key name from the bundle. In addition, each occurrence of formatting code (e.g. %S) is replaced by each successive element in the supplied array. var dir = "/usr/local/document"; var count = 10; var strbundle = document.getElementById("strings"); var result = strbundle.getForm...
XBL Example - Archive of obsolete content
Navigation buttons along the bottom will allow the user to cycle through the objects while a text widget between the buttons will display the current page. You could put anything within the pages, however, this widget might be useful for a set of images. We'll call this a slideshow element. ...
...ed as the first page of the deck. The label widget has not appeared as no value has been specified for it. We could set a value, but instead it will calculated later. page Property Next, a property that holds the current page will be added. When getting this custom property, it will need to retrieve the value of the selectedIndex attribute of the deck, which holds the number of the currently dis
played page. Similarly, when setting this property, it will need to change the selectedIndex attribute of the deck. In addition, the text widget will need to be updated to display which page is the current one. <property name="page" onget="return parseInt(document.getAnonymousNodes(this)[0].childNodes[0].getAttribute('selectedIndex'));" onset="return this.setPage(val);"/> The page property ge...
...hould not change to a value earlier than the first page. if (newidx>=totalpages) return totalpages; If the new index is after the last page, don't change the page and return the last page's index. The page should not change to one after the last page. thedeck.setAttribute("selectedIndex",newidx); Change the selectedIndex attribute on the deck. This causes the requested page to be dis
played. document.getAnonymousNodes(this)[0].childNodes[1].childNodes[1].setAttribute("value",(newidx+1)+" of "+totalpages); This line modifies the label element so that it displays the current page index. The label element can be retrieved by getting the first element of anonymous content (the vertical box), the second child of that label element (the horizontal box), and then the second element ...
...nt (the vertical box), the second child of that label element (the horizontal box), and then the second element of that box. The value attribute is changed to read '1 of 3' or something similar. Note that one is added to the index because indicies start at 0. Constructor We will also need a constructor to initialize the label element so that it displays correctly when the slideshow is first dis
played. We use similar code as to the method above to set the page number. The reference to 'this.page' will call the onget script of the page property, which in turn will retrieve the initial page from the selectedIndex attribute. <constructor> var totalpages=this.childNodes.length; document.getAnonymousNodes(this)[0].childNodes[1].childNodes[1] .setAttribute("value",(this.page+1)+" of "...
datepicker - Archive of obsolete content
tic behavior when the date is changed using the keyboard instead of the mouse. To avoid this, you can use the workaround described here, i.e., use window.setTimeout(actual-event-handler-function, 0); to queue up your event handler to run after the rest of the picker's change event handlers. A monthchange event is fired for the grid and popup datepickers whenever a new month is navigated to or dis
played. Attributes disabled, firstdayofweek, readonly, type, tabindex, value Properties date, dateLeadingZero, dateValue, disabled, month, monthLeadingZero, open, readOnly, tabIndex, value, year, yearLeadingZero Examples <datepicker type="grid" value="2007-03-26"/> Attributes disabled Type: boolean Indicates whether the element is disabled or not. If this attribute is set, the e...
... grid. value Type: string The initial value of the datepicker in the form YYYY-MM-DD. Properties date Type: integer The currently selected date of the month from 1 to 31. Set this property to change the selected date. dateLeadingZero Type: boolean A read only value indicating whether a leading zero should be dis
played before the date when it is less than 10. dateValue Type: Date The date that is currently entered or selected in the datepicker as a Date object. disabled Type: boolean Gets and sets the value of the disabled attribute. month Type: integer The currently selected month from 0 to 11. Set this property to change the selected mon...
... selected in the datepicker as a Date object. disabled Type: boolean Gets and sets the value of the disabled attribute. month Type: integer The currently selected month from 0 to 11. Set this property to change the selected month. monthLeadingZero Type: boolean A read only value indicating whether a leading zero should be dis
played before the month when it is less than 10. open Type: boolean For popup type datepickers, specifies whether the popup is open. Set this property to open or close the popup. For non-popup datepickers, this property is always false. readOnly Type: boolean If set to true, then the user cannot modify the value of the element. tabIndex Ty...
...d date in the form YYYY-MM-DD. Unlike the month property, months in this value range from 01 to 12. Set this property to change the selected date. year Type: integer The currently selected year from 1 to 9999. Set this property to change the selected year. yearLeadingZero Type: boolean A read only value indicating whether a leading zero should be dis
played before the year when it is less than 1000. Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElem...
description - Archive of obsolete content
ion, it will wrap to multiple lines. It may contain arbitrary markup, which can be styled as needed. More information is available in the XUL tutorial. Attributes crop, disabled, tabindex value Properties accessibleType, crop, disabled, tabIndex, value Style classes header, indent, monospace, plain, small-margin Examples This is a long section of text that will word wrap when dis
played <description> This is a long section of text that will word wrap when dis
played. </description> This is a long section of text that will not word wrap <description value="This is a long section of text that will not word wrap"> </description> This is a long section of dynamically controlled text that will word wrap <description id="desc" style="width: 300px"></description> document.getEleme...
...f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or ...
... to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. crop Type: string Gets and sets the value of the crop attribute. disabled Type: boolean Gets and sets the value of the disabled attribute. tabIndex Type: integer Gets and ...
...ode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes header A class used for headings. Typically, this will cause the text to appear bold. indent This class causes the text to be indented on its left side. monospace This class causes the text to be dis
played in a monospace font. plain This class causes the element to be dis
played with no border or margin. small-margin This class causes the text to be dis
played with a smaller margin. Related label ...
listbox - Archive of obsolete content
to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. currentIndex Type: integer Set to the index of the currently focused item in the list. If no item is focused, the value will be -1. (or, on some platforms, typeof(listboxcurrentIndex) will be undefined) In a single selection list, the curr...
...ds it to the end of the existing list of items. You may optionally set a value. The function returns the newly created element. clearSelection() Return type: no return value Deselects all of the items. A select event is sent before the items are deselected. ensureElementIsVisible( element ) Return type: no return value If the specified element is not currently visible to the user, the dis
played items are scrolled so that it is. If the item is already visible, no scrolling occurs. ensureIndexIsVisible( index ) Return type: no return value If the item at the specified index is not currently visible to the user the dis
played items are scrolled so that it is. If the item is already visible, no scrolling occurs. getIndexOfFirstVisibleRow() Return type: integer Returns the index of th...
...scrolled so that it is. If the item is already visible, no scrolling occurs. ensureIndexIsVisible( index ) Return type: no return value If the item at the specified index is not currently visible to the user the dis
played items are scrolled so that it is. If the item is already visible, no scrolling occurs. getIndexOfFirstVisibleRow() Return type: integer Returns the index of the first dis
played row. Note that this is not the same as the first row -- if the dis
played items have been scrolled down, this function will retrieve the index of the first row that the user can see. getIndexOfItem( item ) Return type: integer Returns the zero-based position of the specified item. Items are numbered starting at the first item dis
played in the list. getItemAtIndex( index ) Return type: eleme...
... getSelectedItem( index ) Return type: element When multiple items are selected, you can retrieve each selected item using this method. The argument index specifies the index in the list of the selected items, not the row number of the item. The item index is zero-based, thus this example will return the first selected item: getSelectedItem(0). ...
menu - Archive of obsolete content
This element is also used to create submenus. More information is available in the XUL tutorial. ...
...f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or n...
... to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. control Type: menu element Returns the enclosing menu that the item is inside, if any, or null if there is no enclosing menu. itemCount Type: integer Read only property holding the number of child items. menupopup Type: menu...
...uteNS(), setUserData appendItem( label, value ) Return type: element Creates a new item and adds it to the end of the existing list of items. You may optionally set a value. The function returns the newly created element. getIndexOfItem( item ) Return type: integer Returns the zero-based position of the specified item. Items are numbered starting at the first item dis
played in the list. getItemAtIndex( index ) Return type: element Returns the element that is at the specified index. insertItemAt( index, label, value ) Return type: element This method creates a new item and inserts it at the specified position. You may optionally set a value. The new item element is returned. removeItemAt( index ) Return type: element Re...
richlistbox - Archive of obsolete content
to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. currentIndex Type: integer Set to the index of the currently focused item in the list. If no item is focused, the value will be -1. (or, on some platforms, typeof(listboxcurrentIndex) will be undefined) In a single selection list, the cu...
... it to the end of the existing list of items. You may optionally set a value. The function returns the newly created element. clearSelection() Return type: no return value Deselects all of the items. A select event is sent before the items are deselected. ensureElementIsVisible( element ) Return type: no return value If the specified element is not currently visible to the user, the dis
played items are scrolled so that it is. If the item is already visible, no scrolling occurs. ensureIndexIsVisible( index ) Return type: no return value If the item at the specified index is not currently visible to the user the dis
played items are scrolled so that it is. If the item is already visible, no scrolling occurs. getIndexOfFirstVisibleRow() Return type: integer Returns the index of ...
...rolled so that it is. If the item is already visible, no scrolling occurs. ensureIndexIsVisible( index ) Return type: no return value If the item at the specified index is not currently visible to the user the dis
played items are scrolled so that it is. If the item is already visible, no scrolling occurs. getIndexOfFirstVisibleRow() Return type: integer Returns the index of the first dis
played row. Note that this is not the same as the first row -- if the dis
played items have been scrolled down, this function will retrieve the index of the first row that the user can see. getIndexOfItem( item ) Return type: integer Returns the zero-based position of the specified item. Items are numbered starting at the first item dis
played in the list. getItemAtIndex( index ) Return type: ele...
... getSelectedItem( index ) Return type: element When multiple items are selected, you can retrieve each selected item using this method. The argument index specifies the index in the list of the selected items, not the row number of the item. The item index is zero-based, thus this example will return the first selected item: getSelectedItem(0). ...
textbox - Archive of obsolete content
The multiline attribute can be specified to display a field with multiple rows. More information is available in the XUL tutorial. ...
...TML <input> element and once in the context of the <textbox> element itself. As of Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10), the script code only runs in the context of the <textbox> element, matching the behavior of all other event handlers. oninput Type: script code This event is sent when a user enters text in a textbox. This event is only called when the text dis
played would change, thus it is not called when the user presses non-displayable keys. placeholder Type: string A string that appears in the textbox when it has no value. preference Type: id Connects the element to a corresponding preference. This attribute only has any effect when used inside a prefwindow. More information is available in the Preferences System article. readonl...
...lement, use the getRowCount method. searchbutton Type: boolean If true, the search field will only fire a command event when the user presses the search button or presses the Enter key. Otherwise, the command event is fired whenever the user modifies the value. This attribute only applies to textboxes with the type search. size Type: integer The number of characters that can be dis
played in the textbox. spellcheck Type: boolean If true, spell checking is enabled by default for the text box; if false, spell checking is disabled by default. If not specified, this defaults to false The HTML The spellcheck attribute uses values of true or false (you cannot simply add the spellcheck attribute to a given element): <!-- spellcheck everything! --> <input type="text" spellc...
...moveEventListener(), 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. plain This class causes the element to be dis
played with no border or margin. Notes The maxlength attribute does not work when in multiline mode. A workaround using JavaScript and the onkeypress event handler as shown in abstract below may be your solution. The XUL script: <textbox id="pnNote" multiline="true" rows="2" cols="70" onkeypress="return pnCountNoteChars(event);"/> The Javascript: function pnCountNoteChars(evt) { //allow non ch...
timepicker - Archive of obsolete content
e: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. value Type: string The initial value of the timepicker in either the form HH:MM:SS or HH:MM. Properties amIndicator Type: string The string value dis
played for hours between midnight and noon, defaulting to AM. This value is determined from the user's locale. dateValue Type: Date The date that is currently entered or selected in the datepicker as a Date object. disabled Type: boolean Gets and sets the value of the disabled attribute. hideSeconds Type: boolean Indicates whether ...
... sets the value of the disabled attribute. hideSeconds Type: boolean Indicates whether the seconds field is visible or not. hour Type: integer The currently selected hour from 0 to 23. Set this property to change the selected hour. hourLeadingZero Type: boolean A read only value indicating whether a leading zero should be dis
played before the hour when it is less than 10. increment Type: integer Gets and sets the value of the increment attribute. is24HourClock Type: boolean A read only value indicating whether a 12-hour or 24-hour clock is used to display times. With a 12-hour clock, an extra field allows the user to pick between AM and PM. This value is determined from the us...
...he user's locale. isPM Type: boolean If false, the hour is between 0 and 11, and if true, the hour is 12 or greater. minute Type: integer The currently selected minute from 0 to 59. Set this property to change the selected minute. minuteLeadingZero Type: boolean A read only value indicating whether a leading zero should be dis
played before the minute when it is less than 10. pmIndicator Type: string The string value dis
played for hours between noon and midnight, defaulting to PM. This value is determined from the user's locale. readOnly Type: boolean If set to true, then the user cannot modify the value of the element. second Type: integer The currently ...
...from the user's locale. readOnly Type: boolean If set to true, then the user cannot modify the value of the element. second Type: integer The currently selected second from 0 to 59. Set this property to change the selected second. secondLeadingZero Type: boolean A read only value indicating whether a leading zero should be dis
played before the second when it is less than 10. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string The currently entered time of the form HH:MM:SS. Set this property to change the time. Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchE...
window - Archive of obsolete content
w much less than the default default width you wish the margin on that side to be. If this value turns out to be less than 0, 0 is used. disablechrome Type: boolean Set this attribute to true to disable chrome in the window. ...
... drawintitlebar Type: boolean If this attribute is true, the top of the window's content area will begin at the top edge of the title bar, instead of below the title bar. This allows the window to draw in the title bar. ...
...eenbutton Type: boolean Set this attribute to true to display a button in the window chrome to allow the user to switch the window into full screen mode. Supported on Mac OS X 10.7 Lion and later and on Windows. The window receives a "fullscreen" event once the change has been made. height Type: string (representing an integer) The preferred height of the element in pixels. The actual dis
played height may be different if the element or its contents have a minimum or maximum height. The CSS height property may also be used. hidechrome Type: boolean Set this attribute to true to have the chrome including the titlebar hidden. id Type: unique id A unique identifier so that you can identify the element with. You can use this as a parameter to getElementById() and other DOM fu...
... JavaScript code, use window.windowState. Listen to the sizemodechange event dispatched to the DOM window to get notified when the window state changes. title Type: string The text to appear in the title bar of the window. 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 dis
played 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 property may also be used. windowtype Type: string Set to a string which can be used to identify the type of window. This might be used, for example, to distinguish between a browser window and an editor windo...
Index - MDN Web Docs Glossary: Definitions of Web-related terms
. This is specified per alignment method, as detailed below. 141 Falsy CodingScripting, Glossary, JavaScript A falsy (sometimes written falsey) value is a value that is considered false when encountered in a Boolean context. 142 Favicon Glossary, Intro, favicon, user agent A favicon (favorite icon) is a tiny icon included along with a website, which is dis
played in places like the browser's address bar, page tabs and bookmarks menu. 143 Fetch directive CSP, HTTP, Security CSP fetch directives are used in a Content-Security-Policy header and control locations from which certain resource types may be loaded. For instance, script-src allows developers to allow trusted sources of script to execute on a page, while font-src controls the s...
...ready scanned for scripts, style sheets and images. The downside is that there's more work lost when the speculation fails. 430 Speed index Glossary, Performance, Reference, Web Performance Speed Index (SI) is a page load performance metric that shows you how quickly the contents of a page are visibly populated. It is the average time at which visible parts of the page are dis
played. Expressed in milliseconds, and dependent on the size of the viewport, the lower the score, the better. 431 Stacking context CSS, CodingScripting, Glossary Stacking context refers to how elements on a webpage appear to sit on top of other elements, just as you can arrange index cards on your desk to lie side-by-side or overlap each other. 432 State machine Codi...
...ion Technology Working Group) is a community that maintains and develops web standards, including DOM, Fetch, and HTML. Employees of Apple, Mozilla, and Opera established WHATWG in 2004. 489 Web performance Glossary, Perceived Performance, Reference, Web Performance Web performance is the objective time from when a request for content is made until the requested content is dis
played in the user's browser, objective render times, and the subjective user experience of load time and runtime. 490 Web server web server, web-server A web server is a piece of software that often runs on a hardware server offering service to a user, usually referred to as the client. A server, on the other hand, is a piece of hardware that lives in a room full of computers, comm...
...6 buffer Buffer, CodingScripting, Glossary, NeedsContent A buffer is a storage in physical memory used to temporarily store data while it is being transferred from one place to another. 517 caret Cursor, Glossary, Input, caret, insertion point, text cursor, text entry, text input, text insertion point A caret (sometimes called a "text cursor") is an indicator dis
played on the screen to indicate where text input will be inserted. 518 document environment CodingScripting, Glossary, JavaScript When the JavaScript global environment is a window or an iframe, it is called a document environment. A global environment is an environment that doesn't have an outer environment. 519 firewall DDoS, Firewall, Glossary, Security, computer...
What’s in the head? Metadata in HTML - Learn web development
It contains information such as the page <title>, links to CSS (if you choose to style your HTML content with CSS), links to custom favicons, and other metadata (data about the HTML, such as the author, and important keywords that describe the document.) In this article we'll cover all of the above and more, in order to give you a good basis for working with markup. Prerequisites: Basic HTML familiarity, as covered in Getting started with HTML. ...
...ave on the HTML document. What is the HTML head? Let's revisit the simple HTML document we covered in the previous article: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My test page</title> </head> <body> <p>This is my page</p> </body> </html> The HTML head is the contents of the <head> element -- unlike the contents of the <body> element (which are dis
played on the page when loaded in a browser), the head's content is not dis
played on the page. Instead, the head's job is to contain metadata about the document. In the above example, the head is quite small: <head> <meta charset="utf-8"> <title>My test page</title> </head> In larger pages however, the head can get quite full. Try going to some of your favorite websites and use the developer tools...
...o documents Mozilla products, like Firefox OS."> <meta property="og:title" content="Mozilla Developer Network"> One effect of this is that when you link to MDN Web Docs on facebook, the link appears along with an image and description: a richer experience for users. Twitter also has its own similar proprietary metadata called Twitter Cards, which has a similar effect when the site's URL is dis
played on twitter.com. For example: <meta name="twitter:title" content="Mozilla Developer Network"> Adding custom icons to your site To further enrich your site design, you can add references to custom icons in your metadata, and these will be dis
played in certain contexts. The most commonly used of these is the favicon (short for "favorites icon", referring to its use in the "favorites" or "bookmark...
...our metadata, and these will be dis
played in certain contexts. The most commonly used of these is the favicon (short for "favorites icon", referring to its use in the "favorites" or "bookmarks" lists in browsers). The humble favicon has been around for many years. It is the first icon of this type: a 16-pixel square icon used in multiple places. You may see (depending on the browser) favicons dis
played in the browser tab containing each open page, and next to bookmarked pages in the bookmarks panel. A favicon can be added to your page by: Saving it in the same directory as the site's index page, saved in .ico format (most browsers will support favicons in more common formats like .gif or .png, but using the ICO format will ensure it works as far back as Internet Explorer 6.) Adding the fol...
Responsive images - Learn web development
creen device. The header below looks ok, but it's starting to take up a lot of the screen height for a mobile device. And at this size, it is difficult to see the people within the first content image. An improvement would be to display a cropped version of the image which displays the important details of the image when the site is viewed on a narrow screen. ...
...This is called the resolution switching problem. ...
...ing each CSS pixel, the elva-fairy-320w.jpg image will be loaded (the 1x is implied, so you don't need to include it.) If the device has a high resolution of two device pixels per CSS pixel or more, the elva-fairy-640w.jpg image will be loaded. The 640px image is 93KB, whereas the 320px image is only 39KB. Art direction To recap, the art direction problem involves wanting to change the image dis
played to suit different image display sizes. For example, a web page includes a large landscape shot with a person in the middle when viewed on a desktop browser. When viewed on a mobile browser, that same image is shrunk down, making the person in the image very small and hard to see. It would probably be better to show a smaller, portrait image on mobile, which zooms in on the person. The <picture> e...
...w-close-portrait.jpg"> <source media="(min-width: 800px)" srcset="elva-800w.jpg"> <img src="elva-800w.jpg" alt="Chris standing up holding his daughter Elva"> </picture> The <source> elements include a media attribute that contains a media condition -- as with the first srcset example, these conditions are tests that decide which image is shown -- the first one that returns true will be dis
played. In this case, if the viewport width is 799px wide or less, the first <source> element's image will be dis
played. If the viewport width is 800px or more, it'll be the second one. The srcset attributes contain the path to the image to display. Just as we saw with <img> above, <source> can take a srcset attribute with multiple images referenced, as well as a sizes attribute. So, you could offer mu...
Build your own function - Learn web development
e called displayMessage(). It will display a custom message box on a web page and will act as a customized replacement for a browser's built-in alert() function. We've seen this before, but let's just refresh our memories. Type the following in your browser's JavaScript console, on any page you like: alert('This is a message'); The alert function takes a single argument -- the string that is dis
played in the alert box. Try varying the string to change the message. The alert function is limited: you can alter the message, but you can't easily vary anything else, such as the color, icon, or anything else. We'll build one that will prove to be more fun. Note: This example should work in all modern browsers fine, but the styling might look a bit funny in slightly older browsers. We'd recommend ...
...e calling, then we can't call it directly -- we need to put it inside an anonymous function so that it isn't in the immediate scope and therefore isn't called immediately. Now it will not be called until the button is clicked. Reload and try the code again and you'll see that it still works just fine, except that now you can also vary the message inside the parameter to get different messages dis
played in the box! A more complex parameter On to the next parameter. This one is going to involve slightly more work -- we are going to set it so that depending on what the msgType parameter is set to, the function will display a different icon and a different background color. First of all, download the icons needed for this exercise (warning and chat) from GitHub. Save them in a new folder call...
...If the msgType parameter is not set at all (or to something different), then the else { ... } part of the code comes into play, and the paragraph is simply given default padding and no icon, with no background panel color set either. This provide...
...arning.png)'; panel.style.backgroundColor = 'red'; } else if (msgType === 'chat') { msg.style.backgroundImage = 'url(icons/chat.png)'; panel.style.backgroundColor = 'aqua'; } else { msg.style.paddingLeft = '20px'; } Here, if the msgType parameter is set as 'warning', the warning icon is dis
played and the panel's background color is set to red. If it is set to 'chat', the chat icon is dis
played and the panel's background color is set to aqua blue. If the msgType parameter is not set at all (or to something different), then the else { ... } part of the code comes into play, and the paragraph is simply given default padding and no icon, with no background panel color set either. This provides a default state if no msgType parameter is provided, meaning that it is an optional parameter! L...
Image gallery - Learn web development
stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Project brief You have been provided with some HTML, CSS and image assets and a few lines of JavaScript code; you need to write the necessary JavaScript to turn this into a working program. ...
...h1> <div class="full-img"> <img class="dis
played-img" src="images/pic1.jpg"> <div class="overlay"></div> <button class="dark">Darken</button> </div> <div class="thumb-bar"> </div> The example looks like this: The most interesting parts of the example's CSS file: It absolutely positions the three elements inside the full-img <div> -- the <img> in which the full-sized image is dis
played, an empty <div> that is sized to be the same size as the <img> and put right over the top of it (this is used to apply a darkening effect to the image via a semi-transparent background color), and a <button> that is used to control the darkening effect. It sets the width of any images inside the thumb-bar <div> (so-called "thumbnail" images) to 20%, and floats them to the left so they sit next t...
...-called "thumbnail" images) to 20%, and floats them to the left so they sit next to one another on a line. Your JavaScript needs to: Loop through all the images, and for each one insert an <img> element inside the thumb-bar <div> that embeds that image in the page. Attach an onclick handler to each <img> inside the thumb-bar <div> so that when they are clicked, the corresponding image is dis
played in the dis
played-img <img> element. Attach an onclick handler to the <button> so that when it is clicked, a darken effect is applied to the full-size image. When it is clicked again, the darken effect is removed again. To give you more of an idea, have a look at the finished example (no peeking at the source code!) Steps to complete The following sections describe what you need to do. Loopi...
...te to this value in each case. Bear in mind that in each case, the image is inside the images directory and its name is pic1.jpg, pic2.jpg, etc. Adding an onclick handler to each thumbnail image In each loop iteration, you need to add an onclick handler to the current newImage -- this handler should find the value of the src attribute of the current image. Set the src attribute value of the dis
played-img <img> to the src value passed in as a parameter. Alternatively, you can add one event listener to the thumb bar. Writing a handler that runs the darken/lighten button That just leaves our darken/lighten <button> -- we've already provided a line that stores a reference to the <button> in a constant called btn. You need to add an onclick handler that: Checks the current class name set on ...
Introduction to web APIs - Learn web development
se (and which we'll cover in this module in greater detail) are: APIs for manipulating documents loaded into the browser. The most obvious example is the DOM (Document Object Model) API, which allows you to manipulate HTML and CSS -- creating, removing and changing HTML, dynamically applying new styles to your page, etc. Every time you see a popup window appear on a page or some new content dis
played, for example, that's the DOM in action. Find out more about these types of API in Manipulating documents. APIs that fetch data from the server to update small sections of a webpage on their own are very commonly used. This seemingly small detail has had a huge impact on the performance and behaviour of sites -- if you just need to update a stock listing or list of available new stories, doing it...
... updating scenes like cartoons and games. Audio and Video APIs like HTMLMediaElement, the Web Audio API, and WebRTC allow you to do really interesting things with multimedia such as creating custom UI controls for playing audio and video, displaying text tracks like captions and subtitles along with your videos, grabbing video from your web camera to be manipulated via a canvas (see above) or dis
played on someone else's computer in a web conference, or adding effects to audio tracks (such as gain, distortion, panning, etc). Device APIs are basically APIs for manipulating and retrieving data from modern device hardware in a way that is useful for web apps. Examples include telling the user that a useful update is available on a web app via system notifications (see the Notifications API) or vib...
...h to manipulate our track: const AudioContext = window.AudioContext || window.webkitAudioContext; const audioCtx = new AudioContext(); Next, we create constants that store references to our <audio>, <button>, and <input> elements, and use the AudioContext.createMediaElementSource() method to create a MediaElementAudioSourceNode representing the source of our audio -- the <audio> element will be
played from: const audioElement = document.querySelector('audio'); const playBtn = document.querySelector('button'); const volumeSlider = document.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 ...
...is to work is to connect the different nodes in the audio graph up, which is done using the AudioNode.connect() method available on every node type: audioSource.connect(gainNode).connect(audioCtx.destination); The audio starts in the source, which is then connected to the gain node so the audio's volume can be adjusted. The gain node is then connected to the destination node so the sound can be
played on your computer (the AudioContext.destination property represents whatever is the default AudioDestinationNode available on your computer's hardware, e.g. your speakers). They have recognizable entry points When using an API, you should make sure you know where the entry point is for the API. In The Web Audio API, this is pretty simple -- it is the AudioContext object, which needs to be used t...
Properly configuring server MIME types - Learn web development
eir 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 intended to help guide a web browser in how the content is to be processed and dis
played. 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 Registered values for MIME types are available in IANA | MIME Media Types. The HTTP s...
...e 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 intended the content to be processed and dis
played 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 content as expected even though the web serv...
...o guess MIME types for the following reasons: Loss of control If the browser ignores the reported MIME type, web administrators and authors no longer have control over how their content is to be processed. For example, a web site oriented for web developers might wish to send certain example HTML documents as either text/html or text/plain in order to have the documents either processed and dis
played as HTML or as source code. If the browser guesses the MIME type, this option is no longer available to the author. Security Some content types, such as executable programs, are inherently unsafe. For this reason these MIME types are usually restricted in terms of what actions a web browser will take when given content of that type. An executable program should not be executed on the user's comp...
...t There are several steps which you can take to determine the correct MIME type value to be used for your content. If your content was created using a vendor's software application, read the vendor's documentation to see what MIME types should be reported for different media types. Look in the IANA | MIME Media Types registry which contains all registered MIME types. If the media type is dis
played using a plug-in in Netscape Gecko, install the plug-in and then look in the Help->About Plug-ins Menu to see what MIME types are associated with the media type. Search for the file extension in FILExt or File extensions reference to see what MIME types are associated with that extension. How to set up your server to send the correct MIME types The fundamental idea is to configure your server ...
Index
Specifies a special JavaScript directory. This option causes the specified directory to be signed and tags its entries as inline JavaScript. This special type of entry does not have to appear in the JAR file itself. Instead, it is located in the HTML page containing the inline scripts. When you use signtool -v, these entries are dis
played with the string NOT PRESENT. -k key ... directory Specifies the nickname (key) of the certificate you want to sign with and signs the files in the specified directory. The directory to sign is always specified as the last command-line argument. Thus, it is possible to write signtool -k MyCert -d . signdir You may have trouble if the nick...
...makes the manifest files (required by the JAR format) considerably smaller, but they contain slightly less information. --outfile outputfile Specifies a file to receive redirected output from Netscape Signing Tool. -p password Specifies a password for the private-key database. Note that the password entered on the command line is dis
played as plain text. -s keysize Specifies the size of the key for generated certificate. Use the -M option to find out what tokens are available. The -s option can be used with the -G option only. -t token Specifies which available token should generate the key and receive the certificate. Use the -M option to find out what tokens ...
...- VeriSign, Inc. GTE CyberTrust Root CA Uptime Group Plc. Class 4 CA * Verisign Object Signing Cert Integrion CA GTE CyberTrust Secure Server CA AT&T Directory Services * test object signing cert Uptime Group Plc. Class 1 CA VeriSign Class 1 Primary CA - ------------ Certificates that can be used to sign objects have *'s to their left. Two signing certificates are dis
played: Verisign Object Signing Cert and test object signing cert. You use the -l option to get a list of signing certificates only, including the signing CA for each. signtool -l using certificate directory: /u/jsmith/.netscape Object signing certificates --------------------------------------- Verisign Object Signing Cert Issued by: VeriSign, Inc. - Verisign, Inc. Expires: ...
...one key pair. If you create a new key pair for such a card, the previous pair is overwritten. -H Display a list of the options and arguments used by the Certificate Database Tool. -K List the key ID of keys in the key database. A key ID is the modulus of the RSA key or the publicValue of the DSA key. IDs are dis
played in hexadecimal ("0x" is not shown). -L List all the certificates, or display information about a named certificate, in a certificate database. Use the -h tokenname argument to specify the certificate database on a particular hardware or software token. -M Modify a certificate's trust attributes using the values of the -t ...
Rhino Debugger
s you have entered. You may move backward and forward through the history list by pressing the Up/Down arrow keys on the keyboard. Opening Scripts You may select the File->Open menu item on the menu bar to load JavaScript scripts contained in files. This action will display a file-selection dialog box prompting you for the location of a script to load. The selected file will be compiled and dis
played in a new window. Running Scripts You may select the File->Run menu item on the menu bar to execute JavaScript scripts contained in files. This action will display a file-selection dialog box prompting you for the location of a script to execute. The loaded script will be run in a new thread and control will be given to the debugger on its first instruction. Controlling Execution The debugge...
...lowing: Select the Debug->Break menu item on the menu bar Press the Break button on the toolbar Press the Pause/Break key on the keyboard Break on Exceptions To give control to the debugger whenever a JavaScript is exception is thrown select the Debug->Break on Exceptions checkbox from the menu bar. Whenever a JavaScript exception is thrown by a script a message dialog will be dis
played and control will be given to the debugger at the location the exception is raised. Break on Function Enter Selecting Debug->Break on Function Enter will give control to the debugger whenever the execution is entered into a function or script. Break on Function Exit Selecting Debug->Break on Function Return will give control to the debugger whenever the execution is about to return from a fu...
... disappear and the breakpoint at that location will be cleared. Viewing Variables The lower-left (dockable) pane in the debugger main window contains a tab-pane with two tabs, labeled "this" and "Locals". Each pane contains a tree-table which displays the properties of the current object and currently visible local variables, respectively. This The properties of the current object are dis
played in the this table. If a property is itself a JavaScript object the property may be expanded to show its sub-properties. The this table is updated each time control returns to the debugger or when you change the stack location in the Context: window. Locals The local variables of the current function are dis
played in the Locals table. If a variable is itself a JavaScript object the variable ...
...its sub-properties. The Locals table is updated each time control returns to the debugger or when you change the stack location in the Context: window Watch Window You may enter arbitrary JavaScript expressions in the Watch: table located in the lower-right (dockable) pane in the debugger main window. The expressions you enter are re-evaluated in the current scope and their current values dis
played each time control returns to the debugger or when you change the stack location in the Context: window. Evaluation Window The Evaluate pane located in the lower-right (dockable) pane in the debugger main window contains an editable command line where you may enter arbitrary JavaScript code. The code is evaluated in the context of the current stack frame. The window maintains a history of the ...
nsITaskbarPreviewButton
widget/public/nsITaskbarPreviewButton.idlScriptable This interface is used on Microsoft Windows to get access to a window preview's toolbar button properties. These buttons are dis
played below the window preview. 1.0 66 Introduced Gecko 1.9.2 Inherits from: nsISupports Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) You can't directly instantiate this interface. Instead, you use the nsITaskbarWindowPreview.getButton() to get the objects representing the buttons. Attributes Attribute Type Description disabled boolean If true, the button is disabled. This is not the same as visible, which indicates whether or not the button should be dis
played at all. dismissOnClick boolean If true, the array of previews should be dismissed when the...
...If false, the button doesn't participate in the layout of buttons underneath the preview. ...
...If false, the button doesn't participate in the layout of buttons underneath the preview. This is false by default. ...
...ed when the button is clicked. This is false by default. hasBorder boolean If true, the taskbar should draw a border around this button's image. This is true by default. image imgIContainer The icon dis
played in the button. This is null by default. tooltip DOMString The string dis
played in the button's tooltip. By default, this is an empty string. visible boolean If true, the button is dis
played. If false, the button doesn't participate in the layout of buttons underneath the preview. This is false by default. See also nsITaskbarPreview nsITaskbarPreviewController nsITaskbarTabPreview nsITaskbarWindowPreview nsIWinTaskbar ...
Examine and edit CSS - Firefox Developer Tools
Click that icon to display the grid overlaid on the page, including grid lines and tracks. See Examine grid layouts for more on this. To view user-agent styles (i.e., browser-default CSS rules), enable "Inspector > Show Browser Styles" under the developer tool settings panel. (Note that this setting is independent of the "Browser styles" checkbox in the Computed view.) User-agent styles are dis
played against a different background, and the link to the filename and line number contains the prefix (user agent): element {} rule The element {} rule at the top of the rules list isn't actually a CSS rule. It represents the CSS properties assigned to the element via its style attribute. This also gets the target icon: , giving you a convenient way to highlight the currently selected element in ...
...lement: ::after ::backdrop ::before ::first-letter ::first-line ::selection :-moz-color-swatch :-moz-number-spin-box :-moz-number-spin-down :-moz-number-spin-up :-moz-number-text :-moz-number-wrapper :-moz-placeholder :-moz-progress-bar :-moz-range-progress :-moz-range-thumb :-moz-range-track :-moz-selection If the selected element has pseudo-elements applied to it, they are dis
played before the selected element but hidden by a disclosure triangle: Clicking the triangle displays them: Viewing common pseudo-classes There's a button to the right of the filter box: Click the button to see checkboxes that you can use to enable the :hover, :active and :focus, :focus-within and :visited pseudo-classes for the selected element: This feature can also be accessed from the po...
...nt. You can clear the checkbox for a particular class name, to see how the element would appear without that class applied to it. You can add a class to the element by typing a name in the Add new class field below the Rules toolbar. Autocompletions based on existing classes are suggested as you type. Link to CSS file At the top right of each rule, the source filename and line number is dis
played as a link: clicking it opens the file in the Style Editor. You can copy the location of the source file: right-click the link and select "Copy Location". The Inspector understands CSS source maps. That means that if you are using a CSS preprocessor that has support for source maps, and you've enabled source map support in the Style Editor settings, then the link will take you to the original so...
...ter the rule view to show only the rules applying to the current node that try to set the same property: that is, the complete cascade for the given property. This makes it easy to see which rule is overriding the declaration: View @media rules for Print You can toggle the display into a mode that emulates @media rules for print. When on, any rules defined for printing the page will be dis
played similar to the "Print Preview" mode that many word processing applications provide. View @media rules for color-scheme-preference As of Firefox 72, you must set devtools.inspector.color-scheme-simulation.enabled to true in the Configuration Editor to enable this feature. If you have set privacy.resistFingerprinting to true, prefers-color-scheme preference is overridden to light. In order to u...
about:debugging - Firefox Developer Tools
ormation about your remote debugging setup: Setup Use the Setup tab to configure the connection to your remote device. This Firefox Provides information about temporary extensions you have loaded for debugging, extensions that are installed in Firefox, the tabs that you currently have open, and service workers running on Firefox. If your about:debugging page is different from the one dis
played here, go to about:config, find and set the option devtools.aboutdebugging.new-enabled to true. Setup tab Connecting to a remote device Firefox supports debugging over USB with Android devices, using the about:debugging page. Before you connect: Enable Developer settings on your Android device. Enable USB debugging in the Android Developer settings. Enable Remote Debugging via USB in the ...
...erence. If you need to see these extensions, navigate to about:config and make sure that the preference is set to true. Extensions Loading a temporary extension With the Load Temporary Add-on button you can temporarily load a web extension from a directory on disk. Click the button, navigate to the directory containing the add-on and select its manifest file. The temporary extension is then dis
played under the Temporary Extensions header. You don't have to package or sign the extension before loading it, and it stays installed until you restart Firefox. The major advantages of this method, compared with installing an add-on from an XPI, are: You don't have to rebuild an XPI and reinstall when you change the add-on's code; You can load an add-on without signing it and without needing to ...
...sable signing. Once you have loaded a temporary extension, you can see information about it and perform operations on it. You can use the following buttons: Inspect Loads the extension in the debugger. Reload Reloads the temporary extension. This is handy when you have made changes to the extension. Remove Unloads the temporary extension. Other information about the extension is dis
played: Location The location of the extension's source code on your local system. Extension ID The temporary ID assigned to the extension. Internal UUID The internal UUID assigned to the extension. Manifest URL If you click the link, the manifest for this extension is loaded in a new tab. Updating a temporary extension If you install an extension in this way, what happens when you update t...
...rkers Click the Unregister button to unregister the service worker. Sending push events to service workers To debug push notifications, you can set a breakpoint in the push event listener. However, you can also debug push notifications locally, without needing the server. Click the Push button to send a push event to the service worker. Service workers not compatible A warning message is dis
played at the top of the This Firefox tab if service workers are incompatible with the current browser configuration, and therefore cannot be used or debugged. Service workers can be unavailable if the dom.serviceWorkers.enable preference is set to false in about:config. Connection to Firefox for Android 68 Releases of Firefox for Android that are based on version 68 cannot be debugged from deskto...
Fullscreen API - Web APIs
se which is resolved once full-screen mode has been activated. Properties The Document interface provides properties that can be used to determine if full-screen mode is supported and available, and if full-screen mode is currently active, which element is using the screen. DocumentOrShadowRoot.fullscreenElement The fullscreenElement property tells you the Element that's currently being dis
played in full-screen mode on the DOM (or shadow DOM). If this is null, the document is not in full-screen mode. document.fullscreenEnabled The fullscreenEnabled property tells you whether or not it is possible to engage full-screen mode. This is false if full-screen mode is not available for any reason (such as the "fullscreen" feature not being allowed, or full-screen mode not being supported). Ev...
...nt, indicating that the element has been placed into, or removed from, full-screen mode. Element.onfullscreenerror An event handler for the fullscreenerror event when sent to an element which has encountered an error while transitioning into or out of full-screen mode. Obsolete properties Document.fullscreen A Boolean value which is true if the document has an element currently being dis
played in full-screen mode; otherwise, this returns false. Note: Use the fullscreenElement property on the Document or ShadowRoot instead; if it's not null, then it's an Element currently being dis
played in full-screen mode. Events The Fullscreen API defines two events which can be used to detect when full-screen mode is turned on and off, as well as when errors occur during the process of changin...
...es in Firefox, visit about:config. No support 9 -- 65Notes Alternate Name Notes Before Firefox 44, Firefox incorrectly allowed elements inside a <frame> or <object> element to request, and to be granted, fullscreen. ...
...nge preferences in Firefox, visit about:config. No support 9 -- 65Notes Alternate Name Notes Before Firefox 44, Firefox incorrectly allowed elements inside a <frame> or an <object> to request, and to be granted, fullscreen. ...
Key Values - Web APIs
s multiple languages, while others exist only on keyboards targeting specific languages. In addition, not all keyboards have all of these keys. Common IME keys KeyboardEvent.key Value Description Virtual Keycode Windows Mac Linux Android "AllCandidates" The All Candidates key, which starts multi-candidate mode, in which multiple candidates are dis
played for the ongoing input. GDK_KEY_MultipleCandidate (0xFF3D Qt::Key_MultipleCandidate (0x0100113D) "Alphanumeric" The Alphanumeric key. VK_OEM_ATTN (0xF0) GDK_KEY_Eisu_Shift (0xFF2F) GDK_KEY_Eisu_toggle (0xFF30) Qt::Key_Eisu_Shift (0x0100112f) Qt::Key_Eisu_toggle (0x01001130) "CodeInput" The Code Input key, which enables code input...
... ongoing input. GDK_KEY_PreviousCandidate (0xFF3E) Qt::Key_PreviousCandidate (0x0100113E) "Process" [3] The Process key. Instructs the IME to process the conversion. VK_PROCESSKEY (0xE5) "SingleCandidate" [4] The Single Candidate key. Enables single candidate mode (as opposed to multi-candidate mode); in this mode, only one candidate is dis
played at a time. GDK_KEY_SingleCandidate (0xFF3C) Qt::Key_SingleCandidate (0x0100113C) [1] On the X Window System, the Compose key is called the Multi key. [2] The NonConvert key is reported as "Nonconvert" instead of the correct "NonConvert" by Internet Explorer (tested on release 9 and 11) and Firefox versions 36 and earlier. [3] The Process key currently returns "Unidenti...
... third favorites list slot. VK_STORE_FAVORITE_2 "FavoriteStore3" Stores the current program or content into the fourth favorites list slot. VK_STORE_FAVORITE_3 "Guide" Toggles the display of the program or content guide. VK_GUIDE Qt::Key_Guide (0x0100011A) KEYCODE_GUIDE (172) "GuideNextDay" If the guide is currently dis
played, this button tells the guide to display the next day's content. VK_NEXT_DAY "GuidePreviousDay" If the guide is currently dis
played, this button tells the guide to display the previous day's content. VK_PREV_DAY "Info" Toggles the display of information about the currently selected content, program, or media. VK_INFO Qt::Key_Info (0x0...
...ESH GDK_KEY_Refresh (0x1008FF29) GDK_KEY_Reload (0x1008FF73) "BrowserSearch" Activates the user's preferred search engine or the search interface within their browser. VK_BROWSER_SEARCH (0xAA) APPCOMMAND_BROWSER_SEARCH GDK_KEY_Search (0x1008FF1B) Qt::Key_Search (0x01000092) KEYCODE_SEARCH (84) "BrowserStop" Stops loading the currently dis
played Web view or content. VK_BROWSER_STOP (0xA9) APPCOMMAND_BROWSER_STOP GDK_KEY_Stop (0x1008FF28) Qt::Key_Search (0x01000063) [1] Prior to Firefox 37, this key's value was reported as "Unidentified". Numeric keypad keys These keys are found on the keyboard's numeric keypad. However, not all are present on every keyboard. Although typical numeric keypads have numeric key...
Media Source API - Web APIs
Media Source Extensions concepts and usage Playing video and audio has been available in web applications without plugins for a few years now, but the basic features offered have really only been useful for playing single whole tracks. We can't, for example, combine/split arraybuffers. ...
...recently been the domain of Flash, with technologies like Flash Media Server serving video streams using the RTMP protocol. The MSE standard With Media Source Extensions (MSE), this is changing. MSE allows us to replace the usual single track src value fed to media elements with a reference to a MediaSource object, which is a container for information like the ready state of the media for being
played, and references to multiple SourceBuffer objects that represent the different chunks of media that make up the entire stream. MSE gives us finer grained control over how much and how often content is fetched, and some control over memory usage details, such as when buffers are evicted. It lays the groundwork for adaptive bitrate streaming clients (such as those using DASH or HLS) to be built on i...
...roadcasting, so DASH is not suitable for real time communication like WebRTC is. It can however support significantly more client connections than WebRTC. There are numerous available free and open source tools for transcoding content and preparing it for use with DASH, DASH file servers, and DASH client libraries written in JavaScript. Interfaces MediaSource Represents a media source to be
played via an HTMLMediaElement object. SourceBuffer Represents a chunk of media to be passed into an HTMLMediaElement via a MediaSource object. SourceBufferList A simple container list for multiple SourceBuffer objects. VideoPlaybackQuality Contains information about the quality of video being
played by a <video> element, such as number of dropped or corrupted frames. Returned by the HTMLVideoElem...
...ormation in the initialization segments of a media chunk. TrackDefaultList A simple container list for multiple TrackDefault objects. Extensions to other interfaces URL.createObjectURL() Creates an object URL pointing to a MediaSource object that can then be specified as the src value of an HTML media element to play a media stream. HTMLMediaElement.seekable When a MediaSource object is
played by an HTML media element, this property will return a TimeRanges object that contains the time ranges that the user is able to seek to. HTMLVideoElement.getVideoPlaybackQuality() Returns a VideoPlaybackQuality object for the currently
played video. AudioTrack.sourceBuffer, VideoTrack.sourceBuffer, TextTrack.sourceBuffer Returns the SourceBuffer that created the track in question. Specificat...
Using the Notifications API - Web APIs
This article looks at the basics of using this API in your own apps. Typically, system notifications refer to the operating system's standard notification mechanism: think for example of how a typical desktop system or mobile device broadcasts notifications. ...
.... HTTPS), and you can no longer allow notification permissions to be requested from cross-origin <iframe>s. Checking current permission status You can check to see if you already have permission by checking the value of the Notification.permission read only property. It can have one of three possible values: default The user hasn't been asked for permission yet, so notifications won't be dis
played. granted The user has granted permission to display notifications, after having been asked previously. denied The user has explicitly declined permission to show notifications. Getting permission If permission to display notifications hasn't been granted yet, the application needs to use the Notification.requestPermission() method to request this from the user. In its simplest form, we jus...
...fications platform or by the user, the close steps for it must be run." Notification events There are four events that are triggered on the Notification instance: click Triggered when the user clicks on the notification. close Triggered once the notification is closed. error Triggered if something goes wrong with the notification; this is usually because the notification couldn't be dis
played for some reason. show Triggered when the notification is dis
played to the user. These events can be tracked using the onclick, onclose, onerror, and onshow handlers. Because Notification also inherits from EventTarget, it's possible to use the addEventListener() method on it. Replacing existing notifications It is usually undesirable for a user to receive a lot of notifications in a short s...
...nger application notified a user for each incoming message, and they were being sent a lot? To avoid spamming the user with too many notifications, it's possible to modify the pending notifications queue, replacing single or multiple pending notifications with a new one. To do this, it's possible to add a tag to any new notification. If a notification already has the same tag and has not been dis
played yet, the new notification replaces that previous notification. If the notification with the same tag has already been dis
played, the previous notification is closed and the new one is dis
played. Tag example Assume the following basic HTML: <button>Notify me!</button> It's possible to handle multiple notifications this way: window.addEventListener('load', function () { // At first, let's ch...
Web Video Text Tracks Format (WebVTT) - Web APIs
There can be zero or more of them, and they can be used in any order so long as each setting is used no more than once. The cue settings are added to the right of the cue timings. There must be one or more spaces between the cue timing and the first setting and between each setting. A setting's name and value...
...0 00:00:05.000 --> 00:01:00.000 00:00:30.000 --> 00:00:50.000 Example 12 - Non-overlapping cue timing examples 00:00:00.000 --> 00:00:10.000 00:00:10.000 --> 00:01:00.581 00:01:00.581 --> 00:02:00.100 00:02:01.000 --> 00:02:01.000 Cue settings Cue settings are optional components used to position where the cue payload text will be dis
played over the video. This includes whether the text is dis
played horizontally or vertically. There can be zero or more of them, and they can be used in any order so long as each setting is used no more than once. The cue settings are added to the right of the cue timings. There must be one or more spaces between the cue timing and the first setting and between each setting. A setting's name and value are separated by a colon. The settings are case sensitive s...
...ach setting is used no more than once. The cue settings are added to the right of the cue timings. There must be one or more spaces between the cue timing and the first setting and between each setting. A setting's name and value are separated by a colon. The settings are case sensitive so use lower case as shown. There are five cue settings: vertical Indicates that the text will be dis
played vertically rather than horizontally, such as in some Asian languages. Table 1 - vertical values vertical:rl writing direction is right to left vertical:lr writing direction is left to right line Specifies where text appears vertically. If vertical is set, line specifies where text appears horizontally. Va...
...ht be used for an Asian language. 00:00:05.000 --> 00:00:10.000 00:00:05.000 --> 00:00:10.000 line:63% position:72% align:start 00:00:05.000 --> 00:00:10.000 line:0 position:20% size:60% align:start 00:00:05.000 --> 00:00:10.000 vertical:rt line:-1 align:end Cue payload The payload is where the main information or content is located. In normal usage the payload contains the subtitles to be dis
played. 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 recommended that you use the great...
HTML attribute reference - HTML: Hypertext Markup Language
the information submitted via the form. align <applet>, <caption>, <col>, <colgroup>, <hr>, <iframe>, <img>, <table>, <tbody>, <td>, <tfoot> , <th>, <thead>, <tr> Specifies the horizontal alignment of the element. allow <iframe> Specifies a feature-policy for the iframe. alt <applet>, <area>, <img>, <input> Alternative text in case an image can't be dis
played. async <script> Executes the script asynchronously. autocapitalize Global attribute Sets whether input is automatically capitalized when entered by user autocomplete <form>, <input>, <select>, <textarea> Indicates whether controls in this form can by default have their values automatically completed by the browser. autofocus <button>, <inpu...
... <area>, <iframe>, <img>, <link>, <script> Specifies which referrer is sent when fetching the resource. rel <a>, <area>, <link> Specifies the relationship of the target object to the link object. required <input>, <select>, <textarea> Indicates whether this element is required to fill out or not. reversed <ol> Indicates whether the list should be dis
played in a descending order instead of a ascending. rows <textarea> Defines the number of rows in a text area. rowspan <td>, <th> Defines the number of rows a table cell should span over. sandbox <iframe> Stops a document loaded in an iframe from using certain features (such as submitting forms or opening new windows). scope <th> Defines the c...
... summary <table> tabindex Global attribute Overrides the browser's default tab order and follows the one specified instead. target <a>, <area>, <base>, <form> Specifies where to open the linked document (in the case of an <a> element) or where to display the response recieved (in the case of a <form> element) title Global attribute Text to be dis
played in a tooltip when hovering over the element. translate Global attribute Specify whether an element's attribute values and the values of its Text node children are to be translated when the page is localized, or whether to leave them unchanged. type <button>, <input>, <command>, <embed>, <object>, <script>, <source>, <style>, <menu> Defines the type of the element. ...
...o be translated when the page is localized, or whether to leave them unchanged. type <button>, <input>, <command>, <embed>, <object>, <script>, <source>, <style>, <menu> Defines the type of the element. usemap <img>, <input>, <object> value <button>, <data>, <input>, <li>, <meter>, <option>, <progress>, <param> Defines a default value which will be dis
played in the element on page load. width <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video> For the elements listed here, this establishes the element's width. Note: For all other instances, such as <div>, this is a legacy attribute, in which case the CSS width property should be used instead. wrap <textarea> Indicates whether the text s...
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
and relevant keyboard in supporting browsers and devices with dynamic keyboards. <input type="email" name="email"/> HTML5 file A control that lets the user select a file. Use the accept attribute to define the types of files that the control can select. <input type="file" accept="image/*, text/*" name="file"/> hidden A control that is not dis
played but whose value is submitted to the server. There is an example in the next column, but it's hidden! image A graphical submit button. Displays an image defined by the src attribute. The alt attribute displays if the image src is missing. <input type="image" name="image" src="" alt="image input"/> month A control for entering a month and year, with n...
...pes. See The HTML autocomplete attribute for additional information, including information on password security and how autocomplete is slightly different for hidden than for other input types. autofocus A Boolean attribute which, if present, indicates that the input should automatically have focus when the page has finished loading (or when the <dialog> containing the element has been dis
played). Note: An element with the autofocus attribute may gain focus before the DOMContentLoaded event is fired. No more than one element in the document may have the autofocus attribute. If put on more than one element, the first one with the attribute receives focus. The autofocus attribute cannot be used on inputs of type hidden, since hidden inputs cannot be focused. Warning: Automati...
... mozactionhint A string indicating the type of action that will be taken when the user presses the Enter or Return key while editing the field; this is used to determine an appropriate label for that key on a virtual keyboard. Firefox for Android only. orient Sets the orientation of the range slider. Firefox only. results The maximum number of items that should be dis
played in the drop-down list of previous search queries. Safari only. webkitdirectory A Boolean indicating whether or not to only allow the user to choose a directory (or directories, if multiple is also present) autocorrect A Safari extension, the autocorrect attribute is a string which indicates whether or not to activate automatic correction while the user is editing this fiel...
...but is not yet widely implemented. To see the status of the change being implemented in Firefox, see bug 1490661. Permitted values are: go, done, next, search, and send. The browser decides, using this hint, what label to put on the enter key. orient results The results attribute--supported only by Safari--is a numeric value that lets you override the maximum number of entries to be dis
played 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. webkitdirectory The Boolean webkitdirectory attribute, if present, indicates that only directories should be available to be selected by the user in the fi...
HTML documentation index - HTML: Hypertext Markup Language
104 <form> Element, Form Element, Forms, HTML, HTML Form Element, HTML forms, Reference, Web The HTML <form> element represents a document section containing interactive controls for submitting information. 105 <frame> Deprecated, Element, HTML, Reference, Web <frame> is an HTML element which defines a particular area in which another HTML document can be dis
played. A frame should be used within a <frameset>. 106 <frameset> Deprecated, Element, HTML, Reference, Web The HTML <frameset> element is used to contain <frame> elements. 107 <h1>-<h6>: The HTML Section Heading elements Element, HTML, HTML sections, Reference, Web The HTML <h1>-<h6> elements represent six levels of section headings. <h1> is the highest sectio...
...HTML grouping content, HTML:Flow content, Reference, Web The HTML <pre> element represents preformatted text which is to be presented exactly as written in the HTML file. 178 <progress>: The Progress Indicator element Element, HTML, HTML forms, HTML5, Reference, Web The HTML <progress> element displays an indicator showing the completion progress of a task, typically dis
played as a progress bar. 179 <q>: The Inline Quotation element Citation, Cite, Element, HTML, HTML text-level semantics, Q, Quotation, Quotation Marks, Reference, Web, quote The HTML <q> element indicates that the enclosed text is a short inline quotation. Most modern browsers implement this by surrounding the text in quotation marks. 180 <rb>: The Ruby Base element ...
...e, Style, Web The HTML <style> element contains style information for a document, or part of a document. 199 <sub>: The Subscript element Baseline, Element, Footnotes, HTML, HTML text-level semantics, HTML:Flow content, HTML:Palpable Content, HTML:Phrasing content, Reference, Subscript, Web, sub The HTML Subscript element (<sub>) specifies inline text which should be dis
played as subscript for solely typographical reasons. 200 <summary>: The Disclosure Summary element Disclosure Box, Disclosure Control, Disclosure Summary, Element, HTML, HTML interactive elements, Reference, Summary, Web The HTML Disclosure Summary element (<summary>) element specifies a summary, caption, or legend for a <details> element's disclosure box. 201 <sup>: The...
... The HTML Disclosure Summary element (<summary>) element specifies a summary, caption, or legend for a <details> element's disclosure box. 201 <sup>: The Superscript element Element, HTML, HTML text-level semantics, HTML:Flow content, HTML:Palpable Content, HTML:Phrasing content, Reference, Web The HTML Superscript element (<sup>) specifies inline text which is to be dis
played as superscript for solely typographical reasons. 202 <table>: The Table element Element, HTML, HTML tabular data, Reference, Tables, Web The HTML <table> element represents tabular data -- that is, information presented in a two-dimensional table comprised of rows and columns of cells containing data. 203 <tbody>: The Table Body element Element, HTML, HTML tabu...
widget - Archive of obsolete content
data = require("sdk/self").data var clockPanel = require("sdk/panel").Panel({ width:215, height:160, contentURL: data.url("clock.html") }); require("sdk/widget").Widget({ id: "open-clock-btn", label: "Clock", contentURL: data.url("History.png"), panel: clockPanel }); Note that this is, at the moment, the only way you can attach a panel to a wid...
...sed for accessibility, title bars, and error reporting. id string A string used to identify your widget in order to save its location when the user moves it in the browser. This string has to be unique and must not be changed over time. Optional options: Name Type content string An optional string value containing the dis
played content of the widget. It may contain HTML. Widgets must have either the content property or the contentURL property set. If the content is an image, it is automatically scaled to be 16x16 pixels. contentURL string An optional string URL to content to load into the widget. This can be local content or remote content, an image or web content. Widgets must have either t...
... postMessage(data) Sends a message to the widget view's content scripts. Parameters data : value The message to send. The message can be any JSON-serializable value. on(type, lis...
ui/button/toggle - Archive of obsolete content
the label value inherited from the global state: Browser: label = "my default" W1 T1 > displays "my default" T2 > displays "my default" W2 T3 > displays "my default" T4 > displays "my default" If you then set a label specific to T3 as "my T3 label", then set a label state specific to W2 as "my W2 label", then the button dis
played when T3 is the active tab will still show "my T3 label", but the button dis
played when T4 is the active tab will show "my W2 label": Browser: label = "my default" W1 T1 > displays "my default" T2 > displays "my default" W2 T3 > displays "my T3 label" T4 > displays "my W2 label" Setting the properties on the button instance...
...respond to clicks. Defaults to false. onChange function Change handler for the button. onClick function Click handler for the button. badge Number or String New in Firefox 36. Badge to attach to the button. The badge can contain as many characters (or digits) as you like, but only the first four will be dis
played. badgeColor CSS <color> value New in Firefox 36. Color for the badge. If badgeColor is omitted and badge is specified, then the badge is red. ToggleButton Methods click() Click the button. This will cause the button to generate the click event: var { ToggleButton } = require('sdk/ui/button/toggle'); var button = ToggleButton({ id: "my-butto...
...false, or the value of the checked option to the button's constructor. It is then flipped, on a per-window basis, whenever the user clicks the button or when the button's click() method is called. badge New in Firefox 36. Value to attach to the button as a badge. May be a number or a string. The badge can contain as many characters (or digits) as you like, but only the first four will be dis
played. badgeColor New in Firefox 36. Color for the badge, specified as a CSS <color> value. Events click This event is emitted when a user clicks the button or your add-on calls the button's click() method. Arguments state : The button's state. This includes all the button's properties. change This event is emitted when a user clicks the button or your add-on calls the button's click() meth...
Add a Context Menu Item - Archive of obsolete content
To follow this tutorial you'll need to have learned the basics of jpm. To add items and submenus to the Firefox context menu, use the context-menu module. Here's an add-on that adds a new context menu item. The item is dis
played whenever something in the page is selected. When it's clicked, the selection is sent to the main add-on code, which just logs it: var contextMenu = require("sdk/context-menu"); var menuItem = contextMenu.Item({ label: "Log Selection", context: contextMenu.SelectionContext(), contentScript: 'self.on("click", function () {' + ' var text = window.getSelection().toString();' + ' self.postMessage(text);' + '});', onMessage: function (selectionText) { console.log(selectionText); } }); Try it: run the ad...
...ing an instance of Firefox from the command line): info: elephantine lizard Details All this add-on does is to construct a context menu item. You don't need to add it: once you have constructed the item, it is automatically added in the correct context. The constructor in this case takes four options: label, context, contentScript, and onMessage. label The label is just the string that's dis
played. context The context describes the circumstances in which the item should be shown. The context-menu module provides a number of simple built-in contexts, including this SelectionContext(), which means: display the item when something on the page is selected. If these simple contexts aren't enough, you can define more sophisticated contexts using scripts. contentScript This attaches a script...
...he item the content script's click event fires, and the content script retrieves the selected text and sends a message to the add-on the add-on's message event fires, and the add-on code's handler function is passed the selected text, which it logs More options Adding an image You can add an image to a context menu item with the image option. This is a URL pointing to a 16x16 icon that's dis
played at the left side of the context menu item. Typically you'd store the image in your add-on's "data" directory, and construct the URL using self.data.url(): var self = require("sdk/self"); var contextMenu = require("sdk/context-menu"); var menuItem = contextMenu.Item({ label: "Log Selection", context: contextMenu.SelectionContext(), contentScript: 'self.on("click", function () {' + ...
Inline options - Archive of obsolete content
sions.myaddon.bool" title="Boolean" desc="Stored as a boolean preference" /> </vbox> Note that it's limited to <setting> tags. The root <vbox> just acts as a container, it isn't merged into the main window. If you need script support, see the display notifications section. ...
...he subject at StackOverflow: How to use addEventListener on inputChanged of inline options Display notifications If you want to use the settings UI for anything more than storing preferences, then you will probably need to initialize them when they first appear. ...
...more than storing preferences, then you will probably need to initialize them when they first appear. You can't do this until your options XUL has been loaded into the Add-on Manager window, so you should listen for the addon-options-dis
played notification to initialize your settings. For example: var observer = { observe: function(aSubject, aTopic, aData) { if (aTopic == "addon-options-dis
played" && aData == "MY_ADDON@MY_DOMAIN") { var doc = aSubject; var control = doc.getElementById("myaddon-pref-control"); control.value = "test"; } } }; Services.obs.addObserver(observer, "addon-options-dis
played", false); // Don't forget to remove your observer when your add-on is shut down. This code should be in bootstrap.js (within the startup() function) for restartless e...
The Box Model - Archive of obsolete content
ve some default styling, though). Their behavior is similar. However, one of the fundamental differences between XUL and HTML has been the fact that XUL boxes can be oriented vertically or horizontally (this behavior is being introduced into HTML standards). There are 3 basic box elements in XUL: hbox, vbox and box. An hbox is oriented horizontally by default, meaning that its child nodes are dis
played next to each other from left to right. A vbox is oriented vertically by default, its child nodes dis
played one below the other from top to bottom. A box is a generic version that you can orient as you please, but its default is horizontal orientation, so it's pretty much equivalent to an hbox and it is seldom used. Here's a very simple example of an hbox with 3 child buttons: <hbox> <button l...
...d that localized strings may be significantly longer in other languages, specially much longer than English strings. You should avoid using long blocks text, and also avoid designing your UI so that everything fits just right around text. You should always keep in mind that the text can be much longer, and your UI should adapt to it. Labels should generally be short, and they should always be dis
played in a single line. Descriptions may be longer, and in general you should plan it so that they can wrap into multiple lines. In order to have wrapping descriptions, you need to set the text as a child node instead of using the value attribute: <description>&xulschoolhello.description.label;</description> Even then, the text will extend as much as it can in a single line, so you need to add so...
... at the end is the most common practice. Similarly as with wrapping, cropping will only occur is there is no room for the text to grow, so you'll need to restrict the width using CSS. Text links XUL makes it very easy for you to create a label that is also a link. All you need is to set the text-link class to the label, and add an onclick handler (oncommand won't work for this). The label is dis
played with the expected link style so that users can easily recognize it as a link. A trickier case is when you need only part of a label to be clickable, just like in HTML. Since labels can't handle rich text, workarounds have to implemented using Javascript. One possibility is to use special markup in a locale property so that the link can be easily recognized: xulschoolhello.linkedText.label = G...
Supporting search suggestions in search plugins - Archive of obsolete content
Firefox supports search suggestions in OpenSearch plugins; as the user types in the search bar, Firefox queries the URL specified by the search plugin to fetch live search suggestions. Once the list has been retrieved, it's dis
played in a popup box that appears under the search bar, which lets the user select a suggested search term. If the user continues to type, a new set of suggestions is requested from the search engine, and the dis
played list is refreshed. Implementing suggestion support in the search plugin To support search suggestions, a search plugin needs to define an extra <Url> element with its type attribute set to "application/x-suggestions+json". (This means that a suggestion-supporting engine plugin will have two <Url> elements, the other one being the main text/html s...
... match the current search term. completion list An array of suggested search terms. The array should be enclosed in square brackets. For example: ["term 1", "term 2", "term 3", "term 4"] descriptions This optional element is an array of descriptions for each of the suggestions in thecompletion list . These can be any additional information the search engine might want to return to be dis
played by the browser, such as the number of results available for that search. Descriptions are not supported in Firefox, and are ignored if any are specified. query URLs This optional element is an array of alternate URLs for each of the suggestions in thecompletion list . For example, if you want to offer a map link instead of just a search result page for a given suggestion, you can return an ...
...ving out the optional elements. Your completion list can include as many suggestions as you like, although it should be kept manageable, given that the display will be updating live while the user is typing their search string. In addition, the method you use to select suggestions is entirely up to you. Note: Firefox requires that suggest requests complete within 500ms for suggestions to be dis
played. If the request for the suggest URL does not return data before 500ms have elapsed, no search suggestions will be shown. ...
Adding preferences to an extension - Archive of obsolete content
tus bar panel. The first thing we need to do is get the currently configured stock symbol to watch from the preferences. To do so, we call the nsIPrefBranch.getCharPref() method, specifying that we want the preference named "symbol", which is where we store the user's selection for the stock to watch. We forcibly convert the symbol to upper-case since that's the way stock symbols are normally dis
played. Next, we call our own refreshInformation() method to immediately fetch and display the current information about the stock the extension is configured to monitor. We'll look at the details of how this method works later. The last thing the startup() method does is to call the window.setInterval() DOM method to set up a callback that will automatically run our refreshInformation() method every ...
...ses the popup menu we'll be adding to change what stock they're watching. watchStock: function(newSymbol) { this.prefs.setCharPref("symbol", newSymbol); }, The only new information for us here is the call to the preference object's setCharPref() function, which sets the value of the "symbol" preference. Note that this call results in our StockWatcher.observe() method being invoked and dis
played stock information being updated. refreshInformation() This method is slightly revised from previous versions, in that it needs to fetch the preference for the stock to watch and use that to construct the URL to monitor, as well as to construct the string to be dis
played in the status bar panel. refreshInformation: function() { // Because we may be called as a callback, we can't rely on ...
... The Refresh Now option calls the StockWatcher.refreshInformation() function, to refresh the display. The rest of the options call the StockWatcher.watchStock() function to start watching a different stock. For a more detailed tutorial on creating popup menus, see XUL Tu...
XML data - Archive of obsolete content
original data in the XML file. You see the actual tags that define the data's structure. By linking a CSS stylesheet with the XML document, you can define other ways to display it. To do this, your stylesheet uses rules that map tags in the XML document to the display types used by HTML. Example Data in an XML document uses <INFO> tags. ...
... stylesheet with the XML document, you can define other ways to display it. To do this, your stylesheet uses rules that map tags in the XML document to the display types used by HTML. Example Data in an XML document uses <INFO> tags. You want the document's INFO elements to be dis
played like HTML paragraphs. In the document's stylesheet, you specify how INFO elements are to be dis
played: INFO { display: block; margin: 1em 0; } The most common values for the display property are: block Dis
played like HTML's DIV (for headings, paragraphs) inline Dis
played like HTML's SPAN (for emphasis within text) Add your own style rules that specify the font, spacing and other details in the same way as for HTML. More details ...
...owser: Oceans Arctic Area: 13,000 million km2 Mean depth: 1,200 m Atlantic Area: 87,000 million km2 Mean depth: 3,900 m . . . Notes about this demonstration: The superscript 2 (in "million km2") a Unicode character, coded as \B2 in the CSS file. The heading, "Oceans", has a negative top margin, moving it up so it is dis
played on top of the border. Challenge Change the stylesheet so that it displays the document as a table. (See the Tables chapter in the CSS Specification for examples that you can adapt.) What next? If you had difficulty understanding this page, or if you have other comments about it, please contribute to its Discussion page. This is the last page of the tutorial. For more ...
Layout System Overview - Archive of obsolete content
formatting and when to apply legacy formatting is controlled by the document's DOCTYPE specification. These layout modes are referred to as 'Standards' and 'NavQuirks' modes. (DOCTYPE and modes are explained in more detail in article Mozilla's DOCTYPE sniffing. Galley and Page Presentations: The presentation generally is constrained by the width of the window in which the presentation is to be dis
played, and a height that extends as far as necessary. This is referred to as the Galley Mode presentation, and is what one expects from a typical browser. Additionally, layout must support a paginated presentation, where the width of the presentation is constrained by the dimensions of the printed output (paper) and the height of each page is fixed. This paged presentation presents several challenges n...
...cated somewhat by the notion of incrementalism. One of the goals of the Layout system's design is to create parts of the presentation as they become available, rather than waiting for the entire document to be read, parsed, and then presented. This is a major benefit for large documents because the user does not have to wait for the 200th page of text to be read in before the first page can be dis
played - they can start reading something right away. So really, this sequence of operations Resolve Style, Create Frame, Layout Frame, gets repeated many times as the content becomes available. In the normal in-flow case this is quite natural because the sequential addition of new content results in sequential addition of new frames, and because everything is in-flow, the new frames do not influence th...
... (content elements that require multiple frames have primary and secondary frames; only the primary frame is mapped). The Frame Manager is then instructed to store the mapping from a content element to the primary frame. This mapping facilitates updates to frames that result in changes to content (see discussion above). Another important mapping maintained by the Frame Manager is that of the undis
played content. When a content element is defined as having no display (via the CSS property 'display:none') it is noted by a special entry in the undis
played map. This is important because no frame is generated for these elements yet changes to their style values and to the content elements still need to be handled by layout, in case their display state changes from 'none' to something else. The Undisp...
Introducing the Audio API extension - Archive of obsolete content
function loadedMetadata() { channels = audio.mozChannels; rate = audio.mozSampleRate; frameBufferLength = audio.mozFrameBufferLength; } var audio = document.getElementById('audio-element'); audio.addEventListener('loadedmetadata', loadedMetadata, false); </script> </body> </html> The MozAudioAvailable event As the audio is
played, sample data is made available to the audio layer and the audio buffer (size defined in mozFrameBufferLength) gets filled with those samples. Once the buffer is full, the event MozAudioAvailable is triggered. This event therefore contains the raw samples of a period of time. Those samples may or may not have been
played yet at the time of the event and have not been adjusted for mute or volume se...
...tion of the last heard sample. // Get current audible position of the underlying audio stream, measured in samples. var currentSampleOffset = audioOutput.mozCurrentSampleOffset(); Audio data written using the mozWriteAudio() method needs to be written at a regular interval in equal portions, in order to keep a little ahead of the current sample offset (the sample offset that is currently being
played by the hardware can be obtained with mozCurrentSampleOffset()), where "a little" means something on the order of 500 ms of samples. For example, if working with two channels at 44100 samples per second, a writing interval of 100 ms, and a pre-buffer equal to 500 ms, one would write an array of (2 * 44100 / 10) = 8820 samples, and a total of (currentSampleOffset + 2 * 44100 / 2). It's also possib...
... means something on the order of 500 ms of samples. For example, if working with two channels at 44100 samples per second, a writing interval of 100 ms, and a pre-buffer equal to 500 ms, one would write an array of (2 * 44100 / 10) = 8820 samples, and a total of (currentSampleOffset + 2 * 44100 / 2). It's also possible to auto-detect the minimal duration of the pre-buffer, such that the sound is
played without interruptions, and lag between writing and playback is minimal. To do this start writing the data in small portions and wait for the value returned by mozCurrentSampleOffset() to be greater than 0. var prebufferSize = sampleRate * 0.020; // Initial buffer is 20 ms var autoLatency = true, started = new Date().valueOf(); ... // Auto latency detection if (autoLatency) { prebufferSize = Ma...
Sorting Results - Archive of obsolete content
rder of the results will just be the order that the template builder generates the results. For ascending or descending sorts, this doesn't matter, since it will ignore whether results are containers and just sort by a value, alphabetically or numerically depending on the type of data. When using a tree, sorting may be performed on each column of the tree. For instance, if a list of photos was dis
played in a two column tree showing the title and description, you could sort by either title or description. The user can change the sort column and direction by clicking the column headers, however, you can programmatically change the sort as well. Sorting Tree Results We'll examine sorting of trees first since trees are the most common element used with sorted items. Using a tree builder, you can sor...
... not actually necessary. For instance, in the example the second column sorts by date, but if you were to use a different variable such as ?description, the tree would sort by the value of the description variable for each row. In almost all situations however, you would normally sort using the same variable used for the label value. However, one situation where this is not desirable is if the dis
played values would not generate the correct order as there is a different representation that is more accurate. For example, the date 'May 15' would appear after 'August 24' when sorted purely alphabetically but before it when sorted chronologically. For RDF datasources, another way to sort by dates is to use the the parseType="Date" construct in the RDF datasource. This marks a literal as being a date...
...r after 'August 24' when sorted purely alphabetically but before it when sorted chronologically. For RDF datasources, another way to sort by dates is to use the the parseType="Date" construct in the RDF datasource. This marks a literal as being a date value rather than a string. The builder will recognize this and sort chronologically instead. This also has the advantage that the dates will be dis
played according to the user's current locale (meaning that the date is formatted so as to be suitable for the user's language). Here is a sample of how to specify this in the RDF/XML datasource: <rdf:RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:r="http://www.xulplanet.com/rdf/" xmlns:nc="http://home.netscape.com/NC-...
Adding HTML Elements - Archive of obsolete content
ld use these elements when you can. You can also add labels to controls either by using the HTML label element, or you can simply put the text inside another HTML block element (such as p or div) as in the example below. ...
...block element (such as p or div) as in the example below. Example 1 : Source View <html:p> Search for: <html:input id="find-text"/> <button id="okbutton" label="OK"/> </html:p> This code will cause the text 'Search for:' to be dis
played, followed by an input element and an OK button. Notice that the XUL button can appear inside the HTML elements, as it does here. Plain text will only be dis
played when placed inside an HTML element that would normally allow you to display text (such as a p tag). Text outside of one will not be dis
played, unless the XUL element the text is inside allows this (the description element, for example). The examples below may help. Examples of HTML elements What follows are some examples of adding HTML elements to windows. In each case, the window and other commo...
...d to place the text in and another was used to break apart the text into multiple lines. Text outside of HTML blocks Example 3 : Source View <html:div> Would you like to save the following documents? <html:hr/> </html:div> Expense Report 1 What I Did Last Summer <button id="yes" label="Yes"/> <button id="no" label="No"/> As can be seen in the image, the text inside the div tag was dis
played but the other text (Expense Report 1 and What I Did Last Summer) was not. This is because there is no HTML or XUL element capable of displaying text enclosing it. To have this text appear, you would need to put it inside the div tag, or enclose the text in a description tag. Note: Due to bug 554290, this text actually does render in Gecko 1.9.2 and later. Invalid HTML elements <html:po>Case 1</...
Anonymous Content - Archive of obsolete content
below will be expanded as follows, assuming that the scrollbar is bound to the XBL above: <scrollbar/> expands to: <scrollbar> <xul:scrollbarbutton type="decrement"/> <xul:slider flex="1"> <xul:thumb/> </xul:slider> <xul:scrollbarbutton type="increment"/> </scrollbar> The elements within the content tag are added to the scroll bar anonymously. Although anonymous content is dis
played on screen, you cannot get to it through a script in the normal way. To the XUL, it's as if there was only one single element, even though it is really made up of a number of elements. If you look at a scroll bar in a Mozilla window, you will see that it is made up of an arrow button, a slider, a thumb inside it and a second arrow button at the end, which are the elements that appear in the XBL ab...
... the files in the bindings directory in the toolkit package. This only applies to the elements defined within the content tag. Properties, methods and other aspects of XBL are still available whether the content is from XBL or whether the XUL provides its own content. Using the Children Element There may be times when you want both the XBL content and the content provided by the XUL file to be dis
played. You can do this by using the children element. The children added in the XUL are added in place of the children element. This is handy when creating custom menu widgets. For example, a simplified version of an editable menulist element, might be created as follows: XUL: <menu class="dropbox"> <menupopup> <menuitem label="1000"/> <menuitem label="2000"/> </menupopup> </menu> CSS: m...
...ildren tag. Other elements will not match this tag. You can place multiple children elements in a binding to place different types of content in different places. If an element in the XUL does not match any of the children elements, that element (and any others that don't match) will be used instead of the bound content. Here is another example. Let's say that we wanted to create a widget that dis
played an image with a zoom in and zoom out button on each side of it. This would be created with a box to hold the image and two buttons. The image element has to be placed outside the XBL as it will differ with each use. XUL: <box class="zoombox"> <image src="images/happy.jpg"/> <image src="images/angry.jpg"/> </box> XBL: <binding id="zoombox"> <content> <xul:box flex="1"> <xul:butt...
Content Panels - Archive of obsolete content
display HTML pages or other XUL files. Adding Child Panels There may be times when you want to have part of a document loaded from a different page. Sometimes, you will want to change part of the window. A good example is a step-by-step wizard that guides you through a number of screens, asking a set of questions. Each time the user clicks the Next button, the next screen of the wizard is dis
played. You could create a wizard interface by opening a different window for each screen. There are three problems with this approach. First, each window could appear in a different location (although there are ways around this). Second, the elements such the Back and Next buttons are the same throughout the interface. It would be much better if just the content area of the wizard changed. Third, it wo...
...n be placed anywhere and the contents can be loaded from a different file. Set the URL to appear in the frame with the src attribute. This URL may point to any kind of file, although it will usually point to an HTML file or another XUL file. You can use a script to change the contents of the iframe without affecting the main window. In the Mozilla browser window, the area where the web page is dis
played is created by using an iframe. When the user enters a URL or clicks on a link in a document, the source of the frame is changed. iframe example Example 1 : Source View <toolbox> <toolbar id="nav-toolbar"> <toolbarbutton label="Back" /> <toolbarbutton label="Forward" /> <textbox id="urlfield" /> </toolbar> </toolbox> <iframe id="content-body" src="http://www.mozilla.org/index...
...eed a simple panel. A similar element, tabbrowser, provides the functionality of browser but also provides a tab bar for switching between multiple pages. This is the widget used by the Mozilla browser for its tabbed browsing interface. The tabbrowser element is actually implemened as a tabbox containing a set of browser elements. Both types of browser offer similar control over pages that are dis
played. browser example Example 2 : Source View <browser src="http://www.mozilla.org" flex="1" /> As with the iframe, you can specify the url in a browser using the src attribute. For a tabbrowser, you cannot set the url directly like this, as it doesn't display just one url. Instead, you must use a script and call the loadURI function. There are three classes of browser, depending on the kind o...
Document Object Model - Archive of obsolete content
he tree of XUL nodes. When an XUL file is loaded, the tags are parsed and converted into a hierarchical document structure of nodes, one for each tag and block of text. The DOM structure may be examined and modified using various methods provided for this purpose. Specific XUL elements also provide additional functions which may be used. Each XUL file that is loaded will have its own document dis
played in a window or frame. Although there is only ever one document associated with a window at a time, you may load additional documents using various methods. In Mozilla, the DOM may be accessed and manipulated using JavaScript. The various DOM objects have functions which may be accessed in script, however, it is important to note that the DOM is an API that is accessible by JavaScript. JavaScript...
...t is important to note, however, that the open() method returns before the window has fully loaded, so functions will not typically be available yet. The window object isn't defined by any DOM specification, but in Mozilla is sometimes considered part of DOM Level 0, a name used by some developers to refer to the DOM-like functions before they were added to specifications. The actual document dis
played in a window can be retrieved using the window's document property. Since it is one of the most commonly referenced properties of the window, the document property is usually referenced without the 'window.' qualifier. Mozilla provides several different document objects depending on the kind of document. The three main documents are HTMLDocument, XMLDocument, and XULDocument, for HTML, XML and XU...
...ds to the id of the case sensitive checkbox. Once we have an indication of whether it is checked or not, we can use the state to perform the search. We could do something similar for the other check box, or any other element that has an id. We'll need to get the text in the input field for example. Our find files example It doesn't make sense to have the progress bar and the dummy tree data dis
played when the find files dialog is first dis
played. These were added so that we could see them. Let's take them out now and have them dis
played when the Find button is pressed. First, we need to make them initially invisible. The hidden attribute is used to control whether an element is visible or not. We'll change the progress meter so that its initially hidden. Also, we'll add an id attribute so th...
XUL Structure - Archive of obsolete content
zilla, XUL is handled in much the same way as HTML or other types of content are handled. When you type the URL of an HTML page into the browser's address field, the browser locates the web site and downloads the content. The Mozilla rendering engine takes the content in the form of HTML source and transforms it into a document tree. The tree is then converted into a set of objects that can be dis
played on the screen. Style sheets (CSS), images, and other technologies are used to control the presentation. XUL functions in much the same way. In fact, in Mozilla, all document types, whether they are HTML or XUL, or even SVG, are all handled by the same underlying code. This means that the same CSS properties may be used to style both HTML and XUL, and many of the features can be shared between bo...
...ill occur if a web page tries, for example, to read a local file. However, a file loaded via a chrome URL will be able to read files with the same access privileges as the installed extension. This distinction is important. This means that there are certain things that content of web pages cannot do, such as read the user's bookmarks. This distinction is not based on the kind of content being dis
played; only on the type of URL used. Both HTML and XUL placed on a web site have no extra permissions; however both HTML and XUL loaded through a chrome URL have enhanced permissions. Remote XUL was disabled in Firefox 8, so the following is of historic interest only. If you are going to use XUL on a web site, you can just put the XUL file on the web site as you would an HTML file, and then load its ...
...lled editor.xul. Scripts are placed in separate files alongside the XUL files. Skin - Style sheets, images and other theme specific files Style sheets describe details of the appearance of a window. They are stored separately from XUL files to facilitate modifying the skin (theme) of an application. Any images used are stored here also. Locale - Locale specific files All the text that is dis
played within a window is stored separately. This way, a user can have a set for their own language. Content Packages The name of the JAR file might describe what it contains, but you can't be sure unless you view its contents. Let's use the browser package included with Firefox as an example. If you extract the files in browser.jar, you will find that it contains a directory structure much like the ...
XUL controls - Archive of obsolete content
tem label="Lions" value="l"/> <menuitem label="Tigers" value="t"/> <menuitem label="Bears" value="b"/> </menupopup> </menulist> More information about the menulist element. Menulist Reference Related Elements: menupopup menuitem <menulist editable="true"> An editable menulist is like a standard menulist except that the selected value is dis
played in a textbox where it may be modified directly or values not in the popup list may be entered. <menulist editable="true"> <menupopup> <menuitem label="Elephants"/> <menuitem label="Kangaroos"/> <menuitem label="Bats" /> </menupopup> </menulist> More information about the editable menulist element. Menulist Reference Related Elements: menupopup menuitem...
... <textbox type="autocomplete"> A textbox that provides a dropdown showing matches that would complete what the user types. The user can select one to have it filled into the textbox. <textbox type="autocomplete" autocompletesearch="history"/> Textbox Reference <textbox type="number"> A textbox for entering numbers. Two arrow buttons are dis
played for cycling through values. <textbox type="number" min="1" max="20"/> Textbox Reference <textbox type="password"> A textbox that hides the characters typed, used for entering passwords. <textbox type="password"/> Textbox Reference <textbox type="search"> A textbox for searching. <textbox type="search"/...
...ser input. The command event is fired after the user stops typing, or if the user tabs away or hits Enter. <textbox type="timed"/> Textbox Reference <timepicker> A timepicker displays a set of textboxes for entering a time. <timepicker value="12:05"/> Timepicker Reference <toolbarbutton> A button that is dis
played on a toolbar. <toolbarbutton label="Reload"/> More information about the toolbarbutton element. Toolbarbutton Reference Related Elements: toolbar <toolbarbutton type="menu"> A button that is dis
played on a toolbar with a drop down menu attached to it. <toolbarbutton type="menu" label="Show"> <menupopup> <menuitem label="Toolbars"/>...
menuitem - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description Type: string Descriptive text to appear in addition to th...
... to update additional state. image Type: URI The URI of the image to appear on the element. If this attribute is empty or left out, no image appears. The position of the image is determined by the dir and orient attributes. Note: The menuitem must have a class of menuitem-iconic for the image to appear. key Type: id Set to the id of a key element whose key shortcut is dis
played in the menuitem. label Type: string The label that will appear on the element. If this is left out, no text appears. For an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. name Type: string name Radio menuitems with the same name as put into a group. Only one menuitem in each radio group can be c...
... to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. accessKey Type: character Gets and sets the value of the accesskey attribute. command Type: element id Gets and sets the value of the command attribute. control Type: menu element Returns the enclosing menu tha...
menupopup - Archive of obsolete content
e the window border. There are several ways in which a menupopup may be used: It may be placed inside a menu, menulist, toolbarbutton, or a button with the type attribute set to "menu" to create a popup that will open when the menu or button is pressed. It may be attached to any element using the popup attribute. When the element is clicked with the left mouse button, the menupopup will be dis
played. It may be attached to any element using the context attribute. When a context menu is opened, the menupopup will be dis
played. A context menu may be opened by right-clicking the element, or by pressing the menu key on the keyboard. More information is available in the XUL tutorial and Popup Guide. Attributes ignorekeys, left, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, pos...
... label="Mozilla" value="http://mozilla.org"/> <menuitem label="Slashdot" value="http://slashdot.org"/> <menuitem label="Sourceforge" value="http://sf.net"/> <menuitem label="Freshmeat" value="http://freshmeat.net"/> </menupopup> </menulist> The following example shows how a menupopup can be used as a context menu for an element. When the label is right-clicked, the menu will be dis
played. <menupopup id="clipmenu"> <menuitem label="Cut"/> <menuitem label="Copy"/> <menuitem label="Paste"/> </menupopup> <label value="Right click for popup" context="clipmenu"/> Attributes ignorekeys Type: boolean If true, keyboard navigation between items in the popup is disabled. left Type: integer Overrides the horizontal position of the popup specified by the showPopup...
... 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 intended to be dis
played only temporarily; they are not expected to be dis
played 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 ...
toolbarbutton - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } dir Type: one of the values below The direction in which the child el...
...rder that they appear in the XUL source. tabindex Type: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. title Type: string This functionality only applies when toolbarbutton is used in the Customize Toolbar dialog. The text that is dis
played as a button's label when it's in the Customize Toolbar palette. It overrides the value of label, which is used if title is not set. This does not affect the button's label when it is in a toolbar, which remains determined by the label attribute. type Type: string The type of button. If this attribute is not present, a normal button is created. You can set this attribute to the value me...
...e of label, which is used if title is not set. This does not affect the button's label when it is in a toolbar, which remains determined by the label attribute. type Type: string The type of button. If this attribute is not present, a normal button is created. You can set this attribute to the value menu to create a button with a menu popup. This will typically cause the button to be dis
played differently. menu: Set the type attribute to the value menu to create a button with a menu popup. Place a menupopup element inside the button in this case. The user may click anywhere on the button to open and close the menu. menu-button: You can also use the value menu-button to create a button with a menu. Unlike the menu type, this type requires the user to press the arrow to open the men...
tooltip - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } default Type: boolean If true, the tooltip is used as the default pop...
... sizeTo( width, height ) Return type: no return value Changes the current size of the popup to the new width and height. Related TBD ...
...fset 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 intended to be dis
played only temporarily; they are not expected to be dis
played permanently. sizeTo( width, height ) Return type: no return value Changes the current size of the popup to the new width and height. Related TBD ...
treecol - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } cycler Type: boolean If true, then the column is a cycler column. In ...
... fixed Type: boolean If true, the size of the column in the tree cannot be adjusted by the user. Any splitter to either side will resize those columns while keeping the fixed column at a constant size. If false or not specified, the user can adjust the size of the column, typically by dragging the column header with the mouse. hidden Type: boolean If set to true, the element is not dis
played. This is similar to setting the CSS display property to 'none'. hideheader Type: boolean Set this to true to indicate that the tree column header should be dis
played without any column header styling. If you don't set a label for that column either, the header is not dis
played at all. ignoreincolumnpicker Type: boolean If true, the column does not appear in the column picker. ...
...ibute to specify the sort key. ascending The data is sorted in ascending order. descending The data is sorted in descending order. natural The data is sorted in natural order, which means the order that it is stored in. src Type: URI Set this attribute to have the treecol element use an image for the header instead of a label. You cannot have both an image and a label dis
played in the header. Set this to the URL of an image to appear on the tree column header. If this attribute is left out, no image appears and the label is used instead. The class treecol-image must be used on the treecol element for the image to appear. You should still specify a label for use in the column picker if ignoreincolumnpicker is not true and hidecolumnpicker is not true on the tree. ...
wizard - Archive of obsolete content
Properties | Methods | Related ] This element is used to construct a step-by-step wizard found in some applications to guide users through a task. It is used for a window with several steps contained on several pages. This element provides the header and buttons along the bottom, and also handles navigation between the pages. Each page should be constructed using a wizardpage. The pages are dis
played in the order that they are placed in the wizard, unless you use the next and pageid attributes on the pages to change the sequence. The wizard will rendered in a manner suitable for the user's selected theme and platform. In newer versions of Mozilla, a statusbar may be placed directly inside the wizard element which will be shared among all pages. More information is available in the XUL tutori...
...o go to the previous page. If this property is false, the user cannot navigate to the previous page. Set this property to true to indicate that the user can go back a page. Set to false to disallow moving to the previous page. This has the effect of enabling or disabling the Back button. currentPage Type: wizardpage element This property returns the wizardpage element that is currently dis
played. You can modify this value to change the current page. onFirstPage Type: boolean This property is set to true if the user is on the first page, which may or may not be the first index. onLastPage Type: boolean This property is set to true if the user is on the last page of the wizard. pageCount Type: integer This property holds the number of pages in the wizard. page...
...thod to cancel and close the wizard. getButton( type ) Return type: button element Returns the button element in the dialog corresponding to the given type. getPageById( pageID ) Return type: wizardpage element Returns the wizardpage element corresponding to the specified pageID. goTo( pageID ) Return type: no return value This method is used to change which page is currently dis
played, specified by the pageID argument. The page will be changed regardless of the value of canAdvance or canRewind. rewind() Return type: no return value Call this method to go back a page. It is equivalent to pressing the Back button. The canRewind property must be set to true for the page to be changed. Related wizardpage ...
Common Firefox theme issues and solutions - Archive of obsolete content
n Linux: the styling of drop down select box fields may show both a drop arrow and up/down spinner arrows. The problem is commonly caused by a -moz-appearance:menulist style rule in chrome://global/skin/menulist.css. Once the offending rule is found, it should be deleted and manual styling used. App button not styled on Linux, but is styled on Windows On Linux the Firefox app button that is dis
played when tabs are on top and menu bar is disabled is not styled properly compared to Windows and is not changing colors when in private browsing mode. The cause of this issue is that Linux Firefox uses a different ID for the Firefox button from Windows. The fix is to make sure any style rule that references #appmenu-button also has a comparable reference to #appmenu-toolbar-button in chrome://browser...
.../browser.css. If your Firefox button relies on some button styling from toolbarbuttons.css you'll need to add comparable style rules for #appmenu-toolbar-button in browser.css. Toolbars and menus Firefox application button Application button doesn't change styling for private browsing mode When in private browsing mode there needs to be a visual difference to the Firefox app button that is dis
played when tabs are on top and the menu bar is disabled. Text only toolbar buttons not aligned properly When text only toolbar buttons are selected in customize toolbars, text labels in toolbar buttons may not align properly. The common cause of this is style rules that reference [iconsize="small"] without excluding [mode="text"]. The solution usually is to append :not ([mode="text"]) to those style ...
...delines No visual clue for disabled url bars There needs to be a visual clue when URL bar is disabled. To test this please go to bug 324777 using the default theme and activate the "click me" link. The URL bar of the resulting popup window is disabled. Address bar "door hangers" Door hanger sync panel not styled The sync panel at the bottom of the "door hanger" for the save password panel dis
played when a user logs into a website needs to be styled to match rest of panel including border. This issue also applies to the edit bookmark panel, which is activated by double clicking on the bookmark star in the URL bar. For details, please see bug 708797. "About" Pages about:addons Disabled add-on Icons are not grey scale In Tools > Add-ons, the icons of disabled icons need to be converted to ...
Mozilla XForms User Interface - Archive of obsolete content
s that are used to build the user interface presentation in a form. appearance - the value provided by the form author gives a hint to the processor as to which widget to use to represent the XForms control. Three possible values are available to the author: minimal, compact and full. Generally speaking, the main purpose for these values is to reflect how much space (screen real estate) the dis
played widget will take. tabindex - defines the keyboard navigation sequence between controls. accesskey - keyboard shortcut for moving focus to an XForms element. Binding attributes Single-Node (see the spec) and Node-Set (see the spec) attributes are used to bind XForms elements to instance nodes. These attributes are: ref, nodeset, model and bind. XForms Elements Almost every XForms element can ...
...l Elements These elements may be used as child elements to the form controls described above. label Specifies the label for the xforms control (see the spec). Every form control other than the output element must contain a label element. It is valid for a form control to have an empty label element. help Specifies contextual help for the containing form control (see the spec). The help will be dis
played if the F1 key is pressed while the containing form control has focus. hint Similar to a tooltip (see the spec). The hint is dis
played when the mouse moves and pauses over the containing form control. alert This message will be shown when the form control cannot properly bind to instance data or when the instance data value is invalid or out of the specified range of selectable values (see the spe...
... the elements. Elements in this section do not have any behaviors that are dependent on the host language. group This element is used to logically group xforms elements together (see the spec). switch This element is used in conjunction with case and toggle elements (see the spec). The switch element contains case elements which in turn contain markup. Only the contents of a single case may be dis
played at one time. The toggle element is used (as an event handler) to make a case visible and thereby hiding all other case elements contained by the same switch. repeat A repeat element contains markup and is itself bound to a nodeset in an instance document (see the spec). For each node in the nodeset, the contents of the repeat element will be dis
played in the form. That node will serve as the cont...
Responsive design - Learn web development
me pixellated if the column becomes wider than the image. The third key component was the media query. Media Queries enable the type of layout switch that Cameron Adams had previously explored using JavaScript, using only CSS. Rather than having one layout for all screen sizes, the layout could be changed. Sidebars could be repositioned for the smaller screen, or alternate navigation could be dis
played. It is important to understand that responsive web design isn't a separate technology -- it is a term used to describe an approach to web design or a set of best practices, used to create a layout that can respond to the device being used to view the content. In Marcotte's original exploration this meant flexible grids (using floats) and media queries, however in the almost 10 years since that ...
...ate Recommendation in 2009, meaning that it was deemed ready for implementation in browsers. Media Queries allow us to run a series of tests (e.g. whether the user's screen is greater than a certain width, or a certain resolution) and apply CSS selectively to style the page appropriately for the user's needs. For example, the following media query tests to see if the current web page is being dis
played as screen media (therefore not a printed document) and the viewport is at least 800 pixels wide. The CSS for the .container selector will only be applied if these two things are true. @media screen and (min-width: 800px) { .container { margin: 1em 2em; } } You can add multiple media queries within a stylesheet, tweaking your whole layout or parts of it to best suit the various screen ...
... to responsive images was as described in Marcotte's early articles on responsive design. Basically, you would take an image that was at the largest size that might be needed, and scale it down. This is still an approach used today, and in most stylesheets, you will find the following CSS somewhere: img { max-width: 100%; } There are obvious downsides to this approach. The image might be dis
played a lot smaller than its intrinsic size, which is a waste of bandwidth -- a mobile user may be downloading an image several times the size of what they actually see in the browser window. In addition, you may not want the same image aspect ratio on mobile as on desktop. For example, it might be nice to have a square image for mobile, but show the same scene as a landscape image on desktop. Or, ackn...
Client-side form validation - Learn web development
thods available on the above elements. checkValidity(): Returns true if the element's value has no validity problems; false otherwise. If the element is invalid, this method also fires an invalid event on the element. setCustomValidity(message): Adds a custom error message to the element; if you set a custom error message, the element is considered to be invalid, and the specified error is dis
played. This lets you use JavaScript code to establish a validation failure other than those offered by the standard HTML5 validation constraints. The message is shown to the user when reporting the problem. Implementing a customized error message As you saw in the HTML5 validation constraint examples earlier, each time a user tries to submit an invalid form, the browser displays an error message. Th...
...cript code to establish a validation failure other than those offered by the standard HTML5 validation constraints. The message is shown to the user when reporting the problem. Implementing a customized error message As you saw in the HTML5 validation constraint examples earlier, each time a user tries to submit an invalid form, the browser displays an error message. The way this message is dis
played depends on the browser. These automated messages have two drawbacks: There is no standard way to change their look and feel with CSS. They depend on the browser locale, which means that you can have a page in one language but an error message dis
played in another language, as seen in the following Firefox screenshot. Customizing these error messages is one of the most common use cases of...
...nged. Inside the contained code, we check whether the email input's validity.typeMismatch property returns true, meaning that the contained value doesn't match the pattern for a well-formed email address. If so, we call the setCustomValidity() method with a custom message. This renders the input invalid, so that when you try to submit the form, submission fails and the custom error message is dis
played. If the validity.typeMismatch property returns false, we call the setCustomValidity() method an empty string. This renders the input valid, so the form will submit. You can try it out below: Note: You can find this example live on GitHub as custom-error-message.html (see also the source code.) A more detailed example Now that we've seen a really simple example, let's see how we can use t...
Other form controls - Learn web development
The browser usually sets them visually apart from the options (i.e. by being bolded and at a different nesting level) so they are less likely to be confused for actual options. If an <option> element has an explicit value attribute set on it, that value is sent when the form is submitted with that option selected. If the value attribute is omitted, as wit...
... Note: All browsers that support the <select> element also support the multiple attribute. Autocomplete box You can provide suggested, automatically-completed values for form widgets using the <datalist> element with child <option> elements to specify the values to display. The <datalist> needs to be give...
...th the <input> and the <select> are collected server-side. Less obvious datalist uses According to the HTML specification, the list attribute and the <datalist> element can be used with any kind of widget requiring a user input. This leads to some uses of it that might seem a little non-obvious. For example, in browsers that support <datalist> on range input types, a small tick mark will be dis
played above the range for each datalist <option> value. You can see an implementation example of this on the <input type="range"> reference page. And browsers that support <datalist>s and <input type="color"> should display a customized palette of colors as the default, while still making the full color palette available. In this case, different browsers behave differently from case to case, so consi...
Introduction to events - Learn web development
, set of elements, the HTML document loaded in the current tab, or the entire browser window. There are many different types of events that can occur. For example: The user selects a certain element or hovers the cursor over a certain element. The user chooses a key on the keyboard. The user resizes or closes the browser window. A web page finishes loading. A form is submitted. A video is
played, paused, or finishes. An error occurs. You can gather from this (and from glancing at the MDN Event reference) that there are a lot of events that can be responded to. Each available event has an event handler, which is a block of code (usually a JavaScript function that you as a programmer create) that runs when the event fires. When such a block of code is defined to run in response to an e...
...) { const rndCol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundColor = rndCol; } btn.onclick = bgChange; There are many different event handler properties available. Let's experiment. First, make a local copy of random-color-eventhandlerproperty.html, and open it in your browser. It's just a copy of the simple random color example we've
played with already. Now try changing btn.onclick to the following different values in turn, and observing the results in the example: btn.onfocus and btn.onblur -- The color changes when the button is focused and unfocused; try pressing the tab to focus on the button and press the tab again to focus away from the button. These are often used to display information about filling in form fields when t...
...d hides a <div> with a <video> element inside it: <button>Display video</button> <div class="hidden"> <video> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>Your browser doesn't support HTML5 video. Here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> </div> When the <button> is selected, the video is dis
played, by changing the class attribute on the <div> from hidden to showing (the example's CSS contains these two classes, which position the box off the screen and on the screen, respectively): btn.onclick = function() { videoBox.setAttribute('class', 'showing'); } We then add a couple more onclick event handlers -- the first one to the <div> and the second one to the <video>. Now, when the area of...
Video and Audio APIs - Learn web development
op of the CSS we use a @font-face block to import a custom web font. This is an icon font -- all the characters of the alphabet equate to common icons you might want to use in an application. Next we use generated content to display an icon on each button: We use the ::before selector to display the content before each <button> element. We use the content property to set the content to be dis
played in each case to be equal to the contents of the data-icon attribute. In the case of our play button, data-icon contains a capital "P". We apply the custom web font to our buttons using font-family. In this font, "P" is actually a "play" icon, so therefore the play button has a "play" icon dis
played on it. Icon fonts are very cool for many reasons -- cutting down on HTTP requests because you do...
...ely positioned to sit directly on top of the outer <div>. It is also given an initial width of 0, so you can't see it at all. As the video plays, the width will be increased via JavaScript as the video elapses. The <span> is also absolutely positioned to sit near the left hand side of the timer bar. We also give our inner <div> and <span> the right amount of z-index so that the timer will be dis
played on top, and the inner <div> below that. This way, we make sure we can see all the information -- one box is not obscuring another. Implementing the JavaScript We've got a fairly complete HTML and CSS interface already; now we just need to wire up all the buttons to get the controls working. Create a new JavaScript file in the same directory level as your index.html file. Call it custom-p...
...dia(): function stopMedia() { media.pause(); media.currentTime = 0; play.setAttribute('data-icon','P'); } there is no stop() method on the HTMLMediaElement API -- the equivalent is to pause() the video, and set its currentTime property to 0. Setting currentTime to a value (in seconds) immediately jumps the media to that position. All there is left to do after that is to set the dis
played icon to the "play" icon. Regardless of whether the video was paused or playing when the stop button is pressed, you want it to be ready to play afterwards. Seeking back and forth There are many ways that you can implement rewind and fast forward functionality; here we are showing you a relatively complex way of doing it, which doesn't break when the different buttons are pressed in an unexpe...
Arrays - Learn web development
0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background-color: #f5f9fa; } Active learning: Top 5 searches A good use for array methods like push() and pop() is when you are maintaining a record of currently active items in a web app. In an animated scene for example, you might have an array of objects representing the background graphics currently dis
played, and you might only want 50 dis
played at once, for performance or clutter reasons. As new objects are created and added to the array, older ones can be deleted from the array to maintain the desired number. In this example we're going to show a much simpler use -- here we're giving you a fake search site, with a search box. The idea is that when terms are entered in the search box, the top 5 pre...
... Note: In a real search app, you'd probably be able to click the previous search terms to return to previous searches, and it would display actual search results! We are just keeping it simple for now. ...
... number. In this example we're going to show a much simpler use -- here we're giving you a fake search site, with a search box. The idea is that when terms are entered in the search box, the top 5 previous search terms are dis
played in the list. When the number of terms goes over 5, the last term starts being deleted each time a new term is added to the top, so the 5 previous terms are always dis
played. Note: In a real search app, you'd probably be able to click the previous search terms to return to previous searches, and it would display actual search results! We are just keeping it simple for now. To complete the app, we need you to: Add a line below the // number 1 comment that adds the current value entered into the search input to the start of the array. This can be retrieved using...
Debugging Frame Reflow
ral Overview The frame reflow can be logged with the debug capabilities implemented in nsFrame.cpp. It provides the following information for each frame at the start of its reflow reflow reason available width, available height computed width, computed height the previous and the next frame in flow and a count number. When the frame's reflow is finished the following information is dis
played : reflow metric (desired) width, height max. element width maximum width frame status overflow area Getting the log Make sure that your build is a debug build (in short you need ac_add_options --enable-debug in your .mozconfig file). Create a text file (for instance reflow_rules.txt). Enter this line in the text file * 1 This should look like: point the GECKO_DISPL...
...started at rowG 00B984A4 r=2 a=1500,UC c=1500,UC cnt=879 where the previous information is used. The block has been required to compute the max. element size only once and it reports now: block 02D7BCF8 d=1410,300 The block shows the same address as the previous one. Frames with children that overflow the parent have the NS_FRAME_OUTSIDE_CHILDREN flag set. For these frames the overflow area is dis
played as block 025ED8F0 d=8940,1020 o=(0,0) 9180 x 1020. The overflow area is specified as (x,y) origin and width x height. The reflow finishes at the same level where it started. Advanced reflow debugging The previously described technique dumps the data for every frame. Sometimes the log is clearer if only the main frames are shown. The entries in the reflow log can be controlled on a frame level. Fo...
...w 0268A594 d=UC,20 VALUE 20 is not a whole pixel rowG 0268A02C d=UC,695 VALUE 695 is not a whole pixel While unaligned values at the entrance of a frame reflow can be ignored, when they appear at the exit of a routine this can cause display errors like stray lines. OS2 is very vulnerable to pixel alignment errors as text is drawn on pixel boundaries. GECKO_DISPLAY_REFLOW_INDENT_UNDIS
PLAYED_FRAMES Setting this option via set GECKO_DISPLAY_REFLOW_INDENT_UNDIS
PLAYED_FRAMES = 1 will cause an advance of the indent even for frames which are blocked via the reflow rules file. Original Document Information Author(s): Bernd Mielke Last Updated Date: December 4, 2004 Copyright Information: Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; co...
SVG Guidelines
This can be particularly true for icons. While SVG may scale well enough for flat-ish icons without a lot of detail, for icons that try to pack in a lot of detail graphic artists generally want to be able to pixel tweak. Performance While SVG provides a lot of flexibility in terms of scaling, themability, etc. this flexibility depends on doing computations for SVG images at the time they're dis
played, rather than at the time the author creates them. Consider an image that involves some complex gradients and filters. If saved as a raster image then the work to rasterize the gradients and filters takes place on the authors computer before the result is stored in the raster file. This work doesn't need to be redone when the image is dis
played on someone else's computer. On the other hand, if the...
...This isn't to say that SVG images are always slower than raster equivalents. ...
... specific tags and attributes (sketch:foo, illustrator:foo, sopodi:foo, ...) The XML namespace definition that comes with the latter (xmlns:sketch, xmlns:sopodi, ...) Other metadata In addition to non-standard editor metadata, standard compliant metadata also exists. Typical examples of this are <title> and <desc> tags. Although this kind of data is supported by the browser, it can only be dis
played when the SVG is opened in a new tab. Plus, in most of the cases, the filename is quite descriptive So it's recommended to remove that kind of metadata since it doesn't bring much value. You shouldn't include DOCTYPEs in your SVGs either; they are a source of many issues, and the SVG WG recommends not to include them. See SVG Authoring guidelines. Avoid the use of CDATA sections CDATA sections ...
Firefox and the "about" protocol
efox Reader View turned on. ...
... The array maps most of the URLs, like config to URLs in the chrome: pseudo protocol, such as chrome://global/content/config.xul. The about location information is duplicated in docshell/build/ns...
... The array maps most of the URLs, like config to URLs in the chrome: pseudo protocol, such as chrome://global/content/config.xul. The about location information is duplicated in docshell/build/nsDocShellModule.cpp. Note: You must access about: protocol pages by typing them in...
Using the Browser API
frame. Finally, we call blur() on the url bar to stop focusing it, so the keyboard moves off the screen, allowing us to get our full screen view back. There's another event listener added later on in the code that listens for the mozbrowserlocationchange event. When this fires, we set the value inside the URL bar input to be equal to the event object detail property -- this is so that the URL dis
played continues to match the website being shown when the user navigates back and forth through the history. browser.addEventListener('mozbrowserlocationchange', function (e) { urlBar.value = e.detail; }); Zooming in and out The browser content can be programmatically zoomed in and out using the HTMLIFrameElement.zoom() method. This takes a single method -- a zoom factor -- which dictates the perc...
...om(zoomFactor); }); zoomOut.addEventListener('touchend',function() { zoomFactor -= 0.1; browser.zoom(zoomFactor); }); Controlling the stop/reload button Next, let's talk about the stop/reload button. As in a traditional browser, this is a single button that acts as a reload button when the page has finished loading, and a stop button while the page is loading (each with a different icon dis
played). This is implemented in our sample app with the following functions: browser.addEventListener('mozbrowserloadstart',function() { stopReload.textContent = 'x'; }); browser.addEventListener('mozbrowserloadend',function(e) { canMoveBwd(); canMoveFwd(); stopReload.textContent = 'R'; console.log(e.detail.backgroundColor); controls.style.background = e.detail.backgroundColor; }); When t...
...provide a more integrated experience -- this can be read out of the event object's e.detail.backgroundColor value. When the front page of https://developer.mozilla.org is loaded, for example, the e.detail.backgroundColor value reported is rgb(0, 83, 159). Back to the stop/reload button -- updating the icon is nice, but we also need to update the functionality that is invoked when each icon is dis
played. We do this with the following function, which runs the HTMLIFrameElement.stop() method to stop the page loading if the button is displaying a cross, and the HTMLIFrameElement.reload() method to reload the page otherwise. stopReload.addEventListener('touchend',function() { if(stopReload.textContent === 'x') { browser.stop(); } else { browser.reload(); } }); Implementing the search...
Mozilla Web Developer FAQ
ked as follows: if(document.getElementById) { /* code that uses document.getElementById() */ } Why doesn't Mozilla display my alt tooltips? Contrary to a popular belief stemming from the behavior of a couple browsers running on the Windows platform, alt isn't an abbreviation for 'tooltip' but for 'alternative'. The value of the alt attribute is a textual replacement for the image and is dis
played when the image isn't. Mozilla doesn't display the alt attribute as a tooltip, because it has been observed that doing so encourages authors to misuse the attribute. When the alternative text is shown in a tooltip, some authors write bad alt texts, because they intend the text as auxiliary tooltip text and not as a replacement for the image. ('Bad' in the sense that the textual alternative is ...
...who don't see the image.) When the alternative text is shown in a tooltip, other authors don't want to supply textual alternatives at all, because they don't want tooltips to appear. (Again, making things harder for people who don't see the image.) There is another attribute that Mozilla shows as a tooltip: title. In fact, the HTML 4.01 specification suggests that the title attribute may be dis
played as a tooltip. However, this particular display method is not required and some other browsers show the title attribute in the browser status bar, for example. At this point some people feel compelled to post a "But IE..." rant in the newsgroups or in Bugzilla. Please note that Mac IE 5 behaves in the same way as Mozilla when it comes to the alt and title attributes. Windows IE also shows the tit...
...cy browsers or mobile browsers that opt not to download fonts due to file size). Why aren't symbol/dingbat fonts working? They are working. Characters in HTML 4 and XML documents are Unicode characters (even if the document has been encoded using a legacy encoding for transfer)--not font glyph indexes. <font face="Symbol">a</font> means the character LATIN SMALL LETTER A (U+0061) preferably dis
played using the Symbol font. Since the Symbol font does not have glyph for that character, another font is used. If you mean ?, you should use GREEK SMALL LETTER ALPHA (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 appl...
NSS tools : signtool
Specifies a special JavaScript directory. This option causes the specified directory to be signed and tags its entries as inline JavaScript. This special type of entry does not have to appear in the JAR file itself. Instead, it is located in the HTML page containing the inline scripts. When you use signtool -v, these entries are dis
played with the string NOT PRESENT. -k key ... directory Specifies the nickname (key) of the certificate you want to sign with and signs the files in the specified directory. The directory to sign is always specified as the last command-line argument. Thus, it is possible to write signtool -k MyCert -d . signdir You may have trouble if the nick...
...makes the manifest files (required by the JAR format) considerably smaller, but they contain slightly less information. --outfile outputfile Specifies a file to receive redirected output from Netscape Signing Tool. -p password Specifies a password for the private-key database. Note that the password entered on the command line is dis
played as plain text. -s keysize Specifies the size of the key for generated certificate. Use the -M option to find out what tokens are available. The -s option can be used with the -G option only. -t token Specifies which available token should generate the key and receive the certificate. Use the -M option to find out what tokens ...
...- VeriSign, Inc. GTE CyberTrust Root CA Uptime Group Plc. Class 4 CA * Verisign Object Signing Cert Integrion CA GTE CyberTrust Secure Server CA AT&T Directory Services * test object signing cert Uptime Group Plc. Class 1 CA VeriSign Class 1 Primary CA - ------------ Certificates that can be used to sign objects have *'s to their left. Two signing certificates are dis
played: Verisign Object Signing Cert and test object signing cert. You use the -l option to get a list of signing certificates only, including the signing CA for each. signtool -l using certificate directory: /u/jsmith/.netscape Object signing certificates --------------------------------------- Verisign Object Signing Cert Issued by: VeriSign, Inc. - Verisign, Inc. Expires: ...
Gecko Roles
RNAL_FRAME A sub-document. ROLE_MENUPOPUP Represents a menu, which presents a list of options from which the user can make a selection to perform an action. ROLE_MENUITEM Represents a menu item, which is an entry in a menu that a user can choose to carry out a command, select an option. ROLE_TOOLTIP Represents a tooltip that provides helpful hints; this is generally dis
played at the mouse cursor position. ROLE_APPLICATION Represents a main window for an application. ROLE_DOCUMENT Represents a document window. A document window is always contained within an application window. ROLE_PANE Represents a pane within a frame or document window. Users can navigate between panes and within the contents of the current pane, but cannot navigate between it...
... within a table. ROLE_CELL Represents a cell within a table. ROLE_LINK Represents a link to something else. This object might look like text or a graphic, but it acts like a button. ROLE_HELPBALLOON Displays a Help topic in the form of a ToolTip or Help balloon. ROLE_CHARACTER Represents a cartoon-like graphic object, such as Microsoft Office Assistant, which is dis
played to provide help to users of an application. ROLE_LIST Represents a list box, allowing the user to select one or more items. ROLE_LISTITEM Represents an item in a list. ROLE_OUTLINE Represents an outline or tree structure, such as a tree view control, that displays a hierarchical list and allows the user to expand and collapse branches. ROLE_OUTLINEITEM Represents a...
...et a value. ROLE_HOTKEYFIELD Represents a hot-key field that allows the user to enter a combination or sequence of keystrokes. ROLE_SLIDER Represents a slider, which allows the user to adjust a setting in given increments between minimum and maximum values. ROLE_SPINBUTTON Represents a spin box, which is a control that allows the user to increment or decrement the value dis
played in a separate "buddy" control associated with the spin box. ROLE_DIAGRAM Represents a graphical image used to diagram data. ROLE_ANIMATION Represents an animation control, which contains content that changes over time, such as a control that displays a series of bitmap frames. ROLE_EQUATION Represents a mathematical equation. It is used by MATHML. ROLE_BUTTONDROPDOWN ...
Avoiding leaks in JavaScript XPCOM components
ain the same way he did the first time, and would then expect the added properties to still be there. We currently implement this by making the wrapper a root in the JavaScript garbage collector once somebody sets a JavaScript property on a DOM node. (This is roughly equivalent to making all the properties roots, but simpler.) Once this happens, it remains a root until the document stops being dis
played. This means that neither the element nor any of the properties nor any of the objects reachable from those properties can be freed until the document is no longer dis
played. You might think that it's unusual to set arbitrary properties on DOM nodes. And in many cases it is. But in one important case it's not: XBL. XBL fields are implemented as JavaScript properties on the bound element's wrapper...
...rvice. (But since service is a global variable, just fixing the cycle doesn't fix the leak.) Don't store short-lived objects as JavaScript properties of short-lived DOM nodes I mentioned earlier that, in versions of Mozilla before 1.8, setting arbitrary JavaScript properties on elements (or using XBL fields) causes that element's JavaScript wrapper to be rooted until the document stops being dis
played. ...
...properties of short-lived DOM nodes I mentioned earlier that, in versions of Mozilla before 1.8, setting arbitrary JavaScript properties on elements (or using XBL fields) causes that element's JavaScript wrapper to be rooted until the document stops being dis
played. This can be a problem if there are large objects reachable from that wrapper that should go away before the document stops being dis
played. The worst example of this problem is tabbrowser. Tabbrowser is an XBL binding that wraps browsers in tabs, creating and destroying them as needed. But the browsers are themselves XBL bindings, and much of the memory associated with the page dis
played in the tab is reachable from the JavaScript properties of the browser element. This means that without some workaround, all of the browsers will r...
Index
nt, as mozilla:: primitives are merely bare-minimum wrappers around NSPR's. 95 XPCOM category image-sniffing-services Add-ons, Extensions, NeedsContent In versions of Firefox prior to Firefox 3, extensions could add decoders for new image types. However, such decoders relied on servers sending correct MIME types; images sent with incorrect MIME types would not be correctly dis
played. 96 XPCOM glue Guide, XPCOM, XPCOM glue The XPCOM Glue is a static library which component developers and embedders can link against. It allows developers to link only against the frozen XPCOM method symbols and maintain compatibility with multiple versions of XPCOM. 97 XPCOM Glue without mozalloc Starting with XULRunner 2.0, the frozen linkage dependent...
...ss condition of the value getting set. That is if the value is within the range of minimumValue - maximumValue. 322 nsIAccessibleWin32Object Interfaces, Interfaces:Scriptable, XPCOM, XPCOM Interface Reference No summary! 323 nsIAlertsService Interfaces, Interfaces:Scriptable, XPCOM, XPCOM API Reference, XPCOM Interface Reference By default a message is dis
played in a small window that slides up from the bottom of the screen, holds there for a few seconds, then slides down. The specific appearance varies from platform to platform. 324 nsIAnnotationObserver Developing Mozilla, Extensions, Interfaces, Places, XPCOM, XPCOM API Reference This method is called when an annotation is deleted for an item. If aName is empty, then ALL annotatio...
...faces: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 intended to be dis
played 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(). 846 n...
nsIAlertsService
This interface can be used to notify the user of something that does not require an immediate reaction. For example, it can be used to notify the user that their downloads are complete or that they have new mail. 1.0 66 Introduced Gecko 1.7 Inherits from: nsISupports Last changed in Gecko 22 (Firefox 22 / Thunderbird 22 / SeaMonkey 2.19) By default a message is dis
played in a small window that slides up from the bottom of the screen, holds there for a few seconds, then slides down. The specific appearance varies from platform to platform. Note: Prior Firefox 22, the alerts service was only supported on Windows in Gecko 1.7, had no effect on Mac OS X in Gecko 1.8, but was fully supported in Mac OS X in Gecko 1.9. Note: Since Gecko 22, the notifications are prov...
...eBrowsing, Optional ); Parameters imageUrl A URL identifying the image to display in the notification alert. title The title for the alert. text The text to display in the alert, explaining the alert condition. The text must not be too long, otherwise it might be truncated to a platform-specific length. If the text is too long, try to use line returns in the text to have it split and dis
played over multiple lines. textClickable Optional If true, if the user clicks on it, the listener is notified; when hovered the notification background becomes lighter and the cursor turns to a pointer. Prior to Gecko 32 the text was made to look like a link. cookie Optional A blind cookie the alert passes back to the consumer during alert listener callbacks. alertListener Optional An object to ...
...t implement an observe() method that accepts three parameters: subject: always null. topic: "alertfinished" when the alert disappears, "alertclickcallback" if the user clicks the text or "alertshow" (since Gecko 22) when the alert is shown. data: The value of the cookie parameter passed into the showAlertNotification method. name Optional A name for the notification; this is not dis
played in the alert. However, certain notification systems (such as Growl on Mac OS X) allow the user to disable alerts by name. This name is used in that configuration panel. On Android the name is hashed and used as a notification ID. dir Optional Bidi override for the title. Valid values are "auto", "ltr" or "rtl". Only available on supported platforms. lang Optional Language of title and text ...
nsIPromptService
Parameters aParent The parent window for the dialog. If set to null the parent window will be nsIWindowWatcher.activeWindow. aDialogTitle Text to appear in the title of the dialog. aText Text to appear in the body of the dialog. aButtonFlags aButtonFlags is a combination of Button flags as described in Using the button flags below. aButton0Title caption dis
played for button 0 if(BUTTON_TITLE_IS_STRING*BUTTON_TITLE_POS_0) flags are set in aButtonFlags aButton1Title caption dis
played for button 1 if(BUTTON_TITLE_IS_STRING*BUTTON_TITLE_POS_1) flags are set in aButtonFlags aButton2Title caption dis
played for button 2 if(BUTTON_TITLE_IS_STRING*BUTTON_TITLE_POS_2) flags are set in aButtonFlags aCheckMsg Text to appear with the checkbox. ...
... aCheckState Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns. ...
...romptService); var password = {value: "pass"}; // default the password to pass var check = {value: true}; // default the checkbox to true var result = prompts.promptPassword(null, "Title", "Enter password:", password, null, check); // result is true if OK was pressed, false if cancel was pressed. password.value is // set if OK was pressed. The checkbox is not dis
played. select example select displays a dialog with a listbox of choices. var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var items = ["Hello", "Welcome", "Howdy", "Hi", ":)"]; // list items var selected = {}; var result = prompts.select(null, "Title", "What greeting do you want?", items.length...
Flash Activation: Browser Comparison - Plugins
atically reloads the page no yes yes Other features related to Flash Domain Blocking Plugin Power Saver Peripheral Content Pause Each of the browser vendors has a roadmap about the future of Flash and changes to the user experience. The Firefox Flash roadmap includes links to roadmaps and posts from other vendors. ...
...and posts from other vendors. UI Comparison Mozilla Firefox In-page UI is dis
played when the site attempts to use Flash. An icon also appears on the left side of the location bar. The user can click on the Flash object or the location bar icon to activate Flash: Users have the choice to allow Flash just for the current session, or to remember their choice: Google Chrome In-page UI is dis
played when the site attempts to use Flash without fallback content: A user can click the plugin element to show a prompt for allowing Flash: If the site provides fallback content for an object element, Chrome will display that content and will not prompt the user to enable Flash. If a Flash element is not visible to the user, the user will not get a visible prompt. A user can click the informati...
...e provides fallback content for an object element, Chrome will display that content and will not prompt the user to enable Flash. If a Flash element is not visible to the user, the user will not get a visible prompt. A user can click the information icon on the left side of the location bar on any site to open the site information and allow Flash on that site: Microsoft Edge In-page UI is dis
played when the site attempts to use Flash. An icon also appears on the right side of the location bar. The user can click the Flash object to show activation options: Users have the choice to allow Flash just for the current session, or to remember their choice: Site Authoring Tips If a Flash element is very small, hidden, or covered by other content, users will probably not notice that Flash is...
URLs - Plugins
n is notified upon either successful or unsuccessful completion of the request. NPError NPN_GetURL(NPP instance, const char *url, const char *target); The instance parameter represents the current plug-in instance. The url parameter is the URL of the request, which can be of any type, including HTTP, FTP, news, or mailto. The target parameter represents the destination where the URL will be dis
played, a window or frame. If target refers to the window or frame containing the plug-in instance, it is destroyed and the plug-in may be unloaded. If the target parameter is set to null, the application creates a new stream and delivers the data to the plug-in instance, through calls to NPP_NewStream, NPP_WriteReady and NPP_Write, and NPP_DestroyStream. In general, if a URL works in the location box ...
...ponding call to NPN_GetURLNotify and NPN_PostURLNotify. Warning: In Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), NPN_GetURLNotify() does not notify the plug-in if notifyData is NULL. See bug 638367 for details. Getting the URL and Displaying the Page To retrieve a URL and display it on a specified target page, you use the NPN_GetURL and NPN_GetURLNotify functions. The URL can be dis
played in the same window or frame, a new window, or a different window or frame, depending on the value of the target parameter. Specify the display target with one of these special target names: _blank or _new: Load the URL in a new blank unnamed window. Safest target, even though, when used with a mailto or news URL, this creates an extra blank browser instance. _self or _current: Load the URL in...
...st char *buf, NPBool file, void* notifyData ); The parameters of this function have the same definitions as those of NPN_PostURL. The notifyData parameter contains plug-in-private data passed by NPP_URLNotify and may be used for tracking multiple posts. Posting Data to an HTTP Server The following code posts two name-value pairs to a CGI script through HTTP. The response from the server is dis
played in a new window. char* pPostData = "Content-Type:\tapplication/x-www-form-urlencoded\nContent-Length:\t17\n\nname=aaashun@gmail.com\n"; uint32 nPostDataLen = (uint32)strlen(pPostData); NPN_PostURL(npInstance, "http://www.baidu.com","_blank", nPostDataLen, pPostData, FALSE); Uploading Files to an FTP Server Plug-ins can use NPN_PostURL or NPN_PostURLNotify to upload files to a remote ser...
Work with animations - Firefox Developer Tools
mation Let's take a closer look at the contents of the animation inspector here: It shows a synchronized timeline for every animation applied to the selected element or its children. The timeline starts at the start of the first animation, ends at the end of the last animation, and is labeled with markers every 250 milliseconds (this depends on the time scale of the animations currently dis
played). Animation bars Each animation or transition is shown as a horizontal bar laid across the timeline. The bar is: blue if a transition was used to animate a property orange if a @keyframes animation was used green if the Web Animations API was used The bar contains a lightning bolt icon if the property was animated using the compositor thread (see more about the cost of animating differe...
... to make the name gradually appear lasted 500ms, and had a delay of 150ms was given an easing value of ease-out: you can see this by the convex shape of the green bar. Animation playback At the top of the animation inspector: there are buttons to play/pause and restart the animation there's a dropdown to change the animation playback rate the current time in the animation is dis
played. Finally, if you click inside the bar at the top of the timeline, you get a scrubber that you can drag left and right to move backwards and forwards through the animation, and pinpoint exactly what's happening when. Further information about animation compositing If you open animation-inspector-compositing.html and click the red rectangle, a simple opacity animation will start. If you look at...
...ode, are now given a dotted underline -- see transform in the screenshot below. Hovering over this gives you a tooltip that explains why. In this case, the message is "Animations of 'transform' cannot be run on the compositor when geometric properties are animated on the same element at the same time." Edit @keyframes Any @keyframes rules associated with the currently selected element are dis
played in the Rules view and are editable: Edit timing functions When you create a CSS animation you can specify a timing function: this determines the rate at which the animation progresses. One way to specify the timing function is with a cubic Bezier curve. Timing functions defined as cubic Bezier curves get an icon in the Rules view. If you click the icon you get a visual editor for the curve, ...
Background Tasks API - Web APIs
ground Tasks API (also referred to as the Background Tasks API or simply the requestIdleCallback() API) provides the ability to queue tasks to be executed automatically by the user agent when it determines that there is free time to do so. Concepts and usage The main thread of a Web browser is centered around its event loop. This code draws any pending updates to the Document currently being dis
played, runs any JavaScript code the page needs to run, accepts events from input devices, and dispatches those events to the elements that should receive them. In addition, the event loop handles interactions with the operating system, updates to the browser's own user interface, and so forth. It's an extremely busy chunk of code, and your main JavaScript code may run right inside this thread along wit...
...e'll use that to determine if we should update the scroll position to ensure that the log stays at the end when we're done adding content to it. Next, we update the progress and status information if any tasks have been enqueued. ...
... Then, if there's text waiting to be added to the log (that is, if logFragment isn't null), we append it to the log element using Element.appendChild() and set logFragment to null so we don't add it again. ...
BaseAudioContext.createBuffer() - Web APIs
Note: createBuffer() used to be able to take compressed data and give back decoded samples, but this ability was removed from the spec, because all the decoding was done on the main thread, therefore createBuffer() was blocking other code execution. ...
...an supported, or a sampleRate outside the nominal range). RangeError There isn't enough memory available to allocate the buffer. ...
... call, you will get a stereo buffer (two channels), that, when
played back on an AudioContext running at 44100Hz (very common, most normal sound cards run at this rate), will last for 0.5 seconds: 22050 frames / 44100Hz = 0.5 seconds. var audioCtx = new AudioContext(); var buffer = audioCtx.createBuffer(1, 22050, 22050); If you use this call, you will get a mono buffer (one channel), that, when
played back on an AudioContext running at 44100Hz, will be automatically *resampled* to 44100Hz (and therefore yield 44100 frames), and last for 1.0 second: 44100 frames / 44100Hz = 1 second. Note: audio resampling is very similar to image resizing: say you've got a 16 x 16 image, but you want it to fill a 32x32 area: you resize (resample) it. the result has less quality (it can be blurry or edgy, dep...
Determining the dimensions of elements - Web APIs
sforms applied to the element. In case of transforms, the offsetWidth and offsetHeight returns the element's layout width and height, while getBoundingClientRect() returns the rendering width and height. As an example, if the element has width: 100px; and transform: scale(0.5); the getBoundingClientRect() will return 50 as the width, while offsetWidth will return 100. ...
...dth and offsetHeight returns the element's layout width and height, while getBoundingClientRect() returns the rendering width and height. As an example, if the element has width: 100px; and transform: scale(0.5); the getBoundingClientRect() will return 50 as the width, while offsetWidth will return 100. What's the size of the dis
played content? If you need to know how much space the actual dis
played content takes up, including padding but not including the border, margins, or scrollbars, you want to use the Element.clientWidth and Element.clientHeight properties: How big is the content? If you need to know the actual size of the content, regardless of how much of it is currently visible, you need to use the Element.scrollWidth and Element.scrollHeight properties. These return the width a...
... ...
Basic usage of canvas - Web APIs
e rules, however, don't affect the actual drawing on the canvas. We'll see how this is done in a dedicated chapter of this tutorial. When no styling rules are applied to the canvas it will initially be fully transparent. Fallback content The <canvas> element differs from an <img> tag in that, like for <video>, <audio>, or <picture> elements, it is easy to define some fallback content, to be dis
played in older browsers not supporting it, like versions of Internet Explorer earlier than version 9 or textual browsers. You should always provide fallback content to be dis
played by those browsers. Providing fallback content is very straightforward: just insert the alternate content inside the <canvas> element. Browsers that don't support <canvas> will ignore the container and render the fallback co...
...n't read the canvas at all, for example. Providing a useful fallback text or sub DOM helps to make the canvas more accessible. Required </canvas> tag As a consequence of the way fallback is provided, unlike the <img> element, the <canvas> element requires the closing tag (</canvas>). If this tag is not present, the rest of the document would be considered the fallback content and wouldn't be dis
played. If fallback content is not needed, a simple <canvas id="foo" ...></canvas> is fully compatible with all browsers that support canvas at all. The rendering context The <canvas> element creates a fixed-size drawing surface that exposes one or more rendering contexts, which are used to create and manipulate the content shown. In this tutorial, we focus on the 2D rendering context. Other contexts...
...sRenderingContext2D. var canvas = document.getElementById('tutorial'); var ctx = canvas.getContext('2d'); The first line in the script retrieves the node in the DOM representing the <canvas> element by calling the document.getElementById() method. Once you have the element node, you can access the drawing context using its getContext() method. Checking for support The fallback content is dis
played in browsers which do not support <canvas>. Scripts can also check for support programmatically by simply testing for the presence of the getContext() method. Our code snippet from above becomes something like this: var canvas = document.getElementById('tutorial'); if (canvas.getContext) { var ctx = canvas.getContext('2d'); // drawing code here } else { // canvas-unsupported code here } ...
Using files from web applications - Web APIs
such as the handleFiles() function below. function handleFiles(files) { for (let i = 0; i < files.length; i++) { const file = files[i]; if (!file.type.startsWith('image/')){ continue } const img = document.createElement("img"); img.classList.add("obj"); img.file = file; preview.appendChild(img); // Assuming that "preview" is the div output where the content will be dis
played. const reader = new FileReader(); reader.onload = (function(aImg) { return function(e) { aImg.src = e.target.result; }; })(img); reader.readAsDataURL(file); } } Here our loop handling the user-selected files looks at each file's type attribute to see if its MIME type begins with the string "image/"). For each file that is an image, we create a new img element. CSS can be used to ...
...This is explained in the section Using hidden file input elements using the click() method, as is the method that invokes the file picker. The handleFiles() method follows: const fileSelect = document.getElementById("fileSelect"), fileElem = document.getElementById("fileElem"), fileList = document.getElementById("fileList"); fileSelect.addEventListener("click", function (e) { if (f...
... In Firefox, to have the PDF appear embedded in the iframe (rather than proposed as a downloaded file), the preference pdfjs.disabled must be set to false . <iframe id="viewer"> And here is the change of the src attribute: const obj_url = URL.createObjectURL(blob); const iframe = document.getElementById('viewer'); iframe.setAttribute('src', obj_url); URL.revokeObjectURL(obj_u...
HTMLObjectElement - Web APIs
TMLObjectElement.declare Is a Boolean that reflects the declare HTML attribute, indicating that this is a declaration, not an instantiation, of the object. HTMLObjectElement.form Read only Retuns a HTMLFormElement representing the object element's form owner, or null if there isn't one. HTMLObjectElement.height Returns a DOMString that reflects the height HTML attribute, specifying the dis
played height of the resource in CSS pixels. HTMLObjectElement.hspace Is a long representing the horizontal space in pixels around the control. HTMLObjectElement.name Returns a DOMString that reflects the name HTML attribute, specifying the name of the browsing context. HTMLObjectElement.standby Is a DOMString that reflects the standby HTML attribute, specifying a message to display while the ...
...lement.tabindex Is a long representing the position of the element in the tabbing navigation order for the current document. HTMLObjectElement.type Is a DOMString that reflects the type HTML attribute, specifying the MIME type of the resource. HTMLObjectElement.typeMustMatch Is a Boolean that reflects the typemustmatch HTML attribute, indicating if the resource specified by data must only be
played if it matches the type attribute. HTMLObjectElement.useMap Is a DOMString that reflects the usemap HTML attribute, specifying a <map> element to use. HTMLObjectElement.validationMessage Read only Returns a DOMString representing a localized message that describes the validation constraints that the control does not satisfy (if any). This is the empty string if the control is not a candidate ...
...for constraint validation (willValidate is false), or it satisfies its constraints. HTMLObjectElement.validity Read only Returns a ValidityState with the validity states that this element is in. HTMLObjectElement.vspace Is a long representing the horizontal space in pixels around the control. HTMLObjectElement.width Is a DOMString that reflects the width HTML attribute, specifying the dis
played width of the resource in CSS pixels. HTMLObjectElement.willValidate Read only Returns a Boolean that indicates whether the element is a candidate for constraint validation. Always false for HTMLObjectElement objects. Methods Inherits methods from its parent, HTMLElement. HTMLObjectElement.checkValidity() Retuns a Boolean that always is true, because object objects are never candidates f...
MediaMetadata.MediaMetadata() - Web APIs
artwork: An array of images associated with the playing media. ...
... artwork: An array of images associated with the playing media. ...
... artwork: An array of images associated with the playing media. ...
Notification - Web APIs
information to the user. Constructor Notification() Creates a new instance of the Notification object. Properties Static properties These properties are available only on the Notification object itself. Notification.permission Read only A string representing the current permission to display notifications. Possible values are: denied -- The user refuses to have notifications dis
played. granted -- The user accepts having notifications dis
played. default -- The user choice is unknown and therefore the browser will act as if the value were denied. Notification.maxActions Read only Instance properties These properties are available only on instances of the Notification object. Notification.actions Read only The actions array of the notification as specified in th...
... code of the notification as specified in the constructor's options parameter. Notification.tag Read only The ID of the notification (if any) as specified in the constructor's options parameter. Notification.icon Read only The URL of the image used as an icon of the notification as specified in the constructor's options parameter. Notification.image Read only The URL of an image to be dis
played as part of the notification, as specified in the constructor's options parameter. Notification.renotify Read only Specifies whether the user should be notified after a new notification replaces an old one. Notification.requireInteraction Read only A Boolean indicating that a notification should remain active until the user clicks or dismisses it, rather than closing automatically. Notifica...
... click event. It is triggered each time the user clicks on the notification. Notification.onclose A handler for the close event. It is triggered when the user closes the notification. Notification.onerror A handler for the error event. It is triggered each time the notification encounters an error. Notification.onshow A handler for the show event. It is triggered when the notification is dis
played. Methods Static methods These methods are available only on the Notification object itself. Notification.requestPermission() Requests permission from the user to display notifications. Instance methods These properties are available only on an instance of the Notification object or through its prototype. The Notification object also inherits from the EventTarget interface. Notificat...
Signaling and video calling - Web APIs
; connection.send(msgJSON); } The message object passed into this function is converted into a JSON string by calling JSON.stringify(), then we call the WebSocket connection's send() function to transmit the message to the server. UI to start a call The code which handles the "userlist" message calls handleUserlistMsg(). Here we set up the handler for each connected user in the user list dis
played to the left of the chat panel. This function receives a message object whose users property is an array of strings specifying the user names of every connected user. function handleUserlistMsg(msg) { var i; var listElem = document.querySelector(".userlistbox"); while (listElem.firstChild) { listElem.removeChild(listElem.firstChild); } msg.users.forEach(function(username) { va...
..."Unable to open your call because no camera and/or microphone" + "were found."); break; case "SecurityError": case "PermissionDeniedError": // Do nothing; this is the same as the user canceling the call. break; default: alert("Error opening your camera and/or microphone: " + e.message); break; } closeVideoCall(); } An error message is dis
played in all cases but one. In this example, we ignore "SecurityError" and "PermissionDeniedError" results, treating refusal to grant permission to use the media hardware the same as the user canceling the call. Regardless of why an attempt to get the stream fails, we call our closeVideoCall() function to shut down the RTCPeerConnection, and release any resources already allocated by the process of at...
...andleTrackEvent(event) { document.getElementById("received_video").srcObject = event.streams[0]; document.getElementById("hangup-button").disabled = false; } The incoming stream is attached to the "received_video" <video> element, and the "Hang Up" <button> element is enabled so the user can hang up the call. Once this code has completed, finally the video being sent by the other peer is dis
played in the local browser window! Handling the removal of tracks Your code receives a removetrack event when the remote peer removes a track from the connection by calling RTCPeerConnection.removeTrack(). Our handler for "removetrack" is: function handleRemoveTrackEvent(event) { var stream = document.getElementById("received_video").srcObject; var trackList = stream.getTracks(); if (trackLis...
Basic concepts behind Web Audio API - Web APIs
a computer to handle the audio in distinct blocks. A lot more information can be found on the Wikipedia page Sampling (signal processing). Audio buffers: frames, samples and channels An AudioBuffer takes as its parameters a number of channels (1 for mono, 2 for stereo, etc), a length, meaning the number of sample frames inside the buffer, and a sample rate, which is the number of sample frames
played per second. A sample is a single float32 value that represents the value of the audio stream at each specific point in time, in a specific channel (left or right, if in the case of stereo). A frame, or sample frame, is the set of all values for all channels that will play at a specific point in time: all the samples of all the channels that play at the same time (two for a stereo sound, six for ...
...m) and perfectly cut off frequencies above 20 kHz, in practice a transition band is necessary, where frequencies are partly attenuated. The wider this transition band is, the easier and more economical it is to make an anti-aliasing filter. The 44.1 kHz sampling frequency allows for a 2.05 kHz transition band. ...
... Note: audio resampling is very similar to image resizing. Say you've got a 16 x 16 image, but you want it to fill a 32x32 area. You resize (or resample) it. ...
Adding captions and subtitles to HTML5 video - Developer guides
ersus subtitles Captions and subtitles are not the same thing: they have significantly different audiences, and convey different information, and it is recommended 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 dis
played 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 people. The <track> element HTML5 allows us to specify subtitles for a video using the <track> element. The various attributes of this element allow us to specify such things as the type of content that we're adding, the language it's in, and ...
... array of all the text tracks attached to the video. We loop through each one and set its mode to hidden. Note: The WebVTT API gives us access to all the text tracks that are defined for an HTML5 video using the <track> element. Building a caption menu Our aim is to use the subtitles button we added earlier to display a menu that allows users to choose which language they want the subtitles dis
played in, or to turn them off entirely. We have added the button, but before we make it do anything, we need to build the menu that goes with it. This menu is built dynamically, so that languages can be added or removed later by simply editing the <track> elements within the video's markup. All we need to do is to go through the video's textTracks, reading their properties and building the menu up ...
... The ::cue pseudo-element is the key to targetting individual text track cues for styling, as it matches any defined cue. There are only a handful of CSS properties that can be applied to a text cue: color opacity visib...
Media buffering, seeking, and time ranges - Developer guides
} }); } This works better with longer pieces of audio or video, but press play and click about the player progress bar and you should get something like this. Each red filled white rectangle represents a time range. Note: You can see the timerange code running live on JS Bin. Seekable The seekable attribute returns a TimeRanges object and tells us which parts of the media can be
played without delay; this is irrespective of whether that part has been downloaded or not. Some parts of the media may be seekable but not buffered if byte-range requests are enabled on the server. Byte range requests allow parts of the media file to be delivered from the server and so can be ready to play almost immediately -- thus they are seekable. var seekableTimeRanges = myAudio.seekable; Creati...
...yte-range requests are enabled on the server. Byte range requests allow parts of the media file to be delivered from the server and so can be ready to play almost immediately -- thus they are seekable. var seekableTimeRanges = myAudio.seekable; Creating our own Buffering Feedback If we wish to create our own custom player, we may want to provide feedback on how much of the media is ready to be
played. In practice a good way to do this is use the seekable attribute, although as we have seen above seekable parts of the media are not neccessarily contiguous -- they often are however and we can safely approximate this information to give the user an indication of which parts of the media can be
played directly. We can find this point in the media using the following line of code: var seekableEnd...
... The progress event is fired as data is downloaded, this is a good event to react to if we want to display download or buffering progress. The timeupdate event is fired 4 times a second as the media plays and that's where we increment our playing progress bar. This should give you results similar to the following, where the light grey bar represents the buffered progress and green bar shows the
played progress: Note: You can see the buffering code running live on JS Bin. A quick word about
Played It's worth mentioning the
played property -- this tells us which time ranges have been
played within the media. For example: var
played = audio.
played; // returns a TimeRanges object This could be useful for establishing the parts of your media that are most listened to or watched. ...
Audio and Video Delivery - Developer guides
iles --> <track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English"> <track src="subtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian"> <!-- fallback for browsers that don't support video 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 recommended 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 pla...
...ur media to both HLS and DASH. For further information see Live streaming web audio and video. Customising Your Media Player You may decide that you want your audio or video player to have a consistent look across browsers, or just wish to tweak it to match your site. The general technique for achieving this is to omit the controls attribute so that the default browser controls are not dis
played, create custom controls using HTML and CSS, then use JavaScript to link your controls to the audio/video API. If you need something extra, it's possible to add features that are not currently present in default players, such as playback rate, quality stream switches or even audio spectrums. You can also choose how to make your player responsive -- for example you might remove the progress bar un...
...e currently available for seeking to. This returns a TimeRanges object listing the ranges of times that you can seek to. var mediaElement = document.querySelector('#mediaElementID'); mediaElement.seekable.start(0); // Returns the starting time (in seconds) mediaElement.seekable.end(0); // Returns the ending time (in seconds) mediaElement.currentTime = 122; // Seek to 122 seconds mediaElement.
played.end(0); // Returns the number of seconds the browser has
played Specifying playback range When specifying the URI of media for an <audio> or <video> element, you can optionally include additional information to specify the portion of the media to play. To do this, append a hash mark ("#") followed by the media fragment description. A time range is specified using the syntax: #t=[startti...
Overview of events and handlers - Developer guides
d event handling become central to web programming with the addition of the language to browsers, accompanying a switch in the rendering architecture of browsers from fetch and load page rendering to event driven, reflow based, page rendering. Initially, browsers wait, until they receive all of the resources associated with a page, to parse, process, draw, and present the page to the user. The dis
played page remains unchanged until the browser requests a new page. With the change to dynamic page rendering, browsers loop continuously between processing, drawing, presenting content, and waiting for some new event trigger. Event triggers include the completion of the loading of a resource on the network e.g., downloads an image that can now be drawn on the screen, the completion of parsing a resour...
...es 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 intended to emit events named 'click' in response to a mouse click or, when dis
played 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 instanceof Event) ? "EventPrototype" : "ObjectPrototype"; alert("We got a...
...the documents. This will also need finding a good explanation of the events involved during page loading, such as discussed partially in this web page or in this Stack Overflow question. ...
<li> - HTML: Hypertext Markup Language
The source for this interactive example is stored in a GitHub repository. ...
... The source for this interactive example is stored in a GitHub repository. ...
...uitem, menuitemcheckbox, menuitemradio, option, none, presentation, radio, separator, tab, treeitem DOM interface HTMLLIElement Attributes This element includes the global attributes. value This integer attribute indicates the current ordinal value of the list item as defined by the <ol> element. The only allowed value for this attribute is a number, even if the list is dis
played with Roman numerals or letters. List items that follow this one continue numbering from the value set. The value attribute has no meaning for unordered lists (<ul>) or for menus (<menu>). Note: This attribute was deprecated in HTML4, but reintroduced in HTML5. type This character attribute indicates the numbering type: a: lowercase letters A: uppercase letters i: lowercase Roman nu...
<shadow>: The obsolete Shadow Root element - HTML: Hypertext Markup Language
ere is a simple example of using the <shadow> element. It is an HTML file with everything needed in it. Note: This is an experimental technology. For this code to work, the browser you display it in must support Web Components. See Enabling Web Components in Firefox. <html> <head></head> <body> <!-- This <div> will hold the shadow roots. ...
... Specifications This element is no longer defined by any specifications. ...
...eShadowRoot(); // Insert something into the older shadow root shadowroot1.innerHTML = '<p>Older shadow root inserted by <shadow></p>'; // Insert into younger shadow root, including <shadow>. // The previous markup will not be dis
played unless // <shadow> is used below. shadowroot2.innerHTML = '<shadow></shadow> <p>Younger shadow root, dis
played because it is the youngest.</p>'; </script> </body> </html> If you display this in a web browser it should look like the following. Specifications This element is no longer defined by any specifications. ...
HTML elements reference - HTML: Hypertext Markup Language
yling purposes (using the class or id attributes), or because they share attribute values, such as lang. <strong> The HTML Strong Importance Element (<strong>) indicates that its contents have strong importance, seriousness, or urgency. Browsers typically render the contents in bold type. <sub> The HTML Subscript element (<sub>) specifies inline text which should be dis
played as subscript for solely typographical reasons. <sup> The HTML Superscript element (<sup>) specifies inline text which is to be dis
played as superscript for solely typographical reasons. <time> The HTML <time> element represents a specific period in time. <u> The HTML Unarticulated Annotation element (<u>) represents a span of inline text which should be r...
...<option> can represent menu items in popups and other lists of items in an HTML document. <output> The HTML Output element (<output>) is a container element into which a site or app can inject the results of a calculation or the outcome of a user action. <progress> The HTML <progress> element displays an indicator showing the completion progress of a task, typically dis
played as a progress bar. <select> The HTML <select> element represents a control that provides a menu of options <textarea> The HTML <textarea> element represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form. Interactive elements HTML offe...
...t. <element> The obsolete HTML <element> element was part of the Web Components specification; it was intended to be used to define new custom DOM elements. <font> The HTML Font Element (<font>) defines the font size, color and face for its content. <frame> <frame> is an HTML element which defines a particular area in which another HTML document can be dis
played. A frame should be used within a <frameset>. <frameset> The HTML <frameset> element is used to contain <frame> elements. <image> The obsolete HTML Image element (<image>) is an obsolete remnant of an ancient version of HTML lost in the mists of time; use the standard <img> element instead. <isindex> <isindex> was an obsolete HTML element that put a text f...
Content-Disposition - HTTP
In a multipart/form-data body, the HTTP Content-Disposition general header is a header that can be used on the subpart of a multipart body to give information about the field it applies to. The subpart is delimited by the boundary defined in the Content-Type header. Used on the body itself, Content-Disposition has no effect. ...
...rm-data, as well as the optional directive name and filename, can be used in the HTTP context. Header type Response header (for the main body) General header (for a subpart of a multipart body) Forbidden header name no Syntax As a response header for the main body The first parameter in the HTTP context is either inline (default value, indicating it can be dis
played inside the Web page, or as the Web page) or attachment (indicating it should be downloaded; most browsers presenting a 'Save as' dialog, prefilled with the value of the filename parameters if present). Content-Disposition: inline Content-Disposition: attachment Content-Disposition: attachment; filename="filename.jpg" As a header for a multipart body The first parameter in the HTTP context is a...
...e and filename* are present in a single header field value, filename* is preferred over filename when both are understood. Examples A response triggering the "Save As" dialog: 200 OK Content-Type: text/html; charset=utf-8 Content-Disposition: attachment; filename="cool.html" Content-Length: 21 <HTML>Save me!</HTML> This simple HTML file will be saved as a regular download rather than dis
played in the browser. Most browsers will propose to save it under the cool.html filename (by default). An example of an HTML form posted using the multipart/form-data format that makes use of the Content-Disposition header: POST /test.html HTTP/1.1 Host: example.org Content-Type: multipart/form-data;boundary="boundary" --boundary Content-Disposition: form-data; name="field1" value1 --boundary Conte...
Autoplay guide for media and Web Audio APIs - Web media technologies
, if any, can be used to autoplay media. By default, the autoplay feature policy is set to 'self' (including the single quote characters), indicating that autoplay is permitted as they're hosted on the same domain as the document. You can also specify 'none' to disable autoplay entirely, '*' to allow autoplay from all domains, or one or more specific origins from which media can be automatically
played. These origins are separated by space characters. Note: The specified feature policy applies to the document and every <iframe> nested within it, unless those frames include an allow, which sets a new feature policy for that frame and all frames nested within it. When using the allow attribute on an <iframe> to specify a feature policy for that frame and its nested frames, you can also specif...
...regardless of the domain; a domain restriction can be added as well as needed. ...
... or <video> elements. media.autoplay.allow-extension-background-pages This Boolean preference, if true, allows browser extensions' background scripts to autoplay audio media. Setting this value to false disables this capability. The default value is true. media.autoplay.allow-muted A Boolean preference which if true (the default) allows audio media which is currently muted to be automatically
played. If this has been changed to false, media with an audio track will not be permitted to play even if muted. media.autoplay.block-webaudio A Boolean preference which indicates whether or not to apply autoplay blocking to the Web Audio API. The default is true. media.autoplay.default An integer preference which specifies whether per-domain configuration for autoplay support by default is allowed...
Image file type and format guide - Web media technologies
ular for decades, due to its simplicity and compatibility. Its animation support caused a resurgence in its popularity in the social media era, when animated GIFs began to be widely used for short "videos", memes, and other simple animation sequences. Another popular feature of GIF is support for interlacing, where rows of pixels are stored out of order so that partially-received files can be dis
played in lower quality. This is particularly useful when network connections are slow. GIF is a good choice for simple images and animations, although converting full color images to GIF can result in unsatisfactory dithering. Typically, modern content should use PNG for lossless and indexed still images, and should consider using APNG for lossless animation sequences. MIME type image/gif...
...patents have expired and the GIF format may be used freely ICO (Microsoft Windows icon) The ICO (Microsoft Windows icon) file format was designed by Microsoft for desktop icons of Windows systems. However, early versions of Internet Explorer introduced the ability for a web site to provide a ICO file named favicon.ico in a web site's root directory to specify a favicon -- an icon to be dis
played in the Favorites menu, and other places where an iconic representation of the site would be useful. An ICO file can contain multiple icons, and begins with a directory listing details about each. Following the directory comes the data for the icons. Each icon's data can be either a BMP image without the file header, or a complete PNG image (including the file header). If you use ICO files, you s...
...y fallbacks for images, the <picture> element does. <picture> is used as a wrapper for a number of <source> elements, each specifying a version of the image in a different format or under different media conditions, as well as an <img> element which defines where to display the image and the fallback to the default or "most compatible" version. ...
Populating the page: how browsers work - Web Performance
mething it can work with. Hence, it repeats the HTML-to-object process, but for the CSS. The CSSOM tree includes styles from the user agent style sheet. The browser begins with the most general rule applicable to a node and recursively refines the computed styles by applying more specific rules. In other words, it cascades the property values. Building the CSSOM is very, very fast and is not dis
played in a unique color in current developer tools. Rather, the "Recalculate Style" in developer tools shows the total time it takes to parse CSS, construct the CSSOM tree, and recursively calculate computed styles. In terms of web performance optimization, there are lower hanging fruit, as the total time to create the CSSOM is generally less than the time it takes for one DNS lookup. Other Processes ...
...n layers and composited, improving performance by painting portions of the screen on the GPU instead of the CPU, freeing up the main thread. Style The third step in the critical rendering path is combining the DOM and CSSOM into a render tree.The computed style tree, or render tree, construction starts with the root of the DOM tree, traversing each visible node. Tags that aren't going to be dis
played, like the <head> and its children and any nodes with display: none, such as the script { display: none; } you will find in user agent stylesheets, are not included in the render tree as they will not appear in the rendered output. Nodes with visibility: hidden applied are included in the render tree, as they do take up space. As we have not given any directives to override the user agent default,...
...h node. Layout is the process by which the width, height, and location of all the nodes in the render tree are determined, plus the determination of the size and position of each object on the page. Reflow is any subsequent size and position determination of any part of the page or the entire document. Once the render tree is built, layout commences. The render tree identified which nodes are dis
played (even if invisible) along with their computed styles, but not the dimensions or location of each node. To determine the exact size and location of each object, the browser starts at the root of the render tree and traverses it. On the web page, most everything is a box. Different devices and different desktop preferences mean an unlimited number of differing viewport sizes. In this phase, taking...
Add to Home screen - Progressive web apps (PWAs)
be added to a Home screen, as well as a service worker to enable it to be used offline. The example displays a series of fox pictures. If you have Firefox for Android available, use it to navigate to our demo at https://mdn.github.io/pwa-examples/a2hs/. You'll see fox pictures, but more important, you'll see a "home" icon with a plus (+) icon inside it -- this is the "Add to Home screen" icon dis
played for any site that has the necessary features in place. Tapping this will show a confirmation banner -- pressing the big + ADD TO HOME SCREEN button completes the action, adding the app to the Home screen. (Note: In Android 8 and higher, a system-level "Add to Home screen" permission dialog will be shown first.) If you have Mobile Chrome available, the experience is slightly different; upon ...
... should behave. Note: The .webmanifest extension is specified in the Media type registration section of the specification, but generally browsers will support manifests with other appropriate extensions, e.g. .json. The fields needed for A2HS are as follows: background_color: Specifies a background color to be used in some app contexts. The most relevant one to A2HS is the splash screen dis
played when the app icon on the Home screen is tapped and it first starts to load (this currently appears only when apps have been added to the Home screen by Chrome). display: Specifies how the app should be dis
played. To make it feel like a distinct app (and not just a web page), you should choose a value such as fullscreen (no UI is shown at all) or standalone (very similar, but system-level UI elem...
...uch as fullscreen (no UI is shown at all) or standalone (very similar, but system-level UI elements such as the status bar might be visible). icons: Specifies icons for the browser to use when representing the app in different places (such as on the task switcher, or more important, the Home screen). We've included only one in our demo. name/short_name: These fields provide an app name to be dis
played when representing the app in different places. name provides the full app name, and short_name provides a shortened name to be used when there is insufficient space to display the full name. You are advised to provide both if your app's name is particularly long. start_url: Provides a path to the asset that should be loaded when the added-to-Home screen app is launched. Note that this has to be ...
passwords - Archive of obsolete content
You don't supply this value when storing an add-on credential: it is automatically generated for you. However, you can use it to work out which stored credentials belong to your add-on by comparing it with the uri property of the self module. realm You can use this as a name for the credential, to distinguish it from any other credentials you've stored. The realm is dis
played in Firefox's Password Manager, under "Site", in brackets after the URL. For example, if the realm for a credential is "User Registration", then its "Site" field will look something like: addon:jid0-01mBBFyu0ZAXCFuB1JYKooSTKIc (User Registration) HTML Form Credential If a web service uses HTML forms to authenticate its users, then the corresponding credential is an HTML Form credential...
...he password. url The URL for the web service which requires the credential. You should omit anything after the hostname and (optional) port. realm The WWW-Authenticate response header sent by the server may include a "realm" field as detailed in RFC 2617. If it does, this property contains the value for the "realm" field. Otherwise, it is omitted. The realm is dis
played in Firefox's Password Manager, under "Site", in brackets after the URL. So: if a web server at http://www.example.com requested authentication with a response code like this: HTTP/1.0 401 Authorization Required Server: Apache/1.3.27 WWW-Authenticate: Basic realm="ExampleCo Login" The corresponding values for the credential (excluding username and password) should be: url: "http:/...
ui/button/action - Archive of obsolete content
tton is disabled. Disabled buttons appear disabled in the UI, and do not respond to clicks. Defaults to false. onClick function Click handler for the button. badge Number or String New in Firefox 36. Badge to attach to the button. The badge can contain as many characters (or digits) as you like, but only the first four will be dis
played. badgeColor CSS <color> value New in Firefox 36. Color for the badge. If badgeColor is omitted and badge is specified, then the badge is red. ActionButton Methods click() Click the button. This will cause the button to generate the click event: var { ActionButton } = require('sdk/ui/button/action'); var button = ActionButton({ id: "my-butto...
...on's label. icon The button's icon or icons, as a URL, relative path, or object containing a set of key-value pairs. disabled Boolean property indicating whether or not the button is disabled. badge New in Firefox 36. Value to attach to the button as a badge. May be a number or a string. The badge can contain as many characters (or digits) as you like, but only the first four will be dis
played. badgeColor New in Firefox 36. Color for the badge, specified as a CSS <color> value. Events click This event is emitted when a user clicks the button or your add-on calls the button's click() method. Arguments state : The button's state. This contains all the button's properties. ...
Listening to events in Firefox extensions - Archive of obsolete content
ent. DOMTitleChanged Dispatched when the title of the page changes. DOMContentLoaded Dispatched when the initial DOM for the page is completely loaded. load Dispatched after the page--including images--has first finished loading. unload Dispatched when the user has navigated away from the page. pageshow Dispatched when a page is newly dis
played. pagehide Dispatched when a page is hidden. Standard behavior for Web pages is: User navigates to a page. As the page loads, inline scripts run. Once the page is loaded, the onload handler fires. Some pages include a fourth step. If a page uses an unload or beforeunload handler, it fires when the user navigates away from the page. If an unload handler is present, the pag...
...elements support the following: var progressListener = { // add nsIWebProgressImplementation here } b.addProgressListener(progressListener); Where b is the browser or tabbrowser you want to listen to events for. There are code snippets available that give more detail on using web progress listeners. For a tabbrowser, the above code will only get events from the browser that is currently dis
played at the time the event occurs. In order to listen to events from all browsers, including those not currently being dis
played, the following example can be used: var tabsProgressListener = { // add tabs progress listener implementation here } gBrowser.addTabsProgressListener(tabsProgressListener); This lets you receive events related to all tabs. More information about listening to events fro...
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
ar. You should normally set this to true, unless you have strong reasons not to want users changing your toolbar. The mode attribute is set to icons, which is the usual value. This can be changed in the Customize dialog by the user. The context attribute should also be set if you want a customizable toolbar. It points to the id of a popup element that holds the customization options that are dis
played when the user right-clicks on the toolbar. This popup is already part of the main window, so it doesn't need to be implemented again. The defaultset attribute lists the ids of the icons you want to include on your toolbar by default. It's a comma-separated list of ids, and it can also include other special values: spacer, separator and spring. spacer represents an empty button space, separator a...
...ion has icons with a lighter shade. On Linux, icons are 24x24 pixels by default. Since Firefox is a GTK application, it uses GTK icons whenever possible. The icons in the image are the ones that aren't provided by GTK. GTK icons are accessed using special URLs, like this one: moz-icon://stock/gtk-go-back?size=menu. You can enter this URL in Firefox on Linux, and the corresponding icon will be dis
played. This is also the reason this is the only theme that still has colorful icons for its buttons. Now let's look at the CSS work involved in a toolbar that works on the aforementioned systems. If you want your toolbar to look right on all systems, you should consider having different icon sets for each. You should also consider using a graphic designer for this work, as it takes a lot of attention...
Adding menus and submenus - Archive of obsolete content
<menuseparator /> <menuitem label="&xulschoolhello.greet.custom.label;" oncommand="XULSchoolChrome.GreetingDialog.greetingCustom(event);" /> </menupopup> </menu> </menubar> </toolbox> This code displays a simple menu with options for 3 different types of greetings, a menuseparator, and finally an option to show a custom greeting. The separator is usually dis
played as a horizontal line that creates a logical division between different types of menuitem elements, keeping everything more organized. A menubar can hold one or more menu elements. Menus require a menupopup element as a container for its children, which are usually menuitem elements, but can also be menuseparator, or menu in order to have multiple nesting levels: <toolbox> <menubar id="xulschoo...
...In this case we grouped the 3 greeting items into a submenu. It doesn't make much sense to do that in this case because we end up with only two menu items, one of them being a menu with 3 child items. You can also have menus that are filled dynamically. Instead of setting the menupopup directly in the XUL, you can use the onpopupshowing event to fill the children when the popup is about to be dis
played. DOM functions like createElement and appendChild can be used to accomplish this. If you have nothing to show on a menu, you should follow the standard used in Firefox: show a single disabled item with an "(Empty)" label. If filling your menu takes a noticeable amount of time, you should not make Firefox (and your users) wait for it to fill up before displaying anything. It's best to show an i...
Handling Preferences - Archive of obsolete content
extension needs. Download this sample Hello World using preferences. There are a couple of additions in the Makefiles, to include the preference file xulschoolhello.js. The contents of the file are fairly simple: // Amount of messages shown to the user. pref("extensions.xulschoolhello.message.count", 0); This defines a preference we'll use to keep track of the amount of times we have dis
played a greeting message to the user. Its default value is 0. You'll see this preference appear in about:config after installing the extension. Just type "xulschool" in the filter box to see your new preference. Note: Always begin your preference names with "extensions", followed by some namespacing and finally the actual name of the preference. Name parts are normally separated by dots. Now let's lo...
...e windows be modal on Windows. This way the user is urged to apply or discard any changes instead of being able to ignore the Preferences window. For preferences windows you should always use the prefwindow element instead of window in your XUL file. Firefox will know if it needs to add OK and Cancel buttons or not. In most cases, your preferences window will have a few options that can be dis
played all at once. If you have many preferences, you can organize them using the prefpane element. This creates a visually appealing tabbed view, just like the one in the Firefox Preferences window. The prefpane is just a container, and you can have as many as you want. The tabs at the top of the window will need icons, and just like with toolbar buttons there are subtle differences between operating s...
JavaScript Object Management - Archive of obsolete content
have complex behavior that requires too much code, look for ways to divide it into multiple objects and files. You can include as many scripts in a XUL window as you need. To initialize your chrome objects, it's usually better to run the initialization code from the "load" event handler for the window. The load event is fired after the DOM on the window has loaded completely, but before it's dis
played to the user. This allows you to manipulate and possibly change elements in the window without the user noticing the changes. /** * Controls the browser overlay for the Hello World extension. */ <Namespace>.BrowserOverlay = { /** * Initializes this object. */ init : function(aEvent) { this._stringBundle = document.getElementById("xulschoolhello-string-bundle"); // you can ma...
...orcement whatsoever, but this standard give others the chance to "play nice" and don't use private members. Use "_" at the beginning of private attributes and methods in JS objects. For example: _stringBundle, _createUserNode(). Exercise Here's a short exercise to test a particular aspect of the chrome. Modify the Hello World extension so that the message says how many times it has been dis
played. The message could say something like "Hello! This message has been shown 5 times." Keep the counter as a variable in the BrowserOverlay object, and increment it every time the message is going to be shown. Once you have this working right, try the following: open the message a few times, so that the number increments. Now open a new window and display the message from the new window. What do yo...
Signing an XPI - Archive of obsolete content
Signing Request (CSR) in the background without you necessarily realising it. The CSR will be uploaded to the Issuer. Later, you must use the same browser when installing the new certificate because the key and certificate pair must be together. Hint: When applying for a certificate ensure that the Organisation (O) contains your name and not the Issuer's default text, because this is what is dis
played to users. For this guide I applied for a free certificate from Unizeto Certum. After completing the application process where I entered my details into the online application, I received an automated email requesting documentary evidence of my ID in the form of a photo-ID or similar. I have hi-resolution scanned images of my passport and drivers license for these situations so I placed them on m...
... placed them on my web-server temporarily in a hidden location and emailed Unizeto Certum with the details and location of the files. Within a few hours I received a confirmation email from a human accepting the ID images and giving me a hyperlink to the certifcate download area. Install the certificate into Mozilla Firefox (which goes with the private key created earlier), and copy/paste the dis
played certificate text into a new file called C:\Projects\CodeSigning\Certum Code Signing.cer. Installing real certificate There are two steps required to install the new certificate in the Code Signing NSS certificate database. 1. Install the Issuer's Certificate Authority Root 2. Install your key and certificate The root CA establishes the trust of your certificate. Many issuer's have multiple...
MMgc - Archive of obsolete content
c will "poison" memory for deleted objects, and will detect if the poison has been written over by the application, which would indicate a write to a deleted object. Stack traces (walk stack frame and lookup IPs) When #define MEMORY_INFO is on, MMgc will capture a stack trace for every object allocation. This slows the application down but can be invaluable when debugging. Memory leaks will be dis
played with their stack trace of origin. Sample stack trace: xmlclass.cpp:391 toplevel.cpp:164 toplevel.cpp:507 interpreter.cpp:1098 interpreter.cpp:20 methodenv.cpp:47 Allocation traces, deletion traces etc. If you're trying to see why memory is not getting reclaimed; GC::WhosPointingAtMe() can be called from the msvc debugger and will spit out objects that are pointing to the given memory location. M...
...ng to the given memory location. Memory Profiler MMgc's memory profiler can display the state of your application's heap, showing the different classes of object in memory, along with object counts, byte counts, and percentage of total memory. It can also display stack traces for where every object was allocated. The report can be output to the console or to a file, and can be configured to be dis
played pre/post sweep or via API call. The Memory Profiler use sRTTI and stack traces to get information by location and type: class avmplus::GrowableBuffer - 24.9% - 3015 kb 514 items, avg 6007b 98.9% - 2983 kb - 512 items - poolobject.cpp:29 abcparser.cpp:948 ... 0.8% - 24 kb - 1 items - poolobject.cpp:29 abcparser.cpp:948 ... class avmplus::String - 13.2% - 1602 kb 15675 items, avg 104b ...
Adding the structure - Archive of obsolete content
panel-iconic" id="tinderbox-status" status="none"/> <statusbarpanel class="statusbarpanel-iconic" id="offline-status"/> <statusbarpanel class="statusbarpanel-iconic" id="security-button" onclick="BrowserPageInfo(null, 'securityTab')"/> </statusbar> The statusbar XUL element defines a horizontal status bar where informative messages about an application's state can be dis
played. It can contain both text messages (i.e. "Done" in Mozilla when a document finishes loading) and graphical messages (f.e. the lock icon in Mozilla that shows whether or not a loaded document was encrypted with SSL). Status bars comprise a series of panels, each one defined by a statusbarpanel XUL element. Each status bar panel displays a different kind of status information. Graphical panels (li...
... << PreviousNext >> ...
Editor Embedding Guide - Archive of obsolete content
n. GetCommandState "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) DoCommand no parameters Note This is logical style. cmd_code Toggles code on selection. GetCommandState "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "s Note This is logical style. Typically it is dis
played with monospace font. cmd_samp Toggles program output sample style on selection. GetCommandState "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) DoCommand no parameters Note This is logical style. Typically it is dis
played with monospace font. cmd_var Toggles variable style on selection. GetCommandState "state_...
... cmd_removeLinks Removes the existing link from the selection (if any). GetCommandState "state_enabled"(boolean), ??? DoCommand no parameters cmd_ol Makes ordered list from selection or inserts new list if there is no selection. ...
Documentation for BiDi Mozilla - Archive of obsolete content
ns on specific platforms, since the platform never sees a text fragment with mixed directionality, and is not expected to do anything more complicated than displaying left-to-right text from left to right or right-to-left text from right to left. In some circumstances, even on a platform with Bidi capability, the layout code has to reverse text fragments or to allow for the fact that they are dis
played in reverse. In general, this happens whenever we are dealing with less than a whole frame. Examples of this are in nsTextFrame::PaintTextSlowly; nsTextFrame::PaintUnicodeText when a selection is dis
played; nsTextFrame::GetPosition; nsTextFrame::GetPointFromOffset. Text in Visual mode must also be reversed before display on a Bidi platform. Text fields and Composer The specification of the Bidi ...
...ased on Bidi Options in Preferences, the Text Mode of the clipboard may be "Logical", "Visual" or "As Source". In "As Source" mode, the text copied into the clipboard is exactly the same (from a Bidi point of view) as the original source. The text pasted from the clipboard (to the composer or to an edit field) is pasted as is. In "Visual" mode, the text copied into the clipboard is exactly the dis
played text. The text pasted from the clipboard is converted (if needed) so that Mozilla displays it (from a Bidi point of view) as it would be dis
played by a visual clipboard viewer. In "Logical" mode, the text copied into the clipboard is converted (if needed) so that a Logical application will display it (from a Bidi point of view) as it is dis
played by Mozilla. Text pasted from the clipboard is trea...
Configuration - Archive of obsolete content
running this web app. The actual icon file should be stored in the webapp bundle. status turns the status messages on or off for this web app: yes or no location turns the readonly location bar on or off for this web app: yes or no navigation turns the hotkey history navigation (ALT+LEFT, ALT+RIGHT and ALT+HOME) on or off for this web app: yes or no splashscreen filename of an HTML page to be dis
played while the app is loading. The file must be located in the web app home directory: splashscreen.html include uris that should be opened in the web app, rather than in the default browser. An asterisk is used to match any string. Separate multiple uris with commas: *google.com, *yahoo.com exclude urls that should be opened in the default browser, rather than in the web app. Syntax is the same as fo...
...shscreen.html include uris that should be opened in the web app, rather than in the default browser. An asterisk is used to match any string. Separate multiple uris with commas: *google.com, *yahoo.com exclude urls that should be opened in the default browser, rather than in the web app. Syntax is the same as for include. trayicon Indicates that a system tray (notification area) icon should be dis
played for the application on Windows: yes or no. iconic Specifies that the application should be opened in iconic state. Currently support only on Windows in conjunction with the trayicon, causes the application to open minimized to the system tray: yes or no. Launch Prism with -webapp [bundle] to load the specified web profile and install the webapp to your Prism profile folder. Once the webapp is in...
width - Archive of obsolete content
<< XUL Reference home 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 dis
played 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 property may also be used. In this example, the preferred width of the inner hbox will be dis
played at 40 pixels. The dis
played width is also 40 pixels as no flexibility or alignment applies. ...
...h property may also be used. In this example, the preferred width of the inner hbox will be dis
played at 40 pixels. The dis
played width is also 40 pixels as no flexibility or alignment applies. <hbox> <hbox width="40" style="background-color: red;"> <label value="40"/> </hbox> </hbox> However, in the following example, despite that the preferred width of the box is 30 pixels, the dis
played size of the box will be larger to accommodate the larger label. <vbox width="30" align="start" style="background-color: red;"> <label value="vbox xul width 10px red"/> </vbox> Note: When used on treecol objects, the width attribute can be used to allow a tree to be scrolled horizontally if the column widths add up to be wider than the containing object. ...
Menus - Archive of obsolete content
For more information about how to use an overlay to modify a menu, see Using Menus and Popups in Extensions The following tables list the IDs of menus in Firefox that are commonly overlaid upon. Firefox menus Element ID Description main-menubar The menubar element. menu_FilePopup The menupopup associated with the 'File' menu. menu_EditPopup The menupopup associated with the 'Edit' menu. ...
...ociated with the 'Help' menu. menu_viewSidebarMenu The menupopup for the 'Sidebar' submenu on the 'View' menu. menuWebDeveloperPopup The menupopup for the 'Web Developer' submenu on the 'Tools' menu. Firefox context menu Element ID Description Relevant context contentAreaContextMenu The popup for the context menu when a web page is dis
played in the browser area. spell-no-suggestions The no spelling suggestions item - notable as it is the first item on the context menu. Editable Text context-openlink Opens a link in a new window Links context-openlinkintab Opens a link in a new tab Links context-bookmarklink Bookmarks a link Links context-savelink Saves a lin...
ContextMenus - Archive of obsolete content
ute. <menupopup id="link-menu"> <menuitem label="Open Link" default="true"/> <menuitem label="Open In New Window"/> <menuitem label="Properties"/> </menupopup> The default attribute has been set to true on the first menu item ('Open Link'). On platforms that support it, it will be marked as a default item. On other platforms, the attribute will just be ignored and the menuitem will be dis
played normally. Naturally, it only makes sense to have one default item per context menu. Note that the default attribute just affects how the item is dis
played, it performs no other function itself. You will still need to associate code with the element to handle the default operation. Menu Separators To group menu items together for better visual clarity, use a menu separator. <menuseparator/> ...
...bute is set to '_child'. Note that this special value must begin with an underscore to distinguish it from an id of 'child'. The menupopup does not have to be the last child of the element as in this example, but usually this will be a convenient place to put it. Hiding and Showing Menu Items based on Context When the context menu is opened, a popupshowing event will fire before the popup is dis
played. This may be used to adjust the items dis
played on the menu. Typically, this will vary based on what the context is. For example, right clicking on an image might display items pertaining to images, whereas clicking on a link would display items pertaining to links. In many cases, it may be easier to use a single context menu containing every possible item, and show and hide the necessary items ...
MenuItems - Archive of obsolete content
es on each platform, but is the key typically used for shortcut keys. For instance, if the "accel" key is Control, the menu might display "Ctrl + O". Although there isn't usually a need to do so, you can also set a custom label for the keyboard shortcut on the menu using the acceltext attribute. You might do this if the key associated with the item changes, for instance a list of open windows dis
played on a Window menu. <menuitem label="First Window" acceltext="1"/> Here the keyboard shortcut label will be '1', however you will need to write code to handle the key as well. Adding icons to menu items An icon may be added to a menu item using the image attribute. The icon will appear to the left of the menuitem label. In addition to the image, a special class "menuitem-iconic" must be used o...
... is fundamentally different to other HTML elements, such as <li> or <div> where list-style-image and -moz-image-region can be applied at the same element level. Checkbox menu items Sometimes, you will want to have an item on a menu that acts as a toggle. For instance, a menuitem that can be used to toggle a toolbar on and off. To indicate the current state of the toolbar, a checkbox would be dis
played next to the menu item label. If the checkbox is on, the toolbar is shown, whereas if the checkbox is off, the toolbar is not shown. The user can select the menu item to switch the toolbar visibility. This type of menuitem can be created by using the type attribute and setting it to the value "checkbox". <menu label="View" accesskey="V"> <menupopup> <menuitem label="Show Toolbar" accesskey...
Panels - Archive of obsolete content
abel control="search" value="Terms:"/> <textbox id="search"/> </panel> To attach a panel to an non-button element, for instance to have a panel open when a label is clicked, use the popup attribute. The popup attribute should be set to the id of a panel within the same document. When the left mouse button is pressed on the element with the popup attribute, the corresponding panel will be dis
played. For instance, to attach the popup defined above to a label, use the following code: <label value="Search" popup="search-panel"/> The result is a search button which opens a panel for entering the search term. When using the popup attribute, the panel will appear with the top left corner at the mouse position. In this case, you may wish to have the popup appear below the label instead. The pos...
...d. The position attribute may be used to control the placement of the popup. Here is a complete example: <panel id="search-panel" position="after_start"> <label control="search" value="Terms:"/> <textbox id="search"/> </panel> <label value="Search" popup="search-panel"/> The position attribute has been added to the panel element with the value 'after_start'. This causes the panel to be dis
played not where the mouse was clicked but aligned along the bottom edge of the label. For more information about this attribute and other possible values that can be used, see Positioning Popups. It is also possible to open a panel like a context menu using the context attribute instead of the popup attribute. This works just like using context menus except that the panel element is used instead of th...
PopupEvents - Archive of obsolete content
This event is fired on a menupopup, panel or tooltip once it is about to be hidden. This may happen because the user selected an item from the menu, or it may be because the popup was closed by clicking elsewhere. popuphidden This event is fired on a menupopup, panel or tooltip once it has been hidden. The popupshowing event Just before a popup is about to be dis
played, a popupshowing event will fired on the popup. This will occur regardless of how the popup is opened, either from user interaction or from a script calling the openPopup or openPopupAtScreen methods. The typical usage of a listener of the popupshowing event is to adjust the content of the popup based on context. For instance, right clicking on an image might display items on a context menu pertai...
...ypical usage of a listener of the popupshowing event is to adjust the content of the popup based on context. For instance, right clicking on an image might display items on a context menu pertaining to images, whereas clicking on a link would display only those items pertaining to links. Within the listener for the popupshowing event, you can append to or modify the menu as needed before it is dis
played. For examples of the use of the popupshowing event when used with context menus, see Hiding and Showing Menu Items based on Context. However, this technique can be applied to any type of popup. In this example, a label within a panel is initialized with the current time. <panel id="time-panel" onpopupshowing="this.lastChild.value = (new Date()).toLocaleFormat('%T')"> <label value="Time:"/> <l...
Tooltips - Archive of obsolete content
the parent toolbar does. The result is that the toolbar's tooltip will apply when the mouse is moved over the Close button, as well as when the mouse is over an empty part of the toolbar. Note that the tooltip text 'File Buttons' isn't a good tooltip to use either. It conveys no additional information to the user, so it shouldn't be used as in this example. The tooltip element Tooltips are dis
played using a tooltip element, which is a type of popup, but is styled to look different. Elements that use the tooltiptext attribute display the tooltip in a default tooltip element, which typically looks like a small yellow box large enough to fit the text inside it. This default tooltip is created automatically, so you don't normally need to use a tooltip element. However, it is possible to use ano...
... property is examined to retrieve the label of the element that the mouse is over. This label is then set as the value of the last child of the tooltip. In the earlier example, the last child of the tooltip is a label. The effect is that the value of the label within the tooltip will change based on the element that the mouse is moved over. Tooltips in Trees As the entire body of the tree is dis
played using a single element, the tooltip and tooltiptext attributes do not apply to individual rows or cells of a tree. However, the tree will automatically display tooltips for a cell when the value is cropped. For instance, if a cell has a long label and the column is shorter than the label's length, a tooltip will appear when the mouse is moved over the cell so that the user can see the entire valu...
Building Hierarchical Trees - Archive of obsolete content
, the tree rows will not become containers, so you will not be able to open them. As the rows are not containers, the tree builder does not recurse to find additional data. The tree builder creates rows lazily, so a closed container will not have any data generated inside in it until the row is opened. When the user opens the tree row, the next level of rows are generated from the template and dis
played in the tree. Similarly, when the user closes a tree row, the rows inside it are removed, such that they will have to be generated again the next time the row is opened. If you want to put rows inside the photo rows, you will either need to make each photo resource a container (for this RDF datasource, this will usually be an RDF Seq), or use the containment attribute to specify additional propert...
... they will not have children in the tree. <rdf:Bag rdf:about="http://www.xulplanet.com/rdf/myneighbourhood"> <rdf:li> <rdf:Seq rdf:about="http://www.xulplanet.com/rdf/marion" dc:title="Marion Street"> The result is a two level tree with two columns. For an XML source, a container is a node in the XML document that has children. In this example, the two group elements are dis
played at the first level. The individual people are dis
played at the next level of the tree as the builder recurses. In this example, we only need to use one rule. <tree datasources="people2.xml" ref="*" querytype="xml" rows="10" flags="dont-build-content"> <treecols> <treecol id="name" primary="true" label="Name" flex="1"/> </treecols> <template> <query expr="*"/> <action> ...
RDF Modifications - Archive of obsolete content
tasource. subject: http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg predicate: http://purl.org/dc/elements/1.1/description object: One of the thirty or so Egyptian obelisks The template builder will be notified through the RDF observer mechanism of the change. The template builder will need to check all of the queries and rules to see if this triple could cause a change in what would be dis
played. If the triple wouldn't cause any change in the output, the builder won't make any changes. If the output would change, the builder will need to adjust the output, either by adding a new result, removing an old result, or by changing the value of some part of the result. The builder is smart enough to only change what needs to be changed and leave the remaining parts alone. Let's assume we have s...
... <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/description" object="?description"/> </query> These query statements will cause any photos with both a title and a description to be dis
played. Assuming that the 'obelisk' photo doesn't have a description already, adding the triple listed above should cause a new result to be available for this photo. The builder scans through the query statements one by one. The content tag can safely be skipped at this part of the process, so the builder moves onto the member statement. This type of statement can only cause a change when an item is be...
Rule Compilation - Archive of obsolete content
at is, it processes as little as needed, and only continues when necessary. For instance, consider the example below: <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/A" hidden="true"> <template> ... </template> </vbox> The <vbox> is hidden as indicated by the 'hidden' attribute. Since any content that would be generated wouldn't be dis
played anyway, the template builder doesn't do anything, putting off work until later. If you show the vbox by setting the hidden state to false, the template builder will be invoked and the content will be generated. Does this mean that templates cannot be used inside hidden areas of the UI? No, you can still do that. Changing the hidden state of an element isn't the only way to cause content to be gen...
...ed menu items until the menu is opened. A similar rule applies for child tree items. The children are not generated until the user presses the twisty to open the container or when a script opens a row. Lazy generation comes in handy for menus and trees especially when dealing with recursive items. It would be rather time consuming to generate output for every item in a tree, even for those not dis
played, so the template builder doesn't do so. The template builder is even lazier. If the generated content itself contains hidden elements, those child elements will not be generated until necessary. When building content, the builder iterates down the node tree, copying and building only when needed. << PreviousNext >> ...
Static Content - Archive of obsolete content
<< PreviousNext >> Creating a menuitem in the filter list to show all items is fairly easy. This item doesn't need to be generated from the datasource. Instead it will be what is called static content in a template. The static content is any content that is a sibling of the template element. This content is dis
played as is without affecting the generated content from the template. <menulist datasources="template-guide-photos4.rdf" ref="http://www.daml.org/2001/09/countries/country-ont#Country" oncommand="applyFilter(event.target.value);"> <menupopup> <menuitem label="All"/> </menupopup> <template> <query> <content uri="?start"/> <triple subject="?country" predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ...
...ts/1.1/title" object="?countrytitle"/> </query> <action> <menupopup> <menuitem uri="?country" label="?countrytitle" value="?country"/> </menupopup> </action> </template> </menulist> The only difference between the previous example and this one is that the menulist element has some additional content added before the template. The content will be dis
played just like it would be as if the template wasn't present. That is, before the template is examined, the menulist would have one item in it, with the label 'All'. The template generates two results as before, one for each country, and appends a menuitem for each one. One interesting thing about this example is that only one menupopup will be created, even though there are two in the code, one outsi...
Custom toolbar button - Archive of obsolete content
mage-region: rect( 0px 24px 24px 0px);} .custombutton:hover {-moz-image-region: rect(24px 24px 48px 0px);} [iconsize="small"] .custombutton {-moz-image-region: rect( 0px 40px 16px 24px);} [iconsize="small"] .custombutton:hover {-moz-image-region: rect(24px 40px 40px 24px);} There is nothing to customize. Save the file. Explanation: This CSS stylesheet specifies how the button is dis
played. It links to the button image, specifying the dimensions of the four parts of the image. 8. Create a plain text file named button.js. Copy the following content, and paste it into the new file: CustomButton = { 1: function () { alert("Just testing") }, } There is nothing to customize for now. Save the file. The next section in this tutorial contains examples of code that you can us...
...rts on the right are used when you set the toolbar to use small buttons. 10. Download the extension image. Get a context menu for the image that you see here (for example, by right-clicking it). Choose Save Image As... from the context menu, and save it in the same directory as the files you have just created. Ensure that the name of the saved file is: icon.png Explanation: This image is dis
played in the application's Extension Manager window. Testing your new button Restart the application. Either get a context menu for the application's toolbar (for example, by right-clicking it) and choose Customize..., or choose View - Toolbars - Customize... from the application's menu bar. Drag your new button to where you want it on the toolbar. Press Done to close the toolbar palette window. ...
Tree Widget Changes - Archive of obsolete content
ore it took a row index and a column id. To get a column in JavaScript: tree.columns.getColumnFor(treeColElement); tree.columns.getNamedColumn(treeColID); tree.columns.getColumnAt(index); You can also just use array syntax to get a column: tree.columns["lastName"]; tree.columns[5]; Once you have a column, you can get various properties of it: column.index - the index of the column in dis
played order column.id - the id attribute of the column column.element - the treecol element column.x - the X position in the tree of the left edge of the column column.width - the width of the column In C++ code, you can also get the atom attribute of nsITreeColumn which returns an nsIAtom for the column, making it fast to do comparisons. nsCOMPtr<nsIAtom> atom; aCol->GetAtom(getter_AddRefs(atom...
....selection instead of tree.treeBoxObject.selection. Use tree.columns[1].id instead of tree.treeBoxObject.getColumnID(1) to get the id of a column, in this case column 1. Use tree.columns.getKeyColumn().index instead of tree.treeBoxObject.getKeyColumnIndex(). The nsITreeBoxObject.getPageCount() method has been renamed to make it clearer what it does. It returns the number of rows that can be dis
played in the tree. This should correspond to the rows attribute on the tree if it was specified. tree.treeBoxObject.getPageCount() is now tree.treeBoxObject.getPageLength(). The invalidatePrimaryCell(row) method has been removed, instead use nsITreeBoxObject.invalidateCell() like this invalidateCell(row, tree.columns.getPrimaryColumn()). This may be used to redraw a cell after it or its data has been...
Adding Labels and Images - Archive of obsolete content
<< PreviousNext >> This section describes a way to add labels and images to a window. In addition, we look at how to include elements into groups. Text Elements You cannot embed text directly into a XUL file without tags around it and expect it to be dis
played. You can use two XUL elements for this purpose. Label Element The most basic way to include text in a window is to use the label element. It should be used when you want to place a descriptive label beside a control, such as a button. An example is shown below: Example 1 : Source View <label value="This is some text"/> The value attribute can be used to specify the text that you wish to have dis
played. The text will not wrap, so the text will all be dis
played on a single line. This syntax is the most common of labels. If th...
...up of controls for example. As with the label element, you can either use the value attribute for a single line of text or place text or XHTML content inside opening and closing description tags for longer blocks of text. It is more common to use the attribute syntax for labels, and the text content syntax for descriptions. Example 4 : Source View <description> This longer section of text is dis
played. </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 intended for labels of controls, such as text fields. The co...
Creating Dialogs - Archive of obsolete content
This section describes how one might construct them. Creating a Dialog The openDialog() function is used to open a dialog, and is related to open(). This function differs from open() in several ways. It displays a dialog instead of a window, which implies that it is asking something of the user. It also has subtle differences in the way it works and appears to the user. These differences will vary depending on the platform the application is running on. In addition, the openDialog() function can take additional arguments beyond the first three. ...
...n array stored in the new window's arguments property. You can pass as many arguments as you wish. This is a convenient way to supply default values to the fields in the dialog. var somefile=document.getElementById('enterfile').value; window.openDialog("chrome://findfile/content/showdetails.xul","showmore", "chrome",somefile); In this example the dialog showdetails.xul is dis
played. It's passed one argument, somefile, which was taken from the value of an element with the ID enterfile. In a script used by the dialog, we can then refer to the argument using the window's arguments property. For example: var fl = window.arguments[0]; document.getElementById('thefile').value = fl; This is an effective way to pass values to the new window. You can pass values back from the op...
Creating a Window - Archive of obsolete content
rt style sheets. In this case, we import the styles found in the global part of a skin package. We didn't specify a specific file so Mozilla will determine which files in the directory to use. In this case, the all-important global.css file is selected. This file contains all the default declarations for all of the XUL elements. Because XML does not have any knowledge of how elements should be dis
played, the file indicates how. Generally, you will put this line at the top of every XUL file. You can also import other style sheets using a similar syntax. Note that you would normally import the global style sheet from within your own style sheet file. <window This line declares that you are describing a window. Each user interface window is described in a separate file. This tag is much like the...
...e but they do not have to be. id="findfile-window" The id attribute is used as an identifier so that the window can be referred to by scripts. You will usually put an id attribute on all elements. The name can be anything you want although it should be something relevant. title="Find Files" The title attribute describes the text that would appear on the title bar of the window when it is dis
played. In this case the text 'Find Files' will appear. orient="horizontal" The orient attribute specifies the arrangement of the items in the window. The value horizontal indicates that items should be placed horizontally across the window. You may also use the value vertical, which means that the items are placed in a column. This is the default value, so you may leave the attribute off entirely if...
Creating a Wizard - Archive of obsolete content
the wizard element includes the content of each page of the wizard. The pages of the wizard are created using the wizardpage element. You can place whatever content you want inside each wizardpage. Note that wizards currently only work properly from chrome URLs. The wizard consists of several sections. The exact layout will vary according to the OS for the platform. Wizards will generally be dis
played using customs that are familiar to the user of a particular OS. A typical layout will include a title across the top, a set of navigation buttons across the bottom and the page contents in between. The title across the top is created using the title attribute, much like one would use for regular windows. The navigation buttons are created automatically. An example wizard Source <?xml version=...
...s true, the wizard closes. If it returns false, then the wizard does not close, which might occur if the function saveDogInfo() encountered invalid input, for example. There are also related onwizardback, onwizardnext and onwizardcancel attributes, which are called when the Back, Next and Cancel buttons are pressed respectively. These functions are called regardless of which page is currently dis
played. To have different code called depending on which page you are on, use the onpagerewound or onpageadvanced attributes on a wizardpage element. They work in a similar way to the other functions except that you can use different code for each page. This allows you to validate the input entered on each page before the user continues. A third option is to use the onpagehide and onpageshow attribute...
Element Positioning - Archive of obsolete content
Example 3 The third button is flexible so it will grow based on the size of the box the button is in. However, the button will never shrink...
... label="4" flex="1" style="min-height: 2ex; max-width: 100px"/> <textbox flex="1" style="max-width: 10em;"/> <description style="max-width: 50px">This is some boring but simple wrapping text.</description> Example 1 The first button will be dis
played with a width of 100 pixels (px means pixels). You need to add the unit or the width will be ignored. Example 2 The second button will be dis
played with a height of ten pixels and a width of 100 ems (an em is the size of a character in the current font). Example 3 The third button is flexible so it will grow based on the size of the box the button is in. However, the button will never shrink to be less than 50 pixels. Other flexible components such as spacers will absorb the remaining space, breaking the flex ratio. Example 4 The fourt...
Focus and Selection - Archive of obsolete content
AB key by adding a tabindex attribute to an element. This attribute should be set to a number. When the user presses TAB, the focus will shift to the element with the next highest tab index. That means that you can order the elements by setting indices on elements in sequence. Usually, however, you would not set the tabindex attribute. If you do not, pressing TAB will set the focus to the next dis
played element. You only need to set tab indices if you wish to use a different order. Here is an example: Example 1 : Source View <button label="Button 1" tabindex="2"/> <button label="Button 2" tabindex="1"/> <button label="Button 3" tabindex="3"/> The focus event The focus event is used to respond when the focus is given to an element. The blur event is used to respond when the focus is removed from...
...u may wish to select only part of the text. To do this you can use the setSelectionRange function. It takes two parameters, the first is the starting character and the second is the character after the last one that you want to have selected. Values are zero-based, so the first character is 0, the second is 1 and so on. tbox.setSelectionRange(4,8); This example will select the fifth character dis
played, as well as the sixth, seventh and eighth. If there were only six characters entered into the field, only the fifth and sixth characters would be selected. No error would occur. If you use the same value for both parameters, the start and end of the selection changes to the same position. This results in changing the cursor position within the textbox. For example, the line below can be used to m...
Groupboxes - Archive of obsolete content
es The groupbox element is used to group related XUL elements together, much like the HTML fieldset element is used to group HTML elements. The groupbox is a type of box, and the elements it contains are aligned according to the XUL box rules. However, there are several differences between groupboxes and regular boxes: The groupbox can be labeled using the caption element. The groupbox is dis
played in a special way--usually with a beveled border and a caption, although you can change the appearance using CSS. You can create a caption for your groupbox by inserting a caption element as the first child. Groupboxes are box elements, so you can use the box attributes, such as orient and flex. A simple groupbox example The example below shows a simple groupbox: Example 1 : Source View <grou...
...x elements, so you can use the box attributes, such as orient and flex. A simple groupbox example The example below shows a simple groupbox: Example 1 : Source View <groupbox> <caption label="Answer"/> <description value="Banana"/> <description value="Tangerine"/> <description value="Phone Booth"/> <description value="Kiwi"/> </groupbox> This will cause four pieces of text to be dis
played surrounded by a box with the label Answer. Note that the groupbox has a vertical orientation by default which is necessary to have the text elements stack in a single column. More complex captions You can also add child elements inside the caption element to create a more complex caption. For example, Mozilla's Font preferences panel uses a drop-down menu as a caption. Although any content can be...
Introduction - Archive of obsolete content
y for building portable user interfaces. It takes a long time to build an application even for only one platform. The time required to compile and debug can be lengthy. With XUL, an interface can be implemented and modified quickly and easily. XUL has all the advantages of other XML languages. For example XHTML or other XML languages such as MathML or SVG can be inserted within it. Also, text dis
played with XUL is easily localizable, which means that it can be translated into other languages with little effort. What kinds of user interfaces can be made with XUL? XUL provides the ability to create most elements found in modern graphical interfaces. Some elements that can be created are: Input controls such as textboxes and checkboxes Toolbars with buttons or other content Menus on a menu ...
... What kinds of user interfaces can be made with XUL? XUL provides the ability to create most elements found in modern graphical interfaces. Some elements that can be created are: Input controls such as textboxes and checkboxes Toolbars with buttons or other content Menus on a menu bar or pop up menus Tabbed dialogs Trees for hierarchical or tabular information Keyboard shortcuts The dis
played content can be created from the contents of a XUL file or with data from a datasource. In Mozilla, such datasources include a user's mailbox, their bookmarks and search results. The contents of menus, trees and other elements can be populated with this data, or with your own data supplied in an RDF file. There are several ways you can use XUL: Firefox extension An extension adds functionalit...
Localization - Archive of obsolete content
e text for that language will be used instead. for Japanese: <!ENTITY findLabel "??"> For example, the following text: <description value="&findLabel;"/> is translated as: English version: <description value="Find"/> Japanese version: <description value="??"/> You would declare an entity for each label or string of text that you use in your interface. You should not have any directly dis
played text in the XUL file at all. In addition to using entities for text labels, you should use them for any value that could be different in a different language. Access keys and keyboard shortcuts for example. XUL <menuitem label="&undo.label;" accesskey="&undo.key;"/> DTD <!ENTITY undo.label "Undo"> <!ENTITY undo.key "u"> The example above uses two entities, one for the label on the Undo ...
...tton" label="&button.find;" oncommand="doFind()"/> <button id="cancel-button" label="&button.cancel;" oncommand="window.close();"/> </hbox> </vbox> </window> Each text string has been replaced by an entity reference. A DTD file has been included near the beginning of the XUL file. Each entity that was added should be declared in the DTD file. The window will not be dis
played if an entity is found in the XUL file that hasn't been declared. Note that the name of the entity is not important. In the example above, words in entities have been separated with periods. You don't have to do this. The entity names here follow similar conventions as the rest of the Mozilla code. You might notice that the text '2520 bytes' has been replaced by two entities. This is because the...
More Button Features - Archive of obsolete content
The button below will have both a label and the image 'happy.png'. The image will appear to the left of the label. You can change this position by using two other attributes. ...
...er way to specify the image is by using the CSS list-style-image style property on the button. This is designed to allow the 'skin' (in this case, the appearance of the image) to be changed without changing the XUL file. An example is shown below. Example 2 : Source View <button id="find-button" label="Find" style="list-style-image: url('happy.png')"/> In this case, the image 'happy.png' is dis
played on the button. The style attribute functions similar to its HTML counterpart. In general, it can be used on all XUL elements. Note that you really should put the style declarations in a separate style sheet. Positioning the Images By default, the image on a button will appear to the left of the text label. There are two attributes that can be used to control this position. The dir attribute contr...
More Event Handlers - Archive of obsolete content
removed, both listeners would be called and both alerts would appear. Prevent Default Action If no event handlers have been registered for an event, then after completing the capturing and bubbling phases, the element will handle the event in a default way. What will happen depends on the event and the type of element. For example, the 'popupshowing' event is sent to a popup just before it is dis
played. The default action is to display the popup. If the default action is prevented, the popup will not be dis
played. The default action can be prevented with the event object's preventDefault method, as in the example below. Example 3 : Source View <button label="Types" type="menu"> <menupopup onpopupshowing="event.preventDefault();"> <menuitem label="Glass"/> <menuitem label="Plastic"/> ...
...nt's position from the event position, as in the following code. var element = event.target; var elementX = event.clientX - element.boxObject.x; var elementY = event.clientY - element.boxObject.y; XUL elements have a box object that can be retrieved using the boxObject property. We'll learn more about the box object in a later section, but it holds information pertaining to how the element is dis
played, including the x and y position of the element. In this example code, these coordinates are subtracted from the event coordinates to get the event position relative to the element. Load Events The load event is sent to the document (the window tag) once the XUL file has finished loading and just before the content is dis
played. This event is commonly used to initialize fields and perform other ta...
More Wizards - Archive of obsolete content
t="font"> <wizardpage pageid="font" next="done"> <wizardpage pageid="color" next="done"> <wizardpage pageid="done"> The wizard always starts at the first page, which in this case has the page ID type. The next page is the one with the page ID font, so the wizard will navigate to that page next. On the page with the page ID font, we can see that the next page is done, so that page will be dis
played afterwards. The page with the page ID done has no next attribute, so this will be the last page. A script will adjust the next attributes as necessary to go to the page with the page ID color when needed. Wizard Functions The wizard works much like a tabbed panel, except that the tabs are not dis
played and the user navigates between pages by using the buttons along the bottom. Because all of ...
... code."/> </wizardpage> </wizard> There is also a corresponding canRewind property that you can use to enable or disable the Back button. Both properties are adjusted automatically as you switch pages. Thus, the Back button will be disabled on the first page so you don't have to set it yourself. Another useful property of the wizard is currentPage, which holds a reference to the currently dis
played wizardpage. You can also modify the current page by changing this property. If you do change it, the various page change events will still be fired. Next, we'll see how to use overlays to handle common content. << PreviousNext >> ...
Open and Save Dialogs - Archive of obsolete content
. This function takes three arguments, the window that is opening the dialog, the title of the dialog and the mode. The mode here is modeOpen which is used for an Open dialog. You can also use modeGetFolder and modeSave for the other two modes. These modes are constants of the nsIFilePicker interface. Default directory and filters There are two features you can set of the dialog before it is dis
played. The first is the default directory that is dis
played when the dialog is opened. The second is a filter that indicates the list of file types that are dis
played in the dialog. This would be used, for example, to hide all but .html files. You can set the default directory by setting the displayDirectory property of the file picker object to a directory. The directory should be an nsILocalFil...
...log. This would be used, for example, to hide all but .html files. You can set the default directory by setting the displayDirectory property of the file picker object to a directory. The directory should be an nsILocalFile object. If you do not set this, a suitable default will be selected for you. To add filters, call the appendFilters() function to set the file types that you wish to have dis
played. fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterImages); fp.appendFilters(nsIFilePicker.filterText | nsIFilePicker.filterAll); The first example will add filters for HTML and for image files. The user will only be able to select those types of files. The manner in which this is done is platform specific. On some platforms, each filter will be separate and the user can choose...
RDF Datasources - Archive of obsolete content
t of drives) A file URL By using a file URL for the ref attribute, you can select a specific directory to be returned. For example, you might use file:///windows or files:///usr/local. The files datasource is an example of a datasource that determines its resources only when necessary. We don't want every file in the filesystem to be determined before the data is dis
played. Instead, only the files and directories that the tree element (or other elements) will need to display at a given time will be determined. Composite Datasources You can specify multiple datasources in the datasources attribute by separating them with whitespace as in the example below. This has the effect of reading the data from all the datasources mentioned. <tree datasources="rdf:bookmarks rd...
...F file. This causes only the descendants of this list to be returned. Two rules have been used here. The first rule catches all the resources that have their ANIMALS:specimens attribute set to 0. You can see this attribute in the RDF file on each of the Description elements. Some of them have a value of 0. So in these cases, rule one will match. Because rule one has no content, nothing will be dis
played for these ones. This is an effective way to hide data that we don't want to display. The second rule applies to all other resources and creates a row in a popup menu. The end effect is that we get a popup menu containing all the mammals which have a specimen that is not 0. Next, we'll look at the full rule syntax. << PreviousNext >> ...
Stacks and Decks - Archive of obsolete content
element on the top of the stack, that is, the last element in the stack. That means that buttons will only work properly as the last element of the stack. Decks A deck element also lays out its children on top of each other much like the stack element, however decks only display one of their children at a time. ...
...The index is a number that identifies which page to display. Pages are numbered starting from zero. So, the first child of the deck is page 0, the second is page 1 and so on. ...
Templates - Archive of obsolete content
ent Builder The content builder takes the content inside the template element and duplicates it for each row. For instance, if the user had ten bookmarks in the example above, ten label elements would be created and added as children of the vbox element. If you were to use DOM functions to traverse the tree, you will find these elements there and can query their properties. These elements get dis
played, but the template itself is not dis
played, although it still exists in the document tree. In addition, the id of each of the labels will be set to the RDF resource for that row. The content builder always starts at the place where uri="rdf:*" is specfied. If the uri attribute is placed on an element lower in the element tree, the elements outside are only created once. In the example below, one ...
...laration to the window tag. If we didn't do this, the attribute would be looked for in the XUL namespace. Because it does not exist there, the rule will not match. If you use attributes in your own custom namespace, you need to add the namespace declaration in order to match them. You should be able to guess what would happen if the second rule was removed. The result would be a single spacer dis
played but no bookmarks because they don't match any of the rules. Put simply, a rule matches if all of the attributes placed on the rule element match the corresponding attributes on the RDF resource. In the case of an RDF file, the resources would be the Description elements. There are some small exceptions however. You cannot match based on the attributes id, rdf:property or rdf:instanceOf. Because...
Tree Box Objects - Archive of obsolete content
About the Tree Box Object Box objects were described in an earlier section. The tree box object is a specialized box object used specifically for trees. The tree box implements the TreeBoxObject interface. Redrawing the Tree We already saw the rowCountChanged() function of the tree box object in the previous section. It is used to indicate that one or more rows have been added to the tree or removed from the tree. The tree will redraw the affected area. ...
...This makes it easier to see how the example works. Also, notice that the first row is 0. The doScroll() function gets the box object and calls the scrollToRow() function with an argument set to the value of the textbox. You might notice that the tree box object can be retrieved in the same way as other box objects using the boxObject (FIXME: dealLink)property, however we need to call ...
Tree Selection - Archive of obsolete content
in the count just after their parents. This means that if there are 3 top-level items and each has two child items, there will be a total of 9 items. The first item (at index 0) will be the first top-level item. The next item at index 1 will be its first child. The second child will be at index 2 and the second parent item will be at position 3 and so on. In the image, there are eight rows dis
played, of which two are selected. The first selected row has an index of 4 and the second has an index of 7. The rows that are not dis
played are not included in the index count. Multiple Selection For trees that allow multiple selection, getting the list of selected rows is a bit more complicated. The tree's view has a selection property which holds information about the selected rows. This selection w...
...angeCount() function. The getRangeAt() function is called passing the range index and the start and end objects. This function will fill in the start and end indicies by assigning them to the 'value' property. So if the first range is from the third item to the seventh item, 'start.value' will be 2 (remember that indices start with 0, so we subtract one.) and 'end.value' will be 6. An alert is dis
played for each index. If you just want to find out if a specific row is selected, use can use the isSelected() function. It takes a row index as an argument and returns true if that row is selected. alert(tree.view.selection.isSelected(3)); Modifying the Tree Selection The selection object has a number of functions which may be used to change the selection. The simplest function is the select() functi...
label - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or ...
...ses 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. header A class used for headings. Typically, this will cause the text to appear bold. indent This class causes the text to be indented on its left side. monospace This class causes the text to be dis
played in a monospace font. plain This class causes the element to be dis
played with no border or margin. small-margin This class causes the text to be dis
played with a smaller margin. text-link Labels with this class may be focused and the click handler run or the address in the href attribute opened on a mouse click or Enter key press. Labels will appear like a link (blue and underlined). ...
listitem - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } current Type: boolean This attribute will be set to true if the listi...
... to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. accessible Type: nsIAccessible Returns the accessibility object for the element. checked Type: boolean Gets and sets the value of the checked attribute. control Type: element id Gets and sets the v...
menuseparator - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or ...
... to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. accessKey Type: character Gets and sets the value of the accesskey attribute. command Type: element id Gets and sets the value of the command attribute. control Type: menu element Returns the enclosing menu...
radio - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or ...
... to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessKey Type: character Gets and sets the value of the accesskey attribute. accessibleType Type: integer A value indicating the type of accessibility object for the element. control Type: radiogroup element Returns the enclosing radiogroup that the radio element is contained within, which may or may not be i...
radiogroup - Archive of obsolete content
to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. disabled Type: boolean Gets and sets the value of the disabled attribute. focusedItem Type: radio element Holds the currently focused item in the radiogroup, which may or may not be the same as the selected item.
...) Return type: no return value Deselects the currently selected radio button in the group and selects the one adjacent to it. If the argument dir is true, the next radio button is selected. If it is false, the previous radio button is selected. getIndexOfItem( item ) Return type: integer Returns the zero-based position of the specified item. Items are numbered starting at the first item dis
played in the list. getItemAtIndex( index ) Return type: element Returns the element that is at the specified index. insertItemAt( index, label, value ) Return type: element This method creates a new item and inserts it at the specified position. You may optionally set a value. The new item element is returned. removeItemAt( index ) Return type: element ...
scale - Archive of obsolete content
Use the orient attribute to specify the orientation of the scale. The default value is horizontal which displays a horizontal scale. Lower values are to the left and higher values are to the right. Set the orient attribute to vertical to use a vertical scale. ...
... to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties disabled Type: boolean Gets and sets the value of the disabled attribute. increment Type: integer Gets and sets the value of the increment attribute. min Type: integer Gets and sets the value of the min attribute. max Type: integer Gets and sets the value of the max att...
tab - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or ...
... element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. last-tab Type: boolean This attribute will be set to true for the last tab. This attribute should not be set manually, but is useful in a theme if the last tab should be styled differently. linkedpanel Type: id The id of the linked tabpanel element that will be dis
played when the tab is selected. If this attribute is not used, the tab will be connected to the panel at the corresponding index in the tabpanels element that the tab is in its tabs container. However, if this attribute is used, this behavior is overridden, and the tab will always be linked to a specific panel. This might be used to avoid duplication by linking several tabs to one panel with slight dif...
tabbox - Archive of obsolete content
The tabbox should contain two children, the first a tabs element which contains the tabs and the second a tabpanels element which contains the contents of the pages. More information is available in the XUL tutorial. ...
...any element in the window is focused. document Keyboard navigation is captured at the document level. Tab navigation will occur as long as any element in the document is focused. handleCtrlTab Type: boolean If set to true or omitted, the tabbox will switch to the next tab when the Control and Tab keys are pressed. If the Shift key is also held down, the previous tab will be dis
played. If this attribute is set to false, these keys do not navigate between tabs. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. eventNode Type: EventTarget Indicates the node where keyboard navigation events listener is set up. The initial value for this property is determined by the value of the eventno...
treecell - Archive of obsolete content
string The label that will appear on the element. If this is left out, no text appears. For an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. mode Type: one of the values below For columns that are progress meters, this determines the type of progress meter to use. none No progress meter is dis
played. The cell text is dis
played instead. normal The cell uses its value attribute to determine the amount of the bar that is filled in. undetermined The progressmeter is indeterminate. properties Type: space-separated list of property names Sets the properties of the element, which can be used to style the element. For more information, see Styling a Tree. ref Type: URI ...
... to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip,...
wizardpage - Archive of obsolete content
n addition to the dialog title. label Type: string The label that will appear on the element. If this is left out, no text appears. For an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. next Type: id Set to the pageid of the next wizardpage after this one. When set, the page with this pageID is dis
played when the Next button is pressed. This can be used to create wizards that do not have a linear sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. pageid Type: id This attribute should be set to a string that identifies the page's identifer in the wizard. This is used with the next attribute. The wizard always starts with the wizardp...
...t page. pageid Type: id This attribute should be set to a string that identifies the page's identifer in the wizard. This is used with the next attribute. The wizard always starts with the wizardpage that appears first in the wizard child list. Properties next Type: string wizardpage id Set to the pageid of the next page after this one. When set, the page with this pageID is dis
played when the Next button is pressed. This can be used to create wizards that do not have a linear sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. pageid Type: string wizardpage id This attribute should be set to a string that identifies the page's identifer in the wizard. This is used with the next attribute. The wizard always start...
NPN_GetValue - Archive of obsolete content
ormation the call gets. ...
...e. For possible values, see Error Codes. Description NPN_GetValue returns the browser information set with NPN_SetValue. The queried information is returned in the value parameter. Unix The platform-specific values for this parameter are NPNVxDisplay (the current Display), NPNVxtAppContext (the browser's XtAppContext), and NPNVnetscapeWindow (the browser toplevel window in which the plugin is dis
played). You can use NPNVnetscapeWindow to obtain the appropriate Window for the WM_TRANSIENT_FOR property of a dialog box created from the plug-in. Microsoft Windows You can use this method to help create a menu or dialog box for a windowless plug-in. In order to bring up popup menus and modal dialogs, a plug-in needs a parent window. A windowless plug-in does not receive its own native window. Instead...
Create Your Own Firefox Background Theme - Archive of obsolete content
It will be anchored to the top-right corner of the browser window. View a sample Theme Header here. ...
...side of the image. Online Image Editor Resources Pixlr -- Pixlr offers professional and easy-to-use tools for creating and editing images within a browser. Photoshop -- Tweak, rotate and touch up photos with Photoshop(R) Express, a free online photo editor. Creating a Theme Footer Image In older versions of Firefox, or newer versions with certain add-ons installed, the footer image is dis
played as the background of the bottom of the browser window, behind the add-on and find bars. It will be anchored to the bottom-left corner of the browser window. Footer images are optional. View a sample Theme Footer here. Image Requirements Dimensions should be 3000px wide x 100px high PNG or JPG file format Image must be no larger than 300 KB in file size Tips Subtle, soft contrast ...
Using workers in extensions - Archive of obsolete content
ad. This provides a way for the main thread to specifically request that the worker update the stock information at once. The refreshInformation() method is fairly similar to the previous versions, with two notable exceptions: If the ticker symbol has not been set yet, an exception is thrown (lines 4-6). When the result is received from XMLHttpRequest, instead of immediately updating the dis
played information in the status bar, a message is sent to the main thread using the worker's postMessage() method. This is because only the main thread is allowed to access the user interface. The main thread The changes here are also relatively minor, but crucial. The startup() method This method is called when the extension is first loaded, and needs to be updated to start up and configure the w...
...(); this.prefs.setCharPref("symbol", newSymbol); this.worker.postMessage(this.tickerSymbol); }, refreshInformation: function() { // Empty message just means 'refresh'. this.worker.postMessage(""); }, The onworkermessage() method This method is called when the worker posts a message back to the main thread. Its job is to update the ticker information that's currently dis
played in the status bar, as well as to update the tooltip that appears while the mouse cursor is hovering over the ticker. This code is essentially identical to what's done in the previous version, except that it's done in response to an event instead of within the refreshInformation() method. A note about ChromeWorkers Requires Gecko 2.0(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Gecko 2...
-ms-overflow-style - Archive of obsolete content
The -ms-overflow-style CSS property is a Microsoft extension controlling the behavior of scrollbars when the content of an element overflows. Initial valueautoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values auto The initial value. Same as inherit. none Scrollbars are never dis
played, although the element can still be scrolled if the element's content overflows. scrollbar "Traditional" scrollbars are dis
played if the element's content overflows. "Traditional" scrollbars don't auto-hide and never overlap the element's content. Accordingly, the dimensions of the layout area for the content are reduced by the width (for vertical scrollbars) or height (for horizontal scrollbars...
... content overflows. "Traditional" scrollbars don't auto-hide and never overlap the element's content. Accordingly, the dimensions of the layout area for the content are reduced by the width (for vertical scrollbars) or height (for horizontal scrollbars) of the scrollbar(s). -ms-autohiding-scrollbar Auto-hiding scrollbars are used if the element's content overflows. Auto-hiding scrollbars are dis
played during scrolling or shortly after the pointer interacts with the page, and are hidden shortly after scrolling and pointer interaction stops. When they are visible, auto-hiding scrollbars overlap the element's content. Formal syntax auto | none | scrollbar | -ms-autohiding-scrollbar Specifications Not part of any specification. ...
::-ms-fill - Archive of obsolete content
This pseudo-element is available only in Internet Explorer 10, Internet Explorer 11, and Microsoft Edge. All allowable properties except animation-name apply to a determinate progress bar. Only animation-name applies to an indeterminate one. (A progress bar is determinate if it has a value attribute set; otherwise it is indeterminate. An indeterminate progress bar can be selected with the :indeterminate pseudo-class.) By default, Internet Explorer and Edge display a moving dots animation for an indeterminate progress bar. ...
...is indeterminate. An indeterminate progress bar can be selected with the :indeterminate pseudo-class.) By default, Internet Explorer and Edge display a moving dots animation for an indeterminate progress bar. By setting animation-name on ::-ms-fill, you can change the animation, as shown in this table: Value Description none Turns off the animation so that no dots are dis
played. -ms-bar Shows animated dots that flow in a bar pattern. -ms-ring Shows animated dots that flow in a ring pattern. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-fill in its selector. Other properties are ignored. animation-name background-clip, background-color, background-image, background-origin, background-repeat, an...
The Business Benefits of Web Standards - Archive of obsolete content
long ago and now work where these new skills are appreciated. Familiarity with Dreamweaver or any other legacy software is not a good basis for hiring creative development personnel. Eliminate Unwelcome Future Costs A very significant portion of electronically-stored information is produced for the web and written in HTML format. Most of this information uses invalid HTML which happens to be dis
played correctly in permissive older browsers. As the web evolves, web browsers may eventually become either less permissive, or behave differently when given invalid markup (e.g. parse invalid data and render it slightly differently). Using valid, standards-compliant markup ensures that data will still be re-usable for a long time, as specifications on how to parse the standard formats are well documen...
...ects on text fragments. As Style Sheet technology gives designers good typographic control and permits effects such as roll-overs, it greatly reduces the need for JavaScript programming and creation of graphics. Even more importantly, it reduces bandwidth consumption by images. Well-formed HTML Code Saves Time and Money One of the major headaches for web developers comes from web pages being dis
played differently in various browsers. Such rendering differences do exist in older browsers, but most of them are well known and documented. In many cases, rendering differences are caused by ambiguous coding. For developers who are in commercial environments and are in a postion to measure these time costs some of the figures are astonishing. A single inconsistency between the browsers in a high end ...
Audio for Web games - Game development
ng that silence will mean we can now use JavaScript to play that file at arbitrary points. You can find out more about best practises with the autoplay policy here. Note: Playing part of your file at zero volume could also work if the browser allows you to change volume (see below). Also note that playing and immediately pausing your audio does not guarantee that a small piece of audio won't be
played. Note: Adding a web app to your mobile's homescreen may change its capabilities. In the case of autoplay on iOS, this appears to be the case currently. If possible, you should try your code on several devices and platforms to see how it works. Volume Programmatic volume control may be disabled in mobile browsers. The reason often given is that the user should be in control of the volume at ...
...ick', function() { // check if context is in suspended state (autoplay policy) if (audioCtx.state === 'suspended') { audioCtx.resume(); } playTrack(track); playButton.dataset.playing = true; }) }) }) Note: You can see this demo in action here and view the source code here. 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 experience. Note: This example does not wait for the beat to end before introducing the next piece; we could do this if we knew the BPM (Beats Per Minute) of the tracks. You may find that the introduction of a new track sounds more natural if it comes in on the beat/bar/phrase or w...
Buttons - Game development
You can find the source code as it should look after completing this lesson at Gamedev-Phaser-Content-Kit/demos/lesson15.html. Instead of starting the game right away we can leave that decision to the player by adding a Start button they can press. Let's investigate how to do that. New variables We will need a variable to store a boolean value representing whether the game is currently being
played or not, and another one to represent our button. Add these lines below your other variable definitions: var playing = false; var startButton; Loading the button spritesheet We can load the button spritesheet the same way we loaded the ball's wobble animation. Add the following to the bottom of the preload() function: game.load.spritesheet('button', 'img/button.png', 120, 40); A single butt...
...he new button to the game is done by using the add.button method. Add the following lines to the bottom of your create() function: startButton = game.add.button(game.world.width*0.5, game.world.height*0.5, 'button', startGame, this, 1, 0, 2); startButton.anchor.set(0.5); The button() method's parameters are as follows: The button's x and y coordinates The name of the graphic asset to be dis
played for the button A callback function that will be executed when the button is pressed A reference to this to specify the execution context The frames that will be used for the over, out and down events. Note: The over event is the same as hover, out is when the pointer moves out of the button and down is when the button is pressed. Now we need to define the startGame() function referenced i...
Plug-in Development Overview - Gecko Plugin API Reference
rs: STR#' 127 can contain a list of MIME type descriptions corresponding to the types in 'STR#' 128 . For example, this description list corresponds to the types in the previous example: String 1: "QuickTime Video", String 4: "AIFF Audio", and String 5: "JPEG Image Format." STR#' 126: String 1 can contain a descriptive message about the plug-in. This message, which is in HTML format, is dis
played by the browser in its "About Plug-ins" page. String 2 can contain the name of the plug-in, thus allowing the name the user sees to be different from the name of the file on disk. Drawing a Plug-in Instance Before drawing itself on the page, the plug-in must provide information about itself, set the window or other target in which it draws, arrange for redrawing, and handle events. A windowles...
...n of the document's origin converted to NFKC-encoded (that is, normalized) UTF-8. Your plug-in must free the returned string's memory by calling NPN_MemFree() when you're done with it. Getting Version and UI Information The Netscape group of Plug-in API methods provides some basic services to the plug-in. You can use these Netscape methods: To identify the browser in which your plug-in is dis
played: Use the NPN_UserAgent method to read this information. To determine whether plug-in and the browser versions are compatible and possibly provide alternative processing for different versions: Use the NPN_Version method to check for changes in major and minor version numbers. For information about using these methods, see Version, UI, and Status Information. Displaying Messages on the Status ...
Accessible multimedia - Learn web development
can't see the video, for example what the scene looks like. Chapter titles -- Chapter markers intended 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 dis
played, and even limited styling/positioning information. These text strings are called cues. A typical WebVTT file will look something like this: WEBVTT 1 00:00:22.230 --> 00:00:24.606 This is the first subtitle. 2 00:00:30.739 --> 00:00:34.074 This is the second. ... To get this dis
played along with the HTML media playback, you need to: Save it as a .vtt file in a sensible place. Link to t...
...he cues are subtitles, captions, or descriptions. Furthermore, use srclang to tell the browser what language you have written the subtitles in. Here's an example: <video controls> <source src="example.mp4" type="video/mp4"> <source src="example.webm" type="video/webm"> <track kind="subtitles" src="subtitles_en.vtt" srclang="en"> </video> This will result in a video that has subtitles dis
played, kind of like this: For more details, please read Adding captions and subtitles to HTML5 video. You can find the example that goes along with this article on Github, written by Ian Devlin (see the source code too.) This example uses some JavaScript to allow users to choose between different subtitles. Note that to turn the subtitles on, you need to press the "CC" button and select an option --...
Pseudo-classes and pseudo-elements - Learn web development
Matches when the user activates (for example clicks on) an element. :any-link Matches both the :link and :visited states of a link. :blank Matches an <input> element whose input value is empty. :checked Matches a radio button or checkbox in the selected state. :current Matches the element, or an ancestor of the element, that is currently being dis
played. :default Matches the one or more UI elements that are the default among a set of similar elements. :dir Select an element based on its directionality (value of the HTML dir attribute or CSS direction property). :disabled Matches user interface elements that are in an disabled state. :empty Matches an element that has no children except optionally w...
...form elements that are not required. :out-of-range Matches an element with a range when its value is out of range. :past Matches the elements before the current element. :placeholder-shown Matches an input element that is showing placeholder text. :playing Matches an element representing an audio, video, or similar resource that is capable of being "
played" or "paused", when that element is "playing". :paused Matches an element representing an audio, video, or similar resource that is capable of being "
played" or "paused", when that element is "paused". :read-only Matches an element if it is not user-alterable. :read-write Matches an element if it is user-alterable. :required Matches form elements tha...
Sizing items in CSS - Learn web development
ral size, set before they are affected by any CSS. A straightforward example is an image. An image has a width and a height defined in the image file it is embedding into the page. This size is described as the intrinsic size -- which comes from the image itself. If you place an image on a page and do not change its height and width, either using attributes on the <img> tag or CSS, it will be dis
played using that intrinsic size. We have given the image in the example below a border so that you can see the extent of the file. An empty <div> however, has no size of its own. If you add a <div> to your HTML with no content, then give it a border as we did with the image, you will see a line on the page. This is the collapsed border on the element -- there is no content to hold it open. In our ex...
...you can see how it has scaled down to fit into the box. This technique is used to make images responsive, so that when viewed on a smaller device they scale down appropriately. You should, however, not use this technique to load really large images and then scale them down in the browser. Images should be appropriately sized to be no larger than they need to be for the largest size they are dis
played in the design. Downloading overly large images will cause your site to become slow, and it can cost users more money if they are on a metered connection. Note: Find out more about responsive image techniques. Viewport units The viewport -- which is the visible area of your page in the browser you are using to view a site -- also has a size. In CSS we have units which relate to the size of th...
Test your skills: sizing - Learn web development
. Your task is to make the inner box 60% of the width of the outer box. The value of the box-sizing property is set to border-box, which means that the total width includes any padding and border. You should also give the inner box padding of 10% using the width (or inline size) as the size from which that percentage is calculated. Try updating the live code below to recreate the example as dis
played in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Task Three This task has two images in boxes. One image is smaller than the box, the other is larger and breaking out of the box. If you imagine that the box is responsive and therefore could grow and shrink, which property would you apply to t...
...ee This task has two images in boxes. One image is smaller than the box, the other is larger and breaking out of the box. If you imagine that the box is responsive and therefore could grow and shrink, which property would you apply to the image so that the large image shrinks down into the box but the small image does not stretch. Try updating the live code below to recreate the example as dis
played in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePe...
The box model - Learn web development
ly use some of the behavior defined in the box model. The model defines how the different parts of a box -- margin, border, padding, and content -- work together to create a box that you can see on the page. To add some additional complexity, there is a standard and an alternate box model. Parts of a box Making up a block box in CSS we have the: Content box: The area where your content is dis
played, which can be sized using properties like width and height. Padding box: The padding sits around the content as white space; its size can be controlled using padding and related properties. Border box: The border box wraps the content and any padding. Its size and style can be controlled using border and related properties. Margin box: The margin is the outermost layer, wrapping the content, p...
...oving the line completely to see the difference in display models. Where this can be useful is when you want to give a link to a larger hit area by adding padding. <a> is an inline element like <span>; you can use display: inline-block to allow padding to be set on it, making it easier for a user to click the link. You see this fairly frequently in navigation bars. The navigation below is dis
played in a row using flexbox and we have added padding to the <a> element as we want to be able to change the background-color when the <a> is hovered. The padding appears to overlap the border on the <ul> element. This is because the <a> is an inline element. Add display: inline-block to the rule with the .links-list a selector, and you will see how it fixes this issue by causing the padding to be re...
Test your skills: values and units - Learn web development
ses, download the starting point for this task to work in your own editor or in an online editor. Task Two In this task you need to set the size of various items of text. The <h1> should be 50 pixels. The <h2> should be 2em. All <p> elements should be 16 pixels. A <p> element that is directly after an <h1> should be 120%. ...
... Assessment or further help You can practice these examples in the Interactive Editors mentioned above. ...
Test your skills: Writing Modes and Logical Properties - Learn web development
lesson on Handling different text directions. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Task One The box in the example is dis
played with a horizontal writing mode. Can you add a line of CSS to change it so it uses a vertical writing mode with right to left text? Your example should look like the image below. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Task Two I...
...ent or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Task Two In the example below use logical properties to replace width and height in order to maintain the aspect ratio of the box as it is turned vertically. Your end result should look like the image below. Try updating the live code below to recreate the example as dis
played in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Task Three Use logical versions of the margin, border, and padding properties so that the edges of the box relate to the text rather than following top, left, bottom and right. You can see how this should look in the image below. Try updatin...
Introduction to CSS layout - Learn web development
t layout tool for each task. Normal flow Normal flow is how the browser lays out HTML pages by default when you do nothing to control page layout. Let's look at a quick HTML example: <p>I love my cat.</p> <ul> <li>Buy cat food</li> <li>Exercise</li> <li>Cheer up friend</li> </ul> <p>The end!</p> By default, the browser will display this code as follows: Note here how the HTML is dis
played in the exact order in which it appears in the source code, with elements stacked up on top of one another -- the first paragraph, followed by the unordered list, followed by the second paragraph. The elements that appear one below the other are described as block elements, in contrast to inline elements, which appear one beside the other, like the individual words in a paragraph. Note: The dir...
... a class of wrapper, inside which are three <div> elements. By default these would display as block elements, below one another, in our English language document. However, if we add display: flex to the parent, the three items now arrange themselves into columns. This is due to them becoming flex items and being affected by some initial values that flexbox sets on the flex container. They are dis
played in a row, because the initial value of flex-direction set on their parent is row. They all appear to stretch to the height of the tallest item, because the initial value of the align-items property set on their parent is stretch. This means that the items stretch to the height of the flex container, which in this case is defined by the tallest item. The items all line up at the start of the conta...
The HTML5 input types - Learn web development
any value when clicked). Additionally, on devices with dynamic keyboards, the keyboard's enter key may read "search", or display a magnifying glass icon. The below screenshots show a non-empty search field in Firefox 71, Safari 13, and Chrome 79 on macOS, and Edge 18 and Chrome 79 on Windows 10. Note that the clear icon only appears if the field has a value, and, apart from Safari, it is only dis
played when the field is focused. Another feature worth noting is that the values of a search field can be automatically saved and re-used to offer auto-completion across multiple pages of the same website; this tends to happen automatically in most modern browsers. Phone number field A special field for filling in phone numbers can be created using tel as the value of the type attribute: <input t...
...n that it refers to a location that actually exists! Numeric field Controls for entering numbers can be created with an <input> type of number. This control looks like a text field but allows only floating-point numbers, and usually provides buttons in the form of a spinner to increase and decrease the value of the control. On devices with dynamic keyboards, the numeric keyboard is generally dis
played. The following screenshot (from Firefox for Android) provides an example: With the number input type, you can constrain the minimum and maximum values allowed by setting the min and max attributes. You can also use the step attribute to set the increment increase and decrease caused by pressing the spinner buttons. By default, the number input type only validates if the number is an integer.
Sending form data - Learn web development
m Content-Type: application/x-www-form-urlencoded Content-Length: 13 say=Hi&to=Mom The Content-Length header indicates the size of the body, and the Content-Type header indicates the type of resource sent to the server. We'll discuss these headers later on. Note: You can find this example on GitHub -- see post-method.html (see it live also). Viewing HTTP requests HTTP requests are never dis
played to the user (if you want to see them, you need to use tools such as the Firefox Network Monitor or the Chrome Developer Tools). As an example, your form data will be shown as follows in the Chrome Network tab. After submitting the form: Open the developer tools. Select "Network" Select "All" Select "foo.com" in the "Name" tab Select "Headers" You can then get the form data, as shown in t...
..., you need to use tools such as the Firefox Network Monitor or the Chrome Developer Tools). As an example, your form data will be shown as follows in the Chrome Network tab. After submitting the form: Open the developer tools. Select "Network" Select "All" Select "foo.com" in the "Name" tab Select "Headers" You can then get the form data, as shown in the image below. The only thing dis
played to the user is the URL called. As we mentioned above, with a GET request the user will see the data in their URL bar, but with a POST request they won't. This can be very important for two reasons: If you need to send a password (or any other sensitive piece of data), never use the GET method or you risk displaying it in the URL bar, which would be very insecure. If you need to send a large a...
JavaScript basics - Learn web development
vaScript is an object, and can be stored in a variable. Keep this in mind as you learn. let myVariable = document.querySelector('h1'); All of the above examples too. So why do we need variables? Variables are necessary to do anything interesting in programming. If values couldn't change, then you couldn't do anything dynamic, like personalize a greeting message or change an image dis
played in an image gallery. Comments Comments are snippets of text that can be added along with code. The browser ignores text marked as comments. You can write comments in JavaScript just as you can in CSS: /* Everything in between is a comment. */ If your comment contains no line breaks, it's an option to put it behind two slashes like this: // This is a comment Operators An operator is a math...
...('html'); myHTML.onclick = function() {}; It's just shorter. Supercharging our example website With this review of JavaScript basics completed (above), let's add some new features to our example site. Adding an image changer In this section, you will learn how to use JavaScript and DOM API features to alternate the display of one of two images. This change will happen as a user clicks the dis
played image. Choose an image you want to feature on your example site. Ideally, the image will be the same size as the image you added previously, or as close as possible. Save this image in your images folder. Rename the image firefox2.png. Add the JavaScript below to your main.js file. (Also delete your Hello world! JavaScript from the earlier exercise.) let myImage = document.querySelector('...
HTML Cheatsheet - Learn web development
Bold a word or phrase within the text Mark text as important <strong>I'm important</strong> I'm important Highlight some text <mark>Notice me</mark> Notice me Draw a line through irrelevant text <s>I'm irrelevant</s> I'm irrelevant Underline a non-textual annotation This is <u>mispelled</u> This is mispelled Text dis
played lower than normal text H<sub>2</sub>O H2O Small text Used to represent the <small>small print </small>of a document Used to represent the small print of a document Used for an address <address>Main street 67</address> Main street 67 Used for a textual cite <cite>Lorem ipsum</cite> lorem ipsum Text dis
played higher than normal text x<su...
... This text is in code format. This text is in predefined format. Embedded Audio <audio controls="controls" src="https://udn.realityripple.com/samples/b7/193cb038d0.mp3">You...
Images in HTML - Learn web development
ze are defined by an external resource (like an image or video file), not by the contents of the element itself. Note: You can find the finished example from this section running on Github (see the source code too.) Alternative text The next attribute we'll look at is alt. Its value is supposed to be a textual description of the image, for use in situations where the image cannot be seen/dis
played or takes a long time to render because of a slow internet connection. For example, our above code could be modified like so: <img src="images/dinosaur.jpg" alt="The head and torso of a dinosaur skeleton; it has a large head with long sharp teeth"> The easiest way to test your alt text is to purposely misspell your filename. If for example our image name was spelled dinosooooor.jp...
...ou can use Cmd + I to get the info display up for the image file. Returning to 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"> This doesn't result in much difference to the display, under normal circumstances. But if the image isn't being dis
played, for example, the user has just navigated to the page, and the image hasn't yet loaded, you'll notice the browser is leaving a space for the image to appear in: This is a good thing to do, resulting in the page loading quicker and more smoothly. However, you shouldn't alter the size of your images using HTML attributes. If you set the image size too big, you'll end up with images that look gr...
Index - Learn web development
, questions In this article, you'll find some frequently-asked questions (FAQs) about CSS, along with answers that may help you on your quest to become a web developer. 168 Using CSS generated content Basic, Beginner, CSS, CSS:Getting_Started, Graphics, Guide, NeedsUpdate, Web This article describes some ways in which you can use CSS to add content when a document is dis
played. You modify your stylesheet to add text content or images. 169 create fancy boxes Beginner, CSS, CodingScripting, Learn CSS boxes are the building blocks of any web page styled with CSS. Making them nice looking is both fun and challenging. It's fun because it's all about turning a design idea into working code; It's challenging because of annoying constraints and crazy freed...
...ing, Guide, Intro, Learn, Security, Server-side programming, Web security, Website Security This article has explained the concept of web security and some of the more common threats against which your website should attempt to protect. Most importantly, you should understand that a web application cannot trust any data from the web browser. All user data should be sanitized before it is dis
played, or used in SQL queries and file system calls. 224 Structuring the web with HTML Beginner, Guide, HTML, Intro, Learn, Topic To build websites, you should know about HTML -- the fundamental technology used to define the structure of a webpage. HTML is used to specify whether your web content should be recognized as a paragraph, list, heading, link, image, multimedia player, fo...
Fetching data from the server - Learn web development
ocks, JavaScript objects), the basics of Client-side APIs Objective: To learn how to fetch data from the server and use it to update the contents of a web page. What is the problem here? Originally page loading on the web was simple -- you'd send a request for a website to a server, and as long as nothing went wrong, the assets that made the web page would be downloaded and dis
played on your computer. The trouble with this model is that whenever you want to update any part of the page, for example, to display a new set of products or load a new page, you've got to load the entire page again. This is extremely wasteful and results in a poor user experience, especially as pages get larger and more complex. Enter Ajax This led to the creation of technologies that allow web ...
...of data (such as HTML, XML, JSON, or plain text) and display them only when needed, helping to solve the problem described 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 dis
played. Note: In the early days, this general technique was known as Asynchronous JavaScript and XML (AJAX), because it tended 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 in...
What is JavaScript? - Learn web development
rowser APIs are built into your web browser, and are able to expose data from the surrounding computer environment, or do useful complex things. For example: The DOM (Document Object Model) API allows you to manipulate HTML and CSS, creating, removing and changing HTML, dynamically applying new styles to your page, etc. Every time you see a popup window appear on a page, or some new content dis
played (as we saw above in our simple demo) for example, that's the DOM in action. The Geolocation API retrieves geographical information. This is how Google Maps is able to find your location and plot it on a map. The Canvas and WebGL APIs allow you to create animated 2D and 3D graphics. People are doing some amazing things using these web technologies --see Chrome Experiments and webglsamples. Audi...
...n ahead of time. There are advantages to both types of language, but we won't discuss them right now. Server-side versus client-side code You might also hear the terms server-side and client-side code, especially in the context of web development. Client-side code is code that is run on the user's computer -- when a web page is viewed, the page's client-side code is downloaded, then run and dis
played by the browser. In this module we are explicitly talking about client-side JavaScript. Server-side code on the other hand is run on the server, then its results are downloaded and dis
played in the browser. Examples of popular server-side web languages include PHP, Python, Ruby, ASP.NET and... JavaScript! JavaScript can also be used as a server-side language, for example in the popular Node.js en...
Working with JSON - Learn web development
Previous Overview: Objects Next JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax. It is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be dis
played on a web page, or vice versa). You'll come across it quite often, so in this article we give you all you need to work with JSON using JavaScript, including parsing JSON so you can access data within it, and creating JSON. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, familiarity with JavaScript basics (see First steps and Building blocks) and OOJS basics (see Introduction to objects). Objective: To understand how to work with d...
...s superpowers -- for each one we create an <li> element, put the superpower inside it, then put the listItem inside the <ul> element (myList) using appendChild(). The very last thing we do is to append the <h2>, <p>s, and <ul> inside the <article> (myArticle), then append the <article> inside the <section>. The order in which things are appended is important, as this is the order they will be dis
played inside the HTML. Note: If you are having trouble getting the example to work, try referring to our heroes-finished.html source code (see it running live also.) Note: If you are having trouble following the dot/bracket notation we are using to access the JavaScript object, it can help to have the superheroes.json file open in another tab or your text editor, and refer to it as you look at ou...
Measuring performance - Learn web development
Web APIs available that allow you to create your own performance measuring tools. You can use the Navigation Timing API to measure client-side web performance; including the amount of time needed to unload the previous page, how long domain lookups take, the total time spent executing the window's load handler, and more. You can use the API for metrics related to all of the navigation events dis
played in the didagram below. The Performance API, which provides access to performance-related information for the current page, includes the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. These interfaces allows the accurate measurement of the time it takes for JavaScript tasks to complete. The PerformanceEntry object is part of the performan...
...report contains scores about how your website is performing, both for mobile and desktop. This is a good start for getting an idea about what you are already doing well and what could be improved. At the time of writing, MDN's performance report summary looks similar to the following: A performance report contains information about things like how long a user has to wait before anything is dis
played on the page, how many bytes need to be downloaded to display a page, and much more. It also lets you know it the measured values are considered good or bad. webpagetest.org is another example of a tool that automatically tests your site and returns useful metrics. Try running your favorite website now, on both webpagetest.org and PageSpeed Insights, and see what the scores are. Network tools ...
Introduction to the server side - Learn web development
puter literacy. A basic understanding of what a web server is. Objective: To gain familiarity with what server-side programming is, what it can do, and how it differs from client-side programming. Most large-scale websites use server-side code to dynamically display different data when needed, generally pulled out of a database stored on a server and sent to the client to be dis
played via some code (e.g. HTML and JavaScript). Perhaps the most significant benefit of server-side code is that it allows you to tailor website content for individual users. Dynamic sites can highlight content that is more relevant based on user preferences and habits. It can also make sites easier to use by storing personal preferences and information -- for example reusing stored credit card detai...
...ait for client request messages, process them when they arrive, and reply to the web browser with an HTTP response message. The response contains a status line indicating whether or not the request succeeded (e.g. "HTTP/1.1 200 OK" for success). The body of a successful response to a request would contain the requested resource (e.g. a new HTML page, or an image, etc...), which could then be dis
played by the web browser. Static sites The diagram below shows a basic web server architecture for a static site (a static site is one that returns the same hard-coded content from the server whenever a particular resource is requested). When a user wants to navigate to a page, the browser sends an HTTP "GET" request specifying its URL. The server retrieves the requested document from its file syste...
Componentizing our Svelte app - Learn web development
lp you decide how to better organize your components. Eventually, we will split up our app into the following components: Alert.svelte: A general notification box for communicating actions that have occurred. NewTodo.svelte: The text input and button that allow you to enter a new todo item. FilterButton.svelte: The All, Active, and Completed buttons that allow you to apply filters to the dis
played todo items. TodosStatus.svelte: The "x out of y items completed" heading. Todo.svelte: An individual todo item. Each visible todo item will be dis
played in a separate copy of this component. MoreActions.svelte: The Check All and Remove Completed buttons at the bottom of the UI that allow you to perform mass actions on the todo items. In this article we will concentrate on creating the Filt...
...lso passing the current todo object into the component as a prop. Update the {#each} block inside Todos.svelte like so: <ul role="list" class="todo-list stack-large" aria-labelledby="list-heading"> {#each filterTodos(filter, todos) as todo (todo.id)} <li class="todo"> <Todo {todo} /> </li> {:else} <li>Nothing to do here!</li> {/each} </ul> The list of todos is dis
played on the page, and the checkboxes should work (try checking/unchecking a couple, and then observing that the filters still work as expected), but our "x out of y items completed" status heading will no longer update accordingly. That's because our Todo component is receiving the todo via the prop, but it's not sending any information back to its parent. We'll fix this later on. Sharing data betwee...
Creating our first Vue component - Learn web development
values inside our template. Let's start by adding the label prop to the component template. In your <template>, replace the contents of the <label> element with {{label}}. {{}} is a special template syntax in Vue, which lets us print the result of JavaScript expressions defined in our class, inside our template, including values and methods. It's important to know that content inside {{}} is dis
played as text and not HTML. In this case, we're printing the value of the label prop. Your component's template section should now look like this: <template> <div> <input type="checkbox" id="todo-item" checked="false" /> <label for="todo-item">{{label}}</label> </div> </template> Go back to your browser and you'll see the todo item rendered as before, but without a label (oh no!). Go to ...
...p it consistent though. Because the shorthand syntax is more commonly used, this tutorial will stick to that pattern. So let's do this. Update your <input> element now to replace checked="false" with :checked="isDone". Test out your component by passing :done="true" to the ToDoItem call in App.vue. Note that you need to use the v-bind syntax, because otherwise true is passed as a string. The dis
played checkbox should be checked. <template> <div id="app"> <h1>My To-Do List</h1> <ul> <li> <to-do-item label="My ToDo Item" :done="true"></to-do-item> </li> </ul> </div> </template> Try changing true to false and back again, reloading your app in between to see how the state changes. Giving Todos a unique id Great! We now have a working checkbox where we can s...
Handling common accessibility problems - Learn web development
browser (it differs slightly between different browsers) so that you can tell what element is focused. You can then press Enter/Return to follow a focused link or press a button (we've included some JavaScript to make the buttons alert a message), or start typing to enter text in a text input (other form elements have different controls, for example the <select> element can have its options dis
played and cycled between using the up and down arrow keys). Note that different browsers may have different keyboard control options available. Most modern browsers follow the tab pattern described above (you can also do Shift + Tab to move backwards through the focusable elements), but some browsers have their own idiosyncracies: Firefox for the Mac doesn't do tabbing by default. To turn it on, yo...
...and content on the page, to be picked up by a screenreader and read out to the user. Note: For more information, read Text alternatives. Missing alt text can be tested for in a number of ways, for example using accessibility Auditing tools. Alt text is slightly more complex for video and audio content. There is a way to define text tracks (e.g. subtitles) and display them when video is being
played, in the form of the <track> element, and the WebVTT format (see Adding captions and subtitles to HTML5 video for a detailed tutorial). Browser compatibility for these features is fairly good, but if you want to provide text alternatives for audio or support older browsers, a simple text transcript presented somewhere on the page or on a separate page might be a good idea. Element relationships a...
Gecko info for Windows accessibility vendors
bject whenever its children change. EVENT_SHOW and EVENT_HIDE may also be fired with the reorder event, for the child who's visibility changed. The show and hide events are not fired on every IAccessible when a new subtree of IAccessibles changes visibility -- only the top IAccessible. The exception is progress meters, which are guaranteed to fire EVENT_SHOW and EVENT_HIDE events when they are dis
played or hidden. EVENT_ALERT is fired when an object of ROLE_ALERT appears or changes. This should indicate to a screen reader to read the contents of the alert (it may be a container who's descendents should be read). EVENT_SELECTION is fired on children of single selection containers along with the EVENT_FOCUS as selection/focus move together in that case. EVENT_SELECTIONWITHIN is fired o...
...will occur. Because of the persistence, relations and events can be mapped within an assistive technology's internal model. Page Loading is Tracked via STATE_CHANGE events When a new document is about to be loaded, an EVENT_STATE_CHANGE occurs on the root ROLE_DOCUMENT object for a window. The STATE_BUSY flag is now set for the root pane object. Once the new page is ready to be dis
played and traversed via its IAccessible tree, the old content window is destroyed, and a new window is created. Next, another EVENT_STATE_CHANGE is fired for the new root ROLE_DOCUMENT object for the window, with its STATE_BUSY flag cleared. MSAA Role Support Role Supported? Unique features ROLE_TITLEBAR Supported automatically by MS Windows ...
Software accessibility: Where are we today?
oft, first with MS DOS, followed by variants of Microsoft Windows. These operating systems were not designed with the needs of people with disabilities in mind. Many, including those who were blind or physically disabled, were unable to use applications which were written for Microsoft operating systems. These applications assumed that computer users could: Read and react to text and images dis
played on the screen. Type on a standard keyboard. Select text, pictures, and other information using a mouse React to sounds
played. This tends to be somewhat less of a limitation in that most software doesn't rely exclusively on audio to relay feedback. If a person was unable to do one of the above-listed tasks, they found themselves unable to use many popular computer applications. Here are so...
...ll these groups of people together, that's a lot of potential users! In answer to this problem, many small accessibility hardware and software vendors created products and software which helped people who could not perform one of the four basic tasks to use common computer applications. ...
Continuous Integration
stems. TaskCluster and Treeherder TaskCluster, Mozilla's continuous integration (CI) system picks up changes pushed to Hg. TaskCluster generate binary builds for Firefox and Firefox for Android across a variety of operating sytems. After the builds are completed, they are used to run a series of correctness and performance tests. The results of TaskCluster jobs (both builds and tests) are dis
played in Treeherder. There is a group of individuals who are constantly monitoring Treeherder, looking for broken builds and/or tests. These individuals are known as sheriffs. The sheriffs' role is to "keep the tree green", or in other words, to keep the code in our respositories in a good state, to the extent that the state is reflected in the output shown on Treeherder. When sheriffs see a build ...
...s. Clobber builds mean the directory hierarchy, including the local source and object directory are deleted if it exists from a previous build. Functional Tests These jobs are scheduled after a build job has successfully produced a build. These test jobs can sometimes run even if a build job fails, if the build job failed during 'make check'. Talos Performance Tests All performance tests dis
played in Treeherder are run using the Talos framework, and denoted by the letter T. These jobs are scheduled at the same time as the correctness jobs. Talos is used to execute several suites for desktop Firefox and Firefox for Android; these suites are denoted using lower-case letters, e.g., T(c d g1 o s tp). The Talos indicators in Treeherder appear green if the job successfully completed; to see t...
Eclipse CDT
y /Applications/Eclipse.app/Contents/MacOS/ on macOS) is in your PATH. Then, to create the eclipse project and open it, run: ./mach ide eclipse Or to create the eclipse project without opening it yet, run: ./mach build-backend -b CppEclipse Building the Eclipse project should only take a few seconds. In the case of the build-backend command, instructions on how to open the project will be dis
played after the command completes. Manual setup, and more More information can be found on the Eclipse CDT Manual Setup page. Much of that page is redundant (taken care of by the mach setup), but there is still some information there that is relevant that should make its way back here at some point. Keeping the index up-to-date As the source changes from day-to-day, you'll want to update the index ...
... so if anyone feels like doing a bit of Java hacking to fix these issues that'd be great. Headers are only parsed once For performance reasons, Eclipse only processes header files that have include guards once, using the compiler options for the first source file it encounters that includes that header (Eclipse bug 380511). This is responsible for most of the parse errors in the source files dis
played in Eclipse. One problem with the "parse once" strategy is that the compiler options for the original source file may ifdef out sections of the header, that would not be ifdef'ed out - and in fact are required by - source files in other parts of the tree. For example, in content/svg/content/src/nsSVGEllipseElement.cpp Eclipse shows a parse error due to NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO not bei...
Inner and outer windows
but rather a perspective on what the user is looking at. Windows and the bfcache An outer window is a browsing context; that is, the actual environment in which a Document is presented to the user. This may be a window or a tab, or it might be an <iframe> contained within another document. HTML5 refers to the outer window as the WindowProxy. An inner window represents the actual content being dis
played; it's the current view of what the user sees. Consider this view of a window and the browser history: As the user navigates, documents are added to the backward-forward cache (often referred to as the bfcache). These are, in essence, inner windows. They get dis
played in the outer window, which is contained in the "physical" browser window. Here's the trick, though: the inner window in essence pr...
...of a window and the browser history: As the user navigates, documents are added to the backward-forward cache (often referred to as the bfcache). These are, in essence, inner windows. They get dis
played in the outer window, which is contained in the "physical" browser window. Here's the trick, though: the inner window in essence pretends to be the outer window. If the document currently being dis
played asks "what window am I in?", it gets the outer window as the answer. That lets the document interact with the "physical" window, while the outer window can keep track of all the documents (inner windows) it contains. In other words, window always returns the outer window. Nested windows Things become slightly more complex when you consider that documents can contain other documents. This happens,...
Listening to events on all tabs
nts the callbacks used to provide notifications of progress events. Removing a listener To remove a previously installed progress listener, call removeTabsProgressListener(): gBrowser.removeTabsProgressListener(myProgressListener); Implementing a listener The listener object itself has five methods it can implement to handle various events: onLocationChange Called when the URI of the document dis
played in the tab changes. void onLocationChange( nsIDOMXULElement aBrowser, nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation [optional] in unsigned long aFlags ); Parameters aBrowser The browser representing the tab whose location changed. aWebProgress The progress instance responsible for handling the events. aRequest The nsIRequest object represen...
...ess 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 extended error information (e.g., for HTTP requests see nsIHttpChannel). onStatusChange Notification that the status of a request has changed. The status message is intended to be dis
played 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 aBrowser The browser that fired the notification. aWebProgress The nsIWebProgress instance that fired the notification. aRequest The nsIRequest that has new sta...
mozbrowsercontextmenu
ontextmenu A Menu object (see The Menu object, below) representing a custom menu defined via <menu> / <menuitem> elements and pointed to via a contextmenu attribute on the DOM element clicked on, which contains the menu's id. contextmenuItemSelected An anonymous function that fires when a menu item is selected. The MenuSystem object An object defining a standard context menu that will be dis
played. Its properties are as follows: documentURI A DOMString representing the URL of the document the menu is associated with. uri A DOMString. In the case of an image or video context menu, this is the src of the image or video clicked on to get the context menu. In the case of an link context menu, it is the link's href. text A DOMString representing the text of the link clicked on, in the c...
...orm context menu. name A DOMString representing the name of a form, in the case of a form context menu. The Menu object An object representing a custom menu defined via <menu> / <menuitem> elements and pointed to via a contextmenu attribute on the DOM element clicked on, which contains the menu's id. Its properties are as follows: type A DOMString representing the type of context menu dis
played. It can be menu (a full menu) or menuitem (a single menu item.) label A DOMString equal to the label attribute of the DOM node the context menu is accessed on. icon The menu item's icon, if the context menu being accessed is a menu item. id The menu item's id, if the context menu being accessed is a menu item. This is passed to the contextmenuItemSelected() function, to indicate which item ...
nglayout.debug.disable_xul_cache
The XUL cache is serialized and saved between Mozilla sessions in the XUL FastLoad file, which saves a "compiled" version of the XUL and JavaScript in a document to disk for faster startup the next time the application runs. ...
...lications, it's convenient to disable the XUL cache so that changes you make to files on disk take effect the next time the window or dialog is loaded (instead of the next time Mozilla starts). Possible values and their effects: True: Do not cache parsed XUL documents and do not save the cache to the XUL FastLoad file on exit; re-read the source files each time the window or dialog needs to be dis
played. False: Cache XUL documents in memory and save the cache to disk on exit to improve performance. (Default) See also: http://kb.mozillazine.org/Nglayout.debug.disable_xul_cache ...
Animated PNG graphics
s and 8-bit transparency. APNG is a simpler alternative to MNG, providing a spec suitable for the most common usage of animated images on the Internet. APNG is backwards-compatible with PNG; any PNG decoder should be able to ignore the APNG-specific chunks and display a single image. Terminology The default image is the image described by the standard 'IDAT' chunks, and is the image that is dis
played by decoders that do not support APNG. The canvas is the area on the output device on which the frames are to be dis
played. The contents of the canvas are not necessarily available to the decoder. As per the PNG Specification, if a 'bKGD' chunk exists it may be used to fill the canvas if there is no preferrable background. The output buffer is a pixel array with dimensions specified by the width...
...s been read. This implies that some errors may not be detected until partway through the animation. It is strongly recommended 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 dis
played to the user if appropriate. Structure An APNG stream is a normal PNG stream as defined in the PNG Specification, with three additional chunk types describing the animation and providing additional frame data. To be recognized as an APNG, an 'acTL' chunk must appear in the stream before any 'IDAT' chunks. The 'acTL' structure is described below. Conceptually, at the beginning of each play the ...
Gecko events
r applications send this event when a user needs to know that a user interface element has changed. Is Supported: yes EVENT_FOREGROUND The foreground window has changed. Is Supported: no EVENT_MENU_START A menu item on the menu bar has been selected. Is Supported: yes EVENT_MENU_END A menu from the menu bar has been closed. Is Supported: yes EVENT_MENUPOPUP_START A pop-up menu has been dis
played. Is Supported: yes EVENT_MENUPOPUP_END A pop-up menu has been closed. Is Supported: yes EVENT_CAPTURE_START A window has received mouse capture. Is Supported: no EVENT_CAPTURE_END A window has lost mouse capture. Is Supported: no EVENT_MOVESIZE_START A window is being moved or resized. Is Supported: no EVENT_MOVESIZE_END The movement or resizing of a window has finished Is Supported: n...
...NTEXTHELP_START A window has entered context-sensitive Help mode Is Supported: no EVENT_CONTEXTHELP_END A window has exited context-sensitive Help mode Is Supported: no EVENT_DRAGDROP_START An application is about to enter drag-and-drop mode Is Supported: yes EVENT_DRAGDROP_END An application is about to exit drag-and-drop mode Is Supported: no EVENT_DIALOG_START A dialog box has been dis
played Is Supported: no EVENT_DIALOG_END A dialog box has been closed Is Supported: no EVENT_SCROLLING_START Scrolling has started on a scroll bar Is Supported: yes EVENT_SCROLLING_END Scrolling has ended on a scroll bar Is Supported: yes EVENT_MINIMIZE_START A window object is about to be minimized or maximized Is Supported: no EVENT_MINIMIZE_END A window object has been minimized or maximize...
Observer Notifications
profile-after-change This is fired after all the observers for profile-do-change have been notified. You can register with nsICategoryManager to receive this notification. Prior to Firefox 3.5, this was available to observers observing the app-startup/xpcom-startup notification. final-ui-startup Triggered just before the first window for the application is dis
played. sessionstore-windows-restored Sent by the session restore process to indicate that all initial browser windows have opened. Note that while the window are open and the chrome loaded the tabs in the windows may still be being restored after this notification. Note: This notification is specific to Firefox and SeaMonkey 2.0 applications Application shutdown Th...
...rmission object. Context menu Topic Subject Data Description content-contextmenu An object containing two properties: event The event that triggered the context menu. addonInfo An empty object that add-ons can use to send data to the main process. null This notification is sent when the context menu is dis
played. It is sent, and received, in the content process: you can't listen to it in the chrome process. It's used by the context-menu module in the Add-on SDK, to help send information to the context-menu code running in the chrome process when a context menu is dis
played. ...
imgIContainer
alid value was passed in. FRAME_CURRENT 1 FRAME_MAX_VALUE 1 kNormalAnimMode 0 Animation mode Constants 0 = normal 1 = do not animate 2 = loop once. kDontAnimMode 1 kLoopOnceAnimMode 2 kDisposeClearAll -1 "Disposal" method indicates how the image should be handled before the subsequent image is dis
played. Do not change these without looking at the implementations using them, struct gif_struct::disposal_method and gif_write() in particular. Clear() the whole image, revealing. Obsolete since Gecko 2.0 kDisposeNotSpecified 0 Leave frame, let new frame draw() on top. Obsolete since Gecko 2.0 kDisposeKeep 1 Leave frame, let new frame draw() on top. Obsolete since G...
...n Exceptions thrown Missing Exception Missing Description Native code only!getCurrentFrameRect Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. The rectangle defining the location and size of the currently dis
played frame. Should be an attribute, but cannot be because of reference/pointer conflicts with native types in xpidl. void getCurrentFrameRect( in nsIntRect aFrameRect ); Parameters aFrameRect Missing Description Exceptions thrown Missing Exception Missing Description Native code only!getFrame Get a surface for the given frame. This may be a platform-native, optimized surface, s...
nsIAccessibleDocument
d only. Obsolete since Gecko 1.9 docType AString The doc type of the document, as specified in the document. Read only. DOMDocument nsIDOMDocument The nsIDOMDocument interface associated with this document. Read only. Note: Renamed from document in Gecko 2.0 isEditable boolean True if the document is live in an editor. False if the document is being dis
played but not edited. If a <div> is contentEditable, then it has its own document, with isEditable == true. Read only. Obsolete since Gecko 1.9 mimeType AString The mime type of the document. Read only. title AString The title of the document, as specified in the document. Read only. URL AString The URL of the document Read only. window nsIDOMWin...
...tring The mime type of the document. Read only. title AString The title of the document, as specified in the document. Read only. URL AString The URL of the document Read only. window nsIDOMWindow The nsIDOMWindow that the document resides in. Read only. windowHandle voidPtr The window handle for the OS window the document is being dis
played in. For example, in Windows you can static cast it to an HWND. Read only. Native code only! Methods getAccessibleInParentChain() Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Returns the first accessible parent of a DOM node. Guaranteed not to return null if the DOM node is in a document. nsIAccessible getAccessibleInParentChain( in n...
nsIAccessibleEvent
ver applications send this event when a user needs to know that a user interface element has changed. EVENT_FOREGROUND 0x0003 0x0017 0x0014 The foreground window has changed. EVENT_MENU_START 0x0018 0x0015 A menu item on the menu bar has been selected. EVENT_MENU_END 0x0019 0x0016 A menu from the menu bar has been closed. EVENT_MENUPOPUP_START 0x001A 0x0017 A pop-up menu has been dis
played. EVENT_MENUPOPUP_END 0x001B 0x0018 A pop-up menu has been closed. EVENT_CAPTURE_START 0x001C 0x0019 A window has received mouse capture. EVENT_CAPTURE_END 0x001D 0x001A A window has lost mouse capture. EVENT_MOVESIZE_START 0x001E 0x001B A window is being moved or resized. EVENT_MOVESIZE_END 0x001F 0x001C The movement or resizing of a window has finished. EVENT_CONTEXTHELP_ST...
...T 0x0020 0x001D A window has entered context-sensitive Help mode. EVENT_CONTEXTHELP_END 0x0021 0x001E A window has exited context-sensitive Help mode. EVENT_DRAGDROP_START 0x0022 0x001F An application 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 dis
played. 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.
nsIAccessibleRole
nts a link to something else. This object might look like text or a graphic, but it acts like a button. It is used for xul:label@class="text-link", html:a, html:area, xforms:trigger@appearance="minimal". ROLE_HELPBALLOON 31 Displays a Help topic in the form of a ToolTip or Help balloon. ROLE_CHARACTER 32 Represents a cartoon-like graphic object, such as Microsoft Office Assistant, which is dis
played to provide help to users of an application. ROLE_LIST 33 Represents a list box, allowing the user to select one or more items. It is used for xul:listbox, html:select@size, role="list". See also ROLE_LIST_ITEM. ROLE_LISTITEM 34 Represents an item in a list. See also ROLE_LIST. ROLE_OUTLINE 35 Represents an outline or tree structure, such as a tree view control, that displays a hierarchical ...
...a hot-key field that allows the user to enter a combination or sequence of keystrokes. ROLE_SLIDER 51 Represents a slider, which allows the user to adjust a setting in given increments between minimum and maximum values. It is used by xul:scale, role="slider", xforms:range. ROLE_SPINBUTTON 52 Represents a spin box, which is a control that allows the user to increment or decrement the value dis
played in a separate "buddy" control associated with the spin box. It is used for xul:spinbuttons. ROLE_DIAGRAM 53 Represents a graphical image used to diagram data. It is used for svg:svg. ROLE_ANIMATION 54 Represents an animation control, which contains content that changes over time, such as a control that displays a series of bitmap frames. ROLE_EQUATION 55 Represents a mathematical equation. ...
nsIDownloadManagerUI
is visible; otherwise false. Read only. Constants Constant Value Description REASON_USER_INTERACTED 0 When opening the Download Manager user interface, this value indicates that it's being done at the user's request. REASON_NEW_DOWNLOAD 1 When opening the Download Manager user interface, this value indicates that the user interface is being dis
played because a new download is being started. Methods getAttention() Calls attention to the Download Manager's user interface if it's already open. The UI need not be visible to call this function, nor will the UI be made visible. void getAttention(); Parameters None. Exceptions thrown NS_ERROR_UNEXPECTED The user interface isn't currently open. show() Shows the Download Manager's...
... See also The Download Manager schema ...
nsIDownloadProgressListener
e 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 intended to be dis
played 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 method even if nev...
...g 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 intended to be dis
played 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 : function(prog, r...
nsIMessenger
aHistory); Note: Prior to Gecko 8.0, all references to nsIDOMWindow used in this interface were nsIDOMWindow. Attributes Attribute Type Description transactionManager nsITransactionManager Readonly: The transaction manager for this nsIMessenger instance. sendingUnsentMsgs boolean Indicates if sending messages is in progress. lastDis
playedMessageUri ACString Readonly: The URL of the last dis
played message. navigatePos long The current index in the navigation history. Constants Name Value Description eUnknown 0 Unknown transaction type. eDeleteMsg 1 Delete transaction type. eMoveMsg 2 Move transaction type. eCopyMsg 3 Copy transac...
... navigatePos long The current index in the navigation history. Constants Name Value Description eUnknown 0 Unknown transaction type. eDeleteMsg 1 Delete transaction type. eMoveMsg 2 Move transaction type. eCopyMsg 3 Copy transaction type. Methods setDisplayCharset() Sets the character set for the dis
played message. void setDisplayCharset(in ACString aCharset); Parameters aCharset The character set to use. setWindow() Sets the current window for a messenger session. void setWindow(in nsIDOMWindow aWin, in nsIMsgWindow aMsgWindow); Parameters aWin The window to set as the window for the messaging session. If this window contains a messagepane element (I think this m...
nsIMsgDBView
hdrForFirstSelectedMessage nsIMsgDBHdr Readonly: Header of the first selected message. numSelected long Readonly: The number of messages currently selected. msgToSelectAfterDelete nsMsgViewIndex Readonly: The index of the message to select after the current one is deleted. nsMsgViewIndex is defined as a unsigned long in MailNewsTypes2.idl. currentlyDis
playedMessage nsMsgViewIndex Readonly: The index of the currently dis
played message. nsMsgViewIndex is defined as a unsigned long in MailNewsTypes2.idl. suppressMsgDisplay boolean Suppress displaying messages. Used when the message pane is collapsed. suppressCommandUpdating boolean Suppress command updating. Used during folder loading. db nsIMsgDatabase ...
...ey. Used by "go to folder" feature and "remember last selected message" feature. If key is not found, nothing is selected. void selectMsgByKey(in nsMsgKey key); Parameters key The Key of the message to load. nsMsgKey is defined as an unsigned long in MailNewsTypes2.idl. selectFolderMsgByKey() Selects a message within a folder by its key. This assumes that the key is somewhere in the dis
played messages... I think. void selectFolderMsgByKey(in nsIMsgFolder aFolder, in nsMsgKey aKey); Parameters aFolder The nsIMsgFolder to search within. aKey The key of the message. nsMsgKey is defined as an unsigned long in MailNewsTypes2.idl. onDeleteCompleted() Called when delete is completed on a message. Used to notify the tree that rows are going away. void...
nsIMsgMessageService
age keys to be copied. srcFolder aCopyListener An nsIStreamListener to be notified of copy events. aMoveMessage Set to true if you want the message to be moved. false leaves it as just a copy. aUrlListener An nsIUrlListener aMsgWindow nsIMsgWindow for progress and status feedback Return values aURL The new nsIURI of the message. (?) DisplayMessage() When you want a message dis
played.... void DisplayMessage(in string aMessageURI, in nsISupports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, in string aCharsetOverride, out nsIURI aURL); Parameters aMessageURI A uri representing the message to display. aDisplayConsumer Is (for now) an...
...use this method. Note: The Uri MUST refer to a message and not a folder! void GetUrlForUri(in string aMessageURI, out nsIURI aURL, in nsIMsgWindow aMsgWindow); Parameters aMessageURI aMsgWindow nsIMsgWindow for progress and status feedback Return values aURL The nsIURI of the message. DisplayMessageForPrinting() When you want a message dis
played in a format that is suitable for printing. void DisplayMessageForPrinting(in string aMessageURI, in nsISupports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, out nsIURI aURL); Parameters aMessageURI A uri representing the message t...
nsIMsgWindow
nsIInterfaceRequestor These are currently used to set notification callbacks on protocol channels to handle things like bad cert exceptions. promptDialog nsIPrompt Readonly: This is the equivalent of calling GetInterface on the rootDocShell object. mailCharacterSet ACString This is used to track the character set of the currently dis
played message. If set to an alias, the actual character set is returned. charsetOverride boolean Remember the message's charset was overridden, so it can be inherited (e.g for quoting). stopped boolean Check if a running url been stopped. If you are checking this flag, you need to clear it before you start your operation since there's no convenien...
...ring title, in AString body, in boolean clearMsgHdr); Parameters title Not used. body The HTML to display in the message pane. Note that the HTML is wrapped in <html> and <body> tags for you. clearMsgHdr Whether or not the existing message pane and header should be cleared before the HTML is dis
played. StopUrls() This is equivalent to calling Stop(nsIWebNavigation::STOP_NETWORK) on the nsIWebNavigation object. void StopUrls(); closeWindow() When the msg window is being unloaded from the content window, this notification can be used to force a flush on anything the message window hangs on. For some reason XPConnect is still hanging onto the message window even though all of our objects have ...
nsIPrintingPrompt
nt nsIDOMWindow parameter. See nsIPrintingPromptService for all documentation. This service enables embedders to implement their own Print and Progress Dialogs. Each platform has a "base" or "backstop" implementation of the service. The service is automatically registered at start up. Historically, platform toolkits with native dialogs have implemented them in the GFX layer Usually they were dis
played when a new DeviceContextSpec specific to that platform was created. Windows: The GFX layer no longer supports default toolkit behavior for displaying the native Print Dialog. If an embedder implemented service returns any error code (other than NS_ERROR_ABORT) printing will terminate. Returning NS_OK assumes that the PrintSettings object was correctly filled in and if it does not have valid fi...
...f the others. For the Print Dialog: You may stub out this service by having all the methods return NS_ERROR_NOT_IMPLEMENTED. You can then fly you own dialog and then properly fill in the PrintSettings object before calling nsIWebBrowserPrint's Print method. If you stub out this service you MUST set "printSilent" to true, if you do not, Printing will terminate and an error dialog will be dis
played. Mac: The GFX layer still supports default toolkit behavior for displaying the Print Dialog. If an embedder implemented service returns NS_ERROR_NOT_IMPLEMENTED for "showPrintDialog" The toolkit will display the native print dialog. Defaults for platform service: Mac OS X: showPrintDialog - displays a native dialog showPageSetup() - displays a native dialog showProgress() - not imp...
nsIScrollable
An integer representing the minimal position of the vertical scroll range. ...
...l scroll range. ...
nsISound
fects, this will do nothing. Note: This function is not supported on the Macintosh. void playSystemSound( in AString soundAlias ); Parameters soundAlias Two different types of names are supported: You can specify the name of a system sound provided by the host operating system; for example, if you specify "SystemExclamation", you can play the Windows alert sound, but it's
played only on Windows. Similarly, if you specify "Blow", you can play the Mac OS X "Blow" system sound, but, similarly, it's
played only on the Macintosh. If you wish to use this method for playing sounds, you should check the platform before you call playSystemSound(). Note: This second usage is obsolete starting in Gecko 1.9.2. You should instead use playEventSound() instead. Typically...
...Various event names are provided, which will result in playing the corresponding sound effect on the platform the user is running on: _moz_mailbeep The system sound when the system receives email. ...
nsITaskbarPreview
ctive boolean Indicates whether or not the preview is marked as active (currently selected) in the taskbar. controller nsITaskbarPreviewController The controller for this preview. ...
...By default, this is an empty string. visible boolean Indicates whether or not the preview is visible; by default, this is false. ...
nsIUpdatePrompt
in nsIDOMWindow parent); void showUpdateInstalled(); Methods checkForUpdates() Presents a user interface that checks for and displays the available updates. void checkForUpdates(); Parameters None. showUpdateAvailable() Shows a message advising the user that an update is available to be downloaded and installed. If the app.update.silent preference is true or the user interface is already dis
played the call will be a no-op. void showUpdateAvailable( in nsIUpdate update ); Parameters update An nsIUpdate describing the update that's available. showUpdateDownloaded() Shows a message advising the user that an update has been downloaded, and that the user should restart the application in order to install it. If background is true (for example the download was not user initiated) and the ap...
...UpdateHistory( in nsIDOMWindow parent ); Parameters parent An nsIDOMWindow indicating the parent window to which to anchor the update list window. This can be null. showUpdateInstalled() Shows a message detailing the update that was just installed successfully. If the app.update.silent preference is true, the app.update.showInstalledUI preference is false, or the user interface is already dis
played the call will be a no-op. void showUpdateInstalled( in nsIUpdate update Obsolete since Gecko 1.9.1 ); Parameters update Obsolete since Gecko 1.9.1 An nsIUpdate describing the update that was installed. See also nsIUpdate nsIUpdateCheckListener nsIUpdateChecker nsIUpdatePatch nsIApplicationUpdateService nsIUpdateManager nsIUpdateTimerManager ...
nsPIPromptService
value is 9. This is the label of the second button on the dialog. eButton2Text The value is 10. This is the label of the third button on the dialog. eButton3Text The value is 11. This is the label of the forth button on the dialog. eDialogTitle The value is 12. This is the title of the dialog. eOpeningSound Obsolete since Gecko 1.9.2 The value is 13. This is the system sound name which should be
played when the dialog is shown. See also nsISound.playSystemSound(). This is obsolete on Gecko 1.9.2 and later. You should use eSoundEventId instead. The indexes for GetInt() and SetInt() are: eButtonPressed The value is 0. This is used for the result of the dialog. The pressed button number will be returned. eCheckboxState The value is 1. This is the default checkbox state and the result of it. eNum...
...wise, it's a normal edit field. Note that the second is always password field. eDefaultButton The value is 5. This is the button number which should be the default button on the dialog. eDelayButtonEnable The value is 6. If this is not 0, the all buttons are disabled when the dialog is shown. And they will be enabled later. eSoundEventId The value is 7. This is the sound event ID which should be
played when the dialog is shown. See also nsISound.playEventSound(). Method overview void doDialog(in nsIDOMWindow aParent, in nsIDialogParamBlock aParamBlock, in string aChromeURL); Methods doDialog() Opens a dialog. void doDialog( in nsIDOMWindow aParent, in nsIDialogParamBlock aParamBlock, in string aChromeURL ); Parameters aParent The parent window of the dialog. aParamBlock Various p...
Creating a Custom Column
getSortStringForRow(hdr): return the string value that the column will be sorted by getSortLongForRow(hdr): return the long value that the column will be sorted by isString(): return true / false Warning! Do not get confused between GetCellText() and GetSortString/LongForRow()! Though they sound similar you may not want to return the same value from both. ...
... Putting the Pieces together We now have our column and our handler object - it's time to put everything together. For this we use a new function, addColumnHandler that takes a column ID and a handler object. Our implementation will need to call something s...
Mozilla
Querying Places for information about obtaining and using nsINavHistoryResult objects, which this page assumes you are familiar with. Error codes returned by Mozilla APIs The following tables list errors that can occur when calling various Mozilla APIs. Each error is listed by its name and an error code in parentheses. An error will typically be dis
played on the error console, but can be captured using a try-catch block in JavaScript. These constants can be accessed through Components.results. For example, by using Components.results.NS_ERROR_NOT_INITIALIZED Firefox Here you can learn about how to contribute to the Firefox project and you will also find links to information about the const...
... Popup notifications, also known as "doorhanger notifications", are presented to notify the user of something that's important but may not need immediate attention. These non-modal notifications let the user make decisions when they have a moment to do so, instead of being forced to deal with them at possibly inconvenient times. For example, this popup notification is dis
played when a web site requests geolocation information: Using RAII classes in Mozilla RAII classes are useful when two operations (e.g., Lock/Unlock, AddRef/Release, PushState/PopState) must be paired. Using tab-modal prompts Note: This part of the documentation is outdated. The updated prompt documentation can be fou...
Plug-in Development Overview - Plugins
rs: STR#' 127 can contain a list of MIME type descriptions corresponding to the types in 'STR#' 128 . For example, this description list corresponds to the types in the previous example: String 1: "QuickTime Video", String 4: "AIFF Audio", and String 5: "JPEG Image Format." STR#' 126: String 1 can contain a descriptive message about the plug-in. This message, which is in HTML format, is dis
played by the browser in its "About Plug-ins" page. String 2 can contain the name of the plug-in, thus allowing the name the user sees to be different from the name of the file on disk. Drawing a Plug-in Instance Before drawing itself on the page, the plug-in must provide information about itself, set the window or other target in which it draws, arrange for redrawing, and handle events. A windowles...
...n of the document's origin converted to NFKC-encoded (that is, normalized) UTF-8. Your plug-in must free the returned string's memory by calling NPN_MemFree() when you're done with it. Getting Version and UI Information The Netscape group of Plug-in API methods provides some basic services to the plug-in. You can use these Netscape methods: To identify the browser in which your plug-in is dis
played: Use the NPN_UserAgent method to read this information. To determine whether plug-in and the browser versions are compatible and possibly provide alternative processing for different versions: Use the NPN_Version method to check for changes in major and minor version numbers. For information about using these methods, see Version, UI, and Status Information. Displaying Messages on the Status ...
Introduction to DOM Inspector - Firefox Developer Tools
will be the webpages you have opened in tabs. For Thunderbird and SeaMonkey Mail and News, any messages you're viewing will be listed here. Inspecting Chrome Documents The Inspect Chrome Document menupopup can be accessed from the File menu , and it will contain the list of currently loaded chrome windows and subdocuments. A browser window and the DOM Inspector are likely be already open and dis
played in this list. The DOM Inspector keeps track of all the windows that are open, so to inspect the DOM of a particular window in the DOM Inspector, simply access that window as you would normally and then choose its title from this dynamically updated menulist. Inspecting arbitrary URLs You may also inspect the DOM of arbitrary URLs by using the Inspect a URL menuitem in the File menu, or by jus...
... Searching for Nodes in the DOM Another way to inspect the DOM is to search for particular elements you're interested in by ID, class, or attribute. When you select Edit > Find Nodes... or press Ctrl + F, the DOM Inspector displays a find dialog that lets you find elements in various ways, and that gives you incremental searching by way of the <F3> shortcut key. Updating t...
Deprecated tools - Firefox Developer Tools
Editor Mode can be triggered clicking on the icon on the right of the console input, or with Ctrl + B (Cmd + B on macOS) When in Editor Mode, the Enter key adds a new line in the input, and you can evaluate the expression using Ctrl + Enter (Cmd + Enter on macOS). When evaluating, the input isn't cleared, which makes it possible to quickly iterrate over a snippet of code. The results are dis
played in the console output, to the right of the input, providing immediate feedback. Unlike in Scratchpad, errors are properly dis
played in the output with an expandable stacktrace, making it easier to debug the code you're currently writing. Starting Firefox 72, you can import a Javascript file content in the console input with Ctrl + O (Cmd + O on macOS), as well as saving the console input content...
...Editor allowed you to examine an audio context constructed in the page and provided a visualization of its graph. This gave a high-level view of its operation, and enabled you to ensure that all the nodes are connected in the way you expect. It was possible to edit the AudioParam properties for each node in the graph. Some non-AudioParam properties, like an OscillatorNode's type property, were dis
played and editable as well. It was deprecated due to lack of use. More details about the Web Audio Editor Alternatives Alternatives include AudioN and https://github.com/spite/WebAudioExtension web extensions. Shader editor Bugzilla issue: bug 1342237 Removed as of Firefox 67 Description The Shader Editor allowed users to examine and edit the source of the WebGL vertex and fragment shaders. I...
Migrating from Firebug - Firefox Developer Tools
ebug the box model can be inspected via the Layout side panel. In the DevTools the box model is part of the Computed side panel. Both tools highlight the different parts of the box model within the page when hovering them in the box model view. Also, both tools allow you to edit the different values inline via a click on them. ...
...In the DevTools they are shown when clicking the small 'ev' icon besides an element within the node view. Both tools allow to display wrapped event listeners (e.g. listeners wrapped in jQuery functions). To improve the UI of the DevTools, there is also a request to add an Events side panel to them like the one in Firebug (see bug 1226640). ...
Network request list - Firefox Developer Tools
You can override this behavior by checking "Enable persistent logs" in the Settings. ...
... fit its contents. The Reset Columns command on the context menu also resets the width of the columns to the default values. Clicking the column header label sorts the request list by that column. You can reset the sort to the default by selecting "Reset Sorting" from the context menu. Here is a list of all available columns: Status: The HTTP status code returned. The numeric code is dis
played on a colored background, to help unusual ones stand out. If there was no response, this column is empty. Or you might see a red circle with a diagonal slash for responses that were blocked by the browser or the server. Method: The HTTP request method used. Domain: Domain of the path requested. If the request used SSL/TLS and the connection had security weaknesses such as weak ciphers, yo...
Settings - Firefox Developer Tools
determines which tools are enabled in the toolbox. New tools are often included in Firefox but not enabled by default. Available Toolbox Buttons This group of checkboxes determines which tools get an icon in the Toolbox's toolbar. As of Firefox 62, if the option to "Select an iframe as the currently targeted document" is checked, the icon will appear in the toolbar while the Settings tab is dis
played, even if the current page doesn't include any iframes. Note that in Firefox 52 we removed the checkbox to toggle the "Select element" button. The "Select element" button is now always shown. Themes This enables you to choose one of two themes. There's a light theme, which is the default: A dark theme: Common preferences Settings that apply to more than one tool. There'...
...output when you navigate to a new page. If Common Preferences is not included in the Settings, Web Console logs can be persisted by using the 'about:config' url in browser address bar, searching for: 'devtools.webconsole.persistlog' then toggling this value to true Inspector Show browser styles A setting to control whether styles applied by the browser (user-agent styles) should be dis
played in the Inspector's Rules view. Note that this setting is independent of the "Browser styles" checkbox in the Inspector's Computed view. Truncate DOM attributes By default, the Inspector truncates DOM attributes that are more than 120 characters long. Uncheck this box to prevent this behavior. This setting works by toggling the about:config preference "devtools.markup.collapseAttributes". To cha...
Web Audio Editor - Firefox Developer Tools
dio Editor examines an audio context constructed in the page and provides a visualization of its graph. This gives you a high-level view of its operation, and enables you to ensure that all the nodes are connected in the way you expect. You can then examine and edit the AudioParam properties for each node in the graph. Some non-AudioParam properties, like an OscillatorNode's type property, are dis
played, and you can edit these as well. This tool is still experimental. If you find bugs, we'd love it if you filed them in Bugzilla. If you have feedback or suggestions for new features, dev-developer-tools or Twitter are great places to register them. Opening the Web Audio Editor The Web Audio Editor is not enabled by default in Firefox 32. To enable it, open the Developer Tool Settings and check ...
...graph The Web Audio Editor will now display the graph for the loaded audio context. Here's the graph for the Violent Theremin demo: You can see that it uses three nodes: an OscillatorNode as the source, a GainNode to control the volume, and an GainNode as the destination. Connections to AudioParams Displaying connections to AudioParams is new in Firefox 34. Connections between nodes are dis
played as solid lines. If, instead, you've connected a node to an AudioParam in another node, then the connection is shown as a dashed line between the nodes, and is labeled with the name of the AudioParam: Inspecting and modifying AudioNodes If you click on a node, it's highlighted and you get a node inspector on the right hand side. This list the values of that node's AudioParam properties. For exam...
Console messages - Firefox Developer Tools
This is not shown by default: you can opt to see timestamps by selecting Show Timestamps in the console settings menu (gear icon in the console toolbar). Icon Not all console messages contain icons. The following icons may be used: Informational message Warning Error Blocked; for network messages In addition, a disclosure triangle indicates that further information is available; clicking it displays or collapses that information. Message The message itself. ...
...re as Global Variable Creates a global variable (with a name like temp0, temp1, etc.) whose value is the selected object. The name of the variable appears as an input to the interpreter, and its value appears as a response. Copy Object Copies the selected object to the clipboard. Filtering and searching Filtering by category You can use the toolbar along the top to constrain the results dis
played. To see only messages of particular categories, click the button labeled with that category (Errors, CSS, and so on). For Errors and Warnings, when you turn off display of the category, a number appears next to the button text to indicate how many messages of that type are available. For example, "Warnings (25)". Network requests with response codes in the 400-499 (client error) or 500-599 (se...
about:debugging (before Firefox 68) - Firefox Developer Tools
e and add-on debugging toolboxes" and "Enable remote debugging" in the Developer Tools Settings. Loading a temporary add-on With the "Load Temporary Add-on" button you can load any sort of restartless add-on temporarily, from a directory on disk. Just click the button, navigate to the directory containing the add-on's file, and select any file in that directory. The temporary add-on will be dis
played under the "Temporary Extensions" header. You don't have to package or sign the add-on. The add-on will stay installed until you restart Firefox. The big advantages of this method, compared with installing an add-on from an XPI, are: you don't have to rebuild an XPI and reinstall when you change the add-on's code you can load an add-on without signing it and without needing to disable sign...
...ervice workers Sending push events in about:debugging is new in Firefox 47. To debug push notifications, you can set a breakpoint in the push event listener. However, you can also debug push notifications locally, without needing the server. Just click the "Push" button to send a push event to the service worker: Service workers not compatible In Firefox 49+, a warning message will be dis
played in the Service Workers section of the Workers page if service workers are incompatible with the current browser configuration, and therefore cannot be used or debugged. Service workers can be unavailable for several reasons: If you are using a Private Browsing window. If your History preference is set to "Never Remember History" or "Always use private browsing mode". If the dom.serviceWo...
Animation - Web APIs
ce of the Web Animations API represents a single animation player and provides playback controls and a timeline for an animation node or source. Constructor Animation() Creates a new Animation object instance. Properties Animation.currentTime The current time value of the animation in milliseconds, whether running or paused. If the animation lacks a timeline, is inactive or hasn't been
played yet, its value is null. Animation.effect Gets and sets the AnimationEffectReadOnly associated with this animation. This will usually be a KeyframeEffect object. Animation.finished Read only Returns the current finished Promise for this animation. Animation.id Gets and sets the String used to identify the animation. Animation.pending Read only Indicates whether the animation is cur...
...sist() Explicitly persists an animation, when it would otherwise be removed due to the browser's Automatically removing filling animations behavior. Animation.play() Starts or resumes playing of an animation, or begins the animation again if it previously finished. Animation.reverse() Reverses playback direction, stopping at the start of the animation. If the animation is finished or un
played, it will play from end to beginning. Animation.updatePlaybackRate() Sets the speed of an animation after first synchronizing its playback position. Automatically removing filling animations It is possible to trigger a large number of animations on the same element. If they are indefinite (i.e., forwards-filling), this can result in a huge animations list, which could create a memory leak. Fo...
AudioBufferSourceNode.loop - Web APIs
The loop property's default value is false. Syntax var loopingEnabled = AudioBufferSourceNode.loop; AudioBufferSourceNode.loop = true | false; Value A Boolean which is true if looping is enabled; otherwise, the value is false. When looping is enabled, the sound begins playing at the time specified as the start point when start() is called. ...
...cified by the loopEnd property is reached, playback continues at the time specified by loopStart Example In this example, the AudioContext.decodeAudioData function is used to decode an audio track and put it into an AudioBufferSourceNode. Buttons are provided to play and stop the audio playback, and a slider control is used to change the playbackRate property value on the fly. When the audio is
played, it loops. You can run the full example live (or view the source.) function getData() { source = audioCtx.createBufferSource(); request = new XMLHttpRequest(); request.open('GET', 'viper.ogg', true); request.responseType = 'arraybuffer'; request.onload = function() { var audioData = request.response; audioCtx.decodeAudioData(audioData, function(buffer) { myBuffer...
AudioBufferSourceNode.start() - Web APIs
Optional An offset, specified as the number of seconds in the same time coordinate system as the AudioContext, to the time within the audio buffer that playback should begin. For example, to start playback halfway through a 10-second audio clip, offset should be 5. The default value, 0, will begin playback at the beginning of the audio buffer, and offsets past the end of the audio which will be
played (based on the audio buffer's duration and/or the loopEnd property) are silently clamped to the maximum value allowed. The computation of the offset into the sound is performed using the sound buffer's natural sample rate, rather than the current playback rate, so even if the sound is playing at twice its normal speed, the midway point through a 10-second audio buffer is still 5. duration Optiona...
...ion and/or the loopEnd property) are silently clamped to the maximum value allowed. The computation of the offset into the sound is performed using the sound buffer's natural sample rate, rather than the current playback rate, so even if the sound is playing at twice its normal speed, the midway point through a 10-second audio buffer is still 5. duration Optional The duration of the sound to be
played, specified in seconds. If this parameter isn't specified, the sound plays until it reaches its natural conclusion or is stopped using the stop() method. Using this parameter is functionally identical to calling start(when, offset) and then calling stop(when+duration). Return value undefined. Exceptions TypeError A negative value was specified for one or more of the three time parameters. ...
AudioProcessingEvent - Web APIs
on target Read only EventTarget The event target (the topmost target in the DOM tree). type Read only DOMString The type of event. bubbles Read only boolean Does the event normally bubble? cancelable Read only boolean Is it possible to cancel the event? playbackTime Read only double The time when the audio will be
played, as defined by the time of AudioContext.currentTime inputBuffer Read only AudioBuffer The buffer containing the input audio data to be processed. The number of channels is defined as a parameter, numberOfInputChannels, of the factory method AudioContext.createScriptProcessor(). Note the the returned AudioBuffer is only valid in the scope of the onaudioprocess function. ou...
....buffer = myBuffer; }, function(e){"Error with decoding audio data" + e.err}); } request.send(); } // Give the node a function to process audio events scriptNode.onaudioprocess = function(audioProcessingEvent) { // The input buffer is the song we loaded earlier var inputBuffer = audioProcessingEvent.inputBuffer; // The output buffer contains the samples that will be modified and
played var outputBuffer = audioProcessingEvent.outputBuffer; // Loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputBuffer.numberOfChannels; channel++) { var inputData = inputBuffer.getChannelData(channel); var outputData = outputBuffer.getChannelData(channel); // Loop through the 4096 samples for (var sample = 0; sample < input...
Manipulating video using canvas - Web APIs
This tutorial demonstrates how to perform chroma-keying (also known as the "green screen effect") using JavaScript code. The document content The HTML document used to render this content is shown below. ...
...eplaced with a zero, indicating that the pixel is entirely transparent. As a result, the final image has the entire green screen area 100% transparent, so that when it's drawn into the destination context in line 13, the result is an overlay onto the static backdrop. The resulting image looks like this: This is done repeatedly as the video plays, so that frame after frame is processed and dis
played with the chroma-key effect. View the full source for this example. ...
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 dis
played in the Web Console along with an indicator that the time has ended. ...
...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 dis
played when the timer value is logged using timeLog() and again when it's stopped. In addition, the call to timeEnd() has the additional information, "timer ended" to make it obvious that the timer is no longer tracking time. Specifications Specification Status Comment Console APIThe definition of 'console.timeEnd()' in that specification. Living Standard Initial defi...
Element: contextmenu event - Web APIs
Any right-click event that is not disabled (by calling the event's preventDefault() method) will result in a contextmenu event being fired at the targeted element. ...
... Any right-click event that is not disabled (by calling the event's preventDefault() method) will result in a contextmenu event being fired at the targeted element. ...
Guide to the Fullscreen API - Web APIs
formation itself as to whether the document is entering or exiting fullscreen mode, but if the document has a non null fullscreenElement, you know you're in fullscreen mode. When a fullscreen request fails It's not guaranteed that you'll be able to switch into fullscreen mode. For example, <iframe> elements have the allowfullscreen attribute in order to opt-in to allowing their content to be dis
played in fullscreen mode. In addition, certain kinds of content, such as windowed plug-ins, cannot be presented in fullscreen mode. Attempting to put an element which can't be dis
played in fullscreen mode (or the parent or descendant of such an element) won't work. Instead, the element which requested fullscreen will receive a mozfullscreenerror event. When a fullscreen request fails, Firefox will log ...
...e of their own accord; see Things your users want to know. You can also do so programmatically by calling the Document.exitFullscreen() method. Other information The Document provides some additional information that can be useful when developing fullscreen web applications: DocumentOrShadowRoot.fullscreenElement The fullscreenElement property tells you the Element that's currently being dis
played fullscreen. If this is non-null, the document is in fullscreen mode. If this is null, the document is not in fullscreen mode. Document.fullscreenEnabled The fullscreenEnabled property tells you whether or not the document is currently in a state that would allow fullscreen mode to be requested. Things your users want to know You'll want to be sure to let your users know that they can press t...
GeolocationCoordinates.longitude - Web APIs
meters / 335 feet) east of the Greenwich meridian. This is the same standard used by the Global Positioning System (GPS). Examples In this simple example, we fetch the user's location and display the resulting coordinates once they're returned. JavaScript The JavaScript code below creates an event listener so that when the user clicks on a button, the location information is retrieved and dis
played. let button = document.getElementById("get-location"); let latText = document.getElementById("latitude"); let longText = document.getElementById("longitude"); button.addEventListener("click", function() { navigator.geolocation.getCurrentPosition(function(position) { let lat = position.coords.latitude; let long = position.coords.longitude; latText.innerText = lat.toFixed(2); l...
... click event, we call getCurrentPosition() to request the device's current position. This is an asynchronous request, so we provide a callback which receives as in put a GeolocationPosition object describing the determined position. From the GeolocationPosition object, we obtain the user's latitude and longitude using position.coords.latitude and position.coords.longitude so we can update the dis
played coordinates. The two <span> elements are updated to display the corresponding values after being converted to a value with two decimal places. HTML The HTML used to present the results looks like this: <p> Your location is <span id="latitude">0.00</span>? latitude by <span id="longitude">0.00</span>? longitude. </p> <button id="get-location"> Get My Location </button> Result Take this ...
HTMLEmbedElement - Web APIs
Properties Inherits properties from its parent, HTMLElement. HTMLEmbedElement.align Is a DOMString representing an enumerated property indicating alignment of the element's contents with respect to the surrounding context. The possible values are "left", "right", "center", and "justify". HTMLEmbedElement.height Is a DOMString reflecting the height HTML attribute, containing the dis
played height of the resource. HTMLEmbedElement.name Is a DOMString representing the name of the embedded object. HTMLEmbedElement.src Is a DOMString that reflects the src HTML attribute, containing the address of the resource. HTMLEmbedElement.type Is a DOMString that reflects the type HTML attribute, containing the type of the resource. HTMLEmbedElement.width Is a DOMString that reflects the...
...t.name Is a DOMString representing the name of the embedded object. HTMLEmbedElement.src Is a DOMString that reflects the src HTML attribute, containing the address of the resource. HTMLEmbedElement.type Is a DOMString that reflects the type HTML attribute, containing the type of the resource. HTMLEmbedElement.width Is a DOMString that reflects the width HTML attribute, containing the dis
played width of the resource. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLEmbedElement' in that specification. Living Standard Adds two obsolete properties, name and align, to help with compatibility with old Web sites. HTML5The definition of '...
HTMLImageElement.alt - Web APIs
technologies to help differently-abled users make full use of your content. It will be read aloud or sent to the touch device, for example, to support visually impaired users. Think of it like this: When choosing alt strings for your images, imagine what you would say when reading the page to someone over the phone without mentioning that there's an image on the page. The alternate text is dis
played in the space the image would occupy and should be able to take the place of the image without altering the meaning of the page. Syntax htmlImageElement.alt = altText; let altText = htmlImageElement.alt; Value A DOMString which contains the alternate text to display when the image is not loaded or for use by assistive devices. The alt attribute is officially mandatory; it's meant to always be...
... page to indicate that the content of the page is new and has been updated recently, the corresponding alt text might be "Updated Recently" or even "Updated on 27 August 2019". In this example, a starburst image with the word "New!" is used to indicate that an article is about something new (and probably supposedly also exciting). The alt attribute is set to New Page! to allow that text to be dis
played in place of the image if the image isn't available. It is also available to be read by screen readers. HTML The HTML below creates a snippet of content from a site using the described icon. Note the use of the alt attribute on the <img>, providing a good substitution string to use in case the image doesn't load. <div class="container"> <img src="https://udn.realityripple.com/samples/87/eace6...
HTMLImageElement - Web APIs
ML <img> element which is not attached to any DOM tree. It accepts optional width and height parameters. When called without parameters, new Image() is equivalent to calling document.createElement("img"). Properties Inherits properties from its parent, HTMLElement. HTMLImageElement.alt A DOMString that reflects the alt HTML attribute, thus indicating the alternate fallback content to be dis
played if the image has not been loaded. HTMLImageElement.complete Read only Returns a Boolean that is true if the browser has finished fetching the image, whether successful or not. That means this value is also true if the image has no src value indicating an image to load. HTMLImageElement.crossOrigin A DOMString specifying the CORS setting for this image element. See CORS settings attributes fo...
...sful or not. That means this value is also true if the image has no src value indicating an image to load. HTMLImageElement.crossOrigin A DOMString specifying the CORS setting for this image element. See CORS settings attributes for further details. This may be null if CORS is not used. HTMLImageElement.currentSrc Read only Returns a USVString representing the URL from which the currently dis
played image was loaded. This may change as the image is adjusted due to changing conditions, as directed by any media queries which are in place. HTMLImageElement.decoding An optional DOMString representing a hint given to the browser on how it should decode the image. If this value is provided, it must be one of the possible permitted values: sync to decode the image synchronously, async to decode i...
HTMLInputElement - Web APIs
ot affect the value of the checked attribute, and clicking the checkbox will set the value to false. Properties that apply only to elements of type image alt string: Returns / Sets the element's alt attribute, containing alternative text to use when type is image. ...
... Properties that apply only to elements of type file accept string: Returns / Sets the element's accept attribute, containing comma-separated list of file types accepted by the server when type is file. ...
HTMLMediaElement.controls - Web APIs
Example var obj = document.createElement('video'); obj.controls = true; Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.controls' in that specification. ...
... Example var obj = document.createElement('video'); obj.controls = true; Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.controls' in that specification. ...
HTMLMediaElement.playbackRate - Web APIs
The audio is muted when the fast forward or slow motion is outside a useful range (for example, Gecko mutes the sound outside the range 0.25 to 5.0). The pitch of the audio is corrected by default and is the same for every speed. Some browsers implement the non-standard HTMLMediaElement.preservesPitch property to control this. ...
... The audio is muted when the fast forward or slow motion is outside a useful range (for example, Gecko mutes the sound outside the range 0.25 to 5.0). The pitch of the audio is corrected by default and is the same for every speed. Some browsers implement the non-standard HTMLMediaElement.preservesPitch property to control this. ...
IDBCursor.advance() - Web APIs
a negative number. InvalidStateError The cursor is currently being iterated or has iterated past its end. Example In this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through the records in the object store. Here we use cursor.advance(2) to jump 2 places forward each time, meaning that only every other result will be dis
played. advance() works in a similar way to IDBCursor.continue, except that it allows you to jump multiple records at a time, not just always go onto the next record. Note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. For a complete working example, see our IDBCursor example (view example live.) function advanceResult() { ...
... Recommendation Indexed Database API DraftThe definition of 'advance()' in that specification. Recommendation Browser compatibility The compatibility table on this page is generated from structured da...
Using IndexedDB - Web APIs
pat.append('<ul id="compat-list"></ul>'); COMPAT_ENVS.forEach(function(val, idx, array) { $('#compat-list').append('<li>' + val[0] + ': ' + val[1] + '</li>'); }); const DB_NAME = 'mdn-demo-indexeddb-epublications'; const DB_VERSION = 1; // Use a long long for this value (don't use a float) const DB_STORE_NAME = 'publications'; var db; // Used to keep track of which view is dis
played to avoid uselessly reloading it var current_view_pub_key; function openDb() { console.log("openDb ..."); var req = indexedDB.open(DB_NAME, DB_VERSION); req.onsuccess = function (evt) { // Equal to: db = req.result; db = this.result; console.log("openDb DONE"); }; req.onerror = function (evt) { console.error("openDb:", evt.target.errorCode); }; ...
... pub_msg.empty(); var pub_list = $('#pub-list'); pub_list.empty(); // Resetting the iframe so that it doesn't display previous content newViewerFrame(); var req; req = store.count(); // Requests are executed in the order in which they were made against the // transaction, and their results are returned in the same order. // Thus the count text below will be dis
played before the actual pub list // (not that it is algorithmically important in this case). req.onsuccess = function(evt) { pub_msg.append('<p>There are <strong>' + evt.target.result + '</strong> record(s) in the object store.</p>'); }; req.onerror = function(evt) { console.error("add error", this.error); displayActionFailure(this.error); }; ...
MediaDevices.ondevicechange - Web APIs
that contain references to the <ul> elements that are used to list the audio and video devices: let audioList = document.getElementById("audioList"); let videoList = document.getElementById("videoList"); Getting and drawing the device list Now let's take a look at updateDeviceList() itself. This method is called any time we want to fetch the current list of media devices and then update the dis
played lists of audo and video devices using that information. function updateDeviceList() { navigator.mediaDevices.enumerateDevices() .then(function(devices) { audioList.innerHTML = ""; videoList.innerHTML = ""; devices.forEach(function(device) { let elem = document.createElement("li"); let [kind, type, direction] = device.kind.match(/(\w+)(input|output)/i); elem.in...
...he array returned by String.match() to the variables kind, type, and direction. We do this because the value of MediaDeviceInfo.kind 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 dis
played in the list. Once the string is assembled, containing the device's name in bold and the direction in parentheses, it's appended 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 init...
MediaPositionState.playbackRate - Web APIs
This information can then, in turn, be used by the user agent to provide a user interface which displays media playback information to the viewer. ...
...reverse, and other controls. Syntax let positionState = { playbackRate: rate }; let playbackRate = positionState.playbackRate; Value A floating-point value specifying a multiplier corresponding to the current relative rate at which the media being performed is playing. A value of 1.0 indicates the media is playing forward at normal speed, while higher values indicate that the media is being
played faster than normal. Lower values indicate the media is being
played more slowly. Negative values can be specified to indicate the media is playing in reverse, with decreasing values then indicating faster and faster reverse playback. Note: A value of 0.0 is not permitted. Example In this example, an app is updating the browser to let it know that the user has clicked a button causing the pla...
Recording a media element - Web APIs
<h2>Preview</h2> <video id="preview" width="160" height="120" autoplay muted></video> </div> We present our main interface in two columns. On the left is a start button and a <video> element which displays the video preview; this is the video the user's camera sees. Note that the autoplay attribute is used so that as soon as the stream starts to arrive from the camera, it immediately gets dis
played, and the muted attribute is specified to ensure that the sound from the user's microphone isn't output to their speakers, causing an ugly feedback loop. <div class="right"> <div id="stopButton" class="button"> Stop </div> <h2>Recording</h2> <video id="recording" width="160" height="120" controls></video> <a id="downloadButton" class="button"> Download </a> </div> On the rig...
...here's what happens: Lines 2-4 navigator.mediaDevices.getUserMedia() is called to request a new MediaStream that has both video and audio tracks. This is the stream we'll record. Lines 5-9 When the Promise returned by getUserMedia() is resolved, the preview <video> element's srcObject property is set to be the input stream, which causes the video being captured by the user's camera to be dis
played in the preview box. Since the <video> element is muted, the audio won't play. The "Download" button's link is then set to refer to the stream as well. Then, in line 8, we arrange for preview.captureStream() to call preview.mozCaptureStream() so that our code will work on Firefox, on which the MediaRecorder.captureStream() method is prefixed. Then a new Promise which resolves when the preview vide...
msFirstPaint - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. msFirstPaint is a read-only property which gets the time when the document loaded by the window object began to be dis
played to the user. Put another way, msFirstPaint utilizes the browser to measure when the first content completes being painted in the window. It is available from javascript and can be reported from the field. This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax p = object.msFirstPaint; Value An Integer value that represents the time when the document began ...
...ser. Put another way, msFirstPaint utilizes the browser to measure when the first content completes being painted in the window. It is available from javascript and can be reported from the field. This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax p = object.msFirstPaint; Value An Integer value that represents the time when the document began to be dis
played or 0 if the document could not be loaded. The numerical value reported represents the number of milliseconds between the recorded time and midnight January 1, 1970 (UTC). This property is supported only for documents dis
played in IE9 Standards mode. Example The following example shows how to calculate the time that is required to request the document before the document begins to display for ...
PublicKeyCredentialRequestOptions.extensions - Web APIs
d Edge. Firefox does not seem to support any extension. Also Chrome doesn't plan to support any other extension in future Extension identifier Type Description appid USVString FIDO appID. An appID which was used with legacy FIDO JS APIs to identify the current relying party. txAuthSimple USVString Simple transaction authorization. This text is dis
played on a prompt of the authenticator before verifying the user or testing their presence. The client outputs a USVString which is the text as it was dis
played (line breaks may have been added). txAuthGeneric An object with two properties: contentType (USVString) content (ArrayBuffer) Generic transaction authorization. This is used to display an image or so...
...ine breaks may have been added). txAuthGeneric An object with two properties: contentType (USVString) content (ArrayBuffer) Generic transaction authorization. This is used to display an image or some non-textual content on the authenticator before verifying the user or testing their presence. The contentType gives the MIME type of the resource to be dis
played while content gives its actual content. The client outputs the hash of the content which was dis
played (hashing with the same algorithm which is used for the signature). uvi Boolean User verification index. If true, the client outputs an ArrayBuffer which contains a value uniquely identifying a user verification data record. In other words, this may be used server side to check if ...
ServiceWorkerRegistration.showNotification() - Web APIs
rameters title The title that must be shown within the notification options Optional An object that allows configuring the notification. It can have the following properties: actions: An array of actions to display in the notification. The members of the array should be an object literal. It may contain the following values: action: A DOMString identifying a user action to be dis
played on the notification. title: A DOMString containing action text to be shown to the user. icon: A USVString containing the URL of an icon to display with the action. Appropriate responses are built using event.action within the notificationclick event. badge: a USVString containing the URL of an image to represent the notification when there is not enough space to display the notif...
... representing an extra content to display within the notification. data: Arbitrary data that you want to be associated with the notification. This can be of any data type. dir : The direction of the notification; it can be auto, ltr or rtl icon: a USVString containing the URL of an image to be used as an icon by the notification. image: a USVString containing the URL of an image to be dis
played in the notification. lang: Specify the lang used within the notification. This string must be a valid BCP 47 language tag. renotify: A boolean that indicates whether to suppress vibrations and audible alerts when reusing a tag value. If options's renotify is true and options's tag is the empty string a TypeError will be thrown. The default is false. requireInteraction: Indicates that on dev...
TextTrackCue - Web APIs
TextTrackCue is an abstract class which is used as the basis for the various derived cue types, such as VTTCue; you will instead work with those derived types. These cues represent a string of text that is presented for some duration of time during the performance of a TextTrack. ...
...will be removed from the display), as well as other information. Properties This interface also inherits properties from EventTarget. TextTrackCue.track Read only The TextTrack that this cue belongs to, or null if it doesn't belong to any. TextTrackCue.id A DOMString that identifies the cue. TextTrackCue.startTime A double that represents the video time that the cue will start being dis
played, in seconds. TextTrackCue.endTime A double that represents the video time that the cue will stop being dis
played, in seconds. TextTrackCue.pauseOnExit A boolean for whether the video will pause when this cue stops being dis
played. Event handlers TextTrackCue.onenter The event handler for the enter event. TextTrackCue.onexit The event handler for the exit event. Specifications ...
VideoPlaybackQuality.totalVideoFrames - Web APIs
Essentially, this is the number of frames the element would have presented had no problems occurred. This value is reset when the media is reloaded or replaced. ...
...Essentially, this is the number of frames the element would have presented had no problems occurred. This value is reset when the media is reloaded or replaced. ...
Color masking - Web APIs
<< PreviousNext >> This WebGL example modifies random colors by applying color masking to limit the range of dis
played colors to specific shades. Masking random colors This example modifies the random color animation by applying color masking with colorMask(). You can think of the color masking operation as if looking at the colored canvas through some tinted glass or color filter. So, by masking off the blue and green channels, you are only allowing the red component of pixels to be updated, and therefore it is as if you were looking through a red tinted glass. Color masking allows us to demonstrate some basics of color theory. By masking off some channel(s), we are in fact biasing the dis
played colors towards the complementary color. So, clearly masking both blue and red, wou...
...raphics operations in WebGL are done in a certain order, where the output of each operation serves as the input of the next. So, for example, clearing operation sets the value of each pixel to the chosen clear color. Masking occurs later in the pipeline, and modifies the pixel color value, so the final result on the screen is that of the clear color, tinted by the color mask. ...
Using DTMF with WebRTC - Web APIs
notified each time a DTMF tone finishes playing. You can find the log function at the bottom of the documentation. When a tone finishes playing Each time a DTMF tone finishes playing, a tonechange event is delivered to callerPC. The event listener for these is implemented as the handleToneChangeEvent() function. function handleToneChangeEvent(event) { if (event.tone !== "") { log("Tone
played: " + event.tone); } else { log("All tones have
played. Disconnecting."); callerPC.getLocalStreams().forEach(function(stream) { stream.getTracks().forEach(function(track) { track.stop(); }); }); receiverPC.getLocalStreams().forEach(function(stream) { stream.getTracks().forEach(function(track) { track.stop(); }); }); audio.pause(); ...
...The event's tone property is a string indicating which tone just finished playing. If all tones have finished playing, tone is an empty string; when that's the case, RTCDTMFSender.toneBuffer is empty. In this example, we log to the screen which tone just finished playing. In a more advanced application, you might update the user interface, for example, t...
Lighting a WebXR setting - Web APIs
ehave. The reflected light ray's color may, of course, be altered in intensity and/or hue due to the light's interaction with the surface, but the angle is always the same. Components of a light source A light source has three major components; each component is in essence a type of light There are three kinds of light that can affect the color and brightness of objects and their pixels as dis
played on the viewer's screen or headset. A sphere with only ambient lighting. Note the total lack of any shading to indicate the depth of the sphere. Ambient light Ambient light is light that doesn't come from a defined source, but is just present throughout the scene. This light reaches every surface in the scene at the same intensity from every direction, and is then reflected equally in e...
...At the edge of the light cone, the light ceases to affect the surface at all. Computational costs of lighting To be visible, a scene must include lighting of some sort, so all or nearly all scenes will have at least one light source and may have a great many of them. Each light source substantially increases the amount of calculation needed to determine the final color and brightness of each dis
played pixel. Performing the shading for each of these light source types is more computationally demanding than the one before it; so ambient light is the least expensive to apply, followed by directional light sources, point lights, and finally spotlights. Additionally, the more accurate the lighting is designed to be, the more computationally expensive it becomes. Increased shadow detail, volumetric...
Rendering and the WebXR frame animation callback - Web APIs
draw another frame by once again calling requestAnimationFrame(). Refresh rate and frame rate Assuming you've called the XRSession method requestAnimationFrame() since the last time the screen refreshed, the browser will call your frame renderer callback every time it's ready to repaint your app or site window. ...
... will call your frame renderer callback every time it's ready to repaint your app or site window. In this context, "repaint" simply means the process of ensuring that the screen's dis
played content matches what the DOM and the elements within are trying to present at the moment. Hardare vertical refresh rate When the browser is ready to refresh the <canvas> within which your WebXR content is dis
played, it calls your frame rendering callback, which uses the specified timestamp and any other relevant data, such as models and textures, as well as application state, to render the scene--as it should appear at the specified time--into the WebGL backbuffer. When your callback returns, the browser transfers that backbuffer to the display or XR device, along with anything else that's changed since the...
Advanced techniques: Creating and sequencing audio - Web APIs
w to build such a demo from first principles, as a learning exercise. Note: You can find the source code on GitHub as step-sequencer; see the step-sequencer running live also. The interface consists of master controls, which allow us to play/stop the sequencer, and adjust the BPM (beats per minute) to speed up or slow down the "music". There are four different sounds, or voices, which can be
played. Each voice has four buttons, which represent four beats in one bar of music. When they are enabled the note will sound. When the instrument plays, it will move across this set of beats and loop the bar. Each voice also has local controls, which allow you to manipulate the effects or parameters particular to each technique we are using to create those voices. The techniques we are using are: ...
...tNote = 0; let nextNoteTime = 0.0; // when the next note is due. function nextNote() { const secondsPerBeat = 60.0 / tempo; nextNoteTime += secondsPerBeat; // Add beat length to last beat time // Advance the beat number, wrap to zero currentNote++; if (currentNote === 4) { currentNote = 0; } } We want to create a reference queue for the notes that are to be
played, and the functionality to play them using the functions we've previously created: const notesInQueue = []; function scheduleNote(beatNumber, time) { // push the note on the queue, even if we're not playing. notesInQueue.push({ note: beatNumber, time: time }); if (pads[0].querySelectorAll('button')[currentNote].getAttribute('aria-checked') === 'true') { playSweep() } ...
Window.content - Web APIs
me (privileged) code, and not available to the web anymore. Returns a Window object for the primary content window. This is useful in XUL windows that have a <browser> (or tabbrowser or <iframe>) with type="content-primary" attribute on it -- the most famous example is Firefox main window, browser.xul. In such cases, content returns a reference to the Window object for the document currently dis
played in the browser. It is a shortcut for browserRef.contentWindow. In unprivileged content (webpages), content is normally equivalent to top (except in the case of a webpage loaded in a sidebar, content still refers to the Window of the currently selected tab). Note: Some examples use _content instead of content. The former has been deprecated for a long time, and you should use content in any new...
...currently selected tab). Note: Some examples use _content instead of content. The former has been deprecated for a long time, and you should use content in any new code. Syntax var windowObject = window.content; Example Executing the following code in a chrome XUL window with a <browser type="content-primary"/> element in it draws a red border around the first div on the page currently dis
played in the browser: content.document.getElementsByTagName("div")[0].style.border = "solid red 1px"; Specification None. See also Working with windows in chrome code When accessing content documents from privileged code, be aware of XPCNativeWrappers. ...
Privileged features - Web APIs
ileges. titlebar By default, all new secondary windows have a titlebar. If set to no or 0, this feature removes the titlebar from the new secondary window. Mozilla and Firefox users can force new windows to always render the titlebar by setting dom.disable_window_open_feature.titlebar to true in about:config or in their user.js file. alwaysRaised If on, the new window will always be dis
played on top of other browser windows, regardless of whether it is active or not. alwaysLowered If on, the new created window floats below, under its own parent when the parent window is not minimized. alwaysLowered windows are often referred as pop-under windows. The alwaysLowered window can not be on top of the parent but the parent window can be minimized. In NS 6.x, the alwaysLowered window has n...
...oats below, under its own parent when the parent window is not minimized. alwaysLowered windows are often referred as pop-under windows. The alwaysLowered window can not be on top of the parent but the parent window can be minimized. In NS 6.x, the alwaysLowered window has no minimize system command icon and no restore/maximize system command. alwaysOnTop If on, the new window will always be dis
played on top of all other windows (browser windows and otherwise), regardless of whether it is active or not. This was added in Firefox 66 (see bug 1519893). z-lock Same as alwaysLowered. close When set to no or 0, this feature removes the system close command icon and system close menu item. It will only work for dialog windows (dialog feature set). close=no will override minimizable=yes. Mozilla...
Window.scroll() - Web APIs
- or - options is a ScrollToOptions dictionary. ...
... - or - options is a ScrollToOptions dictionary. ...
Understandable - Accessibility
e 3.2.1 On Focus (A) When a control or other page feature receives focus, it should not change the context in a way that may confuse or disorientate the user. This is a matter of sensible design -- people don't want interfaces to surprise them; they want things to be intuitive and behave as expected. For example, focusing a navigation menu option should not change the dis
played page -- it should be activated before the display changes. GlobalEventHandlers.onfocus contains some useful information. Also see Building keyboard accessibility back in for some useful implementation ideas. 3.2.2 On Input (A) When data is inputted into a control, or a setting is changed, context should not be changed unexpectedly. The user should be warned/advised of the ...
...s doing so would cause a security issue (e.g. when entering a password) or context problem (e.g. they are trying to answer a question in a quiz app). In such cases, when this is appropriate, you'll probably use a combination of JavaScript and server-side functionality to check if the entry is correct, and if not, what viable suggestions can be given to the user. Such suggestions should be dis
played usefully in context, just like error messages (see 3.3.1). No tutorial suggestions yet. 3.3.4 Error Prevention (Legal, Financial, Data) (AA) In the case of forms involved with entry of sensitive data (such as legal agreements, e-commerce transactions, or personal data), at least one of the following should be true: Submissions are reversible. Data is checke...
-moz-force-broken-image-icon - CSS: Cascading Style Sheets
S property can be used to force the broken image icon to be shown even when a broken image has an alt attribute. 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 dis
played, alongside the broken image icon. Formal definition Initial value0Applies toimagesInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <integer> Examples HTML <img src='/broken/image/link.png' alt='Broken image link'> CSS img { -moz-force-broken-image-icon: 1; height: 100px; width: 100px; } Result ScreenshotLive sample Note: Unless the image has a specified ...
... Notes This property will only work in Gecko-based browsers. The use of this property is not recommended. A proper alt attribute should be used instead. Specifications Not part of any standard. ...
-ms-high-contrast - CSS: Cascading Style Sheets
High Contrast Mode is a specialized display mode that prioritizes making content as legible as possible by dynamically replacing foreground and background colors with a user-specified theme. For web content, theme colors are mapped to content types. This media feature applies to bitmap media types. It does not accept min/max prefixes. Syntax The -ms-high-contrast media feature is specified as one of the following values. Values none ... ...
...rules will be applied when the system is placed in high contrast mode with a black-on-white color variation. white-on-black Indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with a white-on-black color variation. Formal syntax Syntax not found in DB! Examples The following declarations will match applications that are being dis
played in high contrast mode with any color variation, a black-on-white color variation, and a white-on-black color variation, respectively. @media screen and (-ms-high-contrast: active) { /* All high contrast styling rules */ } @media screen and (-ms-high-contrast: black-on-white) { div { background-image: url('image-bw.png'); } } @media screen and (-ms-high-contrast: white-on-black) { div { bac...
inverted-colors - CSS: Cascading Style Sheets
Examples HTML <p>If you're using inverted colors, this text should be blue on white (the inverse of yellow on black). ...
... Examples HTML <p>If you're using inverted colors, this text should be blue on white (the inverse of yellow on black). ...
CSS Box Alignment - CSS: Cascading Style Sheets
baseline by adding a margin outside the boxes. Self alignment is when using justify-self or align-self, or when setting these values as a group with justify-items and align-items. Distributed alignment The distributed alignment keywords are used with the align-content and justify-content properties. These keywords define what happens to any additional space after alignment subjects have been dis
played. The values are as follows: stretch space-between space-around space-evenly For example, in Flex Layout items are aligned with flex-start initially. Working in a horizontal top to bottom writing mode such as English, with flex-direction as row the items start on the far left and any available space after displaying the items is placed after the items. If you set justify-content: space-...
...nd some browsers only support these prefixed versions. grid-row-gap grid-column-gap grid-gap The prefixed versions will be maintained as an alias of the unprefixed ones, however you can always double up in the way that you would with vendor prefixes, adding the grid-gap property and then the gap property with the same values. Also, be aware that other things may increase the visual gap dis
played, for example using the space distribution keywords or adding margins to items. Pages detailing individual alignment properties As the CSS box alignment properties are implemented differently depending on the specification they interact with, refer to the following pages for each layout type for details of how to use the alignment properties with it: Box alignment in Flexbox Box alignment in...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
he outer display type of those methods being block. Changing the Formatting Context an element participates in Browsers display items as part of a block or inline formatting context in terms of what normally makes sense for that element. For example, a <strong> element is used to highlight a word and displays bold in browsers. It would not generally make sense for that <strong> element to be dis
played as a block level element, breaking onto a new line. If you did want all <strong> elements to display as block elements, you could do so by setting display: block on <strong>. This means that you can always use most of the semantic HTML elements to markup your content, and then change the way it displays using CSS. Summary In this guide, we have looked at how elements display in normal flow, a...
...lays using CSS. Summary In this guide, we have looked at how elements display in normal flow, as block and inline elements. Due to the default behaviour of these elements, an HTML document with no CSS styling at all, will display in a readable way. By understanding how normal flow works you will find layout easier, as you understand the starting point for making changes to how elements are dis
played. See Also CSS Basic Box Model Normal Flow - Learn Layout Inline elements Block-level elements ...
CSS Flow Layout - CSS: Cascading Style Sheets
Block elements display one after the other, as paragraphs do in the Writing Mode of that document. ...
...Block elements display one after the other, as paragraphs do in the Writing Mode of that document. In English therefore, inline elements display one after the other, starting on the left, and block elements start at the top and move down the page. ...
Using Media Queries for Accessibility - CSS: Cascading Style Sheets
This will help not only users with low vision and contrast sensitivity issues but also users that are working on a computer or phone with direct sunlight. Syntax The -ms-high-contrast media feature is specified as one of the following values. Values active Indicates that the subsequent styling rules will be applied when the system is...
... Indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with a black-on-white color variation. white-on-black Indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with a white-on-black color variation. Example The following declarations will match applications that are being dis
played in high contrast mode with any color variation, a black-on-white color variation, and a white-on-black color variation, respectively. @media screen and (-ms-high-contrast: active) { /* All high contrast styling rules */ } @media screen and (-ms-high-contrast: black-on-white) { div { background-image: url('image-bw.png'); } } @media screen and (-ms-high-contrast: white-on-black) { div { bac...
image() - CSS: Cascading Style Sheets
elf or inheriting the directionality from an ancestor or default value for the page -- the image will be used as-is. List items with dir="rtl" set on the <li> or inheriting the right-to-left directionality from an ancestor, such as documents set to Arabic or Hebrew, will have the bullet display on the right, horizontally flippled, as if transform: scalex(-1) had been set. The text will also be dis
played left-to-right. Displaying a section of the background image <div class="box">Hover over me. What cursor do you see?</div> .box:hover { cursor: image("https://mdn.mozillademos.org/files/16411/sprite.png#xywh=32,64,16,16"); } When the user hovers over the box, the cursor will change to display the 16x16 px section of the sprite image, starting at x=32 and y=64. Providing fallback images...
...32,64,16,16"); } When the user hovers over the box, the cursor will change to display the 16x16 px section of the sprite image, starting at x=32 and y=64. Providing fallback images .help::before { content: image("try.webp", "try.svg", "try.gif"); } In this example, the browser will display an image as generated content before the content of the element with the class of help. The image dis
played will be a WebP image, if WebP is supported. If not, the SVG example will be shown. If SVG is not supported, the GIF version will display. Putting color on top of a background image .quarterlogo {height: 200px; width: 200px; border: 1px solid;} .quarterlogo { background-image: image(rgba(0, 0, 0, 0.25)), url("https://mdn.mozillademos.org/files/12053/firefox.png"); background-s...
Event reference
Mouse events Event Name Fired When auxclick A pointing device button (ANY non-primary button) has been pressed and released on an element. click A pointing device button (ANY button; soon to be primary button only) has been pressed and released on an element. contextmenu The right button of the mouse is clicked (before the context menu is dis
played). dblclick A pointing device button is clicked twice on an element. mousedown A pointing device button is pressed on an element. mouseenter A pointing device is moved onto the element that has the listener attached. mouseleave A pointing device is moved off the element that has the listener attached. mousemove A pointing device is moved ...
...t DOM L3 The composition of a passage of text is prepared (similar to keydown for a keyboard input, but works with other inputs such as speech recognition). compositionupdate CompositionEvent DOM L3 A character is added to a passage of text being composed. contextmenu MouseEvent HTML5 The right button of the mouse is clicked (before the context menu is dis
played). copy ClipboardEvent Clipboard The text selection has been added to the clipboard. cut ClipboardEvent Clipboard The text selection has been removed from the document and added to the clipboard. dblclick MouseEvent DOM L3 A pointing device button is clicked twice on an element. devicechange Event Media Capture and Streams ...
Cross-browser audio basics - Developer guides
c and type. src contains the path to the audio file to be loaded (relative or absolute). type is used to inform the browser of the file type. If omitted, most browsers will attempt to guess this from the file extension. If the <audio> element is not supported then <audio> and <source> will be ignored. However any supported text or elements that you define within <audio> will be dis
played or acted upon. So the ideal place to create a fallback or inform of incompatibility is before the closing </audio> tag. In this case, we've provided a simple paragraph including a link to download the audio directly. The controls attribute on the <audio> element is specified when we require the browser to provide us with default playback controls. If you don't specify this attribute, no controls...
... the media is downloading }); canplay canplay is a useful event to detect should you want to determine whether the media is ready to play. You could, for example, disable custom controls until this event occurs. myAudio.addEventListener("canplay", function() { //audio is ready to play }); canplaythrough canplaythrough is similar to canplay but it lets you know that the media is ready to be
played all the way through (that is to say that the file has completely downloaded, or it is estimated that it will download in time so that buffering stops do not occur). myAudio.addEventListener("canplaythrough", function() { //audio is ready to play all the way through }); Media loading event order To recap, the order of the media loading events are: loadstart > durationchange > loadedmetadata ...
Media events - Developer guides
edded in HTML documents using the <audio> and <video> elements; this section lists them and provides some helpful information about using them. Event name Description abort Sent when playback is aborted; for example, if the media is playing and is restarted from the beginning, this event is sent. canplay Sent when enough data is available that the media can be
played, at least for a couple of frames. This corresponds to the HAVE_FUTURE_DATA readyState. canplaythrough Sent when the readyState changes to HAVE_ENOUGH_DATA, indicating that the entire media can be
played without interruption, assuming the download rate remains at least at the current level. It will also be fired when playback is toggled between paused and playing. Note: Manually setti...
...ished loading. loadedmetadata The media's metadata has finished loading; all attributes now contain as much useful information as they're going to. loadstart Sent when loading of the media begins. mozaudioavailable Sent when an audio buffer is provided to the audio layer for processing; the buffer contains raw audio samples that may or may not already have been
played by the time you receive the event. pause Sent when the playback state is changed to paused (paused property is true). play Sent when the playback state is no longer paused, as a result of the play method, or the autoplay attribute. playing Sent when the media has enough data to start playing, after the play event, but also when recovering from being stalled, wh...
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
ends). border-inline-start-color and border-inline-end-color These let you color the edges of the border closest to to the beginning and the end of the start of lines of text within the box. Which side this is will vary depending on the writing-mode, direction, and text-orientation properties, which are typically (but not always) used to adjust text directionality based on the language being dis
played. For example, if the box's text is being rendered right-to-left, then the border-inline-start-color is applied to the right side of the border. Other ways to use color CSS isn't the only web technology that supports color. There are graphics technologies that are available on the web which also support color. The HTML Canvas API Lets you draw 2D bitmapped graphics in a <canvas> element. Se...
... the value of its type attribute. The <input> element represents a color only in the hexadecimal string notation covered above. Example: Picking a color Let's look at a simple example, in which the user can choose a color. As the user adjusts the color, the border around the example changes to reflect the new color. After finishing up and picking the final color, the color picker's value is dis
played. On macOS, you indicate that you've finalized selection of the color by closing the color picker window. HTML The HTML here creates a box that contains a color picker control (with a label created using the <label> element) and an empty paragraph element (<p>) into which we'll output some text from our JavaScript code. <div id="box"> <label for="colorPicker">Border color:</label> <inp...
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
n the text and the <mark> element represents text of certain relevance. The <b> element doesn't convey such special semantic information; use it only when no others fit. Similarly, do not mark titles and headings using the <b> element. For this purpose, use the <h1> to <h6> tags. Further, stylesheets can change the default style of these elements, with the result that they are not necessarily dis
played in bold. It is a good practice to use the class attribute on the <b> element in order to convey additional semantic information as needed (for example <b class="lead"> for the first sentence in a paragraph). This makes it easier to manage multiple use cases of <b> if your stylistic needs change, without the need to change all of its uses in the HTML. Historically, the <b> element was meant to m...
... so the meaning of the <b> element has been changed. If there is no semantic purpose to using the <b> element, you should use the CSS font-weight property with the value "bold" instead in order to make text bold. Examples <p> This article describes several <b class="keywords">text-level</b> elements. It explains their usage in an <b class="keywords">HTML</b> document. </p> Keywords are dis
played with the default style of the <b>element, likely in bold.</b> Result Specifications Specification Status Comment HTML Living StandardThe definition of '<b>' in that specification. Living Standard HTML5The definition of '<b>' in that specification. Recommendation HTML 4.01 SpecificationThe definition of '<b>' in that specification. ...
<frame> - HTML: Hypertext Markup Language
name This attribute is used for labeling frames. Without labeling, every link will open in the frame that it's in - the closest parent frame. ...
... used within a <frameset>. Using the <frame> element is not encouraged because of certain disadvantages such as performance problems and lack of accessibility for users with screen readers. Instead of the <frame> element, <iframe> may be preferred. Attributes Like all other HTML elements, this element supports the global attributes. src This attribute specifies the document that will be dis
played by the frame. name This attribute is used for labeling frames. Without labeling, every link will open in the frame that it's in - the closest parent frame. See the target attribute for more information. noresize This attribute prevents resizing of frames by users. scrolling This attribute defines the existence of a scrollbar. If this attribute is not used, the browser adds a scrollbar when ...
<input type="date"> - HTML: Hypertext Markup Language
AsNumber. Methods select(), stepDown(), stepUp() Value A DOMString representing the date entered in the input. The date is formatted according to ISO8601, described in Format of a valid date string in Date and time formats used in HTML. You can set a default value for the input with a date inside the value attribute, like so: <input type="date" value="2017-06-01"> The dis
played date format will differ from the actual value -- the dis
played date is formatted based on the locale of the user's browser, but the parsed value is always formatted yyyy-mm-dd. You can get and set the date value in JavaScript with the input element's value and valueAsNumber properties. For example: var dateControl = document.querySelector('input[type="date"]'); dateControl.value = '2017-06-01'...
...see Setting maximum and minimum dates), supporting browsers will display an error if you try to submit a date that is out of bounds. However, you'll need to double-check the submitted results to ensure the value is within these dates, if the date picker isn't fully supported on the user's device. You can also use the required attribute to make filling in the date mandatory -- an error will be dis
played if you try to submit an empty date field. This should work in most browsers, even if they fall back to a text input. Let's look at an example of minimum and maximum dates, and also made a field required: <form> <label> Choose your preferred party date (required, April 1st to 20th): <input type="date" name="party" min="2017-04-01" max="2017-04-20" required> <span class="validity"><...
<input type="email"> - HTML: Hypertext Markup Language
org you@example.org" Placeholders Sometimes it's helpful to offer an in-context hint as to what form the input data should take. This can be especially important if the page design doesn't offer descriptive labels for each <input>. This is where placeholders come in. A placeholder is a value that demonstrates the form the value should take by presenting an example of a valid value, which is dis
played inside the edit box when the element's value is "". Once data is entered into the box, the placeholder disappears; if the box is emptied, the placeholder reappears. Here, we have an email input with the placeholder sophie@example.com. Note how the placeholder disappears and reappears as you manipulate the contents of the edit field. <input type="email" placeholder="sophie@example.com"> Contr...
...e wind up with a validation which says "make sure this resembles a valid e-mail address, and if it is, make sure it's also a beststartupever.com address." It's advisable to use the title attribute along with pattern. If you do, the title must describe the pattern. That is, it should explain what format the data should take on, rather than any other information. That's because the title may be dis
played or spoken as part of a validation error message. For example, the browser might present the message "The entered text doesn't match the required pattern." followed by your specified title. If your title is something like "E-mail address", the result would be the message "The entered text doesn't match the required pattern. E-mail address", which isn't very good. That's why, instead, we specify t...
<input type="search"> - HTML: Hypertext Markup Language
ue of the field. WebKit and Blink only (Safari, Chrome, Opera, etc.). mozactionhint A string indicating the type of action that will be taken when the user presses the Enter or Return key while editing the field; this is used to determine an appropriate label for that key on a virtual keyboard. Firefox for Android only. results The maximum number of items that should be dis
played in the drop-down list of previous search queries. Safari only. autocorrect A Safari extension, the autocorrect attribute is a string which indicates whether or not to activate automatic correction while the user is editing this field. Permitted values are: on Enable automatic correction of typos, as well as processing of text substitutions if any are configured. off Disable automa...
...erkeyhint, but is not yet widely implemented. To see the status of the change being implemented in Firefox, see bug 1490661. Permitted values are: go, done, next, search, and send. The browser decides, using this hint, what label to put on the enter key. results The results attribute--supported only by Safari--is a numeric value that lets you override the maximum number of entries to be dis
played 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 intended for handling search t...
<input type="url"> - HTML: Hypertext Markup Language
escaped as necessary. Placeholders Sometimes it's helpful to offer an in-context hint as to what form the input data should take. This can be especially important if the page design doesn't offer descriptive labels for each <input>. This is where placeholders come in. A placeholder is a value that demonstrates the form the value should take by presenting an example of a valid value, which is dis
played inside the edit box when the element's value is "". Once data is entered into the box, the placeholder disappears; if the box is emptied, the placeholder reappears. Here, we have a url input with the placeholder http://www.example.com. Note how the placeholder disappears and reappears as you manipulate the contents of the edit field. <input id="myURL" name="myURL" type="url" placeholder=...
...a validation which says "make sure this is a valid URL, and also in a Myco domain." This isn't perfect, but it is good enough for this simple demo's requirements. It's advisable to use the title attribute along with pattern. If you do, the title must describe the pattern; it should explain what format the data should take on, rather than any other information. That's because the title may be dis
played or spoken as part of a validation error message. For example, the browser might present the message "The entered text doesn't match the required pattern." followed by your specified title. If your title is something like "URL", the result would be the message "The entered text doesn't match the required pattern. URL", which is not a good user experience. That's why, instead, we specify the strin...
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
g keystrokes within an input below. Nesting a <kbd> element inside a <samp> element represents input that has been echoed back to the user by the system. See Echoed input, below, for an example. Nesting a <samp> element inside a <kbd> element, on the other hand, represents input which is based on text presented by the system, such as the names of menus and menu items, or the names of buttons dis
played on the screen. See the example under Representing onscreen input options below. You can define a custom style to override the browser's default font selection for the <kbd> element, although the user's preferences may potentially override your CSS. Examples Basic example <p>Use the command <kbd>help mycommand</kbd> to view documentation for the command "mycommand".</p> Representing key...
... For example, you can explain how to choose the "New Document" option in the "File" menu using HTML that looks like this: <p>To create a new file, choose the menu option <kbd><kbd><samp>File</samp></kbd>=><kbd><samp>New Document</samp></kbd></kbd>.</p> <p>Don't forget to click the <kbd><samp>OK</samp></kbd> button to confirm once you've entered the name of the new file.</p> This...
<tr>: The Table Row element - HTML: Hypertext Markup Language
tribute is ignored. This attribute is not only obsolete, but was rarely implemented anyway. To achieve the same effect as the char attribute, set the CSS text-align property to the same string you would specify for the char property, such as text-align: ".". charoffObsolete since HTML5 A DOMString indicating the number of characters on the tail end of the column's data should be dis
played after the alignment character specified by the char attribute. For example, when displaying money values for currencies that use hundredths of a unit (such as the dollar, which is divided into 100 cents), you would typically specify a value of 2, so that in tandem with char being set to ".", the values in a column would be cleanly aligned on the decimal points, with the number of cents properly d...
...fter the alignment character specified by the char attribute. For example, when displaying money values for currencies that use hundredths of a unit (such as the dollar, which is divided into 100 cents), you would typically specify a value of 2, so that in tandem with char being set to ".", the values in a column would be cleanly aligned on the decimal points, with the number of cents properly dis
played to the right of the decimal point. This attribute is obsolete, and was never widely supported anyway. valignObsolete since HTML5 A DOMString specifying the vertical alignment of the text within each cell in the row. Possible values for this attribute are: baseline Aligns each cell's content text as closely as possible to the bottom of the cell, handling alignment of differen...
Inline elements - HTML: Hypertext Markup Language
</span>; its background has been colored to display both the beginning and end of the inline element's influence.</div> In this example, the <div> block-level element contains some text. Within that text is a <span> element, which is an inline element. ...
... Chan...
X-Frame-Options - HTTP
ptions: SAMEORIGIN Directives If you specify DENY, not only will attempts to load the page in a frame fail when loaded from other sites, attempts to do so will fail when loaded from the same site. On the other hand, if you specify SAMEORIGIN, you can still use the page in a frame as long as the site including it in a frame is the same as the one serving the page. DENY The page cannot be dis
played in a frame, regardless of the site attempting to do so. SAMEORIGIN The page can only be dis
played in a frame on the same origin as the page itself. The spec leaves it up to browser vendors to decide whether this option applies to the top level, the parent, or the whole chain, although it is argued that the option is not very useful unless all ancestors are also in the same origin (see bug 72549...
...r this option applies to the top level, the parent, or the whole chain, although it is argued that the option is not very useful unless all ancestors are also in the same origin (see bug 725490). Also see Browser compatibility for support details. ALLOW-FROM uri This is an obsolete directive that no longer works in modern browsers. Don't use it. In supporting legacy browsers, a page can be dis
played in a frame only on the specified origin uri. Note that in the legacy Firefox implementation this still suffered from the same problem as SAMEORIGIN did -- it doesn't check the frame ancestors to see if they are in the same origin. The Content-Security-Policy HTTP header has a frame-ancestors directive which you can use instead. Examples Note: Setting X-Frame-Options inside the <meta> element...
short_name - Web app manifests
Type String Mandatory No The short_name member is a string that represents the name of the web application dis
played to the user if there is not enough space to display name (e.g., as a label for an icon on the phone home screen). short_name is directionality-capable, which means it can be dis
played left-to-right or right-to-left based on the value of the dir and lang manifest members. ...
...enough space to display name (e.g., as a label for an icon on the phone home screen). short_name is directionality-capable, which means it can be dis
played left-to-right or right-to-left based on the value of the dir and lang manifest members. Examples Simple short_name in left-to-right language: "name": "Awesome application", "short_name": "Awesome app" short_name in Arabic, which will be dis
played right-to-left: "dir": "rtl", "lang": "ar", "name": "????? ????", "short_name": "????" Specification Specification Status Comment Feedback Web App ManifestThe definition of 'short_name' in that specification. Working Draft Initial definition. Web App Manifest Working Group drafts ...
MathML attribute reference - MathML
ment pages for details). Unimplemented alignmentscope <mtable> A Boolean value specifying whether table columns should act as alignment scopes or not. Unimplemented altimg altimg-width altimg-height altimg-valign alttext <math> Visual and textual fall-back options. bevelled <mfrac> Specifies the style how the fraction should be dis
played. Deprecated. Use U+2044 (fraction slash) instead. Unimplemented charalign <mstack> Specifies the horizontal alignment of digits. close <mfenced> A string for the closing delimiter. columnalign <mtable>, <mtd>, <mtr>, <mlabeledtr> Specifies the horizontal alignment of table cells. columnlines <mtable> Specifies table column borders. ...
...ements the depth. See length. dir <math>, <mi>, <mo>, <mrow>, <ms>, <mtext> The text direction. Possible values are either ltr (left to right) or rtl (right to left). display <math> Specifies the rendering mode. The values block and inline are allowed. displaystyle <mstyle>, <mtable> A Boolean value specifying whether more vertical space is used for dis
played equations or, if set to false, a more compact layout is used to display formulas. Unimplemented edge <malignmark> Unimplemented equalcolumns <mtable> A Boolean value indicating whether to force all columns to have the same total height. Unimplemented equalrows <mtable> A Boolean value indicating whether to force all rows to have the same total height.
<mfrac> - MathML
Otherwise, if set to false (which is the default value), numerator and denominator are on top of each other. This attribute is deprecated and will be removed in the future. Use U+2044 (fraction slash) instead. class, id, style Provided for use with stylesheets. ...
...Otherwise, if set to false (which is the default value), numerator and denominator are on top of each other. This attribute is deprecated and will be removed in the future. Use U+2044 (fraction slash) instead. class, id, style Provided for use with stylesheets. ...
MathML documentation index - MathML
or more operators with their respective operands (such as <mi> and <mn>). This element renders as a horizontal row containing its arguments. 27 <ms> MathML, MathML Reference, MathML:Element, MathML:Token Elements The MathML <ms> element represents a string literal meant to be interpreted by programming languages and computer algebra systems. By default, string literals are dis
played as enclosed by double quotes ("); by using the lquote and rquote attributes, you can set custom characters to display. Note that quotation marks should not be specified unless they are part of the string literal. The content of an <ms> element is not an ASCII string per se, but rather a sequence of characters and <mglyph> and <malignmark> elements. 28 <mspace> MathML, MathML R...
... <malignmark> elements. 28 <mspace> MathML, MathML Reference, MathML:Element, MathML:Token Elements The MathML <mspace> element is used to display a blank space, whose size is set by its attributes. 29 <msqrt> MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The MathML <msqrt> element is used to display square roots (no index is dis
played). The square root accepts only one argument, which leads to the following syntax: <msqrt> base </msqrt>. 30 <mstyle> MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The MathML <mstyle> element is used change the style of its children. It accepts all attributes of all MathML presentation elements with some exceptions and additional attributes listed be...
Web video codec guide - Web media technologies
1.79 TB (that is, 1790 GB). Not only is the required storage space enormous, but the network bandwidth needed to transmit an uncompressed video like that would be enormous, at 249 MB/sec--not including audio and overhead. This is where video codecs come in. Just as audio codecs do for the sound data, video codecs compress the video data and encode it into a format that can later be decoded and
played back or edited. Most video codecs are lossy, in that the decoded video does not precisely match the source. Some details may be lost; the amount of loss depends on the codec and how it's configured, but as a general rule, the more compression you achieve, the more loss of detail and fidelity will occur. Some lossless codecs do exist, but they are typically used for archival and storage for local...
...g software you use. The documentation included with your encoding software will help you to understand the specific impact of these options on the encoded video. Compression artifacts Artifacts are side effects of a lossy encoding process in which the lost or rearranged data results in visibly negative effects. Once an artifact has appeared, it may linger for a while, because of how video is dis
played. Each frame of video is presented by applying a set of changes to the currently-visible frame. This means that any errors or artifacts will compound over time, resulting in glitches or otherwise strange or unexpected deviations in the image that linger for a time. To resolve this, and to improve seek time through the video data, periodic key frames (also known as intra-frames or i-frames) are pl...
Installing and uninstalling web apps - Progressive web apps (PWAs)
face will be available to let you install the site as a web app. The UI for this varies from browser to browser, but the general idea is the same. Unfortunately, there isn't a standard for icons and symbols used for operations such as this. Firefox for Android On an Android device using Firefox, you'll see a "home" icon with a plus (+) icon inside it--this is the "Add to Home screen" icon dis
played for any site that has the necessary features in place. Tapping this will show a confirmation banner--pressing the banner's big "+ ADD TO HOME SCREEN" button completes the action, adding the app to the Home screen. Note that in Android 8 and higher, a system-level "Add to Home screen" permission dialog will be shown first. Samsung Internet Browser If you have Samsung Internet in your mobile...
...port for web applications, including support for the add to home screen feature. To add a web app to the home screen (also known as the launcher or springboard), tap the sharing button () at the bottom of the screen: This calls up the sharing panel. Among the options should be the "Add to Home Screen" option, unless it's been specifically removed from the list by the user editing the optons dis
played: Choosing "Add to Home Screen" here presents the confirmation dialog box, which not only confirms that the user wants to add the app to the home screen, but also lets the user customize its name. Upon clicking "Add," the app is included on the home screen. The installed web application Regardless of which browser and device you're using, when you choose to add the app to your home screen ...
display - SVG: Scalable Vector Graphics
will prevent the given child element from contributing to the clipping path. Note: As a presentation attribute, display can be used as a CSS property. See css display for further information. As a presentation attribute, it can be applied to any element. ...
...n. As a presentation attribute, it can be applied to any element. ...
operator - SVG: Scalable Vector Graphics
graphic defined in the in2 attribute. in This value indicates that the parts of the source graphic defined in the in attribute that overlap the destination graphic defined in the in2 attribute, replace the destination graphic. out This value indicates that the parts of the source graphic defined in the in attribute that fall outside the destination graphic defined in the in2 attribute, are dis
played. atop This value indicates that the parts of the source graphic defined in the in attribute, which overlap the destination graphic defined in the in2 attribute, replace the destination graphic. The parts of the destination graphic that do not overlap with the source graphic stay untouched. xor This value indicates that the non-overlapping regions of the source graphic defined in the in at...
...that do not overlap with the source graphic stay untouched. xor This value indicates that the non-overlapping regions of the source graphic defined in the in attribute and the destination graphic defined in the in2 attribute are combined. lighter This value indicates that the sum of the source graphic defined in the in attribute and the destination graphic defined in the in2 attribute is dis
played. arithmetic This value indicates that the source graphic defined in the in attribute and the destination graphic defined in the in2 attribute are combined using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 where: i1 and i2 indicate the corresponding pixel channel values of the input image, which map to in and in2 respectively, and k1,k2,k3,and k4 indicate the values of ...
<svg> - SVG: Scalable Vector Graphics
g> ; Default value: none; Animatable: no contentScriptType Deprecated since SVG 2 The default scripting language used by the SVG fragment. Value type: <string> ; Default value: application/ecmascript; Animatable: no contentStyleType Deprecated since SVG 2 The default style sheet language used by the SVG fragment. Value type: <string> ; Default value: text/css; Animatable: no height The dis
played height of the rectangular viewport. (Not the height of its coordinate system.) Value type: <length>|<percentage> ; Default value: auto; Animatable: yes preserveAspectRatio How the svg fragment must be deformed if it is dis
played with a different aspect ratio. Value type: (none| xMinYMin| xMidYMin| xMaxYMin| xMinYMid| xMidYMid| xMaxYMid| xMinYMax| xMidYMax| xMaxYMax) (meet|slice)? ; Default va...
...ax| xMidYMax| xMaxYMax) (meet|slice)? ; Default value: xMidYMid meet; Animatable: yes version Deprecated since SVG 2 Which version of SVG is used for the inner content of the element. Value type: <number> ; Default value: none; Animatable: no viewBox The SVG viewport coordinates for the current SVG fragment. Value type: <list-of-numbers> ; Default value: none; Animatable: yes width The dis
played width of the rectangular viewport. (Not the width of its coordinate system.) Value type: <length>|<percentage> ; Default value: auto; Animatable: yes x The dis
played x coordinate of the svg container. No effect on outermost svg elements. Value type: <length>|<percentage> ; Default value: 0; Animatable: yes y The dis
played y coordinate of the svg container. No effect on outermost svg element...
Specification Deviations - SVG: Scalable Vector Graphics
yle' and 'class' attributes on all SVG elements. Nevertheless, to allow Mozilla to more cleanly share internal 'class' and 'style' related code, we will implement these attributes on all SVG elements as of Firefox 3. In general this change will not be visible to SVG authors (the elements for which the SVG specification does not define the 'class' and 'style' attribute are elements that are not dis
played directly). However, there are two exceptions. Extending the 'class' attribute to apply to all SVG elements will allow SVG authors to use the Selectors API to select any SVG element based on class. This seems like a good thing. Requiring SVG authors to know which elements can and cannot take a 'class' attribute would just put an extra burden on them. Extending the 'style' attribute to apply to all...
...ass. This seems like a good thing. Requiring SVG authors to know which elements can and cannot take a 'class' attribute would just put an extra burden on them. Extending the 'style' attribute to apply to all SVG elements should only really be visible to SVG authors if they call ViewCSS.getComputedStyle on the element or one of its descendants. Since these elements and their descendants are not dis
played, it seems unlikely that anyone will either specify 'style' or call getComputedStyle on them. Note that this extension does not mean that we add a css::CSSStyleDeclaration 'style' property to the DOM of elements that do not implement the SVGStylable interface. ...
Web Components
ed "shadow" DOM tree to an element -- which is rendered separately from the main document DOM -- and controlling associated functionality. In this way, you can keep an element's features private, so they can be scripted and styled without the fear of collision with other parts of the document. HTML templates: The <template> and <slot> elements enable you to write markup templates that are not dis
played in the rendered page. These can then be reused multiple times as the basis of a custom element's structure. The basic approach for implementing a web component generally looks something like this: Create a class in which you specify your web component functionality, using the ECMAScript 2015 class syntax (see Classes for more information). Register your new custom element using the CustomE...
...M boundary into the standard DOM (true), or not (false). Event.composedPath: Returns the event's path (objects on which listeners will be invoked). This does not include nodes in shadow trees if the shadow root was created with ShadowRoot.mode closed. HTML templates <template> Contains an HTML fragment that is not rendered when a containing document is initially loaded, but can be dis
played at runtime using JavaScript, mainly used as the basis of custom element structures. The associated DOM interface is HTMLTemplateElement. <slot> A placeholder inside a web component that you can fill with your own markup, which lets you create separate DOM trees and present them together. The associated DOM interface is HTMLSlotElement. The slot global HTML attribute Assigns a slot in a shadow...
Content Scripts - Archive of obsolete content
me exact page, it is possible for the content scripts to communicate directly to each other using the DOM postMessage() API or a CustomEvent. The following add-on shows a content script added by page-mod receiving a CustomEvent sent from a context-menu item when the context menu item is clicked. The page-mod script will then issue an alert with the URL of the link on which the context menu was dis
played. The URL is passed to the page-mod script in the CustomEvent. var pageMod = require("sdk/page-mod"); pageMod.PageMod({ include: "*.mozilla.org", contentScript: 'function contextMenuAlert(href) {' + ' window.alert("The context menu was clicked on URL:\\n" + href);' + '};' + 'window.addEventListener("myAddonId-contextMenu-clicked",' ...
Porting the Library Detector - Archive of obsolete content
This means we'll need two additional content scripts: one in the widget's context, which listens for icon mouseover events and sends a message to main.js containing the name of the corresponding library: function setLibraryInfo(element) { self.port.emit('setL...
SDK API Lifecycle - Archive of obsolete content
. If we do have to make backwards-incompatible changes, we will go through the formal deprecation process. Deprecated We plan to change this module, and backwards compatibility should not be expected. Don't start using it, and plan to migrate away from this module to its replacement. The stability index for each module is written into that module's metadata structure, and is dis
played at the top of each module's documentation page. Deprecation Process Deprecation In the chosen release, the SDK team will communicate the module's deprecation: update the module's stability index to be "deprecated" include a deprecation notice in the release notes, the Add-ons blog, and the Jetpack Google group. The deprecation notice should point developers at a migration guide. Migratio...
context-menu - Archive of obsolete content
ever need to manually remove your items from the menu unless you want them to never appear again. For example, if your add-on needs to add a context menu item whenever the user visits a certain page, don't create the item when that page loads, and don't remove it when the page unloads. Rather, create your item only once and supply a context that matches the target URL. Context menu items are dis
played in the order created or in the case of sub menus the order added to the sub menu. Menu items for each add-on will be grouped together automatically. If the total number of menu items in the main context menu from all add-ons exceeds a certain number (normally 10 but configurable with the extensions.addon-sdk.context-menu.overflowThreshold preference) all of the menu items will instead appear in a...
page-worker - Archive of obsolete content
d of jsonable value (object, array, string, etc.) can be used here. Optional. onMessage function Use this to add a listener to the page worker's message event. Page A Page object loads the page specified by its contentURL option and executes any content scripts that have been supplied to it in the contentScript and contentScriptFile options. The page is not dis
played to the user. The page worker is loaded as soon as the Page object is created and stays loaded until its destroy method is called or the add-on is unloaded. Methods destroy() Unloads the page worker. After you destroy a page worker, its memory is freed and you must create a new instance if you need to load another page. postMessage(message) Sends a message to the content scripts. Parameters...
private-browsing - Archive of obsolete content
ch as tabs) that are associated with private windows: the windows module will not list any private browser windows, generate any events for private browser windows, or let the add-on open any private browser windows the tabs module will not list any tabs that belong to private browser windows, and the add-on won't receive any events for such tabs any ui components will not be dis
played in private browser windows any menus or menu items created using the context-menu will not be shown in context menus that belong to private browser windows the page-mod module will not attach content scripts to documents belonging to private browser windows any panel objects will not be shown if the active window is a private browser window the selection module will not in...
self - Archive of obsolete content
be copied into the XPI and made available through the data object. The Package Specification article explains the package.json file. Methods data.load(name) The data.load() method returns the contents of an embedded data file, as a string. It is most useful for data that will be modified or parsed in some way, such as JSON, XML, plain text, or perhaps an HTML template. For data that can be dis
played directly in a content frame, use data.url(). Parameters name : string The filename to be read, relative to the package's data directory. Each package that uses the self module will see its own data directory. Returns string : the file contents. data.url(name) The data.url() method returns a resource:// url that points at an embedded data file. It is most useful for data that can be display...
frame/hidden-frame - Archive of obsolete content
This is useful in the construction of APIs that load web content not intended to be directly seen or accessed by users, like page-worker. It is also useful in the construction of APIs that load web content for intermittent display, such as panel. Usage The module 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. remove unregisters a frame, unloading any content that was loaded in it. ...
lang/functional - Archive of obsolete content
Returns function : The wrapped fn that can only be executed once. chain(fn) Creates a version of the input function that will return this. let { chain } = require("sdk/lang/functional"); function Person (age) { this.age = age; } Person.prototype.happyBirthday =...
ui/frame - Archive of obsolete content
undled HTML, CSS and JavaScript, that can be added to a designated area of the Firefox user interface. At the moment you can only add frames to a toolbar. Usage This module exports the Frame constructor, which can be used to create frame components. Right now it can be used in conjunction with a Toolbar: you create a Frame, then supply it to the Toolbar's constructor, and the content is then dis
played inside the toolbar. Constructing frames The Frame constructor takes one mandatory option, which is a url pointing to an HTML document supplied under your add-ons "data" directory. For example, this HTML document defines a <select> element and a couple of <span> elements, and includes a CSS file to style the content and a JavaScript script to implement behavior: <!DOCTYPE html> <html> <head>...
Low-Level APIs - Archive of obsolete content
ublic API. core/promise Implementation of promises to make asynchronous programming easier. dev/panel Enables you to extend the Firefox Developer Tools. event/core The event/core module allows the creation of APIs to broadcast and subscribe to events. event/target Create objects that broadcast events. frame/hidden-frame Creates Firefox frames (i.e. XUL <iframe> elements) that are not dis
played to the user. frame/utils Provides helper functions for working with platform internals like frames and browsers. fs/path Provides access to the local filesystem with the NodeJS path module API. io/byte-streams Provides streams for reading and writing bytes. io/file Provides access to the local filesystem. io/text-streams Provides streams for reading and writing text. lang/functional F...
Annotator - Archive of obsolete content
l build an add-on that uses many of the SDK's high-level APIs. The add-on is an annotator: it enables the user to select elements of web pages and enter notes (annotations) associated with them. The annotator stores the notes. Whenever the user loads a page containing annotated elements these elements are highlighted, and if the user moves the mouse over an annotated element its annotation is dis
played. Next we'll give a quick overview of the annotator's design, then go through the implementation, step by step. If you want to refer to the complete add-on you can find it under the examples directory in the SDK. Design Overview Implementing the Widget Creating Annotations Storing Annotations Displaying Annotations ...
Display a Popup - Archive of obsolete content
riptFile: data.url("get-text.js") }); // Create a button require("sdk/ui/button/action").ActionButton({ id: "show-panel", label: "Show Panel", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onClick: handleClick }); // Show the panel when the user clicks the button. function handleClick(state) { text_entry.show(); } // When the panel is dis
played it generated an event called // "show": we will listen for that event and when it happens, // send our own "show" event to the panel's script, so the // script can prepare the panel for display. text_entry.on("show", function() { text_entry.port.emit("show"); }); // Listen for messages called "text-entered" coming from // the content script. The message payload is the text the user // entered.
Localization - Archive of obsolete content
me? In your "fr.properties" file, include the French translation: monster_name_title= Nom monster_name_description= Quel est le nom du monstre ? Now when the browser's locale is set to "en-US", users see this in the Add-ons Manager: When the browser's locale is set to "fr", they see this: The menulist and the radio preference types have options. The label attribute of each option is dis
played to the user. If the locale file has a entry with the value of the label attribute prefixed with "{name}_options." as its key, where {name} is the name of the preference, its value is used as a localized label. Using identifiers If the localization system can't find an entry for a particular identifier using the current locale, then it just returns the identifier itself. This has the nice prope...
Downloading Files - Archive of obsolete content
aRequest, aStateFlags, aStatus) { // do something } } persist.saveURI(obj_URI, null, null, null, "", targetFile, privacy); Downloading files that require credentials Before calling nsIWebBrowserPersist.saveURI(), you need to set the progressListener property of the nsIWebBrowserPersist instance to an object that implements nsIAuthPrompt. Normally, nsIAuthPrompt expects a prompt to be dis
played so the user can enter credentials, but you can return a username and password credentials directly without prompting the user. If you want to open a login prompt, you can use the default prompt by calling the window watcher's getNewAuthPrompter() method. Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); const WebBrowserPersist = Components.Constructor("@mozilla.org/emb...
Installing Extensions and Themes From Web Pages - Archive of obsolete content
tallTrigger, one from trying to load the XPI file directly. Available Parameters for the install object The InstallTrigger.install method accepts a JavaScript object as a parameter, with several properties on that object used to affect the install. URL The URL property specifies the URL of the XPI to install. This property is required. IconURL The IconURL property specifies an icon to be dis
played in the installation dialog. This property is optional. If you do not specify an icon, the default icon will be used, usually a green puzzle piece. The icon can be any image format supported by Firefox, and should be 32x32 pixels in size. Hash The Hash property specifies a cryptographic hash of the XPI file contents. This is used to verify the downloaded file, to protect against a corrupted file...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
rmissions in return for a fee, and will still restrict some normally unrestricted uses. The software that Microsoft sells, such as Windows, comes with a license that permits only limited duplication in exchange for a fee, so, although customers can install it on their computers, they cannot modify it. And essential freedoms, such as reverse-engineering, are also restricted. This use permit is dis
played when you install the software. When the user clicks "I agree," the installation process finishes. Software range of uses Restricted to author Unrestricted Software license >> Usable within permitted scope Restricted Use within permitted scope FIXME: Wow, the table is weird! So what's an OSS license? So now yo...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
read the same way streams are. If the text includes multi-byte characters, as is used in Japanese, you'll need to convert the character codes. Text file input Listing 15 shows an example of opening a text file encoded as Shift-JIS (a double-byte character encoding for Japanese). Copy some Japanese text into a text file, save it as Shift-JIS, and put in the path to that file. The text will be dis
played as-is. The text that you've read in is actually being represented internally as Unicode (UTF-16). Listing 15: Reading a Shift-JIS text file file.initWithPath('C:\\temp\\temp.txt'); var charset = 'Shift_JIS'; var fileStream = Components.classes['@mozilla.org/network/file-input-stream;1'] .createInstance(Components.interfaces.nsIFileInputStream); fileStream.init(file, 1, 0, false...
Adding Events and Commands - Archive of obsolete content
you should know, even if it isn't that frequently used. The DOM createEvent function allows you to create custom events that you can dispatch and capture. Custom events serve as a good communication mechanism, specially when dealing with a somewhat common problem: communication between window XUL and web page content. It isn't hard for XUL code to control the content on pages being loaded or dis
played, as we will see later on, but it can be hard for your extension XUL code to receive information from pages in a secure manner. This is because it would be very insecure to have a website JS controlling the behavior of Firefox and running JavaScript code with chrome privileges. Suppose your extension interacts with pages from a website, and you want some actions on this site to trigger actions in...
Adding sidebars - Archive of obsolete content
x. In these cases the << XUL Reference << and << XUL Reference << elements are probably what you're looking for. They are extremely useful, and you'll find yourself using them in many situations besides sidebars. A deck is like a tabbbox without the tabs. It only displays one of its child nodes at a time, depending on its selectedIndex value. In the following example, the second child will be dis
played, not the first which would be the default. <deck selectedIndex="2"> <hbox> <!-- Content for the first child. --> </hbox> <hbox> <!-- Content for the second child. --> </hbox> </deck> Note how this is one of the few cases where an attribute of an element is named using camel case instead of all small caps. The size of the deck depends on the size of the largest child no...
Adding windows and dialogs - Archive of obsolete content
u're just debugging some problem and want to see if the program reaches a specific line of code, or to inspect the value of a variable, but your final extension should not have alert calls anywhere. If you use window.alert, the alert window will have the title [JavaScript Application], indicating that the source of the message is not well defined. The Prompt Service allows better alerts to be dis
played. Here's an example of displaying an alert using the Prompt Service: let prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"]. getService(Ci.nsIPromptService); prompts.alert(window, "Alert Title", "Hello!"); You should of course use localized strings instead of hard-coded ones. The Prompt Service allows you to set the title of the dialog however you want it, and also lets you spec...
Custom XUL Elements with XBL - Archive of obsolete content
many lines of code, and having more than one ends up making gigantic, unbrowsable files. On the other hand, if your bindings are small and have a strong relationship with each other, it makes sense to keep them together. As for the CSS file, it's usually good to have a single file declaring all bindings in your extension. Content Under the content tag you define the XUL content that will be dis
played for your element. <content> <xul:hbox> <xul:image class="xulshoolhello-person-image" xbl:inherits="src=image" /> <xul:vbox flex="1"> <xul:label xbl:inherits="value=name" /> <xul:description xbl:inherits="value=greeting" /> </xul:vbox> <xul:vbox> <xul:button label="&xulshoolhello.remove.label;" accesskey="&xulshoolhello.remove.accesskey;" onco...
Extensions support in SeaMonkey 2 - Archive of obsolete content
These are so commonly available that developers often forget that they are not built-ins. SeaMonkey on the other hand defaults to not support them so they either need to be expanded to their proper forms or matching constants/variables need to be defined in custom code. Shorthand Expansion ...
Tabbed browser - Archive of obsolete content
rrently selected tab The following code allows you to retrieve the document that is in the selected tab. This code will work in the scope of the browser window (e.g. you're working from an overlay to the browser window). gBrowser.contentDocument; or content.document If you're working from a window or dialog that was opened by the browser window, you can use this code to get the document dis
played in the selected tab in the browser window that opened the new window or dialog. window.opener.content.document From windows or dialogs not opened by the browser window, you can use nsIWindowMediator to get the document dis
played in the selected tab of the most recently used browser window. var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Co...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
content of the site tells the story of how technology affects our daily lives, especially in the realms of business, culture, and politics. Why not attempt to use technology standards for the Web to live out that story? The visual design of Wired News and the Vignette templates were all sorely stale, and we had no significant effort invested into either for more than two years. I think that fact
played a critical role in our team's willingness to try out something completely new. Our engineering team actually needed the least convincing to convert over to a standards-based design, because they could also immediately envision the benefits to their workload and maintenance of the site. How is the site styled now that you've ripped out all the HTML-based presentation? Technically, there are 13 t...
CSS3 - Archive of obsolete content
h-parent for a better support of documents with multiple directionalities of text. the CSS text-align property with a <string> value to align on that character. This is useful to align number on the decimal point. the CSS word-spacing and letter-spacing properties with range constraints to control flexibility in justification. Adds: Control on how whitespaces are dis
played using the CSS text-space-collapse and tab-size properties. Control on line breaks and word boundaries using the CSS line-break, word-break, hyphens, text-wrap, overflow-wrap, and text-align-last properties. Control on how justification is happening, in order to support more type of scripts, using the CSS text-justify property. Control on edge effect using the CSS text-indent and ha...
Creating a dynamic status bar extension - Archive of obsolete content
ation with the server is a good idea for one of the future articles startup: function() { this.refreshInformation(); window.setInterval(this.refreshInformation, 10*60*1000); }, This starts by calling our refreshInformation() function, which is responsible for fetching and displaying stock ticker information in the status bar panel. We do this so that upon loading, the stock information is dis
played as soon as possible. After doing that, we install an interval routine on the browser window by calling window.setInterval(). This configures our refreshInformation() routine to be called every 10 minutes (the time interval is specified in milliseconds). refreshInformation() The refreshInformation() function is called whenever we want to update the stock information. It's called whenever the user ...
Creating a status bar extension - Archive of obsolete content
ication string. Before Firefox 1.5, this was a GUID. Starting with Firefox 1.5, however, you should use a string in the form extension-name@creator-domain. version The extension's version number. type The addon type. For extensions, this is 2. Human-readable information In this sample, we have four pieces of human-readable information; that is, information that is dis
played to the user within the Firefox interface. These are: Property name Description em:name The extension's name. This name is dis
played in the Extensions window. em:description A short, one-line description of the extension. This text is also dis
played in the Extensions window. em:creator The author's name. homepageURL The URL of a web site ...
Install.js - Archive of obsolete content
ional) en-US\ sampleext\ ... skin\ (optional) classic\ sampleext\ ... install.js install.rdf (optional -- see above) Code // install.js // XpiInstaller // By Pike (Heavily inspired by code from Henrik Gemal and Stephen Clavering) var XpiInstaller = { // --- Editable items begin --- extFullName: 'Sample Extension', // The name dis
played to the user (don't include the version) extShortName: 'sampleext', // The leafname of the JAR file (without the .jar part) extVersion: '1.0', extAuthor: 'Insert-your-name-here', extLocaleNames: null, // e.g. ['en-US', 'en-GB'] extSkinNames: null, // e.g. ['classic', 'modern'] extPostInstallMessage: null, // Set to null for no post-install message // --- Editable items end --- profileIns...
Creating a Web based tone generator - Archive of obsolete content
This example creates a simple tone generator, and plays the resulting tone. The function requestSoundData() produces the samples to be
played. This function is called at a certain interval through the setInterval() function. The function mozWriteAudio() is called to write those samples produced in the audio stream. In order to always have samples to play, a buffer of 500 ms is created. The function mozCurrentSampleOffset() is used to know the position of the samples being
played so that we can fill a 500 ms buffer of audio samples. <!DOCTYPE html> <html> <head> <title>JavaScript Audio Write Example</title> </head> <body> <input type="text" size="4" id="freq" value="440"><label for="hz">Hz</label> <button onclick="start()">play</button> <button onclick="stop()">sto...
In-Depth - Archive of obsolete content
s on tabs. -moz-border-radius-bottomleft The same as -moz-border-radius but only applies to the bottom left corner. An example of where this would be used is on a footer. -moz-border-radius-bottomright The same as -moz-border-radius but only applies to the bottom right corner. An example of where this would be used is on a footer. -moz-box-direction Controls which way the items in this box are dis
played. Normal in English web browsers items are dis
played top to bottom and left to right. This will flip it around so items inside of this box will be dis
played bottom to top and right to left. This is useful for, say, putting the navigation controls (back button) on the right hand side of the toolbar. Values: Normal, Reverse -moz-image-region This is useful for dividing up an image into multiple smal...
Download Manager preferences - Archive of obsolete content
fter downloads are complete. On Windows XP SP2 and Windows Vista, this value also indicates whether downloaded files trigger a security warning upon launch. Default value is true. browser.download.manager.showAlertInterval The minimum number of milliseconds that must elapse between download complete alerts; if two downloads complete within this amount of time, only one alert is dis
played. Default value is 2000 (2 seconds). browser.download.manager.showAlertOnComplete A boolean value that indicates whether or not an alert should be shown when downloads complete. Default value is true. browser.download.manager.showWhenStarting A boolean value that indicates whether or not to show the Downloads window when a download begins. The default value is t...
Error Console - Archive of obsolete content
le. Before Gecko 1.8.1 (Firefox 2), it was called JavaScript Console (see bug 265871). Types of errors Error usually a syntax error that prevents the program from compiling. Warning usually lets the program compile but warns of bad coding and suggests design flaws. Message very similar to warning, used very rarely. Manipulating data dis
played in Error Console Information dis
played in Error Console can be accessed and manipulated through the Console service. Extensions can write to the Error Console from JavaScript using Components.utils.reportError, or if you're fine with logging to the OS-provided console, dump(). To bring up Error Console from within a browser or mail window, use the function toJavaScriptConsole(). ...
Plug-n-Hack Phase1 - Archive of obsolete content
ity tool commands manifest An example commands manifest (for OWASP ZAP) is: https://code.google.com/p/zap-extensions/source/browse/branches/beta/src/org/zaproxy/zap/extension/plugnhack/resource/service.json Firefox UI In Firefox the tool commands will be made available via the Developer Toolbar (GCLI) https://developer.mozilla.org/docs/Tools/GCLI A example of how the ZAP commands are currently dis
played is: Note that user specified parameters can be specified for commands, which can either be free text, a static pull down list of options or a dynamic list of options obtained from the tool on demand. So if you select the "zap scan" command then you will be prompted to select a site from the list of sites currently known to ZAP. PnH does not specify how tool commands should be dis
played, so other...
HostWindow - Archive of obsolete content
Prism hosts web applications in a simple, minimal window. The window does have some UI components (as shown in the screenshot below). Prism can be configured to show or hide several of the UI components. Location Bar - A readonly textbox that contains the currently dis
played URL. When not dis
played the entire location bar section is hidden. Sidebar - Section of window area used to display ancillary web content, including web applications. When the sidebar is dis
played, the splitter can be used to change the width or quickly collapse it. The splitter itself cannot be hidden as it is the only UI to show a collapsed sidebar. When not dis
played the entire sidebar area, including the splitter are hidden. Note: The sidebar is currently not supported. We are considering whether to support a ...
Scripting - Archive of obsolete content
llows for some client-side web application customization. The web application bundle is allowed to hold a JavaScript file named webapp.js (called the webapp script). This file will be loaded into the Prism chrome window very much like a Firefox extension is loaded into the browser chrome window. It can contain the following functions: startup When the app starts, before the user interface is dis
played. Since the web application has not yet loaded, the window object is still undefined. preload Just before the user interface is dis
played. Returning false causes the application to terminate. load After the main application windows has finished loading. The window object has been initialized and can be used. error If there is an error loading the main app page (e.g. the server is not accessible). ...
Proxy UI - Archive of obsolete content
v4 ( ) SOCKS v5 "No proxy for:" Discussed in detail elsewhere... but should be noted that if you cut and paste from IE, the semi-colons are automatically converted to commas when you save changes (FF, TB, SM). Automatic proxy configuration URL Supports a URL (which is checked via URIfixup) and a reload button. Offline|Online "plug" Location Status bar on the right side. Right-click A menu is dis
played that has the following items: Online (Proxy: None) Online (Proxy: Auto Discover) Online (Proxy: Auto URL) Online (Proxy: Manual) --- Proxy Configuration... <h7 name="Details">Details</h7> The menu should display the current proxy mode with a dot. The modes that can have an empty configuration (Auto URL and Manual) will be disabled if the prefs are blank. Selecting an enabled item sets the menu se...
Frequently Asked Questions - Archive of obsolete content
is with the SVG file. To be valid the root <svg> tag in SVG files must have at least the following two "namespace bindings". <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> Actually the second binding isn't always required, but unless you understand namespaces, we'd strongly recommend you include it. For more information see this link. If source code is dis
played without a gray area at the top, or if you just see gibberish, then the problem is server misconfiguration. When servers send user agents an SVG file they must tell the user agent that the file has the MIME type "image/svg+xml", and if the SVG file is stored gzipped they must tell the browser that too. Mozilla is strict about this, and no, it's not a bug. Failing to respect the MIME types servers ...
Actionscript Performance Tests - Archive of obsolete content
estconfig.txt file defines groups of tests to run (e.g. sunspider, scimark, language). By default the time for each test is output. Use the --memory flag to capture the maximum private bytes memory (high water mark) for a test. By default each test is run a single time. To run each test multiple times use the --iterations flag. When the number of iterations is greater than 2 all times are dis
played in [], faster time is dis
played in the output column, and the 95% confidence interval is calculated. The 95% confidence interval is the calculated percentage of the mean value to fall within 95% of the measured results. For example if the mean is 100 and the 95% confidence interval is 2%, 95% of the expected values should fall between 98 and 102. To compare two vms against each other export AV...
Tamarin mercurial commit hook - Archive of obsolete content
): [hooks] pretxncommit.commit = python:/path/to/tamarin-redux/utils/hooks/tamarin-commit-hook.py:master_hook Once added, all commits will run the commit hook. Hook Use On every commit to your local repository, the hook will only check for violations in any new / changed code. Any untouched lines of code that violate the check will be ignored. ...
Venkman - Archive of obsolete content
JavaScript Debugger 1.0 and 1.1. In April of 2001, Robert Ginda began work on a JavaScript debugger for Mozilla, called Venkman. Venkman builds on the js/jsd portion of John's 1998 work, exposing it as an XPCOM component. This allows the user interface be written in JavaScript and XUL, which allows Venkman to be fully cross-platform. Venkman is named after the character Dr. Peter Venkman,
played by Bill Murray in the movies Ghostbusters and Ghostbusters II. Getting Venkman Firefox and Thunderbird The latest version of JavaScript Debugger is available from Firefox Add-ons. Mozilla Suite and SeaMonkey These releases come with Venkman pre-installed. On Windows, it is an install option; choose Advanced install. Also available f...
Elements - Archive of obsolete content
bindings. extends - The extends attribute is used to specify the URL of a binding that this binding inherits from (see Inheritance of Implementations). The URL specifies a particular binding document. The # notation must be used to point to a specific binding id within a binding document. Note that content cannot be inherited, only behavior. display - This attribute specifies how the tag is dis
played. By setting this attribute, you can have an element have the layout and display characteristics of an existing element. For example, use the value 'xul:button' to create an element that is dis
played like a button. The part before the colon is a namespace prefix so you must declare the XUL namespace as well. Not all tags have a unique display type. The following XUL display types may be used: brow...
alert - Archive of obsolete content
Summary The alert function displays a modal dialog box with a message representing the input. Method of Install object Syntax void alert ( String message ); Parameters The message parameter is dis
played as a string in the dialog box. If message is not a string, then it is converted into one and dis
played. Returns Nothing. ...
confirm - Archive of obsolete content
ject aCheckState ); Parameters The second, extended 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 extended form. See the notes at the end of this document for a safe way to implement a fallback. aText The string to be dis
played in the confirmation dialog. This string is typically in the form of a prompt for the user (e.g., "Are you sure you want to delete the selected file(s)?"). aDialogTitle The string to be used as the dialog title. Defaults to "Confirm" (or the localized equivalent). aButtonFlags A set of flags defining the buttons that should appear in the dialog. The value is calcula...
initInstall - Archive of obsolete content
ackage, String version, int flags); int initInstall ( String displayName, String package, String version); int initInstall ( String displayName, String package, InstallVersion version); Parameters The initInstall method has the following parameters: displayName A string that contains the name of the software being installed. The name of the software is dis
played to the user. package The Client Version Registry pathname for the software (for example: Plugins/Adobe/Acrobat or /royalairways/RoyalPI/). It is an error to supply a null or empty name. The name can be absolute or relative. A relative pathname is relative to the Netscape 6 namespace. A relative pathname must start with plugins/, to be relative to the plug-ins portion o...
alwaysopenpopup - Archive of obsolete content
<< XUL Reference home alwaysopenpopup Obsolete since Gecko 1.9.1 Type: boolean Note: Applies to: Thunderbird and SeaMonkeyIf true, the autocomplete popup will be dis
played even when there are no matches. If false, the default value, the popup will be hidden. This attribute is obsolete as of Gecko 1.9.1; to control the display of the popup, use the minresultsforpopup attribute instead. ...
colorpicker.type - Archive of obsolete content
<< XUL Reference home type Type: string If this attribute is not present, the colorpicker is dis
played inside the window. If this is set to the text button, the colorpicker is dis
played as a button. When the user clicks the button, a popup appears for the user to select a color. ...
crop - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } ...
currentset - Archive of obsolete content
This will be modified when the user customizes the toolbar. The value of this attribute should be a comma-separated list of item IDs from the toolbarpalette or, additionally, any of the following strings: "separator", "spring", "spacer". this isn't necessary the *current* set, i.e. ...
defaultset - Archive of obsolete content
<< XUL Reference home defaultset Not in SeaMonkey 1.x Type: comma-separated list of item ids The default set of dis
played items on the toolbar. This should be set to a comma-separated list of item IDs from the toolbarpalette. For example, back-button,forward-button,print-button. ...
disablechrome - Archive of obsolete content
<< XUL Reference home disablechrome Type: boolean Set this attribute to true to disable chrome in 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 dis
played, the add-on bar) left showing. Note: This has no effect if the tabs on top preference is turned off. ...
Building Trees - Archive of obsolete content
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 to determine what to display. The tree builder implements the nsITreeView interface, so it becomes the tree's view--in other words, the tree's view and the tree's builder are the same object. When the tree is dis
played, it asks the view for the contents of each cell. The builder looks at the label for the corresponding cell, translates any variables or predicates into values, and returns the value. In the example above, the first cell should display the title. The builder doesn't compute any labels until the view asks for them. When the view requests a label for the first cell, the builder looks up the 'http://...
Multiple Rule Example - Archive of obsolete content
the <rule> element), it could be considered to be the final else block that matches all data. Since results generated by earlier rules override those of later results, you will want to ensure that the rules are placed in the right order. The rules should be ordered from most specific to least specific. If you reversed the order of the two rules in the example above, three photos would still be dis
played, but the larger rule that displays the image details would be dropped as the other rule has a higher priority. The result would be that the palace photo would not show this information. << PreviousNext >> ...
Template Builder Interface - Archive of obsolete content
ecked to see if it has a datasources attribute. If so, a template builder will be created for the element and attached to the element. If the element is a <tree> element and has the flags attribute set to "dont-build-content", a tree builder will be created. Otherwise, a content builder will be created. Both types of builder share much of the same code except for how they generate output to be dis
played. Both types of builders implement the nsIXULTemplateBuilder interface, while the tree builder also implements the nsIXULTreeBuilder interface. The builder associated with an element is accessible via the element's 'builder' property both for content builders and for tree builders. An element that does not have a builder will have this property set to null. The processes of creating a builder for ...
Using Recursive Templates - Archive of obsolete content
o the groups. This is done with all nodes that have children to indicate that the node contains generated children as well as whether the node is empty. These hints are used for trees, but they can also be used in a stylesheet to provide a different appearance for containers with children, empty containers, as well as non-containers. In this example, both the parent groups and child people are dis
played the same. You could use multiple rules as well, in order to generate different output for each level. In this next example, an assign element is used to assign the local name of the node is to the variable ?type. In an XPath expression, the period refers to the context node. For an assign element, the context is the the result node. The local-name function retrieves the tag of the element without...
XML Templates - Archive of obsolete content
specify a namespace. If so, you will need to ensure that prefixes are defined within the template as well, so that they can be used in the XPath expressions. The namespace prefixes that may be used in an XPath expression are those that are defined on the query or assign element where the expression is used. Be aware that when XML data is included inline as in this example, the content may be dis
played and may affect the layout of other parts of the window. You may wish to hide the inline XML by placing it inside a hidden box. << PreviousNext >> ...
Complete - Archive of obsolete content
ocale. Locales are named with a two-part code. For example, the code en-US means English language (en) for the United States (US). To make it eaiser to support different locales, developers usually place anything that might depend on the locale in separate files in a separate directory. In the Custom Toolbar Button extension, the only things that might depend on the locale are the text strings dis
played in the user interface. These are in the files button.xul and button.js. XUL and JavaScript each have mechanisms for loading text strings from the correct locale directory. This extension only uses the XUL method. Its JavaScript code gets the text strings it needs from the XUL. For more information about working with locales, see the main Localization page here. How a text sting gets localized Whe...
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
n: rect( 0px 164px 20px 145px);} .custombutton:active {-moz-image-region: rect( 0px 183px 20px 164px);} Remove one of the common style sections, leaving the section for the theme that you use in SeaMonkey. (If you leave both sections in the file, then your button's appearance will match the classic theme.) Save the file. Explanation: This CSS stylesheet specifies how the button is dia
played. It links to the button image, specifying the dimensions of the six parts of the image. 8. Create a plain text file named button.js. Copy the following content, and paste it into the new file: CustomButton = { 1: function () { alert("Just testing") }, } There is nothing to customize for now. Save the file. The next section in this tutorial contains examples of cod...
Accesskey display rules - Archive of obsolete content
Be aware, this is very important thing. When you cannot use DTD, e.g., when you need to generate some UIs dynamically, you can use .properties file or something. Then, you should provide a way for specifying accesskeys which are independent from their labels. Note that using '&' in label text is bad way. Because Japanese localizers "&Cancel" need to localize to "?????(&C)". This label will be dis
played as "?????(C)(C)" on the localized build. So, "(C)" will be doubled. For this issue, we recommend the following format if you use .properties: <command-name>.label=Cancel <command-name>.accesskey=C Note that APIs of nsIPromptService are using the bad way. Because the APIs are already frozen. Therefore, XUL toolkit removes accesskey text before setting the label to the buttons. However, XUL applic...
Adding Methods to XBL-defined Elements - Archive of obsolete content
destructor. A constructor is called whenever the binding is attached to an element. It is used to initialize the content such as loading preferences or setting the default values of fields. The destructor is called when a binding is removed from an element. This might be used to save information. There are two points when a binding is attached to an element. The first occurs when a window is dis
played. All elements that have XBL-bound content will have their constructors invoked. The order that they are called in should not be relied upon, as they are loaded from various files. The window's onload handler is not called until after all the bindings have been attached and their constructors finished. The second point is when a binding is attached by changing the -moz-binding style property of an...
Adding Properties to XBL-defined Elements - Archive of obsolete content
o the property. This script should store the value somewhere, or validate the value. For example, some properties might only be able to store numbers. Attempting to assign alphabetic text to such a property should fail. <property name="size" onget="return 77;" onset="alert('Changed to:'+val);"/> This property will always return 77 when retrieved. When set, an alert will be dis
played which displays the value to assign to the property. The special variable val holds the value that the property should be assigned to. Use this to validate it or store it. The following decribes what happens in a typical case: There are two elements, one called 'banana' and the other 'orange'. They each have a custom property called 'size'. When the following line of script is executed: banana.siz...
Advanced Rules - Archive of obsolete content
predicate="http://www.xulplanet.com/rdf/weather#temperature" object="?temp"/> </bindings> This binding will grab the temperature resource of each city and assign it to the 'temp' variable. This is similar to what a triple does. The difference is that a binding is not examined when attempting to check the conditions. This means that the city must have a name and prediction to be dis
played, yet it does not matter if it has a temperature. However, if it does, it will be placed in the 'temp' variable so it can be used in the action. If a city does not have a temperature, the 'temp' variable will be set to an empty string. Next, we'll find out how to save the state of XUL elements. << PreviousNext >> ...
Box Model Details - Archive of obsolete content
="1" align="top"> <button label="Left" style="min-width: 100px;" flex="1"/> <spacer flex="1"/> <button label="Right" style="min-width: 100px;" flex="1"/> </hbox> Summary of the box model To achieve complicated layouts, you will generally need to add nested boxes, specify minimum and maximum sizes on some elements, and make certain elements flexible. The best interface is one that can be dis
played at various sizes without problems. The box model may be difficult to understand without trying various various things out for yourself. The following is an outline of both types of boxes: Horizontal boxes Lay out their elements next to each other horizontally. Flexible elements are flexed horizontally. Packing controls their horizontal placement of child elements. Alignment controls how ...
Broadcasters and Observers - Archive of obsolete content
aster is shown below. You should always use an id attribute so that it can be referred to by other elements. <broadcasterset> <broadcaster id="isOffline" label="Offline"/> </broadcasterset> Any elements that are watching the broadcaster will be modified automatically whenever the broadcaster has its label attribute changed. This results in these elements having a new label. Like other non-dis
played elements, the broadcasterset element serves as a placeholder for broadcasters. You should declare all your broadcasters inside a broadcasterset element so that they are all kept together. Making elements observers Elements that are watching the broadcaster are called observers because they observe the state of the broadcaster. To make an element an observer, add an observes attribute to it. Thi...
Creating an Installer - Archive of obsolete content
er which is a small piece of script which launches the install. The user is presented with a dialog which indicates the package being installed. It is possible for the install trigger to launch multiple installers. In this case, they will be presented in a list. The user may choose to continue or cancel. If the user chooses to continue, the installer XPI file is downloaded. A progress bar is dis
played to the user during this process. The file install.js is extracted from the install archive and executed. This script will call install functions which will indicate which files from the archive should be installed. Once the script is complete, the new package has been installed. If multiple packages are being installed, their scripts will run in sequence. Install Triggers As indicated above,...
Features of a Window - Archive of obsolete content
t/findfile.xul", "findfile", "chrome"); Specifying the Width and Height You should have noticed that whenever elements were added to a window, the window's width expanded to fit the new elements. The window is really just a box which is flexible and defaults to vertical orientation. You can also specify the width and height directly on the window tag. This, of course, causes the window to be dis
played in a specific size. If you leave it out, the size is determined by the elements that are in it. Gecko 1.9.2 note Starting in Gecko 1.9.2 (Firefox 3.6), overriding the position of a window using window features will not change the persisted values saved by the session store feature. That means the next time the window is opened, it will still open in the saved location. <window id="find...
Grids - Archive of obsolete content
nt inside each column element is placed in the first row, the second element in the second row and the third element is placed in the third row. If you put content in both the columns and the rows, the content will overlap each other, although they will align in a grid properly. It creates an effect much like a grid of stack elements. The order of the elements in the grid determines which is dis
played on top and which is placed underneath. If the rows element is placed after the columns element, the content within the rows is dis
played on top. If the columns element is placed after the rows element, the content within the columns is dis
played on top. Similarly, events such as mouse buttons and keypresses are sent only to the set on top. This is why the columns were declared after the rows in t...
List Controls - Archive of obsolete content
bel="George" /> <listcell label="House Painter" /> </listitem> <listitem> <listcell label="Mary Ellen" /> <listcell label="Candle Maker" /> </listitem> <listitem> <listcell label="Roger" /> <listcell label="Swashbuckler" /> </listitem> </listbox> Header Rows List boxes also allow a special header row to be used. This is much like a regular row except that it is dis
played differently. You would use this to create column headers. Two new elements are used. The listhead element is used for the header rows, just as the listitem element is used for regular rows. The header row is not a normal row however, so using a script to get the first row in the list box will skip the header row. The listheader element is used for each cell in the header row. Use the label attrib...
Manipulating Lists - Archive of obsolete content
verse. The nsIDOMXULMultiSelectControlElement interface also provides methods for modifying the selected items. For instance, the addItemToSelection() function adds a new item to the set of selected items, without clearing the existing selection. The removeItemFromSelection() function removes a single item from the selection. List Scrolling If there are more rows in the listbox than can be dis
played, a scroll bar will appear to allow the user to scroll the list. The scroll position may be adjusted using a couple of listbox methods. The scrollToIndex() method scrolls to a given row. This listbox will scroll such that the row will be the top row visible, unless the row is near the end of the list of items. The ensureIndexIsVisible() method is similar in that it also scrolls to show a row, but...
More Tree Features - Archive of obsolete content
other things you need to do to make sure the hierarchy works properly. First, you need to mark the treeitem element that has children as a container. You do this by adding the container attribute to it as follows: <treeitem container="true" /> This allows the user to click on the row that corresponds to the treeitem to expand and collapse the inner rows. You can have the child rows initially dis
played by adding the open attribute. When the user expands and collapses the parent, the view's toggleOpenState function will be called to toggle the item between open and closed. For a content tree view, this will set the open attribute to reflect the current state. The second change is that you must put the primary attribute on the first column. This causes a small triangle or plus sign to appear befo...
Persistent Data - Archive of obsolete content
stored in a RDF file (localstore.rdf) in the same directory as other user preferences. It holds state information about each window. This method has the advantage that it works with Mozilla user profiles, so that each user can have different settings. XUL allows you to save the state of any element. You will typically want to save toolbar states, window positions and whether certain panels are dis
played or not, but you can save almost anything. persist attribute To allow the saving of state, you simply add a persist attribute to the element which holds a value you want to save. The persist attribute should be set to a space-separated list of attributes of the element that you want to save. The element must also have an id attribute in order to identify it. For example, to save the size of a wind...
Popup Menus - Archive of obsolete content
Creating a Popup Menu XUL has three different types of popups, described below. The main difference is the way in which they appear. Plain Popups The plain popup is a popup window which appears when the user presses the left mouse button on an element. They are much like the menus on the menu bar, except that they can be placed anywhere and can contain any content. ...
Progress Meters - Archive of obsolete content
pt later to turn it on and off. <textbox id="find-text"/> <html:progress value="50" max="100" style="margin: 4px;"/> <button id="find-button" label="Find" default="true"/> The value has been set to 50% so that we can see the meter on the window. A margin has been set to 4 pixels so that it is separated from the edge of the window. As was stated earlier, we only want the progress bar to be dis
played while the search was occurring. A script will show and hide it as necessary. To make this work you will first have to define the namespace html. Do this by adding the below line to your opening window tag in the findfile.xul. xmlns:html="http://www.w3.org/1999/xhtml" The example so far. Source View In the next section, we will learn how to add additional elements to the window using HTML...
Tabboxes - Archive of obsolete content
</tabs> <tabpanels> <tabpanel id="mailtab"> <checkbox label="Automatically check for mail"/> </tabpanel> <tabpanel id="newstab"> <button label="Clear News Buffer"/> </tabpanel> </tabpanels> </tabbox> Here, two tabs have been added, the first labeled 'Mail' and the other 'News'. When the user clicks on the Mail tab, the contents of the first tab page will be dis
played below the tabs. In this case, the page with the check box labeled 'Automatically check for mail' will appear. When the second tab is clicked, the page containing the button labeled 'Clear News Buffer' will appear instead. The currently selected tab element is given an additional selected attribute which is set to true. This alters the appearance of the currently selected tab to make it look sele...
Tree View Details - Archive of obsolete content
ontainerOpen for rows that are not containers as indicated by the return value of the isContainer method. A container may be rendered differently than a non-container. For instance, a container may have a folder icon beside it. A style sheet may be used to style items based on various properties such as whether a row is open. This is described in a later section. A non-empty container will be dis
played with a twisty next to it so that the user may open and close the row to see child items. Empty containers will not have a twisty, but will still be treated like a container. When the user clicks the twisty to open a row, the tree will call the view's toggleOpenState method. The view should then perform any necessary operations to retrieve the child rows and then update the tree with the new rows...
Trees and Templates - Archive of obsolete content
mn, the data will be sorted in that column. The user can change the sort direction by clicking the column header. If you do not set the sort attribute on a column, the data cannot be sorted by that column. The sortDirection attribute (note the mixed case) is used to set the direction in which the column will be sorted by default. Three values are possible: ascending the data is dis
played is ascending order. descending the data is dis
played is descending order. natural the data is dis
played in natural order, which means the order the data is stored in the RDF datasource. The final attribute, sortActive should be set to true for one column, the one that you would like to be sorted by default. The following example changes the columns in the earlier ex...
Using Remote XUL - Archive of obsolete content
ic XUL document, we need a way to display pages from the mozilla.org web site. For that we'll use a XUL iframe element. <?xml version="1.0"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <iframe src="https://www.mozilla.org/" flex="1" /> </window> The XUL iframe element is just like its HTML counterpart: it defines an area within which web content can be dis
played. Its src attribute contains the URL of the page being dis
played in the iframe. We set this value to the mozilla.org home page by default so that page loads into the iframe when we first load the XUL document. The iframe's flex attribute tells the browser to stretch the iframe to fill the space available to it. Without it, the iframe's size would be a fixed default and wouldn't change when the us...
XULBrowserWindow - Archive of obsolete content
is hidden for about:addons and any other pages in the in content whitelist. You can augment the functionality of this method using chaining in order to hide chrome for other locations. See Hiding browser chrome for details and an example. boolean hideChromeForLocation( in String aLocation ); Parameters aLocation The URL to check to see if chrome should be hidden while that location is dis
played. Return value true if chrome should be hidden while displaying the specified location; otherwise false. ...
XUL Template Primer - Bindings - Archive of obsolete content
</rdf:Description> </rdf:li> <rdf:li> <rdf:Description nc:name="Lumpy"/> </rdf:li> </rdf:Seq> </nc:friends> </rdf:Description> <rdf:Description ID="home" nc:street="437 Hoffman"/> <rdf:Description ID="doghouse" nc:street="435 Hoffman"/> </rdf:RDF> The RDF model that this file creates can be represented with the following graph. When dis
played in Mozilla, something like this appears: Note that even though poor Lumpy has no nc:address property, he still appears in the content model! Unlike the <conditions>, bindings do not affect whether or not a rule matches: they just "pull through" additional information if it is available. The <bindings> element The <bindings> element is optional in a XUL template, but if present, must appear a...
XUL Event Propagation - Archive of obsolete content
is the complement of event bubbling. When you register an event listener on an ancestor of the event target (i.e. any node above the event-raising element in the node hierarchy), you can use event capturing to handle the event in the ancestor before it is heard in the target itself or any of the intervening nodes. In the diagram above, the alert dialog invoked by the menuitem itself is not dis
played, since the root window element has used event capture to handle the event itself. In another example, an onload event handler for a XUL window can register a box element to capture all the click events that are raised from its child elements: var bbox = document.getElementById("bigbox"); if (bbox) bbox.addEventListener("click", function() { alert('captured'); }, true); ... <box id="bigbox"> ...
arrowscrollbox - Archive of obsolete content
smoothscroll attribute and then to the toolkit.scrollbox.smoothScroll preference. Currently, smooth scrolling supports horizontal arrowscrollboxes only. tabIndex Type: integer Gets and sets the value of the tabindex attribute. Methods ensureElementIsVisible( element ) Return type: no return value If the specified element is not currently visible to the user, the dis
played items are scrolled so that it is. If the item is already visible, no scrolling occurs. scrollByIndex( lines ) Return type: no return value Scrolls the contents of the arrowscrollbox by a certain number of lines. A line is a single element. Use a positive value as the lines argument to scroll forward that many lines, or a negative value to scroll backward that many lines. ...
browser - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A XUL <browser> element represents a frame which is expected to contain a view of a Web document. It is similar to an iframe except that it holds a page history and contains additional methods to manipulate the currently dis
played page. Are you here looking for information about the Firefox web browser, or because you'd like to download the latest version of Firefox? Get Firefox Most of the properties and methods of the browser will rarely be used and can only be called from chrome URLs. Other URLs will need to use the document and history objects to change the dis
played document. Attributes autocompleteenabled, autocompletepopup, autoscroll, disablehistory, disableglobalhistory, disable...
button - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } dir Type: one of the values below The direction in which the child e...
caption - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } image Type: URI The URI of the image to appear on the element. If ...
checkbox - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or ...
colorpicker - Archive of obsolete content
ect when used inside a prefwindow. More information is available in the Preferences System article. tabindex Type: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. type Type: string If this attribute is not present, the colorpicker is dis
played inside the window. If this is set to the text button, the colorpicker is dis
played as a button. When the user clicks the button, a popup appears for the user to select a color. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. color Type: color string The currently selected color. This ...
commandset - Archive of obsolete content
In addition, this element can hold a command updater which is used to update commands when certain events occur. A common use of the command updater is to update cut, copy, and paste menu items. More information is available in the XUL tutorial. ...
dialogheader - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description Type: string Descriptive text to appear in addition to th...
grid - Archive of obsolete content
A grid is a layout type that arranges elements in rows and columns. The grid is expected to contain both a columns element as a child which defines the structure of the columns and a rows element as child to define the rows. The size and attributes defined on columns and rows will affect the size and placement of elements in each cell. Elements placed within both the columns and rows will be dis
played, although usually only elements will be placed inside one of these. It is most common to place elements within the rows and use the columns only to define their flexibility and width. Whichever of the columns and rows is last in the grid is dis
played on top; commonly the columns element appears in the grid first. More information is available in the XUL tutorial. Example <!-- groupbox contai...
listcell - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or ...
menubar - Archive of obsolete content
To look native (at least on Windows), the menubar element needs to be placed inside a toolbox element. More information is available in the XUL tutorial. ...
notification - Archive of obsolete content
to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. image Type: image URL Gets and sets the value of the image attribute. label Type: string Gets and sets the value of the label attribute. persistence Type: integer Gets and sets the value o...
notificationbox - Archive of obsolete content
This property is read-only. allNotifications Type: nodeList NodeList of all notifications. This property is read-only. notificationsHidden Type: boolean Indicating whether the notification area should be hidden. Events AlertActive Type: Event Fired when a notification element is shown. AlertClose Type: Event Fired when a notif...
panel - Archive of obsolete content
| Properties | Methods | Related ] A panel is a used as a temporary floating popup window that may contain any type of content. It does not have any window decorations. When open, it floats above the window and may extend outside the border of the main window. Typically, it will be attached to a button using the button's type attribute so that when the button is pressed, the panel will be dis
played. A panel may also be opened via a script using the openPopup method. The panel is closed when the user clicks outside the panel, presses Escape or when the panel's hidePopup method is called. Warning: For Firefox versions between 3.6 and 4.0, placing an iframe, browser or editor inside a panel is not supported. Some features may work, but only on some platforms. For those versions of Firefox, i...
preference - Archive of obsolete content
is kept in sync with the actual value stored in the preferences (see valueFromPreferences). When instantApply is off (default on Windows), this gets and sets the current value of the preference in the currently open dialog. There's a special case of value === undefined, indicating that the preference does not have a user-set value (hasUserValue == false). In this case the actual value to be dis
played in the UI is obtained from the defaultValue property. valueFromPreferences Gets and sets the value stored in the user preference, specified in name. (This always accesses the nsIPrefBranch APIs regardless of the instantApply mode in effect). Methods reset() Return type: no return value Resets the preference to its default value. For a textbox it also clears th...
prefwindow - Archive of obsolete content
extra1: An optional additional button. You can set its label with the buttonlabelextra1 attribute and its command with the ondialogextra1 attribute. extra2: A second optional additional button. You can set its label with the buttonlabelextra2 attribute and its command with the ondialogextra2 attribute. currentPane Type: prefpane element Reference to the currently dis
played pane. To change the current pane, use the showPane method. defaultButton Type: string Normally this attribute should not be set, but if it is, it specifies the default button in the dialog. Typically, this means that the button will be activated when the Enter key is pressed. This should be set to one of the same values as those for the buttons attribute. instantApply (readonly) Indic...
richlistitem - Archive of obsolete content
to put custom attributes in a non-XUL namespace (serializable and future-proof); 3) Use setUserData() (future-proof and clean, but not easily serializable). For user editable menulist elements, the contents, as visible to the user, are read and set using the Menulist.value syntax. For those elements, setAttribute("value", myValue) and getAttribute("value") do not access or affect the contents dis
played to the user. Properties accessible Type: nsIAccessible Returns the accessibility object for the element. control Type: element id Gets and sets the value of the control attribute. disabled Type: boolean Gets and sets the value of the disabled attribute. label Type: string Gets the concatentation of text from ...
scrollbox - Archive of obsolete content
It is intended 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. Examples The following shows the XUL for a bunch of labels. They come out in a box. ...
splitter - Archive of obsolete content
es. state Type: one of the values below Indicates whether the splitter has collapsed content or not. This attribute will be updated automatically as the splitter is moved, and is generally used in a stylesheet to apply a different appearance for each state. open The content either before or after the splitter, depending on the value of the collapsed attribute, is currently dis
played. collapsed The content either before or after the splitter is collapsed and is not visible. dragging The user is current adjusting the position of the splitter, typically by dragging it with the mouse. substate Type: one of the values below On splitters which have state="collapsed" and collapse="both", determines which direction the splitter is actually collapsed in. Since c...
stack - Archive of obsolete content
Child elements may also be placed at absolute positions within the stack. The top, right, bottom, and left attributes on a child of the stack specify the position of that element. ...
<statusbarpanel> - Archive of obsolete content
f the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the dis
played text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } image Type: URI The URI of the image to appear on the element. If t...
tabpanels - Archive of obsolete content
ated ] A container to hold the set of pages in a tabbox. The tabpanels element should be placed in a tabbox although it does not have to be a direct child. The children of the tabpanels element become the panels of the tabbox. In most cases you would use a vbox, but they can be any element, although some people like to use tabpanel elements. By clicking the first tab, the first panel will be dis
played. By clicking the second tab, the second panel will be dis
played and so on. There should be the same number of panels as there are tabs. Panels should never be hidden; hiding the tab suffices to make the panel inaccessible. More information is available in the XUL tutorial. Attributes selectedIndex Properties selectedIndex, selectedPanel Examples (example needed) Attributes sel...
tabs - Archive of obsolete content
r last tab is reached. appendItem( label, value ) Return type: element Creates a new item and adds it to the end of the existing list of items. You may optionally set a value. The function returns the newly created element. getIndexOfItem( item ) Return type: integer Returns the zero-based position of the specified item. Items are numbered starting at the first item dis
played in the list. getItemAtIndex( index ) Return type: element Returns the element that is at the specified index. insertItemAt( index, label, value ) Return type: element This method creates a new item and inserts it at the specified position. You may optionally set a value. The new item element is returned. removeItemAt( index ) Return type: element ...
toolbarpalette - Archive of obsolete content
The children of the toolbarpalette should be the complete list of toolbarbuttons and toolbaritems that can be added to the toolbar. Do not add the various spacing items, as those are added automatically. You can add your own custom buttons to the Firefox browser by using an overlay that overlays the toolbarpalette with the idBrowserToolbarPalette. ...
toolbox - Archive of obsolete content
The user may click the grippy to collapse the toolbar. If multiple toolbars are placed in the same toolbox, they will all collapse into the same row. The Firefox browser does not have grippies so toolbars cannot be collapsed and expanded. ...
Building XULRunner with Python - Archive of obsolete content
indow.addEventListener('load', onLoad, False) One possible gotcha is that the default python path used to find modules that areimported explicitly includes the xulrunner executable directory and the directory that is current when XULRunner launches. However it does not include any path related to the XUL application being run. Some work around will need to be found. Unhandled exceptions are dis
played in the JavaScript Error Console which can be opened usingxulrunner -jsconsole. One solution is to puttry .... except: print_exc() round any event handler to print tracebacks to stdout and use a python console to catch that output. The JSconsole can also be open and used from code, for example (in Javascript) function openJavaScriptConsole() { var wwatch = Components.classes["@mozilla.org/embe...
calICalendarView - Archive of obsolete content
the events and tasks shown in the calICalendarView. Typically, one more day must be added to it, in order to make it exclusive. supportsDisjointDates Consumers of calICalendarView should check this attribute to determine whether or not the implementation allows for calls to setDateList. If an implementation returns true for this attribute, it must allow for any arbitrary set of dates to be dis
played. hasDisjointDates Returns false if the dates being dis
played represent a continuous list, and true if certain dates in between startDate and endDate may not be dis
played. selectedItem Returns a calIItemBase corresponding to the currently active item in the view. Other areas of the code may use this attribute for setting selection, editing purposes, or any other purpose. NOTE: This will like...
calICalendarViewController - Archive of obsolete content
ntly', that is, without a more detailed dialog appearing. The calIEvent should have its endDate set to aEndTime, if this parameter is specified. Otherwise, it should be set to a default value, as determined by the application. The other values of the calIEvent (title, summary, alarm, etc) should likewise be set to defaults. If no aStartTime is specified, then an event-creation dialog should be dis
played. modifyOccurrence void modifyOccurrence (in calIItemOccurrence aOccurrence, in calIDateTime aNewStartTime, in calIDateTime aNewEndTime); The modifyOccurrence method is used to change the attributes of an already existing calIItem. The calIDateTime parameters must either both be specified, or neither. If they are both specified, aOccurrence should be modified 'silently', that i...
Gecko Compatibility Handbook - Archive of obsolete content
riting HTML ID and CLASS name attributes and CSS Styles for those IDs and CLASSes. Do not specify heights or widths on inline elements such as SPANs. Use only cross-browser box specifications for margins, padding and borders. (more about CSS) Content differs in Gecko browsers and Internet Explorer Incorrect Layout mode specified by DOCTYPE. If pages should be dis
played by legacy browsers such as Netscape Navigator 4 or Internet Explorer 4 and 5, be sure to specify Quirks mode layout via the DOCTYPE. Images are laid out without intervening blank areas in Interent Explorer but display blank areas between the images in Gecko browsers. Incorrect Layout mode specified by DOCTYPE. Standards Mode Layout has been specified by the DOCT...
2006-10-13 - Archive of obsolete content
ith Firefox Print on the Firefox context menu User would like discussion about why the bug https://bugzilla.mozilla.org/show_bug.cgi?id=204519 is a WONTFIX. (User feels Print belongs on the context menu along with Back, Reload, etc.) Questions About Programming For Firefox A Student questions how to create an extension that changes fonts, and how to capture website content before it is dis
played. Firefox add-on wanted User is inquiring if there is such an application to automatically save pieces of a webpage everytime is it updated. Firefox 2.0 should re-implement modal window.open to support Web 2.0 User would like the option to show pop-up windows, using window.open(), from inside untrusted script, to be re-implemented. This function was disabled, see bug: https://bugzilla.mozi...
2006-11-10 - Archive of obsolete content
- November 10, 2006 Announcements None this week. Discussions site-specific search using our search box A discussion surrounding implementing a way to search a current page with the page's embedded search component and how to make this efficient and usable. Event in Firefox similar to OnDownloadComplete event in IE An inquiry about how to change the font of a web page before it is dis
played using an extenstion. favicon as microsummary/feed/other stuff indicator Suggestion about making the favicon create a bookmark for the page with a microsummary. Firefox 2.0 - net accessed when bookmark properties viewed Question about whether Firefox 2.0 downlads the web page again when the properties of the bookmark are viewed. Followed by a discussion whether this is an improvement. w...
2006-10-27 - Archive of obsolete content
ouncement regarding the Eudora/Thunderbird rewrite: "Is Thunderbird destined to become a hybrid of the existing code and Eudora?". Jonathan Pritchard has clarified that announcement does not mean Thunderbird will be changing direction, just certain areas of development that are of interest to the Eudora developers will have more attention paid to them. Calling TB with a specific message to be dis
played There's a new question by Guenter about calling TB from an external program (eg. Firefox) to display a message. Meetings None for this week. ...
2006-10-27 - Archive of obsolete content
ing in Firefox 2.0 if add-on type is 8 Testing a custom update.rdf file for a langpack using the official version of Firefox 2.0 RC 3. Discussions Developing a spelling Dictionary Developing a spelling Dictionary. Alternative German locale While the alternative locale is active, the auto update of Firefox stops working. problem with Belarusian Firefox 2 RC3 The broken message is dis
played after user tries to visit non-existing site. Meetings None for this week. Authors Paul Yanchun Gu (gpaul) Aditya Nanda Kuswanto(vipers101) ...
Monitoring plugins - Archive of obsolete content
on(subject, topic, data) { if (topic == "experimental-notify-plugin-call" ) { if (data > 0.500) { alert("Runtime is: " + data); } } } NOTE: This is just a simplified example and the use of alert() is discouraged as the component can send hundreds of notifications each second and could potentially cause your browser to crash if an excessive number of alert boxes are dis
played. Also note that in the example above an if statement first checks to see that the arriving notification's topic is the correct one. This is useful in cases where your class is registered to receive notifications for more than one topic with the observer service. Clean Up To unregister your class with the observer service - when you no longer want to be listening to runtime notifications - your...
NPN_Status - Archive of obsolete content
lug-in display status information in the browser window, in the same place the browser does. If your plug-in has a button or other object that acts as a link when clicked, you can call NPN_Status() to display a description or URL when the user moves the cursor over it. The browser always displays the last status line message it receives, regardless of the message source. Your message is always dis
played, but you have no control over how long it stays in the status line before another message replaces it. See also NPN_UserAgent() NPP ...
Introduction to Public-Key Cryptography - Archive of obsolete content
:8e:54:65:fc:06: 30:43:34:d1:63:1f:06:7d:c3:40:a8:2a:82:c1:a4:83:2a:fb:2e:8f:fb: f0:6d:ff:75:a3:78:f7:52:47:46:62:97:1d:d9:c6:11:0a:02:a2:e0:cc: 2a:75:6c:8b:b6:9b:87:00:7d:7c:84:76:79:ba:f8:b4:d2:62:58:c3:c5: b6:c1:43:ac:63:44:42:fd:af:c8:0f:2f:38:85:6d:d6:59:e8:41:42:a5: 4a:e5:26:38:ff:32:78:a1:38:f1:ed:dc:0d:31:d1:b0:6d:67:e9:46:a8: d:c4 Here is the same certificate dis
played in the 64-byte-encoded form interpreted by software: -----BEGIN CERTIFICATE----- MIICKzCCAZSgAwIBAgIBAzANBgkqhkiG9w0BAQQFADA3MQswCQYDVQQGEwJVUzER MA8GA1UEChMITmV0c2NhcGUxFTATBgNVBAsTDFN1cHJpeWEncyBDQTAeFw05NzEw MTgwMTM2MjVaFw05OTEwMTgwMTM2MjVaMEgxCzAJBgNVBAYTAlVTMREwDwYDVQQK EwhOZXRzY2FwZTENMAsGA1UECxMEUHViczEXMBUGA1UEAxMOU3Vwcml5YSBTaGV0 dHkwgZ8wDQYJKoZIhvcNAQEFBQADgY0AMIGJAoGBAMr6eZiPGf...
Building a Theme - Archive of obsolete content
net). No file extension. Now you should be ready to test your theme! Start Firefox. Firefox will detect the text link to your theme directory and install the theme. Your theme will not be active the first time you install, and you will need to click "Enable" and restart before you can see your change. After it restarts this second time, you should see the background color of the toolbars is dis
played in orange now. You can now go back and make additional changes to your css files, close and restart Firefox, and see the updates. Package Now that your theme works, you can package it for deployment and installation. Zip up the contents of your theme's folder (not the theme folder itself), and rename the zip file to have a .xpi extension. In Windows, you can do this easily by selecting all ...
Theme changes in Firefox 3 - Archive of obsolete content
le Description of change browser/themes/pinstripe/browser/tabbrowser/tabDragIndicator.png Removed superfluous blank pixels from the edges, so that the image is smaller. May or may not affect other Mac themes that use it. browser/themes/pinstripe/browser/browser.css .tabbrowser-tab[first-tab="true"] > .tab-image-left no longer has a margin-left. Instead .tabs-left now dis
played and given the same width as the former margin-left. It was already done this way in Winstripe. Changes in browser --- Changes in global All platforms The yellow background for the location bar has been deprecated; instead, themes should style the new #identity-box element depending on its verifiedDomain/verifiedIdentity class. The Go button is now located inside the location bar, so t...
Theme changes in Firefox 4 - Archive of obsolete content
tual add-on toolbar button icon dimensions (assuming correct stylesheet and images) small 16x16 pixels large 24x24 pixels Note: For stock buttons, the theme is free to use icons of any size. However, the theme should be designed in such a way that the above add-on button icon sizes fit correctly. Note: Add-ons always use a 24x24 pixels icon when the button is dis
played in the toolbar customization palette. Default values of the iconsize attribute on browser toolbars If the theme doesn't override the value of the iconsize attribute, the following defaults are used: Toolbar element ID Default iconsize value Menu bar #toolbar-menubar small Navigation bar #nav-bar small or large depending on user preference. ...
Settings - Archive of obsolete content
properly. Show Panes on Startup When this option is enabled, the debugger's variables pane is visible when you first start the debugger. Show Only Enumerable Properties Do not display non-enumerable JavaScript properties. Show Variables Filter Box Enabling this option adds a "Filter variables" search box to the variables pane, so that you can filter the dis
played list of variables. Show Original Sources Enabling this option will make the debugger use source maps, if they are available, to display the original source for code which has been combined, minified, or even compiled to JavaScript from a language like CoffeeScript. Defaults to true. Automatically Black Box Minified Sources New in Firefox 33. Automatical...
CSS - Archive of obsolete content
supported only in Internet Explorer 10, Internet Explorer 11, and Microsoft Edge.::-ms-expandThe ::-ms-expand CSS pseudo-element is a Microsoft extension that represents the button of a <select> menu control that opens or closes the drop-down menu. Typically it is a triangle that points downward.::-ms-fillThe ::-ms-fill CSS pseudo-element is a Microsoft extension that represents a progress bar dis
played by <progress>.::-ms-fill-lowerThe ::-ms-fill-lower CSS pseudo-element represents the lower portion of the track of a slider control; that is, the portion corresponding to values less than the value currently selected by the thumb. A slider control is one possible representation of <input type="range">.::-ms-fill-upperThe ::-ms-fill-upper CSS pseudo-element is a Microsoft extension that represents...
Displaying notifications (deprecated) - Archive of obsolete content
d API has been dropped in Firefox 22 in favor of the standard API. To see how to use the standard API, please read: Using Web Notifications Mobile Only in Gecko 2.0 Available only in Firefox Mobile as of Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Firefox offers support for "desktop notifications"; these are notifications that are dis
played to the user outside the context of the web content, using the standard notification system provided by the operating system. For example, on Android, notifications appear in the bar at the top of the screen, and in the panel that appears when you drag that bar downward. Creating a notification The first thing you need to do is create the notification object by using the navigator.mozNotificati...
Date.prototype.toLocaleFormat() - Archive of obsolete content
even ambiguous or unreadable dates. Also note that the behavior of the used locale depends on the platform, and the user might customize the locale used, so using the system locale the choose the format string might in some cases not even be adequate. You might consider using some of the more general toLocale* methods of the Date object or doing your own custom localization of the date to be dis
played using some of the get* methods of the Date object instead of using this method. Examples Using toLocaleFormat() var today = new Date(); var date = today.toLocaleFormat('%A, %B %e, %Y'); In this example, toLocaleFormat() returns a string such as "Wednesday, October 3, 2007". Note that the format string in this example is not properly localized, which will result in the problems described abov...
Writing JavaScript for XHTML - Archive of obsolete content
comments so as to be able to work in either application/xhtml+xml or text/html: <script type="text/javascript"> //<![CDATA[ ... //]]> </script> <!-- (For styles, it is different) --> <style type="text/css"> /*<![CDATA[*/ ... /*]]>*/ </style> And if you really need compatibility with very old browsers that do not recognize the script or style tags resulting in their contents dis
played on the page, you can use this: <script type="text/javascript"><!--//--><![CDATA[//><!-- ... //--><!]]></script> <!-- (For styles, it is different) --> <style type="text/css"><!--/*--><![CDATA[/*><!--*/ ... /*]]>*/--></style> See this document for more on the issues related to application/xhtml+xml and text/html (at least as far as XHTML 1.* and HTML 4; HTML5 addresses many of...
XForms Custom Controls - Archive of obsolete content
-moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-output-mediatype-anyURI'); } Custom Data Types If you define a new schema data type or you use a built-in data type and find the current XForms control for this type to be insufficient, then you should write a new custom control. For example, if you have an instance node of type xsd:date and you'd like to see the date dis
played in a local format. In Mozilla, every bound XForms control has a typelist attribute of mozType namespace that contains the inheritance chain of data types that we detected. The mozType namespace is introduced by Mozilla XForms implementation and its URI is http://www.mozilla.org/projects/xforms/2005/type. For example, if a control is bound to a node of type xsd:integer then the typelist attribute ...
XForms Alert Element - Archive of obsolete content
URL of a document whose contents will be retrieved by the alert element and used to provide the alert message for the containing form control. Type restrictions The alert element can be bound to any simple content. Representations Can be represented in two ways: modeless window that contains the alert element's message (default representation). the alert element's message can also be dis
played immediately after the containing form control element in the XForms document's layout. This representation is used if the alert element has an inline display style. Examples <xforms:model> <xforms:instance> <data xmlns=""> <x>10</x> </data> </xforms:instance> <xforms:bind id="x" nodeset="x" type="xsd:integer"/> </xforms:model> <style> @namespace xforms url("http://www.w3.org/2002/x...
XForms Help Element - Archive of obsolete content
The message of the help element can exist in instance data, in a remote document, or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, linking attributes, inline text. ...
XForms Hint Element - Archive of obsolete content
The message of the hint element can exist in instance data, in a remote document, or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, linking attributes, inline text. Attributes Single-Node Binding Linking src - URL of a document whose contents will be retrieved by the hint element and used to provide hint text for the containing form control. ...
XForms Input Element - Archive of obsolete content
nd instance node will be updated when the control loses the focus. checkbox Most often used when the form author only needs a simple 'true', 'false', '1', or '0' response from the user (xhtml/xul). Characteristics used when the instance node is of type xsd:boolean or a type derived from it analogous widgets are <xhtml:input type="checkbox"/> and <xul:checkbox/> The corresponding label can be dis
played before or after the checkbox by using the labelposition attribute. Specific handling of attributes incremental - if "true" or this attribute is omitted from this element, then the instance node will be updated when the user checks or un-checks the checkbox. If "false" then the instance node will be updated when the checkbox loses the focus. labelposition - a Mozilla XForms extension in the name...
XForms Repeat Element - Archive of obsolete content
That node will serve as the context node for any relative xpath expressions in that set of repeated markup. Attributes UI Common appearance - the value of this attribute gives a hint to the XForms processor as to which type of widget(s) to use to represent this control. Node Set Binding Special startindex - optional 1-based initial value of the repeat index. ...
XForms Switch Module - Archive of obsolete content
uct that allows the creation of user interfaces where the user interface can be varied based on user actions and events. The module defines for this switch, case and toggle elements. Switch Element The element (see the spec) is used in conjunction with case and toggle elements. The switch element contains case elements which in turn contain markup. Only the contents of a single case may be dis
played at one time. The toggle element is an action that when triggered will make a case selected and visible and thereby hiding all other case elements contained by the same switch. Attributes Single-Node Binding Type restrictions The switch element can be bound to a node containing data of any type. Actually, the switch element doesn't interact with the data in the bound node. However, having a re...
XForms - Archive of obsolete content
ts, XForms tried to address some of the limitations of the current HTML forms model. However, XForms never gained traction and is now considered obsolete. Other strengths that XForms brings to the table is the separation of data from presentation, strong data typing, the ability to submit XML data to servers instead of name/value pairs, and a descriptive way to author forms so that they can be dis
played by a wide variety of devices. XForms is a W3C specification. XForms Tutorial and Cookbook XForms in Wikibook Format - Over 50 examples tested with Firefox. XForms support can be added to Firefox and SeaMonkey by installing the Mozilla XForms extension. This extension, while supporting a significant subset of the XForms 1.0 and 1.1 candidate recommendations, is not actively maintained any more ...
Archived open Web documentation - Archive of obsolete content
stances to arrive at a common sense approach to browser detection. Browser Feature Detection An experimental approach to discovering degree of support for Standards CSS Obsolete CSS features Displaying notifications (deprecated) Firefox offers support for "desktop notifications"; these are notifications that are dis
played to the user outside the context of the web content, using the standard notification system provided by the operating system. E4X ECMAScript for XML (E4X) is a programming language extension that adds native XML support to JavaScript. It does this by providing access to the XML document in a form that feels natural for ECMAScript programmers. T...
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
, where the number that precedes each list item may be obviously different than the content that follows it. In fact, the markers were set to be a uniform size that did not change to match the content of the list items, so in rare cases the marker might actually appear to be smaller. See bug 110360, which explains the problem and shows when the fix was applied. In addition, when a document is dis
played in "quirks" mode in Mozilla 0.9.4 and later, the markers of lists will not use the font size of the list item text, but will instead stay the same as the user's default font size. See bug 97351 for more details. The Solution Fortunately, there are Mozilla-specific CSS-like rules that can be used to correct both problems. The following rule is derived from Mozilla's html.css file: *|*:-moz-list...
Mozilla's DOCTYPE sniffing - Archive of obsolete content
e that makes this determination is currently in DetermineParseMode() in nsParser.cpp. See bug 1312 and bug 55264 for some of the history of the mode determination. See bug 153032 for the creation of the Almost-Standards mode around Mozilla 1.0. The goals that led to choosing this behavior were the following: Almost all existing text/html pages on the Web that need to be in quirks mode to be dis
played correctly should be dis
played using quirks mode. (Almost all, rather than all, to allow for the following points as well.) Authors writing Web pages to current standards should be able to trigger strict mode. Pages written using any public identifiers in DOCTYPE declarations that appear in the future should be dis
played using strict mode. In other words, the algorithm is the best approximatio...
Using the Right Markup to Invoke Plugins - Archive of obsolete content
value="1.au|2.au|3.au|4.au|5.au|6.au|7.au|8.au|9.au|0.au" /> <param name="pause" value="200" /> <p>You need the Java Plugin. Get it from <a href="http://java.sun.com/products/plugin/index.html">here.</a></p> </object> The above code mentions a version specific MIME type, and if the Mozilla-based browser such as Netscape 7 doesn't have JRE 1.4.1_01 installed, the alternate text is dis
played. It isn't always necessary to give such a version specific MIME type. If you aren't taking advantage of any version specific features, a more generic MIME type such as application/x-java-vm will do the job just as well. The configuration parameters for the applet, including the class which contains the initial entry point (Animator.class, referenced by the "code" param element), are specified in ...
Index - Game development
cript, Laptop, Mobile, keyboard, mouse, touch One of HTML5's main advantages as a game development platform is the ability to run on various platforms and devices. Streamlining cross device differences creates multiple challenges, not least when providing appropriate controls for different contexts. In this series of articles we will show you how you can approach building a game that can be
played using touchscreen smartphones, mouse and keyboard, and also less common mechanisms such as gamepads. 31 Desktop gamepad controls Controls, Desktop, Gamepad API, Gamepads, Games, JavaScript, controllers That's it! We have successfully implemented gamepad controls in our game -- try connecting any popular controller like the XBox 360 one and see for yourself how fun it is to av...
Game distribution - Game development
put your HTML5 games into the same arena (see Native desktop, later on) and you should because it's good to diversify the platforms you support, but you have to remember that developers creating desktop games have years of experience, great tools and stable distribution channels. Many HTML5 games will target different market segments than native desktop games, e.g. simple time killer games to be
played while on the move rather than huge immersive experiences. Such games are often designed to be
played with two, or even one finger, so you can hold the device, play the game and be able to use the second hand for whatever you currently need. Saying this, desktop platforms can be used for distribution quite easily with the availability of wrappers that can help you prepare native builds of your ga...
Game monetization - Game development
effective -- only a small fraction of players will actually pay for IAPs. How small? It varies, but around one person in every thousand is about average. The more people that play your game, the higher the chance someone will pay, so your earnings heavily depend on your promotion activities. Freemium Games that feature IAPs are often referred to a freemium -- a freemium game can be acquired and
played for free, but you can pay for extra (premium) features, virtual goods or other benefits. The word itself acquired negative connotations after big companies focused on creating games, the main purpose of which was to get as much money from the players as possible instead of delivering a fun experience. The worst cases were when you could use real money to pay for getting advantages over other play...
Explaining basic 3D theory - Game development
texels the same way picture elements are combined from pixels. Applying textures onto objects during the fragment processing stage of the rendering pipeline allows us to adjust it by wrapping and filtering it if necessary. Texture wrapping allows us to repeat the 2D image around the 3D object. Texture filtering is applied when the original resolution or the texture image is different from the dis
played fragment -- it will be minified or magnified accordingly. Lighting The colors we see on the screen is a result of the light source interacting with the surface colors of the object's material. Light might be absorbed or reflected. The standard Phong Lighting Model implemented in WebGL has four basic types of lighting: Diffuse: A distant directional light, like the sun. Specular: A point of ...
Building up a basic demo with A-Frame - Game development
="rotation" from="20 0 0" to="20 360 0" direction="alternate" dur="4000" repeat="indefinite" easing="ease"> </a-animation> </a-box> As with any other entities, you can define key properties for the animation. We'll be animating the rotation attribute from 20 0 0 to 20 360 0, so it will do a full spin. The animation direction is set to alternate so the animation will be
played forward, and then back. The duration is set to 4 seconds, and it will be repeated indefinitely. The animation uses ease for easing, with tween.js being implemented internally. Scaling We can also add animation to entities with custom geometry like the torus, in much the same way. Add the following <a-animation> element to your torus: <a-entity geometry=" primitive: torus; radius: 1; ...
Building up a basic demo with Babylon.js - Game development
eate a Babylon.js engine instance first (passing it the <canvas> element to render on) before we start developing our game. Add the following code to the bottom of your second <script> element: var engine = new BABYLON.Engine(canvas); The BABYLON global object contains all the Babylon.js functions available in the engine. Creating a scene A scene is the place where all the game content is dis
played. While creating new objects in the demo, we will be adding them all to the scene to make them visible on the screen. Let's create a scene by adding the following lines just below our previous code: var scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color3(0.8, 0.8, 0.8); Thus, the scene is created and the second line sets the background color to light gray. Creating a rende...
WebVR — Virtual Reality for the Web - Game development
is is taken from, see Using the WebVR API. Tools and techniques The first WebVR experiments and demos used Three.js as it's probably the most popular 3D engine for the web. See the VREffect and VRControls functions available on the Three.js github to help you implement and handle WebVR with Three.js. Boris Smus has written about the concept of Responsive WebVR, where a single web game can be
played on various devices like laptops without VR hardware, PCs with Oculus Rift, or smartphones inside Google Cardboard and still deliver a unique and valuable experience across all of them. It's like responsive design, but applied to the VR world -- write once and run in any VR headset ... or without it. You can check the WebVR Boilerplate sources -- it's a good example to start learning WebVR from, a...
Implementing game control mechanisms - Game development
One of HTML5's main advantages as a game development platform is the ability to run on various platforms and devices. Streamlining cross device differences creates multiple challenges, not least when providing appropriate controls for different contexts. In this series of articles we will show you how you can approach building a game that can be
played using touchscreen smartphones, mouse and keyboard, and also less common mechanisms such as gamepads. Case study We'll be using the Captain Rogers: Battle at Andromeda demo as an example. Captain Rogers was created using the Phaser framework, the most popular tool for simple 2D game development in JavaScript right now, but it should be fairly easy to reuse the knowledge contained within these articles when building games in pure JavaSc...
Tiles and tilemaps overview - Game development
creen coordinates (the actual position where those elements are rendered on the screen). The world coordinates can be expressed in terms of tile position (row and column of the map) or in pixels across the map, depending on the game. To be able to transform world coordinates into screen coordinates, we need the coordinates of the camera, since they determine which section of the world is being dis
played. Here are examples showing how to translate from world coordinates to screen coordinates and back again: // these functions assume that the camera points to the top left corner function worldToScreen(x, y) { return {x: x - camera.x, y: y - camera.y}; } function screenToWorld(x,y) { return {x: x + camera.x, y: y + camera.y}; } Rendering A trivial method for rendering would just be to it...
Animations and tweens - Game development
llide(ball, bricks, ballHitBrick); paddle.x = game.input.x || game.world.width*0.5; } Then we can create the ballHitPaddle() function (having ball and paddle as default parameters), playing the wobble animation when it is called. Add the following function just before your closing </script> tag: function ballHitPaddle(ball, paddle) { ball.animations.play('wobble'); } The animation is
played every time the ball hits the paddle. You can add the animations.play() call inside the ballHitBrick() function too, if you feel it would make the game look better. Tweens Whereas animations play external sprites sequentially, tweens smoothly animate properties of an object in the gameworld, such as width or opacity. Let's add a tween to our game to make the bricks smoothly disappear when they ...
Browsing context - MDN Web Docs Glossary: Definitions of Web-related terms
A browsing context is the environment a browser displays a Document. In modern browsers, it usually is a tab, but can be a window or even only parts of a page, like a frame or an iframe. Each browsing context has a specific origin, the origin of the active document and a history that memorize all the dis
played documents, in order. Communication between browsing context is severaly constrained. Between browsing context of the same origin, a BroadcastChannel can be opened and used. Learn more See origin ...
Favicon - MDN Web Docs Glossary: Definitions of Web-related terms
Note, however, that most modern browsers replaced the favicon from the address bar by an image indicating whether or not the website is using HTTPS. Usually, a favicon is 16 x 16 pixels in size and stored in the GIF, PNG, or ICO file format. They are used to improve user experience and enforce brand consistency. ...
ITU - MDN Web Docs Glossary: Definitions of Web-related terms
The International Telecommunication Union (ITU) is the organization authorized by the United Nations to establish standards and rules for telecommunication, including telegraph, radio, telephony and the internet. From defining rules for ensuring transmissions get to where they need to go to and creating the "SOS" alert signal used in Morse code, the ITU has long
played a key role in how we use technology to exchange information and ideas. In the Internet Age, the ITU's role of establishing standards for video and audio data formats used for streaming, teleconferencing, and other purposes. For example, the ITU and the Moving Picture Experts Group (MPEG) worked together to develop and publish, as well as to maintain, the various MPEG specifications, such as MPEG-2 (ITU H.262), AVC (ITU H.
MVC - MDN Web Docs Glossary: Definitions of Web-related terms
, then the model will usually notify the view (so the display can change as needed) and sometimes the controller (if different logic is needed to control the updated view). Going back to our shopping list app, the model would specify what data the list items should contain -- item, price, etc. -- and what list items are already present. The View The view defines how the app's data should be dis
played. In our shopping list app, the view would define how the list is presented to the user, and receive the data to display from the model. The Controller The controller contains logic that updates the model and/or view in response to input from the users of the app. So for example, our shopping list could have input forms and buttons that allow us to add or delete items. These actions require th...
Media (Audio-visual presentation) - MDN Web Docs Glossary: Definitions of Web-related terms
The term media (more accurately, multimedia) refers to audio, video, or combined audio-visual material such as music, recorded speech, movies, TV shows, or any other form of content that is presented over a period of time. More broadly, media may include still images such as photographs or other still images. Media content can be recorded,
played back, presented, and at times interacted with in various ways. Learn more General knowledge Multimedia on Wikipedia Technical reference Web media technologies: a guide to all the ways media can be used in web content Multimedia and Embedding in the MDN learning area <audio> and <video> elements, used to present media in HTML documents ...
Pixel - MDN Web Docs Glossary: Definitions of Web-related terms
A pixel is the smallest building block of a graphical display like a computer screen. Display resolution is expressed in the unit of pixels. eg: A "800 x 600" pixel resolution means that 800 pixels can be dis
played in width and 600 pixels in height. Learn more Technical reference Pixel on Wikipedia ...
Screen reader - MDN Web Docs Glossary: Definitions of Web-related terms
nteract with dedicated accessibility APIs, using various operating system features and employing hooking techniques. VoiceOver macOS comes with VoiceOver, a built-in screen reader. To access VoiceOver, go to System Preferences > Accessibility > VoiceOver. You can also toggle VoiceOver on and off with fn+command + F5. VoiceOver both reads aloud and displays content. The content read aloud is dis
played in a dark grey box. Desktop/laptop screen reader users navigate websites with a keyboard or other non-pointing device. The best way to emulate use is to do the same. Just like keyboard navigation without VoiceOver, you can navigate through interactive elements using the tab key and the arrow keys: Next interactive element: Tab Previous interactive element: Shift + Tab Next radio button in ...
Script-supporting element - MDN Web Docs Glossary: Definitions of Web-related terms
In an HTML document, script-supporting elements are those elements that don't directly contribute to the appearance or layout of the page; instead, they're either scripts or contain information that's only used by scripts. These elements may be important, but do not affect the dis
played page unless the page's scripts explicitly cause them to do so. There are only two script-supporting elements: <script> and <template>. Technical reference To learn more, see Script-supporting elements in Kinds of HTML content. ...
caret - MDN Web Docs Glossary: Definitions of Web-related terms
Most user interfaces represent the caret using a thin vertical line or a character-sized box that flashes, but this can vary. This point in the text is called the insertion point. The word "caret" differentiates the text insertion point from the mouse cursor. On the web, a caret is used to represent the insertion point in <input> and <textarea> elements, as well as any elements whose contenteditable attribute is set, thereby allowing the contents of the element to be edited by the user. ...
HTML: A good basis for accessibility - Learn web development
rowser (it differs slightly between different browsers) so that you can tell what element is focused. You can then press Enter/Return to follow a focused link or press a button (we've included some JavaScript to make the buttons alert a message), or start typing to enter text in a text input. Other form elements have different controls, for example, the <select> element can have its options dis
played and cycled between using the up and down arrow keys. Note: Different browsers may have different keyboard control options available. See Using native keyboard accessibility for more details. You essentially get this behavior for free, just by using the appropriate elements, e.g. <h1>Links</h1> <p>This is a link to <a href="https://www.mozilla.org">Mozilla</a>.</p> <p>Another link, to the <...
HTML: A good basis for accessibility - Learn web development
rowser (it differs slightly between different browsers) so that you can tell what element is focused. You can then press Enter/Return to follow a focused link or press a button (we've included some JavaScript to make the buttons alert a message), or start typing to enter text in a text input. Other form elements have different controls, for example, the <select> element can have its options dis
played and cycled between using the up and down arrow keys. Note: Different browsers may have different keyboard control options available. See Using native keyboard accessibility for more details. You essentially get this behavior for free, just by using the appropriate elements, e.g. <h1>Links</h1> <p>This is a link to <a href="https://www.mozilla.org">Mozilla</a>.</p> <p>Another link, to the <...
Mobile accessibility - Learn web development
therefore need higher-resolution images so that the display can continue to look crisp and sharp. Again, you can serve images as appropriate using responsive image techniques. In addition, many image requirements can be fulfilled using the SVG vector images format, which is well-supported across browsers today. SVG has a small file size and will stay sharp regardless of whatever size is being dis
played (see Adding vector graphics to the web for more details). Note: We won't provide a full discussion of responsive design techniques here, as they are covered in other places around MDN (see above links). Specific mobile considerations There are other important issues to consider when making sites more accessible on mobile. We have listed a couple here, but we will add more when we think of ...
WAI-ARIA basics - Learn web development
the result of checking this checkbox is, as well as updating the aria-disabled state, and some visual indicators too: function toggleMusician(bool) { let instruItem = formItems[formItems.length-1]; if(bool) { instruItem.input.disabled = false; instruItem.label.style.color = '#000'; instruItem.input.setAttribute('aria-disabled', 'false'); hiddenAlert.textContent = 'Instruments
played field now enabled; use it to tell us what you play.'; } else { instruItem.input.disabled = true; instruItem.label.style.color = '#999'; instruItem.input.setAttribute('aria-disabled', 'true'); instruItem.input.removeAttribute('aria-label'); hiddenAlert.textContent = 'Instruments
played field now disabled.'; } } Describing non-semantic buttons as buttons A few times in thi...
What is accessibility? - Learn web development
levels or no hearing at all. Hearing-impaired people do use ATs (see Assistive Devices for People with Hearing, Voice, Speech, or Language Disorders), but there are not really special ATs specific for computer/web use. There are, however, specific techniques for providing textual alternatives to audio content which range from simple text transcripts to text tracks (i.e. captions) that can be dis
played along with video. An article, later on, will discuss these. Hearing-impaired people also represent a significant userbase -- "466 million people worldwide have disabling hearing loss", says the World Health Organization's Deafness and hearing loss fact sheet. People with mobility impairments These people have disabilities concerning movement, which might involve purely physical issues (such as...
Images, media, and form elements - Learn web development
hat CSS cannot affect the internal layout of these elements -- only their position on the page amongst other elements. As we will see however, there are various things that CSS can do with an image. Certain replaced elements, such as images and video, are also described as having an aspect ratio. This means that it has a size in both the horizontal (x) and vertical (y) dimensions, and will be dis
played using the intrinsic dimensions of the file by default. Sizing images As you already know from following these lessons, everything in CSS generates a box. If you place an image inside a box that is smaller or larger than the intrinsic dimensions of the image file in either direction, it will either appear smaller than the box, or overflow the box. You need to make a decision about what happens w...
Test your skills: Images and Form elements - Learn web development
oks: Use attribute selectors to target the search field and button inside .myform. Make the form field and button use the same text size as the rest of the form. Give the form field and button 10 px of padding. Give the button a purple background (I used rebeccapurple), white foreground, no border and rounded corners of 5px. Try updating the live code below to recreate the example as dis
played in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePe...
Test your skills: Overflow - Learn web development
the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Task Two In this task an image is in the box, it is bigger than the dimensions of the box so overflows visibly. Change it so that any image outside of the box is hidden. Try updating the live code below to recreate the example as dis
played in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePe...
Test your skills: The Box Model - Learn web development
ment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. The Box Model Two In this task, add to the box: A 5px, black, dotted border. A top margin of 20px. A right margin of 1em. A bottom margin of 40px. A left margin of 2em. Padding on all sides of 1em. Try updating the live code below to recreate the example as dis
played in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. The Box Model Three In this example the inline element has a margin, padding and border however the lines above and below are overlapping it. What can you add to your CSS to cause the size of the margin, padding, and border to be respected by t...
Test your skills: Flexbox - Learn web development
with an equal amount of space between each item. The finished example should look like the image below. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Flex Layout Two These list items are all different sizes, but we want them to be dis
played as three equal sized columns, no matter what content is in each item. Try updating the live code below to recreate the finished example: Additional questions: Can you now make the first item twice the size of the other items? For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Flex Layout Three There ...
Test Your Skills: Fundamental layout comprehension - Learn web development
ou can download the HTML, CSS, and a set of six images here. Save the HTML document and stylesheet into a directory on your computer, and add the images into a folder named images. Opening the index.html file in a browser should give you a page with basic styling but no layout, which should look something like the image seen below. This starting point has all of the content of your layout as dis
played by the browser in normal flow. If you don't want to work locally then using a tool such as CodePen or jsFiddle will work as well. You will need to upload the images using their Assets functionality and replace the value in the src attribute to point to the new image location. Your tasks You now need to implement your layout. The tasks you need to achieve are: To display the navigation i...
Test your skills: Grid Layout - Learn web development
w to recreate the finished example: Additional questions: Can you now cause the first item to display on top without changing the order of items in the source? For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Grid Layout Three There are four direct children in this grid; the starting point has them dis
played using auto-placement. Use the grid-area and grid-template-areas properties to lay the items out as shown in the image. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Grid and Flex Layout 4 You will need to use both Grid Layout and Flex...
Positioning - Learn web development
ve their position property explicitly defined, then by default all ancestor elements will have a static position. The result of this is, the absolutely positioned element will be contained in the initial containing block. The initial containing block has the dimensions of the viewport, and is also the block that contains the <html> element. Simply put, the absolutely positioned element will be dis
played outside of the <html> element, and be positioned relative to the initial viewport. The positioned element is nested inside the <body> in the HTML source, but in the final layout, it is 30px away from the top and left of the edge of the page. We can change the positioning context -- which element the absolutely positioned element is positioned relative to. This is done by setting positioning on ...
Practical positioning examples - Learn web development
n this circumstance because we have fixed content in our tabs. It also looks a bit jarring to have different tabs at different heights. Styling our tabs Now we want to style tabs to look like tabs -- basically, these are a horizontal navigation menu, but instead of loading different web pages when they are clicked on like we've seen previously in the course, they cause different panels to be dis
played on the same page. First, add the following rule at the bottom of your CSS to remove the default padding-left and margin-top from the unordered list: .info-box ul { padding-left: 0; margin-top: 0; } Note: We are using descendant selectors with .info-box at the start of the chain throughout this example -- this is so that we can insert this feature into a page with other content already on i...
Using CSS generated content - Learn web development
You modify your stylesheet to add text content or images. One of the important advantages of CSS is that it helps you to separate a document's style from its content. However, there are situations where it makes sense to specify certain content as part of the stylesheet, not as part of the document. You can specify text or image content within a stylesheet when that content is closely linked to the document's structure. Note: Content specified in a stylesheet does not become part of the DOM. Specifying content in a stylesheet can cause complications. ...
Fundamental text and font styling - Learn web development
nt. text-underline-position: Specify the position of underlines set using the text-decoration-line property underline value. text-rendering: Try to perform some text rendering optimization. Text layout styles: text-indent: Specify how much horizontal space should be left before the beginning of the first line of the text content. text-overflow: Define how overflowed content that is not dis
played is signaled to users. white-space: Define how whitespace and associated line breaks inside the element are handled. word-break: Specify whether to break lines within words. direction: Define the text direction (This depends on the language and usually it's better to let HTML handle that part as it is tied to the text content.) hyphens: Switch on and off hyphenation for supported languages. l...
Web fonts - Learn web development
iple font files in the package -- some fonts are distributed as a family with different variants available, for example thin, medium, bold, italic, thin italic, etc. For this example, we just want you to concern yourself with a single font file for each choice. Note: Under the "Find fonts" section in the right-hand column, you can click on the different tags and classifications to filter the dis
played choices. Generating the required code Now you'll need to generate the required code (and font formats). For each font, follow these steps: Make sure you have satisfied any licensing requirement, if you are going to use this in a commercial and/or Web project. Go to the Fontsquirrel Webfont Generator. Upload your two font files using the Upload Fonts button. Check the checkbox labeled "Ye...
How can we design for all types of users? - Learn web development
speak, and are expressed most of the time in pixels (px). For instance, if in your CSS you declare this: body { font-size:16px; } ... you are telling the browser that whatever happens, the font size must be 16 pixels. Modern browsers get around this rule by pretending that you're asking for "16 pixels when the user sets a zoom factor of 100%". Yet, for many years Internet Explorer adamantly dis
played 16 pixels as 16 pixels. In this case, zooming did nothing, even as late as Internet Explorer 8, which we still have to cater to because it's still around. Relative units Also called proportional units, relative units are computed relative to a parent element. Relative units are friendlier to accessibility because they respect the settings on the user's system. Relative units are expressed in e...
What is the difference between webpage, website, web server, and search engine? - Learn web development
asy to confuse these terms sometimes since they refer to related but different functionalities. In fact, you'll sometimes see these terms misused in news reports and elsewhere, so getting them mixed up is understandable! We'll cover these terms and technologies in more detail as we explore further, but these quick definitions will be a great start for you: web page A document which can be dis
played in a web browser such as Firefox, Google Chrome, Opera, Microsoft Internet Explorer or Edge, or Apple's Safari. These are also often called just "pages." website A collection of web pages which are grouped together and usually connected together in various ways. Often called a "web site" or simply a "site." web server A computer that hosts a website on the Internet. search engine A web serv...
What are browser developer tools? - Learn web development
The JavaScript debugger The JavaScript debugger allows you to watch the value of variables and set breakpoints, places in your code that you want to pause execution and identify the problems that prevent your code from executing properly. To get to the debugger: Firefox: Select ? Web Developer ? Debugger or press Ctrl + Shift + S to open the JavaScript Debugger. If the tools are already dis
played, click on the Debugger tab. Chrome: Open the Developer tools and then select the Sources tab. (Opera works the same way.) Edge and Internet Explorer 11: Press F12 and then, Ctrl + 3, or if the tools are already dis
played, click on the Debugger tab. Safari: Open the Developer Tools and then select the Debugger tab. Exploring the debugger There are three panes in the JavaScript Debugger on Fir...
Basic native form controls - Learn web development
button</strong> </button> <input type="button" value="This is an anonymous button"> Buttons always behave the same whether you use a <button> element or an <input> element. As you can see from the examples, however, <button> elements let you use HTML in their content, which is inserted between the opening and closing <button> tags. <input> elements on the other hand are empty elements; their dis
played content is inserted inside the value attribute, and therefore only accepts plain text as content. The following examples show default, focused, and disabled button input types -- in Firefox 71 and Safari 13 on macOS and Chrome 79 and Edge 18 on Windows 10. Image button The image button control is rendered exactly like an <img> element, except that when the user clicks on it, it behaves like ...
How the Web works - Learn web development
ces (for example, your computer connected to your Wi-Fi, or your phone connected to your mobile network) and web-accessing software available on those devices (usually a web browser like Firefox or Chrome). Servers are computers that store webpages, sites, or apps. When a client device wants to access a webpage, a copy of the webpage is downloaded from the server onto the client machine to be dis
played in the user's web browser. The other parts of the toolbox The client and server we've described above don't tell the whole story. There are many other parts involved, and we'll describe them below. For now, let's imagine that the web is a road. On one end of the road is the client, which is like your house. On the other end of the road is the server, which is a shop you want to buy something ...
The web and web standards - Learn web development
rver more quickly. Server-side languages and frameworks HTML, CSS, and JavaScript are front-end (or client-side) languages, which means they are run by the browser to produce a website front-end that your users can use. There are another class of languages called back-end (or server-side) languages, meaning that they are run on the server before the result is then sent to the browser to be dis
played. A typical use for a server-side language is to get some data out of a database and generate some HTML to contain the data, before then sending the HTML over to the browser to display it to the user. Example server-side languages include ASP.NET, Python, PHP, and NodeJS. Web best practices We have briefly talked about the technologies that you'll use to build websites. Now let's discuss the be...
Tips for authoring fast-loading HTML pages - Learn web development
. <script> ... JavaScript files for functions required during the loading of the page, but not any interaction related JavaScript that can only run after page loads. Minimize the number of files for performance while keeping unrelated JavaScript in separate files for maintenance. . <body> . User visible page content in small chunks ( <header>/ <main>/ <table>) that can be dis
played without waiting for the full page to download. . <script> ... Any scripts which will be used to perform interactivity. Interaction scripts typically can only run after the page has completely loaded and all necessary objects have been initialized. There is no need to load these scripts before the page content. That only slows down the initial appearance of the page load. Minimize the...
Introduction to HTML - Learn web development
define elements, attributes, and other important terms, and show where they fit in the language. We also show how a typical HTML page is structured and how an HTML element is structured, and explain other important basic language features. Along the way, we'll play with some HTML to get you interested! What's in the head? Metadata in HTML The head of an HTML document is the part that is not dis
played in the web browser when the page is loaded. It contains information such as the page <title>, links to CSS (if you want to style your HTML content with CSS), links to custom favicons, and metadata (data about the HTML, such as who wrote it, and important keywords that describe the document). HTML text fundamentals One of HTML's main jobs is to give text meaning (also known as semantics), so tha...
From object to iframe — other embedding technologies - Learn web development
an invisible iframe into your document (or embed your document into their own malicious website) and use it to capture users' interactions. This is a common way to mislead users or steal sensitive data. A quick example first though -- try loading the previous example we showed above into your browser -- you can find it live on Github (see the source code too.) You won't actually see anything dis
played on the page, and if you look at the Console in the browser developer tools, you'll see a message telling you why. In Firefox, you'll get told Load denied by X-Frame-Options: /docs/Glossary does not permit framing. This is because the developers that built MDN have included a setting on the server that serves the website pages to disallow them from being embedded inside <iframe>s (see Configure CS...
Introducing asynchronous JavaScript - Learn web development
blem -- you can't include an async code block that returns a result, which you then rely on later in a sync code block. You just can't guarantee that the async function will return before the browser has processed the sync block. To see this in action, try taking a local copy of our example, and changing the fourth console.log() call to the following: console.log ('All done! ' + image.src + 'dis
played.'); You should now get an error in your console instead of the third message: TypeError: image is undefined; can't access its "src" property This is because at the time the browser tries to run the third console.log() statement, the fetch() block has not finished running so the image variable has not been given a value. Note: For security reasons, you can't fetch() files from your local file...
Graceful asynchronous programming with Promises - Learn web development
ObjectURL() method, passing it as a parameter the Blob returned when the second promise fulfills. This will return a URL pointing to the object. Then we create an <img> element, set its src attribute to equal the object URL and append it to the DOM, so the image will display on the page! If you save the HTML file you've just created and load it in your browser, you'll see that the image is dis
played in the page as expected. Good work! Note: You will probably notice that these examples are somewhat contrived. You could just do away with the whole fetch() and blob() chain, and just create an <img> element and set its src attribute value to the URL of the image file, coffee.jpg. We did, however, pick this example because it demonstrates promises in a nice simple fashion, rather than for its r...
Drawing graphics - Learn web development
r = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); The first line creates a new renderer, the second line sets the size at which the renderer will draw the camera's view, and the third line appends the <canvas> element created by the renderer to the document's <body>. Now anything the renderer draws will be dis
played in our window. Next, we want to create the cube we'll display on the canvas. Add the following chunk of code at the bottom of your JavaScript: let cube; let loader = new THREE.TextureLoader(); loader.load( 'metal003.png', function (texture) { texture.wrapS = THREE.RepeatWrapping; texture.wrapT = THREE.RepeatWrapping; texture.repeat.set(2, 2); let geometry = new THREE.BoxGeomet...
Manipulating documents - Learn web development
window-resize-example.html and bgtile.png demo files. Open it and have a look -- you'll see that we've got a <div> element covering a small part of the screen, which has got a background tile applied to it. We'll use that to represent our app UI area. First of all, let's grab a reference to the div, and then grab the width and height of the viewport (the inner window, where your document is dis
played) and store them in variables -- these two values are handily contained in the Window.innerWidth and Window.innerHeight properties. Add the following lines inside the existing <script> element: const div = document.querySelector('div'); let winWidth = window.innerWidth; let winHeight = window.innerHeight; Next, we'll dynamically alter the width and height of the div to equal that of the viewp...
Third-party APIs - Learn web development
Displaying the data OK, let's look at how we'll display the data. Add the following function below your fetchResults() function. function displayResults(json) { while (section.firstChild) { section.removeChild(section.firstChild); } const articles = json.response.docs; if(articles.length === 10) { nav.style.display = 'block'; } else { nav.style.display = 'n...
Object prototypes - Learn web development
. Below the existing JavaScript, add the following code, which adds a new method to the constructor's prototype property: Person.prototype.farewell = function() { alert(this.name.first + ' has left the building. Bye for now!'); }; Save the code and load the page in the browser, and try entering the following into the text input: person1.farewell(); You should get an alert message dis
played, featuring the person's name as defined inside the constructor. This is really useful, but what is even more useful is that the whole inheritance chain has updated dynamically, automatically making this new method available on all object instances derived from the constructor. Think about this for a moment. In our code we define the constructor, then we create an instance object from the constru...
Introducing JavaScript objects - Learn web development
ir "parent" classes. In addition, we present some advice on when and where you might use OOJS. Working with JSON data JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax, which is commonly used for representing and transmitting data on web sites (i.e. sending some data from the server to the client, so it can be dis
played on a web page). You'll come across it quite often, so in this article, we give you all you need to work with JSON using JavaScript, including parsing the JSON so you can access data items within it and writing your own JSON. Object building practice In previous articles we looked at all the essential JavaScript object theory and syntax details, giving you a solid base to start from. In this art...
CSS performance optimization - Learn web development
operty tells browsers which properties of an element are expected to change enabling browsers to set up optimizations before the element is actually changed, improving performance by doing potentially expensive work before it is required. will-change: opacity, transform; The font-display property Applied to the @font-face rule, the font-display property defines how font files are loaded and dis
played by the browser, allowing text to appear with a fallback font while a font loads, or fails to load. This improves performance by making the text visible instead of having a blank screen, with a trade-off being a flash of unstyled text. @font-face { font-family: someFont; src: url(/path/to/fonts/someFont.woff) format('woff'); font-weight: 400; font-style: normal; font-display: fallback; ...
Server-side web frameworks - Learn web development
lying database as that is a configuration setting that may be changed separately of our code. The first code snippet below shows a very simple Django model for a Team object. This stores the team name and team level as character fields and specifies a maximum number of characters to be stored for each record. The team_level is a choice field, so we also provide a mapping between choices to be dis
played and data to be stored, along with a default value. #best/models.py from django.db import models class Team(models.Model): team_name = models.CharField(max_length=40) TEAM_LEVELS = ( ('U09', 'Under 09s'), ('U10', 'Under 10s'), ('U11', 'Under 11s'), ... #list our other teams ) team_level = models.CharField(max_length=3,choices=TEAM_LEVELS,defaul...
Server-side website programming - Learn web development
server-side technology to dynamically display data as required. For example, imagine how many products are available on Amazon, and imagine how many posts have been written on Facebook. Displaying all 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 dis
played 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 recommended. 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 d...
TypeScript support in Svelte - Learn web development
le, if you start adding an ms property to the Alert component call, TypeScript will infer from the default value that the ms property should be a number: And if you pass something that is not a number it will complain about it: The application template has a validate script configured that runs svelte-check against your code. This package allows you to detect errors and warnings normally dis
played by a code editor from the command line, which makes it pretty useful for running it in a continuous integration (CI) pipeline. Just run npm run validate to check for unused CSS, and return A11y hints and TypeScript compile errors. In this case, if you run npm run validate (either in the VS Code console or terminal) you will get the following error: Even better, if you run it from the VS Code ...
Working with Svelte stores - Learn web development
res into its reactivity system using the reactive $store syntax. If you create your own stores honoring the store contract, you get this reactivity syntactic sugar for free. Creating the Alert component To show how to work with stores, we will create an Alert component. These kind of widgets might also be known as popup notifications, toast, or notification bubbles. Our Alert component will dis
played by the App component, but any component can send notifications to it; whenever a notification arrives the Alert component will be in charge of displaying it on screen. Creating a store Let's start by creating a writable store. Any component will be able to write to this store, and the Alert component will subscribe to it and display a message whenever the store is modified. Create a new f...
Dynamic behavior in Svelte: working with variables and props - Learn web development
ld see the "2 out of 3 items completed" message as before, but this time the information is coming from the todos array. To prove it, go to that array, and try changing some of the todo object's completed property values, and even add a new todo object. Observe how the numbers in the message are updated appropriately. Dynamically generating the todos from the data At the moment, our dis
played todo items are all static. We want to iterate over each item in our todos array and render the markup for each task, so let's do that now. HTML doesn't have a way of expressing logic -- like conditionals and loops. Svelte does. In this case we use the {#each...} directive to iterate over the todos array. The second parameter, if provided, will contain the index of the current item. Also, a key e...
Adding a new todo form: Vue events, methods, and models - Learn web development
/> element inside your App's <template>, like so: <template> <div id="app"> <h1>My To-Do List</h1> <to-do-form></to-do-form> <ul> <li v-for="item in ToDoItems" :key="item.id"> <to-do-item :label="item.label" :done="item.done" :id="item.id"></to-do-item> </li> </ul> </div> </template> Now when you view your running site, you should see the new form dis
played. If you fill it out and click the "Add" button, the page will post the form back to the server, but this isn't really what we want. What we actually want to do is run a method on the submit event that will add the new todo to the ToDoItem data list defined inside App. To do that, we'll need to add a method to the component instance. Creating a method & binding it to an event with v-on To mak...
Package management basics - Learn web development
ght out of the box and you will likely need some modern tooling to bundle your code and dependencies together when they are released on the web. A bundle is the term that's generally used to refer to a single file on your web server that contains all the JavaScript for your software -- typically compressed as much as possible to help reduce the time it takes to get your software downloaded and dis
played in your visitors' browser. In addition, what happens if you find a better tool that you want to use instead of the current one, or a new version of your dependency is released that you want to update to? This is not too painful for a couple of dependencies, but in larger projects with many dependencies this kind of thing can become really challenging to keep track of. It makes more sense to use ...
Accessibility Features in Firefox
ow contrast, with large or small fonts. Text files used in configuration (techies only): configuration files are easily edited with any text editor. For example, prefs.js gives access to a large number of configuration options not available in the preferences window. Also, userContent.css allows users knowledgeable about cascading style sheets to customize the appearance of all pages that are dis
played. Finally, bookmarks.html contains all your bookmarks, and is easy to move around from computer to computer. View selection source (techies only): when you select some text and right click or press Shift+F10, you can "view selection source". This will show the HTML source for only the selected text, which is useful for understanding accessibility problems in some web sites. Customize Your Exper...
Mozilla accessibility architecture
In the destructor for nsWindow: when the document is destroyed, its window also goes away. If there is a newly loading document, it has its own separate window which has already been created and rendered into. In fact, for about a second two nsDocAccessible's exist for the same screen space - one for the old document about to be destroyed, and one for the loading document which hasn't been dis
played yet. Side note: we do not fire the event indicating the new document is ready, until the new document is dis
played. From a mutation event callback in nsDocAccessible, indicating that a node or subtree of nodes is changing or being removed. We iterate through all the dom nodes in the subtree, checking for nsIAccessNode entries in the cache for each dom node, shutting them down if they exist. Thi...
Mozilla's Section 508 Compliance
look and feel, is automatically selected. Complete when run in the Gnome desktop. The default theme, Classic, uses Gnome's font and color contrast settings. Under Linux/UNIX it is the user's choice, whether to stick with the Gnome theme or not -- they must choose Classic if they want to follow the Gnome theme. Unknown - needs research (h) When animation is dis
played, the information shall be displayable in at least one non-animated presentation mode at the option of the user. Complete. Mozilla's preferences under Privacy & Security - Images contain options for making animated images still. (i) Color coding shall not be used as the only means of conveying information, indicating an action, prompting a response, or distinguishing ...
Frequently Asked Questions for Lightweight themes
at you think. Visit the Themes forum to send us your feedback. Creating Your Own Themes Can I create my own Theme? Absolutely! All you need to do is create two graphics files in your favorite graphics editing program (e.g., Photoshop). To get started read more about how to create a theme. Are there any content guidelines? Yes. We are big fans of creativity, but want to ensure that the art dis
played in the Themes gallery meets a basic set of guidelines. Please review the Terms of Service and Conditions of Use for authoritative and complete language. Do I still retain ownership over artwork that I upload? Yes. Your artwork will always be your artwork. After creating a Lightweight theme, can I edit the design? Yes. If at any point you need to edit or delete your theme design after it has b...
Lightweight themes
Lightweight themes are sometimes referred to as "Background themes" or, (on addons.mozilla.org) as just "Themes". How to create your own lightweight theme Lightweight themes are made up of a "header" graphic image file, which skins the default Firefox UI background. Finished Your Design? You can submit it right now! Creating a theme header image The header image is dis
played as the background of the top of the browser window, nestling in behind the toolbars, address bar, search bar and the tab strip. It will be anchored to the top-right corner of the browser window. View a sample Theme Header here. Image requirements Dimensions should be 3000px wide x 200px high PNG or JPG file format Image must be no larger than 300 KB in file size Tips Subtle, soft contrast images and ...
Creating reftest-based unit tests
ble to create a reftest that tests markup against an actual graphic image of the visual construct that should result. This is probably going to be a more fragile test, for the reasons described above. But it may be necessary. For example, say that certain markup should produce a certain Sanskrit glyph. How does one test that? One should be able to "snap a picture" of the glyph as it should be dis
played and then the reference page would include that graphic in an <img> element. More investigation into whether this will work is definitely warranted. Experiments with this have shown it to be not as easy as one would hope. We'll see. Here is a list of reftest opportunities files in the source. These are files that have been checked in to be tested. Presumably, one was supposed to open the pages w...
Error codes returned by Mozilla APIs
These constants can be accessed through Components.results. For example, by using Components.results.NS_ERROR_NOT_INITIALIZED General Errors The following errors are general and can occur when using any component. NS_ERROR_NOT_INITIALIZED (0xC1F30001) An attempt was made to use a component or object which has not yet been initialized. ...
Experimental features in Firefox
Yes Developer Edition 43 No Beta 43 No Release 43 No Preference name layout.css.control-characters.enabled or layout.css.control-characters.visible Property: initial-letter The initial-letter CSS property is part of the CSS Inline Layout specification and allows you to specify how dropped, raised, and sunken initial letters are dis
played. See bug 1223880 for more details. Release channel Version added Enabled by default? Nightly 50 No Developer Edition 50 No Beta 50 No Release 50 No Preference name layout.css.initial-letter.enabled Conic gradients Conic gradients expand CSS gradients to allow the color transitions to be rendered...
Storage access policy: Block cookies from trackers
aw the advertisements on their website and the conversion will not be tracked. We expect that most view-through conversion tracking techniques will no longer work, including those offered by display networks. You run an ad on a display network or social media website that is clicked by a user. That user lands on your website, which includes a conversion tracking tag from the same website that dis
played your ad. This type of conversion is often referred to as a "click-through conversion." Since the social media site or display network will not have access to their third-party storage, they will not recognize the user as the same user that saw the advertisements on their website and the conversion will not be tracked. We expect that this version of click-through conversion will no longer work. Y...
Embedding the editor
supports the <HTMLArea> element; if Mozilla is to support something similar, editor needs to be embeddable to the extent that this can be done. It is likely that we'd use XBL to implement this type of widget, as is the plan for other form controls. As is the case for composer embedded in a native application, there is a requirement here that the composer UI be configurable, such that it can be dis
played either as a toolbar at the top of the <htmlarea>, a floating palette, or a top-level toolbar. Current problems The current composer architecture was created while other parts of Mozilla were still under development, and as a result it suffers from a number of shortcomings, and anachronisms. This section describes its major faults. Editor incorrectly rooted The editor in a composer window is curre...
How Mozilla determines MIME Types
ng dot, the value is the MIME type. The extension must be lowercase. If no ext-to-type-mapping category is found, the ExternalHelperAppService returns application/x-extension-EXT, where EXT is the extension of the file. Helper Applications A somewhat related issue are the helper applications. When loading an URI with a type that Mozilla can not handle, a helper app dialog shows up, and the dis
played information comes from these sources: Ask the OS for a handler of the given <extension, MIME Type> pair. Note that the extension here comes from the Content-Disposition header if present, and from the URL itself otherwise. This is where the listed "default application" comes from. The "data source" (that is, the list of helper applications) is searched for an entry with the MIME type of the U...
How to implement a custom autocomplete search component
This can happen when using an autcomplete panel in a panel (for example if an autcomplete textbox is set in a panel that shows and hides). The solution is to define a custom autocomplete panel as follows with the noautofocus="true" attribute (very important, don't miss this part): <panel id="popup_autocomplete" type="autocomple...
Internationalized Domain Names (IDN) Support in Mozilla Browsers
nd Conclusions Netscape 7.1/Mozilla 1.4 has solid support for Internationalized Domain Names and is the first browser with built-in support for new RFC's for IDN established by IETF. This means that there is no longer any need to use a plug-in to process non-ASCII domain names. Netscape/Mozilla's support for IDN is not without some bugs. One notable bug is that non-ASCII names are not always dis
played correctly in some UI areas such as Preference panels, Bookmarks and History. Non-ASCII names are not always correctly dis
played in the location bar due to the fact that ACE to Unicode conversion is not implemented yet. Of particular concern for Japanese users is the one in which Full-width Japanese Roman characters are not normalized to ASCII roman characters. (Cf. bug 210734.) This forces the Ja...
Addon
this add-on to be disabled. version Read only string The version of the add-on. Optional properties Attribute Type Description aboutURL Read only string The URL of the about dialog to display for this add-on. This is passed to window.openDialog() when presenting the about dialog. If you don't provide an aboutURL, a generic about dialog is dis
played. The dialog receives the Addon object representing your add-on as a parameter. applyBackgroundUpdates integer Indicates whether updates found in the background for this add-on will be applied automatically. See auto update values. The user is provided a UI for this in the add-ons manager and it's the add-on provider's responsibility to remember its selection. contributors ...
AddonManager
s preference lets you configure which of these scopes are enabled; however, you can't turn off the profile scope. Starting in Firefox 8, you can also set the value of the preference extensions.autoDisabledScopes to prevent Firefox from automatically installing add-ons from the specified scopes. AddonType viewTypes Constant Description VIEW_TYPE_LIST The type should be dis
played in a regular list view in the UI. AddonType flags Constant Description TYPE_UI_HIDE_EMPTY The type should be hidden from the UI if no add-ons of that type are currently installed. Startup change types These constants represent the lists of types of changes that can occur to add-ons during startup; they're used with the getStartupChanges(), addStartupChange(...
AddonType
rmation about each type of add-on that may be installed. They are mostly used to help the UI know how to display the different types of add-on. Properties Attribute Type Description id string The unique ID for the type. name string The localized name for the type. uiPriority integer A number used to determine the order of types dis
played in the user interface. The lower the number the higher in the list the type will appear. Built-in Values: Value Category 2000 Locale 4000 Extension 5000 Theme 6000 Plugin viewType integer The type of ...
CustomizableUI.jsm
e item is dragged to, or undefined after the measurements have been done and the node has been moved back to its 'regular' area. onCustomizeStart(aWindow) Fired when opening customize mode in aWindow. onCustomizeEnd(aWindow) Fired when exiting customize mode in aWindow. onWidgetOverflow(aNode, aContainer) Fired when a widget's DOM node is overflowing its container, a toolbar, and will be dis
played in the overflow panel. onWidgetUnderflow(aNode, aContainer) Fired when a widget's DOM node is not overflowing its container, a toolbar, anymore. onWindowOpened(aWindow) Fired when a new customizable (ie browser) window is opened. onWindowClosed(aWindow) Fired when a customizable (ie browser) window is closed. Method overview void addListener(aListener); void removeListe...
source-editor.jsm
since Gecko 13.0 readOnly Boolean A Boolean value indicating whether or not the source editor should be read only. showAnnotationRuler Boolean A Boolean value indicating whether or not to display the annotations gutter/ruler. See XXXXX for details. showLineNumbers Boolean A Boolean value indicating whether or not the line numbers gutter should be dis
played. showOverviewRuler Boolean A Boolean value indicating whether or not to show the overview gutter/ruler. This presents an overview of the current annotations in the editor, such as the breakpoints. tabSize Number A number indicating how many spaces each tab character should occupy. This default can be overridden by the user preference named by SourceEditor.PREFS.TAB...
Localization content best practices
ing). String includes variables: always explain what will be the value of these variables at run-time. English could be ambiguous. For example: bookmark. Is this a noun or a verb? Using meaningful IDs could also help in these cases. Strings are used in a specific context. For example accessibility (a11y) strings: in this case space is less important than clarity, since these strings are not dis
played in the UI but used by tools like screen readers. There is an established format for localization comments: it's important to follow the format as closely as possible, since there are a number of automated tools that parse these comments for easier access and use by localizers. DTD files <!-- LOCALIZATION NOTE (entity name): {{privacy}} will be replaced at run-time by an active link. the ...
Localizing with Koala
oala will re-run the comparison of your local localization files with the newest en-US reference and display the results in the sidebar on the left. Filter the files list in the sidebar to only display files containing "search" in their name. You'll see that search.properties is now marked as "modified" (before it was "added) and the entity counts have changed. Also, searchbar.dtd is no longer dis
played in the "compare" view, as it has been completely translated. Here's a quick summary of what the output of the comparison means: files: "unmodified" - the file is completely translated. "added" - the file need to be added to the locale's file structure (it is present in en-US, but not in the locale files). "modified" - the file needs to be modified (it is present in both en-US and the locale f...
Creating localizable web applications
only require good images handling (see Images), but also should be taken into account when designing the interaction on the website. Consider the following example: a filmreel-like slideshow showcasing highlighted features of the product or featured designs. For right-to-left languages, the slideshow should go from right to left as well, making the last element in the HTML the first one to be dis
played. Separate URLs from navigation Sometimes, when the URLs are well-designed, you may want to use the URL to do something in the code depending on where the user is. Take the URL structure of the getpersonas.com website for example. The URL http://getpersonas.com/nature/popular/2 points to the second page of the listing of the popular Personas in the "Nature" category. You could easily use list($c...
Basics
omplicated expressions lim n -> N ( 1 + 1 n ) n - e N , k = ? 2 z ? x 2 ? 2 z ? y 2 - ( ? 2 z ? x ? y ) 2 ( 1 + ( ? z ? x ) 2 + ( ? z ? y ) 2 ) 2 , write vector equations Y = a X + b , etc. Notice how the mathematics appear in the main flow of text and respond as you resize the window. You can also make dis
played equations, such as the following ones: x -> maps to y = f n ( x ) = ( 1 + 1 x n ) n ? a b f ( x ) d x = b - a 6 [ f ( a ) + 4 f ( a + b 2 ) + f ( b ) ] - ( b - a ) 5 4 ! 5 ! f ( 4 ) ( ? ) , a <= ? <= b | x | = { - x if x < 0 x otherwise You can also typeset 2D mathematical constructs such as matrices. The follo...
MathML Demo: <mfrac> - fractions
1 3 + 1 4 + 1 5 + 1 6 + ... normal size at all levels in all contexts 1 2 + 1 3 + 1 4 + 1 5 + 1 6 + ... Inline nested fracs 1 6 2 + 1 3 + 1 4 + 1 5 + 1 6 + ... are script size at the first level and decrease to script script size for all more nested levels. Dis
played nested fractions are normal size at the first level, 1 6 2 + 1 3 + 1 4 + 1 5 + 1 6 + ... script size at second level, and script-script size at all more nested levels. HypergeomDist ( x ; M , K , n ) = ? k = 0 x ( K k ) ( M - K n - k ) ( M n ) Here's a display F ( t , y ) = ( 1 , d y d t ) || ( ...
MathML Demo: <mtable> - tables and matrices
ys inside symmetric fences. ---... [ 1 666666 x 2 c axis ] [ 1 666666 x 2 c center ] + ? 1 55555 x + 1 c bottom ? + ? 1 4444 x c top ? + || 1 4444 4444 4444 x center || post text. Now for a display ---... 1 4444 4444 4444 x 7777777 text after dis
played math. Do you see which vertical alignment is set on that table? Example of \begin{matrix} ---... 0 1 1 0 with 3 \hline's. Example of \begin{smallmatrix} ---... 1 2 3 4 5 obtained with scriptlevel="+1". Example of \begin{pmatrix} ---... ( 0 - i i 0 ) with an \hline after the first row. Example of \begin{bmatrix} ---... [ 1...
Investigating leaks using DMD heap scan mode
t which objects (possibly) point to other objects, using the block_analyzer script: python $srcdir/memory/replace/dmd/block_analyzer.py dmd-$pid.log.gz $leakaddr This will look through every block of memory in the log, and give some basic information about any block of memory that (possibly) contains a pointer to that object. You can pass some additional options to affect how the results are dis
played. "-sfl 10000 -a" is useful. The -sfl 10000 tells it to not truncate stack frames, and -a tells it to not display generic frames related to the allocator. Caveat: I think block_analyzer.py does not attempt to clamp the address you pass into it, so if it is an offset from the start of the block, it won't find it. block_analyzer.py will return a series of entries that look like this (with the [...
Gecko Profiler FAQ
fore is to use a "difference calltree": In the regular call tree, each node of the calltree is assigned a weight which is just the number of samples that were under this call stack. In a difference call tree, each node's weight instead is computed as <number of samples under this stack in the "after" profile> minus <number of samples under this stack in the "before" profile>. That tree is then dis
played in the usual way, with weights in decreasing order from top to bottom. Then the call stacks whose cost increased the most in the "after" profile will be at the top, and those are the ones you usually want to look at if you caused a regression. In this view, the timestamps of individual samples / stacks will not be meaningful. profiler.firefox.com does not have a comparison view at t...
about:memory
' as a separator. For example, preference/referent/weak/dead represents the path to the final leaf node in the example tree above. Sub-trees can be collapsed or expanded by clicking on them. If you find any particular tree overwhelming, it can be helpful to collapse all the sub-trees immediately below the root, and then gradually expand the sub-trees of interest. Sections Memory reports are dis
played on a per-process basis, with one process per section. Within each process's measurements, there are the following subsections. Explicit Allocations This section contains a single tree, called "explicit", that measures all the memory allocated via explicit calls to heap allocation functions (such as malloc and new) and to non-heap allocations functions (such as mmap and VirtualAlloc). Here is a...
Performance
irefox, 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 Gecko. That log can then be re
played against Firefox's default memory allocator independently or through another replace-malloc library, allowing the testing of other allocators under the exact same workload. Memory Profiler The memory profiler samples allocation events and provides different views to analyze the allocation characteristic. See also the documentation on Leak-hunting strategies and tips. ...
Preference reference
awInTitlebar to false.nglayout.debug.disable xul fastloadThe preference nglayout.debug.disable_xul_fastload controls whether or not XUL fastload is used.nglayout.debug.disable_xul_cacheTo improve performance, Mozilla caches chrome XUL documents the first time they load for faster loading later. The effect is that the source XML file is not read and re-parsed each time the chrome in question is dis
played. The XUL cache is serialized and saved between Mozilla sessions in the XUL FastLoad file, which saves a "compiled" version of the XUL and JavaScript in a document to disk for faster startup the next time the application runs.reader.parse-on-load.force-enabledThe preference reader.parse-on-load.force-enabled controls if the reader mode used in Firefox Mobile should be enabled independent of the me...
PR_Assert
file The file name of the compilation unit containing this function call. ...
NSS 3.38 release notes
alls: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_38_RTM/src/ New in NSS 3.38 New Functionality Added support for the TLS Record Size Limit Extension. When creating a certificate request (CSR) using certutil -R, an existing orphan private key can be reused. Parameter -k may be used to specify the ID of an existing orphan key. The available orphan key IDs can be dis
played using command certutil -K. When using certutil -O to print the chain for a given certificate nickname, the new parameter --simple-self-signed may be provided, which can avoid ambiguous output in some scenarios. New Functions in secitem.h SECITEM_MakeItem - Allocate and make an item with the requested contents New Macros in ssl.h SSL_RECORD_SIZE_LIMIT - used to contro...
Notes on TLS - SSL 3.0 Intolerant Servers
This is the main symptom of the problem when Mozilla based browsers encounter TLS/SSL 3.0 intolerant servers. Cause There are some number of web servers in production today which incorrectly implement the SSL 3.0 specification. ...
PKCS11 FAQ
ailable on the token? Does the certificate need to be imported into NSS's internal certificate database? If so, is there a way to get the certificate from an external token into NSS's internal certificate database? NSS searches all the installed PKCS #11 modules when looking for certificates. Once you've installed the module, the module's certificates simply appear in the list of certificates dis
played in the Certificate window. What version of PKCS #11 does NSS support? NSS requires at least PKCS #11 version 2.0, but can support some features of later versions of NSS, including NSS 2.20. NSS does not use all the features of later versions of PKCS #11. What are the expectations in terms of session manipulation? Will NSS potentially open more than one session at a time? Read-only sessions, re...
PKCS11 Implement
onList The NSS calls C_GetFunctionList on startup or when it loads a new module. The function list returned should include all the PKCS 2.0 function calls. If you don't implement a function, you should still provide a stub that returns CKR_FUNCTION_NOT_SUPPORTED. C_GetInfo The NSS calls C_GetInfo on startup or when it loads a new module. The version numbers, manufacturer IDs, and so on are dis
played when the user views the information. The supplied library names are used as the default library names; currently, these names should not include any double quotation marks. (This is more restrictive than PKCS 2.0 and may change in future versions of NSS.). Slot and Token Management C_GetSlotList The NSS calls C_GetSlotList on startup or when it loads a new module, requests all the module's s...
NSS tools : certutil
e key pair. If you create a new key pair for such a card, the previous pair is overwritten. -H Display a list of the options and arguments used by the Certificate Database Tool. -K List the key ID of keys in the key database. A key ID is the modulus of the RSA key or the publicValue of the DSA key. IDs are dis
played in hexadecimal ("0x" is not shown). -L List all the certificates, or display information about a named certificate, in a certificate database. Use the -h tokenname argument to specify the certificate database on a particular hardware or software token. -M Modify a certificate's trust attributes using the values ...
NSS Tools certutil
art cards (for example, the Litronic card) do not let you remove a public key you have generated. In such a case, only the private key is deleted from the key pair. You can display the public key with the command certutil -K -htokenname . -K List the keyID of keys in the key database. A keyID is the modulus of the RSA key or the publicValue of the DSA key. IDs are dis
played in hexadecimal ("0x" is not shown). -A Add an existing certificate to a certificate database. The certificate database should already exist; if one is not present, this option will initialize one by default. -D Delete a certificate from the certificate database. -L List all the certificates, or display infor...
certutil
one key pair. If you create a new key pair for such a card, the previous pair is overwritten. -H Display a list of the options and arguments used by the Certificate Database Tool. -K List the key ID of keys in the key database. A key ID is the modulus of the RSA key or the publicValue of the DSA key. IDs are dis
played in hexadecimal ("0x" is not shown). -L List all the certificates, or display information about a named certificate, in a certificate database. Use the -h tokenname argument to specify the certificate database on a particular hardware or software token. -M Modify a certificate's trust attributes using the values of the -t ...
WebReplayRoadmap
tures should be accessible to users operating locally. While cloud integration is not in placer, Web Replay's architecture has recently been redesigned in preparation for cloud support, and communicating with replaying processes over a network connection instead of IPC should work pretty efficiently. Recording Firefox UI (partially implemented) Right now only content tabs can be recorded and re
played. Firefox's UI and privileged code is largely written in JS, and it would be nice to be able to use Web Replay to help debug and develop Firefox itself, for better dogfooding and gathering internal feedback. This is partially underway and is tracked in bug 1521566. ...
Redis Tips
This is immensely helpful. Related commands - An ever-growing list of related commands is given on the right-hand side of the page. Recipes - At the bottom of many pages is a section that gives usage patterns or recipes for the command under discussion. There are many insightful ideas to be found here. Getting Started with Redis Before you go any further in this document, make sure you have
played with redis for at least 5 or 10 minutes. If you have not, here is a fantastic on-line, interactive redis tutorial: http://try.redis.io/ For reference later on, you'll want the source of all things redis: https://redis.io You'll want to run a redis-server on your machine, and use the redis-cli at the command-line for hacking. Node.JS redis client: https://github.com/mranney/node_redis ...
Pinning violation reports
hey intend. It allows site operators to specify who can issue valid certificates for them, rather than accepting any one of the hundreds of built-in root certificates that ship with your browser. If a site makes use of key pinning, and your browser sees a certificate chain for that site which does not match the pin, Firefox will reject the connection and display an error page. The error page dis
played by Firefox when you encounter a pin violation gives you the option of reporting this error. Doing this can help us to make the web safer. ...
Gecko states
ird or mixed state. STATE_READONLY The object is designated read-only. STATE_HOTTRACKED The object is hot-tracked by the mouse, which means that its appearance has changed to indicate that the mouse pointer is located over it. Isn't used STATE_DEFAULT This state represents the default button in a window. STATE_EXPANDED Children of this object that have the ROLE_OUTLINEITEM role are dis
played. STATE_COLLAPSED Children of this object that have the ROLE_OUTLINEITEM role are hidden. STATE_BUSY The control cannot accept input at this time. STATE_FLOATING Children "owned" not "contained" by parent STATE_CHECKABLE Indicates scrolling or moving text or graphics. STATE_ANIMATED The object's appearance changes rapidly or constantly. Graphics that are occasionally animated are describ...
Using the Places history service
o be marked as "typed." nsINavHistoryService.markPageAsFollowedBookmark: Called by the UI (implemented, but not yet called, see bug 409301) when the user selects a bookmark. This will cause the transition type of the next visit of the URL to be marked as "bookmark." nsINavHistoryService.setPageUserTitle: Sets the user-defined title for the page, which will override the actual page title when dis
played in the UI. This is used for bookmark titles.This function may be removed if the bookmark service is changed. nsINavHistoryService.setPageDetails: Used to set all of the global bits associated with a URL. It is designed for synchronizing or backup services. Basic querying of the history system nsIGlobalHistory2.isVisited: Called by Gecko when rendering links. When isVisited returns true, the li...
Aggregating the In-Memory Datasource
d've taken any old random garbage. Similarly, I wanted to trap Flush() so that I could write the bookmarks.html file back to disk. In short, the only case where this technique is useful is when you're implementing a datasource to get "read-only reflection". That is, you want to reflect the contents of something as an RDF graph (presumably so that it can be aggregated with other information or dis
played as styled content). Technical Details As before, have an nsCOMPtr as your delegate, but this time around,don't derive from nsIRDFDataSource. Also, instead of keeping an nsCOMPtr<nsIRDFDataSource>, you'll just want an nsCOMPtr<nsISupports>: class MyClass : public nsIMyInterface { ... private: nsCOMPtr<nsISupports> mInner; }; Construct the datasource delegate when your object is constr...
Using XPCOM Components
es from the cookie list. enumerator Enumerate through the cookie list. remove Remove a particular cookie from the list. In XPCOM the interface is guaranteed to stay the same even if the underlying implementation changes. The interfaces are public, in other words, and the implementations are private[private-xpcom-interfaces]. When a user selects one of the cookies dis
played in the list and then clicks the Remove button, the Remove method in the nsICookieManager interface is called. The function is carried out by the CookieManager component, and the selected cookie is deleted from disk and removed from the dis
played list. The snippet in Getting the CookieManager Component in JavaScript shows how the Remove() method from the XPCOM CookieManager component can be calle...
Receiving startup notifications
pp-startup" category using nsICategoryManager; having done so, the component will receive these startup notifications, including: xpcom-startup Sent when XPCOM finishes starting up. Most application features are not yet available at this point, but XPCOM itself is. app-startup Sent when the application has finished starting up. final-ui-startup Sent just before the first application window is dis
played. Registering with the Category Manager To register with the Category Manager, simply call its nsICategoryManager.AddCategoryEntry() method: categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY, "mycomponentname", "contract-id", PR_TRUE, PR_TRUE, getter_Copies(p...
Components.Exception
on objects. These exception objects may be thrown when implementing xpcom interfaces in JavaScript, and they can provide better diagnostics in the error console if not caught than simply throwing an nsresult's value will. See also nsIXPCException. ...
nsIAbCard
larityIndex is bumped every time e-mail is sent to this recipient . preferMailFormat unsigned long Allowed values are stored in nsIAbPreferMailFormat. isMailList boolean mailListURI string If isMailList is true then mailListURI will contain the URI of the associated mailing list. allowRemoteContent boolean Allow remote content to be dis
played in HTML mail received from this contact Methods getCardValue() AString getCardValue(in string name) Parameters name The attribute you want the value for. Return value The value of the attribute asked for. setCardValue() void setCardValue(in string attrname, in AString value) Parameters attrname The attribute you want to set. value The value to set the attribute to. ...
nsIAccessNode
o 2.0 nextSiblingNode nsIAccessNode The next nsIAccessNode sibling. Read only. Obsolete since Gecko 2.0 numChildren long The number of DOM children for the DOM node, which matches the number of nsIAccessNode children for this nsIAccessNode. Read only. Obsolete since Gecko 2.0 ownerWindow voidPtr The OS window handle for the window this node is being dis
played in. Read only. Native code only! Obsolete since Gecko 8.0 parentNode nsIAccessNode The parent nsIAccessNode. Read only. Obsolete since Gecko 2.0 previousSiblingNode nsIAccessNode The previous nsIAccessNode sibling. Read only. Obsolete since Gecko 2.0 rootDocument nsIAccessibleDocument The root document accessible that this access node resides in. Read ...
nsIAccessibleStates
The object is designated read-only. STATE_HOTTRACKED 0x00000080 The object is hot-tracked by the mouse, which means that its appearance has changed to indicate that the mouse pointer is located over it. Currently unused. STATE_DEFAULT 0x00000100 This state represents the default button in a window. STATE_EXPANDED 0x00000200 Children of this object that have the ROLE_OUTLINEITEM role are dis
played. (See nsIAccessibleRole.Constants). STATE_COLLAPSED 0x00000400 Children of this object that have the ROLE_OUTLINEITEM role are hidden. (See nsIAccessibleRole.Constants). STATE_BUSY 0x00000800 The control cannot accept input at this time. STATE_FLOATING 0x00001000 Children "owned" not "contained" by parent. STATE_MARQUEED 0x00002000 The object is scrolling or moving text or graphics. STA...
nsIAutoCompleteInput
oses focus. maxRows unsigned long The maximum number of rows to display in the autocomplete suggestion popup. minResultsForPopup unsigned long Specifies a minimum number of search results that must be available before the autocomplete popup will open. popup nsIAutoCompletePopup The view in which results will be dis
played.Read only. popupOpen boolean Indicates whether or not the popup view is already open. searchCount unsigned long The number of autocomplete sessions to search. Read only. searchParam AString An additional parameter used for configuring searches. selectionEnd long The ending index of the ...
nsIAutoCompleteItem
xpfe/components/autocomplete/public/nsIAutoCompleteResults.idlScriptable Please add a summary to this article. Inherits from: nsISupports Last changed in Gecko 1.7 Attributes Attribute Type Description className string Class name used to define some style through css like the colors, an icon url, and so on. comment wstring An extra comment that will be dis
played next to the value but that will not be part of the value itself. param nsISupports Parameter use by the search engine. value AString The result value using AString to avoid excess allocations. ...
nsICommandLineHandler
The text should have embedded newlines which wrap at 76 columns, and should include a newline at the end. By convention, the right column which contains flag descriptions begins at the 24th character. Read only. Methods handle() Processes a command line. If this handler finds arguments that it understands, it should perform the appropriate actions (such as openin...
nsIContentViewer
tribute was part of nsIDocumentViewer. [noscript,notxpcom,nostdcall] nsIViewPtr findContainerView(); Parameters None. Return value The container view, or null if this content viewer is the root of a view manager hierarchy. Note: If this container is the root of a view manager hierarchy (that is, this method returns null), and mParentWidget is also null, then this document should not even be dis
played. Native code only!getBounds void getBounds( in nsIntRectRef aBounds ); Parameters aBounds Missing Description getDocument() Returns the DOM document object (as an nsIDocument without addrefing. [noscript,notxpcom] nsIDocumentPtr getDocument(); Parameters None. Return value The DOM document object. hide() void hide(); Parameters None. Native code only!init Initializes the content vi...
nsIDOMHTMLAudioElement
entSampleOffset() Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. Returns the current offset of the audio stream, specified as the number of samples that have
played since the beginning of the stream. unsigned long long mozCurrentSampleOffset(); Parameters None. Return value An unsigned 64-bit value indicating how many audio samples have been
played since the stream began playing. mozSetup() Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every us...
nsIDOMWindowInternal
crolled vertically. scrollMaxX long Returns the maximum number of pixels that the document can be scrolled horizontally. scrollMaxY long Returns the maximum number of pixels that the document can be scrolled vertically. length unsigned long Readonly: Returns the number of frames in the window. fullScreen boolean Whether the window is dis
played in full screen mode or not frameElement nsIDOMElement Readonly: The element in which the window is embedded, or null if the window is top-level. URL nsIDOMMozURLProperty Readonly: A DOM URL object, which provides the window.URL.createObjectURL() and window.URL.revokeObjectURL() methods. Note: Prior to Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMon...
nsIDirIndex
rectory index. Because this has no reference back to their original source, changing these attributes won't affect the directory. Inherits from: nsISupports Last changed in Gecko 1.7 Attributes Attribute Type Description contentType string The content type; may be null if it is unknown. Unspecified for directories. description wstring A description for the filename, which should be dis
played by a viewer. lastModified PRTime Last-modified time in seconds-since-epoch. If the last modified time is unknown, this value is -1. location string The fully qualified filename, expressed as a URI. This is encoded with the encoding specified in the nsIDirIndexParser, and is also escaped. size long long File size; if the size is unknown, this value is -1. type unsigned long The type of the...
nsIDocShell
tor()to determine the direction of the enumeration. ENUMERATE_BACKWARDS 1 Used by getDocShellEnumerator()to determine the direction of the enumeration. APP_TYPE_UNKNOWN 0 This is the default value of the appType attribute. APP_TYPE_MAIL 1 This is the value of the appType attribute used by Thunderbird and SeaMonkey to indicate that email messages are dis
played in this window. APP_TYPE_EDITOR 2 This is the value of the appType attribute used by Thunderbird and SeaMonkey to indicate that email messages or web pages are composed in this window. BUSY_FLAGS_NONE 0 Returned by the busyFlags attribute when the nsIDocShell is not loading a document. BUSY_FLAGS_BUSY 1 Returned by the busyFlags attribute when the nsID...
nsIDragService
source node aDOMNode, and the offset calculated so that the initial location for the image appears in the same screen position as where the element is located. The node must be within a document. Currently, supported images are all DOM nodes. If this is an HTML <image> or <canvas> element, the drag image is taken from the image data. If the element is in a document, it will be rendered at its dis
played size, otherwise, it will be rendered at its real size. For other types of elements, the element is rendered into an offscreen buffer in the same manner as it is currently dis
played. The document selection is hidden while drawing. The aDragEvent must be supplied as the current screen coordinates of the event are needed to calculate the image location. void invokeDragSessionWithImage( in nsIDOMN...
nsIFaviconService
getFaviconImageForPage() Obsolete since Gecko 22.0 (Firefox 22.0 / Thunderbird 22.0 / SeaMonkey 2.19) Note: This method was removed in Gecko 22.0. You should use the new async API mozIAsyncFavicons.getFaviconURLForPage() and getFaviconLinkForIcon() instead. This method is very similar to that of getFaviconLinkForIcon() method. For a given page will give you a URI that, when dis
played in chrome, will result in the given page's favicon. Unlike the other get functions, we needn't have heard of the page or its favicon: the default one will be returned in this case. When compared to getFaviconLinkForIcon() method, this method only adds the extra level of indirection, looking up the favicon based on the page URI and using the default if not found. nsIURI getFaviconImageForPage( i...
nsIFeed
ours are represented as integer values from 0 (midnight) to 23 (11:00 PM), and are always indicated using UTC. Note: This field is rarely implemented. subtitle nsIFeedTextConstruct Returns a subtitle for the feed, based on its description, subtitle, and appropriate extensions. textInput nsIWritablePropertyBag2 Information about a text box that can be dis
played along with the feed by aggregators that support it, to allow the reader to send a response back to the source of the feed. Note: This field is almost never used, and is incompatible with many aggregators. type unsigned long Indicates the type of content presented by a feed. See Constants. Note: You should consider this a bit mask of values; at some point, the type may incl...
nsIFeedEntry
escription content nsIFeedTextConstruct The full text of the entry's content. This comes from the atom:content and/or content:encoded fields. enclosures nsIArray An array of all the enclosures included in the entry. These are used by podcasts, photocasts, and so forth. mediaContent nsIArray An array of all the enclosures or other media that might be dis
played inline in the entry. parent nsIFeedContainer A reference to the entry's parent, which is either a feed (nsIFeed or another entry. published AString A string indicating the date on which the entry was published, in RFC822 format. This date is parsable by both JavaScript (via Date.parse()) and mail code. Note, that the related updated attribute is available from the ns...
nsIFilePicker
passed in object's done method will be called upon completion. void open( in nsIFilePickerShownCallback aFilePickerShownCallback ); Parameters aFilePickerShownCallback The nsIFilePickerShownCallback to be called on completion. show() Obsolete since Gecko 57.0 (Firefox 57.0 / Thunderbird 57.0 / SeaMonkey 2.54) Displays the file picker dialog. The dialog is dis
played modally. short show(); Parameters None. Return value One of the return constants. Example Here's an example: const nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = Components.classes["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); fp.init(window, "Dialog Title", nsIFilePicker.modeOpen); fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filter...
nsILoginManagerCrypto
.1) Method overview AString decrypt(in AString cipherText); AString encrypt(in AString plainText); Attributes Attribute Type Description isLoggedIn boolean Current login state of the token used for encryption. If the user is not logged in, performing a crypto operation will result in a master password prompt. Read only. uiBusy boolean true when a master password prompt is being dis
played. Read only. Methods decrypt() Decrypts the specified string, returning the plain text value. Can throw if the user cancels entry of their master password, or if the cipherText value can not be successfully 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...
nsIMarkupDocumentViewer
idi presentation. Use these attributes to access the individual Bidi options. The default direction for the layout of bidirectional text. 1 - left to right 2 - right to left. bidiTextType octet The ordering of bidirectional text. This may be either "logical" or "visual". Logical text will be reordered for presentation using the Unicode Bidi Algorithm. Visual text will be dis
played without reordering. 1 - the default order for the charset 2 - logical order 3 - visual order. defaultCharacterSet ACString forceCharacterSet ACString fullZoom float The amount by which to scale all lengths. Default is 1.0. hintCharacterSet ACString hintCharacterSetSource PRInt32 minFontSize long The...
nsIMemoryReporter
long long. description AUTF8String A human-readable description of this memory usage report. Read only. kind PRInt32 The memory kind, one of the Memory reporter kind constants below. Read only. path AUTF8String The path that this memory usage should be reported under. Paths are delimited with '/' characters to allow a hierarchy of memory to be dis
played in about:memory. As of Gecko 6.0, the path should start with "explicit/" if the memory report accounts for all memory reported under sub-paths. Read only. process ACString The name of the process containing this reporter. Each reporter starts with an empty string for this value, indicating that it applies to the current process; this is true even for reporters in a child process. W...
nsIMemoryReporterManager
lla.org/memory-reporter-manager;1 as a service: var reporterManager = Components.classes["@mozilla.org/memory-reporter-manager;1"] .getService(Components.interfaces.nsIMemoryReporterManager); Each memory reporter object, which implements nsiMemoryReporter interface, provides information for a given code area. Each code area is identified by a unique path string, which is dis
played in about:memory. Method overview nsISimpleEnumerator enumerateMultiReporters(); nsISimpleEnumerator enumerateReporters(); void init(); void registerMultiReporter(in nsIMemoryMultiReporter reporter); void registerReporter(in nsIMemoryReporter reporter); void unregisterMultiReporter(in nsIMemoryMultiRe...
nsIMsgAccountManagerExtension
ageName ACString chrome package, where the files for the new panel are located. This is usually GUID of the ID of the addons which adds the new Panel. This attribute is readonly! Methods showPanel() Before displaying a panel in the Account Manager this method is triggered. boolean showPanel( in nsIMsgIncomingServer server ); Parameters server The account for which the panel should be dis
played. Return value A true indicates, that the Account Manager can display the panel for the given account, while false prevents the panel to be loaded. See also nsIMsgAccountManager Building an Account Manager Extension ...
nsIMsgDBViewCommandUpdater
chCommandUpdater (for search dialogs) Method overview void updateCommandStatus(); void displayMessageChanged(in nsIMsgFolder aFolder, in AString aSubject, in ACString aKeywords); void updateNextMessageAfterDelete(); Methods updateCommandStatus() Called when the number of selected items changes. void updateCommandStatus(); Parameters None. displayMessageChanged() Called when the dis
played message has changed. void displayMessageChanged(in nsIMsgFolder aFolder, in AString aSubject, in ACString aKeywords ); Parameters aFolder The folder containing selected message. aSubject The subject of the selected message. aKeywords Keywords associated with the selected message. updateNextMessageAfterDelete() Allows the backend to tell the front end to re-determine which message we sh...
nsIMsgWindowCommands
nterface in a mail or news message list. Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) The JavaScript implementation of this used by Thunderbird is given here. Method overview void selectFolder(in ACString folderUri); void selectMessage(in ACString messageUri); void clearMsgPane(); Methods selectFolder() This method is called by the backend to change the folder dis
played in the message window. This could be as a result of clicking on a new mail alert, or by clicking a link to a newsgroup. void selectFolder( in ACString folderUri ); Parameters folderUri The URI of the folder to select. selectMessage() This method is called by the backend to change the dis
played message. For instance, when deleting attachments, this causes the message to be redis
played. void s...
nsINavHistoryObserver
in AString aPageTitle ); Parameters aURI The URI of the page whose title changed. aPageTitle The new title of the page. onVisit() Called when a resource is visited. This is called the first time a resource (page, image, and so on.) is seen as well as every subsequent time. Normally, transition types of TRANSITION_EMBED (corresponding to images in a page, for example) are not dis
played in history results (unless includeHidden is set). Many observers can ignore _EMBED notifications (which will comprise the majority of visit notifications) to save work. void onVisit( in nsIURI aURI, in long long aVisitID, in PRTime aTime, in long long aSessionID, in long long aReferringID, in unsigned long aTransitionType, in ACString aGUID, out unsigned long aAdded ); Parameters...
nsIPlacesView
of all currently selected nsINavHistoryResultNode objects of the view. The nodes are not necessarily returned in the same order in which they occur in the model, or in the same container, or from the same provider. nsINavHistoryResultNode[] getSelectionNodes(); Parameters None. Return value An array of nsINavHistoryResultNode objects that are selected. selectAll() Selects all the nodes dis
played in the view. void selectAll(); Parameters None. See also Displaying Places information using views ...
nsIProgressEventSink
netwerk/base/public/nsIProgressEventSink.idlScriptable This interface is used to asynchronously convey channel status and progress information that is generally not critical to the processing of the channel. The information is intended to be dis
played 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 intended to be dis
played 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 ...
nsISessionStartup
0 / SeaMonkey 2.5), this was a string. It was changed in order to improve performance, which was suffering due to the need to parse and stringify the data. Constants Session type constants Constant Value Description NO_SESSION 0 There's no data available from the previous session. RECOVER_SESSION 1 The last session crashed. It will either be restored or about:sessionrestore will be dis
played. RESUME_SESSION 2 The previous session should be restored at startup. DEFER_SESSION 3 The previous session is viable but shouldn't be restored without explicit action (with the exception of app tabs, which are always restored in this case). Methods doRestore() Determines whether or not there is a session to restore. boolean doRestore(); Parameters None. Return value true if the session...
nsITaskbarTabPreview
this interface; instead, call the nsIWinTaskbar.createTaskbarTabPreview(). Method overview void EnsureRegistration(); Violates the XPCOM interface guidelines nativeWindow GetHWND(); Violates the XPCOM interface guidelines void move(in nsITaskbarTabPreview aNext); Attributes Attribute Type Description icon imgIContainer The icon dis
played next to the title in the preview. This is null by default. title DOMString The title dis
played above the thumbnail. By default, this is an empty string. Methods Violates the XPCOM interface guidelines EnsureRegistration() Used internally to ensure that the taskbar knows about this preview. If a preview is not registered, the API call to set its sibling (via the move(...
nsITreeBoxObject
; Parameters index The index of the row scrollByLines() Scroll the tree up or down by numLines lines. void scrollByLines(in long numLines); Parameters numlines The number of lines to scroll. Positive values move down in the tree. Prevents scrolling off the end of the tree. scrollByPages() Scroll the tree up or down by numPages pages. A page is considered to be the amount dis
played by the tree. This method prevents scrolling off the end of the tree. void scrollByPages(in long numPages); Parameters numPages The number of pages to scroll. Positive values move down in the tree. scrollToCell() Scrolls such that a given cell is visible (if possible) at the top left corner of the visible view. void scrollToCell(in long row, in nsITreeColumn col); Parameters row...
nsITreeColumn
ycler attribute is not set, the column cells are regular text cells. Read only. editable boolean If true the nsITreeColumn content is editable. If the editable attribute is not set, the column cells are not editable. Read only. element nsIDOMElement The treecol element. Read only. id AString The id attribute of the nsITreeColumn. Read only. index long The index of the nsITreeColumn in dis
played order. Read only. primary boolean If true the nsITreeColumn is the primary column. If the primary attribute is not set, the column is not the primary column. Read only. selectable boolean If true the nsITreeColumn is able to be selected. If the selectable attribute is not set, the column cells are not selectable. Read only. type short The type of the column, see constants. Read only. wid...
nsIWebNavigationInfo
s". OTHER 1 << 15 Note: Other return types may be added here in the future as they become relevant. Returned by isTypeSupported() to indicate that a type is supported via some other means. Methods isTypeSupported() Determines whether or not the specified MIME type is supported by the given nsIWebNavigation object. This lets you determine whether a MIME type can be dis
played as-is inside a browser, or if the browser will instead forward handling of the data to a plug-in or an external helper application. Note: This method may cause plug-ins to be rescanned in order to ensure they are properly registered for the types they support. unsigned long isTypeSupported( in ACString aType, in nsIWebNavigation aWebNav ); Parameters aType The MIME type to check. ...
nsIWebPageDescriptor
Inherits from: nsISupports Last changed in Gecko 1.7 Method overview void loadPage(in nsISupports aPageDescriptor, in unsigned long aDisplayType); Attributes Attribute Type Description currentDescriptor nsISupports Retrieves the page descriptor for the current document. Read only. Constants Display type constants Constant Value Description DISPLAY_AS_SOURCE 0x0001 Generates an optionally syntax-highlighted (for XML/HTML documents) source of the original page. ...
nsIWebProgressListener
est 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 extended error information (for example for HTTP requests see nsIHttpChannel. onStatusChange() Notification that the status of a request has changed. The status message is intended to be dis
played 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 aWebProgress The nsIWebProgress instance that fired the notification. aRequest The nsIRequest that has new status. aStatus This value is not an error code. Instead, it is a numeric valu...
nsIXFormsModelElement
extensions/xforms/nsIXFormsModelElement.idlScriptable Defines scriptable methods for manipulating instance data and updating computed and dis
played values. 1.0 66 Introduced Gecko 1.8 Obsolete Gecko 1.9.1 Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview nsIDOMDocument getInstanceDocument(in DOMString instanceID); void rebuild(); void recalculate(); void refresh(); void revalidate(); Methods getInstanceDocument() nsIDOMDocument getInstanceDocument( in DOMString instanceID ); Parameters instanceID The ID of the instance element to be returned. Return value An nsIDOMDocument. Exceptions thrown DOMException If there is no matching instance data. rebuild() Signals the...
XPCOM Interface Reference by grouping
itrary decision by the author. (I'm fully aware that this will be a great point of discussion and probably will end in tears, but since I'm the first person to apparently take a swing at this, I get first dibs.) The primary sections consist of: Browser This section contains elements associated with the view pane or the content of the "browser window" proper. It is wrapped by System, but dis
played for convenience. Data This section contains Data wrappers and core object definitions. Security This section contains APIs for secure channel communications System This section contains Application level interfaces including calls to external support elements (such as device calls). This is the root element and may contain some functions defined in other groups. User This ...
XPCOM
ch as C++) require recompilation when moving to a different platform. Often, compiled XPCOM components are called 'binary' or 'native'.XPCOM category image-sniffing-servicesIn versions of Firefox prior to Firefox 3, extensions could add decoders for new image types. However, such decoders relied on servers sending correct MIME types; images sent with incorrect MIME types would not be correctly dis
played.XPCOM glueThe XPCOM Glue is a static library which component developers and embedders can link against. It allows developers to link only against the frozen XPCOM method symbols and maintain compatibility with multiple versions of XPCOM.XPCOM guideThese articles provide tutorials and usage documentation for XPCOM, including how to use it in your own projects and how to build XPCOM components for ...
Address Book examples
PhotoType property of the contact must return a string equal to aType. The address book defaults with three photo handler types, identified by "generic", "file" and "web". These can be overridden by calling registerPhotoHandler with these identifiers and a custom photo handler. Photo display handlers A photo display handler determines how a contact photo can be extracted from a contact and dis
played in an IMG element. This is useful in the contact viewer within the address book. Photo display handlers are registered with the registerPhotoDisplayHandler function within the context of the address book card view overlay. A photo display handler is a function that behaves as follows: /* * function(aCard, aImg): * The function is responsible for determining how to retrieve * the photo...
DB Views (message lists)
l The indentation level when in threaded mode. m_folders Cross-folder views only (nsMsgSearchDBView and its descendant, nsMsgXFVirtualFolderDBView) Most of the time, the thread pane is driven by an nsMsgThreadedDBView object (even when we're in a flat sort). If the user does a quick search or picks a view from the view menu, we create an nsMsgQuickSearchDBView. Advanced search results are dis
played with an nsMsgSearchDBView, and cross-folder saved searches use nsMsgXFVirtualFolderDBView, which inherits from nsMsgSearchDBView. nsMsgGroupView is used when grouping is turned on. One unique thing about nsMsgGroupView is that instead of using the message database's nsMsgThread objects like the other view classes, it uses an nsMsgGroupThread object, which also implements nsIMsgThread. View Fl...
Events
onActiveMessagesLoaded The active messages in the folder have been loaded onCreatedView A folder view has been created, but not yet shown. If custom column handlers need to do something, this is likely the event you are looking for. onDestroyingView The current folder view is being destroyed. ...
nsIMsgCloudFileProvider
Readonly: A link to the homepage of the service, if applicable. iconClass ACString Readonly: A chrome URL for an icon to be used for representing the service. accountKey ACString Readonly: The unique identifier for the account associated with an instance of an nsIMsgCloudFileProvider. settingsURL ACString Readonly: A chrome URL for an XHTML page dis
played in the account setup dialog window, used for displaying and setting provider-specific settings. This URL should not point to external web content. managementURL ACString Readonly: A chrome URL for an XHTML page dis
played within the Filelink preferences dialog, used for displaying and setting provider-specific settings once the account has already been set up. This URL should not po...
Index
o the application window and modify them using scripts and attaching event handlers. While XUL provides the elements of the user interface, actions are written in JavaScript. 79 Building a Thunderbird extension 6: Adding JavaScript In this step we will create a small piece of JavaScript code that inserts the current date into our statusbar widget. The statusbar is usually dis
played at the bottom of the Thunderbird window. Depending on the installed theme the result will look something like this: 80 Building a Thunderbird extension 7: Installation Extensions, thunderbird While you are developing the extension, there are two ways you can make Thunderbird load it so you can test it as you go. You can either put the folder with the extension files directly ...
Thunderbird Configuration Files
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 folder and select File > New > Text Document. The default name New Text Document.txt should be dis
played. Change the name to user.js (click Yes on the file type warning that appears). Linux users: Use your own preferred method to create user.js in the profile folder. If you don't already have one, consider running the following code in a terminal. $ cd $PROFILE # where $PROFILE is your profile folder $ touch user.js # create the empty JavaScript file Alternatively, open a Files window (if you...
Building a Thunderbird extension 3: install manifest
of the extension and must be in lowercase; the last portion is a two-part period-delimited value such as your first and last name or the top-level domain of your website. While this value is in email address format, it is not an email address. It should, however, be a unique value so that it does not conflict with other extensions. <em:name>My First Extension</em:name>: The extension name is dis
played in the Thunderbird add-on Manager. <em:version>1.0</em:version>: This is the version number of your extension. It must be updated each time you release a new version of your extension. It is not the Thunderbird version number (which is stored in the minVersion and maxVersion fields). <em:creator>jenzed</em:creator>: This optional value is used to store the extension author's name. <em:id>{3550...
Building a Thunderbird extension 6: Adding JavaScript
Warning: This content is for older versions of Thunderbird. Much of it may no longer be relevant. See developer.thunderbird.net for newer information. In this step we will create a small piece of JavaScript code that inserts the current date into our statusbar widget. The statusbar is usually dis
played at the bottom of the Thunderbird window. Depending on the installed theme the result will look something like this: Modify XUL elements with JavaScript Save the following JavaScript code into the content/ folder next to your myhelloworld.xul file and name it overlay.js. window.addEventListener("load", function(e) { startup(); }, false); window.setInterval( function() { startup(); }, 60000); //update date every minute function startup() { var myPanel = document.getElementById(...
Folders and message lists
The FolderDisplayWidget for the current folder can be accessed via the global variable gFolderDisplay. This object provides many of the functions required for working with folder views. We'll look at some of them below. Getting the Current nsIMsgFolder The nsIMsgFolder interface contains many methods and attributes for working with folders. To get the nsIMsgFolder instance for the currently-dis
played folder, just use gFolderDisplay.dis
playedFolder. Getting the Currently-Selected Message The FolderDisplayWidget has several ways of getting the currently-selected message(s), depending on what exactly you're trying to do: gFolderDisplay.selectedCount: Returns the number of messages currently selected. gFolderDisplay.selectedMessage: Returns the first currently-selected message. When using t...
Theme Packaging
rd themes are packaged in an XPI file with the following structure: theme.xpi: install.rdf preview.png icon.png chrome/ browser/files communicator/files global/files mozapps/files ... You must have a top-level chrome.manifest file which registers the chrome for the theme (as before) and also an install.rdf manifest that specifies metadata that is dis
played in the Appearance section of the Add-ons Manager. preview.png is a preview image which will show when double-clicked on a theme in the Appearance section of the Add-ons Manager. It can be any size. icon.png is a 32x32 (max. 48x48) PNG (may contain alpha transparency) which will show up in the Appearance section of the Add-ons Manager. install.rdf Your install.rdf manifest will look something...
customDBHeaders Preference
Special thanks go to Mr. Bienvenu for his patience and assistance in guiding me through this process. ...
Using popup notifications
Popup notifications, also known as "doorhanger notifications", are presented to notify the user of something that's important but may not need immediate attention. These non-modal notifications let the user make decisions when they have a moment to do so, instead of being forced to deal with them at possibly inconvenient times. For example, this popup notification is dis
played when a web site requests geolocation information: This lets the user decide whether or not to share their location when it's convenient to do so, instead of being compelled to do it at once. In addition, notifications can be dismissed and recalled by clicking anywhere outside the notification, then clicking on the notification icon to bring it back again. A popup notification can include a text message, a button actio...
Using tab-modal prompts
Then apply it, like in the example below, here we apply the prompt with a checkbox: var window = gBrowser.contentWindow; var promptfact = Components.classes['@mozilla.org/prompter;1'].getService(Components.interfaces.nsIPromptFactory); var prompt = promptfact.getPrompt(window, ...
Working with windows in chrome code
to work with content JavaScript directly can lead to security problems. See Interaction between privileged and non-privileged pages if you need to interact with the content page. The content shortcut In case of <browser type="content-primary" />, you can use the content shortcut property to accesss the Window object of the content document. For example: // alerts the title of the document dis
played in the content-primary widget alert(content.document.title); For example, you can use content.document in a browser.xul overlay to access the web page in the selected tab in a Firefox window. Some examples use _content instead of content. The former has been deprecated for a while, and you should use content in the new code. Accessing a document in the sidebar Firefox has a sidebar, which is...
Add to iPhoto
= 4; this.kLSRolesAll = 0xffffffff; Implementing the extension Now that the Mac OS X APIs we'll be using have been declared, we can write the core of the extension itself. This is done in the iPhoto object in the extension's code. Hooking up to the context menu On startup, we find the content area's context menu and add an event listener to it that will be called when the context menu is dis
played. We'll use our handler for this event to add the "Add Image to iPhoto" option if the user has right-clicked on an image. if (document.getElementById("contentAreaContextMenu")) { document.getElementById("contentAreaContextMenu").addEventListener("popupshowing", iPhoto.onPopup, false); } Responding when the context menu is clicked When the user right-clicks an image, our handler gets called: ...
Drawing and Event Handling - Plugins
This chapter tells how to determine whether a plug-in instance is windowed or windowless, how to draw and redraw plug-ins, and how to handle plug-in events. When it comes to determining the way a plug-in instance appears in a web page, you (and the web page author) have many options. The content provider who writes the web page determines its display mode: whether the plug-in is embedded, or dis
played in its own separate page. You determine whether a plug-in is windowed or windowless by the way you define the plug-in itself. A windowed plug-in is drawn into its own native window (or portion of a native window) on a web page. A windowed plug-in is opaque, hiding the part of the page beneath its display window. This type of plug-in determines when it draws itself. A windowless plug-in does n...
Initialization and Destruction - Plugins
red in the plug-in's instance->pdata. NPError NPP_Destroy(NPP instance, NPSavedData **save); The instance parameter represents the plug-in instance to delete. The plug-in can use the optional save parameter to save data for reuse by a new instance with the same URL. The data is passed to NPP_New through its saved parameter. For example, a video player could save the last frame number to be dis
played. When the user returns to the page, the previous frame number is passed to the new instance of the plug-in, so it can initially display the same frame. Note that you cannot count on data being saved this way; the data may be lost if the browser restarts or purges memory. Ownership of the buf field of the NPSavedData structure passes from the plug-in to the browser when NPP_Destroy returns. The ...
Streams - Plugins
R_BREAK: The plug-in terminated the stream because of a user request. NPRES_NETWORK_ERR: The stream failed because of network problems. For the complete list of codes, see "Result Codes." For an example that demonstrates using this function with NPN_NewStream and NPN_Write, see "Example of Sending a Stream." Example of Sending a Stream The following code creates a new stream of HTML text dis
played by the browser in a new window, writes it, and destroys the stream. Error handling has been omitted for simplicity. NPStream* stream; char* myData = "<html><head><title>This is a message from my plug-in!</title></head><body><p><strong>This is a message from my plug-in!</strong></p></body>/html>"; int32 myLength = strlen(myData) + 1; /* Create the stream. */ err = NPN_NewStream(instance, "text/h...
Version, UI, and Status Information - Plugins
line. void NPN_Status(NPP instance, const char *message); The instance parameter is the current plug-in instance, that is, the one that the status message belongs to. In the message parameter, pass the string you want to display on the status line. The browser always displays the last status line message it receives, regardless of the message source. For this reason, your message is always dis
played, but you have no control over how long it stays in the status line before another message replaces it. You should use a different method to display messages that the user needs to see, such as error messages. Getting Agent Information A plug-in can check which browser is running on the user's current system. Browsers communicate with HTTP servers, which store agent software name, version, and o...
Color vision simulation - Firefox Developer Tools
se simulations are not completely medically accurate. However, they can give you a sense of what your web site looks like to users with vision problems, and therefore help you judge whether you need to make adjustments in your color or contrast choices. ...
Accessibility Inspector - Firefox Developer Tools
. In the right side of the panel, the Checks subpanel lists the specific issue with the selected node. For each type of issue, there is a Learn more link to further information on MDN Web Docs about the issue. The menu items act as toggles. Select the item to view that type of issue; select the item again to clear the display of issues of that type. Issues with a particular item are always dis
played in the Checks subpanel as you browse the tree. The Check for issues menuitems are a quick way to view all and only those items that have issues. Simulate The Accessibility Inspector offers (as of Firefox 70), a simulator that lets you see what a web page would look like to users with various forms of color vision deficiency (better known as "color blindness"), as well as contrast sensitivity lo...
Debugging service workers - Firefox Developer Tools
a hint as to what's wrong, which depends on what exactly is wrong with the code. If this is not enough to help you figure out the problem, you could also try going to the JavaScript Debugger and stepping through your code to pinpoint exactly where it is going wrong. Debugging your service worker In any case, when the service worker is successfully registered, you'll see information about it dis
played in the Application > Service Workers view (along with any other service workers registered on the same domain): This gives you a variety of information about your service worker: The URL that the service worker is registered on. That last time the service worker was updated (if the service has not been updated, this is when it was first installed). The path to the service worker source fi...
DOM Property Viewer - Firefox Developer Tools
the Web Developer submenu in the Firefox Menu Panel (or Tools menu if you display the menu bar or are on macOS), or by pressing its Ctrl + Shift + W keyboard shortcut. The Toolbox will appear at the bottom of the browser window, with the DOM Property Viewer activated. It's just called "DOM" in the Toolbox. DOM Property Viewer user interface DOM tree The different properties of the DOM are dis
played as an expandable tree. The left-hand side shows the property's name, and the right-hand side shows its value. Up to three properties of an object and items of an array are dis
played. If a property has more elements than this, you'll see a "more..." annotation, and will need to click the property to see all elements. A lock icon indicates that a property is not writable. Refreshing the display I...
Examine, modify, and watch variables - Firefox Developer Tools
, like greetme, as well as built-in globals like localStorage and console. Each object can be expanded, using a disclosure triangle, to show its properties. Pointing your cursor at a variable's name displays a tooltip that provides additional information about the variable. See Object.defineProperty() for details on what these property descriptors mean. You can filter the variables that are dis
played, either by using the "*" modifier in the script filter, or by typing into the filter variables box, if you have enabled this in the debugger settings. If a variable exists in the source but has been optimized away by the JavaScript engine, then it is shown in the Variables view, but is given the value (optimized away), and is not editable. In the screenshot below the variable upvar has been op...
Ignore a source - Firefox Developer Tools
action leaks during debugging sessions when you are forced to step through its stack frames in order to reach your own code. However, you can tell the debugger to ignore the details of selected sources. You can enable or disable ignoring a source file in a couple of ways: In the source list pane, right-click the filename and choose Ignore source (or Unignore source). If the source file is dis
played in the source pane, click the "eye" icon at the bottom. When a source file is ignored: Any breakpoints it may have defined are disabled. When "Pause on Exceptions" is enabled in the Debugger settings, the debugger won't pause when an exception is thrown in the ignored source; instead it waits until (and if) the stack unwinds to a frame in a source that isn't ignored. The debugger skips t...
Source map errors - Firefox Developer Tools
l error messages here are: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data Error: "version" is a required argument Original source missing An original source may be missing. You may encounter this when trying to open one of the original sources in the debugger. The message looks a little different in this case: In this case, the error will also be dis
played in the source tab in the debugger: NetworkError when attempting to fetch resource A bug in Firefox prevents it from loading source maps for web extensions. See Bug 1437937: WebExtensions Doesn't Find Source Maps for details. Source-Map-Fehler: TypeError: NetworkError when attempting to fetch resource. Ressourcen-Adresse: moz-extension://c7f0f003-4fcf-49fd-8ec0-c49361266581/background.js S...
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
() in the browser console. This begins logging allocations in the current browser tab. In the browser tab, click on the text that says "Click here...". The event handler should add some text to the end of the page. Back in the browser console, evaluate the expression demoPlotAllocations(). This stops logging allocations, and displays a tree of allocations: An allocation plot, dis
played in the console The numbers at the left edge of each line show the total number of objects allocated at that site or at sites called from there. After the count, we see the function name, and the source code location of the call site or allocation. The (root) node's count includes objects allocated in the content page by the web browser, like DOM events. Indeed, this display shows that po...
Index - Firefox Developer Tools
pen the Inspector: 67 Reposition elements in the page Starting in Firefox 48 you can move absolutely positioned elements by dragging them around the page. 68 Select an element Guide, Inspector, Tools The selected element is the element in the page that the Inspector is currently focused on. The selected element is shown in the HTML pane and its CSS is dis
played in the CSS pane. 69 Select and highlight elements The selected element is the element in the page that the Inspector is currently focused on. The selected element is shown in the HTML pane and its CSS is dis
played in the CSS pane. 70 Use the Inspector API Inspector, Reference, Reference(2), Tools Firefox add-ons may access the following objects from the ...
Measure a portion of the page - Firefox Developer Tools
gs. From the Available Toolbox Buttons check the Measure a portion of the page checkbox. You will now see the Measure a portion of the page button at the top right of the Toolbox, in the same place as the Settings/Options button. When you want to use the tool, click this button. Now when you mouse over the viewport, you'll see the mouse has a crosshair cursor with its current coordinates dis
played beside it. When you hold the mouse button down and then drag, you'll start to draw a rectangle, with its x, y, and diagonal dimensions dis
played. The units are in pixels. When you stop holding the mouse down, the rectangle that was dis
played on screen when you released the button will stay there until you click again, allowing you time to take screenshots, note the information down, etc. The ...
Aggregate view - Firefox Developer Tools
ke this: It presents a breakdown of the heap's contents, as a table. There are three main ways to group the data: Type Call Stack Inverted Call Stack You can switch between them using the dropdown menu labeled "Group by:" located at the top of the panel: There's also a box labeled "Filter" at the top-right of the pane. You can use this to filter the contents of the snapshot that are dis
played, so you can quickly see, for example, how many objects of a specific class were allocated. Type This is the default view, which looks something like this: It groups the things on the heap into types, including: JavaScript objects: such as Function or Array DOM elements: such as HTMLSpanElement or Window Strings: listed as "strings" JavaScript sources: listed as "JSScript" Internal obj...
Inspecting web sockets - Firefox Developer Tools
is opened by right-clicking in the table header. Expanding each message Selecting a message in the list shows a preview of the data being sent in that message, at the bottom of the Response pane. Supported WS protocols The inspector currently supports the following web socket protocols: Plain JSON Socket.IO SockJS SignalR WAMP The payload based on those protocols is parsed and dis
played as an expandable tree for easy inspection, although you can of course still see the raw data (as sent over the wire) as well. ...
Network request details - Firefox Developer Tools
he request headers section, a question mark links to the documentation for that request header, if one is available. A Raw toggle button in the section heading controls whether the headers are shown with formatting, or as plain, unformatted text. Cookies tab This tab lists full details of any cookies sent with the request or response: As with headers, you can filter the list of cookies dis
played. The full list of cookie attributes is shown--see the following screenshot showing Response cookies with further attributes shown. The samesite attribute has been shown since Firefox 62 (bug 1452715). Params tab This tab displays the GET parameters and POST data of a request: Response tab The complete content of the response. If the response is HTML, JS, or CSS, it will be shown as text:...
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
change in the Flex Container section: You can control the color of the overlay by clicking on the small circle next to the selector. This will toggle a color picker so you can select a different color for the overlay. The switch on the right-hand side of the Flex Container section will also toggle the overlay on and off. Flex item properties The flex items within the flex container are dis
played as a numbered list in the Flex Items section. Each entry displays the item's selector. Hover over an element to highlight it on the page. If you click on the item, the display shifts to show details about that element: This view shows information about the calculations for the size of the selected flex item: A diagram visualizing the sizing of the flex item Content Size - the size of th...
Examine and edit HTML - Firefox Developer Tools
he HTML pane keyboard shortcuts list. ::before and ::after You can inspect pseudo-elements added using ::before and ::after: Custom element definition When you open the Inspector on a page that includes custom elements, you can view the class definition for the custom element in the Debugger: Inspect the element Click on the word custom The source for the element's class will be dis
played in the Debugger. Whitespace-only text nodes Web developers don't write all their code in just one line of text. They use white space such as spaces, returns, or tabs between their HTML elements because it makes markup more readable. Usually this white space seems to have no effect and no visual output, but in fact, when a browser parses HTML it will automatically generate anonymous text node...
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
icker icon that allows you to change the primary color of the grid overlay. This is useful for selecting different colors so you can easily tell your grids apart. Inspecting a subgrid When the page contains a grid with a subgrid, the entry for the subgrid is indented under its parent in the Overlay grid section. When you select the checkbox for the subgrid, the lines for the parent grid are dis
played also dis
played; if the checkbox for the parent grid is unselected, then its lines are translucent. Display line numbers By default, the line numbers are dis
played on the grid overlay. Unchecking the "Display line numbers" box turns them off. Display area names In a grid with named areas, the area names are shown on the grid overlay by default. Unchecking the "Display area names" box...
Select an element - Firefox Developer Tools
The selected element is the element in the page that the Inspector is currently focused on. The selected element is shown in the HTML pane and its CSS is dis
played in the CSS pane. The highlighted element is the element that's overlaid in the page with a graphic showing the box model, and a tooltip showing its tag and size: With the context menu To open the Inspector and select an element immediately, activate the context menu over the element in the page and select "Inspect Element": With the HTML pane When the inspector is open, as you move the mouse around the elements listed in the HTML pane, the corresponding elements are highlighted in the page. Click an element in the HTML pane to select it: You can also use the arrow keys to move around the DOM with the keyboard. Wit...
Select and highlight elements - Firefox Developer Tools
The selected element is the element in the page that the Inspector is currently focused on. The selected element is shown in the HTML pane and its CSS is dis
played in the CSS pane. The highlighted element is the element that's overlaid in the page with a graphic showing the box model, and a tooltip showing its tag and size: With the context menu To open the Inspector and select an element immediately, activate the context menu over the element in the page and select "Inspect Element": With the HTML pane When the inspector is open, as you move the mouse around the elements listed in the HTML pane, the corresponding elements are highlighted in the page. Click an element in the HTML pane to select it: You can also use the arrow keys to move around the DOM with the keyboard. Wit...
Flame Chart - Firefox Developer Tools
u a way to know exactly which function was executing at any point during the recording, how long it ran for, and where it was called from. Zooming and panning To work effectively with the Flame Chart, you'll need to be able to navigate it. There are two main controls you can use to navigate the Flame Chart: Zoom: increase/decrease the selected portion of the complete profile that's dis
played in the Flame Chart 1) Mouse wheel up/down in the Flame Chart. 2) Trackpad 2 fingers up/down in the Flame Chart. Pan: move the selected portion of the complete profile left and right 1) Click and drag the selected portion in the recording overview pane. 2) Click and drag anywhere in the Flame Chart. An example To see how the Flame Chart can reve...
How to - Firefox Developer Tools
"Save" in the Recordings pane: Load a profile To load a profile, click "Import..." and choose the file: Clear all loaded profiles To clear all loaded profiles, click "Clear". ...
UI Tour - Firefox Developer Tools
in pieces: Toolbar Recordings pane Recording overview Details pane, which may contain any one of: Waterfall Call Tree Flame Chart Toolbar The toolbar contains buttons to: start and stop a recording import a recording you previously saved clear the Recordings pane. Note that if you do this, you lose any recordings you have not saved. filter the markers that are dis
played in the Waterfall view switch the active tool in the Details pane. access the Settings popup Recordings pane The recordings pane lists all the recordings you have loaded, including any you have made in this session and any you have imported. At any given time, one recording is selected, and that recording is dis
played in the rest of the tool. To select a different recording, click its en...
Waterfall - Firefox Developer Tools
r The worker is serializing a message to be sent to the main thread. Deserialize data in Worker The worker is deserializing a message received from the main thread. The markers, and their colors, are the same in the Waterfall tool as in the Waterfall overview, making is easy to correlate from one to the other. Filtering markers You can control which markers are dis
played using a button in the Toolbar: Waterfall patterns Exactly what you'll see in the Waterfall is very dependent on the kind of thing your site is doing: JavaScript-heavy sites will have a lot of orange, while visually dynamic sites will have a lot of purple and green. But there are common patterns which can alert you to possible performance problems. Rendering waterfall One pattern that you'll...
Rulers - Firefox Developer Tools
To be able to toggle rulers for a page, you first need to enable the button by going to the settings page for the Developer Tools and checking "Toggle rulers for the page" under Available Toolbox Buttons. Once enabled, the "Toggle rulers for the page" button appears at the top right of the Toolbox, in the same place as the Settings/Options button. ...
Style Editor - Firefox Developer Tools
argument to the Lass command-line tool, but in some preprocessors like Sass, source maps are generated by default and you don't need to do anything. Viewing original sources Now, if you check "Show original sources" in the Style Editor settings, the links next to CSS rules in the Rules view will link to the original sources in the Style Editor. From Firefox 35 onwards original sources are dis
played by default. Editing original sources You can also edit the original sources in the Style Editor and see the results applied to the page immediately. To get this to work there are two extra steps. First, set up your preprocessor so it watches the original source and automatically regenerates the CSS when the source changes. With Sass you can do this simply by passing the --watch option: sass i...
Rich output - Firefox Developer Tools
nt Event Examining object properties When an object is logged to the console it has a right-pointing triangle next to it, indicating that it can be expanded. Click on the triangle, and the object will be expanded to show its contents: Starting with Firefox 67 (available now in Firefox Developer) you can use the arrow keys on your keyboard to navigate through objects dis
played in the console. The right-arrow key opens the details of an object and the left-arrow key closes open objects. Examining request details Similar to examining object details, you can see the details about a network request directly in the console. Click on the arrow next to the request and a details panel will open that is equivalent to the Headers panel in the Network Monitor tool. Export ou...
The JavaScript input interpreter - Firefox Developer Tools
initiate a reverse search through the expression history, much like you can in bash on Linux and Mac or PowerShell on Windows. On Windows and Linux press F9. On Mac press Ctrl+R (note: not Cmd+R!) to initiate the reverse search. Enter the text you want to search for in the input box at the bottom of the Console. Start typing part of the expression you are looking for and the first match is dis
played in the console. Repeatedly typing F9 on Windows and Linux ( Ctrl+R on Mac) cycles backwards through the matches. Once you have initiated the reverse search, you can use Shift + F9 on Windows or Linux ( Ctrl+S on Mac) to search forward in the list of matches. You can also use the ? and ? icons in the expression search bar. When you find the expression you want, press Enter (Return) to execut...
Animation.currentTime - Web APIs
Syntax var currentTime = Animation.currentTime; Animation.currentTime = newTime; Value A number representing the current time in milliseconds, or null to deactivate the animation. ...
Animation.pause() - Web APIs
The pause() method of the Web Animations API's Animation interface suspends playback of the animation. Syntax animation.pause(); Parameters None. Return value None. Exceptions InvalidStateError The animation's currentTime is unresolved (for example, if it's never been
played or isn't currently playing) and the end time of the animation is positive infinity. Throws an InvalidStateError if the animation's currentTime is unresolved (perhaps it hasn't started playing yet) and the end time of the animation is positive infinity. Example Animation.pause() is used many times in the Alice in Web Animations API Land Growing/Shrinking Alice Game, largely because animations created with the Element.animate() method immediately start playing and must be paused manually if you want to avoid...
Animation.ready - Web APIs
ell as when the animation is canceled, since in both of those scenarios, the animation is ready to be started again. Since the same Promise is used for both pending play and pending pause requests, authors are advised to check the state of the animation when the promise is resolved. Syntax var readyPromise = Animation.ready; Value A Promise which resolves when the animation is ready to be
played. You'll typically use a construct similar to this when using the ready promise: animation.ready.then(function() { // Do whatever needs to be done when // the animation is ready to run }); Example In the following example, the state of the animation will be running when the current ready Promise is resolved because the animation does not leave the pending play state in between the calls to ...
Animation.reverse() - Web APIs
If called on a paused animation, the animation will continue in reverse. Syntax animation.reverse(); Parameters None. Return value undefined Example In the Growing/Shrinking Alice Game example, clicking or tapping the bottle causes Alice's growing animation (aliceChange) to play backwards, causing her to get smaller. ...
AudioBuffer - Web APIs
Objects of these types are designed to hold small audio snippets, typically less than 45 s. For longer sounds, objects implementing the MediaElementAudioSourceNode are more suitable. ...
AudioBufferSourceNode.AudioBufferSourceNode() - Web APIs
The AudioBufferSourceNode() constructor creates a new AudioBufferSourceNode object instance. Syntax var audioBufferSourceNode = new AudioBufferSourceNode(context, options) Parameters Inherits parameters from the AudioNodeOptions dictionary. context A reference to an AudioContext. options Optional Options are as follows: buffer: An instance of AudioBuffer to be
played. detune: A value in cents to modulate the speed of audio stream rendering. Its nominal range is (-? to +?). The default is 0. loop: A boolean indicating whether the audio should play in a loop. The default is false. If the loop is dynamically modified during playback, the new value will take effect on the next processing block of audio. loopEnd: An optional value, in seconds, where looping should end if the loop...
AudioBufferSourceNode.loopEnd - Web APIs
operty is only used if the loop property is true. The default value is 0. Example In this example, the AudioContext.decodeAudioData() function is used to decode an audio track and put it into an AudioBufferSourceNode. Buttons are provided to play and stop the audio playback, and slider controls are used to change the playbackRate, loopStart and loopEnd properties on the fly. When the audio is
played to the end, it loops, but you can control how long the loops last by altering loopStart and loopEnd. For example, if you set their values to 20 and 25, respectively, then begin playback, the sound will play normally until it reaches the 25 second mark. Then the current play position will loop back to the 20 second mark and continue playing until the 25 second mark, ad infinitum (or at least until...
AudioBufferSourceNode.loopStart - Web APIs
during playback. This value is only used when the loop parameter is true. Example In this example, the AudioContext.decodeAudioData() function is used to decode an audio track and put it into an AudioBufferSourceNode. Buttons are provided to play and stop the audio playback, and slider controls are used to change the playbackRate, loopStart, and loopEnd properties on the fly. When the audio is
played to the end, it loops, but you can control how long the loops last by altering loopStart and loopEnd. For example, if you set their values to 20 and 25, respectively, the audio will start to loop between 20 and 25 seconds in to the track. For a full working example, see this code running live, or view the source. function getData() { source = audioCtx.createBufferSource(); request = new XM...
AudioBufferSourceNode.playbackRate - Web APIs
A value of 1.0 indicates it should play at the same speed as its sampling rate, values less than 1.0 cause the sound to play more slowly, while values greater than 1.0 result in audio playing faster than normal. The default value is 1.0. When set to another value, the AudioBufferSourceNode resamples the audio before sending it to the output. ...
AudioContext.createMediaElementSource() - Web APIs
For more details about media element audio source nodes, check out the MediaElementAudioSourceNode reference page. Syntax var audioCtx = new AudioContext(); var source = audioCtx.createMediaElementSource(myMediaElement); Parameters myMediaElement An HTMLMediaElement object that you want to feed into an audio processing graph to manipulate. ...
AudioContext.createMediaStreamSource() - Web APIs
For more details about media stream audio source nodes, check out the MediaStreamAudioSourceNode reference page. Syntax audioSourceNode = audioContext.createMediaStreamSource(stream); Parameters stream A MediaStream to serve as an audio source to be fed into an audio processing graph for use and manipulation. ...
AudioNode - Web APIs
h Each AudioNode has inputs and outputs, and multiple audio nodes are connected to build a processing graph. This graph is contained in an AudioContext, and each audio node can only belong to one audio context. A source node has zero inputs but one or multiple outputs, and can be used to generate sound. On the other hand, a destination node has no outputs; instead, all its inputs are directly
played back on the speakers (or whatever audio output device the audio context uses). In addition, there are processing nodes which have inputs and outputs. The exact processing done varies from one AudioNode to another but, in general, a node reads its inputs, does some audio-related processing, and generates new values for its outputs, or simply lets the audio pass through (for example in the Analyser...
AudioScheduledSourceNode: ended event - Web APIs
s stopped playing. Bubbles No Cancelable No Interface Event Event handler property AudioScheduledSourceNode.onended 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. 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.onended property: node.onended = function() { document.get...
AudioScheduledSourceNode.start() - Web APIs
ntTime attribute. A value of 0 (or omitting the when parameter entirely) causes the sound to start playback immediately. offset Optional A floating-point number indicating the offset, in seconds, into the audio buffer where playback should begin. If 0 is passed then the playback will start from the beginning. duration Optional A floating-point number indicating the duration, in seconds, to be
played. If no value is passed then the duration will be equal to the length of the audio buffer minus the offset value Return value undefined Exceptions InvalidStateNode The node has already been started. This error occurs even if the node is no longer running because of a prior call to stop(). RangeError The value specified for when is negative. Example This example demonstrates how to cre...
AudioScheduledSourceNode - Web APIs
. 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 onended event handler property. Specification Specification Status Comment Web Audio APIThe definition of 'AudioScheduledSourceNode' in that specification. Working Draft ...
BaseAudioContext.createDynamicsCompressor() - Web APIs
oContext Interface is used to create a DynamicsCompressorNode, which can be used to apply compression to an audio signal. Compression lowers the volume of the loudest parts of the signal and raises the volume of the softest parts. Overall, a louder, richer, and fuller sound can be achieved. It is especially important in games and musical applications where large numbers of individual sounds are
played simultaneously, where you want to control the overall signal level and help avoid clipping (distorting) of the audio output. Syntax baseAudioCtx.createDynamicsCompressor(); Returns A DynamicsCompressorNode. Example The below code demonstrates a simple usage of createDynamicsCompressor() to add compression to an audio track. For a more complete example, have a look at our basic Compressor ex...
BaseAudioContext.createScriptProcessor() - Web APIs
.buffer = myBuffer; }, function(e){"Error with decoding audio data" + e.err}); } request.send(); } // Give the node a function to process audio events scriptNode.onaudioprocess = function(audioProcessingEvent) { // The input buffer is the song we loaded earlier var inputBuffer = audioProcessingEvent.inputBuffer; // The output buffer contains the samples that will be modified and
played var outputBuffer = audioProcessingEvent.outputBuffer; // Loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputBuffer.numberOfChannels; channel++) { var inputData = inputBuffer.getChannelData(channel); var outputData = outputBuffer.getChannelData(channel); // Loop through the 4096 samples for (var sample = 0; sample < input...
BaseAudioContext.decodeAudioData() - Web APIs
e decoded, usually grabbed from XMLHttpRequest, WindowOrWorkerGlobalScope.fetch() or FileReader. successCallback A callback function to be invoked when the decoding successfully finishes. The single argument to this callback is an AudioBuffer representing the decodedData (the decoded PCM audio data). Usually you'll want to put the decoded data into an AudioBufferSourceNode, from which it can be
played and manipulated how you want. errorCallback An optional error callback, to be invoked if an error occurs when the audio data is being decoded. Return value Void, or a Promise object that fulfills with the decodedData. Example In this section we will first cover the older callback-based system and then the newer promise-based syntax. Older callback syntax In this example, the getData() fu...
BaseAudioContext - Web APIs
expose audio time and frequency data and for example to create data visualisations. BaseAudioContext.createBiquadFilter() Creates a BiquadFilterNode, which represents a second order filter configurable as several different common filter types: high-pass, low-pass, band-pass, etc BaseAudioContext.createBuffer() Creates a new, empty AudioBuffer object, which can then be populated by data and
played via an AudioBufferSourceNode. BaseAudioContext.createBufferSource() Creates an AudioBufferSourceNode, which can be used to play and manipulate audio data contained within an AudioBuffer object. AudioBuffers are created using AudioContext.createBuffer or returned by AudioContext.decodeAudioData when it successfully decodes an audio track. BaseAudioContext.createConstantSource() Creates a Const...
Drawing text - Web APIs
ent.getElementById('canvas').getContext('2d'); ctx.font = '48px serif'; ctx.strokeText('Hello world', 10, 50); } <canvas id="canvas" width="300" height="100"></canvas> draw(); Styling text In the examples above we are already making use of the font property to make the text a bit larger than the default size. There are some more properties which let you adjust the way the text gets dis
played on the canvas: font = value The current text style being used when drawing text. This string uses the same syntax as the CSS font property. The default font is 10px sans-serif. textAlign = value Text alignment setting. Possible values: start, end, left, right or center. The default value is start. textBaseline = value Baseline alignment setting. Possible values: top, hanging, middle, alph...
console.count() - Web APIs
l. If omitted, count() behaves as though it was called with the "default" label. Examples For example, given code like this: let user = ""; function greet() { console.count(); return "hi " + user; } user = "bob"; greet(); user = "alice"; greet(); greet(); console.count(); Console output will look something like this: "default: 1" "default: 2" "default: 3" "default: 4" The label is dis
played as default because no explicit label was supplied. If we pass the user variable as the label argument to the first invocation of count(), and the string "alice" to the second: let user = ""; function greet() { console.count(user); return "hi " + user; } user = "bob"; greet(); user = "alice"; greet(); greet(); console.count("alice"); We will see output like this: "bob: 1" "alice: 1" "ali...
console.debug() - Web APIs
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 appended 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 ... ...
Console.info() - Web APIs
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 appended 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. ...
Console.table() - Web APIs
, "Jones"); console.table([john, jane, emily]); Note that if the array contains objects, then the columns are labeled with the property name. // an object whose properties are objects var family = {}; family.mother = new Person("Jane", "Smith"); family.father = new Person("John", "Smith"); family.daughter = new Person("Emily", "Smith"); console.table(family); Restricting the columns dis
played By default, console.table() lists all elements in each row. You can use the optional columns parameter to select a subset of columns to display: // an array of objects, logging only firstName function Person(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } var john = new Person("John", "Smith"); var jane = new Person("Jane", "Doe"); var emily = new Person("Em...
Console.timeLog() - Web APIs
e" doesn't exist. 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 dis
played when the timer value is logged using timeLog() and again when it's stopped. In addition, the call to timeEnd() has the additional information, "timer ended" to make it obvious that the timer is no longer tracking time. Specifications Specification Status Comment Console APIThe definition of 'console.timeLog()' in that specification. Living Standard Initial defi...
console.trace() - Web APIs
ples. Syntax console.trace( [...any, ...data ]); Parameters ...any, ...data Optional Zero or more objects to be output to console along with the trace. These are assembled and formatted the same way they would be if passed to the console.log() method. Example function foo() { function bar() { console.trace(); } bar(); } foo(); In the console, the following trace will be dis
played: bar foo <anonymous> Specifications Specification Status Comment Console APIThe definition of 'console.trace()' in that specification. Living Standard Initial definition ...
console - Web APIs
Note: It's important to note that if you're using this to log the timing for network traffic, the timer will report the total time for the transaction, while the time listed in the network panel is just the amount of time required for the header. If you have response body logging enabled, the time listed for the response header and body combi...
Constraint validation API - Web APIs
y A read-only property that returns a ValidityState object, whose properties represent validation errors for the value of that element. validationMessage A read-only property that returns an empty string if the element is not a candidate for constraint validation, or if the element's value is valid. If the element's value is not valid, it returns a localized validation message. This will be dis
played in the UI if the element is the only form control with a validity problem; if a custom error message is set using setCustomValidity(), this will be shown. willValidate A read-only boolean property that returns true if the element is a candidate for constraint validation; and false otherwise. Elements with the HTMLObjectElement interface are never candidates for constraint validation. Others may...
DOMHighResTimeStamp - Web APIs
ent document's lifetime. It's calculated like this: If the script's global object is a Window, the time origin is determined as follows: If the current Document is the first one loaded in the Window, the time origin is the time at which the browser context was created. If during the process of unloading the previous document which was loaded in the window, a confirmation dialog was dis
played to let the user confirm whether or not to leave the previous page, the time origin is the time at which the user confirmed that navigating to the new page was acceptable. If neither of the above determines the time origin, then the time origin is the time at which the navigation responsible for creating the window's current Document took place. If the script's global object is a WorkerGl...
DataTransfer.dropEffect - Web APIs
For example, when the user hovers over a target drop element, the browser's cursor may indicate which type of operation will occur. When the DataTransfer object is created, dropEffect is set to a string value. On getting, it returns its current value. On setting, if the new value is one of the values listed below, then the property's current value will be set to the new value and other values will be ignored. ...
DeprecationReportBody - Web APIs
ell it to start observing reports using ReportingObserver.observe(); this tells the observer to start collecting reports in its report queue, and runs the callback function specified inside the constructor: observer.observe(); Because of the event handler we set up inside the ReportingObserver() constructor, we can now click the button to display the report details. ...
Document.createDocumentFragment() - Web APIs
t cause page reflow (computation of element's position and geometry). Historically, using document fragments could result in better performance. You can also use the DocumentFragment constructor to create a new fragment: let fragment = new DocumentFragment(); Example This example creates a list of major web browsers in a DocumentFragment, then adds the new DOM subtree to the document to be dis
played. HTML <ul id="ul"> </ul> JavaScript var element = document.getElementById('ul'); // assuming ul exists var fragment = document.createDocumentFragment(); var browsers = ['Firefox', 'Chrome', 'Opera', 'Safari', 'Internet Explorer']; browsers.forEach(function(browser) { var li = document.createElement('li'); li.textContent = browser; fragment.appendChild(li); }); element.appen...
Document.queryCommandState() - Web APIs
contenteditable="true">Select a part of this text!</div> <button onclick="makeBold();">Test the state of the 'bold' command</button> JavaScript function makeBold() { var state = document.queryCommandState("bold"); switch (state) { case true: alert("The bold formatting will be removed from the selected text."); break; case false: alert("The selected text will be dis
played in bold."); break; case null: alert("The state of the 'bold' command is indeterminable."); break; } document.execCommand('bold'); } Result Specifications Specification Status Comment execCommand ...
Document.title - Web APIs
Syntax var docTitle = document.title; docTitle is a string containing the document's title. If the title was overridden by setting document.title, it contains that value. Otherwise, it contains the title specified in the markup (see the Notes below). document.title = newTitle; newTitle is the new title of the document. The assignment affects the return value of document.title, the title dis
played for the document (e.g. in the titlebar of the window or tab), and it also affects the DOM of the document (e.g. the content of the <title> element in an HTML document). Example <!DOCTYPE html> <html> <head> <title>Hello World!</title> </head> <body> <script> alert(document.title); // displays "Hello World!" document.title = "Goodbye World!"; alert(document.title); // displays "...
Examples of web and XML development using the DOM - Web APIs
ent 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 dis
played 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("event propagation halted."); } fu...
Introduction to the DOM - Web APIs
web content and applications. What is the DOM? The Document Object Model (DOM) is a programming interface for HTML and XML documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as nodes and objects. That way, programming languages can connect to the page. A Web page is a document. This document can be either dis
played in the browser window or as the HTML source. But it is the same document in both cases. The Document Object Model (DOM) represents that same document so it can be manipulated. The DOM is an object-oriented representation of the web page, which can be modified with a scripting language such as JavaScript. The W3C DOM and WHATWG DOM standards are implemented in most modern browsers. Many browsers ...
DynamicsCompressorNode - Web APIs
This is often used in musical production and game audio. DynamicsCompressorNode is an AudioNode that has exactly one input and one output; it is created using the AudioContext.createDynamicsCompressor() method. ...
Element.onfullscreenchange - Web APIs
ed on by checking the value of event.target, then compares the document's fullscreenElement value to the element to see if they're the same node. This gives us a value, isFullscreen, which we pass into a function called adjustMyControls(), which we imagine to be a function that makes adjustments to the app's user interface to present itself optimally when it's in full-screen mode versus being dis
played in a window. function toggleFullscreen() { let elem = document.querySelector("video"); elem.onfullscreenchange = handleFullscreenChange; if (!document.fullscreenElement) { elem.requestFullscreen().then({}).catch(err => { alert(`Error attempting to enable full-screen mode: ${err.message} (${err.name})`); }); } else { document.exitFullscreen(); } } function handleFull...
Element.requestFullscreen() - Web APIs
It's not guaranteed that the element will be put into full screen mode. If permission to enter full screen mode is granted, the returned Promise will resolve and the element will receive a fullscreenchange event to let it know that it's now in full screen mode. If permission is denied, the promise is rejected and the element receives a fullscreenerror event instead. If the element has been detached from the original document, then the document receives these events instead. ...
Element.scroll() - Web APIs
The scroll() method of the Element interface scrolls the element to a particular set of coordinates inside a given element. Syntax element.scroll(x-coord, y-coord) element.scroll(options) Parameters Calling with coordinates x-coord The pixel along the horizontal axis of the element that you want dis
played in the upper left. y-coord The pixel along the vertical axis of the element that you want dis
played in the upper left. Calling with options options A ScrollToOptions dictionary. Examples // Put the 1000th vertical pixel at the top of the element element.scroll(0, 1000); Using options: element.scroll({ top: 100, left: 100, behavior: 'smooth' }); Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definitio...
File.webkitRelativePath - Web APIs
ribute set. Syntax relativePath = File.webkitRelativePath Value A USVString containing the path of the file relative to the ancestor directory the user selected. Example In this example, a directory picker is presented which lets the user choose one or more directories. When the change event occurs, a list of all files contained within the selected directory hierarchies is generated and dis
played. HTML content <input type="file" id="filepicker" name="fileList" webkitdirectory multiple /> <ul id="listing"></ul> JavaScript content document.getElementById("filepicker").addEventListener("change", function(event) { let output = document.getElementById("listing"); let files = event.target.files; for (let i=0; i<files.length; i++) { let item = document.createElement("li"); ite...
FontFace.display - Web APIs
This property is equivalent to the CSS font-display descriptor. When this property is used, font loading has a timeline with three periods. The lengths of the first two periods depend on the value of the property and the user agent. (See below.) block period The browser invisibly prepares a fallback font. If the font face loads during this time, it's used to display the text and display is complete. swap period If the font face is still not loaded, the fallback font will be shown. When the font face loads, the fallback will be swaped for the downloaded font. ...
FontFace - Web APIs
to an external resource, or a buffer; it also allows control of when the font face is loaded and its current status. Constructor FontFace() Constructs and returns a new FontFace object, built from an external resource described by an URL or from an ArrayBuffer. Properties This interface doesn't inherit any property. FontFace.display A CSSOMString that determines how a font face is dis
played based on whether and when it is downloaded and ready to use. FontFace.family A CSSOMString that retrieves or sets the family of the font. It is equivalent to the font-family descriptor. FontFace.featureSettings A CSSOMString that retrieves or sets infrequently used font features that are not available from a font's variant properties. It is equivalent to the font-feature-settings descriptor. ...
FullscreenOptions.navigationUI - Web APIs
ment's Document.documentElement, which is the document's root <html> element. let elem = document.documentElement; elem.requestFullscreen({ navigationUI: "show" }).then({}).catch(err => { alert(`An error occurred while trying to switch into full-screen mode: ${err.message} (${err.name})`); }); The promise's resolve handler does nothing, but if the promise is rejected, an error message is dis
played by calling alert(). Specifications Specification Status Comment Fullscreen APIThe definition of 'FullscreenOptions' in that specification. Living Standard Initial definition ...
GlobalEventHandlers.onanimationcancel - Web APIs
one"; document.getElementById("toggleBox").innerHTML = "Show the box"; } }); Toggling the box to display: none has the effect of aborting its animation. In browsers that support animationcancel, the event is fired and this handler is called. Result Assembled together, you get this: If your browser supports animationcancel, hiding the box using the button will cause a message to be dis
played about the event. Specification Specification Status Comment CSS AnimationsThe definition of 'onanimationcancel' in that specification. Working Draft ...
GlobalEventHandlers.onanimationiteration - Web APIs
Start Iteration #" + (iterationCounter+1); }; This sets up two global variables: box, which references the "box" element that we're animating, and iterationCounter, which is initially zero, which indicates how many iterations of the animation have occurred. The onanimationiteration event handler is then set up. It simply sets the box's animation-play-state to "paused", then updates the text dis
played in the button to indicate that clicking the button will start playing the next iteration of theanimation. Finally, we set up a handler for a click on the button that runs the animation: document.getElementById("play").addEventListener("click", function(event) { box.style.animationPlayState = "running"; iterationCounter++; }, false); This sets the box element's animation-play-state to "runn...
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. ...
HTMLAnchorElement - Web APIs
{ 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 intended to be downloaded rather than dis
played in the browser. The value represent the proposed name of the file. If the name is not a valid filename of the underlying OS, browser will adapt it. HTMLHyperlinkElementUtils.hash Is a USVString representing the fragment identifier, including the leading hash mark ('#'), if any, in the referenced URL. HTMLHyperlinkElementUtils.host Is a USVString representing the hostname and port (if it's not...
HTMLAreaElement - Web APIs
ocus 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 intended to be downloaded rather than dis
played in the browser. The value represent the proposed name of the file. If the name is not a valid filename of the underlying OS, browser will adapt it. HTMLHyperlinkElementUtils.hash Is a USVString containing the fragment identifier (including the leading hash mark (#)), if any, in the referenced URL. HTMLHyperlinkElementUtils.host Is a USVString containing the hostname and port (if it's not the ...
msAudioCategory - Web APIs
will mute existing background media sounds. Game audio needed for the game experience (dancing games, music games) Feature films (designed to pause when they go to the background) No GameEffects Game sound effects designed to mix with existing audio Characters talking All non-music sounds No GameMedia Background music
played by a game No SoundEffects Game or other sound effects designed to mix with existing audio: Characters talking Beeps, dings, brief sounds No Other Default audio type, and recommended for all audio media that does not need to continue playing in the background. No If msAudioDeviceType is not explicitly set, msAudioDeviceType wi...
HTMLButtonElement - Web APIs
ting where to display the response that is received after submitting the form. If specified, this attribute overrides the target attribute of the <form> element that owns this element. HTMLButtonElement.labels Read only Is a NodeList that represents a list of <label> elements that are labels for this button. HTMLButtonElement.menu Is a HTMLMenuElement representing the menu element to be dis
played if the button is clicked and is of type="menu". HTMLButtonElement.name Is a DOMString representing the name of the object when submitted with a form. HTML5 If specified, it must not be the empty string. HTMLButtonElement.tabIndex Is a long that represents this element's position in the tabbing order. HTMLButtonElement.type Is a DOMString indicating the behavior of the button. This is an enu...
HTMLElement.hidden - Web APIs
resentation while intending it to be visible in others Elements that are not hidden must not link to elements which are. Syntax isHidden = HTMLElement.hidden; HTMLElement.hidden = true | false; Value A Boolean which is true if the element is hidden from view; otherwise, the value is false. Example Here's an example where a hidden block is used to contain a thank you message that is dis
played after a user agrees to an unusual request. JavaScript document.getElementById("okButton") .addEventListener("click", function() { document.getElementById("welcome").hidden = true; document.getElementById("awesome").hidden = false; }, false); This code sets up a handler for the welcome panel's "OK" button that hides the welcome panel and makes the follow-up panel--with the curious n...
HTMLElement.title - Web APIs
Syntax var str = element.title; element.title = str; Example const link = document.createElement('a'); link.innerText = 'grapes'; link.href = 'https://en.wikipedia.org/wiki/Grape'; link.title = 'Wikipedia page on grapes'; Specifications Specification Status Comment HTML Living StandardThe definition of 'title' in that specification. Living Standard No change from Document Object Model (DOM) Level 2 HTML Specification. ...
HTMLImageElement.naturalHeight - Web APIs
ainer the image will be drawn in is 200px wide, and the image will be drawn to fill its width (100%). JavaScript let output = document.querySelector(".output"); let image = document.querySelector("img"); window.addEventListener("load", event => { output.innerHTML += `Natural size: ${image.naturalWidth} x ` + `${image.naturalHeight} pixels<br>`; output.innerHTML += `Dis
played size: ${image.width} x ` + `${image.height} pixels`; }); The JavaScript code simply dumps the natural and as-dis
played sizes into the <div> with the class output. This is done in response to the window's load event handler, in order to ensure that the image is available before attempting to examine its width and height. Result Specifications Specification ...
HTMLImageElement.naturalWidth - Web APIs
ainer the image will be drawn in is 200px wide, and the image will be drawn to fill its width (100%). JavaScript let output = document.querySelector(".output"); let image = document.querySelector("img"); window.addEventListener("load", event => { output.innerHTML += `Natural size: ${image.naturalWidth} x ` + `${image.naturalHeight} pixels<br>`; output.innerHTML += `Dis
played size: ${image.width} x ` + `${image.height} pixels`; }); The JavaScript code simply dumps the natural and as-dis
played sizes into the <div> with the class output. This is done in response to the window's load event handler, in order to ensure that the image is available before attempting to examine its width and height. Result Specifications Specification ...
HTMLImageElement.srcset - Web APIs
is run within a handler for the window's load event. It uses the image's currentSrc property to fetch and display the URL selected by the browser from the srcset. let box = document.querySelector(".box"); let image = box.querySelector("img"); let newElem = document.createElement("p"); newElem.innerHTML = `Image: <code>${image.currentSrc}</code>`; box.appendChild(newElem); Result In the dis
played output below, the selected URL will correspond with whether your display results in selecting the 1x or the 2x version of the image. If you happen to have both standard and high density displays, try moving this window between them and reloading the page to see the results change. For additional examples, see our guide to responsive images. Specifications Specification Status ...
HTMLInputElement.webkitdirectory - Web APIs
e to know the hierarchy even though the FileList is flat. Note: The behavior of webkitRelativePath is different in Chromium < 72. See this bug for further details. Example In this example, a directory picker is presented which lets the user choose one or more directories. When the change event occurs, a list of all files contained within the selected directory hierarchies is generated and dis
played. HTML content <input type="file" id="filepicker" name="fileList" webkitdirectory multiple /> <ul id="listing"></ul> JavaScript content document.getElementById("filepicker").addEventListener("change", function(event) { let output = document.getElementById("listing"); let files = event.target.files; for (let i=0; i<files.length; i++) { let item = document.createElement("li"); ite...
HTMLMediaElement.canPlayType() - Web APIs
lement method canPlayType() reports how likely it is that the current browser will be able to play media of a given MIME type. Note: This feature is not available in Web Workers. Syntax canPlayResponse = audioOrVideo.canPlayType(mediaType); Parameters mediaType A DOMString containing the MIME type of the media. Return value A DOMString indicating how likely it is that the media can be
played. The string will be one of the following values: probably Media of the type indicated by the mediaType parameter is probably playable on this device. maybe Not enough information is available to determine for sure whether or not the media will play until playback is actually attempted. "" (empty string) Media of the given type definitely can't be
played on the current device. Example v...
HTMLMediaElement.readyState - Web APIs
playback position, but not enough to actually play more than one frame. HAVE_FUTURE_DATA 3 Data for the current playback position as well as for at least a little bit of time into the future is available (in other words, at least two frames of video, for example). HAVE_ENOUGH_DATA 4 Enough data is available--and the download rate is high enough--that the media can be
played through to the end without interruption. Examples This example will listen for audio data to be loaded for the element `example`. It will then check if at least the current playback position has been loaded. If it has, the audio will play. <audio id="example" preload="auto"> <source src="sound.ogg" type="audio/ogg" /> </audio> var obj = document.getElementById('example'); obj.addEve...
HTMLMediaElement.volume - Web APIs
Syntax var volume = video.volume; //1 Value A double values must fall between 0 and 1, where 0 is effectively muted and 1 is the loudest possible value. Example var obj = document.createElement('audio'); console.log(obj.volume); // 1 obj.volume = 0.75; Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.volume' in that specification. ...
Option() - Web APIs
If this is not specified, a default value of "" (empty string) is used. value Optional A DOMString representing the value of the HTMLOptionElement, i.e. the value attribute of the equivalent <option>. If this is not specified, the value of text is used as the value, e.g. ...
HTMLVideoElement.getVideoPlaybackQuality() - Web APIs
= videoElement.getVideoPlaybackQuality(); Return value A VideoPlaybackQuality object providing information about the video element's current playback quality. Example This example updates an element to indicate the total number of video frames that have elapsed so far in the playback process. This value includes any dropped or corrupted frames, so it's not the same as "total number of frames
played." var videoElem = document.getElementById("my_vid"); var counterElem = document.getElementById("counter"); var quality = videoElem.getVideoPlaybackQuality(); counterElem.innerText = quality.totalVideoFrames; Specifications Specification Status Comment Media Playback QualityThe definition of 'HTMLVideoElement.getVideoPlaybackQuality()' in that specification. Editor'...
HTMLVideoElement.videoHeight - Web APIs
er frame rather than rendered video, the poster frame's intrinsic size is considered to be the size of the <video> element. If at any time the intrinsic size of the media changes and the element's readyState isn't HAVE_NOTHING, a resize event will be sent to the <video> element. This can happen when the element switches from displaying the poster frame to displaying video content, or when the dis
played video track changes. Example This example creates a handler for the resize event that resizes the <video> element to match the intrinsic size of its contents. let v = document.getElementById("myVideo"); v.addEventListener("resize", ev => { let w = v.videoWidth; let h = v.videoHeight; if (w && h) { v.style.width = w; v.style.height = h; } }, false); Note that this only appli...
HTMLVideoElement.videoWidth - Web APIs
er frame rather than rendered video, the poster frame's intrinsic size is considered to be the size of the <video> element. If at any time the intrinsic size of the media changes and the element's readyState isn't HAVE_NOTHING, a resize event will be sent to the <video> element. This can happen when the element switches from displaying the poster frame to displaying video content, or when the dis
played video track changes. Example This example creates a handler for the resize event that resizes the <video> element to match the intrinsic size of its contents. let v = document.getElementById("myVideo"); v.addEventListener("resize", ev => { let w = v.videoWidth; let h = v.videoHeight; if (w && h) { v.style.width = w; v.style.height = h; } }, false); Note that this only appli...
The HTML DOM API - Web APIs
es together or for providing a point at which a hierarchy can be constructed; other nodes may represent visible components of a document. Each node is based on the Node interface, which provides properties for getting information about the node as well as methods for creating, deleting, and organizing nodes within the DOM. Nodes don't have any concept of including the content that is actually dis
played in the document. They're empty vessels. The fundamental notion of a node that can represent visual content is introduced by the Element interface. An Element object instance represents a single element in a document created using either HTML or an XML vocabulary such as SVG. For example, consider a document with two elements, one of which has two more elements nested inside it: While the Docu...
Dragging and Dropping Multiple Items - Web APIs
will need to retrieve the file object or objects using the mozGetDataAt() method. If you use getData(), you will receive an empty string as the data is not a string. Note that some simple types like numbers can be converted to strings, so it is safe to use getData() in this case. Multiple Drop Example The following example provides a box where the lists of items and formats dropped on it are dis
played. <html> <head> <script> function dodrop(event) { var dt = event.dataTransfer; var count = dt.mozItemCount; output("Items: " + count + "\n"); for (var i = 0; i < count; i++) { output(" Item " + i + ":\n"); var types = dt.mozTypesAt(i); for (var t = 0; t < types.length; t++) { output(" " + types[t] + ": "); try { var data = dt.mozGetDataAt(types[t], i); ...
MediaPositionState - Web APIs
ayback position and duration of the media currently being performed. Properties duration A floating-point value giving the total duration of the current media in seconds. This should always be a positive number, with positive infinity (Infinity) indicating media without a defined end, such as a live stream. playbackRate A floating-point value indicating the rate at which the media is being
played, as a ratio relative to its normal playback speed. Thus, a value of 1 is playing at normal speed, 2 is playing at double speed, and so forth. Negative values indicate that the media is playing in reverse; -1 indicates playback at the normal speed but backward, -2 is double speed in reverse, and so on. position A floating-point value indicating the last reported playback position of the media in...
MediaSession.metadata - Web APIs
laying media, or null if the metadata has not been set. This metadata is provided by the browser to the device for presentation in any standard media control user interface the device might offer. Syntax var mediaMetadata = navigator.mediaSession.metadata; navigator.mediaSession.metadata = mediaMetadata; Value An instance of MediaMetadata containing information about the media currently being
played. Example The following example creates a new media session and assigns action handlers to it: if ('mediaSession' in navigator){ navigator.mediaSession.metadata = new MediaMetadata({ title: "Podcast Episode Title", artist: "Podcast Host", album: "Podcast Name", artwork: [{src: "podcast.jpg"}] }); navigator.mediaSession.setActionHandler('play', function() {}); navigator.m...
MediaSession.setPositionState() - Web APIs
dia file format, written in JavaScript, uses setInterval() to establish a callback which fires once per second to refresh the position information by calling setPositionState(). If the media is still playing when the interval is fired, setPositionState() is called with an object that specifies the duration, playback rate, and position as reported by a myMedia object that describes the track being
played. If the media is not playing, clearInterval() is used to remove the interval handler. let positionInterval = window.setInterval(() => { if (myMedia.isPlaying) { navigator.mediaSession.setPositionState({ duration: myMedia.trackDurationInSeconds, playbackRate: myMedia.playbackRate, position: myMedia.trackPlayPositionInSeconds }); } else { window.clearInterval(pos...
MediaSource - Web APIs
The MediaSource interface of the Media Source Extensions API represents a source of media data for an HTMLMediaElement object. A MediaSource object can be attached to a HTMLMediaElement to be
played in the user agent. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alig...
MediaStreamConstraints - Web APIs
ct providing the constraints which must be met by the video track included in the returned MediaStream. If constraints are specified, a video track is inherently requested. Security peerIdentity A DOMString identifying the peer who has sole access to the stream. If this property is specified, only the indicated peer can receive and use the stream. Streams isolated in this way can only be dis
played in a media element (<audio> or <video>) where the content is protected just as if CORS cross-origin rules were in effect. When a peer identity is set, MediaStreamTracks from that peer have their isolated flag set to true. ...
Using the MediaStream Recording API - Web APIs
element will have its horizontal translation value changed and transition smoothly into view: input[type=checkbox]:checked ~ aside { transform: translateX(0); } Basic app setup To grab the media stream we want to capture, we use getUserMedia(). We then use the MediaRecorder API to record the stream, and output each recorded snippet into the source of a generated <audio> element so it can be
played back. We'll declare some variables for the record and stop buttons, and the <article> that will contain the generated audio players: const record = document.querySelector('.record'); const stop = document.querySelector('.stop'); const soundClips = document.querySelector('.sound-clips'); Finally for this section, we set up the basic getUserMedia structure: if (navigator.mediaDevices && navigat...
Using the Media Capabilities API - Web APIs
including values for the contentType, width, height, bitrate, and framerate: The contentType must be a string specifying a valid video MIME type. The width and height are the horizontal and vertical dimensions of the video; these are also used to determine the aspect ratio. The bitrate is the number of bits used to encode one second of video. The framerate is the number of frames which are
played per second of time when playing the video. const videoConfiguration = { type: "file", video: { contentType: "video/webm;codecs=vp8", width: 800, height: 600, bitrate: 10000, framerate: 15 } }; Had we been querying the decodability of an audio file, we would create an audio configuration including the number of channels and sample rate, leaving out the pro...
Transcoding assets for Media Source Extensions - Web APIs
1625.mp4 Splitting media file (video) video_02000.mp4 $ tree -L 2 output output +-- audio | +-- und +-- stream.mpd +-- video +-- 1 +-- 2 +-- 3 +-- 4 +-- 5 8 directories, 1 file Note: mp4-dash-encode.py does not display ffmpeg error messages. You can see it by specifying the -d option. Note: If "Invalid duration specification for force_key_frames: 'expr:eq(mod(n" is dis
played as an error message, modify mp4-dash-encode.py and remove two "'" from "-force_key_frames 'expr:eq(mod(n,%d),0)'". Summary With your video properly encoded and adaptive bitrate media generated, you're now ready to begin adaptive bitrate streaming on the web using DASH and MSE. ...
MerchantValidationEvent.complete() - Web APIs
process, or a Promise which resolves to the validation data. Return value undefined. Exceptions This exception may be passed into the rejection handler for the promise: InvalidStateError The event did not come directly from the user agent, but was instead dispatched by other code. another payment request is currently being processed, the current payment request is not currently being dis
played to the user, or payment information is currently being updated. Example In this example, we see the client-side code needed to support merchant validation for a payment request called payRequest: payRequest.onmerchantvalidation = event => { const validationDataPromise = getValidationData(event.validationURL); event.complete(validationDataPromise); } function getValidationData(url) { /*...
MimeType - Web APIs
contains information about a MIME type associated with a particular plugin. NavigatorPlugins.mimeTypes returns an array of this object. Properties MimeType.type Returns the MIME type of the associated plugin. MimeType.description Returns a description of the associated plugin or an empty string if there is none. MimeType.suffixes A string containing valid file extensions for the data dis
played by the plugin, or an empty string if an extension is not valid for the particular module. For example, a browser's content decryption module may appear in the plugin list but support more file extensions than can be anticipated. It might therefore return an empty string. MimeType.enabledPlugin Returns an instance of Plugin containing information about the plugin itself. Specifications ...
Navigator.mediaSession - Web APIs
a controls on a keyboard or elsehwere on the user's device be used to control the app's media playback. Syntax let mediaSession = navigator.mediaSession; Value A MediaSession object the current document can use to share information about media it's playing and its current playback status. This information can include typical metadata such as the title, artist, and album name of the song being
played as well as potentially one or more images containing things like album art, artist photos, and so forth. Example In this example, metadata is submitted to the mediaSession object. Note that the code begins by ensuring that the navigator.mediaSession property is available before attempting to use it. if ("mediaSession" in navigator){ navigator.mediaSession.metadata = new MediaMetadata({ t...
Navigator.msLaunchUri() - Web APIs
entifier (URI) contains the protocol for the default service or app, such as mailto://test@contoso.com. This proprietary method is specific to Internet Explorer, and Microsoft Edge versions 18 and lower. Syntax navigator.msLaunchUri(uri, successCallback, noHandlerCallback); Parameters uri A DOMString specifying the URL containing including the protocol of the document or resource to be dis
played. successCallbackOptional A function matching the signature of MSLaunchUriCallback to be executed if the protocol handler is present. noHandlerCallbackOptional A function matching MSLaunchUriCallback to be executed if the protocol handler is not present. Return value undefined. Usage notes If a default protocol handler is available on the system that matches the URI, the successCall...
msSaveBlob - Web APIs
sSaveBlob() method saves the File or Blob to disk. This method behaves in the same way as Navigator.msSaveOrOpenBlob() except that this disables the file open option. Syntax navigator.msSaveBlob(blob, defaultName); Parameters blob A blob to be saved. defaultName The file name to be used when saving file. Return value True is returned as long as the download notification bar is dis
played, or false if a failure occured. Notes When a site calls this method, the behavior is the same as when Windows Internet Explorer downloads a file with the following in the header, where X-Download-Options removes the file open button from the browser file download dialog: Content-Length: <blob.size> Content-Type: <blob.type> Content-Disposition: attachment;filename=<defaultName> X-Download-Opti...
msSaveOrOpenBlob - Web APIs
OrOpenBlob() method saves the File or Blob to disk. This method behaves in the same way as Navigator.msSaveBlob() except that this enables the file open option. Syntax navigator.msSaveOrOpenBlob(blob, defaultName); Parameters blob A blob to be saved. defaultName The file name to be used when saving file. Return value True is returned as long as the download notification bar is dis
played, or false if a failure occurred. Notes When a site calls this method, the behavior is the same as when Windows Internet Explorer downloads a file with the following in the header: Content-Length: <blob.size> Content-Type: <blob.type> Content-Disposition: attachment;filename=<defaultName> Specifications Not part of any specifications. ...
Navigator.registerProtocolHandler() - Web APIs
example, you can register to handle SMS text message links by passing the "sms" scheme. url A string containing the URL of the handler. This URL must include %s, as a placeholder that will be replaced with the escaped URL to be handled. Note: The handler URL must us the https scheme. Older browsers also supported http. title A human-readable title string for the handler. This will be dis
played to the user, such as prompting "Allow this site to handle [scheme] links?" or listing registered handlers in the browser's settings. Note: The title has been removed from the spec due to spoofing concerns, but all current browsers still require it. It is recommended to always set the title, since browsers that support the updated spec most likely will be backwards-compatible and still accept the...
Node.baseURI - Web APIs
L and the xml:base attribute in XML. Syntax var nodeBaseURI = node.baseURI; Value A DOMString representing the base URL of the specified Node. It may be null if unable to obtain an absolute URI. Although this property is read-only, its value may change in certain situations (see below). Details The base URL of a document The base URL of a document defaults to the document's address (as dis
played by the browser and available in window.location), but it can be changed: When an HTML <base> tag is found in the document When the document is new (created dynamically) See the Base URLs section of the HTML Living standard for details. You can use document.baseURI to obtain the base URL of a document. Note that obtaining the base URL for a document may return different URLs over time if th...
Notification.Notification() - Web APIs
otification's language, as specified using a DOMString representing a BCP 47 language tag. See the Sitepoint ISO 2 letter language codes page for a simple reference. badge: A USVString containing the URL of the image used to represent the notification when there isn't enough space to display the notification itself. body: A DOMString representing the body text of the notification, which is dis
played below the title. tag: A DOMString representing an identifying tag for the notification. icon: A USVString containing the URL of an icon to be dis
played in the notification. image: a USVString containing the URL of an image to be dis
played in the notification. data: Arbitrary data that you want associated with the notification. This can be of any data type. vibrate: A vibration pattern f...
Notification.close() - Web APIs
Note: This API shouldn't be used just to have the notification removed from the screen after a fixed delay since this method will also remove the notification from any notification tray, preventing users from interacting with it after it was initially shown. A valid use for this API would be to remove a notification that is no longer relevant (e.g. ...
Notification.icon - Web APIs
Syntax var icon = Notification.icon; Value A USVString. Examples In our To-do list app (view the app running live), we use the Notification() constructor to fire a notification, passing it arguments to specify the body, icon and title we want. ...
Notification.onclick - Web APIs
Syntax Notification.onclick = function(event) { ... }; The default behavior is to move the focus to the viewport of the notification's related browsing context. If you don't want that behaviour, call preventDefault() on the event object. ...
Notification.onerror - Web APIs
Note: This feature is available in Web Workers. The onerror property of the Notification interface specifies an event listener to receive error events. These events occur when something goes wrong with a Notification (in many cases an error preventing the notification from being dis
played.) Syntax Notification.onerror = function() { ... }; Specifications Specification Status Comment Notifications APIThe definition of 'onerror' in that specification. Living Standard Initial specification. ...
Notification.onshow - Web APIs
Note: This feature is available in Web Workers. The onshow property of the Notification interface specifies an event listener to receive show events. These events occur when a Notification is dis
played. Syntax Notification.onshow = function() { ... }; ...
NotificationAction - Web APIs
a way to asynchronously show actions to the user in a notification. Properties Instance properties These properties are available only on instances of the Notification object. NotificationAction.action Read only The name of the action, which can be used to identify the clicked action similar to input names. NotificationAction.title Read only The string describing the action that is dis
played to the user. NotificationAction.icon Read only The URL of the image used to represent the notification when there is not enough space to display the notification itself. Example Notifications can fire notificationclick events on the ServiceWorkerGlobalScope. Here a service worker shows a notification with a single "Archive" action, allowing users to perform this common task from the notifi...
Notifications API - Web APIs
The API is designed to be compatible with existing notification systems, across different platforms. Concepts and usage On supported platforms, showing a system notification generally involves two things. ...
OfflineAudioContext.oncomplete - Web APIs
OfflineAudioContext interface is called when the audio processing is terminated, that is when the complete event (of type OfflineAudioCompletionEvent) is raised. Syntax var offlineAudioCtx = new OfflineAudioContext(); offlineAudioCtx.oncomplete = function() { ... } Example When processing is complete, you might want to use the oncomplete handler the prompt the user that the audio can now be
played, and enable the play button. offlineAudioCtx.oncomplete = function() { console.log('Offline audio processing now complete'); showModalDialog('Song processed and ready to play'); playBtn.disabled = false; } Specifications Specification Status Comment Web Audio APIThe definition of 'oncomplete' in that specification. Working Draft ...
OfflineAudioContext.startRendering() - Web APIs
ine audio graph is set up, you need to render it to an AudioBuffer using OfflineAudioContext.startRendering. When the startRendering() promise resolves, rendering has completed and the output AudioBuffer is returned out of the promise. At this point we create another audio context, create an AudioBufferSourceNode inside it, and set its buffer to be equal to the promise AudioBuffer. This is then
played as part of a simple standard audio graph. Note: For a working example, see our offline-audio-context-promise Github repo (see the source code too.) // define online and offline audio context var audioCtx = new AudioContext(); var offlineCtx = new OfflineAudioContext(2,44100*40,44100); source = offlineCtx.createBufferSource(); // use XHR to load an audio track, and // decodeAudioData to dec...
OfflineAudioContext - Web APIs
ine audio graph is set up, you need to render it to an AudioBuffer using OfflineAudioContext.startRendering. When the startRendering() promise resolves, rendering has completed and the output AudioBuffer is returned out of the promise. At this point we create another audio context, create an AudioBufferSourceNode inside it, and set its buffer to be equal to the promise AudioBuffer. This is then
played as part of a simple standard audio graph. Note: For a working example, see our offline-audio-context-promise Github repo (see the source code too.) // define online and offline audio context var audioCtx = new AudioContext(); var offlineCtx = new OfflineAudioContext(2,44100*40,44100); source = offlineCtx.createBufferSource(); // use XHR to load an audio track, and // decodeAudioData to dec...
PannerNode.orientationX - Web APIs
n as (positionX, positionY, positionZ), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationX, orientationY, orientationZ). Depending on the directionality of the sound (as specified using the attributes coneInnerAngle, coneOuterAngle, and coneOuterGain), the orientation of the sound may alter the perceived volume of the sound as it's being
played. If the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. The AudioParam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its AudioParam.value property. Syntax var orientationX = PannerNode.orientationX; PannerNode.orientationX.value = newOrientationX; Va...
PannerNode.orientationY - Web APIs
n as (positionX, positionY, positionZ), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationX, orientationY, orientationZ). Depending on the directionality of the sound (as specified using the attributes coneInnerAngle, coneOuterAngle, and codeOuterGain), the orientation of the sound may alter the perceived volume of the sound as it's being
played. If the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. The AudioParam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its AudioParam.value property. Syntax var orientationY = PannerNode.orientationY; PannerNode.orientationY.value = newOrientationY; Va...
PannerNode.orientationZ - Web APIs
n as (positionX, positionY, positionZ), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationX, orientationY, orientationZ). Depending on the directionality of the sound (as specified using the attributes coneInnerAngle, coneOuterAngle, and codeOuterGain), the orientation of the sound may alter the perceived volume of the sound as it's being
played. If the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. The AudioParam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its AudioParam.value property. Syntax var orientationZ = PannerNode.orientationZ; PannerNode.orientationZ.value = newOrientationZ; Va...
PannerNode.positionX - Web APIs
n as (positionX, positionY, positionZ), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationX, orientationY, orientationZ). Depending on the directionality of the sound (as specified using the attributes coneInnerAngle, coneOuterAngle, and codeOuterGain), the orientation of the sound may alter the perceived volume of the sound as it's being
played. If the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. The AudioParam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its AudioParam.value property. Syntax var positionX = PannerNode.positionX; PannerNode.positionX.value = newPositionX; Value An Audi...
PannerNode.positionY - Web APIs
n as (positionX, positionY, positionZ), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationX, orientationY, orientationZ). Depending on the directionality of the sound (as specified using the attributes coneInnerAngle, coneOuterAngle, and codeOuterGain), the orientation of the sound may alter the perceived volume of the sound as it's being
played. If the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. The AudioParam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its AudioParam.value property. Syntax var positionY = PannerNode.positionY; PannerNode.positionY.value = newPositionY; Value An Audi...
PannerNode.positionZ - Web APIs
n as (positionX, positionY, positionZ), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationX, orientationY, orientationZ). Depending on the directionality of the sound (as specified using the attributes coneInnerAngle, coneOuterAngle, and codeOuterGain), the orientation of the sound may alter the perceived volume of the sound as it's being
played. If the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. The AudioParam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its AudioParam.value property. Syntax var positionZ = PannerNode.positionZ; PannerNode.positionZ.value = newPositionZ; Value An Audi...
PayerErrors.name - Web APIs
ated. The value is a string explaining the problem. If the payer's name validated successfully, the name property is omitted from the PayerErrors object. Syntax payerName = payerErrors.name; Value If this property is present in the PayerErrors object, the payer's name couldn't be successfully validated, and the name property's value is a DOMString explaining the error. This string will be dis
played to the user by the user agent's payment handling user interface. If the payer's name is valid, this property is left out of the PayerErrors object. Example function validatePayment(response) { const correctionPromises let paymentErrors = {}; let payerErrors = {}; // Check payer details if (!validEmail(response.payerEmail)) { payerErrors.email = "Please make sure you enter a val...
PayerErrors.phone - Web APIs
string explaining the problem. If the payer's phone number validated successfully, the phone property is omitted from the PayerErrors object. Syntax payerPhone = payerErrors.phone; Value If this property is present in the PayerErrors object, the payer's phone number couldn't be successfully validated, and the phone property's value is a DOMString explaining the error. This string will be dis
played to the user by the user agent's payment handling user interface as appropriate. If the phone number is valid, this property is omitted from the PayerErrors object. Example function validatePayment(response) { const correctionPromises let paymentErrors = {}; let payerErrors = {}; // Check payer details if (!validEmail(response.payerEmail)) { payerErrors.email = "Please make sure...
PaymentDetailsUpdate.error - Web APIs
Syntax errorString = paymentDetailsUpdate.error; paymentDetailsUpdate.error = errorString; Value A DOMString specifying the string to display to the user if the information specified in the PaymentDetailsUpdate doesn't provide any valid shipping options. This happens if both of the following are true: The PaymentRequest specifies using its requestShipping property that shipping information is required. ...
PaymentItem - Web APIs
he Payment Request API to describe a single line item on a payment request. This might be an item or service being purchased or a tax or other charge. Properties amount Secure context A PaymentCurrencyAmount object describing the monetary value of the item. label Secure context A string specifying a human-readable name or description of the item or service being charged for. This may be dis
played to the user by the user agent, depending on the design of the interface. pending Secure context A Boolean value which is true if the specified amount has not yet been finalized. This can be used to show items such as shipping or tax amounts that depend upon the selection of shipping address, shipping option, or so forth. The user agent may show this information but is not required to do so. S...
Push API - Web APIs
nt schemes for handling this, there is currently no standard mechanism. Firefox allows a limited number (quota) of push messages to be sent to an application, although Push messages that generate notifications are exempt from this limit. The limit is refreshed each time the site is visited. In comparison, Chrome applies no limit, but requires that every push message causes a notification to be dis
played. Note: As of Gecko 44, the allowed quota of push messages per application is not incremented when a new notification fires, when another is still visible, for a period of three seconds. This handles cases where a burst of Push messages is received, and not all generate a visible notification. Note: Chrome versions earlier than 52 require you to set up a project on Google Cloud Messaging to s...
RTCDTMFSender: tonechange event - Web APIs
lable No Interface RTCDTMFToneChangeEvent Event handler property ontonechange To determine what tone started playing, or if a tone stopped playing, check the value of the event's tone property. Examples This example establishes a handler for the tonechange event which updates an element to display the currently playing tone in its content, or, if all tones have
played, the string "<none>". This can be done using addEventListener(): dtmfSender.addEventListener("tonechange", ev => { let tone = ev.tone; if (tone === "") { tone = "<none>"; } document.getElementById("playingTone").innerText = tone; }, false); You can also just set the ontonechange event handler property directly: dtmfSender.ontonechange = function( ev ) { let tone = ev.ton...
RTCDTMFSender - Web APIs
See toneBuffer for details on the format of the tone buffer. Methods RTCDTMFSender.insertDTMF() Given a string describing a set of DTMF codes and, optionally, the duration of and inter-tone gap between the tones, insertDTMF() starts sending the specified tones. Calling insertDTMF() replaces any already-pending tones from the toneBuffer. You can abort s...
RTCDTMFToneChangeEvent.tone - Web APIs
eEvent.tone returns the DTMF character which has just begun to play, or an empty string (""). if all queued tones have finished playing (that is, RTCDTMFSender.toneBuffer is empty). Syntax var tone = dtmfToneChangeEvent.tone; Example This example establishes a handler for the tonechange event which updates an element to display the currently playing tone in its content, or, if all tones have
played, the string "<none>". dtmfSender.ontonechange = function( ev ) { let tone = ev.tone; if (tone === "") { tone = "<none>" } document.getElementById("playingTone").innerText = tone; }; Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCDTMFToneChangeEvent.tone' in that specification. ...
RTCDTMFToneChangeEvent - Web APIs
type of the event (always "tonechange"); the second a dictionary containing the initial state of the properties of the event. Methods Supports the methods defined in Event. There are no additional methods. Examples This snippet is derived loosely from the full, working example you'll find in When a tone finishes playing in Using DTMF with WebRTC. It appends each tone to a display box as it's
played, and, once all tones have been sent, re-enabled a previously-disabled "Send" button, allowing the next DMTF string to be entered. dtmfSender.addEventListener("change", function(event) { if (event.tone !== "") { dialStringBox.innerText += event.tone; } else { sendDTMFButton.disabled = false; } }, false); Specifications Specification Status Comment WebRTC 1.
RTCDataChannel.onmessage - Web APIs
RTCDataChannel.onmessage = function; Value A function which the browser will call to handle the message event. The function receives as its sole input parameter a MessageEvent object describing the event. Example This code snippet creates a peer connection, adds a data channel to it, and starts creating new <p> (paragraph) elements each time a message arrives, with the message's contents dis
played inside it. The new elements are then attached to the end of the document. let pc = new RTCPeerConnection(); let dc = pc.createDataChannel(); dc.onmessage = function(event) { var el = document.createElement("p"); var txtNode = document.createTextNode(event.data); el.appendChild(txtNode); receiveBox.appendChild(el); } Specifications Specification Status Comment ...
RTCError - Web APIs
${errLine} of the SDP: ${errMessage}`; showMyAlertMessage("Data Channel Error", alertMessage); } else { terminateMyConnection(); } }); If the error is an SDP syntax error--indicated by its errorDetail property being sdp-syntax-error--, a message string is constructed to present the error message and the line number within the SDP at which the error occurred. This message is then dis
played using a function called showMyAlertMessage(), which stands in for whatever output mechanism this code might use. Any other error is treated as terminal, causing a terminateMyConnection() function to be called. The above example uses addEventListener() to add the handler for error events. You can also use the RTCDataChannel object's onerror event handler property, like this: dataChannel.onerror...
RTCErrorEvent.error - Web APIs
${errLine} of the SDP: ${errMessage}`; showMyAlertMessage("Data Channel Error", alertMessage); } else { terminateMyConnection(); } }); If the error is an SDP syntax error--indicated by its errorDetail property being sdp-syntax-error--, a message string is constructed to present the error message and the line number within the SDP at which the error occurred. This message is then dis
played using a function called showMyAlertMessage(), which stands in for whatever output mechanism this code might use. Any other error is treated as terminal, causing a terminateMyConnection() function to be called. The above example uses addEventListener() to add the handler for error events. You can also use the RTCDataChannel object's onerror event handler property, like this: dataChannel.onerror...
RTCInboundRtpStreamStats.framesDecoded - Web APIs
ded property of the RTCInboundRtpStreamStats dictionary indicates the total number of frames which have been decoded successfully for this media source. Syntax var framesDecoded = rtcInboundRtpStreamStats.framesDecoded; Value An integer value indicating the total number of video frames which have been decoded for this stream so far. This represents the number of frames that would have been dis
played assuming no frames were skipped. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCInboundRtpStreamStats.framesDecoded' in that specification. Candidate Recommendation Initial definition. ...
RTCRtpContributingSource.audioLevel - Web APIs
audioLevel will be the level value defined in [RFC6465] if the RFC 6465 header extension is present, and otherwise null. Syntax var audioLevel = RTCRtpContributingSource.audioLevel Value A double-precision floating-point number which indicates the volume level of the audio in the most recently received RTP packet from the source described by the RTCRtpContributingSource. ...
RTCRtpContributingSource.timestamp - Web APIs
The read-only timestamp property of the RTCRtpContributingSource interface returns a DOMHighResTimeStamp indicating the most recent time of playout of an RTP packet from the source. Syntax var domHighResTimeStamp = RTCRtpContributingSource.timestamp Value A DOMHighResTimeStamp which indicates the time at which the most recent RTP packet from the corresponding source was
played out. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'timestamp' in that specification. Candidate Recommendation Initial definition. ...
RTCRtpContributingSource - Web APIs
The RTCRtpContributingSource dictionary of the the WebRTC API is used by getContributingSources() to provide information about a given contributing source (CSRC), including the most recent time a packet that the source contributed was
played out. The information provided is based on the last ten seconds of media received. Properties audioLevel Optional A double-precision floating-point value between 0 and 1 specifying the audio level contained in the last RTP packet
played from this source. rtpTimestamp Optional The RTP timestamp of the media
played out at the time indicated by timestamp. This value is a source-generated time value which can be used to help with sequencing and synchronization. source Optional A 32-bit unsigned integer value specifying the CSRC identifier of the contri...
RTCRtpSynchronizationSource.voiceActivityFlag - Web APIs
whether or not the most recent RTP packet on the source includes voice activity. This is only present if the stream is using the voice activity detection feature; see the RTCOfferOptions flag voiceActivityDetection. Syntax var voiceActivity = RTCRtpSynchronizationSource.voiceActivityFlag Value A Boolean value which is true if voice activity is present in the most recently received RTP packet
played by the associated source, or false if voice activity is not present. This property is omitted entirely if voice activity detection is not enabled on the source, or if the RFC 6464 extension header isn't present. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'voiceActivityFlag' in that specification. ...
RTCRtpSynchronizationSource - Web APIs
nformation provided is based on the last ten seconds of media received. While the published specification describes this as an interface, it has since been changed to a dictionary in follow-up drafts. Properties Also implements the properties of RTCRtpContributingSource. voiceActivityFlag Optional A Boolean value indicating whether or not voice activity is included in the last RTP packet
played from the source. If the peer has indicated that it's not supporting voice activity detection, this field is not provided. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpSynchronizationSource' in that specification. Candidate Recommendation Initial definition. ...
Report - Web APIs
ell it to start observing reports using ReportingObserver.observe(); this tells the observer to start collecting reports in its report queue, and runs the callback function specified inside the constructor: observer.observe(); Because of the event handler we set up inside the ReportingObserver() constructor, we can now click the button to display the report details. ...
Screen - Web APIs
browser window. Properties Screen.availTop Specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features. Screen.availLeft Returns the first available pixel available from the left side of the screen. Screen.availHeight Specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features dis
played by the operating system, such as the Taskbar on Windows. Screen.availWidth Returns the amount of horizontal space in pixels available to the window. Screen.colorDepth Returns the color depth of the screen. Screen.height Returns the height of the screen in pixels. Screen.left Returns the distance in pixels from the left side of the main screen to the left side of the current screen. Scr...
Screen Wake Lock API - Web APIs
re's a checkbox which when checked, will automatically reacquire the wake lock if the document's visibility state changes and becomes visible again. Performance considerations Release the screen wake lock when user ends activity that required always-on screen. For example, a ticketing app which uses QR codes to transmit ticket information, might acquire screen wake lock when the QR code is dis
played (so that code is successfully scanned) but release afterwards. A presentation app might hold the lock only while a presentation is active, but not when presentation is being edited. If your app is performing long-running downloads, consider using background fetch. If you app is synchronizing data from a remote server, consider using background sync. Only active documents can acquire screen wak...
ScriptProcessorNode: audioprocess event - Web APIs
lt action None Interface AudioProcessingEvent Event handler property ScriptProcessorNode.onaudioprocess Examples scriptNode.addEventListener('audioprocess', function(audioProcessingEvent) { // The input buffer is a song we loaded earlier var inputBuffer = audioProcessingEvent.inputBuffer; // The output buffer contains the samples that will be modified and
played var outputBuffer = audioProcessingEvent.outputBuffer; // Loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputBuffer.numberOfChannels; channel++) { var inputData = inputBuffer.getChannelData(channel); var outputData = outputBuffer.getChannelData(channel); // Loop through the 4096 samples for (var sample = 0; sample < input...
ScriptProcessorNode.bufferSize - Web APIs
.buffer = myBuffer; }, function(e){"Error with decoding audio data" + e.err}); } request.send(); } // Give the node a function to process audio events scriptNode.onaudioprocess = function(audioProcessingEvent) { // The input buffer is the song we loaded earlier var inputBuffer = audioProcessingEvent.inputBuffer; // The output buffer contains the samples that will be modified and
played var outputBuffer = audioProcessingEvent.outputBuffer; // Loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputBuffer.numberOfChannels; channel++) { var inputData = inputBuffer.getChannelData(channel); var outputData = outputBuffer.getChannelData(channel); // Loop through the 4096 samples for (var sample = 0; sample < input...
ScriptProcessorNode.onaudioprocess - Web APIs
.buffer = myBuffer; }, function(e){"Error with decoding audio data" + e.err}); } request.send(); } // Give the node a function to process audio events scriptNode.onaudioprocess = function(audioProcessingEvent) { // The input buffer is the song we loaded earlier var inputBuffer = audioProcessingEvent.inputBuffer; // The output buffer contains the samples that will be modified and
played var outputBuffer = audioProcessingEvent.outputBuffer; // Loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputBuffer.numberOfChannels; channel++) { var inputData = inputBuffer.getChannelData(channel); var outputData = outputBuffer.getChannelData(channel); // Loop through the 4096 samples for (var sample = 0; sample < input...
ScriptProcessorNode - Web APIs
.buffer = myBuffer; }, function(e){"Error with decoding audio data" + e.err}); } request.send(); } // Give the node a function to process audio events scriptNode.onaudioprocess = function(audioProcessingEvent) { // The input buffer is the song we loaded earlier var inputBuffer = audioProcessingEvent.inputBuffer; // The output buffer contains the samples that will be modified and
played var outputBuffer = audioProcessingEvent.outputBuffer; // Loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputBuffer.numberOfChannels; channel++) { var inputData = inputBuffer.getChannelData(channel); var outputData = outputBuffer.getChannelData(channel); // Loop through the 4096 samples for (var sample = 0; sample < input...
onnotificationclose - Web APIs
Notifications created on the main thread or in workers which aren't service workers using the Notification() constructor will instead receive a close event on the Notification object itself. ...
ServiceWorkerGlobalScope - Web APIs
when incoming messages are received. Controlled pages can use the MessagePort.postMessage() method to send messages to service workers. The service worker can optionally send a response back via the MessagePort exposed in event.data.port, corresponding to the controlled page. Also available via the ServiceWorkerGlobalScope.onmessage property. notificationclick Occurs when a user clicks on a dis
played notification. Also available via the ServiceWorkerGlobalScope.onnotificationclick property. notificationclose Occurs -- when a user closes a dis
played notification. Also available via the ServiceWorkerGlobalScope.onnotificationclose property. push Occurs when a server push notification is received. Also available via the ServiceWorkerGlobalScope.onpush property. pushsubscriptionchange Oc...
Using Service Workers - Web APIs
ts to cache really easily. However, it made many assumptions about what you were trying to do and then broke horribly when your app didn't follow those assumptions exactly. Read Jake Archibald's (unfortunately-titled but well-written) Application Cache is a Douchebag for more details. Note: As of Firefox 44, when AppCache is used to provide offline support for a page a warning message is now dis
played in the console advising developers to use Service workers instead (bug 1204581.) Service workers should finally fix these issues. Service worker syntax is more complex than that of AppCache, but the trade off is that you can use JavaScript to control your AppCache-implied behaviors with a fine degree of granularity, allowing you to handle this problem and many more. Using a Service worker you c...
SourceBuffer.mode - Web APIs
The mode property of the SourceBuffer interface controls whether media segments can be appended to the SourceBuffer in any order, or in a strict sequence. The two available values are: segments: The media segment timestamps determine the order in which the segments are
played. The segments can be appended to the SourceBuffer in any order. sequence: The order in which the segments are appended to the SourceBuffer determines the order in which they are
played. 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(). If timestamps already exist for the media segments, then the value will be set to segments; if they don't, then the value will be set ...
TextTrack.mode - Web APIs
he track's presence is exposed in the DOM, the user agent is otherwise ignoring it. No cues are active, no events are being fired, and the user agent won't attempt to obtain the track's cues. This is the default value, unless the text track has the default Boolean attribute is specified, in which case the default is showing. hidden The text track is currently active but the cues aren't being dis
played. If the user agent hasn't tried to obtain the track's cues yet, it will do so soon (thereby populating the track's TextTrack.cues property). The user agent is keeping a list of the active cues (in the track's activeCues property) and events are being fired at the corresponding times, even though the text isn't being dis
played. showing The text track is currently enabled and is visible. If the t...
TextTrack - Web APIs
ons)--describes and controls the text track associated with a particular <track> element. Properties This interface also inherits properties from EventTarget. TextTrack.activeCues Read only A TextTrackCueList object listing the currently active set of text track cues. Track cues are active if the current playback position of the media is between the cues' start and end times. Thus, for dis
played cues such as captions or subtitles, the active cues are currently being dis
played. TextTrack.cues Read only A TextTrackCueList which contains all of the track's cues. TextTrack.id Read only A DOMString which identifies the track, if it has one. If it doesn't have an ID, then this value is an empty string (""). If the TextTrack is associated with a <track> element, then the track's ID matche...
VTTCue() - Web APIs
startTime, the value of endTime would be 65.5. text A DOMString providing the text that will be shown during the time span indicated by startTime and endTime. Return value A new VTTCue object representing a cue which will be presented during the time span given. Example // Create a cue that is shown from 2 to 3 seconds and uses the given text. var cue = new VTTCue(2, 3, 'Cool text to be dis
played'); Specifications Specification Status Comment WebVTT: The Web Video Text Tracks FormatThe definition of 'VTTCue()' in that specification. Candidate Recommendation ...
VTTRegion - Web APIs
ewport anchor Y offset, as a percentage of the video. VTTRegion.scroll An enum representing how adding new cues will move existing cues. Examples var region = new VTTRegion(); region.width = 50; // Use 50% of the video width region.lines = 4; // Use 4 lines of height. region.viewportAnchorX = 25; // Have the region start at 25% from the left. var cue = new VTTCue(2, 3, 'Cool text to be dis
played'); cue.region = region; // This cue will be drawn only within this region. Specifications Specification Status Comment WebVTT: The Web Video Text Tracks Format Candidate Recommendation ...
VideoPlaybackQuality.droppedVideoFrames - Web APIs
Syntax value = videoPlaybackQuality.droppedVideoFrames; Value An unsigned 64-bit value indicating the number of frames that have been dropped since the last time the media in the <video> element was loaded or reloaded. This information can be used to determine whether or not to downgrade the video stream to avoid dropping frames. ...
WebGLRenderingContext.makeXRCompatible() - Web APIs
If necessary, the WebGL layer may reconfigure the context to be ready to render to a different device than it originally was. This is useful if you have an application which can start out being presented on a standard 2D display but can then be transitioned to a 3D immersion system. Syntax let makeCompatPromise = webGLRenderingContext.makeXRCompatible(); Parameters None. ...
Boilerplate 1 - Web APIs
em from now on. This would allow us to focus on the interesting pieces of code that are most relevant for learning WebGL. Specifically, the HTML has a <p> element that contains some descriptive text about the page and may also hold error messages; a <canvas> element; and optionally a <button>. The CSS contains rules for body, canvas, and button. Any additional non-trivial CSS and HTML will be dis
played on the pages of specific examples. In following examples, we will use a JavaScript helper function, getRenderingContext(), to initialize the WebGL rendering context. By now, you should be able to understand what the function does. Basically, it gets the WebGL rendering context from the canvas element, initializes the drawing buffer, clears it black, and returns the initialized context. In case o...
Clearing with colors - Web APIs
s how input (in this case, a clear command) translates into output (in this case, all pixels are set to green). Finally, we note that color in WebGL is usually in RGBA format, that is four numerical components for red, green, blue and alpha (opacity). Therefore, clearColor() takes four arguments. <p>A very simple WebGL program that shows some color.</p> <!-- Text within a canvas element is dis
played only if canvas is not supported. --> <canvas>Your browser does not seem to support HTML5 canvas.</canvas> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } // Run everything inside window load event handler, to make sure // DOM is fully loaded and styled before t...
Detect WebGL - Web APIs
o manipulate it. window.addEventListener("load", function() { var paragraph = document.querySelector("p"), button = document.querySelector("button"); // Adding click event handler to button. button.addEventListener("click", detectWebGLContext, false); function detectWebGLContext () { // Create canvas element. The canvas is not added to the // document itself, so it is never dis
played in the // browser window. var canvas = document.createElement("canvas"); // Get WebGLRenderingContext from canvas element. var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); // Report the result. if (gl && gl instanceof WebGLRenderingContext) { paragraph.innerHTML = "Congratulations! Your browser supports WebGL."; } else...
Raining rectangles - Web APIs
<< PreviousNext >> A simple WebGL game that demonstrates clearing with solid colors, scissoring, animation, and user interaction. Animation and user interaction with scissoring This is a simple game. The objective: try to catch as many of the raining rectangles as you can by clicking on them. In this example, we use an object-oriented approach for the dis
played rectangles, which helps to keep the state of the rectangle (its position, color, and so on) organized in one place, and the overall code more compact and reusable. This example combines clearing the drawing buffer with solid colors and scissoring operations. It is a preview of a full graphical application that manipulates various phases of the WebGL graphics pipeline and state machine. In addition, the example demonstra...
WebGL by example - Web APIs
lor. Clearing by clicking How to combine user interaction with graphics operations. Clearing the rendering context with a random color when the user clicks. Simple color animation A very basic color animation, done by clearing the WebGL drawing buffer with a different random color every second. Color masking Modifying random colors by applying color masking and thus limiting the range of dis
played colors to specific shades. Basic scissoring How to draw simple rectangles and squares with scissoring operations. Canvas size and WebGL The example explores the effect of setting (or not setting) the canvas size to its element size in CSS pixels, as it appears in the browser window. Boilerplate 1 The example describes repeated pieces of code that will be hidden from now on, as well as defin...
Taking still photos with WebRTC - Web APIs
), and fill the entire canvas with that color by calling fillRect(). Last in this function, we convert the canvas into a PNG image and call photo.setAttribute() to make our captured still box display the image. Capturing a frame from the stream There's one last function to define, and it's the point to the entire exercise: the takepicture() function, whose job it is to capture the currently dis
played video frame, convert it into a PNG file, and display it in the captured frame box. The code looks like this: function takepicture() { var context = canvas.getContext('2d'); if (width && height) { canvas.width = width; canvas.height = height; context.drawImage(video, 0, 0, width, height); var data = canvas.toDataURL('image/png'); photo.setAttribute('src', ...
WebRTC API - Web APIs
ction's data channels are sent and received. Dictionaries RTCConfiguration Used to provide configuration options for an RTCPeerConnection. RTCIceServer Defines how to connect to a single ICE server (such as a STUN or TURN server). RTCRtpContributingSource Contains information about a given contributing source (CSRC) including the most recent time a packet that the source contributed was
played out. Events bufferedamountlow The amount of data currently buffered by the data channel--as indicated by its bufferedAmount property--has decreased to be at or below the channel's minimum buffered data size, as specified by bufferedAmountLowThreshold. close The data channel has completed the closing process and is now in the closed state. Its underlying data transport is completely closed...
Writing WebSocket servers - Web APIs
see. However, be warned that non-browser agents can send a faked Origin. Most applications reject requests without this header. If any header is not understood or has an incorrect value, the server should send a 400 ("Bad Request")} response and immediately close the socket. As usual, it may also give the reason why the handshake failed in the HTTP response body, but the message may never be dis
played (browsers do not display it). If the server doesn't understand that version of WebSockets, it should send a Sec-WebSocket-Version header back that contains the version(s) it does understand. In the example above, it indicates version 13 of the WebSocket protocol. The most interesting header here is Sec-WebSocket-Key. Let's look at that next. Note: Regular HTTP status codes can be used only be...
Fundamentals of WebXR - Web APIs
not displaying anything is essentially identical to wearing regular eyeglasses. When objects are drawn, they are drawn onto the goggles' lenses, either partially or completely blocking the physical environment from being seen through the obscured portion of the lens. CAVEs A Cave Automated Virtual Environment (CAVE) is an immersive VR environment in which the scene is projected or otherwise dis
played on the walls (as well as possibly the ceiling and/or floor), thus completely surrounding the user with the simulation and allowing them to be immersed in the scene. The user wears 3D glasses that both add the 3D effect to the projected image, but provide a means for the system to render foreground objects into the world. The user's activity may be monitored using motion sensors that are worn or ...
Movement, orientation, and motion: A WebXR example - Web APIs
or (let x=0; x<rowLength; x++) { outHTML += `<mtd><mn>${mat[(x*rowLength) + y].toFixed(2)}</mn></mtd>\n`; } outHTML += "</mtr>\n"; } outHTML += "</mtable>\n<mo>]</mo>\n</mrow>\n</math>"; } target.innerHTML = outHTML; } This replaces the contents of the element specified by target with a newly-created <math> element which contains the 4x4 matrix. Each entry is dis
played with up to two decimal places. Everything else The rest of the code is identical to that found in the earlier examples: initShaderProgram() Initializes the GLSL shader program, calling loadShader() to load and compile each shader's program, then attaching each one to the WebGL context. Once they're compiled, the program is linked and returned to the caller. loadShader() Creates a shader o...
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
-handed to be used for every single object in a scene, it can be very useful for a few specific objects to have their own coordinate system in this manner. The world space; the origin of this space is the origin of the WebGL coordinate system underlying the entire 3D canvas. The player, avatar, or camera; the origin of this space is used as the camera position for rendering the scene to be dis
played to the user. The hand and/or hand controller; each of these represents one of the user's hands, either in the form of the hand itself or a controller (or both). The origin is generally the center of the user's fisted hand. The target ray; each controller or other handheld device may have a targeting ray associated with it, which is represented by a space whose origin is at the point on the cont...
Starting up and shutting down a WebXR session - Web APIs
ant session maintenance events Over the course of your WebXR session, you may receive any of a number of events which indicate changes to the state of the session, or which let you know about things you need to do to keep the session operating properly. Detecting changes to session's visibility state When the state of the XRSession's visibility changes--such as when the session is hidden or dis
played, or when the user has focused another context--the session receives an eventvisibilitychange event. session.onvisibilitychange = (event) => { switch(event.session.visibilityState) { case "hidden": myFrameRate = 10; break; case "blurred-visible": myFrameRate = 30; break; case "visible": default: myFrameRate = 60; break; } }; This example ch...
Using the Web Animations API - Web APIs
icle are available by default in Firefox 48+ and Chrome 36+. Safari supports Web Animations in its Technology Preview version and there is also a handy polyfill that tests for feature support and adds it where necessary. Writing CSS Animations with the Web Animations API One of the more familiar ways to approach learning the Web Animations API is to start with something most web developers have
played with before: CSS Animations. CSS Animations have a familiar syntax that breaks down nicely for demonstration purposes. The CSS version Here's a tumbling animation written in CSS showing Alice falling down the rabbit hole that leads to Wonderland (see the full code on Codepen): Notice that the background moves, Alice spins, and her color changes at an offset from her spinning. We're going to ...
Web Animations API - Web APIs
on on the concepts behind the API and how to use it, read Using the Web Animations API. Web Animations interfaces Animation Provides playback controls and a timeline for an animation node or source. Can take an object created with the KeyframeEffect() constructor. KeyframeEffect Describes sets of animatable properties and values, called keyframes and their timing options. These can then be
played using the Animation() constructor. AnimationTimeline Represents the timeline of animation. This interface exists to define timeline features (inherited by DocumentTimeline and future timeline objects) and is not itself accessed by developers. AnimationEvent Actually part of CSS Animations. DocumentTimeline Represents animation timelines, including the default document timeline (accessed usi...
Visualizations with Web Audio API - Web APIs
is so that each bar in the graph is big enough to actually look like a bar rather than a thin strand. analyser.fftSize = 256; var bufferLength = analyser.frequencyBinCount; console.log(bufferLength); var dataArray = new Uint8Array(bufferLength); canvasCtx.clearRect(0, 0, WIDTH, HEIGHT); Next, we start our draw() function off, again setting up a loop with requestAnimationFrame() so that the dis
played data keeps updating, and clearing the display with each animation frame. function draw() { drawVisual = requestAnimationFrame(draw); analyser.getByteFrequencyData(dataArray); canvasCtx.fillStyle = 'rgb(0, 0, 0)'; canvasCtx.fillRect(0, 0, WIDTH, HEIGHT); Now we set our barWidth to be equal to the canvas width divided by the number of bars (the buffer length). Howeve...
Web Audio API - Web APIs
face represents a delay-line; an AudioNode audio-processing module that causes a delay between the arrival of an input data and its propagation to the output. DynamicsCompressorNode The DynamicsCompressorNode interface provides a compression effect, which lowers the volume of the loudest parts of the signal in order to help prevent clipping and distortion that can occur when multiple sounds are
played and multiplexed together at once. GainNode The GainNode interface represents a change in volume. It is an AudioNode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. WaveShaperNode The WaveShaperNode interface represents a non-linear distorter. It is an AudioNode that use a curve to apply a waveshaping distortion to the sign...
Using the Web Speech API - Web APIs
e speech was paused at. utterThis.onpause = function(event) { var char = event.utterance.text.charAt(event.charIndex); console.log('Speech paused at character ' + event.charIndex + ' of "' + event.utterance.text + '", which is "' + char + '".'); } Finally, we call blur() on the text input. This is mainly to hide the keyboard on Firefox OS. inputTxt.blur(); } Updating the dis
played pitch and rate values The last part of the code simply updates the pitch/rate values dis
played in the UI, each time the slider positions are moved. pitch.onchange = function() { pitchValue.textContent = pitch.value; } rate.onchange = function() { rateValue.textContent = rate.value; } ...
Using the Web Storage API - Web APIs
ment.getElementById('bgcolor').value = currentColor; document.getElementById('font').value = currentFont; document.getElementById('image').value = currentImage; htmlElem.style.backgroundColor = '#' + currentColor; pElem.style.fontFamily = currentFont; imgElem.setAttribute('src', currentImage); } Here, the first three lines grab the values from local storage. Next, we set the values dis
played in the form elements to those values, so that they keep in sync when you reload the page. Finally, we update the styles/decorative image on the page, so your customization options come up again on reload. Setting values in storage Storage.setItem() is used both to create new data items, and (if the data item already exists) update existing values. This takes two arguments -- the key of the data...
Using Web Workers - Web APIs
ll. Dedicated workers As mentioned above, a dedicated worker is only accessible by the script that called it. In this section we'll discuss the JavaScript found in our Basic dedicated worker example (run dedicated worker): This allows you to enter two numbers to be multiplied together. The numbers are sent to a dedicated worker, multiplied together, and the result is returned to the page and dis
played. This example is rather trivial, but we decided to keep it simple while introducing you to basic worker concepts. More advanced details are covered later on in the article. Worker feature detection For slightly more controlled error handling and backwards compatibility, it is a good idea to wrap your worker accessing code in the following (main.js): if (window.Worker) { ... } Spawning a ...
Window.alert() - Web APIs
The Window.alert() method displays an alert dialog with the optional specified content and an OK button. Syntax window.alert(message); Parameters message Optional A string you want to display in the alert dialog, or, alternatively, an object that is converted into a string and dis
played. Example window.alert("Hello world!"); alert("Hello world!"); Both produce: Notes The alert dialog should be used for messages which do not require any response on the part of the user, other than the acknowledgement of the message. The following text is shared between this article, DOM:window.prompt and DOM:window.confirm Dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed. For this reason, you should not overus...
Window.defaultStatus - Web APIs
(Firefox 23 / Thunderbird 23 / SeaMonkey 2.20)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Summary Gets/sets the status bar text for the given window. Syntax var sMsg = window.defaultStatus; window.defaultStatus = sMsg; Parameters sMsg is a string containing the text to be dis
played by default in the statusbar. Example <html> <body onload="window.defaultStatus='hello!';"/> <button onclick="window.confirm('Are you sure you want to quit?');">confirm</button> </body> </html> Notes To set the status once the window has been opened, use window.status. Specification HTML5 ...
Window.fullScreen - Web APIs
Syntax isInFullScreen = windowRef.fullScreen; With chrome privileges, the property is read-write, otherwise it is read-only. Bear in mind that if you try to set this property without chrome privileges, it will not throw an exception and instead just silently fail. This is to prevent scripts designed to set this property in Internet Explorer from breaking. Return value isInFullScreen A boolean. Possible Values: true: The window is in full screen mode. false: The window is not in full screen mode. ...
Window.getSelection() - Web APIs
indow.getSelection() method returns a Selection object representing the range of text selected by the user or the current position of the caret. Syntax selection = window.getSelection(); Return value A Selection object. When cast to string, either by appending an empty string ("") or using Selection.toString(), this object returns the text selected. When called on an <iframe> that is not dis
played (eg. where display: none is set) Firefox will return null, whereas other browsers will return a Selection object with Selection.type set to None. Examples function foo() { var selObj = window.getSelection(); alert(selObj); var selRange = selObj.getRangeAt(0); // do stuff with the range } Notes String representation of the Selection object In JavaScript, when an object is pass...
Window.outerHeight - Web APIs
The Window.outerHeight read-only property returns the height in pixels of the whole browser window, including any sidebar, window chrome, and window-resizing borders/handles. Notes To change the size of a window, see window.resizeBy() and window.resizeTo(). To get the inner height of a window, i.e. the height of the page being dis
played, see window.innerHeight. Graphical example The following figure shows the difference between outerHeight and innerHeight. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.outerHeight' in that specification. Working Draft ...
Window.outerWidth - Web APIs
Window.outerWidth read-only property returns the width of the outside of the browser window. It represents the width of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles. Notes To change the size of a window, see window.resizeBy() and window.resizeTo(). To get the inner width of a window, i.e. the width of the page being dis
played, see window.innerWidth. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.outerWidth' in that specification. Working Draft Initial definition. ...
Window: popstate event - Web APIs
unction that does the processing at the end of the browser event loop: window.onpopstate = () => setTimeout(doSomeThing, 0); When popstate is sent When the transition occurs, either due to the user triggering the browser's "Back" button or otherwise, the popstate event is near the end of the process to transition to the new location. It happens after the new location has loaded (if needed), dis
played, made visible, and so on, after the pageshow event is sent, but before the persisted user state information is restored and the hashchange event is sent. To better understand when the popstate event is fired, consider this simplified sequence of events that occurs when the current history entry changes due to either the user navigating the site or the history being traversed programmatically. He...
Window.prompt() - Web APIs
The Window.prompt() displays a dialog with an optional message prompting the user to input some text. Syntax result = window.prompt(message, default); Parameters message Optional A string of text to display to the user. Can be omitted if there is nothing to show in the prompt window. default Optional A string containing the default value dis
played in the text input field. Note that in Internet Explorer 7 and 8, if you do not provide this parameter, the string "undefined" is the default value. Return value A string containing the text entered by the user, or null. Example let sign = prompt("What's your sign?"); if (sign.toLowerCase() == "scorpio") { alert("Wow! I'm a Scorpio too!"); } // there are many ways to use the prompt feature sign = window.prompt(); // open the blank pr...
Window.showModalDialog() - Web APIs
Syntax returnVal = window.showModalDialog(uri[, arguments][, options]); returnVal holds the returnValue property as set by the document specified by uri. uri is the URL of the document to display in the dialog. ...
Window.status - Web APIs
The status property of the Window interface was originally intended to set the text in the status bar at the bottom of the browser window. However, the HTML standard now requires setting window.status to have no effect on the text dis
played in the status bar. Syntax window.status = string; var value = window.status; Specifications Specification Status Comment HTML Living StandardThe definition of 'window.status' in that specification. Living Standard ...
Window - Web APIs
is currently being handled. The Event object passed directly to event handlers should be used instead whenever possible. Window.frameElement Read only Returns the element in which the window is embedded, or null if the window is not embedded. Window.frames Read only Returns an array of the subframes in the current window. Window.fullScreen This property indicates whether the window is dis
played in full screen or not. Window.history Read only Returns a reference to the history object. Window.innerHeight Read only Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar. Window.innerWidth Read only Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar. Window.isSecureContext Rea...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
es a timeout value of 15 minutes for background tabs since bug 736602 in Firefox 14, and background tabs can also be unloaded entirely. Firefox 50 no longer throttles background tabs if a Web Audio API AudioContext is actively playing sound. Firefox 51 further amends this such that background tabs are no longer throttled if an AudioContext is present in the tab at all, even if no sound is being
played. These resolve a number of issues with apps which play note-based music not being able to time or synchronize the music properly when the tab is in the background. Throttling of tracking timeout scripts Since Firefox 55, tracking scripts (e.g. Google Analytics, any script URL that Firefox recognises as a tracking script through its TP lists) have been subject to further throttling. When runnin...
Synchronous and asynchronous requests - Web APIs
ts third parameter to indicate that the request should be handled asynchronously. Line 3 creates an event handler function object and assigns it to the request's onload attribute. This handler looks at the request's readyState to see if the transaction is complete in line 4; if it is, and the HTTP status is 200, the handler dumps the received content. If an error occurred, an error message is dis
played. Line 15 actually initiates the request. The callback routine is called whenever the state of the request changes. Example: writing a function to read an external file In some cases, you must read many external files. This is a standard function which uses the XMLHttpRequest object asynchronously in order to switch the content of the read file to a specified listener. function xhrSuccess() { ...
XRPermissionDescriptor.mode - Web APIs
content will be blended 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 dis
played using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected 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...
XRSession.requestAnimationFrame() - Web APIs
ain the poses of the viewer and the scene itself, as well as other information needed to render a frame of an AR or VR scene. Return value An integer value which serves as a unique, non-zero ID or handle you may pass to cancelAnimationFrame() if you need to remove the pending animation frame request. Example The following example requests XRSession with "inline" mode so that it can be dis
played in an HTML element (without the need for a separate AR or VR device). Note: A real application should check that the device and the User Agent support WebXR API at all and then that they both support the desired session type via XR.isSessionSupported(). // Obtain XR object const XR = navigator.xr // Request a new XRSession XR.requestSession("inline").then((xrSession) => { xrSession.request...
XRSession: visibilitychange event - Web APIs
You can also create the event handler by assigning it to the XRSession's onvisibilitychange event handler property, like this: xrSession.onvisibilitychange = (e) => { /* event handled here */ }; Specifications Specification Status Comment WebXR Device APIThe definition of 'visibilitychange event' in that specification. Working Draft Initial def...
XRSession - Web APIs
a haptic glove. Also available through the onsqueezestart event handler property. visibilitychange An XRSessionEvent which is sent to the session when its visibility state as indicated by the visibilityState changes. Also available through the onvisibilitychange event handler property. Example This example establishes a new XRSession in inline mode so that it can be dis
played within an HTML element, avoiding the need for a dedicated AR or VR viewing device such as a headset. const XR = navigator.xr; if (XR) { XR.requestSession("inline").then((xrSession) => { xrSession.requestReferenceSpace("local").then((xrReferenceSpace) => { xrSession.requestAnimationFrame((time, xrFrame) => { let viewer = xrFrame.getViewerPose(xrReferenceSpace); gl.bi...
XRSessionMode - Web APIs
content will be blended 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 dis
played using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected 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...
XRSystem: requestSession() - Web APIs
content will be blended 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 dis
played using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected 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...
XRViewerPose - Web APIs
rited from XRPose, XRViewerPose includes the following: views Read only An array of XRView objects, one for each viewpoint on the scene which is needed to represent the scene to the user. A typical headset provides a viewer pose with two views whose eye property is either left or right, indicating which eye that view represents. Taken together, these views can reproduce the 3D effect when dis
played on the XR device. Usage notes The XRViewerPose object is used to describe the state of a viewer of a WebXR scene as it's tracked by the user's XR hardware. The viewer may be the virtual representation of the user, or it may represent another device or interface which may serve as the source of a position and orientation that make up a view upon the scene. For example, every player in a MMORPG ...
ARIA: figure role - Accessibility
tive label for assistive technology users, you can use the aria-label attribute on the figure container: <div role="figure" aria-label="Text that describes the figure."> ... </div> You can use the aria-label with <figure> as well: <figure aria-label="Text that describes the figure."> ... </figure> Generally, you should reference the figure from the main text, but the figure need not be dis
played at the same location as the referencing element. Note: If at all possible in your work, you should use the appropriate semantic HTML elements to mark up a figure and its caption -- <figure> and <figcaption>. See Best practices for a full example. Associated WAI-ARIA roles, states, and properties aria-describedby The id of an element containing reference text serving as a caption. aria-...
ARIA: row role - Accessibility
mitted: aria-selected="true: Row is currently selected aria-selected="false": Row is not currently selected. aria-selected="undefined" or the attribute is missing: The row is not selectable. aria-colindex attribute The aria-colindex attribute is only needed if columns are hidden from the DOM. It is generally placed on row children, rather than on the row itself. If the columns dis
played are contiguous, then it can be placed on the row. The attribute takes as its value an integer between 1 and the total number of columns within the table, grid or treegrid. When placed on the row, the aria-colindex defines an element's column index or position with respect to the total number of columns within a row. For example, in a table with 15 columns, and columns 4, 5, and 6 are in the ...
Accessibility Information for Web Authors - Accessibility
fy errors in webpage related to Section 508 standards and/or the WCAG guidelines. It can perform a "Complete Webpage Quality Check" for accessibility, privacy, searchability, metadata and even alt text attribute quality. The web author chooses the guidelines (as a basis for errors and warnings) to be used by "Cynthia says(TM)": Section 508, WCAG Priorities 1, 2 and 3. The output data report is dis
played in a clear and well structured table where each and all checkpoints are identified and described (along with an helpful clickable link to the related reference guideline) into logical groups and according to measurable results: passed, warning, failed for automated verification, warning for manual verification, not selected, not available, not related, etc. Accessibility Valet from WebThing ...
Web accessibility for seizures and physical reactions - Accessibility
mprove legibility." User Preference Media Features (Planned in Media Queries Level 5) User Preference Media Features in W3C Editor's Draft Media Queries Level 5 are especially promising in providing user control over media. Here are some highlights: inverted-colors According to the section, User Preference Media Features , "The inverted-colors media feature indicates whether the content is dis
played normally, or whether colors have been inverted." forced-colors In forced-colors-mode, the user agent enforces the user's preferred color palette on the page, overriding the author's chosen colors. From W3C's Draft document, Media Queries Level 5 section on forced-colors: "The forced-colors media feature is used to detect if the user agent has enabled a forced colors mode where it enforces a us...
-webkit-mask-repeat-x - CSS: Cascading Style Sheets
s */ -webkit-mask-repeat-x: repeat, no-repeat, space; /* Global values */ -webkit-mask-repeat-x: inherit; -webkit-mask-repeat-x: initial; -webkit-mask-repeat-x: unset; Syntax Values repeat The mask image is repeated both horizontally and vertically. no-repeat The mask image is not repeated; only one copy of the mask image is drawn. The remainder of the masked element's content is not dis
played. repeat The mask image is repeated both horizontally and vertically. space The image is repeated as much as possible without clipping. The first and last images are pinned to either side of the element, and whitespace is distributed evenly between the images. The mask-position property is ignored unless only one image can be dis
played without clipping. The only case where clipping happens usi...
-webkit-mask-repeat-y - CSS: Cascading Style Sheets
peat-y: repeat, no-repeat, space; /* Global values */ -webkit-mask-repeat-y: inherit; -webkit-mask-repeat-y: initial; -webkit-mask-repeat-y: unset; Syntax Values repeat The mask image is repeated vertically. no-repeat The mask image is not repeated vertically; only one copy of the mask image is drawn in vertical direction. The vertical remainder of the masked element's content is not dis
played. repeat The mask image is repeated vertically. space The image is repeated as much as possible without clipping. The first and last images are pinned to the top and bottom edge of the element, and whitespace is distributed evenly between the images. The mask-position property is ignored unless only one image can be dis
played without clipping. The only case where clipping happens using space i...
-webkit-touch-callout - CSS: Cascading Style Sheets
get. When a target is touched and held on iOS, Safari displays a callout information about the link. This property allows disabling that behavior. /* Keyword values */ -webkit-touch-callout: default; -webkit-touch-callout: none; /* Global values */ -webkit-touch-callout: initial; -webkit-touch-callout: inherit; -webkit-touch-callout: unset; Syntax Values default The default callout is dis
played. none The callout is disabled. Formal definition Initial valuedefaultApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax default | none Examples Turn off touch callout .example { -webkit-touch-callout: none; } Specifications Not part of any standard. Apple has a description in the Safari CSS Reference. ...
:-moz-handler-blocked - CSS: Cascading Style Sheets
The :-moz-handler-blocked CSS pseudo-class is a Mozilla extension that matches elements that can't be dis
played because their handlers have been blocked. Note: This selector is mainly intended to be used by theme developers. Syntax :-moz-handler-blocked Specifications Not part of any standard. ...
:-moz-handler-crashed - CSS: Cascading Style Sheets
The :-moz-handler-crashed CSS pseudo-class is a Mozilla extension that matches elements that can't be dis
played because the plugin responsible for drawing them has crashed. Note: This selector is mainly intended to be used by theme developers. Syntax :-moz-handler-crashed Specifications Not part of any standard. ...
:-moz-handler-disabled - CSS: Cascading Style Sheets
The :-moz-handler-disabled CSS pseudo-class is a Mozilla extension that matches elements that can't be dis
played because their handlers have been disabled by the user. Note: This selector is mainly intended to be used by theme developers. Syntax :-moz-handler-disabled Specifications Not part of any standard. ...
:-moz-locale-dir(ltr) - CSS: Cascading Style Sheets
This is determined by the preference intl.uidirection.locale (where locale is the current locale) being set to "ltr". Note: This selector is mainly used by extensions and themes to adapt the user interface based on the user's locale. (This can vary from window to window, and even from tab to tab.) It also allows extensions to work even when they don't support the user's default locale, since they can support both left-to-right and right-to-left layouts regardless of locale specifics. ...
:-moz-locale-dir(rtl) - CSS: Cascading Style Sheets
This is determined by the preference intl.uidirection.locale (where locale is the current locale) being set to "rtl". Note: This selector is mainly used by extensions and themes to adapt the user interface based on the user's locale. (This can vary from window to window, and even from tab to tab.) It also allows extensions to work even when they don't support the user's default locale, since they can support both left-to-right and right-to-left layouts regardless of locale specifics. ...
::backdrop - CSS: Cascading Style Sheets
endered immediately beneath any element being presented in full-screen mode. This includes both elements which have been placed in full-screen mode using the Fullscreen API and <dialog> elements. When multiple elements have been placed into full-screen mode, the backdrop is drawn immediately beneath the frontmost such element, and on top of the older full-screen elements. /* Backdrop is only dis
played when dialog is opened with dialog.showModal() */ dialog::backdrop { background: rgba(255,0,0,.25); } All full-screen elements are placed in a last-in/first out (LIFO) stack in the top layer, which is a special layer in the viewport which is always rendered last (and therefore on top) before drawing the viewport's contents to the screen. The ::backdrop pseudo-element makes it possible to obscur...
:placeholder-shown - CSS: Cascading Style Sheets
own. HTML <input placeholder="Type something here!"> CSS input { border: 1px solid black; padding: 3px; } input:placeholder-shown { border-color: teal; color: purple; font-style: italic; } Result Overflowing text When form fields are too small, placeholder text can get cropped in an undesirable way. You can use the text-overflow property to alter the way overflowing text is dis
played. HTML <input id="input1" placeholder="Name, Rank, and Serial Number"> <br><br> <input id="input2" placeholder="Name, Rank, and Serial Number"> CSS #input2:placeholder-shown { text-overflow: ellipsis; } Result Customized input field The following example highlights the Branch and ID code fields with a custom style. HTML <form id="test"> <p> <label for="name">Enter Student Name:<...
font-display - CSS: Cascading Style Sheets
Syntax /* Keyword values */ font-display: auto; font-display: block; font-display: swap; font-display: fallback; font-display: optional; Values auto The font display strategy is defined by the user agent. block Gives the font face a short block period and an infinite swap period. swap Gives the font face an extremely small block period and an infinite swap period. fallback Gives the font face an extremely small block period and a short swap period. optional Gives the font face an extremely small block period and no swap period. ...
font-weight - CSS: Cascading Style Sheets
For a particular font family, authors can download various font faces which correspond to the different styles of the same font family, and then use the font-weight descriptor to explicitly specify the font face's weights. The values for the CSS descriptor is same as that of its corresponding font property. ...
@font-face - CSS: Cascading Style Sheets
a custom font with which to display text; the font can be loaded from either a remote server or a locally-installed font on the user's own computer. Syntax @font-face { font-family: "Open Sans"; src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"), url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); } Descriptors font-display Determines how a font face is dis
played based on whether and when it is downloaded and ready to use. font-family Specifies a name that will be used as the font face value for font properties. font-stretch A font-stretch value. Since Firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is supported by a font-face, for example font-stretch: 50% 200%; font-style A font-style value. Since Fir...
overflow-block - CSS: Cascading Style Sheets
The overflow-block CSS media feature can be used to test how the output device handles content that overflows the initial containing block along the block axis. Syntax The overflow-block feature is specified as a keyword value chosen from the list below. none Content that overflows the block axis is not dis
played. scroll Content that overflows the block axis can be seen by scrolling to it. optional-paged Content that overflows the block axis can be seen by scrolling to it, but page breaks can be manually triggered (such as via break-inside, etc.) to cause the following content to display on the following page. paged Content is broken up into discrete pages; content that overflows one page in the block axis is dis
played on the following page. Examples HTML <p>Lorem ipsum dolor si...
marks - CSS: Cascading Style Sheets
document. Crop marks indicate where the page should be cut. Cross marks are used to align sheets. Crop marks and cross marks are printed outside the page box. To have room to show crop and cross marks, the final pages will have to be somewhat bigger than the page box. Syntax /* Keyword values */ marks: none; marks: crop; marks: cross; marks: crop cross; Values crop Crop marks will be dis
played. cross Cross marks will be dis
played. none No marks will be dis
played. Formal definition Related at-rule@pageInitial valuenoneComputed valueas specified Formal syntax none | [ crop | cross ] Examples Adding crop and cross marks @page { marks: crop cross; } Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of 'mark...
size - CSS: Cascading Style Sheets
ight = width */ size: 6in; /* 2 values: width then height */ size: 4in 6in; /* Keyword values for absolute size */ size: A4; size: B5; size: JIS-B4; size: letter; /* Mixing size and orientation */ size: A4 portrait; Values auto The user agent decides the size of the page. In most cases, the dimensions and orientation of the target sheet are used. landscape The content of the page is dis
played in landscape mode (i.e. the longest side of the box is horizontal). portrait The content of the page is dis
played in portrait mode (i.e. the longest side of the box is vertical). This is the default orientation. <length> Any length value (see <length>). The first value corresponds to the width of the page box and the second one corresponds to its height. If only one value is provided, it is u...
@viewport - CSS: Cascading Style Sheets
upport for @viewport is weak at this time, with support being largely available in Internet Explorer and Edge. Even in those browsers, only a small number of descriptors are available. Browsers will ignore @viewport if they don't support it, and will ignore any descriptors that they don't recognize. min-width Used in the determination of the width of the viewport when the document is first dis
played. max-width Used in the determination of the width of the viewport when the document is first dis
played. width A shorthand descriptor for setting both min-width and max-width. min-height Used in the determination of the height of the viewport when the document is first dis
played. max-height Used in the determination of the height of the viewport when the document is first dis
played. heigh...
Box alignment in grid layout - CSS: Cascading Style Sheets
e used. Therefore, in a horizontal language such as English or Arabic the inline direction runs horizontally. Should you be in a vertical writing mode the inline axis will run vertically. To align things on the inline axis you use the properties that start with justify-, justify-content, justify-items and justify-self. The block axis crosses the inline axis in the direction that blocks are dis
played down the page -- for example paragraphs in English are dis
played one below the other vertically. This, therefore is the block dimension. To align things on the block axis you use the properties that start with align-, align-content, align-items and align-self. Self alignment justify-self align-self place-self justify-items align-items place-items These properties deal with aligning ...
Color picker tool - CSS: Cascading Style Sheets
s tool makes it easy to create, adjust, and experiment with custom colors for the web. It also makes it easy to convert between various color formats supported by CSS, including: HEXA colors, RGB (Red/Green/Blue) and HSL (Hue/Saturation/Lightness). Control over the alpha channel is also supported on RGB (rgba) and HSL (hsla) formats. As you adjust the parameters that define the color, it gets dis
played in all three standard Web CSS formats. In addition, based on the currently-selected color, a palette for HSL and HSV, as well as alpha, is generated. The "eyedropper" style color picker box can be toggled between HSL or HSV format. You can also test colors and how they overlap one another by dragging them into the box at the bottom of the tool and moving them over one another. Adjust their relati...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
ntainer, or multicol container for short. The columns are anonymous boxes and described as column boxes in the specification. Defining columns To create a multicol container you must use at least one of the column-* properties, these being column-count and column-width. The column-count property The column-count property specifies the number of columns that you would like the content to be dis
played as. The browser will then assign the correct amount of space to each column box to create the requested number of columns. In the below example we use the column-count property to create three columns on the .container element. The content, including the children of .container is then split between the three columns. In the above example the content is wrapped in paragraph p tags with default...
Typical use cases of Flexbox - CSS: Cascading Style Sheets
we also often use Flexbox for jobs that might be better done by Grid Layout, as a fallback for Grid, and also in order to get alignment capabilities. This is something that may well change once Box Alignment is implemented in Block Layout. In this guide I look at some of the typical things you might use flexbox for today. Navigation A common pattern for navigation is to have a list of items dis
played as a horizontal bar. This pattern, as basic as it seems, was difficult to achieve before flexbox. It forms the most simple of flexbox examples, and could be considered the ideal flexbox use case. When we have a set of items that we want to display horizontally, we may well end up with additional space. We need to decide what to do with that space, and have a couple of options. We either display ...
In Flow and Out of Flow - CSS: Cascading Style Sheets
In the previous guide I explained block and inline layout in normal flow. All elements that are in flow, will be laid out using this method. In the following example I have a heading, paragraph, a list and a final paragraph which contains a strong element. The heading and paragraphs are block level, the strong element inline. The list is dis
played using flexbox to arrange the items into a row, however it too is participating in block and inline layout - the container has an outside display type of block. All of the elements can be said to be in flow. Appearing on the page in the order that they are in the source. Taking an item out of flow All elements are in-flow apart from: floated items items with position: absolute (including position: fixed which acts in the same way) the root e...
OpenType font features guide - CSS: Cascading Style Sheets
ted (such as '1st' or '3rd'), as is a slashed zero if present in the font. Lining and Oldstyle figures Fractions, ordinals, and slashed zero East Asian (font-variant-east-asian) This allows access to various alternate forms of glyphs within a font. The example below shows a string of glyphs with only the OpenType set 'jis78' enabled. Uncheck the box below and you'll see more characters dis
played. Note: these glyphs were copied out of a font sample and are not intended 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 o...
CSS Fragmentation - CSS: Cascading Style Sheets
Fragmentation occurs when an inline box wraps onto multiple lines. It also occurs when a block spans more than one column inside a column layout container, or spans a page break when printed. Each piece of the rendering for the element is called a fragment. ...
Basic Concepts of grid layout - CSS: Cascading Style Sheets
display: grid; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } All the direct children are now grid items. In a web browser, you won't see any difference to how these items are dis
played before turning them into a grid, as grid has created a single column grid for the items. At this point, you may find it useful to work with the Grid Inspector, available as part of Firefox's Developer Tools. If you view this example in Firefox and inspect the grid, you will see a small icon next to the value grid. Click this and then the grid on this element will be overlaid in the browser window...
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
right hand side of the grid. Setting auto margins, using margin-right or margin-left however, or absolutely positioning items using the top, right, bottom and left offsets would not honor writing modes. In the next guide, we will look further into this interaction between CSS grid layout, box alignment and writing modes. This will be important to understand, if you develop sites that are then dis
played in multiple languages, or if you want to mix languages or writing modes in a design. ...
Grid template areas - CSS: Cascading Style Sheets
ill use grid for main page layout, however grid can be just as useful for small elements as those larger ones. Using grid-template-areas can be especially nice as it is easy to see in the code what your element looks like. As a very simple example we can create a "media object". This is a component with space for an image or other media on one side and content on the other. The image might be dis
played on the right or left of the box. Our grid is a two-column track grid, with the column for the image sized at 1fr and the text 3fr. If you wanted a fixed width image area, then you could set the image column as a pixel width, and assign the text area 1fr. A single column track of 1fr would then take up the rest of the space. We give the image area a grid area name of img and the text area cont...
Consistent list indentation - CSS: Cascading Style Sheets
t dotted red border represents outer edges of the content-area of the list item. Remember that, at this point, the list item has no padding or borders. If we add two more list items, we get a result like that shown in Figure 2. Now we wrap these in a parent element; in this case, we'll wrap them in an unordered list (i.e., <ul>). According to the CSS box model, the list items' boxes must be dis
played within the parent element's content area. Since that parent has no padding or margins yet, we get the situation shown in Figure 3. Here, the dotted blue border shows us the edges of the <ul> element's content area. Since we have no padding for the <ul> element, its content wraps snugly around the three list items. Now we add the list item markers. Since this is an unordered list, we'll add tr...
Using CSS counters - CSS: Cascading Style Sheets
e initialized to a value with the counter-reset property (0 by default). The same property can also be used to change its value to any specific number. Once initialized, a counter's value can be increased or decreased with counter-increment. The counter's name must not be "none", "inherit", or "initial"; otherwise the declaration is ignored. Displaying a counter The value of a counter can be dis
played using either the counter() or counters() function in a content property. The counter() function has two forms: 'counter(name)' or 'counter(name, style)'. The generated text is the value of the innermost counter of the given name in scope at the given pseudo-element.The counter is rendered in the specified style (decimal by default). The counters() function also has two forms: 'counters(name, st...
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
nning vertically and the block dimension horizontally. The grid doesn't look the same however, as the width assigned to the container is a horizontal measure, a measure tied to the physical and not the logical or flow relative running of the text. If instead of the width property we use the logical property inline-size, the component now works the same way no matter which writing mode it is dis
played using. You can try this out in the live example below. Change writing-mode from vertical-rl to horizontal-tb on .grid to see how the different properties change the layout. When working with a site in a writing mode other than a horizontal, top to bottom one, or when using writing modes for creative reasons, being able to relate to the flow of the content makes a lot of sense. Block and in...
Overview of CSS Shapes - CSS: Cascading Style Sheets
or further away from the box. To explore the box values in more detail see our guide covering Shapes From Box Values. Shapes from images An interesting way to generate your path is to use an image with an alpha channel -- the text will then wrap around the non-transparent parts of the image. This allows the overlay of wrapped content around an image, or the use of an image which is never dis
played on the page purely as a method of creating a complex shape without needing to carefully map a polygon. Note that images used in this way must be CORS compatible, otherwise shape-outside will act as if none had been given as the value, and you will get no shape. In this next example, we have an image with a fully transparent area, and we are using an image as the URL value for shape-outside. The...
Shapes From Images - CSS: Cascading Style Sheets
mage-threshold to 0.3 then I see the shape, if I set it to something smaller than 0.2 I do not get the shape. Using images with generated content In the above example I have both used the image as the value of shape-outside and also added it to the page. Many demos do this as it helps to show the shape we are following, however the shape-outside property is not related to the image that is dis
played on the page and so you do not need to display an image to use an image to create a shape. You do need something to float, but that could be some generated content as in the below example. I am floating generated content and using a larger star image to shape my content without displaying any image on the page. Creating shapes using a gradient As a CSS gradient is treated as an image, you can...
Filter Effects - CSS: Cascading Style Sheets
Filter Effects is a module of CSS that defines a way of processing an element's rendering before it is dis
played in the document. Reference Properties backdrop-filter filter Data types <filter-function> Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'filter' in that specification. Working Draft Initial definition. ...
List group with badges - CSS: Cascading Style Sheets
The badge should always be centered vertically whether there is a single line of content, or more than one. Recipe Download this example Choices made Flexbox makes this particular pattern straightforward and also makes it easy to make changes to the layout. To ensure the text and badge line up correctly I use the justify-content property with a value of space-between. This places any extra space between the items. ...
Using media queries - CSS: Cascading Style Sheets
basic syntax remains the same for all types of media queries. Syntax A media query is composed of an optional media type and any number of media feature expressions. Multiple queries can be combined in various ways by using logical operators. Media queries are case-insensitive. A media query computes to true when the media type (if specified) matches the device on which a document is being dis
played and all media feature expressions compute as true. Queries involving unknown media types are always false. Note: A style sheet with a media query attached 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. E...
Viewport concepts - CSS: Cascading Style Sheets
ining pages and each included file has their own unique window object. Only the top-level window has a visual viewport that may be distinct from the layout viewport. For included documents, the visual viewport and layout viewport are the same. CSS The layout viewport and visual viewport described above are not the only viewports you will encounter. Any sub-viewport that is fully or partially dis
played within the layout viewport is considered a visual viewport. We generally think of width and height media queries as being relative to the width and height of the browser window. They are actually relative to the viewport, which is the window in the main document but is the intrinsic size of the element's parent in a nested browsing context like objects, iframes and SVG. In CSS, we also have leng...
Visual formatting model - CSS: Cascading Style Sheets
t In continuous media, the viewport is the viewing area of the browser window. User agents can change the layout of the page when the viewport size changes -- for example, if you resize your window, or change the orientation of a mobile device. If the viewport is smaller than the size of the document then the user agent needs to offer a way to scroll to the parts of the document that are not dis
played. We most often see this as scrolling in the block dimension -- vertically in a horizontal, top-to-bottom language. However, you might design something 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 f...
animation-direction - CSS: Cascading Style Sheets
t value. reverse The animation plays backwards each cycle. In other words, each time the animation cycles, the animation will reset to the end state and start over again. Animation steps are performed backwards, and timing functions are also reversed. For example, an ease-in timing function becomes ease-out. alternate The animation reverses direction each cycle, with the first iteration being
played forwards. The count to determine if a cycle is even or odd starts at one. alternate-reverse The animation reverses direction each cycle, with the first iteration being
played backwards. The count to determine if a cycle is even or odd starts at one. Note: When you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the anim...
animation-fill-mode - CSS: Cascading Style Sheets
rties at once. Syntax /* Single animation */ animation-fill-mode: none; animation-fill-mode: forwards; animation-fill-mode: backwards; animation-fill-mode: both; /* Multiple animations */ animation-fill-mode: none, backwards; animation-fill-mode: both, forwards, none; Values none The animation will not apply any styles to the target when it's not executing. The element will instead be dis
played using any other CSS rules applied to it. This is the default value. forwards The target will retain the computed values set by the last keyframe encountered during execution. The last keyframe depends on the value of animation-direction and animation-iteration-count: animation-direction animation-iteration-count last keyframe encountered normal even or...
animation-iteration-count - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. It is often convenient to use the shorthand property animation to set all animation properties at once. ...
animation - CSS: Cascading Style Sheets
in the shorthand, must be accepted for those properties rather than for animation-name. Furthermore, when serialized, default values of other properties must be output in at least the cases necessary to distinguish an animation-name that could be a value of another property, and may be output in additional cases. Values <single-animation-iteration-count> The number of times the animation is
played. The value must be one of those available in animation-iteration-count. <single-animation-direction> The direction in which the animation is
played. The value must be one of those available in animation-direction. <single-animation-fill-mode> Determines how styles should be applied to the animation's target before and after its execution. The value must be one of those available in animation-...
background-image - CSS: Cascading Style Sheets
he background-color is drawn beneath them. How the images are drawn relative to the box and its borders is defined by the background-clip and background-origin CSS properties. If a specified image cannot be drawn (for example, when the file denoted by the specified URI cannot be loaded), browsers handle it as they would a none value. Note: Even if the images are opaque and the color won't be dis
played in normal circumstances, web developers should always specify a background-color. If the images cannot be loaded--for instance, when the network is down--the background color will be used as a fallback. Syntax Each background image is specified either as the keyword none or as an <image> value. To specify multiple background images, supply multiple values, separated by a comma: background-ima...
background-repeat - CSS: Cascading Style Sheets
much as needed to cover the whole background image painting area. The last image will be clipped if it doesn't fit. space The image is repeated as much as possible without clipping. The first and last images are pinned to either side of the element, and whitespace is distributed evenly between the images. The background-position property is ignored unless only one image can be dis
played without clipping. The only case where clipping happens using space is when there isn't enough room to display one image. round As the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room (space left >= half of the image width) for another one to be added. When the next image is added, all of the current ones compress to allow room...
border-image-source - CSS: Cascading Style Sheets
d to the final border image. Syntax /* Keyword value */ border-image-source: none; /* <image> values */ border-image-source: url(image.jpg); border-image-source: linear-gradient(to top, red, yellow); /* Global values */ border-image-source: inherit; border-image-source: initial; border-image-source: unset; Values none No border image is used. The appearance defined by border-style is dis
played instead. <image> Image reference to use for the border. Formal definition Initial valuenoneApplies toall elements, except internal table elements when border-collapse is collapse. It also applies to ::first-letter.InheritednoComputed valuenone or the image with its URI made absoluteAnimation typediscrete Formal syntax none | <image>where <image> = <url> | <image()> | <image-set()> | <eleme...
border-image - CSS: Cascading Style Sheets
source | slice | width */ border-image: linear-gradient(red, blue) 27 / 35px; /* source | slice | width | outset | repeat */ border-image: url("/images/border.png") 27 23 / 50px 30px / 1rem round space; The border-image property may be specified with anywhere from one to five of the values listed below. Note: If the computed value of border-image-source is none, or if the image cannot be dis
played, the border-style will be dis
played instead. Values <'border-image-source'> The source image. See border-image-source. <'border-image-slice'> The dimensions for slicing the source image into regions. Up to four values may be specified. See border-image-slice. <'border-image-width'> The width of the border image. Up to four values may be specified. See border-image-width. <'border-image...
border-style - CSS: Cascading Style Sheets
can have the following values: none Like the hidden keyword, displays no border. Unless a background-image is set, the computed value of the same side's border-width will be 0, even if the specified value is something else. In the case of table cell and border collapsing, the none value has the lowest priority: if any other conflicting border is set, it will be dis
played. hidden Like the none keyword, displays no border. Unless a background-image is set, the computed value of the same side's border-width will be 0, even if the specified value is something else. In the case of table cell and border collapsing, the hidden value has the highest priority: if any other conflicting border is set, it won't be dis
played. dotted...
content - CSS: Cascading Style Sheets
an be any number of text characters. Non-Latin characters must be encoded using their Unicode escape sequences: for example, \000A9 represents the copyright symbol. <image> An <image>, denoted by the <url> or <gradient> data type, or part of the webpage, defined by the element() function, denoting the content to display. <counter>() The value of a CSS counter, generally a number. It can be dis
played using either the counter() or counters() function. The counter() function has two forms: 'counter(name)' or 'counter(name, style)'. The generated text is the value of the innermost counter of the given name in scope at the given pseudo-element. It is formatted in the specified style (decimal by default). The counters() function also has two forms: 'counters(name, string)' or 'counters(name, ...
<display-box> - CSS: Cascading Style Sheets
endered. display: none HTML <p>Visible text</p> <p class="secret">Invisible text</p> CSS p.secret { display: none; } Result display: contents In this example the outer <div> has a 2-pixel red border and a width of 300px. However it also has display: contents specified therefore this <div> will not be rendered, the border and width will no longer apply, and the child element will be dis
played as if the parent had never existed. HTML <div class="outer"> <div>Inner div.</div> </div> CSS .outer { border: 2px solid red; width: 300px; display: contents; } .outer > div { border: 1px solid green; } Result Specifications Specification Status CSS Display Module Level 3The definition of 'display-box' in that specification. Candidate Recommendati...
<display-outside> - CSS: Cascading Style Sheets
syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. This will result in expected behavior; for example if you specify an element to be block, you would expect that the children of that element would participate in block and inline normal flow layout. Examples In the following example, span elements (normally dis
played as inline elements) are set to display: block and so break onto new lines and expand to fill their container in the inline dimension. HTML <span>span 1</span> <span>span 2</span> CSS span { display: block; border: 1px solid rebeccapurple; } Result Specifications Specification Status CSS Display Module Level 3The definition of 'display-outside' in that spe...
font-size - CSS: Cascading Style Sheets
below is nearly identical to the previous example. The only exception is that the unit has been changed to rem. html { font-size: 62.5%; /* font-size 1em = 10px on default browser settings */ } span { font-size: 1.6rem; } Then we apply this CSS to the same HTML, which looks like this: <span>Outer <span>inner</span> outer</span> In this example, the words "outer inner outer" are all dis
played at 16px (assuming that the browser's font-size has been left at the default value of 10px). Formal definition Initial valuemediumApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesPercentagesrefer to the parent element's font sizeComputed valueas specified, but with relative lengths converted into absolute lengthsAnimation typea length Formal syntax <absolu...
font-variant-ligatures - CSS: Cascading Style Sheets
e type designer. They correspond to the OpenType values dlig. Two values are possible: discretionary-ligatures activating these ligatures. no-discretionary-ligatures deactivating the ligatures. Note that the keyword normal usually deactivates these ligatures. <historical-lig-values> These values control the ligatures used historically, in old books, like the German tz digraph being dis
played ss. They correspond to the OpenType values hlig. Two values are possible: historical-ligatures activating these ligatures. no-historical-ligatures deactivating the ligatures. Note that the keyword normal usually deactivates these ligatures. <contextual-alt-values> These values control whether letters adapt to their context--that is, whether they adapt to the surrounding letters. These...
mask-repeat - CSS: Cascading Style Sheets
age is repeated as much as needed to cover the whole mask painting area. The last image will be clipped if it doesn't fit. space The image is repeated as much as possible without clipping. The first and last images are pinned to either side of the element, and whitespace is distributed evenly between the images. The mask-position property is ignored unless only one image can be dis
played without clipping. The only case where clipping happens using space is when there isn't enough room to display one image. round As the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room for another one to be added. When the next image is added, all of the current ones compress to allow room. Example: An image with an original wid...
<resolution> - CSS: Cascading Style Sheets
72 or 96 dots per inch, but the dpi for printed documents is usually much greater. As 1 inch is 2.54 cm, 1dpi ? 0.39dpcm. dpcm Represents the number of dots per centimeter. As 1 inch is 2.54 cm, 1dpcm ? 2.54dpi. dppx Represents the number of dots per px unit. Due to the 1:96 fixed ratio of CSS in to CSS px, 1dppx is equivalent to 96dpi, which corresponds to the default resolution of images dis
played in CSS as defined by image-resolution. x Alias for dppx. Note: Although the number 0 is always the same regardless of unit, the unit may not be omitted. In other words, 0 is invalid and does not represent 0dpi, 0dpcm, or 0dppx. Examples Use in a media query @media print and (min-resolution: 300dpi) { ... } Valid resolutions 96dpi 50.82dpcm 3dppx Invalid resolutions 72 dpi Spaces...
scroll-snap-coordinate - CSS: Cascading Style Sheets
ate: 50px 50px; /* Single coordinate */ scroll-snap-coordinate: 100px 100px, 100px bottom; /* Multiple coordinates */ /* Global values */ scroll-snap-coordinate: inherit; scroll-snap-coordinate: initial; scroll-snap-coordinate: unset; If the element has been transformed, the snap coordinates are likewise transformed, thus aligning the snap points with the element as it is dis
played. Syntax Values none Specifies that the element does not contribute to a snap point. <position> Specifies the offset of the snap coordinates from the start edge of the element's border box. For each pairing, the first value gives the x coordinate of the snap coordinate, the second value its y coordinate. Formal definition Initial valuenoneApplies toall elementsInheritednoPercentagesrefe...
text-overflow - CSS: Cascading Style Sheets
t at the limit of the content area, therefore the truncation can happen in the middle of a character. To clip at the transition between characters you can specify text-overflow as an empty string, if that is supported in your target browsers: text-overflow: '';. ellipsis This keyword value will display an ellipsis ('...', U+2026 Horizontal Ellipsis) to represent clipped text. The ellipsis is dis
played inside the content area, decreasing the amount of text dis
played. If there is not enough space to display the ellipsis, it is clipped. <string> The <string> to be used to represent clipped text. The string is dis
played inside the content area, shortening the size of the dis
played text. If there is not enough space to display the string itself, it is clipped. fade This keyword clips the ov...
Live streaming web audio and video - Developer guides
MPEG-DASH DASH stands for Dynamic Adaptive Streaming over HTTP and is a new format that has recently seen support added to Chrome, and Internet Explorer 11 running on Windows 8.1. It is supported via Media Source Extensions 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 appended/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 s...
Video player styling basics - Developer guides
ft + this.offsetParent.offsetLeft)) / this.offsetWidth; video.currentTime = pos * video.duration; }); Fullscreen The FullScreen implemention hasn't changed. Responsive styling Now that the player has its basic look and feel taken care of, some other styling changes -- involving media queries -- need to be made in order to make it responsive. The player currently works fairly well until dis
played on a "medium" screen (e.g. 1024px/64em) or smaller. In this case, the margins and padding on the <figure> element need to be removed so that all the available space is taken advantage of, and the buttons are a bit too small so this needs to be altered by setting a new height on the element that has the .controls class set on it: @media screen and (max-width:64em) { figure { padding-left...
Event developer guide - Developer guides
by modern web browsers. The device on which the web browser is running can trigger events, for example due to a change in its position and orientation in the real world, as discussed partially by the page on orientation coordinate systems and the page on the use of 3D transforms. That is different, but similar, to the change in device vertical orientation. The window in which the browser is dis
played can trigger events; for example, change size if the user maximizes the window or otherwise changes it. The process loading of a web page can trigger events in response to the completion of different steps in the downloading, parsing, and rendering of the web page for display to the user. The user interaction with the web page contents can trigger events. The events triggered by user interaction...
Graphics on the Web - Developer guides
You can also construct graphics on-the-fly, or manipulate images after the fact. These articles provide insight into how you can accomplish this. 2D Graphics Canvas The <canvas> element provides APIs to draw 2D graphics using JavaScript. SVG Scalable Vector Graphics (SVG) lets you use lines, curves, and other geometric shapes to render graphics. With vectors, you can create images that scale cleanly to any size. View All... ...
Constraint validation - Developer guides
/ No custom constraint violation FS.setCustomValidity(""); } Finally we hook the method with the correct event: window.onload = function () { document.getElementById("FS").onchange = checkFileSize; } You can see a live example of the File size constraint validation. Visual styling of constraint validation Apart from setting constraints, web developers want to control what messages are dis
played to the users and how they are styled. Controlling the look of elements The look of elements can be controlled via CSS pseudo-classes. :required and :optional CSS pseudo-classes The :required and :optional pseudo-classes allow writing selectors that match form elements that have the required attribute, or that don't have it. :placeholder-shown CSS pseudo-class See :placeholder-shown :valid ...
HTML5 - Developer guides
iveElement and hasFocus attributes are supported. Web-based protocol handlers You can now register web applications as protocol handlers using the navigator.registerProtocolHandler() method. requestAnimationFrame Allows control of animations rendering to obtain optimal performance. Fullscreen API Controls the usage of the whole screen for a Web page or application, without the browser UI dis
played. Pointer Lock API Allows locking the pointer to the content, so games and similar applications don't lose focus when the pointer reaches the window limit. Online and offline events In order to build a good offline-capable web application, you need to know when your application is actually offline. Incidentally, you also need to know when your application has returned to an online status again...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
AppletElement Attributes align This attribute is used to position the applet on the page relative to content that might flow around it. The HTML 4.01 specification defines values of bottom, left, middle, right, and top, whereas Microsoft and Netscape also might support absbottom, absmiddle, baseline, center, and texttop. alt This attribute causes a descriptive text alternate to be dis
played on browsers that do not support Java. Page designers should also remember that content enclosed within the <applet> element may also be rendered as alternative text. archive This attribute refers to an archived or compressed version of the applet and its associated class files, which might help reduce download time. code This attribute specifies the URL of the applet's class file to be loaded...
<area> - HTML: Hypertext Markup Language
rwise no corresponding role Permitted ARIA roles No role permitted DOM interface HTMLAreaElement Attributes This element's attributes include the global attributes. alt A text string alternative to display on browsers that do not display images. The text should be phrased so that it presents the user with the same kind of choice as the image would offer when dis
played without the alternative text. This attribute is required only if the href attribute is used. coords A set of values specifying the coordinates of the hot-spot region. The number and meaning of the values depend upon the value specified for the shape attribute. rect or rectangle: the value is two x,y pairs: left, top, right, bottom. circle: the value is x,y,r where x,y is a pair speci...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
source src="foo.ogg" type="audio/ogg; codecs=vorbis"/> <source src="foo.mp3" type="audio/mpeg"/> </audio> Accessibility concerns Audio with spoken dialog should provide both captions and transcripts that accurately describe its content. Captions, which are specified using WebVTT, allow people who are experiencing hearing loss to understand an audio recording's content as the recording is being
played, while transcripts allow people who need additional time to be able to review the recording's content at a pace and format that is comfortable for them. If automatic captioning services are used, it is important to review the generated content to ensure it accurately represents the source audio. The <audio> element doesn't directly support WebVTT. You will have to find a library or framework th...
<bgsound>: The Background Sound element (obsolete) - HTML: Hypertext Markup Language
d file to play in the background while the page is used; use <audio> instead. Do not use this! In order to embed audio in a Web page, you should be using the <audio> element. Attributes balance This attribute defines a number between -10,000 and +10,000 that determines how the volume will be divided between the speakers. loop This attribute indicates the number of times a sound is to be
played and either has a numeric value or the keyword infinite. src This attribute specifies the URL of the sound file to be
played, which must be one of the following types: .wav, .au, or .mid. volume This attribute defines a number between -10,000 and 0 that determines the loudness of a page's background sound. Example <bgsound src="sound1.mid"> <bgsound src="sound2.au" loop="infinite"> Usage...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
nt inside the <canvas> block. That content will be rendered both on older browsers that don't support canvas and in browsers with JavaScript disabled. Providing a useful fallback text or sub DOM helps to make the the canvas more accessible. Required </canvas> tag Unlike the <img> element, the <canvas> element requires the closing tag (</canvas>). Sizing the canvas using CSS versus HTML The dis
played size of the canvas can be changed using CSS, but if you do this the image is scaled during rendering to fit the styled size, which can make the final graphics rendering end up being distorted. It is better to specify your canvas dimensions by setting the width and height attributes directly on the <canvas> elements, either directly in the HTML or by using JavaScript. Maximum canvas size The ma...
<caption>: The Table Caption element - HTML: Hypertext Markup Language
includes the global attributes. Deprecated attributes The following attributes are deprecated and should not be used. They are documented below for reference when updating existing code and for historical interest only. align This enumerated attribute indicates how the caption must be aligned with respect to the table. It may have one of the following values: left The caption is dis
played to the left of the table. top The caption is dis
played above the table. right The caption is dis
played to the right of the table. bottom The caption is dis
played below the table. Usage note: Do not use this attribute, as it has been deprecated. The <caption> element should be styled using the CSS properties caption-side and text-align. Usage notes The <caption> element should...
<code>: The Inline Code element - HTML: Hypertext Markup Language
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. ...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
is not set, the dialog shouldn't be shown to the user. Usage notes <form> elements can close a dialog if they have the attribute method="dialog". When such a form is submitted, the dialog closes with its returnValue property set to the value of the button that was used to submit the form. The ::backdrop CSS pseudo-element can be used to style behind a <dialog> element when the dialog is dis
played with HTMLDialogElement.showModal(). For example, to dim unreachable content behind the modal dialog. Examples Simple example <dialog open> <p>Greetings, one and all!</p> </dialog> Advanced example This example opens a pop-up dialog box that contains a form, when the "Update details" button is clicked. HTML <!-- Simple pop-up dialog box containing a form --> <dialog id="favDialog"> <f...
<div>: The Content Division element - HTML: Hypertext Markup Language
<div> <p>Any kind of content here. Such as <p>, <table>. You name it!</p> </div> The result looks like this: A styled example This example creates a shadowed box by applying a style to the <div> using CSS. Note the use of the class attribute on the <div> to apply the style named "shadowbox" to the element. HTML <div class="shadowbox"> <p>Here's a very interesting note dis
played in a lovely shadowed box.</p> </div> CSS .shadowbox { width: 15em; border: 1px solid #333; box-shadow: 8px 8px 5px #444; padding: 8px 12px; background-image: linear-gradient(180deg, #fff, #ddd 40%, #ccc); } Result Specifications Specification Status Comment HTML Living StandardThe definition of '<div>' in that specification. Living Standard No ...
<em>: The Emphasis element - HTML: Hypertext Markup Language
.2 (Firefox 4) inclusive, Firefox implements the HTMLSpanElement interface for this element. Attributes This element only includes the global attributes. Usage notes The <em> element is for words that have a stressed emphasis compared to surrounding text, which is often limited to a word or words of a sentence and affects the meaning of the sentence itself. Typically this element is dis
played in italic type. However, it should not be used simply to apply italic styling; use the CSS font-style property for that purpose. Use the <cite> element to mark the title of a work (book, play, song, etc.). Use the <i> element to mark text that is in an alternate tone or mood, which covers many common situations for italics such as scientific names or words in other languages. Use the <strong> ele...
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
Must have a start tag, and must not have an end tag. Permitted parents Any element that accepts embedded content. Implicit ARIA role No corresponding role Permitted ARIA roles application, document, img, none, presentation DOM interface HTMLEmbedElement Attributes This element's attributes include the global attributes. height The dis
played height of the resource, in CSS pixels. This must be an absolute value; percentages are not allowed. src The URL of the resource being embedded. type The MIME type to use to select the plug-in to instantiate. width The dis
played width of the resource, in CSS pixels. This must be an absolute value; percentages are not allowed. Usage notes You can use the object-position property to adjust ...
<hgroup> - HTML: Hypertext Markup Language
erface HTMLElement Attributes This element only includes the global attributes. Usage notes The <hgroup> element has been removed from the HTML5 (W3C) specification, but it still is in the WHATWG version of HTML. It is partially implemented in most browsers, though, so is unlikely to go away. However, given that a key purpose of the <hgroup> element is to affect how headings are dis
played by the outline algorithm defined in the HTML specification--but the HTML outline algorithm is not implemented in any browsers--then the <hgroup> semantics are in practice only theoretical. So the HTML5 (W3C) specification provides advice on how to mark up Subheadings, subtitles, alternative titles and taglines without using <hgroup>. The <hgroup> element allows the primary heading for a docume...
<hr>: The Thematic Break (Horizontal Rule) element - HTML: Hypertext Markup Language
r example, a change of scene in a story, or a shift of topic within a section. 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. Historically, this has been presented as a horizontal rule or line. While it may still be dis
played as a horizontal rule in visual browsers, this element is now defined in semantic terms, rather than presentational terms, so if you wish to draw a horizontal line, you should do so using appropriate CSS. Content categories Flow content. Permitted content None, it is an empty element. Tag omission It must have start tag, but must not have an end tag. P...
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
n communication can be achieved using Window.postMessage(). Positioning and scaling As a replaced element, the position, alignment, and scaling of the embedded document within the <iframe> element's box, can be adjusted with the object-position and object-fit properties. Examples A simple <iframe> An <iframe> in action. After creating the frame, when the user clicks a button, its title is dis
played in an alert. HTML <iframe src="https://mdn-samples.mozilla.org/snippets/html/iframe-simple-contents.html" title="iframe Example 1" width="400" height="300"> </iframe> Result Accessibility concerns People navigating with assistive technology such as a screen reader can use the title attribute on an <iframe> to label its content. The title's value should concisely describe the ...
<img>: The Image Embed element - HTML: Hypertext Markup Language
nd us a pull request. The above example shows usage of the <img> element: The src attribute is required, and contains the path to the image you want to embed. The alt attribute holds a text description of the image, which isn't mandatory but is incredibly useful for accessibility -- screen readers read this description out to their users so they know what the image means. Alt text is also dis
played on the page if the image can't be loaded for some reason: for example, network errors, content blocking, or linkrot. There are many other attributes to achieve various purposes: Referrer/CORS control for security and privacy: see crossorigin and referrerpolicy. Use both width and height to set the intrinsic size of the image, allowing it to take up space before it loads, to mitigate content...
<input type="datetime-local"> - HTML: Hypertext Markup Language
his input type is described in Local date and time strings in Date and time formats used in HTML. You can set a default value for the input by including a date and time inside the value attribute, like so: <label for="party">Enter a date and time for your party booking:</label> <input id="party" type="datetime-local" name="partydate" value="2017-06-01T08:30"> One thing to note is that the dis
played date and time formats differ from the actual value; the dis
played date and time are formatted according to the user's locale as reported by their operating system, whereas the date/time value is always formatted yyyy-MM-ddThh:mm. When the above value submitted to the server, for example, it will look like partydate=2017-06-01T08:30. Note: Also bear in mind that if such data is submitted via HTT...
<input type="hidden"> - HTML: Hypertext Markup Language
ot be focused even using JavaScript (e.g. hiddenInput.focus()). Value The <input> element's value attribute holds a DOMString that contains the hidden data you want to include when the form is submitted to the server. This specifically can't be edited or seen by the user via the user interface, although you could edit the value via browser developer tools. Important: While the value isn't dis
played to the user in the page's content, it is visible--and can be edited--using any browser's developer tools or "View Source" functionality. Do not rely on hidden inputs as a form of security. Additional attributes In addition to the attributes common to all <input> elements, hidden inputs offer the following attributes: Attribute Description name Like all input types,...
<input type="image"> - HTML: Hypertext Markup Language
equest. Value None -- the value attribute should not be specified. Events None. Supported common attributes alt, src, width, height, formaction, formenctype, formmethod, formnovalidate, formtarget IDL attributes None. Methods None. Value <input type="image"> elements do not accept value attributes. The path to the image to be dis
played is specified in the src attribute. Additional attributes In addition to the attributes shared by all <input> elements, image button inputs support the following attributes: Attribute Description alt Alternate string to display when the image can't be shown formaction The URL to which to submit the data formenctype The encoding method to use w...
<input type="month"> - HTML: Hypertext Markup Language
by this input type is described in Format of a valid local month string in Date and time formats used in HTML. You can set a default value for the input control by including a month and year inside the value attribute, like so: <label for="bday-month">What month were you born in?</label> <input id="bday-month" type="month" name="bday-month" value="2017-06"> One thing to note is that the dis
played date format differs from the actual value; most user agents display the month and year in a locale-appropriate form, based on the set locale of the user's operating system, whereas the date value is always formatted yyyy-MM. When the above value is submitted to the server, for example, it will look like bday-month=1978-06. You can also get and set the date value in JavaScript using the HTMLInpu...
<input type="number"> - HTML: Hypertext Markup Language
(that is, not NaN or Infinity). Placeholders Sometimes it's helpful to offer an in-context hint as to what form the input data should take. This can be especially important if the page design doesn't offer descriptive labels for each <input>. This is where placeholders come in. A placeholder is a value most commonly used to provide a hint as to the format the input should take value. It is dis
played inside the edit box when the element's value is "". Once data is entered into the box, the placeholder disappears; if the box is emptied, the placeholder reappears. Here, we have an number input with the placeholder "Multiple of 10". Note how the placeholder disappears and reappears as you manipulate the contents of the edit field. <input type="number" placeholder="Multiple of 10"> Controlli...
<input type="submit"> - HTML: Hypertext Markup Language
the user agent attempts to submit the form to the server. <input type="submit" value="Send Request"> Value A DOMString used as the button's label Events click Supported common attributes type and value IDL attributes value Methods None Value An <input type="submit"> element's value attribute contains a DOMString which is dis
played as the button's label. Buttons do not have a true value otherwise. <input type="submit" value="Send Request"> If you don't specify a value, the button will have a default label, chosen by the user agent. This label is likely to be something along the lines of "Submit" or "Submit Query." Here's an example of a submit button with a default label in your browser: <input type="submit"> Ad...
<input type="tel"> - HTML: Hypertext Markup Language
, telNo=+12125553151. Placeholders Sometimes it's helpful to offer an in-context hint as to what form the input data should take. This can be especially important if the page design doesn't offer descriptive labels for each <input>. This is where placeholders come in. A placeholder is a value that demonstrates the form the value should take by presenting an example of a valid value, which is dis
played inside the edit box when the element's value is "". Once data is entered into the box, the placeholder disappears; if the box is emptied, the placeholder reappears. Here, we have an tel input with the placeholder 123-4567-8901. Note how the placeholder disappears and reappears as you manipulate the contents of the edit field. <input id="telNo" name="telNo" type="tel" placeholder="123-456...
<input type="week"> - HTML: Hypertext Markup Language
ormat of the date and time value used by this input type is described in Format of a valid week string in Date and time formats used in HTML. You can set a default value for the input by including a value inside the value attribute, like so: <label for="week">What week would you like to start?</label> <input id="week" type="week" name="week" value="2017-W01"> One thing to note is that the dis
played format may differ from the actual value, which is always formatted yyyy-Www. When the above value is submitted to the server, for example, browsers may display it as Week 01, 2017, but the submitted value will always look like week=2017-W01. You can also get and set the value in JavaScript using the input element's value property, for example: var weekControl = document.querySelector('input[typ...
theme-color - HTML: Hypertext Markup Language
alue for the name attribute of the <meta> element indicates a suggested color that user agents should use to customize the display of the page or of the surrounding user interface. If specified, the content attribute must contain a valid CSS <color>. Example <meta name="theme-color" content="#4285f4"> The following image shows the effect that the <meta> element above will have on a document dis
played in Chrome running on an Android mobile device. Image credit: from Icons & Browser Colors, created and shared by Google and used according to terms described in the Creative Commons 4.0 Attribution License. Specifications Specification HTML Living StandardThe definition of 'theme-color' in that specification. ...
<object> - HTML: Hypertext Markup Language
this element a declaration only. The object must be instantiated by a subsequent <object> element. In HTML5, repeat the <object> element completely each that that the resource is reused. formHTML5 The form element, if any, that the object element is associated with (its form owner). The value of the attribute must be an ID of a <form> element in the same document. height The height of the dis
played resource, in CSS pixels. -- (Absolute values only. NO percentages) name The name of valid browsing context (HTML5), or the name of the control (HTML 4). standbyHTML 4 onlyObsolete since HTML5 A message that the browser can show while loading the object's implementation and data. tabindexHTML 4 onlyObsolete since HTML5 The position of the element in the tabbing navigation order for the curre...
<output>: The Output element - HTML: Hypertext Markup Language
ide an ancestor <form> element. name The element's name. Used in the form.elements API. The <output> value, name, and contents are NOT submitted during form submission. Examples In the following example, the form provides a slider whose value can range between 0 and 100, and an <input> element into which you can enter a second number. The two numbers are added together, and the result is dis
played in the <output> element each time the value of any of the controls changes. <form oninput="result.value=parseInt(a.value)+parseInt(b.value)"> <input type="range" id="b" name="b" value="50" /> + <input type="number" id="a" name="a" value="10" /> = <output name="result" for="a b">60</output> </form> Accessibility Concerns Many browsers implement this element as an aria-live region. Assi...
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
is considered raw text. Note: Do not use this element. <plaintext> is deprecated since HTML 2, and not all browsers implemented it. Browsers that did implement it didn't do so consistently. <plaintext> is obsolete in HTML5; browsers that accept it may instead treat it as a <pre> element that still interprets HTML within. If <plaintext> is the first element on the page (other than any non-dis
played elements, like <head>), do not use HTML at all. Instead serve a text file with the text/plain MIME-type. Instead of <plaintext>, use the <pre> element or, if semantically accurate (such as for inline text), the <code> element. Escape any <, > and & characters, to prevent browsers inadvertently parsing content the element content as HTML. A monospaced font can be applied to any HTML element via ...
<progress>: The Progress Indicator 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, labelable content, palpable content. Permitted content Phrasing content, but there must be no <progress> element among its descendants. Tag omission None, both the starting and ending tag are mandatory. ...
<rp>: The Ruby Fallback Parenthesis element - HTML: Hypertext Markup Language
mitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Ruby annotations are for showing pronunciation of East Asian characters, like using Japanese furigana or Taiwanese bopomofo characters. The <rp> element is used in the case of lack of <ruby> element support; the <rp> content provides what should be dis
played in order to indicate the presence of a ruby annotation, usually parentheses. Examples This example uses ruby annotations to display the Romaji equivalents for each character. <ruby> ? <rp>(</rp><rt>Kan</rt><rp>)</rp> ? <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> CSS body { font-size: 22px; } The result looks like this in your browser: The HTML above rendered by a browser without r...
<select>: The HTML Select element - HTML: Hypertext Markup Language
elected if you choose to do so. The "focused" select option is highlighted with a dotted outline, in the same way as a keyboard-focused link. Pressing Space to select/deselect "focused" select options. Styling with CSS The <select> element is notoriously difficult to style productively with CSS. You can affect certain aspects like any element -- for example, manipulating the box model, the dis
played font, etc., and you can use the appearance property to remove the default system appearance. However, these properties don't produce a consistent result across browsers, and it is hard to do things like line different types of form element up with one another in a column. The <select> element's internal structure is complex, and hard to control. If you want to get full control, you should consid...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
e web. For details on the video and audio media types, you can use, see the Guide to media types formats used on the web. Examples Video example This example demonstrates how to offer a video in Ogg format for users whose browsers support Ogg format, and a QuickTime format video for users whose browsers support that. If the audio or video element is not supported by the browser, a notice is dis
played instead. If the browser supports the element but does not support any of the specified formats, an error event is raised and the default media controls (if enabled) will indicate an error. Be sure to reference our guide to media types and formats on the web for details on what media file formats you can use and how well they're supported by browsers. <video controls> <source src="foo.webm" typ...
<sub>: The Subscript element - HTML: Hypertext Markup Language
Subscripts are typically rendered with a lowered baseline using smaller text. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content. ...
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
let you know when this state change occurs. Default label text If a <details> element's first child is not a <summary> element, the user agent will use a default string (typically "Details") as the label for the disclosure box. Default style Per the HTML specification, the default style for <summary> elements includes display: list-item. This makes it possible to change or remove the icon dis
played as the disclosure widget next to the label from the default, which is typically a triangle. You can also change the style to display: block to remove the disclosure triangle. See the Browser compatibility section for details, as not all browsers support full functionality of this element yet. Examples Below are some examples showing <summary> in use. You can find more examples in the document...
<sup>: The Superscript element - HTML: Hypertext Markup Language
Superscripts are usually rendered with a raised baseline using smaller text. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content. ...
<th> - HTML: Hypertext Markup Language
the CSS vertical-align property instead. width Deprecated since HTML4, Obsolete since HTML5 This attribute is used to define a recommended 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 dis
played. Note: Do not use this attribute as it is obsolete in the latest standard: use the CSS width property instead. Examples See <table> for examples on <th>. Specifications Specification Status Comment HTML Living StandardThe definition of 'th element' in that specification. Living Standard HTML5The definition of 'th element' in that specification. ...
<title>: The Document Title element - HTML: Hypertext Markup Language
Don't use "keyword blobs." If your title is just a list of words, algorithms often reduce your page's position in the search results. Try to make sure your titles are as unique as possible within your own site. Duplicate--or near-duplicate--titles can contribute to inaccurate search results. Example <title>Awesome interesting stuff</title> This example establishes a page whose title (as dis
played at the top of the window or in the window's tab) as "Awesome interesting stuff". Accessibility concerns It is important to provide a title value that describes the page's purpose. A common navigation technique for users of assistive technology is to read the page title and infer the content the page contains. This is because navigating into a page to determine its content can be a time consum...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
he element, the user agent selects a bullet type depending on the nesting level of the list. Warning: Do not use this attribute, as it has been deprecated; use the CSS list-style-type property instead. Usage notes The <ul> element is for grouping a collection of items that do not have a numerical ordering, and their order in the list is meaningless. Typically, unordered-list items are dis
played with a bullet, which can be of several forms, like a dot, a circle, or a square. The bullet style is not defined in the HTML description of the page, but in its associated CSS, using the list-style-type property. The <ul> and <ol> elements may be nested as deeply as desired. Moreover, the nested lists may alternate between <ol> and <ul> without restriction. The <ol> and <ul> elements both repre...
hidden - HTML: Hypertext Markup Language
that they describe. Similarly, a canvas element with the hidden attribute could be used by a scripted graphics engine as an off-screen buffer, and a form control could refer to a hidden form element using its form attribute. Note: Changing the value of the CSS display property on an element with the hidden attribute overrides the behavior. For instance, elements styled display: flex will be dis
played despite the hidden attribute's presence. Specifications Specification Status Comment HTML Living StandardThe definition of 'hidden' in that specification. Living Standard No change from latest snapshot, HTML 5.1 HTML Living StandardThe definition of 'Hidden elements' in that specification. Living Standard Defines the suggested default rendering of t...
itemprop - HTML: Hypertext Markup Language
An item with a property whose value is a product ID The ID is not human-friendly, so the product's name is used the human-visible text instead of the ID. <h1 itemscope> <data itemprop="product-id" v...
Evolution of HTTP - HTTP
rge extensions, numerous other headers have been added, sometimes experimentally only. Notable headers are Do Not Track (DNT) header to control privacy, X-Frame-Options, or Upgrade-Insecure-Requests but many more exist. HTTP/2 - A protocol for greater performance Over the years, Web pages have become much more complex, even becoming applications in their own right. The amount of visual media dis
played, the volume and size of scripts adding interactivity, has also increased: much more data is transmitted over significantly more HTTP requests. HTTP/1.1 connections need requests sent in the correct order. Theoretically, several parallel connections could be used (typically between 5 and 8), bringing considerable overhead and complexity. For example, HTTP pipelining has emerged as a resource burd...
MIME types (IANA media types) - HTTP
e it to disk to use it. Some common incorrect server configurations: RAR-compressed files. In this case, the ideal would be the true type of the original files; this is often impossible as .RAR files can hold several resources of different types. In this case, configure the server to send application/x-rar-compressed. Audio and video. Only resources with the correct MIME Type will be
played in <video> or <audio> elements. Be sure to specify the correct media type for audio and video. Proprietary file types. Avoid using application/octet-stream as most browsers do not allow defining a default behavior (like "Open in Word") for this generic MIME type. A specific type like application/vnd.mspowerpoint lets users open such files automatically in the presentation software of their ...
Browser detection using the user agent - HTTP
ually fair method. From this point on, we shall assume that all the dog boxes are at the top of the source code, that all the cat boxes are at the bottom of the source code, and that all these boxes have the same parent element. There a single instance of a dog box immediately above a cat box, of course. The first method uses horizontal Flexboxes to group the content such that when the page is dis
played to the end user, all the dogs boxes are at the top of the page and all the cat boxes are lower on the page. The second method uses a Column layout and resents all the dogs to the left and all the cats to the right. Only in this particular scenario, it is appropriate to provide no fallback for the flexboxes/multicolumns, resulting in a single column of very wide boxes on old browsers. Also conside...
Connection management in HTTP/1.x - HTTP
onnection. Theoretically, performance could also be improved if two HTTP requests were to be packed into the same TCP message. The typical MSS (Maximum Segment Size), is big enough to contain several simple requests, although the demand in size of HTTP requests continues to grow. Not all types of HTTP requests can be pipelined: only idempotent methods, that is GET, HEAD, PUT and DELETE, can be re
played safely: should a failure happen, the pipeline content can simply be repeated. Today, every HTTP/1.1-compliant proxy and server should support pipelining, though many have limitations in practice: a significant reason no modern browser activates this feature by default. Domain sharding Unless you have a very specific immediate need, don't use this deprecated technique; switch to HTTP/2 instead...
Large-Allocation - HTTP
eader. This message means that the browser saw the Large-Allocation header, and was able to reload the page into a new process which should have more available contiguous memory. A Large-Allocation header was ignored due to the load being triggered by a non-GET request. When a POST request is used to load a document, that load cannot currently be redirected into a new process. This error is dis
played when loading a document with a Large-Allocation header with a non-GET HTTP method. This could be caused due to the document being loaded by a form submission, for example. A Large-Allocation header was ignored due to the presence of windows which have a reference to this browsing context through the frame hierarchy or window.opener. This error means that the document was not loaded at the top...
HTTP headers - HTTP
s origins that are allowed to see values of attributes retrieved via features of the Resource Timing API, which would otherwise be reported as zero due to cross-origin restrictions. Do Not Track DNT Expresses the user's tracking preference. Tk Indicates the tracking status of the corresponding response. Downloads Content-Disposition Indicates if the resource transmitted should be dis
played inline (default 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 l...
HTTP Index - HTTP
ver understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions. 255 425 Too Early Browser, Client error, HTTP, Status code The HyperText Transfer Protocol (HTTP) 425 Too Early response status code indicates that the server is unwilling to risk processing a request that might be re
played, which creates the potential for a replay attack. 256 426 Upgrade Required Client error, HTTP, HTTP Status Code, Reference, Status code The HTTP 426 Upgrade Required client error response code indicates that the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. 257 428 P...
An overview of HTTP - HTTP
layout information (CSS) to display, and sub-resources contained within the page (usually images and videos). The Web browser then mixes these resources to present to the user a complete document, the Web page. Scripts executed by the browser can fetch more resources in later phases and the browser updates the Web page accordingly. A Web page is a hypertext document. This means some parts of dis
played text are links which can be activated (usually by a click of the mouse) to fetch a new Web page, allowing the user to direct their user-agent and navigate through the Web. The browser translates these directions in HTTP requests, and further interprets the HTTP responses to present the user with a clear response. The Web server On the opposite side of the communication channel, is the server, w...
Redirections in HTTP - HTTP
, you don't want your users to resend PUT, POST or DELETE requests. If you serve the response as the result of this request, a simple press of the reload button will resend the request (possibly after a confirmation message). In this case, the server can send back a 303 (See Other) response for a URL that will contain the right information. If the reload button is pressed, only that page is redis
played, without replaying the unsafe requests. Temporary responses to long requests Some requests may need more time on the server, like DELETE requests that are scheduled for later processing. In this case, the response is a 303 (See Other) redirect that links to a page indicating that the action has been scheduled, and eventually informs about its progress, or allows to cancel it. Configuring redir...
204 No Content - HTTP
The HTTP 204 No Content success status response code indicates that the request has succeeded, but that the client doesn't need to go away from its current page. A 204 response is cacheable by default. An ETag header is included in such a response. The common use case is to return 204 as a result of a PUT request, updating a resource, without changing the current content of the page dis
played to the user. If the resource is created, 201 Created is returned instead. If the page should be changed to the newly updated page, the 200 should be used instead. Status 204 No Content Specifications Specification Title RFC 7231, section 6.3.5: 204 No Content Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content ...
425 Too Early - HTTP
Status 425 Too Early Specifications Specification Title RFC 8470, section 5.2: 425: Early Data Using Early Data in HTTP ...
HTTP response status codes - HTTP
ed in the request URI. 422 Unprocessable Entity (WebDAV) The request was well-formed but was unable to be followed due to semantic errors. 423 Locked (WebDAV) The resource that is being accessed is locked. 424 Failed Dependency (WebDAV) The request failed due to failure of a previous request. 425 Too Early Indicates that the server is unwilling to risk processing a request that might be re
played. 426 Upgrade Required The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. The server sends an Upgrade header in a 426 response to indicate the required protocol(s). 428 Precondition Required The origin server requires the request to be conditional. This response is intended to prevent the 'lost u...
A re-introduction to JavaScript (JS tutorial) - JavaScript
ta and methods that operate on that data. JavaScript is a prototype-based language that contains no class statement, as you'd find in C++ or Java (this is sometimes confusing for programmers accustomed to languages with a class statement). Instead, JavaScript uses functions as classes. Let's consider a person object with first and last name fields. There are two ways in which the name might be dis
played: as "first last" or as "last, first". Using the functions and objects that we've discussed previously, we could display the data like this: function makePerson(first, last) { return { first: first, last: last }; } function personFullName(person) { return person.first + ' ' + person.last; } function personFullNameReversed(person) { return person.last + ', ' + person.first; } var ...
Closures - JavaScript
he code in JSFiddle. The helpText array defines three helpful hints, each associated with the ID of an input field in the document. The loop cycles through these definitions, hooking up an onfocus event to each one that shows the associated help method. If you try this code out, you'll see that it doesn't work as expected. No matter what field you focus on, the message about your age will be dis
played. The reason for this is that the functions assigned to onfocus are closures; they consist of the function definition and the captured environment from the setupHelp function's scope. Three closures have been created by the loop, but each one shares the same single lexical environment, which has a variable with changing values (item). This is because the variable item is declared with var and thu...
Using Promises - JavaScript
Error propagation You might recall seeing failureCallback three times in the pyramid of doom earlier, compared to only once at the end of the promise chain: doSomething() .then(result => doSomethingElse(result)) .then(newResult => doThirdThing(newResult)) .then(finalResult => console.log(`Got the final result: ${finalResult}`)) .catch(fail...
Inheritance and the prototype chain - JavaScript
tion, a // function in JavaScript will always have a default // prototype property. // (Ps: There is one exception that arrow function doesn't have a default prototype property) var doSomething = function(){}; console.log( doSomething.prototype ); As seen above, doSomething() has a default prototype property, as demonstrated by the console. After running this code, the console should have dis
played an object that looks similar to this. { constructor: f doSomething(), __proto__: { constructor: f Object(), hasOwnProperty: f hasOwnProperty(), isPrototypeOf: f isPrototypeOf(), propertyIsEnumerable: f propertyIsEnumerable(), toLocaleString: f toLocaleString(), toString: f toString(), valueOf: f valueOf() } } We can add propert...
JavaScript error reference - JavaScript
Below, you'll find a list of errors which are thrown by JavaScript. These errors can be a helpful debugging aid, but the reported problem isn't always immediately clear. The pages below will provide additional details about these errors. Each error is an object based upon the Error object, and has a name and a message. Errors dis
played in the Web console may include a link to the corresponding page below to help you quickly comprehend the problem in your code. For a beginner's introductory tutorial on fixing JavaScript errors, see What went wrong? Troubleshooting JavaScript. List of errors In this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). Together, these two properties provide a starting point toward understanding and r...
Intl.Locale.prototype.region - JavaScript
Knowing the locale's region is vital to identifying differences between locales. For example, English is spoken in the United Kingdom and the United States of America, but there are differences in spelling and other language conventions between those two countries. Knowing the locale's region helps JavaScript programmers make sure that the content from their sites and applications is correctly dis
played when viewed from different areas of the world. Examples Setting the region in the locale identifer string argument The region is the third part of a valid Unicode language identifier string, and can be set by adding it to the locale identifier string that is passed into the Locale constructor. The region is a mandatory part of a let regionStr = new Intl.Locale("en-Latn-US"); console.log(regi...
Intl.NumberFormat() constructor - JavaScript
ber with parentheses instead of appending a minus sign. You can enable this formatting by setting the currencySign option to "accounting". The default value is "standard". localeMatcher The locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. notation The formatting that should be dis
played for the number, the defaults is "standard" "standard" plain number formatting "scientific" return the order-of-magnitude for formatted number. "engineering" return the exponent of ten when divisible by three "compact" string representing exponent, defaults is using the "short" form. numberingSystem Numbering System. Possible values include: "arab", "arabext", " bali", "be...
String.prototype.big() - JavaScript
Usage note: The <big> element has been removed in HTML5 and shouldn't be used anymore. Instead web developers should use CSS properties. Syntax str.big() Return value A string containing a <big> HTML element. Description The big() method embeds a string in a <big> tag: "<big>str</big>". ...
<math> - MathML
f Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color. You can use #rgb, #rrggbb and HTML color names. display This enumerated attribute specifies how the enclosed MathML markup should be rendered. It can have one of the following values: block, which means that this element will be dis
played outside the current span of text, as a block that can be positioned anywhere without changing the meaning of the text; inline, which means that this element will be dis
played inside the current span of text, and cannot be moved out of it without changing the meaning of that text. If not present, its default value is inline. mode Deprecated in favor of the display attribute. Possible ...
<mglyph> - MathML
class, id, style Provided for use with stylesheets. height The height of the image. href Used to set a hyperlink to a specified URI. ...
<ms> - MathML
Note that quotation marks should not be specified unless they are part of the string literal. The content of an <ms> element is not an ASCII string per se, but rather a sequence of characters and <mglyph> and <malignmark> elements. Attributes class, id, style Provided for use with stylesheets. dir The text direction. ...
<msqrt> - MathML
The square root accepts only one argument, which leads to the following syntax: <msqrt> base </msqrt>. Attributes class, id, style Provided for use with stylesheets. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color and also the color of the root symbol itself. You can use #rgb, #rrggbb and HTML color names. ...
<mstyle> - MathML
below. Attributes dir Overall directionality of formulas. Possible values are either ltr (left to right) or rtl (right to left). decimalpoint This attribute is specifying the character for the alignment point within <mstack> and <mtable> columns, if the decimalpoint value is used to specify the alignment. displaystyle A Boolean value specifying whether more vertical space is used for dis
played equations or, if set to false, a more compact layout is used to display formulas. The main effect is that larger versions of operators are dis
played, when displaystyle is set to true. See also largeop and movablelimits on <mo>. infixlinebreakstyle Specifies the default linebreakstyle to use for infix operators. The values before, after and duplicate are allowed. scriptlevel Controls mostly th...
<mtable> - MathML
n borders. Multiple values separated by space are allowed and apply to the corresponding columns (e.g. columnlines="none none solid"). Possible values are: none (default), solid and dashed. columnspacing Specifies the space between table columns. Unimplemented columnwidth Specifies the width of table columns. displaystyle A Boolean value specifying whether more vertical space is used for dis
played equations or, if set to false, a more compact layout is used to display formulas. The main effect is that larger versions of operators are dis
played, when displaystyle is set to true. Unimplemented equalcolumns A Boolean value indicating whether to force all columns to have the same total height. false is default. Unimplemented equalrows A Boolean value indicating whether to force all rows to...
Digital audio concepts - Web media technologies
used as the value), or by averaging the amplitude over the duration of each sample. Those sample values are then recorded as the amplitude of the waveform at that time. When it comes time to play back that sound later, these amplitudes are used to generate an approximation of the original waveform; instead of playing back an exact duplicate of the original, smooth wave, the rougher, blue wave is
played. The more often you take samples of the original audio, the closer to the original you can get. The number of samples taken per second is called the sample rate. Consider the wave above, and how much different the blue, digital wave would look if you took samples twice as often. Or ten times as often. The more samples you take, the smoother the wave becomes. Audio data format and structure At ...
Media container formats (file types) - Web media technologies
ored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The video is offered first in WebM format (with the type attribute set to video/webm). If the user agent can't play that, it moves on to the next option, whose type is specified as video/mp4. If neither of those can be
played, the text "This browser does not support the HTML5 video element." is presented. Specifications Specification Comment ETSI 3GPP Defines the 3GP container format ISO/IEC 14496-3 (MPEG-4 Part 3 Audio) Defines MP4 audio including ADTS FLAC Format The FLAC format specification ISO/IEC 11172-1 (MPEG-1 Part 1 Systems) Defines the MPEG-1 ...
Handling media support issues in web content - Web media technologies
ideo's contents. In the case of an action movie, for example, the poster frame might be an iconic exemplar image from one of the film's best-known scenes. A similar concept can be applied to still images; if an image you wish to present is very large and may take time to download (especially for slower devices or connections), you can offer a lower-resolution or alternate version that will be dis
played until the full-quality version is available to be dis
played. We'll look at both of these scenarios and how to implement them. Poster frames for video Progressive images Images--whether embedded using <img> or <picture>--don't support a concept similar to poster frames. However, there are ways to present an image in low quality while it's still loading. This requires creating your images using...
Performance fundamentals - Web Performance
veness sometimes involves multiple stages of feedback. Application launch is one particularly important case discussed in more detail below. Responsiveness is important simply because people get frustrated and angry when they're ignored. Your app is ignoring the user every second that it fails to respond to the user's input. Framerate Framerate is the rate at which the system changes pixels dis
played to the user. This is a familiar concept: everyone prefers, say, games that display 60 frames per second over ones that display 10 frames per second, even if they can't explain why. Framerate is important as a "quality of service" metric. Computer displays are designed to "fool" user's eyes, by delivering photons to them that mimic reality. For example, paper covered with printed text reflects ph...
Navigation and resource timings - Web Performance
owsers. Performance Timings The performanceTiming API, a JavaScript API for measuring the loading performance of the requested page, is deprecated but supported in all browsers. It has been replaced with the performanceNavigationTiming API. The performance timing API provided read only times, in milliseconds(ms), describing at what time each point in the page loading process was reached. ...
Optimizing startup performance - Web Performance
game is in fact still starting up. Data size Do your best to optimize the size of your game data; smaller level files will download and be processed faster than larger ones. Subjective factors Anything you can do to help keep the user engaged during the startup process will help make the time seem to go by faster. For games, consider having background music playing or a nice splash screen dis
played. In between calculations, update your progress indicator, make changes to the display, or anything else you might be able to do to help the user feel like your app is doing something instead of sitting there quietly. ...
How to make PWAs installable - Progressive web apps (PWAs)
e of your web app. short_name: Short name to be shown on the home screen. description: A sentence or two explaining what your app does. icons: A bunch of icon information -- source URLs, sizes, and types. Be sure to include at least a few, so that one that fits best will be chosen for the user's device. start_url: The index document to launch when starting the app. display: How the app is dis
played; can be fullscreen, standalone, minimal-ui, or browser. theme_color: A primary color for the UI, used by operating 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-fiel...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
, options); setTimeout(randomNotification, 30000); } A new random notification is created every 30 seconds until it becomes too annoying and is disabled by the user. (For a real app, the notifications should be much less frequent, and more useful.) The advantage of the Notifications API is that it uses the operating system's notification functionality. This means that notifications can be dis
played to the user even when they are not looking at the web app, and the notifications look similar to ones dis
played by native apps. Push Push is more complicated than notifications -- we need to subscribe to a server that will then send the data back to the app. The app's Service Worker will receive data from the push server, which can then be shown using the notifications system, or another mechan...
The building blocks of responsive design - Progressive web apps (PWAs)
mobile devices a smaller image to download. Mobiles in general (more commonly in some parts of the world than others) are on lower bandwidth connections and have less memory available than desktop devices, so yes, those extra kilobytes really do count. Another challenge is dealing with high resolution screens -- raster graphics designed for low resolutions are in danger of appearing tiny when dis
played on a high resolution screen, so devices often apply a default zoom factor to rendered pages to avoid this. The trouble with this, then, is that raster images are zoomed in and as a result can start to look pixellated. CSS background images For CSS background images this is a fairly easy problem to solve. If you use the mobile first methodology, you will be creating your mobile layout inside you...
Structural overview of progressive web apps - Progressive web apps (PWAs)
design look good on both mobile (with a responsive web design approach) and desktop devices. app.js: The main app JavaScript The file app.js is run when the app is first loaded; its job is primarily to initialize the app, though it c can do other things as well. We'll look at how the app functions more closely in later articles in this guide. The first thing it does is to generate the app's dis
played content using the following template: var template = "<article>\n\ <img src='data/img/SLUG.jpg' alt='NAME'>\n\ <h3>#POS. NAME</h3>\n\ <ul>\n\ <li><span>Author:</span> <strong>AUTHOR</strong></li>\n\ <li><span>Twitter:</span> <a href='https://twitter.com/TWITTER'> @TWITTER</a></li>\n\ <li><span>Website:</span> <a href='http://WEBSITE/'>WEBSITE</a></li>\n\ <li><...
SVG Presentation Attributes - SVG: Scalable Vector Graphics
2 It defines which color profile a raster image included through the <image> element should use. Value: auto|sRGB|linearRGB|<name>|<IRI>|inherit; Animatable: Yes color-rendering It provides a hint to the browser about how to optimize its color interpolation and compositing operations. Value: auto|optimizeSpeed|optimizeQuality|inherit; Animatable: Yes cursor It specifies the mouse cursor dis
played when the mouse pointer is over an element. Value: <FuncIRI>|<keywords>|inherit; Animatable: Yes direction It specifies the base writing direction of text. Value: ltr|rtl|inherit; Animatable: Yes display It allows to control the rendering of graphical or container elements. Value: see css display; Animatable: Yes dominant-baseline It defines the baseline used to align the box's text and i...
cursor - SVG: Scalable Vector Graphics
This attribute behaves exactly like the css cursor property except that if the browser supports the <cursor> element, you should be able to use it with the <funciri> notation. As a presentation attribute, it also can be used as a property directly inside a CSS stylesheet, see css cursor for further information. ...
requiredExtensions - SVG: Scalable Vector Graphics
that white space must be 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 dis
played. It is thus recommended 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"...
systemLanguage - SVG: Scalable Vector Graphics
ge-Tag value, as defined 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 dis
played. It is thus recommended 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 ...
textLength - SVG: Scalable Vector Graphics
298" fill="none" stroke="green" stroke-width="2"/> <text id="hello" x="10" y="150" font-family="sans-serif" font-size="60" fill="green"> Hello world! </text> </svg> First, a <rect> element is used to create and stroke a rectangle to contain the text. Then <text> is used to create the text element itself, with an id of "hello". HTML The HTML is also simple, with only two dis
played elements contained inside a grouping <div>: <div class="controls"> <input type="range" id="widthSlider" min="80" max="978"> <span id="widthDisplay"></span> </div> The <input> element, of type "range", is used to create the slider control the user will manipulate to change the width of the text. A <span> element of ID "widthDisplay" is provided to display the current width value. JavaScript...
<image> - SVG: Scalable Vector Graphics
To include dynamic SVG elements, try <use> with an external URL. To include SVG files and run scripts inside them, try <object> inside of <foreignObject>. ...
SVG documentation index - SVG: Scalable Vector Graphics
e attribute specifies the default scripting language for the given document fragment on the <svg> element. 50 contentStyleType Deprecated, SVG, SVG Attribute The contentStyleType attribute specifies the style sheet language for the given document fragment on the <svg> element. 51 cursor SVG, SVG Attribute The cursor attribute specifies the mouse cursor dis
played when the mouse pointer is over an element. 52 cx SVG, SVG Attribute The cx attribute define the x-axis coordinate of a center point. 53 cy SVG, SVG Attribute The cy attribute define the y-axis coordinate of a center point. 54 d SVG, SVG Attribute The d attribute defines a path to be drawn. 55 data-* Attribute, SVG ...
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
rt, currentView Unimplemented bindings: getIntersectionList, getEnclosureList, checkIntersection, checkEnclosure g Implemented. defs Implemented. desc Implemented. Only stored in the DOM, no user interface. title Implemented. The title is dis
played as a tooltip when the mouse hovers over the SVG object. metadata Implemented. Only stored in the DOM, no user interface. symbol Implemented. use Implemented. Doesn't completely follow <svg:use> cascading rules (bug 265894). Doesn't deliver events to a SVGElementInstance tree (bug 265895)...
Getting started - SVG: Scalable Vector Graphics
be made to the font size and vertical position to ensure the final result is aesthetically pleasing. Basic properties of SVG files The first important thing to notice is the order of rendering elements. The globally valid rule for SVG files is, that later elements are rendered atop previous elements. The further down an element is the more it will be visible. SVG files on the web can be dis
played directly in the browser or embedded in HTML files via several methods: If the HTML is XHTML and is delivered as type application/xhtml+xml, the SVG can be directly embedded in the XML source. If the HTML is HTML5, and the browser is a conforming HTML5 browser, the SVG can also be directly embedded. However, there may be syntax changes necessary to conform to the HTML5 specification. T...
SVG fonts - SVG: Scalable Vector Graphics
nt, corresponds to CSS' src descriptor in @font-face declarations. You can point to external sources for font declarations by means of its children <font-face-name> and <font-face-uri>. The above example states that if the renderer has a local font available named "Super Sans Bold", it should use this instead. Following <font-face-src> is a <missing-glyph> element. This defines what should be dis
played if a certain glyph is not found in the font and if there are no fallback mechanisms. It also shows how glyphs are created: By simply adding any graphical SVG content inside. You can use literally any other SVG elements in here, even <filter>, <a> or <script>. For simple glyphs, however, you can simply add a d attribute -- this defines a shape for the glyph exactly like how standard SVG paths work...
Texts - SVG: Scalable Vector Graphics
s point. The attribute dominant-baseline decides the vertical alignment. Like with the shape elements text can be colorized with the fill attribute and given a stroke with the stroke attribute. Both may also refer to gradients or patterns, which makes simple coloring text in SVG very powerful compared to CSS 2.1. Setting font properties An essential part of a text is the font in which it is dis
played. SVG offers a set of attributes, many similar to their CSS counterparts, to enable font selection. Each of the following properties can be set as an attribute or via a CSS declaration: font-family, font-style, font-weight, font-variant, font-stretch, font-size, font-size-adjust, kerning, letter-spacing, word-spacing and text-decoration. Other text-related elements tspan This element is used to...
How to fix a website with blocked mixed content - Web security
adopted by Internet Explorer (since version 9) and Chrome. This page explains what you should be aware of as a web developer. Your website may break If your website delivers HTTPS pages, all active mixed content delivered via HTTP on this pages will be blocked by default. Consequently, your website may appear broken to users (if iframes or plugins don't load, etc.). Passive mixed content is dis
played by default, but users can set a preference to block this type of content, as well. Note that since mixed content blocking already happens in Chrome and Internet Explorer, it is very likely that if your website works in both of these browsers, it will work equally well in Firefox with mixed content blocking. In any case, the best way to know if something is broken in Firefox is to download the l...