Search completed in 1.11 seconds.
1229 results for "required":
Your results are loading. Please wait...
requiredFeatures - SVG: Scalable Vector Graphics
the requiredfeatures attribute takes a list of feature strings, with the individual strings separated by white space. it determines whether or not all of the named features are supported by the browser; if all of them are supported, the attribute evaluates to true end the element is rendered; otherwise, the attribute evaluates to false and the current element and its children are skipped and thus will not be rendered. this provides a way to design svg that gracefully falls back when features aren't available. if the attribute is not present, then its implicit evaluated value is true. if a null string or empty string value is given to attribute requiredfeatures, the attribute is evaluate to false. requiredfeatures is often used in conjunction with the <switch> element. ...
...kipped and thus will not be rendered. this provides a way to design svg that gracefully falls back when features aren't available. if the attribute is not present, then its implicit evaluated value is true. if a null string or empty string value is given to attribute requiredfeatures, the attribute is evaluate to false. requiredfeatures is often used in conjunction with the <switch> element. if requiredfeatures is used in other situations, it represents a simple switch on the given element whether to render the element or not. to detect availability of an svg feature from script, there is the (also deprecated) domimplementation.hasfeature() method. twentynine elements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <circle>, <clippath>...
...ipse>, <foreignobject>, <g>, <image>, <line>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <set>, <svg>, <switch>, <text>, <textpath>, <tref>, <tspan>, <use> html, body, svg { height: 100%; } text { fill: white; } <svg viewbox="0 0 250 45" xmlns="http://www.w3.org/2000/svg"> <g> <rect fill="forestgreen" x="10" y="10" height="25" width="230" /> <text x="20" y="27">requiredfeatures supported</text> </g> <g requiredfeatures=""> <rect fill="crimson" x="10" y="10" height="25" width="230" /> <text x="20" y="27">requiredfeatures not supported</text> </g> </svg> usage notes value <list-of-features> default value true if not defined, false if null or empty string as value animatable no <list-of-features> this...
...And 28 more matches
HTML attribute: required - HTML: Hypertext Markup Language
if the attribute is not included, the :optional pseudo class will match. the attribute is not supported or relevant to range and color, as both have default values. it is also not supported on hidden as it can not be expected that a user to fill out a form that is hidden. ...
...if the attribute is not included, the :optional pseudo class will match. the attribute is not supported or relevant to range and color, as both have default values. ...
...pseudo class will match. if the attribute is not included, the :optional pseudo class will match. the attribute is not supported or relevant to range and color, as both have default values. it is also not supported on hidden as it can not be expected that a user to fill out a form that is hidden. nor is it supported on any of the button types, including image. ...
...And 9 more matches
Using the aria-required attribute - Accessibility
note that this attribute will not automatically change the presentation of the field. note: opinions may differ on how assistive technology should handle this technique. ...
... note that this attribute will not automatically change the presentation of the field. note: opinions may differ on how assistive technology should handle this technique. ...
... note that this attribute will not automatically change the presentation of the field. note: opinions may differ on how assistive technology should handle this technique. ...
...And 4 more matches
SVGExternalResourcesRequired - Web APIs
the svgexternalresourcesrequired interface defines an interface which applies to all elements where this element or one of its descendants can reference an external resource. ...
...endants can reference an external resource. ...
...ewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/svgexternalresourcesrequired" target="_top"><rect x="1" y="1" width="280" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="141" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgexternalresourcesrequired</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} warning: this interface was removed in the svg 2 specification. ...
...And 3 more matches
externalResourcesRequired - SVG: Scalable Vector Graphics
the externalresourcesrequired attribute specifies whether referenced resources that are not part of the current document are required for proper rendering of the given container or graphics element. this attribute applies to all types of resource references, including style sheets, color profiles and fonts specified by a reference using a <font-face> element or a css @font-face specification. in particular, if an element sets externalresourcesrequired="true", then all style sheets must be available since any style sheet might affect the rendering of that element. the externalresourcesrequired attribute is not inheritable (from a sense of attribute value inheritance), but if set on a container element, its value will apply to all elements within the container. because setting externalresources...
...ular, if an element sets externalresourcesrequired="true", then all style sheets must be available since any style sheet might affect the rendering of that element. the externalresourcesrequired attribute is not inheritable (from a sense of attribute value inheritance), but if set on a container element, its value will apply to all elements within the container. because setting externalresourcesrequired="true" on a container element will have the effect of disabling progressive display of the contents of that container, if that container includes elements that reference external resources, authors should avoid simply setting externalresourcesrequired="true" on the outermost <svg> element on a universal basis. ...
...use setting externalresourcesrequired="true" on a container element will have the effect of disabling progressive display of the contents of that container, if that container includes elements that reference external resources, authors should avoid simply setting externalresourcesrequired="true" on the outermost <svg> element on a universal basis. instead, it is better to specify externalresourcesrequired="true" on those particular graphics elements or container elements which specifically need the availability of external resources in order to render properly. usage notes value false | true default value false animatable no true this value indicates that resources external to the current document are required. if an external resource is not availabl...
...And 2 more matches
402 Payment Required - HTTP
Web › HTTP › Status › 402
the http 402 payment required is a nonstandard client error status response code that is reserved for future use. sometimes, this code indicates that the request can not be processed until the client makes a payment. originally it was created to enable digital cash or (micro) payment systems and would indicate that the requested content is not available until the client makes a payment. however, no standard use convention exists and different entities use it in different contexts. ...
... use. sometimes, this code indicates that the request can not be processed until the client makes a payment. ...
...quest can not be processed until the client makes a payment. originally it was created to enable digital cash or (micro) payment systems and would indicate that the requested content is not available until the client makes a payment. ...
...d indicate that the requested content is not available until the client makes a payment. however, no standard use convention exists and different entities use it in different contexts. ...
407 Proxy Authentication Required - HTTP
Web › HTTP › Status › 407
the http 407 proxy authentication required client error status response code indicates that the request has not been applied because it lacks valid authentication credentials for a proxy server that is between the browser and the server that can access the requested resource. this status is sent with a proxy-authenticate header that contains information on how to authorize correctly. ...
...entication required client error status response code indicates that the request has not been applied because it lacks valid authentication credentials for a proxy server that is between the browser and the server that can access the requested resource. this status is sent with a proxy-authenticate header that contains information on how to authorize correctly. ...
...s that the request has not been applied because it lacks valid authentication credentials for a proxy server that is between the browser and the server that can access the requested resource. this status is sent with a proxy-authenticate header that contains information on how to authorize correctly. ...
...ent with a proxy-authenticate header that contains information on how to authorize correctly. ...
426 Upgrade Required - HTTP
Web › HTTP › Status › 426
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. the server sends an upgrade header with this response to indicate the required protocol(s). ...
... 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. the server sends an upgrade header with this response to indicate the required protocol(s). ...
... 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. the server sends an upgrade header with this response to indicate the required protocol(s). ...
.... the server sends an upgrade header with this response to indicate the required protocol(s). ...
requiredExtensions - SVG: Scalable Vector Graphics
determines whether all of the named extensions are supported by the user agent. ...
...ons are capabilities within a user agent that go beyond the feature set defined in this specification. each extension is identified by an url reference. usage notes value <list-of-extensions> default value none animatable no <list-of-extensions> the value is a list of references (iri references in svg 1, url references in svg 2) which identify the required extensions, with the individual values separated by white space. determines whether all of the named extensions are supported by the user agent. if all of the given extensions are supported, then the attribute evaluates to true; otherwise, the current element and its children are skipped and thus will not be rendered. note: if a given extension reference contains white space within itself, that...
...l values separated by white space. determines whether all of the named extensions are supported by the user agent. if all of the given extensions are supported, then the attribute evaluates to true; otherwise, the current element and its children are skipped and thus will not be rendered. note: if a given extension reference contains white space within itself, that white space must be escaped. requiredextensions is often used in conjunction with the <switch> element. if the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. note: if several extension reference objects are enclosed in a <switch> and none of them matches, this may lead to situations where no content is displayed. it is thus recommended to include a...
...empty string value is given, the attribute evaluates to "false". the iri names for the extension should include versioning information, such as "http://example.org/svgextensionxyz/1.0", so that script writers can distinguish between different versions of a given extension. specifications specification status comment scalable vector graphics (svg) 2the definition of 'requiredextensions' in that specification. candidate recommendation iris replaced with urls scalable vector graphics (svg) 1.1 (second edition)the definition of 'requiredextensions' in that specification. recommendation initial definition ...
JSObjectOps.getRequiredSlot
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. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. ...
...h it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.getrequiredslot and setrequiredslot callbacks get and set a required slot—one that should already have been allocated. syntax typedef jsval (*jsgetrequiredslotop)(jscontext *cx, jsobject *obj, uint32 slot); typedef jsbool (*jssetrequiredslotop)(jscontext *cx, jsobject *obj, uint32 slot, jsval v); name type description cx jscontext * the js context in which we access the slot. ...
...ool (*jssetrequiredslotop)(jscontext *cx, jsobject *obj, uint32 slot, jsval v); name type description cx jscontext * the js context in which we access the slot. obj jsobject * the object whose slot we access. slot uint32 the index of the slot to access. see note below. v jsval the value to store in the slot, for jssetrequiredslotop. description get and set a required slot, one that should already have been allocated. these operations are infallible, so required slots must be pre-allocated, or implementations must suppress out-of-memory errors. the native ops (js_objectops, see js/src/jsobj.cpp) access slots reserved by including a call to the jsclass_has_reserved_slots(n) macro in the jsclass.flags initializer...
XRPermissionDescriptor.requiredFeatures - Web APIs
the xrpermissiondescriptor dictionary's requiredfeatures property should be set prior to calling navigator.permissions.query() to a list of webxr features which must be supported for the app to work. this ensures that permissions are checked as applicable to ensure that those features are available upon request. syntax xrpermissiondescriptor = { mode: xrsessionmode, requiredfeatures: reqfeaturelist, optionalfeatures: optfeaturelist }; xrpermissiondescriptor.requiredfeatures = reqfeaturelist; reqfeaturelist = xrpermissiondescriptor.requiredfeatures; value an array of strings indicating the webxr features which must be available for use by the app or site. the permissions check will be performed in such a manner as to verify that all features in the list are available for use with t...
...nce space types will be used more often. xrreferencespace usage notes examples in this example, permissions are checked to ensure that the user has granted permission for the site or app to use immersive augmented reality mode with the local-floor reference space (presumably since the user is unlikely to start to fly). ...
... working draft initial definition. ...
:required - CSS: Cascading Style Sheets
Web › CSS › :required
the :required css pseudo-class represents any <input>, <select>, or <textarea> element that has the required attribute set on it. /* selects any required <input> */ input:required { border: 1px dashed red; } this pseudo-class is useful for highlighting fields that must have valid data before a form can be submitted. note: the :optional pseudo-class selects optional form fields. syntax :required examples see :invalid for an example. accessibility concerns mandatory <input>s should have the required attribute applied to them. this will ensure that people navigating with the aid of assistive technology such as a screen reader will be able to understand which inputs need valid content to ensure a successful submission. ...
...typically, descriptive text and/or an icon are used. ...
... inputs should be indicated visually using a treatment that does not rely solely on color to convey meaning. typically, descriptive text and/or an icon are used. mdn understanding wcag, guideline 3.3 explanations understanding success criterion 3.3.2 | w3c understanding wcag 2.0 specifications specification status comment html living standardthe definition of ':required' in that specification. living standard no change. html5the definition of ':required' in that specification. recommendation defines the semantics of html and constraint validation. selectors level 4the definition of ':required' in that specification. working draft no change. ...
411 Length Required - HTTP
Web › HTTP › Status › 411
the hypertext transfer protocol (http) 411 length required client error response code indicates that the server refuses to accept the request without a defined content-length header. note: by specification, when sending data in a series of chunks, the content-length header is omitted and at the beginning of each chunk you need to add the length of the current chunk in hexadecimal format. see transfer-encoding for more details. ...
...ired client error response code indicates that the server refuses to accept the request without a defined content-length header. ...
...d content-length header. ...
428 Precondition Required - HTTP
Web › HTTP › Status › 428
the http 428 precondition required response status code indicates that the server requires the request to be conditional. typically, this means that a required precondition header, such as if-match, is missing. when a precondition header is not matching the server side state, the response should be 412 precondition failed. ...
... the http 428 precondition required response status code indicates that the server requires the request to be conditional. typically, this means that a required precondition header, such as if-match, is missing. when a precondition header is not matching the server side state, the response should be 412 precondition failed. ...
...dicates that the server requires the request to be conditional. typically, this means that a required precondition header, such as if-match, is missing. when a precondition header is not matching the server side state, the response should be 412 precondition failed. ...
511 Network Authentication Required - HTTP
Web › HTTP › Status › 511
the http 511 network authentication required response status code indicates that the client needs to authenticate to gain network access. this status is not generated by origin servers, but by intercepting proxies that control access to the network. network operators sometimes require some authentication, acceptance of terms, or other user interaction before granting access (for example in an internet café or at an airport). they often identify clients who have not done so using their media access control (mac) addresses. ...
... by origin servers, but by intercepting proxies that control access to the network. ...
...quire some authentication, acceptance of terms, or other user interaction before granting access (for example in an internet café or at an airport). ...
mozbrowserusernameandpasswordrequired
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the mozbrowserusernameandpasswordrequired event is fired when the content within a browser <iframe> requires an http authentification. the embedder is supposed to retrieve the necessary credentials, usually using a dialog or a database of username/passwords, and then call authenticate() or cancel() as appropriate. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type descriptio...
... is a proxy server (true) or not (false). authenticate() a function that is called to enable the authentication to go ahead. it needs to take two parameters — the username and password to authenticate. cancel() a function that is called to cancel the authentication. ...
UI pseudo-classes - Learn web development
a keyboard activation). these basic pseudo-classes should be familiar to you now. more recently, the css selector level 3 and css basic ui level 3 added more pseudo-classes related to html forms that provide several other useful targetting conditions that you can take advantage of. we'll discuss these in more detail in the sections below, but briefly, the main ones we'll be looking at are: :required and :optional: targets required or optional form controls. :valid and :invalid, and :in-range and :out-of-range: target form controls that are valid/invalid according to form validation constraints set on them, or in-range/out-of-range. :enabled and :disabled, and :read-only and :read-write: target enabled or disabled form controls (e.g. with the disabled html attribute set), and read-write or ...
...asses discussed here are concerned with styling form controls based on their validation state (is their data valid, or not?) you'll learn much more about setting and controlling validation constraints in our next article — client-side form validation — but for now we'll keep things simple with regards to form validation, so it doesn't confuse things. styling inputs based on whether they are required or not one of the most basic concepts with regards to client-side form validation is whether a form input is required (it has to be filled in before the form can be submitted) or optional. <input>, <select>, and <textarea> elements have a required attribute available which, when set, means that you have to fill in that control before the form will successfully submit. for example: <form> <fi...
...re the form can be submitted) or optional. <input>, <select>, and <textarea> elements have a required attribute available which, when set, means that you have to fill in that control before the form will successfully submit. ...
...And 25 more matches
Index
module conforming to the pkcs#11 standard implements an interface of c calls, which allow querying the characteristics and offered services of the module. multiple elements of nss's own modules have been implemented with this interface, and nss makes use of this interface when talking to those modules. this strategy allows nss to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software modules (e.g., to allow to load such modules as a plugin that provides additional algorithms or stores key or trust information) that implement the pkcs#11 interface. a core element of nss is freebl, a base library providing hash functions, big number calculations, and cryptographic algorithm...
...ates”), which also implements the pkcs#11 interface. on an organizational level the contents of the set are managed according to the mozilla ca policy. on a technical level the set is a binary software module. a cryptographic transaction, such as encryption or decryption related to a data exchange, usually involves working with the x.509 certs of your communication partners (peer). it's also required that you safely keep your own secret keys that belong to your own certificates. you might want to protect the storage of your secret keys with pbe. you might decide to modify the default trust provided by nss. all of this requires storing, looking up, and retrieving data. nss simplifies performing these operations by offering storage and management apis. nss doesn't require the programmer to mana...
...s#11 modules that have been registered to be used by nss. the file could be named secmod.db, but in newer database generations a file named pkcs11.txt is used. only nss is allowed to access and manipulate these database files directly; a programmer using nss must go through the apis offered by nss to manipulate the data stored in these files. the programmer's task is to initialize nss with the required parameters (such as a database), and nss will then transparently manage the database files. most of the time certificates and keys are supposed to be stored in the nss database. therefore, after initial import or creation, the programmer usually doesn't deal with their raw bytes. instead, the programmer will use lookup functions, and nss will provide an access handle that will be subsequently ...
...And 25 more matches
Client-side form validation - Learn web development
this is called client-side form validation, and helps ensure data submitted matches the requirements set forth in the various form controls. this article leads you through basic concepts and examples of client-side form validation. prerequisites: computer literacy, a reasonable understanding of html, css, and javascript. objective: to understand what client-side form validation is, why it's important, and how to apply various techniques to implement it. ...
... website security for an idea of what could happen; implementing server-side validation is somewhat beyond the scope of this module, but you should bear it in mind. what is form validation? go to any popular site with a registration form, and you will notice that they provide feedback when you don't enter your data in the format they are expecting. you'll get messages such as: "this field is required" (you can't leave this field blank). "please enter your phone number in the format xxx-xxxx" (a specific data format is required for it to be considered valid). "please enter a valid email address" (the data you entered is not in the right format). "your password needs to be between 8 and 30 characters long and contain one uppercase letter, one symbol, and a number." (a very specific data form...
... this is called form validation. when you enter data, the browser and/or the web server will check to see that the data is in the correct format and within the constraints set by the application. ...
...And 21 more matches
Index - Web APIs
Web › API › Index
signal read-only property of the abortcontroller interface returns an abortsignal object instance, which can be used to communicate with/abort a dom request as desired. 10 abortsignal api, abortsignal, dom, experimental, interface, reference the abortsignal interface represents a signal object that allows you to communicate with a dom request (such as a fetch) and abort it if required via an abortcontroller object. 11 abortsignal.aborted api, abortsignal, experimental, property, reference, aborted the aborted read-only property returns a boolean that indicates whether the dom request(s) the signal is communicating with is/are aborted (true) or not (false). 12 abortsignal.onabort api, abortsignal, event handler, experimental, fetch, property,...
... kind: some text or some file. 806 datatransferitem.type api, datatransferitem, html dom, html drag and drop api, property, reference, type, drag and drop the read-only datatransferitem.type property returns the type (format) of the datatransferitem object representing the drag data item. the type is a unicode string generally given by a mime type, although a mime type is not required. 807 datatransferitem.webkitgetasentry() api, datatransferitem, file system api, file and directory entries api, files, method, non-standard, offline, reference, drag and drop, getasentry if the item described by the datatransferitem is a file, webkitgetasentry() returns a filesystemfileentry or filesystemdirectoryentry representing it. if the item isn't a file, null is retur...
...() api, dom, method, obsolete, reference returns a boxobject (x, y, width, height) for a specified element. 919 document.getelementbyid() api, dom, document, elements, method, reference, web, getelementbyid, id the document method getelementbyid() returns an element object representing the element whose id property matches the specified string. since element ids are required to be unique if specified, they're a useful way to get access to a specific element quickly. 920 document.getelementsbyclassname() api, dom, dom element methods, gecko, html5, method, reference returns an array-like object of all child elements which have all of the given class names. 921 document.getelementsbyname() api, dom, document, html, method, reference ...
...And 13 more matches
JavaScript Daemons Management - Archive of obsolete content
-1 : 1; var bbreak = odmn.task.call(odmn.owner, odmn.index, odmn.length, odmn.backw) === false, bend = odmn.isatend(), binvert = odmn.reversals > 0; if (bend && !binvert || bbreak) { odmn.pause(); return false; } if (bend && binvert) { odmn.backw...
...you could safely remove all or some of them, * depending on your needs. if you want to remove them and are using the daemon.safe subsystem you * should also remove the daemon.safe global object methods that require them. **/ daemon.construct = function (aargs) { var odmn = new this.blank(); ...
...is(octx, octx.perform, nrate || null, nlen || null, octx.create || null, octx.prepare || null); }; /* warning! calling daemon.incorporate(@func) will modify the @func.prototype property! ...
...And 12 more matches
Codecs used by WebRTC - Web media technologies
the webrtc api makes it possible to construct web sites and apps that let users communicate in real time, using audio and/or video as well as optional data and other information. to communicate, the two devices need to be able to agree upon a mutually-understood codec for each track so they can successfully communicate and present the shared media. this guide reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers support for webrtc. containerless media webrtc uses bare mediastreamtrack objects for each track being shared from one peer to another, without a container or even a mediastream associated with the tracks. which codecs can be within those tracks is not mandated by the webrtc specification. however, rfc 7742 specifies that all webrtc...
...tc-compatible browsers must support vp8 and h.264's constrained baseline profile for video, and rfc 7874 specifies that browsers must support at least the opus codec as well as g.711's pcma and pcmu formats. these two rfcs also lay out options that must be supported for each codec, as well as specific user comfort features such as echo cancelation. this guide reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers support for webrtc. while compression is always a necessity when dealing with media on the web, it's of additional importance when videoconferencing in order to ensure that the participants are able to communicate without lag or interruptions. of secondary importance is the need to keep the video and audio synchronized, so that the m...
... pixels tall. it's encouraged that video be encoded at a frame rate and size no lower than that, since that's essentially the lower bound of what webrtc generally is expected to handle. sdp supports a codec-independent way to specify preferred video resolutions (rfc 6236. this is done by sending an a=imageattr sdp attribute to indicate the maximum resolution that is acceptable. the sender is not required to support this mechanism, however, so you have to be prepared to receive media at a different resolution than you requested. beyond this simple maximum resolution request, specific codecs may offer further ways to ask for specific media configurations. supported video codecs webrtc establishes a baseline set of codecs which all compliant browsers are required to support. some browsers may choo...
...And 12 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Web › HTML › Element › input
hose types' pages. this element includes the global attributes. those with extra importance as it relates to <input> are highlighted. attributes for the <input> element include global html attributes and: attribute type or types description accept file hint for expected file type in file upload controls alt image alt attribute for the image type. ...
...le values name all name of the form control. submitted with the form as part of a name/value pair. pattern password, text, tel pattern the value must match to be valid placeholder password, search, tel, text, url text that appears in the form control when it has no value set readonly almost all boolean. the value is not editable required almost all boolean. a value is required or must be check for the form to be submittable size email, password, tel, text size of the control src image same as src attribute for <img>; address of image resource step numeric types incremental values that are valid. type all type of form control value all current value o...
...isabled a boolean attribute which, if present, indicates that the user should not be able to interact with the input. disabled inputs are typically rendered with a dimmer color or using some other form of indication that the field is not available for use. specifically, disabled inputs do not receive the click event, and disabled inputs are not submitted with the form. note: although not required by the specification, firefox will by default persist the dynamic disabled state of an <input> across page loads. use the autocomplete attribute to control this feature. form a string specifying the <form> element with which the input is associated (that is, its form owner). this string's value, if present, must match the id of a <form> element in the same document. if this attribute isn'...
...And 11 more matches
StringView - Archive of obsolete content
encoding). bufferview read only arraybufferview an arraybufferview containing the representation of the whole buffer as array of 8-bit, 16-bit, or 32-bit integers (depending on the chosen encoding). constructor syntax new stringview(input[, encoding[, startoffset[, length]]]) description create a new string-like object based upon an arraybuffer. arguments input (required) the argument the stringview is constructed from. it can be: another stringview a string a number an arraybuffer a typed array of uint8array, uint16array, or uint32array subclass any other kind of ordered object (like arrays, collections, etc.) if it is a number it will become the length of the new stringview; otherwise it will become its content. the following table shows the b...
...w1, "utf-16"); alert(mystringview1.buffer.bytelength); // 12 alert(mystringview2.buffer.bytelength); // 24 stringview constructor's methods makefrombase64() syntax stringview.makefrombase64(base64string[, encoding][, byteoffset][, length]) description returns a new instance of stringview constructed decoding a given base64-encoded string. arguments base64string (required) a base64-encoded string which will be decoded and copied into the new stringview object. encoding optional a string expressing the encoding type. for possible values see here. byteoffset optional a number expressing the start offset in bytes of the new stringview. if not specified (or specified as null) it will be considered as 0. length optional a number expressing the leng...
.... if characterslength is 0 or negative, substr returns an empty string. if characterslength is omitted, substr extracts characters to the end of the string. foreachchar() syntax stringview.foreachchar(callback[, thisobject[, characteroffset[, characterslength]]]) description repeatedly invokes a function for each character of the stringview. arguments callback (required) a function to be invoked for each character. it will be called with four arguments, expressing respectively: charcode a number expressing the unicode representation of the actual character (codepoint). characteroffset a number expressing the position, in codepoints, of the passed character. rawoffset a number expressing the position, in codepoints parts, of the pas...
...And 10 more matches
sslfnc.html
n ssl export policy functions must also be called during nss initialization. nss_init nss_initreadwrite nss_nodb_init ssl_optionsetdefault ssl_optiongetdefault ssl_cipherprefsetdefault ssl_cipherprefgetdefault ssl_clearsessioncache ssl_configserversessionidcache ssl_configmpserversidcache ssl_inheritmpserversidcache nss_init sets up configuration files and performs other tasks required to run network security services. database files are opened read-only. syntax #include "nss.h" secstatus nss_init(char *configdir); parameter this function has the following parameter: configdir a pointer to a string containing the pathname of the directory where the certificate, key, and security module databases reside. returns the funct...
...mestic, international, and french versions of software products with encryption features. ssl_cipherpolicyset sets policy flags for individual cipher suites, one at a time. this may be helpful if you have an export license that permits more or fewer capabilities than those allowed by the other export policy functions. nss_initreadwrite sets up configuration files and performs other tasks required to run network security services. unlike nss_init, nss_initreadwrite provides both read and write access to database files. syntax #include "nss.h" secstatus nss_initreadwrite(char *configdir); parameter this function has the following parameter: configdir a pointer to a string containing the pathname of the directory where the certificate, key, and secur...
...mime operations. before calling nss_initreadwrite, your program must call pr_init. the policy flags for all cipher suites are turned off by default, disallowing all cipher suites. therefore, an application cannot use nss to perform any cryptographic operations until after it enables appropriate cipher suites by calling one of the ssl export policy functions. nss_nodb_init performs tasks required to run network security services without setting up configuration files. important: this nss function is not intended for use with ssl, which requires that the certificate and key database files be opened. syntax #include "nss.h" secstatus nss_nodb_init(char *reserved); parameter this function has the following parameter: reserved should be null.. ...
...And 9 more matches
How to structure a web form - Learn web development
/form> note: you can find this example in checkbox-label.html (see it live also). multiple labels strictly speaking, you can put multiple labels on a single widget, but this is not a good idea as some assistive technologies can have trouble handling them. in the case of multiple labels, you should nest a widget and its labels inside a single <label> element. ...
...heckbox-label.html (see it live also). multiple labels strictly speaking, you can put multiple labels on a single widget, but this is not a good idea as some assistive technologies can have trouble handling them. in the case of multiple labels, you should nest a widget and its labels inside a single <label> element. ...
...ologies can have trouble handling them. in the case of multiple labels, you should nest a widget and its labels inside a single <label> element. ...
...And 8 more matches
HTTP Index - HTTP
Web › HTTP › Index
troubleshooting simply put, the origin making the request does not match any of the origins permitted by the access-control-allow-origin header. ...
...all cors requests must have an origin header. 26 reason: cors preflight channel did not succeed cors, corspreflightdidnotsucceed, cross-origin, error, http, https, messages, reasons, security, console, troubleshooting the cors request requires preflight, preflighting could not be performed. ...
...nd a proxy server. it authenticates the request to the proxy server, allowing it to transmit the request further. 170 proxy-authorization http, http header, reference, request header, header the http proxy-authorization request header contains the credentials to authenticate a user agent to a proxy server, usually after the server has responded with a 407 proxy authentication required status and the proxy-authenticate header. 171 public-key-pins hpkp, http, reference, security, header the http public-key-pins response header associates a specific cryptographic public key with a certain web server to decrease the risk of mitm attacks with forged certificates. if one or several keys are pinned and none of them are used by the server, the browser will not acc...
...And 8 more matches
Index - Archive of obsolete content
nd summary 1 archive of obsolete content archive, landing here at mdn, we try to avoid outright deleting content that might be useful to people targeting legacy platforms, operating systems, and browsers. perhaps your target audience is people that are using older hardware, for example, and can't upgrade to the latest and greatest browsers. or for "reasons," your company is required to use very old software and you need to build web content that runs on that software. or perhaps you're just curious about the history of an obsolete feature or api, and how it worked. 2 .htaccess ( hypertext access ) 301 redirect, cache control, custom error pages, htaccess, permanent redirect, redirect file accessing : htaccess files can be opened using any text editor, li...
...fx --force-mobile. enables you to run and test add-ons for firefox mobile (aka fennec). 139 jpmignore jpm no summary! 140 package.json commonjs, jpm, sdk, add-on, package.json the package.json file contains manifest data for your add-on, providing not only descriptive information about the add-on for presentation in the add-ons manager, but other metadata required of add-ons. 141 tutorials add-on sdk no summary! 142 add a context menu item add-on sdk, firefox, guide no summary! 143 add a menu item to firefox add-on sdk no summary! 144 adding a button to the toolbar add-on sdk no summary! 145 annotator add-on sdk no summary! 146 creating annot...
...ns didn't work to build on osx 10.6.7. 455 layout faq needsupdate no summary! 456 layout system overview gecko layout is primarily concerned with providing a presentation to an html or xml document. this presentation is typically formatted in accordance with the requirements of the css1 and css2 specifications from the w3c. presentation formatting is also required to provide compatibility with legacy browsers (microsoft internet explorer and netscape navigator 4.x). the decision about when to apply css-specified 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 doct...
...And 7 more matches
Elements - Archive of obsolete content
a xbl binding can add anonymous content, fields, properties, methods, and event handlers to html/xml elements. a single xbl binding can be attached to an element by using style sheets or by sc...
...-8,%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3cbindings%20id%3d%22xbltestbindings%22%20xmlns%3d%22http%3a//www.mozilla.org/xbl%22%3e%0a%20%20%3cbinding%20id%3d%22xbltest%22%3e%3ccontent%3epass%3c/content%3e%3c/binding%3e%0a%3c/bindings%3e%0a); } since data: urls don't support fragment identifiers, the first binding found in the embedded xml is used instead. keep in mind that the binding is still required to have an id even though you're not referencing it. in addition, data: urls are only supported from chrome code (in other words, from the application or an extension). note: the normal same-origin policy is used for web sites; they can only link to xbl files on the same domain, or within the chrome. for clarity's sake, here's what the embedded xml in the previous example looks like: <?xml ver...
...l be blocked, but the anonymous content and styling will be still used. given that the css declarations should be always used - unless you need to add bindings at runtime to individual elements. a binding element may contain a resources tag, a content tag, a implementation tag and a handlers tag. id - the id attribute is a document-unique identifier. for the binding element, this attribute is required, since it is used to attach 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 ...
...And 7 more matches
An overview of NSS Internals
module conforming to the pkcs#11 standard implements an interface of c calls, which allow querying the characteristics and offered services of the module. multiple elements of nss's own modules have been implemented with this interface, and nss makes use of this interface when talking to those modules. this strategy allows nss to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software modules (e.g., to allow to load such modules as a plugin that provides additional algorithms or stores key or trust information) that implement the pkcs#11 interface. a core element of nss is freebl, a base library providing hash functions, big number calculations, and cryptographic algorithm...
...ates”), which also implements the pkcs#11 interface. on an organizational level the contents of the set are managed according to the mozilla ca policy. on a technical level the set is a binary software module. a cryptographic transaction, such as encryption or decryption related to a data exchange, usually involves working with the x.509 certs of your communication partners (peer). it's also required that you safely keep your own secret keys that belong to your own certificates. you might want to protect the storage of your secret keys with pbe. you might decide to modify the default trust provided by nss. all of this requires storing, looking up, and retrieving data. nss simplifies performing these operations by offering storage and management apis. nss doesn't require the programmer to mana...
...s#11 modules that have been registered to be used by nss. the file could be named secmod.db, but in newer database generations a file named pkcs11.txt is used. only nss is allowed to access and manipulate these database files directly; a programmer using nss must go through the apis offered by nss to manipulate the data stored in these files. the programmer's task is to initialize nss with the required parameters (such as a database), and nss will then transparently manage the database files. most of the time certificates and keys are supposed to be stored in the nss database. therefore, after initial import or creation, the programmer usually doesn't deal with their raw bytes. instead, the programmer will use lookup functions, and nss will provide an access handle that will be subsequently ...
...And 7 more matches
WAI-ARIA basics - Learn web development
t is going on. here we'll show how to use it at a basic level to improve accessiblity. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript, an understanding of the previous articles in the course. objective: to gain familiarity with wai-aria, and how it can be used to provide useful additional semantics to enhance accessibility where required. what is wai-aria? let's start by looking at what wai-aria is, and what it can do for us. a whole new set of problems as web apps started to get more complex and dynamic, a new set of accessibility features and problems started to appear. for example, html5 introduced a number of semantic elements to define common page features (<nav>, <footer>, etc.) before these were available, devel...
...f html5 structural elements e.g. role="navigation" (<nav>) or role="complementary" (<aside>), but there are also others that describe different pages structures, such as role="banner", role="search", role="tabgroup", role="tab", etc., which are commonly found in uis. properties — these define properties of elements, which can be used to give them extra meaning or semantics. as an example, aria-required="true" specifies that a form input needs to be filled in to be valid, whereas aria-labelledby="label" allows you to put an id on an element, then reference it as being the label for anything else on the page, including multiple elements, which is not possible using <label for="input">. as an example, you could use aria-labelledby to specify that a key description contained in a <div> is the label...
...is used to create a complex ui-feature, or a native control is greatly enhanced/changed via javascript, accessibility can suffer — screenreader users will find it difficult to work out what the feature does if there are no semantics or other clues. in these situations, aria can help to provide what's missing with a combination of roles like button, listbox, or tabgroup, and properties like aria-required or aria-posinset to provide further clues as to functionality. one thing to remember though — you should only use wai-aria when you need to! ideally, you should always use native html features to provide the semantics required by screenreaders to tell their users what is going on. sometimes this isn't possible, either because you have limited control over the code, or because you are creating...
...And 6 more matches
<input type="email"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › email
alue of the field is a valid e-mail address or not. on browsers that don't support inputs of type email, a email input falls back to being a standard text input. value a domstring representing an e-mail address, or empty events change and input supported common attributes autocomplete, list, maxlength, minlength, multiple, name,pattern, placeholder, readonly, required, size, and type idl attributes list and value methods select() value the <input> element's value attribute contains a domstring which is automatically validated as conforming to e-mail syntax. more specifically, there are three possible value formats that will pass validation: an empty string ("") indicating that the user did not enter a value or that the value ...
...g. constraint validation is only applied when the value is changed by the user. multiple a boolean attribute which, if present, indicates that the user can enter a list of multiple e-mail addresses, separated by commas and, optionally, whitespace characters. see allowing multiple e-mail addresses for an example, or html attribute: multiple for more details. note: normally, if you specify the required attribute, the user must enter a valid e-mail address for the field to be considered valid. however, if you add the multiple attribute, a list of zero e-mail addresses (an empty string, or one which is entirely whitespace) is a valid value. in other words, the user does not have to enter even one e-mail address when multiple is specified, regardless of the value of required. pattern the patter...
...ted technical issues with your content. see labels and placeholders in <input>: the input (form input) element for more information. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or...
...And 6 more matches
<input type="text"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › text
ithub repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. value a domstring representing the text contained in the text field. events change and input supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size idl attributes list, value methods select(), setrangetext() and setselectionrange(). value the value attribute is a domstring that contains the current value of the text entered into the text field. you can retrieve this using the value property in javascript. let thetext = mytextinput.value; if no validation constraints are in place for the input (see ...
...ted technical issues with your content. see labels and placeholders in <input>: the input (form input) element for more information. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or...
...sition: absolute; content: '✖'; padding-left: 5px; } input:valid+span:after { position: absolute; content: '✓'; padding-left: 5px; } the technique also requires a <span> element to be placed after the form element, which acts as a holder for the icons. this was necessary because some input types on some browsers don't display icons placed directly after them very well. ...
...And 6 more matches
Install script template - Archive of obsolete content
var plid = "@myplugin.com/myplugin,version=5.3"; var version = "5.3.0.0"; var mimetype = "application/x-my-plugin"; var suffix = "my...
... var plid = "@myplugin.com/myplugin,version=5.3"; var version = "5.3.0.0"; var mimetype = "application/x-my-plugin"; var suffix = "my"; var suffix_description = "my plugin files"; var company_name = "mypluginco"; var plugin_description = "...
... write to the registry. errorcode="+hkcu_status); return hkcu_status; } } return 0; } /** * function for preinstallation of plugin (firstinstall). * you should not stop the install process because the function failed, * you still have a chance to install the plugin for the already * installed gecko browsers. ...
...And 5 more matches
Creating our first Vue component - Learn web development
state that affects their display. registering props in vue, there are two ways to register props: the first way is to just list props out as an array of strings. each entry in the array corresponds to the name of a prop. the second way is to define props as an object, with each key corresponding to the prop name. listing props as an object allows you to specify default values, mark props as required, perform basic object typing (specifically around javascript primitive types), and perform simple prop validation. note: prop validation only happens in development mode, so you can't strictly rely on it in production. additionally, prop validation functions are invoked before the component instance is created, so they do not have access to the component state (or other props). for this comp...
...se the object registration method. go back to your todoitem.vue file. add a props property inside the export default {} object, which contains an empty object. inside this object, add two properties with the keys label and done. the label key's value should be an object with 2 properties (or props, as they are called in the context of being available to the components). the first is a required property, which will have a value of true. this will tell vue that we expect every instance of this component to have a label field. vue will warn us if a todoitem component does not have a label field. the second property we'll add is a type property. set the value for this property as the javascript string type (note the capital "s"). this tells vue that we expect the value of this property ...
...operty. set the value for this property as the javascript string type (note the capital "s"). this tells vue that we expect the value of this property to be a string. now on to the done prop. first add a default field, with a value of false. ...
...And 5 more matches
sslintro.html
initialization initialization includes setting up configuration files, setting global defaults, and setting up callback functions. functions used in the initialization part of an application can include the following: pr_init. initializes nspr. must be called before any other nss functions. pk11_setpasswordfunc. sets the global callback function to obtain passwords for pkcs #11 modules. required. nss_init. sets up configuration files and performs other tasks required to run network security services. nss_init is not idempotent, so call it only once. required. ssl_optionsetdefault. changes default values for all subsequently opened sockets as long as the application is running (compare with ssl_seturl which only configures the socket that is currently open). this function must be ca...
...te and configure a server cache, using either ssl_configserversessionidcache or ssl_configmpserversidcache. the server cache is used for all sessions where the program handshakes as an ssl server. ssl_clearsessioncache. clears all sessions from the client session cache. optional. ssl_configserversessionidcache. sets up parameters for a server session cache for a single-process application. required for single-process server applications. ssl_configmpserversidcache. sets up parameters for a server cache for a multi-process application. required for multi-process server applications. you can use either this function or ssl_configserversessionidcache, not both. configuration the configuration portion of an ssl-enabled application typically begins by opening a new socket and then import...
...brings an ordinary nspr socket into the ssl library, returning a new nspr socket that can be used to make ssl calls. ...
...And 5 more matches
Alerts - Accessibility
the problem you have a form — a contact form, for example — that you want to put some accessible error checking into. examples of common problems include e-mail addresses which are not valid, or a name field which does not contain at least a first name or a surname. the form first, please read about the aria-required technique if you have not done so, as this technique expands upon that. ...
...ddresses which are not valid, or a name field which does not contain at least a first name or a surname. the form first, please read about the aria-required technique if you have not done so, as this technique expands upon that. ...
...ot contain at least a first name or a surname. the form first, please read about the aria-required technique if you have not done so, as this technique expands upon that. ...
...And 5 more matches
<input type="number"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › number
ted technical issues with your content. see labels and placeholders in <input>: the input (form input) element for more information. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below. only values which are equal to the basis for stepping (min if specified, value otherwise, and an appropriate default value if neither of those is provided) are valid.
...ng screenshot is taken from firefox for android: a simple number input in its most basic form, a number input can be implemented like this: <label for="ticketnum">number of tickets you would like to buy:</label> <input id="ticketnum" type="number" name="ticketnum" value="0"> a number input is considered valid when empty and when a single number is entered, but is otherwise invalid. if the required attribute is used, the input is no longer considered valid when empty. note: any number is an acceptable value, as long as it is a valid floating point number (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 <...
...value="12999922"> </datalist> use of the list attribute with number inputs is not supported in all browsers. it works in chrome and opera, for example, but not in firefox. validation we have already mentioned a number of validation features of number inputs, but let's review them now: <input type="number"> elements automatically invalidate any entry that isn't a number (or empty, unless required is specified). you can use the required attribute to make an empty entry invalid. (in other words, the input must be filled in.) you can use the step attribute to constrain valid values to a certain set of steps (e.g., multiples of 10). you can use the min and max attributes to constrain valid values to lower and upper bounds. the following example exhibits all of the above features, as well...
...And 5 more matches
<input type="search"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › search
in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. value a domstring representing the value contained in the search field. events change and input supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, required, size. idl attributes value methods select(), setrangetext(), setselectionrange(). value the value attribute contains a domstring representing the value contained in the search field. you can retrieve this using the htmlinputelement.value property in javascript. searchterms = mysearch.value; if no validation constraints are in place for the input (see validation...
...ted technical issues with your content. see labels and placeholders in <input>: the input (form input) element for more information. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or...
... padding-left: 5px; position: absolute; } input:valid ~ span:after { content: '✓'; padding-left: 5px; position: absolute; } the technique also requires a <span> element to be placed after the form element, which acts as a holder for the icons. this was necessary because some input types on some browsers don't display icons placed directly after them very well. ...
...And 5 more matches
<input type="tel"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › tel
ted technical issues with your content. see labels and placeholders in <input>: the input (form input) element for more information. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or...
...pass the validation, or to remove it entirely. it's also possible for someone to simply bypass your html entirely and submit the data directly to your server. if your server-side code fails to validate the data it receives, disaster could strike when improperly-formatted data (or data which is too large, is of the wrong type, and so forth) is entered into your database. ...
...tirely and submit the data directly to your server. if your server-side code fails to validate the data it receives, disaster could strike when improperly-formatted data (or data which is too large, is of the wrong type, and so forth) is entered into your database. making telephone numbers required you can make it so that an empty input is invalid and won't be submitted to the server using the required attribute. ...
...And 5 more matches
<input type="time"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › time
cept, given in the time value format described previously. if the value specified isn't a valid time string, no minimum value is set. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below. only values which are equal to the basis for stepping (min if specified, value otherwise, and an appropriate default value if neither of those is provided) are valid. ...
...available about when or if safari will add it. ...
...add it. ...
...And 5 more matches
2015 MDN Fellowship Program - Archive of obsolete content
upport our efforts, the fellow will review various technical specifications to identify gaps between the documentation and current situation and refine existing tests to adapt to this cross-browser test harness. activities and deliverables identify gaps between existing documentation and current development environments. the work would entail refining existing tests to adapt to this framework. required skills and experience experience and comfort writing javascript test scripts. mentor information josh matthews, mozilla platform group. github: jdm twitter: @lastontheboat service workers brief project description service workers essentially act as proxy servers that sit between web applications, the browser and (when available) the network. they enable the creation of effective offlin...
...act as proxy servers that sit between web applications, the browser and (when available) the network. they enable the creation of effective offline experiences and wiill also allow access to push notifications and background sync apis. activities and deliverables write a demonstration web application (new or existing) to showcase service worker functionality. provide detailed api descriptions. required skills and experience experienced web developer with expertise in javascript, css, html as well as with efficient network interaction (queuing resource fetching, etc.). self-starter and autonomous worker mentor information brittany storoz, mozilla apps engineering. github: brittanystoroz twitter: @brittanystoroz webgl brief project description webgl is the latest incarnation of the ope...
...ebgl brief project description webgl is the latest incarnation of the opengl family of real time rendering immediate mode graphics apis. webgl is getting some cool new features in 2015 with the standardization efforts around the webgl 2.0 spec being published. activities and deliverables help us develop a curriculum on mdn for teaching developers new to graphics programming the webgl apis. required skills and experience computer graphics experience with programmable shaders and the opengl, opengl es, webgl, or direct3d apis. command of javascript and module systems preferred. mentor information nick desaulniers, sleeps at desk. github: nickdesaulniers twitter: @lostoracle web app performance brief project description web performance is a feature that needs to be considered from s...
...And 4 more matches
nss tech note1
e *t, secitem *item); secstatus sec_quickderdecodeitem(prarenapool* arena, void* dest, const sec_asn1template* templateentry, secitem* src); here is a description of the arguments : secitem* src† is a structure containing a pointer to the binary data to be decoded, as well as its size. const sec_asn1template* templateentry is a pointer to one or more decoder templates. the number of required templates is determined by the type of the first template.when multiple templates are required, the pointer must point to a null-terminated array of templates. the syntax of these templates is identical for both decoders, except where noted. a "null template" is a template that is all zeros, having a zero kind.† the term "null-terminated array", as used throughout this document, means an array ...
...to save the current component. it is normally relative to the dest argument passed to the decoder. if templates are nested, the offset applies to the location of the current component within the target component, typically the decoded sequence. sub† . this field does not apply to all template types. ...
...the current component within the target component, typically the decoded sequence. sub† . this field does not apply to all template types. if kind contains the sec_asn1_inline or sec_asn1_pointer modifiers, then it must point to the required subtemplate. if kind contains the sec_asn1_xtrn or sec_asn1_dynamic modifiers, this is a pointer to a callback function that will dynamically return the required subtemplate. size† . this field does not apply to all template types. ...
...And 4 more matches
PKCS11 Implement
version 2.0. how nss calls pkcs #11 functions this section is organized according to the categories used in pkcs #11: cryptographic token interface standard, version 2.0. to understand this section, you should be familiar with the standard specification. general-purpose functions c_initialize the nss calls c_initialize on startup or when it loads a new module. the nss always passes null, as required by the pkcs #11 specification, in the single c_initialize parameter preserved. c_finalize the nss calls c_finalize on shutdown and whenever it unloads a module. c_getfunctionlist the nss calls c_getfunctionlist on startup or when it loads a new module. the function list returned should include all the pkcs 2.0 function calls. if you don't implement a function, you should still provide a stu...
...the token is a removable device, nss may call c_gettokeninfo anytime it's looking for a new token to check whether the token is write protected, whether it can generate random numbers, and so on. the nss expects ck_token_info.label to contain the name of the token. if the ckf_write_protected flag is set, nss won't use the token to generate keys. the nss interprets the combination of the ckf_login_required and ckf_user_pin_initialized flags as shown in table 1.1. nss's interpretation of the ckf_login_required and ckf_user_pin_initialized flags cfk_login_required cfk_user_pin_initialized nss assumes that: false false this is a general access device. the nss will use it without prompting the user for a pin. true false the device is uninitialized. the nss attempts to initialize the de...
...the user pin; if these calls are successful, the key is generated and at that point the cfk_user_pin_initialized flag should change from false to true. false true this is a general access device that can have a pin set on it. because it's a general access device, nss never prompts for the pin, even though it's possible to set a pin with c_setpin. if the pin is set successfully, the cfk_login_required flag should change to true. the nss uses this combination of flags for its internal token when the key database password is null. these are not standard pkcs #11 semantics; they are intended for nss's internal use only. true true the device has been initialized and requires authentication. the nss checks whether the user is logged on, and if not prompts the user for a pin. c_getmechanism...
...And 4 more matches
NSS tools : modutil
-tempdir temporary-directory give a directory location where temporary files are created during the installation by the -jar option. if no temporary directory is specified, the current directory is used. usage and examples creating database files before any operations can be performed, there must be a set of security databases available. modutil can be used to create these files. the only required argument is the database that where the databases will be located. modutil -create -dbdir [sql:]directory adding a cryptographic module adding a pkcs #11 module means submitting a supporting library file, enabling its ciphers, and setting default provider status for various security mechanisms. this can be done by supplying all of the information through modutil directly or by running a ja...
...nable-list] [-mechanisms mechanism-list] for example: modutil -dbdir sql:/home/my/sharednssdb -add "example pkcs #11 module" -libfile "/tmp/crypto.so" -mechanisms rsa:dsa:rc2:random using database directory ... module "example pkcs #11 module" added to database. installing a cryptographic module from a jar file pkcs #11 modules can also be loaded using a jar file, which contains all of the required libraries and an installation script that describes how to install the module. the jar install script is described in more detail in [1]the section called “jar installation file format”. the jar installation script defines the setup information for each platform that the module can be installed on. for example: platforms { linux:5.4.08:x86 { modulename { "example pkcs #11 module" } mo...
...le can be installed on. for example: platforms { linux:5.4.08:x86 { modulename { "example pkcs #11 module" } modulefile { crypto.so } defaultmechanismflags{0x0000} cipherenableflags{0x0000} files { crypto.so { path{ /tmp/crypto.so } } setup.sh { executable path{ /tmp/setup.sh } } } } linux:6.0.0:x86 { equivalentplatform { linux:5.4.08:x86 } } } both the install script and the required libraries must be bundled in a jar file, which is specified with the -jar argument. modutil -dbdir sql:/home/mt"jar-install-filey/sharednssdb -jar install.jar -installdir sql:/home/my/sharednssdb this installation jar file was signed by: ---------------------------------------------- **subject name** c=us, st=california, l=mountain view, cn=cryptorific inc., ou=digital id class 3 - netscap...
...And 4 more matches
NSS tools : modutil
Mozilla › Projects › NSS › tools › modutil
give a directory location where temporary files are created during the installation by the -jar option. if no temporary directory is specified, the current directory is used. usage and examples creating database files before any operations can be performed, there must be a set of security databases available. modutil can be used to create these files. the only required argument is the database that where the databases will be located. modutil -create -dbdir [sql:]directory adding a cryptographic module adding a pkcs #11 module means submitting a supporting library file, enabling its ciphers, and setting default provider status for various security mechanisms. this can be done by supplying all of the information through modutil directly or ...
...-mechanisms mechanism-list] for example: modutil -dbdir sql:/home/my/sharednssdb -add "example pkcs #11 module" -libfile "/tmp/crypto.so" -mechanisms rsa:dsa:rc2:random using database directory ... module "example pkcs #11 module" added to database. installing a cryptographic module from a jar file pkcs #11 modules can also be loaded using a jar file, which contains all of the required libraries and an installation script that describes how to install the module. the jar install script is described in more detail in [1]the section called “jar installation file format”. the jar installation script defines the setup information for each platform that the module can be installed on. for example: platforms { linux:5.4.08:x86 { modulename { "example pkc...
... modutil -dbdir sql:/home/mt"jar-install-filey/sharednssdb -jar install.jar -installdir sql:/home/my/sharednssdb this installation jar file was signed by: ---------------------------------------------- **subject name** c=us, st=california, l=mountain view, cn=cryptorific inc., ou=digital id class 3 - n...
...And 4 more matches
MediaTrackConstraints - Web APIs
...
...operty, or because it doesn't apply. for example, because rtp doesn't provide some of these values during negotiation of a webrtc connection, a track associated with a rtcpeerconnection will not include certain values, such as facingmode or groupid. properties of all media tracks deviceid a constraindomstring object specifying a device id or an array of device ids which are acceptable and/or required. ...
...webrtc connection, a track associated with a rtcpeerconnection will not include certain values, such as facingmode or groupid. properties of all media tracks deviceid a constraindomstring object specifying a device id or an array of device ids which are acceptable and/or required. groupid a constraindomstring object specifying a group id or an array of group ids which are acceptable and/or required. properties of audio tracks autogaincontrol a constrainboolean object which specifies whether automatic gain control is preferred and/or required. channelcount a constrainlong specifying the channel count or range of channel counts which are acceptable and/or required. echocancellation a constrainboolean object specifying whether or not echo cancellation is preferred and/or required. l...
...And 4 more matches
XRSessionInit - Web APIs
the webxr device api dictionary xrsessioninit specifies required and/or optional features when requesting a new xrsession by calling the navigator.xr.requestsession() method. properties the following parameters are all optional. if none are included, the device will use a default feature configuration for all options. optionalfeatures optional an array of values identifying features which the returned xrsession may optionally support. at this time, all features are identified using strings from the xrreferencespacetype enumeration, but future updates to the webxr standard may add more features. requiredfeatures optional an array of values which the returned xrsession must support. these values currently must come from the enumerated type xrreferencespacetype. more features may be added ...
...nal an array of values which the returned xrsession must support. these values currently must come from the enumerated type xrreferencespacetype. more features may be added in future updates to the webxr standard. default features immersive sessions all immersive (both immersive-vr and immersive-ar) sessions support both the viewer and local reference spaces. because immersive sessions are required to support the local reference space, any request to open an immersive xrsession is required to obtain explicit or implicit user consent. inline sessions all inline webxr sessions support the viewer reference space. security requirements each reference space or feature type has minimum safety requirements. by session type, those are: reference space type user consent rquirement ...
...rsive xrsession is required to obtain explicit or implicit user consent. inline sessions all inline webxr sessions support the viewer reference space. security requirements each reference space or feature type has minimum safety requirements. ...
...And 4 more matches
Basic form hints - Accessibility
separate <div> element. the aria-describedby attribute on the <button> references the id of the <div>. <button aria-describedby="descriptionrevert">revert</button> <div id="descriptionrevert">reverting will undo any changes that have been made since the last save.</div> note: the aria-describedby attribute is used for other purposes, in addition to form controls. required and invalid fields note: now that required is available to more than 97% of users globally, it is no longer recommended that you use both required and aria-required. web developers typically use presentational strategies to indicate required or invalid fields. assistive technologies (ats) cannot necessarily infer this information from the presentation. aria provides attributes for indicating ...
... the aria-invalid state can be programmatically applied, to indicate to an at which data fields have incorrect data, so that the user knows they have entered invalid data. the example below shows a simple form with three fields. ...
...le to more than 97% of users globally, it is no longer recommended that you use both required and aria-required. web developers typically use presentational strategies to indicate required or invalid fields. assistive technologies (ats) cannot necessarily infer this information from the presentation. aria provides attributes for indicating that form controls are required or invalid: the aria-required property can be applied to a form element, to indicate to an at that it is required to complete the form. the aria-invalid state can be programmatically applied, to indicate to an at which data fields have incorrect data, so that the user knows they have entered invalid data. ...
...And 4 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
have a control (or controls) for setting the date/time and then deal with the locale in a separate control. for example, if you are creating a system where the user is likely to already be logged in, with their locale already set, you could provide the timezone in a hidden input type. ...
...local"> does not apply any validation to entered values. the ui implementations generally don't let you enter anything that isn't a date/time — which is helpful — but a user might still fill in no value and submit, or enter an invalid date and/or time (e.g. the 32nd of april). ...
... to restrict the available dates (see setting maximum and minimum dates), and you can use the required attribute to make filling in the date/time mandatory. as a result, supporting browsers will display an error if you try to submit a date that is outside the set bounds, or an empty date field. ...
...And 4 more matches
<input type="password"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › password
ve information like passwords (e.g. login forms) should be served over https; many browsers now implement mechanisms to warn against insecure login forms; see insecure passwords. value a domstring representing a password, or empty events change and input supported common attributes autocomplete, inputmode, maxlength, minlength, pattern, placeholder, readonly, required, and size idl attributes selectionstart, selectionend, selectiondirection, and value methods select(), setrangetext(), and setselectionrange() value the value attribute contains a domstring whose value is the current contents of the text editing control being used to enter the password. if the user hasn't entered anything yet, this value is an empty string (""). if...
... size idl attributes selectionstart, selectionend, selectiondirection, and value methods select(), setrangetext(), and setselectionrange() value the value attribute contains a domstring whose value is the current contents of the text editing control being used to enter the password. if the user hasn't entered anything yet, this value is an empty string (""). if the required property is specified, then the password edit box must contain a value other than an empty string to be valid. if the pattern attribute is specified, the content of a password control is only considered valid if the value passes validation; see validation for more information. note: the line feed (u+000a) and carriage return (u+000d) characters are not permitted in a password value. when setti...
...ues with your content. see labels and placeholders in <input>: the input (form input) element for more information. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed from javascript code that directly sets the value of the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or...
...And 4 more matches
<input type="url"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › url
e to visually denote whether the current value of the field is a valid url or not. on browsers that don't support inputs of type url, a url input falls back to being a standard text input. value a domstring representing a url, or empty events change and input supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size idl attributes list, value, selectionend, selectiondirection methods select(), setrangetext() and setselectionrange(). value the <input> element's value attribute contains a domstring which is automatically validated as conforming to url syntax. more specifically, there are two possible value formats that will pass validation: an empty string ("") indic...
...ted technical issues with your content. see labels and placeholders in <input>: the input (form input) element for more information. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or...
...currently, all browsers which implement this element implement it as a standard text input field with basic validation features. in its most basic form, a url input can be implemented like this: <input id="myurl" name="myurl" type="url"> notice that it's considered valid when empty and when a single validly-formatted url address is entered, but is otherwise not considered valid. by adding the required attribute, only properly-formed urls are allowed; the input is no longer considered valid when empty. there is nothing magical going on here. submitting this form would cause the following data to be sent to the server: myurl=http%3a%2f%2fwww.example.com. note how characters are escaped as necessary. placeholders sometimes it's helpful to offer an in-context hint as to what form the input data...
...And 4 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
s. so far, we've seen how components can share data using props, and communicate with their parents using events and two-way data binding. now we will see how components can also expose methods and variables. the following new components will be developed throughout the course of this article: moreactions: displays the check all and remove completed buttons, and emits the corresponding events required to handle their functionality. newtodo: displays the <input> field and add button for adding a new todo. todosstatus: displays the "x out of y items completed" status heading. code along with us git clone the github repo (if you haven't already done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/05-a...
...ks, by default, basically re-run all our javascript on every change against this virtual dom, and apply different methods to cache expensive calculations and optimize execution. they make little to no attempt to understand what our javascript code is doing. svelte doesn't use a virtual dom representation. instead, it parses and analyzes our code, creates a dependency tree, and then generates the required javascript to update only the parts of the dom that need to be updated. this approach usually generates optimal javascript code with minimal overhead, but it also has its limitations. sometimes svelte cannot detect changes to variables being watched. remember that to tell svelte that a variable has changed, you have to assign it a new value. a simple rule of thumb is that the name of the updated...
...anged and generate simpler and more performant code. for more information on <svelte:options...>, check the svelte options documentation. all of these solutions involve an assignment in which the updated variable is on the left side of the equation. any of this techniques will allow svelte to notice that our todos array has been modified. choose one, and update your checkalltodos() function as required. now you should be able to check and uncheck all your todos at once. try it! finishing our moreactions component we will add one usability detail to our component. we'll disable the buttons when there are no tasks to be processed. to create this we'll receive the todos array as a prop, and set the disabled property of each button accordingly. update your moreactions.svelte component like ...
...And 3 more matches
nss tech note3
nt ...... used to encrypt s/mime emails. certusageobjectsigner ........ used to verify signatures on files of executable code, e.g. jar files. certusagestatusresponder ..... used by an ocsp responder certusageverifyca ............ a ca of any kind. each cert has a "type" and a "key usage", each of which may contain one or more valid values. ...
...tures on files of executable code, e.g. jar files. certusagestatusresponder ..... used by an ocsp responder certusageverifyca ............ a ca of any kind. each cert has a "type" and a "key usage", each of which may contain one or more valid values. each of the above seccertusages translates into a required set of cert type and key usage for the certificate itself, and into another set of required cert type and key usage for all the ca certs in the cert chain. to determine if a cert is valid for a given cert usage, it must have the the cert type and key usage required for that cert usage, and all the ca certs in the cert chain must have the cert type and key usage required for ca certs for that cert usage. there are 8 key usages: cert_sign crl_sign data_encipherment digital_signature...
...s for that cert usage. ...
...And 3 more matches
NSS tools : certutil
guments modify a command option and are usually lower case, numbers, or symbols. -a use ascii format or allow the use of ascii format for input or output. this formatting follows rfc 1113. for certificate requests, ascii output defaults to standard output unless redirected. -b validity-time specify a time at which a certificate is required to be valid. use when checking certificate validity with the -v option. the format of the validity-time argument is yymmddhhmmss[+hhmm|-hhmm|z], which allows offsets to be set relative to the validity end time. specifying seconds (ss) is optional. when specifying an explicit time, use a z at the end of the term, yymmddhhmmssz, to ...
... nicknames. -k key-type-or-id specify the type or specific id of a key. the valid key type options are rsa, dsa, ec, or all. the default value is rsa. specifying the type of key can avoid mistakes caused by duplicate nicknames. giving a key type generates a new key pair; giving the id of an existing key reuses that key pair (which is required to renew certificates). -l display detailed information when validating a certificate with the -v option. -m serial-number assign a unique serial number to a certificate being created. this operation should be performed by a ca. if no serial number is provided a default serial number is made from the current time. serial numbers are limited t...
...ated independently using the -g command option. certutil -g -d [sql:]directory | -h tokenname -k key-type -g key-size [- y exponent-value] -q pqgfile|curve-name for example: $ certutil -g -h lunasa -k ec -g 256 -q sect193r2 listing certificates the -l command option lists all of the certificates listed in the certificate database. the path to the directory (-d) is required. $ certutil -l -d sql:/home/my/sharednssdb certificate nickname trust attri butes ssl,s/mime, jar/xpi ca administrator of instance pki-ca1's example domain id u,u,u tps administrator's example domain id u,u,u google internet authority ...
...And 3 more matches
NSS Tools modutil
e will not be checked. with the -changepw command, the password on the netscape internal module cannot be set or changed, since this password is stored in key3.db. usage the security module database tool's capabilities are grouped as follows, using these combinations of options and arguments. the options and arguments in square brackets are optional, those without square brackets are required. creating a set of security management database files (key3.db, cert8.db, and secmod.db): -create displaying basic module information or detailed information about the contents of a given module: -list [modulename] adding a pkcs #11 module, which includes setting a supporting library file, enabling ciphers, and setting default provider status for various security mechanisms: -add mo...
...platform keysper-file keys global keys forwardcompatible gives a list of platforms that are forward compatible. if the current platform cannot be found in the list of supported platforms, then the forwardcompatible list is checked for any platforms that have the same os and architecture in an earlier version. if one is found, its attributes are used for the current platform. platforms (required) gives a list of platforms. each entry in the list is itself a key-value pair: the key is the name of the platform and the value list contains various attributes of the platform. the modulename, modulefile, and files attributes must be specified for each platform unless an equivalentplatform attribute is specified. the platform string is in the following format: system name:os release:architect...
... os2 (x86) osf (alpha) reliantunix (mips) sco (x86) solaris (sparc) sony (mips) sunos (sparc) unixware (x86) win16 (x86) win95 (x86) winnt (x86) here are some examples of valid platform strings: irix:6.2:mipssunos:5.5.1:sparclinux:2.0.32:x86win95::x86. per-platform keys these keys have meaning only within the value list of an entry in the platforms list. modulename (required) gives the common name for the module. this name will be used to reference the module from netscape communicator, the security module database tool (modutil), servers, or any other program that uses the netscape security module database. modulefile (required) names the pkcs #11 module file (dll or .so) for this platform. the name is given as the relative path of the file within the jar arch...
...And 3 more matches
certutil
d key4.db). arguments option arguments modify an action and are lowercase. -a use ascii format or allow the use of ascii format for input or output. this formatting follows rfc 1113. for certificate requests, ascii output defaults to standard output unless redirected. -b validity-time specify a time at which a certificate is required to be valid. use when checking certificate validity with the -v option. the format of the validity-time argument is yymmddhhmmss[+hhmm|-hhmm|z], which allows offsets to be set relative to the validity end time. specifying seconds (ss) is optional. when specifying an explicit time, use a z at the end of the term, yymmddhhmmssz, to close it. ...
...cify the type of a key. the valid options are rsa, dsa, ecc, or all. the default value is rsa. specifying the type of key can avoid mistakes caused by duplicate nicknames. -k key-type-or-id specify the type or specific id of a key. giving a key type generates a new key pair; giving the id of an existing key reuses that key pair (which is required to renew certificates). -l display detailed information when validating a certificate with the -v option. -m serial-number assign a unique serial number to a certificate being created. this operation should be performed by a ca. the default serial number is 0 (zero). serial numbers are limited to integers. -n nickname ...
...lso be generated independently using the -g command option. certutil -g -d [sql:]directory | -h tokenname -k key-type -g key-size [-y exponent-value] -q pqgfile|curve-name for example: $ certutil -g -h lunasa -k ec -g 256 -q sect193r2 listing certificates the -l command option lists all of the certificates listed in the certificate database. the path to the directory (-d) is required. $ certutil -l -d sql:/home/my/sharednssdb certificate nickname trust attributes ssl,s/mime,jar/xpi ca administrator of instance pki-ca1's example domain id u,u,u tps administrator's example domain id u,u,u google internet authority ...
...And 3 more matches
Index
Mozilla › Tech › XPCOM › Index
mpatibility xpcom if mozilla decides to upgrade to a compiler that does not have the same abi as the current version, any built component may fail. it is a possiblity that is introduced when upgrading to a new compiler without recompiling everything. effectively, it is a different platform. 5 bundling multiple binary components binary xpcom components are sometimes required to implement low-level features for extensions. since binary components are linked against a single gecko sdk, a dependency to a particular version of gecko is created. if the component uses only "frozen" xpcom interfaces, there is a good chance the same binary component will work with different versions of gecko (version 1.8 and 1.9, for example). the more likely case is that the component uses ...
...hen the gre began to be used). 103 component internals obsolete, xpcom let's start by examining how xpcom components are written in c++. the most common type of component is one that is written in c++ and compiled into a shared library (a dll on a windows system or a dso on unix). 104 creating the component code xpcom this chapter goes over the basic code required to handle the relationship between your component and xpcom. having the component found and registered properly is the goal of this first chapter of the tutorial. in the subsequent chapters, we can begin to work on the example weblock component functionality itself. 105 finishing the component xpcom at this point you have created most of the infrastructure of the component. t...
... use 198 moziplaceinfo no summary! 199 moziplacesautocomplete interfaces, interfaces:scriptable, places, xpcom, xpcom interface reference mark a page as being currently open. 200 moziregistry outdated_articles clients will rely on nsrepository to create instances of a given class. clients requiring dynamic "binding" of clsids will be required to use some higher-level services (tbd) to figure out the clsids they should use. the intent is that such services themselves be built on top of the new moziregistry interface. 201 mozirepresentativecolorcallback interfaces, interfaces:scriptable, places, xpcom api reference, xpcom interface reference will be called when color analysis finishes. 202 mozispellchecki...
...And 3 more matches
Video player styling basics - Developer guides
as mentioned earlier, a data-state attribute is now used to indicate whether the video controls are visible or not and these also need to be styled: .controls[data-state=hidden] { display:none; } .controls[data-state=visible] { display:block; } there are a nu...
...s set up the correct way: .controls { width:100%; height:8.0971659919028340080971659919028%; /* of figure's height */ position:relative; } the height of the .controls class is set to be (a very precise!) percentage of the enclosing <figure> element (this was worked out with experimentation based on the required button height). its position is also specifically set to relative, which is required for its responsiveness (more on that later). as mentioned earlier, a data-state attribute is now used to indicate whether the video controls are visible or not and these also need to be styled: .controls[data-state=hidden] { display:none; } .controls[data-state=visible] { display:block; } there are a number of properties that also need to be set for all elements within the video control...
...a value for margin-left is also set, but the first element (in this case the play/pause button) has this property overridden by the value 0. the <div> container for the <progress> element also requires some specific settings; it is set to be much wider than the other child elements and its cursor value is set to be pointer: .controls .progress...
...And 3 more matches
<textarea> - HTML: Hypertext Markup Language
Web › HTML › Element › textarea
you to specify an exact size for the <textarea> to take. setting these is a good idea for consistency, as browser defaults can differ. default content entered between the opening and closing tags. <textarea> does not support the value attribute. the <textarea> element also accepts several attributes common to form <input>s, such as autocomplete, autofocus, disabled, placeholder, readonly, and required. attributes this element includes the global attributes. autocapitalize this is a non-standard attribute supported by webkit on ios (therefore nearly all browsers running on ios, including safari, firefox, and chrome), which controls whether and how the text value should be automatically capitalized as it is entered/edited by the user. the non-deprecated values are available in ios 5 and ...
...e a descendant of a form element. this attribute enables you to place <textarea> elements anywhere within a document, not just as descendants of form elements. maxlength the maximum number of characters (utf-16 code units) that the user can enter. if this value isn't specified, the user can enter an unlimited number of characters. minlength the minimum number of characters (utf-16 code units) required that the user should enter. name the name of the control. placeholder a hint to the user of what can be entered in the control. carriage returns or line-feeds within the placeholder text must be treated as line breaks when rendering the hint. note: placeholders should only be used to show an example of the type of data that should be entered into a form; they are not a substitute for a prope...
...to the input. see labels and placeholders in <input>: the input (form input) element for a full explanation. readonly this boolean attribute indicates that the user cannot modify the value of the control. unlike the disabled attribute, the readonly attribute does not prevent the user from clicking or selecting in the control. the value of a read-only control is still submitted with the form. required this attribute specifies that the user must fill in a value before submitting a form. rows the number of visible text lines for the control. spellcheck specifies whether the <textarea> is subject to spell checking by the underlying browser/os. the value can be: true: indicates that the element needs to have its spelling and grammar checked. default : indicates that the element is to ac...
...And 3 more matches
HTTP response status codes - HTTP
Web › HTTP › Status
was used in the first request, a post must be used in the second request. client error responses 400 bad request the server could not understand the request due to invalid syntax. 401 unauthorized although the http standard specifies "unauthorized", semantically this response means "unauthenticated". that is, the client must authenticate itself to get the requested response. 402 payment required this response code is reserved for future use. the initial aim for creating this code was using it for digital payment systems, however this status code is used very rarely and no standard convention exists. 403 forbidden the client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. unlike 401, the client's ident...
... and cannot be used. for example, an api may forbid delete-ing a resource. the two mandatory methods, get and head, must never be disabled and should not return this error code. 406 not acceptable this response is sent when the web server, after performing server-driven content negotiation, doesn't find any content that conforms to the criteria given by the user agent. 407 proxy authentication required this is similar to 401 but authentication is needed to be done by a proxy. 408 request timeout this response is sent on an idle connection by some servers, even without any previous request by the client. it means that the server would like to shut down this unused connection. this response is used much more since some browsers, like chrome, firefox 27+, or ie9, use http pre-connection mechani...
...is response is sent when the requested content has been permanently deleted from server, with no forwarding address. clients are expected to remove their caches and links to the resource. the http specification intends this status code to be used for "limited-time, promotional services". apis should not feel compelled to indicate resources that have been deleted with this status code. 411 length required server rejected the request because the content-length header field is not defined and the server requires it. 412 precondition failed the client has indicated preconditions in its headers which the server does not meet. 413 payload too large request entity is larger than limits defined by server; the server might close the connection or return an retry-after header field. 414 uri too long ...
...And 3 more matches
Web video codec guide - Web media technologies
ition (1920x1080) video in full color (4 bytes per pixel) is 8,294,400 bytes. at a typical 30 frames per second, each second of hd video would occupy 248,832,000 bytes (~249 mb). a minute of hd video would need 14.93 gb of storage. a fairly typical 30 minute video conference would need about 447.9 gb of storage, and a 2-hour movie would take almost 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, i...
...rmat, however, and numerous patents are owned by multiple parties regarding its technologies. commercial use of avc media requires a license, though the mpeg la patent pool does not require license fees for streaming internet video in avc format as long as the video is free for end users. non-web browser implementations of webrtc (any implementation which doesn't include the javascript apis) are required to support avc as a codec in webrtc calls. while web browsers are not required to do so, some do. in html content for web browsers, avc is broadly compatible and many platforms support hardware encoding and decoding of avc media. however, be aware of its licensing requirements before choosing to use avc in your project! supported bit rates varies by level supported frame ra...
...fari h.263 support no no no[1] no no no container support 3gp, mp4, quicktime rtp / webrtc compatible no supporting/maintaining organization itu specification https://www.itu.int/rec/t-rec-h.263/ licensing proprietary; appropriate license or licenses are required. note that multiple patent pools may apply. [1] while firefox does not generally support h.263, the openmax platform implementation (used for the boot to gecko project upon which firefox os was based) did support h.263 in 3gp files. [2] version 1 of h.263 specifies a set of picture sizes which are supported. later versions may support additional resolutions. hevc (h.265) the high effici...
...And 3 more matches
Install Manifests - Archive of obsolete content
d install.rdf and live at the top level of an add-on's xpi file. layout the basic layout of an install manifest is like so: <?xml version="1.0" encoding="utf-8"?> <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"> <!-- properties --> </description> </rdf> some properties are required, some are optional. some have simple string values, some are complex resources. required property reference your install manifest must specify these properties correctly otherwise your add-on may not install. id the id of the extension, which must be one of the following: guid (firefox 1.0) a string formatted like so: extensionname@example.org the latter format is significantly easier t...
...ed by this add-on. this means that the add-on will work with the application identified by the id property (<em:id>) specified (for a comprehensive list of application ids and valid min/maxversions for them see valid application versions for add-on developers), from the minimum version (<em:minversion>) up to and including the maximum version (<em:maxversion>). however, while <em:maxversion> is a required property, it is ignored unless you also set <em:strictcompatibility> in the main <description> of your install.rdf (i.e. not in <em:targetapplication>). these version strings are formatted in the same fashion as the version property and will be compared to the application version; this allows the extension author to specify which versions of firefox an extension has been tested with. id, minvers...
...ess you also set <em:strictcompatibility> in the main <description> of your install.rdf (i.e. not in <em:targetapplication>). these version strings are formatted in the same fashion as the version property and will be compared to the application version; this allows the extension author to specify which versions of firefox an extension has been tested with. id, minversion, and maxversion are all required. note: extensions compatible with firefox 3.5 should specify a maxversion of 3.5.*, so that they are automatically compatible with security and stability updates. for firefox 3.0, a maxversion of 3.0.* should be used. extensions compatible only with firefox or thunderbird 2 should specify a maxversion of 2.0.0.*. the install manifest must specify at least one of these objects, and may specify...
...And 2 more matches
XUL Application Packaging - Archive of obsolete content
rovides metadata that allows xulrunner to launch the application properly. it is parsed as a windows-style ini file with [headings] and key=value pairs. lines beginning with ; or # are treated as comments. a sample application.ini file can be found in the mozilla source tree. the [app] section the app section specifies metadata about the application name specifies the application name. ...
... ini file with [headings] and key=value pairs. lines beginning with ; or # are treated as comments. a sample application.ini file can be found in the mozilla source tree. the [app] section the app section specifies metadata about the application name specifies the application name. required name example: name=testapplication version specifies the application version number. ...
...the email format is recommended for newly developed applications. ...
...And 2 more matches
CSS property compatibility table for form controls - Learn web development
not support text-shadow on form widgets and ie9 does not support it at all. text fields see the text, search, and password input types. property n t note css box model width yes yes height partial[1][2] yes webkit browsers (mostly on mac osx and ios) use the native look & feel for the search fields. ...
...the search fields. therefore, it's required to use -webkit-appearance:none to be able to apply this property to search fields. on windows 7, internet explorer 9 does not apply the border unless background:none is applied. border partial[1][2] yes webkit browsers (mostly on mac osx and ios) use the native look & feel for the search fields. therefore, it's required to use -webkit-appearance:none to be able to apply this property to search fields. on windows 7, internet explorer 9 does not apply the border unless background:none is applied. ...
... on windows 7, internet explorer 9 does not apply the border unless background:none is applied. ...
...And 2 more matches
Creating the Component Code
having the component found and registered properly is the goal of this first chapter of the tutorial. in the subsequent chapters, we can begin to work on the example weblock component functionality itself. use the calculator (after learning long division) you have to write a fair amount of code to create a component library that gets loaded into xpcom. an xpcom component needs to implement at least three interfaces that xpcom requires, and often others as well. there is more code in this chapter than you'll eventually need, however. ...
...id pair. moving another layer outward is the nsimodule. this interface provides yet another abstraction of the nsifactory object, and may allow for multiple nsifactory objects. the key to this interface is that the return type of getclassobject does not have to be an nsifactory. instead, the nsimodule can ask for implementation details about the xpcom object. this is very useful if the caller is required to know information about the component like its threading module, whether or not it's a singleton, its implementation language, and so forth. the interface used in this case is nsiclassinfo. starting from the outside in, onion peel view of xpcom component creation represents the sequence for constructing an xpcom object. onion peel view of xpcom component creation before we begin looking at ...
...onent to clients. these three interface implementations - for the component functionality, nsimodule interface, and for the nsifactory interface - are the basic pieces of code you need to write to create an xpcom component. basic structure of the weblock component source weblock1.cpp that defines these classes and the code you need to create a basic component has the following structure: * required includes and constants * weblock: public iweblock * weblockfactory: public nsifactory * weblockmodule: public nsimodule in xpcom, all of these classes also derive from the nsisupports base interface. digging in: required includes and constants let's take a look at the first several lines of code in the component and discuss what they mean in xpcom. the includes and definitions at th...
...And 2 more matches
Using XPCOM Utilities to Make Things Easier
writing your own implementation. but they have the advantage of allowing much more rapid development. to get an idea about how much can be handled with the macros described in this section, compare the code listing in weblock2.cpp at the end of the chapter with weblock1.cpp in the previous chapter. the module macros include one set of macros that define the exported nsgetmodule entry point, the required nsimodule implementation code and another that creates a generic factory for your implementation class. used together, these macros can take care of a lot of the component implementation code and leave you working on the actual logic for your component. note that all of the macros described in this section are similar but are used in slightly different situations. some differ only in whether or...
...ented by the components parameter. each structure describes a cid that is to be registered with xpcom. the first parameter for each of these macros is an arbitrary string that names the module. in a debugging environment, this string will be printed to the screen when the component library is loaded or unloaded. you should pick a name that makes sense and helps you keep track of things. the four required parts[other-parts] of the structure contain the following information: a human readable class name the class id (cid) the contract id (an optional but recommended argument) a constructor for the given object static const nsmodulecomponentinfo components[] = { { "pretty class name", cid, contract_id, constructor }, // ... }; the important thing to note in the fictitious...
...-11d3-9337-00104ba0fd40 */ \ 0x9ac9e770, \ 0x18bc, \ 0x11d3, \ {0x93, 0x37, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \ } the next entry is the contract id string, which is also usually defined in a #define in a header file. these three entries constitute the required parameters for the registerfactorylocation method we looked at in the prior chapter. when you use these implementation macros, you must declare a constructor for the object, and this keeps you from having to write a factory object. factory macros the factory macro makes it easy to write factory implementations. given the class name concreteclass, the factory macro declaration is: ns_generic_fa...
...And 2 more matches
nsISecurityCheckedComponent
(xul controllers, the ui for the <video> tag, etc.). method overview string cancallmethod(in nsiidptr iid, in wstring methodname); string cancreatewrapper(in nsiidptr iid); string cangetproperty(in nsiidptr iid, in wstring propertyname); string cansetproperty(in nsiidptr iid, in wstring propertyname); methods cancallmethod() returns a capability string indicating what permissions are required to call the specified method on the given interface. string cancallmethod( in nsiidptr iid, in wstring methodname ); parameters iid the iid of the interface this method exists on. methodname the name of the method to be called on the interface. return value the capability required to call this method. see capability strings for details. cancreatewrapper() returns a string indicating what p...
...ecified method on the given interface. string cancallmethod( in nsiidptr iid, in wstring methodname ); parameters iid the iid of the interface this method exists on. methodname the name of the method to be called on the interface. return value the capability required to call this method. see capability strings for details. cancreatewrapper() returns a string indicating what permissions are required to create a wrapper for the given interface. string cancreatewrapper( in nsiidptr iid ); parameters iid the interface to reflect into javascript. return value the capability required to reflect this interface. note that if wrapper creation is prevented, the properties and methods will not be defined on the javascript object, whereas if wrapper creation succeeds but methods/properties are p...
...see capability strings for details. ...
...And 2 more matches
Using IndexedDB - Web APIs
the one returned. index.openkeycursor(null, "nextunique").onsuccess = function(event) { var cursor = event.target.result; if (cursor) { // do something with the entries. cursor.continue(); } }; please see "idbcursor constants" for the valid direction arguments. version changes while a web app is open in another tab when your web app changes in such a way that a version change is required for your database, you need to consider what happens if the user has the old version of your app open in one tab and then loads the new version of your app in another. when you call open() with a greater version than the actual version of the database, all other open databases must explicitly acknowledge the request before you can start making changes to the database (an onblocked event is fired ...
...3+. by default, indexeddb didn’t handle internationalization of sorting strings at all, and everything was sorted as if it were english text. for example, b, á, z, a would be sorted as: a b z á which is obviously not how users want their data to be sorted — aaron and Áaron for example should go next to one another in a contacts list. achieving proper international sorting therefore required the entire dataset to be called into memory, and sorting to be performed by client-side javascript, which is not very efficient. this new functionality enables developers to specify a locale when creating an index using idbobjectstore.createindex() (check out its parameters.) in such cases, when a cursor is then used to iterate through the dataset, and you want to specify locale-aware sorting, y...
...ibs/jquery/1.8.3/jquery.min.js"></script> <h1>indexeddb demo: storing blobs, e-publication example</h1> <div class="note"> <p> works and tested with: </p> <div id="compat"> </div> </div> <div id="msg"> </div> <form id="register-form"> <table> <tbody> <tr> <td> <label for="pub-title" class="required"> title: </label> </td> <td> <input type="text" id="pub-title" name="pub-title" /> </td> </tr> <tr> <td> <label for="pub-biblioid" class="required"> bibliographic id:<br/> <span class="note">(isbn, issn, etc.)</span> </label> ...
...And 2 more matches
SVGTests - Web APIs
Web › API › SVGTests
svgtests.systemlanguage read only an svgstringlist corresponding to the systemlanguage attribute of the given element. ...
... svgtests.systemlanguage read only an svgstringlist corresponding to the systemlanguage attribute of the given element. ...
... svgtests.systemlanguage read only an svgstringlist corresponding to the systemlanguage attribute of the given element. ...
...And 2 more matches
Starting up and shutting down a WebXR session - Web APIs
system method issessionsupported(). this returns a promise which resolves to true if the given type of session is available for use or false otherwise. const immersiveok = await navigator.xr.issessionsupported("immersive-vr"); if (immersiveok) { // create and use an immersive vr session } else { // create an inline session instead, or tell the user about the // incompatibility if inline is required } creating and starting the session a webxr session is represented by an xrsession object. to obtain an xrsession, you call your xrsystem's requestsession() method, which returns a promise that resolves with an xrsession if it's able to establish one successfully. fundamentally, that looks like this: xr.requestsession("immersive-vr").then((session) => { xrsession = session; /* continue to...
... exception if an error occurs while creating the session. customizing the session in addition to the display mode, the requestsession() method can take an optional object with initialization parameters to customize the session. currently, the only configurable aspect of the session is which of the reference spaces should be used to represent the world's coordinate system. ...
...ize the session. currently, the only configurable aspect of the session is which of the reference spaces should be used to represent the world's coordinate system. you can specify either required or optional reference spaces in order to obtain a session compatible with the reference spaces you need or prefer to use. ...
...And 2 more matches
Using the aria-invalid attribute - Accessibility
description this technique demonstrates how to use the aria-invalid attribute. the aria-invalid attribute is used to indicate that the value entered into an input field does not conform to the format expected by the application.this may include formats such as email addresses or telephone numbers. aria-invalid can also be used to indicate that a required field has not been filled in.the attribute should be programmatically set as a result of a validation process. this attribute can be used with any typical html form element; it is not limited to elements that have an aria role assigned. values vocabulary: false (default) no errors detected grammar a grammatical error has been detected. spelling a spelling error has been detected. true the value has failed validation. any...
... being submitted. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: simple form validation the following snippet shows a simplified version of two form fields with a validation function attached to the blur event. ...
...ion provided above is one of those opinions and therefore not normative. examples example 1: simple form validation the following snippet shows a simplified version of two form fields with a validation function attached to the blur event. note that since the default value for aria-required is false, it is not strictly necessary to add the attribute to input. ...
...And 2 more matches
ARIA Test Cases - Accessibility
n-mapped aria roles is given. documenting and filing bugs review the information on how to file a bug on an aria implementation. when documenting an issue, please also list it in the relevant compatibility table below. when possible provide a link to the bug in the database so that its status can be reviewed. widget test cases alert simple alert complex alert real alert example with aria-required and aria-invalid -- type in a email address without an at sign to test the alert expected at behavior: a screen reader or screen magnifier must speak an alert when it becomes visible. a screen magnifier should move the current view to the alert or open a new panel with the alert information optional, but desired: if there are widgets within the alert, their role and any keyboard mnemonic (...
...when pressing space, new state should be announced automatically. markup used: role="checkbox" aria-checked="true" or "false" notes: need testcase where ...
...leopard) pass n/a pass pass zoomtext - - - - orca - - - - img tiled image expected at behavior: screen readers should announce the image is a single graphic element along with its associated label, even though it is built from numerous sub-images. markup used: role="img" notes: if the screen reader does not provide the required behavior, then most likely it is a browser issue, for not respecting "children presentational: true" for that role. the accessible hierarchy should contain no children for the img. results: at firefox ie opera safari jaws 9 - - n/a n/a jaws 10 - - - - voiceover (leopard) n/a n/a - fail window-eyes - ...
...And 2 more matches
Creating a cross-browser video player - Developer guides
this article describes a simple html5 video player that uses the media and fullscreen apis and works across most major desktop and mobile browsers. as well as working fullscreen, the player features custom controls rather than just using the browser defaults. the player controls themselves won't be styled beyond the basics required to get them working; full styling of the player will be taken care of in a future article. working example our example video player displays a clip from an open source movie called tears of steel, and includes typical video controls. note: you can see the example running live, or check out the source code on github. html markup to start off with, let's take a look at the html that makes up the player. the video first of all the <video> element is de...
...s developers access to and control of html5 media. this api will be used to make the custom control set defined above actually do something. in addition, the fullscreen button will use the fullscreen api, another w3c api that controls the ability of web browsers to show apps using your computer's full screen. setup before dealing with the individual buttons, a number of initialisation calls are required. to begin with, it's a good idea to first check if the browser actually supports the <video> element and to only setup the custom controls if it does. this is done by simply checking if a created <video> element supports the canplaytype() method, which any supported html5 <video> element should. var supportsvideo = !!document.createelement('video').canplaytype; if (supportsvideo) { // set up...
...deo> element supports the canplaytype() method, which any supported html5 <video> element should. var supportsvideo = !!document.createelement('video').canplaytype; if (supportsvideo) { // set up custom controls // ... } once it has been confirmed that the browser does indeed support html5 video, it's time to set up the custom controls. ...
...And 2 more matches
<input type="month"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › month
. this value must be a year-month pairing which is earlier than or equal to the one specified by the max attribute. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed from javascript code that directly sets the value of the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below. only values which are equal to the basis for stepping (min if specified, value otherwise, and an appropriate default value if neither of those is provided) are valid. ...
...apply any validation to entered values. the ui implementations generally don't let you enter anything that isn't a date — which is helpful — but you can still submit the form with the month input empty, or enter an invalid date (e.g. the 32nd of april). ...
... min and max to restrict the available dates (see setting maximum and minimum dates), and in addition use the required attribute to make filling in the date mandatory. as a result, supporting browsers will display an error if you try to submit a date that is outside the set bounds, or an empty date field. ...
...And 2 more matches
<input type="week"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › week
isn't a valid week string, the input has no minimum value. this value must be less than or equal to the value of the max attribute. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below. only values which are equal to the basis for stepping (min if specified, value otherwise, and an appropriate default value if neither of those is provided) are valid. ...
...="number"] { width: 100px; } input + span { padding-right: 30px; } input:invalid+span:after { position: absolute; content: '✖'; padding-left: 5px; } input:valid+span:after { position: absolute; content: '✓'; padding-left: 5px; } the result here is that only weeks between w01 and w52 in 2017 will be seen as valid and be selectable in supporting browsers. ...
...+ span { padding-right: 30px; } input:invalid+span:after { position: absolute; content: '✖'; padding-left: 5px; } input:valid+span:after { position: absolute; content: '✓'; padding-left: 5px; } the result here is that only weeks between w01 and w52 in 2017 will be seen as valid and be selectable in supporting browsers. ...
...And 2 more matches
SVG Attribute reference - SVG: Scalable Vector Graphics
Web › SVG › Attribute
calcmode cap-height class clip clippathunits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering contentscripttype contentstyletype cursor cx cy d d decelerate descent diffuseconstant direction display divisor dominant-baseline dur dx dy e edgemode elevation enable-background end exponent externalresourcesrequired f fill fill-opacity fill-rule filter filterres filterunits flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight format from fr fx fy g g1 g2 glyph-name glyph-orientation-horizontal glyph-orientation-vertical glyphref gradienttransform gradientunits h hanging height href hreflang horiz-adv-x ...
...erator order orient orientation origin overflow overline-position overline-thickness p panose-1 paint-order path pathlength patterncontentunits patterntransform patternunits ping pointer-events points pointsatx pointsaty pointsatz preservealpha preserveaspectratio primitiveunits r r radius referrerpolicy refx refy rel rendering-intent repeatcount repeatdur requiredextensions requiredfeatures restart result rotate rx ry s scale seed shape-rendering slope spacing specularconstant specularexponent speed spreadmethod startoffset stddeviation stemh stemv stitchtiles stop-color stop-opacity strikethrough-position strikethrough-thickness string stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterl...
... xlink attributes xlink:href, xlink:type, xlink:role, xlink:arcrole, xlink:title, xlink:show, xlink:actuate presentation attributes note that all svg presentation attributes can be used as css properties. alignment-baseline, baseline-shift, clip, clip-path, clip-rule, color, color-interpolation, color-interpolation-filters, color-profile,...
...And 2 more matches
passwords - Archive of obsolete content
the server may include a "realm" field as detailed in rfc 2617. if it does, this property contains the value for the "realm" field. otherwise, it is omitted. the realm is displayed in firefox's password manager, under "site", in brackets after the url. so: if a web server at http://www.example.com requested 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://www.example.com" realm: "exampleco login" oncomplete and onerror this api is explicitly asynchronous, so all its functions take two callback functions as additional options: oncomplete and onerror. oncomplete is called...
...it is passed all the matching credentials as a list. this is the only mandatory option. optional options: name type username string the username for the credential. password...
...m: "exampleco login", username: "joe", password: "secret123", }); see "credentials" above for more details on how to set these properties. the options parameter may also include oncomplete and onerror callback functions, which are called when the function has completed successfully and when it encounters an error, respectively. these options are both optional. parameters options : object required options: name type username string the username for the credential. password string the password for the credential. optional options: name type url string the url to which the credential applies. omitted for add-on credentials. formsubmiturl string the ur...
... password string the password for the credential. optional options: name type url string the url to which the credential applies. omitted for add-on credentials. formsubmiturl string the ur...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
...
...st not be specific to a product; license must not interfere with other software. the “no discrimination may be made against individuals or organizations” rule means that you cannot prohibit it from any particular country. the “no discrimination may be made based on field of endeavor” rule means that you cannot prevent it from being used in warfare. the “no additional licensing can be required when redistributing” rule means that you cannot prohibit the software’s use from anyone who does not buy a separate license. because the oss license is intended to foster source-code reuse and mutual development, it avoids restrictions on source-code duplication, distribution, and modification to the greatest extent possible. types of oss licenses and their characteristics the details of o...
...sidered modifications? license revision addition static link dynamic link gpl y y y y lgpl y y y n mpl y y n n if you release software under the gpl, lgpl, or mpl, any modifications to it must also be released. however, if the modified version is never distributed, it need not be released. copyleft is not required a common misconception regarding open source is that any modification made to open-source code must also be released as open source. this condition only applies under some open-source licenses (such as the gpl). this condition, which is commonly referred to as “copyleft,” mandates that any modification to the source code, or any new code combined with the source code, must be released under...
...es which one to apply. in most cases, this means gpl and another license with looser restrictions. for example, mysql is published under a dual license: gpl and a commercial license. oss license can duplicate can distribute can modify commercial license install on one machine only unauthorized copies prohibited no modifications payment required certain uses are permitted depending on which license you choose english version is the official text nearly all oss licenses take english as their official texts. japanese versions, for example, are mentioned only as reference translations. thanks to the internet, published source code can be used all over the world, so the language that the most people will be able to under...
Updating addons broken by private browsing changes - Archive of obsolete content
fox 20 (and will require updating to work correctly in releases of firefox since the ones listed). idls nsitransferable: see using the clipboard for information about the new init method. imgicache: this must no longer be obtained as a service. see the imgicache article for more information. ...
...use privatebrowsingutils.getprivacycontextfromwindow(win) to obtain it from the relevant window. nsidownloadmanager/nsidownload: integer download ids (and specifically the id property of nsidownload) are deprecated, and don't allow access to private downloads. ...
...r to indicate desired properties of the window. passing {private: true} will cause a private window to open, otherwise the window will always be non-private. use {private: privatebrowsingutils.iswindowprivate(window)} to open a window that matches the current window's privacy status. openlinkin: can receive an extra private boolean property in the parameter object. internalsave: takes a new required document argument (prior to the optional boolean and string arguments) indicating the document that originated the save action. gprivatebrowsingui: can no longer be used to control private browsing of any kind. any new private browsing session should be opened using openbrowserwindow, and any queries for private browsing status should use privatebrowsingutils.iswindowprivate(win) on a relevant...
...l boolean and string arguments) indicating the document that originated the save action. gprivatebrowsingui: can no longer be used to control private browsing of any kind. any new private browsing session should be opened using openbrowserwindow, and any queries for private browsing status should use privatebrowsingutils.iswindowprivate(win) on a relevant window object. saveurl: takes a new required document argument indicating the source of the url being saved. ...
Creating a Help Content Pack - Archive of obsolete content
ows: rdf:about must be urn:root or your pack won't work. this attribute 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 displayed 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 ...
...ich the information stored in the referenced data sources applies. this attribute is useful when some of your help contents only apply to one specific platform. if this attribute is omitted, the information in the data sources applies to all platforms. the attribute is a space-separated list of platform strings. strings recognized from 1.8 onward are win, mac, os2, and unix; more will be added as required. unrecognized strings are ignored during parsing. an example of how to use this attribute follows: <!-- assumptions: win-toc.rdf contains windows- and os/2-specific info, unix-toc.rdf contains linux- and mac-specific info. --> <rdf:li> <rdf:description nc:panelid="toc" ...
...ssary definitions. nc:platform (added in mozilla 1.8b2/firefox 1.1) may be used on search data sources as it's used on table of contents, index, and glossary definitions. nc:emptysearchtext specifies the text that is shown when a search through help returns no results. nc:emptysearchlink specifies what uri should be shown when the pseudo-result "no results found" is accessed. this attribute is required. the sample page chrome://help/locale/welcome.xhtml has a section on searching which may be a useful link to use here. note that you can use the nc:datasources attribute to inherit content from other content packs. one common use of this is to inherit the small using the help window article provided with the viewer. for example, the following code uses a datasource outside the content pack you ...
... the outer framework of a glossary description file. to add data to it, add one of the following per entry in your glossary within the rdf:seq above: <rdf:li> <rdf:description nc:name="" nc:link=""/> </rdf:li> the rdf:li element serves purely to contain each separate entry. the rdf:description element describes the glossary entry. it has two required attributes: nc:name and nc:link. nc:name is the name for the entry - it's what's currently displayed in the glossary as the entry's title. nc:link contains a uri referencing what will be displayed in the viewer when the entry is accessed. the index file one important note on the index file is that there is no automatically generated set of top-level letters (e.g., a for accessibility and autom...
Microsummary XML grammar reference - Archive of obsolete content
elements in a microsummary generator document should be in this namespace except the descendants of the <template> element, which should be in the xslt namespace: http://www.w3.org/1999/xsl/transform the <generator> element the <generator> element is the root tag for all microsummary generators, and should contain the remainder of the xml code describing the generator. attributes: name (required) a descriptive, human-readable name for the microsummary created by the generator. uri (optional) a valid uri uniquely identifying the generator. only relevant for generators dynamically created by firefox code and extensions. generators installed from the web via nssidebar::addmicrosummarygenerator are identified by the remote url from which they were downloaded, and firefox...
...rator. uri (optional) a valid uri uniquely identifying the generator. only relevant for generators dynamically created by firefox code and extensions. generators installed from the web via nssidebar::addmicrosummarygenerator are identified by the remote url from which they were downloaded, and firefox ignores the value of this attribute for them. child elements: <template> (required) defines how to transform pages into their microsummaries. <pages> (required) identifies the set of pages that the generator is able to summarize. <update> (optional) specifies how frequently firefox should update the microsummaries. the <template> element the <template> element contains the xslt stylesheet which transforms web pages into their microsummaries. ...
... per xslt, you may specify the stylesheet child element using either the <stylesheet> or the <transform> tag, which are interchangeable. ...
...mmary if the cache contains a fresh copy of the page. the <condition> element the optional <condition> element specifies an xpath boolean expression along with a conditional interval of time, in minutes, that must elapse between updates if the expression evaluates to true when evaluated against the page being summarized. it must be a child of the <update> element. attributes: expression (required) an xpath boolean expression to be evaluated against the page being summarized. interval (required) an interval of time, in minutes, that must elapse between updates if the expression evaluates to true. child elements: none. for more information about the use of this element, see the entry for the <update> element. see also creating a microsummary xslt ...
Installer Script - Archive of obsolete content
logcomment(" available: " + spaceavailable + " k"); 15. return(false); 16. } 17. return(true); 18. } 19. ...
... logcomment(" available: " + spaceavailable + " k"); 15. return(false); 16. } 17. return(true); 18. } 19. var srdest = 17311; 20. ...
... logcomment(" available: " + spaceavailable + " k"); 15. ...
... logcomment(" available: " + spaceavailable + " k"); 15. return(false); 16. } 17. ...
Learn XPI Installer Scripting by Example - Archive of obsolete content
initialization process. verifying the target the first thing the installation script does when it's executed is to check that there is adequate disk space for the software to be installed, where the verifydiskspace function is called as a condition of the main installation block that starts at line 24). ...
...this input is defined in line 22, where getfolder() is used to assign...
...erequired) { var spaceavailable; // get the available disk space on the given path spaceavailable = filegetdiskspaceavailable(dirpath); // convert the available disk space into kilobytes spaceavailable = parseint(spaceavailable / 1024); // do the verification if(spaceavailable < spacerequired) { logcomment("insufficient disk space: " + dirpath); logcomment(" required : " + spacerequired + " k"); logcomment(" available: " + spaceavailable + " k"); return(false); } return(true); } in the verifydiskspace block, filegetdiskspaceavailable is called with dirpath as its expected input. this input is defined in line 22, where getfolder() is used to assign a value to the communicatorfolder variable representing the "program" folder on the local s...
... return(true); } in the verifydiskspace block, filegetdiskspaceavailable is called with dirpath as its expected input. this input is defined in line 22, where getfolder() is used to assign a value to the communicatorfolder variable representing the "program" folder on the local system: var communicatorfolder = getfolder("program"); spaceavailable = filegetdiskspaceavailable(dirpath); spacerequired, the other expected input to the verifydiskspace function, is given as 17311 kilobytes on line 19. inside the function, the two sizes are compared and if the available space is larger than the required space, the installation proceeds. adding files and directories (full of files) to the install once you have verified that the target can accomodate the software to be installed and initialized th...
Attribute - MDN Web Docs Glossary: Definitions of Web-related terms
an attribute extends an element, changing its behavior or providing metadata. an attribute always has the form name="value" (the attribute's identifier followed by its associated value). ...
... an attribute extends an element, changing its behavior or providing metadata. an attribute always has the form name="value" (the attribute's identifier followed by its associated value). ...
...ement, changing its behavior or providing metadata. an attribute always has the form name="value" (the attribute's identifier followed by its associated value). you may see attributes without the equals sign or a value. ...
...nging its behavior or providing metadata. an attribute always has the form name="value" (the attribute's identifier followed by its associated value). you may see attributes without the equals sign or a value. ...
Example - Learn web development
this the example for a basic payment form for the article how to structure an html form. ...
... this the example for a basic payment form for the article how to structure an html form. ...
... <input type="radio" id="title_2" name="title" value="k" > king </label> </li> <li> <label for="title_3"> <input type="radio" id="title_3" name="title" value="q"> queen </label> </li> </ul> </fieldset> <p> <label for="name"> <span>name: </span> <strong><abbr title="required">*</abbr></strong> </label> <input type="text" id="name" name="username"> </p> <p> <label for="mail"> <span>e-mail: </span> <strong><abbr title="required">*</abbr></strong> </label> <input type="email" id="mail" name="usermail"> </p> <p> <label for="pwd"> <span>password: </span> <strong><abbr title="required">*</a...
...ation</h2> <p> <label for="card"> <span>card type:</span> </label> <select id="card" name="usercard"> <option value="visa">visa</option> <option value="mc">mastercard</option> <option value="amex">american express</option> </select> </p> <p> <label for="number"> <span>card number:</span> <strong><abbr title="required">*</abbr></strong> </label> <input type="tel" id="number" name="cardnumber"> </p> <p> <label for="date"> <span>expiration date:</span> <strong><abbr title="required">*</abbr></strong> <em>formatted as mm/dd/yyyy</em> </label> <input type="date" id="date" name="expiration"> </p> </section> <section> <p> <button type="submit"...
Package management basics - Learn web development
idn’t install! parcel has spotted that you need the module, searched for it in the npmjs.com package registry, and installed it locally for us, automatically. you can prove this by looking in our package.json file again — you'll see that the dependencies field have been updated for us: "dependencies": { "date-fns": "^2.12.0", "parcel-bundler": "^1.12.4" } parcel has also added the files required for someone else to pick up this project and install any dependencies that we’ve used. if you take a look in the directory you ran the parcel command in, you’ll find a number of new files; the most interesting of which are: node_modules: the dependency files of parcel and date-fns. dist: the distribution directory — these are the automatically packaged, minified files parcel has built f...
...ode: webpack, rollup, and parcel. there will be more available than this, but these are popular ones: the rollup tool offers tree shaking and code splitting as it’s core features. webpack requires some configuration (though “some” might be understating the complexity of some developers’ webpack configurations). in the case of parcel (prior to parcel version 2), there's a special flag required — --experimental-scope-hoisting — which will tree shake while building. let’s stick with parcel for now, given that we’ve already got it installed. try running the following command: parcel build index.html --experimental-scope-hoisting you’ll see that this makes a huge difference: ✨ built in 7.87s. dist/my-project.86f8a5...
...following main package managers are available: npm at npmjs.org pnpm at pnpm.js.org yarn at yarnpkg.com npm and pnpm are similar from a command line point of view — in fact pnpm aims to have full parity over the argument options that npm offers. it differs in that it uses a different method for downloading and storing the packages on your computer, aiming to reduce the overall disk space required. where npm is shown in the examples below, pnpm can be swapped in and the command will work. yarn is often thought to be quicker than npm in terms of installation process (though your mileage may vary). this is important to developers because there can be a significant amount of time wasted on waiting for dependencies to install (and copy to the computer). note: the npm package manager is not...
... where npm is shown in the examples below, pnpm can be swapped in and the command will work. yarn is often thought to be quicker than npm in terms of installation process (though your mileage may vary). this is important to developers because there can be a significant amount of time wasted on waiting for dependencies to install (and copy to the computer). note: the npm package manager is not required to install packages from the npm registry, even though they share the same name. pnpm and yarn can consume the same package.json format as npm, and can install any package from the npm and other package registries. let’s review the common actions you’ll want to perform with package managers. initialise a new project npm init yarn init as shown above, this will prompt and walk you through...
Addon
an addon represents an add-on that is either installed or can be installed. instances can be created using the many getaddon methods on the addonmanager object. the interface can represent many different kinds of add-ons and as such, some of the methods and properties are considered "required" and others "optional," which means that the optional methods or property may not exist on addon instances for some types of add-ons. ...
... object. the interface can represent many different kinds of add-ons and as such, some of the methods and properties are considered "required" and others "optional," which means that the optional methods or property may not exist on addon instances for some types of add-ons. api consumers should take care to verify the existence of these methods or properties before relying on them. ...
... blockliststate read only integer the current blocklist state of this add-on; see nsiblocklistservice for possible values. creator read only addonauthor ...
...tus read only integer callbacks datadirectorycallback() a callback which is passed a directory path, and, when an error has occured, an error object. void datadirectorycallback( in string path, in error error ) parameters path a string representation of the addon's data directory. error if an error has occured, an error object relevant to the error, othereise null. required methods iscompatiblewith() tests whether this add-on is known to be compatible with a particular application and platform version. void iscompatiblewith( in string appversion, in string platformversion ) parameters appversion an application version to test against platformversion a platform version to test against findupdates() starts an update check for this add-on. this will pe...
sslerr.html
change algorithm." an ssl client has requested an ssl cipher suite that uses a key exchange algorithm for which the local server has no appropriate public key. this indicates a configuration error on the local server. ...
..."pkcs #11 token was inserted or removed while operation was in progress." a cryptographic operation required to complete the handshake failed because the token that was performing it was removed while the handshake was underway. another token may also have been inserted into the same slot. ssl_error_token_slot_not_found -12204 "no pkcs#11 token could be found to do a required operation." a cryptographic operation required a pkcs#11 token with specific abilities, and no token could be found in any slot, including the "soft token" in the internal virtual slot, that could do the job. may indicate a server configuration error, such as having a certificate that is inappropriate for the key exchange algorithm selected. ssl_error_no_compression_overla...
... returned by pkcs#11 routines that did not provide meaningful error codes of their own. these should rarely be seen. ...
... sec_error_baggage_not_created -8121 error while creating baggage object. xp_java_remove_principal_error -8120 couldn't remove the principal. xp_java_delete_privilege_error -8119 couldn't delete the privilege xp_java_cert_not_exists_error -8118 this principal doesn't have a certificate. sec_error_bad_export_algorithm -8117 required algorithm is not allowed. sec_error_exporting_certificates -8116 error attempting to export certificates. sec_error_importing_certificates -8115 error attempting to import certificates. sec_error_pkcs12_decoding_pfx -8114 unable to import. decoding error. file not valid. sec_error_pkcs12_invalid_mac -8113 unable to import. invalid mac. i...
Animated PNG graphics
Mozilla › Tech › APNG
st or second frame), the 'fctl' chunk must appear after all 'idat' chunks and before the 'fdat' chunks for the frame. for all subsequent frames, the 'fctl' chunk for frame n must appear after the 'fdat' chunks from frame n-1 and before the 'fdat' chunks for frame n. other ancillary chunks are allowed to appear among the apng chunks, including between 'fdat' chunks. exactly one 'fctl' chunk is required for each frame. byte offset field name field type description 0 sequence_number unsigned int sequence number of the animation chunk, starting with 0. 4 width unsigned int width of the following frame. 8 height unsigned int height of the following frame. 12 x_offset unsigned int x position at which to render...
... a fraction indicating the time to display the current frame, in seconds. if the denominator is 0, it is to be treated as if it were 100 (that is, delay_num then specifies 1/100ths of a second). if the the value of the numerator is 0 the decoder should render the next frame as quickly as possible, though viewers may impose a reasonable lower bound. frame timings should be independent of the time required for decoding and display of each frame, so that animations will run at the same rate regardless of the performance of the decoder implementation. dispose_op specifies how the output buffer should be changed at the end of the delay (before rendering the next frame). valid values for dispose_op are: value constant description 0 apng_dispose_op_none no disposal is do...
...ntical. for example, if the default image is included in the animation, and uses a blend_op of apng_blend_op_source, clearing is not necessary because the entire output buffer will be overwritten. 'fdat': the frame data chunk the 'fdat' chunk has the same purpose as an 'idat' chunk. it has the same structure as an 'idat' chunk, except preceded by a sequence number. at least one 'fdat' chunk is required for each frame. the compressed datastream is then the concatenation of the contents of the data fields of all the 'fdat' chunks within a frame. when decompressed, the datastream is the complete pixel data of a png image, including the filter byte at the beginning of each scanline, similar to the uncompressed data of all the 'idat' chunks. it utilizes the same bit depth, color type, compression me...
...nd adat from 0.6 the fdat chunk is no longer a container for other chunks, but rather a replacement for an idat chunk removed the fend chunk added a sequence number field to fdat reintroduced the width and height fields in fctl from 0.7 removed hidden flag, instead only the first frame can be hidden and it is signaled with a missing fctl idat, fctl and fdat are no longer required to have no other chunks in between them from 0.8 removed crcs for ihdr and plte from actl the actl fctl and adat are now not copy safe, renamed them to actl, fctl and adat from 0.9 split render_op into dispose_op and blend_op from 0.10 no changes test encoder and sample images sample images are available from the apng implementation page at http://littlesvr.ca/apng/ an enco...
How to build an XPCOM component in JavaScript
ion must be compiled into a binary format (xpt) in order to be registered and used within mozilla applications. the compilation can be done using the gecko sdk. you can learn how to get mac, linux, and windows versions of the gecko sdk by reading the article gecko sdk. for code outside the tree note: on windows if you download the gecko sdk without the whole build tree, you will be missing some required dlls for xpidl.exe and it will run with no errors but not do anything. to fix this download the mozilla build tools for windows and copy the dlls from windows\bin\x86 within the zip into the bin directory of the gecko sdk. note: the mac version of the sdk provided for download is powerpc-only. if you need an intel version, you'll need to compile it yourself as described on that page. execute th...
...if not // provided, the default factory is used, which returns // |(new mycomponent()).queryinterface(ii...
...f 'value' is not // specified, the concatenation of the string "service," and the object's contractid // is passed as avalue parameter of addcategoryentry. service: true }], // queryinterface implementation, e.g. ...
...oworld]; if ("generatensgetfactory" in xpcomutils) var nsgetfactory = xpcomutils.generatensgetfactory(components); // firefox 4.0 and higher else var nsgetmodule = xpcomutils.generatensgetmodule(components); // firefox 3.x note: starting with firefox 4.0 you will need to declare your component in chrome.manifest; classdescription and contractid properties on the other hand are no longer required. see xpcom changes in gecko 2.0 for more details. installation for extensions: copy helloworld.js, and helloworld.xpt (only if you defined and compiled the idl) to {extensiondir}/components/. delete compreg.dat and xpti.dat from your profile directory. restart application. for firefox: copy helloworld.js, and helloworld.xpt (only if you defined and compiled the idl) to the {objdir}/di...
Mailnews and Mail code review requirements
ui-review is obtained at an early stage in the patch development process. getting early ui-reviews this reduces the chance that work is rejected due to needing further user experience changes, and hence is aimed at saving time for the developer and reviewers. all patches that affect user experience or interfaces on thunderbird should have ui-review on those patches in addition to the reviews required below. to obtained a ui-review on an attachment, set ui-review to '?' and enter :bwinton (for blake winton) as the requestee. mike conley (:mconley) can also provide useful feedback, but blake is the current ultimate decider for ui choices in thunderbird. rules for all patches affecting mailnews/ and mail/ wherever possible, significant patches in a certain area should be reviewe...
...ne of the listed sub-module owner/reviewers. peers may grant review in any area covered by mailnews/, provided they feel confident in their knowledge of the code being changed. sub-module peers may only grant review in the listed sub-module. if a reviewer feels that the patch would benefit from additional reviews, they should request a second review from an appropriate person. ...
...ed sub-module. if a reviewer feels that the patch would benefit from additional reviews, they should request a second review from an appropriate person. super-review is required in certain situations: significant architectural refactoring, any change to any api, all changes that affect how code modules interact. see the full super-review policy for more details. unit test rules patches are required to include automated tests which are run during make check or via mozmill in thunderbird, but submitters are encouraged to request exceptions from reviewers in cases where the cost is believed to outweigh the benefit. once unit tests are committed, the in-testsuite+ flag should be set on the bug. unit tests must be included in patches and reviewed just like any other code. if an automated test ...
...ed on the try server. for xpcshell tests, it has either passed on try or has been run locally on the appropriate platform(s). specifically, if the xpcshell test will do different things on windows than it will do on os x or linux, it must be run on windows and one of os x / linux. the author of the patch is the module owner or a peer of the module to which the test corresponds. a bug is still required, even if it is immediately marked fixed. rs=orange-debugging requirements: the patch is trying to fix an intermittent orange test failure. the patch only touches test logic. the patch only adds/modifies logging statements, although the logs can be conditional. the patch must have been run at least once on the try server. (i have done some mozmill orange fixing where the try server would...
MediaDevices.getUserMedia() - Web APIs
audio source like a microphone, a/d converter, or the like), and possibly other track types. it returns a promise that resolves to a mediastream object. if the user denies permission, or matching media is not available, then the promise is rejected with notallowederror or notfounderror respectively. note: it's possible for the returned promise to neither resolve nor reject, as the user is not required to make a choice at all and may simply ignore the request. generally, you will access the mediadevices singleton object using navigator.mediadevices, like this: async function getmedia(constraints) { let stream = null; try { stream = await navigator.mediadevices.getusermedia(constraints); /* use the stream */ } catch(err) { /* handle the error */ } } similarly, using the...
...g the media types requested. either or both must be specified. if the browser cannot find all media tracks with the specified types that meet the constraints given, then the returned promise is rejected with notfounderror. the following requests both audio and video without any specific requirements: { audio: true, video: true } if true is specified for a media type, the resulting stream is required to have that type of track in it. if one cannot be included for any reason, the call to getusermedia() will result in an error. while information about a user's cameras and microphones are inaccessible for privacy reasons, an application can request the camera and microphone capabilities it needs and wants, using additional constraints. the following expresses a preference for 1280x720 camera r...
...y and security requirements that browsers are obligated to meet. getusermedia() is a powerful feature which can only be used in secure contexts; in insecure contexts, navigator.mediadevices is undefined, preventing access to getusermedia(). a secure context is, in short, a page loaded using https or the file:/// url scheme, or a page loaded from localhost. in addition, user permission is always required to access the user's audio and video inputs. only a window's top-level document context for a valid origin can even request permission to use getusermedia(), unless the top-level context expressly grants permission for a given <iframe> to do so using feature policy. otherwise, the user will never even be asked for permission to use the input devices. for additional details on these requirements ...
...permission management. first, getusermedia() must always get user permission before opening any media gathering input such as a webcam or microphone. browsers may offer a once-per-domain permission feature, but they must ask at least the first time, and the user must specifically grant ongoing permission if they choose to do so. of equal importance are the rules around notification. browsers are required to display an indicator that shows that a camera or microphone is in use, above and beyond any hardware indicator that may exist. they must also show an indicator that permission has been granted to use a device for input, even if the device is not actively recording at the moment. for example in firefox, the url bar displays a pulsing red icon to indicate that recording is underway. the icon is...
SecurityPolicyViolationEvent.SecurityPolicyViolationEvent() - Web APIs
properties type a domstring representing the type of security policy violation that occurred. eventinitdict optional a dictionary object containing information about the properties of the securitypolicyviolationevent to be constructed. this can include the following properties, but bear in mind that if you do include an eventinitdict, certain properties must be included (marked below with required): blockeduri: the blockeduri of the securitypolicyviolationevent. if not included, the default value is "". columnnumber: the columnnumber of the securitypolicyviolationevent. if not included, the default value is 0. disposition: the disposition of the securitypolicyviolationevent (required). documenturi: the documenturi of the securitypolicyviolationevent (required). effectivedirecti...
...event. if not included, the default value is "". columnnumber: the columnnumber of the securitypolicyviolationevent. if not included, the default value is 0. disposition: the disposition of the securitypolicyviolationevent (required). documenturi: the documenturi of the securitypolicyviolationevent (required). effectivedirective: the effectivedirective of the securitypolicyviolationevent (required). linenumber: the linenumber of the securitypolicyviolationevent. if not included, the default value is 0. originalpolicy: the originalpolicy of the securitypolicyviolationevent (required). referrer: the referrer of the securitypolicyviolationevent. if not included, the default value is "". sample: the sample of the securitypolicyviolationevent. if not included, the default value is "". ...
... return value a securitypolicyviolationevent object instance. example let spvevt = new securitypolicyviolationevent('foo', { ... ...
...included, the default value is "". sample: the sample of the securitypolicyviolationevent. if not included, the default value is "". sourcefile: the sourcefile of the securitypolicyviolationevent. if not included, the default value is "". statuscode: the statuscode of the securitypolicyviolationevent (required). violateddirective: the violateddirective of the securitypolicyviolationevent (required). return value a securitypolicyviolationevent object instance. example let spvevt = new securitypolicyviolationevent('foo', { ... }); specifications specification status comment content security policy level 3the definition of 'securitypolicyviolationevent' in that specification. working draft initial definition ...
Signaling and video calling - Web APIs
s a target property. if that property is present, it specifies the username of the client to which the message is to be sent, and we call sendtooneuser() to send the message to them. otherwise, the message is broadcast to all users by iterating over the connection list, sending the message to each user. as the existing code allows the sending of arbitrary message types, no additional changes are required. our clients can now send messages of unknown types to any specific user, letting them send signaling messages back and forth as desired. that's all we need to change on the server side of the equation. now let's consider the signaling protocol we will implement. designing the signaling protocol now that we've built a mechanism for exchanging messages, we need a protocol defining how those mes...
...advertently sending video and/or audio data when the user isn't prepared for it. as soon as media is attached to the rtcpeerconnection, a negotiationneeded event is triggered at the connection, so that ice negotiation can be started. if an error occurs while trying to get the local media stream, our catch clause calls handlegetusermediaerror(), which displays an appropriate error to the user as required. handling getusermedia() errors if the promise returned by getusermedia() concludes in a failure, our handlegetusermediaerror() function performs. function handlegetusermediaerror(e) { switch(e.name) { case "notfounderror": alert("unable to open your call because no camera and/or microphone" + "were found."); break; case "securityerror": case "permissionde...
...tun server but abusing these is bad form. each object in iceservers contains at least a urls field providing urls at which the specified server can be reached. it may also provide username and credential values to allow authentication to take place, if needed. after creating the rtcpeerconnection, we set up handlers for the events that matter to us. the first three of these event handlers are required; you have to handle them to do anything involving streamed media with webrtc. the rest aren't strictly required but can be useful, and we'll explore them. there are a few other events available that we're not using in this example, as well. here's a summary of each of the event handlers we will be implementing: rtcpeerconnection.onicecandidate the local ice layer calls your icecandidate event...
...idate". target the username the ice candidate needs to be delivered to. this lets the signaling server route the message. candidate the sdp representing the candidate the ice layer wants to transmit to the other peer. the format of this message (as is the case with everything you do when handling signaling) is entirely up to you, depending on your needs; you can provide other information as required. note: it's important to keep in mind that the icecandidate event is not sent when ice candidates arrive from the other end of the call. instead, they're sent by your own end of the call so that you can take on the job of transmitting the data over whatever channel you choose. this can be confusing when you're new to webrtc. receiving ice candidates the signaling server delivers each ice can...
Using bounded reference spaces - Web APIs
prepared to fall back to some other type of reference space. understanding boundaries as mentioned previously, the boundary is defined as an array of points located at floor level, each defining a corner of the boundary area, going around the origin in a clockwise manner. this is demonstrated in the diagram below. ...
...gram below. this diagram defines the boundaries of room with the origin in the center, as required, and a set of 12 points representing the vertices of the available physical space. there are two cut-out areas in the room, possibly representing a couch, sofa, or bench behind the user and a stand or table on which the computer or other hardware is located. as this suggests, the safe area is not required to be convex, but may have any number of indentations or extrusions, as long as it's a contiguous shape, note that the coordinates of the origin here, (0, 0), are indicative of the fact that the boundaries are defined at floor level and are essentially a 2d shape on the floor, like an invisible fence used to keep pets from getting away from home. the full coordinates here would be (0, 0, 0). th...
...ook at how to safely create a session that will work whether bounded spaces are supported or not. safely creating a bounded-preferred space before actually attempting to create a bounded reference space, you need to create a session that supports them. ...
...port bounded reference spaces as an option rather than as a required feature unless you have special knowledge of the environment in which your code will run. you can create a session that supports a bounded-floor reference space if available by using code such as the following: async function onactivatexrbutton(event) { if (!xrsession) { navgator.xr.requestsession("immersive-vr"), { requiredfeatures: ["local-floor"], optionalfeatures: ["bounded-floor"] }).then((session) => { xrsession = session; startsessionanimation(); }); } } this function, called when the user clicks on a button to start the xr experience, works as usual, exiting at once if a session is already in place, then requesting a new session using immersive-vr mode. the options specified when...
ARIA: checkbox role - Accessibility
hecked="false" tabindex="0" aria-labelledby="chk1-label"> </span> <label id="chk1-label">remember my preferences</label> the first rule of aria is if a native html element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and adding aria. instead use the native html checkbox of <input type="checkbox">, which natively provides all the functionality required: <input type="checkbox" id="chk1-label"> <label for="chk1-label">remember my preferences</label> description the native html checkbox form control can only have two checked states ("checked" or "not checked"), with an indeterminate state settable via javascript. similarly, an element with role="checkbox" can expose three states through the aria-checked attribute: true, false, or mixed. sinc...
...arly, an element with role="checkbox" can expose three states through the aria-checked attribute: true, false, or mixed. since a checkbox is an interactive control, it must be focusable and keyboard accessible. if the role is applied to a non-focusable element, use the tabindex attribute to change this. the expected keyboard shortcut for activating a checkbox is the space key. the developer is required to change the value of the aria-checked attribute dynamically when the checkbox is activated. associated wai-aria roles, states, and properties aria-checked the value of aria-checked defines the state of a checkbox. this attribute has one of three possible values: true the checkbox is checked false the checkbox is not checked mixed the checkbox is partially check...
...te has one of three possible values: true the checkbox is checked false the checkbox is not checked mixed the checkbox is partially checked, or indeterminate tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. ...
...ossible values: true the checkbox is checked false the checkbox is not checked mixed the checkbox is partially checked, or indeterminate tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. ...
Understandable - Accessibility
s/words. your site should provide a glossary that contains definitions of such words/terms that you can then link to when they appear, or at the very least provide definitions somewhere in the surrounding text, or in a description list at the bottom of the page. 3.1.4 abbreviations (aaa) where abbreviations are used, you should provide an expansion of them, or a definition as required. the <abbr> element is often thought of as the preferred way to provide an expansion for an abbreviation — it takes a title attribute that contains the expansion, and this appears when the acronym is moused over. however, the title contents are not accessible via keyboard, nor are they reliably read out by screenreaders. a better way to handle this is to again provide links to glossary pag...
...a page, provide an option to stop it automatically advancing. better to avoid such functionality if possible. note: also see the wcag description for guideline 3.2 predictable: make web pages appear and operate in predictable ways. guideline 3.3 — input assistance: help users avoid and correct mistakes this guideline centers around helping users enter correct information when required with the minimum of mistakes. success criteria how to conform to the criteria practical resource 3.3.1 error identification (a) when a user is filling out a form or choosing between options, any error that is detected should be clearly reported to the user, along with the form control that the error relates to. it is advisable to implement client-side err...
...used alongside client-side validation. client-side validation is too easy to turn off or otherwise get around, so it can't be relied on alone. see form data validation for comprehensive validation information, and wai-aria: dynamic content updates for information on live regions. 3.3.2 labels or instructions (a) clear instructions should be provided when data input is required. ...
...e validation is too easy to turn off or otherwise get around, so it can't be relied on alone. see form data validation for comprehensive validation information, and wai-aria: dynamic content updates for information on live regions. 3.3.2 labels or instructions (a) clear instructions should be provided when data input is required. when a simple instruction or prompt is required, you can use <label> elements for single inputs like name or age, a combination or <label>s and <fieldset>s/<legend>s for multiple inputs that go together (like the elements of a date of birth or postal address). when more complex explanation is required, you can always include explanatory paragraphs too, or maybe you need to try to make your forms more intuitive. meaningfu...
HTML attribute: multiple - HTML: Hypertext Markup Language
aying a scrolling list box for a <select> control with the multiple attribute set versus a single line dropdown when the attribute is ommitted. the email input displays the same, but will match the :invalid pseudo-class if more than one comma-separated email address is included if the attribute is not present. when multiple is set on the email input type, the user can inlclude zero (if not also required), one or more comma-separated email addresses. <input type="email" multiple name="emails" id="emails"> if and only if the multiple attribute is specified, the value can be a list of properly-formed comma-separated e-mail addresses. any trailing and leading whitespace is removed from each address in the list. when multiple is set on the file input type, the user can select one or more files. th...
...> <option>sleepy</option> <option>bashful</option> <option>sneezy</option> <option>dopey</option> <option>doc</option> </select> when multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown. ...
...ers.com">sneezy</option> <option value="dopey@woodworkers.com">dopey</option> <option value="doc@woodworkers.com">doc</option> </datalist> input:invalid {border: red solid 3px;} if and only if the multiple attribute is specified, the value can be a list of properly-formed comma-separated e-mail addresses. any trailing and leading whitespace is removed from each address in the list. if the required attribute is present, at least one email address is required. some browsers support the appearance of the list of options from the associated <datalist> for subsequent email addresses when multiple is present. others do not. file input when multiple is set on the file input type, the user can select one or more files: <form method="post" enctype="multipart/form-data"> <p> <label for="...
...specification status comment html living standardthe definition of 'multiple attribute' in that specification. living standard html5the definition of 'multiple attribute' in that specification. recommendation accessibility concerns provide instructions to help users understand how to complete the form and use individual form controls. indicate any required and optional input, data formats, and other relevant information. when using the multiple attribute, inform the user that multiple values are allowed and provide directions on how to provide multiple values, such as "separate email addresses with a comma." setting size="1" on a multiple select can make it appear as a single select in some browsers, but then it doesn't expand on focus, harming us...
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
ttributes, constraint validation api, reference the pattern attribute specifies a regular expression the form control's value should match. if a non-null value doesn't conform to the constraints set by the pattern value, the validitystate object's read-only patternmismatch property will be true. 46 html attribute: readonly attribute, attributes, constraint validation, forms, required the boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control. 47 html attribute: rel attribute, attributes, constraint validation, link, form, rel the rel attribute defines the relationship between a linked resource and the current document. valid on <link>, <a>, <area>, and <form>, the supported values depend on...
...utable, meaning the user can not edit the control. 47 html attribute: rel attribute, attributes, constraint validation, link, form, rel the rel attribute defines the relationship between a linked resource and the current document. valid on <link>, <a>, <area>, and <form>, the supported values depend on the element on which the attribute is found. 48 html attribute: required attribute, attributes, constraint validation, forms, required the boolean required attribute 49 html attribute: size attribute, html, input, reference, select the size attribute defines the width of the <input> and the height of the <select> element. for the input, if the type attribute is text or password then it's the number of characters. this must be an integer ...
... reference, select, text, usernames, autocomplete, form, passwords, textarea autocomplete lets web developers specify what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field. 52 disabled attribute, attributes, constraint validation, forms, required the boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form. the user can neither edit nor focus on the control, nor it's form control descendants. 53 html documentation index html, index, mdn meta a comprehensive index list of all the available html documentation. 54 html elements reference basi...
...r; a wide variety of types of input data and control widgets are available, depending on the device and user agent. 119 <input type="button"> element, forms, html, html forms, input, input element, input type, reference, button <input> elements of type button are rendered as simple push buttons, which can be programmed to control custom functionality anywhere on a webpage as required when assigned an event handler function (typically for the click event). 120 <input type="checkbox"> element, html, html forms, input, input types, reference, checkbox, form <input> elements of type checkbox are rendered by default as boxes that are checked (ticked) when activated, like you might see in an official government paper form. the exact appearance depends upon the ...
Web audio codec guide - Web media technologies
lt in significantly smaller compressed audio than lossless codecs do. generally speaking, the most common reasons to choose lossless audio are because you require archival-quality storage, or because the audio samples will be remixed and recompressed, and you wish to avoid the amplification of artifacts in the audio due to recompression. for real-time streaming of audio, a lossy codec is usually required in order to ensure the flow of data can keep up with the audio playback rate regardless of network performance. maximum number of channels the audio delivered to each speaker in a sound system is provided by one audio channel in a stream. monaural sound is a single channel. stereo sound is two. 5.1 surround sound has five audio channels, plus one low frequency enhancement (lfe) channel. lfe ch...
...instead, firefox relies upon a platform's native support for aac. this capability was introduced on each platform in different firefox releases: aac support in firefox using external library, by platform platform first firefox ve...
...instead, firefox relies upon a platform's native support for aac. this capability was introduced on each platform in different firefox releases: aac support in firefox using external library, by platform platform first firefox version with aac support ...
...r networking environments. µ-law is primarily used in north america and japan, with a-law being predominant elsewhere. the drawbacks to g.711 are obvious: small 8-bit samples and narrow audio frequency bandwidth. that having been said, it's been in use for decades, is "good enough" for voice applications, and is vital if you may need to interface with a standard telephone network. this codec is required to be supported by all webrtc solutions because it's a simple, easy to implement, and widely-used and compatible codec. typically, most modern applications will use g.711 only as a fallback option, unless the limitations have specific value to their use cases. opus, for example, offers a narrowband encoding at a 40 kbps bit rate. still, g.711 provides a least common denominator which can be fall...
Image file type and format guide - Web media technologies
image file type details the following secti...
...idth as a 32-bit value: tag type size value 0x0100 (imagewidth) 0x0004 (long) 0x00000001 (1 entry) 0x00000280 (640 pixels) a single tiff file can contain multiple images; this may be used to represent multi-page documents, for example (such as a multi-page scanned document, or a received fax). however, software reading tiff files is only required to support the first image. tiff supports a variety of color spaces, not just rgb. these include cmyk, ycbcr, and others, making tiff a good choice for storing images intended for print, film, or television media. long ago, some browsers supported tiff images in web content; today, however, you need to use special libraries or browser add-ons to do so. as such, tiff files are not useful within ...
...or an associated, pre-multiplied alpha component, and 2 for unassociated alpha (a separate matte); however, alpha channels are rarely used in tiff files and may be unsupported by the user's software. compression most tiff files are uncompressed, but lossless packbits and lzw compression are supported, as is lossy jpeg compression. licensing no license required (aside from any associated with libraries you might use); all known patents have expired. webp image webp supports lossy compression via predictive coding based on the vp8 video codec, and lossless compression that uses substitutions for repeating data. lossy webp images average 25–35% smaller than jpeg images of visually similar compression levels. lossless webp images are typically 26...
... maximum dimensions 16,383×16,383 pixels supported color modes lossy webp stores the image in 8-bit y'cbcr 4:2:0 (yuv420) format. lossless webp uses 8-bit argb color, with each component taking 8 bits for a total of 32 bits per pixel. compression lossless (huffman, lz77, or color cache codes) or lossy (vp8). licensing no license required; source code is openly available. xbm (x window system bitmap file) xbm (x bitmap) files were the first to be supported on the web, but are no longer used and should be avoided, as their format has potential security concerns. modern browsers have not supported xbm files in many years, but when dealing with older content, you may find some still around. xbm uses a snippet of c code to re...
SVG documentation index - SVG: Scalable Vector Graphics
Web › SVG › Index
te specifies how the accumulation of the background image is managed. 68 end needscompattable, svg, svg attribute the end attribute defines an end value for the animation that can constrain the active duration. 69 exponent needscompattable, svg, svg attribute the exponent attribute defines the exponent of the gamma function. 70 externalresourcesrequired deprecated, needsexample, svg, svg attribute the externalresourcesrequired attribute specifies whether referenced resources that are not part of the current document are required for proper rendering of the given container or graphics element. 71 fill svg, svg attribute the fill attribute has two different meanings. for shapes and text it's a presentation attribute ...
...ring-intent attribute permits the specification of a color profile rendering intent other than the default. 175 repeatcount svg, svg attribute the repeatcount attribute indicates the number of times an animation will take place. 176 repeatdur svg, svg attribute the repeatdur attribute specifies the total duration for repeating an animation. 177 requiredfeatures svg, svg attribute the requiredfeatures attribute takes a list of feature strings, with the individual strings separated by white space. it determines whether or not all of the named features are supported by the browser; if all of them are supported, the attribute evaluates to true end the element is rendered; otherwise, the attribute evaluates to false and the current element ...
...307 <desc> element, svg, svg descriptive the <desc> element provides an accessible, long-text description of any svg container element or graphics element. 308 <discard> element, needsexample, reference, svg, svg animation the <discard> svg element allows authors to specify the time at which particular elements are to be discarded, thereby reducing the resources required by an svg user agent. this is particularly useful to help svg viewers conserve memory while displaying long-running documents. 309 <ellipse> element, reference, svg, svg graphics the <ellipse> element is an svg basic shape, used to create ellipses based on a center coordinate, and both their x and y radius. 310 <feblend> element, svg, svg filter the <febl...
...368 <svg> element, reference, svg, svg container, web the svg element is a container that defines a new coordinate system and viewport. it is used as the outermost element of svg documents, but it can also be used to embed an svg fragment inside an svg or html document. 369 <switch> element, needsexample, svg, svg container the <switch> svg element evaluates any requiredfeatures, requiredextensions and systemlanguage attributes on its direct child elements in order, and then renders the first child where these attributes evaluate to true. 370 <symbol> svg, svg container the <symbol> element is used to define graphical template objects which can be instantiated by a <use> element. 371 <text> element, reference, svg, svg text con...
/loader - Archive of obsolete content
: <script type='application/javascript' src='resource://gre/modules/commonjs/toolkit/loader.js'></script> this will expose a single loader object containing all of the api functions described in this document. it can be loaded as a javascript code module: let { loader, require, unload } = components.utils.import('resource://gre/modules/commonjs/toolkit/loader.js'); it can be required as a commonjs module from a module loaded in the loader itself: let { loader, require, unload } = require('toolkit/loader'); what is it good for ? create somewhat standardized js environments that people doing non-browser js are familiar with. provide an environment for loading commonjs style modules, which makes it possible to consume lots of interesting code that has already been dev...
...a globals, it's almost always better to use pseudo-modules or, even better, modules. resolve the optional resolve option enables you to completely customize module resolution logic. resolve is assigned a function that takes: the id of the module passed into require() the id of the module that called require() on each require() call, the supplied function is then called with the id of the required module and that of the requiring module. the function returns a string representing the resolved module id, which is then resolved to its location url using the mapping provided in the paths option. if this option is not provided, the loader will use plain path resolution. this feature may also be used to implement specific security constraints. for example, the sdk generates a manifest file a...
...s; if (id in manifest) return requirements[id]; else throw error('module "' + requirer + '" has no authority to require ' + 'module "' + id + "') } }); thrown exceptions will propagate to the caller of require(). if the function assigned to resolve does not return a string value, an exception will still be thrown as the loader will be unable to resolve the required module's location. id add-on debugging requires knowing which objects belong to which add-on. when created with this option, loader will transparently mark all new global objects with the provided value. all together all of these options can be combined to configure the loader for a specific use case. don't get too excited about configuration options, keep in mind that modules are more useful...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
eferences listed in table 1 and double-click on them to set them accordingly. some of these preferences do not exist—to create them, right-click, select “new>boolean”, and type in the name and set the value accordingly. install the dom inspector the dom inspector is an extension that lets you examine html and xul dom tree structures, javascript objects and css properties, etc. this is not required for developing extensions, but it is handy to have around. install extensions for firefox from the mozilla add-ons website. optional - install firebug and chromebug chromebug is used by the firebug development team to develop firebug. you can use it to help debug firefox extensions as well as to inspect and learn how the firefox ui (chrome) is constructed. you can learn more about chromebug a...
...s, as discussed in chapter 4, they will be able to use xpcom functions (figure 1). extension/ chrome manifest chrome/ #registered in the chrome content package #run with privileges locale package skin package figure 1: chrome packages and chrome registration (fixme: not really explicit and not a figure) cross-package overlays the “overlay” technique introduced in chapter 3 required the use of the xul-overlay instruction in the xul document that is the overlay target. it is also possible to coerce an overlay without using the xul-overlay instruction in the xul document—this is called a “cross-package overlay” (figure 2). in fact, you need to use cross-package overlays to append buttons or menus to the firefox browser window. use the chrome manifest to invoke a cross-pa...
... chrome.manifest this is the chrome manifest described in the earlier section. registers packages and invokes cross-package overlays. content/overlay.xul xul file that will be overlaid on the firefox browser window, adding buttons, menu items, etc. content/clock.xul content/clock.js ...
Signing an XPI - Archive of obsolete content
\apps\nspr-4.6\lib\;%path% an easier way is to copy everything from your new directories c:\apps\nss-3.11.4\ and c:\apps\nspr-4.6\ including sub directories to the same directory - fx c:\apps\codesigning\ - and then run every command from that. initialize the certificate database decide which folder to create the certificate database in. use this command to create it (note the trailing dot is required). c:\projects\codesigning\> certutil -n -d . the dot will cause the database to be created in the current directory. you will be prompted for the nss certificate database password - don't forget it! c:\projects\codesigning\> certutil -n -d . enter a password which will be used to encrypt your keys. the password should be at least 8 characters long, and should contain at least one non-alphabe...
... 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 displayed 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 root cas for different levels of trust. find out which one was used for your certificate and download it. you can view the details of your certific...
...cating mozilla's key database. it consists of two files named key3.db and cert8.db. they usually live in the mozilla firefox user profile folder. i found mine in c:\documents and settings\tj\application data\mozilla\firefox\profiles\xxxxxxxx.default\ where xxxxxxxx is a random string of characters. this procedure assumes you installed the new certificate into mozilla firefox here's the commands required to export it to a file, import it to the code signing database, and verify the signing attributes (u,u,u). ensure you use the nickname of your certificate in place of mine, and the directory where your mozilla firefox key database files are: c:\projects\codesigning> pk12util -o "certum code signing.pkcs12" -n "tj's unizeto sp. z o.o. id" -d "c:\documents and settings\tj\application data\mozilla\...
New Security Model for Web Services - Archive of obsolete content
special privileges. this is currently permitted for locally-saved scripts and signed scripts. this could be combined with the other options above such as whitelisting, signed scripts, etc. but the big problem with this is that the typical browser user really does not either understand or pay the consequences if he inadvertently opens a hole in his company's firewall. quite complex settings may be required to permit the user to allow access to desired external services without risking other resources. controlling resource access on the server access by untrusted scripts really needs to be under the control of the stake holder, which is the resource and server owner -- not the user -- to determine whether a resource should be insulated from web applications loaded from outside of the firewall. us...
...erver access by untrusted scripts really needs to be under the control of the stake holder, which is the resource and server owner -- not the user -- to determine whether a resource should be insulated from web applications loaded from outside of the firewall. using a soap header for verification soap messages have a distinct processing model allowing a header to be added that the recipient is required to understand and accept, which identifies the untrusted source of a script making a request. soap services which have not been cleared for access by untrusted scripts will reject the requests. this is offered in the mozilla implementation of soap today. unfortunately, this does not prevent soap messages from being sent to non-soap addresses, which is a big enough problem that the verification c...
...ss file are as follows. <!element webscriptaccess (delegate?|allow*)> <!element delegate empty> <!element allow empty> <!attlist allow type|from cdata #implied>. the root element the first element of the file should be the following: <wsa:webscriptaccess xmlns:wsa="http://www.mozilla.org/2002/soap/security"> delegation if the <delegate/> element is present then "web-scripts-access.xml" is required in the subdirectory for uris which are in a subdirectory. for example, if the script in question is "http://www.example.com/foo/bar.xml", then the declarations file http://www.example.com/web-scripts-access.xml which contains the "delegate" keyword delegates to http://www.example.com/foo/web-scripts-access.xml. if the uri is in a subdirectory, and the root directory's access file delegated but no...
Windows Install - Archive of obsolete content
windows install example this example shows the installation of a xpi in which user profile information is contained. note the disk space verification, the editing of the windows registry, the writing to the installation log, and the error checking before either performinstall or cancelinstall is called. ...
...l is called. ...
...(dirpath, spacerequired) { var spaceavailable; // get the available disk space on the given path spaceavailable = filegetdiskspaceavailable(dirpath); // convert the available disk space into kilobytes spaceavailable = parseint(spaceavailable / 1024); // do the verification if(spaceavailable < spacerequired) { logcomment("insufficient disk space: " + dirpath); logcomment(" required : " + spacerequired + " k"); logcomment(" available: " + spaceavailable + " k"); return(false); } return(true); } function updatewinreg4ren8dot3() { var fprogram = getfolder("program"); var ftemp = getfolder("temporary"); //notes: // can't use a double backslash before subkey // - windows already puts it in. // subkeys have to exist before values can be put ...
The Joy of XUL - Archive of obsolete content
lications (browser, messenger, address book, etc.) is written in xul with one single code base supporting all mozilla platforms. separation of presentation from application logic one of the major downfalls of most web applications is the tight coupling of user interface elements with client application logic. this poses a significant problem in team environments because the skills required to develop these two parts are often satisfied by different people. xul provides a clear separation among the client application definition and programmatic logic ("content" consisting of xul, xbl, and javascript), presentation ("skin" consisting of css and images), and language-specific text labels ("locale" consisting of dtds and string bundles in .properties files). the layout and appearan...
...ined virtually unchanged. porting xul applications to other platforms is trivial.the calendar originated as a linux application with no consideration given to porting it to other platforms. but later, when the original developer (oeone corporation) contributed the source to the mozilla project, the calendar had to be migrated to the windows and macintosh platforms. the ui for the xul application required zero porting effort because it worked with almost no alteration on both new platforms. similarly, since the ui code is written in javascript, the interaction logic worked with no effort. however, since the libical library is written in c, more significant effort was required to migrate this component to the other platforms. fortunately, an implementation of the libical library was already availa...
...s too was complete and mozilla had a working calendar for all three primary platforms: linux, macintosh, and windows. xpinstall is easy for developers and for users.the calendar is not a planned deliverable for the mozilla 1.0 release, and therefore is not included as a standard component in regular nightly and milestone release builds. developers who are equipped with the software and knowledge required to compile mozilla can set an optional environment variable and build the calendar themselves. but many mozilla users who want to try out the calendar can't afford this luxury. using xpinstall it was easy for the developers to package a version of calendar that could be installed directly over the internet by clicking a link. conclusion mozilla, featuring xul, delivers a compelling technology f...
The Implementation of the Application Object Model - Archive of obsolete content
nsulated from the layout dll should those interfaces change, imply that a layer needs to exist between the pluggable content and the content tree interfaces. this layer would serve several useful functions. first of all it could streamline the redundancy in the interface methods and present a new interface for pluggable content that was much smaller and easier to plug into than the 4-5 interfaces required if directly implementing the content tree interfaces. furthermore, should the content tree interfaces change, only this layer would need to be updated. the pluggable content, safe behind this layer, wouldn't have to change at all. one natural solution to try for implementing such a layer might be inheritance. however, in this xpcom world, where each type of pluggable content is off in its own dll...
... store its uri in a member variable, and it could use that as a basis for resolving the pluggable data source from which it would obtain its information. statement #2 all content nodes that reside in the aom and that implement the content tree interfaces must be the same class of object. so now we're on the right track, but there are still some flaws in our architecture. let's consider another required feature that has heretofore gone unmentioned in this document: the need to take the same set of data and present it as completely different content models. the perfect example of this requirement is the personal toolbar. the personal toolbar must show up in a tree widget (in which case it has to be faking a tree content model, complete with <tt><treeitem></tt> and <tt><treecell></tt> nodes), or i...
... falls outside of the domain of an existing data source, it must be possible for that change to be persistently remembered by recording the change into a new data source that can then be read in when the data is re-aggregated in future sessions of the application. the architecture that i have just described, the very architecture that i claim it is most desirable to have in order to implement our required feature set, is a combination of xul and rdf. the xul/rdf architecture if you've read this far, you should now have a general idea of what the architecture is like, as well as the motivations for choosing such an architecture. now it's time to fill in some of the details by mentioning xul and rdf specifically. a picture (provided by chris waterson) of the xul/rdf architecture is shown below. ...
Introduction to Public-Key Cryptography - Archive of obsolete content
mime also makes it possible to encrypt email messages. this is also important for some business users. however, using encryption for email requires careful planning. if the recipient of encrypted email messages loses his or her private key and does not have access to a backup copy of the key, for example, the encrypted messages can never be decrypted. single sign-on network users are frequently required to remember multiple passwords for the various services they use. for example, a user might have to type a different password to log into the network, collect email, use directory services, use the corporate calendar program, and access various servers. multiple passwords are an ongoing headache for both users and system administrators. users have difficulty keeping track of different passwords, ...
...ions that follow explains how certificate hierarchies and certificate chains determine what certificates software can trust. ca hierarchies certificate chains verifying a certificate chain ca hierarchies in large organizations, it may be appropriate to delegate the responsibility for issuing certificates to several different certificate authorities. for example, the number of certificates required may be too large for a single ca to maintain; different organizational units may have different policy requirements; or it may be important for a ca to be physically located in the same geographic area as the people to whom it is issuing certificates. it's possible to delegate certificate-issuing responsibilities to subordinate cas. the x.509 standard includes a model for setting up a hierarchy ...
... their changing needs. issuing certificates is one of several managements tasks that can be handled by separate registration authorities. certificates and the ldap directory the lightweight directory access protocol (ldap) for accessing directory services supports great flexibility in the management of certificates within an organization. system administrators can store much of the information required to manage certificates in an ldap-compliant directory. for example, a ca can use information in a directory to prepopulate a certificate with a new employee's legal name and other information. the ca can leverage directory information in other ways to issue certificates one at a time or in bulk, using a range of different identification techniques depending on the security policies of a given org...
Building a Theme - Archive of obsolete content
note: this tutorial is about building themes for firefox 29 and later. other tutorials exist for building themes for earlier versions of firefox. for an older tutorial, see creating a skin for firefox. note: firefox for mac os x has changed some directories so the guide may be obsolete. setting up the development environment themes and extensions are packaged and distributed in zip files or bundles, with the xpi (pronounced “zippy”) file extension. ...
...we will be needing are located under the chrome\toolkit\skin\classic folder. create a folder called chrome in your theme's folder. next, the contents of the following directories to their respective folders into the folder. global to chrome/global mozapps to chrome/mozapps now that you've copied the global and mozapps folders, a handful of other folders from the browser/omni.ja archive are required. it is located in the browser folder in the location mentioned above. the files we will be needing from the browser/omni.ja archive are located under chrome/browser/skin/classic. copy the contents of the following directories to their respective folders. this gives us a base set of styles to work with. browser to chrome/browser/ communicator to chrome/communicator/ you should end up with t...
....*" indicates that the extension works with firefox 39 and any subsequent 39.x release. themes are compatible by default, unless you set strict compatibility mode for your theme. if you get a message that the install.rdf is malformed, it is helpful to load it into firefox using the file->open file command and it will report xml errors to you. see install manifests for a complete listing of the required and optional properties. save the file. styling the browser's ui with css firefox's user interface is written in xul and javascript. xul is an xml grammar that provides user interface widgets like buttons, menus, toolbars, trees, etc. user actions are bound to functionality using javascript. these xul elements are styled using css. if you don't know css, it's going to be a steep learning cur...
Index - MDN Web Docs Glossary: Definitions of Web-related terms
made to attack a single target, in order to swamp server resources and block legitimate users. 115 dos attack glossary, security dos (denial of service) is a network attack that prevents legitimate use of server resources by flooding the server with requests. 116 doctype browser, codingscripting, doctype, glossary, html, intro in html, the doctype is the required "<!doctype html>" preamble found at the top of all documents. its sole purpose is to prevent a browser from switching into so-called “quirks mode” when rendering a document; that is, the "<!doctype html>" doctype ensures that the browser makes a best-effort attempt at following the relevant specifications, rather than using a different rendering mode that is incompatible with some specificati...
...to content in a higher priority level when compared to normal users. 333 progressive enhancement accessibility, design, glossary progressive enhancement is a design philosophy that provides a baseline of essential content and functionality to as many users as possible, while delivering the best possible experience only to users of the most modern browsers that can run all the required code. 334 progressive web apps composing, glossary, progressive web apps progressive web apps is a term used to describe the modern state of web app development. this involves taking standard web sites/apps that enjoy all the best parts of the web — such as discoverability via search engines, being linkable via urls, and working across multiple form factors — and supercha...
...cryption. the key is usually called a "symmetric key" or a "secret key". 442 synchronous glossary, web, webmechanics synchronous refers to real-time communication where each party receives (and if necessary, processes and replies to) messages instantly (or as near to instantly as possible). 443 syntax codingscripting, glossary, syntax syntax specifies the required combination and sequence of characters making up correctly structured code. syntax generally includes grammar and the rules that apply to writing it, such as indentation requirements in python. 444 syntax error codingscripting, glossary, javascript an exception caused by the incorrect use of a pre-defined syntax. syntax errors are detected while compiling or parsing source co...
Web fonts - Learn web development
make sure that your designs look ok with each font, etc. web fonts but there is an alternative, which works very well, right back to ie version 6. web fonts are a css feature that allows you to specify font files to be downloaded along with your website as it is accessed, meaning that any browser that supports web fonts can have exactly the fonts you specify available to it. ...
...ont formats for decent cross-browser support. for example, most modern browsers support woff/woff2 (web open font format versions 1 and 2), the most efficient format around, but older versions of ie only support eot (embedded open type) fonts, and you might need to include an svg version of the font to support older versions of iphone and android browsers. we'll show you below how to generate the required code. fonts generally aren't free to use. you have to pay for them, and/or follow other license conditions such as crediting the font creator in the code (or on your site). you shouldn't steal fonts and use them without giving proper credit. note: web fonts as a technology have been supported in internet explorer since version 4! you can use the firefox font editor to investigate and manipu...
... 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 displayed 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 "yes, the fonts i'm uploading are lega...
Example 1 - Learn web development
irst example of code that explains how to build a custom form widget. ...
...kground: #000; color: #ffffff; } result for basic state active state html <div class="select active"> <span class="value">cherry</span> <ul class="optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> css /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { fon...
...ground: #000; color: #ffffff; } result for active state open state html <div class="select active"> <span class="value">cherry</span> <ul class="optlist"> <li class="option highlight">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> css /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { fon...
Tips for authoring fast-loading HTML pages - Learn web development
age structure. tools such as html tidy can automatically strip leading whitespace and extra blank lines from valid html source. other tools can "compress" javascript by reformatting the source or by obfuscating the source and replacing long identifiers with shorter versions. minimize the number of files reducing the number of files referenced in a web page lowers the number of http connections required to download a page, thereby reducing the time for these requests to be sent, and for their responses to be received. depending on a browser's cache settings, it may send a request with the if-modified-since header for each referenced file, asking whether the file has been modified since the last time it was downloaded. too much time spent querying the last modified time of the referenced files c...
...esearch on this subject is beneficial. it can be somewhat involved, but it will save a lot in page requests on pages which would normally not be cacheable. more information: http conditional get for rss hackers http 304: not modified http etag on wikipedia caching in http optimally order the components of the page download page content first, along with any css or javascript that may be required for its initial display, so that the user gets the quickest apparent response during the page loading. this content is typically text, and can, therefore, benefit from text compression in transit, thus providing an even quicker response to the user. any dynamic features that require the page to complete loading before being used, should be initially disabled, and then only enabled after the page...
...r anything that is after the script tags that do not have these attributes. note: even though these attributes do help a lot the first time a page is loaded, you should use them but not assume they will work in all browsers. if you already follow all javascript best practices, there is no need to change your code. example page structure · <html> · <head> · <link> ... css files required for page appearance. minimize the number of files for performance while keeping unrelated css in separate files for maintenance. · <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 sep...
Index - Learn web development
etely ignored its look and feel up to now. in the next article, we'll concentrate on fixing this, looking at the different ways vue provides to style components. 272 advanced svelte: reactivity, lifecycle, accessibility accessibility, beginner, components, frameworks, javascript, learn, lifecycle, svelte, client-side, reactivity in this article we have finished adding all the required functionality to our app, plus we've taken care of a number of accessibility and usability issues. we also finished splitting our app into manageable components, each one with a unique responsibility. 273 beginning our react todo list app, beginner, frameworks, javascript, learn, react, style, client-side now our todo list app actually looks a bit more like a real app! the pr...
......
...quick to load and responsive to user interaction. this is known as web performance, and in this module you'll focus on the fundamentals of how to create performant websites. 338 css performance optimization css, performance, reference, tutorial css is render blockingto optimize the cssom construction, remove unnecessary styles, minify, compress and cache it, and split css not required at page load into additional files to reduce css render blocking. 339 html performance features html, learning, web performance html is by default fast and accessible. it is our job, as developers, to ensure that we preserve these two properties when creating or editing html code. complications can occur when, for example, the file size of a <video> embed is too large, or whe...
Introduction to the server side - Learn web development
server-side development is highly recommended. what is server-side website programming? web browsers communicate with web servers using the hypertext transfer protocol (http). when you click a link on a web page, submit a form, or run a search, an http request is sent from your browser to the target server. the request includes a url identifying the affected resource, a method that defines the required action (for example to get, delete, or post the resource), and may include additional information encoded in url parameters (the field-value pairs sent via a query string), as post data (data sent by the http post method), or in associated cookies. web servers wait for client request messages, process them when they arrive, and reply to the web browser with an http response message. the response...
...tp responses. requests for static resources are handled in the same way as for static sites (static resources are any files that don't change —typically: css, javascript, images, pre-created pdf files etc). requests for dynamic resources are instead forwarded (2) to server-side code (shown in the diagram as a web application). for "dynamic requests" the server interprets the request, reads required information from the database (3), combines the retrieved data with html templates (4), and sends back a response containing the generated html (5,6). are server-side and client-side programming the same? let's now turn our attention to the code involved in server-side and client-side programming. in each case, the code is significantly different: they have different purposes and concerns...
...ludes selecting and styling ui components, creating layouts, navigation, form validation, etc. by contrast, server-side website programming mostly involves choosing which content is returned to the browser in response to requests. the server-side code handles tasks like validating submitted data and requests, using databases to store and retrieve data and sending the correct data to the client as required. client-side code is written using html, css, and javascript — it is run inside a web browser and has little or no access to the underlying operating system (including limited access to the file system). web developers can't control what browser every user might be using to view a website — browsers provide inconsistent levels of compatibility with client-side code features, and part of th...
Introducing a complete toolchain - Learn web development
r best work possible, and they should also only need to be set up once, if done properly. in the same way, setting up your development environment, if done well, needs doing only once and should be reusable in many future projects. you will probably want to review this part of the toolchain semi-regularly and consider if there's any upgrades or changes you should introduce, but this shouldn't be required too often. your toolchain will depend on your own needs, but for this example of a (possible) complete toolchain, the tools that will be installed up front will be: library installation tools — for adding dependencies. code revision control. code tidying tools — for tidying javascript, css, and html. code linting tools — for linting our code. library installation tools we'll use n...
...de these dependencies will not be installed. a "typical" project can have many development dependencies which are not needed to actually run the code in production. keeping them as separate dependencies reduces any unnecessary work when deploying to production (which we will look at in the next chapter). before starting on the development of the actual application code, a little configuration is required for our tools to work properly. it's not a prerequisite of developing for the web, but it's useful to have the tools configured correctly if they’re going to help catch errors during development — which eslint is particularly useful for. configuring our tools in the root of the project (not in the src directory), we will add configuration files to configure some of our tools, namely prettie...
...s on the basis that it will try to configure your development requirements on the fly. parcel will watch the code and run a live-reloading web server during development. this also means that parcel will install our software dependencies automatically as they are referenced in the source code, as we saw in chapter 3. parcel will take care of installing any transformation tooling and configuration required without us needing to intervene (in most cases). then as a final bonus, parcel can bundle and prepare the code for production deployment, taking care of minification and browser compatibility requirements. we therefore need to install the parcel dependency in our project too — run the following command in your terminal: npm install --save-dev parcel-bundler using future features the code f...
Gecko info for Windows accessibility vendors
indicates that the absence of state_checked should be spoken as // "unchecked", and that event_state_change will be fired in the event that the // checkbox is toggled. const unsigned ...
...d states are supported gecko defines three state constants using previously unused states: const unsigned long state_checkable = state_marqueed; // useful on menuitem, listitem // and treeitem. indicates that the absence of state_checked should be spoken as // "unchecked", and that event_state_change will be fired in the event that the // checkbox is toggled. const unsigned long state_required = state_alert_low; // used on form controls // to indicate that this field must be filled out to submit the form const unsigned long state_invalid = state_alert_high; // used on form controls to // indicate the the field does not currently have a legal value const unsigned long state_??? = state_alert_medium; // reserved for future use. document structure exposed in msaa tree bst...
... it clear that the description is truly intended to be read. neither "description:" or "of" in the above strings is ever localized, so they should be parsed out. dhtml accessibility is supported this means that you may encounter roles that are not typically in html content. be prepared for new combinations of roles and states in content, such as role_slider, role_progressbar and state_required. in addition, check the state_focusable bit on tables, which indicates a traversable dhtml spreadsheet. please see the dhtml accessibility documentation page for more information on this topic. iaccessibles persist unless the document changes, retrieving the iaccessible more than once for the same object will return the same iaccessible*. the uniqueid will remain the same as well. if ...
Software accessibility: Where are we today?
ome, like stephen hawking, enter information by choosing among lists of options. they might press a switch down to begin moving a highlight bar through the list, and release the switch when the desired option is highlighted. special keyboards exist to make data entry easier. however, any special features are generally handled in the keyboard itself, so that no special programming is required. speech recognition technology lets people talk to the computer. this technology has come a long way, but still needs to be more integrated into mainstream software. consistent keyboard support and hotkeys many people can't use a mouse. extremely consistent keystroke support is a very important consideration. blind testers have knack for finding ways to improve keystro...
...ly partial success, largely due to the fact that it requires significant changes to applications which are made accessible. because most popular desktop and productivity applications are not open source, this forced disabled people to rely on the companies which produce this software to make it accessible. these companies were often reluctant for various reasons including the large amount of time required to do so. on a positive note, recent federal purchasing rules such as section 508 have caused many companies to pay attention and implement msaa support. enter open source software microsoft was on the right track with microsoft active accessibility, but because the source code to most popular desktop applications which are used in large corporations is not publicly available, they were never mad...
...designs, rather than tacked onto as an afterthought. it also gives disabled programmers a chance to control their own destiny, by giving them the opportunity and the right to directly fix the innaccessible software themselves. furthermore, any software solution that can enable equality should by all rights be free of charge - an integral part of society's infrastructure. if no special hardware is required, why should a disabled person pay extra money to use the same software as everyone else? that said, there is still an important role for adaptive technology vendors in creating special services and hardware, or even proprietary software on platforms where that is appropriate. . the ideal situation would be for adaptive technology professionals to make money on rehab, trainingand support - somethi...
Creating Sandboxed HTTP Connections
irect - when a redirect happens, a new nsichannel is created, and both the old and new ones are passed in as arguments. since nsistreamlistener does not cover cookies, the current channel being used will need to be stored as a global, since another listener will be used for cookie notifications (covered in the next section). it is usually best to use a javascript wrapper that implements all the required methods and calls the specified callback function when the connection has completed. below is an example: // global channel var gchannel; // init the channel // the io service var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); // create an nsiuri var uri = ioservice.newuri(myurlstring, null, null);...
...e request header's value. if amerge is true, the new value is appened, otherwise the old value is overwritten. getresponseheader(aheader) - returns the response header value for the requested header. setresponseheader(aheader, avalue, amerge) - sets the response header's value. if amerge is true, the new value is appened, otherwise the old value is overwritten. these methods provide all the required functionality needed to modify cookies before they are processed/sent, allowing for sandboxed cookie connections that don't affect the user's cookies. http referrer if the http request needs to have a referrer set, two additional steps are needed after the nsichannel is created, but before it is opened. first, a nsiuri needs to be generated for the referrer url. like before, the nsiioservice is...
... first, a nsiinputstream instance is created, after which the setdata method is called. the first argument is the post data as a string, while the second argument is the length of that data. in this case, the data is url encoded, meaning that the string should look like this: foo=bar&baz=eek. var inputstream = components.classes["@mozilla.org/io/string-input-stre...
Updating NSPR or NSS in mozilla-central
spr and nss teams and always taken from exports of hg tags. do not check in individual changes. if you check in an individual change by mistake, your change will be lost when the nspr and nss teams push a new hg tag to mozilla-central. ...
...2784), you must manually add a dummy change (add or remove a blank line) to force a rebuild of nspr: mozilla/nsprpub/config/prdepend.h or nss: mozilla/security/nss/coreconf/coreconf.dep check directory mozilla/nsprpub/patches/ for patches that need to be applied to nspr, and directory mozilla/security/patches/ for patches that need to be applied to nss. apply the patches. if merging is required, update the patch file. if a patch is no longer needed, remove the patch from the directory and update the readme file. check for new or removed files $ hg addremove -n review the output to make sure it looks correct update the minimum required system nss version in old-configure.in. this is for builds with --with-system-nss. for example, in the following, "3.16.1" would be replaced w...
... push the update: $ hg push ...
Displaying Places information using views
ylesheet browser/components/places/content/places.css and overlay the file browser/components/places/content/placesoverlay.xul: <?xml-stylesheet href="chrome://browser/content/places/places.css" ?> <?xul-overlay href="chrome://browser/content/places/placesoverlay.xul" ?> it's this stylesheet that binds elements with the special type attribute to one of the views. the overlay contains javascript required by the views. it also contains the built-in places context menu and commands, which you may want to take advantage of in your own uses of the views. connecting a view to its data to hook up a built-in view to its data, use the view's special place attribute. note: starting in gecko 2.0, you can't use the place attribute with menus. see menu view for details. you may specify the attribute di...
...; treeview.selectnode(somehistoryresultnode); placestreeview note: this section describes the implementation of the places tree view. the built-in tree view is backed by an instance of placestreeview, a prototype defined in browser/components/places/content/treeview.js. placestreeview performs double duty for the built-in tree view: it implements both nsitreeview and much of the functionality required of a places view. the latter functionality is specified specifically by interface nsinavhistoryresulttreeviewer, which inherits from the more general nsinavhistoryresultobserver . because of placestreeview's double duty, you can use it to bridge a query result and a tree element: var result = historyservice.executequery(query, opts); // your places query result var tree = document.getelementbyi...
...e old nsitreeview to null. because the object implementing nsitreeview also implements nsinavhistoryresultobserver, the viewer then disconnects itself from the result by calling removeobserver().) is this still right when using nsinavhistoryresultobserver? creating custom tree views custom places tree views can be a lot of work. take a look at using the tree view above to get an idea of what's required. custom nsitreeviews in general are a lot of work, and if you are not familiar with creating custom nsitreeviews, see the custom tree views and tree view details pages in the xul tutorial. all of that information is relevant here. fortunately you can commandeer parts of the built-in tree view to suit your purposes. the javascript prototype backing the built-in view, placestreeview, is especially...
API-provided widgets
to create a widget, you should pass a specification object with its desired properties. this document details the available properties. properties property description id the id of the widget (required). type a string indicating the type of widget. possible types are button for simple button widgets (the default) view for buttons that open a panel or subview, depending on where they are placed. custom for fine-grained control over the creation of the widget. viewid only useful for views (and required there): the id of the that should be shown when clicking the widget. tooltiptext string to use for the tooltip of the widget label string to use for the label of the widget ...
... label string to use for the label of the widget removable whether the widget is removable (optional, default: true). nb: if you specify false here, you must provide a defaultarea, too. overflows whether widget can overflow when in an overflowable toolbar (optional, default: true) defaultarea default area to add the widget to (optional, default: none; required if non-removable) shortcutid id of an element that has a shortcut for this widget (optional, default: null). this is only used to display the shortcut as part of the tooltip for builtin widgets (which have strings inside customizablewidgets.properties). if you're in an add-on, you should not set this property, and should instead include the shortcut as part of the tooltiptext you pass...
...cut as part of the tooltiptext you pass in yourself. showinprivatebrowsing whether to show the widget in private browsing mode (optional, default: true) event handlers you can also define several event handlers which will be called at various stages in a widget's lifetime: event handler name description onbuild(adoc) only useful for custom widgets (and required there); a function that will be invoked with the document in which to build a widget. should return the dom node that has been constructed. nb: the dom node you construct should have the same id as the id property described above, so that customizableui can find the node again later. onbeforecreated(adoc) attached to all non-custom widgets; a function that will be invoked before the w...
Mozilla Web Developer FAQ
s2 box layout model the default vertical sizing of layout boxes and the default vertical alignment of images is different from the behavior of old browsers. these aspects of the layout can be changed by explicitly setting the display css property of the images (and possible surrounding <a> elements) to block. if the table cells that contain only an image are marked with <td class="imgcell">, the required css rule is: .imgcell img, .imgcell a { display: block; } longer explanation… why are there still gaps even between text rows in tables when the layout engine is in the standards mode or in the almost standards mode? in the standards mode and in the almost standards mode mozilla does not suppress the default margins of the first and last child element in table cells. therefore, the default m...
..., 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 displayed 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 title attribute in a tooltip. does mozilla support downloadable font...
...er versions of mozilla as well as in old mozilla-based products, there is no pseudo-dtd catalog and the use of externally defined character entities (other than the five pre-defined ones) leads to an xml parsing error. there are also other xhtml user agents that do not support externally defined character entities (other than the five pre-defined ones). since non-validating xml processors are not required to support externally defined character entities (other than the five pre-defined ones), the use of externally defined character entities (other than the five pre-defined ones) is inherently unsafe in xml documents intended for the web. the best practice is to use straight utf-8 instead of entities. (numeric character references are safe, too.) document.write() is not supported. the stream tha...
NSS Sample Code Sample1
re persistant keys. steps // 1a through 1x show how to do this). // 1a. the primary host generates an rsa keypair that will be used // store keys locally. // 1b. the primary host wraps the newly generated key using the // rsa key and stores the wrapped key data in a local file. // 1c. the primary host unwraps the key using the rsa key each time // access to the key is required, such as at server startup. // 2. the secondary host generates an rsa keypair that will be used // to transport keys between the primary host and itself. this // key needs to exist long enough to be used to process the // response to a key transport request that is made to the primary // server. the example here shows how to create a permanent (token) // rsa key for this purpose. (...
...the wrapped // key data came from the primary host. the same methods outlined // in step 4 may be used here. // 7. the secondary host unwraps the the key using its own rsa private key. // note: currently nss does not support permanent symmetric keys. // the secondary host may store the wrapped value that was received // from the primary in a file, and unwrap it each time the key is required // (such as at server startup). // nss actually has some support for permanent symmetric keys. however this // example will need to be modified somewhat in order to demonstrate it. // utility function to print hex data static void printbuffer(unsigned char *digest, unsigned int len) { int i; cout << "length: " << len << endl; for(i = 0;i < len;i++) printf("%02x ", digest[i]); cout <...
...secitem_freeitem(mwrappedmackey, pr_true); if (menckey) pk11_freesymkey(menckey); if (mmackey) pk11_freesymkey(mmackey); } int server::init() { int rv = 0; seckeyprivatekey *prvkey = 0; seckeypublickey *pubkey = 0; pk11slotinfo *slot = 0; pk11rsagenparams rsaparams; secstatus s; // see if there is already a private key with this name. // if there is one, no further action is required. rv = getprivatekey(&prvkey); if (rv == 0 && prvkey) goto done; rv = 0; // these could be parameters to the init function rsaparams.keysizeinbits = 1024; rsaparams.pe = 65537; slot = pk11_getinternalkeyslot(); if (!slot) { rv = 1; goto done; } prvkey = pk11_generatekeypair(slot, ckm_rsa_pkcs_key_pair_gen, &rsaparams, &pubkey, pr_true, pr_true, 0); if (!prvke...
PKCS11 FAQ
Mozilla › Projects › NSS › PKCS11 › FAQ
dule, it was implemented only to support nss, though other products have managed to get it to work in their environment. there are a number of bugs against softoken's non-compliance, but these bugs have lower priority than fixing nss's non-complient uses of pkcs #11 or adding new features to nss. if multiple pkcs #11 modules are loaded, how does nss determine which ones to use for the mechanisms required by ssl? nss uses the first slot it finds that can perform all the required operations. on servers, it's almost always the slot that contains the server's private key. does nss support the use of pkcs #11 callbacks specified in the pnotify and papplication parameters for c_opensession? nss does not currently use any of the callbacks. nss applications detect card insertion and deletion by means...
...il certificate for use with s/mime? an email address must be included in the attribute of the subject dn or the mail attribute of the subject dn. if the subject dn does not include an email address, the certificate extension subjectaltname must include an email address. the subjectaltname extension is part of the x.509 v3 and pkix specifications. if i have a multipurpose token that supports all required pkcs #11 functions and provides rsa_pkcs and dsa mechanisms but but not aes, des or rc4, will nss use the token for the rsa_pkcs mechanisms and the nss internal pkcs #11 module for aes, des or rc4 when making an ssl connection? once nss starts using a token for a given operation (like s/mime or ssl), it works hard to keep using that same token (so keys don't get moved around). symmetric operatio...
...isible to all sessions of the same application. nss explicitly depends on this semantic without the use of c_copyobject. if your module does not support this semantic, it will not work with nss. questions about pins will a password change ever be done on the token? yes, nss attempts to change the password in user mode only. (it goes to sso mode only if your token identifies itself as ckf_login_required, but not ckf_user_initialized). it's perfectly valid to reject the password change request with a return value such as ckr_function_not_supported. if you do this, nss applications display an appropriate error message for the user. if i have my smart card which has initial pin set at '9999', i insert it into my reader and download with my certificate (keygen completed), can i issue 'change passw...
TPS Bookmark Lists
" are all children of this) sub-folders are preceded with forward slashes, so "menu/folder1" denotes that "folder1" is a sub-folder of "menu". tps does not support forward slashes as part of a folder name. folder contents the contents for a folder are given as an array of objects, representing various bookmark types, described below. bookmark objects valid properties are: uri: the bookmark uri. required. title: the bookmark title. optional. defaults to the bookmark uri. loadinsidebar: true or false. optional. toggles the "load in sidebar" property. description: the bookmark description. optional. tags: an array of tags for the bookmark. optional. keyword: the keyword for the bookmark. optional. after: the title of the bookmark item expected to be found after this bookmark; used only in verify an...
...re this bookmark should be moved to (i.e., this bookmark would be inserted into the bookmark list at the position of the named bookmark, causing that bookmark to be positioned below the current one) example: { uri: "http://www.google.com", title: "google", loadinsidebar: false, tags: [ "google", "computers", "misc" ] } livemark objects valid properties are: livemark: the livemark name. required. siteuri: the livemark's uri. optional. feeduri: the livemark's feed uri. required. after: the title of the bookmark item expected to be found after this livemark; used only in verify and modify actions. before: the title of the bookmark item expected to be found before this livemark; used only in verify and modify actions. changes: an object containing new properties to be set for this livemark ...
..., this livemark would be inserted into the bookmark list at the position of the named bookmark, causing that bookmark to be positioned below the current one) example: { livemark: "livemarkone", feeduri: "http://rss.wunderground.com/blog/jeffmasters/rss.xml", siteuri: "http://www.wunderground.com/blog/jeffmasters/show.html" } folder objects valid properties are: folder: the folder's name. required. description: the folder's description. optional. after: the title of the bookmark item expected to be found after this folder; used only in verify and modify actions. before: the title of the bookmark item expected to be found before this folder; used only in verify and modify actions. changes: an object containing new properties to be set for this folder when this asset list is used in a modify...
Mozilla internal string guide
ent 8-bit class: naming convention for wide and narrow string classes wide narrow nsastring nsacstring nsstring nscstring nsautostring nsautocstring etc... the string classes distinguish, as part of the type hierarchy, between strings that must have a null-terminator at the end of their buffer (ns[c]string) and strings that are not required to have a null-terminator (nsa[c]string). nsa[c]string is the base of the string classes (since it imposes fewer requirements) and ns[c]string is a class derived from it. functions taking strings as parameters should generally take one of these four types. in order to avoid unnecessary copying of string data (which can have significant performance cost), the string classes support different owne...
...or_failure; ... // and later, still nothing to free } the resulting code is much simpler, and easy to read. literal strings a literal string is a raw string value that is written in some c++ code. for example, in the statement printf("hello world\n"); the value "hello world\n" is a literal string. it is often necessary to insert literal string values when an nsastring or nsacstring is required. two user-defined literals are provided that implicitly convert to const nsstring& resp. const nscstring&: ""_ns for 8-bit literals, converting implicitly to const nscstring& u""_ns for 16-bit literals, converting implicitly to const nsstring& the benefits of the user-defined literals may seem unclear, given that nsdependentcstring will also wrap a string value in an nscstring. the advantag...
...ill only copy the value into the nsautostring's buffer. moreover, using the string classes allows for sharing of string buffers. in many cases, assigning from one string object to another avoids copying in favor of simply incrementing a reference count. in strings using string classes often have their length pre-calculated. this can be a performance win. in cases where a raw-character buffer is required, string and wstring provide faster access than promiseflatstring. utf-8 strings defined with autf8string may need to be decoded when crossing xpconnect boundaries. this can be a performance hit. on the other hand, utf-8 strings take up less space for strings that are commonly ascii. utf-16 strings defined with wstring or astring are fast when the unicode value is required. however, if the value...
Reference Manual
// |nscomptr|s... nscomptr<nsifoo> foo; getfoo(getter_addrefs(foo)); getfoo2(*getter_addrefs(foo)); getsomething(getter_addrefs(foo)); why not just overload operator& to do this work? several reasons: it would become inconvenient take the address of an nscomptr in all other situations; the name "getter_addrefs" enforces the notion that a certain behavior is required of the getter; and once upon a time, there was another possibility (as you're about to learn). is there a getter_doesnt_addref( nscomptr& ) for getters that return non-addrefed results through a parameter? no, there isn't. once upon a time, there was, but it went away for three reasons: it is against the rules of xpcom for a getter to return a non-addrefed interface pointer through a parameter...
... with raw pointers. even if you don't follow these suggestions, your nscomptr code may still end up smaller, or at worst only negligibly bulkier than the raw pointer version. see code bloat [long, summary at top] for details, though the recommendations from that document are re-iterated here. time [[more time-performance measurements are needed.]] in places where two or more subroutines calls are required, i.e., of addref, release, and queryinterface, some nscomptr routines are factored, and hence, require additional time corresponding to invoking a subroutine. this time is negligable, especially in the face of work done by queryinterface, and the work that may be done by release. in all other cases, nscomptr does only the work you would have done by hand. the bulk of the work for which an nscompt...
... for which an nscomptr is used is dereferencing with operator->, just as it is with a primitive pointer. on every platform, this operation generates the exact same code, and takes the same time, as performing this operation on a raw xpcom interface pointer. the destructor, which corresponds to client code calling release against a raw xpcom interface pointer, is factored, requiring the extra time required to invoke a subroutine call, though this is balanced against the cost already present in both cases of calling release which may, in turn, invoke delete and the referents destructor. all nscomptrs constructors and assignment operators are inline. the simple constructors, i.e., those that don't query, do only exactly the same work that you would do by hand. any routines that call more than one of ...
xptcall FAQ
what is xptcall? xptcall is a small low level xpcom method call library. it is implemented using platform specific c/c++ and assembly language code. it is used to facilitate cross language and cross thread method calls. porting this code is required in order to make mozilla run on any given platform. why does xptcall exist? xptcall exists for two reasons: to support invoking arbitrary methods on xpcom interfaces. to support dynamically impersonating any xpcom interface. both of these facilities are required by xpconnect. these facilities are also used by xpcom/proxy. it may also be used by other subsystems in the future. the xptcall approach was chosen over an approach that would have required generating stub code for calling and implementing all interfaces. though the chosen app...
...rary pointer types). given the correct set of parameters, this function can call any method on any xpcom interface. xpconnect uses information from typelib files to reflect arbitrary xpcom interfaces into javascript and to make calls from javascript to xpcom using xptc_invokebyindex. the information in the typelibs allows xpconnect to convert function parameters and build the nsxptcvariant array required to make this call. the stubs (or impersonation) facility of xptcall allows for implementing a class which can, at runtime, pretend to be any xpcom interface. this is done by providing a vtbl full of generic function stubs in xptcall. these stubs forward calls to a shared function whose job it is to use the typelib information to extract the parameters from the platform specific calling conventio...
...te a bunch of platform specific code to build interface specific vtbls and method stubs. the method i choose was to use a single large vtbl with a lot of small generic stubs. this minimizes the platform specific code as much as possible. again, you just can't write code in c to do all this. the varargs stuff goes part way, but is just not enough. if anyone has credible ideas about how to get the required functionality in a cross platform way and/or without resorting to assembly code i'd love to hear about it. is xptcall a platform requirement for mozilla? yes. mozilla will not run properly without a functioning port of xptcall. non-functional stub code exists to allow building xptcall on non-supported platforms. but any browser feature that relies on xpconnect will fail. any platform that does ...
Address Book examples
.getservice(components.interfaces.nsiabmanager); let alladdressbooks = abmanager.directories; while (alladdressbooks.hasmoreelements()) { let ab = alladdressbooks.getnext(); if (ab instanceof components.interfaces.nsiabdirectory && !ab.isremote) { let searchresult = abmanager.getdirectory(ab.uri + "?" + searchquery).childcards; // ... use searchresult as required. } } note: this method doesn't work with remote address books (e.g. ldap). hence the additional !ab.isremote check how do i add/edit/delete contacts? note: not all address books can be written to. use the nsiabcollection.readonly attribute to determine the read-only status of an address book adding contacts create a card and set its properties using the nsiabcard interface (see the interf...
...delete it like this: var abmanager = components.classes["@mozilla.org/abmanager;1"] .createinstance(components.interfaces.nsiabmanager); abmanager.deleteaddressbook(maillist.uri); how do i display properties dialogs to the user? in the following examples: selectedab is the uri of an address book to default the dialog to saving the card in. this may be blank if not required. aburi and card are the uri of the address book and the card contained within that address book. new contact dialog window.opendialog("chrome://messenger/content/addressbook/abnewcarddialog.xul", "", "chrome,resizable=no,titlebar,modal,centerscreen", {selectedab:selectedab}); edit contact dialog window.opendialog("chrome://messenger/con...
... the onsave function. returns true on success. * if the function returns false, the generic photo handler onshow * function will be called. * * onsave: function(acard, adocument) * called when the editor wants to save this photo type. the * onsave method is responsible for analyzing the photo of this * type requested by the user, and storing it, as well as the * other fields required by onload/onshow to retrieve and display * the photo again. returns true on success. if the function * returns false, the generic photo handler onsave function will * be called. */ photo handlers are registered within the context of the contact editor dialog using the registerphotohandler function, as follows: registerphotohandler(atype, aphotohandler) ...where atype is a string w...
FileHandle API - Web APIs
be unique. note: the above code only creates a "temporary file" that exists only while you hold the filehandle instance. if you want a file to survive a page refresh/app relaunch, you need to store the handle in a more permanent location, like the database itself. see file storage below to learn more about this. perform read and write operations to read or write within a handled file, it is required to get a lockedfile. the filehandle.open() method provides such an object which can be readonly or readwrite. any attempt to perform a write action on a readonly lockedfile object will fail. writing there are three possible writing operations on a locked file: write : it's an arbitrary writing method which starts writing in the file at the lockedfile.location byte. append : this operation a...
...ss: ' + this.error); } reading it's possible to directly write the content of a lockedfile object without using an intermediate file object and a filereader object. the lockedfile interface provides a readastext method and a readasarraybuffer method. those two methods expect a size to indicate how many bytes must be read starting at the lockedfile.location byte. to read the whole file, it is required to know its size. this information (as well as the date of its last modification) can be retrieved through the lockedfile.getmetadata() method. // get a lockedfile object from the handle var myfile = myfilehandle.open('readwrite'); // retrieve the size of the file var getmeta = myfile.getmetadata(); getmeta.onsuccess = function () { var size = this.result.size; // the reading operation wi...
...ully stored and can be retrieved anytime.') } } } a file stored that way is physically put on the device. the database itself only stores a pointer to that file. it means that if the filehandle object is stored several times in several dbs or several data stores, all those objects will reference the same unique file. this is not a problem because to access the file, a lockedfile object is required and operations on such object are performed in isolation, meaning that once a lockedfile is active, all operations of this lockedfile are guaranteed to happen sequentially on the underlying file without being interleaved with operations from other lockedfile. secured write operation for performance reasons, write (and read) operations are done in memory. periodically, the results of those opera...
The HTML DOM API - Web APIs
tain the html, as well as to the browser's state, available plugins (if any), and various configuration options. barprop navigator window deprecated web app and browser integration interfaces external obsolete web app and browser integration interfaces applicationcache plugin pluginarray form support interfaces these interfaces provide structure and functionality required by the elements used to create and manage forms, including the <form> and <input> elements. formdataevent htmlformcontrolscollection htmloptionscollection radionodelist validitystate canvas and image interfaces these interfaces represent objects used by the canvas api as well as the <img> element and <picture> elements. canvasgradient canvaspattern canvasrenderingcontext2d imag...
...e of the input; if it's zero, then the "send" button is disabled if it's not already disabled. otherwise, the code ensures that the button is enabled. with this in place, the "send" button is always enabled whenever the user name input field has a value, and disabled when it's empty. html the html for the form looks like this: <p>please provide the information below. ...
... already disabled. otherwise, the code ensures that the button is enabled. with this in place, the "send" button is always enabled whenever the user name input field has a value, and disabled when it's empty. html the html for the form looks like this: <p>please provide the information below. ...
Ajax navigation example - Web APIs
used", 300: "multiple choices", 301: "moved permanently", 302: "found", 303: "see other", 304: "not modified", 305: "use proxy", 306: "reserved", 307: "temporary redirect", 308: "permanent redirect", 400: "bad request", 401: "unauthorized", 402: "payment required", 403: "forbidden", 404: "not found", 405: "method not allowed", 406: "not acceptable", 407: "proxy authentication required", 408: "request timeout", 409: "conflict", 410: "gone", 411: "length required", 412: "precondition failed", 413: "request entity too large", ...
...ndition failed", 413: "request entity too large", 414: "request-uri too long", 415: "unsupported media type", 416: "requested range not satisfiable", 417: "expectation failed", 422: "unprocessable entity", 423: "locked", 424: "failed dependency", 425: "unassigned", 426: "upgrade required", 427: "unassigned", 428: "precondition required", 429: "too many requests", 430: "unassigned", 431: "request header fields too large", 500: "internal server error", 501: "not implemented", 502: "bad gateway", 503: "service unavailable", 504: "gateway timeout", 505: ...
...ted", 502: "bad gateway", 503: "service unavailable", 504: "gateway timeout", 505: "http version not supported", 506: "variant also negotiates (experimental)", 507: "insufficient storage", 508: "loop detected", 509: "unassigned", 510: "not extended", 511: "network authentication required" }; var oreq, bisloading = false, bupdateurl = false; oloadingbox.id = "ajax-loader"; ocover.onclick = abortreq; oloadingimg.src = "data:image/gif;base64,r0lgodlheaaqapiaap///waaamlcwkjcqgaaagjiyokcgpkskih/c05fvfndqvbfmi4waweaaaah/hpdcmvhdgvkihdpdgggywphegxvywquaw5mbwah+qqjcgaaacwaaaaaeaaqaaadmwi63p4wyklre2mioggznadomgyjrbexwroumcg2lmdewnhqlvsyod2mbzkydadka+diaa...
Using the Payment Request API - Web APIs
al payment amount, tax, shipping cost, etc. options (optional) — an object containing addtional options related to the payment. ...
...show().then(function(paymentresponse) { // here we would process the payment. for this demo, simulate immediate success: paymentresponse.complete('success') .then(function() { // for demo purposes: intropanel.style.display = 'none'; successpanel.style.display = 'block'; }); }) this object provides the developer with access to details they can use to complete the logical steps required after the payment completes, such as an email address to contact the customer, a shipping address for mailing goods out to them, etc. in the code above, you'll see that we've called the paymentresponse.complete() method to signal that the interaction has finished — you'd use this to carry out finishing steps, like updating the user interface to tell the user the transaction is complete, etc. o...
... checkoutobject); request.show().then(function(paymentresponse) { // here we would process the payment. paymentresponse.complete('success') .then(function() { // finish handling payment }); }) } }) paymentrequest.abort() can be used to abort the payment request if required. detecting availability of the payment request api you can effectively detect support for the payment request api by checking if the user's browser supports paymentrequest, i.e. if (window.paymentrequest). in the following snippet, a merchant page performs this check, and if it returns true updates the checkout button to use paymentrequest instead of legacy web forms. const checkoutbutton = d...
PublicKeyCredentialCreationOptions.authenticatorSelection - Web APIs
h may be used across different platform (such as a usb or nfc device). requireresidentkeyoptional a boolean which indicated that the credential private key must be stored in the authenticator, the client or in a client device. the default value is false. userverificationoptional a string qualifying how the user verification should be part of the authentication process. ...
...latform (such as a usb or nfc device). requireresidentkeyoptional a boolean which indicated that the credential private key must be stored in the authenticator, the client or in a client device. the default value is false. userverificationoptional a string qualifying how the user verification should be part of the authentication process. ...
...or the creation of the public key credential must comply with the requirements. note: see publickeycredential.isuserverifyingplatformauthenticatoravailable() which resolves to true when a user-verifiying platform authenticator is available. ...
Web Authentication API - Web APIs
connected by https or is the localhost), and will not be available for use if the browser is not operating in a secure context. in their most basic forms, both create() and get() receive a very large random number called a challenge from the server and they return the challenge signed by the private key back to the server. this proves to the server that a user is in possession of the private key required for authentication without revealing any secrets over the network. in order to understand how the create() and get() methods fit into the bigger picture, it is important to understand that they sit between two components that are outside the browser: server - the web authentication api is intended to register new credentials on a server (also referred to as a service or a relying party) and l...
...authentication, the password is replaced with a key pair that is stored in an authenticator. the authenticator may be embedded into an operating system, such as windows hello, or may be a physical token, such as a usb or bluetooth security key. registration a typical registration process has six steps, as illustrated in figure 1 and described further below. this is a simplification of the data required for the registration process that is only intended to provide an overview. the full set of required fields, optional fields, and their meanings for creating a registration request can be found in the publickeycredentialcreationoptions dictionary. likewise, the full set of response fields can be found in the publickeycredential interface (where publickeycredential.response is the authenticatoratte...
...nse that is the authenticatorattestationresponse containing the authenticatorresponse.clientdatajson and authenticatorattestationresponse.attestationobject. the publickeycredential is sent back to the server using any desired formatting and protocol (note that the arraybuffer properties need to be be base64 encoded or similar). server validates and finalizes registration - finally, the server is required to perform a series of checks to ensure that the registration was complete and not tampered with. these include: verifying that the challenge is the same as the challenge that was sent ensuring that the origin was the origin expected validating that the signature over the clientdatahash and the attestation using the certificate chain for that specific model of the authenticator a...
ARIA: switch role - Accessibility
="button" role="switch" aria-checked="true" id="speakerpower" class="switch"> <span>off</span> <span>on</span> </button> <label for="speakerpower" class="switch">speaker power</label> description the aria switch role is identical to the checkbox role, except instead of being "checked" or "unchecked", it is either "on" and "off." like the checkbox role, the aria-checked attribute is required. the two possible values are true and false. unlike a <checkbox> or role="checkbox", there is no indeterminate or mixed state. the switch role does not support the value mixed for the aria-checked attribute; assigning a value of mixed to a switch instead sets the value to false. assistive technologies may choose to represent switch widgets with a specialized presentation to reflect the notion of...
...s may choose to represent switch widgets with a specialized presentation to reflect the notion of an on/off switch. since a switch is an interactive control, it must be focusable and keyboard accessible. if the role is applied to a non-focusable element, use the tabindex attribute to change this. the expected keyboard shortcut for toggling the value of a switch is the space key. the developer is required to change the value of the aria-checked attribute dynamically when the switch is toggled. associated aria roles, states, and properties aria-checked attribute the aria-checked attribute is required when using the switch role, as it represents the current state of the widget that the switch role is applied to. a value of true represents the "on" state; false represents the "off" state; a valu...
...ported by the switch role, and is treated as false. the default value is false. aria-readonly attribute the aria-readonly attribute is supported by the switch role. it indicates whether the widget's state is editable by the user. a value of false means that the user can change the widget's state; a value of true means that the user cannot change the widget's state. the default value is false. required javascript features handler for click events when the user clicks on the switch widget, a click event is fired, which must be handled in order to change the state of the widget. changing the aria-checked attribute when a click event is fired on the switch widget, the handler must change the value of the aria-checked attribute from true to false, or vice versa. possible effects on user age...
ARIA: listbox role - Accessibility
role of the listbox when it gets focus. if an option or item is focused within the list, it gets announced next, followed by an indication of the item's position with the list if the screen reader supports this. as focus moves within the list, the screen reader announces the relevant items. associated aria roles, states, and properties associated roles option one or more nested options are required. all selected options have aria-selected set to true. all options that are not selected have aria-selected set to false. if an option is not selectable, omit the aria-selected. list a section containing listitem elements states and properties aria-activedescendant holds the id string of the currently active element within the listbox. if that's an option element, then that would be the ...
...to true if the user can select more than one option. if set to true, every selectable option should have an aria-selected attribute included and set to true or false. options which are not selectable should not have the aria-selected attribute. if false or omitted, only the currently selected option, if any option is selected, needs the aria-selected attribute, and it must be set to true. aria-required a boolean attribute which indicates that an option with a non-empty string value must be selected. aria-readonly the user cannot change which options are selected or unselected, but the listbox is otherwise operable. aria-label a human-readable string value which identifies the listbox. if there's a visible label, then aria-labelledby should be used instead to refer to that label. aria-lab...
...the focused option and all options up to the first option. optionally, moves focus to the first option. control + shift + end (optional): selects the focused option and all options down to the last option. optionally, moves focus to the last option. control + a (optional): selects all options in the list. optionally, if all options are selected, it may also unselect all options. required javascript features selecting an option in a single select listbox when the user selects an option, the following must occur: deselect the previously selected option, setting the aria-selected to false, or removing the attribute altogether, changing the appearance of the newly unselected option to appear not selected. select the newly selected option, setting aria-selected="true" on the opt...
Cognitive accessibility - Accessibility
at least 20 seconds to extend the timeout duration by a factor of 10 with a simple action, such as hitting the space bar. provide a toggle on content that allows users to enable a longer session time limit, or no session time limit at all. examples of timed content include forms, timed reading exercises, and training materials. if the time limit is longer than 20 hours, accommodations are not required. moving, blinking, scrolling it is important not to distract users, especially ones with cognitive disabilities. if moving, blinking, scrolling, or auto-updating information starts automatically, lasts more than five seconds, and is presented in parallel with other content, the user must able to pause, stop, hide or control it, unless it's an essential functionality. "essential" means t...
...ors. convey automated error detection users need to be alerted to the error and informed of what is wrong. if there is client side error detection, observe the following guidelines to make the error as effective as possible when conveyed to the user: the error must be described in the text. ensure that the error message is as specific as possible. provide text to identify incomplete required fields and text descriptions if a value entered is invalid. if the error prevented a form submission, focus on the error. if multiple errors are present, provide a summary, with each error linking to the related input. include text along with use of icons, images, color and so on. some people have difficulty understanding the meaning of icons and other visual cues. other people may have diffi...
...ed to input information, using the <label>, <fieldset>, and <legend> elements to do so. labels should be descriptive and positioned close to the input they relate to. when requiring a specific format for input, provide an example formatted in the proper way. additionally, consider performing server-side validation to help format input data, to aid in the ease of user input. if a form control is required, indicate it both visually and via code. if a form control changes context, describe what will happen in a way that the user will understand it before they cause the context change to happen. error suggestion provide suggested input to the user if an input error is automatically detected and suggestions for correction are known (unless doing so would jeopardize the security or purpose of...
:invalid - CSS: Cascading Style Sheets
Web › CSS › :invalid
e user. syntax :invalid examples this example presents a simple form that colors elements green when they validate and red when they don't. ...
...nter an email address:</label> <input type="email" id="email_input" required> </div> </form> css label { display: block; margin: 1px; padding: 1px; } .field { margin: 1px; padding: 1px; } input:invalid { background-color: #ffdddd; } form:invalid { border: 5px solid #ffdddd; } input:valid { background-color: #ddffdd; } form:valid { border: 5px solid #ddffdd; } input:required { border-color: #800000; border-width: 3px; } input:required:invalid { border-color: #c00000; } result accessibility concerns the color red is commonly used to indicate invalid input. people who have certain types of color blindness will be unable to determine the input's state unless it is accompanied by an additional indicator that does not rely on color to convey meaning. typicall...
...blindness will be unable to determine the input's state unless it is accompanied by an additional indicator that does not rely on color to convey meaning. typically, descriptive text and/or an icon are used. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.1 | w3c understanding wcag 2.0 notes radio buttons if any one of the radio buttons in a group is required, the :invalid pseudo-class is applied to all of them if none of the buttons in the group is selected. (grouped radio buttons share the same value for their name attribute.) gecko defaults by default, gecko does not apply a style to the :invalid pseudo-class. however, it does apply a style (a red "glow" using the box-shadow property) to the :-moz-ui-invalid pseudo-class, which applies in a subse...
Constraint validation - Developer guides
valuemissing constraint violation step date an integer number of days unless the step...
... limiting the si...
... 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 displayed 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 :invalid css pseudo-classes the :valid and :invalid pseudo-classes are used to represent <input> elements whose content validates and fails to val...
<img>: The Image Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › img
the html <img> element embeds an image into the document. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the above example shows 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 displayed on the page if the image can't be loaded for some reason: for example, network errors, content blocking, or linkrot. there are many o...
... image loading errors if an error occurs whil...
...e, so when images are used in an inline formatting context with vertical-align: baseline, the bottom of the image will be placed on the text baseline. you can use the object-position property to position the image within the element's box, and the object-fit property to adjust the sizing of the image within the box (for example, whether the image should fit the box or fill it even if clipping is required). depending on its type, an image may have an intrinsic width and height. for some image types, however, intrinsic dimensions are unnecessary. svg images, for instance, have no intrinsic dimensions if their root <svg> element doesn't have a width or height set on it. examples alternative text the following example embeds an image into the page and includes alternative text for accessibility. ...
<input type="date"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › date
ke the 32nd of april). if you use min and max to restrict the available dates (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. ...
...he 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 displayed 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"></span> </label> <p> <button>submit</button> </p> </form> if you try to submit the form with an incomplete date (or with a date outside the set bounds), the browser displays an error. try playi...
...people write dates. for example: ddmmyyyy dd/mm/yyyy mm/dd/yyyy dd-mm-yyyy mm-dd-yyyy month dd, yyyy one way around this is the pattern attribute on your date input. even though the date picker doesn't use it, the text input fallback will. for example, try viewing the following in a unsupporting browser: <form> <label for="bday">enter your birthday: <input type="date" name="bday" required pattern="\d{4}-\d{2}-\d{2}"> <span class="validity"></span> </label> <p> <button>submit</button> </p> </form> if you submit it, you'll see that the browser displays an error and highlights the input as invalid if your entry doesn't match the pattern ####-##-## (where # is a digit from 0 to 9). of course, this doesn't stop people from entering invalid dates, or incorrect formats. ...
Set-Cookie - HTTP
the set-cookie http response header is used to send a cookie from the server to the user agent, so the user agent can send it back to the server later. to send multiple cookies, multiple set-cookie headers should be sent in the same response. browsers block frontend javascript code from accessing the set cookie header, as required by the fetch spec, which defines set-cookie as a forbidden response-header name that must be filtered out from any response exposed to frontend code. for more information, see the guide on http cookies. header type response header forbidden header name no forbidden response-header name yes syntax set-cookie: <cookie-name>=<cookie-value> set-cookie: <cookie-name>=<cookie-value>; expires=<date> set-cookie: <cookie-name>=<co...
...ers, spaces, or tabs. it also must not contain a separator character like the following: ( ) < > @ , ; : \ " / [ ] ? = { }. a <cookie-value> can optionally be wrapped in double quotes and include any us-ascii characters excluding control characters, whitespace, double quotes, comma, semicolon, and backslash. encoding: many implementations perform url encoding on cookie values, however it is not required per the rfc specification. it does help satisfying the requirements about which characters are allowed for <cookie-value> though. __secure- prefix: cookies names starting with __secure- (dash is part of the prefix) must be set with the secure flag from a secure page (https). __host- prefix: cookies with names starting with __host- must be set with the secure flag, must be from a secure page (...
...must be set with the secure flag from a secure page (https). __host- prefix: cookies with names starting with __host- must be set with the secure flag, must be from a secure page (https), must not have a domain specified (and therefore aren't sent to subdomains) and the path must be /. expires=<date> optional the maximum lifetime of the cookie as an http-date timestamp. see date for the required formatting. if unspecified, the cookie becomes a session cookie. a session finishes when the client shuts down, and session cookies will be removed. warning: many web browsers have a session restore feature that will save all tabs and restore them next time the browser is used. session cookies will also be restored, as if the browser was never closed. when an expires date is set, the de...
encodeURIComponent() - JavaScript
, ', (, ), and *), even though these characters have no formalized uri delimiting uses, the following can be safely used: function fixedencodeuricomponent(str) { return encodeuricomponent(str).replace(/[!'()*]/g, function(c) { return '%' + c.charcodeat(0).tostring(16); }); } examples encoding for content-disposition and link headers the following example provides the special encoding required within utf-8 content-disposition and link server response header parameters (e.g., utf-8 filenames): var filename = 'my file(2).txt'; var header = "content-disposition: attachment; filename*=utf-8''" + encoderfc5987valuechars(filename); console.log(header); // logs "content-disposition: attachment; filename*=utf-8''my%20file%282%29.txt" function encoderfc5987valuechars(str) { ...
...er); // logs "content-disposition: attachment; filename*=utf-8''my%20file%282%29.txt" function encoderfc5987valuechars(str) { return encodeuricomponent(str). // note that although rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it replace(/['()]/g, escape). // i.e., %27 %28 %29 replace(/\*/g, '%2a'). // the following are not required for percent-encoding per rfc5987, // so we can allow for a little better readability over the wire: |`^ replace(/%(?:7c|60|5e)/g, unescape); } // here is an alternative to the above function function encoderfc5987valuechars2(str) { return encodeuricomponent(str). // note that although rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it ...
...t(str). // note that although rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it replace(/['()*]/g, c => "%" + c.charcodeat(0).tostring(16)). // i.e., %27 %28 %29 %2a (note that valid encoding of "*" is %2a // which necessitates calling touppercase() to properly encode) // the following are not required for percent-encoding per rfc5987, // so we can allow for a little better readability over the wire: |`^ replace(/%(7c|60|5e)/g, (str, hex) => string.fromcharcode(parseint(hex, 16))); } specifications specification ecmascript (ecma-262)the definition of 'encodeuricomponent' in that specification. ...
Critical rendering path - Web Performance
will be the width of the device instead of the default viewport width. the device-width changes when a user rotates their phone between landscape and portrait mode. layout happens every time a device is rotated or browser is otherwise resized. layout performance is impacted by the dom -- the greater the number of nodes, the longer layout takes. layout can become a bottleneck, leading to jank if required during scrolling or other animations. while a 20ms delay on load or orientation change may be fine, it will lead to jank on animation or scroll. any time the render tree is modified, such as by added nodes, altered content, or updated box model styles on a node, layout occurs. to reduce the frequency and duration of layout events, batch updates and avoid animating box model properties. paint t...
...ncy and duration of layout events, batch updates and avoid animating box model properties. paint the last step is painting the pixels to the screen. once the render tree is created and layout occurs, the pixels can be painted to the screen. onload, the entire screen is painted. after that, only impacted areas of the screen will be repainted, as browsers are optimized to repaint the minimum area required. paint time depends on what kind of updates are being applied to the render tree. while painting is a very fast process, and therefore likely not the most impactful place to focus on in improving performance, it is important to remember to allow for both layout and re-paint times when measuring how long an animation frame may take. the styles applied to each node increase the paint time, but remo...
...ptimization priority. optimizing for crp improve page load speed by prioritizing which resources get loaded, controlling the order in which they are loaded, and reducing the file sizes of those resources. performance tips include 1) minimizing the number of critical resources by deferring their download, marking them as async, or eliminating them altogether, 2) optimizing the number of requests required along with the file size of each request, and 3) optimizing the order in which critical resources are loaded by prioritizing the downloading critical assets, shorten the critical path length. ...
Introduction to progressive web apps - Progressive web apps (PWAs)
safe, so the connections between the user, the app, and your server are secured against any third parties trying to get access to sensitive data. offering these features and making use of all the advantages offered by web applications can create a compelling, highly flexible offering for your users and customers. is it worth doing all that? absolutely! with a relatively small amount of effort required to implement the core pwa features, the benefits are huge. for example: a decrease in loading times after the app has been installed, thanks to caching with service workers, along with saving precious bandwidth and time. pwas have near-instantaneous loading (from the second visit). the ability to update only the content that has changed when an app update is available. in contrast, with a nat...
...est-known success story is probably that of flipkart lite. india's largest e-commerce site was rebuilt as a progressive web app in 2015, which resulted in 70% increase in conversions. the aliexpress pwa has also seen much better results than either the web or the native app, with a 104% increase in conversion rates for new users. given their profit increase, and the relatively low amount of work required for the conversion of these apps to pwas, the advantage is clear. early stage emerging startups like couponmoto have also started using progressive web apps to drive more consumer engagement, showing that they can help small as well as big companies to (re-)engage users more effectively. you can check the list at pwa.rocks for more examples. particularly worth mentioning is the hnpwa.com page...
... of similarly-named apps, some of which may even be based on your own site, which only adds to the confusion. web apps eliminate that confusion and ensure that users get the best possible experience. browser support as mentioned before, pwas don't depend on a single api, but rather using various technologies to achieve the goal of delivering the best web experience possible. the key ingredient required for pwas is service worker support. thankfully service workers are now supported on all major browsers on desktop and mobile. other features such as web app manifest, push notifications, and add to home screen functionality have wide support too. currently, safari has limited support for web app manifest and add to home screen and no support for web push notifications. however, other major bro...
<a> - SVG: Scalable Vector Graphics
Web › SVG › Element › a
. value type: <list-of-link-types> ; default value: none; animatable: yes target where to display the linked url. value type: _self|_parent|_top|_blank|<name> ; default value: _self; animatable: yes type a mime type for the linked url. value type: <string> ; default value: none; animatable: yes xlink:href deprecated since svg 2 the url or url fragment that the hyperlink points to. ...
...t value: none; animatable: yes xlink:href deprecated since svg 2 the url or url fragment that the hyperlink points to. may be required for backwards compatibility for older browsers. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippat...
<svg> - SVG: Scalable Vector Graphics
Web › SVG › Element › svg
it is unnecessary for inner svg elements or inside html documents. ...
.... no effect on outermost svg elements. value type: <length>|<percentage> ; default value: 0; animatable: yes note: starting with svg2, x, y, width, and height are geometry properties, meaning these attributes can also be used as css properties. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <al...
<use> - SVG: Scalable Vector Graphics
Web › SVG › Element › use
em using css inheritance. for security reasons, browsers may apply the same-origin policy on use elements and may refuse to load a cross-origin url in the href attribute. there is currently no defined way to set a cross-origin policy for use elements. since svg 2, the xlink:href attribute is deprecated in favor of href. see xlink:href page for more information. however, xlink:href can still be required in practice for cross-browser compatibility (see the compatibility table below). attributes href the url to an element/fragment that needs to be duplicated. value type: <url> ; default value: none; animatable: yes xlink:href an <iri> reference to an element/fragment that needs to be duplicated. value type: <iri> ; default value: none; animatable: yes x the x coordinate of the use ele...
...ed has a viewbox - i.e. they only have an effect when use refers to a svg or symbol element. note: starting with svg2, x, y, width, and height are geometry properties, meaning those attributes can also be used as css properties for that element. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:href, xlink:title usage notes categoriesgraphics element, graphics referencing element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescr...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
status unknown svggraphicselement instead of svglocatable and svgtransformable implementation status unknown svggeometryelement with svggeometryelement.ispointinfill() and svggeometryelement.ispointinstroke() methods partially implemented (bug 1239100). the methods ispointinfill() and ispointinstroke() are not implemented yet (bug 1325319). ...
... moved pathlength attribute and gettotallength() and getpointatlength() methods from svgpathelement to svggeometryelement implemented (bug 1239100) document structure change notes svgsvgelement.suspendredraw(), svgsvgelement.unsuspendredraw(), and svgsvgelement.unsuspendredrawall() deprecated turned into no-ops (bug 734079) externalresourcesrequired attribute removed implementation status unknown auto value for width and height in <image> implementation status unknown referencing entire document with <use> implementation status unknown lang attribute on <desc> and <title> implemented (bug 721920) css transforms on outermost <svg> not affecting svgsvgelement.currentscale or svgsvgelement.current...
... attributes of <svg> implementation status unknown baseprofile and version attributes removed from <svg> implementation status unknown svgsvgelement.forceredraw() deprecated turned into a no-op (bug 733764) svgsvgelement.deselectall() deprecated not yet deprecated (bug 1302705) <switch> not affecting <style> implementation status unknown requiredfeatures attribute removed implementation status unknown svgsvgelement.currentview and svgsvgelement.usecurrentview removed svgsvgelement.currentview was never implemented, svgsvgelement.usecurrentview not removed yet (bug 1174097) svgunknownelement not implemented (bug 1239218) lang attribute without namespace implemented (bug 721920) svgsvgelement.
context-menu - Archive of obsolete content
essage: function(){ var cmitems = getmostrecentbrowserwindow().document.queryselectorall(".addon-context-menu-item[value^='"+ uuidstr +"']"); for(var i=0; i < cmitems.length; i++) cmitems[i].tooltiptext = cmitems[i].value.substring(36); } }); globals constructors item(options) creates a labeled menu item that can perform an action when clicked. parameters options : object required options: name type label string the item's label. it must either be a string or an object that implements tostring(). optional options: name type image string the item's icon, a string url. the url can be remote, a reference to an image in the add-on's data directory, or a data uri. data ...
...s that the item can use to interact with the page. onmessage function if the item is contained in the top-level context menu, this function will be called when the content script calls self.postmessage. it will be passed the data that was passed to postmessage. menu(options) creates a labeled menu item that expands into a submenu. parameters options : object required options: name type label string the item's label. it must either be a string or an object that implements tostring(). items array an array of menu items that the menu will contain. each must be an item, menu, or separator. optional options: name type image string the menu's icon,...
places/bookmarks - Archive of obsolete content
queries are or'd together, we also get bookmarks that // match the second query. the second query's properties // are and'd together, so results that are in the platform's unsorted // bookmarks folder, and are also tagged with 'mozilla', get returned // as well in this query }); globals constructors bookmark(options) creates an unsaved bookmark instance. parameters options : object required options: name type title string the title for the bookmark. required. url string the url for the bookmark. required. optional options: name type group group the parent group that the bookmark lives under. defaults to the bookmarks.unsorted group. index number ...
...p the parent group that the bookmark lives under. defaults to the bookmarks.unsorted group. index number the index of the bookmark within its group. last item within the group by default. tags set a set of tags to be applied to the bookmark. group(options) creates an unsaved bookmark group instance. parameters options : object required options: name type title string the title for the group. required. optional options: name type group group the parent group that the bookmark group lives under. defaults to the bookmarks.unsorted group. index number the index of the bookmark group within its parent group. last it...
platform/xpcom - Archive of obsolete content
this will typically return a descendant of unknown, although it may return a custom object that satisfies the nsisupports interface. optional options: name type contract string a contract id. users of xpcom can ...
... of the 'about' object if you will be getting the wrappedjsobject property from the returned object to access its javascript implementation, pass ci.nsisupports here: var custom = factory.createinstance(null, ci.nsisupports).wrappedjsobject; // you can now access the interface defined for the 'custom' object returns object : the component created by the factory. lockfactory() this method is required by the nsifactory interface, but as in most implementations it does nothing interesting. queryinterface() see the documentation for unknown.queryinterface(). properties interfaces the set of interfaces supported by this object. factory sets this to nsifactory. id this factory's class id. contract this factory's contract id. service use this class to register an xpcom service. to regist...
package.json - Archive of obsolete content
some of its entries, such as icon, name, and description, have direct analogues in the install manifest format, and entries from package.json are written into the install manifest when the add-on is built using jpm xpi. others, such as lib, permissions, and preferences, represent instructions to the jpm tool itself to generate and include particular code and data structures in your add-on. ...
...of packages that this add-on requires in order to function properly. description the add-on's description; this is a human-readable message describing what the add-on does. this defaults to the text "a basic add-on". this value will be used as the add-on's em:description element in its install.rdf. engines object with supported applications (key) and required version numbers (value). the version number can both specify a minimum and maximum version separated by a space. firefox: firefox desktop fennec: firefox for android thunderbird: thunderbird seamonkey: seamonkey any application uuid example: "engines": { "firefox": ">= 38.0a1", "fennec": ">= 38.0a1" } fullname note: this is de...
Displaying web content in an extension without security issues - Archive of obsolete content
equest.responsetext)); that way you can have the template in your extension but still strip it off all privileges when it is loaded in a frame. restricting what documents that contain untrusted data can do there are several restrictions that can be applied per frame. here it is most important to disable javascript and plugins. ...
...code and to insert it into the document via innerhtml. and scripts won’t run anyway when inserted via innerhtml, right? well, not quite. it is right that <script>alert('xss')</script> won’t run if inserted via innerhtml. but <img src="does_not_exist" onerror="alert('xss')"> for example will still run javascript code, and there are many more possibilities. so properly sanitizing input is still required when using innerhtml and it is far from trivial. it is much easier to use dom manipulation methods that won’t have unexpected side-effects. for example, your template document might have this code: <style type="text/css"> #entrytemplate { display: none; } </style> <div id="entrytemplate"> <div class="title"></div> <div class="description"></div> </div> now to insert a new entry in the d...
Enhanced Extension Installation - Archive of obsolete content
stored in the profile directory, there is no longer any need for special extension system handling of the -register command line flag, so support for that has been removed. datasource structure since there is now only a single rdf/xml datasource for storage of all installed items, the staggered datasource structure used by firefox 1.0 and the use of an internal composite datasource is no longer required. the extension system retains an object implementing nsirdfdatasource (so that it can supply special properties in addition to the set stored simply in the xml datasource) and an internal member that holds the single rdf/xml datasource. properties are read and are written directly to this, there are no shims. tracking install locations since there is now only a single datasource, install locati...
...ectory install location such as app-profile or app-global the location is functioning if it the directory exists. if any location is not functioning, or any of the manifests listed above does not exist, all manifests are removed and the system rebuilds everything from scratch. this should prevent against random file deletions and allow developers to easily reset their state by deleting one of the required system files. since we can now install by simply detecting the presence of a {guid} folder under the app-profile and app-global install locations, we no longer need installed-extensions.txt for registration of pre-configured items such as the default theme. the firefox build system will just create the {guid} folder for the default theme and place its install manifest inside, and on the first st...
How to convert an overlay extension to restartless - Archive of obsolete content
urce" line from your chrome.manifest file. it's probably a good idea to do this even if you aren't going fully restartless / extractionless due to the previously mentioned exposure to content of resource mappings. also, drop support for firefox 4 through 9 while you're at it. prior to firefox 10, the chrome.manifest file you rely on wasn't loaded automatically for restartless add-ons. hacks were required, and probably a bad idea. step 2b: audit any remaining resource:// uri usage internal to your extension if you don't need resource:// uris for anything else, then you may be able to skip the next step. if not, see if you still can't do things any other way. as with jsms, a chrome:// uri may be more appropriate. if you want to also make your add-on extractionless then you may need "step 3" if yo...
... stylesheetservice.unregistersheet(stylesheeturi, stylesheetservice.author_sheet); } } ... step 8: window icons firefox does not scan the chrome/icons/default directory of restartless or extrationless extensions for window icons. if you are using custom window icons, they will need to be moved to %mozdir%/icons/default/ upon load of your extension. removal upon unload is not required, but you must be able to handle overwriting them upon load. this is because your unload() will not always be called prior to an upgrade (e.g. upgrade might take place while the application is not running). further, this is a generic location for icons and the icon may still be in use by a different profile. thus, you will probably want to use version numbers in the icon name (the id of the wind...
MMgc - Archive of obsolete content
::gcroot { mygcobject* mygcobject; }; note that a gcroot is not a garbage-collected object. it is an unmanaged memory object that contains gc pointers. mmgc keeps a list of all gcroots in the system and makes sure that it marks them. gcroots are generally expected to be allocated using mmgc's unmanaged memory allocators, so that mmgc can figure out how big the gcroot object is. use of gcroot is required to have gc pointers from unmanaged memory, since without gcroot, those pointers won't be marked by the mark phase of the gc. note that gcroot can be used either by subclassing, or by creating a gcroot and passing it the memory locations to treat as a root: /** subclassing constructor */ gcroot(gc *gc); /** general constructor */ gcroot(gc *gc, const void *object, size_t size); allocating objects...
..., regardless of whether the object pointed to is gcobject, gcfinalizedobject, rcobject or rcfinalizedobject. the gc marks the entire stack during collection, and not incrementally, so write barriers aren't needed. write barriers are not needed for pointers to gc objects from unmanaged memory (gcroot). gcroots are marked at the end of the mark phase, and not incrementally, so no write barriers are required. drc() is required for rc objects, since the reference count must be maintained. write barriers are not needed for c++ objects that exist purely on the stack, and never in the heap. the flash player class "nativeinfo" is a good example. such objects are essentially the same as stack-based local variables. zeroing rcobjects all rcobjects (including all subclasses) must zero themselves out complete...
Creating a Firefox sidebar extension - Archive of obsolete content
extension for more detailed information about structuring, packaging, and deploying extensions. packages extensions to firefox are installed with packages ("bundles"). an extension package usually contains a "content" provider, which contains the xul code and application logic. optionally locales and skins can be included. most additions are provided with a default tree structure, although not required it is recommended to use this structure. here the package for the sidebar is created, the files included are listed below. example 1. package structure emptysidebar \- chrome |- content |- locale | \- en-us \- skin create all folders, except for skin. it is not used for this tutorial. the locale holds the locale, only the en-us locale is created. it is listed in example 2. the ...
...d openemptysidebar.modifierskey keys from the dtd, remove the <keyset> from the firefoxoverlay.xul file. one must then set the key attribute of the menuitem to "". the extension needs to provide some special manifest files that control how it is installed and where its chrome resources are stored. the first is install.rdf, the install manifest. see install manifests for a complete listing of the required and optional properties. the install manifest is listed in example 5. example 5. install.rdf <?xml version="1.0" encoding="utf-8"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:id>emptysidebar@yourdomain.com</em:id> <em:name>emptysidebar extension</em:name> <em:ver...
Using microformats - Archive of obsolete content
microformat to add to the microformat module. definition a javascript structure describing the microformat. see describing microformats in javascript for details. count() counts the number of microformats in a document that match specified criteria. var nummicroformats = microformats.count(name, rootelement, options); parameters name the name of the microformat to count. rootelement required. the dom element at which to begin the search. if you want to search the entire document, specify content.document. options optional. if provided, this is a javascript object that contains zero or more of the following flags: recurseexternalframes if true, child frames are included in the search. the default is true. showhidden if true, hidden microformats are added; otherwise they're l...
... the microformat object to dump. return value a string that describes the contents of the specified microformat object. get() returns an array of microformat objects corresponding to the microformats found that match specified criteria. var microformatsarray = microformats.get(name, rootelement, options, targetarray); parameters name the name of the microformat to find. rootelement required. the dom element at which to begin the search. if you want to search the entire document, specify content.document. options optional. if provided, this is a javascript object that contains zero or more of the following flags: recurseexternalframes if true, child frames that reference external content are included in the search. the default is true. showhidden if true, hidden microformat...
Mozilla Crypto FAQ - Archive of obsolete content
e outside the u.s. you do not need to provide such notification in any case, but you may need to take other actions to comply with laws and regulations in your own country concerning encryption technologies. as a mirror of the mozilla ftp site you will automatically be distributing open source encryption code as well. if you are a u.s. resident and/or your mirror site is in the u.s. then you are required to comply with applicable u.s. regulations governing the export of encryption software. your particular obligations depend on your exact circumstances, and we cannot provide legal advice to you. however, in an advisory opinion issued in reference to the bernstein case, the bureau of export administration (bxa) has stated the following: "concerning the posting onto a mirror or archive site of alr...
...ns governing the export of encryption software. your particular obligations depend on your exact circumstances, and we cannot provide legal advice to you. however, in an advisory opinion issued in reference to the bernstein case, the bureau of export administration (bxa) has stated the following: "concerning the posting onto a mirror or archive site of already-posted source code, notification is required only for the initial posting." bxa and nsa have already been notified of the posting of encryption-related source code on the mozilla site, and in light of this opinion we have therefore decidednot to ask mirror sites to provide notification themselves. note that in any case the notification procedures outlined in the export administration regulations apply only to u.s. residents and sites locat...
Table Layout Strategy - Archive of obsolete content
idths are balanced by basictablelayoutstrategy::balancecolumnwidths or the fixed layout counter part. in the following the basic table layout strategy is discussed. the functionality is distributed over a large number of subroutines as shown in the chart below. the words the table layout is width oriented and knows the following widths: minimum content width - min the minimum width that is required to layout the content, all linebreak possibilities will be used percent width - pct the cell width specified in percent, fixed width - fix the cell width specified as px, mm etc., proportional width - prop the cell width specified via 1*, 2* etc. and the desired width - des the width the content could fill without any linebreaks. cells can be members of colspans. these colspans have to d...
...ey include. this information is hold in the adjusted width's. due to this there are 10 width informations for every column. min_con des_con fix min_adj des_adj fix_adj pct pct_adj min_pro final the width parameter have the following meaning: #define width_not_set -1 #define num_widths 10 #define num_major_widths 3 // min, des, fix #define min_con 0 // minimum width required of the content + padding #define des_con 1 // desired width of the content + padding #define fix 2 // fixed width either from the content or cell, col, etc. + padding #define min_adj 3 // minimum width + padding due to col spans #define des_adj 4 // desired width + padding due to col spans #define fix_adj 5 // fixed width + padding due to col spans...
Binding Attachment and Detachment - Archive of obsolete content
f the dom load event for the bound document. when the load event fires, and if all binding documents loaded successfully, it can be assumed that all bindings are attached to all elements in the page. for elements that are created during or after the load event is fired, no assumptions can be made regarding order of binding attachment. when a binding is attached, the following events occur: if required, anonymous content is cloned from the binding's content template and inserted around the bound element. the methods and properties of the binding are installed on the element and become available to scripts that reference the bound element. any specified event handlers are installed on their requested targets. if the binding needs to execute any initialization code following its attachment to...
... share the same binding document. therefore if all the bindings in a chain come from binding documents that have already been loaded by the bound document, then the attachment of a binding (either through css or through the dom) is guaranteed to be synchronous. an author can ensure that all bindings are synchronously attached by calling loadbindingdocument to pre-fetch any xbl documents that are required. if the binding document is loaded prior to the firing of the load event, then any binding attachments that are placed following the load will be synchronous if they come from one of these previously loaded binding documents. the document obtained from loadbindingdocument is a copy of the binding document that is unique to the bound document. the bindings in the binding document can be modified ...
Introduction - Archive of obsolete content
ng features of a specific platform making building cross-platform software time-consuming and costly. a number of cross-platform solutions have been developed in the past. java, for example, has portability as a main selling point. xul is one such language designed specifically for building portable user interfaces. it takes a long time to build an application even for only one platform. the time required to compile and debug can be lengthy. with xul, an interface can be implemented and modified quickly and easily. xul has all the advantages of other xml languages. for example xhtml or other xml languages such as mathml or svg can be inserted within it. also, text displayed with xul is easily localizable, which means that it can be translated into other languages with little effort. what kinds o...
...alled an overlay, which allows the ui provided from one source, in this case, the firefox browser, to be merged together with the ui from the extension. extensions may also be applied to other mozilla based products such as thunderbird. standalone xulrunner application xulrunner is a packaged version of the mozilla platform which allows you to create standalone xul applications. a browser isn't required to run these applications, as they have their own executable file. xul package in between the other two are applications which are created in the same way as an extension, but they act like a separate application in a separate window. this is used when you don't want to have the larger size of a complete xulrunner application, but don't mind requiring a mozilla browser to be installed to be abl...
Using Remote XUL - Archive of obsolete content
owsers that understand it. this isn't a problem inside an organization that uses mozilla-based browsers exclusively, but for other sites you may need to provide another form of navigation as well. prerequisites to understand this tutorial you should have experience with tag-based languages like html along with basic javascript, css, and the dom. knowledge of xml and its syntax is useful but not required. you also need a text editor and a web browser that can render xul, like mozilla, or firefox. if you build a xul file along with this tutorial and put it onto a web server, you need to configure your web server to specify the content type of xul files as application/vnd.mozilla.xul+xml. for apache, you can do this by adding the following line to your mime.types file: application/vnd.mozilla.xul...
... to do is create a basic xul document. <?xml version="1.0"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" /> a xul document requires only two entities to be valid, an xml processing instruction on the first line that identifies the file as xml, and a window element that defines a xul application window (or in this case web page). the processing instruction is required because xul is an xml-based language, and this instruction tells browsers how to parse the document. the window element is the root (outermost) element in a xul document and encompasses all other elements. it is analogous to the <html> element in html. these two elements give us a valid xul document we can load and display in our web browser, even though there's nothing to see yet. source | ren...
XUL accessibility guidelines - Archive of obsolete content
t use images (i.e. image elements, buttons with images). for toolbar buttons with images it is recommended to use both a text label in the label attribute and image alt text in the tooltiptext attribute. view the code examples below. <image src="stop.png" tooltiptext="stop" /> <html:img src="stop.jpg" alt="stop" /> <html:img src="decorative_image.jpg" alt="" /> <!-- in html the alt attribute is required. --> <toolbarbutton label="stop" image="stop.png" tooltiptext="stop loading the page" /> title 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 t...
...een reader). interactive elements avoid small targets, which are difficult to see and click on. verify that the layout and contrast is sufficient to distinguish interactive elements one from another and from static portions of the application. error recovery when the user causes an error in an application allow for graceful recovery. for example, if the user provides letters where numbers are required in a form, this should not break the application. the user should be alerted to the problem and allowed to fix the error. response time when appropriate, alert the user to time limits and allow the user to adjust a time limit or request more time. one of the miracles of modern technology is that it allows people with even the most severe physical limitations to use computers. some users use mou...
Building XULRunner with Python - Archive of obsolete content
irst a word of warning that zonealarm has exhibited memory leaks that cause build machines to crash with rather spurious errors. you may want to uninstall it if you suspect this to be a problem. you will also want to disable any virus scanner resident monitoring as that will slow builds. ensure the pc is running xp with all the latest service packs and patches applied. microsoft c++ compiler is required and whilst the current free version is visual studio 8 express (msvc8) you will almost certainly want to use visual studio .net 2003 (msvc71) which is not longer officially available. the issue is that xulrunner must be built with the same version of c as python and with python 2.5 that is msvc71. both must use the same version of the c runtime library msvcrt?.dll or crashes will ensue. the alter...
...unstable. ...
NPAPI plugin reference - Archive of obsolete content
nd called by the plug-in. np_getmimedescription np_getmimedescription returns a supported mime type list for your plugin. it works on unix (linux) and macos. on windows you have to define supported mimetypes in the dll resource file. np_getvalue allows the browser to query the plug-in for information. np_initialize provides global initialization for a plug-in. np_port contains information required by the window field of an npwindow structure. np_shutdown provides global deinitialization for a plug-in. npanycallbackstruct contains information required during embedded mode printing. npapi plug-in side api this chapter describes methods in the plug-in api that are available from the plug-in object; these allow plug-ins to interact with the browser. the names of all of these methods begi...
... instance of the completion of a url request. npp_write delivers data to a plug-in instance. (remark: hence the name "npp_write" is misleading - just think of:"data_arrived") npp_writeready determines maximum number of bytes that the plug-in can consume. npprint contains information the plug-in needs to print itself in full-page or embedded mode. npprintcallbackstruct contains information required by the platformprint field of the npembedprint structure during embedded mode printing on unix systems. nppvariable see npn_setvalue. nprect represents a rectangular area of a plug-in's content area. npregion represents a platform-defined region of a page. npsaveddata block of instance information saved after the plug-in instance is deleted; can be returned to the plug-in to restore the d...
-ms-hyphenate-limit-chars - Archive of obsolete content
the -ms-hyphenate-limit-chars css property is a microsoft extension that specifies one to three values indicating the minimum number of characters in a hyphenated word. if the word does not meet the required minimum number of characters in the word, before the hyphen, or after the hyphen, then the word is not hyphenated. ...
...f characters in a hyphenated word. if the word does not meet the required minimum number of characters in the word, before the hyphen, or after the hyphen, then the word is not hyphenated. initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values auto corresponds to a value of 5 2 2, indicating a 5-character word limit, 2 characters required before a hyphenation break, and 2 characters required following a hyphenation break. <integer>{1,3} one to three integer values, corresponding to the word limit, the minimum number of characters required before a hyphenation break, and the minimum number of characters required following a hyphenation break, respectively. if the third value is missing it is equal to the second. if the se...
XForms Custom Controls - Archive of obsolete content
since firefox 4, xbl and xul are disabled by default for all pages not loaded from a chrome:// url. this also includes content loaded from file:// urls. it is possible to re-enable this by following the steps on using remote xul. this is required for all examples here to run! purpose you are in the right place if you would like to create your own custom renderings of the xforms controls like input, output, trigger, etc. we will also show you how to create custom controls that work with the xforms model and are automatically updated just like xforms controls. the purpose of this article is to give you enough background information so that you'll be able to get a good start. to really grasp the following information, a good understanding of xforms, xbl, javascript and css is needed. xpcom kn...
...stance node. */ domstring getvalue(); /** * set value of instance node. */ void setvalue(in domstring value); /** * return true if the instance node is readonly as determined by the mdg. */ boolean isreadonly(); /** * return true if the instance node is relevant as determined by the mdg. */ boolean isrelevant(); /** * return true if the instance node is required as determined by the mdg. */ boolean isrequired(); /** * return true if instance node is valid as determined by the mdg. */ boolean isvalid(); /** * return true if the control is bound to an instance node. */ boolean hasboundnode(); /** * return the bound instance node. */ nsidomnode getboundnode(); /** * set the content of the instance node. if aforce...
Implementation Status - Archive of obsolete content
.4.3 xforms-value-changed supported 4.4.4 xforms-valid supported 4.4.5 xforms-invalid supported 4.4.6 xforms-readonly supported 4.4.7 xforms-readwrite supported 4.4.8 xforms-required supported 4.4.9 xforms-optional supported 4.4.10 xforms-enabled supported 4.4.11 xforms-disabled supported 4.4.12 domactivate supported 4.4.13 domfocusin supported ...
...gnedlong, unsignedint, unsignedshort, byte, unsignedbyte, float, decimal, anyuri, base64binary, hexbinary, qname 6. ...
CSS and JavaScript accessibility best practices - Learn web development
nation of what you need to conform to the wcag criteria around color contrast. note: a high contrast ratio will also allow anyone using a smartphone or tablet with a glossy screen to better read pages when in a bright environment, such as sunlight. another tip is to not rely on color alone for signposts/information, as this will be no good for those who can't see the color. instead of marking required form fields in red, for example, mark them with an asterisk and in red. hiding things there are many instances where a visual design will require that not all content is shown at once. for example, in our tabbed info box example (see source code) we have three panels of information, but we are positioning them on top of one another and providing tabs that can be clicked to show each one (it is ...
... updating without a page reload (screen readers won't pick this up or alert users to it by default): <div class="errors" role="alert" aria-relevant="all"> <ul> </ul> </div> we will explain these attributes in our next article, which covers wai-aria in much more detail. note: some of you will probably be thinking about that fact that html5 forms have built-in validation mechanisms like the required, min/minlength, and max/maxlength attributes (see the <input> element reference for more information). we didn't end up using these in the demo because cross-browser support for them is patchy (for example ie10 and above only). note: webaim's usable and accessible form validation and error recovery provides some further useful information about accessible form validation. other javascript ac...
Pseudo-classes and pseudo-elements - Learn web development
e.g. 2n + 1 would match the last element of that type in the sequence, then two elements before that, then two elements before that, etc. all the odd ones, counting from the end.) :only-child matches an element that has no siblings. :only-of-type matches an element that is the only one of its type among its siblings. :optional matches 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 t...
...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 that are required. :right in paged media, matches right-hand pages. :root matches an element that is the root of the document. :scope matches any element that is a scope element. :valid matches an element such as an <input> element, in a valid state. :target matches an element if it is the target of the current u...
Legacy layout methods - Learn web development
l { float: left; margin-left: 20px; width: 60px; background: rgb(255, 150, 150); } the top row of single columns will now lay out neatly as a grid. note: we've also given each column a light red color so you can see exactly how much space each one takes up. layout containers that we want to span more than one column need to be given special classes to adjust their width values to the required number of columns (plus gutters in between). we need to create an additional class to allow containers to span 2 to 12 columns. each width is the result of adding up the column width of that number of columns plus the gutter widths, which will always number one less than the number of columns. add the following at the bottom of your css: /* two column widths (120px) plus one gutter width (20px)...
...sses on your elements or even adding and removing some containers, to see how you can vary the layout. for example, you could make the second row look like this: <div class="row"> <div class="col span8">13</div> <div class="col span4">14</div> </div> now you've got a grid system working, you can simply define the rows and the number of columns in each row, then fill each container with your required content. great! creating a fluid grid our grid works nicely, but it has a fixed width. we really want a flexible (fluid) grid that will grow and shrink with the available space in the browser viewport. to achieve this we can turn the reference pixel widths into percentages. the equation that turns a fixed width into a flexible percentage-based one is as follows. target / context = result for...
Practical positioning examples - Learn web development
impler, yes, but then each separate "page" view would actually be a newly-loaded webpage, which would make it harder to save information across views, and integrate this feature into a larger ui design. in addition, so-called "single page apps" are becoming very popular — especially for mobile web uis — because having everything served as a single file cuts down on the number of http requests required to view all the content, thereby improving performance. note: some web developers take things even further, only having one page of information loaded at once, and dynamically changing the information shown using a javascript feature such as xmlhttprequest. at this point in your learning however we want to keep things as simple as possible. there is some javascript later on, but only a tiny bit...
... our finished example will look like this: note: you can see the finished example running live at hidden-info-panel.html (source code). check it out to get an idea of what you will be building in this section of the article. as a starting point, make a local copy of hidden-info-panel-start.html from our github repo. this doesn't follow on from the previous example, so a fresh start file is required. let's have a look at the html in the file: <label for="toggle">❔</label> <input type="checkbox" id="toggle"> <aside> ... </aside> to start with here we've got a <label> element and an <input> element — <label> elements are normally used to associate a text label with a form element for accessibility purposes (allowing a screen user to see what description goes with what form element). ...
Fundamental text and font styling - Learn web development
em. the maths can be complicated, so you need to be careful about how you style things. it is best to use rem where you can, to keep things simple, and avoid setting the font-size of container elements where possible. a simple sizing example when sizing your text, it is usually a good idea to set the base font-size of the document to 10 px, so that then the maths is a lot easier to work out — required (r)em values are then the pixel font size divided by 10, not 16. after doing that, you can easily size the different types of text in your document to what you want. it is a good idea to list all your font-size rulesets in a designated area in your stylesheet, so they are easy to find. our new result is like so: <h1>tommy the cat</h1> <p>well i remember it as though it were a meal ago...</p> ...
...er lines of text are laid out horizontally or vertically and the direction in which subsequent lines flow. font shorthand many font properties can also be set through the shorthand property font. these are written in the following order: font-style, font-variant, font-weight, font-stretch, font-size, line-height, and font-family. among all those properties, only font-size and font-family are required when using the font shorthand property. a forward slash has to be put in between the font-size and line-height properties. a full example would look like this: font: italic normal bold normal 3em/1.5 helvetica, arial, sans-serif; active learning: playing with styling text in this active learning session, we don't have any specific exercises for you to do: we'd just like you to have a good pl...
What is a URL? - Learn web development
a urls). using ftp, for example, is not secure and is no longer supported by modern browsers. other technologies, such as css or javascript, use urls extensively, and these are really the heart of the web. absolute urls vs relative urls what we saw above is called an absolute url, but there is also something called a relative url. let's examine what that distinction means in more detail. ...
... when a url is used within a document, such as in an html page, things are a bit different. ...
How to build custom form controls - Learn web development
structure, we can start designing our control. the whole point of building this custom control is to be able to style it exactly how we want. to that end, we will split our css work into two parts: the first part will be the css rules absolutely necessary to make our control behave like a <select> element, and the second part will consist of the fancy styles used to make it look the way we want. required styles the required styles are those necessary to handle the three states of our control. .select { /* this will create a positioning context for the list of options; adding this to .select:focus-within will be a better option when fully supported */ position: relative; /* this will make our control become part of the text flow and sizable at the same time */ display : inline-bl...
...nd sizable at the same time */ display : inline-block; } we need an extra class active to define the look and feel of our control when it is in its active state. because our control is focusable, we double this custom style with the :focus pseudo-class in order to be sure they will behave the same. .select .active, .select:focus { outline: none; /* this box-shadow property is 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 displayed below the valu...
Sending forms through JavaScript - Learn web development
xhr.send( urlencodeddata ); } btn.addeventlistener( 'click', function() { senddata( {test:'ok'} ); } ) here's the live result: note: this use of xmlhttprequest is subject to the same-origin policy if you want to send data to a third party ...
... xhr.send( data ); } // access our form... const form = document.getelementbyid( "theform" ); // ...to take over the submit event form.addeventlistener( 'submit', function ( event ) { event.preventde...
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
ppens when you need to run the code over and over again—for example, in the case of an animation? this is where setinterval() comes in. this works in a very similar way to settimeout(), except that the function you pass as the first parameter is executed repeatedly at no less than the number of milliseconds given by the second parameter apart, rather than once. you can also pass any parameters required by the function being executed as subsequent parameters of the setinterval() call. let's look at an example. the following function creates a new date() object, extracts a time string out of it using tolocaletimestring(), and then displays it in the ui. it then runs the function once per second using setinterval(), creating the effect of a digital clock that updates once per second (see this liv...
... raf = requestanimationframe(draw); } now it is time to set up the initial state of the app when the page first loads. add the following two lines, which simply hide the results paragraph and spinner container using display: none;. result.style.display = 'none'; spinnercontainer.style.display = 'none'; next, define a reset() function, which sets the app back to the original state required to start the game again after it has been played. add the following at the bottom of your code: function reset() { btn.style.display = 'block'; result.textcontent = ''; result.style.display = 'none'; } okay, enough preparation! it's time to make the game playable! add the following block to your code. the start() function calls draw() to start the spinner spinning and display it i...
Third-party APIs - Learn web development
t the example off, make copies of nytimes_start.html and nytimes.css in a new directory on your computer. if you've already cloned the examples repository, you'll already have a copy of these files, which you can find in the javascript/apis/third-party-apis/nytimes directory. initially the <script> element contains a number of variables needed for the setup of the example; below we'll fill in the required functionality. the app will end up allowing you to type in a search term and optional start and end dates, which it will then use to query the article search api and display the search results. connect the api to your app first, you'll need to make a connection between the api and your app. in the case of this api, you need to include the api key as a get parameter every time you request ...
...c/search/v2/articlesearch.json?api-key=your-api-key-here&page=0&q=cats &fq=document_type:("article")&begin_date=20170301&end_date=20170312 note: you can find more details of what url parameters can be included at the nytimes developer docs. note: the example has rudimentary form data validation — the search term field has to be filled in before the form can be submitted (achieved using the required attribute), and the date fields have pattern attributes specified, which means they won't submit unless their values consist of 8 numbers (pattern="[0-9]{8}"). see form data validation for more details on how these work. requesting data from the api now we've constructed our url, let's make a request to it. we'll do this using the fetch api. add the following code block inside the fetchresult...
Object-oriented JavaScript for beginners - Learn web development
tructors and object instances javascript uses special functions called constructor functions to define and initialize objects and their features. they are useful because you'll often come across situations in which you don't know how many objects you will be creating; constructors provide the means to create as many objects as you need in an effective way, attaching data and functions to them as required. let's explore creating classes via constructors and creating object instances from them in javascript. first of all, we'd like you to make a new local copy of the oojs.html file we saw in our first objects article. a simple example let's start by looking at how you could define a person with a normal function. add this function within the script element: function createnewperson(name) { ...
... to them when they were created; this is one reason why it is very important to use this, so each one uses its own value, and not some other value. let's look at the constructor calls again: let person1 = new person('bob'); let person2 = new person('sarah'); in each case, the new keyword is used to tell the browser we want to create a new object instance, followed by the function name with its required parameters contained in parentheses, and the result is stored in a variable — very similar to how a standard function is called. each instance is created according to this definition: function person(name) { this.name = name; this.greeting = function() { alert('hi! i\'m ' + this.name + '.'); }; } after the new objects have been created, the person1 and person2 variables contain the ...
Aprender y obtener ayuda - Learn web development
n activity, we have found out that you can't really engage in both ways of learning — or thinking — at once. so which one should you choose? you might think that focused learning is better for studying, but in reality, both are very important. focused thinking is great for concentrating hard on specific subjects, getting into deep problem solving, and improving your mastery of the techniques required — strengthening the neural pathways in your brain where that information is stored. it isn't however very good at getting an understanding of "the big picture", and unlocking new neural pathways when you are trying to understand new subjects or solve new problems that you haven't come across before. for that, you need diffuse thinking. this is the opposite of focus — you let your brain wand...
... build web sites and web applications (we can definitely help you with this one!). how to get a domain, hosting, and use them to put a web site or application online. how to run a small business. how to advertise my business and attract clients. how much time and money will it take? estimate the time and cost of getting these things. if you'll need to work to earn money to buy the materials required, then the time to do that will have to be factored in. once you have a time estimate, you can start to build a plan around your life. how many hours per week do i need to do? once you know what you need to do, and how long you think it'll take you, you can start writing out a plan to follow, to achieve your goal. it can be as simple as: "it'll take me 500 hours to learn what i need to know, an...
CSS performance optimization - Learn web development
rently needed. the browser can paint the page once it has downloaded the css and built the css object model. browsers follow a specific rendering path: paint only occurs after layout, which occurs after the render tree is created, which in turn requires both the dom and the cssom trees. to optimize the cssom construction, remove unnecessary styles, minify, compress and cache it, and split css not required at page load into additional files to reduce css render blocking. optimizing for render blocking css can scope styles to particular conditions with media queries. media queries are important for a responsive web design and help us optimize a critical rendering path. the browser blocks rendering until it parses all of these styles but will not block rendering on styles it knows it will not use, ...
...wn as composited, animating transform properties is done in the gpu, resulting in improved performance, especially on mobile. will-change property the css will-change property 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 displayed 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 t...
Client-Server Overview - Learn web development
(a primer) web browsers communicate with web servers using the hypertext transfer protocol (http). when you click a link on a web page, submit a form, or run a search, the browser sends an http request to the server. this request includes: a url identifying the target server and resource (e.g. an html file, a particular data point on the server, or a tool to run). a method that defines the required action (for example, to get a file or to save or update some data). the different methods/verbs and their associated actions are listed below: get: get a specific resource (e.g. an html file containing information about a product, or a list of products). post: create a new resource (e.g. add a new article to a wiki, add a new contact to a database). head: get the metadata informatio...
...hing data (not modifying data). the web server detects that the request is "dynamic" and forwards it to the web application for processing (the web server determines how to handle different urls based on pattern matching rules defined in its configuration). the web application identifies that the intention of the request is to get the "best team list" based on the url (/best/) and finds out the required team name and number of players from the url. the web application then gets the required information from the database (using additional "internal" parameters to define which players are "best", and possibly also getting the identity of the logged in coach from a client-side cookie). the web application dynamically creates an html page by putting the data (from the database) into placeholders in...
Server-side web frameworks - Learn web development
will generate server-side code to work with these requests and responses. this means that you will have an easier job, interacting with easier, higher-level code rather than lower level networking primitives. the example below shows how this works in the django (python) web framework. every "view" function (a request handler) receives an httprequest object containing request information, and is required to return an httpresponse object with the formatted output (in this case a string). # django view function from django.http import httpresponse def index(request): # get an httprequest (request) # perform operations using information from the request. # return httpresponse return httpresponse('output string to return') route requests to the appropriate handler most sites will...
...mappings between a url pattern and a view function. urlpatterns = [ url(r'^$', views.index), # example: /best/myteamname/5/ url(r'^best/(?p<team_name>\w.+?)/(?p<team_number>[0-9]+)/$', views.best), ] make it easy to access data in the request data can be encoded in an http request in a number of ways. an http get request to get files or data from the server may encode what data is required in url parameters or within the url structure. an http post request to update a resource on the server will instead include the update information as "post data" within the body of the request. the http request may also include information about the current session or user in a client-side cookie. web frameworks provide programming-language-appropriate mechanisms to access this information. for ...
Server-side website programming - Learn web development
the dynamic websites – server-side programming topic is a series of modules that show how to create dynamic websites; websites that deliver customised information in response to http requests. the modules provide a general introduction to server-side programming. most major websites use some kind of 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 displayed inside those templates when needed, such as when you want to view a different product on amazon. ...
...playing it in a page, validating user-entered data and saving it in a database, checking user permissions and logging users in, etc.), and are constructed using web frameworks that make these and other common web server operations easy. basic knowledge of programming concepts (or of a particular programming language) is useful, but not essential. similarly, expertise in client-side coding is not required, but a basic knowledge will help you work better with the developers creating your client-side web "front end". you will need to understand "how the web works". we recommend that you first read the following topics: what is a web server what software do i need to build a website? how do you upload files to a web server? with that basic understanding, you'll be ready to work your way throu...
Getting started with Svelte - Learn web development
t which files or folder to ignore from the project — useful if you decide to include your app in a git repo. rollup.config.js: svelte uses rollup.js as a module bundler. this configuration file tells rollup how to compile and build your app. if you prefer webpack you can create your starter project with npx degit sveltejs/template-webpack svelte-app instead. scripts: contains setup scripts as required. currently should only contain setuptypescript.js, a script that sets up typescript support in svelte. we'll talk about this more in the last article. src: this directory is where the source code for your application lives — where you'll be creating the code for your app. app.svelte: this is the top-level component of your app. so far it just renders the 'hello world!' message. main.j...
...h is based on a hash of the component styles. you can see this in action by opening localhost:5000 in a new browser tab, right/ctrl-clicking on the hello world! label, and choosing inspect: when compiling the app, svelte changes our h1 styles definition to h1.svelte-1tky8bj, and then modifies every <h1> element in our component to <h1 class="svelte-1tky8bj">, so that it picks up the styles as required. note: you can override this behavior and apply styles to a selector globally using the :global(...) modifier (see the svelte <style> docs for more information). making a couple of changes now that we have a general idea of how it all fits together, we can start making a few changes. at this point you can try updating your app.svelte component — for example change the <h1> element on line...
Rendering a list of Vue components - Learn web development
ance for a slight refactor there's one little bit of refactoring we can do here. instead of generating the id for the checkboxes inside your todoitem component, we can turn the id into a prop. while this isn't strictly necessary, it makes it easier for us to manage since we already need to create a unique id for each todo item anyway. add a new prop to your todoitem component — id. ...
...e it required, and make its type a string. to prevent name collisions, remove the id field from your data attribute. you are no longer using uniqueid, so you need to remove the import uniqueid from 'lodash.uniqueid'; line, otherwise your app will throw an error. the <script> contents in your todoitem component should now look something like this: export default { props: { label: {required: true, type: string}, done: {default: false, type: boolean}, id: {required: true, type: string} }, data() { return { isdone : this.done, } }, } now, over in your app.vue component, pass item.id as a prop to the todoitem component. your app.vue template should now look like this: <template> <div id="app"> <h1>my to-do list</h1> <ul...
Introduction to cross browser testing - Learn web development
e should be — what content and functionality should it have, what should it look like, etc. at this point you'll also want to know how much time you have to develop the site — what is their deadline, and how much are they going to pay you for your work? we won't go into much detail about this, but cross-browser issues can have a serious effect on such planning. once you've got an idea of the required featureset, and what technologies you will likely build these features with, you should start exploring the target audience — what browsers, devices, etc. will the target audience for this site be using? the client might already have data about this from previous research they've done, e.g. from other web sites they own, or from previous versions of the web site you are now working on. if not, ...
...versions of the most popular desktop and mobile (ios, android, windows phone) browsers — this should include chrome (and opera as it is based on the same rendering engine as chrome), firefox, ie/edge, and safari. it should also provide an acceptable experience on ie 8 and 9, and be accessible with wcag aa compliance. now you know your target testing platforms, you should go back and review the required featureset and what technologies you are going to use. for example, if the e-commerce site owner wants a webgl-powered 3d tour of each product built into the product pages, they will need to accept that this just won't work in ie versions before 11. you'd have to agree to provide a version of the site without this feature to users of older ie versions. you should compile a list of the potential ...
Strategies for carrying out testing - Learn web development
e, as well as installing the browsers you want to test, install an anti-virus program to protect it from viruses. having multiple virtual machines is very useful, particularly for windows ie/edge testing — on windows, you are not able to have multiple versions of the default browser installed side by side, so you might want to build up a library of virtual machines to handle different tests as required, e.g.: windows 10 with edge 14 windows 10 with edge 13 windows 8.1 with ie11 windows 8 with ie10 windows 7 with ie9 windows xp with ie8 windows xp with ie7 windows xp with ie6 note: another good thing about virtual machines is that the virtual disk images are fairly self-contained. if you are working on a team, you can create one virtual disk image, then copy it and pass it around. j...
...edge 14 windows 10 with edge 13 windows 8.1 with ie11 windows 8 with ie10 windows 7 with ie9 windows xp with ie8 windows xp with ie7 windows xp with ie6 note: another good thing about virtual machines is that the virtual disk images are fairly self-contained. if you are working on a team, you can create one virtual disk image, then copy it and pass it around. just make sure you have the required licenses to run all those copies of windows or whatever else you are running if it is a licensed product. automation and commercial apps as mentioned in the last chapter, you can take a lot of the pain out of browser testing by using some kind of automation system. you can set up your own testing automation system (selenium being the popular app of choice), which does take some setup, but can ...
Setting up your own test automation environment - Learn web development
h as "open this web page", "move over this element on the page", "click this link", "see whether the link opens this url", etc. this is ideal for running automated tests. how you install and use webdriver depends on what programming environment you want to use to write and run your tests. most popular environments have available a package or framework that will install webdriver and the bindings required to communicate with webdriver using this language, for example, java, c#, ruby, python, javascript (node), etc. see setting up a selenium-webdriver project for more details of selenium setups for different languages. different browsers require different drivers to allow webdriver to communicate with and control them. see platforms supported by selenium for more information on where to get browse...
...above examples using simple console.log() statements, but this is all done in javascript, so you can use whatever test running and reporting system you want, be it mocha, chai, or some other tool. for example, try making a local copy of our mocha_test.js example inside your project directory. put it inside a subfolder called test. this example uses a long chain of promises to run all the steps required in our test — the promise-based methods webdriver uses need to resolve for it to work properly. install the mocha test harness by running the following command inside your project directory: npm install --save-dev mocha you can now run the test (and any others you put inside your test directory) using the following command: mocha --no-timeouts you should include the --no-timeouts fla...
Deploying our app - Learn web development
se netlify's wonderful static hosting offering to host our project. netlify gives us hosting or more specifically, a url to view your project online and to share it with your friends, family, and colleagues. deploying to hosting tends to be at the tail-end of the project life cycle, but with services such as netlify bringing down the cost of deployments (both in financial terms and also the time required to actually deploy) it's possible to deploy during development to either share work in progress or to have a pre-release for some other purpose. netlify, amongst other things, also allows you to run pre-deployment tasks, which in our case means that all the production code build processes can be performed inside of netlify and if the build is successful, the website changes will be deployed. al...
... with npx parcel src/index.html, we can run it with npx parcel build src/index.html and parcel will build everything ready for production instead of just running it for development and testing purposes. this includes doing minification and tree-shaking of code, and cache-busting on filenames. the newly-created production code is placed in a new directory called dist, which contains all the files required to run the website, ready for you to upload to a server. however, doing this step manually isn't our final aim — what we want is for the build to happen automatically and the result of the dist directory to be deployed live on our website. this is where our code, github, and netlify need to be set up to talk to one another, so that each time we update our github code repository, netlify will ...
Creating a spell check dictionary add-on
tionaries/ locale-code.dic locale-code.aff the .dic and .aff files must be placed in a subfolder named dictionaries within the zip file. both files must have the locale code as their file name. you also have to add a file named install.rdf to the root of the zip file. this file contains information about your add-on such as name and version number (see below). in addition to these required files, you may add optional files, for example to give your add-on an icon or to describe the license of the dictionary. here is an example of the install.rdf file. you can create and edit it with a plain text editor such as notepad. <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mo...
... em:id, or your users will not be updated to the latest version. the em:version should follow the rules of mozilla add-on version numbers, and if you update an existing dictionary add-on, the new version number must be greater than the old one. don't change em:type or em:unpack, and don't add a em:bootstrap element. type = 64 indicates that the add-on is in the restartless format, and unpack is required for hunspell to read the dictionary. although the restartless format for dictionary add-ons were introduced in gecko 10, dictionary updates only works starting from gecko 18. the em:minversion should therefore be the same as in the example above (or greater). if you set em:minversion to a lower value, gecko 10-17 will not be able to update your dictionary add-on once the restartless dictionary i...
Debugging on Mac OS X
w entitlement allowed by submitting a try build and downloading the dmg generated by the "rpk" shippable build job. a debugger can be attached to firefox processes of these builds. try builds use the developer.entitlements.xml file from the source tree while production builds use production.entitlements.xml. on macos 10.15+, downloaded try builds will not launch by default because notarization is required. to workaround this problem, remove the quarantine extended attribute from the downloaded nightly: $ xattr -r -d com.apple.quarantine /path/to/nightly.app local builds local builds of mozilla-central do not enable hardened runtime and hence do not have debugging restrictions. as a result, some functionality will be permitted on local builds, but blocked on production builds which have harden...
...o enable hardened runtime by default and eliminate this discrepancy. to obtain a hardened runtime build without using try infrastructure, a developer can manually codesign builds using the macos codesign(1) command with the developer.entitlements.xml file from the tree. this requires creating a codesigning identity. disabling system integrity protection (sip) if debugging a production build is required, follow apple's documented steps for disabling system integrity protection (sip). note that disabling sip bypasses hardened runtime restrictions which can mask some bugs that only occur with hardened runtime so it is recommended to test fixes with sip enabled. disabling sip has system security implications that should be understood before taking this step. creating an xcode project if you try ...
Configuring Build Options
the default options are the most well-supported, so it is preferable to add as few options as possible. please read the following directions carefully before building, and follow them in order. skipping any step may cause the build to fail, or the built software to be unusable. ...
...g and patch the mozilla source. disabling these tests can speed build time and reduce disk space considerably. developers should generally not use this option. localization mk_add_options moz_co_locales=isocode tbd. ac_add_options --enable-ui-locale=isocode tbd. ac_add_options --with-l10n-base=/path/to/base/dir tbd. other options mk_add_options autoclobber=1 if a clobber would be required before a build, this will cause mach to clobber and continue with the build instead of asking the user to manually clobber and exiting. ac_add_options --disable-crypto cryptography is enabled by default. in some countries, it may be illegal to use or export cryptographic software. you should become familiar with the cryptography laws in your country. on the 1.7 and aviary branches, cryptograph...
Eclipse CDT
o keep the code assistance working well. since the compiler options used to build the source change relatively infrequently, the "build" step above doesn't need to be rerun all that often. rerun it (and then rebuild the index) once a week or so, or as necessary when you start to notice unusual code assistance issues that aren't fixed by rebuilding the index alone. rebuilding the index itself is required much more frequently since the source changes more frequently. in principle, you can set the index to rebuild automatically by opening the workspace preferences, selecting "c/c++ > indexer", and reenabling "automatically update the index". however, you may find this too disruptive, since re-indexing will then happen very frequently and code assistance can be broken while the index is rebuilding. ...
...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 displayed 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 being defined. this define is in nsdomclassinfoid.h, which is included via the following include chain: content/svg/content/src/nssvgellipseelement.cpp content/svg/content/src/nssvgpathgeometryelement.h conte...
Using the Browser API
Mozilla › Gecko › Chrome › API › Browser API › Using
ns, which always run in a separate content process from web content. aside from the iframe, there are some basic controls: <button> elements, a simple <form> to implement the browser controls, and a search bar. the search bar also contains buttons, as well as a form to type search requests into. you can see the full html listing here. ...
...note that this doesn't include simple errors due to incorrect urls being entered. see the mo...
mozbrowseropenwindow
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the mozbrowseropenwindow event is fired when a new window is required — usually when the content of a browser <iframe> successfully calls the window.open() method, or the user clicks on a link with an unknown target. the embedder must use the <iframe> passed in the event.details.frameelement property as the new window content. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property typ...
...seropenwindow", function( event ) { console.log("a new window has opened containing the content at " + event.details.url + "."); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
DownloadTarget
at metadata is no longer available and the file has been deleted, then this value is zero. for single-file downloads, this property's value will always match the actual size of the file on disk, while the download.totalbytes property, when available, may indicate the size of the data as encoded for transfer instead. for downloads of multiple files, such as downloading a web page and its required media to disk, the meaning of this property is undefined. it currently indicates the size of the main file (such as the html document) rather than the sum of all of the files' sizes, but you must not rely upon this behavior, as it is subject to change. this is a dynamic property, which is updated when the download finishes or whenever the download.refresh() method is called. you can use this...
...it currently indicates the size of the main file (such as the html document) rather than the sum of all of the files' sizes, but you must not rely upon this behavior, as it is subject to change. this is a dynamic property, which is updated when the download finishes or whenever the download.refresh() method is called. you can use this value from the front-end to reduce file i/o that would be required to check the file directly. methods refresh() updates the state of a finished, failed, or canceled download based on the current state as indicated by the file system. if the download is in progress or has been finalized, this method does nothing and returns a resolved promise. calling this method lets the download object's properties be updated if the user moves or deletes the targ...
JNI.jsm
to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/jni.jsm"); this module was available in firefox since version 17. if you would like to support versions before that, you can copy and paste the contents of the jsm file int jni stands for java native interface; this library allows calling java code running in java virtual machines (jvms), etc. the most common use for this module is in add-ons and other works on firefox for android (fennec). with this module, all of the android sdk functions that firefox has permissions for are at your fingertips. ...
... will cause a crash. therefore, it is always recommended to use slash notation. so for geckoappshell we would pass here "org/mozilla/gecko/geckoappshell" and for geckointerface we would use "org/mozilla/gecko/geckoappshell$geckointerface". adeclares optional if this is omitted, then afullyqualifiedname must be an array type. if this is provided, then afullyqualifiedname must be a class name. a required object that contains up to five fields of key names: constructors, fields, static_fields, methods, and static_methods. return value blah blah newstring() blah blah cdata newstring( ajenv, astr ); parameters ajenv the return value of getforthread(). astr a javascript string, use any encoding desired. return value blah blah readstring() blah blah string readstring( ajenv, aj...
Sqlite.jsm
chrome -- that is, from within the application itself or an add-on. before you can use this module, you need to import it into your scope: components.utils.import("resource://gre/modules/sqlite.jsm") obtaining a connection sqlite.jsm exports the sqlite symbol. this symbol is an object with a single function: openconnection. this function takes an object defining connection options: path (required) the database file to open. this can be an absolute or relative path. if a relative path is given, it is interpreted as relative to the current profile's directory. if the path does not exist, a new sqlite database will be created. the value typically ends with .sqlite. sharedmemorycache (optional) boolean indicating whether multiple connections to the database share the same memory cache. shar...
...ection. these are arguably the most important apis in this type. executecached(sql, params, onrow) execute(sql, params, onrow) these similar functions are used to execute a single sql statement on the connection. as you might have guessed by the name, there are 2 flavors: cached and non-cached. other than that, they behave identically. these functions receive the following arguments: sql (required) string sql statement to execute. the trailing semicolon is not required. params (optional) parameters to bind to this statement. this can be an array or an object. see notes below. onrow (optional) function that is called when a row has been received. the return value is a promise that is resolved when the statement has finished execution. when a statement is executed via executecached(),...
XPCOMUtils.jsm
lained previously. declare the class (or multiple classes) implementing the component(s). create an array of component constructors. define the nsgetfactory() or nsgetmodule() entry point. pseudocode this section provides some pseudocode that demonstrates how to put together a javascript class based on the steps listed above. ...
...n provides some pseudocode that demonstrates how to put together a javascript class based on the steps listed above. constructor the constructor is a simple method that handles any required initialization tasks. function mycomponent() { // initialize the component here } class declaration declare the class prototype, using a form similar to this. mycomponent.prototype = { // properties required for xpcom registration: classdescription: "unique text description", classid: components.id("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"), contractid: "@example.com/xxx;1", // [optional] custom factory (an object implementing nsifactory). if not // provided, the default factory is used, which returns // |(new mycomponent()).queryinterface(iid)| in its createinstance(). _...
Application Translation with Mercurial
branch has already been translated. either translate a different product now or contact the person responsible for localization from the team's page (see above) so he can notify you by mail when the next strings for translation become available. if it is a red text consisting of a number and the word 'missing', then there are untranslated texts and you can move on with this guide. required tools build pre-requisites first, get the required programs to compile mozilla applications like firefox and thunderbird from build instructions. this is only necessary once. mozillabuild must be installed into an absolute file path without whitespaces, else it will break. file comparison program for the translation, it is recommend to use file comparison program to compare the english fil...
... uses winmerge: download and install it. a comparison of alternatives (e.g. for linux and mac os) is available on wikipedia. file and text editor for editing individual files a text editor can be a better choice than a file comparion program, e.g. because the file is new and everything has to be translated, the file is too customized to compare it to the english one, or special functionality is required (e.g. bookmarking untranslated lines). use a text editor you are comfortable with. this example uses notepad++. progress tracking tool to track which strings and files already have been translated and later also to see which new strings have already been tested in the product as being a good translation for the functionality behind the translated strings and that the translated texts fit into t...
Localizing with Mercurial
ibuted scm (version 1.3.1)), you have installed mercurial successfully! more details for more details on installing hg on linux systems, refer to the instructions on mercurial's download page. mercurial on windows with windows, you have a couple of install options: for a command line interface, download and install mozillabuild package. this will not only install hg, but also all the tools required to build mozilla products on windows. trust us, you'll want this eventually. for a graphical interface, you may want to install tortoisehg, which integrates with your windows explorer shell. it also installs the command line utility. part of the command line hg install for windows involves making sure the hg executable is in the system's %path% variable (tortoisehg doesn't need this step). use...
...n-us files for any combination of firefox, seamonkey, thunderbird: hg clone https://hg.mozilla.org/comm-central/ cd comm-central python client.py checkout the first command will create a clone of the comm-central repository. the second command will move you into that directory. the third command will do a clone of mozilla-central, and pull some other hg repositories. the other directories are required for seamonkey and thunderbird. cloning your localization repository for the first time is just as easy. for example, to clone your firefox nightly l10n repo, run the following command, replacing ab-cd with your locale code: hg clone https://hg.mozilla.org/l10n-central/ab-cd/ updating your local repos to update your working copy of mozilla-central, go to your local mozilla-central directo...
Extras
rl(#grad1)"/> <g transform="translate(150,125)"> <g> <animatetransform attributename="transform" attributetype="xml" type="rotate" from="0" to="360" dur="6s" repeatcount="indefinite"/> <g transform="translate(-50,-35)"> <rect width="100" height="70" fill="url(#grad2)"/> <switch> <foreignobject width="100" height="70" requiredextensions="http://www.w3.org/1998/math/mathml"> <math display="block"> <mrow> <mo>(</mo> <mtable> <mtr> <mtd><mi>cos</mi><mi>θ</mi></mtd> <mtd><mo>−</mo><mi>sin</mi><mi>θ</mi></mtd> </mtr> <mtr> <mtd><mi>sin</mi><mi>θ</mi></mtd> <mtd><mi>cos</mi><mi>θ</mi></mtd> </mtr> </mtable> <mo>)</mo> </mrow> </math> </foreignobject> <text>rotation matrix</text> </switch> </g></g></g> <g> <animatemotio...
... 32,69 z" begin="0s" dur="20s" repeatcount="indefinite"/> <animatetransform attributename="transform" attributetype="xml" type="scale" values="1;2;.5;1" keytimes="0;.25;.75;1" dur="20s" repeatcount="indefinite"/> <circle fill="url(#grad3)" r="30"/> <g transform="translate(-30,-30)"> <switch> <foreignobject width="60" height="60" requiredextensions="http://www.w3.org/1998/math/mathml"> <math display="block"> <mrow> <munderover> <mo>∑</mo> <mrow> <mi>n</mi> <mo>=</mo> <mn>0</mn> </mrow> <mrow> <mo>+</mo> <mi>∞</mi> </mrow> </munderover> <mfrac> <msup> <mi>α</mi> <mi>n</mi> </msup> <mrow> <mi>n</mi> <mo>!</mo> </mrow> </mfrac> </mrow> </math> </foreignobject> <text>exp(α)</text> </switch> </g> </g> </svg> </div> inline ja...
Fonts for Mozilla 2.0's MathML engine
d display a box containing the hexadecimal representation of the unicode code point for the character. some mathematical operators are also drawn by using glyphs for larger variants of the character (e.g. summation symbol) or by assembling glyphs for a few pieces of the character (e.g braces). these variant or part glyphs do not in general have unicode assignments, and so font-specific support is required for some characters. mozilla has general support for the common delimiters and arrows that have the necessary unicode assignments. for other characters, mozilla has font-specific support. in general, if the necessary glyphs are not available on the system then mozilla tries to stretch symbols using scale transforms, but that may result in a less pleasant rendering. to see mathml as intended, you ...
...y unicode assignments. for other characters, mozilla has font-specific support. in general, if the necessary glyphs are not available on the system then mozilla tries to stretch symbols using scale transforms, but that may result in a less pleasant rendering. to see mathml as intended, you need sufficient font support, which may mean installing some fonts. note that some web sites may provide the required mathematical fonts as web fonts. in that case, you will see the correct rendering on these pages if you use gecko 15.0 (firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) or greater. recommended fonts the stix fonts project has been developing a comprehensive set of fonts that cover all the symbols in mathml and also contains glyphs to stretch mathematical operators. they are available under the s...
Mozilla Port Blocking
unsigned mail through a mail server behind your firewall: a really nasty hole. mozilla responded by modifying how protocols can access ports. by default, mozilla now blocks access to specific ports which are used by vulnerable services in order to prevent security vulnerabilites due to "cross-protocol scripting". each protocol's handler can override this blocking for itself in order to enable the required access for that protocol. potential problems caused by port blocking port blocking can cause problems if a site or web application requires access to one of the ports which is blocked in mozilla. if a user attempts to access a uri on a blocked port, mozilla shows one of the following alerts to the user or in the error console. "access to the port number given has been disabled for security reason...
...st have a good reason for the change, a deep understanding of the security risk involved and be able to justify it. things to do allow user preference to override default port blocking. currently you need to add preferences to either user.js or all.js. see bug 85601. per protocol port blocking/enabling preferences. better user interface allow the user to decide if the blocking is really required. some kind of way to manage the ports which are blocked. more information nsioservice.cpp gbadportlist bug 83401 vulnerability note vu#476267 dougt@netscape.com original document information author(s): doug turner last updated date: august 15, 2007 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available ...
Power profiling overview
ected by running programs but also by other things such as (for laptops) how bright the monitor backlight is. devices such as ammeters give the best results, but these can be expensive and difficult to set up. a cruder technique that works with mobile machines and devices is to run a program for a long time and simply time how long it takes for the battery to drain. the long measurement times required are a disadvantage, though. power estimates the next best measurements come from recent (sandy bridge and later) intel processors that implement the rapl (running average power limit) interface that provides msrs containing energy consumption estimates for up to four power planes or domains of a machine, as seen in the diagram above. pkg: the entire package. pp0: the cores. pp1: an...
...up frequency identifies the problem, more ingenuity may be needed. looking at other measurements (c-state residency, gpu usage, etc.) may be helpful. animations are sometimes the cause of high power consumption. the animation inspector in the firefox devtools can identify them. alternatively, here is an explanation of how one developer diagnosed two animation-related problems the hard way (which required genuine platform expertise). the approximate cause of power problems often isn't that hard to find. fixing them is often the hard part. good luck. if you do fix a problem by improving a proxy measurement, you should verify that it also improves a power measurement or estimate. that way you know the fix had a genuine effect. further reading chapter 13 of the intel optimization manual has many...
HTTP delegation
xplicitly destroyed (sec_httpserver_freesessionfcn). should the application be unable to keep a physical connection alive all the time, the application is expected to create new connections automatically. nss may choose to repeatedly call a "network connection keep alive" function (sec_httpserver_keepalivesessionfcn) on the server session object, giving application code a chance to do whatever is required. for each individual http request, nss will request the creation of a "http request object" (sec_httprequest_createfcn). no full uri is provided as a parameter. instead, the parameters are a server session object (that carries host and port information already) and the request path. in our example the path is "/cgi-bin/ocsp-responder". (when issueing get requests, the "?query-string=data" portion...
...ns associated with the server session object. once the http response has been obtained from the http server, the function will provide the results in its "out parameters". please read the source code documentation to learn how to use this api synchronously or asynchronously. now that we have explained the interaction between nss, the callback functions and the application, let's look at the steps required by the application to initially register the callbacks. make sure you have completed the nss initialization before you attempt to register the callbacks. look at sec_httpclientfcn, which is a (versioned) table of function pointers. create an instance of this type and supply a pointer to your implementation for each entry in the function table. finally register your http client implementation with...
HTTP delegation
xplicitly destroyed (sec_httpserver_freesessionfcn). should the application be unable to keep a physical connection alive all the time, the application is expected to create new connections automatically. nss may choose to repeatedly call a "network connection keep alive" function (sec_httpserver_keepalivesessionfcn) on the server session object, giving application code a chance to do whatever is required. for each individual http request, nss will request the creation of a "http request object" (sec_httprequest_createfcn). no full uri is provided as a parameter. instead, the parameters are a server session object (that carries host and port information already) and the request path. in our example the path is "/cgi-bin/ocsp-responder". (when issuing get requests, the "?query-string=data" portion ...
...ns associated with the server session object. once the http response has been obtained from the http server, the function will provide the results in its "out parameters". please read the source code documentation to learn how to use this api synchronously or asynchronously. now that we have explained the interaction between nss, the callback functions and the application, let's look at the steps required by the application to initially register the callbacks. make sure you have completed the nss initialization before you attempt to register the callbacks. look at sec_httpclientfcn, which is a (versioned) table of function pointers. create an instance of this type and supply a pointer to your implementation for each entry in the function table. finally register your http client implementation with...
NSS 3.12.4 release notes
rovided it does not also match the expression bar. either expression or both may be a union. except between brackets, any unescaped ~ is an exclusion. at most one exclusion is permitted. exclusions cannot be nested (contain other exclusions). example: *~abc will match any string except abc unions: (foo|bar) will match either the expression foo, or the expression bar. at least one '|' separator is required. more are permitted. expressions inside unions may not include unions or exclusions. inside a union, to be matched and not treated as a special character, these characters must be escaped: \ ( | ) [ ~ except when they occur inside a bracketed expression, where only \ and ] require escaping. new functions in the nss shared library: pk11_isinternalkeyslot (see pk11pub.h) secmod_opennewslot (see ...
...dir>) causes nss to look for sql:<dbdir>/libnssckbi.so bug 495365: add const to the 'nickname' parameter of sec_certnicknameconflict bug 495656: nss_initreadwrite(sql:<configdir>) leaves behind a pkcs11.txu file if libnssckbi.so is in <configdir>. bug 495717: unable to compile nss/cmd/certutil/keystuff.c on wince bug 496961: provide truncated hmac support for testing tool fipstest bug 497002: lab required nspr-free freebl changes. bug 497217: the first random value ever generated by the rng should be discarded bug 498163: assert if profile path contains cyrillic chars. [[@isspace - secmod_argisblank - secmod_arghasblanks - secmod_formatpair - secmod_mknewmodulespec] bug 498509: produce debuggable optimized builds for mozilla on macosx bug 498511: produce debuggable optimized nss builds for mozilla...
PKCS #11 Module Specs
flags valid flags are: nomoddb don't open secmod.db and try to supply the strings. the mod db function is not through standard pkcs #11 interfaces. readonly databases should be opened read only. nocertdb don't try to open a certificate database. nokeydb don't try to open a key database. forceopen don't fail to initialize the token if the databases could not be opened. passwordrequired zero length passwords are not acceptable (valid only if there is a keydb). optimizespace allocate smaller hash tables and lock tables. when this flag is not specified, softoken will allocate large tables to prevent lock contention. tokens configure 'tokens' by hand. the tokens parameter specifies a space separated list of slotids, each of which specify their own set of parameters affectin...
...d). minpwlen minimum password length for this token. flags comma separated list of flag values, parsed case-insensitive. valid flags are: readonly databases should be opened read only. nocertdb don't try to open a certificate database. nokeydb don't try to open a key database. forceopen don't fail to initialize the token if the databases could not be opened. passwordrequired zero length passwords are not acceptable (valid only if there is a keydb). optimizespace allocate smaller hash tables and lock tables. when this flag is not specified, softoken will allocate large tables to prevent lock contention. examples: ...
FC_GetTokenInfo
the device, "nss 3", padded with spaces to 16 characters and not null-terminated. serialnumber: the device's serial number as a string, "0000000000000000", 16 characters and not null-terminated. flags: bit flags indicating capabilities and status of the device. ...
...device is read-only ckf_login_required (0x00000004): this device requires the user to log in to use some of its services ckf_user_pin_initialized (0x00000008): the user's password has been initialized ckf_dual_crypto_operations (0x00000200): a single session with the token can perform dual cryptographic operations ckf_token_initialized (0x00000400): the token has been initialized. if login is required (which is true for the fips mode of operation), this flag means the user's password has been initialized. ulsessioncount: number of sessions that this application currently has open with the token ulrwsessioncount: number of read/write sessions that this application currently has open with the token hardwareversion: hardware version number, for example, 8.3 (major=0x08, minor=0x03), which are...
NSS functions
the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. function name/documentation source code nss versions sec_pkcs7addce...
...the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. function name/documentation source code nss versions sec_pkcs12addcertandkey ...
gtstd.html
e the use of nss command line tools to operate a simple root certificate authority for test purposes only. the ca, ssl server and ssl client certificates produced by these instructions work correctly for short term testing purposes. although it is possible to use nss command line tools to operate a proper ca, these instructions do not provide nearly enough understanding of the many considerations required to competently operate a ca. the nss teams strongly recommends that users should not attempt to operate a ca for use in mission critical production business uses using nss's command line tools, nor with the simple command line test tools that come with any package of cryptographic libraries. many who have attempted it have eventually come to regret that decision. for production deployment, the ns...
...uses the ca's databases. this step leaves the client's new certificate in a file. >certutil -c -d ca_db -c "myco's root ca" -a -i client_db/client.req -o client_db/client.crt -2 -6 enter password or pin for "communicator certificate db": add the new client certificate to the client's certificate database in the client_db directory with the appropriate nickname. notice that no trust is required for this certificate. >certutil -a -d client_db -n "joe client" -a -i client_db/client.crt -t ",," display the contents of the client's certificate databases. >certutil -l -d client_db the trust flag settings "u,u,u" indicate that the client's databases contain the private key for this certificate. this is necessary for the ssl client to be able to authenticate to the server. ve...
NSS Tools certutil
t all available modules or print a single named module. arguments -a use ascii format or allow the use of ascii format for input or output. this formatting follows rfc 1113. for certificate requests, ascii output defaults to standard output unless redirected. -b validity-time specify a time at which a certificate is required to be valid. use when checking certificate validity with the -v option. the format of thevalidity-time argument is "yymmddhhmmss[+hhmm|-hhmm|z]". specifying seconds (ss) is optional. when specifying an explicit time, use "yymmddhhmmssz". when specifying an offset time, use "yymmddhhmmss+hhmm" or "yymmddhhmmss-hhmm". if this option is not used, the validity check defaults to the current system tim...
...on of a certificate or certificate request that is being created or added to the database. subject alternative name extensions are described in section 4.2.1.7 of rfc 32800 usage the certificate database tool's capabilities are grouped as follows, using these combinations of options and arguments. options and arguments in square brackets are optional, those without square brackets are required. -n [-d certdir ] -s -k rsa|dsa -n certname -s subject [-c issuer |-x] -t trustargs [-h tokenname ] [-m serial-number ] [-v valid-months ] [-w offset-months ] [-d certdir ] [-p phone ] [-f password-file ] [-1] [-2] [-3] [-4] -r -k rsa|dsa -s subject [-h tokenname ] [-d certdir ] [-p phone ] [-o output-file ] [-f password-file ] -c -c issuer [-f password-file ] [-h tokenname ] -i cert-reque...
NSS tools : signtool
s imported into browser software such as communicator, it behaves like an object-signing ca and cannot be used to sign objects. the -g option is available in netscape signing tool 1.0 and later versions only. by default, it produces only rsa certificates with 1024-byte keys in the internal token. however, you can use the -s option specify the required key size and the -t option to specify the token. for more information about the use of the -g option, see "generating test object-signing certificates""generating test object-signing certificates" on page 1241. -l lists signing certificates, including issuing cas. if any of your certificates are expired or invalid, the list wi...
... validated mode, see "netscape signing tool and fips-140-1". --norecurse blocks recursion into subdirectories when signing a directory's contents or when parsing html. -o optimizes the archive for size. use this only if you are signing very large archives containing hundreds of files. this option 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 displayed as plain text. -s keysi...
Scripting Java
interfaces that clients must implement. one example of this is the thread class: its constructor takes a runnable that contains a single method run that will be called when the new thread is started. to address this need, rhino provides the ability to create new java objects that implement interfaces. first we must define a javascript object with function properties whose names match the methods required by the java interface. to implement a runnable, we need only define a single method run with no parameters. if you remember from chapter 3, it is possible to define a javascript object with the {propertyname: value} notation. we can use that syntax here in combination with a function expression to define a javascript object with a run method: js> obj = { run: function () { print("\nrunning"); } ...
...the scenes, rhino generates the bytecode for a new java class that implements runnable and forwards all calls to its run method over to an associated javascript object. the object that implements this class is called a java adapter. because the forwarding to javascript occurs at runtime, it is possible to delay defining the methods implementing an interface until they are called. while omitting a required method is bad practice for programming in the large, it's useful for small scripts and for exploratory programming. the javaadapter constructor in the previous section we created java adapters using the new operator with java interfaces. this approach has its limitations: it's not possible to implement multiple interfaces, nor can we extend non-abstract classes. for these reasons there is a jav...
SpiderMonkey Build Documentation
lems. see js_setgczeal() for details. for a list of other available build options, type (assuming the current working directory is one of the above-created build directories): /bin/sh ../configure.in --help generating a compilation database some tools (like ides, static analyzers and refactoring tools) consume a file called compile_commands.json which contains a description of all the pieces required to build a piece of software so that tools don't have to also understand a build system. to generate a compile_commands.json with the spidermonkey configure script, enable the compiledb backend, like this: /bin/sh ../configure.in <options> --enable-build-backends=compiledb,recursivemake (recursivemake is there as you'd likely also want to be able to build!) windows builds since version 28,...
...pidermonkey developers frequently and deliberately change the jsapi abi. you cannot use headers built for one version/configuration of jsapi to create object files which will be linked against another. support for js_threadsafe was recently removed, and threadsafe builds are now enabled by default. the js-config script, described below, is the recommended way to determine correct include paths, required libraries, etc. for your embedding to use during compilation. we highly recommend calling the js-config script from your embedding's makefile to set your cflags, ldflags, and so forth. to install spidermonkey somewhere other than the default, you must use the configure --prefix option, as described above. failure to do so may break your js-config.h header or js-config script. some features dete...
GCIntegration - SpiderMonkey Redirect 1
g it the value the pointer held before the write. there are several examples of this usage in xpconnect. the js::objectptr class is intended to serve as a drop-in replacement for jsobject *. it has an assignment operator that automatically invokes a write barrier. so far, though, there hasn't been much use for this class—there aren't many places outside of spidermonkey where a write barrier is required. read barriers "weak pointers" are a major complication to the scheme described above. for the purposes of this article, a weak pointer is one that is not traced during gc. at the end of the gc, if the pointer refers to an object that is not reachable via some other path, then it will be nulled out or dropped in some way. if the object is still reachable, then the pointer will be left alone. to...
..., that will allow us to avoid write barriers in some cases. only strings and objects without finalizers will be stored in the nursery, at least initially. consequently, if the thing being stored is known to have a finalizer, then there is no need for a write barrier. note that what matters is the value being written—if the object being written to has a finalizer, a write barrier may still be required. if a pointer is not traced, as by js_call_tracer, then there is no need for a write barrier. if a pointer is a root, then that pointer will be scanned during every nursery collection, so there is no need for a write barrier. as above, this means that classes governed by ns_decl_cycle_collection_script_holder_class do not need a write barrier on their fields. we have not decided yet on an api...
Index
false. 43 js::float32value jsapi reference, reference, référence(2), spidermonkey js::float32value converts a c floating-point number of type float to js::value, the type of javascript values. 44 js::getdeflatedutf8stringlength jsapi reference, reference, référence(2), spidermonkey js::getdeflatedutf8stringlength returns the length of the char buffer required to encode s as utf8. the returned length does not include the null-terminator. 45 js::getfirstargumentastypehint jsapi reference, reference, référence(2), spidermonkey js::getfirstargumentastypehint converts first argument of @@toprimitive method to jstype. 46 js::getselfhostedfunction jsapi reference, reference, référence(2), spidermonkey js::getself...
...ull, it must come from the *propp out parameter of a prior jsobjectops.defineproperty or jsobjectops.lookupproperty call. 136 jsobjectops.getproperty jsapi reference, obsolete, spidermonkey get, set, or delete obj[id], returning js_false on error or exception, js_true on success. if getting or setting, the new value is returned in *vp on success. 137 jsobjectops.getrequiredslot jsapi reference, obsolete, spidermonkey get and set a required slot, one that should already have been allocated. these operations are infallible, so required slots must be pre-allocated, or implementations must suppress out-of-memory errors. the native ops (js_objectops, see js/src/jsobj.cpp) access slots reserved by including a call to the jsclass_has_reserved_slots(n) macro in th...
Garbage collection
le: exact stack rooting. marking todo incremental marking incremental marking means being able to do a bit of marking work, then let the mutator (javascript program) run a bit, then do another bit of marking work. thus, instead of one long pause for marking, the gc does a series of short pauses. the pauses can be set to be 10ms or less. there is always a possibility that a long pause will be required. if the allocation rate is high during incremental gc, the engine may run out of memory before finishing the incremental gc. if so, the engine must immediately restart a full, non-incremental gc in order to reclaim some memory and continue execution. incremental write barrier the problem that requires a write barrier incremental gc requires a write barrier for correctness. todo decent diagram...
...moved, just read). so we barrier the read instead; if you ever read a weak reference in the middle of an ongoing incremental gc, then the target of the weak ref will be marked. implementation details write barriers have a runtime cost, so spidermonkey tries to skip them when an incremental gc cycle is not active. each zone has a flag needsincrementalbarrier() that indicates whether barriers are required. for each type t such that fields of type t* need a write barrier, there is a functiont::writebarrierpre(old). for example, fields of type jsobject* need a write barrier, so there is a function jsobject::writebarrierpre(jsobject* old). if zone->needsincrementalbarrier(), then writebarrierpre() marks old. that's it. the class heap<t> is provided to make it easy to invoke write barriers. a heap<t...
JSAPI reference
jsgetmethodop obsolete since javascript 1.8.5 jssetmethodop obsolete since javascript 1.8.5 jsenumeratevaluesop obsolete since javascript 1.8.5 jsconcatenateop obsolete since javascript 1.8.5 arrays js_newarrayobje...
... jsgetmethodop obsolete since javascript 1.8.5 jssetmethodop obsolete since javascript 1.8.5 jsenumeratevaluesop obsolete since javascript 1.8.5 jsconcatenateop obsolete since javascript 1.8.5 arrays js_newarrayobject js_isarrayobject js_getarraylength js_setarr...
A Web PKI x509 certificate primer
nt, keycertsign, and crlsign. for ca certificates the keycertsign bit must be set. extended key usages this is another bitfield to constrain the usages of the key of the certificate. its is directed mostly at what type of application the certificate was issued for. examples of extended key usages are: serverauth, clientauth, and ocspsigning. for end-entity certificates for pki this extension is required to exist with the serverauth bit asserted. name constraints this is an extension exclusive for ca and indicates limits on the name space for its children. this is one of the most powerful extensions for businesses to have to help limit risk imposed by losing the private key of the ca. authority information access this extension is primarily used to to describe the ocsp location for revocation...
...r_expired_certificate a certificate is too old to be used re-generate the certificate sec_error_extension_value_invalid a certificate has an extension with an empty value re-generate the certificate without the extension, or re-generate it with a non-empty value sec_error_inadequate_cert_type a certificate has an extended key usage extension that does not assert a required usage, or an end-entity certificate asserts the id-kp-ocspsigning usage when it shouldn't re-generate the certificate with the appropriate extended key usage values sec_error_inadequate_key_usage a certificate has a key usage extension that does not assert a required usage re-generate the certificate with the appropriate key usage values sec_error_invalid_algorithm a...
Places utilities for JavaScript
array ob...
... array object getannotationsforitem(aitemid) parameters aitemid the identifier of the itme for which annotations are to be retrieved. return type return array of objects, each containing the following properties: name, flags, expires, mimetype, type, value setannotationsforuri() annotate a uri with a batch of annotations. ...
mozIRegistry
body knows it is the place to come to in order to find out how they are supposed to link together the various xpcom components that together form the mozilla browser. the information below is intended to tell you everything you need to know about how to do that. summary clients will rely on nsrepository to create instances of a given class. clients requiring dynamic "binding" of clsids will be required to use some higher-level services (tbd) to figure out the clsids they should use. the intent is that such services themselves be built on top of the new moziregistry interface. we are proposing a new "moziregistry" xpcom interface that provides the same level of function as is currently provided by the "netscape registry" implemented in libreg. nsrepository will be modified to use this interface,...
...ed at run/link time. there will be two registry interface implementations: one based solely on libreg (for "compatibility") and a fancier rdf-based one. open issues we have identified two open issues, neither of which appear to be so hard that it we won't be able to solve them in a timely fashion: if and when we remove what is currently a static binding of clsids, there will be the risk that required clsids won't be present. a corollary is that the build/install process will require updates to user "registry" to enable new class implementations to be accessible. our current build/install process doesn't quite step up to these problems as of yet. there are some bootstrapping issues related to using the service manager to access the moziregistry interface. currently, nsiservicemanager requires...
nsIComponentRegistrar
actory); void unregisterfactorylocation(in nscidref aclass, in nsifile afile); methods autoregister() register a component (.manifest) file or all component files in a directory. registration lasts for this run only, and is not cached. note: formerly this method would register component files directly. this is no longer supported. component files must have an associated loader and export the required symbols which this loader defines. for example, if the given file is a native library, it must export the symbol nsgetmodule. other loaders may have different semantics. this method may only be called from the main thread. void autoregister( in nsifile aspec ); parameters aspec this parameter indicates either a component file to be registered or a directory containing component files to be r...
... afile, in string aloaderstr, in string atype ); parameters aclass the classid of the class being registered. aclassname the name of the class being registered. this value is intended as a human-readable name for the class and need not be globally unique. acontractid the contractid of the class being registered. afile a component file. this file must have an associated loader and export the required symbols, which the loader specifies. aloaderstr opaque loader specific string. this value is passed into the nsimodule.registerself() callback and must be forwarded unmodified when registering factories via their location. atype component type of aclass. this value is passed into thensimodule.registerself() callback and must be forwarded unmodified when registering factories via their location. ...
nsIHttpChannel
(uri) of the resource from which this channel's uri was obtained (see rfc2616 section 14.36). this attribute may only be set before the channel is opened. note: the channel may silently refuse to set the referer: header if the uri does not pass certain security checks (e.g., a "https://" url will never be sent as the referrer for a plaintext http request). the implementation is not required to throw an exception when the referrer uri is rejected. exceptions thrown ns_error_in_progress if set after the channel has been opened. ns_error_failure if used for setting referrer during visitrequestheaders(). getting the value will not throw. requestmethod acstring set or get the http request method (default is "get"). setter ...
...se code indicates success. the value of nsirequest.status() will be ns_ok even when processing a 404 file not found response because such a response may include a message body that (in some cases) should be shown to the user. use this attribute to distinguish server error pages from normal pages, instead of comparing the response status manually against the set of valid response codes, if that is required by your application. read only. exceptions thrown ns_error_not_available if called before the response has been received (before onstartrequest()). responsestatus unsigned long get the http response code (for example 200). read only. exceptions thrown ns_error_not_available if called before the response has been received (before ons...
nsIOutputStream
m number of bytes to copy from the buffer. return value this method returns the number of bytes copied from the buffer (may be less than acount). exceptions thrown ns_base_stream_would_block if writing to the output stream would block the calling thread (non-blocking mode only) writefrom() this method copies data from an nsiinputstream to this nsioutputstream. a nsioutputstream is not required to implement this method. in some contexts, writefrom may be guaranteed to be implemented, but in general it is not. this method serves as an optimization. note: this method is defined by this interface in order to allow the output stream to efficiently copy the data from the input stream into its internal buffer (if any). if this method was provided as an external facility, a separate char* buf...
...ve code only!writesegments low-level write method that has access to the stream's underlying buffer. the reader function may be called multiple times for segmented buffers. this method is expected to keep calling the reader until either there is nothing left to write or the reader returns an error. this method should not call the reader with zero bytes to provide. note: a nsioutputstream is not required to implement this method. in some contexts, writesegments may be guaranteed to be implemented, but in general it is not. this method serves as an optimization. unsigned long writesegments( in nsreadsegmentfun areader, in voidptr aclosure, in unsigned long acount ); parameters areader a callback function that may be called multiple times. see nsreadsegmentfun for more details on this ...
nsIParserUtils
nd flattens out svg. sanitizerlogremovals (1 << 6) flag for sanitizer: log messages to the console for everything that gets sanitized. methods converttoplaintext() converts html to plain text. astring converttoplaintext( in astring src, in unsigned long flags, in unsigned long wrapcol ); parameters src the html source to parse (c++ callers are allowed but not required to use the same string for the return value.) flags conversion option flags defined in nsidocumentencoder. wrapcol number of characters per line; 0 for no auto-wrapping. return value the plain text conversion of the html specified in src. parsefragment() parses markup into a sanitized document fragment. nsidomdocumentfragment parsefragment( in astring fragment, in unsigned long flag...
...sn't recognize can get removed as a side effect. note: if -moz-binding is not present, <style> elements and style attributes, and if sanitizerallowstyle is specified, the sanitized content may still be xss dangerous if loaded into a non-gecko web engine! astring sanitize( in astring src, in unsigned long flags ); parameters src the html source to parse (c++ callers are allowed but not required to use the same string for the return value). flags sanitization option flags defined above. return value the resulting text. ...
nsIPluginHost
ewindowptr apluginnativewindow ); parameters apluginnativewindow native code only!destroy void destroy(); parameters none. native code only!findproxyforurl fetches a url. (corresponds to npn_geturl and npn_geturlnotify.) posts to a url with post data and/or post headers. (corresponds to npn_posturl and npn_posturlnotify.) returns the proxy info for a given url. the caller is required to free the resulting memory with nsimalloc.free(). the result will be in the following format. "direct" -- no proxy "proxy xxx.xxx.xxx.xxx" -- use proxy "socks xxx.xxx.xxx.xxx" -- use socks mixed. for example "proxy 111.111.111.111;proxy 112.112.112.112", "proxy 111.111.111.111;socks 112.112.112.112".... which proxy/socks to use is determined by the plugin. void findproxyforurl( in st...
...ing and cr or lf some where after that, then it assumes there is http headers in the input buffer and continue to search for end of headers (crlfcrlf or lflf). it will *always malloc()* output buffer (caller is responsible to free it) if input buffer starts with lf, which comes from 4.x spec http://developer.netscape.com/docs/manuals/communicator/plugin/pgfn2.htm#1007754 "if no custom headers are required, simply add a blank line ('\n') to the beginning of the file or buffer.", it skips that '\n' and considers rest of the input buffer as data. if "content-length" string and end of headers is found it substitutes single lf with crlf in the headers, so the end of headers always will be crlfcrlf (single cr in headers, if any, remain untouched) else it puts "content-length: "+size_of_data+crlfcrlf at ...
nsITextInputProcessor
string, specify commit string with its argument: tip.commitcompositionwith("foo-bar-buzz"); when you cancel composition, just do this: tip.cancelcomposition(); when you dispatch keydown event (and one or more keypress events), just do this: var keyevent = new keyboardevent("", // type attribute value should be empty. { key: "enter", // required. code: "enter", // optional. keycode: keyboardevent.dom_vk_return, // required if printable key, but optional if non-printable key. location: keyboardevent.dom_vk_standard, // optional, may be computed from code attribute value. repeat: false, // optional. }); // the other att...
...rdevent instance for a call of either keydown() or keyup(), this value should be empty string. otherwise, when you use the keyboardevent instance for a call of startcomposition(), flushpendingcomposition(), commitcomposition(), commitcompositionwith(), or cancelcomposition(), you can specify "keydown" or empty string. if "keydown" is specified, the methods don't dispatch the "keyup" event. key required. when you dispatch printable key events, this value should be the text to be inputted. even if the key event shouldn't cause text input actually, e.g., ctrl key is pressed, this value should be the text when such modifiers causing suppressing text input are not pressed. for example, ctrl+c should be "c", ctrl+shift+cshould be "c", altgr+c may be "©" and then, ctrl+altgr+c should be "©". when ...
nsITextInputProcessorNotification
or notification to ime. when gecko supports new notification to ime, this interface may have some new attributes. so, nsitextinputprocessorcallback won't be changed for keeping backward compatibility. attributes attribute type description type acstring the type of request or notification to ime. see type values below. types "request-to-commit" this is required to be handled. when this is requested, the callback should commit composition synchronously, i.e., nsitextinputprocessor.commitcomposition() should be called. if the callback doesn't want to commit the composition synchronously, it's okay to commit it later (i.e., asynchronously). however, gecko will commit the composition with the last composing string internally. this is typically notified w...
...() should be called. if the callback doesn't want to commit the composition synchronously, it's okay to commit it later (i.e., asynchronously). however, gecko will commit the composition with the last composing string internally. this is typically notified when user clicks somewhere, focus is moved, or web contents modify the value of the editor during composition. "request-to-cancel" this is required to be handled. when this is requested, the callback should cancel composition synchronously, i.e., nsitextinputprocessor.cancelcomposition() should be called. if the callback doesn't want to cancel the composition synchronously, it's okay to cancel it later (i.e., asynchronously). however, gecko will cancel the composition with empty string internally. this is typically notified when the edito...
XPCOM
in a pointer without addrefing it.binary compatibilityif mozilla decides to upgrade to a compiler that does not have the same abi as the current version, any built component may fail. it is a possiblity that is introduced when upgrading to a new compiler without recompiling everything. effectively, it is a different platform.bundling multiple binary componentsbinary xpcom components are sometimes required to implement low-level features for extensions. since binary components are linked against a single gecko sdk, a dependency to a particular version of gecko is created. if the component uses only "frozen" xpcom interfaces, there is a good chance the same binary component will work with different versions of gecko (version 1.8 and 1.9, for example). the more likely case is that the component uses ...
...bjects (e.g. mutex::lock()) has a matching function in nspr (pr_lock()). this is no accident, as mozilla:: primitives are merely bare-minimum wrappers around nspr's.xptcall faqxptcall is a small low level xpcom method call library. it is implemented using platform specific c/c++ and assembly language code. it is used to facilitate cross language and cross thread method calls. porting this code is required in order to make mozilla run on any given platform.xptcall porting guideoriginal author: john bandhauer, 31 may 1999.xptcall porting statusthis is a status page for the multiplatform porting of xptcall. xptcall has a faq and a porting guide. join the xpcom community choose your preferred method for joining the discussion: mailing list n...
WebIDL bindings
> (e.g. rootedtypedarray<int16array>). typed arrays on the heap need to be traced. dictionary types a dictionary argument is represented by a const reference to a struct whose name is the dictionary name in the mozilla::dom namespace. the struct has one member for each of the dictionary's members with the same name except the first letter uppercased and prefixed with "m". the members that are required or have default values have types as described under the corresponding webidl type in this document. the members that are not required and don't have default values have those types wrapped in optional<>. dictionary return values are represented by an out parameter whose type is a non-const reference to the struct described above, with all the members that have default values preinitialized to t...
...ethods for the interface to access. iterable interfaces have different requirements, based on if they are single or pair value iterators. example interface for a single value iterator: interface longiterable { iterable<long>; getter long(unsigned long index); readonly attribute unsigned long length; }; for single value iterator interfaces, we treat the interface as an indexed getter, as required by the spec. see the indexed getter implementation section for more information on building this kind of structure. example interface for a pair value iterator: interface stringandlongiterable { iterable<domstring, long>; }; the bindings for this pair value iterator interface require the following methods be implemented in the c++ object: class stringandlongiterable { public: // returns t...
PKCS #11 Netscape Trust Objects - Network Security Services
cific to a certificate, they do not need to be stored on the same token as the certificate. trust objects are of the class cko_netscape_trust and have the following attributes. trust object attributes. attribute type description cka_class ck_object_class cko_netscape_trust cka_issuer byte array der-encoding of the certificate issuer name. required for non-trust anchor objects. cka_subject byte array der-encoding of the certificate subject name. optional. cka_serial_number byte array der-encoding of the certificate serial number. required for non-trust anchor objects. cka_cert_sha1_hash byte array sha1 hash of the der-encoding of the certificate. required for trust anchor objects. ck...
... cka_trust_server_auth ck_trust level of trust for server authentication purpose. cka_trust_client_auth ck_trust level of trust for client authentication purpose. ...
Plug-in Basics - Plugins
uivalent to the src attribute of embed. codebase represents the url of the plug-in; this is the same as the codebase attribute of the applet element. for plug-ins, codebase is the same as pluginspace. type represents the mime type of the plug-in; this is the same as the type attribute of embed. height, width, align are basic img/embed/applet attributes supported by object. height and width are required for object elements that resolve to embed elements. use the id attribute, which specifies the name of the plug-in, if the plug-in is communicating with javascript. this is equivalent to the name attribute of applet and embed. it must be unique. using the appropriate attributes it's up to you to provide enough attributes and to make sure that they do not conflict; for example, the values of wi...
...ile format). the embed element has a number of attributes that determine the appearance and size of the plug-in instance, including these: the border and frameborder attributes specify the size of a border for the plug-in or draw a borderless plug-in. height, width, and units determine the size of the plug-in in the html page. if the plug-in is not hidden, the height and width attributes are required. hspace and vspace create a margin of the specified width, in pixels, around the plug-in. align specifies the alignment for the plug-in relative to the web page. use the hidden attribute if you do not want the plug-in to be visible. in this case, you do not need the attributes that describe plug-in appearance. in fact, hidden overrides those attributes if they are present. use the name attri...
Structures - Plugins
« previousnext » this chapter describes the data structures that are used to represent the various objects in the plug-in api. structure summary npanycallbackstruct contains information required during embedded mode printing. npbyterange represents a particular range of bytes from a stream. npembedprint substructure of npprint that contains platform-specific information used during embedded mode printing. npevent represents an event passed by npp_handleevent to a windowless plug-in. ...
...that contains platform-specific information used during embedded mode printing. npevent represents an event passed by npp_handleevent to a windowless plug-in. npfullprint substructure of npprint that contains platform-specific information used during full-page mode printing. npp represents a single instance of a plug-in. np_port contains information required by the window field of an npwindow structure. npprint contains information the plug-in needs to print itself in full-page or embedded mode. npprintcallbackstruct contains information required by the platformprint field of the npembedprint during embedded mode printing. nprect represents a rectangular area of a page. npregion represents a platform-de...
DevTools API - Firefox Developer Tools
be used. the parameter is a toolpanel object. {toolid}-selected(panel) a tool has been selected. the parameter is a toolpanel object. {toolid}-destroy(panel) a tool is about to be destroyed. the parameter is a toolpanel object. destroy the toolbox is about to be destroyed. destroyed the toolbox has been destroyed. tooldefinition a tooldefinition object contains all the required information for a tool to be shown in the toolbox. methods istargetsupported(target) a method that is called during toolbox construction to check if the tool supports debugging the given target. parameters: target {target} - the target to check. return value: a boolean indicating if the tool supports the given target. build(window, toolbox) a method that builds the toolpane...
...ile the tool is the active tool. parameters: panel {toolpanel} - the toolpanel for the tool. toolbox {toolbox} - the toolbox for the shortcut was triggered for. return value: undefined. properties the tooldefinition object can contain following properties. most of them are optional and can be used to customize the presense of the tool in the browser and the toolbox. id string, required. an unique identifier for the tool. it must be a valid id for an html element. url string, required. an url of the panel document. label string, optional. the tool's name. if undefined the icon should be specified. tooltip string, optional. the tooltip for the tool's tab. panellabel string, optional. an accessibility label for the panel. ordinal integer, optional. th...
Constraint validation API - Web APIs
however, you may want to impose more complex constraints, or to provide clearer reporting of validation failures than the defaults. ...
...set, the validity state is set to invalid. to clear this state, invoke the function with an empty string passed as its argument. in this case the custom error message is cleared, the element is considered valid, and no message is shown. examples take the following form: <form> <label for="name">enter username (upper and lowercase letters): </label> <input type="text" name="name" id="name" required pattern="[a-za-z]+"> <button>submit</button> </form> the basic html form validation features will cause this to produce a default error message if you try to submit the form with either no valid filled in, or a value that does not match the pattern. if you wanted to instead display custom error messages, you could use javascript like the following: const nameinput = document.queryselector('i...
CredentialsContainer.create() - Web APIs
effect. syntax var promise = credentialscontainer.create([options]) parameters options an object of type credentialcreationoptions that contains options for the requested new credentials object. it must include one of the options "password", "federated", or "publickey". the options are: password: optional either an htmlformelement, or a passwordcredentialdata object. tbd id: (required) usvstring inherited from credentialdata. name: optional usvstring tbd iconurl: optional usvstring tbd password: (required) usvstring tbd federated: optional an federatedcredentialinit object. contains requirements for creating/obtaining federated credentials. the available options are: id: (required) usvstring inherited from credentialdata. name: optional usvstri...
... returns a promise that resolves with a credential instance, such as passwordcredential, federatedcredential, or publickeycredential. ...
CredentialsContainer.get() - Web APIs
redential.[[collectfromcredentialstore]] is called. this method is restricted to top-level contexts. calls to it within an <iframe> element will resolve without effect. syntax var promise = credentialscontainer.get([options]) parameters options optional an object of type credentialrequestoptions that contains options for the request. the options include criteria that the credentials are required or allowed to have, and options for interacting with the user. it can contain the following properties: password: a boolean indicating that returned credential instances should include user (as opposed to federated) credentials. federated: a federatedcredentialrequestoptions object containing requirements for returned federated credentials. the available options are: providers: an ...
...ated credentials. the available options are: providers: an array of domstring instances of identity providers to search for. protocols an array of domstring instances of federation protocols to search for. publickey: an publickeycredentialrequestoptions object containing requirements for returned webauthn credentials. mediation: a string indicating whether the user will be required to log on for every visit to the website. valid values are "silent", "optional", or "required". unmediated: a boolean indicating the returned credential instance should not require user mediation. signal: an instance of abortsignal that can indicate that an ongoing get() operation should be halted. an aborted operation may complete normally (generally if the abort was received after the ope...
Using FormData Objects - Web APIs
nclude additional information that's not necessarily user-editable. sending files using a formdata object you can also send files using formdata. ...
...m enctype="multipart/form-data" method="post" name="fileinfo"> <label>your email address:</label> <input type="email" autocomplete="on" autofocus name="userid" placeholder="email" required size="32" maxlength="64" /><br /> <label>custom file label:</label> <input type="text" name="filelabel" size="12" maxlength="32" /><br /> <label>file to stash:</label> <input type="file" name="file" required /> <input type="submit" value="stash the file!" /> </form> <div></div> then you can send it using code like the following: var form = document.forms.nameditem("fileinfo"); form.addeventlistener('submit', function(ev) { var ooutput = document.queryselector("div"), odata = new formdata(form); odata.append("customfield", "this is some extra data"); var oreq = new xmlhttprequest()...
HTMLInputElement - Web APIs
s the element's autofocus attribute, which specifies that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. only one form element in a document can have the autofocus attribute. it cannot be applied if the type attribute is set to hidden (that is, you cannot automatically set focus to a hidden control). required boolean: returns / sets the element's required attribute, indicating that the user must fill in a value before submitting a form. value string: returns / sets the current value of the control. note: if the user enters a value different from the value expected, this may return an empty string. validity read only validitystate object: returns the element's current...
...ccesskey properties, as well as the blur(), click(), and focus() methods, are now defined on htmlelement. the following properties are now obsolete: align and usemap. the following properties have been added: autocomplete, autofocus, dirname, files, formaction, formenctype, formmethod, formnovalidate, formtarget, height, indeterminate, labels, list, max, min, multiple, pattern, placeholder, required, selectiondirection, selectionend, selectionstart, step, validationmessage, validity, valueasdate, valueasnumber, width, and willvalidate. the following methods have been added: checkvalidity(), setcustomvalidity(), setselectionrange(), stepup(), and stepdown(). document object model (dom) level 2 html specificationthe definition of 'htmlinputelement' in that specification. obsolet...
HTMLSelectElement - Web APIs
tiple html attribute, which indicates whether multiple items can be selected. htmlselectelement.name a domstring reflecting the name html attribute, containing the name of this control used by servers and dom search functions. htmlselectelement.optionsread only an htmloptionscollection representing the set of <option> (htmloptionelement) elements contained by this element. htmlselectelement.required a boolean reflecting the required html attribute, which indicates whether the user is required to select a value before submitting the form. htmlselectelement.selectedindex a long reflecting the index of the first selected <option> element. the value -1 indicates no element is selected. htmlselectelement.selectedoptionsread only an htmlcollection representing the set of <option> elements t...
...tus comment html living standardthe definition of 'htmlselectelement' in that specification. living standard since the latest snapshot, html5, it adds the autocomplete property and the reportvalidity() method. html5the definition of 'htmlselectelement' in that specification. recommendation is a snapshot of html living standard. it adds the autofocus, form, required, labels, selectedoptions, willvalidate, validity and validationmessage properties. the tabindex property and the blur() and focus() methods have been moved to htmlelement. the methods item(), nameditem(), checkvalidity() and setcustomvalidity(). document object model (dom) level 2 html specificationthe definition of 'htmlselectelement' in that specification. obsolete option...
HTMLTextAreaElement - Web APIs
name string: returns / sets the element's name attribute, containing the name of the control. placeholder string: returns / sets the element's placeholder attribute, containing a hint to the user about what to enter in the control. readonly boolean: returns / sets the element's readonly attribute, indicating that the user cannot modify the value of the control. required boolean: returns / sets the element's required attribute, indicating that the user must specify a value before submitting the form. rows unsigned long: returns / sets the element's rows attribute, indicating the number of visible text lines for the control. selectiondirection string: returns / sets the direction in which selection occurred. this is "forward" if selectio...
...tandardthe definition of 'htmltextareaelement' in that specification. living standard html5the definition of 'htmltextareaelement' in that specification. recommendation the attributes tabindex and accesskey, as well as the methods blur() and focus() are now defined on htmlelement. the following attributes have been added: autofocus, placeholder, dirname, wrap, maxlength, required, textlength, labels, selectionstart, selectionend, selectiondirection, validity, validationmessage, and willvalidate. the following methods have been added: checkvalidity(), setcustomvalidity(), and setselectionrange(). document object model (dom) level 2 html specificationthe definition of 'htmltextareaelement' in that specification. obsolete the property defaultvalue doesn't ...
IDBIndexSync - Web APIs
sor over the records of this index. the range of the new cursor matches the specified key range; if the key range is not specified or is null, then the range includes all the records. void opencursor ( in optional idbkeyrange range, in optional unsigned short direction ) raises (idbdatabaseexception); parameters range the key range to use as the cursor's range. direction the cursor's required direction. returns void exceptions this method can raise an idbdatabaseexception with the following code: not_found_err if no records exist in this index for the requested key range. openobjectcursor() creates a cursor over the records of this index's referenced object store, as arranged by this index. the range of the new cursor matches the specified key range; if the key range is no...
...e, as arranged by this index. the range of the new cursor matches the specified key range; if the key range is not specified or is null, then the range includes all the records. void openobjectcursor ( in optional idbkeyrange range, in optional unsigned short direction ) raises (idbdatabaseexception); parameters range the key range to use as the cursor's range. direction the cursor's required direction. returns void exceptions this method can raise an idbdatabaseexception with the following code: not_found_err if no records exist in this index for the requested key range. put() stores the given value in this index and returns the key for the stored record. if a record already exists with the given key, the record is overwritten. any put ( in any value, in optional any...
Checking when a deadline is due - Web APIs
li>data not submitted — form incomplete.</li>'; return; } in this segment, we check to see if the form fields have all been filled in. if not, we drop a message into our developer notifications pane (see the bottom left of the app ui) to tell the user what is going on, and exit out of the function. ...
... note.innerhtml += '<li>transaction not opened due to error. duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // add our newitem object to the object store var request = objectstore.add(newitem[0]); in this section we create an object called newitem that stores the data in the format required to insert it into the database. the next few lines open the database transaction and provide messages to notify the user if this was successful or failed.then an objectstore is created into which the new item is added. the notified property of the data object indicates that the to-do list item's deadline has not yet come up and been notified - more on this later! note: the db variable stores a ...
MediaTrackConstraints.aspectRatio - Web APIs
g the value of mediatracksupportedconstraints.aspectratio as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { aspectratio: constraint }; constraintsobject.aspectratio = constraint; value a constraindouble describing the acceptable or required value(s) for a video track's aspect ratio. the value is the width divided by the height and is rounded to ten decimal places. for example, the standard high-definition video aspect ratio of 16:9 can be computed as 1920/1080, or 1.7777777778. if this value is a number, the user agent will attempt to obtain media whose aspect ratio is as close as possible to this number given the capabilities of t...
... video aspect ratio of 16:9 can be computed as 1920/1080, or 1.7777777778. if this value is a number, the user agent will attempt to obtain media whose aspect ratio is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required aspect ratio (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'aspectratio' in that specification. candidate recomm...
MediaTrackConstraints.frameRate - Web APIs
hecking the value of mediatracksupportedconstraints.framerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
... example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'framerate' in that specification. ...
MediaTrackConstraints.latency - Web APIs
however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var constraintsobject = { latency: constraint }; constraintsobject.latency = constraint; value a constraindouble describing the acceptable or required value(s) for an audio track's latency, with values specified in seconds. in audio processing, latency is the time between the start of processing (when sound occurs in the real world, or is generated by a hardware device) and the data being made available to the next step in the audio input or output process. in most cases, low latency is desirable for performance and user experience purposes, bu...
...e otherwise acceptable, higher latency might be acceptable. if this property's value is a number, the user agent will attempt to obtain media whose latency tends to be as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required latency (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. latency is always prone to some variation due to hardware usage demands, network constraints, and so forth, so even in an "exact" match, some variation should be expected. example see example: constraint exerciser in capabilities, constraints, and settings for an example. sp...
MediaTrackControls.volume - Web APIs
rted by checking the value of mediatracksupportedconstraints.volume as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { volume: constraint }; constraintsobject.volume = constraint; value a constraindouble describing the acceptable or required value(s) for an audio track's volume, on a linear scale where 0.0 means silence and 1.0 is the highest supported volume. if this value is a number, the user agent will attempt to obtain media whose volume is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its ...
... a linear scale where 0.0 means silence and 1.0 is the highest supported volume. if this value is a number, the user agent will attempt to obtain media whose volume is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required volume (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. any constraint set which only permits values outside the range 0.0 to 1.0 cannot be satisfied and will result in failure. example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
Media Capabilities API - Web APIs
consists of a media decoding type and a videoconfiguration or audioconfiguration dictionary. mediaencodingconfiguration defines the valid values for allowed types of media when the media configuration is submitted as the parameter for mediacapabilities.encodinginfo(). consists of a media encoding type and a videoconfiguration or audioconfiguration dictionary. ...
...nginfo(). consists of a media encoding type and a videoconfiguration or audioconfiguration dictionary. videoconfiguration describes the required video properties that must be configured when querying a video configuration to be passed as part of a mediaconfiguration parameter to the mediacapabilities.encodinginfo() and mediacapabilities.decodinginfo() methods. audioconfiguration describes the required audio properties that must be configured when querying an audio configuration to be passed as part of a mediaconfiguration parameter to the mediacapabilities.encodinginfo() and mediacapabilities.decodinginfo() methods. specifications specification status comment media capabilities draft initial definition ...
Media Source API - Web APIs
emory 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 its extensible api. creating assets that work with mse in modern browsers is a laborious process, taking significant time, computing power, and energy. the usage of external utilities to massage the content into a suitable format is required. while browser support for the various media containers with mse is spotty, usage of the h.264 video codec, aac audio codec, and mp4 container format is a common baseline. mse also provides an api for runtime detection of container and codec support. if you do not require explicit control of video quality over time, the rate at which content is fetched, or the rate at which memory is evicted, th...
...protocols available (such as http live streaming (hls)), dash has the most platform support. dash moves lots of logic out of the network protocol and into the client side application logic, using the simpler http protocol to fetch files. indeed, one can support dash with a simple static file server, which is also great for cdns. this is in direct contrast with previous streaming solutions that required expensive licenses for proprietary non-standard client/server protocol implementations. the two most common use cases for dash involve watching content “on demand” or “live.” on demand allows a developer to take their time transcoding the assets into multiple resolutions of various quality. live profile content can introduce latency due to its transcoding and broadcasting, so dash is n...
PublicKeyCredentialRequestOptions.userVerification - Web APIs
ss. note: an analogous option exists for the creation operation (navigators.credentials.create()), see the userverification property of publickeycredentialcreationoptions.authenticatorselection. syntax userverification = publickeycredentialrequestoptions.userverification value a string qualifying how the user verification should be part of the authentication process. ...
...exists for the creation operation (navigators.credentials.create()), see the userverification property of publickeycredentialcreationoptions.authenticatorselection. syntax userverification = publickeycredentialrequestoptions.userverification value a string qualifying how the user verification should be part of the authentication process. ...
RTCIceCandidate.usernameFragment - Web APIs
ty on the rtcicecandidate interface is a string indicating the username fragment ("ufrag") that uniquely identifies a single ice interaction session. this value is specified when creating the rtcicecandidate by setting the corresponding usernamefragment value in the rtcicecandidateinit object when creating a new candidate with new rtcicecandidate(). note that 24 bits of the username fragment are required to be randomized by the browser. see randomization below for details. if you instead call rtcicecandidate() with a string parameter containing the candidate m-line text, the value of usernamefragment is extracted from the m-line. syntax var ufrag = rtcicecandidate.usernamefragment; value a domstring containing the username fragment (usually referred to in shorthand as "ufrag" or "ice-ufrag")...
...alue a domstring containing the username fragment (usually referred to in shorthand as "ufrag" or "ice-ufrag") that, along with the ice password ("ice-pwd"), uniquely identifies a single ongoing ice interaction, including for any communication with the stun server. the string may be up to 256 characters long, and has no default value. randomization at least 24 bits of the text in the ufrag are required to be randomly selected by the ice layer at the beginning of the ice session. the specifics for which bits are random and what the remainder of the ufrag text are are left up to the browser implementation to decide. for example, a browser might choose to always use a 24-character ufrag in which bit 4 of each character is randomly selected between 0 and 1. another example: it might take a user-def...
SVGFontElement - Web APIs
specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgfontelement' in that specification. recommendation initial definition ...
...ent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface has no properties but inherits properties from its parent, svgelement and implements properties from svgexternalresourcesrequired and svgstylable. methods this interface has no methods but inherits methods from its parent, svgelement and implements methods from svgexternalresourcesrequired and svgstylable. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgfontelement' in that specification. recommendation initial definition ...
Using readable streams - Web APIs
constructor allows you to do this via a syntax that looks complex at first, but actually isn’t too bad. the generic syntax skeleton looks like this: const stream = new readablestream({ start(controller) { }, pull(controller) { }, cancel() { }, type, autoallocatechunksize }, { highwatermark, size() }); the constructor takes two objects as parameters. ...
...inside this method, you should include code that sets up the stream functionality, e.g. beginning generation of data or otherwise getting access to the source. ...
Using writable streams - Web APIs
we use the writablestream() constructor; the syntax looks complex at first, but actually isn’t too bad. the syntax skeleton looks like this: const stream = new writablestream({ start(controller) { }, write(chunk,controller) { }, close(controller) { }, abort(reason) { } }, { highwatermark, size() }); the constructor takes two objects as parameters. the first object is required, and creates a model in javascript of the underlying sink the data is being written to. the second object is optional, and allows you to specify a custom queueing strategy to use for your stream, which takes the form of an instance of bytelengthqueuingstrategy or countqueuingstrategy. the first object can contain up to four members, all of which are optional: start(controller) — a method th...
...fied inside the writablestream() constructor, as discussed above. controllers as you'll have noticed when studying the writablestream() syntax skeleton, the start(), write(), and close() methods can optionally have a controller parameter passed to them. this contains an instance of the writablestreamdefaultcontroller interface, which can be used by the developer to further control the stream as required. this currently only has one method available on it — writablestreamdefaultcontroller.error(), which when invoked causes future interactions with the stream to error. this is useful when another part of an app goes wrong, and you want to propagate the error to the stream so that the whole system fails cleanly, rather than risking garbage being silently written to the stream (or something simil...
SubtleCrypto.unwrapKey() - Web APIs
kcs8: pkcs #8 format. spki: subjectpublickeyinfo format. jwk: json web key format. wrappedkey is an arraybuffer containing the wrapped key in the given format. unwrappingkey is the cryptokey to use to decrypt the wrapped key. the key must have the unwrapkey usage set. unwrapalgo is an object specifying the algorithm to be used to encrypt the exported key, and any extra parameters as required: to use rsa-oaep, pass an rsaoaepparams object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. to use aes-kw, pass the string "aes-kw" or an object of the form { "name": "aes-kw }. unwrappedkeyalgo is a dictionary object defining the type of key to unwrap and providing extra algorithm-s...
...p, pass an rsaoaepparams object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. to use aes-kw, pass the string "aes-kw" or an object of the form { "name": "aes-kw }. unwrappedkeyalgo is a dictionary object defining the type of key to unwrap and providing extra algorithm-specific parameters as required. for rsassa-pkcs1-v1_5, rsa-pss, or rsa-oaep: pass an rsahashedimportparams object. for ecdsa or ecdh: pass an eckeyimportparams object. for hmac: pass an hmacimportparams object. for aes-ctr, aes-cbc, aes-gcm, or aes-kw: pass the string identifying the algorithm or an object of the form { "name": algorithm }, where algorithm is the name of the algorithm. extractable is a boo...
SyncManager.register() - Web APIs
resolves to an instance of syncregistration. parameters options optional an object that sets options for an instance of syncregistration. the available options are: allowonbattery: a boolean that determines whether synchronization is allowed when the user agent is on a battery-powered device. the default is true. id: the unique identifier of the specified syncregistration object. idlerequired: a boolean that determines whether synchronization is allowed when the user agent's device is idle. the default is false. maxdelay: the maximum delay in milliseconds before the next sync event (or the first sync event if it is periodic). the default is 0, meaning there is no maximum delay. mindelay: the minimum delay in milliseconds before the next sync event (or the first sync event if it is...
...econds before the next sync event (or the first sync event if it is periodic). the default is 0, meaning there is no maximum delay. mindelay: the minimum delay in milliseconds before the next sync event (or the first sync event if it is periodic). the default is 0. minperiod: the minimum time in milliseconds between periodic sync events. the default is 0, meaning events are not periodic. minrequirednetwork: the network condition under which background synchronization will occur. valid values are 'network-any', 'network-offline', 'network-online', 'network-non-mobile'. the default value is 'network-online'. ...
Touch() - Web APIs
Web › API › Touch › Touch
"clientx", optional and defaulting to 0, of type double, that is the horizontal position of the touch on the client window of user's screen, excluding any scroll offset. ...
... "clientx", optional and defaulting to 0, of type double, that is the horizontal position of the touch on the client window of user's screen, excluding any scroll offset. ...
ValidityState - Web APIs
nge css pseudo-classes. tooshort read only a boolean that is true if the value fails to meet the specified minlength for htmlinputelement or htmltextareaelement objects, or false if its length is greater than or equal to the minimum length. if true, the element matches the :invalid and :out-of-range css pseudo-classes. typemismatch read only a boolean that is true if the value is not in the required syntax (when type is email or url), or false if the syntax is correct. if true, the element matches the :invalid css pseudo-class. valid read only a boolean that is true if the element meets all its validation constraints, and is therefore considered to be valid, or false if it fails any constraint. if true, the element matches the :valid css pseudo-class; the :invalid css pseudo-class otherwi...
... true, the element matches the :invalid css pseudo-class. valid read only a boolean that is true if the element meets all its validation constraints, and is therefore considered to be valid, or false if it fails any constraint. if true, the element matches the :valid css pseudo-class; the :invalid css pseudo-class otherwise. valuemissing read only a boolean that is true if the element has a required attribute, but no value, or false otherwise. if true, the element matches the :invalid css pseudo-class. specifications specification status comment html living standardthe definition of 'validitystate' in that specification. living standard living standard html 5.1the definition of 'validitystate' in that specification. recommendation no change fro...
Lifetime of a WebRTC session - Web APIs
nto a browser application. in this article, we'll look at the lifetime of a webrtc session, from establishing the connection all the way through closing the connection when it's no longer needed. this article doesn't get into details of the actual apis involved in establishing and handling a webrtc connection; it simply reviews the process in general with some information about why each step is required. see signaling and video calling for an actual example with a step-by-step explanation of what the code does. this page is currently under construction, and some of the content will move to other pages as the webrtc guide material is built out. pardon our dust! establishing the connection the internet is big. really big. it’s so big that years ago, smart people saw how big it was, how fast...
... you don't know her address. you need to look up her address and include it on the package, or she'll wind up wondering why you forgot her birthday again. this is where signaling comes in. signaling signaling is the process of sending control information between two devices to determine the communication protocols, channels, media codecs and formats, and method of data transfer, as well as any required routing information. the most important thing to know about the signaling process for webrtc: it is not defined in the specification. why, you may wonder, is something fundamental to the process of establishing a webrtc connection left out of the specification? the answer is simple: since the two devices have no way to directly contact each other, and the specification can’t predict every poss...
Writing WebSocket servers - Web APIs
guage that is capable of berkeley sockets, such as c(++), python, php, or server-side javascript. this is not a tutorial in any specific language, but serves as a guide to facilitate writing your own server. this article assumes you're already familiar with how http works, and that you have a moderate level of programming experience. depending on language support, knowledge of tcp sockets may be required. the scope of this guide is to present the minimum knowledge you need to write a websocket server. note: read the latest official websockets specification, rfc 6455. sections 1 and 4-7 are especially interesting to server implementors. section 10 discusses security and you should definitely peruse it before exposing your server. a websocket server is explained on a very low level here. websoc...
...json parser. practically speaking, this will be part of a library, but the server needs to pass the data around. tip: to avoid name conflict, it's recommended to make your subprotocol name part of a domain string. if you are building a custom chat app that uses a proprietary format exclusive to example inc., then you might use this: sec-websocket-protocol: chat.example.com. note that this isn't required, it's just an optional convention, and you can use any string you wish. related websocket handshake library in c++ writing websocket client applications tutorial: websocket server in c# tutorial: websocket server in vb.net tutorial: websocket server in java ...
Geometry and reference spaces in WebXR - Web APIs
to cover how the physical position and orientation of the user's head, as well as potentially other parts of their body such as the hands, are mapped into the digital world, as well as how the relative positions of both physical and virtual objects are tracked as they move around, so that the scene can be properly rendered and composited. fundamentals of 3d geometry while we'll examine here the required math operations used to compute the positions, orientations, and movement of objects in virtual space—plus the need to integrate the human viewer of the scene into the mix—a thorough introduction to geometry and the use of matrices and vectors to manage 3d representations of a scene is well beyond the scope of what can be accomplished in this article. you can learn more about the individual o...
...ence space that offers the lowest amount of functionality needed, or provide a fallback mechanism that detects failed attempts to obtain reference spaces and tries again with a less powerful alternative. the compatibility issues that arise may be as fundamental as being unable to support immersive-ar mode (augmented reality sessions) on a vr-only headset, or may involve a request for one or more required options which cannot be met when attempting to create the xr session. xr sessions are created using the navigator.xr.requestsession() method. one of its optional parameters is an object conforming to the xrsessioninit dictionary which you can use to specify required and/or optional features that the session must (or should ideally) support. currently, the only supported options are strings ident...
Lighting a WebXR setting - Web APIs
potential security issues involved with collecting all of this data in order to generate and apply lighting to your virtual objects using real-world data. of course, many ar applications make it pretty clear where the user is located. if the user is running an app called touring the louvre, there's a very good chance the user is located in the musée du louvre in paris, france. but browsers are required to take a number of steps to make it difficult to physically locate the user without their consent. ambient light sensor api the collection of light data using the ambient light sensor api introduces various potential privacy issues. lighting information can leak to the web information about the user's surroundings and device usage patterns. such information can be used to enhance user profi...
...re devices access content that uses the same third-party script, that script can be used to correlate lighting information and how it changes over time to attempt to determine a spatial relationship between the devices; this could in theory indicate that the devices are in the same general area, for example. how browsers mitigate these issues in order to help mitigate these risks, browsers are required by the webxr lighting estimation api specification to report lighting information that is fudged somewhat from the true value. there are many ways this could be done. spherical harmonics precision browsers can mitigate the risk of fingerprinting by reducing the precision of spherical harmonics. when performing real-time rendering—as is the case with any virtual or augmented reality applicatio...
Window.open() - Web APIs
Web › API › Window › open
d as well. size if only one of them is specified, the behavior is implementation-dependent, and web author should not rely on it. width or innerwidth specifies the width of the content area, viewing area of the new secondary window in pixels. the width value includes the width of the vertical scrollbar if present. the width value does not include the sidebar if it is expanded. the minimum required value is 100. height or innerheight specifies the height of the content area, viewing area of the new secondary window in pixels. the height value includes the height of the horizontal scrollbar if present. the height value does not include other ui parts such as location bar, title bar, tab bar, etc. the minimum required value is 100. if the windowfeatures parameter is non-empty and no size ...
...ow in pixels. this outerwidth value includes the window vertical scrollbar (if present) and left and right window resizing borders. outerheight (only on firefox, obsolete from firefox 80) specifies the height of the whole browser window in pixels. this outerheight value includes any/all present toolbar, window horizontal scrollbar (if present) and top and bottom window resizing borders. minimal required value is 100. toolbar and ui parts features in modern browsers (firefox 76 or newer, google chrome, safari, chromium edge), the following features are just a condition for whether to open popup or not. see popup condition section. the following features control the visibility of each ui parts, all features can be set to yes or 1, or just be present to be on. set them to no or 0, or in most ...
XRPermissionDescriptor.mode - Web APIs
the mode property of the xrpermissiondescriptor dictionary is a string taken from the xrsessionmode enumerated type, specifying which web xr session mode (inline, immersive-vr, or immersive-ar) the described permissions will be used for. syntax xrpermissiondescriptor = { mode: xrsessionmode, requiredfeatures: reqfeaturelist, optionalfeatures: optfeaturelist }; xrpermissiondescriptor.mode = xrsessionmode; xrmode = xrpermissiondescriptor.mode; value a domstring whose value is one of the strings found in the xrsessionmode enumerated type: immersive-ar the session's output will be given exclusive access to the immersive device, but the rendered content will be blended with the real-world environment. the session's environmentblendmode indicates the method to be used to blend the...
...mode, and may or may not have viewer tracking available. inline sessions don't require special hardware and should be avalable on any user agent offering webxr api support. usage notes examples the example below checks to ensure that permission has been granted to allow the user to use webxr for an immersive virtual reality experience. no specific features are specified during this query; see requiredfeatures and optionalfeatures for more information on specifying features during a webxr permission check. let xrpermissiondesc = { name: "xr", mode: "immersive-vr" }; if (navigator.permissions) { navigator.permissions.query(xrpermissiondesc).then(({state}) => { switch(state) { case "granted": setupxr(); break; case "prompt": promptandsetupxr(); ...
XRPermissionDescriptor - Web APIs
ties in addition to inheriting the properties of the parent interface, permissiondescriptor, xrpermissiondescriptor provides the following properties. mode an xrsessionmode value indicating the xr mode (inline, immersive-vr, or immersive-ar) for which the permissions are requested. optionalfeatures an array of strings, each specifying the name of a webxr feature which is requested but not required for the app to function. the available features are the same as those used by xrsessioninit; see default features in xrsessioninit for further information. requiredfeatures an array of strings giving the names of the webxr features for which permission must be obtained in order to use your app or site. examples the example below demonstrates performing the permission request for an applicati...
... (currently by just dumping it to the console using domxref("console.log()")}}). if the permissions api isn't available at all, this example simply assumes that webxr will report an appropriate error if permission isn't available, and tries to start up the webxr session using the same setupxr() function called by the granted case. ...
Using ARIA: Roles, states, and properties - Accessibility
on to a browser's accessibility api, and does not affect a page's dom. roles widget roles button checkbox gridcell link menuitem menuitemcheckbox menuitemradio option progressbar radio scrollbar searchbox separator (when focusable) slider spinbutton switch tab tabpanel textbox treeitem composite roles the techniques below describe each composite role as well as their required and optional child roles. combobox grid (including row, gridcell, rowheader, columnheader roles) listbox (including option role) menu menubar radiogroup (see radio role) tablist (including tab and tabpanel roles) tree treegrid document structure roles application article cell columnheader definition directory document feed figure group heading img list listitem ma...
... log marquee status timer window roles alertdialog dialog states and properties widget attributes aria-autocomplete aria-checked aria-current aria-disabled aria-errormessage aria-expanded aria-haspopup aria-hidden aria-invalid aria-label aria-level aria-modal aria-multiline aria-multiselectable aria-orientation aria-placeholder aria-pressed aria-readonly aria-required aria-selected aria-sort aria-valuemax aria-valuemin aria-valuenow aria-valuetext live region attributes aria-live aria-relevant aria-atomic aria-busy drag & drop attributes aria-dropeffect aria-dragged relationship attributes aria-activedescendant aria-colcount aria-colindex aria-colspan aria-controls aria-describedby aria-details aria-errormessage aria-flow...
ARIA: cell role - Accessibility
and table cell element (<td>) whenever possible is strongly encouraged. associated wai-aria roles, states, and properties context roles role="row" an element with role="row" is a row of cells within a tabular structure. a row contains one or more cells, grid cells, column headers, or row headers within a grid, table or treegrid, and optionally within a rowgroup. role="rowgroup" row is a required cell parent. rowgroup is an optional contextual row parent. it establishes a relationship between descendant rows. it is a structural equivalent to the thead, tfoot, and tbody elements in an html table element. role="table" one of the three possible contexts (along with grid and treegrid) in which you'll find a row containing cells. table identifies the cell as being part of a non-interactive t...
...he first header would likely have aria-rowindex="1" set, and cells in row 47 would have aria-rowindex="47", if aria-rowindex were needed due to not all rows being in the dom. if the rows that are visible are contiguous, and there are no cells with a colspan or rowspan greater than one, this property can be added to the parent rows instead of all the rows' cells. keyboard interactions none required javascript features the first rule of aria use is if you can use a native feature with the semantics and behavior you require already built in, instead of repurposing an element and adding an aria role, state or property to make it accessible, then do so. employ the html <td> element instead of the aria role of cell whenever possible. examples <div role="table" aria-label="semantic elements...
ARIA: table role - Accessibility
nd tfoot. role="row" a row within the table, and optionally within a rowgroup, that is a container for one or more cells, columnheaders, or rowheaders. aria-describedby attribute takes as its value the id of the element that serves as a description for the table. aria-label attribute the aria-label provides an accessible name for the table. ...
...aria-label provides an accessible name for the table. aria-colcount attribute this attribute is only required if the columns are not present in the dom all the time. it provides an explicit indication of the number of columns in the full table. set the value to the total number of columns in the full table. if unknown, set aria-colcount="-1". aria-rowcount attribute this attribute is only required if the rows are not present in the dom all the time, such as scrollable tables that reuse rows to minimize the number of dom nodes. it provides an explicit indication of the number of rows in the full table. set the value to the total number of rows in the full table. if unknown, set aria-colcount="-1". keyboard interactions none required javascript features none. for sortable columns, se...
ARIA: button role - Accessibility
for example, if clicking the button opens a dialog, the focus should move to the dialog. if the button closes a dialog, focus should returns to the button that opened the dialog unless the function performed in the dialog context logically leads to a different element. if the button alters the current context, then focus typically remains on the button, such as muting and unmuting an audio file. required javascript features required event handlers buttons can be operated by mouse, touch, and keyboard users. for native html <button> elements, the button's onclick event fires for mouse clicks and when the user presses space or enter while the button has focus. but if another tag is used to create a button, the onclick event only fires when clicked by the mouse cursor, even if role="button" is use...
...ey on the keyboard. (note not the deprecated onkeypress) changing attribute values aria-pressed the value of aria-pressed defines the state of a toggle button. this attribute has one of four possible values: true, false, mixed, undefined examples basic button example in this example, a span element has been given the button role. because a <span> element is used, the tabindex attribute is required to make the button focusable and part of the page's tab order. the included css style is provided to make the <span> element look like a button, and to provide visual cues when the button has focus. the handlebtnclick and handlebtnkeydown event handlers perform the button's action when activated using a mouse click or the space or enter key. in this case, the action is to add a new name to the l...
ARIA: dialog role - Accessibility
the dialog's content as being grouped and separated from the rest of the page content. however, adding role="dialog" alone is not sufficient to make a dialog accessible. additionally, the following needs to be done: the dialog must be properly labeled keyboard focus must be managed correctly the sections below describe how these two requirements can be met. labeling even though it is not required for the dialog itself to be able to receive focus, it still needs to be labeled. the label given to the dialog will provide contextual information for the interactive controls inside the dialog. in other words, the dialog's label acts like a grouping label for the controls inside it (similar to how a <legend> element provides a grouping label for the controls inside a <fieldset> element). if a d...
...ils at any time in the user account section.</p> <button>close</button> </div> keep in mind that a dialog's title and description text do not have to be focusable in order to be perceived by screen readers operating in a non-virtual mode. the combination of the aria dialog role and labeling techniques should make the screen reader announce the dialog's information when focus is moved into it. required javascript features focus management a dialog has particular requirements for how keyboard focus should be managed: dialogs should always have at least one focusable control. for many dialogs, there will be a button like "close", "ok" or "cancel". in addition to the needed control, dialogs can contain any number of focusable elements, even entire forms or other container widgets like tabs. ...
ARIA: textbox role - Accessibility
input field --> <div id="txtboxlabel">enter your five-digit zipcode</div> <div role="textbox" contenteditable="true" aria-placeholder="5-digit zipcode" aria-labelledby="txtboxlabel"></div> <!-- multi-line text area --> <div id="txtboxmultilinelabel">enter the tags for the article</div> <div role="textbox" contenteditable="true" aria-multiline="true" aria-labelledby="txtboxmultilinelabel" aria-required="true"></div> semantic elements are more concise and require no javascript to support textbox features. <label for="txtbox">enter your five-digit zipcode</label> <input type="text" placeholder="5-digit zipcode" id="txtbox"/> <!-- multi-line text area --> <label for="txtboxmultiline">enter the tags for the article</label> <textarea id="txtboxmultiline" required></textarea> where a text f...
...rol first receives focus and when users remove a previously-entered value. instead of using aria-placeholder, use the semantic <input type="text"> or <textarea> with a placeholder attribute. aria-readonly attribute indicates that the user cannot modify the value of the text field. instead of using aria-readonly, use the semantic <input type="text"> or <textarea> with a readonly attribute. aria-required attribute indicates that a value must be provided for the field before it is submitted. instead of using aria-required, use the semantic <input type="text"> or <textarea> with a required attribute. keyboard interactions in a single-line use (when aria-multiline is false or not used), the return or enter key submits the form. in a multi-line use (when aria-multiline is true), return or enter k...
An overview of accessible web applications and widgets - Accessibility
lopers should always prefer using the correct semantic html element over using aria. the aria specification is split up into three different types of attributes: roles, states, and properties. roles describe widgets that aren't otherwise available in html 4, such as sliders, menu bars, tabs, and dialogs. properties describe characteristics of these widgets, such as if they are draggable, have a required element, or have a popup associated with them. states describe the current interaction state of an element, informing the assistive technology if it is busy, disabled, selected, or hidden. aria attributes are interpreted automatically by the browser and translated to the operating system's native accessibility apis. so an element with role="slider" will be controlled in the same way as a native ...
...with the entry fields. in this example, the html for the tooltip has the form shown in example 2a. line 9 sets the aria-hidden state to true. example 2a. html for a tooltip <div class="text"> <label id="tp1-label" for="first">first name:</label> <input type="text" id="first" name="first" size="20" aria-labelledby="tp1-label" aria-describedby="tp1" aria-required="false" /> <div id="tp1" class="tooltip" role="tooltip" aria-hidden="true">your first name is optional</div> </div> the css for this markup is shown in example 2b. note that there is no custom classname used, only the status of the aria-hidden attribute on line 1. example 2b. attribute-based selector for indicating state div.tooltip[aria-hidden="true"] { display: none;...
Accessibility documentation index - Accessibility
aria, accessibility, attribute, codingscripting, html, javascript, needscontent, role(2), agent, alert, user, useragent the aria-invalid attribute is used to indicate that the value entered into an input field does not conform to the format expected by the application.this may include formats such as email addresses or telephone numbers. aria-invalid can also be used to indicate that a required field has not been filled in.the attribute should be programmatically set as a result of a validation process. 21 using the aria-label attribute aria, accessibility, codingscripting, html, needscontent, reference, référence(2), agent, aria-label, user, useragent the aria-label attribute is used to define a string that labels the current element. use it in cases where a text...
...he aria-relevant attribute aria, accessibility, needsexample, arialive, attri the aria-relevant attribute is an optional value used to describe what types of changes have occurred to an aria-live region, and which are relevant and should be announced. any change that is not relevant acts in the same manner it would if the aria-live attribute were set to off. 25 using the aria-required attribute aria, accessibility, needscontent the aria-required attribute is used to indicate that user input is required on an element before a form can be submitted. this attribute can be used with any typical html form element; it is not limited to elements that have an aria role assigned. 26 using the aria-valuemax attribute aria, accessibility the aria-valuemax a...
Perceivable - Accessibility
e clearly labelled so that it is obvious that it is the button you need to press. if there are multiple buttons, make sure they are all clearly labelled to distinguish their function. "listen to the audio instructions for guidance" this is obviously problematic—audio will be inaccessible to those with hearing impairments, whereas text can be read, but also spoken by a screenreader if required. "swipe from the right hand side of the screen to reveal the menu" some users might not be able to swipe the screen, either due to disability or because their device does not support touch. an alternative should be provided, such as a keyboard shortcut or button that can be activated by keyboard or other means. note: conveying instructions solely by color is related, but...
...rom backgrounds and other decoration. the classic example is color (both color contrast and use of color to convey instructions), but it applies in other situations too. success criteria how to conform to the criteria practical resource 1.4.1 use of color (a) color should not be solely relied upon to convey information. for example, in forms, you should never mark required fields purely with a color (like red). instead (or as well as), something like an asterisk with a label of "required" would be more appropriate. see color and color contrast and multiple labels. 1.4.2 audio controls (a) for any audio that plays for longer than three seconds, provide accessible controls to play and pause the audio/video, and mute/adjust volume. use native <bu...
:-moz-ui-invalid - CSS: Cascading Style Sheets
his pseudo-class is applied according to the following rules: if the control does not have focus, and the value is invalid, apply this pseudo-class. if the control has focus, and the value was valid (including empty) when it gained focus, do not apply the pseudo-class. if the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke. if the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. the result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control. however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes vali...
...he preceding rules apply only if the user has changed the value or attempted to submit the form. the result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control. however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. required items have the pseudo-class applied only if the user changes them or attempts to submit an unchanged valid value. by default, gecko applies a style that creates a red "glow" (using the box-shadow property) around items, which have this pseudo-class applied. see the :invalid pseudo-class for an example that shows how to override the default style. the specification for :user-invalid is still in p...
:-moz-ui-valid - CSS: Cascading Style Sheets
ints. this pseudo-class is applied according to the following rules: if the control does not have focus, and the value is valid, apply this pseudo-class. if the control has focus, and the value was valid (including empty) when it gained focus, apply this pseudo-class. if the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke. if the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. the result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control. however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes vali...
...he preceding rules apply only if the user has changed the value or attempted to submit the form. the result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control. however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. required items are flagged as invalid only if the user changes them or attempts to submit an unchanged invalid value. syntax syntax not found in db! specifications not part of any standard. ...
:first-child - CSS: Cascading Style Sheets
the :first-child css pseudo-class represents the first element among a group of sibling elements. /* selects any <p> that is the first element among its siblings */ p:first-child { color: lime; } note: as originally defined, the selected element had to have a parent. beginning with selectors level 4, this is no longer required. syntax :first-child examples basic example html <div> <p>this text is selected!</p> <p>this text isn't selected.</p> </div> <div> <h2>this text isn't selected: it's not a `p`.</h2> <p>this text isn't selected.</p> </div> css p:first-child { color: lime; background-color: black; padding: 5px; } result styling a list html <ul> <li>item 1</li> <li>item 2</li> <li>item 3 <ul> <li>item 3.1</li> <li>item 3.2</li> ...
... selectors level 3the definition of ':first-child' in that specification. recommendation no change. css level 2 (revision 1)the definition of ':first-child' in that specification. recommendation initial definition. ...
:first-of-type - CSS: Cascading Style Sheets
the :first-of-type css pseudo-class represents the first element of its type among a group of sibling elements. /* selects any <p> that is the first element of its type among its siblings */ p:first-of-type { color: red; } note: as originally defined, the selected element had to have a parent. beginning with selectors level 4, this is no longer required. syntax :first-of-type examples styling the first paragraph html <h2>heading</h2> <p>paragraph 1</p> <p>paragraph 2</p> css p:first-of-type { color: red; font-style: italic; } result nested elements this example shows how nested elements can also be targeted. note that the universal selector (*) is implied when no simple selector is written. html <article> <div>this `div` is first!</div> <div>this <span>nested `spa...
... selectors level 3the definition of ':first-of-type' in that specification. recommendation initial definition. ...
:last-child - CSS: Cascading Style Sheets
the :last-child css pseudo-class represents the last element among a group of sibling elements. /* selects any <p> that is the last element among its siblings */ p:last-child { color: lime; } note: as originally defined, the selected element had to have a parent. beginning with selectors level 4, this is no longer required. syntax :last-child examples basic example html <div> <p>this text isn't selected.</p> <p>this text is selected!</p> </div> <div> <p>this text isn't selected.</p> <h2>this text isn't selected: it's not a `p`.</h2> </div> css p:last-child { color: lime; background-color: black; padding: 5px; } result styling a list html <ul> <li>item 1</li> <li>item 2</li> <li>item 3 <ul> <li>item 3.1</li> <li>item 3.2</li> <li>...
... selectors level 3the definition of ':last-child' in that specification. recommendation initial definition. ...
:last-of-type - CSS: Cascading Style Sheets
the :last-of-type css pseudo-class represents the last element of its type among a group of sibling elements. /* selects any <p> that is the last element of its type among its siblings */ p:last-of-type { color: lime; } note: as originally defined, the selected element had to have a parent. beginning with selectors level 4, this is no longer required. syntax :last-of-type examples styling the last paragraph html <h2>heading</h2> <p>paragraph 1</p> <p>paragraph 2</p> css p:last-of-type { color: red; font-style: italic; } result nested elements this example shows how nested elements can also be targeted. note that the universal selector (*) is implied when no simple selector is written. html <article> <div>this `div` is first.</div> <div>this <span>nested `span` is ...
... selectors level 3the definition of ':last-of-type' in that specification. recommendation initial definition. ...
:only-child - CSS: Cascading Style Sheets
epresents an element without any siblings. this is the same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity. /* selects each <p>, but only if it is the */ /* only child of its parent */ p:only-child { background-color: lime; } note: as originally defined, the selected element had to have a parent. beginning with selectors level 4, this is no longer required. syntax :only-child examples basic example html <div> <div>i am an only child.</div> </div> <div> <div>i am the 1st sibling.</div> <div>i am the 2nd sibling.</div> <div>i am the 3rd sibling, <div>but this is an only child.</div></div> </div> css div:only-child { color: red; } div { display: inline-block; margin: 6px; outline: 1px solid; } result a list example h...
... selectors level 3the definition of ':only-child' in that specification. recommendation initial definition. ...
:only-of-type - CSS: Cascading Style Sheets
the :only-of-type css pseudo-class represents an element that has no siblings of the same type. /* selects each <p>, but only if it is the */ /* only <p> element inside its parent */ p:only-of-type { background-color: lime; } note: as originally defined, the selected element had to have a parent. beginning with selectors level 4, this is no longer required. syntax :only-of-type examples styling elements with no siblings of the same type html <main> <div>i am `div` #1.</div> <p>i am the only `p` among my siblings.</p> <div>i am `div` #2.</div> <div>i am `div` #3. <i>i am the only `i` child.</i> <em>i am `em` #1.</em> <em>i am `em` #2.</em> </div> </main> css main :only-of-type { color: red; } result specifications specification status co...
...>i am `div` #2.</div> <div>i am `div` #3. <i>i am the only `i` child.</i> <em>i am `em` #1.</em> <em>i am `em` #2.</em> </div> </main> css main :only-of-type { color: red; } result specifications specification status comment selectors level 4the definition of ':only-of-type' in that specification. working draft matching elements are not required to have a parent. selectors level 3the definition of ':only-of-type' in that specification. recommendation initial definition. ...
:optional - CSS: Cascading Style Sheets
Web › CSS › :optional
the :optional css pseudo-class represents any <input>, <select>, or <textarea> element that does not have the required attribute set on it. /* selects any optional <input> */ input:optional { border: 1px dashed black; } this pseudo-class is useful for styling fields that are not required to submit a form. note: the :required pseudo-class selects required form fields. syntax :optional examples see :invalid for an example. accessibility concerns if a form contains optional <input>s, required inputs should be indicated using the required attribute. ...
...typically, descriptive text and/or an icon are used. ...
:valid - CSS: Cascading Style Sheets
Web › CSS › :valid
this pseudo-class is useful for highlighting correct fields for the user. ...
...generated content relative to them. we then absolutely position different generated content depending on whether the form's data is valid or invalid — a green check or a red cross, respectively. to add a bit of extra urgency to the invalid data, we've also given the inputs a thick red border when invalid. note: we've used ::before to add these labels, as we were already using ::after for the "required" labels. you can try it below: notice how the required text inputs are invalid when empty, but valid when they have something filled in. the email input on the other hand is valid when empty, as it is not required, but invalid when it contains something that is not a proper email address. accessibility concerns the color green is commonly used to indicate valid input. people who have certa...
src - CSS: Cascading Style Sheets
Web › CSS › @font-face › src
the src css descriptor of the @font-face rule specifies the resource containing font data. it is required for the @font-face rule to be valid. syntax /* <url> values */ src: url(https://somewebsite.com/path/to/font.woff); /* absolute url */ src: url(path/to/font.woff); /* relative url */ src: url(path/to/font.woff) format("woff"); /* explicit format */ src: url('path/to/font.woff'); /* quoted url */ src: url(path/to/svgfont.svg#example); /* fragment identifying font */ /* <font-face-name> values */ src: local(font); /* unquoted name */ src: local(some font); /* name containing space */ src: local("font"); /* quoted name */ /* multiple items */ src: local(font), url(path/to/font.svg) format("svg"), url(path/to/fo...
...re than one font load only one of the fonts for a given @font-face rule. fragment identifiers are used to indicate which font to load. if a container format lacks a defined fragment identifier scheme, a simple 1-based indexing scheme (e.g., "font-collection#1" for the first font, "font-collection#2" for the second font, etc.) is used. ...
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
this version does not include auto-placement capability, or grid template areas. some simple grid layouts could be implemented for ie10, through to edge 15, using the -ms properties. as these properties are vendor prefixed, they will not effect any browser supporting the up to date and unprefixed specification. autoprefixer ...
... this, right in my css. feature queries will look very familiar if you have ever used a media query to create a responsive layout. rather than checking a viewport width, or some feature of the browser or device, we check for support of a css property and value pair using an @supports rule. inside the feature query, we can then write any css we need to apply our modern layout, and remove anything required for the older layout. @supports (display: grid) { .wrapper { /* do anything for grid supporting browsers here. */ } } feature queries have excellent browser support, and all of the browsers that support the updated grid specification support feature queries too. you can use them to deal with the issue we have with our enhanced: floated layout. i use an @supports rule to check ...
CSS values and units - CSS: Cascading Style Sheets
entimeters 1cm = 96px/2.54 mm millimeters 1mm = 1/10th of 1cm q quarter-millimeters 1q = 1/40th of 1cm in inches 1in = 2.54cm = 96px pc picas 1pc = 1/16th of 1in pt points 1pt = 1/72th of 1in px pixels 1px = 1/96th of 1in when including a length value, if the length is 0, the unit identifier is not required. otherwise, the unit identifier is required, is case insensitive, and must come immediately after the numeric part of the value, with no space in-between. angle units angle values are represented by the type <angle> and accept the following values: unit name description deg degrees there are 360 degrees in a full circle. grad gradians there are ...
... deg degrees there are 360 degrees in a full circle. grad gradians there are 400 gradians in a full circle. rad radians there are 2π radians in a full circle. turn turns there is 1 turn in a full circle. time units time values are represented by the type <time>. when including a time value, the unit identifier -- the s or ms -- is required. it accepts the following values. unit name description s seconds ms milliseconds there are 1,000 milliseconds in a second. frequency units frequency values are represented by the type <frequency>. it accepts the following values. unit name description hz hertz represents the number of occurrences per se...
Pseudo-classes - CSS: Cascading Style Sheets
html living standard living standard defines when particular selectors match html elements. selectors level 4 working draft de...
...e like :-moz-only-whitespace . no significant change for other pseudo-classes defined in selectors level 3 and html5 (though semantic meaning not taken over). html5 recommendation copies the relevant section from the canonical (whatwg) html spec. css basic user interface module level 3 recommendation defined :default, :valid, :invalid, :in-range, :out-of-range, :required, :optional, :read-only and :read-write, but without the associated semantic meaning. selectors level 3 recommendation defined :target, :root, :nth-child(), :nth-last-of-child(), :nth-of-type(), :nth-last-of-type(), :last-child, :first-of-type, :last-of-type, :only-child, :only-of-type, :empty and :not(). defined the syntax of :enabled, :disabled, :checked, and :indeterminate, b...
outline-color - CSS: Cascading Style Sheets
* keyword value */ outline-color: invert; /* global values */ outline-color: inherit; outline-color: initial; outline-color: unset; the outline-color property is specified as any one of the values listed below. values <color> the color of the outline, specified as a <color>. invert to ensure the outline is visible, performs a color inversion of the background. note that browsers are not required to support this value; if they don't, this keyword is considered invalid. description an outline is a line that is drawn around an element, outside the border. unlike the element's border, the outline is drawn outside the element's frame, and may overlap other content. the border, on the other hand, will actually alter the page's layout to ensure that it fits without overlapping anything else ...
...usted, it is important to ensure that the contrast ratio between it and the background the outline is placed over is high enough that people experiencing low vision conditions will be able to perceive it. color contrast ratio is determined by comparing the luminosity of the text and background color values. in order to meet current web content accessibility guidelines (wcag), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. large text is defined as 18.66px and bold or larger, or 24px or larger. webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 formal definition initial valueinvert, for browsers supporting it, currentcolor for the otherapplies toall ele...
will-change - CSS: Cascading Style Sheets
important: will-change is intended to be used as a last resort, in order to try to deal with existing performance problems. it should not be used to anticipate performance problems. ...
...e memory use and will cause more complex rendering to occur as the browser attempts to prepare for the possible change. this will lead to worse performance. give it sufficient time to work. this property is intended as a method for authors to let the user-agent know about properties that are likely to change ahead of time. then the browser can choose to apply any ahead-of-time optimizations required for the property change before the property change actually happens. so it is important to give the browser some time to actually do the optimizations. find some way to predict at least slightly ahead of time that something will change, and set will-change then. be aware, that will-change may actually influence the visual appearance of elements, when used with property values, that create a...
Adding captions and subtitles to HTML5 video - Developer guides
once the menu is built, it is then inserted into the dom at the bottom of the video...
... this.setattribute('data-state', 'active'); } else { video.texttracks[i].mode = 'hidden'; } } subtitlesmenu.style.display = 'none'; }); subtitlemenubuttons.push(button); return listitem; } this function builds the required <li> and <button> elements, and returns them so they can be added to the subtitles menu list. it also sets up the required event listeners on the button to toggle the relevant subtitle set on or off. this is done by simply setting the required subtlte's mode attribute to showing, and setting the others to hidden. once the menu is built, it is then inserted into the dom at the bottom of the videocontainer. initially the menu is hidden by default, so an event listener needs to be added to our subtitles button to to...
Setting up adaptive streaming media sources - Developer guides
how, looking at two of the most common formats: mpeg-dash and hls (http live streaming.) choosing formats in terms of adaptive streaming formats, there are many to choose from; we decided to choose the following two as between them we can support most modern browsers. mpeg-dash hls (http live streaming) in order to adaptively stream media we need to split the media up into chunks. we are required to provide several different quality files split up over several time points. the more qualities and time points there are, the more 'adaptive' your stream will be, but we will usually want to find a pragmatic balance between size, time to encode and adaptiveness. the good news is that once we have encoded our media in the appropriate format we are pretty good to go. for adaptive streaming over ...
...split up over several time points. the more qualities and time points there are, the more 'adaptive' your stream will be, but we will usually want to find a pragmatic balance between size, time to encode and adaptiveness. the good news is that once we have encoded our media in the appropriate format we are pretty good to go. for adaptive streaming over http, no special server-side components are required. both mpeg-dash and hls use a playlist format to structure the component piece of media that make the possible streams. various bitrate streams are broken into segments and placed in appropriate server folders — we have to provide our media players with a link to lookup files or playlists specifying the name and location of these stream folders. mpeg-dash encoding mpeg-dash is an adaptive bi...
HTML attribute: rel - HTML: Hypertext Markup Language
Web › HTML › Attributes › rel
server that handles pingbacks to the current document. external resource not allowed not allowed preconnect specifies that the user agent should preemptively connect to the target resource's origin. external resource not allowed not allowed prefetch specifies that the user agent should preemptively fetch and cache the target resource as it is likely to be required for a followup navigation. external resource not allowed not allowed preload specifies that the user agent must preemptively fetch and cache the target resource for current navigation according to the potential destination given by the as attribute (and the priority associated with the corresponding destination). external resource not allowed not allowed pre...
... "_blank" as target attribute value). effectively, the opposite of noopener. pingback gives the address of the pingback server that handles pingbacks to the current document. preconnect specifies that the user agent should preemptively connect to the target resource's origin. prefetch specifies that the user agent should preemptively fetch and cache the target resource as it is likely to be required for a followup navigation. preload specifies that the user agent must preemptively fetch and cache the target resource for current navigation according to the potential destination given by the as attribute (and the priority associated with the corresponding destination). prerender specifies that the user agent should preemptively fetch the target resource and process it in a way that helps d...
HTML attribute reference - HTML: Hypertext Markup Language
hould be preloaded. radiogroup <command> readonly <input>, <textarea> indicates whether the element can be edited. referrerpolicy <a>, <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 displayed 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. san...
...st of the time, it will follow the rules laid out in the specification, but sometimes it doesn't. html specifications try to make this as developer-friendly as possible, but for various reasons (mostly historical), some attributes behave oddly (select.size, for example) and you should read the specifications to understand how exactly they behave. boolean attributes some content attributes (e.g. required, readonly, disabled) are called boolean attributes. if a boolean attribute is present, its value is true, and if it’s absent, its value is false. html5 defines restrictions on the allowed values of boolean attributes: if the attribute is present, its value must either be the empty string (equivalently, the attribute may have an unassigned value), or a value that is an ascii case-insensitive ma...
<select>: The HTML Select element - HTML: Hypertext Markup Language
Web › HTML › Element › select
lement. you can include a selected attribute on an <option> element to make it selected by default when the page first loads. the <select> element has some unique attributes you can use to control it, such as multiple to specify whether multiple options can be selected, and size to specify how many options should be shown at once. it also accepts most of the general form input attributes such as required, disabled, autofocus, etc. you can further nest <option> elements inside <optgroup> elements to create separate groups of options inside the dropdown. for further examples, see the native form widgets: drop-down content. attributes this element includes the global attributes. autocomplete a domstring providing a hint for a user agent's autocomplete feature. see the html autocomplete attri...
... <form>. it can also override an ancestor <form> element. multiple this boolean attribute indicates that multiple options can be selected in the list. if it is not specified, then only one option can be selected at a time. when multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown. name this attribute is used to specify the name of the control. required a boolean attribute indicating that an option with a non-empty string value must be selected. size if the control is presented as a scrolling list box (e.g. when multiple is specified), this attribute represents the number of rows in the list that should be visible at one time. browsers are not required to present a select element as a scrolled list box. the default value is 0. note: accor...
HTTP authentication - HTTP
shown in the figure, the exchange must happen over an https (tls) connection to be secure. proxy authentication the same challenge and response mechanism can be used for proxy authentication. as both resource authentication and proxy authentication can coexist, a different set of headers and status codes is needed. in the case of proxies, the challenging status code is 407 (proxy authentication required), the proxy-authenticate response header contains at least one challenge applicable to the proxy, and the proxy-authorization request header is used for providing the credentials to the proxy server. access forbidden if a (proxy) server receives valid credentials that are inadequate to access a given resource, the server should respond with the 403 forbidden status code. unlike 401 unauthorized...
...ponse header contains at least one challenge applicable to the proxy, and the proxy-authorization request header is used for providing the credentials to the proxy server. access forbidden if a (proxy) server receives valid credentials that are inadequate to access a given resource, the server should respond with the 403 forbidden status code. unlike 401 unauthorized or 407 proxy authentication required, authentication is impossible for this user. authentication of cross-origin images a potential security hole recently been fixed by browsers is authentication of cross-site images. from firefox 59 onwards, image resources loaded from different origins to the current document are no longer able to trigger http authentication dialogs (bug 1423146), preventing user credentials being stolen if atta...
Data URLs - HTTP
ncoding is needed to preserve the line endings that delimit rows of the spreadsheet. data:text/plain;base64,sgvsbg8sifdvcmxkiq== base64-encoded version of the above data:text/html,%3ch1%3ehello%2c%20world!%3c%2fh1%3e an html document with <h1>hello, world!</h1> data:text/html,<script>alert('hi');</script> an html document that executes a javascript alert. note that the closing script tag is required. encoding data into base64 format base64 is a group of binary-to-text encoding schemes that represent binary data in an ascii string format by translating it into a radix-64 representation. by consisting only in ascii characters, base64 strings are generally url-safe, and that's why they can be used to encode data in data urls. encoding in javascript the web apis have native methods to encod...
...ing in html a data url provides a file within a file, which can potentially be very wide relative to the width of the enclosing document. as a url, the data should be formatable with whitespace (linefeed, tab, or spaces), but there are practical issues that arise when using base64 encoding. length limitations although firefox supports data urls of essentially unlimited length, browsers are not required to support any particular maximum length of data. for example, the opera 11 browser limited urls to 65535 characters long which limits data urls to 65529 characters (65529 characters being the length of the encoded data, not the source, if you use the plain data:, without specifying a mime type). lack of error handling invalid parameters in media, or typos when specifying 'base64', are ignored,...
CSP: base-uri - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: child-src - HTTP
f example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. f...
... and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inlin...
CSP: connect-src - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: default-src - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: font-src - HTTP
f example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. f...
... and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inlin...
CSP: form-action - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: frame-ancestors - HTTP
s port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. if no url scheme is specified for a host-source and the iframe is loaded from an https url, the url for the page loading the iframe must also be https, per the w3c spec on matching source expressions. <scheme-source> a scheme such as http: or https:. the colon is required and scheme should not be quoted. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. fi...
...refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'none' refers to the empty set; that is, no urls match. the single quotes are required. examples content-security-policy: frame-ancestors 'none'; content-security-policy: frame-ancestors 'self' https://www.example.org; specifications specification status comment content security policy level 3the definition of 'frame-ancestors' in that specification. working draft no changes. content security policy level 2the definition of 'frame-ancest...
CSP: frame-src - HTTP
f example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. f...
... and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inlin...
CSP: img-src - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: manifest-src - HTTP
f example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. f...
... and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inlin...
CSP: media-src - HTTP
f example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. f...
... and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inlin...
CSP: navigate-to - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: object-src - HTTP
f example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. f...
... and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inlin...
CSP: prefetch-src - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: script-src-attr - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: script-src-elem - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: script-src - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: style-src-attr - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: style-src-elem - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: style-src - HTTP
in of example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be us...
...hes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsaf...
CSP: worker-src - HTTP
f example.com using the http: url scheme. mail.example.com:443: matches all attempts to access port 443 on mail.example.com. https://store.example.com: matches all attempts to access store.example.com using https:. *.example.com: matches all attempts to load from any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. f...
... and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inlin...
Protocol upgrade mechanism - HTTP
ients to invite the server to switch to one of the listed protocols, in descending preference order. because upgrade is a hop-by-hop header, it also needs to be listed in the connection header field. this means that a typical request that includes upgrade would look something like: get /index.html http/1.1 host: www.example.com connection: upgrade upgrade: example/1, foo/2 other headers may be required depending on the requested protocol; for example, websocket upgrades allow additional headers to configure details about the websocket connection as well as to offer a degree of security in opening the connection. see upgrading to a websocket connection for more details. if the server decides to upgrade the connection, it sends back a 101 switching protocols response status with an upgrade heade...
...n the client wishes to use when communicating with the server. this number should be the most recent version possible listed in the iana websocket version number registry. the most recent final version of the websocket protocol is version 13. response header if the server can't communicate using the specified version of the websocket protocol, it will respond with an error (such as 426 upgrade required) that includes in its headers a sec-websocket-version header with a comma-separated list of the supported protocol versions. if the server does support the requested protocol version, no sec-websocket-version header is included in the response. sec-websocket-version: supportedversions supportedversions a comma-delineated list of the websocket protocol versions supported by the server. resp...
Date.prototype.toUTCString() - JavaScript
quest. syntax dateobj.toutcstring() return value a string representing the given date using the utc time zone. description the value returned by toutcstring() is a string in the form www, dd mmm yyyy hh:mm:ss gmt, where: format sring description www day of week, as three letters (e.g. ...
...returned by toutcstring() is a string in the form www, dd mmm yyyy hh:mm:ss gmt, where: format sring description www day of week, as three letters (e.g. sun, mon, ...) dd day of month, as two digits with leading zero if required mmm month, as three letters (e.g. jan, feb, ...) yyyy year, as four or more digits with leading zeroes if required hh hour, as two digits with leading zero if required mm minute, as two digits with leading zero if required ss seconds, as two digits with leading zero if required prior to ecmascript 2018, the format of the return value varied according to the platform. the most common return value was an rfc-1123 formatted date stamp, which is a slightly updated versio...
Intl.Collator() constructor - JavaScript
unctuation should be ignored. possible values are true and false; the default is false. numeric whether numeric collation should be used, such that "1" < "2" < "10". possible values are true and false; the default is false. this option can be set through an options property or through a unicode extension key; if both are provided, the options property takes precedence. ...
.... implementations are not required to support this property. casefirst whether upper case or lower case should sort first. possible values are "upper", "lower", or "false" (use the locale's default); the default is "false". this option can be set through an options property or through a unicode extension key; if both are provided, the options property takes precedence. implementations are not required to support this property. examples using collator the following example demonstrates the different potential results for a string occurring before, after, or at the same level as another: console.log(new intl.collator().compare('a', 'c')); // → a negative value console.log(new intl.collator().compare('c', 'a')); // → a positive value console.log(new intl.collator().compare('a', 'a'))...
Number.prototype.toLocaleString() - JavaScript
orted in all browsers yet. ...
...umber = 0; try { number.tolocalestring('i'); } catch (e) { return e.name === 'rangeerror'; } return false; } prior to es5.1, implementations were not required to throw a range error exception if tolocalestring is called with arguments. a check that works in all hosts, including those supporting ecma-262 prior to ed 5.1, is to test for the features specified in ecma-402 that are required to support regional options for number.prototype.tolocalestring directly: function tolocalestringsupportsoptions() { return !!(typeof intl == 'object' && intl && typeof intl.numberformat == 'function'); } this tests for a global intl object, checks that it's not null and that it has a numberformat property that is a function. using locales this example shows some of the variations in local...
with - JavaScript
nded, as it may be the source of confusing bugs and compatibility issues. see the "ambiguity contra" paragraph in the "description" section below for details. the with statement extends the scope chain for a statement. syntax with (expression) statement expression adds the given expression to the scope chain used when evaluating the statement. the parentheses around the expression are required. statement any statement. to execute multiple statements, use a block statement ({ ... }) to group those statements. description javascript looks up an unqualified name by searching a scope chain associated with the execution context of the script or function containing that unqualified name. the 'with' statement adds the given object to the head of this scope chain during the evaluation of ...
...renceerror is thrown. using with is not recommended, and is forbidden in ecmascript 5 strict mode. the recommended alternative is to assign the object whose properties you want to access to a temporary variable. performance pro & contra pro: the with statement can help reduce file size by reducing the need to repeat a lengthy object reference without performance penalty. the scope chain change required by 'with' is not computationally expensive. use of 'with' will relieve the interpreter of parsing repeated object references. note, however, that in many cases this benefit can be achieved by using a temporary variable to store a reference to the desired object. contra: the with statement forces the specified object to be searched first for all name lookups. therefore all identifiers that aren't...
Digital audio concepts - Web media technologies
los...
...anything outside the range of human hearing (or possibly even more, depending on how willing the algorithm is willing to risk losing detail at the high and/or low end of the frequency band. that means that the codec can discard audio whose frequency is lower than about 20 hz or higher than about 20,000 hz (20 khz). this narrows the audio bandwidth of the sound, thereby reducing the amoung of data required to represent the signal in its compressed form. the audio bandwidth can't be reduced nearly as much as for a speech-only codec, but it is still a helpful start. some people can hear outside this range to some extent. more often, people's ability to hear higher frequencies is rather lower than this; in particular, it's worth noting that by middle age, the high end of that frequency range usually ...
The "codecs" parameter in common media types - Web media technologies
lash character (/), then the container format used to contain the media: audio/mpeg an audio file using the mpeg file type, such as an mp3. video/ogg a video file using the ogg file type. video/mp4 a video file using the mpeg-4 file type. video/quicktime a video file in apple's quicktime format. as noted elsewhere, this format was once commonly used on the web but no longer is, since it required a plugin to use. however, each of these mime types is vague. all of these file types support a variety of codecs, and those codecs may have any number of profiles, levels, and other configuration factors. for this reason, you can add the codecs parameter to the media type. to do so, append a semicolon (;) followed by codecs= and then the string describing the format of the contents of the file...
...ormat binding, in the section codecs parameter string. the audio codec continues to be indicated as either vorbis or opus. in this format, the codecs parameter's value begins with a four-character code identifying the codec being used in the container, which is then followed by a series of period (.) separated two-digit values. cccc.pp.ll.dd.cc[.cp[.tc[.mc[.ff]]]] the first five components are required; everything from cp (color primaries) onward is optional; you can stop including components at any point from then onward. each of these components is described in the following table. following the table are some examples. webm codecs parameter components component details cccc a four-character code indicating which indicates which of the possible codecs is bei...
The building blocks of responsive design - Progressive web apps (PWAs)
: 40%; float: left; height: 100%; overflow: auto; padding: 2rem; } so we're giving the first two columns a width of 30%, and the third a width of 40%, floating the columns all left. this way they end up side-by-side, and their proportions remain the same as the browser window size varies. this is just a simple grid example, but you can apply this principle to more complex grid layouts as required. border-box sizing the padding does not affect the overall width and height of the containers because we have set the box-sizing of all elements to border-box: *, *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } this basically means that width and height will now set the dimensions of an element all the way up to and including th...
... x-card:nth-child(1) video, x-card:nth-child(2) img, x-card:nth-child(3) { margin-top: 17.5vw; } x-card:nth-child(1) button, x-card:nth-child(2) button { position: absolute; bottom: 0; } x-card:nth-child(2) button:nth-of-type(2) { bottom: 5.9rem; } x-card:nth-child(1) button { font-size: 7vw; } x-card:nth-child(2) button { font-s...
SVG Conditional Processing Attributes - SVG: Scalable Vector Graphics
the svg conditional processing attributes are all the attributes that can be specified on some svg elements to control whether or not the element on which it appears should be rendered. externalresourcesrequired requiredextensions requiredfeatures systemlanguage attributes externalresourcesrequired deprecated since svg 2 if set to true, it indicates that the browser must wait for all the external resources necessary to render that element to be loaded before processing the associated element. ...
... which it appears should be rendered. externalresourcesrequired requiredextensions requiredfeatures systemlanguage attributes externalresourcesrequired deprecated since svg 2 if set to true, it indicates that the browser must wait for all the external resources necessary to render that element to be loaded before processing the associated element. value: false|true; animatable: no requiredextensions list all the browser specific capabilities that must be supported by the borwser to be allowed to render the associated element. value: a list of space-separated uri; animatable: no requiredfeatures deprecated since svg 2 list all the features, as defined is the svg 1.1 specification, that must be supported by the borwser to be allowed to render the associated element.. value: a li...
<circle> - SVG: Scalable Vector Graphics
Web › SVG › Element › circle
he circle's circumference, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2, cx, cy, and r are geometry properties, meaning those attributes can also be used as css properties for that element. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification ...
<ellipse> - SVG: Scalable Vector Graphics
Web › SVG › Element › ellipse
al length for the path, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2 cx, cy, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification ...
<foreignObject> - SVG: Scalable Vector Graphics
of the foreignobject. value type: <length>|<percentage> ; default value: 0; animatable: yes note: starting with svg2, x, y, width, and height are geometry properties, meaning those attributes can also be used as css properties for that element. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesnonepermitted contentany elements or character data specifications specification status comment scalable vector graphics (svg) 2the definition of '<foreignobject>' in that...
<g> - SVG: Scalable Vector Graphics
Web › SVG › Element › g
using g to inherit presentation attributes --> <g fill="white" stroke="green" stroke-width="5"> <circle cx="40" cy="40" r="25" /> <circle cx="60" cy="60" r="25" /> </g> </svg> attributes this element only includes global attributes global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, graphical event attributes presentation attributes most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterl...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <al...
<line> - SVG: Scalable Vector Graphics
Web › SVG › Element › line
s the y-axis coordinate of the line ending point. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes pathlength defines the total path length in user units. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification ...
<marker> - SVG: Scalable Vector Graphics
Web › SVG › Element › marker
rker. value type: top|center|bottom|<coordinate> ; default value: 0; animatable: yes viewbox this attribute defines the bound of the svg viewport for the current svg fragment. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippat...
<path> - SVG: Scalable Vector Graphics
Web › SVG › Element › path
te defines the shape of the path. value type: <string> ; default value: ''; animatable: yes pathlength this attribute lets authors specify the total length for the path, in user units. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesgraphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment ...
<polygon> - SVG: Scalable Vector Graphics
Web › SVG › Element › polygon
ttp://www.w3.org/2000/svg"> <!-- example of a polygon with the default fill --> <polygon points="0,100 50,25 50,75 100,0" /> <!-- example of the same polygon shape with stroke and no fill --> <polygon points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polygon. value type: <number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. value type: <number> ; default value: none; animatable: yes global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions,...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification ...
<polyline> - SVG: Scalable Vector Graphics
Web › SVG › Element › polyline
//www.w3.org/2000/svg"> <!-- example of a polyline with the default fill --> <polyline points="0,100 50,25 50,75 100,0" /> <!-- example of the same polyline shape with stroke and no fill --> <polyline points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polyline value type: <number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. value type: <number> ; default value: none; animatable: yes global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions,...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification ...
<rect> - SVG: Scalable Vector Graphics
Web › SVG › Element › rect
erimeter, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2, x, y, width, height, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification ...
<switch> - SVG: Scalable Vector Graphics
Web › SVG › Element › switch
other direct children will be bypassed and therefore not rendered. if a child element is a container element, like <g>, then its subtree is also processed/rendered or bypassed/not rendered. the display and visibility properties have no effect on <switch> element processing. in particular, setting display:none on a child has no effect on the true/false testing for <switch> processing. ...
... svg <switch> example this example demonstrates showing different text content depending on the browser's language settings. the switch element will display the first of its child elements whose systemlanguage attribute matches the user's language, or the fallback element with no systemlanguage attribute if none ...
<text> - SVG: Scalable Vector Graphics
Web › SVG › Element › text
ng; animatable: yes textlength a width that the text should be scaled to fit. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesgraphics element, text content elementpermitted contentcharacter data and any number of the following elements, in any order:animation elementsdescriptive elementstext content elements<a> specificatio...
<textPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › textPath
ing of the path. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes textlength the width of the space into which the text will render. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:title usage notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the following elements, in any order:descriptive elements<a>, <altglyph>...
<tspan> - SVG: Scalable Vector Graphics
Web › SVG › Element › tspan
efined by the textlength attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. ...
... aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the following elements, in any order:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <s...
Namespaces crash course - SVG: Scalable Vector Graphics
now and it will save you all sorts of headaches in the future. background it has been a long standing goal of the w3c to make it possible for different types of xml based content to be mixed together in the same xml file. for example, svg and mathml might be incorporated directly into an xhtml based scientific document. being able to mix content types like this has many advantages, but it also required a very real problem to be solved. naturally, each xml dialect defines the meaning of the markup element names described in its specification. the problem with mixing content from different xml dialects in a single xml document is that the elements defined by one dialect may have the same name as elements defined by another. for example, both xhtml and svg have a <title> element. how should the u...
...o the same xml dialect as the element). parameters such as xlink:href require the namespace name that was assigned to that prefix (http://www.w3.org/1999/xlink for xlink). hence to get the value of the xlink:href parameter of an <a> element in svg you would write: elt.getattributens('http://www.w3.org/1999/xlink', 'href'); for setting parameters that have a namespace, it is recommended (but not required) that you also include their prefix in the second parameter so that the dom can later be more easily converted back to xml (if for instance you want to send it back to the server). for example: elt.setattributens('http://www.w3.org/1999/xlink', 'xlink:href', 'otherdoc.svg'); as a final example, here's a demonstration of how you should dynamically create an <image> element using script: var svg...
Certificate Transparency - Web security
tamp sent during the handshake ocsp stapling (that is, the status_request tls extension) and providing a signedcertificatetimestamplist with one or more scts with the x.509 certificate extension, the included scts are decided by the issuing ca. there should be no need for web servers to be modified if this mechanism is used. ...
... apple requires a varying number of scts in order for safari and other servers to trust server certificates. firefox does not currently check or require the use of ct logs for sites that users visit. ...
<xsl:stylesheet> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:stylesheet> element (or the equivalent <xsl:transform> element) is the outermost element of a stylesheet. namespace declaration a pseudo-attribute required to identify the document as an xslt stylesheet. typically this is xmlns:xsl="http://www.w3.org/1999/xsl/transform". syntax <xsl:stylesheet version="number" xmlns:xsl="http://www.w3.org/1999/xsl/transform" id="name" extension-element-prefixes="list-of-names" exclude-result-prefixes="list-of-names"> entire stylesheet </xsl:stylesheet> required attributes version specifies the version of xslt required by this stylesheet. optional attributes exclude-result-prefixes specifies any namespace used in this document that should ...
... element so the same results are produced whether the source documents have been validated against a schema or not. use-when determines whether the element and all the nodes that have it as ancestor are excluded from the stylesheet. xpath-default-namespace specifies the namespace that will be used if the element name is unprefixed or an unprefixed type name within an xpath expression. type required outermost element of stylesheet. specifications specification status comment xslt 3.0the definition of '<xsl:stylesheet>' in that specification. recommendation added the attributes default-mode, expand-text, and use-when. xslt 2.0 added the attributes xpath-default-namespace, default-validation, default-collation, and input-type-annotations and ...
Private Properties - Archive of obsolete content
looks at how ordinary objects can be used as hash maps, by creating a simple image cache: let images = {}; function getimage(name) { let image = images[name]; if (!image) { image = loadimage(name); images[name] = image; } return image; } now suppose there's a need to associate a thumbnail with each image. moreover, to create each thumbnail only when it's first required: function getthumbnail(image) { let thumbnail = image._thumbnail; if (!thumbnail) { thumbnail = createthumbnail(image); image._thumbnail = thumbnail; } return thumbnail; } this approach is straightforward, but relies on the use of prefixes. a better approach would be to store thumbnails in their own, separate hash map: let thumbnails = {}; function getthumbnai...
XUL Migration Guide - Archive of obsolete content
ed to respect this distinction. the main reason for this design is security: it reduces the risk that a malicious web page will be able to access privileged apis. there's much more information on content scripts in the working with content scripts guide. using the supported apis the sdk provides a set of high level apis providing some basic user interface components and functionality commonly required by add-ons. because we expect to keep these apis compatible as new versions of firefox are released, we call them the "supported" apis. see the tutorials and the high-level api reference. if the supported apis do what you need, they're the best option: you get the benefits of compatibility across firefox releases and of the sdk's security model. apis like ui and panel are very generic and with ...
hotkeys - Archive of obsolete content
to clash with some other add-on, so consider making the combination you choose user-configurable. globals constructors hotkey(options) creates a hotkey whose onpress listener method is invoked when key combination defined by hotkey is pressed. if more than one hotkey is created for the same key combination, the listener is executed only on the last one created. parameters options : object required options: name type combo string any function key: "f1, f2, ..., f24" or key combination in the format of 'modifier-key': "accel-s" "meta-shift-i" "control-alt-d" all hotkeys require at least one modifier as well as the key. these are the possible modifiers you can supply: shift: the shift key. alt: the alt key. on the macintosh, ...
page-mod - Archive of obsolete content
e-mods will not attach content scripts to documents loaded into private windows, even if their urls match the pattern you have specified. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. globals constructors pagemod(options) creates a page-mod. parameters options : object required options: name: include type: string, regexp, or array of (string or regexp) a match pattern string or an array of match pattern strings. these define the documents to which the page-mod applies. at least one match pattern must be supplied. you can specify a url exactly: var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "http://www.iana.org/domains/example/", conte...
tabs - Archive of obsolete content
newwindow: true }); // open a new tab on active window in the background. tabs.open({ url: "http://www.mysite.com", inbackground: true }); // open a new tab as an app tab and do something once it's open. tabs.open({ url: "http://www.mysite.com", ispinned: true, onopen: function onopen(tab) { // do stuff like listen for content // loading. } }); parameters options : object required options: name type url string string url to be opened in the new tab. this is a required property. optional options: name type isprivate boolean boolean which will determine whether the new tab should be private or not. if your add-on does not support private browsing this will have no effect. see the p...
widget - Archive of obsolete content
nction(message) {' + ' alert("got message: " + message);' + '});' + 'self.postmessage("ready");', onmessage: function(message) { if (message == "ready") widget.postmessage("me too"); } }); globals constructors widget(options) creates a new widget. the widget is immediately added to the add-on bar. parameters options : object required options: name type label string a string description of the widget used 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:...
windows - Archive of obsolete content
was opened: var windows = require("sdk/windows").browserwindows; var example = windows.open("http://www.example.com"); require("sdk/ui/button/action").actionbutton({ id: "read", label: "read", icon: "./read.png", onclick: function() { example.close(); } }); this example uses the action button api, which is only available from firefox 29 onwards. parameters options : object required options: name type url string string url to be opened in the new window. this is a required property. isprivate boolean boolean which will determine whether the new window should be private or not. if your add-on does not support private browsing this will have no effect. see the private-browsing documentation for more information.
content/worker - Archive of obsolete content
ntent scripts and the add-on code to exchange messages using the port or postmessage apis. the worker is similar to the web worker interface defined by the w3c. but unlike "web workers," these workers run in the same process as web content and browser chrome, so code within workers can block the ui. globals constructors worker(options) creates a content worker. parameters options : object required options: name type window object the content window to create javascript sandbox for communication with. optional options: name type contentscriptfile string,array the local file urls of content scripts to load. content scripts specified by this option are loaded before those specified by the contentscr...
core/heritage - Archive of obsolete content
ceof behavior you need to make a dance with // another special `constructor` property of the `prototype` object. object.defineproperty(pet.prototype, 'constructor', { value: pet }); // finally you can define some properties. pet.prototype.call = function(name) { return this.name === name ? this.bark() : ''; }; since sdk apis may be interacting with untrusted code an extra security measures are required to guarantee that documented behavior can't be changed at runtime. to do that we need to freeze constructor's prototype chain to make sure functions are frozen: object.freeze(dog.prototype); object.freeze(pet.prototype); note: also, this is not quite enough as object.prototype stays mutable & in fact we do little bit more in sdk to address that, but it's not in the scope of this documentation. ...
event/target - Archive of obsolete content
events. this module provides an exemplar eventtarget object, that implements an interface for adding and removing event listeners of a specific type. eventtarget is the base class for all objects in sdk on which events are emitted. also see the tutorial on implementing event targets to get started with this api. instantiation it's easy to create event target objects, no special arguments are required. const { eventtarget } = require("sdk/event/target"); let target = eventtarget(); for a convenience though optional options arguments may be used, in which case all the function properties with keys like: onmessage, onmyevent... will be auto registered for associated 'message', 'myevent' events on the created instance. all other properties of options will be ignored. adding listeners eventtar...
frame/hidden-frame - Archive of obsolete content
nt.contentwindow.location = "http://www.mozilla.org/"; let self = this; this.element.addeventlistener("domcontentloaded", function() { console.log(self.element.contentdocument.title); }, true, true); } })); see the panel module for a real-world example of usage of this module. globals constructors hiddenframe(options) creates a hidden frame. parameters options : object required options: name type onready function,array functions to call when the frame is ready to load content. you must specify an onready callback and refrain from using the hidden frame until the callback gets called, because hidden frames are not always ready to load content the moment they are added. functions add(hiddenframe) register a hidden fra...
preferences/event-target - Archive of obsolete content
the system-wide settings. these are the same preferences that are exposed to users in the about:config page. preferences/service gives you full access to the preferences system. you can also use the simple-prefs module to access just the preferences for your own add-on and expose them to the user in the add-on manager. globals constructor prefstarget(options) parameters options : object required options: name type branchname string by default this is "", the root. example var { prefstarget } = require("sdk/preferences/event-target"); // listen to the same branch which reqire("sdk/simple-prefs") does var target = prefstarget({ branchname: "extensions." + require("sdk/self").preferencesbranch + "." }); target.once("test", function(pre...
stylesheet/style - Archive of obsolete content
ructor creates an object that represents style modifications via stylesheet file(s) or/and css rules. stylesheet file url(s) are verified to be local to an add-on, while css rules are verified to be a string or array of strings. the style created can be applied to a content by calling attach, and removed using detach. those functions are part of content/mod module. parameters options : object required options: name type uri string,array a string, or an array of strings, that represents local uri to stylesheet. source string,array a string, or an array of strings, that contains css rules. those rules are applied after the rules in the stylesheet specified with uri options, if provided. optional options: name ...
ui/button/action - Archive of obsolete content
tate("tab").label; to learn more about this, see the api documentation for state(). destroying buttons when you've finished with a button, destroy it by calling its destroy() method. after that, any attempts to access any of its properties or to call any of its methods will throw exceptions. globals constructors actionbutton(options) creates an action button. parameters options : object required options: name type id string the button's id. this is used internally to keep track of this button. the id must be unique within your add-on. label string the button's human-readable label. when the button is in the toolbar, this appears in a tooltip, and when the button is in the menu, it appears underneath the button as a legend.
ui/button/toggle - Archive of obsolete content
{ checked } = this.state('tab'); this.state('tab', {checked: !checked}); } }); destroying buttons when you've finished with a button, destroy it by calling its destroy() method. after that, any attempts to access any of its properties or to call any of its methods will throw exceptions. globals constructors togglebutton(options) creates a toggle button. parameters options : object required options: name type id string the button's id. this is used internally to keep track of this button. the id must be unique within your add-on. label string the button's human-readable label. when the button is in the toolbar, this appears in a tooltip, and when the button is in the menu, it appears underneath the button as a legend.
ui/frame - Archive of obsolete content
} } globals constructors frame(options) creates an frame. once created, the frame needs to be added to a toolbar for it to be visible: var { frame } = require("sdk/ui/frame"); var { toolbar } = require("sdk/ui/toolbar"); var frame = new frame({ url: "./frame.html" }); var toolbar = toolbar({ name: "my-toolbar", title: "my toolbar", items: [frame] }); parameters options : object required options: name type url url, string a url pointing to the html file specifying the frame's content. the file must be bundled with the add-on under its "data" directory. you can specify the url in one of two ways: as a resource:// url pointing at a file under your add-on's "data" directory, typically constructed using self.data.url(filename) ...
ui/sidebar - Archive of obsolete content
this will be used for the label for your sidebar in the "sidebar" submenu in firefox, and will be shown at the top of your sidebar when it is open. url string the url of the content to load in the sidebar. this must be a local url (typically, loaded from the "data" folder usi...
ui/toolbar - Archive of obsolete content
this appears as the name of the toolbar in the firefox "toolbars" menu. it must be unique. optional options: name type items array adding buttons to toolbars is only supported from firefox 30 onwards. in firefox 29, you can only add frames. ...
jpm - Archive of obsolete content
and watchpost for more information. -v --verbose verbose operation: jpm watchpost --post-url http://localhost:8888/ -v jpm sign this feature is only supported from jpm 1.0.4 onwards. this command retrieves a new xpi for your add-on signed by mozilla. this allows you to self-host your add-on so that users can install it without error when signed add-ons are required. you can sign an xpi you've already generated by passing the xpi file in the --xpi argument, like this: jpm sign --api-key ${jwt_issuer} --api-secret ${jwt_secret} --xpi <xpi file> alternatively, you can omit the --xpi argument, in which case jpm sign will generate an xpi from the current directory (or --addon-dir). jpm sign --api-key ${jwt_issuer} --api-secret ${jwt_secret} this submits an ...
Tools - Archive of obsolete content
...
Getting Started (jpm) - Archive of obsolete content
vigate to the "@my-addon.xpi" file, open it and follow the prompts to install the add-on. note that firefox by default requires add-ons, even locally developed ones, to be signed. after installation they'll show up disabled in the list of installed add-ons, noting the missing signature. during development, or if you don't plan to distribute, you can open about:config and set xpinstall.signatures.required to false to run it unsigned. this setting applies to any add-on, so take extra care to not accidently install a malicious one from elsewhere. to distribute your add-on, submit the xpi file to addons.mozilla.org or run jpm sign if you wish to distribute the add-on on your own server. summary in this tutorial we've built and packaged an add-on using three commands: jpm init to initialize an e...
Localization - Archive of obsolete content
import the l10n module, and assign its get function to "_" (underscore). wrap all references to localizable strings with the _() function. if you run it you'll see the expected output for the current locale: info: hello! info: bonjour ! note...
Bootstrapped extensions - Archive of obsolete content
u can get access to the menu bar in firefox with document.getelementbyid("main-menubar"). be sure that at shutdown time, you remove any user interface you've added. creating a bootstrapped extension to mark an extension as bootstrappable, you need to add the following element to its install manifest: <em:bootstrap>true</em:bootstrap> then you need to add a bootstrap.js file that contains the required functions; this should be alongside the install.rdf file in the extension's package. backward compatibility because older versions of firefox don't know about the bootstrap property or bootstrap.js file, it's not overly difficult to create an xpi that will work on both as a bootstrappable extension and as a traditional extension. create your extension as a bootstrappable extension, then add the...
Customizing the download progress bar - Archive of obsolete content
oads-overlay.xul, reference the new stylesheet: <?xml version="1.0"?> <?xml-stylesheet href="chrome://myextension/skin/myextension.css" type="text/css"?> <overlay id="mydownloadoverlay" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> </overlay> in jar.mn, make sure that there is an asterisk in front of the entry for myextension.css so that it will be preprocessed. this is required since it contains platform-specific directives, as we will see. the myextension.css file will look something like this: richlistitem progressmeter { %ifdef xp_win min-height: 17px !important; %else %ifdef xp_macosx -moz-appearance: none !important; background-image: url(chrome://myextension/skin/progress_bg_osx.png) !important; %endif %endif } richlistitem .progress-bar { %if...
Preferences - Archive of obsolete content
ling display properties in xul components). this technique will work no matter how or where the preferences are changed: in another browser window, directly in the about:config interface, or even by another extension. note: during gecko 13 development, nsiprefbranch2 was deprecated, and its methods moved to nsiprefbranch. calling .queryinterface(components.interfaces.nsiprefbranch2) is no longer required, although it still works. here is a straightforward example: var myprefobserver = { register: function() { // first we'll need the preference services to look for preferences. var prefservice = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice); // for this.branch we ask for the preferences fo...
View Source for XUL Applications - Archive of obsolete content
irectly is the viewsource method. the rest of those methods should be considered private, and might become inaccessible in the future. void viewsource(aobject); methods viewsource opens a viewer to the source code for some document or uri. parameters the viewsource method takes an object as its first and only parameter. the object can include the following properties: url (required) a string url for the document to view the source of. browser (optional) the browser containing the document that we would like to view the source of. this is optional if outerwindowid is not passed. outerwindowid (optional) the outerwindowid of the content window containing the document that we want to view the source of. pass this if you want to attempt to load the document source out of t...
Extension Packaging - Archive of obsolete content
l application integration points as an extension, even if the application is not yet installed. this can be accomplished on windows using the registry. multi-item extension xpis in some cases, a single xpi file may wish to install multiple extensions/themes. a special kind of extension xpi, called the multiple item package, explains how to create this kind of package. (firefox 1.5/xulrunner 1.8 required.) from the release of firefox 53, multiple item extension packages are no longer supported and will not load. as a consequence, these packages are no longer accepted by amo. official references for toolkit api structure of an installable bundle: describes the common structure of installable bundles, including extensions, themes, and xulrunner applications extension packaging: specific...
Installing Extensions and Themes From Web Pages - Archive of obsolete content
ce you've effectively invoked two install requests, one from the installtrigger, one from trying to load the xpi file directly. available parameters for the install object the 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 displayed in the installation dialog. this property is optional. if you do not specify an icon, the default icon will be used, usually a green puzzle piece. the icon can be any image format 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 ...
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
extension code using internal linkage will need to migrate to use frozen linkage because internal linkage will not be available in firefox 3. this document is a guide to common code patterns that may need to change to work with frozen linkage. strings the most obvious change required by frozen linkage is using the frozen string api. - #include "nsastring.h"- #include "nsstring.h"- #include "nsreadableutils.h"- #include "nsescape.h" + #include "nsstringapi.h" on windows, if you see the following error, you are including a header you shouldn't be: nsstringfwd.h(60) : fatal error c1001: internal compiler error to debug this error, make in the failing directory, adding the /showincludes directive to figure out what is being included incorrectly: make -c directory/that/failed os_cppflags=-showinclud...
Multiple item extension packaging - Archive of obsolete content
l manifest to determine if this is a multiple item package and then start the installation of the individual packages it contains automatically. no other files besides the install.rdf install manifest and the files with a jar and xpi file extension will be extracted or utilized. install.rdf a multiple item package does not have the same requirements as an extension for its install.rdf. the only required properties are em:id, em:targetapplication, and em:type. for the firefox and thunderbird 1.5 extension manager to determine that the package is a multiple item package, the em:type specified in your install.rdf must be 32 and specified as <em:type nc:parsetype="integer">32</em:type>. the xml namespace xmlns:nc="http://home.netscape.com/nc-rdf#" must also be declared in your install.rdf as shown ...
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
d xpcom. extensions are also built using these four technologies. figure 1: role of each technology in firefox in addition to these technologies, extension development will require you to learn about how to confer privileges to overcome security restrictions on code that you write, and how to embed your code into the firefox ui. these issues are discussed in chapter 5. the minimum knowledge required in the interest of brevity, i will omit explanations of widely understood technologies, and focus instead on introducing new technologies you will need to understand in order to develop for firefox. i will assume that you have experience developing with dynamic html, as well as the topics below. for more information on these technologies, please refer to other sources. xml coding css coding ...
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
the toolbox is the collection of toolbars in firefox, including the main menu bar. let's look at the attributes we used: the toolbarname is the name that will appear on the view > toolbars menulist. this menu allows hiding and showing any toolbar. the customizable attribute determines if the user can customiz...
Adding sidebars - Archive of obsolete content
d rich interfaces without requiring new windows or complicated overlays. sidebars take as much space as the user wants them to, and provide a frame where you can add elaborate data and controls. you're probably familiar with the bookmarks and history sidebars. if not, you can open either one from the view > sidebar menu. they also have shortcuts to open or close them using the keyboard. the code required to add a sidebar is very simple, as explained in creating a firefox sidebar. it's even simpler than that. all you need is to overlay the view sidebar menu. <menupopup id="viewsidebarmenu"> <menuitem id="xulschoolhello-sidebar" label="&xulschoolhello.sidebar.title;" accesskey="&xulschoolhello.sidebar.accesskey;" type="checkbox" autocheck="false" group="sidebar" sidebarurl="chr...
Appendix F: Monitoring DOM changes - Archive of obsolete content
code below contains an inefficient fallback implementation for older browsers. it is worth noting, however, that while the animation-based implementation will fire any time an element which previously did not match the given selector is changed so that it does (when a class is added, for instance), the fallback will only match nodes when they are inserted into the dom tree. minor changes are also required if one wishes to support other browsers, or to run in non-chrome-privileged scopes. /** * watches for nodes matching the given css selector to become * available. * * @param {string} selector the css selector of nodes about which you * want to be notified. * @param {function(event)} callback the function which is to be called * when matching nodes become available. * @param {docu...
Connecting to Remote Content - Archive of obsolete content
ponsexml property will hold an xmldocument object that can be manipulated using dom methods. sometimes the server doesn't specify an xml content-type header, which is necessary for the xml parsing to happen automatically. you can use overridemimetype to force the response to be parsed as xml. request.overridemimetype("text/xml"); // do this before sending the request! the open method takes two required parameters: the http request method and the url to send the request. the http request method can be "get", "post" or "put". sending a post request requires you to set the content type of the request and to pass the post data to the send() method as below. request.open("post", url, true); request.setrequestheader("content-type", "application/x-www-form-urlencoded"); request.send("data=hello&versi...
Getting Started with Firefox Extensions - Archive of obsolete content
ns too. we'll now begin with a basic "hello world" extension. let's start by installing it. click on the link below. note: this extension is unsigned. starting with firefox 43, extensions need to be signed by mozilla before they can be installed in firefox. unsigned add-ons can still be installed in developer edition, nightly, and esr versions of firefox, after toggling the xpinstall.signatures.required preference in about:config. install hello world click the above link and then click "allow" in the pop-up bubble. you should see another pop-up telling you that you are installing an unverified add-on. click "install". after the extension is installed, you'll be asked to restart firefox. installing, uninstalling, enabling and disabling add-ons require a restart to complete, with the exception o...
Handling Preferences - Archive of obsolete content
eferences system provides a simple, unified storage facility for name / value mappings. when your storage needs are more complicated than this, you'll need more advanced apis that will be discussed in a section further ahead. to add preferences to your extension you should first create a js preferences file that describes the preferences and their default values, although setting defaults is not required. as mentioned earlier, a preference with no default value can be set later on. note: we recommend that you include all of your extension preferences in the js defaults file. it makes it easier to compile a list of the preferences your extensions handle, and to document what they do. the preferences file you need to create should be defaults/preferences/yourextensionname.js, under your exten...
JavaScript Object Management - Archive of obsolete content
t any moment you want. this is an odd, but powerful feature that comes in handy at times when things get complicated. for instance, you could replace a method in any object in the firefox chrome, so that it behaves differently than how it normally does. this should be a last resort option, but it is very useful at times. you usually need only one js file to control a xul window, since the code required is normally not that much. if you 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 load...
The Essentials of an Extension - Archive of obsolete content
ntral storage mechanism for firefox, but it is now being replaced for a simpler database system. we'll discuss both of these storage systems further ahead in the tutorial. now let's look at the important parts of the file. <em:id>helloworld@xulschool.com</em:id> this is the unique identifier for the extension. firefox needs this to distinguish your extension from other extensions, so it is required that you have an id that is unique. there are two accepted standards for add-on ids. one is the email-like format in the hello world example, which should be something like <project-name>@<yourdomain>. the other standard practice is to use a generated uuid string, which is extremely unlikely to be duplicated. unix-based systems have a command line tool called uuidgen that generates uuids. there ...
Session store API - Archive of obsolete content
hed. this is something you may need to keep in mind if you rely on the behavior of the session store system. the session restore process the exact sequence of events that occurs when a session is being restored is: a session state is about to be restored. this can be on startup or in response to undo close tab, since closed tabs are restored as single-tab sessions. new windows are opened as required (one for each window that was saved in the session store), and cookies and the list of recently closed tabs are restored. after that, the following steps are taken for each tab being restored: either an existing tab is reused or a new tab is created. in the latter case, a tabopen event is sent. the tab's persistent xul attributes (those saved due to calls to persisttabattribute()) and permi...
Using Dependent Libraries In Extension Components - Archive of obsolete content
.get(), nsaddimage_option_return_on_error | nsaddimage_option_with_searching | nsaddimage_option_match_filename_by_installname); // 1) we don't care if this failed! if you update your dependencies in your component, // but forget to remove a dependant library in the stubloader, then we don't want to // fail loading the component since the dependant library isn't required. // // 2) we are going to leak this library. we don't care about that either. // nsaddimage adds the image to the process. when the process terminates, the library // will be properly unloaded. } library->setnativeleafname(ns_literal_cstring(krealcomponent)); rv = library->getnativepath(path); if (ns_failed(rv)) return rv; const mach_header * componentlib = nsaddimage(pat...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
oning? in trying to eliminate that last table i was using to set the column structure of our pages, i took a close look at both floated divs and positioned divs. i went back and forth between each one for two weeks, and finally narrowed in on positioned divs as the choice for wired news. why did you choose positioning over floats? floats had a few disadvantages from my perspective. one was the required order of content within generic markup. for wired news, the center (or main) column usually contains the most important content for each page. i wanted center column content to appear first in browsers that got the un-styled version. with floats, either the left column or the right column always had to be drawn first. for sites that rely on a left or right column for primary navigation, this cont...
CSS3 - Archive of obsolete content
, 2018 adds: the ability to tweak the box model using the css box-sizing property. at risk: due to insufficient browser support, standardization of the padding-box value may be postponed to the next iteration of this module. allow the styling of forms according their content using the css :indeterminate, :default, :valid, :invalid, :in-range, :out-of-range, :required, :optional, :read-only, and :read-write pseudo-classes and the ::value, ::choices, ::repeat-item, and ::repeat-index pseudo-elements. at risk: due to insufficient browser support, standardization of the pseudo-elements ::value, ::choices, ::repeat-item, and ::repeat-index may be postponed to the next iteration of this module . support for icons, defined by the css icon property simult...
Creating a status bar extension - Archive of obsolete content
em:name the extension's name. this name is displayed in the extensions window. em:description a short, one-line description of the extension. this text is also displayed in the extensions window. em:creator the author's name. homepageurl the url of a web site the user can visit to get information about the extension, or to look for updates. this is not a required field, but including it is a nice thing to do. target application information it's also necessary to include information that identifies the application or applications in which your extension is designed to run. although this sample extension only works in firefox, it's entirely possible to create extensions that work in multiple xul-based applications. it's also necessary to indicate what...
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
rates data request from data binding. this approach allows us to untie from the traditional navigation model. a request to a web server no longer requires a new page to be loaded, in order to update information in a page seamlessly. as a general approach, the main steps to the iframe-based implementation can be represented as follows: create a hidden iframe in the page; when a new content is required, ask for the content to the iframe; the iframe will load the content and callback a function in the main page; update the main page. of course, specific implementations may have different requirements, like the use of multiple iframe elements to make multiple requests retrieving different contents at the same time. example using iframes and javascript: stock ticker this section describes a s...
List of Mozilla-Based Applications - Archive of obsolete content
ey prism (was webrunner) single-site browser xulrunner application pro/engineer wildfire cadcam product psycrunner chat, messenger, multicast toolkit about 1,000 users – xulrunner version of psyczilla extension pyjamas-desktop a python web widget toolkit uses xulrunner dom to implement the widgets and event handling. python-hulahop is required python-hulahop a python gtk widget uses embedded xulrunner, providing full access to nsi dom and all other xulrunner interfaces, in a gtk window. it's possible to create your own python web browser with hulahop, and much much more besides. qsos xul editor tool for the qsos method qsos stands for qualification and selection of opensource software qtrax mus...
Source code directories overview - Archive of obsolete content
subdirectories a common naming scheme is used throughout the mozilla source trees. at the top level is the name of the product (e.g. seamonkey). at the second level is the name of the module (e.g. the editor directory in seamonkey). the third level is where the common naming scheme usually takes over. many third level directories contain the base, the public and the idl directories. although not required, these common names are typically used for a common purpose. if files can be grouped into submodules, they are usually put in their own third level directory and given a unique name (e.g. txmgr in the editor directory in seamonkey). beneath this third level directory, there may be fourth level base, public and idl directories. thus, the scheme is recursive; it can apply to submodules, sub-submodu...
Installing Dehydra - Archive of obsolete content
to generate preprocessed mozilla source files (*.ii), see the pork install instructions. see also dehydra_manual treehydra build instructions ...
Embedding FAQ - Archive of obsolete content
scroll down to "initalization and teardown. how to customize document retrieval one method is to implement your own protocol method. you can find more information on adding new protocols here how to embedding mozilla inside of java there hasn't been any good code examples found. however, there is a stripped down, uncommented code with eclipse libraries in this thread. ...
Block and Line Layout Cheat Sheet - Archive of obsolete content
her up the parent chain. used in nsblockreflowcontext::computecollapsedtopmargin(). this flag causes the nsblockreflowstate's constructor to set the brs_istopmarginroot and brs_isbottommarginroot flags. this is set by default for document, table cell inner, and absolutely positioned wrapper frames. ns_block_space_mgr this indicates that a block frame should create its own space manager. this is required by each block frame that can contain floaters: the space manager is used to reserve space for the floated frames. this is set by default for document frames, area frames, table cell inner frames, absolutely positioned wrapper frames, and floated frames when the frame is created. nslinebox a block consists of lines and other blocks, stacked vertically. a block frame has one nslinebox for each l...
Layout System Overview - Archive of obsolete content
layout's job: provide the presentation layout is primarily concerned with providing a presentation to an html or xml document. this presentation is typically formatted in accordance with the requirements of the css1 and css2 specifications from the w3c. presentation formatting is also required to provide compatibility with legacy browsers (microsoft internet explorer and netscape navigator 4.x). the decision about when to apply css-specified 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...
Repackaging Firefox - Archive of obsolete content
ge_welcome_url=<string> url to the first-run page. this is loaded in addition to the homepage, the very first time that firefox is run. browser.search.defaultenginename=<string> name of the default search engine. note that this does not change the order of the search engines in the drop-down, only selects the default. capitalization is significant. repackaging firefox once you have all the required pieces in place, all you need to do is launch the repackager tool and fill in the fields to set up your customized installers. the "extension" section describes your dex. click the "choose" button to select the xpi file containing your extension; the id and name fields will be filled out automatically. when repacking firefox 2.0.0.3 or lower, be sure to download the latest version of t...
Style System Overview - Archive of obsolete content
tions from the style sheets, and the css stylesheets force one cssruleprocessor per origin (rather than one per stylesheet). htmlstylesheetimpl (html attributes) and htmlcssstylesheet (style attributes) also implement nsistyleruleprocessor. the nsistyleruleprocessor interface implemented by cssruleprocessor, htmlstylesheetimpl, and htmlcssstylesheetimpl has a rulesmatching method, which is required to call nsrulewalker::forward on any rules that match the element. (we'll see what this does later.) the main argument to rulesmatching is a structure of enumeration data that implementations use to determine more quickly which rules match. has a separate rulesmatching method for pseudo-elements. cssruleprocessor one cssruleprocessor per origin (ua, user, author) css rule processor sorts ...
JavaScript Client API - Archive of obsolete content
managed and protected; (b) that your third party client will only store data in encrypted form on the firefox sync servers operated by mozilla; (c) that you and your third party client will use the firefox sync apis solely for their intended purpose; (d) that your third party client will not hide or mask its identity as it uses the services and/or firefox sync apis, including by failing to follow required identification conventions; and (e) that you and your third party client will not use the firefox sync apis for any application or service that replicates or attempts to replicate the services or firefox sync experience unless such use is non-confusing (by non-confusing, we mean that people should always know with whom they are dealing and where the information or software they are downloading ca...
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
1; u; linux i686; en-us; rv:1.5) gecko/20031016 while using the useragent to sniff the browser provides detailed information on the browser in use, code that handles useragents often can make mistakes when new browser versions arrive, thus requiring code changes. it is much better and more reliable to sniff by browser capability or object feature support. you can usually do this by testing the required functionality in javascript. for example, rather than: if (ismozilla || isie5) you would use: if (document.getelementbyid) this would allow other browsers that support that w3c standard method, such as opera or safari, to work without any changes. useragent sniffing makes sense in very limited cases where you really do want to know the exact browser in use, such as when you need to work a...
Nanojit - Archive of obsolete content
ret twoplustwo this adds two and two in the most hardcoded way possible. the conversion from lir to a program like one shown above is the task of the parser. guards guards are special lir instructions, similar to conditional branches, with the difference that when they are called, instead of going to a particular address, they leave the jit code entirely, and stop the trace. need guards are required in a cross platform dynamic language like javascript. certain assumptions are made when a particular jit code is generated. for example, in an instruction inr x, a guard would check that x doesn't overflow the range for a 32 bit integer. the jit code would have a guard checking this condition(an xt guard), and would return to the interpreter if the condition turns out to be true. the interpreter...
Plug-n-Hack - Archive of obsolete content
configuring a browser to work with a security tool can be a non-trivial process, and this can discourage people with less experience from using such tools. ...
Build - Archive of obsolete content
grab the latest release source code from mozilla's ftp site. extract the source code, and you should have a directory called mozilla/. ...
Priority Content - Archive of obsolete content
permission to use any of his materials in devedge in the devmo wiki under the cc:by-sa license (yay!) started: browser feature detection original: browser feature detection wiki location: browser feature detection migrators: serge k. keller mostly completed*: rich-text editing in mozilla 1.3 "mostly completed" means i'm waiting for a location to store example and source files which are required for demoing the information in the articles. original: rich-text editing in mozilla 1.3 wiki location: rich-text editing in mozilla i dropped the 1.3, as the article still applies and shouldn't sound outdated. migrators: joel coreson note: the article links some external example files, not sure how to migrate them (perhaps via "upload file" function that's normally used for images?) also ch...
New Skin Notes - Archive of obsolete content
devmo has a new skin that is ready for testing. if you go to your user preferences, you can change the skin to "devmo". this is currently just a preview, but we would appreciate help with testing. please add any feedback to this page. thanks! feedback fix weird width bug on preferences page. --dria css classes for feature and subfeature boxes, including required graphics. -- dria when will these fixes be on the live site? --nickolay 10:38, 31 aug 2005 (pdt) existing fixes should be on test/docs/ now. --dria stuff that's been fixed note that while i've made these fixes, they haven't necessarily been checked in yet. edit page textarea needs to 'scale' better with page width (so large whitespace area's are non-existant), suggest min-width:some-em-size; width: 88%; and max-widt...
Remotely debugging Firefox for Metro - Archive of obsolete content
irefox on the desktop. prerequisites you will need: windows 8 (metro-style) firefox running in the touch-friendly "metro" mode on a windows 8 computer. firefox running in classic "desktop" mode on windows, mac os x, or linux, either on a separate computer or in a separate profile on the same computer. ...
Frequently Asked Questions - Archive of obsolete content
grey area at the top of the source with the text "this xml file does not appear to have any style information associated with it" then the problem 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 displayed 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 stor...
Space Manager Detailed Design - Archive of obsolete content
pace. the client provides a vertical offset, the yoffset, that corresponds to the band that is of interest. this will be the y offset of the frame that is being reflowed. the caller also provides a collection of banddata objects (an array) and the number of items that the collection can handle. if the collection is too small, then an error is returned and the count is updated to indicate the size required. the algorithm to provide the band data is as follows: get a vertical offset in world coordinates (instead of frame-relative coordinates) by adding the y-origin of the spacemanager to the y offset passed in if the (adjusted) y value passed in is greater than the greatest band being managed, then all space is available so a single trapezoid is returned,marked as available and sized to the maxim...
Abc Assembler Tests - Archive of obsolete content
h case the provisions of the gpl or the lgpl are applicable instead * of those above. if you wish to allow use of your version of this file only * under the terms of either the gpl or the lgpl, and not to allow others to * use your version of this file under the terms of the mpl, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the gpl or the lgpl. if you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the mpl, the gpl or the lgpl. * * ***** end license block ***** */ function main() { getlocal0 pushscope findproperty start pushstring "instructions that start with the letter l" callpropvoid start 1 newfunction .function_i...
Tamarin Acceptance Test Template - Archive of obsolete content
h case the provisions of the gpl or the lgpl are applicable instead * of those above. if you wish to allow use of your version of this file only * under the terms of either the gpl or the lgpl, and not to allow others to * use your version of this file under the terms of the mpl, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the gpl or the lgpl. if you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the mpl, the gpl or the lgpl. * * ***** end license block ***** */ var section = "test"; // provide a document reference (ie, actionscript section) var version = "as3"; // version of ecmascript or actionscript var title = "test"; ...
Actionscript Acceptance Tests - Archive of obsolete content
ated. the name is case-sensitive. e.g: given a test named inheritclass.as, the user can create a directory named inheritclass and place files a.as and b.as in that directory. when the harness compiles the inheritclass.as test, the files in inheritclass will be included: java -jar asc.jar -import builtin.abc -in shell.as -in inheritclass/a.as -in inheritclass/b.as inheritclass.as additional files required by a test: if a test requires additional files to run, but are not to be included when compiling, a testname_support directory can be created. the directory name should not include any testname extensions. any .as files in this directory will be compiled, but will not be run by the harness. note that if you have .as files in the _support dir, they will be compiled as if they are regular tests. ...
Running Tamarin performance tests - Archive of obsolete content
o compile.py. --vmversion specify vmversion e.g. ...
Tamarin Acceptance Testing - Archive of obsolete content
in order to ensure that changes to the tamarin code base are high quality before submitting, all developers are required to complete the following steps. successfully build release and debug versions of the shell with the debugger enabled [info] successfully run the following test suites: acceptance test suite [info] self tests [info] submit a sandbox build request to test against platforms that you may not have locally [info] available tamarin acceptance test suites actionscript acceptance tests: actionscript acceptance tests running tamarin acceptance tests abc assembler tests cmdline tests performance tests actionscript performance tests running tamarin performance tests built-in self tests ...
URIs and URLs - Archive of obsolete content
is stored in a matrix. also a string should not be escaped more than once. necko will not escape an already escaped character unless forced by a special mask that can be used if it is known that a string is not escaped. parsing urls rfc 2396 defines an url parser that can deal with the syntax that is common to most url schemes that are currently in existence. sometimes scheme specific parsing is required. also to be somewhat tolerant to syntax errors the parser has to know more about the specific syntax of the urls for that scheme. to stay almost generic necko contains three parsers for the main classes of standard urls. which one has to be used is defined by the implementation of nsiprotocolhandler for the scheme in question. the three main classes are: authority the urls have an author...
Mac stub installer - Archive of obsolete content
t>.jst install script template file (the jst extension stands for javascript template indicating this is a template for the final install.js for the <component>.xpi. checkin the <component>.jst to the: <http://lxr.mozilla.org/seamonkey/sou.../packager/mac/> directory. note that there are two macro strings in the .jsts: $version$ which is replaced at packages time with the browser version. $spacerequired$ which is replaced at package time with the amount of space in kb required for the package when it is fully extracted. add a [componentx] section to the config.ini template file named config.ini_tmpl found at: <http://lxr.mozilla.org/seamonkey/sou...onfig.ini_tmpl>. then add the componentx into the appropriate setup types so the installer module installs when users select the setup types you ch...
Unix stub installer - Archive of obsolete content
t>.jst install script template file (the jst extension stands for javascript template indicating this is a template for the final install.js for the <component>.xpi. checkin the <component>.jst to the: <http://lxr.mozilla.org/seamonkey/sou.../packager/unix> directory. note that there are two macro strings in the .jsts: $version$ which is replaced at packages time with the browser version. $spacerequired$ which is replaced at package time with the amount of space in kb required for the package when it is fully extracted. add a [componentx] section to the config.ini template file named config.it found at: <http://lxr.mozilla.org/seamonkey/sou...unix/config.it>. then add the componentx into the appropriate setup types so the installer module installs it when users select the setup types you choos...
Windows stub installer - Archive of obsolete content
template indicating this is a template for the final install.js for the <component>.xpi. checkin the <component>.jst to the: <http://lxr.mozilla.org/seamonkey/sou...ckager/windows> directory. note that there are several macro strings--a macro name wrapped in dollar ($) signs--which may be used in the .jsts, including: $version$ which is replaced at packages time with the browser version. $spacerequired$ which is replaced at package time with the amount of space in kb required for the package when it is fully extracted. other macro strings listed in makejs.pl can be found by searching for "version", which is one of the macro strings, until you find the line $line =~ s/\$version\$/$inversion/i; other macro strings are grouped in this section. as with "version", the macro name will be the fi...
Using XPInstall to Install Plugins - Archive of obsolete content
's desktop. in particular, like many ocx files (activex controls) it installs to a special directory within c:\winnt\system32\, called c:\winnt\system32\myplugin. xpinstall is able to determine what directory this is by the getfolder api call. we have written our own javascript function to contain all the secondary installation code -- function createsecondaryinstall() and finally, it writes the required registry keys to windows. this is done via the created function, called function registerplid(). certainly, this script is windows-centric, but it is easy to port it to any other platform. easier, perhaps, since the lengthy win32 registry manipulation need not occur on linux or mac osx. the getfolder api provides you with enough "syntactic sugar" to determine other locations on the user's comput...
File Object - Archive of obsolete content
w packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. file use the file object to manipulate local files and directories during the installation process. overview the file object has methods for analyzing the file system and preparing it (as when new directories, program shortcuts, version comparisons, or deletions are required) for newly installed software packages. the file object works in conjunction with the install object. ...
init - Archive of obsolete content
...
execute - Archive of obsolete content
esent, passes a string to the executable as command-line parameters. the following line, for example, passes the "-c" command-line parameter to the executable: err = file.execute(myfile, "-c", true); when you want to pass more than one parameter to the executable itself, however, you must format the args string in a particular way so that the parameters can be broken up and passed separately as required. in general, you should use single quotes for the args string and double quotes to delimit the command-line arguments within args. the following parsing rules apply: double quotes are treated as quotes; single quotes are ignored by the executable but legal in the execute() method. the outer quotes that frame the args string itself are stripped off when the string is passed to the executable...
registerChrome - Archive of obsolete content
t of skin and/or locale, and ensures that everything in the xpi is registered. one final option for the switch parameter is delayed_chrome, which registers the switch only after a relaunch of the browser. note that you can combine switches as in the example below. srcdir srcdir is a filespecobject representing the source destination of the installation. filespecobjects like that required by this function are created using the getfolder method on the install object. xpipath xpipath is the path within the xpi in where the contents.rdf file defining the chrome is located. for example, "locale/mylocale/aim," points to the locale/mylocale/aim subdirectory of the same xpi file in which the installation script is located. returns an integer error code. for a list of poss...
Return Codes - Archive of obsolete content
. on windows nt, you may only need to restart the application as long as you did not replace operating system files. bad_package_name -200 a problem occurred with the package name supplied to initinstall unexpected_error -201 an unrecognized error occurred. access_denied -202 the user (or the os) did not grant the required security privilege. execution_error -203 an error occurred executing the script no_install_script -204 installation script was not signed no_certificate -205 extracted file is not signed or the file (and, therefore, its certificate) could not be found. no_matching_certificate -206 extra...
equalsize - Archive of obsolete content
ualsize 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 displayed at the size required by the content or as specified by the width and height attributes or the css width and height properties. ...
Deprecated and defunct markup - Archive of obsolete content
bel> or <description> but does not wrap; like <label crop="end">; had been used in menus/toolbars) <textfield> (like <textbox>) <thumb> (<button> with deprecated <gripper>; implements sliding box in center of scrolbar) <title> (to add a caption on a <titledbox> <titledbox> (box with a frame) <titledbutton> (attempt to combine text and images before <button>) <toolbarpaletteitem> required to embed non-buttons in customisable toolbars --neil 03 march 2011 <treebody> (old/experimental and unsupported xul tags) lives on as the internal name for the ancestor <treechildren> element --neil 03 march 2011 <treecaption> (old/experimental and unsupported xul tags) <treecolgroup> (former name for <treecols> <treecolpicker> (internal use only; part of xbl for <tree>) <treefoot> ...
SQLite Templates - Archive of obsolete content
<label value="?name"/> <label value="?email"/> </hbox> </action> </template> </vbox> this template displays the results of two columns. any occurance of a question mark in the action body is replaced with the value from the query results. here, this is used two times, once to display the name and the second to display the email. the uri attribute on the hbox element is required on one element within the action body. for sqlite queries it will almost always be on the outermost node. note also that the query statement has a where clause which restricts the rows to those with an age greater or equal to 30. query parameters sometimes, you will want to adjust the query depending on certain criteria. one possibility is to simply use methods to adjust the text within the query...
Simple Query Syntax - Archive of obsolete content
bel value="rdf:http://purl.org/dc/elements/1.1/title http://www.xulplanet.com/rdf/country"/> the 'rdf:' form is really equivalent to the <binding> tag in the full syntax. the subject of the binding is the result member resource, the predicate is the string that comes after 'rdf:' and the object isn't necessary as the value is replaced directly in the attribute. as with bindings, the value is not required to match, so the data doesn't have to exist in the rdf graph. if one photo doesn't have a title, it will be replaced with an empty string. the special value 'rdf:*' means the uri of the result resource, rather than referring to a predicate. it would be equivalent to ?photo variable in this example if the full syntax was used. you can see in the example that the value 'rdf:*' is used in two places...
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
adds a customizable button to all seamonkey's toolbars. it adds a menu choice to chatzilla's menu bar (because chatzilla has no toolbar). note: for a similar tutorial that applies to seamonkey 2, firefox, thunderbird and sunbird, see: custom toolbar button earlier versions and other mozilla applications also support extensions, but some parts of this tutorial are not appropriate for them. required tools you will need two tools. your operating system normally provides them: a way to create and work with files and directories a text editor for plain text files character encoding some text editors have a setting for character encoding. if your language uses only plain latin (ascii) characters, set your text editor to use any encoding except unicode. if your language uses accents or othe...
Custom toolbar button - Archive of obsolete content
lphas, betas and release candidates) are also ok. in the rest of this page, the term application means the mozilla application where you want to add the button. note: there is a similar tutorial for seamonkey 1.x on the page: custom toolbar button:seamonkey earlier versions and other mozilla applications also support extensions, but some parts of this tutorial are not appropriate for them. required tools you will need two tools. your operating system normally provides them: a way to create and work with files and directories a text editor for plain text files character encoding some text editors have a setting for character encoding. if your language uses only plain latin (ascii) characters, set your text editor to use any encoding except unicode. if your language uses accents or ...
Tree Widget Changes - Archive of obsolete content
that means that the ids can be left out, although it's probably a good idea to use them anyway. instead of identifying columns by id, a new column object is used. this object implements the nsitreecolumn interface and holds information about a single column in the tree. a tree will have one of these objects for each column (each treecol element) in the tree. the columns are grouped into a list which implements the nsitreecolumns interface. ...
Creating Dialogs - Archive of obsolete content
false should be returned instead. this would be used, for example, if an invalid value was entered in a field in the dialog. amongst other useful attributes are buttonlabelaccept - label to appear on the accept button egsave buttonaccesskeyaccept - access key to use for the accept button egs defaultbutton - button is activated when the enter key is pressed note: the label attributes are required by remote sites and are probably missing in the above examples due to bug 224996. example dialog with more features <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <dialog id="mydialog" title="my dialog" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="window.sizetocontent();" buttons="accept,...
Creating an Installer - Archive of obsolete content
lled. our find files example let's try this with the find files dialog. function donefn ( name , result ){ if (result) alert("an error occured: " + result); } var xpi = new object(); xpi["find files"] = "findfile.xpi"; installtrigger.install(xpi,donefn); the xpi archive note: if you want to create a new xulrunner application, extension, or theme, see bundles. the installer xpi file is required to contain one file called install.js which is a javascript file which is executed during the installation. the remaining files are the files to be installed. these files will typically be placed inside a directory in the archive but they do not have to be. for chrome files, they might be structured like the chrome directory. often, the only files placed in an xpi archive will be the install scr...
More Event Handlers - Archive of obsolete content
nts are described. the event object every event handler is passed an event object. in the attribute form of the event handler, the event object is an implied argument to the script code which can be referred to using the name 'event'. in the addeventlistener form, the first argument passed to the listener function will be the event object. other arguments can be passed to a listener function, if required. the event object has a number of properties which can be examined during an event. for a full list, see the reference. we already saw the event's target property in the last section. it holds a reference to the element where the event occurred. a similar property currenttarget holds the element that is currently having its event listeners handled. in the example below, currenttarget is always t...
Skinning XUL Files by Hand - Archive of obsolete content
cessary. software components and users will be able to update the chrome registry and change the global skin. and with the advent of new css2 conventions like positioning, the changes you can make to the presentation and behavior of the basic structure in a xul file is dramatic. the syntax for creating all this information with text -- added to the distributed nature and the sheer volume of text required to define a single chrome -- can sometimes make the progress seem slow. but the advantages of using xul so far outweigh those of using the standard c++ toolkits that xul authoring should rightfully be considered in a separate category of development. xul represents, as one evangelist put it, the "democratization" of interface design and ofapplications development, about which we will have more to...
Tree View Details - Archive of obsolete content
nerempty and iscontaineropen that are used to handle a parent item in the tree. the iscontainer method should return true if a row is a container and might contain children. the iscontainerempty method should return true if a row is an empty container, for instance, a directory with no files in it. the iscontaineropen method is used to determine which items are opened and closed. the view is required to keep track of this. the tree will call this method to determine which containers are open and which are closed. note that the tree will call neither iscontainerempty nor iscontaineropen 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 bes...
Trees - Archive of obsolete content
Archive › Mozilla › XUL › Tutorial › Trees
placeholder for a set of treecol elements. treecol this is used to declare a column of the tree. by using this element, you can specify additional information about how the data in the columns are sorted and if the user can resize the columns. you should always place an id attribute on a column, as mozilla uses the ids to identify the columns when rearranging and hiding them. this is no longer required in mozilla 1.8 and later, but it is still a good idea to use ids on columns. treechildren this contains the main body of the tree where the individual rows of data will be displayed. example tree with two columns example 1 : source view <tree flex="1"> <treecols> <treecol id="namecolumn" label="name" flex="1"/> <treecol id="addresscolumn" label="address" flex="2"/> </treecols> ...
XUL Structure - Archive of obsolete content
files will be installed onto the user's machine. the extension will hook into the browser using a xul specific feature called an overlay which allows the xul from the extension to mesh with the xul in the browser. to the user, it may seem like the extension has modified the browser, but in reality, the code is all separate, and the extension may be easily uninstalled. registered packages are not required to use overlays, of course. if they don't, you won't be able to access them via the main browser interface, but you can still access them via the chrome url, if you know what it is. standalone xul applications may include xul code in a similar way, but, of course, the xul for the application will be included as part of the installation, instead of having to be installed separately as an extensio...
XUL element attributes - Archive of obsolete content
ualsize 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 displayed 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 container is empty. dont-...
key - Archive of obsolete content
Archive › Mozilla › XUL › key
o indiciate that a modifier key may optionally be pressed, place the word 'any' after listing the optional modifier key. for example: <key key="r" modifiers="shift any control"/> in this example, the shift key may or may not be pressed, while the control key must be pressed. this allows keys to match more loosely for modifier keys that aren't relevant, yet still allows specific modifiers to be required. if the modifiers attribute is not specified, then no modifiers may be pressed for the key to match. if neither the key or keycode attribute are used, the key element will handle all key events. however, if one of the attributes is set to an empty string, the element doesn't handle any key events. for example: <!-- this element handles all key events --> <key/> <!-- these elements don't handl...
Application Update - Archive of obsolete content
ng for incompatibilities only if there are versioninfo // updates available to installed addons that resolve them, not newer // versions. pref("app.update.incompatible.mode", 0); update server follow the instructions here to setup an update server for your xulrunner application to query. i opted for the simpler approach of not using the update php script. https is recommended but not required (yet). update.xml the format is outlined here process as best i can tell here's how the update process works. at the scheduled interval the application checks the update server for update.xml, search for the correct one using the software name, versions, build id's, channels, and other information like locales. if the update.xml file doesn't exist there is no update. update.xml contains ...
Custom app bundles for Mac OS X - Archive of obsolete content
the first sub-directory is called contents and within that directory you will place several files and folders that are needed by your applic...
Getting started with XULRunner - Archive of obsolete content
this might also be simplified using a very simple shell script (i call mine "run.sh"): #!/bin/sh /library/frameworks/xul.framework/xulrunner-bin `pwd`/application.ini linux on ubuntu, you can run the application from a terminal. first change into the \myapp folder, then start the application by: xulrunner application.
XULRunner Hall of Fame - Archive of obsolete content
asy way to experiment with xul" xulexplorer a patched version of xul explorer to re-enable application and extension skeleton generation. foxkeh clock (for japanese page) a clock application based charactor foxkeh. pyjamas-desktop a python web widget toolkit (similar to pyqt4 and pygtk2) that uses xulrunner dom to implement the widgets and event handling. python-hulahop is required python-hulahop from the olpc sugarlabs a python gtk widget with xulrunner embedded, providing full access to nsi dom and all other xulrunner interfaces, in a gtk window. it's possible to create your own python web browser with hulahop, and much much more besides. xuljet a framework that helps to create platform independent desktop applications directly in javascript ...
application/http-index-format specification - Archive of obsolete content
le. syntax every line in the file must conform to the following generic syntax: number: data where number is at least a three digit number (note that more digits are possible in the future) and data is separated from number by a colon and a space. the syntax of data is defined by the syntax spec for every number type. if a number is encountered that a parser does not understand the parser is required to ignore that line. there is no line length limit. all lines must be terminated by a carriage return followed by a line feed. number codes 100 a human readable comment line. machine parsers should ignore this data. this data is not intended for display to the end user and is only meant as a comment to make the file format clear to a human interpreter. 101 pre formatted human readable inf...
calICalendarView - Archive of obsolete content
the current state of those nodes. it should be noted, however, that the methods and attributes implemented by a calicalendarview need not behave in any predictable fashion. for instance, when the showdate method of the the calendar-multiday-view (an implementation of this interface) will sometimes show an entire week of dates, and sometimes show only the single date passed in. this allows lack of required predictability allows calicalendarview implementations to be re-used in a variety of sitatuations. it also fueled the development, however, of the more predictable, but less flexible calidecoratedview, which usually contains an embedded calicalendarview. calendar/base/public/calicalendarview.idlscriptable please add a summary to this article. last changed in gecko ? interface code [s...
2006-10-06 - Archive of obsolete content
hence, they are looking for a mac user to test out the new features by building a mac.rdf file with all of the various .mac account properties mentioned in the document here. ...
2006-11-17 - Archive of obsolete content
sed. discussions how to translate mozilla to a language called quiché how to translate mozilla to a language called quiché. how to start a localization how to start a localization po format usage discussion on how to make l10n easier due to expansion to 100 locales. quick builds for localisers (full or partial) discussion on moz-l10n-builder, which automates many of the functions required in localization process. link is located here. going to fosdem 2007 fosdem 2007 (free and open source software developers' european meeting), february 24th - 25th. mozilla developers will be having a room, and everyone is invited. link to the event here. meetings none for this week. authors paul yanchun gu (gpaul) aditya nanda kuswanto(vipers101) ...
2006-10-20 - Archive of obsolete content
summary: mozilla.dev.quality - october 13-october 20, 2006 announcements completed rc3 testing - the key testing activities for rc3 has been completed. there are a few concerns with the software updates, and a decision is required on this before a "go" for rc3 release can be given. announced by tim on friday october 13, 2006. help required designing new home for quality.mozilla.org - talented web designers and/or artists interested in helping the design for quality.mozilla.org please read this posting. if your theme is chosen you will be placed on the hall of fame and will receive a gift from mozilla. posted by jay patel on october 18th, 2006. discussions none for this week meetings upcoming firefox test day - testing will be emphasized on ajax/web 2.0, dhtml, and plugin heavy site...
NPAnyCallbackStruct - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary note: this structure is only used on unix platforms. contains information required during embedded mode printing. syntax typedef struct { int32 type; } npanycallbackstruct; fields the data structure has the following field: type always contains np_print. description callback structures are used to pass platform-specific information. the npanycallbackstruct structure contains information required by the platformprint field of the npembedprint structure during embedded mode printing. during printing in embedded mode, the platformprint field of the npembedprint structure points to an npanycallbackstruct. this structure contains the file pointer to which the plug-in should write its postscript data. at the time ...
NPN_PostURL - Archive of obsolete content
rm data to cgi scripts using http or upload files to a remote server using ftp. you cannot use npn_posturl to specify headers (even a blank line) in a memory buffer. to do this, use npn_posturlnotify. for protocols in which the headers must be distinguished from the body, such as http, the buffer or file should contain the headers, followed by a blank line, then the body. if no custom headers are required, simply add a blank line ('\n') to the beginning of the file or buffer. npn_posturl is typically asynchronous: it returns immediately and only later handles the request. for this reason, you may find it useful to call npn_posturlnotify instead; this function notifies your plug-in upon successful or unsuccessful completion of the request. see also npn_geturl, npn_geturlnotify, npn_posturlnotify, n...
NPP_WriteReady - Archive of obsolete content
description the browser calls npp_writeready before each call to npp_write to determine whether a plug-in can receive data and how many bytes it can receive. this function allows the browser to send only as much data to the instance as it can handle at one time, making resource use more efficient for both the browser and plug-in. the npp_write function may pass a larger buffer, but the plug-in is required to consume only the amount of data returned by npp_writeready. the browser can write a smaller amount of data if desired or necessary; for example, if only 8k of data is available in a network buffer. if the plug-in is allocating memory for the entire stream at once (an as_file stream), it can return a very large number. because it is not processing streaming data, the browser can pass as much da...
NPPrintCallbackStruct - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary contains information required by the platformprint field of the npembedprint structure during embedded mode printing on unix systems. this structure is only used on unix. syntax typedef struct { int32 type; file* fp; } npprintcallbackstruct; fields the data structure has the following fields: type always contains np_print. fp pointer to the file to which the plug-in should write its postscript data. description callback structures are used to pass platform-specific information. the npprintcallbackstruct structure contains the file pointer to which the plug-in should write its postscript data. this information is required by the platformprint field of the npembedprint structure during embedded mode printing. ...
NPSetWindowCallbackStruct - Archive of obsolete content
ribute. x visual for the plug-in window or drawable. colormap standard x toolkit attribute. colormap for the plug-in window or drawable. depth standard x toolkit attribute. depth of the plug-in window or drawable. description callback structures are used to pass platform-specific information. the npsetwindowcallbackstruct object, allocated by the browser, contains information required for the ws_info field of an npwindow. the npp_setwindow() function passes a pointer to this structure to the plug-in. the structure is valid for the lifetime of the npwindow, that is, until npp_setwindow() is called again or the instance is destroyed. the type field of this structure always contains np_setwindow. the remaining fields are standard x toolkit attributes of the top-level shell window...
NP_Port - Archive of obsolete content
syntax typedef struct np_port { cgrafptr port; /* grafport */ int32 portx; /* position inside the topmost window */ int32 porty; } np_port; fields the data structure has the following fields: port standard mac os port into which the plug-in should draw. portx, porty top-left corner of the plug-in rectangle in port coordinates (taking the scroll position into account). ...
Shipping a plugin as a Toolkit bundle - Archive of obsolete content
every add-on must have a unique id. this can be in a guid form but the simpler email form is preferred now. you should aim to use a domain-name that you own and then your own unique short-name for the plugin before the @. the plugin must have a name to identify the plugin to the user in the list of add-ons. the version is fairly self-descriptive, it must be a toolkit ve...
The First Install Problem - Archive of obsolete content
ule. this is the path to the actual dll. (note that the file name must still begin with "np", just as it must when the file is loaded from the .\plugins directory.) example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] path=c:\mycompany\myapplication\netscape\npmyapp.dll "xptpath" -- string value -- absolute path to xpt module required for scripting plug-in, if applicable example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] xptpath=c:\mycompany\myapplication\netscape\npmyapp.xpt "geckoversion" -- this is the optional mention of the minimal gecko version that the browser is compatible with. example: [hkey_local_machine\software\mozillaplugins...
Syndicating content with RSS - Archive of obsolete content
icons rss (and other) feeds use a special icon. it is recommended that you too use this icon when creating the special <a> link to your feed. the icon looks like the following: you can get more icons like this from feed icons. (other sizes and colors, along with their source files, are available too.) advanced syndication techniques although this advanced technique for syndication is not required, support of this is recommended, especially for web sites and applications with high performance needs. the http protocol, one of the core technologies behind the web, provides a way of prioritizing the content type that an http client prefers to receive. this technique takes advantage by having the client prefer rss (over html or other formats). here's a simple example of it being done: accept...
Security Controls - Archive of obsolete content
nfidentiality, integrity, or availability. protection measures (otherwise known as security controls) tend to fall into two categories. first, security weaknesses in the system need to be resolved. for example, if a system has a known vulnerability that attackers could exploit, the system should be patched so that the vulnerability is removed or mitigated. second, the system should offer only the required functionality to each authorized user, so that no one can use functions that are not necessary. this principle is known as least privilege. limiting functionality and resolving security weaknesses have a common goal: give attackers as few opportunities as possible to breach a system. there are three types of security controls, as follows: management controls: the security controls that focus ...
Introduction to SSL - Archive of obsolete content
server authentication, the client encrypts the premaster secret with the server's public key. only the corresponding private key can correctly decrypt the secret, so the client has some assurance that the identity associated with the public key is in fact the server with which the client is connected. otherwise, the server cannot decrypt the premaster secret and cannot generate the symmetric keys required for the session, and the session will be terminated. in the case of client authentication, the client encrypts some random data with the client's private key-that is, it creates a digital signature. the public key in the client's certificate can correctly validate the digital signature only if the corresponding private key was used. otherwise, the server cannot validate the digital signature and...
SSL and TLS - Archive of obsolete content
y will use to authenticate each other, to transmit certificates, and to establish session keys. key-exchange algorithms like rsa and elliptic curve cryptography (ecc) govern the way the server and client determine the symmetric keys to use during an ssl session. the most common ssl cipher suites use rsa key exchange, while tls supports ecc cipher suites as well as rsa. note: longer rsa keys are required to provide security as computing capabilities increase. the recommended rsa key-length is 2048 bits. though many web servers continue to use 1024-bit keys, web servers should migrate to at least 2048 bits. for 64-bit machines, consider using stronger keys. all cas should use at least 2048-bit keys, and stronger keys (such as 3072 or 4096 bits) if possible. as pkis using rsa keys and certificates...
Common Firefox theme issues and solutions - Archive of obsolete content
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 rules. for instance use toolbar[iconsize="small"]:not ([mode="text"]). a little experimenting may be required to fully address this issue with your theme. address bar identity box is missing padlock icons for secure sites in firefox 14 and later the identity box has been significantly changed and the favicon has been replaced by an icon that indicates the website's status. in the case of secure sites the icon must be a padlock. to fix this issue, you need to copy the files chrome://browser/skin/identi...
Browser Detection and Cross Browser Support - Archive of obsolete content
features authoring content which is standards compliant is the easiest way to support the widest range of user agents and to decrease your maintenance costs. while it is not always possible to avoid vendor/version specific differences between browsers, the use of such features and the distinction between browsers based on vendor/version should be strictly limited to those areas where it is still required. limit the use of user agent string based detection server side browser detection requires the use of user agent strings. we recommend that the use of user agent string based detection be limited to server side situations and except in those circumstances where it is absolutely required such as when details of the gecko branch are required. there are legitimate reasons to use the user agent st...
CSS - Archive of obsolete content
Archive › Web › CSS
ontrast-adjust css property is a microsoft extension that gets or sets a value indicating whether to override any css properties that would have been set in high contrast mode.-ms-hyphenate-limit-charsthe -ms-hyphenate-limit-chars css property is a microsoft extension that specifies one to three values indicating the minimum number of characters in a hyphenated word. ...
Date.getVarDate() - Archive of obsolete content
return value returns a vt_date value. remarks the getvardate() method is used when javascript code interacts with com objects, activex objects, or other objects that accept and return date values in vt_date format. these include objects in visual basic and visual basic scripting edition (vbscript). the actual format of the returned value depends on regional settings. ...
Enumerator.atEnd - Archive of obsolete content
the atend method returns true if the current item is the last one in the collection, the collection is empty, or the current item is undefined. otherwise, it returns false. ...
Enumerator.item - Archive of obsolete content
the item method returns the current item. if the collection is empty or the current item is undefined, it returns undefined. ...
Enumerator.moveFirst - Archive of obsolete content
if there are no items in the collection, the current item is set to undefined. ...
Enumerator.moveNext - Archive of obsolete content
if the enumerator is at the end of the collection or the collection is empty, the current item is set to undefined. ...
Error.description - Archive of obsolete content
any instance of an error object. stringexpression optional. a string expression containing a description of the error. remarks the description property contains the error message string associated with a specific error. ...
GetObject - Archive of obsolete content
non-standard. do not use! this object is a microsoft extension and is only supported in internet explorer versions prior to ie 9 (standards mode). the getobject function returns a reference to an automation object from a file. syntax getobject([pathname] [, class]) parameters pathname full path and name of the file containing the object to retrieve. if pathname is omitted, class is required. class optional class of the object. the class argument uses the syntax appname.objectype and has these parts: appname name of the application providing the object. objectype type or class of object to create. remarks the getobject function is not supported in internet explorer 9 standards mode, internet explorer 10 standards mode, internet explorer 11 standards mode, and windows store ...
VBArray.dimensions - Archive of obsolete content
example the dimensions method provides a way to retrieve the number of dimensions in a specified vbarray. the following example consists of three parts. the first part is vbscript code to create a visual basic safe array. ...
VBArray.toArray - Archive of obsolete content
the conversion translates the multidimensional vbarray into a single dimensional javascript array. each successive dimension is appended to the end of the previous one. ...
Old Proxy API - Archive of obsolete content
fundamental traps isn't implemented and the proxy is used in a way that expects the fundamental trap to be defined, then an error is thrown. if a derived trap is implemented, then that trap's code is called whenever the corresponding behavior happens on the proxy. if the derived trap is undefined, a default implementation using the fundamental traps is used. in other words: fundamental traps are required, derived traps are optional. fundamental traps emulated javascript code handler method description object.getownpropertydescriptor(proxy, name) getownpropertydescriptor: function(name) -> propertydescriptor | undefined should return a valid property descriptor object, or undefined to indicate that no property with name exists in the emulated object. object...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
passes validation client-side, submit results to the processor if( validatecomments( name, email, message ) ) { formprocessor( name, email, message ); // update the logger with the most recent entry document.getelementbyid( "out-logger" ).innerhtml += "name: " + name + "<br/>email: " + email + "<br/>message: " + message + "<br/><br/>"; } else { ext.msg.alert( "error", "please enter the required fields" ); } } </script> <!-- processes the form contents --> <script runat="server"> function formprocessor( name, email, message ) { // perform the same validation of the data server-side if( !validatecomments( name, email, message ) ) { throw "incomplete data was submitted."; } // assemble the string var s = "name: " + name + "<br/>" + "email: " + email + "<br/>" + "message: " + mes...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
the internet. you could see the actual fish in the mythical netscape headquarters, any time of the day or night! (assuming the lights were on.) it was cool, it was funny, it was pretty amazing. it's also a weird feeling when someone asks you to work on something that has near-legendary status in your mind. it's like a scuba enthusiast getting to join jacques cousteau on a dive, even down to the required time travel. i dove right in and decided to have some fun with with the redesign, which is why i rather like the final result. to share the joy, i herein present a look into just one piece of the redesign, and how i accomplished certain effects using simple html and some css. marking up the fish in the old fish cam page, there was a table that contained the pictures and descriptions of the fish...
Building Mozilla XForms - Archive of obsolete content
irefox 3.6 any more not developed any more last release: 0.8.6 firefox 4 gecko 2.0 mercurial, repositories mozilla-central xforms schema-validation mostly works upcoming 0.8.7 release if you have your first working firefox build, you can go on with building the xforms extension. firefox 3.5 and up: get the source code if you want to build xforms for firefox up to 3.0, you already have the required source code, it's part of your cvs checkout. skip to the next section. starting with firefox 3.5, you need to do two more mercurial checkouts: cd extensions hg clone http://hg.mozilla.org/xforms hg clone http://hg.mozilla.org/schema-validation that's it, you now have everything you need to get started. configure your build: the .mozconfig file mozilla uses a file called .mozconfig in your home di...
XForms Submit Element - Archive of obsolete content
the submission element (see the spec) specified in its submission attibute. attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. single-node binding special submission - required reference to element submission. type restrictions the submit element can be bound to a node containing data of any type. actually, the submit element doesn't interact with the data in the bound node. however, the relevant model item property on the bound node has an effect on a submit. if the bound node is irrelevant, then the submit will be hidden. representations the xforms submit ele...
Mozilla XForms User Interface - Archive of obsolete content
nds to a node that has a type of xsd:date, we output the date value as plain text. an output bound to a date and also having @appearance='full' will display as a calendar. this article uses several notations. if you see fx 3.0 only, that means that the control will only be available for firefox 3.0 (gecko 1.9). there are several possible reasons for this restriction. the first is that the changes required for such controls could not be safely made to firefox 1.5 or firefox 2.0. the second is that the control is introduced in xforms 1.1 and we don't feel adding the enhancement would be prudent until the 1.1 spec is more stable. for instance, when the spec reaches 'recommendation'-level status. if you see xhtml/xul then it means the control is available when xforms is hosted in either xhtml or xul. ...
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
maximizes the organization's investment. other standards it is also important to follow other types of standards across an organization. there are numerous standards organizations that affect how and why we do what we do. for example, in the accounting arena there is fasb (financial accounting standards board) and iasb (international accounting standards board). all businesses are expected and required to follow the guidelines set forth by the fasb. when auditors evaluate an organizations financial health, they do so by following the fasb rules. focusing on the software development portion of an organization, there are numerous standards bodies that can affect development decisions. for example, if an organization is developing a web-based client, they may have to adhere to standards imposed b...
Describing microformats in JavaScript - Archive of obsolete content
ition format the microformat definition must contain the following entries: mfversion specifies the version number of the microformat api to which the definition was written. for firefox 3, this should be set to 0.8. mfobject the javascript object that implements the microformat. classname a string specifying the name of the microformat's class as referenced in html (class="classname"). required an array indicating the names of any properties that must be specified. this may be left out if all properties are optional. properties a structure describing the properties of the microformat. property specifications each property in the properties structure is specified by its name, and may include additional attributes if the property so requires. standard attributes are: plural a bo...
Archive of obsolete content
here at mdn, we try to avoid outright deleting content that might be useful to people targeting legacy platforms, operating systems, and browsers. perhaps your target audience is people that are using older hardware, for example, and can't upgrade to the latest and greatest browsers. or for "reasons," your company is required to use very old software and you need to build web content that runs on that software. or perhaps you're just curious about the history of an obsolete feature or api, and how it worked. there are many reasons older documentation can be useful. so, we've established this area into which we can archive older documentation. material in this archived content zone should not be used for building new web sites or app...
bootstrap.js - Extensions
the bootstrap.js script should contain several specific functions, which are called by the browser to manage the extension. the script gets executed in a privileged sandbox, which is cached until the extension is shut down. for more information, see bootstrapped extensions. the example below contains the required methods in vsdoc format. function startup(data, reason) { /// bootstrap data structure @see /docs/extensions/bootstrapped_extensions#bootstrap_data /// string id /// string version /// nsifile installpath /// nsiuri resourceuri /// /// reason types: /// app_startup /// addon_enable /// addon_install /// addon_upgrade /// addon_downgrade } function shutdown(data, reason) { /// bootstrap data structure @see /do...
Anatomy of a video game - Game development
experienced game programmers who are new to web development could also benefit, too. ...
Index - Game development
...
Game distribution - Game development
o prepare a game for them as such an action involves little to no modification of the game itself — usually adding a manifest file containing necessary information in a zipped package containing all the resources is enough. the chrome web store is also an attractive option — again, having a manifest file ready, zipping your game and filling in the online submission form is about all that's required. tizen is also putting a high value on supporting apps written in javascript. their store is another available option. native mobile stores when it comes to the mobile market, there's the apple app store for ios, google play for android and all the rest of the competition. native stores are already filled with established devs selling great games, so you have to be talented and lucky to get n...
Building up a basic demo with Three.js - Game development
opening it in your browser. you should now see a gray window. congratulations! geometry now our scene is properly rendering, we can start adding 3d shapes. to speed up development, three.js provides a bunch of predefined primitives, which you can use to create shapes instantly in a single line of code. there's cubes, spheres, cylinders, and more complicated shapes available. detail like drawing required vertices and faces, for a given shape, is handled by the three framework, so we can focus on higher level coding. let's start, by defining the geometry for a cube shape, adding the following just above the render() function: var boxgeometry = new three.boxgeometry(10, 10, 10); in this case, we define a simple cube that is 10 x 10 x 10 units. the geometry itself is not enough though, we also ne...
GLSL Shaders - Game development
e code example that renders a cube. to speed up the background code we will be using the three.js api. as you may remember from the basic theory article, a vertex is a point in a 3d coordinate system. vertices may, and usually do, have additional properties. the 3d coordinate system defines space and the vertices help define shapes in that space. shader types a shader is essentially a function required to draw something on the screen. shaders run on a gpu (graphics processing unit), which is optimized for such operations. using a gpu to deal with shaders offloads some of the number crunching from the cpu. this allows the cpu to focus its processing power on other tasks, like executing code. vertex shaders vertex shaders manipulate coordinates in a 3d space and are called once per vertex. the ...
Audio for Web games - Game development
ck is in a state to be playable. note: in many ways the concept of buffering is an outdated one. as long as byte-range requests are accepted (which is the default behavior), we should be able to jump to a specific point in the audio without having to download the preceding content. however, preloading is still useful — without it, there would always need to be some client-server communication required before playing can commence. concurrent audio playback a requirement of many games is the need to play more than one piece of audio at the same time; for example, there might be background music playing along with sound effects for various things happening in the game. although the situation is soon going to get better with the adoption of the web audio api, the current most widely-supported m...
Implementing game control mechanisms - Game development
boot.js, preloader.js, mainmenu.js and game.js — these are loaded into the index file in this exact order. the first one initializes phaser, the second preloads all the assets, the third one controls the main menu welcoming the player, and the fourth controls the actual gameplay. every state has its own default methods: preload(), create(), and update(). the first one is needed for preloading required assets, create() is executed once the state had started, and update() is executed on every frame. for example, you can define a button in the create() function: create: function() { // ... var buttonenclave = this.add.button(10, 10, 'logo-enclave', this.clickenclave, this); // ... } it will be created once at the start of the game, and will execute this.clickenclave() action assigned to it...
Tiles and tilemaps overview - Game development
s) or to create a level editor. some popular games that use this technique are super mario bros, pacman, zelda: link's awakening, starcraft, and sim city 2000. think about any game that uses regularly repeating squares of background, and you'll probably find it uses tilemaps. the tile atlas the most efficient way to store the tile images is in an atlas or spritesheet. this is simply all of the required tiles grouped together in a single image file. when it's time to draw a tile, only a small section of this bigger image is rendered on the game canvas. the below images shows a tile atlas of 8 x 4 tiles: using an atlas also has the advantage of naturally assigning every tile an index. this index is perfect to use as the tile identifier when creating the tilemap object. the tilemap data struct...
Collision detection - Game development
positions of all the bricks in the group. the third, optional parameter is the function executed when a collision occurs — ballhitbrick(). create this new function as the bottom of your code, just before the closing </script> tag, as follows: function ballhitbrick(ball, brick) { brick.kill(); } and that's it! reload your code and you should see the new collision detection working just as required. thanks to phaser there are two parameters passed to the function — the first one is the ball, which we explicitly defined in the collide method, and the second one is the single brick from the bricks group that the ball is colliding with. inside the function we remove the brick in question from the screen simply by running the kill() method on it. you would expect to have to write a lot more...
Initialize the framework - Game development
next » this is the first of 16 tutorials to learn how to use gamedev phaser. after completing this tutorial you can find the source code for this section at gamedev-phaser-content-kit/demos/lesson01.html. before we can start writing the game's functionality, we need to create a basic structure to render the game inside. this can be done using html — the phaser framework will generate the required <canvas> element. the game's html the html document structure is quite simple, as the game will be rendered entirely on the <canvas> element generated by the framework. using your favourite text editor, create a new html document, save it as index.html, in a sensible location, and add the following code to it: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>gamedev phaser...
Plug-in Development Overview - Gecko Plugin API Reference
file extensions in alternating strings. for example: str 128 mime type string 1 video/quicktime string 2 mov, moov string 3 audio/aiff string 4 aiff string 5 image/jpeg string 6 jpg several other optional strings may contain useful information about the plug-in. plug-ins must support 'str#' 128 but are not required to support any of these others: 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, wh...
Code splitting - MDN Web Docs Glossary: Definitions of Web-related terms
ous bundles or components which can then be loaded on demand or in parallel. as an application grows in complexity or is simply maintained, css and javascripts files or bundles grow in byte size, especially as the number and size of included third-party libraries increases. to prevent the requirement of downloading ginormous files, scripts can be split into multiple smaller files. then features required at page load can be downloaded immediately with additional scripts being lazy loaded after the page or application is interactive, thus improving performance. while the total amount of code is the same (and perhaps even a few bytes larger), the amount of code needed during initial load can be reduced. code splitting is a feature supported by bundlers like webpack and browserify which can create ...
Control flow - MDN Web Docs Glossary: Definitions of Web-related terms
which the computer executes statements in a script. code is run in order from the first line in the file to the last line, unless the computer runs across the (extremely frequent) structures that change the control flow, such as conditionals and loops. for example, imagine a script used to validate user data from a webpage form. the script submits validated data, but if the user, say, leaves a required field empty, the script prompts them to fill it in. to do this, the script uses a conditional structure or if...else, so that different code executes depending on whether the form is complete or not: if (field==empty) { promptuser(); } else { submitform(); } a typical script in javascript or php (and the like) includes many control structures, including conditionals, loops and function...
DTLS (Datagram Transport Layer Security) - MDN Web Docs Glossary: Definitions of Web-related terms
curity. as a datagram protocol, dtls doesn't guarantee the order of message delivery, or even that messages will be delivered at all. however, dtls gains the benefits of datagram protocols, too; in particular, the lower overhead and reduced latency. these features are especially useful for one of the most common areas in which dtls comes into play: webrtc. all of the webrtc related protocols are required to encrypt their communications using dtls; this includes sctp, srtp, and stun. learn more general knowledge datagram transport layer security on wikipedia specifications rfc 6347: datagram transport layer security version 1.2 datagram transport layer security protocol version 1.3 draft specification related specifications rfc 5763: framework for establishing a secure real-time tr...
Doctype - MDN Web Docs Glossary: Definitions of Web-related terms
its sole purpose is to prevent a browser from switching into so-called “quirks mode” when rendering a document; that is, the "<!doctype html>" doctype ensures that the browser makes a best-effort attempt at following the relevant specifications, rather than using a different rendering mode that is incompatible with some specifications. ...
Domain - MDN Web Docs Glossary: Definitions of Web-related terms
ned in a top-level domain registry. "mozilla" is the domain. if you like to own a domain you have to register it with one of the many registrars who are allowed to do so with a top-level domain registry. "developer" is a "sub-domain", something you as the owner of a domain may define yourself. many owners choose to have a subdomain "www" to point to their world_wide_web resource, but that's not required (and has even fallen somewhat out of favor). learn more domain name on wikipedia ...
Domain sharding - MDN Web Docs Glossary: Definitions of Web-related terms
domain sharding, in terms of performance, is the cost of extra dns lookups for each domain and the overhead of establishing each tcp connection. the initial response from an http request is generally an html file listing other resources such as javascript, css, images and other media files that need to be downloaded. as browsers limit the number of active connections per domain, serving all the required resources from a single domain could be slow as assets need to be downloaded sequentially. with domain sharding, the required downloads are served from more than one domain, enabling the browser to simultaneously download needed resources. multiple domains, however, is an anti-pattern, as dns lookups slow initial load times. http2 supports unlimited concurrent requests making domain sharding an ...
Lazy load - MDN Web Docs Glossary: Definitions of Web-related terms
see also lazy loading ...
MVC - MDN Web Docs Glossary: Definitions of Web-related terms
nents follow a more rigid pattern. in the early days of the web, mvc architecture was mostly implemented on the server-side, with the client requesting updates via forms or links, and receiving updated views back to display in the browser. however, these days, more of the logic is pushed to the client with the advent of client-side data stores, and xmlhttprequest allowing partial page updates as required. web frameworks such as angularjs and ember.js all implement an mvc architecture, albeit in slightly different ways. learn more general knowledge model–view–controller on wikipedia ...
Main thread - MDN Web Docs Glossary: Definitions of Web-related terms
n your page, as well as to perform layout, reflows, and garbage collection. this means that long-running javascript functions can block the thread, leading to an unresponsive page and a bad user experience. unless intentionally using a web worker, such as a service worker, javascript runs on the main thread, so it's easy for a script to cause delays in event processing or painting. the less work required of the main thread, the more that thread can respond to user events, paint, and generally be responsive to the user. ...
Media (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
rs several features that allow you to tweak your document's styles—or even offer different styles—according to the media type (such as screen or print, to name two) or media capabilities (such as width, resolution, or other values) of the viewer's device. learn more general knowledge using media queries technical reference media queries define a set of characteristics or parameters required to apply the css styles that are specified within the curly braces of the media query; for example: only applying certain css styles for devices below 768 pixels. @media at-rule conditionally apply part of a stylesheet, based on the result of a media query. window.matchmedia() test the viewing device against a media query. ...
Progressive Enhancement - MDN Web Docs Glossary: Definitions of Web-related terms
feature detection is generally used to determine whether browsers can handle more modern functionality, while polyfills are often used to add missing features with javascript. special notice should be taken of accessibility. ...
SPA (Single-page application) - MDN Web Docs Glossary: Definitions of Web-related terms
only a single web document, and then updates the body content of that single document via javascript apis such as xmlhttprequest and fetch when different content is to be shown. this therefore allows users to use websites without loading whole new pages from the server, which can result in performance gains and a more dynamic experience, with some tradeoff disadvantages such as seo, more effort required to maintain state, implement navigation, and do meaningful performance monitoring. learn more general knowledge some of the most popular spa frameworks include: react angular vue.js ...
Syntax - MDN Web Docs Glossary: Definitions of Web-related terms
syntax generally includes grammar and the rules that apply to writing it, such as indentation requirements in python. syntax varies from language to language (e.g., syntax is different in html and javascript). although languages can share few similarities in terms of their syntaxes for example "operand operator operand" rule in javascript and python. this does not mean the two langauges share similarities with syntax. syntax applies both to programming languages (commands to the computer) and markup languages (document structure information) alike. ...
Tag - MDN Web Docs Glossary: Definitions of Web-related terms
in html, a tag is used for creating an element. the name of an html element is the name used in angle brackets such as <p> for paragraph. note that the end tag's name is preceded by a slash character, </p>, and that in empty elements, the end tag is neither required nor allowed. if attributes are not mentioned, default values are used in each case. learn more general knowledge html element on wikipedia html elements syntax on whatwg technical reference introduction to html ...
VoIP - MDN Web Docs Glossary: Definitions of Web-related terms
packages include skype, msn messenger, yahoo and many more. everything transferrred through voip is digital. it is also known as ip telephony, or broadband telephony. the main reason for using voip technology is because of cost. voip allows you to make a call directly from a computer, a special voip phone, or a traditional phone connected to a special adapter. a high speed internet connection is required for voip. usually, telephone calls over the internet do not incur further charges beyond what the user is paying for internet access, much in the same way that the user doesn't pay for sending individual emails over the internet. learn more general knowledge voip on wikipedia ...
Test your skills: HTML accessibility - Learn web development
form, and wrap them in an element that associates them all together as a single related group. give the group a description/title that summarises all of the information as personal data. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. html accessibility 3 in this task you are required to turn all the information links in the paragraph into good, accessible links. the first two links just go to regular web pages. the third link goes to a pdf, and it's large — 8mb. the fourth link goes to a word document, so the user will need some kind of application installed that can handle that. try updating the live code below to recreate the finished example: download the star...
What is accessibility? - Learn web development
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 loss of limb or paralysis), or neurological/genetic disorders that lead to weakness or loss of control in limbs. some people might have difficulty making the exact hand movements required to use a mouse, while others might be more severely affected, perhaps being significantly paralyzed to the point where they need to use a head pointer to interact with computers. this kind of disability can also be a result of old age, rather than any specific trauma or condition, and it could also result from hardware limitations — some users might not have a mouse. the way this usually affe...
Images, media, and form elements - Learn web development
ent — this defines simple form fields such as text inputs, through to more complex fields added in html5 such as color and date pickers. there are some additional elements, such as <textarea> for multiline text input, and also elements used to contain and label parts of forms such as <fieldset> and <legend>. html5 also contains attributes that enable web developers to indicate which fields are required, and even the type of content that needs to be entered. if the user enters something unexpected, or leaves a required field blank, the browser can show an error message. different browsers are inconsistent in how much styling and customization they allow for such items. styling text input elements elements that allow for text input, such as <input type="text">, specific types such as <input typ...
Organizing your CSS - Learn web development
of the reasons you might use sass is to be able to define all of the colors and fonts used in a project as settings, then use that variable around the project. this means that if you realise you have used the wrong shade of blue, you only need change it in one place. if we created a variable called $base-color as in the first line below, we could then use it through the stylesheet anywhere that required that color. $base-color: #c6538c; .alert { border: 1px solid $base-color; } once compiled to css, you would end up with the following css in the final stylesheet. .alert { border: 1px solid #c6538c; } compiling component stylesheets i mentioned above that one way to organise css is to break down stylesheets into smaller stylesheets. when using sass you can take this to another level and...
Styling tables - Learn web development
that allows you to easily set column widths by setting width on their headings (<th>). use border-collapse: collapse to make table elements borders collapse into each other, producing a neater and easier to control look. use <thead>, <tbody>, and <tfoot> to break up your table into logical chunks and provide extra places to apply css to, so it is easier to layer styles on top of one another if required. use zebra striping to make alternative rows easier to read. use text-align to line up your <th> and <td> text, to make things neater and easier to follow. test your skills! we have covered a lot in this article, but can you remember the most important information? you can find some further tests to verify that you've retained this information before you move on — see test your skills: tab...
Positioning - Learn web development
ve the position: relative; declaration and add a fixed height, like so: body { width: 500px; height: 1400px; margin: 0 auto; } now we're going to give the <h1> element position: fixed;, and get it to sit at the top of the viewport. add the following rule to your css: h1 { position: fixed; top: 0; width: 500px; margin-top: 0; background: white; padding: 10px; } the top: 0; is required to make it stick to the top of the screen. we give the heading the same width as the content column and then give it a white background and some padding and margin, so the content won't be visible underneath it. if you save and refresh now, you'll see a fun little effect whereby the heading stays fixed, and the content appears to scroll up and disappear underneath it. but we could improve this m...
Responsive design - Learn web development
s on the full-featured desktop version of the site. flexible layout before responsive design a number of approaches were developed to try to solve the downsides of the liquid or fixed-width methods of building websites. in 2004 cameron adams wrote a post entitled resolution dependent layout, describing a method of creating a design that could adapt to different screen resolutions. this approach required javascript to detect the screen resolution and load the correct css. zoe mickley gillenwater was instrumental in her work to describe and formalize the different ways in which flexible sites could be created, attempting to find a happy medium between filling the screen or being completely fixed in size. responsive design the term responsive design was coined by ethan marcotte in 2010 and descr...
How CSS works - Learn web development
css! javascript is handled a bit later on in the process, and we won't talk about it here to keep things simpler. the browser parses the fetched css, and sorts the different rules by their selector types into different "buckets", e.g. element, class, id, and so on. based on the selectors it finds, it works out which rules should be applied to which nodes in the dom, and attaches style to them as required (this intermediate step is called a render tree). the render tree is laid out in the structure it should appear in after the rules have been applied to it. the visual display of the page is shown on the screen (this stage is called painting). the following diagram also offers a simple view of the process. about the dom a dom has a tree-like structure. each element, attribute, and piece of...
create fancy boxes - Learn web development
background-color: #a4c9cf; /* well, actually we are not making a full circle as we want the bottom of our cloud to be flat. feel free to tweak this example to make a cloud that isn't flat at the bottom ;) */ border-radius: 100% 100% 0 0; } /* those are common style that apply to both our ::before and ::after pseudo elements. */ .fancy::before, .fancy::after { /* this is required to be allowed to display the pseudo-elements, event if the value is an empty string */ content: ''; /* we positionnate our pseudo-elements on the left and right sides of the box, but always at the bottom */ position: absolute; bottom : 0; /* this makes sure our pseudo-elements will be below the box content whatever happens. */ z-index : -1; background-color: ...
What do common web layouts contain? - Learn web development
p of every page on the site. contains information relevant to all pages (like site name or logo) and an easy-to-use navigation system. main content the biggest region, containing content unique to the current page. stuff on the side 1) information complementing the main content; 2) information shared among a subset of pages; 3) alternative navigation system. in fact, everything not absolutely required by the page's main content. footer visible at the bottom of every page on the site. like the header, contains less prominent global information like legal notices or contact info. these elements are quite common in all form factors, but they can be laid out different ways. here are some examples (1 represents header, 2 footer; a main content; b1, b2 things on the side): 1-column layout. espe...
What is a Domain Name? - Learn web development
ydomainname.org: $ whois afunkydomainname.org not found as you can see, the domain does not exist in the whois database (at the time of writing), so we could ask to register it. good to know! getting a domain name the process is quite straightforward: go to a registrar's website. usually there is a prominent “get a domain name” call to action. click on it. fill out the form with all required details. make sure especially that you have not misspelled your desired domain name. once it's paid for, it's too late! the registrar will let you know when the domain name is properly registered. within a few hours, all dns servers will have received your dns information. note: in this process the registrar asks you for your real-world address. make sure you fill it properly, since in some c...
Basic native form controls - Learn web development
t of the form data once submitted — for example you might want to submit a timestamp to the server stating when an order was placed. because it is hidden, the user can not see nor intentionally edit the value, it will never receive focus, and a screen reader will not notice it either. <input type="hidden" id="timestamp" name="timestamp" value="1286705410"> if you create such an element, it's required to set its name and value attributes. the value can be dynamically set via javascript. the hidden input type should not have an associated label. other text input types, like search, url, and tel, were added with html5. those will be covered in the next tutorial, html5 input types. checkable items: checkboxes and radio buttons checkable items are controls whose state you can change by clicking...
The HTML5 input types - Learn web development
html form control appearance may be quite different from a designer's specifications, web developers sometimes build their own custom form controls. we cover this in an advanced tutorial: how to build custom form widgets. e-mail address field this type of field is set using the value email for the type attribute: <input type="email" id="email" name="email"> when this type is used, the user is required to type a valid email address into the field. any other content causes the browser to display an error when the form is submitted. you can see this in action in the below screenshot. you can also use the multiple attribute in combination with the email input type to allow several email addresses to be entered in the same input (separated by commas): <input type="email" id="email" name="email"...
Example 2 - Learn web development
ul class="optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> <form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { fon...
Example 3 - Learn web development
class="optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> </form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { fon...
Example 4 - Learn web development
class="optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> </form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { fon...
Example 5 - Learn web development
</li> <li class="option" role="option">lemon</li> <li class="option" role="option">banana</li> <li class="option" role="option">strawberry</li> <li class="option" role="option">apple</li> </ul> </div> </form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { fon...
Other form controls - Learn web development
of all the drop-down box types on github at drop-down-content.html (see it live also). select box a simple select box is created with a <select> element with one or more <option> elements as its children, each of which specifies one of its possible values. <select id="simple" name="simple"> <option>banana</option> <option selected>cherry</option> <option>lemon</option> </select> if required, the default value for the select box can be set using the selected attribute on the desired <option> element — this option is then preselected when the page loads. the <option> elements can be nested inside <optgroup> elements to create visually associated groups of values: <select id="groups" name="groups"> <optgroup label="fruits"> <option>banana</option> <option selected>cherry...
Test your skills: Form validation - Learn web development
this task, we are providing you with a simple support query form, and we want you to add some validation features to it: make all of the input fields mandatory to complete before the form can be submitted. change the type of the "email address" and "phone number" fields to make the browser apply some more specific validation suitable for the data being asked for. give the "user name" field a required length of between 5 and 20 characters, the "phone number" field a maximum length of 15 characters, and the "comment" field a maximum length of 200 characters. try submitting your form — it should refuse to submit until the above constaints are followed, and give suitable error messages. to help, you might want to consider adding some simple css to show when a form field is valid or invalid. ...
Web forms — Working with user data - Learn web development
re starting this module, you should at least work through our introduction to html. at this point you should find the introductory guides easy to understand, and also be able to make use of our basic native form controls guide. mastering forms however requires more than just html knowledge — you also need to learn some specific techniques to style form controls, and some scripting knowledge is required to handle things like validation and creating custom form controls. therefore, before you look at the other sections listed below we'd recommend that you go away and learn some css and javascript first. the above text is a good indicator as to why we've put web forms into its own standalone module, rather than trying to mix bits of it into the html, css, and javascript topic areas — form eleme...
HTML basics - Learn web development
orm an entire html page. let's revisit the code we put into our index.html example (which we first met in the dealing with files article): <!doctype html> <html> <head> <meta charset="utf-8"> <title>my test page</title> </head> <body> <img src="images/firefox-icon.png" alt="my test image"> </body> </html> here, we have the following: <!doctype html> — the doctype. it is required preamble. in the mists of time, when html was young (around 1991/92), doctypes were meant to act as links to a set of rules that the html page had to follow to be considered good html, which could mean automatic error checking and other useful things. however these days, they don't do much, and are basically just needed to make sure your document behaves correctly. that's all you need to know for...
JavaScript basics - Learn web development
ore details on javascript consoles, see discover browser developer tools. variables variables are containers that store values. you start by declaring a variable with the var (less recommended, dive deeper for the explanation) or the let keyword, followed by the name you give to the variable: let myvariable; note: a semicolon at the end of a line indicates where a statement ends. it is only required when you need to separate statements on a single line. however, some people believe it's good practice to have semicolons at the end of each statement. there are other rules for when you should and shouldn't use semicolons. for more details, see your guide to semicolons in javascript. note: you can name a variable nearly anything, but there are some restrictions. (see this section about naming...
Creating hyperlinks - Learn web development
prerequisites: basic html familiarity, as covered in getting started with html. html text formatting, as covered in html text fundamentals. objective: to learn how to implement a hyperlink effectively, and link multiple files together. what is a hyperlink? hyperlinks are one of the most exciting innovations the web has to offer. ...
Introduction to HTML - Learn web development
s is to give text meaning (also known as semantics), so that the browser knows how to display it correctly. this article looks at how to use html to break up a block of text into a structure of headings and paragraphs, add emphasis/importance to words, create lists, and more. creating hyperlinks hyperlinks are really important — they are what makes the web a web. this article shows the syntax required to make a link and discusses best practices for links. advanced text formatting there are many other elements in html for formatting text that we didn't get to in the html text fundamentals article. the elements here are less well-known, but still useful to know about. in this article, you'll learn about marking up quotations, description lists, computer code and other related text, subscript a...
From object to iframe — other embedding technologies - Learn web development
opriately — or for testing — but can't cause any harm to the rest of the codebase (either accidental or malicious) is called a sandbox. unsandboxed content can do way too much (executing javascript, submitting forms, popup windows, etc.) by default, you should impose all available restrictions by using the sandbox attribute with no parameters, as shown in our previous example. if absolutely required, you can add permissions back one by one (inside the sandbox="" attribute value) — see the sandbox reference entry for all the available options. one important note is that you should never add both allow-scripts and allow-same-origin to your sandbox attribute — in that case, the embedded content could bypass the same-origin policy that stops sites from executing scripts, and use javascript t...
Graceful asynchronous programming with Promises - Learn web development
n't really make sense to try to execute out of order, or in order but before each previous step has quite finished: you choose what toppings you want. this can take a while if you are indecisive, and may fail if you just can't make up your mind, or decide to get a curry instead. you then place your order. this can take a while to return a pizza and may fail if the restaurant does not have the required ingredients to cook it. you then collect your pizza and eat. this might fail if, say, you forgot your wallet so can't pay for the pizza! with old-style callbacks, a pseudo-code representation of the above functionality might look something like this: choosetoppings(function(toppings) { placeorder(toppings, function(order) { collectorder(order, function(pizza) { eatpizza(pizza); ...
Introduction to events - Learn web development
etc.) are more powerful, but can also become complex and are less well supported (supported as far back as internet explorer 9). you should also experiment with these, and try to use them where possible. the main advantages of the third mechanism are that you can remove event handler code if needed, using removeeventlistener(), and you can add multiple listeners of the same type to elements if required. for example, you can call addeventlistener('click', function() { ... }) on an element multiple times, with different functions specified in the second argument. this is impossible with event handler properties because any subsequent attempts to set a property will overwrite earlier ones, e.g.: element.onclick = function1; element.onclick = function2; etc. note: if you are called on to support...
Function return values - Learn web development
the isnan() function to test whether the num value is not a number — if so, it returns true, and if not, it returns false. if the test returns false, the num value is a number. therefore, a sentence is printed out inside the paragraph element that states the square, cube, and factorial values of the number. the sentence calls the squared(), cubed(), and factorial() functions to calculate the required values. save your code, load it in a browser, and try it out. note: if you have trouble getting the example to work, feel free to check your code against the finished version on github (see it running live also), or ask us for help. now it's your turn! at this point, we'd like you to have a go at writing out a couple of functions of your own and adding them to the library. how about the ...
What is JavaScript? - Learn web development
e.js environment — you can find out more about server-side javascript in our dynamic websites – server-side programming topic. dynamic versus static code the word dynamic is used to describe both client-side javascript, and server-side languages — it refers to the ability to update the display of a web page/app to show different things in different circumstances, generating new content as required. server-side code dynamically generates new content on the server, e.g. pulling data from a database, whereas client-side javascript dynamically generates new content inside the browser on the client, e.g. creating a new html table, filling it with data requested from the server, then displaying the table in a web page shown to the user. the meaning is slightly different in the two contexts, but ...
Inheritance in JavaScript - Learn web development
setting teacher()'s prototype and constructor reference all is good so far, but we have a problem. we have defined a new constructor, and it has a prototype property, which by default just contains an object with a reference to the constructor function itself. it does not contain the methods of the person const...
Working with JSON - Learn web development
ional travel" ] } ] } if we loaded this object into a javascript program, parsed in a variable called superheroes for example, we could then access the data inside it using the same dot/bracket notation we looked at in the javascript object basics article. for example: superheroes.hometown superheroes['active'] to access data further down the hierarchy, you simply have to chain the required property names and array indexes together. for example, to access the third superpower of the second hero listed in the members list, you'd do this: superheroes['members'][1]['powers'][2] first we have the variable name — superheroes. inside that we want to access the members property, so we use ["members"]. members contains an array populated by objects. we want to access the second obj...
Object prototypes - Learn web development
hence, the constructor property is also available to both person1 and person2 objects. for example, try these commands in the console: person1.constructor person2.constructor these should both return the person() constructor, as it contains the original definition of these instances. a clever trick is that you can put parentheses onto the end of the constructor property (containing any required parameters) to create another object instance from that constructor. the constructor is a function after all, so can be invoked using parentheses; you just need to include the new keyword to specify that you want to use the function as a constructor. try this in the console: let person3 = new person1.constructor('karen', 'stephenson', 26, 'female', ['playing drums', 'mountain climbing']); ...
Test your skills: Object basics - Learn web development
he greeting to the browser devtools' console). update the color property value to black. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. object basics 2 in our next task, we want you to have a go at creating your own object literal to represent one of your favourite bands. the required members are: name: a string representing the band name. nationality: a string representing the country the band comes from. genre: what type of music the band plays. members: a number representing the number of members the band has. formed: a number representing the year the band formed. split: a number representing the year the band split up, or false if they are still together. albums:...
Perceived performance - Learn web development
only the stuff you are actually using, then download the rest. if you're downloading all the assets in the end, the weight of all your assets hasn't improved -- in fact, you may need to add some code -- but because the download of non-immediately necessary assets are delayed in a manner that is not perceptible the the user, the user will feel like the download was faster. to minimize the assets required for initial load, separate interactive functionality from content so that required content -- the text, styles, and images visible at initial load -- can be loaded first. delay, or lazy load, the rest of the assets. don't load images or scripts that aren’t used or visible on the initial page load. either delay their load, loading them when the page becomes usable, or, loading them when they b...
Web performance resources - Learn web development
load attribute, requiring javascript, so it is important to include a noscript tag with a traditional fallback. <link rel="stylesheet" href="/path/to/my.css" media="print" onload="this.media='all'"> <noscript><link rel="stylesheet" href="/path/to/my.css"></noscript> the downside with this approach is the flash of unstyled text (fout.) the simplist way to address this is by inlining css that is required for any content that is rendered above the fold, or what you see in the browser viewport before scrolling. these styles will improve perceived performance as the css does not require a file request. <style type="text/css"> // insert your css here </style> javascript avoid javascript blocking by using the async or defer attributes, or link javascript assets after the page's dom elements. javas...
What is web performance? - Learn web development
objective: to gain basic familiarity of what is involved with web performance. * versus subjective, perceived performance, covered in the next article what is web performance? web performance is the objective measurement and perceived user experience of a web site or application. this includes the following major areas: reducing overall load time: how long does it take the files required to render the web site to download on to the user's computer? this tends to be affected by latency, how big your files are, how many files there are, and other factors besides. a general strategy is to make your files as small as possible, reduce the number of http requests made as much as possible, and employ clever loading techniques (such as preload) to make files available sooner. making the...
JavaScript performance - Learn web development
tracking pixels, and features like maps and support features. all of this javascript must be downloaded. eventually. performance optimizatins should include: reducing the amount of javascript that is needed. some features requiring complex javascript can be done with a few lines of javascript. requiring a library for other features may improve developer experience, but is all that javascript required? is there a lighter weight or home spun solutions? some features may not be necessary, and though they may add some bling, is the cost of the feature in terms of performance worth it? remove unused code split the javascript into smaller files code-split javascript into critical and non-critical parts. module bundlers like webpack support code-splitting. optimize these smaller files minific...
Multimedia: video - Learn web development
for current browser support of video and other media types. video autoplay to ensure that a looping background video autoplays, you must add several attributes to the video tag: autoplay, muted, and playsinline. <video autoplay="" loop="" muted="true" playsinline="" src="backgroundvideo.mp4"> while the loop and autoplay make sense for a looping and autoplaying video, the muted attribute is required for autoplay in mobile browsers. playsinline is required for mobile safari, allowing videos to play without forcing fullscreen mode. remove audio from muted hero videos for hero-video or other video without audio, removing audio is smart. <video autoplay="" loop="" muted="true" playsinline="" id="hero-video"> <source src="banner_video.webm" type='video/webm; codecs="vp8, vorbis"'>...
Website security - Learn web development
ersistent xss vulnerability occurs when the malicious script is stored on the website and then later redisplayed 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 displayed, 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 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 disp...
Getting started with Ember - Learn web development
s (allowing easier mental context switching). getting ready to build our ember project you'll need a code editor before continuing to interact with your brand new project. if you don't have one configured already, the ember atlas has some guides on how to set up various editors. installing the shared assets for todomvc projects installing shared assets, as we're about to do, isn't normally a required step for new projects, but it allows us to use existing shared css so we don't need to try to guess at what css is needed to create the todomvc styles. first, enter into your todomvc directory in the terminal, for example using cd todomvc in macos/linux. now run the following command to place the common todomvc css inside your app: npm install --save-dev todomvc-app-css todomvc-com...
Ember resources and troubleshooting - Learn web development
nt. controllers are (as of january 2020), the only way to manage url query params. ideally, controllers should be fairly light in their responsibilities, delegating to components and services where possible. what is the purpose of routes? a route represents part of the url when a user navigates from place to place in the app. a route has only a couple responsibilities: load the minimally required data to render the route (or view-sub-tree). gate access to the route and redirect if needed. handle loading and error states from the minimally required data. a route only has 3 lifecycle hooks, all of which are optional: beforemodel — gate access to the route. model — where data is loaded. aftermodel — verify access. last, a route has the ability to handle common events re...
Routing in Ember - Learn web development
a "sitemap" for developers to be able to quickly see how the entire app is structured. it also tells ember how to interact with your route, such as when loading arbitrary data, handling errors while loading that data, or interpreting dynamic segments of the url. since our data is static, we won't get to any of those fancy features, but we'll still make sure that the route provides the minimally required data to view a page. creating the "index" route did not add a route definition line to router.js, because like with url navigation and javascript module loading, "index" is a special word that indicates the default route to render, load, etc. to adjust our old way of rendering the todolist app, we'll first need to replace the todolist component invocation from the application template with an {...
Ember app structure and componentization - Learn web development
hown in the resulting terminal output: installing component create app/components/header.hbs skip app/components/header.js tip to add a class, run `ember generate component-class header` installing component-test create tests/integration/components/header-test.js header.hbs is the template file where we’ll include the html structure for just that component. later on we'll add the required dynamic functionality such as data bindings, responding to user interaction, etc. note: the header.js file (shown as skipped) is for connection to a backing glimmer component class, which we don't need for now, as they are for adding interactivity and state manipulation. by default, generate component generates template-only components, because in large applications, template-only components en...
Framework main features - Learn web development
often make heavy use of typescript. typescript is not concerned with the writing of user interfaces, but it is a domain-specific language, and has significant differences to vanilla javascript. dsls can't be read by the browser directly; they must be transformed into javascript or html first. transformation is an extra step in the development process, but framework tooling generally includes the required tools to handle this step, or can be adjusted to include this step. while it is possible to build framework apps without using these domain-specific languages, embracing them will streamline your development process and make it easier to find help from the communities around those frameworks. jsx jsx, which stands for javascript and xml, is an extension of javascript that brings html-like synta...
Componentizing our Svelte app - Learn web development
n-svelte-tutorial/05-advanced-concepts or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/05-advanced-concepts remember to run npm install && npm run dev to start your app in development mode. repl to see the current state of the code in a repl, visit: https://svelte.dev/repl/76cc90c43a37452e8c7f70521f88b698?version=3.23.2 summary now we have all of our app's required functionality in place. we can display, add, edit and delete todos, mark them as completed, and filter by status. in this article, we covered the following topics: extracting functionality to a new component. passing information from child to parent using a handler received as a prop. passing information from child to parent using the bind directive. conditionally rendering blocks of marku...
Dynamic behavior in Svelte: working with variables and props - Learn web development
in this article we'll be using variables and props to make our app dynamic, allowing us to add and delete todos, mark them as complete, and filter them by status. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. ...
Vue conditional rendering: editing existing todos - Learn web development
tton type="button" class="btn" @click="oncancel"> cancel <span class="visually-hidden">editing {{label}}</span> </button> <button type="submit" class="btn btn__primary"> save <span class="visually-hidden">edit for {{label}}</span> </button> </div> </form> </template> <script> export default { props: { label: { type: string, required: true }, id: { type: string, required: true } }, data() { return { newlabel: this.label }; }, methods: { onsubmit() { if (this.newlabel && this.newlabel !== this.label) { this.$emit("item-edited", this.newlabel); } }, oncancel() { this.$emit("edit-cancelled"); } } }; </script> <style scoped> .edit-label { ...
Getting started with Vue - Learn web development
be other directories present (for example, if you choose a router, you will also have a views directory). .vue files (single file components) like in many front-end frameworks, components are a central part of building apps in vue. these components let you break a large application into discrete building blocks that can be created and managed separately, and transfer data between each other as required. these small blocks can help you reason about and test your code. while some frameworks encourage you to separate your template, logic, and styling code into separate files, vue takes the opposite approach. using single file components, vue lets you group your templates, corresponding script, and css all together in a single file ending in .vue. these files are processed by a js build tool (such...
Vue resources - Learn web development
hosting platforms. vue 3 vue 3 is a major release of the framework with a lot of major changes. it went into active beta in april, 2020. the biggest change is a new composition api that works as an alternative to the current property-based api. in this new api, a single setup() function is used on the component. only what you return from this function is available in your <template>s. you are required to be explicit about "reactive" properties when using this api. vue handles this for you using the options api. this makes the new api typically considered a more advanced use case. there are also a handful of other changes, including a change in how apps are initialized in vue. to read more about the changes involved with vue 3, refer to this article by vue school which goes over most of the ma...
Understanding client-side JavaScript frameworks - Learn web development
st have a look at the desired functionality of our app, then we'll create a todos.svelte component and put static markup and styles in place, leaving everything ready to start developing our to-do list app features, which we'll go on to in subsequent articles. 3. dynamic behavior in svelte: working with variables and props now that we have our markup and styles ready we can start developing the required features for our svelte to-do list app. in this article we'll be using variables and props to make our app dynamic, allowing us to add and delete todos, mark them as complete, and filter them by status. 4. componentizing our svelte app the central objective of this article is to look at how to break our app into manageable components and share information between them. we'll componentize our ap...
Handling common accessibility problems - Learn web development
th the background color. your design might look cool, but it is no good if people with visual impairments like color blindness can't read your content. use a tool like webaim's color contrast checker to check whether your scheme is contrasting enough. another tip is to not rely on color alone for signposts/information, as this will be no good for those who can't see the color. instead of marking required form fields in red, for example, mark them with an asterisk and in red. note: a high contrast ratio will also allow anyone using a smartphone or tablet with a glossy screen to better read pages when in a bright environment, such as sunlight. hiding content there are many instances where a visual design will require that not all content is shown at once. for example, in our tabbed info box ex...
Introduction to automated testing - Learn web development
once all the questions have been asked, it will ask you if the information entered is ok. type yes and press enter/return and npm will generate a package.json file in your directory. this file is basically a config file for the project. you can customize it later, but for now it'll look something like this: { "name": "node-tes...
Implementing feature detection - Learn web development
a property name) and not include the semi-colon on the end. @supports also has or and not logic available — the other block applies the float layout if the flexbox properties are not available: @supports not (flex-flow: row) and (flex: 1) { /* rules in here */ } this may look a lot more convenient than the previous example — we can do all of our feature detection in css, no javascript required, and we can handle all the logic in a single css file, cutting down on http requests. the problem here is browser support — @supports is not supported at all in ie, and only supported in very recent versions of safari/ios webkit (9+/9.2+), whereas the javascript version should work in much older browsers (probably back to ie8 or 9, although older versions of ie will have additional problems, su...
Command line crash course - Learn web development
this article provides an introduction to the terminal, the essential commands you'll need to enter into it, how to chain commands together, and how to add your own command line interface (cli) tools. prerequisites: familiarity with the core html, css, and javascript languages. objective: to understand what the terminal/command line is, what basic commands you should learn, and how to install new command line tools. ...
Client-side tooling overview - Learn web development
s in your process will improve your own development experience and likely improve the overall quality of your code. it often takes some time for new developer tools to settle down in their complexity. one of the best known tools, webpack, has a reputation for being overly complicated to work with, but in the latest major release there was a huge push to simplify common usage so the configuration required is reduced down to an absolute minimum. there's definitely no silver bullet that will guarantee success with tools, but as your experience increases you'll find workflows that work for you or for your team and their projects. once all the kinks in the process are flattened out, your tool chain should be something you can forget about and it should just work. how to choose and get help with a pa...
Understanding client-side web development tools - Learn web development
al information you need to work towards your goal. get started guides 1. client-side tooling overview in this article we provide an overview of modern web tooling, what kinds of tools are available and where you’ll meet them in the lifecycle of web app development, and how to find help with individual tools. 2. command line crash course in your development process you'll undoubtedly be required to run some command in the terminal (or on the "command line" — these are effectively the same thing). this article provides an introduction to the terminal, the essential commands you'll need to enter into it, how to chain commands together, and how to add your own command line interface (cli) tools. 3. package management basics in this article we'll look at package managers in some detail t...
Mozilla's Section 508 Compliance
lower than 55 hz. complete. mozilla supports of <blink> and text-decoration: blink in web pages. in these situations mozilla blinks 1 hz, which is within the allowable range and follows the stricter mil-std standard. (l) when electronic forms are used, the form shall allow people using assistive technology to access the information, field elements, and functionality required for completion and submission of the form, including all directions and cues. partially complete. see functional performance criteria below. screen reader access is currently being tested. an extension called ad block helps remove extra noisy content from web pages that clutter accessibility. functional performance criteria requirement windo...
Multiprocess on Windows
limited to supporting the same language features which were supported by vb at that time. given those two options, it may seem that oicf is the preferred format. however, for various reasons, our com interceptor currently only supports typelib metadata. in order for the interceptor to be able to work with our interfaces, we must do some additional work to compensate for typelib's weaknesses. the required steps are as follows: ensure that you generate typelibs for all of your com interfaces; ensure that those interfaces are registered; register any outparams that consist of arrays of interfaces. we will now further detail each of these items: generating typelibs for all com interfaces you first need to include a library statement in your idl. when midl processes your idl, it generates c c...
Accessible Toolkit Checklist
the standard window class msctls_statusbar32. make sure that parent-child relationships are exposed correctly in each window's msaa tree general msaa support focus events handling event callbacks, which requires a unique id for each non-windowed child of every widget that can be focused or have any other event associated with it. for example, a unique child id would be required for each tree item supporting the most important basic iaccessible events get_accparent: get the parent of an iaccessible. get_accchildcount: get the number of children of an iaccessible. get_accchild: get the child of an iaccessible. get_accname: get the "name" of the iaccessible, for example the name of a button, checkbox or menu item. ...
Add-ons
development resources. for more information about transition support, please visit our wiki page. publishing add-ons addons.mozilla.org, commonly known as "amo," is mozilla's official site for developers to list add-ons, and for users to discover them. by uploading your add-on to amo, you can participate in our community of users and creators and find an audience for your add-on. you are not required to list your add-on on amo, but your add-on must be signed by mozilla else users will not be able to install it. for an overview for the process of publishing your add-on see signing and distributing your add-on. other types of add-ons in addition to extensions, there are a few other add-on types that allow users to customize firefox. those add-ons include: user dictionaries let you spel...
Adding phishing protection data providers
ing a new provider, you should use the next unused number. to find an id number to use, you can build a loop that requests the value of browser.safebrowsing.provider.0.name, then browser.safebrowsing.provider.1.name, and so forth until no value is returned. then you can use that value. you can find examples of how to read and write preferences in the article adding preferences to an extension. required preferences browser.safebrowsing.provider.idnum.name a human-readable name for the data provider. browser.safebrowsing.provider.idnum.keyurl an url that returns a private key to be used for encrypting of other requests. browser.safebrowsing.provider.idnum.lookupurl the url to use to look up urls to see if they're block-listed. this request must be encrypted using the private key ret...
A bird's-eye view of the Mozilla framework
-platform idl), derived from the corba idl. the xpidl interface description is independent of the programming language used to implement the object itself. for example, a javascript object or c++ class could both implement the same xpidl interface. scripting languages such as javascript cannot directly access xpcom components, but access them indirectly using xpconnect. xpconnect also provides a required layer for xpcom components written in a scripting language. let’s consider a resource description framework (rdf) example, where rdf is a framework for describing and interchangingmetadata, that is, information about information. in this example, we’re interested in the rdf sub-graph underlying thecontents panel widget within thehelp viewer window. suppose the client already has an nsirdfdat...
Chrome registration
e being mapped from (jar files, local directory, etc.) old-style contents.rdf manifests before the plaintext manifests were introduced (which happened in firefox 1.5, toolkit 1.8), rdf manifests named "contents.rdf" were used to register chrome. this format is deprecated; however, seamonkey versions before version 2 do not support the plaintext manifest format yet, so contents.rdf manifests are required for extensions that wish to maintain backwards compatibility with firefox 1.0 or the suite. gecko 1.9.2 note the contents.rdf manifest format is no longer supported at all starting with gecko 1.9.2; add-ons already installed using this format will continue to work but can no longer be installed. be sure to remove your add-on and reinstall it to ensure that it installs correctly after updati...
Debugging Frame Reflow
hat on initial reflow the available height for the outer table frame is unconstrained. the table cell requires its children to compute the mes. it is reported back from the block as: block 02d7bcf8 d=300,300 me=300 the block max. element size is 300 twips. the second table reflow is started at rowg 00b984a4 r=2 a=1500,uc c=1500,uc cnt=879 where the previous information is used. the block has been required to compute the max. element size only once and it 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 displayed 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.
Debugging Table Reflow
roportionconstraint = 3, // 1*, 2*, etc. cols attribute assigns 1* e0proportionconstraint = 4 // 0*, means to force to min width after this follows the width information for each column: widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 the table code knows ten different width's: #define num_widths 10 #define num_major_widths 3 // min, des, fix #define min_con 0 // minimum width required of the content + padding #define des_con 1 // desired width of the content + padding #define fix 2 // fixed width either from the content or cell, col, etc. + padding #define min_adj 3 // minimum width + padding due to col spans #define des_adj 4 // desired width + padding due to col spans #define fix_adj 5 // fixed width + padding due to col spans...
Simple SeaMonkey build
are requirements: the seamonkey build process is both i/o- and cpu-intensive, and can take a long time to build even on modern hardware. minimum and recommended hardware requirements for mozilla development are: recommended: 8gb of ram (having only 4gb ram and 4gb swap may give memory errors during compile) 35 gb free disk space. this will accomodate visual studio 2013 community edition, the required sdks, the mozillabuild package, the mercurial source repository and enough free disk space to compile. a fast ssd is recommended; the firefox build process is i/o-intensive. high speed internet installing build tools if your system is not listed below, see the build prerequisites page. debian linux: # this one-liner should install all necessary build deps sudo aptitude insta...
Commenting IDL for better documentation
ll name of the interface in the description of the method. this will help the tools generate proper links to help make the documentation easier to read and browse through. special commands you can use special commands in your doxygen comments; the ones listed below are interpreted by our tools. using these will help generate much higher quality documentation, faster, with less human intervention required. command details @brief description please only use this to provide a brief description of the interface, keep it short and to the point. do not include more than one brief per interface. @param parameter description every parameter of a method should be documented, only use the parameter name, leave out things like [in]/[out]. @returns description if the method returns something then th...
mach
se.argumentparser.add_argument(). the class and method names can be whatever you want. they are irrelevant to mach. an instance of the @commandprovider class is instantiated by the mach driver if a command in it is called for execution. the __init__ method of the class must take either 1 or 2 arguments (including self). if your class inherits from object, no explicit __init__ implementation is required (the default takes 1 argument). if your class's __init__ takes 2 arguments, the second argument will be an instance of mach.base.commandcontext. this object holds state from the mach driver, including the current directory, a handle on the logging manager, the settings object, and information about available mach commands. the arguments registered with @commandargument are passed to your method ...
Performance best practices for Firefox front-end engineers
information, and then setting it safely, without causing flushes. promisedocumentflushed is only available to priviledged script, and should be called on the inner window of a top-level frame. calling it on the outer window of a subframe is not supported, and calling it from within the inner window of a subframe might cause the callback to fire even though a style and layout flush will still be required. these gotchas should be fixed by bug 1441173. for now, it is up to you as the consumer of this api to not accidentally write to the dom within the promisedocumentflushed callback. doing so might cause flushes to occur for other promisedocumentflushed callbacks that are scheduled to fire in the same tick of the refresh driver. bug 1441168 tracks work to make it impossible to modify the dom withi...
Firefox and the "about" protocol
see firefox reader view for clutter-free web pages about:rights displays rights information about:robots special page showing notes about robots about:serviceworkers displays currently running service work...
mozbrowseractivitydone
ccess) { console.log('activity completed successfully'); } else { console.log('activity not completed successfully'); } }); related events mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserasyncscroll
ozbrowserasyncscroll", function( event ) { console.log("the scroll top position of the document is:" + event.details.top + "px"); }); related events mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowseraudioplaybackchange
queryselector("iframe"); browser.addeventlistener("mozbrowseraudioplaybackchange", function(event) { console.log(event.details); }); related events mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsercaretstatechanged
ryselector("iframe"); browser.addeventlistener("mozbrowsercaretstatechanged", function( event ) { // do stuff with event.details }); related events mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserclose
erclose", function() { console.log("browser window has been closed; iframe will be destroyed."); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsercontextmenu
rowsercontextmenu", function(event) { console.log("asking for menu:" + json.stringify(event.details)); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserdocumentfirstpaint
ventlistener("mozbrowserdocumentfirstpaint", function() { console.log("first content painted."); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsererror
istener("mozbrowsererror", function( event ) { console.log("an error occurred:" + event.detail); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserfindchange
" + event.details.activematchordinal + " out of " + event.details.numberofmatches); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserfirstpaint
ddeventlistener("mozbrowserfirstpaint", function(event) { console.log("first content painted."); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsericonchange
riconchange", function( event ) { console.log("the url of the new favicon is:" + event.details.href); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserloadend
olor; }); browser.addeventlistener('mozbrowserloadend',function() { stopreload.textcontent = 'r'; }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserloadstart
= 'x'; }); browser.addeventlistener('mozbrowserloadend',function() { stopreload.textcontent = 'r'; }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserlocationchange
browser.addeventlistener('mozbrowserlocationchange', function (event) { urlbar.value = event.detail.url; }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsermanifestchange
rowsermanifestchange", function(event) { console.log("new manifest url: " + event.details.href); }); related events mozbrowserasyncscroll mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsermetachange
". ...
mozbrowseropentab
wseropentab", function( event ) { console.log("a new document has opened containing the content at " + event.details.url + "."); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserresize
rresize", function( event ) { console.log("the new window size is " + event.details.width + " x " + event.details.height + "."); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserscroll
{ console.log("the new scroll position is " + event.details.left + " across and " + event.details.top + "down."); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserscrollareachanged
tion( event ) { console.log("the new scroll area is " + event.details.width + " x " + event.details.height + "."); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserscrollviewchange
er.addeventlistener("mozbrowserscrollviewchange", function( event ) { console.log("scrolling has " + event.details.state + "."); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsersecuritychange
); browser.addeventlistener("mozbrowsersecuritychange", function( event ) { console.log("the ssl state is:" + event.details.state); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowserselectionstatechanged
ible) { console.log("the current selection is visible."); } else { console.log("the current selection is not visible."); } }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsershowmodalprompt
sershowmodalprompt", function( event ) { console.log("asking for prompt:" + json.stringify(event.detail)); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsertitlechange
zbrowsertitlechange", function( event ) { console.log("the title of the document is:" + event.detail); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowserusernameandpasswordrequired ...
HTMLIFrameElement.setVisible()
ay also be large incompatibilities between implementations and the behavior may change in the future. the setvisible() method of the htmliframeelement is used to change the visibility state of the browser <iframe>. the visible state of a browser <iframe> has nothing to do with its actual visibility (which is handled through css). the visible state is used to define the level of resources required by the browser <iframe>. if the visible state is set to true, it means that the browser <iframe> should have high priority over the resources needed to render and handle its content. on the contrary, if its visible state is set to false, it has low priority over the resources it needs. as an example, if the content of a browser <iframe> uses the window.requestanimationframe method and if the vis...
Browser API
nged sent when the text selected inside the browser <iframe> content changes. note that this is obsolete, and newer implementations use mozbrowsercaretstatechanged instead. mozbrowsershowmodalprompt sent when alert(), confirm(), or prompt() are called within a browser <iframe>. mozbrowsertitlechange sent when the document title changes within a browser <iframe>. mozbrowserusernameandpasswordrequired sent when an http authentification is requested. mozbrowseropensearch sent when a link to a search engine is found. mozbrowservisibilitychange sent when the visibility state of the current browser iframe <iframe> changes, for example due to a call to setvisible(). specifications this api isn't part of any official specification. ...
Embedding Tips
embedders may wish to override some of the default service implementations with their own. for example, the default prompt service uses xul to render prompt dialogs and embedders may wish to render them in a way more appropriate for their application and platform.. ...
Roll your own browser: An embedding how-to
like that isn't totally obvious, nonetheless it has to be done. here is that effort. i have created a directory under embedding called config. ...
How to get a stacktrace with WinDbg
at the bottom. before debugging can start, several commands must be entered into the one-line input box at the bottom of the command window. tip: all commands must be entered exactly as written, one line at a time, into the bottom of the command box. copying and pasting each line is the easiest method to avoid mistakes some commands start with a period (.) or a pipe character (|), which is required. (the keystroke for a pipe character on us keyboards is shift+\) submit the log file on a bug or via the support site, even if nothing seems to happen during the debug process start debugging now that firefox is opened in the debugger, you need to configure your windbg to download symbols from the mozilla symbol server. to load the symbols, enter the three commands below, pressing enter afte...
How to investigate Disconnect failures
main thread is blocked). crashes (not freezes) if we have a crash we always should submit it. under about:crashes we have links to all the crashes submitted by firefox to crash-stats. from there use “signature” as summary for bugzilla bug. in “extensions” check installed addons and check if they might be responsible for the failure. 3. single out the failing test or shorten the required tests needed to reproduce. 4. reproduce manually if possible. file a bug once you found what caused the failure, file a new bug; if you could make it reproducible, narrow down the test case as much as you can so we can see what causes the failure. ...
JavaScript-DOM Prototypes in Mozilla
if such objects are provided, they are not guaranteed by any specification to have any effect on the environment. results in other browsers is not guaranteed. so how does all this work in the mozilla dom code? it all happens in xpconnect and nsdomclassinfo.{cpp,h} in t...
AddonManager
all that has been canceled. addoninstall errors constant description error_network_failure a network error occurred. error_incorrect_hash the downloaded file did not match the expected hash. error_corrupt_file the file appears to be corrupt. error_file_access there was an error accessing the filesystem. error_signedstate_required the addon must be signed and isn't. update check reasons constant description update_when_user_requested an update check performed at the explicit request of the user. update_when_new_app_detected an update check performed when a new version of the application has been detected. update_when_new_app_installed an update check performed afte...
Download
download is stopped, and optionally removes any partial data kept as part of a canceled or failed download. after this method has been called, the download cannot be started again. note: this method should be used in place of the cancel() and removepartialdata() methods while shutting down or disposing of the download object, to prevent other callers from interfering with the operation. this is required because cancellation and other operations are asynchronous. promise finalize( boolean aremovepartialdata ); parameters aremovepartialdata optional whether any partially downloaded data should be removed after the download has been stopped. the default is false. promise resolves to undefined when the operation has finished successfully. ...
FileUtils.jsm
tart from (see getting special files for more info) patharray an array of path components to locate beneath the directory specified by key. the last item in this array must be the leaf name of a file. followlinks optional true if links should be followed, false otherwise. return value returns a nsifile object for the file specified. the file is not created if it does not exist, however all required directories along the way are. getdir() gets a directory at the specified hierarchy under a nsidirectoryservice key. nsifile getdir( string key, array patharray, bool shouldcreate, bool followlinks ); parameters key the nsidirectoryservice key to start from (see getting special files for more info) patharray an array of path components to locate beneath the directory specified ...
Following the Android Toasts Tutorial from a JNI Perspective
s article will follow the android developers :: api guides - toasts tutorial. it will use the jni.jsm module that is available in firefox for android since version 17. this article teaches developers how to port java code to jni by reading the java and android documentation. toast description a toast provides simple feedback about an operation in a small popup. it only fills the amount of space required for the message, and the current activity remains visible and interactive. for example, navigating away from an email before you send it triggers a "draft saved" toast to let you know that you can continue editing later. toasts automatically disappear after a timeout. toasts do not have to be created with jni; they are exposed by the nativewindow feature on firefox for android, see toast documen...
JavaScript OS.Constants
tem-specific constants. this module is largely a companion to js-ctypes. using os.constants from the main thread to initialize os.constants for use in the main thread, add the following snippet to your code: components.classes["@mozilla.org/net/osfileconstantsservice;1"]. getservice(components.interfaces.nsiosfileconstantsservice). init(); from a chrome worker no initialization is required. module os.constants is always available for chrome workers. os.constants.sys constants related to system configuration. name the name of the operating system (e.g. "darwin"). debug set to true on debug build configurations, non-existent otherwise. os.constants.path paths of well-known files and directories. libxul the path to the file containing ...
NetUtil.jsm
am, ostream, function(aresult) { if (!components.issuccesscode(aresult)) { // an error occurred! } }) asyncfetch() the asyncfetch() method opens an input source, asynchronously, and gives an nsiinputstream containing the data obtained to the callback provided. the callback may then consume data from the input stream passed to the callback. note: prior to gecko 2, the input source was required to be specified as an nsichannel. note: support for specifying an nsiinputstream as the input source was added in gecko 5. asyncfetch( asource, acallback ); parameters asource the source to open asynchronously. this may be specified as an nsiuri, nsifile, nsichannel, nsiinputstream or as a string specifying the url to open. acallback a function that will be called when the open o...
OS.File for the main thread
thod will neuter the array buffer. options an object that may contain the following fields tmppath if null or unspecified, write the data directly to path. if specified, write the data to a temporary file called tmppath and, once the write is complete, rename the file to replace path. performing this operation is a little slower but also a little safer. firefox 25 note tmppath is required in firefox 24 or lower version, but optional in firefox 25 or higher version nooverwrite if specified and true, and if path already exists, this function will throw an error without overwriting path. flush if false or unspecified, return immediately once the write is complete. if true, before writing, force the operating system to write its internal disk buffers to the disk. this is consider...
PerfMeasurement.jsm
umber of times memory accesses missed the cache. branch_instructions uint64 the number of branch instructions executed. branch_misses uint64 the number of times branch prediction guessed wrong. bus_cycles uint64 the number of memory bus cycles that elapsed. page_faults uint64 the number of page exceptions the os handled. major_page_faults uint64 the number of times page faults required disk access. context_switches uint64 the number of context switches that occurred involving the thread being profiled. cpu_migrations uint64 the number of times the profiled thread migrated from one cpu core to another. event types measured constant the eventsmeasured constant provides a mask indicating which event types were recorded. variable type description eventsmeasured even...
PromiseWorker.jsm
ed by the worker thread, which is created by promiseworker.jsm in main thread, to communicate with the main thread. promiseworker.js provides abstractworker. here's the simplified diagram of how promiseworker works (svg version of the promiseworker diagram) setup and usage this section explains how to set up and use a promiseworker. as well known with workers, there is a minimum of two files required. the worker file, and the main thread file. the following sections tell you which content to use in your worker and main thread files, in order to use promiseworker objects. worker file there is some standard templating that must be dropped into the worker file by the developer. the require.js file must be imported with workerglobalscope/importscripts(). next, the promiseworker.js file should b...
Using JavaScript code modules
a javascript code module is simply some javascript code located in a registered location. the module is loaded into a specific javascript scope, such as xul script or javascript xpcom script, using components.utils.import() or components.utils["import"](). ...
WebRequest.jsm
name type description name string header name, for example "content-type" value string header value, for example "image/png" chrome incompatibilities although this api is modeled on chrome's webrequest extension api, there are some differences. we're working on addressing them, though. filtering by windowid and tabid is not supported. the onauthrequired, onbeforeredirect, and onerroroccurred events are not supported. the "requestbody" instruction in opt_extrainfospec is not supported. redirection is not allowed in onbeforerequest or onheadersreceived, but is allowed in onbeforesendheaders. see bug 1176092. handlerbehaviorchanged() is not supported. requestid is not included in the argument passed to the listener. examples basic examples ...
Index
of translating software user interfaces from one language to another and adapting it to suit a foreign culture. these resources are for anyone with an interest in the technical aspects involved in localization. 2 application translation with mercurial android, draft, editing, firefox, lightning, localization, mercurial, seamonkey, translate, patch, thunderbird first, get the required programs to compile mozilla applications like firefox and thunderbird from build instructions. this is only necessary once. 3 bootstrapping a new locale localization, mercurial, translate, bit bucket (see also https://developer.mozilla.org/en/create_a_new_localization) 4 encodings for localization files internationalization, localization when creating a l...
Localization content best practices
double quotation marks, respectively. the pair should be used to surround statements and references to user input. example: you have chosen a keyword that is currently in use by "%s". please select another. example: search %1$s for "%2$s" non-directional single, and double, quotation marks should be used in reference to html code, or other languages where ascii character usage is required, such as html. html does not prefer one over the other, and our codebase uses them interchangeably as of march 2016. example: this web page at <span id='malware_sitename'/> has been reported as an attack page and has been blocked based on your security preferences. u+2026 (\u2026) is the horizontal ellipsis character. this character should be used in place of three consecutive periods. crea...
Initial setup
re's what you do: look through the existing localization community directory to see if one already exists for your locale. if a community already exists, reach out to them and ask how you can help. if a community doesn't exist, send an email to the new-locales newsgroup for additional guidance. accounts there are a handful of accounts that you need to be aware of as you begin. they're not required for you to begin contributing, but will be required when you are preparing to produce an official release. for now, simply be aware that these will become important as your efforts progress. these accounts will store your code, contributions, and help you produce an official localization. hg (mercurial) mercurial is the revision control environment that houses the main mozilla source code as ...
QA phase
gs let's now push this changeset. enter the following command: hg push http://hg.mozilla.org/l10n-central/x-testing mercurial will connect to your repo and ask you to provide your account information (i.e., the username and the password). real url is http://hg.mozilla.org/l10n-central/x-testing pushing to http://hg.mozilla.org/l10n-central/x-testing searching for changes http authorization required realm: hg.mozilla.org http user: your_id password: after you enter your account information, the changeset will be pushed. adding changesets adding manifests adding file changes added 1 changesets with 2 changes to 2 files bb/acl: your_id is allowed. accepted payload. quota: 979.7 kb in use, 150.0 mb available (0.64% used) your changeset has been successfully pushed to your repository! as y...
Creating localizable web applications
nf->url('/'));?> </h1> snippet 10. better: <h1> <a href="<?= $locale_conf->url('/') ?>"> <img src="/static/img/logo.png" alt="<?= /* l10n: link title attribute */ _("mozilla labs personas"); ?> " /> </a> </h1> ...but don't sacrifice flexibility don't sacrifice flexibility trying to satisfy the rule above. make sure the content supports changing the order of the sentence, which may be required by some grammars. snippet 1. bad: <p class="added"><?= _("<strong>added:</strong>") . $persona['date']; ?></p> snippet 2. bad: <p class="added"><strong><?= _("added:") ?></strong><?= $persona['date']; ?></p> snippet 3. good: <p class="added"><? printf( /* l10n: %s is a date */ _("<strong>added:</strong> %s"), $persona['date']);?></p> the first bad snippet puts the <strong/> html elements i...
Basics
o><mo mathvariant="bold">...</mo> </mstyle> </mfrac> </mrow> </mstyle> </mfrac> </mrow> </mstyle> </mfrac> </mrow> </mstyle> </mfrac> </mrow> </mstyle> </mfrac> </mrow> </math> </button> </div> for more information about mathml in mozilla, see the mathml project page. there are links to more samples, screenshots and instructions on how to download fonts for various platforms. these fonts are required to view other examples beyond the basic constructions illustrated here. mathml background image html content <div class="background"></div> <math display="block"> <mrow> <msub> <mi>z</mi> <mi>&alpha;</mi> </msub> <mrow> <mo>(</mo> <mi>f</mi> <mo>)</mo> </mrow> <mo>=</mo> <mfrac> <mn>1</mn> <mrow> <mn>2</mn> <mi>i</mi> <mo>&thinspace;</mo> <mi>cos</mi> <mo>(</mo> <mfrac> <mrow> <mi>&alpha;...
Fonts for Mozilla's MathML engine
this wiki page describes how users can install and use such math fonts with mozilla's mathml engine. note that most of these instructions may as well apply to other web rendering engines. installation instructions windows install the latin modern math and stix fonts as follows: download latinmodern-math-1959.zip. open the zip archive, move inside the latinmodern-math-1959 directory and then inside the otf directory. you will find a latinmodern-math font file. open the latinmodern-math font file and click the install button. download stixv2.0.2.zip. ...
Mozilla DOM Hacking Guide
(cx, obj, ::js_getstringchars(str), ::js_getstringlength(str), v, nsnull, nsnull, 0)) { return ns_error_failure; } // this js api call defines the "location" property on the window object, its // value being the xpconnect wrapper for the location object. *objp = obj; return ns_ok; } this is the first step. it is required to have the getter for .location work as well, but that's another story. the second step is to map .location to .location.href in nswindowsh::setproperty() if (str == slocation_id) { // setting the location property jsstring *val = ::js_valuetostring(cx, *vp); ns_ensure_true(val, ns_error_unexpected); // convert the value assigned to location (i.e. the url) to a jsstring. nscomptr<nsisupp...
GPU performance
nvidia parallel nsight - haven't tried. amd gpu shaderanalyzer - will compile a shader and show the machine code and give static pipeline estimations. not that useful for firefox because all of our shaders are pretty simple. ...
JS::PerfMeasurement
ructions .branch_instructions branch instructions executed ::branch_misses .branch_misses branch instructions that were not predicted correctly ::bus_cycles .bus_cycles total memory bus cycles ::page_faults .page_faults total page-fault exceptions fielded by the os ::major_page_faults .major_page_faults page faults that required disk access ::context_switches .context_switches context switches involving the profiled thread ::cpu_migrations .cpu_migrations migrations of the profiled thread from one cpu core to another these events map directly to "generic events" in the linux 2.6.31+ <linux/perf_event.h> interface, and so unfortunately are a little vague in their specification; for...
Memory Profiler
firefox developer tools now has a built-in memory profiler. this article details how to use an old profiler specifically designed for firefox os devices. getting the profiler add-on the built-in memory profiler's interface is still under construction. it can be obtained by installing the memory profiler add-on. you may need to set the "xpinstall.signatures.required" pref to false in order to install it, since the xpi is not yet signed. using the add-on open the devtools panel or webide. select the memoryprofiler tab. to take a profile you can use the buttons in the profiler panel. start - start profiling stop - stop profiling reset - clear profile data when profiler is stopped profile data is accumulated and resumed after start. use reset to start a new recording. understan...
Profiling with Xperf
this page applies to xperf version 4.8.7701 or newer. to see your xperf version, either run 'xperf' on a command line with no arguments, or start 'xperfview' and look at help -> about performance analyzer. ...
Profiling with the Firefox Profiler
will invoke bash to use adb and addr2line. install the latest pre-release build in your host machine's firefox browser that has your phone reachable via adb. this will add a icon in the top right of the browser. set devtools.debugger.remote-enabled to true in about:config for fennec. select target mobile usb and press connect. the first run will take an additional 1 minute or so to pull in the required system libraries. profiling firefox startup start your firefox with the environment variable moz_profiler_startup=1 set. this way the profiler is started as early as possible during startup. then capture the profile using the add-on as usual. startup profiling does not use the settings that you configured in the add-on's panel. it uses settings that can be configured with the environment ...
about:memory
this "explicit" value at the root of the tree represents all the memory allocated via explicit calls to allocation functions. the "window-objects" sub-tree represents all javascript window objects, which includes the browser tabs and ui windows. for example, the "top(http://edition.cnn.com/, id=8)" sub-tree ...
Performance
benchmarking tips on generating valid performance metrics. performance best practices in extensions a performance "best practices" guide for extension developers. ...
Firefox Sync
count, authentication and key management. all data is encrypted and decrypted on each device; no sync data is ever transmitted to a server without being encrypted. mozilla does not hold any keys to your sync data. your data can only be decrypted by someone who is able to log in to your firefox account (ie, that knows your firefox accounts password and has access to your email for the verification required during the initial login). documentation this document serves as an index for all technical documentation related to sync. it is not designed for use by end-users, but instead for people who wish to understand the details of how sync is implemented or wish to interact with it. general the always prolific richard newman has written a couple of notes about bookmark syncing (first, second) and h...
Installing JSHydra
building jshydra jshydra requires, as part of its build process, spidermonkey. by default, the configure script will obtain a known working copy of spidermonkey; it is possible via the --moz-src and --moz-obj configure arguments to tell jshydra to use existing copies of the source and build. ...
L20n HTML Bindings
one file (~110kb) one file, minified (~35kb) it's recommended to include the l20n.js file as the last script in the head element. <head> … <script src="l20n.js"></script> </head> create manifest use a localization manifest to define available languages and their resource files. <link rel="localization" href="../locales/manifest.json"> an example of the manifest file (all keys are required): { "locales": [ "en-us", "pl"], "default_locale": "en-us", "resources": [ "../locales/{{locale}}/strings.l20n", "/shared/{{locale}}/date.l20n"¨ ] } make html elements localizable use the data-l10n-id attribute on an html element to mark it as localizable. <p data-l10n-id="about"></p> notice that you don't have to put the text content in the html anymore (you still can if ...
Cached Monitors
e hash table as needed. important cached monitors are slower to use than their uncached counterparts. see monitors for information about uncached monitors. cached monitors functions cached monitors allow the client to associate monitoring protection and state change synchronization in a lazy fashion. the monitoring capability is associated with the protected object only during the time it is required, allowing the monitor object to be reused. this additional flexibility comes at the cost of a small loss in performance. pr_centermonitor enters the lock associated with a cached monitor. pr_cexitmonitor decrements the entry count associated with a cached monitor. pr_cwait waits for a notification that a monitor's state has changed. pr_cnotify notifies a thread waiting for a change in the s...
Introduction to NSPR
le interaction between the thread(s) waiting on a condition and those notifying it. the notification must take place within a monitor--the same monitor that protects the data being manipulated by the notifier. in pseudocode, the sequence looks like this: enter(monitor); ... manipulate the monitored data notify(condition); exit(monitor); notifications to a condition do not accumulate. nor is it required that any thread be waiting on a condition when the notification occurs. the design of the code that waits on a condition must take these facts into account. therefore, the pseudocode for the waiting thread might look like this: enter(monitor) while (!expression) wait(condition); ... manipulate monitored data exit(monitor); the need to evaluate the boolean expression again after rescheduling fr...
Named Shared Memory
e application's address space. pr_attachsharedmemory may also be called to remap a shared memory segment after detaching the same prsharedmemory object. be sure to detach it when you're finished. pr_detachsharedmemory should be called to unmap the shared memory segment from the application's address space. pr_closesharedmemory should be called when no further use of the prsharedmemory object is required within a process. following a call to pr_closesharedmemory, the prsharedmemory object is invalid and cannot be reused. pr_deletesharedmemory should be called before process termination. after you call pr_deletesharedmemory, any further use of the shared memory associated with the name may cause unpredictable results. filenames the name passed to pr_opensharedmemory should be a valid filename f...
Network Addresses
f internet protocol version 6 (ipv6). to facilitate the transition to ipv6, it is recommended that clients treat all structures containing network addresses as transparent objects and use the functions documented here to manipulate the information. if used consistently, this api also eliminates the need to deal with the byte ordering of network addresses. typically, the only numeric declarations required are the well-known port numbers that are part of the prnetaddr structure. network address types and constants prhostent prprotoent pr_netdb_buf_size network address functions initializing a network address pr_initializenetaddr facilitates the use of prnetaddr, the basic network address structure, in a polymorphic manner. by using these functions with other network address functions, cli...
PRThread
an nspr thread. syntax #include <prthread.h> typedef struct prthread prthread; description in nspr, a thread is represented by a pointer to an opaque structure of type prthread. this pointer is a required parameter for most of the functions that operate on threads. a prthread* is the successful result of creating a new thread. the identifier remains valid until it returns from its root function and, if the thread was created joinable, is joined. ...
PRThreadScope
sophisticated scheduling techniques. local threads are scheduled by nspr within the process. the process is assumed to be globally scheduled, but nspr can manipulate local threads without system intervention. in most cases, this leads to a significant performance benefit. however, on systems that require nspr to make a distinction between global and local threads, global threads are invariably required to do any form of i/o. if a thread is likely to do a lot of i/o, making it a global thread early is probably warranted. on systems that don't make a distinction between local and global threads, nspr silently ignores the scheduling request. to find the scope of the thread, call pr_getthreadscope. ...
PR_EXTERN
used to define the prototypes for functions or variables that are to be exported from a shared library. syntax #include <prtypes.h> pr_extern(type)prototype description pr_extern is used to define externally visible routines and globals. for syntax details for each platform, see prtypes.h. the macro includes the proper specifications to declare the target extern and set up other required linkages. warning: some platforms do not allow the use of the underscore character (_) as the first character of an exported symbol. ...
PR_PushIOLayer
...
Process Initialization
prcalloncetype prcalloncefn pr_callonce ...
NSS FAQ
Mozilla › Projects › NSS › FAQ
http? yes, tls is independent of application protocols. it works with common internet standard application protocols (http, pop3, ftp, smtp, etc.) as well as custom application protocols using tcp/ip. how long does it take to integrate nss into my application? the integration effort depends on an number of factors, such as developer skill set, application complexity, and the level of security required for your application. nss includes detailed documentation of the ssl api and sample code that demonstrates basic ssl functionality (setting up an encrypted session, server authentication, and client authentication) to help jump start the integration process. however, there is little or no documentation currently available for the rest of the nss api. if your application requires sophisticated cer...
FIPS Mode - an explanation
ocols, and firefox can only talk to those servers that use fips standard encryption algorithms such as aes or triple-des. servers that can only use non-fips-approved encryption, such as rc4, cannot be used in fips mode. how is fips mode different from normal non-fips mode? in normal non-fips mode, the "master password" is optional and is allowed to be a weak short password. the user is only required to enter his master password to use his own private keys (if he has any) or to access his stored web-site passwords. the user is not required to enter the master password to visit ordinary https servers, nor to view certificates he has previously stored. in non-fips mode, nss is willing and able to use popular non-fips approved cryptographic algorithms, such as rc4 and md5, to communicate with ...
Using JSS
Mozilla › Projects › NSS › JSS › Using JSS
se a binary release of jss, here's how to get jss working with your code. gather components setup your runtime environment initialize jss in your application gather components you need the jss classes and the nspr, nss, and jss shared libraries. nspr and nss shared libraries jss uses the nspr and nss libraries for i/o and crypto. jss version 3.0 linked statically with nss, so it only required nspr. jss versions 3.1 and later link dynamically with nss, so they also require the nss shared libraries. the exact library names vary according to the convention for each platform. for example, the nspr library is called nspr4.dll or libnspr4.dll on windows and libnspr4.so on solaris. the following table gives the core names of the libraries, omitting the platform-specific prefix and suffix.
NSS 3.12.6 release notes
rvers have been upgraded. nss_ssl_require_safe_negotiation values: 1: requiresafenegotiation = true unset: requiresafenegotiation = false controls whether safe renegotiation indication is required for initial handshake. if true, a connection will be dropped at initial handshake if the peer server or client does not support safe renegotiation. the default setting for this option is false. these options can also be set with the following ssl options: ssloptions.enablerenegotiation ssloptions.requiresafeneg...
NSS 3.14.2 release notes
_ext_key_usage_ctl_signing notable changes in nss 3.14.2 bug 805604 - support for aes-ni and avx accelerated aes-gcm was contributed by shay gueron of intel. if compiled on linux systems in 64-bit mode, nss will include runtime detection to check if the platform supports aes-ni and pclmulqdq. if so, nss uses the optimized code path, reducing the cpu cycles per byte to 1/20 of what was required before the patch (https://bugzilla.mozilla.org/show_bug.cgi?id=805604 and https://crypto.stanford.edu/realworldcrypto/slides/gueron.pdf). support for other platforms, such as windows, will follow in a future nss release. (https://bugzilla.mozilla.org/show_bug.cgi?id=540986) sqlite has been updated to 3.7.15. note: please apply the patch in https://bugzilla.mozilla.org/show_bug.cgi?id=837799 if ...
NSS 3.19.2 release notes
oke existing nss applications that need to generate or use such keys, via apis such as seckey_creatersaprivatekey or seckey_createdhprivatekey. in nss 3.19.2, this change in freebl behaviour has been reverted. the fix for bug 1138554 has been moved to libssl, and will now only affect the minimum keystrengths used in ssl/tls. note: future versions of nss may increase the minimum keysizes required by the freebl module. consumers of nss are strongly encouraged to migrate to stronger cryptographic strengths as soon as possible. bugs fixed in nss 3.19.2 this bugzilla query returns all the bugs fixed in nss 3.19.2: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.19.2 compatibility nss 3.19.2 shared l...
NSS 3.24 release notes
nfigservercert function has been added for configuring ssl/tls server sockets with a certificate and private key. use this new function in place of ssl_configsecureserver, ssl_configsecureserverwithcertchain, ssl_setstapledocspresponses, and ssl_setsignedcerttimestamps. ssl_configservercert automatically determines the certificate type from the certificate and private key. the caller is no longer required to use sslkeatype explicitly to select a "slot" into which the certificate is configured (which incorrectly identifies a key agreement type rather than a certificate). separate functions for configuring online certificate status protocol (ocsp) responses or signed certificate timestamps are not needed, since these can be added to the optional sslextraservercertdata struct provided to ssl_configse...
NSS 3.48 release notes
ded master secret is enabled by default, where possible. see bug 1575411 for details. the master password pbe now uses 10,000 iterations by default when using the default sql (key4.db) storage. because using an iteration count higher than 1 with the legacy dbm (key3.db) storage creates files that are incompatible with previous versions of nss, applications that wish to enable it for key3.db are required to set environment variable nss_allow_legacy_dbm_iteration_count=1. applications may set environment variable nss_min_mp_pbe_iteration_count to request a higher iteration count than the library's default, or nss_max_mp_pbe_iteration_count to request a lower iteration count for test environments. see bug 1562671 for details. certificate authority changes the following ca certificates were add...
NSS API Guidelines
porting!) from the tag for your build, this saves you from messing around with specific files revision numbers. header files we have a preferred naming system for include files. we had been moving towards one, for some time, but for the nss 3.0 project we finally wrote it down. data types function prototypes public nss____t.h nss____.h friend (only if required) nss____tf.h nss____f.h nss-private ____t.h ____.h module-private ____tm.h ____m.h the files on the right include the files to their left; the files in a row include the files directly above them. header files always include what they need; the files are protected against double inclusion (and even double opening by the compiler). note: it's not necess...
NSS sources building testing
st be possible to successfully use the command "ping $host.$domsuf" on your computer (ping reports receiving replies). on many computers the variables host=localhost domsuf=localdomain works. in case you built nss in 64 bits, you need to set the use_64 environment variable to 1 to run the tests. if you get name resolution errors, try to disable ipv6 on the loopback device. after you have set the required environment variables, use "cd nss/tests" and start the tests using "./all.sh". the tests will take a while to complete; on a slow computer it could take a couple of hours. once the test suite has completed, a summary will be printed that shows the number of failures. you can find the test suite results in directory nss/../tests_results (i.e. the results directory ends up next to the nss directo...
nss tech note2
0]: cka_token = ck_true [1] 1024[805ef10]: cka_label = localhost.nyc.rr.com [20] 1024[805ef10]: rv = 0x0 4. collect performance data. this mode is most useful in optimized builds. the number of calls to each pkcs #11 function will be counted, and the time spent in each function as well. a summary of performance data is dumped during nss shutdown. no additional environment variables are required for this mode. if the environment variable nss_output_file is set, its value will be used as the path name of the file to which the final output will be written. otherwise, the output will be written to stdout. ...
nss tech note6
nss .chk files for the fips 140 mode nss technical note: 6 in nss 3.8, we added checksum files required for the nss softoken to operate in fips 140 mode. the new checksum file is called libsoftokn3.chk on unix/linux and softokn3.chk on windows. it must be put in the same directory as the nss libraries. the libsoftokn3.chk/softokn3.chk file contains a checksum for the softoken. when in fips 140 mode, the softoken is required to compute its checksum and compare it with the value in libsoftokn3.chk/softokn3.chk. the following applies to nss 3.8 through 3.10 : on 32-bit solaris sparc (i.e., not x86, and not 64-bit sparc) and 32-bit hp-ux pa-risc (i.e., not itanium, and not 64-bit pa-risc), there are two more .chk files: libfreebl_pure32_3.chk and libfreebl_hybrid_3.chk. the following ap...
Overview of NSS
testing the nss software crypto module has been validated three times for conformance to fips 140 at security levels 1 and 2. for more information, see the nss fips page (or this one). the nss libraries passed the niscc tls/ssl and s/mime test suites (1.6 million test cases of invalid input data). complete software development kit in addition to libraries and apis, nss provides security tools required for debugging, diagnostics, certificate and key management, cryptography module management, and other development tasks. nss comes with an extensive and growing set of documentation, including introductory material, api references, man pages for command-line tools, and sample code. nss is available as source and shared (dynamic) libraries. every nss release is backward compatible with previous ...
NSS PKCS11 Functions
o make this unique. minpwlen then minimum password length for this token. flags a comma separated list of flag values, parsed case-insensitive. valid flags are: readonly - databases should be opened read only. nocertdb - don't try to open a certificate database. nokeydb - don't try to open a key database. forceopen - don't fail to initialize the token if thedatabases could not be opened. passwordrequired - zero length passwords are not acceptable(valid only if there is a keydb). optimizespace - allocate smaller hash tables and lock tables.when this flag is not specified, softoken will allocatelarge tables to prevent lock contention. for more info on module strings see pkcs11_module_specs. this function will return a reference to a slot. the caller is responsible for freeing the slot reference wh...
PKCS 12 functions
the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
PKCS 7 functions
the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. the nss version column indicates which versions of nss support the function. ...
Build instructions
with the native compiler. use_64: on platforms that support both 32-bit and 64-bit abis, tells nss to build for the 64-bit abi. default is 32-bit abi, except on platforms that do not support a 32-bit abi. moz_debug_symbols: tells nss to build with debug symbols, even in an optimized build. on windows, in both debug and optimized builds, when using msvc, tells nss to put symbols in a .pdb file. required to build with msvc 8 (2005 express). default is not to put debug symbols into optimized builds, and for msvc, is to put symbols into the .exe or .dll file. nsdistmode: if set to 'copy', mozilla/dist/<obj_stuff>/bin/* real files instead of symbolic links. these variables should be either undefined, or set to "1". results are undefined for variables set to "0". for windows, install the mozillab...
NSPR functions
these nspr functions are listed in this section. nspr initialization and shutdown nspr is automatically initialized by the first nspr function called by the application. call pr_cleanup to shut down nspr and clean up its resources. pr_cleanup error reporting nss uses nspr's thread-specific error code to report errors. ...
NSS environment variables
od when few servers have been upgraded. [2|r|r]: ssl_renegotiate_requires_xtn (default) only allows renegotiation if the peer's hello bears the tls renegotiation_info extension. this is the safe renegotiation. 3.12.5 modified in 3.12.6 nss_ssl_require_safe_negotiation boolean (1 to enable) it controls whether safe renegotiation indication is required for initial handshake. in other words a connection will be dropped at initial handshake if a server or client do not support safe renegotiation. the default setting for this option is false. 3.12.5 nss_ssl_server_cache_mutex_timeout integer (seconds) timeout time to detect dead or hung process in multi-process ssl server. default is 30 seconds. 3.4 nss_strict_nof...
NSS tools : crlutil
hould be set to 0 since this is non-critical extension date: invalidity date of a cert. date should be represented in generalizedtime format (yyyymmddhhmmssz). usage the certificate revocation list management tool's capabilities are grouped as follows, using these combinations of options and arguments. options and arguments in square brackets are optional, those without square brackets are required. see "implemented extensions" for more information regarding extensions and their parameters. * creating or modifying a crl: crlutil -g|-m -c crl-gen-file -n nickname [-i crl] [-u url] [-d keydir] [-p dbprefix] [-l alg] [-a] [-b] * listing all crls or a named crl: crlutil -l [-n crl-name] [-d krydir] * deleting crl from db: crlutil -d -n nickname [-d keydir] [-p dbprefix] * erasing...
NSS reference
these functions are listed in this section. error codes based on "nss and ssl error codes" in the ssl reference. nss environment variables nss cryptographic module nss tech notes nss tech notes nss memory allocation tools based on nss tools documentation. based on nss tools man pages : work in progress ...
NSS Tools crlutil
be set to 0 since this is non-critical extension date: invalidity date of a cert. date should be represented in generalizedtime format (yyyymmddhhmmssz). usage the certificate revocation list management tool's capabilities are grouped as follows, using these combinations of options and arguments. options and arguments in square brackets are optional, those without square brackets are required. -g|-m -c crl-gen-file -n nickname [-i crl] [-u url] [-d keydir] [-p dbprefix] [-l alg] [-a] [-b] -l [-n crl-name] [-d krydir] crlutil -d -n nickname [-d keydir] [-p dbprefix] crlutil -e [-d keydir] [-p dbprefix] crlutil -i -i crl [-t crltype] [-u url] [-d keydir] [-p dbprefix] [-b] creating or modifying a crl: listing all crls or a named crl: deleting ...
NSS tools : crlutil
Mozilla › Projects › NSS › tools › crlutil
to 0 since this is non-critical extension date: invalidity date of a cert. date should be represented in generalizedtime format (yyyymmddhhmmssz). usage the certificate revocation list management tool's capabilities are grouped as follows, using these combinations of options and arguments. options and arguments in square brackets are optional, those without square brackets are required. see "implemented extensions" for more information regarding extensions and their parameters. * creating or modifying a crl: crlutil -g|-m -c crl-gen-file -n nickname [-i crl] [-u url] [-d keydir] [-p dbprefix] [-l alg] [-a] [-b] * listing all crls or a named crl: crlutil -l [-n crl-name] [-d krydir] * deleting crl from db: crlutil -d -n nickname [-d key...
Necko Architecture
interface in hand (nsiurl), you have a completely parsed representation of the original url string, and you can query for the various parts of the url. handlers & channels nsichannel provides a data access interface which allows you to read or write data from or to a uri. there is a 1-to-1 relationship between uris and channels (if you go so far as to create a channel from a uri, which is not required if all you need is a parsed representation of a uri string). for every uri you want to transact with, there is exactly one channel. in order to get a channel from a uri an intermediary layer was introduced. because a uri has no self knowledge about what "protocol" it represents, another component is responsible for deciding which channel implementation will be responsible for "loading" the uri. t...
Necko walkthrough
::onmsgnewtransaction nshttpconnectionmgr::processnewtransaction (notice the check that we're on gsocketthread) gets conn info (i.e. hostname and port) from the transaction, and then gets or creates a connection entry from the connection table, an nsclasshashtable<nscstringhashkey, nsconnectionentry> called mct in nshttpconnectionmgr. if a connection entry already exists matching the required conn info, then that one will be used; otherwise a new one is created (makenewconnection - creates socket etc.). note: nsconnectionentry has a single nshttpconnectioninfo object attached, a pending queue of nshttptransactions, and 3 arrays for connections: active nshttpconnections idle nshttpconnections nshalfopensockets nshttpconnectionmgr::trydispatchtransa...
Renaming With Pork
this describes how to use pork to rewrite source code. most refactoring toolchains are ui-based. typically they require loading the entire project into an ide. usually, ides require one to use their build system. pork does not yet have a ui, but it is also build-system agnostic and scales to large codebases. these notes are based on tools pork refactoring toolchain [required]. see installing pork. filterdiff from patchutils renaming a class 1. make two copies of the source(analysis and test). this isn't strictly required, but will save time. 2. the first copy will be an analysis copy. convince gcc to create annotated .ii files while compiling the analysis copy. typically, make cxxflags="-wp,-k,-w0 -save-temps" will work. note the -k,-w0 options are passed down to the mcpp prepr...
Rhino FAQ
5); then if you wish to assign the string "hi" to the first element, simply execute stringarray[0] = "hi". creating arrays of primitive types is slightly different: you must use the type field. for example, creating an array of seven ints can be done with the code var intarray = java.lang.reflect.array.newinstance(java.lang.integer.type, 7); when i try to execute a script i get the exception required security context missing. what's going on? you've likely missed placing the security.properties file in your class path at org.mozilla.javascript.resources. can i use rhino in a web browser? rhino is a library for java use, and not for general web browsers. however, a java-based browser may use rhino with scripts from a page in the same manner that any other java program would. ...
Rhino overview
of an object that implements the securitysupport interface. this will provide rhino the support functionality it needs to perform security-related tasks. second, the value of the property security.requiresecuritydomain should be changed to true in the resource bundle org.mozilla.javascript.resources.security. the value of this property can be determined at runtime by calling the issecuritydomainrequired method of context. setting this property to true requires that any calls that compile or evaluate javascript must supply a security domain object of any object type that will be used to identify javascript code. in a typical client embedding, this object might be a string with the url of the server that supplied the script, or an object that contains a representation of the signers of a piece of ...
The JavaScript Runtime
...
Rhino scopes and contexts
simple embeddings of rhino probably won't need any of the information here, but more complicated embeddings can gain performance and flexibility from the techniques described below. contexts the rhino context object is used to store thread-specific information about the execution environment. there should be one and only one context associated with each thread that will be executing javascript. ...
Rebranding SpiderMonkey (1.8.5)
ent wherever you see the text $brand you will substitute that text with the name of your brand. for example the default brand for spidermonkey 1.8.5 is 'mozjs185'. mkdir build-$brand-release cd build-$brand-release configure this build of spidermonkey with the desired options. for example: ../configure --enable-ctypes --with-system-nspr note: your desired configuration may be different. the only required part in this step is the ../configure command. so far, so good. now for the tricky parts. we need to perform a recursive find and replace text operation on all files in the current directory. in the unix world we would issue the following command: find ./ -type f -exec sed -i "s/mozjs185/$brand/" {} \; windows users: notepad++ can be used to perform the recursive find and replace text operation.
Creating JavaScript jstest reftests
e test262 format, which you can see in the test262 git repository and read about here. an update script exists in the js/src/tests directories to fetch and reformat the test262 suite, see test262-update.py. writing a new test file please read the high level advice for test writing in the parent article here. jstests has a special requirement: the call to reportcompare in every jstest is required by the test harness. except in old tests or super strange new tests, it should be the last line of the test. comparison functions and shared test functionality the jstest runner loads the code in js/src/tests/shell.js for every test. additionally, it loads every shell.js and broswer.js file in the subdirectories on the path from js/src/tests to the location of your test. if you have functional...
Future directions
onkey api is c++. for the near future, we do not intend to provide a stable api, because too many things are changing. also, we will someday want a more modern c++ api. going forward from now, the api will likely be semi-stable, but there is no guarantee. the public api is gradually moving from jsapi.h and jsfriendapi.h into header files in js/public. much more cleanup and organization is still required. practical coding bits experimental language features new language features (es6+) and apis often get added to spidermonkey while the spec is still being drafted, or before the feature has stabilized. this is good, because it helps the spec work. for these features: do not add vendor prefixes. see http://hsivonen.iki.fi/vendor-prefixes/ for an extended argument. disable the feature before ...
Bytecode Descriptions
t; script->getobject(objectindex + 1) is the raw object. the first time this instruction runs for a given template, it assembles the final value, defining the .raw property on the call site object and freezing both objects. implements: gettemplateobject, steps 4 and 12-16. format: jof_object isconstructing stack: ⇒ js_is_constructing push magicvalue(js_is_constructing). this magic value is a required argument to the jsop::new and jsop::supercall instructions and must not be used any other way. new, supercall operands: (uint16_t argc) stack: callee, isconstructing, args[0], ..., args[argc-1], newtarget ⇒ rval invoke callee as a constructor with args and newtarget, and push the return value. throw a typeerror if callee isn't a constructor. isconstructing must be the value pushed by jsop::i...
Exact Stack Rooting
tializing assignment (e.g., the default constructor followed by operator=) must have a copy constructor available, even if it is not used. since it is never correct to implicitly copy a js::rootedt (more on this in a second) we have deleted the copy constructor from these classes. therefore, we are forced to force you to initialize with constructor syntax. sorry. note 2: in c++, destructors are required to run in declaration order, nicely maintaining our lifo property. however, this does not hold true for temporaries: they are undeclared, after all. some compilers maintain lifo order, some do not. incorrect use of js::rootedt as a temporary will crash at run time. there is also a static constructor method frommarkedlocation() that creates a handle from an arbitrary location. this is used to ma...
Tracing JIT
tly active fragmento. nanojit/regalloc.* nanojit's register allocator. this is a local register allocator, meaning that it does not allocate registers across basic blocks. it is correspondingly very simple: register allocation is done immediately, step-by-step as code is being generated. a running tally is kept of assignments between registers and lir operands, and any time a new lir operand is required in a register a new one is assigned from the list of free registers. when all registers are in use, the least-often-used register currently in use is spilled. nanojit/native*.* the files nativei386.h, nativei386.cpp, nativearm.h, nativearm.cpp, etc. each define architecture-specific methods within the assembler class. only one architecture-specific variant is included into any given build of th...
SpiderMonkey Internals
a second tier jit, code-named ionmonkey was enabled in firefox 18. ionmonkey is an optimizing compiler. self-hosting of built-in functions in js starting with firefox 17, spidermonkey has the ability to implement built-in functions in self-hosted js code. this code is compiled in a special compilation mode that gives it access to functionality that's not normally exposed to js code, but that's required for safe and specification-conformant implementation of built-in functions. all self-hosted code lives in .js files under builtin/. for details on implementing self-hosted built-ins, see self-hosting. file walkthrough jsapi.cpp, jsapi.h the public api to be used by almost all client code. jspubtd.h, jsprvtd.h these files exist to group struct and scalar typedefs so they can be used everywhe...
JS::Add*Root
least until the balancing call to js::remove*root. typically name is a static string constant, identifying the source location of the call to js::addnamed*root for debugging purposes. needs the example for typical usage of the name parameter. all the js::add*root methods are idempotent: multiple calls for the same address will add only one root. correspondingly, only a single js::remove*root is required to unroot the location. on success, these functions return true. otherwise they report an out of memory error and return false. see also mxr id search for js::addvalueroot mxr id search for js::addstringroot mxr id search for js::addobjectroot mxr id search for js::addnamedvalueroot mxr id search for js::addnamedvaluerootrt mxr id search for js::addnamedstringroot mxr id search for js:...
JS::CallArgs
llargsfromvp(unsigned argc, js::value *vp); name type description args unsigned number of argument. (2nd argument of jsnative) vp js::value * a pointer to the argument value array. (3nd argument of jsnative) methods methods of js::callargs method description bool requireatleast(jscontext *cx, const char *fnname, unsigned required) returns true if there are at least required arguments passed in. if false, it reports an error message on the context. methods inherited from js::callargsbase method description unsigned length() const returns the number of arguments.. js::mutablehandlevalue operator[](unsigned i) const returns the i-th zero-indexed argument. js::handlevalu...
JS::GetDeflatedUTF8StringLength
this article covers features introduced in spidermonkey 38 returns the length of the char buffer required to encode given string as utf8. syntax size_t getdeflatedutf8stringlength(jsflatstring* s); name type description s jsflatstring * the pointer to the string to calculate the length. description js::getdeflatedutf8stringlength returns the length of the char buffer required to encode s as utf8. the returned length does not include the null-terminator. see also js::deflatestringtoutf8buffer bug 1034627 ...
JS::PersistentRooted
tentval.construct(rt, js::nullvalue()); // or // persistentval = new js::persistentrootedvalue(rt, js::nullvalue()); // [spidermonkey 38] // persistentval.init(rt, js::nullvalue()); // initialize context and global // ... if (!js_definefunctions(cx, glob, functions)) return 1; // use those function in javascript. // destroy context. // ... // destroy here // required because of maybe or pointer. // persistentrooted itself doesn't require explicit destruction. persistentval.destroy(); // or // delete persistentval; // [spidermonkey 38] // destruction is not required. // destroy runtime. // ... } see also mxr id search for js::persistentrooted mxr id search for js::persistentrootedfunction mxr id search for js::persistentrootedid ...
JS::Value
ymbol &) numbers are stored in a js::value either as a double or as an int32_t. the different representations are visible using the separate int32/double methods but do not affect observable semantics (ignoring performance). the number mutators attempt to use int32_t representation for compatible input values, returning true when int32 could be used and false when double representation was required. any double value may be stored in a js::value, in one of these two representations. the only exception is that only a single nan value can be represented. (note that both -0 and +0 are allowed, and the latter may sometimes be stored using the int32_t representation.) js::value further provides these methods combining various aspects of the above methods: js::objectornullvalue(jsobject*) retu...
JSConvertOp
ch behavior is deprecated. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. description jsconvertop callback specifies conversion behavior for objects having this class, implementing the ecmascript [[defaultvalue]] behavior for them. on success it must return a primitive value in *vp. implementations of this hook have historically been required to accept any type. however, the engine itself only requires support for jstype_string, jstype_number, and jstype_void, if js_convertvalue is not used. if you do not use the js_convertvalue method, you may omit support for other types. (support for the other types may eventually be removed.) the callback returns true to indicate success or false to indicate failure. jsclass hooks jsclass offer...
JSExtendedClass
quality; jsobjectop outerobject; jsobjectop innerobject; jsiteratorop iteratorobject;// added in spidermonkey 1.8 jsobjectop wrappedobject; // added in spidermonkey 1.8 ...and additional reserved fields. }; name type description base jsclass the basic class information and callbacks for this class. this contains some required fields. equality jsequalityop optional. overrides the javascript == and != operators. outerobject jsobjectop optional. return the current outer object. this is used to implement split objects. innerobject jsobjectop optional. return the current inner object. this is used to implement split objects. iteratorobject jsiteratorop added in sp...
JSPropertyOp
on success, the callback returns true. if the property has a stored value, it is then updated to the value left in *vp after the callback. as of spidermonkey 1.7, the value of a property assignment expression, like (a.length = x), is the value of *vp after the setter is called. this is typically the value of the left-hand side after assignment, as opposed to the value of the right-hand side, as required by ecma 262-3 §11.13. this ecmascript incompatibility is observable when assigning to the length property of an array, for example. this incompatibility will be fixed in spidermonkey 1.8; see bug 312354. inherited properties. note that in javascript, an object can inherit properties from its prototype. getters (and sometimes setters; see js_setproperty for details) are called even when the prop...
JS_Add*Root
til the balancing call to js_removeroot. typically name is a static string constant, identifying the source location of the call to js_addnamedroot for debugging purposes. js_dumpnamedroots can be used to access this information from a debugger. all the js_add*root methods are idempotent: multiple calls for the same address will add only one root. correspondingly, only a single js_removeroot is required to unroot the location. on success, these functions return js_true. otherwise they report an out of memory error and return js_false. see also mxr id search for js_addvalueroot mxr id search for js_addstringroot mxr id search for js_addobjectroot mxr id search for js_addnamedvalueroot mxr id search for js_addnamedstringroot mxr id search for js_addnamedobjectroot bug 912581 ...
JS_ConvertArguments
al custom types defined on cx using js_addargumentformatter. for example, if format is "biob", then js_convertarguments converts the first js value in argv into a bool, the second value into a double, the third value into a jsobject *, and the last value into a bool. to skip a given argument, pass an asterisk in the corresponding position in format. if argc is less than the number of arguments required by format, js_convertargument reports an error and returns false. if argc is greater than the number of arguments described in format, the extraneous arguments are ignored. on success, js_convertargument returns true. if any argument conversion fails or there are not enough arguments, it returns false. to perform the opposite conversion, converting values of various c types to an array of jsval...
JS_InstanceOf
te since jsapi 32 description js_instanceof can be used to check whether an object obj is of a particular jsclass. to use it this way, pass null for argv. js_instanceof returns true if obj is of the given class and false otherwise. that is, it returns js_getclass(obj) == clasp. js_instanceof can also be used in native functions to check the class of an argument when a particular class is required. to use it this way, pass the arguments provided by the engine for args with js::callargsfromvp(argc, vp). when args is non-null, js_instanceof behaves as follows. if obj is of the given class, it returns true. otherwise, it returns false; it also reports a typeerror containing the function's name. note that js_instanceof is not the equivalent of the javascript instanceof keyword, which examines...
JS_PropertyStub
default implementations of the required callbacks in jsclass. syntax bool js_propertystub(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandlevalue vp); bool js_strictpropertystub(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandlevalue vp, js::objectopresult &result); // added in spidermonkey 45 bool js_strictpropertystub(jscontext *cx, js::handleobject obj, js::handleid id, bool strict, js::mutablehandlevalue vp); // obsolete since jsapi 39 bool js_resolvestub(jscontext *cx, js::handleobject obj, js::handleid id, bool *resolvedp); // obsolete since jsapi 37 bool js_deletepropertystub(jscontext *cx, js::handleobject obj, js::handleid id, bool *succeeded)...
JS_ReportErrorNumber
this number to errorcallback. the meaning of the error number is up to the application. ... / args ... / const char16_t ** additional arguments for the error message. these arguments must be of type char * for js_reporterrornumber or js_reporterrorflagsandnumber, or char16_t * for js_reporterrornumberuc or js_reporterrorflagsandnumberuc. the number of additional arguments required depends on the error message, which is determined by the errorcallback. callback syntax typedef const jserrorformatstring * (* jserrorcallback)(void *userref, const unsigned errornumber); name type description userref void * the userref pointer that was passed to the reporterrornumber api. errornumber const unsigned the errornumber that was ...
JS_SetContextCallback
nothing and return true if any other value is passed. data void * data specified in js_setcontextcallback. added in spidermonkey 31 typedef enum jscontextop { jscontext_new, jscontext_destroy } jscontextop; enumeration meaning jscontext_new js_newcontext successfully created a new jscontext instance. the callback can initialize the instance as required. if the callback returns js_false, the instance will be destroyed and js_newcontext returns null. in this case the callback is not called again. jscontext_destroy one of js_destroycontext, js_destroycontextnogc, or js_destroycontextmaybegc was called. the callback may perform its own cleanup and must always return true. in a debug build, if the callback returns false, the js engine wi...
JS_malloc
ion. apart from whatever is copied, any newly allocated space is uninitialized. js_realloc(cx, null, nbytes) behaves exactly like js_malloc(cx, nbytes). when p is not null, js_realloc(cx, p, 0) behaves like js_free(cx, p) and returns null. js_strdup allocates a copy of the null-terminated string s. on success, it returns a pointer to the copy. if any of these three functions fails to allocate the required amount of memory, it reports an error as though by calling js_reportoutofmemory(cx) and returns null. js_free deallocates a region of memory allocated a previous call to js_malloc, js_realloc, or js_strdup. if p is null, js_free does nothing. once the region of memory is freed, the application must not use it again. for js_realloc and js_free, if p is non-null, cx must be associated with the same...
jschar
ork in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. jschar is the type of javascript "characters", the 16-bit elements that make up strings. jschar, a typedef for the standard c++ type char16_t, will be removed in jsapi 38. functions that use jschar will use char16_t directly. embedder code should use char16_t, too. (see bug 1063962.) as required by the ecmascript standard, ecma 262-3 §4.3.16", javascript strings are arbitrary sequences of 16-bit values. a string may contain unmatched surrogates, which are not valid utf-16. it may also contain zeroes ('\0'). to get the characters of a javascript string, use js_getstringchars. see also bug 1063962 ...
SpiderMonkey 1.8.8
p, jsenumerateop and jspropertyop, have a type change on their arguments to jshandleobject, jshandleid, jshandlemutableobject etc. atleast for the c api this wraps an extra pointer around these objects, so you would cast the argument to jsobject**, in the callback function. removal of jscontext* parameters to many methods the js_getclass method now takes only a jsobject*, where previously it also required a jscontext* in threadsafe builds. (the js_get_class macro abstracting away this difference has accordingly been removed.) javascript shell changes detail added/removed methods here... known issues detail any known issues here... future direction include-followup-on-experimental-library-versioning-scheme-here spidermonkey embedders should also be aware that mozilla has no plans to keep the jsa...
SpiderMonkey 17
p, jsenumerateop and jspropertyop, have a type change on their arguments to jshandleobject, jshandleid, jshandlemutableobject etc. atleast for the c api this wraps an extra pointer around these objects, so you would cast the argument to jsobject**, in the callback function. removal of jscontext* parameters to many methods the js_getclass method now takes only a jsobject*, where previously it also required a jscontext* in threadsafe builds. (the js_get_class macro abstracting away this difference has accordingly been removed.) garbage collection functions now take runtime argument most garbage collection functions now take a runtime argument instead of a context. the one exception to this is js_maybegc which still takes a context as argument. javascript shell changes detail added/removed methods h...
SpiderMonkey 31
ing any runtimes or contexts and before compiling, evaluating, or executing any js script. once this method has been successfully called, it's okay to call js_newruntime and all the other existing spidermonkey apis as usual. once all jsapi operation has completed, the corresponding js_shutdown method uninitializes spidermonkey, cleaning up memory and allocations performed by js_init. it is not required to call js_shutdown at present, but it is strongly recommended: calling it may be required in a future spidermonkey release. javascript shell changes detail added/removed methods here... on posix platforms, building a threadsafe shell no longer requires nspr. embedders still need to build with nspr, as the new wrappers require using spidermonkey internal functions which are not exposed to the ...
Setting up CDT to work on SpiderMonkey
, as is done in the guide for the whole mozilla codebase on mdn, read a log of the build), which can be setup with these simple steps: open the project's properties by selecting its root and clicking "properties" in the "file" menu and select "c/c++ build". under the "builder settings" group tab, deactivate "use default build command". instead, change "build command" to read make -w (this is required because cdt needs detailed information about which directories make operates on, which using -w causes make to provide). change the "build location" to the build directory configured in step 1. for me, that means changing "build directory" to read ${workspace_loc:/spidermonkey/_dbg.obj}. under "behavior", make sure that "enable parallel build" is deactivated, as cdt’s indexer will freak out o...
Shell global objects
he given object's compartment. savestack(object [, shouldignoreselfhosted = true]]) capture a stack back to the first frame whose principals are subsumed by the object's compartment's principals. if shouldignoreselfhosted is given, control whether self-hosted frames are considered when checking principals. callfunctionfromnativeframe(function) call function with a (c++-)native frame on stack. required for testing that savestack properly handles native frames. callfunctionwithasyncstack(function, stack, asynccause) call function, using the provided stack as the async stack responsible for the call, and propagate its return value or the exception it throws. the function is called with no arguments, and this is undefined. the specified asynccause is attached to the provided stack frame. enable...
TPS Formdata Lists
date: the date the form data was used, expressed in hours from the present, so 0 means now, and -24 means 24 hours ago. optional, defaults to 0. ...
TPS History Lists
there are two types of history asset lists, one used for adding/modiyfing/verifying history, and the other for deleting history. the history list used for operations other than delete has the following properties: uri: required. title: optional. the page title for this uri. visits: required. an array of objects representing visits to the page, each object has the following properties: type: required. an integer value from one of the transition types listed at https://developer.mozilla.org/en/nsinavhistoryservice#constants. date: required. an integer representing when the visit took place, expressed in hours from the present. for example, 0 is now, -24 is 24 hours in the past. for example: var history_initial = [ { uri: "http://www.google.com/", title: "google", visits: [ { ty...
TPS Password Lists
miturl: "http://login.example.com", username: "joe", password: "secret123", usernamefield: "uname", passwordfield: "pword", changes: { password: "zippity-do-dah" } }, { hostname: "http://www.example.com", realm: "login", username: "joe", password: "secretlogin" } ]; each object has the following properties: hostname: the hostname for the password. required. submiturl: the submit url for the password. optional. used for passwords in form fields. realm: the http realm for the password. optional. used for http authentication passwords. username: required. password: required. usernamefield: the username field for a form password. optional. passwordfield: the password field for a form password. optional. changes: an object containing any of the above pr...
TPS Tab Lists
a tabs asset list is an array of objects with the following keys: uri: the uri of the tab, required. title: the title of the tab, optional. if specified, only used during verify actions. profile: the name of the profile the tab belongs to. required for verify actions. for example: var tabs1 = [ { uri: "http://hg.mozilla.org/automation/crossweave/raw-file/2d9aca9585b6/pages/page1.html", title: "crossweave test page 1", profile: "profile1" }, { uri: "data:text/html,<html><head><title>hello</title></head><body>hello</body></html>", title: "hello", profile: "profile1" } ]; tab lists and phase actions tabs cannot be modified or deleted, only added or verified with the following functions: tabs.add - opens the specified tabs in the browser window. tabs.veri...
TPS Tests
ber of sections, each involving the same or different profiles, so that one test file may be used to test the effect of syncing and modifying a common set of data (from a single sync account) over a series of different events and clients. set up an environment and run a test to run tps, you should create a new firefox account using a restmail.net email address (strictly speaking, restmail isn't required, but it will allow tps to automatically do account confirmation steps for you. even if you opt not to use restmail, do not use your personal firefox account, as tps will delete and replace the data in it many times, not to mention the first run is very likely to fail, since it expects a clean start). note: be prepared not to use your computer for 15 or so minutes after starting a full run of tp...
Thread Sanitizer
xflags="-fsanitize=thread -fpic -pie" # additionally, we need the tsan flag during linking. normally, our c/cxxflags would # be used during linking as well but there is at least one place in our build where # our cflags are not added during linking. ...
Web Replay
nfrastructure to work, and in handling the different graphics and ipc pathways on different platforms. comparison with other projects there is lots of existing work in this area. the closest projects are rr, webkit's replay project, and microsoft's time-travel debugger. compared to rr: this should work on all platforms and architectures supported by gecko, though with substantial port work required. this will be part of gecko itself, rather than a separate tool, which means both that developers won't need additional software to use it and that this can't be used to debug other software. this can use multiple cores during recording and replay. this does not preserve exact behavior. context switches can occur at different times and data races can lead to different behavior between recordin...
Secure Development Guidelines
contains various state information instruction pointer (eip) points to register being executed; can’t be modified directly introduction: gaining control (2) eip is modified using call or jump instructions attacks usually rely on obtaining control over the eip otherwise the attacker can try to control memory pointed to by an existing function pointer a vulnerability is required to modify the eip or sensitive memory saved return addr or function pointer get altered introduction: gaining control (3) common issues used to gain control buffer overflows format string bugs integer overflows/underflows writing secure code: input validation input validation most vulnerabilities are a result of un-validated input always perform input validation cou...
Gecko states
n be selected. applied to: events: concomitant state: state_selected state_linked indicates that the object is formatted as a hyperlink. the object role will usually be role_text_leaf. state_traversed the object is a hyperlink that has been visited (previously clicked) by a user. state_multiselectable supports multiple selection state_extselectable supports extended selection state_required indicates that user interaction is required. state_important isn;t used. state_invalid indicates a validation failure. ext_state_supports_autocompletion for editable areas that have any kind of autocompletion ext_state_defunct object no longer exists ext_state_selectable_text for text which is selectable, object must implement nsiaccessibletext ext_state_editable implements nsiacc...
XForms Accessibility
have describedby attribute. state it is formed as well from model item properties (mips) of instance node that xforms element is bound to as from valid/invalid or in-range/out-of-range states of instance node. instance node states are mapped to accessibility state constants declared in nsiaccessiblestates interface like it shown below: relevant - state_unavailable readonly - state_readonly required - state_required invalid - state_invalid out of range - state_invalid attributes redefines datatype aria attribute. its value is xml schema builit-in datatype of instance node that xforms element is bound to. children mozilla xforms implementation allows form control elements to have child elements. therefore accessible children are formed from any accessible child elements of form control...
Places Developer Guide
term for a set of apis for managing browsing history and uri metadata first introduced in firefox 3. it encompasses history, bookmarks, tags, favicons, and annotations. there are two models of identity in the system: uris, and unique integer identifiers for items in the bookmark system. some of the apis are uri-centric, some use item ids. the api signature and context usually make clear which is required. bookmarks the toolkit bookmarks service is nsinavbookmarksservice: var bookmarks = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); this service provides methods for adding, editing and deleting items in the bookmarks collection. types in the bookmark system there are the four types of items in the bookmarks system, and their identifiers...
The Publicity Stream API
. possible error codes include: denied - if the user refuses to publicize the activity permissiondenied - if the publicizing site is not allowed to post to the publicity stream networkerror - if the publicity server is unreachable activityparseerror - if the activity contains syntax errors (not proper json) invalidactivity - if the activity contains semantic errors (i.e. missing required properties) finally, the publicizeactivity() function will throw an exception if required arguments are missing, or if unsupported arguments are present. getpublicitystream( onsuccess: <function>, { [ onerror: <function> ], [ for_apps: <list> ], [ since: <date> ], [ before: <date> ], [ count: <int> ]): provides a means for a web store to receive a list of the current user's socially ...
Bundling multiple binary components
since binary components are linked against a single gecko sdk, a dependency to a particular version of gecko is created. if the component uses only "frozen" xpcom interfaces, there is a good chance the same binary component will work with different versions of gecko (version 1.8 and 1.9, for example). the more likely case is that the component uses "unfrozen" interfaces and those interfaces can change between gecko versions. this can create a difficult situation for extension developers trying to support multiple gecko versions (firefox 2 and 3, for example). ...
An Overview of XPCOM
ration return type. xpcom method declarations should use this as their return type. ns_imethodimp method implementation return type. xpcom method implementations should use this as their return type. ns_imethodimp_(type) special case implementation return type. some methods such as addref and release do not return the default return type. this exception is regrettable, but required for com compliance. ns_import forces the method to be resolved internally by the shared library. ns_export forces the method to be exported by the shared library. reference counting these macros manage reference counting. ns_addref calls addref on an nsisupports object. ns_if_addref same as above but checks for null before calling addref. ...
Component Internals
nterfaces that aren't frozen. unless an interface is explicitly marked "frozen" in the idl comments, your component may possibly break or crash along with a version change. the glue library in general, you should avoid any interfaces, symbols in xpcom, or other part of gecko libraries that aren't frozen. however, there are some unfrozen tools in xpcom that are used so often they are practically required parts of component programming. the smart pointer class, nscomptr, for example, which makes reference counting less tedious and error-prone, is not actually frozen, and neither is nsdebug, a class for aiding in tracking down bugs, nor is nsmemory, a class to ensure that everyone uses the same heap, generic factory, and module. instead of asking every developer to find and copy these various file...
Finishing the Component
weblock_contractid, pr_true, pr_true, &previous); if (previous) nsmemory::free(previous); return rv; } this code adds a new category entry under the topic "content-policy," and it calls addcategoryentry in the same way we did in registering for notifications. a similar step is required for unregistration. implementing the nsicontentpolicy at this point, you can take the weblock component and install it into a gecko installation. when the component is loaded, gecko calls the nsicontentpolicy implementation in weblock on every page load, and this prevents pages from displaying by returning the proper value when the load method is called. the web locking policy that we are goin...
Starting WebLock
would be names and phone numbers. the format of the name-value pair is left up to you. this data structure is more than enough to support the persisting of components that want to be started up. the category name also maps nicely onto the notion of a notification "topic." the topic name could be something like "xpcom-startup", for instance, and the name-value pair could contain the contract ids required to create the components requesting startup. in fact, this is exactly how categories are used to handle registration with xpcom for startup notification. you will see the code which does this in the next section. getting access to the category manager two fields in the nsmodulecomponentinfo structure introduced in the last section are addresses for registration and unregistration callbacks. the...
Creating XPCOM components
xpcom registry manifests registration methods in xpcom autoregistration the shutdown process three parts of a xpcom component library xpcom glue the glue library xpcom string classes creating the component code what we'll be working on component registration the regxpcom program registration alternatives overview of the weblock module source digging in: required includes and constants identifiers in xpcom coding for the registration process the registration methods creating an instance of your component weblock1.cpp using xpcom utilities to make things easier xpcom macros generic xpcom module macros common implementation macros declaration macros weblock2.cpp string classes in xpcom using strings nsembedstring and...
Introduction to XPCOM for the DOM
bject with a method defined on the nsifoo interface. the goal is to retrieve a pointer to the nsifoo interface. to do so, there are two main techniques, and the context should tell you what to use. the first technique is to use a "getter", the second is to use a static cast on the "this" pointer. a getter is a function defined in global scope or in class scope that will "return" a pointer to the required interface. generally getters work like this: first, declare a pointer to an interface, ifooptr without assigning it. pass the address of the pointer to the getter function. the getter function will then assign to the pointer the correct address and will queryinterface the pointer to that interface. ifooptr is now a pointer to an interface assigned to the address of a real object, and you can thus...
Components object
rk for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. warning: this object is only intended for code running with chrome privileges. exposing the object to regular web code was a mistake. if you use this object on your web page, your site might break at any time! in current versions of firefox only a few interfaces required for compatibility are still accessible. don't use components! the components object is the object through which xpconnect functionality is reflected into javascript. the components object is actually a native instance of the nsixpccomponents interface which is reflected into javascript as a top level object using xpconnect. some properties of components require advanced privileges and may not wo...
Language bindings
ting xpcom objects as well as calling methods on them). exposes modules written in the bound language as xpcom objects, thereby enabling all other languages for which xpcom bindings exist to access these modules. since the xpcom layer itself is written in c/c++, its api can be accessed out-of-the-box using c or c++. in order to allow any other language to use the xpcom api, a bridging layer is required. the following bridging layers are currently available: components objectthe components object is the object through which xpconnect functionality is reflected into javascript. the components object is actually a native instance of the nsixpccomponents interface which is reflected into javascript as a top level object using xpconnect.components.classescomponents.classes is a read-only obje...
nsIAccessibleStates
electable 0x02000000 supports extended selection. state_alert_low 0x04000000 this information is of low priority. state_alert_medium 0x08000000 this information is of medium priority. state_alert_high 0x10000000 this information is of high priority. state_protected 0x20000000 maps to gnome's role* atk_role_passwd_text, nothing for java? state_haspopup 0x40000000 new in msaa 2.0. state_required state_alert_low state_important state_alert_medium currently unused. state_invalid state_alert_high indicates a validation failure. state_checkable state_marqueed extended state constants extended state flags (for now non-msaa, for java and gnome/atk support) constant value description ext_state_supports_autocompletion 0x00000001 for editable areas that have any kind of auto com...
nsIAppShellService
ding javascript context. hidesplashscreen() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) remove the splash screen (if visible). this need be called only once per application session. void hidesplashscreen(); parameters none. initialize() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) required initialization routine. void initialize( in nsicmdlineservice acmdlineservice, in nsisupports nativeappsupportorsplashscreen ); parameters acmdlineservice is stored and passed to appshell components as they are initialized. nativeappsupportorsplashscreen is an object that can be queryinterface'd to either an nsinativeappsupport or nsisplashscreen; this object will be used to implemen...
nsIAppStartup
of the process event. hidesplashscreen() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) remove the splash screen (if visible). this need be called only once per application session. void hidesplashscreen(); parameters none. initialize() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) required initialization routine. void initialize( in nsisupports nativeappsupportorsplashscreen ); parameters nativeappsupportorsplashscreen is an object that can be qi'd to either an nsinativeappsupport or nsisplashscreen; this object will be used to implement hidesplashscreen. quit() exit the event loop, and shut down the application. void quit( in pruint32 amode ); parameters amode ...
nsICachingChannel
not_cached will be sent to the listener's onstoprequest if network io is necessary to complete the request. this flag can be used to find out whether fetching this url would cause validation of the cache entry via the network. combining this flag with load_bypass_local_cache will cause all loads to fail. this flag differs from load_only_from_cache in that this flag fails the load if validation is required while load_only_from_cache skips validation where possible. load_check_offline_cache 1 << 27 this load flag causes the offline cache to be checked when fetching a request. it will be set automatically if the browser is offline. this flag will not be transferred through a redirect. load_bypass_local_cache 1 << 28 this load flag causes the local cache to be skipped when fetching a request. u...
nsIChannel
s. exceptions thrown ns_error_already_opened if the channel is reopened ns_error_port_access_not_allowed if the specified port is in the nsioservice forbidden port list. open() synchronously open the channel. note: extensions should not call this method, because it tends to fail when a request is redirected, rather than redirecting transparentlynote: nsichannel implementations are not required to implement this method. moreover, since this method may block the calling thread, it should not be called on a thread that processes ui events. like any other nsichannel method it must not be called on any thread other than the xpcom main thread. nsiinputstream open(); parameters none. return value blocking input stream to the channel's data. exceptions thrown ns_error_in_progress if ...
nsIChannelEventSink
l continue loading as if it received a response of http 200, which includes notifying observers and possibly display or process content attached to the http response. if the sink wants to prevent this loading it must explicitly deal with it, e.g. by calling oldchannel->cancel() there is a certain freedom in implementing this method: if the return-value indicates success, a callback on callback is required. this callback can be done from within asynconchannelredirect() (effectively making the call synchronous) or at some point later (making the call asynchronous). if the return value indicates that an error occurred, in which case an exception is thrown, the redirect is vetoed and no callback must be done. void asynconchannelredirect( in nsichannel oldchannel, in nsichannel newchannel, in uns...
nsIDBChangeListener
or); parameters ainstigator the caller who changed the junk score. this can be used to filter out events that you yourself started. ainstigator may also be null. onhdrpropertychanged() called in the general case where any field may have changed. onhdrpropertychanged is called twice per change. on the first call, aprechange is true, and astatus is undefined. onhdrpropertychanged saves any required status in astatus (such as a filter match). the calling function stores the value of astatus, changes the header ahdrtochange, then calls onhdrpropertychanged again with aprechange false. on this second call, the stored value of astatus is provided, so that any changes may be noted. void onhdrpropertychanged(in nsimsgdbhdr ahdrtochange, in prbool aprechange, ...
nsIDOMWindowInternal
mwindowinternal's functions and attributes are well documented in window, those articles are linked to rather than re-documented. however, they are not guaranteed to document all available arguments (i.e. see window.prompt). method overview firefox 3.5 note the prompt() and find() methods changed in firefox 3.5 to make all their parameters optional; in previous versions, all parameters were required. void alert(in domstring text) boolean confirm(in domstring text) domstring prompt([optional] in domstring amessage, [optional] in domstring ainitial, [optional] in domstring atitle, [optional] in unsigned long asavepassword) void focus() void blur() void back() void forward() void home() void stop() voi...
getFile
dl" ns_xpcom_component_registry_file "comregf" ns_xpcom_xpti_registry_file "xptiregf" ns_xpcom_library_file "xpcomlib" ns_gre_dir "gred" note: on mac os x, up through firefox 34 this is the contents/macos directory within the application's bundle. starting with firefox 35, this is contents/resources. this change was required in order to comply with apple's new gatekeeper v2 rules; without this change, firefox would not work on any mac os x newer than 10.9.4. ns_gre_component_dir "grecomsd" platform-specific locations some symbolic names represent platform-specific locations. the following sections cover these. available on both mac and unix these locations are available on both mac os ...
nsIEventListenerService
inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) implemented by: @mozilla.org/eventlistenerservice;1. to create an instance, use: var eventlistenerservice = components.classes["@mozilla.org/eventlistenerservice;1"] .getservice(components.interfaces.nsieventlistenerservice); universalxpconnect privileges are required to use this service. method overview void geteventtargetchainfor(in nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsidomeventtarget aoutarray); void getlistenerinfofor(in nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsieventlistenerinfo aoutarray)...
nsIFaviconDataCallback
please add a summary to this article. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void oncomplete(in nsiuri auri, in unsigned long adatalen, [const,array,size_is(adatalen)] in octet adata, in autf8string amimetype); methods oncomplete() called when the required favicon's information is available. it's up to the invoking method to state if the callback is always invoked, or called on success only. check the method documentation to ensure that. the caller will receive the most information we can gather on the icon, but it's not guaranteed that all of them will be set. for some method we could not know the favicon's data (it could just be too expensive to...
nsIFeedProgressListener
dleentry( in nsifeedentry entry, in nsifeedresult result ); parameters entry pointer to an nsifeedentry containing information about the entry that was just processed. result pointer to an nsifeedresult containing the current information about the feed being processed. handlefeedatfirstentry() called when the first entry or item in the feed is encountered. in atom, all feed data is required to precede the entries; in rss, this isn't required but is typically the case. in other words, by the time this method is called, it is most likely that most or all of the feed-level metadata has been processed and is available in the received nsifeedresult object. note: if the feed type is one of the entry or item-only types, this event will never be called. void handlefeedatfirstentry( in n...
nsIFilePicker
the operating system's "recent documents" list (if the operating system has one; nothing happens if there is no such concept on the user's platform). this attribute has no effect if private browsing mode is in effect. defaultextension astring the extension for the type of files you want to work with. on some platforms, this is automatically appended to filenames the user enters, if required. specify it without a leading dot, for example "jpg". defaultstring astring the filename, including extension, that should be suggested to the user as a default. this should be set before calling open() or show(). exceptions thrown ns_error_failure if you try to read this attribute. displaydirectory nsilocalfile the directory that the fi...
nsIInputStream
end-of-file. exceptions thrown <other-error> on failure. ns_base_stream_would_block indicates that reading from the input stream would block the calling thread for indeterminate amount of time. this exception may only be thrown if isnonblocking() returns true. native code only!readsegments this method provides direct access to the stream's internal buffer. note: a nsiinputstream is not required to implement this method. in some contexts, readsegments may be guaranteed to be implemented, but in general it is not. this method serves as an optimization. unsigned long readsegments( in nswritesegmentfun awriter, in voidptr aclosure, in unsigned long acount ); parameters awriter the "consumer" of the data to be read. a callback function that may be called once for each buffer seg...
nsIInterfaceRequestor
xpcom/base/nsiinterfacerequestor.idlscriptable this interface defines a generic interface for requesting interfaces that a given object might provide access to. inherits from: nsisupports last changed in gecko 0.9.5 this is similar to nsisupports.queryinterface(). the main difference is that interfaces returned are not required to provide a way back to the object implementing nsiinterfacerequestor. the semantics of nsisupports.queryinterface() dictate that given an interface a that you nsisupports.queryinterface() on to get to interface b, you must be able to nsisupports.queryinterface() on b to get back to a. nsiinterfacerequestor, however, allows you to obtain an interface c from a that may (or most likely) will not have the ability to get back to a. method overview void getin...
nsIJumpListBuilder
tracking up to date by calling the shaddtorecentdocs shell api. jumplist_category_customlist 3 custom lists can be made up of tasks, links, and separators. the title of of the list is passed through the optional string parameter of addbuildlist. methods abortlistbuild() aborts and clears the current jump list build. void abortlistbuild(); parameters none. addlisttobuild() adds a list and if required, a set of items for the list. boolean addlisttobuild( in short acattype, in nsiarray items, optional in astring catname optional ); parameters acattype the type of list to add. items optional an array of nsijumplistitem items to add to the list. catname optional for custom lists, the title of the list. return value true if the operation completed successfully. exceptions thrown ns_error...
Using nsILoginManager
<input type="text" name="uname"> <label>password:</label> <input type="password" name="pword"> </form> creating a site authentication login var authlogininfo = new nslogininfo( 'http://www.example.com', null, 'exampleco login', 'alice', 'secret321', "", "" ); this would correspond to a login on http://www.example.com when the server sends a reply such as: http/1.0 401 authorization required server: apache/1.3.27 www-authenticate: basic realm="exampleco login" creating a local extension login var extlogininfo = new nslogininfo( 'chrome://firefoo', null, 'user registration', 'bob', '123secret', "", "" ); from a component creating a new info block is done slightly differently: var nslogininfo = new constructor("@org/manager/ci.init"); var extlogininfo = new aformsubmitur...
nsILoginManagerStorage
specified as either an nsilogininfo or an nsipropertybag2 object. removealllogins() implement this method to remove all logins from the login store. this is called by the browser sanitization feature when the user asks to clear all stored passwords. the user interface allows this to be done without getting each login first (which might require knowing the master password). no password should be required in order to remove all logins. void removealllogins(); parameters none. removelogin() implement this method to remove the specified login from the login store. gecko 1.9.1 note the values of any nsiloginmetainfo properties are ignored. void removelogin( in nsilogininfo alogin ); parameters alogin the login to remove from the login store. a login must match completely (except for its ns...
Building an Account Manager Extension
cript" src="chrome://example@mozilla.org/content/am-devmo-account.js"/> <dialogheader title="devmo example panel"/> <description> this panel is only shown in imap accounts... </description> <vbox flex = "1"/> </page> as with the xul page, the content of the property file relies on a very strict naming. as our account manager extension is named "devmo-account", we are required to include a property named prefpanel-devmo-account. prefpanel-devmo-account=devmo demo panel step4: the new panel and javascript the javascript for an account manager panel needs to implement at least the following functions. these functions are invoked by the account manager. function onpreinit(account, accountvalues) { } function oninit(pageid, serverid) { } function onaccepteditor() ...
nsIMsgIncomingServer
nal pref key - guaranteed to be unique across all servers. limitofflinemessagesize boolean localpath nsilocalfile localstoretype acstring the schema for the local mail store, such as "mailbox", "imap", or "news" used to construct uris. read only. loginatstartup boolean logonfallback boolean maxmessagesize long offlinesupportlevel long password acstring passwordpromptrequired boolean if the password for the server is available either via authentication in the current session or from password manager stored entries, return false. otherwise, return true. if password is obtained from password manager, set the password member variable. read only. performingbiff boolean port long prettyname astring pretty name - should be "userid on hostname" if the pref is not s...
nsIMsgMessageService
tening to the message headers. the consumer has to be a stream listener and in your listener's ondataavailable method, you can write out the stream data to a local file or concatenate it to a string. aurllistener an nsiurllistener that is notified when url starts and stops, if we run a url. alocalonly whether data should be retrieved only from local caches. if streaming over the network is required and this is true, then an exception is thrown. this defaults to false. note if we're offline, then even if alocalonly is false, we won't stream over the network return the url that gets run, if any ismsginmemcache() determines whether a message is in the memory cache. local folders don't implement this. boolean ismsginmemcache(in nsiuri aurl, in nsimsgfolder afol...
nsIMsgProtocolInfo
ke inbox, trash, etc. read only. methods getdefaultserverport() returns the default port for a connection to a server of this account type. long getdefaultserverport( in boolean issecure ); parameters issecure whether or not the connection will be secure. return value the default port number for connections of this account type. remarks this is one of the interfaces that is required to create a new account type. see also nsimsgincomingserver ...
nsINavBookmarkObserver
ted. in this situation, you should not attempt to get any properties, since this will result in the automatic regeneration of properties that will then be leaked into the database, causing trouble later. aisannotationproperty indicates whether or not aproperty is the name of an item annotation. if this is true, anewvalue is always an empty string. anewvalue the items new value, if required by the property specified by aproperty. alastmodified the value to set the items last modified time to, or 0 if the value should remain unchanged. aitemtype the type of the item that has been changed. this should be one of the nsinavbookmarksservice.type constants. aparentid the id of the folder containing the item. aguid the unique id associated with the item.
nsINavBookmarksService
olbar folder. read only. note: renamed from toolbarroot in gecko 1.9 unfiledbookmarksfolder long long the item id of the unfiled bookmarks folder. read only. constants constant value description default_index -1 this is the default index; this value should be used for apis that allow passing in an index where the index is not known or is not required to be specified, such as when appending an item to a folder. type_bookmark 1 this is an index for type "bookmark". type_folder 2 this is an index for type "folder". type_separator 3 this is an index for type "separator". type_dynamic_container 4 this is an index for type "dynamic container". dynamic containers were removed in gecko 11, b...
nsINavHistoryQuery
te: prtime is in microseconds since 1 jan 1970. javascript date objects are expressed in milliseconds since 1 jan 1970. methods getfolders() this method retrieves all the folders with the folder count. void getfolders( [optional] out unsigned long count, [retval,array,size_is(count)] out long long folders ); parameters count optional the count of the folders. this optional parameter was required prior to gecko 2.0. folders the retrieved folders. setfolders() this method sets the folders with the given folder count. void setfolders( [const,array, size_is(foldercount)] in long long folders, in unsigned long foldercount ); parameters count the count of the folders. folders the folders to be set. clone() this method creates a new query item with the same parameters of this one. ...
nsIPlacesView
rather, each view is responsible for translating its own selection format into one the controller can understand. ...
nsIProtocolProxyService
hod to request that it fail instead of block the calling thread. proxy auto config (pac) may perform a synchronous dns query, which may not return immediately. so, calling resolve without this flag may result in locking up the calling thread for a lengthy period of time. by passing this flag to resolve, one can failover to asyncresolve to avoid locking up the calling thread if a pac query is required. when this flag is passed to resolve, resolve may throw the exception ns_base_stream_would_block to indicate that it failed due to this flag being present. methods resolve() deprecated since gecko 18 this method has been removed in firefox 18. use resolveasync instead previous doc this method returns a nsiproxyinfo instance that identifies a proxy to be used for loading the given u...
nsISHEntry
inherits from: nsihistoryentry last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) implemented by: @mozilla.org/browser/session-history-entry;1. ...
nsITaggingService
tag. gettagsforuri() this method retrieves all tags set for the given uri. nsivariant gettagsforuri( in nsiuri auri, [optional] out unsigned long length, [retval, array, size_is(length)] out wstring atags ); parameters auri the uri for which to return the tags. length optional on return, contains the number of tags returned in atags. this optional parameter was required prior to gecko 2.0. atags on return, contains an array of tags for the specified uri. return value returns array of tags (sorted by name). see also places using the places tagging service ...
nsIUploadChannel
ecifications. for this reason, we have a special meaning for the acontenttype parameter. void setuploadstream( in nsiinputstream astream, in acstring acontenttype, in long acontentlength ); parameters astream the stream to be uploaded by this channel. acontenttype if acontenttype is empty, the protocol will assume that no content headers are to be added to the uploaded stream and that any required headers are already encoded in the stream. in the case of http, if this parameter is non-empty, then its value will replace any existing content-type header on the http request. in the case of ftp and file, this parameter is ignored. acontentlength a value of -1 indicates that the length of the stream should be determined by calling the stream's available method. ...
nsIWebBrowserPersist
ning how data is fetched and saved from the network. it is best to set this value explicitly unless you are prepared to accept the default values. progresslistener nsiwebprogresslistener callback listener for progress notifications. the object that the embbedder supplies may also implement nsiinterfacerequestor and be prepared to return nsiauthprompt or other interfaces that may be required to download data. result unsigned long value indicating the success or failure of the persist operation. read only. constants constant value description persist_flags_none 0 no special persistence behavior. persist_flags_from_cache 1 only use cached data (could result in failure if data is not cached). persist_flags_bypa...
nsIXPConnect
assing in &ns_get_iid(nsisupports) but when passing in null certain shortcuts can be taken because we know without comparing iids that the caller is asking for an nsisupports wrapper. if aallowwrapper, then the returned value will be wrapped in the proper type of security wrapper on top of the xpcwrappednative (if needed). this method doesn't push ajscontext on the context stack, so the caller is required to push it if the top of the context stack is not equal to ajscontext. void wrapnativetojsval( in jscontextptr ajscontext, in jsobjectptr ascope, in nsisupports acomobj, in nswrappercacheptr acache, in nsiidptr aiid, in boolean aallowwrapper, out jsval aval, out nsixpconnectjsobjectholder aholder ); parameters ajscontext missing description ascope missing description aco...
nsIXULAppInfo
he application vendor. this must be ascii, and is normally mixed-case, for example "mozilla". can be an empty string if vendor is not set. read only. version acstring the xul application's version, for example "0.8.0+" or "3.7a1pre". it is different than the version of gecko or the xulrunner platform. be careful about which one you want! can be an empty string, but a valid value is required for xul applications using the extension manager or update service. read only. example display the application and the gecko version in an alert box: var info = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); alert("application version: " + info.version + "\n" + "gecko version: " + info.platformversion); example this exampl...
nsIXULTemplateBuilder
ive match and generates output. the addresult, removeresult, replaceresult and resultbindingchanged methods may be called by the query processor to indicate that the set of valid results has changed, such that a different query may match. if a different match would become active, the content for the existing match is removed and the content for the new match is generated. a query processor is not required to provide any support for updating results after they have been generated. see the template guide for more information about templates. /xul/templates/public/nsixultemplatebuilder.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void rebuild(); void refresh(); void addresult(in nsixultemplateresul...
nsIZipReader
ng containing a 'z', '*~*z*' will match all strings except those containing a 'z'. note that a pattern may not use '~' multiple times, so a string such as '*~*z*~*y*' is not a valid pattern. (foo|bar) will match either the pattern foo or the pattern bar. neither of the patterns foo or bar may use the 'pat~pat2' syntax described immediately above. \ will escape a special character. escaping is required for all special characters unless otherwise specified. all other characters match case-sensitively. an apattern not conforming to this syntax has undefined behavior. return value the nsiutf8stringenumerator containing the matching entry names. exceptions thrown ns_error_illegal_value on many but not all invalid apattern values. getcertificateprincipal() returns an object desc...
NS_CStringContainerInit
l. otherwise, it returns an error code. remarks this function is equivalent to ns_cstringcontainerinit2(container, nsnull, 0, 0). the nscstringcontainer structure has private members that should not be accessed directly. after a nscstringcontainer object has been initialized via ns_cstringcontainerinit, it may be used as an ordinary nsacstring object. with ns_cstringcontainerinit, the coder is required to call ns_cstringcontainerfinish when done with the nscstringcontainer object. therefore, it is generally better to use nsembedcstring, to instantiate a nsacstring object, since it automatically releases allocated memory when the object goes out of scope. example nscstringcontainer str; if (ns_succeeded(ns_cstringcontainerinit(str))) { // now, |str| can be used with any function taking a ns...
NS_StringContainerInit
s ns_ok if successful. otherwise, it returns an error code. remarks the nsstringcontainer structure has unspecified size and layout. its members may not be accessed directly. after a nsstringcontainer object has been initialized, it may be used as an ordinary nsastring object. the internal buffer allocated by a nsstringcontainer is always null-terminated. with ns_stringcontainerinit, the coder is required to call ns_stringcontainerfinish when done with the nsstringcontainer object. therefore, it is generally better to use nsembedstring, to instantiate a nsastring object, since it automatically releases allocated memory when the object goes out of scope. example code nsstringcontainer str; if (ns_succeeded(ns_stringcontainerinit(str))) { // now, |str| can be used with any function taking ...
Working with out parameters
you would implement gettransferdata() as follows: gettransferdata: function(aflavor, adata, adatalen) { .. .. adata.value = resultdata; adatalen.value = resultdata.length; } ...
XSLT 2.0
although xslt 2.0 is not natively supported in firefox, it is possible via saxon-b (java) or, more recently, saxon-ce (javascript) to perform xslt 2.0. for users saxon-ce no extensions are required, saxon-ce runs whenever a html page is loaded that links to the saxon-ce javascript library. saxon-b the xsl results extension uses the new incarnation of liveconnect (handled by java 1.6v12+ instead of mozilla-specific code) to connect with the java-based saxon-b library, and adds support for having xslt performed automatically when visiting a page with the appropriate xslt processing instruction (and which isn't processed by firefox's own xslt 1.0 processor). for developers saxon-ce a javascript api is provided for initiating an xslt 2.0 transform from a web page. error and diagnosti...
Filelink Providers
tself automatically in order to fit the content of the iframe without scrollbars. custom settings fields to handle custom settings, the settings xhtml page should contain a form with the id "provider-form", with its onsubmit attribute set to "return false;". example: <form id="provider-form" onsubmit="return false;"> <label for="username">username:</label> <input id="username" type="text" required="true" /> <label for="server">server:</label> <input id="server" type="text" required="true" /> <label for="port">port:</label> <input id="port" pattern="[0-9]+" required="true" /> </form> the form is expected to use html5 form validation. for each input event, the checkvalidity method of the form is automatically called. the button to set up the account will only become enabled once th...
Index
atabase in your extension you'll need to look over the storage docs for an api reference, however this code should get you started. be careful of multi-thread access to your database. 108 folders and message lists guide, thunderbird 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. 109 thunderbird developer reference docs no summary! 110 tips and tricks from the newsgroups thunderbird the following discussions on mozilla.dev.apps.thunderbird and mozilla.dev.extensions include useful tips for thunderbird add-on developers. please feel free to add links to threads. we w...
MailNews Protocols
rotocol object to run. the service classes usually have their own interface, but they also implement nsimsgmessageservice. a url object. these implement nsimsgmailnewsurl, inherit from base/util/nsmsgmailnewsurl, and implement their own protocol-specific interface (nsiimapurl, nsinntpurl, nsipop3url). a protocol object that takes a url and handles the network communications with the actual server required to run that url. these implement nsimsgprotocol, inherit from nsmsgprotocol, and implement their own protocol-specific interface (nsiimapprotocol, nsipop3protocol, nsinntpprotocol) in addition, in mailnews/db/msgdb/public, we have protocol-specific msg db classes (and in the case of news, a nsinewsdatabase interface), so that we can use polymorphism when msg db operations need to be specialized f...
The libmime module
nue on this method. the easiest way to do this is to make use of the mime_superclass macro that was defined at the top of the file, as shown below. the alternative to that involves typing the literal name of the direct superclass of the class defined in this file, which will be a maintenance headache if the class hierarchy changes. if you use the mime_superclass idiom, then a textual change is required in only one place if this class's superclass changes. static void foobar_finalize (mimeobject *object) { ((mimeobjectclass*)&mime_superclass)->finalize(object); // right parentclass.whatnot.object.finalize(object); // (works...) object->class->superclass->finalize(object); // wrong!! } the class hierarchy is: mimeobject (ab...
Activity Manager examples
////////// //// creating an undoable copy event nscomptr<nsiactivityundohandler> undohandler = new mycopyeventundo(); nscomptr<nsiactivityevent> copyevent(do_createinstance("@mozilla.org/activity-event;1")); // the initiator of this particular event is copyservice. we want to // associate it with the event since we are going to use it in the // undo handler. // same for the source folder, it is required for undo operation, but // since it is the subject of this activity (event), it goes into the // subject list. // wrap copyservice in a nsvariant component nscomptr<nsiwritablevariant> initiator = do_createinstance(ns_variant_contractid); initiator->setasisupports(reinterpret_cast<nsisupports*>(copyservice)); // subject of the delete operation is the imap folder // wrap it in a nsvariant compon...
Folders and message lists
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-displayed folder, just use gfolderdisplay.displayedfolder. ...
Theme Packaging
which will show up in the appearance section of the add-ons manager. install.rdf your install.rdf manifest will look something like this: <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:type>4</em:type> more properties </description> </rdf> required install.rdf properties your install.rdf file must have the following properties. see the install.rdf reference for more information: em:id em:version em:type em:targetapplication em:name em:internalname optional install.rdf properties em:description em:creator em:contributor em:homepageurl em:updateurl note that if your theme will be made available on the https://addons.mozill...
Standard OS Libraries
y have a *special* firefox build for ubuntu?). so des are a stack over wms. there is also a layer known as shell, gnomeshell is the shell used in gnome 3, it is the outter shell. gtk+ is the framework used under firefox (and other mozilla applications like thunderbird). the other framework used in unix systems is qt. firefox is officially supported only for gtk+ at the moment, therefore gtk+ is required for firefox to run. attempting to install firefox on a a non-gtk+ based linux build such as kaosx, which is qt based (details on kaosx at the time of this writing: kdelibs version 4.1.4.3, qt version 4.8.6, 64bit) would install gtk+ libraries along with it in order to enable firefox to work on the qt system. there are rumors of a firefox qt that is in the works. on linux, libraries will be typic...
Flash Activation: Browser Comparison - Plugins
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 required and will become confused. even if the plugin element will eventually be hidden, pages should create the plugin element so that it's visible on the page, and should resize or hide it only after the user has activated the plugin. this can be done by calling a javascript function when the plugin is activated: function plugincreated() { // we don't need to see the plugin, so hide it by resizing ...
Plug-in Development Overview - Plugins
file extensions in alternating strings. for example: str 128 mime type string 1 video/quicktime string 2 mov, moov string 3 audio/aiff string 4 aiff string 5 image/jpeg string 6 jpg several other optional strings may contain useful information about the plug-in. plug-ins must support 'str#' 128 but are not required to support any of these others: 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, wh...
URLs - Plugins
a to post, and len to the length of the buffer. possible url types include http (similar to an html form submission), mailto (sending mail), news (posting a news article), and ftp (uploading a file). for protocols in which the headers must be distinguished from the body, such as http, the buffer or file should contain the headers, followed by a blank line, then the body. if no custom headers are required, simply add a blank line ('\n') to the beginning of the file or buffer. note: you cannot use npn_posturl to specify headers (even a blank line) in a memory buffer. to do this, use npn_posturlnotify for this purpose. § the npn_posturlnotify function has all the same capabilities and works like npn_posturl in most ways except that (1) it supports specifying headers when posting a memory buffer, a...
Debugging service workers - Firefox Developer Tools
ng on one of the caches gives you two options: delete all — delete all caches under this origin. delete "name of cache" — delete only the highlighted cache. you can also click on one of the individual items stored in the cache, then right/ctrl click on it to get options for deleting just that item, or every item in the cache. these options make it much easier to remove a cache if it is required for testing a code update. it is also worth knowing that if you are testing an app's offline capabilities, you'll be able to see whether requests are being retrieved from a service worker-initiated cache rather than from the network by looking at network monitor. resources retrieved from the cache are indicated with service worker in the transferred column. note: there is currently a bug wh...
Source map errors - Firefox Developer Tools
source can be missing or inaccessible. the fix here is to make sure the file is being served and is accessible to the browser invalid source map the source map data can be invalid — either simply not a json file at all, or with an incorrect structure. typical 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 displayed in the source tab in the debugger: networkerror when attempting to fetch resource a bug in firefox prevents it from loading source m...
Edit fonts - Firefox Developer Tools
t characteristics in a much more granular fashion because their allowable ranges are defined by axes of variation (see introducing the 'variation axis' for more information). for example, font-weight can be set to any value between 1 and 1000 in variable fonts (although it is not guaranteed that a variable font will support this entire range). there are several registered axes. although it isn't required that these axes be defined for every font, if the font designer does implement a registered axis, its behavior must follow the defined behavior. all variable font axes have a four-character axis tag. the css font-variation-settings property uses the tag as part of the key-value pair. for example, to set font-weight using font-variation-settings, you could do something like this: font-variation-...
Paint Flashing Tool - Firefox Developer Tools
n are "damaged" and repaint only those. the browser also splits its model of the page into layers that it expects will be updated independently of each other. layers are painted independently and then composited, so a change in the appearance of one layer does not trigger a repaint in any other layers, and when only the relation of two layers changes (in an animation, for example) no repaints are required at all. the choices made by a web developer can hinder the browser here, causing it to trigger more repaints, and for more of the screen, than necessary. this can then cause a site to be slow responding to user input (also known as "janky"). that's where the paint flashing tool helps: by showing you the areas that the browser repaints in response to an event, you can see whether it is repainting...
AbortSignal - Web APIs
properties the abortsignal interface also inherits properties from its parent interface, eventtarget. abortsignal.aborted read only a boolean that indicates whether the request(s) the signal is communicating with is/are aborted (true) or not (false). events listen to this event using addeventlistener() or by assigning an event listener to the oneventname property of this interface. ...
AudioBuffer() - Web APIs
= new audiobuffer(options); parameters inherits parameters from the audionodeoptions dictionary. options options are as follows: length: the size of the audio buffer in sample-frames. to determine the length to use for a specific number of seconds of audio, use numseconds * samplerate. numberofchannels: the number of channels for the buffer. the default is 1, and all user agents are required to support at least 32 channels. samplerate: the sample rate in hz for the buffer. the default is the sample rate of the context used in constructing this object. user agents are required to support sample rates from 8,000 hz to 96,000 hz (but are allowed to go farther outside this range). deprecated parameters context a reference to an audiocontext. this parameter was removed from ...
AudioNode - Web APIs
Web › API › AudioNode
graph as small as possible, and put user-controlled audio nodes at the end of a graph. for example, a volume control (gainnode) should be the last node so that volume changes take immediate effect. each input and output has a given amount of channels. for example, mono audio has one channel, while stereo audio has two channels. the web audio api will up-mix or down-mix the number of channels as required; check the web audio spec for details. for a list of all audio nodes, see the web audio api homepage. creating an audionode there are two ways to create an audionode: via the constuctor and via the factory method. // constructor const analysernode = new analysernode(audioctx, { fftsize: 2048, maxdecibels: -25, mindecibels: -60, smoothingtimeconstant: 0.5, }); // factory method const ...
AudioWorkletGlobalScope - Web APIs
egister it. note that this should be done in a separate file. ...
CSS.registerProperty() - Web APIs
ed property should be inherited (true), or not (false). defaults to false. initialvalue optional a domstring representing the initial value of the defined property. return value undefined. exceptions invalidmodificationerror the given name has already been registered. syntaxerror the given name isn't a valid custom property name (starts with two dashes, e.g. --foo). typeerror the required name and/or inherits dictionary members were not provided. examples the following will register a custom property, --my-color, using registerproperty(), as a color, give it a default value, and have it not inherit its value: window.css.registerproperty({ name: '--my-color', syntax: '<color>', inherits: false, initialvalue: '#c0ffee', }); in this example, the custom property --my-col...
CSSStyleSheet.insertRule() - Web APIs
d. what the inserted rule must contain depends on its type: for rule-sets, both a selector and a style declaration. for at-rules, both an at-identifier and the rule content. index optional a positive integer less than or equal to stylesheet.cssrules.length, representing the newly inserted rule's position in cssstylesheet.cssrules. the default is 0. (in older implementations, this was required. see browser compatibility for details.) return value the newly inserted rule's index within the stylesheet's rule-list. restrictions css has some intuitive and not-so-intuitive restrictions affecting where rules can be inserted. violating them will likely raise a domexception. if index > cssrulelist.length, the method aborts with an indexsizeerror. if rule cannot be inserted at index 0 ...
CanvasRenderingContext2D.clearRect() - Web APIs
eters x the x-axis coordinate of the rectangle's starting point. y the y-axis coordinate of the rectangle's starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. positive values are down, and negative are up. examples erasing the whole canvas this code snippet erases the entire canvas. this is commonly required at the start of each frame in an animation. the dimensions of the cleared area are set to equal the <canvas> element's width and height attributes. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.clearrect(0, 0, canvas.width, canvas.height); erasing part of a canvas this example draws a blue triangle on top of a yellowish background. the clearrect() m...
Basic usage of canvas - Web APIs
eight="150"> current stock price: $3.15 + 0.15 </canvas> <canvas id="clock" width="150" height="150"> <img src="images/clock.png" width="150" height="150" alt=""/> </canvas> telling the user to use a different browser that supports canvas does not help users who can't read the canvas at all, for example. providing a useful fallback text or sub dom helps to make the canvas more accessible. required </canvas> tag as a consequence of the way fallback is provided, unlike the <img> element, the <canvas> element requires the closing tag (</canvas>). if this tag is not present, the rest of the document would be considered the fallback content and wouldn't be displayed. if fallback content is not needed, a simple <canvas id="foo" ...></canvas> is fully compatible with all browsers that support c...
console - Web APIs
Web › API › Console
ser to dismiss the second alert, and then log the ending time to the console: notice that the timer's name is displayed both when the timer is started and when it's stopped. note: it's 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 combined should match what you see in the console output. stack traces the console object also supports outputting a stack trace; this will show you the call path taken to reach the point at which you call console.trace(). given code like this: function foo() { function bar() { con...
ConstrainBoolean - Web APIs
constraint for a property whose value is a boolean value. you can specify an exact value which must be matched, an ideal value that should be matched if at all possible, and a fallback value to attempt to match once all more specific constraints have been applied. properties exact a boolean which indicates a value the property must have. ideal a boolean value indicating the ideal, but not required, value the property should ideally have. if possible, this value will be used, but the user agent will use the other value if it needs to in order to come up with a workable configuration. you can also specify the value of the property as simply true or false, in which case the user agent will use that value if possible once all efforts have been made to match the exact and ideal values for oth...
ConstrainDouble - Web APIs
value as a simple floating-point value, in which case the user agent does its best to match the value once all other more stringent constraints are met. properties if the value of a constraindouble is an object rather than a number, it may have the properties below in addition the properties it inherits from doublerange. exact a double-precision floating-point number specifying a specific, required, value the property must have to be considered acceptable. ideal a double-precision floating-point number specifying a value the property would ideally have, but which can be considered optional if necessary to find a match. specifications specification status comment media capture and streamsthe definition of 'constraindouble' in that specification. candidate reco...
ConstrainULong - Web APIs
. in addition, you can specify the value as a simple long integer value, in which case the user agent does its best to match the value once all other more stringent constraints are met. properties if the value of a constrainulong is an object rather than a number, it may have the properties below in addition to the properties it inherits from ulongrange. exact an integer specifying precise, required, value the property must have to be considered acceptable. ideal an integer specifying a value the property would ideally have, but which can be considered optional if necessary to find a match. specifications specification status comment media capture and streamsthe definition of 'constrainulong' in that specification. candidate recommendation initial definitio...
Crypto.getRandomValues() - Web APIs
illed with random numbers (random in its cryptographic meaning). to guarantee enough performance, implementations are not using a truly random number generator, but they are using a pseudo-random number generator seeded with a value with enough entropy. the pseudo-random number generator algorithm (prng) may vary across user agents, but is suitable for cryptographic purposes. implementations are required to use a seed with enough entropy, like a system-level entropy source. getrandomvalues() is the only member of the crypto interface which can be used from an insecure context. syntax typedarray = cryptoobj.getrandomvalues(typedarray); parameters typedarray an integer-based typedarray, that is an int8array, a uint8array, an int16array, a uint16array, an int32array, or a uint32array. all el...
DOMMatrix - Web APIs
Web › API › DOMMatrix
direction are equal). m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44 double-precision floating-point values representing each component of a 4×4 matrix, where m11 through m14 are the first column, m21 through m24 are the second column, and so forth. a, b, c, d, e, f double-precision floating-point values representing the components of a 4×4 matrix which are required in order to perform 2d rotations and translations. these are aliases for specific components of a 4×4 matrix, as shown below. 2d 3d equivalent a m11 b m12 c m21 d m22 e m41 f m42 methods this interface includes the following methods, as well as the methods it inhe...
DOMMatrixReadOnly - Web APIs
direction are equal). m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44 double-precision floating-point values representing each component of a 4×4 matrix, where m11 through m14 are the first column, m21 through m24 are the second column, and so forth. a, b, c, d, e, f double-precision floating-point values representing the components of a 4×4 matrix which are required in order to perform 2d rotations and translations. these are aliases for specific components of a 4×4 matrix, as shown below. 2d 3d equivalent a m11 b m12 c m21 d m22 e m41 f m42 methods this interface doesn't inherit any methods. none of the following methods alt...
DOMParser - Web APIs
Web › API › DOMParser
outerhtml properties. these properties can also be read to fetch html fragments corresponding to the corresponding dom subtree. syntax let domparser = new domparser()​​ methods domparser.parsefromstring() syntax let doc = domparser.parsefromstring(string, mimetype) return either document or xmldocument depending on the mimetype argument. parameters this method has 2 parameters (both required): string the domstring to be parsed. it must contain either html, xml, xhtml+xml, or svg document. mimetype a domstring. this string determines a class of the the method's return value. the possible values are the following: mimetype doc.constructor text/html document text/xml xmldocument application/xml xmldocument ...
DataTransferItem.type - Web APIs
some example types are: text/plain and text/html. syntax dataitem.type; return value a domstring representing the drag data item's type. example this example shows the use of the type property. ...
Document.getElementById() - Web APIs
if you need to get access to an element which doesn't have an id, you can use queryselector() to find the element using any selector. syntax var element = document.getelementbyid(id); parameters id the id of the element to locate. the id is case-sensitive string which is unique within the document; only one element may have any given id. ...
Document Object Model (DOM) - Web APIs
tedlengthlist svganimatednumber svganimatednumberlist svganimatedpathdata svganimatedpoints svganimatedpreserveaspectratio svganimatedrect svganimatedstring svganimatedtransformlist smil-related interfaces elementtimecontrol timeevent other svg interfaces getsvgdocument shadowanimation svgcolorprofilerule svgcssrule svgdocument svgexception svgexternalresourcesrequired svgfittoviewbox svglangspace svglocatable svgrenderingintent svgstylable svgtests svgtransformable svgunittypes svguseelementshadowroot svgurireference svgviewspec svgzoomandpan svgzoomevent specifications specification status comment dom living standard ...
DoubleRange - Web APIs
mum and minimum value specified. the constraindouble dictionary is based on this, augmenting it to support exact and ideal values as well. properties max a floating-point value specifying the largest permissible value of the property it describes. min a floating-point value specifying the smallest permissible value of the property it describes. the specified min and/or and max values are required. if no match can be found that is within the given range, an error will occur. specifications specification status comment media capture and streamsthe definition of 'doublerange' in that specification. candidate recommendation initial definition ...
DynamicsCompressorNode.attack - Web APIs
it defines how quickly the signal is adapted when its volume is increased. the attack property's default value is 0.003 and it can be set between 0 and 1. syntax var audioctx = new audiocontext(); var compressor = audioctx.createdynamicscompressor(); compressor.attack.value = 0; value an audioparam. note: though the audioparam returned is read-only, the value it represents is not. ...
DynamicsCompressorNode.release - Web APIs
it defines how quick the signal is adapted when its volume is reduced. the release property's default value is 0.25 and it can be set between 0 and 1. syntax var audioctx = new audiocontext(); var compressor = audioctx.createdynamicscompressor(); compressor.release.value = 0.25; value an audioparam. note: though the audioparam returned is read-only, the value it represents is not. ...
DynamicsCompressorNode - Web APIs
de.ratio read only is a k-rate audioparam representing the amount of change, in db, needed in the input for a 1 db change in the output. dynamicscompressornode.reduction read only is a float representing the amount of gain reduction currently applied by the compressor to the signal. dynamicscompressornode.attack read only is a k-rate audioparam representing the amount of time, in seconds, required to reduce the gain by 10 db. dynamicscompressornode.release read only is a k-rate audioparam representing the amount of time, in seconds, required to increase the gain by 10 db. methods no specific methods; inherits methods from its parent, audionode. example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. for a more complete ...
EffectTiming.fill - Web APIs
Web › API › EffectTiming › fill
number of drawbacks: the forwards fill of an animation (or backwards fill if the animation is playing in reverse) will continue to override any changes to specified style indefinitely which can lead to confusing behavior. this is because animations take priority in the css cascade over normal author styles. in order to avoid leaking memory when many filling animations overlap, the browser is required to remove overlapped animations which can lead to surprising results in some cases. rather than using fill modes to persist an animation, it is often simpler to set the final value of the animation effect directly in specified style: elem.animate({ transform: 'translatey(100px)' }, 200).finished.then(() => { elem.style.transform = 'translatey(100px)'; }); alternatively, it may be simpler s...
Element.tabStop - Web APIs
Web › API › Element › tabStop
the tabstop property of the element interface returns a boolean indicating if the element can receive input focus via the tab key. if the specified element is a shadow host tab navigation is delegated to its children. this property was proposed to add tab functionality for custom elements. while with the existing tabindex property, it is required to specify an order for the element to become tabbable. the tabstop property would decouple the tabbable property from the tab index. after feedback, this property was removed from the design doc and replaced by shadowroot.delegatesfocus. syntax var istabstop = element.tabstop; element.tabstop = (true|false); example // tbd ...
EventTarget.addEventListener() - Web APIs
oppropagation() not being supported by internet explorer 8 by using the following code at the beginning of your script. the code supports the use of handleevent() and also the domcontentloaded event. note: usecapture is not supported, as ie 8 does not have any alternative method. the following code only adds ie 8 support. this ie 8 polyfill only works in standards mode: a doctype declaration is required. (function() { if (!event.prototype.preventdefault) { event.prototype.preventdefault=function() { this.returnvalue=false; }; } if (!event.prototype.stoppropagation) { event.prototype.stoppropagation=function() { this.cancelbubble=true; }; } if (!element.prototype.addeventlistener) { var eventlisteners=[]; var addeventlistener=function(type,listener...
Using files from web applications - Web APIs
the visually-hidden technique instead. consider this html: <input type="file" id="fileelem" multiple accept="image/*" class="visually-hidden"> <label for="fileelem">select some files</label> and this css: .visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); } /* separate rule for compatibility, :focus-within is required on modern firefox and chrome */ input.visually-hidden:focus + label { outline: thin dotted; } input.visually-hidden:focus-within + label { outline: thin dotted; } there is no need to add javascript code to call fileelem.click(). also in this case you can style the label element as you wish. you need to provide a visual cue for the focus status of the hidden input field on its label, be it a...
FileError - Web APIs
Web › API › FileError
g its name. invalid_state_err 7 the operation cannot be performed on the current state of the interface object. for example, the state that was cached in an interface object has changed since it was last read from disk. no_modification_allowed_err 6 the state of the underlying file system prevents any writing to a file or a directory. not_found_err 1 a required file or directory could not be found at the time an operation was processed. for example, a file did not exist but was being opened. not_readable_err 4 the file or directory cannot be read, typically due to permission problems that occur after a reference to a file has been acquired (for example, the file or directory is concurrently locked by another application). pat...
FileException - Web APIs
g its name. invalid_state_err 7 the operation cannot be performed on the current state of the interface object. for example, the state that was cached in an interface object has changed since it was last read from disk. no_modification_allowed_err 6 the state of the underlying file system prevents any writing to a file or a directory. not_found_err 1 a required file or directory could not be found at the time an operation was processed. for example, a file did not exist but was being opened. not_readable_err 4 the file or directory cannot be read, typically due to permission problems that occur after a reference to a file has been acquired (for example, the file or directory is concurrently locked by another application). ...
Introduction to the File and Directory Entries API - Web APIs
s impose storage quotas to prevent a web app from using up the entire disk, browsers might impose a quota for each app and allocate storage among web apps. how storage space is granted or allocated and how you can manage storage are idiosyncratic to the browser, so you need to check the respective documentation of the browser. google chrome, for example, allows temporary storage beyond the 5 mb required in the specifications and supports the quota management api. to learn more about the chrome-specific implementation, see managing html5 offline storage. the file and directory entries api has asynchronous and synchronous versions the file and directory entries api comes with asynchronous and synchronous versions. both versions of the api offer the same capabilities and features. in fact, they a...
GlobalEventHandlers.oninvalid - Web APIs
ctionref; var functionref = target.oninvalid; value functionref is a function name or a function expression. the function receives a event object as its sole argument. example this example demonstrates oninvalid and onsubmit event handlers on a form. html <form id="form"> <p id="error" hidden>please fill out all fields.</p> <label for="city">city</label> <input type="text" id="city" required> <button type="submit">submit</button> </form> <p id="thanks" hidden>your data has been received. thanks!</p> javascript const form = document.getelementbyid('form'); const error = document.getelementbyid('error'); const city = document.getelementbyid('city'); const thanks = document.getelementbyid('thanks'); city.oninvalid = invalid; form.onsubmit = submit; function invalid(event) { err...
GlobalEventHandlers.onsubmit - Web APIs
syntax target.onsubmit = functionref; value functionref is a function name or a function expression. the function receives a focusevent object as its sole argument. example this example demonstrates oninvalid and onsubmit event handlers on a form. html <form id="form"> <p id="error" hidden>please fill out all fields.</p> <label for="city">city</label> <input type="text" id="city" required> <button type="submit">submit</button> </form> <p id="thanks" hidden>your data has been received. thanks!</p> javascript const form = document.getelementbyid('form'); const error = document.getelementbyid('error'); const city = document.getelementbyid('city'); const thanks = document.getelementbyid('thanks'); city.oninvalid = invalid; form.onsubmit = submit; function invalid(event) { err...
HTMLDialogElement.returnValue - Web APIs
lue a domstring representing the returnvalue of the dialog. examples the following example displays a button to open a <dialog> containing a form via the showmodal() method. from there, either button will close the dialog. ...
HTMLInputElement: invalid event - Web APIs
if a form is submitted with an invalid value, the submittable elements are checked and, if an error is found, the invalid event will fire on the invalid element. in this example, when an invalid event fires because of an invalid value in the input, the invalid value is logged. ...
HTMLMediaElement.msInsertAudioEffect() - Web APIs
every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the htmlmediaelement.msinsertaudioeffect() method inserts the specified audio effect into the media pipeline. this proprietary method is specific to internet explorer and microsoft edge. syntax htmlmediaelement.msinsertaudioeffect(activatableclassid: domstring, effectrequired: boolean, config); parameters activatableclassid a domstring defining the audio effects class. effectrequired a boolean which if set to true requires an audio effect to be defined. configoptional an optional object to help with defining any additional configuration needed. return value this method does not return a value. see also htmlmediaelement microsoft api extensions ...
HTMLMediaElement.srcObject - Web APIs
o creating a url with url.createobjecturl() and assign it to htmlmediaelement.src. see below for an example. syntax var sourceobject = htmlmediaelement.srcobject; htmlmediaelement.srcobject = sourceobject; value a mediastream, mediasource, blob, or file object (though see the compatibility table for what is actually supported). usage notes older versions of the media source specification required using createobjecturl() to create an object url then setting src to that url. now you can just set srcobject to the mediastream directly. examples basic example in this example, a mediastream from a camera is assigned to a newly-created <video> element. const mediastream = await navigator.mediadevices.getusermedia({video: true}); const video = document.createelement('video'); video.srcobject ...
HTMLVideoElement.msInsertVideoEffect() - Web APIs
user. there may also be large incompatibilities between implementations and the behavior may change in the future. the htmlmediaelement.msinsertvideoeffect() method inserts the specified video effect into the media pipeline. this proprietary method is specific to internet explorer and microsoft edge. syntax str = htmlmediaelement.msinsertvideoeffect(activatableclassid: domstring, effectrequired: boolean, config); parameters activatableclassid a domstring defining the video effects class. effectrequired a boolean which if set to true requires a video effect to be defined. configoptional an optional object to help with defining any additional configuration needed. return value this method does not return a value. example var ovideo1 = document.getelementbyid("video1"); ovid...
HTMLVideoElement.videoHeight - Web APIs
intrinsic width and height a user agent calculates the intrinsic width and height of the element's media by starting with the media's raw pixel width and height, then taking into account factors including: the media's aspect ratio. the media's clean aperture (the sub-rectangle centered within the media that matches the target aspect ratio). the target device's resolution. any other factors required by the media format. if the element is currently displaying the poster 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 d...
HTMLVideoElement.videoWidth - Web APIs
intrinsic width and height a user agent calculates the intrinsic width and height of the element's media by starting with the media's raw pixel width and height, then taking into account factors including: the media's aspect ratio. the media's clean aperture (the sub-rectangle centered within the media that matches the target aspect ratio). the target device's resolution. any other factors required by the media format. if the element is currently displaying the poster 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 d...
Drag Operations - Web APIs
a user begins to drag, the dragstart event is fired. in this example the dragstart listener is added to the draggable element itself. however, you could listen to a higher ancestor as drag events bubble up as most other events do. within the dragstart event, you can specify the drag data, the feedback image, and the drag effects, all of which are described below. however, only the drag data is required. (the default image and drag effects are suitable in most situations.) drag data all drag events have a property called datatransfer which holds the drag data (datatransfer is a datatransfer object). when a drag occurs, data must be associated with the drag which identifies what is being dragged. for example, when dragging the selected text within a textbox, the data associated with the drag d...
Dragging and Dropping Multiple Items - Web APIs
ond item, and its index decreases. // [item1] data=url1, index=0 // [item2] data=url3, index=1 fortunately, you don't normally need to clear items often; it's more common to just add the items only when you know they are needed. common cases where dragging multiple items is used is when dragging multiple files or bookmarks. in this case, add the appropriate formats for each item. although not required, you should always add the same formats for each item. the ensures that receiving drop targets can expect consistent data. to check if multiple files are being dragged, check the mozitemcount property. it will be set to the number of items being dragged. if a particular drop target only supports dropping a single item, it could either reject the dragged items or it could just use just the first ...
HkdfParams - Web APIs
erivekey(), salt does not need to be kept secret. info a buffersource representing application-specific contextual information. this is used to bind the derived key to an application or context, and enables you to derive different keys for different contexts while using the same input key material. it's important that this should be independent of the input key material itself. this property is required but may be an empty buffer. examples see the examples for subtlecrypto.derivekey(). specifications specification status comment web cryptography apithe definition of 'subtlecrypto.hkdfparams' in that specification. recommendation ...
IDBObjectStoreSync - Web APIs
r the records of this object store. the range of the new cursor matches the specified key range; if the key range is not specified or is null, then the range includes all the records. cursorsync opencursor ( in optional keyrange range, in optional unsigned short direction ) raises (databaseexception); parameters range the key range to use as the cursor's range. direction the cursor's required direction. returns idbindexsync an object for accessing the index. exceptions this method can raise a databaseexception with the following code: not_found_err if no records exist in this index for the requested key range. openindex() opens the index with the given name, using the mode of the current transaction. idbindexsync openindex ( in domstring name ) raises (idbdataba...
IDBTransaction - Web APIs
ores and indexes. this mode is for updating the version number of transactions that were started using the setversion() method of idbdatabase objects. transactions of this mode cannot run concurrently with other transactions. transactions in this mode are known as "upgrade transactions." even if these constants are now deprecated, you can still use them to provide backward compatibility if required (in chrome the change was made in version 21). you should code defensively in case the object is not available anymore: var myidbtransaction = window.idbtransaction || window.webkitidbtransaction || { read_write: "readwrite" }; examples in the following code snippet, we open a read/write transaction on our database and add some data to an object store. note also the functions attached to trans...
Browser storage limits and eviction criteria - Web APIs
mation below should be fairly accurate for most modern browsers, but browser specifics are called out where known. opera and chrome should behave the same in all cases. opera mini (still presto-based, server-side rendering) doesn't store any data on the client. what technologies use browser data storage? in firefox, the following technologies make use of browser data storage to store data when required. we term them "quota clients" in this context: indexeddb asm.js caching cache api cookies note: in firefox, web storage will soon start to use the same storage management tools too, as described in this document. note: in private browsing mode, most data storage is not supported. local storage data and cookies are still stored, but they are ephemeral — the data is deleted when you c...
MediaCapabilities.decodingInfo() - Web APIs
example //create media configuration to be tested const mediaconfig = { type : 'file', // or 'media-source' audio : { contenttype : "audio/ogg", // valid content type channels : 2, // audio channels used by the track bitrate : 132700, // number of bits used to encode 1s of audio samplerate : 5200 // nu...
MediaDevices.getDisplayMedia() - Web APIs
raints which are not permitted when calling getdisplaymedia(). these unsupported constraints are advanced and any constraints which in turn have a member named min or exact. usage notes privacy and security because getdisplaymedia() could be used in nefarious ways, it can be a source of significant privacy and security concerns. for that reason, the specification details measures browsers are required to take in order to fully support getdisplaymedia(). the specified constraints can't be used to limit the options available to the user. instead, they must be applied after the user chooses a source, in order to generate output that matches the constraints. the go-ahead permission to use getdisplaymedia() cannot be persisted for reuse. the user must be prompted for permission every time. the...
distinctiveIdentifier - Web APIs
the mediakeysystemconfiguration.distinctiveidentifier read-only property indicates whether a persistent distinctive identifier is required. syntax var distinctiveidentifier = mediasystemconfiguration.distinctiveidentifier; specifications specification status comment encrypted media extensionsthe definition of 'distinctiveidentifier' in that specification. recommendation initial definition ...
persistentState - Web APIs
the mediakeysystemconfiguration.persistentstate read-only property indicates whether the ability to persist state is required. syntax var persistentstate = mediasystemconfiguration.persistentstate; specifications specification status comment encrypted media extensionsthe definition of 'persistentstate' in that specification. recommendation initial definition ...
MediaKeySystemConfiguration - Web APIs
the format of the initialization data. mediakeysystemconfiguration.audiocapabilities read only returns a list of supported audio type and capability pairs. mediakeysystemconfiguration.videocapabilities read only returns a list of supported video type and capability pairs. mediakeysystemconfiguration.distinctiveidentifier read only indicates whether a persistent distinctive identifier is required. mediakeysystemconfiguration.persistentstate read only indicates whether the ability to persist state is required. specifications specification status comment encrypted media extensionsthe definition of 'mediakeysystemconfiguration' in that specification. recommendation initial definition ...
MediaSessionActionDetails.action - Web APIs
syntax let mediasessionactiondetails = { action: actiontype }; let actiontype = mediasessionactiondetails.action; value a domstring specifying which of the action types the callback is being invoked for: nexttrack advances playback to the next track. pause pauses playback of the media. play begins (or resumes) playback of the media. previoustrack moves back to the previous track. seekbackward seeks backward through the media from the current position. seekforward seeks forward from the current position through the media. ...
MediaStreamAudioSourceNode() - Web APIs
method, specifying the stream from which you want to obtain audio. syntax audiosourcenode = new mediastreamaudiosourcenode(context, options); parameters context an audiocontext representing the audio context you want the node to be associated with. options a mediastreamaudiosourceoptions object defining the properties you want the mediastreamaudiosourcenode to have: mediastream a required property which specifies the mediastream from which to obtain audio for the node. return value a new mediastreamaudiosourcenode object representing the audio node whose media is obtained from the specified source stream. exceptions invalidstateerror the specified mediastream doesn't have any audio tracks. examples this example uses getusermedia() to obtain access to the user's camer...
MediaStreamAudioSourceOptions - Web APIs
the mediastreamaudiosourceoptions dictionary provides configuration options used when creating a mediastreamaudiosourcenode using its constructor. it is not needed when using the audiocontext.createmediastreamsource() method. properties mediastream a required property which specifies the mediastream from which to obtain audio for the node. specifications specification status comment web audio apithe definition of 'mediastreamaudiosourceoptions' in that specification. working draft ...
MediaStreamConstraints.audio - Web APIs
value is specified, it simply indicates whether or not an audio track should be included in the returned stream; if it's true, an audio track is included; if no audio source is available or if permission is not given to use the audio source, the call to getusermedia() will fail. if false, no audio track is included. mediatrackconstraints a constraints dictionary detailing the preferable and/or required values or ranges of values for the track's constrainable properties. if you specify constraints, an audio track meeting the constraints is required. examples for browsers with feature policy enabled, the samples below need the microphone feature enabled. see security in mediadevices.getusermedia() for details and examples on how to configure this. using a boolean value in this example, we pr...
MediaStreamConstraints.video - Web APIs
an value is specified, it simply indicates whether or not a video track should be included in the returned stream; if it's true, a video track is included; if no video source is available or if permission is not given to use the video source, the call to getusermedia() will fail. if false, no video track is included. mediatrackconstraints a constraints dictionary detailing the preferable and/or required values or ranges of values for the track's constrainable properties. if you specify constraints, a video track meeting these constraints is required. examples using a boolean value in this example, we provide a simple value of true for the video property. this tells getusermedia() that we require a video track, but we don't care about any specifics beyond that. html content <p>click the st...
MediaStreamTrack.getConstraints() - Web APIs
constraints can be used to ensure that the media meets certain guidelines you prefer. ...
MediaTrackConstraints.autoGainControl - Web APIs
= { autogaincontrol: constraint }; constraintsobject.autogaincontrol = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with automatic gain control enabled or disabled as specified, if possible, but will not fail if this can't be done. if, instead, the value is given as an object with an exact field, that field's boolean value indicates a required setting for the automatic gain control feature; if it can't be met, then the request will result in an error. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'autogaincontrol' in that specification. candidate recommendation ...
MediaTrackConstraints.channelCount - Web APIs
lcount: constraint }; constraintsobject.channelcount = constraint; value if this value is a number, the user agent will attempt to obtain media whose channel count is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required channel count (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. the channel count is 1 for monaural sound, 2 for stereo, and so forth. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamst...
MediaTrackConstraints.echoCancellation - Web APIs
ect = { echocancellation: constraint }; constraintsobject.echocancellation = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with echo cancellation enabled or disabled as specified, if possible, but will not fail if this can't be done. if, instead, the value is given as an object with an exact field, that field's boolean value indicates a required setting for the echo cancellation feature; if it can't be met, then the request will result in an error. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'echocancellation' in that specification. candidate recommendation i...
MediaTrackConstraints.facingMode - Web APIs
eerconnection will never include this property. syntax var constraintsobject = { facingmode: constraint }; constraintsobject.facingmode = constraint; value an object based on constraindomstring specifying one or more acceptable, ideal, and/or exact (mandatory) facing modes are acceptable for a video track. an exact value in this case indicates that the specified facing mode is specifically required; for example: var constraints = { facingmode: { exact: "user" } }; this indicates that only a user-facing camera is acceptable; if there is no user-facing camera, or the user declines permission to use that camera, the media request will fail. the following strings are permitted values for the facing mode. these may represent separate cameras, or they may represent directions in which an adj...
MediaTrackConstraints.height - Web APIs
tsobject = { height: constraint }; constraintsobject.height = constraint; value if this value is a number, the user agent will attempt to obtain media whose height is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required height (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'height' in that specification. candidate recommendation ...
MediaTrackConstraints.noiseSuppression - Web APIs
ect = { noisesuppression: constraint }; constraintsobject.noisesuppression = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with noise suppression enabled or disabled as specified, if possible, but will not fail if this can't be done. if, instead, the value is given as an object with an exact field, that field's boolean value indicates a required setting for the noise suppression feature; if it can't be met, then the request will result in an error. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'noisesuppression' in that specification. candidate recommendation i...
MediaTrackConstraints.sampleRate - Web APIs
samplerate: constraint }; constraintsobject.samplerate = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample rate is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required sample rate (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'samplerate' in that specification. candidate recommen...
MediaTrackConstraints.sampleSize - Web APIs
onstraintsobject.samplesize = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample size (in bits per linear sample) is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required sample size (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. since this property can only represent linear sample sizes, this constraint can only be met by devices that can produce audio with linear samples. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications ...
MediaTrackConstraints.width - Web APIs
aintsobject = { width: constraint }; constraintsobject.width = constraint; value if this value is a number, the user agent will attempt to obtain media whose width is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required width (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'width' in that specification. candidate recommendation i...
Using the Media Capabilities API - Web APIs
media configuration passed to the decodinginfo() method was invalid. there are a few reasons why an error might occur, including: the specified type isn't one of the two permtited values: file or media-source the contenttype given is the error can be due to the type not being one of the two possible values, the contenttype not being a valid codec mime type, or invalid or omitted definitions required in the videoconfiguration. navigator.mediacapabilities.decodinginfo(videoconfiguration).then( console.log('it worked') ).catch(error => console.log('it failed: ' + error) ); media capabilities live example css li { margin : 1em; } html <form> <p>select your video configuration and find out if this browser supports the codec, and whether decoding will be smooth and power efficient:</p> ...
Transcoding assets for Media Source Extensions - Web APIs
he steps listed here, but don't have any media to experiment with, you can grab the trailer to big buck bunny [0] here. big buck bunny is licensed under the creative commons attribution 3.0 license. throughout this tutorial, you'll see the filename trailer_1080p.mov which is the download. [0] (c) copyright 2008, blender foundation / www.bigbuckbunny.org / https://peach.blender.org/about/ tools required when working with mse, the following tools are a must have: ffmpeg — a command-line utility for transcoding your media into the required formats. you can download a version for your system at the download ffmpeg page. extract the executable from the archive file and add it's location to your path statement. osx users can also use homebrew to install ffmpeg. bento4 — a set of command-line...
Capabilities, constraints, and settings - Web APIs
e prioritization of the properties is simple: if two properties' requested values are mutually exclusive, then the one listed first in the constraint set will be used. as an example, if the browser running the code above couldn't provide a 1920x1080 track but could do 1920x900, then that's what would be provided. simple constraints like these, specifying a single value, are always treated as non-required. the user agent will try to provide what you request but will not guarantee that what you get will match. however, if you use simple values for properties when calling mediastreamtrack.applyconstraints(), the request will always succeed, because these values will be considered a request, not a requirement. specifying a range of values sometimes, any value within a range is acceptable for a prop...
MessageEvent.ports - Web APIs
opriate, e.g. in channel messaging or when sending a message to a shared worker). syntax var myports = messageevent.ports; value an array of messageport objects. example onconnect = function(e) { var port = e.ports[0]; port.addeventlistener('message', function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); }); port.start(); // required when using addeventlistener. otherwise called implicitly by onmessage setter. } specifications specification status comment html living standardthe definition of 'ports' in that specification. living standard initial definition ...
MessageEvent - Web APIs
n the connect event's ports property — we then use messageport start() method to start the port, and the onmessage handler to deal with messages sent from the main threads. onconnect = function(e) { var port = e.ports[0]; port.addeventlistener('message', function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); }); port.start(); // required when using addeventlistener. otherwise called implicitly by onmessage setter. } specifications specification status comment html living standardthe definition of 'messageevent' in that specification. living standard ...
msFirstPaint - Web APIs
eger value that represents the time when the document began to be displayed 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 displayed in ie9 standards mode. example the following example shows how to calculate the time that is required to request the document before the document begins to display for the user. var otiming = window.performance.timing; var itimems = otiming.msfirstpaint - otiming.navigationstart; ...
Using Navigation Timing - Web APIs
ancetiming interface's properties section. determining navigation type to put the timing information obtained from performancetiming into the correct perspective, you need to know more about what sort of load operation occurred. in particular, you need to know: was this a load or a reload? was this a navigation or a move forward or backward through history? how many (if any) redirects were required in order to complete the navigation? this information is provided by the performance.navigation property, which returns a performancenavigation object that includes the needed information. let's add this information to the example above. the new code looks like this: window.addeventlistener("load", function() { let now = new date().gettime(); let loadingtime = now - performance.timing.nav...
Notification.permission - Web APIs
mission for the current origin to display system notifications. default: the user decision is unknown; in this case the application will act as if permission was denied. examples the following snippet could be used if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. function notifyme() { // let's check if the browser supports notifications if (!("notification" in window)) { console.log("this browser does not support desktop notification"); } // let's check whether notification permissions have alredy been granted else if (notification.permission === "granted") { // if it's okay let's create a notificat...
Notification.requestPermission() - Web APIs
function notifyme() { // let's check if the browser supports notifications if (!("notification" in window)) { alert("this browser does not support desktop notification"); } // let's check whether notification permissions have already been granted else if (notification.permission === "granted") { // if it's okay let's create a notification ...
Notification - Web APIs
stance. examples assume this basic html: <button onclick="notifyme()">notify me!</button> it's possible to send a notification as follows — here we present a fairly verbose and complete set of code you could use if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. function notifyme() { // let's check if the browser supports notifications if (!("notification" in window)) { alert("this browser does not support desktop notification"); } // let's check whether notification permissions have already been granted else if (notification.permission === "granted") { // if it's okay let's create a notification ...
Using the Notifications API - Web APIs
ue. if it fails, we return false in the catch() {} block. creating a notification creating a notification is easy; just use the notification constructor. this constructor expects a title to display within the notification and some options to enhance the notification such as an icon or a text body. for example, in the to-do-list example we use the following snippet to create a notification when required (found inside the createnotification() function): var img = '/to-do-notifications/img/icon-128.png'; var text = 'hey! your task "' + title + '" is now overdue.'; var notification = new notification('to do list', { body: text, icon: img }); closing notifications used close() to remove a notification that is no longer relevant to the user (e.g. the user already read the notification on the webpa...
OfflineAudioContext.OfflineAudioContext() - Web APIs
the buffer to create for the audio context, in sample-frames, where one sample-frame is a unit that can contain a single sample of audio data for every channel in the audio data. for example, a 5-second buffer with a samplerate of 48000hz would have a length of 5 * 48000 = 240000 sample-frames. samplerate the sample-rate of the linear audio data in sample-frames per second. all user agents are required to support a range of 22050hz to 96000hz, and may support a wider range than that. the most commonly-used rate is 44100hz, which is the sample rate used by cd audio. it is important to note that, whereas you can create a new audiocontext using the new audiocontext() constructor with no arguments, the offlineaudiocontext() constructor requires three arguments, since it needs to create an audiobu...
PaymentAddress.dependentLocality - Web APIs
nterface is a string containing a sublocality designation within a city, such as a neighborhood, borough, district, or, in the united kingdom, a dependent locality. also known as a post town. syntax var paymentdependentlocality = paymentaddress.dependentlocality; value a domstring indicating the sublocality portion of the address. this may be an empty string if no sublocality is available or required. it's used to provide disambiguation when a city may include areas that duplicate street names a sublocality is an area within a city, such as a neighborhood, borough, or district. in the united kingdom, this is used to indicate the post town in the united kingdom (known officially by the royal mail as the dependent locality). this is a disambiguating feature of addresses in places where a city ...
PaymentCurrencyAmount - Web APIs
the paymentcurrencyamount dictionary describes an amount of money in terms of both a number of units and the currency (us dollars, euro, yen, etc.), and is part of the payment request api. this is used to specify the prices of both line items on a payment, using paymentitem objects, and to provide the cost of a shipping option, using paymentshippingoption. properties all properties are required. currency a string containing a valid 3-letter iso 4217 currency identifier (iso 4217) indicating the currency used for the payment value. value a string containing a valid decimal value representing the mount of currency constituting the payment amount. this string must only contain an optional leading "-" to indicate a negative value, then one or more digits from 0 to 9, and an optional d...
PaymentDetailsUpdate.error - Web APIs
ax 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. the paymentdetailsupdate object specifies no valid shipping options in its shippingoptions list. this message can be used to explain to the user why they cannot submit their payment as currently specified—whether that's because the selected products cannot be shipped to their region or because their address is not served by any of the shipping companies you use. specifications sp...
PaymentItem - Web APIs
this may be displayed 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. specifications specification status comment payment request apithe definition of 'paymentitem' in that specification. candidate recommendation initial definition. ...
PaymentMethodChangeEvent - Web APIs
y which may contain zero or more of the following properties: methodname optional a domstring containing the payment method identifier for the payment handler being used. this is an empty string by default. methoddetails optional an object providing payment method-specific information describing the changes made to the payment, or null if there is no additional information available or required. this is null by default. return value a newly-created paymentmethodchangeevent object describing a change to the options specified for the payment method given in the methodname property. the type of the methoddetails property depends on the payment method. for example, if methodname is basic-card, indicating that the basic card payment method is being used for validation, the methoddeta...
Payment processing concepts - Web APIs
minology before getting into the details of how the api operates, there are tems you'll need to know. payee (or merchant) the merchant—either a person or an organization—whose web site or app wishes to receive money through the payment request api. payer the person or organization making a purchase using a web site or app. the payer authenticates themselves, then authorizes payment, as required by the payment method. payment method the instrument by which payment is submitted, such as a credit card or online payment service. payment method provider an organization that provides the technology needed to submit payments using a given payment method. for example, when using a credit card to pay, the credit card processing service is the payment method provider. payment handler the im...
Pointer Lock API - Web APIs
ve", updateposition, false); } } the updateposition() function updates the position of the ball on the canvas (x and y), and also includes if() statements to check whether the ball has gone off the edges of the canvas. if so, it makes the ball wrap around to the opposite edge. it also includes a check whether a requestanimationframe() call has previously been made, and if so, calls it again as required, and calls the canvasdraw() function that updates the canvas scene. a tracker is also set up to write out the x and y values to the screen, for reference. var tracker = document.getelementbyid('tracker'); var animation; function updateposition(e) { x += e.movementx; y += e.movementy; if (x > canvas.width + radius) { x = -radius; } if (y > canvas.height + radius) { y = -radius;...
Multi-touch interaction - Web APIs
et areas. <style> div { margin: 0em; padding: 2em; } #target1 { background: white; border: 1px solid black; } #target2 { background: white; border: 1px solid black; } #target3 { background: white; border: 1px solid black; } </style> global state to support multi-touch interaction, preserving a pointer's event state during various event phases is required. this application uses three arrays to cache event state, one cache per target element. // log events flag var logevents = false; // event caches, one per touch target var evcache1 = new array(); var evcache2 = new array(); var evcache3 = new array(); register event handlers event handlers are registered for the following pointer events: pointerdown, pointermove and pointerup. the handler fo...
PushManager.subscribe() - Web APIs
p-256 public key that the push server will use to authenticate your application server. if specified, all messages from your application server must use the vapid authentication scheme, and include a jwt signed with the corresponding private key. this key is not the same ecdh key that you use to encrypt the data. for more information, see "using vapid with webpush". note: this parameter is required in some browsers like chrome and edge. returns a promise that resolves to a pushsubscription object. example this.onpush = function(event) { console.log(event.data); // from here we can write the data to indexeddb, send it to any open // windows, display a notification, etc. } navigator.serviceworker.register('serviceworker.js'); // use serviceworker.ready to ensure that you can ...
Web Push API Notifications best practices - Web APIs
. sometimes news sites request push notifications so they can essentially say "look at me! look at me!" it all comes down to what the user wants, and you can use behavior to determine intent. for example, if the user views more than one article, or lingers on your page for several minutes, they may be interested in receiving updates. in addition to the question of whether a push notification is required at all, there are many different types of push notifications, ranging from casual-and-disappearing to persistent-and-requiring-interaction. we caution you to use the interaction-requiring ones very sparingly, since they can be the most annoying. your notifications should be assistive, not disruptive. building trust some studies have shown that as many as 60% of push notifications are blocked. ...
RTCDataChannel.label - Web APIs
you may use the label as you wish; you could use it to identify all the channels that are being used for the same purpose, by giving them all the same name. or you could give each channel a unique label for tracking purposes. it's entirely up to the design decisions made when building your site or app. a unique id can be found in the id property. a data channel's label is set when the channel is created by calling rtcpeerconnection.createdatachannel(). it cannot be changed after that. ...
RTCDataChannel - Web APIs
o specify the number of bytes of buffered outgoing data that is considered "low." the default value is 0.id read only the read-only rtcdatachannel property id returns an id number (between 0 and 65,534) which uniquely identifies the rtcdatachannel.label read only the read-only rtcdatachannel property label returns a domstring containing a name describing the data channel. ...
RTCIceCandidateInit.usernameFragment - Web APIs
alue a domstring containing the username fragment (usually referred to in shorthand as "ufrag" or "ice-ufrag") that, along with the ice password ("ice-pwd"), uniquely identifies a single ongoing ice interaction, including for any communication with the stun server. the string may be up to 256 characters long, and has no default value. randomization at least 24 bits of the text in the ufrag are required to be randomly selected by the ice layer at the beginning of the ice session. the specifics for which bits are random and what the remainder of the ufrag text are are left up to the browser implementation to decide. for example, a browser might choose to always use a 24-character ufrag in which bit 4 of each character is randomly selected between 0 and 1. another example: it might take a user-def...
RTCIceServer - Web APIs
credential optional the credential to use when logging into the server. this is only used if the rtciceserver represents a turn server. credentialtype optional if the rtciceserver represents a turn server, this attribute specifies what kind of credential is to be used when connecting. this must be one of the values defined by the rtcicecredentialtype enum. the default is password. urls this required property is either a single domstring or an array of domstrings, each specifying a url which can be used to connect to the server. username optional if the rtciceserver is a turn server, then this is the username to use during the authentication process. avoid specifying an unnecessarily large number of urls in the urls property; the startup time for your connection will go up substantially. ...
RTCPeerConnection.createDataChannel() - Web APIs
default: true. maxpacketlifetime optional the maximum number of milliseconds that attempts to transfer a message may take in unreliable mode. while this value is a 16-bit unsigned number, each user agent may clamp it to whatever maximum it deems appropriate. def...
RTCPeerConnection.createOffer() - Web APIs
ptions these exceptions are returned by rejecting the returned promise. your rejection handler should examine the received exception to determine which occurred. invalidstateerror the rtcpeerconnection is closed. notreadableerror no certificate or set of certificates was provided for securing the connection, and createoffer() was unable to create a new one. since all webrtc connections are required to be secured, that results in an error. operationerror examining the state of the system to determine resource availability in order to generate the offer failed for some reason. example here we see a handler for the negotiationneeded event which creates the offer and sends it to the remote system over a signaling channel. note: keep in mind that this is part of the signaling process, the...
RTCPeerConnection.getDefaultIceServers() - Web APIs
the getdefaulticeservers() method of the rtcpeerconnection interface returns an array of objects based on the rtciceserver dictionary, which indicates what, if any, ice servers the browser will use by default if none are provided to the rtcpeerconnection in its rtcconfiguration. however, browsers are not required to provide any default ice servers at all. syntax var defaulticeservers = rtcpeerconnection.getdefaulticeservers(); return value an array of ice servers, specified as objects based on rtciceserver, which the browser will use if none are specified in the configuration of the rtcpeerconnection. if there are no defaults provided by the browser, the returned array is empty; this property's value is never null. example var pc = new rtcpeerconnection(); var iceservers = pc.getdefaulti...
RTCPeerConnection: negotiationneeded event - Web APIs
this occurs both during the initial setup of the connection as well as any time a change to the communication environment requires reconfiguring the connection. bubbles no cancelable no interface event event handler property rtcpeerconnection.onnegotiationneeded the negotiationneeded event is first dispatched to the rtcpeerconnection when media is first added to the connection. ...
RTCPeerConnection - Web APIs
offer or answer represented by the description was first instantiated.getdefaulticeservers() the getdefaulticeservers() method of the rtcpeerconnection interface returns an array of objects based on the rtciceserver dictionary, which indicates what, if any, ice servers the browser will use by default if none are provided to the rtcpeerconnection in its rtcconfiguration. ...
RTCRtpContributingSource.audioLevel - Web APIs
sure level) change in the sound pressure level from 0 dbov. for both rtcrtpcontributingsource and rtcrtpsynchronizationsource, the audio level is converted to this form from the values defined in the specifications corresponding to each type of source. audiolevel may be absent from rtcrtpcontributingsource objects, which indicates that no volume level was provided by the source; however, it is required and always available on all rtcrtpsynchronizationsource objects. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'audiolevel' in that specification. candidate recommendation initial definition. ...
RTCRtpSender.replaceTrack() - Web APIs
. return value a promise which is fulfilled once the track has been successfully replaced. the promise is rejected if the track cannot be replaced for any reason; this is commonly because the change would require renegotiation of the codec, which is not allowed (see things that require negotiation). if newtrack was omitted or was null, replacetrack() simply stops the sender. no negotiation is required in this case. when the promise is fulfilled, the fulfillment handler receives a value of undefined. exceptions if the returned promise is rejected, one of the following exceptions is provided to the rejection handler: invalidmodificationerror replacing the rtcrtpsender's current track with the new one would require negotiation. invalidstateerror the track on which this method was called ...
RTCRtpTransceiver.direction - Web APIs
ccur: invalidstateerror either the receiver's rtcpeerconnection is closed or the rtcrtpreceiver is stopped. usage notes setting the direction when you change the value of direction, an invalidstateerror exception will occur if the connection is closed or the receiver is stopped. if the new value of direction is in fact different from the existing value, renegotiation of the connection is required, so a negotiationneeded event is sent to the rtcpeerconnection. effect on offers and answers the value of direction is used by rtcpeerconnection.createoffer() or rtcpeerconnection.createanswer() in order to generate the sdp generated by each of those methods. the sdp contains an a-line which specifies the directionality. for example, if the direction is specified as "sendrecv", the correspondin...
RTCSessionDescription() - Web APIs
tionary, so you don't have to instantiate an rtcsessiondescription yourself. syntax sessiondescription = new rtcsessiondescription(rtcsessiondescriptioninit); values rtcsessiondescriptioninit optional an object providing the default values for the session description; the object conforms to the rtcsessiondescriptioninit dictionary. that dictionary has the following properties: type required. a string which is a member of the rtcsdptype enum; it must have one of the following values: this enum defines strings that describe the current state of the session description, as used in the type property. the session description's type will be specified using one of these values. value description answer the sdp contained in the sdp property is the definitive c...
RTCStats - Web APIs
Web › API › RTCStats
specific classes of statistic are defined as dictionaries based on rtcstats. for example, statistics about a received rtp stream are represented by rtcreceivedrtpstreamstats. properties id a domstring which uniquely identifies the object which was inspected to produce this object based on rtcstats. timestamp a domhighrestimestamp object indicating the time at which the sample was taken for this statistics object. ...
ReadableByteStreamController.desiredSize - Web APIs
syntax var desiredsize = readablebytestreamcontroller.desiredsize; value an integer. note that this can be negative if the queue is over-full. examples tbd. ...
ReadableByteStreamController - Web APIs
readablestream's state and internal queue. byte stream controllers are for byte streams. constructor none. readablebytestreamcontroller instances are created automatically during readablestream construction. properties readablebytestreamcontroller.byobrequest read only returns the current byob pull request. readablebytestreamcontroller.desiredsize read only returns the desired size required to fill the stream's internal queue. methods readablebytestreamcontroller.close() closes the associated stream. readablebytestreamcontroller.enqueue() enqueues a given chunk in the associated stream. readablebytestreamcontroller.error() causes any future interactions with the associated stream to error. examples tbd. specifications specification status comment ...
ReadableStream.ReadableStream() - Web APIs
meters underlyingsource an object containing methods and properties that define how the constructed stream instance will behave. underlyingsource can contain the following: start(controller) this is a method, called immediately when the object is constructed. the contents of this method are defined by the developer, and should aim to get access to the stream source, and do anything else required to set up the stream fuctionality. if this process is to be done asynchronously, it can return a promise to signal success or failure. the controller parameter passed to this method is a readablestreamdefaultcontroller or a readablebytestreamcontroller, depending on the value of the type property. this can be used by the developer to control the stream during set up. pull(controller) optional ...
ReadableStreamDefaultController.desiredSize - Web APIs
syntax var desiredsize = readablestreamdefaultcontroller.desiredsize; value an integer. note that this can be negative if the queue is over-full. examples the a readable stream with an underlying push source and backpressure support example in the spec provides a good example of using desiredsize to manually detect when the stream is full and apply backpressure, and also of using readablestreamdefaultcontroller.error() to manually trigger a stream error if another part of the system it relies on fails. ...
ReadableStreamDefaultController - Web APIs
face of the streams api represents a controller allowing control of a readablestream's state and internal queue. default controllers are for streams that are not byte streams. constructor none. readablestreamdefaultcontroller instances are created automatically during readablestream construction. properties readablestreamdefaultcontroller.desiredsize read only returns the desired size required to fill the stream's internal queue. methods readablestreamdefaultcontroller.close() closes the associated stream. readablestreamdefaultcontroller.enqueue() enqueues a given chunk in the associated stream. readablestreamdefaultcontroller.error() causes any future interactions with the associated stream to error. examples in the following simple example, a custom readablestream is cre...
Using the Resource Timing API - Web APIs
sole.log("... encodedbodysize[" + i + "] = " + list[i].encodedbodysize); else console.log("... encodedbodysize[" + i + "] = not supported"); if ("transfersize" in list[i]) console.log("... transfersize[" + i + "] = " + list[i].transfersize); else console.log("... transfersize[" + i + "] = not supported"); } } managing the resource buffer although the browser is required to support at least 150 resource timing performance entries in its resource timing buffer, some applications may use more resources than that limit. to help the developer manage the buffer size, resource timing defines two methods that extend the performance interface. the clearresourcetimings() method removes all "resource" type performance entries from the browser's resource performance entry b...
SVGAElement - Web APIs
console.log("blank!"); linkref.target = "_self"; } else { console.log("sorry! ...
SVGAltGlyphElement - Web APIs
the svgaltglyphelement interface represents an <altglyph> element. this interface makes it possible to implement more sophisticated and particular glyph characters. for some textal representations as: ligatures (e.g. æ, ß, etc ), special-purpose fonts (e.g. musical symbols) or even alternate glyphs such as asian text strings it is required that a different set of glyphs be used than the normal given character data. properties this interface also inherits properties from its parent interface, svggraphicselement. svgaltglyphelement.glyphref it corresponds to the attribute glyphref on the given element. it's data type is 'string'. it defines the glyph identifier, whose format is dependent on the ‘format’ of the given font. svgaltglyphelement.format it corresponds to the attribute fo...
SVGCircleElement - Web APIs
in(math.max(circle.r.baseval.value + change, 10), 250); circle.setattribute("r", newvalue); } click on the circle. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgcircleelement' in that specification. candidate recommendation replaced the inheritance from svgelement, svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable by svggeometryelement scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgcircleelement' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn...
SVGClipPathElement - Web APIs
ined in svgunittypes. methods this interface doesn't implement any specific methods, but inherits methods from its parent, svgelement. specifications specification status comment css masking module level 1the definition of 'svgclippathelement' in that specification. candidate recommendation removed the inheritance from svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, svgtransformable, and svgunittypes scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgclippathelement' in that specification. recommendation initial definition ...
SVGDefsElement - Web APIs
methods this interface doesn't implement any specific methods, but inherits properties from its parent, svggraphicselement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgdefselement' in that specification. candidate recommendation replaced the inheritance from svgelementsvgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable by svggraphicselement scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgdefselement' in that specification. recommendation initial definition ...
SVGFilterElement - Web APIs
ponent of the filterres attribute of the given <filter> element. methods svgfilterelement.setfilterres() sets the values of the filterres attribute. specifications specification status comment filter effects module level 1the definition of 'svgfilterelement' in that specification. working draft removed the inheritance from svglangspace, svgexternalresourcesrequired, svgstylable, and svgunittypes and removed the setfilterres() function scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgfilterelement' in that specification. recommendation initial definition ...
SVGForeignObjectElement - Web APIs
no methods but inherits methods from its parent, svggraphicselement and implements methods from svgurireference. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgforeignobjectelement' in that specification. candidate recommendation replaced the inheritance from svgelement, svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable by svggraphicselement and svgurireference scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgforeignobjectelement' in that specification. recommendation initial definition ...
SVGGElement - Web APIs
ut inherits methods from its parent interface, svggraphicselement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svggelement' in that specification. candidate recommendation changed the inheritance from svgelement to svggraphicselement and removed the implemented interfaces svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svggelement' in that specification. recommendation initial definition ...
SVGGradientElement - Web APIs
e spread method types defined on this interface. methods this interface does not provide any specific methods, but implements those of its parent, svgelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svggradientelement' in that specification. candidate recommendation removed inheritance of svgexternalresourcesrequired, svgstylable, and svgunittypes scalable vector graphics (svg) 1.1 (second edition)the definition of 'svggradientelement' in that specification. recommendation initial definition ...
SVGImageElement - Web APIs
promise which resolves once the image data is ready to be used. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgimageelement' in that specification. candidate recommendation changed the inheritance from svgelement to svggraphicselement, removed the implemented interfaces svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable and added the crossorigin property. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgimageelement' in that specification. recommendation initial definition ...
SVGLineElement - Web APIs
inherits methods from its parent interface, svggeometryelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svglineelement' in that specification. candidate recommendation changed the inheritance from svgelement to svggeometryelement and removed the implemented interfaces svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svglineelement' in that specification. recommendation initial definition ...
SVGMPathElement - Web APIs
roperties from its parent interface, svgelement. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement. specifications specification status comment svg animations level 2the definition of 'svgmpathelement' in that specification. editor's draft removed the implemented interface svgexternalresourcesrequired. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgmpathelement' in that specification. recommendation initial definition ...
SVGMarkerElement - Web APIs
svg_markerunits_userspaceonuse 1 attribute markerunits is 'userspaceonuse'. svg_markerunits_strokewidth 2 attribute markerunits is 'strokewidth'. properties this interface also inherits properties from its parent interface, svgelement, and implements properties from svgexternalresourcesrequired, svganimatedpreserveaspectratio, and svgstylable. name type description refx svganimatedlength corresponds to attribute refx on the given marker element. refy svganimatedlength corresponds to attribute refy on the given mar...
SVGMaskElement - Web APIs
element. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement. specifications specification status comment css masking module level 1the definition of 'svgmaskelement' in that specification. candidate recommendation removed the implemented interfaces svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgmaskelement' in that specification. recommendation initial definition ...
SVGPatternElement - Web APIs
, but inherits methods from its parent interface, svgelement and implements the ones from svgfittoviewbox and svgurireference. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgpatternelement' in that specification. candidate recommendation removed the implemented interfaces svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgpatternelement' in that specification. recommendation initial definition ...
SVGPolygonElement - Web APIs
methods this interface doesn't implement any specific methods, but inherits methods from its parent, svggeometryelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgpolygonelement' in that specification. candidate recommendation replaced the inheritance from svgelementsvgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable by svggeometryelement scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgpolygonelement' in that specification. recommendation initial definition ...
SVGPolylineElement - Web APIs
ethods this interface doesn't implement any specific methods, but inherits methods from its parent, svggeometryelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgpolylineelement' in that specification. candidate recommendation replaced the inheritance from svgelementsvgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable by svggeometryelement scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgpolylineelement' in that specification. recommendation initial definition ...
SVGRectElement - Web APIs
ar b = math.floor(math.random() * 255); myrect.style.fill = 'rgb(' + r + ', ' + g + ' , ' + b + ')'; } click the rect. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgrectelement' in that specification. candidate recommendation replaced the inheritance from svgelementsvgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable by svggeometryelement scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgrectelement' in that specification. recommendation initial definition ...
SVGSVGElement - Web APIs
behavior is not defined if more than one element has this id. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgsvgelement' in that specification. candidate recommendation replaced the inheritance from svgelement by svggraphicselement, removed the implemented interfaces svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, svglocatable, documentevent, viewcss, and documentcss and added implemented interface windoweventhandlers. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgsvgelement' in that specification. recommendation initial definition ...
SVGScriptElement - Web APIs
he given <script> element. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgscriptelement' in that specification. candidate recommendation removed the implemented interface svgexternalresourcesrequired and added the crossorigin property. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgscriptelement' in that specification. recommendation initial definition ...
SVGSwitchElement - Web APIs
herits methods from its parent interface, svggraphicselement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgswitchelement' in that specification. candidate recommendation changed the inheritance from svgelement to svggraphicselement and removed the implemented interfaces svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgswitchelement' in that specification. recommendation initial definition ...
SVGSymbolElement - Web APIs
rface, svggraphicselement, and implements methods from svgfittoviewbox. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgsymbolelement' in that specification. candidate recommendation changed the inheritance from svgelement to svggraphicselement and removed the implemented interfaces svglangspace, svgexternalresourcesrequired, and svgstylable. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgsymbolelement' in that specification. recommendation initial definition ...
SVGTextContentElement - Web APIs
() selects text within the element. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgtextcontentelement' in that specification. candidate recommendation changed inheritance from svgelement to svggraphicselement and getstartpositionofchar() and removed implementations of svgtests, svglangspace, svgexternalresourcesrequired, svgstylable interfaces and getendpositionofchar() to return a dompoint instead of an svgpoint. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgtextcontentelement' in that specification. recommendation initial definition ...
SVGViewElement - Web APIs
lement using the getelementbyid() method call. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgviewelement' in that specification. candidate recommendation removed a mixin svgexternalresourcesrequired scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgviewelement' in that specification. recommendation initial definition ...
Screen Wake Lock API - Web APIs
utton to acquire a wake lock and also release it, which in turn updates the ui. the ui also updates if the wake lock is released automatically for any reason. there'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 displayed (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, consid...
Sensor APIs - Web APIs
return; } // use the sensor. }); an alternative approach is to attempt to use the error and listen for the securityerror. const sensor = new absoluteorientationsensor(); sensor.start(); sensor.onerror = event => { if (event.error.name === 'securityerror') console.log("no permissions to use absoluteorientationsensor."); }; the following table describes for each sensor type, the name required for the permissions api, the <iframe> element's allow attribute and the feature-policy directive. sensor permissions sensor permission/feature policy name absoluteorientationsensor 'accelerometer', 'gyroscope', and 'magnetometer' accelerometer 'accelerometer' ambientlightsensor 'ambient-light-sensor' gyroscope 'gyroscope' ...
ServiceWorkerGlobalScope.skipWaiting() - Web APIs
self.skipwaiting() from inside of an installevent handler. the following example causes a newly installed service worker to progress into the activating state, regardless of whether there is already an active service worker. self.addeventlistener('install', function(event) { // the promise that skipwaiting() returns can be safely ignored. self.skipwaiting(); // perform any other actions required for your // service worker to install, potentially inside // of event.waituntil(); }); specifications specification status comment service workersthe definition of 'skipwaiting()' in that specification. working draft initial definition. ...
Using Service Workers - Web APIs
test, which is a simple star wars lego image gallery. it uses a promise-powered function to read image data from a json object and load the images using ajax, before displaying the images in a line down the page. we’ve kept things static and simple for now. it also registers, installs, and activates a service worker, and when more of the spec is supported by browsers it will cache all the files required so it will work offline! you can see the source code on github, and view the example live. the one bit we’ll call out here is the promise (see app.js lines 22-47), which is a modified version of what you read about above, in the promises test demo. it is different in the following ways: in the original, we only passed in a url to an image we wanted to load. in this version, we pass in...
SharedWorker() - Web APIs
. available properties are as follows: type: a domstring specifying the type of worker to create. the value can be classic or module. if not specified, the default used is classic. credentials: a domstring specifying the type of credentials to use for the worker. the value can be omit, same-origin, or include. if not specified, or if type is classic, the default used is omit (no credentials required). name: a domstring specifying an identifying name for the sharedworkerglobalscope representing the scope of the worker, which is mainly useful for debugging purposes. return value the created worker. exceptions a securityerror is raised if the document is not allowed to start workers, for example if the url has an invalid syntax or if the same-origin policy is violated. a networker...
SharedWorker - Web APIs
n the connect event's ports property — we then use messageport start() method to start the port, and the onmessage handler to deal with messages sent from the main threads. onconnect = function(e) { var port = e.ports[0]; port.addeventlistener('message', function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); }); port.start(); // required when using addeventlistener. otherwise called implicitly by onmessage setter. } specifications specification status comment html living standardthe definition of 'sharedworker' in that specification. living standard no change from unknown. ...
SpeechRecognitionError.error - Web APIs
peech api specification. syntax var myerror = event.error; value a domstring naming the type of error. the possible error types are: no-speech no speech was detected. aborted speech input was aborted in some manner, perhaps by some user-agent-specific behavior like a button the user can press to cancel speech input. audio-capture audio capture failed. network network communication required for completing the recognition failed. not-allowed the user agent disallowed any speech input from occurring for reasons of security, privacy or user preference. service-not-allowed the user agent disallowed the requested speech recognition service, either because the user agent doesn't support it or because of reasons of security, privacy or user preference. in this case it would allow anoth...
SpeechRecognitionErrorEvent.error - Web APIs
the type of error raised. syntax var myerror = event.error; value a domstring naming the type of error. the possible error types are: no-speech no speech was detected. aborted speech input was aborted in some manner, perhaps by some user-agent-specific behavior like a button the user can press to cancel speech input. audio-capture audio capture failed. network network communication required for completing the recognition failed. not-allowed the user agent disallowed any speech input from occurring for reasons of security, privacy or user preference. service-not-allowed the user agent disallowed the requested speech recognition service, either because the user agent doesn't support it or because of reasons of security, privacy or user preference. in this case it would allow anoth...
SpeechSynthesisErrorEvent.error - Web APIs
synthesis-unavailable the operation couldn't be completed at this time because no synthesis engine was available (for example, the user may need to install or configure a synthesis engine.) synthesis-failed the operation failed because the synthesis engine raised an error. language-unavailable no appropriate voice was available for the language set in speechsyn...
StaticRange.StaticRange() - Web APIs
the staticrange() constructor creates a new staticrange object representing a span of content within the dom. it includes properties identifying the standard and end positions of the range as well as a boolean indicating whether or not the range is collapsed (that is, empty). syntax var staticrange = new staticrange(rangespec) parameters rangespec the required rangespec parameter is an object adhering to the staticrangeinit dictionary. the four required rangespec properties are: startcontainer the node in which the starting point of the range is located. startoffset the offset into the starting node at which the first character of the range is found. endcontainer the node in which the end point of the range is located. endoffset the offset into the node indicated by en...
Streams API concepts - Web APIs
that there are two different types of readable stream. as well as the conventional readable stream there is a type called a byte stream — this is an extended version of a conventional stream for reading underlying byte sources (otherwise known as byob, or “bring your own buffer”) sources. these allow streams to be read straight into a buffer supplied by the developer, minimizing the copying required. which underlying stream (and by extension, reader and controller) your code will use depends on how the stream was created in the first place (see the readablestream() constructor page). important: byte streams are not implemented anywhere as yet, and questions have been raised as to whether the spec details are in a finished enough state for them to be implemented. this may change over time. ...
Streams API - Web APIs
after it is fully received. with streams being available to javascript, this all changes — you can now start processing raw data with javascript bit by bit as soon as it is available on the client-side, without needing to generate a buffer, string, or blob. there are more advantages too — you can detect when streams start or end, chain streams together, handle errors and cancel streams as required, and react to the speed of the stream is being read at. the basic usage of streams hinges around making responses available as streams. for example, the response body returned by a successful fetch request can be exposed as a readablestream, and you can then read it using a reader created with readablestream.getreader(), cancel it with readablestream.cancel(), etc. more complicated uses involve...
SubtleCrypto.decrypt() - Web APIs
takes as arguments a key to decrypt with, some optional extra parameters, and the data to decrypt (also known as "ciphertext"). it returns a promise which will be fulfilled with the decrypted data (also known as "plaintext"). syntax const result = crypto.subtle.decrypt(algorithm, key, data); parameters algorithm is an object specifying the algorithm to be used, and any extra parameters as required. the values given for the extra parameters must match those passed into the corresponding encrypt() call. to use rsa-oaep, pass an rsaoaepparams object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. key is a cryptokey containing the key to be used for decryption. if using rsa-oaep, this ...
SubtleCrypto.encrypt() - Web APIs
as its arguments a key to encrypt with, some algorithm-specific parameters, and the data to encrypt (also known as "plaintext"). it returns a promise which will be fulfilled with the encrypted data (also known as "ciphertext"). syntax const result = crypto.subtle.encrypt(algorithm, key, data); parameters algorithm is an object specifying the algorithm to be used and any extra parameters if required: to use rsa-oaep, pass an rsaoaepparams object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. key is a cryptokey containing the key to be used for encryption. data is a buffersource containing the data to be encrypted (also known as the plaintext). return value result is a promise...
SubtleCrypto.wrapKey() - Web APIs
is encrypted. it can be one of the following: raw: raw format. pkcs8: pkcs #8 format. spki: subjectpublickeyinfo format. jwk: json web key format. key is the cryptokey to wrap. wrappingkey is the cryptokey used to encrypt the exported key. the key must have the wrapkey usage set. wrapalgo is an object specifying the algorithm to be used to encrypt the exported key, and any required extra parameters: to use rsa-oaep, pass an rsaoaepparams object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. to use aes-kw, pass the string "aes-kw", or an object of the form { "name": "aes-kw }. return value result is a promise that fulfills with an arraybuffer containing the en...
TransformStream - Web APIs
om the given handlers. properties transformstream.readable read only the readable end of a transformstream. transformstream.writable read only the writable end of a transformstream. methods none examples anything-to-uint8array stream in the following example, a transform stream passes through all chunks it receives as uint8array values. const transformcontent = { start() {}, // required. async transform(chunk, controller) { chunk = await chunk switch (typeof chunk) { case 'object': // just say the stream is done i guess if (chunk === null) controller.terminate() else if (arraybuffer.isview(chunk)) controller.enqueue(new uint8array(chunk.buffer, chunk.byteoffset, chunk.bytelength)) else if (array.isarray(chunk) && chunk.ev...
ULongRange - Web APIs
based on this, augmenting it to support exact and ideal values as well. properties max a numeric value in the range of signed 32-bit integers, specifying the largest permissible value of the property it describes. min a numeric value in the range of signed 32-bit integers, specifying the smallest permissible value of the property it describes. the specified min and/or and max values are required. if no match can be found that is within the given range, an error will occur. specifications specification status comment media capture and streamsthe definition of 'ulongrange' in that specification. candidate recommendation initial definition ...
URL() - Web APIs
Web › API › URL › URL
uctor returns a newly created url object representing the url defined by the parameters. if the given base url or the resulting url are not valid urls, the javascript typeerror exception is thrown. note: this feature is available in web workers. syntax const url = new url(url [, base]) parameters url a usvstring representing an absolute or relative url. if url is a relative url, base is required, and will be used as the base url. if url is an absolute url, a given base will be ignored. base optional a usvstring representing the base url to use in case url is a relative url. if not specified, it defaults to ''. note: you can still use an existing url object for the base, which stringifies itself to the object's href property. exceptions exception explanation ...
URL.createObjectURL() - Web APIs
alling url.revokeobjecturl() when you no longer need them. browsers will release object urls automatically when the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so. using object urls for media streams in older versions of the media source specification, attaching a stream to a <video> element required creating an object url for the mediastream. this is no longer necessary, and browsers are removing support for doing this. important: if you still have code that relies on createobjecturl() to attach streams to media elements, you need to update your code to simply set srcobject to the mediastream directly. specifications specification status comment file apithe defin...
ValidityState.typeMismatch - Web APIs
a the type attribute and the data that is actually present. the typemismatch is only one of the many possible errors and is only relevant for the email and url types. when the value provided doesn't match the expected value based on the type for other input types, you get different errors. for example, if the number input value is not a floating point number, the badinput is true. if the email is required but is empty, the valuemissing will be true. specifications specification status comment html living standardthe definition of 'validitystate.typemismatch' in that specification. living standard html 5.1the definition of 'validitystate.typemismatch' in that specification. recommendation html5the definition of 'validitystate.typemismatch' i...
A basic 2D WebGL animation example - Web APIs
l in the shape being rendered. since we're drawing a solid, untextured object with no lighting applied, this is exceptionally simple: <script id="fragment-shader" type="x-shader/x-fragment"> #ifdef gl_es precision highp float; #endif uniform vec4 uglobalcolor; void main() { gl_fragcolor = uglobalcolor; } </script> this starts by specifying the precision of the float type, as required. then we set the global gl_fragcolor to the value of the uniform uglobalcolor, which is set by the javascript code to the color being used to draw the square. html the html consists solely of the <canvas> that we'll obtain a webgl context on. <canvas id="glcanvas" width="600" height="460"> oh no! your browser doesn't support canvas! </canvas> javascript globals and initialization first, t...
Compressed texture formats - Web APIs
while limiting the added video memory necessary. textures are uncompressed on the fly when being accessed by a shader. note that this advantage doesn't translate to network bandwidth: while the formats are better than uncompressed data, they are in general far worse than standard image formats such as png and jpg. as compressed textures require hardware support, therefore no specific formats are required by webgl; instead, a context can make different formats available, depending on hardware support. this site shows which formats are supported in the used browser. usage of compressed formats first requires activating the respective extension with webglrenderingcontext.getextension(). if supported, it will return an extension object with constants for the added formats and the formats will also b...
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
ow closely-interrelated these two protocols are. capabilities of rtp rtp's primary benefits in terms of webrtc include: generally low latency. packets are sequence-numbered and time-stamped for reassembly if they arrive out of order. this lets data sent using rtp be delivered on transports that don't guarantee ordering or even guarantee delivery at all. this means rtp can be — but is not required to be — used atop udp for its performance as well as its multiplexing and checksum features. rtp supports multicast; while this isn't yet important for webrtc, it's likely to matter in the future, when webrtc is (hopefully) enhanced to support multi-user conversations. rtp isn't limited to use in audiovisual communication. it can be used for any form of continuous or active data transfer, inc...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
{ pc.onnegotiationneeded({ icerestart: true }); } }; this has a number of reliability issues and outright bugs (such as failing if the iceconnectionstatechange event fires when the signaling state isn't stable), but there was no way you could actually request an ice restart other than by creating and sending an offer with the icerestart option set to true. sending the restart request thus required directly invoking the negotiationneeded event's handler. getting it right was tricky at best, and was so easy to get wrong that bugs are common. using restartice() now, you can use restartice() to do this much more cleanly: pc.onnegotiationneeded = async options => { await pc.setlocaldescription(await pc.createoffer(options)); signaler.send({ description: pc.localdescription }); }; pc.onic...
Using DTMF with WebRTC - Web APIs
dia (after the microphone's stream is added to it), a negotiationneeded event is delivered to the caller, letting it know that it's time to start negotiating the connection with the receiver. as previously mentioned, our example is simplified somewhat because we control both the caller and the receiver, so handlecallernegotiationneeded() is able to quickly construct the connection by chaining the required calls together for both the caller and receiver, as shown below. function handlecallernegotiationneeded() { log("negotiating..."); callerpc.createoffer(offeroptions) .then(function(offer) { log("setting caller's local description: " + offer.sdp); return callerpc.setlocaldescription(offer); }) .then(function() { log("setting receiver's remote description to the same as calle...
Using WebRTC data channels - Web APIs
sing the rtcpeerconnection interface, you're able to send and receive media data between the two peers on the connection. but there's a lot more you can do with webrtc. in this guide, we'll examine how to add a data channel to a peer connection, which can then be used to securely exchange arbitrary data; that is, any kind of data we wish, in any format we choose. since all webrtc components are required to use encryption, any data transmitted on an rtcdatachannel is automatically secured using datagram transport layer security (dtls). see security below for more information. creating a data channel the underlying data transport used by the rtcdatachannel can be created in one of two ways: let webrtc create the transport and announce it to the remote peer for you (by causing it to receive a...
WebSocket.send() - Web APIs
Web › API › WebSocket › send
t be sent (for example, because it needs to be buffered but the buffer is full), the socket is closed automatically. syntax websocket.send("hello server!"); parameters data the data to send to the server. it may be one of the following types: usvstring a text string. the string is added to the buffer in utf-8 format, and the value of bufferedamount is increased by the number of bytes required to represent the utf-8 string. arraybuffer you can send the underlying binary data used by a typed array object; its binary data contents are queued in the buffer, increasing the value of bufferedamount by the requisite number of bytes. blob specifying a blob enqueues the blob's raw data to be transmitted in a binary frame. the value of bufferedamount is increased by the byte size of that...
Writing WebSocket client applications - Web APIs
web workers. note: the example snippets in this article are taken from our websocket chat client/server sample. see the code, then try out the example for yourself. creating a websocket object in order to communicate using the websocket protocol, you need to create a websocket object; this will automatically attempt to open the connection to the server. the websocket constructor accepts one required and one optional parameter: websocket = new websocket(url, protocols); url the url to which to connect; this should be the url to which the websocket server will respond. this should use the url scheme wss://, although some software may allow you to use the insecure ws:// for local connections. protocols optional either a single protocol string or an array of protocol strings. these strin...
Fundamentals of WebXR - Web APIs
gh space: forward and backward, left and right, up and down. support for all six degrees of freedom is referred to as 6dof. <<<--- replace image with an svg for future translation work and consistency --->>> some more advanced headsets provide at least minimal support for translational movement detection, but to capture more substantial movement through the space, external sensors are usually required, such as cameras (either using visible light or infrared). webxr session modes webxr offers support for both augmented reality (ar) and virtual reality (vr) sessions, using the same api. which type of session you want to create is specified when creating the session. this is done by specifying the appropriate session mode string for the kind of session you want to create. virtual reality in a...
WebXR permissions and security - Web APIs
w for details. if all of that is true, the promise returned by requestsession() is resolved, and the new xrsession object is passed into the fulfillment handler. otherwise, an appropriate exception is thrown, such as securityerror if the document doesn't have permission to enter immersive mode. inline presentation when you request an xrsession with the mode set to inline, and any features are required or requested, the browser will only allow the session to be created if the call to requestsession() was made by code which is executing expressly due to user intent. specifically: if the requestsession() call isn't coming from within the handler executed in response to a user event, and is not being issued while launching a web application, the request is denied and false is delivered to the ...
Rendering and the WebXR frame animation callback - Web APIs
od mydrawsceneintoview() to actually use webgl to render the scene. into this, we pass the xrview representing the eye we're drawing for (in order to perform perspective mapping and the like) and deltatime, so the scene drawing code can accurately represent the elapsed time when determining the positions of objects moving over time. when the loop that's iterating over the views ends, every image required to represent the scene to the viewer has been rendered, and upon return, the framebuffer makes its way through the gpu and eventually to the xr device's display or displays. since we called requestanimationframe() at thee top of the function, our callback will be invoked once again when it's time to render the next frame of the scene's animation. drawbacks to this approach since it's important ...
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
ou maintain the same viewer position and facing direction while performing this transition, you can use the xrframe method getviewerpose() to obtain the current xrviewerpose, switch the session, then use the saved viewer pose to restore the viewer's position and facing. let viewerpose = frame.getviewerpose(worldreferencespace); let newsession = navigator.xr.requestsession("immersive-vr", { requiredfeatures: "unbounded" }); worldreferencespace = await newsession.requestreferencespace("unbounded"); viewerpose = worldreferencespace.getoffsetreferencespace(viewerpose.transform); here, the viewer pose is obtained, with its transform defined relative to worldreferencespace, the current session's global reference space. then a new session is established and a reference space created to become th...
WebXR Device API - Web APIs
...
Using Web Workers - Web APIs
y different windows, iframes or even workers. in this section we'll discuss the javascript found in our basic shared worker example (run shared worker): this is very similar to the basic dedicated worker example, except that it has two functions available handled by different script files: multiplying two numbers, or squaring a number. both scripts use the same worker to do the actual calculation required. here we'll concentrate on the differences between dedicated and shared workers. note that in this example we have two html pages, each with javascript applied that uses the same single worker file. note: if sharedworker can be accessed from several browsing contexts, all those browsing contexts must share the exact same origin (same protocol, host, and port). note: in firefox, shared worke...
window.requestIdleCallback() - Web APIs
are generally called in first-in-first-out order; however, callbacks which have a timeout specified may be called out-of-order if necessary in order to run them before the timeout elapses. you can call requestidlecallback() within an idle callback function to schedule another callback to take place no sooner than the next pass through the event loop. a timeout option is strongly recommended for required work, as otherwise it's possible multiple seconds will elapse before the callback is fired. syntax var handle = window.requestidlecallback(callback[, options]) return value an id which can be used to cancel the callback by passing it into the window.cancelidlecallback() method. parameters callback a reference to a function that should be called in the near future, when the event loop is ...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
etc. and as shown below, using call to set this doesn't work either. ...
Worker() - Web APIs
Web › API › Worker › Worker
. available properties are as follows: type: a domstring specifying the type of worker to create. the value can be classic or module. if not specified, the default used is classic. credentials: a domstring specifying the type of credentials to use for the worker. the value can be omit, same-origin, or include. if not specified, or if type is classic, the default used is omit (no credentials required). name: a domstring specifying an identifying name for the dedicatedworkerglobalscope representing the scope of the worker, which is mainly useful for debugging purposes. exceptions a securityerror is raised if the document is not allowed to start workers, e.g. if the url has an invalid syntax or if the same-origin policy is violated. a networkerror is raised if the mime type of the w...
Worklet - Web APIs
Web › API › Worklet
worklet types worklets are restricted to specific use cases; they cannot be used for arbitrary computations like web workers. ...
WritableStream.abort() - Web APIs
e abort. return value a promise, which fulfills with the value given in the reason parameter. exceptions typeerror the stream you are trying to abort is not a writablestream, or it is locked. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... // abort the stream later on, when required writablestream.abort(); specifications specification status comment streamsthe definition of 'abort()' in that specification. living standard initial definition. ...
WritableStreamDefaultWriter.desiredSize - Web APIs
syntax var desiredsize = writablestreamdefaultwriter.desiredsize; value an integer. note that this can be negative if the queue is over-full. the value will be null if the stream cannot be successfully written to (due to either being errored, or having an abort queued up), and zero if the stream is closed. exceptions typeerror the writer’s lock is released. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... ...
WritableStreamDefaultWriter - Web APIs
a new writablestreamdefaultwriter object instance. properties writablestreamdefaultwriter.closedread only allows you to write code that responds to an end to the streaming process. returns a promise that fulfills if the stream becomes closed or the writer's lock is released, or rejects if the stream errors. writablestreamdefaultwriter.desiredsizeread only returns the desired size required to fill the stream's internal queue. writablestreamdefaultwriter.readyread only returns a promise that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure. methods writablestreamdefaultwriter.abort() aborts the stream, signaling that the producer can no longer successfully wri...
XRBoundedReferenceSpace.boundsGeometry - Web APIs
r input device. theoretically, a more advanced system might use sensors or other detection methods to determine the bounds of a dedicated xr room (notice how we carefully don't call it a holodeck?). syntax bounds = xrreferencespace.boundsgeometry; value the boundsgeometry property is an array of dompointreadonly objects, each of which defines one vertex in a polygon inside which the viewer is required to remain. each point must be at floor level, with its y coordinate's value set to 0. additionally, the value of w is always 1 in every point in the array. additionally, the points must be listed in clockwise order. each entry in boundsgeometry is equal to an entry in the list of native bounds geometry points for the room, premultiplied by the inverse of the origin offset. in other words, the bo...
XRBoundedReferenceSpace - Web APIs
movement. see the article using bounded reference spaces for details on how bounded spaces work and why they're useful. properties in addition to the properties of xrreferencespace, xrboundedreferencespace includes the following: boundsgeometry read only an array of dompointreadonly objects, each of which defines a vertex in the polygon defining the boundaries within which the user will be required to remain. these vertices must be sorted such that they move clockwise around the viewer's position. methods xrboundedreferencespace inherits the methods of its parent interface, xrreferencespace. it has no further methods. specifications specification status comment webxr device apithe definition of 'xrboundedreferencespace' in that specification. working draft ...
XRHandedness - Web APIs
if a gripspace is present, that means the input source is a hand-held device of some sort, so it should be rendered visibly if possible. if gripspace is non-null, the function proceeds to get the pose for the gripspace transformed into the current reference space. assuming t...
XRInputSource.handedness - Web APIs
if a gripspace is present, that means the input source is a hand-held device of some sort, so it should be rendered visibly if possible. if gripspace is non-null, the function proceeds to get the pose for the gripspace transformed into the current reference space. assuming t...
XRPermissionDescriptor.optionalFeatures - Web APIs
the xrpermissiondescriptor dictionary's optionalfeatures property is used to specify a list of webxr features which your app or site would like to use but can operate without if permission isn't granted to use them. syntax xrpermissiondescriptor = { mode: xrsessionmode, requiredfeatures: reqfeaturelist, optionalfeatures: optfeaturelist }; xrpermissiondescriptor.optionalfeatures = optfeaturelist; optfeaturelist = xrpermissiondescriptor.optionalfeatures; value an array of strings taken from the xrreferencespacetype enumerated type, indicating set of features that your app would like to use, but can operate without if permission to use them isn't available. while further features may be defined in future editions of webxr, currently all permitted values come from the xrreferencespace...
XRPermissionStatus - Web APIs
ssions tate. properties in addition to the properties listed below, xrpermissionstatus includes the properties defined by its parent interface, permissionstatus. granted an array of strings listing the names of the features for which permission has been granted as of the time at which navigator.permissions.query() was called. any feature which was specified in either the optionalfeatures or requiredfeatures when calling navigator.permissions.query() are listed in granted if and only if permission to use them is granted. methods no methods are defined by xrpermissionstatus. usage notes examples specifications specification status comment webxr device apithe definition of 'xrpermissionstatus' in that specification. working draft initial definition. ...
XRSystem: requestSession() - Web APIs
he following: invalidstateerror the requested session mode is immersive-vr but there is already an immersive vr session either currently active or in the process of being set up. there can only be one immersive vr session at a time. notsupportederror there is no webxr-compatible device available, or the device does not support the specified sessionmode; this can also be thrown if any of the required options are unsupported. securityerror permission to enter the specified xr mode is denied. this can happen for a number of reasons, which are covered in more detail in permissions and security in webxr device api. examples creating an immersive vr session the following example calls requestsession() requesting an "immersive-vr" session. if the promise resolves, it sets up a session and...
XRWebGLLayer.framebuffer - Web APIs
ng a stencil will not have a stencil buffer. opaque framebuffers will not have an alpha channel available unless the alpha property is true when creating the layer. the xr compositor assumes that opaque framebuffers use colors with premultiplied allpha, regardless of whether or not the webgl context's premultipliedalpha context attribute is set. note: the depth and stencil properties are not required to be supported in order for a browser to be construed as having full webgl support. the default configuration of a new framebuffer upon creating a new xrwebgllayer, its new framebuffer is initialized just like the default framebuffer for any webgl interface: the color buffer is configured with its clear value set to the color (0, 0, 0, 0) (meaning transparent black). the depth buffer's cl...
XSL Transformations in Mozilla FAQ - Web APIs
this does not affect css stylesheets loaded from the generated dom, those honor media just like in pages without xslt. how do i do transformnode? there is transformtodocument and transformtofragment starting with mozilla 1.2 final, see using the mozilla javascript interface to xsl transformations. why does internet explorer require a different xslt namespace than mozilla? ie up to version 6 required a deprecated namespace of a xslt working draft, please update to mozilla ;-), ie6+ or msxml3+, as it is fixed there. as the differences between xslt1.0 and the ie implementation of that wd are significant, we offer no legacy support. how do i build the standalone version of transformiix? see the building transformiix standalone page. original document information author(s): axel hecht las...
Web APIs
Web › API
dlength svganimatedlengthlist svganimatednumber svganimatednumberlist svganimatedpoints svganimatedpreserveaspectratio svganimatedrect svganimatedstring svganimatedtransformlist svganimationelement svgcircleelement svgclippathelement svgcolorprofileelement svgcomponenttransferfunctionelement svgcursorelement svgdefselement svgdescelement svgelement svgellipseelement svgevent svgexternalresourcesrequired svgfeblendelement svgfecolormatrixelement svgfecomponenttransferelement svgfecompositeelement svgfeconvolvematrixelement svgfediffuselightingelement svgfedisplacementmapelement svgfedistantlightelement svgfedropshadowelement svgfefloodelement svgfefuncaelement svgfefuncbelement svgfefuncgelement svgfefuncrelement svgfegaussianblurelement svgfeimageelement svgfemergeelement svgfemergenodeelement...
Using the alert role - Accessibility
role is most useful for information that requires the user's immediate attention, for example: an invalid value was entered into a form field the user's login session is about to expire the connection to the server was lost, local changes will not be saved because of its intrusive nature, the alert role must be used sparingly and only in situations where the user's immediate attention is required. dynamic changes that are less urgent should use a less aggressive method, such as aria-live="polite" or other live region roles. possible effects on user agents and assistive technology when the alert role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having an alert role in the operating system's accessibility api...
Using the aria-valuemax attribute - Accessibility
description the aria-valuemax attribute is used to define the maximum value allowed for a range widget such as a slider, spinbutton or progressbar. if the aria-valuenow has a known maximum and minimum, the author should provide properties for aria-valuemax and aria-valuemin. the value of aria-valuemax must be greater than or equal to the value of aria-valuemin. aria-valuemax is a required attribute of role slider, scrollbar and spinbutton. value string representation of a number possible effects on user agents and assistive technology if the aria-valuemax is indeterminate, or if aria-valuemin is not less than or equal to the value of aria-valuemax, this creates an error condition that will be handled by the assistive technology. note: opinions may differ on how assistive technol...
Using the aria-valuemin attribute - Accessibility
the aria-valuemin attribute is used to define the minimum value allowed for a range widget such as a slider, spinbutton or progressbar. if the aria-valuenow has a known maximum and minimum, the author should provide properties for aria-valuemax and aria-valuemin.the value of aria-valuemin must be less than or equal to the value of aria-valuemax. aria-valuemin is a required attribute of role slider, scrollbar and spinbutton. value string representation of a number possible effects on user agents and assistive technology if aria-valuemin is not less than or equal to the value of aria-valuemax, this creates an error condition that will be handled by the assistive technology. note: opinions may differ on how assistive technology should handle this technique. the information provided abo...
Using the aria-valuenow attribute - Accessibility
n with aria-valuenow to provide a user-friendly representation of the range's current value. for example, a slider may have rendered values of small, medium, and large. in this case, the values of aria-valuenow could range from 1 through 3, which indicate the position of each value in the value space, but the aria-valuetext would be one of the strings: small, medium, or large. aria-valuenow is a required attribute of role slider, scrollbar and spinbutton. value string representation of a number possible effects on user agents and assistive technology for elements with role progressbar and scrollbar, assistive technologies should render the actual value as a percentage, calculated as a position on the range from aria-valuemin to aria-valuemax if both are defined, otherwise the actual value wi...
ARIA: tabpanel role - Accessibility
the aria tabpanel role indicates description an element with the tabpanel role associated roles and attributes aria- keyboard interaction key action tab → ← delete required javascript features include note about semantic alternatives to using this role or attribute. the first rule of aria use is you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and adding an aria role, state or property to make it accessible, then do so. then post full details in best practices section below. examples fill in a simple example that nicely shows a typical usage of the property, then perhaps some more complex examples. <div role="tablist">...
ARIA: timer role - Accessibility
nal instructions for navigating or operating this element. aria-roledescription used to give the timer a more descriptive role text for screen readers to speak. this should be localized. keyboard interactions keyboard interaction is xxx. focus is being managed via xxx. the tab , space and enter keys, as well as escape , must be handled by the application. the one exception is if focus xxx. required javascript features keypress used to handle keyboard input and control the focus click, touch handle as appropriate for your widget as well changing attribute values aria-activedescendant is used to manage the focus inside the application container. set in response to keyboard or other application events that change focus or point of interaction. the timer role does not have a related ...
ARIA: alert role - Accessibility
e user an element has been dynamically updated. the alert role is added to the node containing an alert message, not the element causing the alert to be triggered. alerts are assertive live regions. setting role="alert" is equivalent to setting aria-live="assertive" and aria-atomic="true". they don't receive focus, and therefore focus does not need to be managed and no user interaction should be required. the most important thing to know about the alert role is that it is for dynamic content. it is perfect for situations such as when a user fills out a form and javascript is used to add an error message - the alert would immediately read out the message. it should not be used on html where the user hasn't interacted with it. for example, if a page loads with multiple visible alerts scattered thr...
ARIA: application role - Accessibility
dback via an aria live region to communicate the position and overlap status with other objects. focus is being managed via aria-activedescendant. the tab , space and enter keys, as well as escape , must be handled by the application. the one exception is if focus is set to a standard widget inside the application that supports keyboard navigation from the browser, for example an input element. required javascript features keypress used to handle keyboard input and control the focus click, touch handle as appropriate for your widget as well changing attribute values aria-activedescendant is used to manage the focus inside the application container. set in response to keyboard or other application events that change focus or point of interaction. the application role does not have a re...
ARIA: article role - Accessibility
al media feed. associated wai-aria roles, states, and properties aria-posinset in the context of a feed, indicates the position of this particular article within that feed, based on a count starting at 1. aria-setsize in the context of a feed, indicates how many article items there are within that feed. keyboard interactions this role does not support any specific keyboard interaction. required javascript features event handlers this role does not require any event handlers to be present. changing attribute values when constructing a feed, set the aria-posinset and aria-setsize attributes on each article role to the appropriate values, bearing in mind that aria-posinset is 1-based. always use native element if available. instead of a div with the article role, the <article> ele...
ARIA: banner role - Accessibility
dmark, but each page should be limited to only one header with the role of banner. in the case of a page containing nested document and/or application roles, each nested document or application role may also have one banner landmark. if a page includes more than one banner landmark, each should have a unique label. associated aria roles, states, and properties none keyboard interactions none required javascript features none examples here's a fake simple banner with a skip to navigation link, a logo, a title and a subtitle. as this is the main header for the site, we've added the banner landmark role to the container element. <div role="banner"> <a href="#nav" id="skiptomenu" class="skiptocontent">skip to keyboard navigation</a> <img src="images/w3c.png" alt="w3c logo"> <h1>aria lan...
ARIA: document role - Accessibility
ich means the document is not collapsible. tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. keyboard interactions the element should be made focusable by setting the tabindex="0" attribute / value pair on it. this way, the user can tab to it, reading mode is invoked automatically, and the content can be read right away. required javascript features none, except as required by any attributes. for example, if the document is collapsible, then the state and the value of aria-expanded must be maintained. examples an example is gmail and the single conversation view. gmail is a web application. when in gmail, most user agent interactions are usurped by the application. however, when the keyboard focus is set on the startin...
ARIA: feed role - Accessibility
as the primary content of the article. each article element has aria-posinset set to a value that represents its position in the feed and an aria-setsize set to a value that represents either the total number of articles that have been loaded or the total number in the feed, depending on which value is more helpful to users. if the total number in the feed is not known, set aria-setsize="-1". required javascript features none, except as required by any attributes. for example, setting aria-busy to true during the update operation if needed, and then to false upon completion. examples example implementation of feed pattern specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'feed' in that specification. recommend...
ARIA: figure role - Accessibility
ement containing reference text serving as a caption. aria-labelledby the id of an element containing text serving as a label. aria-label if there is no element containing text that could serve as a label, you can add the label directly as a value on the aria-label on the element with the figure role or on the <figure> element. keyboard interactions no role specific keyboard interactions. required javascript features no role specific javascript requirements. if you don't have control over the html semantics, you can improve the accessibility of html by adding these roles and properties with javascript. examples we could extend the initial example on the page to also identify a paragraph that provides a descriptive label for the figure by referencing its id in aria-labelledby: <div role...
ARIA: form role - Accessibility
he role="form" to identify a region of the page; do not use it to identify every form field. even if you are using the form landmark instead of <form>, you are encouraged to use native html form controls like button, input, select, and textarea associated wai-aria roles, states, and properties no role specific states or properties. keyboard interactions no role specific keyboard interactions required javascript features onsubmit the onsubmit event handler handles the event raised when the form is submitted. anything that is not a <form> cannot be submitted, therefore you would have to use javascript to build an alternative data submission mechanism, for example with xmlhttprequest. examples <div role="form" id="send-comment" aria-label="add a comment"> <label for="username">username<...
ARIA: gridcell role - Accessibility
oggle aria-readonly on the gridcell element. expandable cells in a treegrid, gridcells may be made expandable by toggling the aria-expanded attribute. note that if this attribute is provided, it applies only to the individual gridcell. associated wai-aria roles, states, and properties grid communicates that a parent element is a a table or tree style grouping of information. row required to communicate the gridcell is part of a row of a table-style grouping of information. columnheader specifies which element is the associated column header. aria-colindex identifies the position of an element in relation to the rest of the table-style grouping of information's columns. rowheader specifies which element is the associated row header. aria-rowindex identifies the...
ARIA: List role - Accessibility
ple. associated wai-aria roles, states, and properties listitem a single item in a list or directory. elements with role listitem can only be found in an element with the role list or group. group a collection of related objects, limited to list items when nested in a list, not important enough to have their own place in a pages table of contents. keyboard interactions none. required javascript features none. examples aria lists — some useful examples and thoughts by scott o'hara best practices only use role="list" and role="listitem" if you have to — for example if you don't have control over your html but are able to improve accessibility dynamically after the fact with javascript. unlike the html <ol> and <ul>, the aria list roles doesn't distinguish between ord...
ARIA: Listitem role - Accessibility
ments with role list must have one or more elements with the role listitem as children, a one or more elements with the role of group that have one or more elements with the listitem role as children. group a collection of related objects, limited to list items when nested in a list, not important enough to have their own place in a pages table of contents. keyboard interactions none. required javascript features none. examples aria lists — some useful examples and thoughts by scott o'hara best practices only use role="list" and role="listitem" if you have to — for example if you don't have control over your html but are able to improve accessibility dynamically after the fact with javascript. if at all possible, you should use the appropriate semantic html elements to mark ...
ARIA: Navigation Role - Accessibility
y communicate a section has a role of navigation. developers should always prefer using the correct semantic html element over using aria. associated wai-aria roles, states, and properties aria-label a brief description of the purpose of the navigation, omitting the term "navigation", as the screen reader will read both the role and the contents of the label. keyboard interactions none. required javascript features none. examples <div role="navigation" aria-label="customer service"> <ul> <li><a href="#">help</a></li> <li><a href="#">order tracking</li> <li><a href="#">shipping &amp; delivery</a></li> <li><a href="#">returns</a></li> <li><a href="#">contact us</a></li> <li><a href="#">find a store</a></li> </ul> </div> accessibility concerns landmark role...
ARIA: Region role - Accessibility
if it is given an accessible name. developers should always prefer using the correct semantic html element, in this case <section>, over using aria. associated wai-aria roles, states, and properties aria-labelledby use this attribute to label the region. often, the value of the aria-labelledby attribute will be the id of the element used to title the section. keyboard interactions none. required javascript features none. examples <div role="region" aria-labelledby="region-heading"> <h2 id="region-heading">this heading's <code>id</code> attribute helps this region have an accessible name</h2> <!-- region content --> </div> accessibility concerns use sparingly! landmark roles are intended to be used sparingly, to identify larger overall sections of the document. using too many la...
ARIA: img role - Accessibility
s, but some of them end up reading the label out twice. use with caution and test thoroughly. another example where this might be suitable is when using ascii emoji combinations, like the legendary "table flip": <div role="img" aria-label="table flip"> <p> (╯°□°)╯︵ ┻━┻ </p> </div> associated wai-aria roles, states, and properties aria-label an accessible name is required. an aria-label attribute keyboard interactions required javascript features examples star rating role="img" example specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'img' in that specification. recommendation screen reader support tbd ...
ARIA: row role - Accessibility
indicating the position, or index, of each row. for example, if a table has 1,500 rows, but only the header and rows 47 and 52 are in the dom, aria-rowindex="1" would be set on the header row, and aria-rowindex="47" and aria-rowindex="52" would be set on the 47th and 52nd row, respectively. if all the rows are present in the dom, this attribute is not necessary. keyboard interactions none required javascript features none. for sortable columns, see the columnheader aria role. the first rule of aria use is you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and adding an aria role, state or property to make it accessible, then do so. employ the html <table> element instead of the aria role of table whenever poss...
ARIA: rowgroup role - Accessibility
data arranged in rows and columns, similar to the native <table> html element. role="treegrid" similar to a grid, but with rows that can be expanded and collapsed in the same manner as for a tree. descendant roles role="row" a row of cells within a tabular structure. a row contains one or more cells, gridcell, or column headers, and sometimes a row header. keyboard interactions none required javascript features none. the first rule of aria use is if you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and adding an aria role, state or property to make it accessible, then do so. employ the html <table> element instead of the aria role of table whenever possible. examples <div role="table" aria-label="semant...
ARIA: tab role - Accessibility
focuses and optionally activates the next tab in the tab list. if the current tab is the last tab in the tab list it activates the first tab. ← focuses and optionally activates the previous tab in the tab list. if the current tab is the first tab in the tab list it activates the last tab. delete when allowed removes the currently selected tab from the tab list. required javascript features while there are ways to build tab-like functionality without javascript, there are no substitute combination of html and css only that will provide the same set of functionality that's required above for accessible tabs with content. example this example combines the role tab with tablist and elements with tabpanel to create an interactive group of tabbed content. here w...
ARIA: heading role - Accessibility
ed wai-aria roles, states, and properties aria-level the aria-level attribute specifies the heading level in the document structure. if no level is present, a value of 2 is the default. keyboard interactions this role does not require any special keyboard navigation. as with any heading, giving it an id ensures it can be referenced from anchor links, making it accessible via the keyboard. required javascript features required event handlers none. changing attribute values usually not required, unless dynamically inserting content. in that case, the newly-added headings need aria-level attributes whose values are consistent with the rest of the document structure. instead of using a <div> or <span> with a heading role and aria-level, consider using a native <h1> through <h6> elemen...
Forms - Accessibility
...
Operable - Accessibility
nt input methods beyond a keyboard or mouse (including touchscreen, voice, device motion, or alternative input devices. success criteria how to conform to the criteria practical resource 2.5.1 pointer gestures (a) added in 2.1 all functionality that can be operated with a pointer can be operated with single-point actions. path-based or multi-point gestures are not required to operate any functionality. exceptions exist. understanding pointer gestures 2.5.2 pointer cancellation (a) added in 2.1 for functionality that can be operated using a single-pointer at least one of the following is true: no down-event, abort/undo, up reversal or essential. understanding pointer cancellation 2.5.3 label in name (a) added in 2.1 for each user interf...
Understanding the Web Content Accessibility Guidelines - Accessibility
the wcag 2.0 and 2.1 provide a detailed set of guidelines for making web content more accessible to people with a wide variety of disabilities. it is comprehensive but incredibly detailed, and quite difficult to gain a rapid understanding of. for this reason, we have summarised the practical steps you need to take to satisfy the different recommendations, with further links to more details where required. the four principles wcag is broadly broken down into four principles — major things that web content must be to be considered accessible (see understanding the four principles of accessibility for the wcag definitions). each of the links below will take you to pages that further expand on these areas, giving you practical advice on how to write your web content so it conforms to the success...
::-webkit-meter-optimum-value - CSS: Cascading Style Sheets
ter-optimum-value css pseudo-element styles the <meter> element when its value is inside the low-high range. green is the default color. syntax ::-webkit-meter-optimum-value specifications not part of any standard. ...
::after (:after) - CSS: Cascading Style Sheets
Web › CSS › ::after
at the orange box after this text. </span> css .ribbon { background-color: #5bc8f7; } .ribbon::after { content: "this is a fancy orange box."; background-color: #ffba10; border-color: black; border-style: dotted; } result tooltips this example uses ::after, in conjunction with the attr() css expression and a data-descr custom data attribute, to create tooltips. no javascript is required! we can also support keyboard users with this technique, by adding a tabindex of 0 to make each span keyboard focusable, and using a css :focus selector. this shows how flexible ::before and ::after can be, though for the most accessible experience a semantic disclosure widget created in some other way (such as with details and summary elements) is likely to be more appropriate. html <p>here w...
::placeholder - CSS: Cascading Style Sheets
e able to read it while also making sure there is enough of a difference between the placeholder text and input text color that users do not mistake the placeholder for inputed data. color contrast ratio is determined by comparing the luminosity of the placeholder text and the input background color values. in order to meet current web content accessibility guidelines (wcag), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. large text is defined as 18.66px and bold or larger, or 24px or larger. webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 usability placeholder text with sufficient color contrast may be interpreted as entered input. placeholder text...
:blank - CSS: Cascading Style Sheets
Web › CSS › :blank
note: the :blank selector is considered at risk, as the csswg keeps changing it. see csswg issue #1967. the :blank css pseudo-class selects empty user input elements (eg. <input> or <textarea>). syntax :blank examples simple :blank example in eventual supporting browsers, the :blank pseudo-class will enable developers to highlight in some way input controls that are not required, but still have no content filled in, perhaps as a reminder to users. html <textarea></textarea> css textarea:blank { border: 3px solid red; } result specifications specification status comment selectors level 4the definition of ':blank' in that specification. working draft initial definition. ...
:nth-child() - CSS: Cascading Style Sheets
selectors level 3the definition of ':nth-child' in that specification. recommendation initial definition. ...
:nth-last-child() - CSS: Cascading Style Sheets
selectors level 3the definition of ':nth-last-child' in that specification. recommendation initial definition. ...
:nth-last-of-type() - CSS: Cascading Style Sheets
selectors level 3the definition of ':nth-last-of-type' in that specification. recommendation initial definition. ...
:nth-of-type() - CSS: Cascading Style Sheets
selectors level 3the definition of ':nth-of-type' in that specification. recommendation initial definition. ...
font-family - CSS: Cascading Style Sheets
the font-family css descriptor allows authors to specify the font family for the font specified in an @font-face rule. syntax /* <string> values */ font-family: "font family"; font-family: 'another font family'; /* <custom-ident> value */ font-family: examplefont; values <family-name> specifies the name of the font family. formal definition related at-rule@font-faceinitial valuen/a (required)computed valueas specified formal syntax <family-name>where <family-name> = <string> | <custom-ident>+ examples setting the font family name @font-face { font-family: examplefont; src: url('examplefont.ttf'); } specifications specification status comment css fonts module level 3the definition of 'font-family' in that specification. candidate recommendatio...
@supports - CSS: Cascading Style Sheets
Web › CSS › @supports
any operator, the not operator can be applied to a declaration of any complexity. the following examples are both valid: @supports not (not (transform-origin: 2px)) {} @supports (display: grid) and (not (display: inline-grid)) {} note: there is no need to enclose the not operator between two parentheses at the top level. to combine it with other operators, like and and or, the parentheses are required. the and operator the and operator creates a new expression from the conjunction of two shorter expressions. it returns true only if both of the shorter expressions are also true. the following example returns true if and only if the two shorter expressions are simultaneously true: @supports (display: table-cell) and (display: list-item) {} multiple conjunctions can be juxtaposed without the...
Box alignment in Flexbox - CSS: Cascading Style Sheets
main axis = direction set by flex-direction = alignment via justify-content the cross axis = runs across the main axis = alignment via align-content, align-self/align-items main axis alignment justify-content cross axis alignment align-self align-items align-content there is no justify-self in flexbox on the main axis, flexbox deals with our content as a group. the amount of space required to lay out the items is calculated, and the leftover space is then available for distribution. the justify-content property controls how that leftover space is used. set justify-content: flex-end and the extra space is placed before the items, justify-content: space-around and it is placed either side of the item in that dimension, etc. this means that a justify-self property does not make sense...
CSS Multi-column Layout - CSS: Cascading Style Sheets
with a class of container. as the value of column-count is 3, the content is arranged into 3 columns of equal size. relationship to fragmentation multiple-column layout is closely related to paged media, in that each column box becomes a fragment, much like a printed page becomes a fragment of an overall document. therefore the properties now defined in the css fragmentation specification are required in order to control how content breaks between columns. reference multiple-column layout properties column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns related css fragmentation properties break-after break-before break-inside orphans widows guides basic concepts of multicol an ove...
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
been aligning the items, or an individual item inside the area defined by the flex-container. if you have a wrapped multiple-line flex container then you might also want to use the align-content property to control the distribution of space between the rows. in the specification this is described as packing flex lines. for align-content to work you need more height in your flex container than is required to display the items. it then works on all the items as a set, and dictates what happens with that free space, and the alignment of the entire set of items within it. the align-content property takes the following values: align-content: flex-start align-content: flex-end align-content: center align-content: space-between align-content: space-around align-content: stretch align-content: ...
Basic concepts of flexbox - CSS: Cascading Style Sheets
x-shrink is 1, so items can shrink if they need to rather than overflowing. the value of flex-basis is auto. items will either use any size set on the item in the main dimension, or they will get their size from the content size. using flex: auto is the same as using flex: 1 1 auto; everything is as with flex:initial but in this case the items can grow and fill the container as well as shrink if required. using flex: none will create fully inflexible flex items. it is as if you wrote flex: 0 0 auto. the items cannot grow or shrink but will be laid out using flexbox with a flex-basis of auto. the shorthand you often see in tutorials is flex: 1 or flex: 2 and so on. this is as if you used flex: 1 1 0. the items can grow and shrink from a flex-basis of 0. try these shorthand values in the live ex...
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
he below screenshots show the expected rendering. remember this behaviour and what effects min-content and max-content have as we explore flex-grow and flex-shrink later in this article. positive and negative free space to talk about these properties we need to understand the concept of positive and negative free space. when a flex container has positive free space, it has more space than is required to display the flex items inside the container. for example, if i have a 500 pixel-wide container, flex-direction is row, and i have three flex items each 100 pixels wide, then i have 200 pixels of positive free space, which could be distributed between the items if i wanted them to fill the container. we have negative free space when the natural size of the items adds up to larger than the av...
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
s this behaviour is useful if you want to target flex items using javascript to show and hide content for example. the example in the specification demonstrates one such pattern. in the following live example i have a non-wrapped flex container. the third item has more content than the others yet is set to visibility: collapse and therefore the flex container is retaining a strut of the height required to display this item. if you remove visibility: collapse from the css or change the value to visible, you will see the item disappear and the space redistribute between non-collapsed items; the height of the flex container should not change. note: use firefox for the below two examples as chrome and safari treat collapse as hidden. when dealing with multiple-line flex containers however you...
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
ion, see display: contents. also, having removed the box you cannot then use it to — for example — add a background colour behind the nested sub children. if you remove display: contents in this live example you will see that the direct child we are removing has an orange background colour. this also disappears when the box disappears. browser support for display:contents is limited and required for this demo to work. firefox supports display: contents already, and the value is being implemented in chrome. once there is better browser support this feature will be very useful in circumstances where you need the markup for semantic reasons but do not want to display the box that it would generate by default. ...
Variable fonts guide - CSS: Cascading Style Sheets
hat the authors of the specification felt it was worth standardizing. the five currently registered axes are weight, width, slant, italic, and optical size. the w3c has undertaken mapping them to existing css attributes, and in one case introduced a new one, which you'll see below. custom axes are in fact limitless: the typeface designer can define and scope any axis they like, and are just required to give it a four-letter tag to identify it within the font file format itself. you can use these four-letter tags in css to specify a point along that axis of variation, as will be show in the code examples below. registered axes and existing css attributes in this section we'll demonstrate the five registered axes defined with examples and the corresponding css. where possible, both the st...
Subgrid - CSS: Cascading Style Sheets
id i have twelve items trying to autoplace into ten grid cells. as the subgrid is on both dimensions there is nowhere for the extra two items to go and so they go into the last track of the grid, as defined in the specification. if we remove the grid-template-rows value we enable regular creation of implicit tracks and, although these won't line up with the tracks of the parent, as many as are required will be created. the gap properties and subgrid if you have a gap, column-gap, or row-gap specified on the parent, this will be passed into the subgrid, so it will have the same spacing between tracks as the parent. in some situations however you may wish the subgrid tracks to have a different gap or no gap. this can be achieved by using the gap-* properties on the grid container of the subgr...
CSS reference - CSS: Cascading Style Sheets
Web › CSS › Reference
pagepage-break-afterpage-break-beforepage-break-insidepaint()paint-orderpath()pc<percentage>perspectiveperspective()perspective-originplace-contentplace-itemsplace-self::placeholderpointer-eventspolygon()<position>positionprefix (@counter-style)ptpxqqquotesrradradial-gradient()range (@counter-style)<ratio>:read-only:read-writerect()remrepeat()repeating-linear-gradient()repeating-radial-gradient():requiredresize<resolution>revertrgb()rgba():rightright@right-bottom:rootrotaterotate()rotate3d()rotatex()rotatey()rotatez()row-gapsssaturate()scalescale()scale3d()scalex()scaley()scalez():scopescroll-behaviorscroll-marginscroll-margin-blockscroll-margin-block-endscroll-margin-block-startscroll-margin-bottomscroll-margin-inlinescroll-margin-inline-endscroll-margin-inline-startscroll-margin-leftscroll-margi...
Value definition syntax - CSS: Cascading Style Sheets
d smaller, smaller bold smaller, smaller, smaller, and so on. but not: bold, as smaller must appear at least one time. bold smaller smaller smaller, as the different occurrence of smaller must be separated by commas. smaller, as bold is juxtaposed and must appear before any smaller keyword. exclamation point (!) the exclamation point multiplier after a group indicates that the group is required, and must produce at least one value; even if the grammar of the items within the group would otherwise allow the entire contents to be omitted, at least one component value must not be omitted. [ bold? smaller? ]! this example matches the following values: bold smaller bold smaller but not: neither bold nor smaller, as one of them must appear. smaller bold, as bold is juxtaposed an...
animation-delay - CSS: Cascading Style Sheets
tion properties at once. syntax /* single animation */ animation-delay: 3s; animation-delay: 0s; animation-delay: -1500ms; /* multiple animations */ animation-delay: 2.1s, 480ms; values <time> the time offset, from the moment at which the animation is applied to the element, at which the animation should begin. this may be specified in either seconds (s) or milliseconds (ms). the unit is required. a positive value indicates that the animation should begin after the specified amount of time has elapsed. a value of 0s, which is the default, indicates that the animation should begin as soon as it's applied. a negative value causes the animation to begin immediately, but partway through its cycle. for example, if you specify -1s as the animation delay time, the animation will begin immedi...
animation-duration - CSS: Cascading Style Sheets
tion properties at once. syntax /* single animation */ animation-duration: 6s; animation-duration: 120ms; /* multiple animations */ animation-duration: 1.64s, 15.22s; animation-duration: 10s, 35s, 230ms; values <time> the time that an animation takes to complete one cycle. this may be specified in either seconds (s) or milliseconds (ms). the value must be positive or zero and the unit is required. a value of 0s, which is the default value, indicates that no animation should occur. note: negative values are invalid, causing the declaration to be ignored. some early, prefixed, implementations may consider them as identical to 0s. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name pr...
background-color - CSS: Cascading Style Sheets
ure that the contrast ratio between the background color and the color of the text placed over it is high enough that people experiencing low vision conditions will be able to read the content of the page. color contrast ratio is determined by comparing the luminance of the text and background color values. in order to meet current web content accessibility guidelines (wcag), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. large text is defined as 18.66px and bold or larger, or 24px or larger. webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 formal definition initial valuetransparentapplies toall elements. it also applies to ::first-letter and ::firs...
<basic-shape> - CSS: Cascading Style Sheets
nd evenodd. default value when omitted is nonzero. each pair argument in the list represents xi and yi - the x and y axis coordinates of the ith vertex of the polygon. path() path( [<fill-rule>,]? <string>) the optional <fill-rule> represents the filling rule used to determine the interior of the path. possible values are nonzero and evenodd. default value when omitted is nonzero. the required <string> is an svg path string encompassed in quotes the arguments not defined above are defined as follows: <shape-arg> = <length> | <percentage> <shape-radius> = <length> | <percentage> | closest-side | farthest-side defines a radius for a circle or ellipse. if omitted it defaults to closest-side. closest-side uses the length from the center of the shape to the closest side of the refere...
border-bottom-left-radius - CSS: Cascading Style Sheets
cle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valuetwo absolute <length>s or <percentage>sanimation typea length, percentage or calc(); formal syntax <length-percentage>{1,2}wh...
border-bottom-right-radius - CSS: Cascading Style Sheets
cle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valuetwo absolute <length>s or <percentage>sanimation typea length, percentage or calc(); formal syntax <length-percentage>{1,2}wh...
border-end-end-radius - CSS: Cascading Style Sheets
cle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valuetwo absolute <length>s or <percentage>sanimation typea length, percentage or calc(); formal syntax <length-percentage>{1,2}wh...
border-end-start-radius - CSS: Cascading Style Sheets
cle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valuetwo absolute <length>s or <percentage>sanimation typea length, percentage or calc(); formal syntax <length-percentage>{1,2}wh...
border-image-width - CSS: Cascading Style Sheets
for horizontal offsets and the height of the border image area for vertical offsets. must not be negative. <number> the width of the border, specified as a multiple of the corresponding border-width. must not be negative. auto the width of the border is made equal to the intrinsic width or height (whichever is applicable) of the corresponding border-image-slice. if the image does not have the required intrinsic dimension, the corresponding border-width is used instead. formal definition initial value1applies toall elements, except internal table elements when border-collapse is collapse. it also applies to ::first-letter.inheritednopercentagesrefer to the width or height of the border image areacomputed valueas specified, but with relative lengths converted into absolute lengthsanimation ty...
border-image - CSS: Cascading Style Sheets
around a given element. it replaces the element's regular border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: you should specify a separate border-style in case the border image fails to load. indeed, this is required according to the specification, although not all browsers implement this requirement. constituent properties this property is a shorthand for the following css properties: border-image-outset border-image-repeat border-image-slice border-image-source border-image-width syntax /* source | slice */ border-image: linear-gradient(red, blue) 27; /* source | slice | repeat */ border-image...
border-radius - CSS: Cascading Style Sheets
the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valueas each of the properties of the shorthand:border-bottom-left-radius: two absolute <length>s or <percentage>sborder-bottom-righ...
border-start-end-radius - CSS: Cascading Style Sheets
cle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valuetwo absolute <length>s or <percentage>sanimation typea length, percentage or calc(); formal syntax <length-percentage>{1,2}wh...
border-start-start-radius - CSS: Cascading Style Sheets
cle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valuetwo absolute <length>s or <percentage>sanimation typea length, percentage or calc(); formal syntax <length-percentage>{1,2}wh...
border-top-left-radius - CSS: Cascading Style Sheets
cle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valuetwo absolute <length>s or <percentage>sanimation typea length, percentage or calc(); formal syntax <length-percentage>{1,2}wh...
border-top-right-radius - CSS: Cascading Style Sheets
cle radius or the semi-major and semi-minor axes of the ellipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valuetwo absolute <length>s or <percentage>sanimation typea length, percentage or calc(); formal syntax <length-percentage>{1,2}wh...
color - CSS: Cascading Style Sheets
Web › CSS › color
that the contrast ratio between the color of the text and the background the text is placed over is high enough that people experiencing low vision conditions will be able to read the content of the page. color contrast ratio is determined by comparing the luminosity of the text and background color values. in order to meet current web content accessibility guidelines (wcag), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. large text is defined as 18.66px and bold or larger, or 24px or larger. webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 formal definition initial valuevaries from one browser to anotherapplies toall elements. it also applies to ::f...
cross-fade() - CSS: Cascading Style Sheets
omitting the comma or percent invalidates the value. the percent is the opacity of the first declared image. the included percentage is subtracted from 100%, with the difference being the opacity of the second image. the green/red example (with the percentages totalling 150%) and the yellow/red/blue example (with three images) from the specification syntax section, are not possibl...
cursor - CSS: Cascading Style Sheets
Web › CSS › cursor
recommendation addition of several keywords and the positioning syntax for url(). css level 2 (revision 1)the definition of 'cursor' in that specification. ...
drop-shadow() - CSS: Cascading Style Sheets
, while the drop-shadow() filter function creates a shadow that conforms to the shape (alpha channel) of the image itself. syntax drop-shadow(offset-x offset-y blur-radius color) the drop-shadow() function accepts a parameter of type <shadow> (defined in the box-shadow property), with the exception that the inset keyword and spread parameters are not allowed. parameters offset-x offset-y (required) two <length> values that determine the shadow offset. offset-x specifies the horizontal distance, where negative values place the shadow to the left of the element. offset-y specifies the vertical distance, where negative values place the shadow above the element. if both values are 0, the shadow is placed directly behind the element. blur-radius (optional) the shadow's blur radius, specified...
filter - CSS: Cascading Style Sheets
Web › CSS › filter
e. the function accepts a parameter of type <shadow> (defined in css3 backgrounds), with the exception that the inset keyword is not allowed. this function is similar to the more established box-shadow property; the difference is that with filters, some browsers provide hardware acceleration for better performance. the parameters of the <shadow> parameter are as follows: <offset-x> <offset-y> (required) these are two <length> values to set the shadow offset. <offset-x> specifies the horizontal distance. negative values place the shadow to the left of the element. <offset-y> specifies the vertical distance. negative values place the shadow above the element. see <length> for possible units. if both values are 0, the shadow is placed behind the element (and may generate a blur effect if <blur-r...
font-size - CSS: Cascading Style Sheets
Web › CSS › font-size
ment on which the em is used. if you haven't set the font size anywhere on the page, then it is the browser default, which is often 16px. so, by default 1em = 16px, and 2em = 32px. if you set a font-size of 20px on the body element, then 1em = 20px and 2em = 40px. note that the value 2 is essentially a multiplier of the current em size. in order to calculate the em equivalent for any pixel value required, you can use this formula: em = desired element pixel value / parent element font-size in pixels for example, suppose the font-size of the body of the page is set to 16px. if the font-size you want is 12px, then you should specify 0.75em (because 12/16 = 0.75). similarly, if you want a font size of 10px, then specify 0.625em (10/16 = 0.625); for 22px, specify 1.375em (22/16). the em is a very ...
font-stretch - CSS: Cascading Style Sheets
he league mono variable font, developed by tyler finck (https://www.tylerfinck.com/) and used here under the terms of the sil open font license, version 1.1: http://scripts.sil.org/cms/scripts/page.php?item_id=ofl_web */ @font-face { src: url('https://mdn.mozillademos.org/files/16014/leaguemonovariable.ttf'); font-family:'leaguemonovariable'; font-style: normal; font-stretch: 1% 500%; /* required by chrome */ } .container { border: 10px solid #f5f9fa; padding: 0 1rem; font: 1.5rem 'leaguemonovariable', sans-serif; } .condensed { font-stretch: 50%; } .normal { font-stretch: 100%; } .expanded { font-stretch: 200%; } result specifications specification status comment css fonts module level 4the definition of 'font-stretch' in that specificat...
image-orientation - CSS: Cascading Style Sheets
used for the purpose of correcting the orientation of images which were shot with the camera rotated. it should not be used for arbitrary rotations. for any purpose other than correcting an image's orientation due to how it was shot or scanned, use a transform property with the rotate keyword to specify rotation. this includes any user-directed changes to the orientation of the image, or changes required for printing in portrait versus landscape orientation. if used in conjunction with other css properties, such as a <transform-function>, any image-orientation rotation is applied before any other transformations. formal definition initial value0degapplies toall elementsinheritedyescomputed valuean <angle>, rounded to the next quarter turn from 0deg and normalized, that is moduloing the value b...
mask-border-width - CSS: Cascading Style Sheets
horizontal offsets and the height of the border area for vertical offsets. must not be negative. <number> the width of the mask border, specified as a multiple of the corresponding border-width. must not be negative. auto the width of the mask border is made equal to the intrinsic width or height (whichever is applicable) of the corresponding mask-border-slice. if the image does not have the required intrinsic dimension, the corresponding border-width is used instead. formal definition initial valueautoapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednopercentagesrelative to width/height of the mask border image areacomputed valueas specified, but with relative lengths converted into absolute lengthsanimation type...
offset - CSS: Cascading Style Sheets
Web › CSS › offset
note: early versions of the spec called this property motion. ...
opacity - CSS: Cascading Style Sheets
Web › CSS › opacity
ratio between the color of the text and the background the text is placed over is high enough that people experiencing low vision conditions will be able to read the content of the page. color contrast ratio is determined by comparing the luminosity of the opacity-adjusted text and background color values. in order to meet current web content accessibility guidelines (wcag), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. large text is defined as 18.66px and bold or larger, or 24px or larger. webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 formal definition initial value1.0applies toall elementsinheritednocomputed valuethe specified value, clipped i...
overflow-anchor - CSS: Cascading Style Sheets
the overflow-anchor css property provides a way to opt out of the browser's scroll anchoring behavior, which adjusts scroll position to minimize content shifts. scroll anchoring behavior is enabled by default in any browser that supports it. therefore, changing the value of this property is typically only required if you are experiencing problems with scroll anchoring in a document or part of a document and need to turn the behavior off. syntax /* keyword values */ overflow-anchor: auto; overflow-anchor: none; /* global values */ overflow-anchor: inherit; overflow-anchor: initial; overflow-anchor: unset; values auto the element becomes a potential anchor when adjusting scroll position. none the element won't be selected as a potential anchor. formal definition initial valueautoappl...
<resolution> - CSS: Cascading Style Sheets
ess 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 are not allowed between the number and the unit. ten dpi the number must use digits only. 0 the unit is required. specifications specification status comment css values and units module level 4the definition of '<resolution>' in that specification. editor's draft adds the x unit. css values and units module level 3the definition of '<resolution>' in that specification. candidate recommendation adds the dppx unit. media queriesthe definition of '<r...
text-overflow - CSS: Cascading Style Sheets
are clipped to 0. values greater than the width of the line box are clipped to the width of the line box. ...
text-shadow - CSS: Cascading Style Sheets
the first-specified shadow on top. this property applies to both ::first-line and ::first-letter pseudo-elements. values <color> optional. the color of the shadow. it can be specified either before or after the offset values. if unspecified, the color's value is left up to the user agent, so when consistency across browsers is desired you should define it explicitly. <offset-x> <offset-y> required. these <length> values specify the shadow's distance from the text. <offset-x> specifies the horizontal distance; a negative value places the shadow to the left of the text. <offset-y> specifies the vertical distance; a negative value places the shadow above the text. if both values are 0, the shadow is placed directly behind the text, although it may be partly visible due to the effect of <blur-...
text-underline-position - CSS: Cascading Style Sheets
l { writing-mode: vertical-rl; text-underline-position: left; } in this example we set both the paragraphs to have a thick underline. in the horizontal text we use text-underline-position: under; to put the underline below all the descenders. in the text with a vertical writing-mode set, we can then use values of left or right to make the underline appear on the left or right of the text as required. the live example looks like this: setting text-underline-position globally because the text-underline-position property inherits and is not reset by the text-decoration shorthand property, it may be appropriate to set its value at a global level. for example, the under value may be appropriate for a document with lots of chemical and mathematical formulas, which make a large use of subscrip...
url() - CSS: Cascading Style Sheets
Web › CSS › url()
s level 2, the definition of url() was extended to describe any uri, including urns. css values and units level 3 returned to the narrower, initial definition. now, url() denotes only true <url>s. syntax values <string> <url> a url, which is a relative or absolute address, or pointer, to the web resource to be included, or a data uri, optionally in single or double quotes. quotes are required if the url includes parentheses, whitespace, or quotes, unless these characters are escaped, or if the address includes control characters above 0x7e. double quotes cannot occur inside double quotes and single quotes cannot occur inside single quotes unless escaped. the following are all valid and equivalent: <css_property>: url("https://example.com/image.png") <css_property>: url('https://exam...
CSS: Cascading Style Sheets
Web › CSS
our exhaustive css reference for seasoned web developers describes every property and concept of css. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started tutorials our css learning area features multiple modules that teach css from the ground up — no previous knowledge required. css first steps css (cascading style sheets) is used to style and layout web pages — for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can st...
Event reference
ted, and newer implementations use mozbrowsercaretstatechanged instead. mozbrowsershowmodalprompt firefox os browser api-specific sent when alert(), confirm() or prompt() are called within a browser <iframe> mozbrowsertitlechange firefox os browser api-specific sent when the document.title changes within a browser iframe. mozbrowserusernameandpasswordrequired firefox os browser api-specific sent when an http authentication is requested. mozbrowservisibilitychange firefox os browser api-specific sent when the visibility state of the current browser iframe <iframe> changes, for example due to a call to setvisible(). mozgamepadbuttondown to be specified a gamepad button is pressed down. mozgamepadb...
WAI ARIA Live Regions/API Support - Developer guides
hide are the equivalent of those events. ...
Block formatting context - Developer guides
note that flexbox is a more efficient way to implement muti columns layout ...
Using HTML sections and outlines - Developer guides
li> <li><a href="#">secondary link</a></li> </ul> </li> <li><a href="#">primary link</a></li> </ul> </nav> collection of links use the <nav> element only for site navigation menus. collections of links such as social media profiles or a blogroll should not be wrapped in the <nav> element. html elements in <nav> while list elements are common for navigation they are not required. you can use other elements such as <p>. article element the <article> element indicates self-contained content, meaning that if you removed all the other html except the <article> element, the content would still make sense to a reader. <article> <h1>how to become an mdn contributor</h1> <p> do you want to help protect the web?.... </p> </article> nesting elements inside an article...
Index - Developer guides
Web › Guide › Index
ing a cross-browser video player apps, html5, video, full screen this article describes a simple html5 video player that uses the media and fullscreen apis and works across most major desktop and mobile browsers. as well as working fullscreen, the player features custom controls rather than just using the browser defaults. the player controls themselves won't be styled beyond the basics required to get them working; full styling of the player will be taken care of in a future article. 9 cross-browser audio basics apps, audio, guide, html5, media, events this article provides: a basic guide to creating a cross-browser html5 audio player with all the associated attributes, properties, and events explained a guide to custom controls created using the media api ...
Printing - Developer guides
ta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>mdn example</title> <script type="text/javascript"> function closeprint () { document.body.removechild(this.__container__); } function setprint () { this.contentwindow.__container__ = this; this.contentwindow.onbeforeunload = closeprint; this.contentwindow.onafterprint = closeprint; this.contentwindow.focus(); // required for ie this.contentwindow.print(); } function printpage (surl) { var ohiddframe = document.createelement("iframe"); ohiddframe.onload = setprint; ohiddframe.style.position = "fixed"; ohiddframe.style.right = "0"; ohiddframe.style.bottom = "0"; ohiddframe.style.width = "0"; ohiddframe.style.height = "0"; ohiddframe.style.border = "0"; ohiddframe.src = surl; document.body.app...
disabled - HTML: Hypertext Markup Language
he autocomplete attribute to control this feature. attribute interactions the difference between disabled and readonly is that read-only controls can still function and are still focusable, whereas disabled controls can not receive focus and are not submitted with the form and generally do not function as controls until they are enabled. because a disabled field cannot have it's value changed, required does not have any effect on inputs with the disabled attribute also specified. additionally, since the elements become immutable, most other attributes, such as pattern, have no effect, until the control is enabled. note: the required attribute is not permitted on inputs with the disabled attribute specified. usability browsers display disabled form controls greyed as disabled form controls ...
HTML attribute: minlength - HTML: Hypertext Markup Language
id, as it is impossible to meet both criteria. the input will fail constraint validation if the length of the text value of the field is less than minlength utf-16 code units long, with validitystate.tooshort returning true. constraint validation is only applied when the value is changed by the user. once submission fails, some browsers will display an error message indicating the minimum length required and the current length. examples by adding minlength="5", the value must either be empty or five characters or longer to be valid. <label for="fruit">enter a fruit name that is at least 5 letters long</label> <input type="text" minlength="5" id="fruit"> we can use pseudoclasses to style the element based on whether the value is valid. the value will be valid as long as it is either null (empt...
HTML attribute: pattern - HTML: Hypertext Markup Language
utted value must match in order to be considered valid (see validating against a regular expression for a simple crash course on using regular expressions to validate inputs). the example below restricts the value to 4-8 characters and requires that it contain only lower-case letters. ...
HTML attribute: readonly - HTML: Hypertext Markup Language
e :read-write pseudo-class. attribute interactions the difference between disabled and readonly is that read-only controls can still function and are still focusable, whereas disabled controls can not receive focus and are not submitted with the form and generally do not function as controls until they are enabled. because a read-only field cannot have it's value changed by a user interaction, required does not have any effect on inputs with the readonly attribute also specified. the only way to modify dynamically the value of the readonly attribute is through a script. note: the required attribute is not permitted on inputs with the readonly attribute specified. usability browsers display the readonly attribute... constraint validation if the element is readonly, then the element's val...
HTML attribute: step - HTML: Hypertext Markup Language
Web › HTML › Attributes › step
specification status comment html living standardthe definition of 'step attribute' in that specification. living standard html5the definition of 'step attribute' in that specification. recommendation accessibility concerns provide instructions to help users understand how to complete the form and use individual form controls. indicate any required and optional input, data formats, and other relevant information. when using the min attribute, ensure this minimum requirement is understood by the user. providing instructions within the <label> may be sufficient. if providing instructions outside of labels, which allows more flexible positioning and design, consider using aria-labelledby or aria-describedby. ...
<a>: The Anchor element - HTML: Hypertext Markup Language
Web › HTML › Element › a
ime type. no built-in functionality. obsolete attributes charsetobsolete since html5 hinted at the character encoding of the linked url. note: this attribute is obsolete and should not be used by authors. use the http content-type header on the linked url. coordsobsolete since html5 used with the shape attribute. a comma-separated list of coordinates. nameobsolete since html5 was required to define a possible target location in a page. in html 4.01, id and name could both be used on <a>, as long as they had identical values. note: use the global attribute id instead. revobsolete since html5 specified a reverse link; the opposite of the rel attribute. deprecated for being very confusing. shapeobsolete since html5 the shape of the hyperlink’s region in an image map. no...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
Web › HTML › Element › abbr
ll human-readable description or expansion of the abbreviation. this text is often presented by browsers as a tooltip when the mouse cursor is hovered over the element. each <abbr> element you use is independent from all others; providing a title for one does not automatically attach the same expansion text to others with the same content text. usage notes typical use cases it's certainly not required that all abbreviations be marked up using <abbr>. there are, though, a few cases where it's helpful to do so: when an abbreviation is used and you want to provide an expansion or definition outside the flow of the document's content, use <abbr> with an appropriate title. to define an abbreviation which may be unfamiliar to the reader, present the term using <abbr> and either a title attribute...
<area> - HTML: Hypertext Markup Language
Web › HTML › Element › area
es 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 displayed 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 specifying the center of the circle and r is a value for the r...
<button>: The Button element - HTML: Hypertext Markup Language
Web › HTML › Element › button
that the state change when focus is moved to the button is high enough that people experiencing low vision conditions will be able to perceive it. color contrast ratio is determined by comparing the luminosity of the button text and background color values compared to the background the button is placed on. in order to meet current web content accessibility guidelines (wcag), a ratio of 4.5:1 is required for text content and 3:1 for large text. (large text is defined as 18.66px and bold or larger, or 24px or larger.) webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 clicking and focus whether clicking on a <button> causes it to (by default) become focused varies by browser and os. the result...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
Web › HTML › Element › canvas
ad. width the width of the coordinate space in css pixels. defaults to 300. usage notes alternative content you may (and should) provide alternate content 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 displayed 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...
<center>: The Centered Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › center
this tag has been deprecated in html 4 (and xhtml 1) in favor of the css text-align property, which can be applied to the <div> element or to an individual <p>. for centering blocks, use other css properties like margin-left and margin-right and set them to auto (or set margin to 0 auto). dom interface this element implements the htmlelement interface. ...
<dd>: The Description Details element - HTML: Hypertext Markup Language
Web › HTML › Element › dd
eding term (<dt>) in a description list (<dl>). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content flow content. tag omission the start tag is required. the end tag may be omitted if the <dd> element is immediately followed by another <dd> element or a <dt> element, or if there is no more content in the parent element. permitted parents <dl> or (in whatwg html) a <div> that is inside a <dl>. previous sibling <dt> or another <dd> element. implicit aria role definition permitted aria roles no role pe...
<header> - HTML: Hypertext Markup Language
Web › HTML › Element › header
lementary, main, navigation or region permitted aria roles group, presentation or none dom interface htmlelement usage notes the <header> element is not sectioning content and therefore does not introduce a new section in the outline. that said, a <header> element is intended to usually contain the surrounding section's heading (an h1–h6 element), but this is not required. historical usage although the <header> element didn't make its way into specifications until html5, it actually existed at the very beginning of html. as seen in the very first website, it was originally used as the <head> element. at some point, it was decided to use a different name. this allowed <header> to be free to fill a different role later on. attributes this element only includes t...
<html>: The HTML Document / Root element - HTML: Hypertext Markup Language
Web › HTML › Element › html
ld be cached locally. see using the application cache for details. version specifies the version of the html document type definition that governs the current document. this attribute is not needed, because it is redundant with the version information in the document type declaration. xmlns specifies the xml namespace of the document. default value is "http://www.w3.org/1999/xhtml". this is required in documents parsed with xml parsers, and optional in text/html documents. example <!doctype html> <html lang="en"> <head>...</head> <body>...</body> </html> accessibility concerns providing a lang attribute with a valid ietf identifying language tag on the <html> element will help screen reading technology determine the proper language to announce. the identifying language tag should d...
<i>: The Idiomatic Text element - HTML: Hypertext Markup Language
Web › HTML › Element › i
ions of the html specification, the <i> element was merely a presentational element used to display text in italics, much like the <b> element was used to display text in bold letters. this is no longer true, as these tags now define semantics rather than typographic appearance. a browser will typically still display the contents of the <i> element in italic type, but is, by definition, no longer required to do so. to display text in italic type, authors should use the css font-style property. be sure the text in question is not actually more appropriately marked up with another element. use <em> to indicate stress emphasis. use <strong> to indicate importance, seriousness, or urgency. use <mark> to indicate relevance. use <cite> to mark up the name of a work, such as a book, play,...
<input type="button"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › button
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: while <input> elements of type button are still perfectly valid html, the newer <button> element is now the favored way to create buttons. ...
<input type="checkbox"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › checkbox
overall.checked = false; overall.indeterminate = true; } } note: if you submit a form with an indeterminate checkbox, the same thing happens as if the checkbox were unchecked — no data is submitted to represent the checkbox. validation checkboxes do support validation (offered to all <input>s). however, most of the validitystates will always be false. if the checkbox has the required attribute, but is not checked, then validitystate.valuemissing will be true. examples the following example is an extended version of the "multiple checkboxes" example we saw above — it has more standard options, plus an "other" checkbox that when checked causes a text field to appear to enter a value for the "other" option. this is achieved with a simple block of javascript. the example also...
<input type="file"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › file
ode and the file api. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. value a domstring representing the path to the selected file. events change and input supported common attributes required additional attributes accept, capture, files, multiple idl attributes files and value dom interface htmlinputelement properties properties that apply only to elements of type file methods select() value a file input's value attribute contains a domstring that represents the path to the selected file(s). if the u...
<input type="range"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › range
e orientation of the range slider. values include horizontal, meaing the range is rendered horizontally, and vertical, where the range is rendered vertically. note: the following input attributes do not apply to the input range: accept, alt, checked, dirname, formaction, formenctype, formmethod, formnovalidate, formtarget, height, maxlength, minlength, multiple, pattern, placeholder, readonly, required, size, src, and width. any of these attributes, if included, will be ignored. examples while the number type lets users enter a number with optional constraints forcing their value to be between a minimum and a maximum value, it does require that they enter a specific value. the range input type lets you ask the user for a value in cases where the user may not even care—or know—what the sp...
<keygen> - HTML: Hypertext Markup Language
Web › HTML › Element › keygen
t value is rsa. name the name of the control, which is submitted with the form data. the element is written as follows: <keygen name="name" challenge="challenge string" keytype="type" keyparams="pqg-params"> the keytype parameter is used to specify what type of key is to be generated. valid values are "rsa", which is the default, "dsa" and "ec". the name and challenge attributes are required in all cases. the keytype attribute is optional for rsa key generation and required for dsa and ec key generation. the keyparams attribute is required for dsa and ec key generation and ignored for rsa key generation. pqg is a synonym for keyparams. that is, you may specify keyparams="pqg-params" or pqg="pqg-params". for rsa keys, the keyparams parameter is not used (ignored if present). the user...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
Web › HTML › Element › link
choose a different rendering of a link as a function of the methods specified; something that is searchable might get a different icon, or an outside link might render with an indication of leaving the current site. this attribute is not well understood nor supported, even by the defining browser, internet explorer 4. prefetch secure context this attribute identifies a resource that might be required by the next navigation and that the user agent should retrieve it. this allows the user agent to respond faster when the resource is requested in the future. target defines the frame or window name that has the defined linking relationship or that will show the rendering of any linked resource. obsolete attributes charset this attribute defines the character encoding of the linked res...
<menuitem> - HTML: Hypertext Markup Language
Web › HTML › Element › menuitem
or input). disabled boolean attribute which indicates that the command is not available in the current state. note that disabled is distinct from hidden; the disabled attribute is appropriate in any context where a change in circumstances might render the command relevant. icon image url, used to provide a picture to represent the command. label the name of the command as shown to the user. required when a command attribute is not present. radiogroup this attribute specifies the name of a group of commands to be toggled as radio buttons when selected. may only be used where the type attribute is radio. type this attribute indicates the kind of command, and can be one of three values. command: a regular command with an associated action. this is the missing value default. checkbox: ...
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
Web › HTML › Element › meta
ontent-type if specified, the content attribute must have the value "text/html; charset=utf-8". note: can only be used in documents served with a text/html mime type — not in documents served with an xml mime type. default-style sets the name of the default css style sheet set. x-ua-compatible if specified, the content attribute must have the value "ie=edge". user agents are required to ignore this pragma. refresh this instruction specifies: the number of seconds until the page should be reloaded - only if the content attribute contains a positive integer. the number of seconds until the page should redirect to another - only if the content attribute contains a positive integer followed by the string ';url=', and a valid url. accessibility concern...
<p>: The Paragraph element - HTML: Hypertext Markup Language
Web › HTML › Element › p
omission” below. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, palpable content. permitted content phrasing content. tag omission the start tag is required. the end tag may be omitted if the <p> element is immediately followed by an <address>, <article>, <aside>, <blockquote>, <div>, <dl>, <fieldset>, <footer>, <form>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <header>, <hr>, <menu>, <nav>, <ol>, <pre>, <section>, <table>, <ul> or another <p> element, or if there is no more content in the parent element and the parent element is not an <a> element. ...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
Web › HTML › Element › source
ormation is used by the browser to determine, before laying the page out, which image defined in srcset to use. please note that sizes will have its effect only if width dimension descriptors are provided with srcset instead of pixel ratio values (200w instead of 2x for example). the sizes attribute has an effect only when the <source> element is the direct child of a <picture> element. src required for <audio> and <video>, address of the media resource. the value of this attribute is ignored when the <source> element is placed inside a <picture> element. srcset a list of one or more strings separated by commas indicating a set of possible images represented by the source for the browser to use. each string is composed of: one url specifying an image. a width descriptor, which con...
<tbody>: The Table Body element - HTML: Hypertext Markup Language
Web › HTML › Element › tbody
teractive-examples and send us a pull request. the <tbody> element, along with its cousins <thead> and <tfoot>, provide useful semantic information that can be used when rendering for either screen or printer as well as for accessibility purposes. content categories none. permitted content zero or more <tr> elements. tag omission the <tbody> element is not a required child element for a parent <table> element to graphically render. however, it must not be present, if its parent <table> element has a <tr> element as a child. permitted parents within the required parent <table> element, the <tbody> element can be added after a <caption>, <colgroup>, and a <thead> element. implicit aria role rowgroup permitted aria roles any ...
<title>: The Document Title element - HTML: Hypertext Markup Language
Web › HTML › Element › title
element (<title>) defines the document's title that is shown in a browser's title bar or a page's tab. it only contains text; tags within the element are ignored. <title>grandma's heavy metal festival journal</title> content categories metadata content. permitted content text that is not inter-element whitespace. tag omission both opening and closing tags are required. note that leaving off </title> should cause the browser to ignore the rest of the page. permitted parents a <head> element that contains no other <title> element. implicit aria role no corresponding role permitted aria roles no role permitted. dom interface htmltitleelement attributes this element only includes the global attributes. usage...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › tt
les basic example this example uses <tt> to show text entered into, and output by, a terminal application. <p>enter the following at the telnet command prompt: <code>set localecho</code><br /> the telnet client should display: <tt>local echo is on</tt></p> result overriding the default font you can override the browser's default font—if the browser permits you to do so, which it isn't required to do—using css: css tt { font-family: "lucida console", "menlo", "monaco", "courier", monospace; } html <p>enter the following at the telnet command prompt: <code>set localecho</code><br /> the telnet client should display: <tt>local echo is on</tt></p> result usage notes the <tt> element is, by default, rendered using the browser's default non-proportional font. you...
<video>: The Video Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › video
yling with css the <video> element is a replaced element — its display value is inline by default, but its default width and height in the viewport is defined by the video being embedded. there are no special considerations for styling <video>; a common strategy is to give it a display value of block to make it easier to position, size, etc., and then provide styling and layout information as required. video player styling basics provides some useful styling techniques. detecting track addition and removal you can detect when tracks are added to and removed from a <video> element using the addtrack and removetrack events. however, these events aren't sent directly to the <video> element itself. instead, they're sent to the track list object within the <video> element's htmlmediaelement that ...
lang - HTML: Hypertext Markup Language
nown; if the language tag is not valid according to bcp47, it is set to invalid. language tag syntax the full bcp47 syntax is in-depth enough to mark extremely specific language dialects, but most usage is much simpler. a language tag is made of hyphen-separated language subtags, where each subtag indicates a certain property of the language. the 3 most common subtags are: language subtag required. a 2-or-3-character code that defines the basic language, typically written in all lowercase. for example, the language code for english is en, and the code for badeshi is bdz. script subtag optional. this subtag defines the writing system used for the language, and is always 4 characters long, with the first letter capitalized. for example, french-in-braille is fr-brai and ja-kana is japanese ...
spellcheck - HTML: Hypertext Markup Language
llowed. the correct usage is <textarea spellcheck="true"></textarea>. if this attribute is not set, its default value is element-type and browser-defined. this default value may also be inherited, which means that the element content will be checked for spelling errors only if its nearest ancestor has a spellcheck state of true. this attribute is merely a hint for the browser: browsers are not required to check for spelling errors. typically non-editable elements are not checked for spelling errors, even if the spellcheck attribute is set to true and the browser supports spellchecking. specifications specification status comment html living standardthe definition of 'spellcheck' in that specification. living standard no change from latest snapshot, html 5.1 ...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
this example is trivial, as the browser probably discovers the <link rel="stylesheet"> and <script> elements in the same chunk of html as the preloads, but the benefits can be seen much more clearly the later resources are discovered and the larger they are. for example: resources that are pointed to from inside css, like fonts or images. resources that...
Using the application cache - HTML: Hypertext Markup Language
e updated document will not be rendered until the document is reloaded (either manually or programatically). storage location and clearing the offline cache in chrome you can clear the offline cache by selecting "clear browsing data..." in the preferences or by visiting chrome://appcache-internals/. safari has a similar "empty cache" setting in its preferences but a browser restart may also be required. in firefox, the offline cache data is stored separately from the firefox profile—next to the regular disk cache: windows vista/7: c:\users\<username>\appdata\local\mozilla\firefox\profiles\<salt>.<profile name>\offlinecache mac/linux: /users/<username>/library/caches/firefox/profiles/<salt>.<profile name>/offlinecache in firefox the current status of the offline cache can be inspected o...
HTML: Hypertext Markup Language
Web › HTML
tml reference section, you'll find the details about every element and attribute in html. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started beginner's tutorials our html learning area features multiple modules that teach html from the ground up — no previous knowledge required. introduction to html this module sets the stage, getting you used to important concepts and syntax such as looking at applying html to text, how to create hyperlinks, and how to use html to structure a web page. multimedia and embedding this module explores how to use html to include multimedia in your web pages, including the different ways that images can be included, and how to embed vi...
Evolution of HTTP - HTTP
s can now be implemented. it is a multiplexed protocol. parallel requests can be handled over the same connection, removing the order and blocking constraints of the http/1.x protocol. it compresses headers. as these are often similar among a set of requests, this removes duplication and overhead of data transmitted. it allows a server to populate data in a client cache, in advance of it being required, through a mechanism called the server push. officially standardized, in may 2015, http/2 has had much success. by july 2016, 8.7% of all web sites[1] were already using it, representing more than 68% of all requests[2]. high-traffic web sites showed the most rapid adoption, saving considerably on data transfer overheads and subsequent budgets. this rapid adoption rate was likely as http/2 doe...
MIME types (IANA media types) - HTTP
audio and video types as is the case for ima...
Reason: CORS header 'Access-Control-Allow-Origin' missing - HTTP
if the server is under your control, add the origin of the requesting site to the set of domains permitted access by adding it to the access-control-allow-origin header's value. ...
Reason: CORS header ‘Origin’ cannot be added - HTTP
all cors requests must have an origin header. ...
Cross-Origin Resource Sharing (CORS) - HTTP
Web › HTTP › CORS
ts after a preflighted request. if a redirect occurs after a preflighted request, some browsers currently will report an error message such as the following. the request was redirected to 'https://example.com/foo', which is disallowed for cross-origin requests that require preflight request requires preflight, which is disallowed to follow cross-origin redirect the cors protocol originally required that behavior but was subsequently changed to no longer require it. however, not all browsers have implemented the change, and so still exhibit the behavior that was originally required. until browsers catch up with the spec, you may be able to work around this limitation by doing one or both of the following: change the server-side behavior to avoid the preflight and/or to avoid the redirect...
Compression in HTTP - HTTP
y algorithm can be configured to compress more or less, which then of course leads to less or more quality. for better performance of a web site, it is ideal to compress as much as possible, while keeping an acceptable level of quality. for images, an image generated by a tool could be not optimized enough for the web; it is recommended to use tools that will compress as much as possible with the required quality. there are numerous tools that are specialized for this. lossy compression algorithms are usually more efficient than loss-less ones. as compression works better on a specific kind of files, it usually provides nothing to compress them a second time. in fact, this is often counter productive as the cost of the overhead (algorithms usually need a dictionary that add to the initial size)...
HTTP conditional requests - HTTP
if the resource didn't exist before: if-none-match will only work with http/1.1 (and later) compliant servers. if unsure if the server will be compliant, you need first to issue a head request to the resource to check this. conclusion conditional requests are a key feature of http, and allow the building of efficient and complex applications. for caching or resuming downloads, the only work required for webmasters is to configure the server correctly; setting correct etags in some environments can be tricky. once achieved, the browser will serve the expected conditional requests. for locking mechanisms, it is the opposite: web developers need to issue a request with the proper headers, while webmasters can mostly rely on the application to carry out the checks for them. in both cases it's ...
Using Feature Policy - HTTP
ins. that is, the default allowlist is '*' for each feature. preventing the use of the sub-optimal functionality requires explicitly specifying a policy that disables the features. for new content, you can start developing with a policy that disables all the features. this approach ensures that none of the functionality is introduced. when applying a policy to existing content, testing is likely required to verify it continues to work as expected. this is especially important for embedded or third-party content that you do not control. to turn on the enforcement of all the best practices, specify the policy as below. send the following the http header: feature-policy: layout-animations 'none'; unoptimized-images 'none'; oversized-images 'none'; sync-script 'none'; sync-xhr 'none'; unsized-medi...
Access-Control-Allow-Headers - HTTP
header type response header forbidden header name no syntax access-control-allow-headers: <header-name>[, <header-name>]* access-control-allow-headers: * directives <header-name> the name of a supported request header. ...
Content-Type - HTTP
s parsed value (ignoring parameters) of either application/x-www-form-urlencoded, multipart/form-data, or text/plain. syntax content-type: text/html; charset=utf-8 content-type: multipart/form-data; boundary=something directives media-type the mime type of the resource or the data. charset the character encoding standard. boundary for multipart entities the boundary directive is required, which consists of 1 to 70 characters from a set of characters known to be very robust through email gateways, and not ending with white space. it is used to encapsulate the boundaries of the multiple parts of the message. often, the header boundary is prepended with two dashes and the final boundary has two dashes appended at the end. examples content-type in html forms in a post request, re...
Index - HTTP
Web › HTTP › Headers › Index
ind a proxy server. it authenticates the request to the proxy server, allowing it to transmit the request further. 90 proxy-authorization http, http header, reference, request header, header the http proxy-authorization request header contains the credentials to authenticate a user agent to a proxy server, usually after the server has responded with a 407 proxy authentication required status and the proxy-authenticate header. 91 public-key-pins hpkp, http, reference, security, header the http public-key-pins response header associates a specific cryptographic public key with a certain web server to decrease the risk of mitm attacks with forged certificates. if one or several keys are pinned and none of them are used by the server, the browser will not acce...
Large-Allocation - HTTP
<a target="_blank"> or other similar methods without rel="noopener" or the "noopener" feature being set. this is for the same reason as above, namely that they can communicate and thus we cannot allow them to switch processes. a large-allocation header was ignored due to the document not being loaded out of process. firefox has moved to a multiprocess architecture, and this architecture is required in order to support the large-allocation header. some legacy addons can prevent firefox from using this new, faster, multiprocess architecture. if you have one of these addons installed, then we will continue to use the old single process architecuture for compatibility, and cannot handle the large-allocation header. this page would be loaded in a new process due to a large-allocation header, ho...
Proxy-Authenticate - HTTP
the http proxy-authenticate response header defines the authentication method that should be used to gain access to a resource behind a proxy server. it authenticates the request to the proxy server, allowing it to transmit the request further. the proxy-authenticate header is sent along with a 407 proxy authentication required. header type response header forbidden header name no syntax proxy-authenticate: <type> realm=<realm> directives <type> authentication type. a common type is "basic". iana maintains a list of authentication schemes. realm=<realm> a description of the protected area, the realm. if no realm is specified, clients often display a formatted host name instead. examples proxy-authenticate: basic proxy-authenticate: basic realm="access...
Proxy-Authorization - HTTP
header type request header forbidden header name no syntax proxy-authorization: <type> <credentials> directives <type> authentication type. a common type is "basic". see also the iana registry of authentication schemes. ...
Upgrade - HTTP
Web › HTTP › Headers › Upgrade
tocols response status with an upgrade header that specifies the protocol(s) being switched to. for example: http/1.1 101 switching protocols upgrade: foo/2 connection: upgrade send a response to the original request using the new protocol (the server may only switch to a protocol with which it can complete the original request). a server may also send the header as part of a 426 upgrade required response, to indicate that the server won't perform the request using the current protocol, but might do so if the protocol is changed. the client can then request a protocol change using the process above. more detail and examples are provided in the topic protocol upgrade mechanism. syntax connection: upgrade upgrade: protocol_name[/protocol_version] notes: the connection header with t...
Warning - HTTP
Web › HTTP › Headers › Warning
elds can in general be applied to any message, however some warn-codes are specific to caches and can only be applied to response messages. header type general header forbidden header name no syntax warning: <warn-code> <warn-agent> <warn-text> [<warn-date>] directives <warn-code> a three-digit warning number. the first digit indicates whether the warning is required to be deleted from a stored response after validation. 1xx warn-codes describe the freshness or validation status of the response and will be deleted by a cache after deletion. 2xx warn-codes describe some aspect of the representation that is not rectified by a validation and won't be deleted by a cache after validation unless a full response is sent. <warn-agent> the name or...
HTTP headers - HTTP
Web › HTTP › Headers
t rfc document for the upgrade header field is rfc 7230, section 6.7. the standard establishes rules for upgrading or changing to a different protocol on the current client, server, transport protocol connection. for example, this header standard allows a client to change from http 1.1 to http 2.0, assuming the server decides to acknowledge and implement the upgrade header field. neither party is required to accept the terms specified in the upgrade header field. it can be used in both client and server headers. if the upgrade header field is specified, then the sender must also send the connection header field with the upgrade option specified. for details on the connection header field please see section 6.1 of the aforementioned rfc. x-dns-prefetch-control controls dns prefetching, a feature ...
Network Error Logging - HTTP
ons to opt-in to receive reports about failed (and, if desired, successful) network fetches from supporting browsers. reports are sent to a reporting group defined within a report-to header. usage web applications opt in to this behaviour with the nel header, which is a json-encoded object: nel: { "report_to": "nel", "max_age": 31556952 } an origin considered secure by the browser is required. the following object keys can be specified in the nel header: report_to the reporting api group to send network error reports to (see below). max_age specifies the lifetime of the policy, in seconds (in a similar way to e.g. hsts policies are time-restricted). the referenced reporting group should have a lifetime at least as long as the nel policy. include_subdomains if true, the po...
HTTP range requests - HTTP
ultiple ranges at once in a multipart document. the ranges are separated by a comma. curl http://www.example.com -i -h "range: bytes=0-50, 100-150" the server responses with the 206 partial content status and a content-type: multipart/byteranges; boundary=3d6b6a416f9b5 header, indicating that a multipart byterange follows. each part contains its own content-type and content-range fields and the required boundary parameter specifies the boundary string used to separate each body-part. http/1.1 206 partial content content-type: multipart/byteranges; boundary=3d6b6a416f9b5 content-length: 282 --3d6b6a416f9b5 content-type: text/html content-range: bytes 0-50/1270 <!doctype html> <html> <head> <title>example do --3d6b6a416f9b5 content-type: text/html content-range: bytes 100-150/1270 eta http...
501 Not Implemented - HTTP
Web › HTTP › Status › 501
the hypertext transfer protocol (http) 501 not implemented server error response code means that the server does not support the functionality required to fulfill the request. this status can also send a retry-after header, telling the requester when to check back to see if the functionality is supported by then. 501 is the appropriate response when the server does not recognize the request method and is incapable of supporting it for any resource. the only methods that servers are required to support (and therefore that must not return 501) are get and head. if the server does recognize the method, but intentionally does not support it, the appropriate response is 405 method not allowed. a 501 error is not something you can fix, but requires a fix by the web server you are trying to acces...
About JavaScript - JavaScript
nt. javascript is an easy to learn and also powerful scripting language, widely used for controlling web page behavior. contrary to popular misconception, javascript is not "interpreted java". in a nutshell, javascript is a dynamic scripting language supporting prototype based object construction. the basic syntax is intentionally similar to both java and c++ to reduce the number of new concepts required to learn the language. language constructs, such as if statements, for and while loops, and switch and try ... catch blocks function the same as in these languages (or nearly so). javascript can function as both a procedural and an object oriented language. objects are created programmatically in javascript, by attaching methods and properties to otherwise empty objects at run time, as opposed t...
Closures - JavaScript
full name'}, {'id': 'age', 'help': 'your age (you must be over 16)'} ]; for (let i = 0; i < helptext.length; i++) { let item = helptext[i]; document.getelementbyid(item.id).onfocus = function() { showhelp(item.help); } } } setuphelp(); this example uses let instead of var, so every closure binds the block-scoped variable, meaning that no additional closures are required. another alternative could be to use foreach() to iterate over the helptext array and attach a listener to each <p>, as shown: function showhelp(help) { document.getelementbyid('help').innerhtml = help; } function setuphelp() { var helptext = [ {'id': 'email', 'help': 'your e-mail address'}, {'id': 'name', 'help': 'your full name'}, {'id': 'age', 'help': 'your age (you mu...
Concurrency model and the event loop - JavaScript
-off after zero milliseconds. calling settimeout with a delay of 0 (zero) milliseconds doesn't execute the callback function after the given interval. the execution depends on the number of waiting tasks in the queue. in the example below, the message ''this is just a message'' will be written to the console before the message in the callback gets processed, because the delay is the minimum time required for the runtime to process the request (not a guaranteed time). basically, the settimeout needs to wait for all the code for queued messages to complete even though you specified a particular time limit for your settimeout. (function() { console.log('this is the start'); settimeout(function cb() { console.log('callback 1: this is a msg from call back'); }); // has a default time val...
Grammar and types - JavaScript
imals. additionally, a best practice for parseint is to always include the radix parameter. the radix parameter is used to specify which numerical system is to be used. parseint('101', 2) // 5 an alternative method of retrieving a number from a string is with the + (unary plus) operator: '1.1' + '1.1' // '1.11.1' (+'1.1') + (+'1.1') // 2.2 // note: the parentheses are added for clarity, not required. literals literals represent values in javascript. these are fixed values—not variables—that you literally provide in your script. this section describes the following types of literals: array literals boolean literals floating-point literals numeric literals object literals regexp literals string literals array literals an array literal is a list of zero or more expressions, ea...
JavaScript modules - JavaScript
dule.js') .then((module) => { // do something with the module. }); let's look at an example. in the dynamic-module-imports directory we've got another example based on our classes example. this time however we are not drawing anything on the canvas when the example loads. instead, we include three buttons — "circle", "square", and "triangle" — that, when pressed, dynamically load the required module and then use it to draw the associated shape. in this example we've only made changes to our index.html and main.js files — the module exports remain the same as before. over in main.js we've grabbed a reference to each button using a document.queryselector() call, for example: let squarebtn = document.queryselector('.square'); we then attach an event listener to each button so that ...
Regular expression syntax cheatsheet - JavaScript
e, /(?<title>\w+), yes \k<title>/ matches "sir, yes sir" in "do you copy? sir, yes sir!". \k is used literally here to indicate the beginning of a back reference to a named capture group. (?<name>x) named capturing group: matches "x" and stores it on the groups property of the returned matches under the name specified by <name>. the angle brackets (< and >) are required for group name. for example, to extract the united states area code from a phone number, we could use /\((?<area>\d\d\d)\)/. the resulting number would appear under matches.groups.area. (?:x) non-capturing group: matches "x" but does not remember the match. the matched substring cannot be recalled from the resulting array's elements ([1], ..., [n]) or from the predefined rege...
Groups and ranges - JavaScript
e, /(?<title>\w+), yes \k<title>/ matches "sir, yes sir" in "do you copy? sir, yes sir!". \k is used literally here to indicate the beginning of a back reference to a named capture group. (?<name>x) named capturing group: matches "x" and stores it on the groups property of the returned matches under the name specified by <name>. the angle brackets (< and >) are required for group name. for example, to extract the united states area code from a phone number, we could use /\((?<area>\d\d\d)\)/. the resulting number would appear under matches.groups.area. (?:x) non-capturing group: matches "x" but does not remember the match. the matched substring cannot be recalled from the resulting array's elements ([1], ..., [n]) or from the predefined rege...
SyntaxError: missing = in const declaration - JavaScript
: missing = in const declaration (firefox) syntaxerror: missing initializer in const declaration (chrome) error type syntaxerror what went wrong? a constant is a value that cannot be altered by the program during normal execution. it cannot change through re-assignment, and it can't be redeclared. in javascript, constants are declared using the const keyword. an initializer for a constant is required; that is, you must specify its value in the same statement in which it's declared (which makes sense, given that it can't be changed later). examples missing const initializer unlike var or let, you must specify a value for a const declaration. this throws: const columns; // syntaxerror: missing = in const declaration fixing the error there are multiple options to fix this error. check what...
TypeError: More arguments needed - JavaScript
(edge) typeerror: object.create requires at least 1 argument, but only 0 were passed typeerror: object.setprototypeof requires at least 2 arguments, but only 0 were passed typeerror: object.defineproperties requires at least 1 argument, but only 0 were passed error type typeerror. what went wrong? there is an error with how a function is called. more arguments need to be provided. ...
Functions - JavaScript
he statements comprising the body of the function. the arrow function expression (=>) an arrow function expression has a shorter syntax and lexically binds its this value (see arrow functions for details): ([param[, param]]) => { statements } param => expression param the name of an argument. zero arguments need to be indicated with (). for only one argument, the parentheses are not required. (like foo => 1) statements or expression multiple statements need to be enclosed in brackets. a single expression requires no brackets. the expression is also the implicit return value of the function. the function constructor note: using the function constructor to create functions is not recommended since it needs the function body as a string which may prevent some js engine optimizatio...
Array.prototype.forEach() - JavaScript
, the foreach() method is the wrong tool. early termination may be accomplished with: a simple for loop a for...of / for...in loops array.prototype.every() array.prototype.some() array.prototype.find() array.prototype.findindex() array methods: every(), some(), find(), and findindex() test the array elements with a predicate returning a truthy value to determine if further iteration is required. foreach expects a synchronous function foreach does not wait for promises. kindly make sure you are aware of the implications while using promises(or async functions) as foreach callback. example code let ratings = [5, 4, 5]; let sum = 0; let sumfunction = async function (a, b) { return a + b } ratings.foreach(async function(rating) { sum = await sumfunction(sum, rating) }) console.l...
Date.UTC() - JavaScript
70, 00:00:00 utc. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax since ecmascript 2017: date.utc(year[, month[, day[, hour[, minute[, second[, millisecond]]]]]]) ecmascript 2016 and earlier: (month used to be required) date.utc(year, month[, day[, hour[, minute[, second[, millisecond]]]]]) parameters year a full year. month an integer between 0 (january) and 11 (december) representing the month. (up through ecmascript 2016, month was a required parameter. as of es2017, it no longer is.) day optional an integer between 1 and 31 representing the day of the month. if omitted, defaults to 1. hour option...
FinalizationRegistry - JavaScript
f time, such as use with certain apis. notes on cleanup callbacks some notes on cleanup callbacks: developers shouldn't rely on cleanup callbacks for essential program logic. cleanup callbacks may be useful for reducing memory usage across the course of a program, but are unlikely to be useful otherwise. a conforming javascript implementation, even one that does garbage collection, is not required to call cleanup callbacks. when and whether it does so is entirely down to the implementation of the javascript engine. when a registered object is reclaimed, any cleanup callbacks for it may be called then, or some time later, or not at all. it's likely that major implementations will call cleanup callbacks at some point during execution, but those calls may be substantially after the related o...
Function.prototype.apply() - JavaScript
n/interactive-examples and send us a pull request. syntax func.apply(thisarg, [ argsarray]) parameters thisarg the value of this provided for the call to func. note that this may not be the actual value seen by the method: if the method is a function in non-strict mode code, null and undefined will be replaced with the global object, and primitive values will be boxed. this argument is required. argsarray optional an array-like object, specifying the arguments with which func should be called, or null or undefined if no arguments should be provided to the function. starting with ecmascript 5 these arguments can be a generic array-like object instead of an array. see below for browser compatibility information. return value the result of calling the function with the specifi...
Intl.DateTimeFormat() constructor - JavaScript
cedence in case both options have been specified. formatmatcher the format matching algorithm to use. possible values are "basic" and "best fit"; the default is "best fit". see the following paragraphs for information about the use of this property. the following properties describe the date-time components to use in formatted output, and their desired representations. implementations are required to support at least the following subsets: weekday, year, month, day, hour, minute, second weekday, year, month, day year, month, day year, month month, day hour, minute, second hour, minute implementations may support other subsets, and requests will be negotiated against all available subset-representation combinations to find the best match. two algorithms are available fo...
Intl.Locale.prototype.script - JavaScript
nd it is important to indicate the script whenever possible, in order to have a complete unicode language identifier. examples setting the script in the locale identifer string argument the script is the second part of a valid unicode language identifier string, and can be set by adding it to the locale identifier string that is passed into the locale constructor. note that the script is not a required part of a locale identifier. let scriptstr = new intl.locale("en-latn-us"); console.log(scriptstr.script); // prints "latn" setting the script via the configuration object the locale constructor takes a configuration object, which can be used to set the script subtag and property. let scriptobj = new intl.locale("fr-fr", {script: "latn"}); console.log(scriptobj.script); // prints "latn" sp...
JSON.stringify() - JavaScript
r and u+2029 paragraph separator could appear literally in string literals and property names in json text. but they could not appear literally in similar context in javascript text, only using unicode escapes as \u2028 and \u2029. this recently changed: now both code points may appear literally in strings in json and javascript both. therefore, if compatibility with older javascript engines is required, it is perilous to directly substitute the string returned by json.stringify into a javascript string to be passed to eval or new function or as part of a jsonp url, and the following utility can be used: function jsfriendlyjsonstringify (s) { return json.stringify(s). replace(/\u2028/g, '\\u2028'). replace(/\u2029/g, '\\u2029'); } var s = { a: string.fromcharcode(0x2028...
Planned changes to shared memory - JavaScript
to any other value than same-origin opens up the resource to potential attacks, such as spectre. note that the cross-origin-opener-policy header limits your ability to retain a reference to popups. direct access between two top-level window contexts will essentially only work if they are same-origin and carry the same two headers with the same two values. api changes as a result of this newly required environment, there are a couple api implications: the atomics object is always available. sharedarraybuffer objects are in principle always available, but unfortunately the constructor on the global object is hidden, unless the two headers mentioned above are set, for compatibility with web content. there is hope that this restriction can be removed in the future. webassembly.memory can still...
SharedArrayBuffer() constructor - JavaScript
e https://github.com/mdn/interactive-examples and send us a pull request. syntax new sharedarraybuffer([length]) parameters length the size, in bytes, of the array buffer to create. return value a new sharedarraybuffer object of the specified size. its contents are initialized to 0. examples always use the new operator to create a sharedarraybuffer sharedarraybuffer constructors are required to be constructed with a new operator. calling a sharedarraybuffer constructor as a function without new will throw a typeerror. var sab = sharedarraybuffer(1024); // typeerror: calling a builtin sharedarraybuffer constructor // without new is forbidden var sab = new sharedarraybuffer(1024); specifications specification ecmascript (ecma-262)the definition of 'sharedarraybuff...
SharedArrayBuffer - JavaScript
calling a sharedarraybuffer constructor as a function without new will throw a typeerror. var sab = sharedarraybuffer(1024); // typeerror: calling a builtin sharedarraybuffer constructor // without new is forbidden var sab = new sharedarraybuffer(1024); constructor sharedarraybuffer() creates a new sharedarraybuffer object. instance properties sh...
String.fromCharCode() - JavaScript
fff) are known as supplementary characters. in utf-16, supplementary characters are represented by two 16-bit code units, known as surrogates, that were reserved for this purpose. a valid combination of two surrogates used to represent a supplementary character is known as a surrogate pair. because fromcharcode() only works with 16-bit values (same as the \u escape sequence), a surrogate pair is required in order to return a supplementary character. for example, both string.fromcharcode(0xd83c, 0xdf03) and \ud83c\udf03 return code point u+1f303 "night with stars". while there is a mathematical relationship between the supplementary code point value (e.g. 0x1f303) and both surrogate values that represent it (e.g., 0xd83c and 0xdf03), it does require an extra step to either calculate or look up th...
String.fromCodePoint() - JavaScript
a polyfill: if (!string.fromcodepoint) (function(stringfromcharcode) { var fromcodepoint = function(_) { var codeunits = [], codelen = 0, result = ""; for (var index=0, len = arguments.length; index !== len; ++index) { var codepoint = +arguments[index]; // correctly handles all cases including `nan`, `-infinity`, `+infinity` // the surrounding `!(...)` is required to correctly handle `nan` cases // the (codepoint>>>0) === codepoint clause handles decimals and negatives if (!(codepoint < 0x10ffff && (codepoint>>>0) === codepoint)) throw rangeerror("invalid code point: " + codepoint); if (codepoint <= 0xffff) { // bmp code point codelen = codeunits.push(codepoint); } else { // astral code point; split in su...
Symbol.for() - JavaScript
he given key and returns it if found. otherwise a new symbol gets created in the global symbol registry with this key. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax symbol.for(key); parameters key string, required. the key for the symbol (and also used for the description of the symbol). return value an existing symbol with the given key if found; otherwise, a new symbol is created and returned. description in contrast to symbol(), the symbol.for() function creates a symbol available in a global symbol registry list. symbol.for() does also not necessarily create a new symbol on every call, but checks ...
Symbol.keyFor() - JavaScript
the symbol.keyfor(sym) method retrieves a shared symbol key from the global symbol registry for the given symbol. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax symbol.keyfor(sym); parameters sym symbol, required. the symbol to find a key for. return value a string representing the key for the given symbol if one is found on the global registry; otherwise, undefined. examples using keyfor var globalsym = symbol.for('foo'); // create a new global symbol symbol.keyfor(globalsym); // "foo" var localsym = symbol(); symbol.keyfor(localsym); // undefined // well-known symbols are not symbols registered /...
TypedArray.prototype.sort() - JavaScript
typedarray.sort([comparefunction]) parameters comparefunction optional specifies a function that defines the sort order. return value the sorted typed array. examples using sort for more examples, see also the array.prototype.sort() method. let numbers = new uint8array([40, 1, 5, 200]); numbers.sort(); // uint8array [ 1, 5, 40, 200 ] // unlike plain arrays, a compare function is not required // to sort the numbers numerically. // regular arrays require a compare function to sort numerically: numbers = [40, 1, 5, 200]; numbers.sort(); // [1, 200, 40, 5] numbers.sort((a, b) => a - b); // compare numbers // [ 1, 5, 40, 200 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.sort' in that specification. ...
TypedArray - JavaScript
calestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). typedarray.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). typedarray.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. examples new is required starting with ecmascript 2015, typedarray constructors must be constructed with the new operator. calling a typedarray constructor as a function without new will throw a typeerror. var dv = int8array([1, 2, 3]); // typeerror: calling a builtin int8array constructor // without new is forbidden var dv = new int8array([1, 2, 3]); property access you can reference elements in the array using sta...
WeakMap.prototype.get() - JavaScript
the key of the element to return from the weakmap object. ...
WeakMap.prototype.has() - JavaScript
the has() method returns a boolean indicating whether an element with the specified key exists in the weakmap object or not. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax wm.has(key); parameters key required. the key of the element to test for presence in the weakmap object. return value boolean returns true if an element with the specified key exists in the weakmap object; otherwise false. examples using the has method var wm = new weakmap(); wm.set(window, 'foo'); wm.has(window); // returns true wm.has('baz'); // returns false specifications specification ecmascript (ecm...
WeakMap.prototype.set() - JavaScript
the set() method adds a new element with a specified key and value to a weakmap object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax wm.set(key, value); parameters key required. must be object. the key of the element to add to the weakmap object. value required. any value. the value of the element to add to the weakmap object. return value the weakmap object. examples using the set method var wm = new weakmap(); var obj = {}; // add new elements to the weakmap wm.set(obj, 'foo').set(window, 'bar'); // chainable // update an element in the weakmap wm.set(obj, 'baz'); specifications s...
WeakSet.prototype.add() - JavaScript
the object to add to the weakset collection. return value the weakset object. ...
WeakSet.prototype.delete() - JavaScript
the object remove from the weakset object. ...
WeakSet.prototype.has() - JavaScript
the object to test for presence in the weakset. ...
WebAssembly.Instance() constructor - JavaScript
the webassembly.instance() constructor creates a new instance object which is a stateful, executable instance of a webassembly.module. syntax important: since instantiation for large modules can be expensive, developers should only use the instance() constructor when synchronous instantiation is absolutely required; the asynchronous webassembly.instantiatestreaming() method should be used at all other times. new webassembly.instance(module, importobject); parameters module the webassembly.module object to be instantiated. importobject optional an object containing the values to be imported into the newly-created instance, such as functions or webassembly.memory objects. there must be one matching property for each declared import of module or else a webassembly.linkerror is thrown. ...
WebAssembly.Module() constructor - JavaScript
webassembly.module() constructor function can be called to synchronously compile given webassembly binary code. however, the primary way to get a module is through an asynchronous compilation function like webassembly.compile(). syntax important: since compilation for large modules can be expensive, developers should only use the module() constructor when synchronous compilation is absolutely required; the asynchronous webassembly.compilestreaming() method should be used at all other times. new webassembly.module(buffersource); parameters buffersource a typed array or arraybuffer containing the binary code of the .wasm module you want to compile. examples synchronously compiling a webassembly module var importobject = { imports: { imported_func: function(arg) { console.l...
globalThis - JavaScript
ub 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. property attributes of globalthis writable yes enumerable no configurable yes description historically, accessing the global object has required different syntax in different javascript environments. on the web you can use window, self, or frames - but in web workers only self will work. in node.js none of these work, and you must instead use global. the this keyword could be used inside functions running in non–strict mode, but this will be undefined in modules and inside functions running in strict mode. you can also use function('re...
Destructuring assignment - JavaScript
tructuring basic assignment const user = { id: 42, is_verified: true }; const {id, is_verified} = user; console.log(id); // 42 console.log(is_verified); // true assignment without declaration a variable can be assigned its value with destructuring separate from its declaration. let a, b; ({a, b} = {a: 1, b: 2}); notes: the parentheses ( ... ) around the assignment statement are required when using object literal destructuring assignment without a declaration. {a, b} = {a: 1, b: 2} is not valid stand-alone syntax, as the {a, b} on the left-hand side is considered a block and not an object literal. however, ({a, b} = {a: 1, b: 2}) is valid, as is const {a, b} = {a: 1, b: 2} your ( ... ) expression needs to be preceded by a semicolon or it may be used to execute a function on th...
Optional chaining (?.) - JavaScript
circuits with a return value of undefined. when used with function calls, it returns undefined if the given function does not exist. this results in shorter and simpler expressions when accessing chained properties when the possibility exists that a reference may be missing. it can also be helpful while exploring the content of an object when there's no known guarantee as to which properties are required. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax obj?.prop obj?.[expr] arr?.[index] func?.(args) description the optional chaining operator provides a way to simplify accessing values through connected object...
Property accessors - JavaScript
racket notation vs. eval javascript novices often make the mistake of using eval() where the bracket notation can be used instead. for example, the following syntax is often seen in many scripts. x = eval('document.forms.form_name.elements.' + strformcontrol + '.value') eval() is slow and should be avoided whenever possible. also, strformcontrol would have to hold an identifier, which is not required for names and ids of form controls. it is better to use bracket notation instead: x = document.forms['form_name'].elements[strformcontrol].value specifications specification ecmascript (ecma-262)the definition of 'property accessors' in that specification. ...
block - JavaScript
isual identification or as a target for break. description the block statement is often called compound statement in other languages. it allows you to use multiple statements where javascript expects only one statement. combining statements into blocks is a common practice in javascript. the opposite behavior is possible using an empty statement, where you provide no statement, although one is required. blocks are commonly used in association with if...else and for statements. examples block scoping rules with var or function declaration in non-strict mode variables declared with var or created by function declarations in non-strict mode do not have block scope. variables introduced within a block are scoped to the containing function or script, and the effects of setting them persist beyon...
break - JavaScript
he terminated statement. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax break [label]; label optional identifier associated with the label of the statement. if the statement is not a loop or switch, this is required. description the break statement includes an optional label that allows the program to break out of a labeled statement. the break statement needs to be nested within the referenced label. the labeled statement can be any block statement; it does not have to be preceded by a loop statement. a break statement, with or without a following label, cannot be used within the body of a function that...
const - JavaScript
onstant's name, which can be any legal identifier. valuen the constant's value. this can be any legal expression, including a function expression. description this declaration creates a constant whose scope can be either global or local to the block in which it is declared. global constants do not become properties of the window object, unlike var variables. an initializer for a constant is required. you must specify its value in the same statement in which it's declared. (this makes sense, given that it can't be changed later.) the const declaration creates a read-only reference to a value. it does not mean the value it holds is immutable—just that the variable identifier cannot be reassigned. for instance, in the case where the content is an object, this means the object's contents (e.g...
for - JavaScript
eclaring the variable i and initializing it to 0. it checks that i is less than nine, performs the two succeeding statements, and increments i by 1 after each pass through the loop. for (let i = 0; i < 9; i++) { console.log(i); // more statements } optional for expressions all three expressions in the head of the for loop are optional. for example, in the initialization block it is not required to initialize variables: var i = 0; for (; i < 9; i++) { console.log(i); // more statements } like the initialization block, the condition block is also optional. if you are omitting this expression, you must make sure to break the loop in the body in order to not create an infinite loop. for (let i = 0;; i++) { console.log(i); if (i > 3) break; // more statements } you can ...
throw - JavaScript
sion to throw. description use the throw statement to throw an exception. when you throw an exception, expression specifies the value of the exception. each of the following throws an exception: throw 'error2'; // generates an exception with a string value throw 42; // generates an exception with the value 42 throw true; // generates an exception with the value true throw new error('required'); // generates an error object with the message of required also note that the throw statement is affected by automatic semicolon insertion (asi) as no line terminator between the throw keyword and the expression is allowed. examples throw an object you can specify an object when you throw an exception. you can then reference the object's properties in the catch block. the following exampl...
serviceworker - Web app manifests
type object mandatory no the serviceworker member describes a service worker that the developer intends to install to control the pwa. examples "serviceworker": { "src": "./serviceworker.js", "scope": "/app", "type": "", "update_via_cache": "none" } values service worker contain the following values (only src is required): member description src the url to download the service worker script from. this is the only required member of the serviceworker member. scope a string representing a url that defines a service worker's registration scope; that is, what range of urls a service worker can control. this is usually a relative url, relative to the base url of the application. by default, the scope value for a ser...
Media container formats (file types) - Web media technologies
bm webm (web media) is a format based on matroska which is designed specifically for use in modern web environments. it's based entirely on free and open technologies and primarily uses codecs that are in turn free and open, although some products support other codecs in webm containers as well. webm was first introduced in 2010 and is now widely supported. compliant implementations of webm are required to support the vp8 and vp8 video codecs and the theora and opus audio codecs. the webm container format and its required codecs are all available under open licenses. any other codecs may require a license to use. webm media mime types audio video audio/webm video/webm video codecs supported by webm codec browser support chrome edge ...
Mapping the width and height attributes of media container elements to their aspect-ratio - Web media technologies
could put a correctly-sized placeholder box in the layout for each image to appear in when it finally loads. without the width and height attributes, no placeholder space would be created, and when the image finally loaded you would get a noticeable jank in the page layout. this wasn't an attractive thing for your users to see, and could also result in performance issues due to the repainting required after each image loads, hence adding the attributes being a good idea. let’s move forward a few years to the era of responsive design. to keep images from breaking out of their containers when the container becomes narrower than the image, developers started using css like the following: img { max-width: 100%; height: auto; } this is really useful for responsive layouts, but unfortunatel...
Performance fundamentals - Web Performance
can maintain all user states. intelligently allocating memory to user state is an important concern that we go over in more detail below. power usage the final metric discussed here is power usage. like memory usage, users perceive power usage only indirectly, by how long their devices can maintain all other upp goals. in service of meeting upp goals, the system must use only the minimum power required. the remainder of this document will discuss performance in terms of these metrics. platform performance optimizations this section provides a brief overview of how firefox/gecko contributes to performance generally, below the level of all applications. from a developer's or user's perspective, this answers the question, "what does the platform do for you?" web technologies the web platform ...
Populating the page: how browsers work - Web Performance
ng technique is often referred to as "syn-syn-ack"—or more accurately syn, syn-ack, ack—because there are three messages transmitted by tcp to negotiate and start a tcp session between two computers. yes, this means three more messages back and forth between each server, and the request has yet to be made. tls negotiation for secure connections established over https, another "handshake" is required. this handshake, or rather the tls negotiation, determines which cipher will be used to encrypt the communication, verifies the server, and establishes that a secure connection is in place before beginning the actual transfer of data. this requires three more round trips to the server before the request for content is actually sent. while making the connection secure adds time to the page load...
Lazy loading - Web Performance
page of an e-commerce site which has a link to a cart page/section and all its resources (js, css, images...) are downloaded only when the user navigates to that cart page. strategies lazy loading can be applied to multiple resources and through multiple strategies. general code splitting javascript, css and html can be split into smaller chunks. this enables sending the minimal code required to provide value upfront, improving page-load times. the rest can be loaded on demand. entry point splitting: separates code by entry point(s) in the app dynamic splitting: separates code where dynamic import() statements are used javascript script type module any script tag with type="module" is treated like a javascript module and is deferred by default. css by default...
Add to Home screen - Progressive web apps (PWAs)
anifest once this is in place. what does a2hs not give you? bear in mind that when you add an app to your home screen, it just makes the app easily accessible — it doesn't download the app's assets and data to your device and make the app available offline, or anything like that. to make your app work offline, you have to use the service worker api to handle storing the assets offline, and if required, web storage or indexeddb to store its data. in our example app, we've just used a service worker to store all necessary files. the service worker is registered against the site with the final code block in the index.js file. we then cache all the site's assets using the cache api, and serve them from the cache instead of the network using the code in the sw.js file. a2hs on desktop while orig...
How to make PWAs installable - Progressive web apps (PWAs)
that would otherwise be present, creating an even more seamless and native-like feel. requirements to make the web site installable, it needs the following things in place: a web manifest, with the correct fields filled in the web site to be served from a secure (https) domain an icon to represent the app on the device a service worker registered, to allow the app to work offline (this is required only by chrome for android currently) currently, only the chromium-based browsers such as chrome, edge, and samsung internet require the service worker. if developing your app using firefox, be aware that you will need a service worker to be compatible with chromium-based browsers. the manifest file the key element is a web manifest file, which lists all the information about the website in...
Mobile first - Progressive web apps (PWAs)
<script type="text/javascript" src="js/lib/modernizr.js"></script> with modernizr in place, we can now use the following js block to test whether media queries are supported, and if not, to load in respond.js, scott jehl's matchmedia and media query polyfill. if(!modernizr.mq('only all')) { require('respond'); } editorial note: this currently doesn't work, and i'm not sure why. ongoing work required. matchmedia is also very useful in many other ways. imagine you wanted to include some kind of webgl chart in the desktop version of the site requiring a webgl library like three but didn't want it included in the mobile version? you could create a block to only load the library in the case of narrow screen devices: if(window.matchmedia("(min-width: 481px)").matches) { require('three'); } w...
k - SVG: Scalable Vector Graphics
Web › SVG › Attribute › k
two elements are using this attribute: <hkern> and <vkern> context notes value <number> default value none animatable no <number> this value indicates the amount for decreasing the spacing between the two glyphs in the kerning pair. ...
preserveAspectRatio - SVG: Scalable Vector Graphics
the alignment value must be one of the following keywords: none do not force uniform scaling. scale the...
<altGlyph> - SVG: Scalable Vector Graphics
Web › SVG › Element › altGlyph
priate set of alternate glyphs is located from processing the <altglyphdef> element, then those alternate glyphs are rendered instead of the character(s) that are inside of the <altglyph> element. ...
<animateColor> - SVG: Scalable Vector Graphics
example svg <svg width="120" height="120" xmlns="http://www.w3.org/2000/svg"> <circle cx="60" cy="60" r="50"> <animatecolor attributename="fill" attributetype="xml" from="black" to="red" dur="6s" repeatcount="indefinite"/> </circle> </svg> result specificati...
<animateTransform> - SVG: Scalable Vector Graphics
specifications specification status comment svg animations level 2the definition of '<animatetransform>' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<ani...
<clipPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › clipPath
will not receive "click" events outside the smaller radius. attributes clippathunits defines the coordinate system for the contents of the <clippath> element. ...
<cursor> - SVG: Scalable Vector Graphics
Web › SVG › Element › cursor
se parts of the cursor which are not masked out. note that cursors usually contain at least two colors so that the cursor can be visible over most backgrounds. usage context categoriesnonepermitted contentany number of the following elements, in any order:descriptive elements attributes global attributes conditional processing attributes core attributes xlink attributes externalresourcesrequired specific attributes x y xlink:href dom interface this element implements the svgcursorelement interface. specifications specification status comment scalable vector graphics (svg) 2the definition of '<cursor>' in that specification. candidate recommendation replaced xlink:href by href attribute. scalable vector graphics (svg) 1.1 (second edit...
<discard> - SVG: Scalable Vector Graphics
Web › SVG › Element › discard
this is particularly useful to help svg viewers conserve memory while displaying long-running documents. the <discard> element may occur wherever the <animate> element may. ...
<feImage> - SVG: Scalable Vector Graphics
Web › SVG › Element › feImage
example svg <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="image"> <feimage xlink:href="/files/6457/mdn_logo_only_color.png"/> </filter> </defs> <rect x="10%" y="...
<filter> - SVG: Scalable Vector Graphics
Web › SVG › Element › filter
tself, but must be used by the filter attribute on svg elements, or the filter css property for svg/html elements. usage context categoriesnonepermitted contentany number of the following elements, in any order:descriptive elementsfilter primitive elements<animate>, <set> attributes global attributes core attributes presentation attributes xlink attributes class style externalresourcesrequired specific attributes x y width height filterres filterunits primitiveunits xlink:href dom interface this element implements the svgfilterelement interface. example svg <svg width="230" height="120" xmlns="http://www.w3.org/2000/svg"> <filter id="blurme"> <fegaussianblur stddeviation="5"/> </filter> <circle cx="60" cy="60" r="50" fill="green" /> <circle cx="170" cy="60" r...
<font> - SVG: Scalable Vector Graphics
Web › SVG › Element › font
the <font> svg element defines a font to be used for text layout. usage context categoriesfont elementpermitted contentany number of the following elements, in any order:descriptive elements<font-face>, <glyph>, <hkern>, <missing-glyph>, <vkern> attributes global attributes core attributes presentation attributes class style externalresourcesrequired specific attributes horiz-origin-x horiz-origin-y horiz-adv-x vert-origin-x vert-origin-y vert-adv-y dom interface this element implements the svgfontelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<font>' in that specification. recommendation initial definition ...
<image> - SVG: Scalable Vector Graphics
Web › SVG › Element › image
de svg documents or inline svg. usage context categoriesgraphics element, graphics referencing elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements attributes global attributes conditional processing attributes core attributes graphical event attributes presentation attributes xlink attributes class style externalresourcesrequired transform specific attributes x: positions the image horizontally from the origin. y: positions the image vertically from the origin. width: the width the image renders at. unlike html's <img>, this attribute is required. height: the height the image renders at. unlike html's <img>, this attribute is required. href and xlink:href: points at a url for the image file. preserveaspectratio...
<mask> - SVG: Scalable Vector Graphics
Web › SVG › Element › mask
ines the y-axis coordinate of the top-left corner of the masking area. value type: <coordinate> ; default value: -10%; animatable: yes width this attribute defines the width of the masking area. ...
<mpath> - SVG: Scalable Vector Graphics
Web › SVG › Element › mpath
the <mpath> sub-element for the <animatemotion> element provides the ability to reference an external <path> element as the definition of a motion path. usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements attributes global attributes core attributes » xlink attributes » externalresourcesrequired specific attributes xlink:href dom interface this element implements the svgmpathelement interface. example svg <svg width="100%" height="100%" viewbox="0 0 500 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" > <rect x="1" y="1" width="498" height="298" fill="none" stroke="blue" stroke-width="2" /> <!-- draw the outline of the motion path in blue, ...
<pattern> - SVG: Scalable Vector Graphics
Web › SVG › Element › pattern
ing href, if both href and xlink:href are set, xlink:href will be ignored and only href will be used. y this attribute determines the y coordinate shift of the pattern tile. ...
<symbol> - SVG: Scalable Vector Graphics
Web › SVG › Element › symbol
aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <al...
<tref> - SVG: Scalable Vector Graphics
Web › SVG › Element › tref
<tref> element. usage context categoriestext content element, text content child elementpermitted contentany number of the following elements, in any order:descriptive elements<animate>, <animatecolor>, <set> attributes global attributes conditional processing attributes core attributes graphical event attributes presentation attributes xlink attributes class style externalresourcesrequired specific attributes xlink:href dom interface this element implements the svgtrefelement interface. example <svg width="100%" height="100%" viewbox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <text id="referencedtext"> referenced character data </text> </defs> <text x="100" y="100" font-size="45" > ...
<view> - SVG: Scalable Vector Graphics
Web › SVG › Element › view
a view is a defined way to view the image, like a zoom level or a detail view. ...
SVG In HTML Introduction - SVG: Scalable Vector Graphics
like in the following example: var img = document.createelementns("http://www.w3.org/2000/svg", "imag...
SVG fonts - SVG: Scalable Vector Graphics
er hasn't considered implementing this, the functionality has been removed from chrome 38 (and opera 25) and firefox has postponed its implementation indefinitely to concentrate on woff. other tools however like the adobe svg viewer plugin, batik and parts of inkscape support svg font embedding. the base for defining an svg font is the <font> element. defining a font there are some ingredients required for embedding a font in svg. let's show an example declaration (the one from the specification), and explain the details. <font id="font1" horiz-adv-x="1000"> <font-face font-family="super sans" font-weight="bold" font-style="normal" units-per-em="1000" cap-height="600" x-height="400" ascent="700" descent="300" alphabetic="0" mathematical="350" ideographic="400" hanging="500"...
mimeTypes.rdf corruption - SVG: Scalable Vector Graphics
ge explains a problem that can cause svg to stop working in mozilla due to the way mozilla maps filename extensions to media types. symptoms previously you were able to open and display svg content with mozilla, but for no apparent reason its behaviour changes and now it always pops up the "open or save file" dialog when you try to open local svg files, and displays the "additional plugins are required to display all the media on this page" bar when you try to view html with embedded svg. note: the "additional plugins are required" bar can appear for legitimate reasons when the svg or its embedding html is broken or served incorrectly over the network (see the svg faq). if the blue square with the white cross displays when you load this scripting across embed demo, then you are not experiencing...
How to turn off form autocompletion - Web security
fox (since version 38), google chrome (since 34), and internet explorer (since version 11). preventing autofilling with autocomplete="new-password" if you are defining a user management page where a user can specify a new password for another person, and therefore you want to prevent autofilling of password fields, you can use autocomplete="new-password". this is a hint, which browsers are not required to comply with. however modern browsers have stopped autofilling <input> elements with autocomplete="new-password" for this very reason. for example, firefox version 67 (see bug 1119063) stopped autofilling in this case; however, firefox 70 (see bug 1565407) can suggest securely-generated passwords, but does not autofill a saved password. see the autocomplete compat table for more details. ...
Web Components
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 customelementregistry.define() method, passing it the element name to be defined, the class or function in which its functionality is specified, and optionally, what element it inherits from. if required, attach a shadow dom to the custom element using element.attachshadow() method. add child elements, event listeners, etc., to the shadow dom using regular dom methods. if required, define an html template using <template> and <slot>. again use regular dom methods to clone the template and attach it to your shadow dom. use your custom element wherever you like on your page, just like you would a...
Introduction to using XPath in JavaScript - XPath
, where nsresolver is the resolver returned by creatensresolver. passing a null resolver doesn't work any better, either. one possible workaround is to create a custom resolver that returns the correct default namespace (the atom namespace in this case). note that you still have to use some namespace prefix in your xpath expression, so that the resolver function will be able to change it to your required namespace. e.g.: function resolver() { return 'http://www.w3.org/2005/atom'; } doc.evaluate('//myns:entry', doc, resolver, xpathresult.any_type, null) note that a more complex resolver will be required if the document uses multiple namespaces. an approach which might work better (and allow namespaces not to be known ahead of time) is described in the next section. using xpath functions t...
XPath snippets - XPath
at have "south" in the street name results = evaluatexpath(people, "//address[contains(@street, 'south')]"); alert(results.length); docevaluatearray the following is a simple utility function to get (ordered) xpath results into an array, regardless of whether there is a special need for namespace resolvers, etc. it avoids the more complex syntax of document.evaluate() for cases when it is not required as well as the need to use the special iterators on xpathresult (by returning an array instead). example: defining a simple docevaluatearray​() utility function // example usage: // var els = docevaluatearray('//a'); // alert(els[0].nodename); // gives 'a' in html document with at least one link function docevaluatearray (expr, doc, context, resolver) { var i, result, a = []; doc = d...
<xsl:apply-imports> - XSLT: Extensible Stylesheet Language Transformations
ane, used mostly in complex stylesheets. import precedence requires that template rules in main stylesheets have higher precedence than template rules in imported stylesheets. sometimes, however, it is useful to be able to force the processor to use a template rule from the (lower precedence) imported stylesheet rather than an equivalent rule in the main stylesheet. syntax <xsl:apply-imports/> required attributes none. optional attributes none. type instruction, appears within a template. defined xslt, section 5.6. gecko support supported. ...
<xsl:apply-templates> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:apply-templates> element selects a set of nodes in the input tree and instructs the processor to apply the proper templates to them. syntax <xsl:apply-templates select=expression mode=name> <xsl:with-param> [optional] <xsl:sort> [optional] </xsl:apply-templates> required attributes none. optional attributes select uses an xpath expression that specifies the nodes to be processed. an asterisk(*) selects the entire node-set. if this attribute is not set, all child nodes of the current node are selected. mode if there are multiple ways of processing defined for the same node, distinguishes among them. type instruction, appears within a template. defined xslt section 5.4. gecko ...
<xsl:attribute-set> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:attribute-set> element creates a named set of attributes, which can then be applied as whole to the output document, in a manner similar to named styles in css. syntax <xsl:attribute-set name=name use-attribute-sets=list-of-names> <xsl:attribute> </xsl:attribute-set> required attributes name specifies the name of the attribute set. the name must be a valid qname. optional attributes use-attribute-sets builds an attribute set from other attribute sets. the names of the contributing sets must be separated with whitespace characters and must not directly or indirectly embed themselves. type top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. defined xslt, secti...
<xsl:attribute> - XSLT: Extensible Stylesheet Language Transformations
any values that can be accessed from the stylesheet. the element must be defined before any other output document element inside the output document element for which it establishes attribute values. but it may be after or inside elements that won't be part of the output (like <xsl:choose> or <xsl:apply-templates> etc.). syntax <xsl:attribute name=name namespace=uri> template </xsl:attribute> required attributes name specifies the name of the attribute to be created in the output document. the name must be a valid qname. optional attributes namespace defines the namespace uri for this attribute in the output document. you cannot set the related namespace prefix with this element. type instruction, appears within a template or an <xsl:attribute-set> element. defined xslt, section...
<xsl:call-template> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:call-template> element invokes a named template. syntax <xsl:call-template name=name> <xsl:with-param> [optional] </xsl:call-template> required attribute name specifies the name of the template you wish to invoke. optional attributes none. type instruction, appears within a template. defined xslt, section 6. gecko support supported. ...
<xsl:choose> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › choose
th reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:choose> element defines a choice among a number of alternatives. it behaves like a switch statement in procedural languages. syntax <xsl:choose> <xsl:when test="[whatever to test1]"></xsl:when> <xsl:when test="[whatever to test2]"></xsl:when> <xsl:otherwise></xsl:otherwise> [optional] </xsl:choose> required attributes none. optional attributes none. type instruction, appears with a template. it contains one or more <xsl:when> elements, and, optionally, a final <xsl:otherwise> element. defined xslt, section 9.2. gecko support supported. ...
<xsl:comment> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › comment
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:comment> element writes a comment to the output document. it must include only text. syntax <xsl:comment> template </xsl:comment> required attributes none. optional attributes none. type instruction, appears within a template. defined xslt, section 7.4. gecko support supported. ...
<xsl:copy-of> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › copy-of
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:copy-of> element makes a deep copy (including descendant nodes) of whatever the select attribute specifies to the output document. syntax <xsl:copy-of select=expression /> required attributes select uses an xpath expression that specifies what is to be copied. optional attributes none. type instruction, appears within a template. defined xslt, section 11.3. gecko support supported. ...
<xsl:copy> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › copy
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:copy> element transfers a shallow copy (the node and any associated namespace node) of the current node to the output document. it does not copy any children or attributes of the current node. syntax <xsl:copy use-attribute-sets=list-of-names> template </xsl:copy> required attributes none. optional attributes use-attribute-sets lists attribute sets that should be applied to the output node, if it is an element. names of the sets should be separated with whitespace characters. type instruction, appears within a template. defined xslt, section 7.5. gecko support supported. ...
<xsl:decimal-format> - XSLT: Extensible Stylesheet Language Transformations
mat> element defines the characters and symbols that are to be used in converting numbers into strings using theformat-number( ) function. syntax <xsl:decimal-format name=name decimal-separator=character grouping-separator=character infinity=string minus-sign=character nan=string percent=character per-mille=charater zero-digit=character digit=character pattern-separator=character /> required attributes none. optional attributes name specifies a name for this format. decimal-separator specifies the decimal point character. the default is (.). grouping-separator specifies the thousands separator character. the default is (,). infinity specifies the string used to represent infinity. the default is the string "infinity". minus-sign specifies the minus sign char...
<xsl:element> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › element
the name must be a valid qname. optional attributes namespace specifies the namespace of the output element. ...
<xsl:fallback> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › fallback
optional attributes none. type instruction, appears within a template. defined xslt, section 15 gecko support not supported at this time. ...
<xsl:for-each> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › for-each
selects a set of nodes and processes each of them in the same way. it is often used to iterate through a set of nodes or to change the current node. if one or more <xsl:sort> elements appear as the children of this element, sorting occurs before processing. otherwise, nodes are processed in document order. syntax <xsl:for-each select=expression> <xsl:sort> [optional] template </xsl:for-each> required attributes select uses an xpath expression to select nodes to be processed. optional attributes none. type instruction, appears within a template. defined xslt, section 8. gecko support supported. ...
<xsl:if> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › if
path axes the <xsl:if> element contains a test attribute and a template. if the test evaluates to true, the template is processed. in this it is similar to an if statement in other languages. to achieve the functionality of an if-then-else statement, however, use the <xsl:choose> element with one <xsl:when> and one <xsl:otherwise> children. syntax <xsl:if test=expression> template </xsl:if> required attributes test contains an xpath expression that can be evaluated (using the rules defined for boolean( ) if necessary) to a boolean value. if the value is true, the template is processed; if it is not, no action is taken. optional attributes none. type instruction, appears within a template. defined xsl section 9.1. gecko support supported ...
<xsl:import> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › import
serves to import the contents of one stylesheet into another stylesheet. generally speaking, the contents of the imported stylesheet have a lower import precedence than that of the importing stylesheet. this is in contrast to <xsl:include> where the contents of the included stylesheet have exactly the same precedence as the contents of the including stylesheet. syntax <xsl:import href=uri /> required attributes href specifies the uri of the stylesheet to import. optional attributes none. type top-level, must appear before any other child of <xsl:stylesheet> or <xsl:transform> in the importing stylesheet. defined xslt, section 2.6.2. gecko support mostly supported with a few issues with top level variables and parameters as of mozilla 1.0. ...
<xsl:include> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › include
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:include> element merges the contents of one stylesheet with another. unlike the case of <xsl:import>, the contents of an included stylesheet have exactly the same precedence as the contents of the including stylesheet. syntax <xsl:include href=uri /> required attributes href specifies the uri of the stylesheet to include. optional attributes none. type top-level, may appear in any order as a child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 2.6.1. gecko support supported. ...
<xsl:key> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › key
must be a qname. match defines the nodes for which this key is applicable. ...
<xsl:message> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › message
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:message> element outputs a message (to the javascript console in ns) and optionally terminates execution of the stylesheet. it can be useful for debugging. syntax <xsl:message terminate="yes" | "no" > template </xsl:message> required attributes none. optional attributes terminate set to "yes", indicates that execution should be terminated. the default value is "no", in which case the message is output and execution continues. type instruction, appears within a template. defined xslt, section 13. gecko support supported. ...
<xsl:namespace-alias> - XSLT: Extensible Stylesheet Language Transformations
rating a stylesheet from another stylesheet. to prevent a normally xsl:-prefixed literal result element (which should simply be copied as-is to the result tree) from being misunderstood by the processor, it is assigned a temporary namespace which is appropriately re-converted back to the xslt namespace in the output tree. syntax <xsl:namespace-alias stylesheet-prefix=name result-prefix=name /> required attributes stylesheet-prefix specifies the temporary namespace. result-prefix specifies the desired namespace for the output tree. optional attributes none. type top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 7.1.1 gecko support not supported at this time. ...
<xsl:number> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › number
xslt functions, xpath functions, xpath axes the <xsl:number> element counts things sequentially. it can also be used to quickly format a number. syntax <xsl:number count=expression level="single" | "multiple" | "any" from=expression value=expression format=format-string lang=xml:lang-code letter-value="alphabetic" | "traditional" grouping-separator=character grouping-size=number /> required attributes none. optional attributes count specifies what in the source tree should be numbered sequentially. it uses an xpath expression. level defines how levels of the source tree should be considered in generating sequential numbers. it has three valid values: single, multiple, and any. the default value is single: single numbers sibling nodes sequentially, as in the ite...
<xsl:otherwise> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:otherwise> element is used to define the action that should be taken when none of the <xsl:when> conditions apply. it is similar to the else or default case in other programing languages. syntax <xsl:otherwise> template </xsl:otherwise> required attributes none. optional attributes none. type subinstruction, must appear as the last child of an <xsl:choose> element, within a template. defined xslt, section 9.2 gecko support supported. ...
<xsl:output> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › output
on correctly in netscape, this element, with the method attribute, must be used. as of 7.0, method="text" works as expected. syntax <xsl:output method="xml" | "html" | "text" version=string encoding=string omit-xml-declaration="yes" | "no" standalone="yes" | "no" doctype-public=string doctype-system=string cdata-section-elements=list-of-names indent="yes" | "no" media-type=string /> required attributes none. optional attributes method specifies output format. version specifies the value of the version attribute of the xml or html declaration in the output document. this attribute is only used when method="html" or method="xml". encoding specifies the value of the encoding attribute in the output document. omit-xml-declaration indicates whether or not to include a...
<xsl:param> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › param
axes the <xsl:param> element establishes a parameter by name and, optionally, a default value for that parameter. when used as a top-level element, the parameter is global . when used inside an <xsl:template> element, the parameter is local to that template. in this case it must be the first child element of the template. syntax <xsl:param name=name select=expression> template </xsl:param> required attributes name names the parameter. this must be a qname. optional attributes select uses an xpath expression to provide a default value if none is specified. type instruction, can appear as a top-level element or within a template. defined xslt, section 11. gecko support supported. ...
<xsl:preserve-space> - XSLT: Extensible Stylesheet Language Transformations
es the <xsl:preserve-space> element defines the elements in the source document for which whitespace should be preserved. if there is more than one element, separate the names with a whitespace character. preserving whitespace is the default setting, so this element only needs to be used to counteract an <xsl:strip-space> element. syntax <xsl:preserve-space elements=list-of-element-names /> required attributes elements specifies the elements for which whitespace should be preserved. optional attributes none. type top-level, must be a child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 3.4 gecko support supported. ...
<xsl:processing-instruction> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:processing-instruction> element writes a processing instruction to the output document. syntax <xsl:processing-instruction name=name> template </xsl:processing-instruction> required attributes name specifies the name of this processing instruction. optional attributes none. type instruction, appears within a template. defined xslt, section 7.3 gecko support supported. ...
<xsl:sort> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › sort
reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:sort> element defines a sort key for nodes selected by <xsl:apply-templates> or <xsl:for-each> and determines the order in which they are processed. syntax <xsl:sort select=expression order="ascending" | "descending" case-order="upper-first" | "lower-first" lang=xml:lang-code data-type="text" | "number" /> required attributes none. optional attributes select uses an xpath expression to specify the nodes to be sorted. order specifies whether the nodes should be processed in "ascending" or "descending" order. the default is "ascending". case-order indicates whether upper- or lowercase letters are to be ordered first. the allowable values are "upper-first" and "lower-first". lang specifies...
<xsl:strip-space> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:strip-space> element defines the elements in the source document for which whitespace should be removed. syntax <xsl:strip-space elements=list-of-element-names /> required attributes elements specifies a space-separated list of elements in the source whose whitespace-only text nodes should be removed. optional attributes none. type top-level, must be a child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 3.4 gecko support supported. ...
<xsl:template> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › template
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:template> element defines an output producing template. this element must have either the match attribute or the name attribute set. syntax <xsl:template match=pattern name=name mode=name priority=number> <xsl:param> [optional] template </xsl:template> required attributes none. optional attributes match specifies a pattern that determines the elements for which this template should be used. it is a required attribute if there is no name attribute. name specifies a name for this template, by which it can be invoked through the <xsl:call-template> element. mode specifies a particular mode for this template, which can be matched by an attribute of the <xsl:apply-templates...
<xsl:text> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › text
optional attributes disable-output-escaping (netscape does not serialize the result of transformation - the "output" below - so this attribute is essentially irrelevant in context. ...
<xsl:value-of> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › value-of
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:value-of> element evaluates an xpath expression, converts it to a string, and writes that string to the result tree. syntax <xsl:value-of select=expression disable-output-escaping="yes" | "no" /> required attributes select specifies the xpath expression to be evaluated and written to the output tree. optional attributes disable-output-escaping (netscape does not serialize the result of transformation - the "output" below - so this attribute is essentially irrelevant in context. to output html-entities, use numerical values instead, eg &#160 for &nbsp) specifies whether special characters are escaped when written to the output. the available values are "yes" or "no". if "yes" is s...
<xsl:variable> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › variable
erence: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:variable> element declares a global or local variable in a stylesheet and gives it a value. because xslt permits no side-effects, once the value of the variable has been established, it remains the same until the variable goes out of scope syntax <xsl:variable name=name select=expression > template </xsl:variable> required attributes name gives the variable a name. optional attributes select defines the value of the variable through an xpath expression. if the element contains a template, this attribute is ignored. type top-level or instruction. if it occurs as a top-level element, the variable is global in scope, and can be accessed throughout the document. if it occurs within a template, the variable...
<xsl:when> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › when
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:when> element always appears within an <xsl:choose> element, acting like a case statement. syntax <xsl:when test=expression> template </xsl:when> required attributes test specifies a boolean expression to be evaluated. if true, the contents of the element are processed; if false, they are ignored. optional attributes none. type subinstruction, always appears within an <xsl:choose> element. defined xslt, section 9.2. gecko support supported. ...
<xsl:with-param> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:with-param> element sets the value of a parameter to be passed into a template. syntax <xsl:with-param name=name select=expression> template </xsl:with-param> required attributes name gives this parameter a name. optional attributes select defines the value of the parameter through an xpath expression. if the element contains a template, this attribute is ignored. type subinstruction, always appears within an <xsl:apply-templates> or an <xsl:call-template> element. defined xslt 11.6 gecko support supported. ...
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element
ssion. for example, assume that a variable "image-dir" is defined as follows: <xsl:variable name="image-dir">/images</xsl:variable> the expression to be evaluated is placed inside curly brackets: <img src="{$image-dir}/mygraphic.jpg"/> this would result in the following: <img src="/images/mygraphic.jpg"/> the element annotations that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its source in the w3c recommendation and an explanation of the degree of present gecko support. use the {{listsubpages}} macro once the bcd for <xsl:fallback>, <xsl:import>, <xsl:namespace-alias>, <xsl:number>, <xsl:output>, <xsl:stylesheet>, <xsl:text> and <xsl:value-of> is fully migrated. <xsl:apply-imports><xsl:apply-templates><xsl...
Compiling a New C/C++ Module to WebAssembly - WebAssembly
prerequisites get the emscripten sdk, using these instructions: https://emscripten.org/docs/getting_started/downloads.html compiling an example with the environment set up, let's look at how to use it to compile a c example to emscripten. ...
Caching compiled WebAssembly modules - WebAssembly
ibrary function defined, getting a wasm module instance and using its exported features (while handling caching in the background) is as simple as calling it with the following parameters: a cache version, which — as we explained above — you need to update when any wasm module is updated or moved to a different url. the url of the wasm module you want to instantiate. an import object, if required. const wasmcacheversion = 1; instantiatecachedurl(wasmcacheversion, 'test.wasm').then(instance => console.log("instance says the answer is: " + instance.exports.answer()) ).catch(err => console.error("failure to instantiate: " + err) ); you can find the source code for this example on github as indexeddb-cache.html (see it live also). browser support at the moment, this technique will w...
WebAssembly Concepts - WebAssembly
mpilation target so that they can run on the web. (note that webassembly has the high-level goal of supporting languages with garbage-collected memory models in the future.) with the advent of webassembly appearing in browsers, the virtual machine that we talked about earlier will now load and run two types of code — javascript and webassembly. the different code types can call each other as required — the webassembly javascript api wraps exported webassembly code with javascript functions that can be called normally, and webassembly code can import and synchronously call normal javascript functions. in fact, the basic unit of webassembly code is called a module and webassembly modules are symmetric in many ways to es2015 modules. webassembly key concepts there are several key concepts ne...
Compiling from Rust to WebAssembly - WebAssembly
we cover here. for the former case, check out projects like yew. in this tutorial, we build an npm package using wasm-pack, a tool for building npm packages in rust. this package will contain only webassembly and javascript code, and so the users of the package won't need rust installed. they may not even notice that it's written in webassembly. rust environment setup let's go through all the required steps to get our environment set up. install rust install rust by going to the install rust page and following the instructions. this installs a tool called "rustup", which lets you manage multiple versions of rust. by default, it installs the latest stable rust release, which you can use for general rust development. rustup installs rustc, the rust compiler, as well as cargo, rust's package ma...
Compiling an Existing C Module to WebAssembly - WebAssembly
height; // draw image onto canvas const ctx = canvas.getcontext('2d'); ctx.drawimage(img, 0, 0); return ctx.getimagedata(0, 0, img.width, img.height); } now it's "only" a matter of copying the data from javascript into wasm. for that, you need to expose two additional functions — one that allocates memory for the image inside wasm and one that frees it up again: #include <stdlib.h> // required for malloc definition emscripten_keepalive uint8_t* create_buffer(int width, int height) { return malloc(width * height * 4 * sizeof(uint8_t)); } emscripten_keepalive void destroy_buffer(uint8_t* p) { free(p); } the create_buffer() function allocates a buffer for the rgba image — hence 4 bytes per pixel. the pointer returned by malloc() is the address of the first memory cell of that buf...