Search completed in 1.07 seconds.
579 results for "lh":
Your results are loading. Please wait...
Using XMLHttpRequest - Web APIs
in this guide, we'll take a look at how to use xmlhttprequest to issue http requests in order to exchange data between the web site and a server. examples of both common and more obscure use cases for xmlhttprequest are included. to send an http request, create an xmlhttprequest object, open a url, and send the request. after the transaction completes, the object will contain useful information such as the response body and the http status of the result. function reqlistener () { console.log(this.responsetext); } var oreq = new xmlhttprequest(); oreq.addeventlistener("load", reqlistener); oreq.open("get", "http://www.example.org/example.txt"); oreq.send(); types of requests a request made via xmlhttprequest can fetch the data in one of two ways, asynchronously or synchronously. the t...
...a detailed discussion and demonstrations of these two types of requests can be found on the synchronous and asynchronous requests page. do not use synchronous requests outside web workers. ...
...a detailed discussion and demonstrations of these two types of requests can be found on the synchronous and asynchronous requests page. ...
...And 31 more matches
XMLHttpRequest - Web APIs
xmlhttprequest (xhr) objects are used to interact with servers. you can retrieve data from a url without having to do a full page refresh. this enables a web page to update just part of a page without disrupting what the user is doing. xmlhttprequest is used heavily in ajax programming. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.076923076923077%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 650 150" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consol...
..."50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#d4dde4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#d4dde4"/><a xlink:href="/docs/web/api/xmlhttprequesteventtarget" target="_top"><rect x="151" y="1" width="250" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">xmlhttprequesteventtarget</text></a><polyline points="401,25 411,20 411,30 401,25" stroke="#d4dde4" fill="none"...
..." stroke="#d4dde4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">xmlhttprequesteventtarget</text></a><polyline points="401,25 411,20 411,30 401,25" stroke="#d4dde4" fill="none"/><line x1="411" y1="25" x2="441" y2="25" stroke="#d4dde4"/><a xlink:href="/docs/web/api/xmlhttprequest" target="_top"><rect x="441" y="1" width="140" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="511" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">xmlhttprequest</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} despite its name, xmlh...
...And 19 more matches
HTML in XMLHttpRequest - Web APIs
the w3c xmlhttprequest specification adds html parsing support to xmlhttprequest, which originally supported only xml parsing. this feature allows web apps to obtain an html resource as a parsed dom using xmlhttprequest. to get an overview of how to use xmlhttprequest in general, see using xmlhttprequest. limitations to discourage the synchronous use of xmlhttprequest, html support is not available in the synchronous mode. also, html support is only available if the responsetype property has been set to "document". this limitation avoids wasting time parsing html uselessly when legacy code uses xmlhttprequest in the default mode to retrieve responsetext for text/html resources. also, this limitation avoids problems with legacy code that assumes that responsexml is null for http error pag...
...n set to "document". this limitation avoids wasting time parsing html uselessly when legacy code uses xmlhttprequest in the default mode to retrieve responsetext for text/html resources. also, this limitation avoids problems with legacy code that assumes that responsexml is null for http error pages (which often have a text/html response body). ...
...lessly when legacy code uses xmlhttprequest in the default mode to retrieve responsetext for text/html resources. also, this limitation avoids problems with legacy code that assumes that responsexml is null for http error pages (which often have a text/html response body). usage retrieving an html resource as a dom using xmlhttprequest works just like retrieving an xml resource as a dom using xmlhttprequest, except you can't use the synchronous mode and you have to explicitly request a document by assigning the string "document" to the responsetype property of the xmlhttprequest object after calling open() but before calling send(). ...
...And 10 more matches
XMLHttpRequest.responseType - Web APIs
when setting responsetype to a particular value, the author should make sure that the server is actually sending a response compatible with that format. if the server returns data that is not compatible with the responsetype that was set, the value of response will be null. ...
... when setting responsetype to a particular value, the author should make sure that the server is actually sending a response compatible with that format. if the server returns data that is not compatible with the responsetype that was set, the value of response will be null. ...
... when setting responsetype to a particular value, the author should make sure that the server is actually sending a response compatible with that format. if the server returns data that is not compatible with the responsetype that was set, the value of response will be null. ...
...And 5 more matches
XMLHttpRequestEventTarget.onload - Web APIs
the xmlhttprequesteventtarget.onload is the function called when an xmlhttprequest transaction completes successfully. syntax xmlhttprequest.onload = callback; values callback is the function to be executed when the request completes successfully. it receives a progressevent object as its first argument. the value of this (i.e. the context) is the same xmlhttprequest this callback is related to. ...
...ttarget.onload is the function called when an xmlhttprequest transaction completes successfully. syntax xmlhttprequest.onload = callback; values callback is the function to be executed when the request completes successfully. it receives a progressevent object as its first argument. the value of this (i.e. the context) is the same xmlhttprequest this callback is related to. ...
... is the function called when an xmlhttprequest transaction completes successfully. syntax xmlhttprequest.onload = callback; values callback is the function to be executed when the request completes successfully. it receives a progressevent object as its first argument. the value of this (i.e. the context) is the same xmlhttprequest this callback is related to. ...
...And 5 more matches
XMLHttpRequestEventTarget.onprogress - Web APIs
the xmlhttprequesteventtarget.onprogress is the function called periodically with information when an xmlhttprequest before success completely. syntax xmlhttprequest.onprogress = callback; values callback is the function to be called periodically before the request is completed. event event.loaded the amount of data currently transfered. event.total the total amount of data to be transferred. ...
...uesteventtarget.onprogress is the function called periodically with information when an xmlhttprequest before success completely. syntax xmlhttprequest.onprogress = callback; values callback is the function to be called periodically before the request is completed. event event.loaded the amount of data currently transfered. event.total the total amount of data to be transferred. ...
...request before success completely. syntax xmlhttprequest.onprogress = callback; values callback is the function to be called periodically before the request is completed. event event.loaded the amount of data currently transfered. event.total the total amount of data to be transferred. ...
...And 5 more matches
XMLHttpRequestEventTarget - Web APIs
xmlhttprequesteventtarget is the interface that describes the event handlers you can implement in an object that will handle events for an xmlhttprequest. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a><polyline point...
..."50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#d4dde4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#d4dde4"/><a xlink:href="/docs/web/api/xmlhttprequesteventtarget" target="_top"><rect x="151" y="1" width="250" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">xmlhttprequesteventtarget</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} ...
...arget" target="_top"><rect x="151" y="1" width="250" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">xmlhttprequesteventtarget</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties xmlhttprequesteventtarget.onabort contains the function to call when a request is aborted and the abort event is received by this object. xmlhttprequesteventtarget.onerror contains the function to call when a request encounters an error and the error event is received by this object. xmlhttprequesteventtarget.onload contains the function to call when an http request returns after successfully fet...
...And 5 more matches
HTMLHRElement - Web APIs
the htmlhrelement interface provides special properties (beyond those of the htmlelement interface it also has available to it by inheritance) for manipulating <hr> elements. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a...
...naco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlelement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#d4dde4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#d4dde4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#d4dde4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/htmlhrelement" target="_top"><rect x="361" y="65" width="130" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="426" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlhrelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits pro...
... width="130" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="426" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlhrelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlhrelement.align is a domstring, an enumerated attribute indicating alignment of the rule with respect to the surrounding context. ...
...And 4 more matches
Screen.availHeight - Web APIs
this can be no larger than the value of window.screen.height, and will be less if the device or user agent reserves any vertical space for itself. ...
...this can be no larger than the value of window.screen.height, and will be less if the device or user agent reserves any vertical space for itself. ...
...this can be no larger than the value of window.screen.height, and will be less if the device or user agent reserves any vertical space for itself. ...
...And 4 more matches
XMLHttpRequest.sendAsBinary() - Web APIs
you can create the binary string using the filereader method readasbinarystring(). the string is converted to binary for transfer by removing the high-order byte of each character. return value undefined. ...
...is a variant of the send() method that sends binary data. the send() method now supports binary data and should now be used instead. this method makes it possible to read and upload any type of file and to stringify the raw data. warning: this method is obsolete and should not be used. you should instead simply use the send() method, which now supports binary data in various forms. syntax xmlhttprequest.sendasbinary(binarystring); parameters binarystring a domstring which encodes the binary content to be sent. you can create the binary string using the filereader method readasbinarystring(). the string is converted to binary for transfer by removing the high-order byte of each character. return value undefined. polyfill since sendasbinary() is an experimental feature, here i...
... be sent. you can create the binary string using the filereader method readasbinarystring(). the string is converted to binary for transfer by removing the high-order byte of each character. return value undefined. polyfill since sendasbinary() is an experimental feature, here is a polyfill for browsers that don't support the sendasbinary() method but support typed arrays. ...
...And 4 more matches
XMLHttpRequestEventTarget.onerror - Web APIs
the xmlhttprequesteventtarget.onerror is the function called when an xmlhttprequest transaction fails due to an error. syntax xmlhttprequest.onerror = callback; values callback is the function to be executed when the request fails. ...
... the xmlhttprequesteventtarget.onerror is the function called when an xmlhttprequest transaction fails due to an error. syntax xmlhttprequest.onerror = callback; values callback is the function to be executed when the request fails. ...
... the xmlhttprequesteventtarget.onerror is the function called when an xmlhttprequest transaction fails due to an error. syntax xmlhttprequest.onerror = callback; values callback is the function to be executed when the request fails. ...
...And 4 more matches
XMLHttpRequestEventTarget.onloadstart - Web APIs
the xmlhttprequesteventtarget.onloadstart is the function called when an xmlhttprequest transaction starts transferring data. syntax xmlhttprequest.onloadstart = callback; values callback is the function to be called when the transaction begins to transfer data. ...
... the xmlhttprequesteventtarget.onloadstart is the function called when an xmlhttprequest transaction starts transferring data. syntax xmlhttprequest.onloadstart = callback; values callback is the function to be called when the transaction begins to transfer data. ...
... the xmlhttprequesteventtarget.onloadstart is the function called when an xmlhttprequest transaction starts transferring data. syntax xmlhttprequest.onloadstart = callback; values callback is the function to be called when the transaction begins to transfer data. ...
...And 4 more matches
PLHashEnumerator
remark the meaning of ht_enumerate_unhash is not clear. ...
... remark the meaning of ht_enumerate_unhash is not clear. ...
... remark the meaning of ht_enumerate_unhash is not clear. ...
...And 3 more matches
nsIGlobalHistory3
docshell/base/nsiglobalhistory3.idlscriptable this interface provides information about global history to gecko. 1.0 66 introduced gecko 1.8 obsolete gecko 9.0 inherits from: nsiglobalhistory2 last changed in gecko 1.9 (firefox 3) this interface was originally created as part of nsiglobalhistory2, but was split off during the transition to places. method overview void adddocumentredirect(in nsichannel aoldchannel, in nsichannel anewchannel, in print32 aflags, in boolean atoplevel); unsigned long geturigeckoflags(in nsiuri auri); void seturigeckoflags(in nsiuri auri, in unsigned long aflags); methods adddocumentredirect() notifies the history system that the page loading via aoldchann...
... void seturigeckoflags(in nsiuri auri, in unsigned long aflags); methods adddocumentredirect() notifies the history system that the page loading via aoldchannel redirected to anewchannel. implementations should generally add the uri for aoldchannel to history for link coloring, but are advised not to expose it in the history user interface. ...
...uri, in unsigned long aflags); methods adddocumentredirect() notifies the history system that the page loading via aoldchannel redirected to anewchannel. implementations should generally add the uri for aoldchannel to history for link coloring, but are advised not to expose it in the history user interface. this function is preferred if nsiglobalhistory3 is available. ...
...And 3 more matches
nsIXMLHttpRequest
obsolete since gecko 60 (firefox 60 / thunderbird 60 / seamonkey 2.57)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. nsixmlhttprequest along with nsijsxmlhttprequest and nsixmlhttprequesteventtarget are mozilla's implementation details of the dom xmlhttprequest object. note: if you're a web developer or a mozilla add-on developer, please refer to the xmlhttprequest documentation instead. ...
...when using the xpcom interface, as seen below in example 2, we can get access to this. the most obvious benefit is that we can set nsirequest - constants in the xhr.channel.loadflags. ...
...the xhr.channel.loadflags. for instance, as done in example 2, the flag of load_anonymous is added, this strips all user data (cookies, tokens, etc). using event handlers from native code (not sure if it's up-to-date) from native code, the way to set up onload and onerror handlers is a bit different. here is a comment from johnny stenback <jst@netscape.com>: the mozilla implementation of nsixmlhttprequest implements the interface nsidomeventtarget and that's how you're supported to add event listeners. try something like this: nscomptr<nsidomeventtarget> target(do_queryinterface(myxmlhttpreq)); target->addeventlistener(ns_literal_string("load"), mylistener, pr_false) where mylistener is your event listener object that implements the interface nsidomeventlistener. the 'onload', 'onerror',...
...And 3 more matches
Element.scrollHeight - Web APIs
the element.scrollheight read-only property is a measurement of the height of an element's content, including content not visible on the screen due to overflow. the scrollheight value is equal to the minimum height the element would require in order to fit all the content in the viewport without using a vertical scrollbar. the height is measured in the same way as clientheight: it includes the element's padding, but not its border, margin or horizontal scrollbar (if present). it can also include the height of pseudo-elements such as ::before or ::after. if the element's content can fit without a need for vertical scrollbar, its scrollheight is equal to clientheight this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syn...
..., but not its border, margin or horizontal scrollbar (if present). it can also include the height of pseudo-elements such as ::before or ::after. if the element's content can fit without a need for vertical scrollbar, its scrollheight is equal to clientheight this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax elemscrollheight = element.scrollheight; value an integer corresponding to the scrollheight pixel value of the element. example padding-top lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in repre...
...iatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. padding-bottom left top right bottom margin-top margin-bottom border-top border-bottom problems and solutions determine if an element has been totally scrolled the following equivalence returns true if an element is at the end of its scroll, false if it isn't. ...
...And 3 more matches
HTMLHyperlinkElementUtils - Web APIs
the htmlhyperlinkelementutils mixin defines utility methods and properties to work with htmlanchorelement and htmlareaelement. these utilities allow to deal with common features like urls. there are no objects of this type, but several objects such as htmlanchorelement and htmlareaelement implement it. properties note: this interface doesn't inherit any property. htmlhyperlinkelementutils.href this a stringifier property that returns a usvstring containing the whole url, and allows the href to be updated. htmlhyperlinkelementutils.protocol this is a usvstring containing the protocol scheme of the url, including the final ':'. ...
... as htmlanchorelement and htmlareaelement implement it. properties note: this interface doesn't inherit any property. htmlhyperlinkelementutils.href this a stringifier property that returns a usvstring containing the whole url, and allows the href to be updated. htmlhyperlinkelementutils.protocol this is a usvstring containing the protocol scheme of the url, including the final ':'. ...
...ils.protocol this is a usvstring containing the protocol scheme of the url, including the final ':'. htmlhyperlinkelementutils.host this is a usvstring containing the host, that is the hostname, and then, if the port of the url is not empty (which can happen because it was not specified or because it was specified to be the default port of the url's scheme), a ':', and the port of the url. htmlhyperlinkelementutils.hostname this is a usvstring containing the domain of the url. htmlhyperlinkelementutils.port this is a usvstring containing the port number of the url. htmlhyperlinkelementutils.pathname this is a usvstring containing an initial '/' followed by the path of the url. ...
...And 3 more matches
HTMLImageElement.naturalHeight - Web APIs
this is the height at which the image is naturally drawn when no constraint or specific value is established for the image. ...
...eight property is a read-only value which returns the intrinsic (natural), density-corrected height of the image in css pixels. this is the height the image is if drawn with nothing constraining its height; if you don't specify a height for the image, or place the image inside a container that either limits or expressly specifies the image height, it will be rendered this tall. syntax let naturalheight = htmlimageelement.naturalheight; value an integer value indicating the intrinsic height, in css pixels, of the image. this is the height at which the image is naturally drawn when no constraint or specific value is established for the image. this natural height is corrected for the pixel density of the device on which it's being presented, unlike height. if the intrinsic height is not av...
... image is naturally drawn when no constraint or specific value is established for the image. this natural height is corrected for the pixel density of the device on which it's being presented, unlike height. if the intrinsic height is not available—either because the image does not specify an intrinsic height or because the image data is not available in order to obtain this information, naturalheight returns 0. example this example simply displays both the natural, density-adjusted size of an image as well as its rendered size as altered by the page's css and other factors. html <div class="box"> <img src="/files/16797/clock-demo-400px.png" class="image"> </div> <div class="output"> </div> the html features a 400x398 pixel image which is placed inside a <div>. css .box { width...
...And 3 more matches
Navigator.registerProtocolHandler() - Web APIs
parameters scheme a string containing the protocol the site wishes to handle. for example, you can register to handle sms text message links by passing the "sms" scheme. url a string containing the url of the handler. ...
... parameters scheme a string containing the protocol the site wishes to handle. for example, you can register to handle sms text message links by passing the "sms" scheme. url a string containing the url of the handler. ...
... parameters scheme a string containing the protocol the site wishes to handle. for example, you can register to handle sms text message links by passing the "sms" scheme. url a string containing the url of the handler. ...
...And 3 more matches
Using XMLHttpRequest in IE6 - Web APIs
xmlhttprequest was first introduced by microsoft in internet explorer 5.0 as an activex control. however, in ie7 and other browsers xmlhttprequest is a native javascript object. ...
... xmlhttprequest was first introduced by microsoft in internet explorer 5.0 as an activex control. however, in ie7 and other browsers xmlhttprequest is a native javascript object. ...
... xmlhttprequest was first introduced by microsoft in internet explorer 5.0 as an activex control. however, in ie7 and other browsers xmlhttprequest is a native javascript object. ...
...And 3 more matches
XMLHttpRequest.response - Web APIs
you may attempt to request the data be provided in a specific format by setting the value of responsetype after calling open() to initialize the request but before calling send() to send the request to the server. ...
...you may attempt to request the data be provided in a specific format by setting the value of responsetype after calling open() to initialize the request but before calling send() to send the request to the server. ...
...ponse types are described below. "" an empty responsetype string is treated the same as "text", the default type. arraybuffer the response is a javascript arraybuffer containing binary data. blob the response is a blob object containing the binary data. document the response is an html document or xml xmldocument, as appropriate based on the mime type of the received data. see html in xmlhttprequest to learn more about using xhr to fetch html content. json the response is a javascript object created by parsing the contents of received data as json. text the response is a text in a domstring object. ms-stream the response is part of a streaming download; this response type is only allowed for download requests, and is only supported by internet explorer. example this e...
...And 3 more matches
HTMLHeadElement - Web APIs
this object inherits all of the properties and methods described in the htmlelement interface. ...
...naco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlelement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#d4dde4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#d4dde4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#d4dde4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/htmlheadelement" target="_top"><rect x="341" y="65" width="150" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="416" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlheadelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits...
...idth="150" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="416" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlheadelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlheadelement.profile is a domstring representing the uris of one or more metadata profiles (white space separated). methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmlheadelement' in that specification. living standard html 5.1the definition ...
...And 2 more matches
HTMLHeadingElement - Web APIs
it inherits methods and properties from the htmlelement interface. ...
...naco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlelement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#d4dde4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#d4dde4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#d4dde4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/htmlheadingelement" target="_top"><rect x="311" y="65" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="401" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlheadingelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties in...
...h="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="401" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlheadingelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlheadingelement.align is a domstring representing an enumerated attribute indicating alignment of the heading with respect to the surrounding context. the possible values are "left", "right", "justify", and "center". methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition...
...And 2 more matches
HTMLHtmlElement - Web APIs
the htmlhtmlelement interface serves as the root node for a given html document. this object inherits the properties and methods described in the htmlelement interface. you can retrieve the htmlhtmlelement object for a given document by reading the value of the document.documentelement property. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,mon...
...naco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlelement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#d4dde4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#d4dde4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#d4dde4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/htmlhtmlelement" target="_top"><rect x="341" y="65" width="150" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="416" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlhtmlelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits...
...idth="150" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="416" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlhtmlelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlhtmlelement.version is a domstring representing the version of the html document type definition (dtd) that governs this document. this property should not be used any more as it is non-conforming. simply omit it. methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition o...
...And 2 more matches
HTMLHyperlinkElementUtils.host - Web APIs
the htmlhyperlinkelementutils.host property is a usvstring containing the host, that is the hostname, and then, if the port of the url is nonempty, a ':', and the port of the url. ...
... the htmlhyperlinkelementutils.host property is a usvstring containing the host, that is the hostname, and then, if the port of the url is nonempty, a ':', and the port of the url. ...
...g containing the host, that is the hostname, and then, if the port of the url is nonempty, a ':', and the port of the url. ...
...And 2 more matches
XMLHttpRequest.getAllResponseHeaders() - Web APIs
return value a bytestring representing all of the response's headers (except those whose field name is set-cookie or set-cookie2) separated by crlf, or null if no response has been received. if a network error happened, an empty string is returned. ...
... return value a bytestring representing all of the response's headers (except those whose field name is set-cookie or set-cookie2) separated by crlf, or null if no response has been received. if a network error happened, an empty string is returned. ...
...nt-length: 6502\r\n x-xss-protection: 1; mode=block\r\n each line is terminated by both carriage return and line feed characters (\r\n). these are essentially delimiters separating each of the headers. note: in modern browsers, the header names are returned in all lower case, as per the latest spec. ...
...And 2 more matches
XMLHttpRequest.readyState - Web APIs
opened open() method has been invoked. ...
... opened open() method has been invoked. ...
... value state description 0 unsent client has been created. open() not called yet. 1 opened open() has been called. 2 headers_received send() has been called, and headers and status are available. 3 loading downloading; responsetext holds partial data. 4 done the operation is complete. unsent the xmlhttprequest client has been created, but the open() method hasn't been called yet. opened open() method has been invoked. during this state, the request headers can be set using the setrequestheader() method and the send() method can be called which will initiate the fetch. headers_received send() has been called and the response headers have been received. loading response's body is being re...
...And 2 more matches
XMLHttpRequest.send() - Web APIs
the xmlhttprequest method send() sends the request to the server. if the request is asynchronous (which is the default), this method returns as soon as the request is sent and the result is delivered using events. if the request is synchronous, this method doesn't return until the response has arrived. send() accepts an optional parameter which lets you specify the request's body; this is primarily used for requests such as put. if the request method is get or head, the body parameter is ignored and the request body is set to null. if no accept header has been set using the setrequestheader(), an accept header with the type "*/*" (any type) is sent. syntax xmlhttprequest.send(body) parameters body optional a body of data to be sent in the xhr request. this can be: a document, ...
... get or head, the body parameter is ignored and the request body is set to null. if no accept header has been set using the setrequestheader(), an accept header with the type "*/*" (any type) is sent. syntax xmlhttprequest.send(body) parameters body optional a body of data to be sent in the xhr request. this can be: a document, in which case it is serialized before being sent. an xmlhttprequestbodyinit, which per the fetch spec can be a blob, buffersource, formdata, urlsearchparams, or usvstring object. null if no value is specified for the body, a default value of null is used. the best way to send binary content (e.g. in file uploads) is by using an arraybufferview or blob in conjunction with the send() method. return value undefined. exceptions exception...
...) is by using an arraybufferview or blob in conjunction with the send() method. return value undefined. exceptions exception description invalidstateerror send() has already been invoked for the request, and/or the request is complete. networkerror the resource type to be fetched is a blob, and the method is not get. ...
...And 2 more matches
XMLHttpRequest.withCredentials - Web APIs
the third-party cookies obtained by setting withcredentials to true will still honor same-origin policy and hence can not be accessed by the requesting script through document.cookie or from response headers. ...
...the third-party cookies obtained by setting withcredentials to true will still honor same-origin policy and hence can not be accessed by the requesting script through document.cookie or from response headers. ...
...om a different domain cannot set cookie values for their own domain unless withcredentials is set to true before making the request. the third-party cookies obtained by setting withcredentials to true will still honor same-origin policy and hence can not be accessed by the requesting script through document.cookie or from response headers. note: this never affects same-site requests. ...
...And 2 more matches
XMLHttpRequestResponseType - Web APIs
json the response is a javascript object created by parsing the contents of received data as json. ...
... json the response is a javascript object created by parsing the contents of received data as json. ...
...onsetype on the request. values "" an empty responsetype string is treated the same as "text", the default type. arraybuffer the response is a javascript arraybuffer containing binary data. blob the response is a blob object containing the binary data. document the response is an html document or xml xmldocument, as appropriate based on the mime type of the received data. see html in xmlhttprequest to learn more about using xhr to fetch html content. json the response is a javascript object created by parsing the contents of received data as json. text the response is a text in a domstring object. ms-stream the response is part of a streaming download; this response type is only allowed for download requests, and is only supported by internet explorer. deprecated values ...
...And 2 more matches
PLHashAllocOps
a pair of functions is used to allocate and tree the table, and another pair of functions is used to allocate and free the table entries. ...
...a pair of functions is used to allocate and tree the table, and another pair of functions is used to allocate and free the table entries. ...
...a pair of functions is used to allocate and tree the table, and another pair of functions is used to allocate and free the table entries. ...
...a pair of functions is used to allocate and tree the table, and another pair of functions is used to allocate and free the table entries. ...
nsIGlobalHistory2
note: docshell will not filter out uri schemes like chrome:, data:, about: and view-source:. ...
...note: docshell will not filter out uri schemes like chrome:, data:, about: and view-source:. ...
...note: docshell will not filter out uri schemes like chrome:, data:, about: and view-source:. ...
...s auri the nsiuri of the page. return value true if a uri has been visited. setpagetitle() set the page title for the given uri. uris that are not already in global history will not be added. void setpagetitle( in nsiuri auri, in astring atitle ); parameters auri the nsiuri for which to set to the title. atitle the page title. see also nsiglobalhistory3 ...
nsIXMLHttpRequestEventTarget
1.0 66 introduced gecko 1.9.1 inherits from: nsidomeventtarget last changed in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) attributes attribute type description onabort nsidomeventlistener a javascript function object that gets invoked if the operation is canceled by the user. onerror nsidomeventlistener a javascript function object that gets invoked if the operation fails to complete due to an error. onload nsidomeventlistener a javascript function object that gets invoked when the operation is successfully completed. ...
... when the operation begins. ...
...tion begins. ...
...rogress nsidomeventlistener a javascript function object that gets invoked zero or more times, after the loadstart event, but before any abort, error, or load events occur. handling the events when the handler functions for these events are called, they receive as a parameter a progressevent, which implements the nsidomprogressevent interface. see also using xmlhttprequest xmlhttprequest nsixmlhttprequest nsidomprogressevent ...
XMLHttpRequest.getResponseHeader() - Web APIs
the xmlhttprequest method getresponseheader() returns the string containing the text of a particular header's value. if there are multiple response headers with the same name, then their values are returned as a single concatenated string, where each value is separated from the previous one by a pair of comma and space. the getresponseheader() method returns the value as a utf byte sequence. note: the search for the header name is case-insensitive. if you need to get the raw string of all of the headers, use the getallresponseheaders() method, which returns the entire raw header string. syntax var myheader = xmlhttprequest.getresponseheader(headername); parameters headername a bytestring indicating the name of the header you want to return the text value of. return value a byt...
...ll if either the response has not yet been received or the header doesn't exist in the response. example in this example, a request is created and sent, and a readystatechange handler is established to look for the readystate to indicate that the headers have been received; when that is the case, the value of the content-type header is fetched. ...
... doesn't exist in the response. example in this example, a request is created and sent, and a readystatechange handler is established to look for the readystate to indicate that the headers have been received; when that is the case, the value of the content-type header is fetched. if the content-type isn't the desired value, the xmlhttprequest is canceled by calling abort(). ...
... xmlhttprequest(); client.open("get", "unicorns-are-teh-awesome.txt", true); client.send(); client.onreadystatechange = function() { if(this.readystate == this.headers_received) { var contenttype = client.getresponseheader("content-type"); if (contenttype != my_expected_type) { client.abort(); } } } specifications specification status comment xmlhttprequestthe definition of 'getresponseheader()' in that specification. living standard whatwg living standard ...
XMLHttpRequest.onreadystatechange - Web APIs
an eventhandler that is called whenever the readystate attribute changes. the callback is called from the user interface thread. the xmlhttprequest.onreadystatechange property contains the event handler to be called when the readystatechange event is fired, that is every time the readystate property of the xmlhttprequest changes. warning: this should not be used with synchronous requests and must not be used from native code. syntax xmlhttprequest.onreadystatechange = callback; values callback is the function to be executed when the readystate changes. ...
...dler to be called when the readystatechange event is fired, that is every time the readystate property of the xmlhttprequest changes. warning: this should not be used with synchronous requests and must not be used from native code. syntax xmlhttprequest.onreadystatechange = callback; values callback is the function to be executed when the readystate changes. ...
...ax xmlhttprequest.onreadystatechange = callback; values callback is the function to be executed when the readystate changes. ...
...ox if(xhr.readystate === xmlhttprequest.done) { var status = xhr.status; if (status === 0 || (status >= 200 && status < 400)) { // the request has been completed successfully console.log(xhr.responsetext); } else { // oh no! there has been an error with the request! ...
XMLHttpRequest.overrideMimeType() - Web APIs
return value undefined. example this example specifies a mime type of "text/plain", overriding the server's stated type for the data being received. ...
... return value undefined. example this example specifies a mime type of "text/plain", overriding the server's stated type for the data being received. ...
... request. this may be used, for example, to force a stream to be treated and parsed as "text/xml", even if the server does not report it as such. this method must be called before calling send(). syntax xmlhttprequest.overridemimetype(mimetype) parameters mimetype a domstring specifying the mime type to use instead of the one specified by the server. if the server doesn't specify a type, xmlhttprequest assumes "text/xml". return value undefined. example this example specifies a mime type of "text/plain", overriding the server's stated type for the data being received. note: if the server doesn't provide a content-type header, xmlhttprequest assumes that the mime type is "text/xml". if the content isn't valid xml, an "xml parsing error: not well-formed" error occurs. you can avo...
...ing the server's stated type for the data being received. note: if the server doesn't provide a content-type header, xmlhttprequest assumes that the mime type is "text/xml". if the content isn't valid xml, an "xml parsing error: not well-formed" error occurs. you can avoid this by calling overridemimetype() to specify a different type. // interpret the received data as plain text req = new xmlhttprequest(); req.overridemimetype("text/plain"); req.addeventlistener("load", callback, false); req.open("get", url); req.send(); specifications specification status comment xmlhttprequestthe definition of 'overridemimetype()' in that specification. living standard whatwg living standard ...
XMLHttpRequest.responseText - Web APIs
the read-only xmlhttprequest property responsetext returns the text received from a server following a request being sent. syntax var resulttext = xmlhttprequest.responsetext; value a domstring which contains either the textual data received using the xmlhttprequest or null if the request failed or "" if the request has not yet been sent by calling send(). while handling an asynchronous request, the value of responsetext always has the current content received from the server, even if it's incomplete because the data has not been completely received yet. you know the entire content has been received when the value of readystate becomes xmlhttprequest.done (4), and status becomes 200 ("ok"). ...
... calling send(). while handling an asynchronous request, the value of responsetext always has the current content received from the server, even if it's incomplete because the data has not been completely received yet. you know the entire content has been received when the value of readystate becomes xmlhttprequest.done (4), and status becomes 200 ("ok"). exceptions invalidstateerror the xmlhttprequest.responsetype is not set to either the empty string or "text". ...
... received yet. you know the entire content has been received when the value of readystate becomes xmlhttprequest.done (4), and status becomes 200 ("ok"). exceptions invalidstateerror the xmlhttprequest.responsetype is not set to either the empty string or "text". since the responsetext property is only valid for text content, any other value is an error condition. ...
...server', true); // if specified, responsetype must be empty string or "text" xhr.responsetype = 'text'; xhr.onload = function () { if (xhr.readystate === xhr.done) { if (xhr.status === 200) { console.log(xhr.response); console.log(xhr.responsetext); } } }; xhr.send(null); specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest.responseXML - Web APIs
this property isn't available to workers. ...
...erty's history; it works for both html and xml. usually, the response is parsed as "text/xml". if the responsetype is set to "document" and the request was made asynchronously, instead the response is parsed as "text/html". responsexml is null for any other types of data, as well as for data: urls. if the server doesn't specify the content-type as "text/xml" or "application/xml", you can use xmlhttprequest.overridemimetype() to parse it as xml anyway. this property isn't available to workers. syntax var data = xmlhttprequest.responsexml; value a document from parsing the xml or html received using xmlhttprequest, or null if no data was received or if the data is not xml/html. exceptions invalidstateerror the responsetype isn't either "document" or an empty string. example va...
...rridemimetype() to parse it as xml anyway. this property isn't available to workers. syntax var data = xmlhttprequest.responsexml; value a document from parsing the xml or html received using xmlhttprequest, or null if no data was received or if the data is not xml/html. exceptions invalidstateerror the responsetype isn't either "document" or an empty string. ...
... living standard whatwg living standard ...
XMLHttpRequest.timeout - Web APIs
the xmlhttprequest.timeout property is an unsigned long representing the number of milliseconds a request can take before automatically being terminated. the default value is 0, which means there is no timeout. timeout shouldn't be used for synchronous xmlhttprequests requests used in a document environment or it will throw an invalidaccesserror exception. when a timeout happens, a timeout event is fired. note: you may not use a timeout for synchronous requests with an owning window. using a timeout with an asynchronous request in internet explorer, the timeout property may be set only after calling the open() method and before calling the send() method. ...
...ronment or it will throw an invalidaccesserror exception. when a timeout happens, a timeout event is fired. note: you may not use a timeout for synchronous requests with an owning window. using a timeout with an asynchronous request in internet explorer, the timeout property may be set only after calling the open() method and before calling the send() method. ...
...eout with an asynchronous request in internet explorer, the timeout property may be set only after calling the open() method and before calling the send() method. example var xhr = new xmlhttprequest(); xhr.open('get', '/server', true); xhr.timeout = 2000; // time in milliseconds xhr.onload = function () { // request finished. do processing here. ...
...ore calling the send() method. example var xhr = new xmlhttprequest(); xhr.open('get', '/server', true); xhr.timeout = 2000; // time in milliseconds xhr.onload = function () { // request finished. do processing here. }; xhr.ontimeout = function (e) { // xmlhttprequest timed out. do something here. ...
JS::NullHandleValue
this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value null. ...
... this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value null. ...
... this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value null. ...
nsIExternalHelperAppService
uriloader/exthandler/nsiexternalhelperappservice.idlscriptable the external helper app service is used for finding and launching platform specific external applications for a given mime content type. inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/uriloader/external-helper-app-service;1. ...
... uriloader/exthandler/nsiexternalhelperappservice.idlscriptable the external helper app service is used for finding and launching platform specific external applications for a given mime content type. inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/uriloader/external-helper-app-service;1. ...
...specific external applications for a given mime content type. inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/uriloader/external-helper-app-service;1. ...
nsIProtocolHandler
if you wish to create a new protocol handler, you need to implement this interface. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview boolean allowport(in long port, in string scheme); nsichannel newchannel(in nsiuri auri); nsiuri newuri(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); attributes attribute type description defaultport long the default port is the port the protocol uses by default. if the protocol doesn't need a port (for example, the "about" protocol), this attribute is -1. ...
...esource), or something else that would not hit the network. uri_opening_executes_script 1<<13 uris for this protocol execute script when they are opened. allows_proxy 1<<2 this protocol handler can be proxied via socks or http (such as irc, smtp, and http, for example). if the protocol supports transparent proxying, the handler should implement the nsiproxiedprotocolhandler interface. if the protocol only supports http proxying, it doesn't need to support nsiproxiedprotocolhandler, but should instead set the allows_proxy_http flag. allows_proxy_http 1<<3 the protocol handler can be proxied using an http proxy (for example, http and ftp). nsiioservice.newchannelfromuri() will feed uris from this protocol handler to the http protocol handler inste...
...hen utf-8 encoding is assumed and no character transformation is not performed. abaseuri if null, aspec must specify an absolute uri. ...
HTMLHyperlinkElementUtils.hostname - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
... living standard initial definition. ...
HTMLHyperlinkElementUtils.href - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
...returns a usvstring containing the whole url, and allows the href to be updated. syntax string = object.href; object.href = string; examples // lets imagine an <a id="myanchor" href="https://developer.mozilla.org/htmlhyperlinkelementutils/href"> element is in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.href; // returns: 'https://developer.mozilla.org/htmlhyperlinkelementutils/href' specifications specification status comment html living standardthe definition of 'htmlhyperlinkelementutils.href' in that specification. living standard initial definition. ...
HTMLHyperlinkElementUtils.password - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
... living standard initial definition. ...
HTMLHyperlinkElementUtils.pathname - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
...g an initial '/' followed by the path of the url (or the empty string if there is no path). syntax string = object.pathname; object.pathname = string; examples // let's an <a id="myanchor" href="https://developer.mozilla.org/docs/htmlhyperlinkelementutils.pathname"> element be in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.pathname; // returns:'/docs/htmlhyperlinkelementutils.pathname' specifications specification status comment html living standardthe definition of 'htmlhyperlinkelementutils.pathname' in that specification. living standard initial definition. ...
HTMLHyperlinkElementUtils.port - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
... living standard initial definition. ...
HTMLHyperlinkElementUtils.protocol - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
... living standard initial definition. ...
HTMLHyperlinkElementUtils.search - Web APIs
the htmlhyperlinkelementutils.search property is a search string, also called a query string, that is usvstring containing a '?' followed by the parameters of the url. modern browsers provide urlsearchparams and url.searchparams to make it easy to parse out the parameters from the querystring. ...
... property is a search string, also called a query string, that is usvstring containing a '?' followed by the parameters of the url. modern browsers provide urlsearchparams and url.searchparams to make it easy to parse out the parameters from the querystring. ...
... living standard initial definition. ...
HTMLHyperlinkElementUtils.toString() - Web APIs
the htmlhyperlinkelementutils.tostring() stringifier method returns a usvstring containing the whole url. it is a read-only version of htmlhyperlinkelementutils.href. ...
... the htmlhyperlinkelementutils.tostring() stringifier method returns a usvstring containing the whole url. it is a read-only version of htmlhyperlinkelementutils.href. ...
... the whole url. it is a read-only version of htmlhyperlinkelementutils.href. ...
HTMLHyperlinkElementUtils.username - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
... living standard initial definition. ...
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
the channel property becomes available only after the request is sent and the connection was established, that is, on readystate loaded, interactive or completed. ...
... the channel property becomes available only after the request is sent and the connection was established, that is, on readystate loaded, interactive or completed. ...
...ganization + "\n"); dump("\tsha1 fingerprint = " + cert.sha1fingerprint + "\n"); var validity = cert.validity.queryinterface(ci.nsix509certvalidity); dump("\tvalid from " + validity.notbeforegmt + "\n"); dump("\tvalid until " + validity.notaftergmt + "\n"); } } catch(err) { alert(err); } } function test(url) { var req = cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(); req.open('get', url, true); req.addeventlistener("error", function(e) { var error = createtcperrorfromfailedxhr(req); dumpsecurityinfo(req, error); }, false); req.onload = function(e) { dumpsecurityinfo(req); }; req.send(); } then test("https://addons.mozilla.org"); produced the following output in my console: connection s...
XMLHttpRequest.abort() - Web APIs
the xmlhttprequest.abort() method aborts the request if it has already been sent. when a request is aborted, its readystate is changed to xmlhttprequest.unsent (0) and the request's status code is set to 0. syntax xmlhttprequest.abort() parameters none. return value undefined example this example begins loading content from the mdn home page, then due to some condition, aborts the transfer by calling abort(). ...
...ts the request if it has already been sent. when a request is aborted, its readystate is changed to xmlhttprequest.unsent (0) and the request's status code is set to 0. syntax xmlhttprequest.abort() parameters none. return value undefined example this example begins loading content from the mdn home page, then due to some condition, aborts the transfer by calling abort(). ...
...ple begins loading content from the mdn home page, then due to some condition, aborts the transfer by calling abort(). ...
XMLHttpRequest: abort event - Web APIs
the abort event is fired when a request has been aborted, for example because the program called xmlhttprequest.abort(). bubbles no cancelable no interface progressevent event handler property onabort examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; ...
...function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...hr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xmlhttprequest living standard ...
XMLHttpRequest: load event - Web APIs
the load event is fired when an xmlhttprequest transaction completes successfully. bubbles no cancelable no interface progressevent event handler property onload examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbut...
...function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...hr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xmlhttprequest living standard ...
XMLHttpRequest.responseURL - Web APIs
the read-only xmlhttprequest.responseurl property returns the serialized url of the response or the empty string if the url is null. if the url is returned, any url fragment present in the url will be stripped away. the value of responseurl will be the final url obtained after any redirects. ...
... the read-only xmlhttprequest.responseurl property returns the serialized url of the response or the empty string if the url is null. if the url is returned, any url fragment present in the url will be stripped away. the value of responseurl will be the final url obtained after any redirects. ...
...ragment present in the url will be stripped away. the value of responseurl will be the final url obtained after any redirects. ...
XMLHttpRequest.status - Web APIs
the read-only xmlhttprequest.status property returns the numerical http status code of the xmlhttprequest's response. before the request completes, the value of status is 0. browsers also report a status of 0 in case of xmlhttprequest errors. ...
... the read-only xmlhttprequest.status property returns the numerical http status code of the xmlhttprequest's response. before the request completes, the value of status is 0. browsers also report a status of 0 in case of xmlhttprequest errors. ...
...tatus); xhr.open('get', '/server'); console.log('opened: ', xhr.status); xhr.onprogress = function () { console.log('loading: ', xhr.status); }; xhr.onload = function () { console.log('done: ', xhr.status); }; xhr.send(); /** * outputs the following: * * unsent: 0 * opened: 0 * loading: 200 * done: 200 */ specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest.statusText - Web APIs
the read-only xmlhttprequest.statustext property returns a domstring containing the response's status message as returned by the http server. unlike xmlhttprequest.status which indicates a numerical status code, this property contains the text of the response status, such as "ok" or "not found". if the request's readystate is in unsent or opened state, the value of statustext will be an empty string. if the server response doesn't explicitly specify a status text, statustext will assume the default value "ok". ...
...nlike xmlhttprequest.status which indicates a numerical status code, this property contains the text of the response status, such as "ok" or "not found". if the request's readystate is in unsent or opened state, the value of statustext will be an empty string. if the server response doesn't explicitly specify a status text, statustext will assume the default value "ok". ...
...n('get', '/server', true); console.log('1 opened', xhr.statustext); xhr.onprogress = function () { console.log('3 loading', xhr.statustext); }; xhr.onload = function () { console.log('4 done', xhr.statustext); }; xhr.send(null); /** * outputs the following: * * 0 unsent * 1 opened * 3 loading ok * 4 done ok */ specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest.upload - Web APIs
the following events can be triggered on an upload object and used to monitor the upload: event event listener description loadstart onloadstart the upload has begun. progress onprogress periodically delivered to indicate the amount of progress made so far. abort onabort the upload operation was aborted. error onerror the upload failed due to an error. load onload the upload completed successfully. ...
...rogress periodically delivered to indicate the amount of progress made so far. abort onabort the upload operation was aborted. error onerror the upload failed due to an error. load onload the upload completed successfully. timeout ontimeout the upload timed out because a reply did not arrive within the time interval specified by the xmlhttprequest.timeout. loadend onloadend the upload finished. this event does not differentiate between success or failure, and is sent at the end of the upload regardless of the outcome. prior to this event, one of load, error, abort, or timeout will already have been delivered to indicate why the upload ended. specifications specification status comment ...
...st.timeout. loadend onloadend the upload finished. ...
XMLHttpRequestEventTarget.onabort - Web APIs
the xmlhttprequesteventtarget.onabort is the function called when an xmlhttprequest transaction is aborted, such as when the xmlhttprequest.abort() function is called. syntax xmlhttprequest.onabort = callback; values callback is the function to be executed when the transaction is aborted. example var xmlhttp = new xmlhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xmlhttp.open(method, url, true); xmlhttp.onabort = function () { console.log('** the request was aborted'); }; xmlhttp.send(); //.. ...
...abort() function is called. syntax xmlhttprequest.onabort = callback; values callback is the function to be executed when the transaction is aborted. example var xmlhttp = new xmlhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xmlhttp.open(method, url, true); xmlhttp.onabort = function () { console.log('** the request was aborted'); }; xmlhttp.send(); //.. ...
...ansaction is aborted. example var xmlhttp = new xmlhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xmlhttp.open(method, url, true); xmlhttp.onabort = function () { console.log('** the request was aborted'); }; xmlhttp.send(); //.. ...
PLHashNumber
syntax #include <plhash.h> typedef pruint32 plhashnumber; #define pl_hash_bits 32 description plhashnumber is an unsigned 32-bit integer. plhashnumber is the data type of the return value of a hash function. a hash function maps a key to a hash number, which is then used to compute the index of the bucket. the macro pl_hash_bits is the size (in bits) of the plhashnumber data type and has the value of 32. ...
... typedef pruint32 plhashnumber; #define pl_hash_bits 32 description plhashnumber is an unsigned 32-bit integer. plhashnumber is the data type of the return value of a hash function. a hash function maps a key to a hash number, which is then used to compute the index of the bucket. the macro pl_hash_bits is the size (in bits) of the plhashnumber data type and has the value of 32. ...
nsIXMLHttpRequestUpload
content/base/public/nsixmlhttprequest.idlscriptable this interface provides access to the features needed when uploading data using nsixmlhttprequest. ...
...monkey 2.0) attributes attribute type description onabort nsidomeventlistener onerror nsidomeventlistener onload nsidomeventlistener onloadstart nsidomeventlistener onprogress nsidomeventlistener see also nsixmlhttprequest nsixmlhttprequesteventtarget xmlhttprequest using xmlhttprequest ...
HTMLHyperlinkElementUtils.origin - Web APIs
e.g "blob:https://mozilla.org" will have "https://mozilla.org". note: this feature is available in web workers. ...
...wing blob:. e.g "blob:https://mozilla.org" will have "https://mozilla.org". note: this feature is available in web workers. syntax string = object.origin; examples // on this page, returns the origin var result = window.location.origin; // returns:'https://developer.mozilla.org' specifications specification status comment html living standardthe definition of 'htmlhyperlinkelementutils.origin' in that specification. living standard initial definition. ...
XMLHttpRequest() - Web APIs
the xmlhttprequest() constructor creates a new xmlhttprequest. for details about how to use xmlhttprequest, see using xmlhttprequest. syntax const request = new xmlhttprequest(); parameters none. return value a new xmlhttprequest object. the object must be prepared by at least calling open() to initialize it before calling send() to send the request to the server. non-standard firefox syntax firefox 16 added a non-standard parameter to the constructor that can enable anonymous mode (see bug 692677). setting the mozanon flag to true effectively resembles the anonxmlhttprequest() constructor described in older versions of the xmlhttprequest specification. ...
...pen() to initialize it before calling send() to send the request to the server. non-standard firefox syntax firefox 16 added a non-standard parameter to the constructor that can enable anonymous mode (see bug 692677). setting the mozanon flag to true effectively resembles the anonxmlhttprequest() constructor described in older versions of the xmlhttprequest specification. const request = new xmlhttprequest(paramsdictionary); parameters (non-standard) objparameters there are two flags you can set: mozanon boolean: setting this flag to true will cause the browser not to expose the origin and user credentials when fetching resources. most important, this means that cookies will not be sent unless explicitly added using setrequestheader. mozsystem boolean: setting this flag to...
XMLHttpRequest: error event - Web APIs
function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...hr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xmlhttprequest living standard ...
XMLHttpRequest: loadend event - Web APIs
function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...hr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xmlhttprequest living standard ...
XMLHttpRequest: loadstart event - Web APIs
function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...hr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xmlhttprequest living standard ...
XMLHttpRequest.open() - Web APIs
ignored for non-http(s) urls. url a domstring representing the url to send the request to. async optional an optional boolean parameter, defaulting to true, indicating whether or not to perform the operation asynchronously. if this value is false, the send() method does not return until the response is received. ...
...hronous xhr support on the main thread entirely. synchronous requests are permitted in workers. user optional the optional user name to use for authentication purposes; by default, this is the null value. password optional the optional password to use for authentication purposes; by default, this is the null value. specifications specification status comment xmlhttprequestthe definition of 'open()' in that specification. living standard whatwg living standard ...
XMLHttpRequest: progress event - Web APIs
function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...hr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xmlhttprequest living standard ...
XMLHttpRequest.setRequestHeader() - Web APIs
when using setrequestheader(), you must call it after calling open(), but before calling send(). if this method is called several times with the same header, the values are merged into one single request header. each time you call setrequestheader() after the first time you call it, the specified text is appended to the end of the existing header's content. if no accept header has been set using this, an accept header with the type "*/*" is sent with the request when send() is called. for security reasons, some headers can only be controlled by the user agent. these headers include the forbidden header names and forbidden response header names. ...
...d by the user agent. these headers include the forbidden header names and forbidden response header names. note: for your custom fields, you may encounter a "not allowed by access-control-allow-headers in preflight response" exception when you send requests across domains. in this situation, you need to set up the access-control-allow-headers in your response header at server side. syntax xmlhttprequest.setrequestheader(header, value) parameters header the name of the header whose value is to be set. value the value to set as the body of the header. return value undefined. specifications specification status comment xmlhttprequestthe definition of 'setrequestheader()' in that specification. living standard whatwg living standard ...
buttonlabelhelp - Archive of obsolete content
...
disableglobalhistory - Archive of obsolete content
...
XHR (XMLHttpRequest) - MDN Web Docs Glossary: Definitions of Web-related terms
xmlhttprequest (xhr) is a javascript api to create ajax requests. its methods provide the ability to send network requests between the browser and a server. learn more general knowledge xmlhttprequest on wikipedia synchronous vs. asynchronous communications technical information the xmlhttprequest object. the documentation on mdn about how to use xmlhttprequest. ...
PLHashComparator
syntax #include <plhash.h> typedef printn (pr_callback *plhashcomparator)( const void *v1, const void *v2); description plhashcomparator is a function type that compares two values of an unspecified type. it returns a nonzero value if the two values are equal, and 0 if the two values are not equal. plhashcomparator defines the meaning of equality for the unspecified type. for convenience, two comparator functions are provided. pl_comparestrings compare two character strings using strcmp. pl_comparevalues compares the values of the arguments v1 and v2 numerically. remark the return value of plhashcomparator functions should be of type prbool. see also pl_comparestrings, pl_comparevalues ...
PLHashEntry
syntax #include <plhash.h> typedef struct plhashentry plhashentry; description plhashentry is a structure that represents an entry in the hash table. an entry has a key and a value, represented by the following fields in the plhashentry structure. const void *key; void *value; the key field is a pointer to an opaque key. the value field is a pointer to an opaque value. if the key of an entry is an integral value that can fit into a void * pointer, you can just cast the key itself to void * and store it in the key field. similarly, if the value of an entry is an integral value that can fit into a void * pointer, you can cast the value itself to void * and store it in the value field. warning: there are other fields in the plhashentry structure besides key and value. these fields ar...
PLHashFunction
syntax #include <plhash.h> typedef plhashnumber (pr_callback *plhashfunction)(const void *key); description plhashnumber is a function type that maps the key of a hash table entry to a hash number. see also pl_hashstring ...
PLHashTable
the number of buckets in a hash table may be changed by the library functions during the lifetime of the table to optimize speed and space. a new hash table is created by the pl_newhashtable function, and destroyed by the pl_hashtabledestroy function. ...
nsIExternalURLHandlerService
uriloader/exthandler/nsiexternalurlhandlerservice.idlscriptable the external url handler service is used for finding platform-specific applications for handling particular urls. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsihandlerinfo geturlhandlerinfofromos(in nsiuri aurl, out boolean afound); methods geturlhandlerinfofromos() given a url, looks up the handler info from the operating system. this should be overridden by each operating systems implementation. nsihandlerinfo geturlhandlerinfofromos( in nsiuri aurl, out boolean afound ); parameters aurl the url we are looking for. afound was an operating system default handler for this url found? r...
nsIFileProtocolHandler
netwerk/protocol/file/nsifileprotocolhandler.idlscriptable this interface provides methods to convert between nsifile and nsiuri. it also provides access to internet shortcuts stored on the host operating system's file system. inherits from: nsiprotocolhandler last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview nsifile getfilefromurlspec(in autf8string url); autf8string geturlspecfromactualfile(in nsifile file); autf8string geturlspecfromdir(in nsifile file); autf8string geturlspecfromfile(in nsifile file); nsiuri newfileuri(in nsifile afile); nsiuri readurlfile(in nsifile file); methods getfilefromurlspec() converts the url string into the corresponding nsifile if possible. a loca...
nsIGlobalHistory
66 introduced gecko 1.0 deprecated gecko 2.0 obsolete gecko 15.0 inherits from: nsisupports last changed in gecko 1.7 method overview void addpage(in string aurl); boolean isvisited(in string aurl); methods addpage() add a page to the history. void addpage( in string aurl ); parameters aurl the url to the page. isvisited() checks to see if the given page is in history. boolean isvisited( in string aurl ); parameters aurl the url to the page. return value true if a page has been passed into addpage(). ...
HTMLHyperlinkElementUtils.hash - Web APIs
the htmlhyperlinkelementutils.hash property returns a usvstring containing a '#' followed by the fragment identifier of the url. the fragment is not percent-decoded. if the url does not have a fragment identifier, this property contains an empty string, "". syntax string = object.hash; object.hash = string; examples <a id="myanchor" href="/docs/htmlhyperlinkelementutils.href#examples">examples</a> <script> var anchor = document.getelementbyid("myanchor"); console.log(anchor.hash); // returns '#examples' </script> specifications specification status comment html living standardthe definition of 'htmlhyperlinkelementutils.hash' in that specification. living standard initial definition ...
XMLHttpRequest.channel - Web APIs
this is null if the channel hasn't been created yet. in the case of a multi-part request, this is the initial channel, not the different parts in the multi-part request. requires elevated privileges to access. ...
XMLHttpRequest.mozAnon - Web APIs
if true, the request will be sent without cookies or authentication headers. ...
XMLHttpRequest.mozBackgroundRequest - Web APIs
if true, no load group is associated with the request, with security dialogs prevented from being shown to the user. ...
XMLHttpRequest.openRequest() - Web APIs
s 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. this mozilla-specific method is available only from within privileged code, and is only called from a c++ context in order to initialize an xmlhttprequest. to initialize a request from javascript code, use the standard open() method instead. ...
XMLHttpRequest: timeout event - Web APIs
the timeout event is fired when progression is terminated due to preset time expiring. bubbles no cancelable no interface progressevent event handler property ontimeout examples const client = new xmlhttprequest(); client.open('get', 'http://www.example.org/example.txt'); client.ontimeout = () => { console.error('timeout!!') }; client.send(); you could also set up the event handler using the addeventlistener() method: client.addeventlistener('timeout', () => { console.error("timeout!!"); }); specifications specification status comment xmlhttprequestthe definition of 'timeout event' in that specification. living standard ...
Index - Web APIs
Web › API › Index
web performance, user behavior tracker, user tracker the beacon interface is used to schedule an asynchronous and non-blocking request to a web server. beacon requests use the http post method and requests typically do not require a response. requests are guaranteed to be initiated before a page is unloaded and they are run to completion, without requiring a blocking request (for example xmlhttprequest). 274 using the beacon api guide, web performance the beacon interface schedules an asynchronous and non-blocking request to a web server. 275 beforeinstallpromptevent api, beforeinstallpromptevent, event, experimental, interface, reference the beforeinstallpromptevent is fired at the window.onbeforeinstallprompt handler before a user is prompte...
...over, pointer, pointerover the pointerover event is fired when a pointing device is moved into an element's hit test boundaries. 1007 document: pointerup event api, document, event, pointerevent, reference, web, onpointerup, pointerup the pointerup event is fired when a pointer is no longer active. 1008 document: readystatechange event event, reference, xmlhttprequest, interactive the readystatechange event is fired when the readystate attribute of a document has changed. 1009 document: scroll event api, dom, document, event, reference, scroll, uievent the scroll event fires when the document view or an element has been scrolled. 1010 document: selectionchange event reference, selection, selection api, events...
...nt.getattributenodens() api, dom, method, reference returns the attr node for the attribute with the given namespace and name. ...
...And 112 more matches
The Essentials of an Extension - Archive of obsolete content
e code for an extension resides in the chrome folder, just like in the hello world example. as we saw in the directory structure of the unpacked extension, the chrome is composed of 3 sections: content, locale and skin. the 3 are necessary for most extensions. if we open the chrome.manifest file (again, any text editor will do), we see that the same 3 sections are mentioned: content xulschoolhello content/ skin xulschoolhello classic/1.0 skin/ locale xulschoolhello en-us locale/ the chrome.manifest file tells firefox where to look for chrome files. the text is spaced to look like a table, but that is not necessary. the parser ignores repeated spaces. the first word in a line tells firefox what it is that is being declared (content, skin, locale, or oth...
...ded in the entries of a chrome.manifest file. they are documented in the chrome registration page. notably, we can have entries that are os-specific. this is important because the appearance of the browser is very different for each operating system. if our extension needed to look differently on different systems, we could change the manifest file so that it looks like this: content xulschoolhello content/ skin xulschoolhello classic/1.0 skin/unix/ skin xulschoolhello classic/1.0 skin/mac/ os=darwin skin xulschoolhello classic/1.0 skin/win/ os=winnt locale xulschoolhello en-us locale/ this way we can have separate skins for windows, mac os x, and linux (plus other unix-like systems), each defined in a separate directory. since most other sys...
...guages, all of this without having to change your extension or your code. this gives firefox extensions a great deal of flexibility. chrome files are accessed through the chrome protocol. this is what a chrome uri looks like: chrome://packagename/section/path/to/file so, for instance, if i want to access the file browseroverlay.xul in the extension, the chrome uri would be chrome://xulschoolhello/content/browseroverlay.xul. if you have too many files in the content and you want to organize them in subdirectories, there's nothing you need to change in chrome.manifest, all you need is to add the right path after content in the uri. skin and locale files work in the same way, and you don't need to specify skin names or locale names. so, to access the dtd file in the hello world extensi...
...And 30 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
details we describe here, your toolbar may not be as easy to customize as the rest. the first thing you need to do is add your buttons to the toolbar palette. the toolbarpalette is a collection of all toolbar buttons and toolbar items in firefox, including those added by extensions. to add your buttons, all you need to do is overlay the palette in your main browser overlay. ...
...ette is a collection of all toolbar buttons and toolbar items in firefox, including those added by extensions. to add your buttons, all you need to do is overlay the palette in your main browser overlay. <overlay id="xulschoolhello-browser-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="xulschoolhello-hello-world-button" class="toolbarbutton-1 chromeclass-toolbar-additional" label="&xulschoolhello.helloworld.label;" tooltiptext="&xulschoolhello.helloworld.tooltip;" oncommand="xulschoolchrome.browseroverlay.dosomething(event);" /> <!-- more buttons here. --> </toolbarpalette> <!-- more overlay stuff. --> </overlay> one detail that is easy to overlook is the...
...ow element in your overlay, some weird errors will begin to happen. always set the label and tooltiptext attributes of a toolbarbutton. in the case of a toolbaritem element (discussed later), use the title attribute instead of label. tooltips are very important for users that want to know what a button does before clicking it. setting the image for a toolbar button is done with css: #xulschoolhello-hello-world-button { list-style-image: url("chrome://xulschoolhello/skin/hello-world.png"); } it's not really that simple to set the image for a toolbar button, because we need to consider the appearance of the button on different systems, and also consider the different button states, but we'll get into that further ahead. the css file with your toolbar styles needs to be included in th...
...And 16 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
ode; for example, mozilla does not support <layer> as i will discuss later. browsers, like internet explorer 4, that were built before the conception of w3c standards inherited many quirks. in this article, i will describe mozilla's quirks mode, which provides strong backwards html compatibility with internet explorer and other legacy browsers. i'll also cover nonstandard technologies, such as xmlhttprequest and rich text editing, that mozilla does support because no w3c equivalent existed at the time. they include: html 4.01, xhtml 1.0 and xhtml 1.1 cascade style sheets (css): css level 1, css level 2.1 and parts of css level 3 document object model (dom): dom level 1, dom level 2 and parts of dom level 3 mathematical markup language: mathml version 2.0 extensible markup language (x...
... removes all link information from the selection. --- usecss toggles the usage of css in the generated markup. boolean value for more information, visit rich-text editing in mozilla. xml differences mozilla has strong support for xml and xml-related technologies, such as xslt and web services. it also supports some non-standard internet explorer extensions, such as xmlhttprequest. how to handle xml as with standard html, mozilla supports the w3c xml dom specification, which allows you to manipulate almost any aspect of an xml document. differences between internet explorer's xml dom and mozilla are usually caused by internet explorer's nonstandard behaviors. probably the most common difference is how they handle white space text nodes. often when xml generates...
...rser.parsefromstring(xmlstring, "text/xml"); } else if (window.activexobject){ // internet explorer, create a new xml document using activex // and use loadxml as a dom parser. mydocument = new activexobject("microsoft.xmldom"); mydocument.async = false; mydocument.loadxml(xmlstring); } else { // not supported. } see using xml data islands in mozilla for an alternative approach. xmlhttprequest internet explorer allows you to send and retrieve xml files using msxml's xmlhttp class, which is instantiated through activex using new activexobject("msxml2.xmlhttp") or new activexobject("microsoft.xmlhttp"). since there is no standard method of doing this, mozilla provides the same functionality in the global javascript xmlhttprequest object. since version 7 ie also supports the "n...
...And 16 more matches
Getting Started - Developer guides
it can send and receive information in various formats, including json, xml, html, and text files. ajax’s most appealing characteristic is its "asynchronous" nature, which means it can communicate with the server, exchange data, and update the page without having to refresh the page. ...
...the page without having to refresh the page. the two major features of ajax allow you to do the following: make requests to the server without reloading the page receive and work with data from the server step 1 – how to make an http request in order to make an http request to the server with javascript, you need an instance of an object with the necessary functionality. ...
...owing: make requests to the server without reloading the page receive and work with data from the server step 1 – how to make an http request in order to make an http request to the server with javascript, you need an instance of an object with the necessary functionality. this is where xmlhttprequest comes in. its predecessor originated in internet explorer as an activex object called xmlhttp. ...
...And 14 more matches
Index
Mozilla › Tech › XPCOM › Index
o determine the orientation of the device. 511 nsidomparser to create a domparser object from a web page or a chrome script running in a window, simply use new domparser(). when you create a domparser from a privileged script, you can pass parameters to the constructor, more on that below. 512 nsidomprogressevent interfaces, interfaces:scriptable, reference, xmlhttprequest, xpcom interface reference, nsidomprogressevent, progress the nsidomprogressevent is used in the media elements (<video> and <audio>) to inform interested code of the progress of the media download. this implementation is a placeholder until the specification is complete, and is compatible with the webkit progressevent. 513 nsidomserializer dom, interfaces, interfac...
... 591 nsiexception interfaces, interfaces:scriptable, reference, xpcom, xpcom interface reference a generic formatter - make it suitable to print, etc. 592 nsiextensionmanager disambiguation, needscontent, needshelp, xpcom, xpcom interface reference unfortunately, at the time of this writing there are two nsiextensionmanager interfaces: 593 nsiexternalhelperappservice interfaces, mime implemented by: @mozilla.org/uriloader/external-helper-app-service;1. to access this service, use: 594 nsiexternalprotocolservice interfaces, interfaces:scriptable, xpcom, xpcom api reference, xpcom interface reference you can ask the external protocol service if it has an external handler for a given protocol scheme. and you can ask ...
...iloader/external-helper-app-service;1. to access this service, use: 594 nsiexternalprotocolservice interfaces, interfaces:scriptable, xpcom, xpcom api reference, xpcom interface reference you can ask the external protocol service if it has an external handler for a given protocol scheme. and you can ask it to load the url using the default handler. 595 nsiexternalurlhandlerservice interfaces, interfaces:scriptable given a url, looks up the handler info from the operating system. this should be overridden by each operating systems implementation. 596 nsiftpchannel channels, interfaces, interfaces:scriptable, xpcom interface reference the nsiftpchannel is an extension of nsisupports used to determine if a channel is an ftp channel,...
...And 12 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
Web › HTTP › CORS
onal http headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. a web application executes a cross-origin http request when it requests a resource that has a different origin (domain, protocol, or port) from its own. an example of a cross-origin request: the front-end javascript code served from https://domain-a.com uses xmlhttprequest to make a request for https://domain-b.com/data.json. for security reasons, browsers restrict cross-origin http requests initiated from scripts. for example, xmlhttprequest and the fetch api follow the same-origin policy. this means that a web application using those apis can only request resources from the same origin the application was loaded from unless the response from other orig...
...the fetch api follow the same-origin policy. this means that a web application using those apis can only request resources from the same origin the application was loaded from unless the response from other origins includes the right cors headers. the cors mechanism supports secure cross-origin requests and data transfers between browsers and servers. modern browsers use cors in apis such as xmlhttprequest or fetch to mitigate the risks of cross-origin http requests. who should read this article? everyone, really. more specifically, this article is for web administrators, server developers, and front-end developers. modern browsers handle the client side of cross-origin sharing, including headers and policy enforcement. but the cors standard means servers have to handle new request and...
...including headers and policy enforcement. but the cors standard means servers have to handle new request and response headers. another article for server developers discussing cross-origin sharing from a server perspective (with php code snippets) is supplementary reading. what requests use cors? this cross-origin sharing standard can enable cross-site http requests for: invocations of the xmlhttprequest or fetch apis, as discussed above. web fonts (for cross-domain font usage in @font-face within css), so that servers can deploy truetype fonts that can only be cross-site loaded and used by web sites that are permitted to do so. webgl textures. images/video frames drawn to a canvas using drawimage(). css shapes from images. this article is a general discussion of cross-origin reso...
...And 11 more matches
Adding menus and submenus - Archive of obsolete content
use it is treated like another toolbar on systems other than mac os x. mac os x treats menus in a very different way than other systems. if your extension involves menus in any way, you should test it on mac os x to make sure everything works adequately. ...
...on systems other than mac os x. mac os x treats menus in a very different way than other systems. if your extension involves menus in any way, you should test it on mac os x to make sure everything works adequately. ...
...os x treats menus in a very different way than other systems. if your extension involves menus in any way, you should test it on mac os x to make sure everything works adequately. ...
...And 10 more matches
nsIExternalProtocolService
uriloader/exthandler/nsiexternalprotocolservice.idlscriptable the external protocol service is used for finding and launching web handlers (a la registerprotocolhandler in the html5 draft) or platform-specific applications for handling particular protocols. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) you can ask the external protocol service if it has an external handler for a given protocol scheme. and you can ask it to load the url using the default handler. ...
...ndlers (a la registerprotocolhandler in the html5 draft) or platform-specific applications for handling particular protocols. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) you can ask the external protocol service if it has an external handler for a given protocol scheme. and you can ask it to load the url using the default handler. ...
...erits from: nsisupports last changed in gecko 1.9 (firefox 3) you can ask the external protocol service if it has an external handler for a given protocol scheme. and you can ask it to load the url using the default handler. ...
...And 10 more matches
Appendix D: Loading Scripts - Archive of obsolete content
mlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript;version=1.8" src="overlay.js"/> </overlay> evalinsandbox the components.utils.evalinsandbox method may be used to load arbitrary code into components.utils.sandbox objects. javascript files or urls may be loaded in this manner by first retrieving their contents into memory using an xmlhttprequest. this is the method used by jetpack's securable module system to load nearly all executable code. advantages namespacing: since scripts executed via evalinsandbox run in a defined namespace, global namespace contamination and the resultant extension compatibility issues are not usually a problem. flexibility: the evalinsandbox method accepts several parameters, including the url, l...
...rformance: there are several significant performance disadvantages inherent in this method: there is currently no way to load code into sandboxes from a cache. this means that code must be compiled and executed anew each time it is loaded, which has a significant overhead for large code bases. in addition to compile time, reading files synchronously from disk has its own overhead, and xmlhttprequests have significantly more overhead than native loading methods. although wary authors can choose to cache instances of their modules so that modules are loaded only once globally, this method can be easily misused to re-load scripts for each new window where they would be better loaded only once globally per session. because sandbox objects are evaluated in their own javascript com...
...ed from a local file in the same directory as the current script. the script will execute in the same security context as the current script and will have access to the same globals, but any new globals it creates will be accessible only to the script itself. objects passed out of the sandbox will not be wrapped in xpcnativewrappers but will still be wrapped in inter-compartment proxies. ...
...And 9 more matches
Synchronous and asynchronous requests - Web APIs
xmlhttprequest supports both synchronous and asynchronous communications. in general, however, asynchronous requests should be preferred to synchronous requests for performance reasons. synchronous requests block the execution of code which causes "freezing" on the screen and an unresponsive user experience. asynchronous request if you use an asynchronous xmlhttprequest, you receive a callback when the data has been received. this lets the browser continue to work as normal while your request is being handled. example: send a file to the console log this is the simplest usage of asynchronous xmlhttprequest. ...
...hich causes "freezing" on the screen and an unresponsive user experience. asynchronous request if you use an asynchronous xmlhttprequest, you receive a callback when the data has been received. this lets the browser continue to work as normal while your request is being handled. example: send a file to the console log this is the simplest usage of asynchronous xmlhttprequest. ...
... 4; if it is, and the http status is 200, the handler dumps the received content. if an error occurred, an error message is displayed. line 15 actually initiates the request. the callback routine is called whenever the state of the request changes. example: writing a function to read an external file in some cases, you must read many external files. ...
...And 9 more matches
Rich-Text Editing in Mozilla - Developer guides
this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- background -</option> <option value="red">red</option> <option value="green">green</option> <option value="black">black</option> </select> </div> <div id="toolbar2"> <img class="intlink" title="clean" onclick="if(validatemode()&&confirm('are you sure?')){odoc.innerhtml=sdeftxt};" src="data:image/gif;base64,r0lgodlhfgawaiqbad04ktrlyzfrjlldzl9vj1dusy14wyodhpwibbsvfy6o7ioxw5qbms+wubcztca0ccs4kddqjdtltmrl1o3yitha7opcsd/f4pfvrvdv8pv5xv///////////////////yh5baekab8alaaaaaawabyaaav84ceozgmeakqubmteyzk547qobcfwtm/jgshq4rhmloxfiehqqsawr+z4iayaj0kegtfolizlwre4ocqwrxototaihmcz0tvgmbqkzhayyfewev14eq8iflhnehmfdqkaiskqci2pdc4qbg+oajc0ewadncogo6anqkkoiqa7" /> <img class="intlink" title="print" onclick="printdoc();" src="d...
...aaabyaaaawcayaaadetgw7aaaabgdbtueaalgpc/xhbqaaaazis0deap8a/wd/ol2nkwaaaalwsflzaaalewaacxmbajqcgaaaaad0su1fb9oebxczfmgboiwaaaaidevydenvbw1lbnqa9sywvwaaaufjrefuomvtlutsjfeux//n3nn0ydpbh1abrpt4lfqtqkc3jrkkneisiiribbehjjpklivo4m1rrmkkjqirmjruqudkpt71qpipirkpaqdf55tv5vvuszjqtjolseukd3xu/3dpzusc/22wtu2wrn+jg5so/ocdh8ycmjdflehmlkjkvk7kuyn+ufza/rtth76zavocdptrxzqtni3mrwupc+6cktlxz/sddp2uu9uxlmyxz6qm8v4tz8lhf1h+zdqxt7s8olmxtbf4e8qafhjj3kbp2mzkkthpitjp9vh6ihia+whtasx5brpwuemgdondf/2a4m7ukds1jw662+xkqtkeuoqjktojm2h53yfl15psj04zc94wdtibr26fxlc2mzrvbccebz2kirfd414tkmlezbvgt33+qcohgha81swysew0r1uzfnylmtpx80pngqq91lwvk2jgvgnfvzg6ycyrat16gftw5kkkfo1eqltfh5q2ett0biwf+aitq4fdbk+imyo1oxvgf03wafjqvbckvdffryetxqiffygazths0zwagd7fg5tnnyntp8/fzvgwjofmgg7gox0sakkgqgdmgkbi0njgmeimpgdk5+wacewed0ywblhguz4hw5oduekrblt7...
...ncee4euyv4pwcpswypw0uhdybkswu1nyjendreqtkjwn2+zvttc1vmstb/mvev/weyslasslimcohobjxw+n3ap/sjefnl5gepzmpu4kg7opr1+tofpyuu3becwykcwqcdfmwfkauo90fhkdinbcamvqnymgqueagqwcohbdc1rjv9pild8ibvkz6qyviibqgtjpx4k0xpigezorn1da0cij4vfr0ta3wvbxh/rjdcufv6r2zpgph/e4pxsbcpeatqprjniso203/5s/za171mv8+w1loaaaaaelftksuqmcc"> <img class="intlink" title="undo" onclick="formatdoc('undo');" src="data:image/gif;base64,r0lgodlhfgawaomkadljwlie33morpgjuykl8aezxqpd+7/i19dv3nha7p///////////////////////yh5baekaa8alaaaaaawabyaaarr8mljq7046807tkayejjbnes4eeujvigapwyac0csocq7sdlwjkakca6tomywiargqf3mrqviejkksvlibsfewhdrih4fh/dzmice3/c4nbqbads=" /> <img class="intlink" title="redo" onclick="formatdoc('redo');" src="data:image/gif;base64,r0lgodlhfgawamihab1chdljwl9vj1ie34kl8apd+7/i1////yh5baekaacalaaaaaawabyaaankelrc/jdksesyphi7s...
...And 9 more matches
Making content editable - Developer guides
this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- background -</option> <option value="red">red</option> <option value="green">green</option> <option value="black">black</option> </select> </div> <div id="toolbar2"> <img class="intlink" title="clean" onclick="if(validatemode()&&confirm('are you sure?')){odoc.innerhtml=sdeftxt};" src="data:image/gif;base64,r0lgodlhfgawaiqbad04ktrlyzfrjlldzl9vj1dusy14wyodhpwibbsvfy6o7ioxw5qbms+wubcztca0ccs4kddqjdtltmrl1o3yitha7opcsd/f4pfvrvdv8pv5xv///////////////////yh5baekab8alaaaaaawabyaaav84ceozgmeakqubmteyzk547qobcfwtm/jgshq4rhmloxfiehqqsawr+z4iayaj0kegtfolizlwre4ocqwrxototaihmcz0tvgmbqkzhayyfewev14eq8iflhnehmfdqkaiskqci2pdc4qbg+oajc0ewadncogo6anqkkoiqa7" /> <img class="intlink" title="print" onclick="printdoc();" src="d...
...aaabyaaaawcayaaadetgw7aaaabgdbtueaalgpc/xhbqaaaazis0deap8a/wd/ol2nkwaaaalwsflzaaalewaacxmbajqcgaaaaad0su1fb9oebxczfmgboiwaaaaidevydenvbw1lbnqa9sywvwaaaufjrefuomvtlutsjfeux//n3nn0ydpbh1abrpt4lfqtqkc3jrkkneisiiribbehjjpklivo4m1rrmkkjqirmjruqudkpt71qpipirkpaqdf55tv5vvuszjqtjolseukd3xu/3dpzusc/22wtu2wrn+jg5so/ocdh8ycmjdflehmlkjkvk7kuyn+ufza/rtth76zavocdptrxzqtni3mrwupc+6cktlxz/sddp2uu9uxlmyxz6qm8v4tz8lhf1h+zdqxt7s8olmxtbf4e8qafhjj3kbp2mzkkthpitjp9vh6ihia+whtasx5brpwuemgdondf/2a4m7ukds1jw662+xkqtkeuoqjktojm2h53yfl15psj04zc94wdtibr26fxlc2mzrvbccebz2kirfd414tkmlezbvgt33+qcohgha81swysew0r1uzfnylmtpx80pngqq91lwvk2jgvgnfvzg6ycyrat16gftw5kkkfo1eqltfh5q2ett0biwf+aitq4fdbk+imyo1oxvgf03wafjqvbckvdffryetxqiffygazths0zwagd7fg5tnnyntp8/fzvgwjofmgg7gox0sakkgqgdmgkbi0njgmeimpgdk5+wacewed0ywblhguz4hw5oduekrblt7...
...ncee4euyv4pwcpswypw0uhdybkswu1nyjendreqtkjwn2+zvttc1vmstb/mvev/weyslasslimcohobjxw+n3ap/sjefnl5gepzmpu4kg7opr1+tofpyuu3becwykcwqcdfmwfkauo90fhkdinbcamvqnymgqueagqwcohbdc1rjv9pild8ibvkz6qyviibqgtjpx4k0xpigezorn1da0cij4vfr0ta3wvbxh/rjdcufv6r2zpgph/e4pxsbcpeatqprjniso203/5s/za171mv8+w1loaaaaaelftksuqmcc"> <img class="intlink" title="undo" onclick="formatdoc('undo');" src="data:image/gif;base64,r0lgodlhfgawaomkadljwlie33morpgjuykl8aezxqpd+7/i19dv3nha7p///////////////////////yh5baekaa8alaaaaaawabyaaarr8mljq7046807tkayejjbnes4eeujvigapwyac0csocq7sdlwjkakca6tomywiargqf3mrqviejkksvlibsfewhdrih4fh/dzmice3/c4nbqbads=" /> <img class="intlink" title="redo" onclick="formatdoc('redo');" src="data:image/gif;base64,r0lgodlhfgawamihab1chdljwl9vj1ie34kl8apd+7/i1////yh5baekaacalaaaaaawabyaaankelrc/jdksesyphi7s...
...And 9 more matches
HTMLAnchorElement - Web APIs
element.accesskey is a domstring representing a single character that switches input focus to the hyperlink. htmlanchorelement.download is a domstring indicating that the linked resource is intended to be downloaded rather than displayed in the browser. the value represent the proposed name of the file. if the name is not a valid filename of the underlying os, browser...
.... element.accesskey is a domstring representing a single character that switches input focus to the hyperlink. htmlanchorelement.download is a domstring indicating that the linked resource is intended to be downloaded rather than displayed in the browser. the value represent the proposed name of the file. if the name is not a valid filename of the underlying os, browser will adapt it. ...
...ring indicating that the linked resource is intended to be downloaded rather than displayed in the browser. the value represent the proposed name of the file. if the name is not a valid filename of the underlying os, browser will adapt it. htmlhyperlinkelementutils.hash is a usvstring representing the fragment identifier, including the leading hash mark ('#'), if any, in the referenced url. htmlhyperlinkelementutils.host is a usvstring representing the hostname and port (if it's not the default port) in the referenced url. ...
...And 8 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
ile access for files internal to your bundle for an extractionless extension, access to files internal to your bundle will not be possible using the nsifile interface. if you need to read data, or otherwise access files within your bundle, there are two options. the first is to use the nsizipreader interface which permits continuing to use nsiinputstreams, etc. the second is to re-code to use xmlhttprequest. a file:// uri to the install location, or .xpi file, is available in installpath property of the bootstrap data structure passed to the startup(), shutdown(), install(), and uninstall() functions in what will be your bootstrap.js file (see below). how to get and load the data of of your add-on's files using the add-on manager api: // this is the old way of getting one of your files ...
..."@mozilla.org/libjar/zip-reader;1"] .createinstance(components.interfaces.nsizipreader); zipreader.open(addondata.installpath); ... from there you can open nsiinputstreams, extract files, or perform some other functions. worst case would be that you extract a file to a temporary location and then use nsifile operations upon the extracted file. ...
...der.open(addondata.installpath); ... from there you can open nsiinputstreams, extract files, or perform some other functions. worst case would be that you extract a file to a temporary location and then use nsifile operations upon the extracted file. step 3b: option 2: use xmlhttprequest now, how do we replace that? the answer to that question is to load your file from a chrome:// uri using xmlhttprequest. you may now have another question: wait, what does this have to do with xml or http? the answer to that question is, of course, nothing. xmlhttprequest is an api created by microsoft, adopted by mozilla and other vendors, and hacked into a swiss army knife of file loading. you can use it in a web page to fetch a file from your server and you can use it in your add-on to fetch a local f...
...And 7 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
ides two implementation examples using the model. the first one looks like a traditional dhtml ticker application and uses hidden iframes and javascript to provide updates inside the webpage's ticker headlines section. this sample was made using iframes to illustrate a possible implementation. an implementation can also use other transport technologies such as soap-based remote procedure calls, xmlhttprequest interfaces, or dom 3 load. the second example shows a tabbed menu that dynamically loads news headlines into the current web page. this implementation uses xmlhttprequest. extending traditional hypertext navigation the hypertext approach to developing web pages, in which developers format text layouts into pages and link those pages to related content, is analogous to a book or a magazi...
... information access. if the user clicks on a link item, the script will be responsible to load the information from the data source and to apply that into the current document. there are basically two steps in this process: data load: acquisition of information data acquisition can be implemented using javascript and remote procedure calls using soap-based rpc mechanism or using interfaces like xmlhttprequest (currently offered in netscape 7 and internet explorer 6). data bind: mutation in the current document this step takes care of applying the changes into the current document, based on the data loaded, and uses dom interfaces. the mechanism can be as simple as copying new content to the current document, or as complex as performing dynamic transformations on the data source before applyi...
...plication. additionally, the javascript code could be modified to periodically reload the tickerdata.html. what is important is that new information can be dynamically loaded into the main web page's context. though the inner-browsing model is mostly appropriate for web applications, it also can be used to improve accessibility to information in traditional web pages. example using javascript's xmlhttprequest and dom interfaces: tabbed menu for headlines this example demonstrates an implementation using xmlhttprequest interfaces. both netscape 7 and recent versions of internet explorer provide xmlhttprequest interfaces that allow javascript to dynamically load an xml document given a data source url. in this case, the content that is updated on the page is a set of headlines for devedge arti...
...And 7 more matches
Sending forms through JavaScript - Learn web development
this article explores such approaches. a form is not always a form with progressive web apps, single page apps, and framework based apps, it's common to use html forms to send data without loading a new document when response data is received. let's first talk about why this requires a different approach. ...
... html forms to collect input from the user, and not for data submission. when the user tries to send the data, the application takes control and transmits the data asynchronously in the background, updating only the parts of the ui that require changes. sending arbitrary data asynchronously is generally called ajax, which stands for "asynchronous javascript and xml". how is it different? the xmlhttprequest (xhr) dom object can build http requests, send them, and retrieve their results. historically, xmlhttprequest was designed to fetch and send xml as an exchange format, which has since been superceded by json. but neither xml nor json fit into form data request encoding. form data (application/x-www-form-urlencoded) is made of url-encoded lists of key/value pairs. for transmitting binary...
... browser) and the back-end (the code which is executed on the server), you can send json/xml and process them however you want. but if you want to use a third party service, you need to send the data in the format the services require. so how should we send such data? the different techniques you'll require are done below. sending form data there are 3 ways to send form data: building an xmlhttprequest manually. using a standalone formdata object. using formdata bound to a <form> element. let's look at them in detail. building an xmlhttprequest manually xmlhttprequest is the safest and most reliable way to make http requests. to send form data with xmlhttprequest, prepare the data by url-encoding it, and obey the specifics of form data requests. let's look at an example: <butt...
...And 7 more matches
nsIWebContentHandlerRegistrar
embeddor.implemented/web-content-handler-registrar;1 as a service: var nsiwchr = cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"] .getservice(ci.nsiwebcontenthandlerregistrar); method overview void registercontenthandler(in domstring mimetype, in domstring uri, in domstring title, in nsidomwindow contentwindow) void registerprotocolhandler(in domstring protocol,in domstring uri, in domstring title, in nsidomwindow contentwindow) methods registercontenthandler summary of registercontenthandler void registercontenthandler( in domstring mimetype, in domstring uri, in domstring title, in nsidomwindow contentwindow ); parameters mimetype...
...er void registercontenthandler( in domstring mimetype, in domstring uri, in domstring title, in nsidomwindow contentwindow ); parameters mimetype the desired mime type as a string uri the uri to the handler as a string. title the title of the handler presented to the user as a string. contentwindow the dom content window from which the method has been called. registerprotocolhandler summary of registerprotocolhandler void registerprotocolhandler( in domstring protocol, in domstring uri, in domstring title, in nsidomwindow contentwindow ); parameters protocol the protocol the site wishes to handle, specified as a string. uri the uri to the handler as a string. you must include "%s" to indicate where to insert the escaped uri of the document to be handl...
...if it ...
...And 7 more matches
Sending and Receiving Binary Data - Web APIs
receiving binary data using javascript typed arrays the responsetype property of the xmlhttprequest object can be set to change the expected response type from the server. possible values are the empty string (default), "arraybuffer", "blob", "document", "json", and "text". the response property will contain the entity body according to responsetype, as an arraybuffer, blob, document, json, or string. this is null if the request is not complete or was not successful. this example reads an image as a binary file and creates an 8-bit unsigned integer array from the raw bytes. note that this will not decode the image and read the pixels. you will need a png decoding library for that. ...
... the entity body according to responsetype, as an arraybuffer, blob, document, json, or string. this is null if the request is not complete or was not successful. this example reads an image as a binary file and creates an 8-bit unsigned integer array from the raw bytes. note that this will not decode the image and read the pixels. you will need a png decoding library for that. ...
...t) { var arraybuffer = oreq.response; // note: not oreq.responsetext if (arraybuffer) { var bytearray = new uint8array(arraybuffer); for (var i = 0; i < bytearray.bytelength; i++) { // do something with each byte in the array } } }; oreq.send(null); you can also read a binary file as a blob by setting the string "blob" to the responsetype property. ...
...And 7 more matches
Proxy Auto-Configuration (PAC) file - HTTP
ile. the examples at the end of this document are complete. there is no additional syntax needed to save it into a file and use it. ...
...la.org") // false isplainhostname("www") // true dnsdomainis() syntax dnsdomainis(host, domain) parameters host is the hostname from the url. domain is the domain name to test the hostname against. description returns true if and only if the domain of hostname matches. ...
...me("www") // true dnsdomainis() syntax dnsdomainis(host, domain) parameters host is the hostname from the url. domain is the domain name to test the hostname against. description returns true if and only if the domain of hostname matches. ...
...And 7 more matches
Observer Notifications - Archive of obsolete content
which takes three parameters. the first parameter (subject) can be any xpcom object, the second parameter is a notification topic, and the final parameter is a string that further describes the notification. this example code shows you what an implementation of the nsiobserver interface looks like: let testobserver = { observe : function(asubject, atopic, adata) { if (atopic == "xulschoolhello-test-topic") { window.alert("data received: " + adata); } } } in order for this observer to work, you need to use the observer service that provides methods for you to add, remove, notify and enumerate observers. adding an observer to the observer service is simple, invoking the addobserver method with three parameters. the first parameter is an observer object, the second par...
...er is a notification topic, and the third parameter is a boolean which indicates whether the observer service should hold a weak reference to the observer. you should normally set the third parameter to false. let observerservice = components.classes["@mozilla.org/observer-service;1"]. ...
...the method takes three parameters. ...
...And 6 more matches
Index - Archive of obsolete content
onal functional helper methods. 91 lang/type functions for working with type detection. 92 loader/cuddlefish add-on sdk, cfx the sdk's module loader. 93 loader/sandbox create javascript sandboxes and execute scripts in them. 94 net/url no summary! 95 net/xhr provides access to xmlhttprequest functionality. 96 places/bookmarks create, modify, and retrieve bookmarks. 97 places/favicon helper functions for working with favicons. 98 places/history access the user's browsing history. 99 platform/xpcom implement xpcom objects, factories, and services. 100 preferences/event-target ...
...the code snippets on this page will let your site work until these new features are more widely available. 190 isdefaultnamespace no summary! 191 js xpcom code snippets, javascript, xpcom, about:, nsiaboutmodule no summary! 192 javascript debugger se...
...pdate their plugin to a newer version. 229 developing add-ons add-ons this page will help guide you to the information you need in order to create add-ons for firefox, thunderbird, or other software based on the mozilla platform, as well as how to distribute your add-ons. 230 displaying web content in an extension without security issues extensions, security, xmlhttprequest, xul one of the most common security issues with extensions is execution of remote code in privileged context. a typical example is an rss reader extension that would take the content of the rss feed (html code), format it nicely and insert into the extension window. the issue that is commonly overlooked here is that the rss feed could contain some malicious javascript code and it...
...And 6 more matches
Fetching data from the server - Learn web development
b apis next another very common task in modern websites and applications is retrieving individual data items from the server to update sections of a webpage without having to load an entire new page. this seemingly small detail has had a huge impact on the performance and behavior of sites, so in this article, we'll explain the concept and look at technologies that make it possible, such as xmlhttprequest and the fetch api. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn how to fetch data from the server and use it to update the contents of a web page. what is the problem here? originally page loading on the web was simple — you'd send a request for a website to ...
...tire page again. this is extremely wasteful and results in a poor user experience, especially as pages get larger and more complex. enter ajax this led to the creation of technologies that allow web pages to request small chunks of data (such as html, xml, json, or plain text) and display them only when needed, helping to solve the problem described above. ...
...chieved by using apis like xmlhttprequest or — more recently — the fetch api. these technologies allow web pages to directly handle making http requests for specific resources available on a server and formatting the resulting data as needed before it is displayed. note: in the early days, this general technique was known as asynchronous javascript and xml (ajax), because it tended to use xmlhttprequest to request xml data. this is normally not the case these days (you'd be more likely to use xmlhttprequest or fetch to request json), but the result is still the same, and the term "ajax" is still often used to describe the technique. the ajax model involves using a web api as a proxy to more intelligently request data rather than just having the browser reload the entire page. let's...
...And 6 more matches
Assert.jsm
let assert = new assert(reporterfunc); the new assert instance,...
... let assert = new assert(reporterfunc); the new assert instance, assert, uses reporterfunc to report assertion results...
... let assert = new assert(reporterfunc); the new assert instance, assert, uses reporterfunc to report assertion results or throws an assertionerror when an asserti...
...And 6 more matches
HTMLAreaElement - Web APIs
element.accesskey is a domstring containing a single character that switches input focus to the control. htmlareaelement.alt is a domstring that reflects the alt html attribute, containing alternative text for the element. htmlareaelement.coords is a domstring that reflects the coords html attribute, containing coordinates to define the hot-spot region. htmlareaeleme...
...oords is a domstring that reflects the coords html attribute, containing coordinates to define the hot-spot region. htmlareaelement.download is a domstring indicating that the linked resource is intended to be downloaded rather than displayed in the browser. the value represent the proposed name of the file. if the name is not a valid filename of the underlying os, browser will adapt it. ...
...mstring indicating that the linked resource is intended to be downloaded rather than displayed in the browser. the value represent the proposed name of the file. if the name is not a valid filename of the underlying os, browser will adapt it. htmlhyperlinkelementutils.hash is a usvstring containing the fragment identifier (including the leading hash mark (#)), if any, in the referenced url. htmlhyperlinkelementutils.host is a usvstring containing the hostname and port (if it's not the default port) in the referenced url. htmlhyperlinkelementutils.hostname is a usvstring containing the hostname in the referenced url. htmlhyperlinkelementutils.href is a usvstring containing that reflects the href html attribute, containing a valid url of a linked resource. htmlareaelement.hreflang is...
...And 6 more matches
Adding Events and Commands - Archive of obsolete content
ome.browseroverlay.init(); }, false); you can do something similar with the onunload event, to do any cleanup you may need. please read appendix a for recommendations on how to use the load event to initialize your add-on without having a negative performance impact on firefox. another way to attach event handlers, just like html, is to place the handler in the xul code: <overlay id="xulschoolhello-browser-overlay" onload="xulschoolchrome.browseroverlay.init();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> we prefer the first method because it keeps a better separation of content and behavior. also, note that the addeventlistener method receives the event name without the "on" prefix, while element attributes do have the prefix. there's a long list of eve...
...erred) one introduced in firefox 3.5. event handlers can take an event argument, which is an event object that holds information on the event. you can get information on key modifiers (in case the user was holding a modifier key like alt while performing the event), screen coordinates for mouse events, and most importantly, the target element for the event. for example: <button label="&xulschoolhello.defaultgreeting.label;" oncommand="xulschoolchrome.browseroverlay.changegreeting(event);" /> then on the javascript code you would have something like this: changegreeting : function(aevent) { // more stuff aevent.target.setattribute("label", somenewgreeting); } the target in this example is the button element, so clicking on it will change its text. the advantage of using the even...
...e user logs in or out of a service, or when firefox detects it's online or offline. it's common that you need to change several elements at the same time, and this can be difficult to manage through javascript. the broadcaster element can help you out in these cases. first you need to add a broadcaster element to your xul code, as a child of a broadcasterset element. <broadcasterset id="xulschoolhello-broadcasterset"> <broadcaster id="xulschoolhello-online-broadcaster" /> </broadcasterset> these elements are completely invisible, so you can put them anywhere. it is recommended that you have them at the top of the xul code, along with script declarations and other invisible elements with as popupset and commandset. then you need to identify which of your xul elements will be linked to ...
...And 5 more matches
Adding sidebars - Archive of obsolete content
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. ...
...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. ...
... 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="chrome://xulschoolhello/content/sidebar.xul" sidebartitle="&xulschoolhello.sidebar.title;" oncommand="togglesidebar('xulschoolhello-sidebar');" /> </menupopup> the example in the mdc page includes a shortcut key combination to toggle the new sidebar. keyboard shortcuts are an essential feature...
...And 5 more matches
Handling Preferences - Archive of obsolete content
is to hold non-code files your extension needs. in the past we have used this directory to store xslt files for xml transformations and local storage template files (more on this later). it's the best place to put miscellaneous files your extension needs. download this sample hello world using preferences. there are a couple of additions in the makefiles, to include the preference file xulschoolhello.js. the contents of the file are fairly simple: // amount of messages shown to the user. pref("extensions.xulschoolhello.message.count", 0); this defines a preference we'll use to keep track of the amount of times we have displayed a greeting message to the user. its default value is 0. you'll see this preference appear in about:config after installing the extension. just type "xulschoo...
...ference. name parts are normally separated by dots. now let's look at how we actually manage the preference values. managing preferences with xpcom we use the preferences service in order to get and set preference values: this._prefservice = cc["@mozilla.org/preferences-service;1"].getservice(ci.nsiprefbranch); // ... get count() { return this._prefservice.getintpref("extensions.xulschoolhello.message.count"); }, increment : function() { let currentcount = this._prefservice.getintpref("extensions.xulschoolhello.message.count"); this._prefservice.setintpref("extensions.xulschoolhello.message.count", currentcount + 1); } one important thing to keep in mind is that the "get" methods of the service can throw an exception if the preference is not found. if you are going to u...
...eference management, there are some facilities provided in xul and firefox that make this much easier to deal with. the standard way of opening a preferences window is to open the add-ons manager, select the add-on, and then click on the preferences button. in order to have this button enabled in your extension you need to add the following line to install.rdf: <em:optionsurl>chrome://xulschoolhello/content/preferenceswindow.xul</em:optionsurl> if you want to open this window from a different place in the ui, such as a menu item or a button in a toolbar, you need to take into account that the opening behavior of a preferences window is different depending on the operating system. this is how we do it: openpreferences : function() { if (null == this._preferenceswindow || this._pre...
...And 5 more matches
No Proxy For configuration - Archive of obsolete content
a the proxy server. due to various limitations, this feature should be used for only the most simple blacklist scenarios. in almost all cases, pac gives better control and flexibility. user interface "no proxy for" is an optional field, part of "manual proxy configuration". the field is relatively short, but can hold reasonably long (2k+ characters) entries. new profiles contain the values "localhost, 127.0.0.1", by default. entry points: preferences | advanced | proxies control-click menu for off line-online icon (network plug) configuration the no proxy list is composed of either domain elements or ipv4 address elements. the elements are separated by either a space (" ") or a comma (","). note for former-ie users: "*" is supported only at the beginning of domain filters (*.moz...
...xy for" ...for example use... ...
... domain suffix "mozilla.org" does not block domains that end in the same string (amozilla.org) sub-domains domain suffix, starting with a dot ".mozilla.org" does not block the main domain (mozilla.org) a hostname (without domain) hostname-only (see problems below) "localhost" also blocks any possible domains that start with the entry ("www.otherdomain.localhost") a hostname (with domain) domain name "www.mozilla.org" does not block hostnames or domains that end in the same string (other-www.mozilla.org) an ip address ip address "1.2.3.4" does not block hostnames that resolve to the ip address ("127.0.0.1" does not block "localhost") a network network w/ cidr block "10.0.0.0/8" does not block hostn...
...And 5 more matches
Hash Tables
this chapter describes the hash table functions in the plds (portable library — data structures) library of nspr. the hash table library functions are declared in the header file plhash.h. warning: the nspr hash table library functions are not thread safe. a hash table lookup may change the internal organization of the hash table (to speed up future lookups). ...
...portable library — data structures) library of nspr. the hash table library functions are declared in the header file plhash.h. warning: the nspr hash table library functions are not thread safe. a hash table lookup may change the internal organization of the hash table (to speed up future lookups). ...
...ary — data structures) library of nspr. the hash table library functions are declared in the header file plhash.h. warning: the nspr hash table library functions are not thread safe. a hash table lookup may change the internal organization of the hash table (to speed up future lookups). ...
...And 5 more matches
How Mozilla determines MIME Types
g will be shown, showing the mime type corresponding to the extension of the file. also, for images loaded via <img src>, mozilla's image library will do content sniffing (never extension sniffing) to find out the real type of the image. if the server did not send a content-type header, mozilla uses the unknown decoder to find a mime type. file uris for file: uris, mozilla will ask the externalhelperappservice for a mime type. ftp like http uris without a mime type, ftp uris go through the unknown decoder. unknown decoder located at netwerk/streamconv/converters/nsunknowndecoder.cpp, the interesting part starts at line 287, the ssnifferentries array together with the determinecontenttype function. it does the following: checks the start of the file for "magic numbers"; this can cu...
... go through the unknown decoder. unknown decoder located at netwerk/streamconv/converters/nsunknowndecoder.cpp, the interesting part starts at line 287, the ssnifferentries array together with the determinecontenttype function. it does the following: checks the start of the file for "magic numbers"; this can currently detect pdf and postscript. if the file starts with <?xml, asks the externalhelperappservice for a mime type for the uri. this is done because the generic text/xml mime type does not work for xul files, and xhtml files get a different dom when interpreted as text/xml. the image library will be asked for the mime type given the content. this should allow reliable detection of all image types mozilla supports. checks whether the data is html by looking for some common html...
...uri. this is done because the generic text/xml mime type does not work for xul files, and xhtml files get a different dom when interpreted as text/xml. the image library will be asked for the mime type given the content. this should allow reliable detection of all image types mozilla supports. checks whether the data is html by looking for some common html tags. ...
...And 4 more matches
JS_NewGlobalObject
requires request. ...
...he jsclass_global_flags bits set. the caller must ensure that the jsclass remains alive throughout the lifetime of the new object, including the garbage collection cycle that finally frees it. the usual way to do this is to make jsclasses global or static. principals jsprincipals * the security information to associate with this compartment. hookoption js::onnewglobalhookoption see debugger api hook added in spidermonkey 31 options const js::compartmentoptions &amp; the option for new compartment (passed to jscompartment constructor). added in spidermonkey 31 description js_newglobalobject creates a new global object based on the specified class. the new object has no parent. it initially has no prototype either, since it is typically...
...lem for consumers that need to set slots on the global to put it in a consistent state. this api provides a way for consumers to set slots atomically (immediately after the global is created), before any debugger hooks are fired. it's unfortunately on the clunky side, but that's the way the cookie crumbles. if callers have no additional state on the global to set up, they may pass fireonnewglobalhook to js_newglobalobject, which causes that function to fire the hook as its final act before returning. otherwise, callers should pass dontfireonnewglobalhook, which means that they are responsible for invoking js_fireonnewglobalobject upon successfully creating the global. if an error occurs and the operation aborts, callers should skip firing the hook. but otherwise, callers must take care to ...
...And 4 more matches
XML Extras
e. not as just another document format. the module is structured as a drop-in component and exposes its xml-as-data features both to javascript and c++/xpcom users. the xml extras module is built by default on all platforms, and is included in the browser installers so it is available in the nightly builds. feature status feature status xmlserializer available xmlhttprequest available domparser (string and stream input source) available web services with soap and wsdl no longer available from gecko 1.9/firefox 3. xml persistence fixptr and xpointer available since 1.4alpha in the core mozilla. moved to xml extras during 1.4beta. see also: xml in mozilla document.load() a few examples dealing w...
... longer available from gecko 1.9/firefox 3. xml persistence fixptr and xpointer available since 1.4alpha in the core mozilla. moved to xml extras during 1.4beta. see also: xml in mozilla document.load() a few examples dealing with xml from mozillazine knowledge base. qa and testing there are some online tests for mainly exercising the http get method via xmlhttprequest. other test cases for each of the implemented components listed above exist in extensions/xmlextras/tests/. more exhaustive test suites need to be created, however. if you'd like to help out with qa, you can do one of the following: sign up as the qa owner for any of the implemented components. the qa owner will manage the tests associated with their component, act as qa contact for...
...s/xmlextras/tests/. file bugs against the implemented components. bugs should be filed against the xml component in the browser product. documentation probably the best way to learn how to use these technologies is through examples. there are some in extensions/xmlextras/tests/. if you follow that link to look at the examples you will need to look at page source for the html documents. for xmlhttprequest object you can mostly rely on the microsoft xmlhttprequest documentation, with some caveats: all functions and property names begin with a lower case letter and the object creation is different. some properties are not implemented. thad hoffman has written a document that shows how you can mimic xml data islands in mozilla. edmond woychowsky has also written articles on xml data island...
...And 4 more matches
Components.utils.importGlobalProperties
using this api you can import these objects into such a system scope. this function is not intended for sandboxes but for system-privileged scopes. to import these objects into a sandbox, use the wantglobalproperties option in the sandbox constructor. this function is passed an array of strings. each string is the name of an object to import, and will be defined on the importing scope's global. ...
... syntax void components.utils.importglobalproperties([string1, string2, ...]); parameters [string1, string2, ...] an array of strings. each string is the n...
... syntax void components.utils.importglobalproperties([string1, string2, ...]); parameters [string1, string2, ...] an array of strings. each string is the name of an object to i...
...And 4 more matches
nsIIOService
netwerk/base/public/nsiioservice.idlscriptable this interface provides a set of url parsing utility functions. these are provided as a convenience to the programmer and in some cases to improve performance by eliminating intermediate data structures and interfaces. inherits from: nsisupports last changed in gecko 1.2 this interface duplicates many of the nsiprotocolhandler methods in a protocol handler independent way (for example newuri() inspects the scheme in order to delegate creation of the new uri to the appropriate protocol handler). note: nsiioservice may only be used from the main thread. implemented by @mozilla.org/network/io-service;1 as a service: var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.int...
...lla.org/network/io-service;1 as a service: var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); method overview boolean allowport(in long aport, in string ascheme); acstring extractscheme(in autf8string urlstring); unsigned long getprotocolflags(in string ascheme); nsiprotocolhandler getprotocolhandler(in string ascheme); nsichannel newchannel(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); obsolete since gecko 48 nsichannel newchannel2(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri, in nsidomnode aloadingnode, in nsiprincipal aloadingprincipal, in nsiprincipal atriggeringprincipal, in uint32_t asecurityflags, i...
..., corresponding to network services that may be easily exploitable. if the given port is considered unsafe, then the protocol handler (corresponding to ascheme) will be asked whether it wishes to override the io service's decision to block the port. this gives the protocol handler ultimate control over its own security policy while ensuring reasonable, default protection. is similar to nsiprotocolhandler.allowport(). boolean allowport( in long aport, in string ascheme ); parameters aport the port to check ascheme the scheme for the protocol handler that could override the ioservice's decision. return value true if the port is allowed, false otherwise. extractscheme() utility to extract the scheme from a url string, consistently and according to spec (see rfc 3986). note: ...
...And 4 more matches
Using FormData Objects - Web APIs
it is primarily intended for use in sending form data, but can be used independently from forms in order to transmit keyed data. the transmitted data is in the same format that the form's submit() method would use to send the data if the form's encoding type were set to multipart/form-data. ...
...ntnum", 123456); // number 123456 is immediately converted to a string "123456" // html file input, chosen by user formdata.append("userfile", fileinputelement.files[0]); // javascript file-like object var content = '<a id="a"><b id="b">hey!</b></a>'; // the body of the new file... var blob = new blob([content], { type: "text/xml"}); formdata.append("webmasterfile", blob); var request = new xmlhttprequest(); request.open("post", "http://foo.com/submitform.php"); request.send(formdata); note: the fields "userfile" and "webmasterfile" both contain a file. the number assigned to the field "accountnum" is immediately converted into a string by the formdata.append() method (the field's value can be a blob, file, or a string: if the value is neither a blob nor a file, the value is converted ...
...the number assigned to the field "accountnum" is immediately converted into a string by the formdata.append() method (the field's value can be a blob, file, or a string: if the value is neither a blob nor a file, the value is converted to a string). this example builds a formdata instance containing values for fields named "username", "accountnum", "userfile" and "webmasterfile", then uses the xmlhttprequest method send() to send the form's data. the field "webmasterfile" is a blob. a blob object represents a file-like object of immutable, raw data. blobs represent data that isn't necessarily in a javascript-native format. the file interface is based on blob, inheriting blob functionality and expanding it to support files on the user's system. in order to build a blob you can invoke the blo...
...And 4 more matches
Event reference
object sent to recipients of the event (so you can find information about what data is provided with each event) as well as a link to the specification or specifications that define the event. event name event type specification fired when... abort uievent dom l3 the loading of a resource has been aborted. abort progressevent progress and xmlhttprequest progression has been terminated (not due to an error). abort event indexeddb a transaction has been aborted. afterprint event html5 the associated document has started printing or the print preview has been closed. animationcancel animationevent css animations a css animation has aborted. animationend animationevent ...
... ended event html5 media playback has stopped because the end of the media was reached. ended event web audio api playback has stopped because the end of the media was reached. endevent timeevent svg a smil animation element ends. error uievent dom l3 a resource failed to load. error progressevent progress and xmlhttprequest progression has failed. error event websocket a websocket connection has been closed with prejudice (some data couldn't be sent for example). error event server sent events an event source connection has been failed. error event indexeddb a request caused an error and failed. error event web speech api a speech...
... languagechange event html 5.1the definition of 'navigatorlanguage.languages' in that specification. the user's preferred languages have changed. levelchange event battery status the level attribute has been updated. load uievent dom l3 a resource and its dependent resources have finished loading. load progressevent progress and xmlhttprequest progression has been successful. loadeddata event html5 media the first frame of the media has finished loading. loadedmetadata event html5 media the metadata has been loaded. loadend progressevent progress and xmlhttprequest progress has stopped (after "error", "abort", or "load" have been dispatched). loadstart progr...
...And 4 more matches
Basic Example - XSLT: Extensible Stylesheet Language Transformations
the .xsl file is then imported (xsltprocessor.importstylesheet(xslstylesheet)) and the transformation run (xsltprocessor.transformtofragment(xmldoc, document)). this allows fetching of data after the page has been loaded, without initiating a fresh page load. figure 6 : example var xslstylesheet; var xsltprocessor ...
...xsltprocessor.importstylesheet(xslstylesheet)) and the transformation run (xsltprocessor.transformtofragment(xmldoc, document)). this allows fetching of data after the page has been loaded, without initiating a fresh page load. ...
...tylesheet(xslstylesheet)) and the transformation run (xsltprocessor.transformtofragment(xmldoc, document)). this allows fetching of data after the page has been loaded, without initiating a fresh page load. ...
...And 4 more matches
Adding windows and dialogs - Archive of obsolete content
if this value is null or empty, the default toolbars of the main window will be added to the new one, which is rarely what you want. ...
...if this value is null or empty, the default toolbars of the main window will be added to the new one, which is rarely what you want. ...
...rce, such as lists or trees that may need resizing to have a better view of the content. to open a new dialog, use the function window.opendialog, an extension of the open function. it allows you to send a set of optional parameters that can be used to communicate with the dialog. let somevalue = 2; let returnvalue = { accepted : false , result : "" }; window.opendialog( "chrome://xulschoolhello/content/somedialog.xul", "xulschoolhello-some-dialog", "chrome,centerscreen", somevalue, returnvalue); // you can send as many extra parameters as you need. // if (returnvalue.accepted) { do stuff } the optional parameters are available in the dialog code through the window.arguments property: let somevalue = window.arguments[0]; let returnvalue = window.arguments[1]; // returnval...
...And 3 more matches
Connecting to Remote Content - Archive of obsolete content
« previousnext » using xmlhttprequest xmlhttprequest is an api for transferring xml between a local script and a remote server via http. it is an integral part of the modern web, and all major browsers support it. besides xml, it can be used to retrieve data in other formats, for example json, html and plain text. in this section we'll look into the xml and json communication mechanisms. ...
...een a local script and a remote server via http. it is an integral part of the modern web, and all major browsers support it. besides xml, it can be used to retrieve data in other formats, for example json, html and plain text. in this section we'll look into the xml and json communication mechanisms. ...
... the modern web, and all major browsers support it. besides xml, it can be used to retrieve data in other formats, for example json, html and plain text. in this section we'll look into the xml and json communication mechanisms. ...
...And 3 more matches
User Notifications and Alerts - Archive of obsolete content
ns make the most sense when they are related to the page currently being displayed, such as a page trying to install an add-on, or a site you just entered a password on. ...
...ng to install an add-on, or a site you just entered a password on. ...
...re very easy to create, and are very customizable: let nb = gbrowser.getnotificationbox(); let acceptbutton = new object(); let declinebutton = new object(); let message = this._bundle.getstring("xulschoolhello.friendmessage.label"); let that = this; acceptbutton.label = this._bundle.getstring("xulschoolhello.acceptbutton.label"); acceptbutton.accesskey = this._bundle.getstring("xulschoolhello.acceptbutton.accesskey"); acceptbutton.popup = null; acceptbutton.callback = function() { that.acceptrequest(); }; // similarly for decline button. ...
...And 3 more matches
jspage - Archive of obsolete content
!=undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].tolowercase()},features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.queryselector)},plugins:{},engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getelementsbyclassname)?950:925)); },trident:function(){return(!window.activexobject)?false:((window.xmlhttprequest)?((document.queryselectorall)?6:5):4);},webkit:function(){return(navigator.taintenabled)?false:((browser.features.xpath)?((browser.features.query)?525:420):419); },gecko:function(){return(!document.getboxobjectfor&&window.mozinnerscreenx==null)?false:((document.getelementsbyclassname)?19:18);}}},browser||{});browser.platform[browser.platform.name]=true; browser.detect=function(){for(var...
...ozinnerscreenx==null)?false:((document.getelementsbyclassname)?19:18);}}},browser||{});browser.platform[browser.platform.name]=true; browser.detect=function(){for(var b in this.engines){var a=this.engines[b]();if(a){this.engine={name:b,version:a};this.engine[b]=this.engine[b+a]=true; break;}}return{name:b,version:a};};browser.detect();browser.request=function(){return $try(function(){return new xmlhttprequest();},function(){return new activexobject("msxml2.xmlhttp"); },function(){return new activexobject("microsoft.xmlhttp");});};browser.features.xhr=!!(browser.request());browser.plugins.flash=(function(){var a=($try(function(){return navigator.plugins["shockwave flash"].description; },function(){return new activexobject("shockwaveflash.shockwaveflash").getvariable("$version");})||"0 r0").ma...
...(@, @, @)";});(function(){element.implement({scrollto:function(h,i){if(b(this)){this.getwindow().scrollto(h,i); }else{this.scrollleft=h;this.scrolltop=i;}return this;},getsize:function(){if(b(this)){return this.getwindow().getsize();}return{x:this.offsetwidth,y:this.offsetheight}; },getscrollsize:function(){if(b(this)){return this.getwindow().getscrollsize();}return{x:this.scrollwidth,y:this.scrollheight};},getscroll:function(){if(b(this)){return this.getwindow().getscroll(); }return{x:this.scrollleft,y:this.scrolltop};},getscrolls:function(){var i=this,h={x:0,y:0};while(i&&!b(i)){h.x+=i.scrollleft;h.y+=i.scrolltop;i=i.parentnode; }return h;},getoffsetparent:function(){var h=this;if(b(h)){return null;}if(!browser.engine.trident){return h.offsetparent;}while((h=h.parentnode)&&!b(h)){if(d(h,"p...
...And 3 more matches
Animations and tweens - Game development
frames, the animation will display just under three times per second. ...
...e() method call that handles the collision between the ball and the paddle (the first line inside update(), see below) we can add an extra parameter that specifies a function to be executed every time the collision happens, in the same fashion as the ballhitbrick() function. ...
...d the paddle (the first line inside update(), see below) we can add an extra parameter that specifies a function to be executed every time the collision happens, in the same fashion as the ballhitbrick() function. ...
...And 3 more matches
PL_NewHashTable
allocpriv passed as the first argument (pool). returns the new hash table. description pl_newhashtable creates a new hash table. ...
... allocpriv passed as the first argument (pool). returns the new hash table. description pl_newhashtable creates a new hash table. ...
... allocpriv passed as the first argument (pool). returns the new hash table. description pl_newhashtable creates a new hash table. ...
...And 3 more matches
nsIUpdateCheckListener
teservice.idlscriptable an interface describing an object that listens to the progress of an update check operation. this object is notified as the check continues, finishes and if it has an error. ...
...ct is notified as the check continues, finishes and if it has an error. ...
.... 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void oncheckcomplete(in nsixmlhttprequest request, [array, size_is(updatecount)] in nsiupdate updates, in unsigned long updatecount); void onerror(in nsixmlhttprequest request, in nsiupdate update); void onprogress(in nsixmlhttprequest request, in unsigned long position, in unsigned long totalsize); methods oncheckcomplete() called when the update check is completed. void oncheckcomplete( in nsixmlhttprequest request, [array, size_is(updatecount)] in nsiupdate updates, in unsigned long updatecount ); parameters request the nsixmlhttprequest object handling the update check. updates an array of nsiupdate obj...
...And 3 more matches
Activity Manager examples
} canceljunkprocess.prototype = { cancel: function(aactivity) { let initiator = aactivity.initiator; if (initiator) { let folder = aactivity.getsubjects({})[0]; .... // assuming that the initiator has some way to can...
... // completion time event.contexttype = process.contexttype; // optional event.contextobj = process.contextobj; // optional gactivitymanager.addactivity(event); showing a user-defined activity with cancel capability (javascript) this sample improves the previous one by providing an nsiactivitycancelhandler to allow the user to cancel the process. // step 1: create a nsiactivitycancelhandler implementation function canceljunkprocess() { // user stuff here.. } canceljunkprocess.prototype = { cancel: function(aactivity) { let initiator = aactivity.initiator; if (initiator) { let folder = aactivity.getsubjects({})[0]; .... // assuming that the initiator has some way to cancel // the junk processing for given folder if (initiator.cancelfolderop(fold...
... since ...
...And 3 more matches
Web Console remoting - Firefox Developer Tools
exited" } this notification is sent only when your client is attached to the global console actor, it does not make sense for tab console actors. this notification has been introduced in firefox 24. ...
...the request argument is the same as the request object in the above example request packet. page errors page errors come from the nsiconsoleservice. ...
...e) method. the request argument is the same as the request object in the above example request packet. page errors page errors come from the nsiconsoleservice. each allowed page error is an nsiscripterror object. the pageerror packet is: { "from": "conn0.console9", "type": "pageerror", "pageerror": { "errormessage": "referenceerror: foo is not defined", "sourcename": "http://localhost/~mihai/mozilla/test.js", "linetext": "", "linenumber": 6, "columnnumber": 0, "category": "content javascript", "timestamp": 1347294508210, "error": false, "warning": false, "exception": true, "strict": false, "private": false, } } the packet is similar to nsiscripterror - for simplicity. we only removed several unneeded properties and changed how fla...
...And 3 more matches
WorkerGlobalScope.location - Web APIs
the location read-only property of the workerglobalscope interface returns the workerlocation associated with the worker. it is a specific location object, mostly a subset of the location for browsing scopes, but adapted to workers. syntax var locationobj = self.location; value a workerlocation object. ...
... note: firef...
... note: firefox has a bug with using console.log...
...And 3 more matches
Ajax - Developer guides
Web › Guide › AJAX
getting started an introduction to ajax. asynchronous javascript and xml, while not a technology in itself, is a term coined in 2005 by jesse james garrett, that describes a "new" approach to using a number of existing technologies together, including html or xhtml, css, javascript, dom, xml, xslt, and most importantly the xmlhttprequest object. when these technologies are combined in the ajax model, web applications are able to make quick, incremental updates to the user interface without reloading the entire browser page. this makes the application faster and more responsive to user actions. although x in ajax stands for xml, json is used more than xml nowadays because of its many advantages such as being lighter and a part of javascript. both json and xml are used for packagin...
... user actions. although x in ajax stands for xml, json is used more than xml nowadays because of its many advantages such as being lighter and a part of javascript. both json and xml are used for packaging information in the ajax model. documentation getting started this article guides you through the ajax basics and gives you two simple hands-on examples to get you started. using the xmlhttprequest api the xmlhttprequest api is the core of ajax. this article will explain how to use some ajax techniques, like: analyzing and manipulating the response of the server monitoring the progress of a request submitting forms and upload binary files – in pure ajax, or using formdata objects using ajax within web workers fetch api the fetch api provides an interface for fet...
... article will explain how to use some ajax techniques, like: analyzing and manipulating the response of the server monitoring the progress of a request submitting forms and upload binary files – in pure ajax, or using formdata objects using ajax within web workers fetch api the fetch api provides an interface for fetching resources. it will seem familiar to anyone who has used xmlhttprequest, but this api provides a more powerful and flexible feature set. server-sent events traditionally, a web page has to send a request to the server to receive new data; that is, the page requests data from the server. with server-sent events, it's possible for a server to send new data to a web page at any time, by pushing messages to the web page. these incoming messages can be treated...
...And 3 more matches
net/xhr - Archive of obsolete content
if access to the filesystem isn't prevented, it could easily be used to access sensitive user data, though this may be inconsequential if the client can't access the network. if access to local area networks isn't prevented, malicious code could access sensitive data. ...
... if access to the filesystem isn't prevented, it could easily be used to access sensitive user data, though this may be inconsequential if the client can't access the network. if access to local area networks isn't prevented, malicious code could access sensitive data. ...
...ting the protocols that can be used in the url passed to the open() method, and limiting them to http:, https:, and possibly a special scheme that can be used to access the add-on's packaged, read-only resources. finally, we need to also consider attenuating http/https requests such that they're "sandboxed" and don't communicate potentially sensitive cookie information. ...
...And 2 more matches
JavaScript Object Management - Archive of obsolete content
completely, but before it's displayed to the user. this allows you to manipulate and possibly change elements in the window without the user noticing the changes. /** * controls the browser overlay for the hello world extension. */ 〈namespace〉.browseroverlay = { /** * initializes this object. */ init : function(aevent) { this._stringbundle = document.getelementbyid("xulschoolhello-string-bundle"); // you can make changes to the window dom here. } // more stuff }; window.addeventlistener( "load", function() { 〈namespace〉.browseroverlay.init(); }, false); there are some things you can't (or shouldn't) do inside load handlers, such as closing the window being loaded, or opening new windows, alerts or dialogs. the window has to finish loading before it c...
.... they are bad ui practices anyway and you should avoid them. if you really need to do something like this anyway, one way to do it is to have a timeout execute the code after a delay: init : function(aevent) { let that = this; this._stringbundle = document.getelementbyid("xs-hw-string-bundle"); window.settimeout( function() { window.alert(that._stringbundle.getstring("xulschoolhello.greeting.label")); }, 0); } the settimeout function executes the function in the first parameter, after a delay in miliseconds specified by the second parameter. in this case we set the delay to 0, which means the function should be executed as soon as possible. firefox has a minimum delay of 10-15ms (taken from this blog post), so it won't really run instantly. it is more than enough to ...
...er section of this tutorial. two other ways are javascript code modules (firefox 3 and above), and xpcom. javascript code modules javascript code modules (also known as jsm) are new to firefox 3, and they're the best tool for keeping everything in sync between windows. they're very simple to set up. the first thing you need to do is add an entry in the chrome.manifest file: resource xulschoolhello modules/ javascript code modules are accessed with the resource protocol, which is very similar to the chrome protocol. just like with the chrome, we define the package name and then a path. to keep things simple, just locate the jsm files in a modules directory under the root of our project. in order to access a file messagecount.js in this directory, the url would be: resource://...
...And 2 more matches
The Box Model - Archive of obsolete content
s. text there are 2 xul elements that are typically used for displaying text: label and description. their behavior is nearly identical, but they are meant to be used in different situations. the label element should be used mainly for text in xul forms, such as the ones you see in the firefox options / preferences window. here's a typical usage of the label element: <label control="xulschoolhello-greeting-textbox" value="&xulschoolhello.typegreeting.label;" /> <textbox id="xulschoolhello-greeting-textbox" /> the label says something like "type a greeting message", and the textbox next to it allows the user to type the message. the control attribute links the label to the textbox. if the user clicks on the label, the textbox will be focused. also, if the user has a screen reader, ...
... the text can be much longer, and your ui should adapt to it. labels should generally be short, and they should always be displayed in a single line. descriptions may be longer, and in general you should plan it so that they can wrap into multiple lines. in order to have wrapping descriptions, you need to set the text as a child node instead of using the value attribute: <description>&xulschoolhello.description.label;</description> even then, the text will extend as much as it can in a single line, so you need to add some css limits in order to make it wrap inside a xul dialog or window. you can use the css property width to restrict the width of the description so that it wraps as you need it to. never cut text lines into separate locale strings in order to bypass wrapping difficu...
...is). the label is displayed with the expected link style so that users can easily recognize it as a link. a trickier case is when you need only part of a label to be clickable, just like in html. since labels can't handle rich text, workarounds have to implemented using javascript. one possibility is to use special markup in a locale property so that the link can be easily recognized: xulschoolhello.linkedtext.label = go to <a>our site</a> for more information the syntax is similar to html because it's easier to read this way, but string bundles won't do anything special with it. you'll have to break the string using regular expressions and generate 3 different labels, one with the text-link class. you'll also need to do some css work on the labels so that the inner spacing in the tex...
...And 2 more matches
Promises - Archive of obsolete content
// and write out a new config file. config.indexstats = processor.stats; yield os.file.writeatomic(configpath, json.stringify(config), { tmppath: configpath + "." + math.random(), encoding: "utf-8" }) timestamp = new date; }); http requests http requests should, in nearly all circumstances, be made via the standard xmlhttprequest api. while this api does not have direct support for promises, its standard usage is very easy to adapt to a promise-based approach. moreover, many third-party wrappers for the xmlhttprequest api now support promises out of the box. example direct usage task.spawn(function* () { // make the initial request. let resp = yield new promise((resolve, reject) => { let xhr = ...
...uest api. while this api does not have direct support for promises, its standard usage is very easy to adapt to a promise-based approach. moreover, many third-party wrappers for the xmlhttprequest api now support promises out of the box. example direct usage task.spawn(function* () { // make the initial request. let resp = yield new promise((resolve, reject) => { let xhr = new xmlhttprequest; xhr.onload = resolve; xhr.onerror = reject; xhr.open("get", dataurl); xhr.responsetype = "json"; xhr.send(); }); let data = resp.target.response; // use the response to construct form data object for the // second request. let form = new formdata; form.append("id", data.id); form.append("content", data.content); ...
... xhr.responsetype = "json"; xhr.send(); }); let data = resp.target.response; // use the response to construct form data object for the // second request. let form = new formdata; form.append("id", data.id); form.append("content", data.content); // make the second request. resp = yield new promise((resolve, reject) => { let xhr = new xmlhttprequest; xhr.onload = resolve; xhr.onerror = reject; xhr.open("post", updateurl); xhr.send(form); }); // use the response of the second request. notifyuser(resp.target.responsetext); }); example using promise-based helper the following example relies on the helper function defined below. task.spawn(function* () { // make the initial request. ...
...And 2 more matches
Windows Media in Netscape - Archive of obsolete content
se { // use netscape plugins } use of microsoft's msxml in conjunction with the windows media player remember that windows media player is the only activex control that netscape 7.1 supports. use of microsoft's msxml in conjunction with use of windows media player is common, particularly since both are offered to the developer community as activex controls for ie browsers. ...
...mber that windows media player is the only activex control that netscape 7.1 supports. use of microsoft's msxml in conjunction with use of windows media player is common, particularly since both are offered to the developer community as activex controls for ie browsers. in particular, the xmlhttp object is a popular one for establishing dynamic channel communication. ...
...media player is common, particularly since both are offered to the developer community as activex controls for ie browsers. in particular, the xmlhttp object is a popular one for establishing dynamic channel communication. ...
...And 2 more matches
Using the Places history service
n overview of places. this page provides a map to the external api. history services interface overview the mozilla history service has undergone many revisions. to maintain backwards compatibility, each version has implemented the older interfaces, resulting in functionality spread across many interfaces. the places history service ("navhistory") implements these history interfaces: nsiglobalhistory2: basic add page, is visited functionality used by the docshell when visiting and rendering pages. nsiglobalhistory3: adds extra functions for dealing with redirects and hints for rendering (gecko flags). nsibrowserhistory: adds functions used by the basic browser like marking pages as typed in the url bar, and removing pages as from the history interface. nsinavhistoryservice: complex q...
...ed getters and setters. nsiautocompletesearch: url-bar autocomplete from history from 1.9.1 (firefox3.1) on, don't use any places service on (or after) quit-application has been notified, since the database connection will be closed to allow the last sync, and changes will most likely be lost. use quit-application-granted instead. differences from previous implementations the previous nsglobalhistory service stored one entry for each page in history. this entry contained the url, title, visit count, last visit date, first visit date, host name, last referrer, flags for typed, hidden, and gecko flags (gecko flags is trunk only). the navhistory service has broken this into two tables (see history service design). the main url table stores the information about the page: url, host name, t...
...been created and initialized. break; case historyservice.database_status_upgraded: // database had an old schema version and has been upgraded to a new one. break; } in case the database is locked by a third party process and cannot be opened, a "places-database-locked" notification is fired, in such a case the service won't be able to initialize. adding pages to history nsiglobalhistory2.adduri: this is the basic function for adding pages to history that is called by the docshell as you browse. the redirect flag is deprecated. see adddocumentredirect below. nsiglobalhistory3.adddocumentredirect: this is called by the docshell when a redirect occurs. it replaces the old redirect flag on adduri. it gives the old and new channels to the history service so that the source pag...
...And 2 more matches
nsIDOMProgressEvent
1.0 66 introduced gecko 1.9.1 deprecated gecko 22 inherits from: nsidomevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) the nsidomprogressevent is used in the media elements (<video> and <audio>) to inform interested code of the progress of the media download. ...
...ablearg specifies whether or not the created event can be canceled. ...
...es whether or not the created event can be canceled. ...
...And 2 more matches
nsIMimeHeaders
methods extractheader() string extractheader( [const] in string headername, in boolean getallofthem ); parameters headername missing description getallofthem missing description return value m...
... methods extractheader() string extractheader( [const] in string headername, in boolean getallofthem ); parameters headername missing description getallofthem missing description return value missing description e...
...lla.org/????????????????????????????"] .createinstance(components.interfaces.nsimimeheaders); method overview string extractheader([const] in string headername, in boolean getallofthem); void initialize([const] in string allheaders, in long allheaderssize); attributes attribute type description allheaders string read only. methods extractheader() string extractheader( [const] in string headername, in boolean getallofthem ); parameters headername missing description getallofthem missing description return value missing description exceptions thrown missing exception missing description initialize() void initialize( [con...
...And 2 more matches
XPCOM Interface Reference by grouping
sidownloadprogresslistener element internal nsiworker nsiworkerglobalscope nsiworkermessageevent nsiworkermessageport nsiworkerscope tree nsitreeboxobject nsitreecolumn nsitreecolumns nsitreecontentview nsitreeselection nsitreeview xform nsixformsmodelelement nsixformsnsinstanceelement nsixformsnsmodelelement xmlhttprequest nsixmlhttprequesteventtarget favicon nsifavicondatacallback nsifaviconservice frame nsichromeframemessagemanager nsiframeloader nsiframeloaderowner nsiframemessagelistener nsiframemessagemanager interface nsijsxmlhttprequest jetpack nsijetpack nsijetpackservice offlinestorage nsiapplicationcache ...
...nt32 nsisupportsprint64 nsisupportspriority nsisupportsprtime nsisupportspruint16 nsisupportspruint32 nsisupportspruint64 nsisupportspruint8 nsisupportsstring nsisupportsvoid nsisupportsweakreference nsivariant do not use nsienumerator nsiinprocesscontentframemessagemanager nsiscriptableio nsixpcscriptable future nsixmlhttprequestupload obsolete nsixmlrpcclient nsixmlrpcfault security auth nsiauthmodule nsiauthprompt nsiauthpromptprovider nsiauthpromptwrapper nsiasyncverifyredirectcallback content nsicontentpolicy credentials nsilogininfo nsiloginmanager using n...
... nsiauthmodule nsiauthprompt nsiauthpromptprovider nsiauthpromptwrapper nsiasyncverifyredirectcallback content nsicontentpolicy credentials nsilogininfo nsiloginmanager using nsiloginmanager nsiloginmanagerstorage nsiloginmetainfo history nsiglobalhistory nsiglobalhistory2 nsiglobalhistory3 ssl nsibadcertlistener2 system action nsicancelable application application nsiapplicationupdateservice nsiappshell nsiappshellservice nsiappstartup ...
...And 2 more matches
Using files from web applications - Web APIs
trivial to go through it and create a new fileupload instance for each. each of these handles uploading the corresponding file. handling the upload process for a file the fileupload function accepts two inputs: an image element and a file from which to read the image data. ...
...open("post", "http://demos.hacks.mozilla.org/paul/demos/resources/webservices/devnull.php"); xhr.overridemimetype('text/plain; charset=x-user-defined-binary'); reader.onload = function(evt) { xhr.send(evt.target.result); }; reader.readasbinarystring(file); } the fileupload() function shown above creates a throbber, which is used to display progress information, and then creates an xmlhttprequest to handle uploading the data. before actually transferring the data, several preparatory steps are taken: the xmlhttprequest's upload progress listener is set to update the throbber with new percentage information so that as the upload progresses the throbber will be updated based on the latest information. the xmlhttprequest's upload load event handler is set to update the throbbe...
...in this case, we're using a generic mime type; you may or may not need to set the mime type at all depending on your use case. the filereader object is used to convert the file to a binary string. ...
...And 2 more matches
HTML to DOM - Archive of obsolete content
however, there are potential dangers involved in injecting remote content in a privileged context in your extension, so it can be desirable to parse the html safely. ...
...however, there are potential dangers involved in injecting remote content in a privileged context in your extension, so it can be desirable to parse the html safely. ...
...s a mediocre programmer, but people liked him <strong>anyway</strong>.</div>"); alert(dompars.getelementbyid('userinfo').innerhtml); to parse a complete html page, load it into an iframe whose type is content (not chrome). see using a hidden iframe element to parse html to a window's dom below. ...
...mentbyid('userinfo').innerhtml); to parse a complete html page, load it into an iframe whose type is content (not chrome). see using a hidden iframe element to parse html to a window's dom below. parsing complete html to dom loading an html document seems much simpler if it's loaded using the xmlhttprequest object. ...
Custom XUL Elements with XBL - Archive of obsolete content
le files. on the other hand, if your bindings are small and have a strong relationship with each other, it makes sense to keep them together. as for the css file, it's usually good to have a single file declaring all bindings in your extension. content under the content tag you define the xul content that will be displayed for your element. ...
...sion. content under the content tag you define the xul content that will be displayed for your element. <content> <xul:hbox> <xul:image class="xulshoolhello-person-image" xbl:inherits="src=image" /> <xul:vbox flex="1"> <xul:label xbl:inherits="value=name" /> <xul:description xbl:inherits="value=greeting" /> </xul:vbox> <xul:vbox> <xul:button label="&xulshoolhello.remove.label;" accesskey="&xulshoolhello.remove.accesskey;" oncommand="document.getbindingparent(this).remove(event);" /> </xul:vbox> </xul:hbox> </content> our element is very simple, displaying an image, a couple of text lines and a button. here are a couple of important things to notice: the "xul:" namespace must be used for all xul tags you have in your content...
...houldn't use the id attribute in any content nodes. these nodes are part of the xul dom just like any other, and having an id attribute is bound to cause problems, given that you could have more than instance of your element in the same document and then multiple inner items with the same id. in order to work around this problem, the anonid attribute is used instead: <xul:label anonid="xulshoolhello-name-label" xbl:inherits="value=name" /> and then, in order to get a reference to the node from the js code in your binding, we use the getanonymouselementbyattribute dom method: let namelabel = document.getanonymouselementbyattribute( this, "anonid", "xulshoolhello-name-label"); implementation the implementation section defines most of the scripting side of your element. here...
...s to the xbl element, and so internal components can be accessed using "this.". inheritance inheritance is one of the most powerful features of xbl. it allows you to create bindings that extend existing bindings, allowing lots of code reuse and subtle behavior modifications. all you need is to use the extends attribute of the binding element: <binding id="manager" extends="chrome://xulschoolhello/content/person.xml#person"> this gives you an exact copy of the "person" binding that you can override as you please. you could, for instance, just add a content tag with significantly different xul content, and leave the implementation alone. you do need to be careful about keeping all anonid attributes consistent, and even some dom structure if the code does node traversal. sadly, you c...
Getting Started with Firefox Extensions - Archive of obsolete content
did you see it? there's a new menu on the main menu, labeled "hello world!". if you open the menu and then the menu item below, you'll see a nice alert message (for some definitions of 'nice'). click on the ok button to close it. that's all the extension does. now let's take a closer look at it. extension contents you may have noticed that the extension file you installed is named xulschoolhello1.xpi. xpi (pronounced "zippy") stands for cross-platform installer, because the same installer file can work on all platforms firefox supports. xpis are simply zip files, but firefox recognizes the xpi extension and triggers the installation process when an xpi file is loaded. to look into the xpi file you need to download it first, not install it. if the server triggers an install when clic...
...when an xpi file is loaded. to look into the xpi file you need to download it first, not install it. if the server triggers an install when clicking on a link or button, what you need to do is right click on the install link, and choose the save link as... option. decompress the xpi file in a convenient location. ...
...ded. to look into the xpi file you need to download it first, not install it. if the server triggers an install when clicking on a link or button, what you need to do is right click on the install link, and choose the save link as... option. decompress the xpi file in a convenient location. ...
...ll link, and choose the save link as... option. decompress the xpi file in a convenient location. issue the following command to unzip the file on linux or mac os x: unzip xulschoolhello1.xpi -d xulschoolhello1 on windows, you can change the file extension from xpi to zip, or open the file directly, then unzip it, using a zip tool. you should see the following directory structure: xulschoolhello1 chrome.manifest install.rdf content browseroverlay.xul browseroverlay.js skin browseroverlay.css locale en-us browseroverlay.dtd browseroverlay.properties that's lots of files for something so simple! in the next section, we'll inspect these files and see what they do. ...
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
in a last-ditch attempt to find a content listener. nsiuricontentlistener implementations we try to find one of these which can handle data of the type we're looking at (that is, it can give us an nsistreamlistener to pump data into). most often, the one we find is nsdsuricontentlistener, which corresponds to a docshell and handles most of the data types that mozilla handles internally. ...
...s we try to find one of these which can handle data of the type we're looking at (that is, it can give us an nsistreamlistener to pump data into). most often, the one we find is nsdsuricontentlistener, which corresponds to a docshell and handles most of the data types that mozilla handles internally. ...
...ndles most of the data types that mozilla handles internally. nsiexternalhelperappservice if we can't do anything else with a load, we give it to the nsiexternalhelperappservice and let it look for a helper app, put up the "what do i do now?" dialog, and so forth. ...
...="#openuri-innards"> <area alt="(0) registercontentlistener()" coords="37,474,346,474,346,505,88,505,88,535,37,535" href="#registercontentlistener" shape="poly"> <area alt="(3) openuri() (nsuriloader)" coords="5,207,312,269" href="#openuri"> <area alt="(2)" coords="102,114,139,148" href="#internalload"> <area alt="(1) loaduri/onlinkclick" coords="77,5,449,59" href="#loaduri"> <area alt="nsiexternalhelperappservice" coords="527,305,839,339" href="#nsiexternalhelperappservice"> <area alt="category manager" coords="683,467,807,527" href="#nscategorymanager"> <area alt="nsdocumentopeninfo" coords="371,71,635,185" href="#nsdocumentopeninfo"> <area alt="necko" coords="721,113,821,157" href="#necko"> <area alt="nsuriloader" coords="23,335,215,455" href="#nsuriloader"> <area coords="227,515,485,575"...
Supporting per-window private browsing - Archive of obsolete content
self. you can use the nsiprivatebrowsingchannel interface for this purpose. the example below creates a channel to load a url, and forces it to be in private mode. ...
...ce for this purpose. the example below creates a channel to load a url, and forces it to be in private mode. ...
...null); channel.queryinterface(components.interfaces.nsiprivatebrowsingchannel); channel.setprivate(true); // force the channel to be loaded in private mode similarly, xmlhttprequest objects created via createinstance(ci.nsixmlhttprequest) will often require explicit adjustment, since they have no context from which to derive a privacy status. ...
...atebrowsingchannel); channel.setprivate(true); // force the channel to be loaded in private mode similarly, xmlhttprequest objects created via createinstance(ci.nsixmlhttprequest) will often require explicit adjustment, since they have no context from which to derive a privacy status. ...
Using workers in extensions - Archive of obsolete content
this series: creating a status bar extension creating a dynamic status bar extension adding preferences to an extension localizing an extension updating an extension to support multiple mozilla applications download the sample you may download the complete example: download the example. how this differs from previous versions this version of the stock ticker extension moves the xmlhttprequest call that fetches updated stock information into a worker thread, which then passes that information back to the main body of the extension's code to update the display in the status bar. this demonstrates not only how to use workers in an extension, but also how to perform xmlhttprequest in a worker, and how workers and main thread code can pass data back and forth. the worker the wo...
...on into a worker thread, which then passes that information back to the main body of the extension's code to update the display in the status bar. this demonstrates not only how to use workers in an extension, but also how to perform xmlhttprequest in a worker, and how workers and main thread code can pass data back and forth. the worker the worker thread's job in this example is to issue the xmlhttprequest calls that fetch the updated stock information. that's all it does. every 10 minutes, it calls xmlhttprequest, and, when the results are received, sends an event back to the main thread with the received data. so we need to move the refreshinformation() method from the stockwatcher2.js file into a separate file that will host the worker thread. that file, ticker_worker.js, is shown her...
...s, is shown here: var symbol = ""; function refreshinformation() { if (!symbol) { throw "no symbol set!"; } var fullurl = "http://quote.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=" + symbol; function inforeceived() { var output = httprequest.responsetext; if (output) { postmessage(output.trim()); } httprequest = null; } var httprequest = new xmlhttprequest(); httprequest.open("get", fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } setinterval(function() { refreshinformation(); }, 10*60*1000); onmessage = function(event) { if (event.data) { symbol = event.data.touppercase(); } refreshinformation(); } when the worker thread is started, the main body of this code (in lines 26-35) is executed. ...
...ion about the stock and pass it back to the main thread. this provides a way for the main thread to specifically request that the worker update the stock information at once. the refreshinformation() method is fairly similar to the previous versions, with two notable exceptions: if the ticker symbol has not been set yet, an exception is thrown (lines 4-6). when the result is received from xmlhttprequest, instead of immediately updating the displayed information in the status bar, a message is sent to the main thread using the worker's postmessage() method. this is because only the main thread is allowed to access the user interface. the main thread the changes here are also relatively minor, but crucial. the startup() method this method is called when the extension is first loaded...
WAI-ARIA basics - Learn web development
either replicate the semantics of html5 elements (e.g. <nav>), or go beyond html5 semantics to provide signposts to different functional areas, e.g search, tabgroup, tab, listbox, etc. dynamic content updates: screenreaders tend to have difficulty with reporting constantly changing content; with aria we can use aria-live to inform screenreader users when an area of content is updated, e.g. via xmlhttprequest, or dom apis. enhancing keyboard accessibility: there are built-in html elements that have native keyboard accessibility; when other elements are used along with javascript to simulate similar interactions, keyboard accessibility and screenreader reporting suffers as a result. where this is unavoidable, wai-aria provides a means to allow other elements to receive focus (using tabindex)...
...rom textual content to alternative text attached to images. traditional static websites with largely text content are therefore easy to make accessible for people with visual impairments. the problem is that modern web apps are often not just static text — they tend to have a lot of dynamically updating content, i.e. ...
...ut the entire page reloading via a mechanism like xmlhttprequest, fetch, or dom apis. these are sometimes referred to as live regions. let's look at a quick example — see aria-no-live.html (also see it running live). in this example we have a simple random quote box: <section> <h1>random quote</h1> <blockquote> <p></p> </blockquote> </section> our javascript loads a json file via xmlhttprequest containing a series of random quotes and their authors. once that is done, we start up a setinterval() loop that loads a new random quote into the quote box every 10 seconds: let intervalid = window.setinterval(showquote, 10000); this works ok, but it is not good for accessibility — the content update is not detected by screenreaders, so their users would not know what is going on. ...
...ounced only if the user is idle. assertive: updates should be announced to the user as soon as possible. we'd like you to take a copy of aria-no-live.html and quotes.json, and update your <section> tag as follows: <section aria-live="assertive"> this will cause a screenreader to read out the content as it is updated. note: most browsers will throw a security exception if you try to do an xmlhttprequest call from a file:// url, e.g. if you just load the file by loading it directly into the browser (via double clicking, etc.). to get it to run, you will need to upload it to a web server, for example using github, or a local web server like python's simplehttpserver. there is an additional consideration here — only the bit of text that updates is read out. it might be nice if we alwa...
How do you set up a local testing server? - Learn web development
the command to start up the server in that directory: # if python version returned above is 3.x python3 -m http.server # on windows try "python" instead of "python3", or "py -3" # if python version returned above is 2.x python -m simplehttpserver by default, this will run the contents of the directory on a local web server, on port 8000. you can go to this server by going to the url localhost:8000 in your web browser. here you'll see the contents of the directory listed — click the html file you want to run. note: if you already have something running on port 8000, you can choose another port by running the server command followed by an alternative port number, e.g. python3 -m http.server 7800 (python 3.x) or python -m simplehttpserver 7800 (python 2.x). you can then access ...
... browser. here you'll see the contents of the directory listed — click the html file you want to run. note: if you already have something running on port 8000, you can choose another port by running the server command followed by an alternative port number, e.g. python3 -m http.server 7800 (python 3.x) or python -m simplehttpserver 7800 (python 2.x). you can then access your content at localhost:7800. running server-side languages locally python's simplehttpserver (python 2.0) http.server (python 3.0) module is useful, but it doesn't know how to run code written in languages such as python, php or javascript. to handle that you'll need something more — exactly what you'll need depends on the server-side language you are trying to run. here are a few examples: to run python ser...
...ere are a few examples: to run python server-side code, you'll need to use a python web framework. flask is also a good (slightly less heavyweight) alternative to django. to run this you'll need to install python/pip, then install flask using pip3 install flask. ...
...t you should be able to run the python flask examples using for example python3 python-example.py, then navigating to localhost:5000 in your browser. to run node.js (javascript) server-side code, you'll need to use raw node or a framework built on top of it. express is a good choice. ...
Introducing asynchronous JavaScript - Learn web development
rgument, i.e, the callback function is not executed immediately. it is “called back” (hence the name) asynchronously somewhere inside the containing function’s body. the containing function is responsible for executing the callback function when the time comes. you can write your own function containing a callback easily enough. ...
...onously somewhere inside the containing function’s body. the containing function is responsible for executing the callback function when the time comes. you can write your own function containing a callback easily enough. ...
...y.appendchild(image); } loadasset('coffee.jpg', 'blob', displayimage); here we create a displayimage() function that simply represents a blob passed to it as an object url, then creates an image to display the url in, appending it to the document's <body>. however, we then create a loadasset() function that takes a callback as a parameter, along with a url to fetch and a content type. it uses xmlhttprequest (often abbreviated to "xhr") to fetch the resource at the given url, then pass the response to the callback to do something with. in this case the callback is waiting on the xhr call to finish downloading the resource (using the onload event handler) before it passes it to the callback. callbacks are versatile — not only do they allow you to control the order in which functions are r...
...le. the expected parameter of foreach() is a callback function, which itself takes two parameters, a reference to the array name and index values. however, it doesn't wait for anything — it runs immediately. promises promises are the new style of async code that you'll see used in modern web apis. a good example is the fetch() api, which is basically like a modern, more efficient version of xmlhttprequest. let's look at a quick example, from our fetching data from the server article: fetch('products.json').then(function(response) { return response.json(); }).then(function(json) { products = json; initialize(); }).catch(function(err) { console.log('fetch problem: ' + err.message); }); note: you can find the finished version on github (see the source here, and also see it runnin...
Introduction to web APIs - Learn web development
age on their own are very commonly used. this seemingly small detail has had a huge impact on the performance and behaviour of sites — if you just need to update a stock listing or list of available new stories, doing it instantly without having to reload the whole entire page from the server can make the site or app feel much more responsive and "snappy". apis that make this possible include xmlhttprequest and the fetch api. you may also come across the term ajax, which describes this technique. find out more about such apis in fetching data from the server. apis for drawing and manipulating graphics are now widely supported in browsers — the most popular ones are canvas and webgl, which allow you to programmatically update the pixel data contained in an html <canvas> element to create...
...ead this article first before continuing. some web apis contain no events, but most contain at least a few. the handler properties that allow us to run functions when events fire are generally listed in our reference material in separate "event handlers" sections. we already saw a number of event handlers in use in our web audio api example above. to provide another example, instances of the xmlhttprequest object (each one represents an http request to the server to retrieve a new resource of some kind) has a number of events available on them, for example, the load event is fired when a response has been successfully returned containing the requested resource, and it is now available. the following code provides a simple example of how this would be used: let requesturl = 'https://mdn.
...ew resource of some kind) has a number of events available on them, for example, the load event is fired when a response has been successfully returned containing the requested resource, and it is now available. the following code provides a simple example of how this would be used: let requesturl = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json'; let request = new xmlhttprequest(); request.open('get', requesturl); request.responsetype = 'json'; request.send(); request.onload = function() { const superheroes = request.response; populateheader(superheroes); showheroes(superheroes); } note: you can see this code in action in our ajax.html example (see it live also). the first five lines specify the location of the resource we want to fetch, create a new...
...rl); request.responsetype = 'json'; request.send(); request.onload = function() { const superheroes = request.response; populateheader(superheroes); showheroes(superheroes); } note: you can see this code in action in our ajax.html example (see it live also). the first five lines specify the location of the resource we want to fetch, create a new instance of a request object using the xmlhttprequest() constructor, open an http get request to retrieve the specified resource, specify that the response should be sent in json format, then send the request. the onload handler function then specifies what we do with the response. we know the response will be successfully returned and available after the load event has fired (unless an error occurred), so we save the response containing ...
Package management basics - Learn web development
t> </body> </html> next, we need to add an index.js file in the same directory as index.html. for now index.js can be empty; it just needs to exist. create this now. having fun with parcel now we’ll run our newly installed parcel tool. in your terminal, run the following command: parcel index.html you should see something like this printed to your terminal: server running at http://localhost:1234 ✨ built in 193ms. note: if you have trouble with the terminal returning a "command not found" type error, try running the above command with the npx utility, i.e. npx parcel index.html. now we're ready to benefit from the full javascript package ecosystem. for a start, there is now a local web server running at http://localhost:1234. go there now and you’ll not see anything for n...
...rs ago", "4 days ago" and so on. the date-fns package’s formatdistancetonow() method is useful for this (there's other packages that do the same thing too). in the index.js file, add the following code and save it: import { formatdistancetonow } from 'date-fns' const date = '1996-09-13 10:00:00'; document.body.textcontent = formatdistancetonow(new date(date)) + ' ago'; go back to http://localhost:1234 and you'll see how long ago it is since the author turned 18. what's particularly special about the code above is that it is using the formatdistancetonow() function from the date-fns package, which we didn’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 look...
...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 for us, and the files it is serving at localhost:1234. these are the files you would upload to your web server when releasing the site online for public consumption. so long as we know the package name, we can use it in our code and parcel will go off, fetch, and install (actually "copy") the package into our local directory (under node_modules). building our code for production however, this code is not ready for production. most build ...
...: "echo \"error: no test specified\" && exit 1", "dev": "parcel serve index.html" }, we’ve added a custom dev command as an npm script. now try running the following in your terminal, making sure you are inside the parcel-experiment directory: npm run dev this should start parcel and serve up your index.html at the local development server, as we saw before: server running at http://localhost:1234 ✨ built in 5.48s. in addition, the npm (and yarn) commands are clever in that they will search for command line tools that are locally installed to the project before trying to find them through conventional methods (where your computer will normally store and allow software to be found). you can learn more about the technical intricacies of the run command, although in most cases you...
How to embed the JavaScript engine
return 1; { // scope for our various stack objects (jsautorequest, rootedobject), so they all go // out of scope before we js_destroycontext. ...
... return 1; { // scope for our various stack objects (jsautorequest, rootedobject), so they all go // out of scope before we js_destroycontext. ...
... return 1; { // scope for our various stack objects (jsautorequest, rootedobject), so they all go // out of scope before we js_destroycontext. ...
...arious stack objects (jsautorequest, rootedobject), so they all go // out of scope before we js_destroycontext. ...
nsICommandLineHandler
d in the category "command-line-handler". the entries in this category are read in alphabetical order, and each category value is treated as a service contract id implementing this interface. by convention, handlers with ordinary priority should begin with "m". ...
...er, and each category value is treated as a service contract id implementing this interface. by convention, handlers with ordinary priority should begin with "m". ...
...terface. by convention, handlers with ordinary priority should begin with "m". ...
...le: category entry value command-line-handler b-jsdebug @mozilla.org/venkman/clh;1 command-line-handler c-extensions @mozilla.org/extension-manager/clh;1 command-line-handler m-edit @mozilla.org/composer/clh;1 command-line-handler m-irc @mozilla.org/chatzilla/clh;1 command-line-handler y-final @mozilla.org/browser/clh-final;1 method overview void handle(in nsicommandline acommandline); attributes attribute type description helpinfo autf8string when the application is launched with the -help argument, this attribute is retrieved and displayed...
nsIMsgMessageService
n nsimsgwindow amsgwindow, in nsiurllistener aurllistener, out nsiuri aurl); void search(in nsimsgsearchsession asearchsession, in nsimsgwindow amsgwindow, in nsimsgfolder amsgfolder, in string asearchuri); nsiuri streammessage(in string amessageuri, in nsisupports aconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, in boolean aconvertdata, in string aadditionalheader); nsiuri streamheaders(in string amessageuri, in nsistreamlistener aconsumer, in nsiurllistener aurllistener [optional] in boolean alocalonly); boolean ismsginmemcache(in nsiuri aurl, in nsimsgfolder afolder, out nsicacheentrydescriptor acacheentry); nsimsgdbhdr messageuritomsghdr(in string uri); methods copymessage() pass in the uri for the message you wa...
... in nsimsgwindow amsgwindow, in nsimsgfolder amsgfolder, in string asearchuri); parameters asearchsession the nsimsgsearchsession to use. amsgwindow nsimsgwindow for progress and status feedback amsgfolder nsimsgfolder asearchuri url of the search. streammessage() this method streams a message to the passed in consumer. it will also tack aadditionalheader onto the url (e.g., header=filter). the good thing about this method is that you can extract a standard representation of any message, no matter if they are emails, rss, news, blogs, etc. nsiuri streammessage(in string amessageuri, in nsisupports aconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, ...
...t you can extract a standard representation of any message, no matter if they are emails, rss, news, blogs, etc. nsiuri streammessage(in string amessageuri, in nsisupports aconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, in boolean aconvertdata, in string aadditionalheader); parameters amessageuri uri of message to stream aconsumer generally, a stream listener listening to the message. 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. amsgwindow nsimsgwindow for progress and status feedback. aurllistener an nsiurllistener that is n...
...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. amsgwindow nsimsgwindow for progress and status feedback. aurllistener an nsiurllistener that is notified when url starts and stops. aconvertdata if aconvertdata is true, it will create a stream converter from message rfc2822 to */*. aadditionalheader header added to the uri. e.g., header=filter return the nsiuri that gets run example for example, the next piece of code shows the selected message code on a dialog: (taken from mozillazine) var content = ""; var messageuri = getfirstselectedmessage(); var msgservice = messenger.messageservicefromuri(messageuri); var msgstream = components.classes["@mozilla.org/network/sync-s...
nsIProtocolProxyService
previous doc this method returns a nsiproxyinfo instance that identifies a proxy to be used for loading the given uri. otherwise, this method returns null indicating that a direct connection should be used. if this proxy is unavailable, getfailoverforproxy() may be called to determine the correct secondary proxy to be used. if the protocol handler for the given uri supports nsiproxiedprotocolhandler, then the nsiproxyinfo instance returned from resolve may be passed to the nsiproxiedprotocolhandler.newproxiedchannel() method to create a nsichannel to the given uri that uses the specified proxy. however, if the nsiproxyinfo type is "http", then it means that the given uri should be loaded using the http protocol handler, which also supports nsiproxiedprotocolhandler. nsiproxyinfo res...
... object or null for a direct connection. note: if pac is configured, and the pac file has not yet been loaded, then this method will return a nsiproxyinfo instance with a type of "unknown" to indicate to the consumer that asyncresolve should be used to wait for the pac file to finish loading. otherwise, the consumer may choose to treat the result as type "direct" if desired. see nsiproxiedprotocolhandler.newproxiedchannel(). asyncresolve() this method is an asychronous version of the resolve method. unlike resolve, this method is guaranteed not to block the calling thread waiting for dns queries to complete. this method is intended as a substitute for resolve when the result is not needed immediately. nsicancelable asyncresolve( in nsiuri auri, in unsigned long aflags, in nsip...
...l be visited in the order in which they were registered. if the filter is already registered, then its position will be updated. after filters have been run, any disabled or disallowed proxies will be removed from the list. a proxy is disabled if it had previously failed-over to another proxy (see getfailoverforproxy()). a proxy is disallowed, for example, if it is a http proxy and the nsiprotocolhandler for the queried uri does not permit proxying via http. if a nsiprotocolhandler disallows all proxying, then filters will never have a chance to intercept proxy requests for such urls. note: it is possible to construct filters that compete with one another in undesirable ways. this api does not attempt to protect against such problems. it is recommended that any extensions that choose to c...
...sition the position of the filter. ...
XPCOM Interface Reference
lernsidragservicensidragsessionnsidroppedlinkhandlernsidroppedlinkitemnsidynamiccontainernsieditornsieditorboxobjectnsieditordocshellnsieditorimesupportnsieditorloggingnsieditormailsupportnsieditorobservernsieditorspellchecknsieffectivetldservicensienumeratornsienvironmentnsierrorservicensieventlistenerinfonsieventlistenerservicensieventsourcensieventtargetnsiexceptionnsiextensionmanagernsiexternalhelperappservicensiexternalprotocolservicensiexternalurlhandlerservicensiftpchannelnsiftpeventsinknsifactorynsifavicondatacallbacknsifaviconservicensifeednsifeedcontainernsifeedelementbasensifeedentrynsifeedgeneratornsifeedpersonnsifeedprocessornsifeedprogresslistenernsifeedresultnsifeedresultlistenernsifeedtextconstructnsifilensifileinputstreamnsifileoutputstreamnsifilepickernsifileprotocolhandler...
...sifeedresultlistenernsifeedtextconstructnsifilensifileinputstreamnsifileoutputstreamnsifilepickernsifileprotocolhandlernsifilespecnsifilestreamsnsifileurlnsifileutilitiesnsifileviewnsifocusmanagernsiformhistory2nsiframeloadernsiframeloaderownernsiframemessagelistenernsiframemessagemanagernsiframescriptloadernsigsettingscollectionnsigsettingsservicensigeolocationprovidernsigeolocationupdatensiglobalhistorynsiglobalhistory2nsiglobalhistory3nsihtmleditornsihttpheaderlistenernsihapticfeedbacknsihttpactivitydistributornsihttpactivityobservernsihttpchannelnsihttpchannelinternalnsihttpheadervisitornsihttpservernsihttpupgradelistenernsiidnservicensiiframeboxobjectnsiiniparsernsiiniparserfactorynsiiniparserwriternsiioservicensiidleservicensiinprocesscontentframemessagemanagernsiinputstreamnsiinputstr...
...portexportservicensiplacesviewnsipluginhostnsiprefbranch2nsipreflocalizedstringnsiprefservicensiprincipalnsiprinterenumeratornsiprintingpromptnsiprivatebrowsingservicensiprocessnsiprocess2nsiprocessscriptloadernsiprofilensiprofilelocknsiprofileunlockernsiprogramminglanguagensiprogresseventsinknsipromptnsipromptservicensipropertiesnsipropertynsipropertybagnsipropertybag2nsipropertyelementnsiprotocolhandlernsiprotocolproxycallbacknsiprotocolproxyfilternsiprotocolproxyservicensiproxyinfonsipushmessagensipushservicensipushsubscriptionnsiradiointerfacelayernsirandomgeneratornsirequestnsirequestobservernsiresumablechannelnsirunnablensishentrynsishistorynsishistorylistenernsisockssocketinfonsisslerrorlistenernsisslsocketcontrolnsiscreennsiscreenmanagernsiscripterrornsiscripterror2nsiscriptableionsi...
...rtnsiwifiaccesspointnsiwifilistenernsiwifimonitornsiwinaccessnodensiwinapphelpernsiwintaskbarnsiwindowcreatornsiwindowmediatornsiwindowwatchernsiwindowsregkeynsiwindowsshellservicensiworkernsiworkerfactorynsiworkerglobalscopensiworkermessageeventnsiworkermessageportnsiworkerscopensiwritablepropertybagnsiwritablepropertybag2nsixformsmodelelementnsixformsnsinstanceelementnsixformsnsmodelelementnsixmlhttprequestnsixmlhttprequesteventtargetnsixmlhttprequestuploadnsixpcexceptionnsixpcscriptablensixpconnectnsixsltexceptionnsixsltprocessornsixsltprocessorobsoletensixulappinfonsixulbrowserwindownsixulbuilderlistenernsixulruntimensixulsortservicensixultemplatebuildernsixultemplatequeryprocessornsixultemplateresultnsixulwindownsixmlrpcclientnsixmlrpcfaultnsizipentrynsizipreadernsizipreadercachensizipw...
The HTML DOM API - Web APIs
ame properties and methods associated with them). ...
...and methods associated with them). ...
...iated with them). ...
... htmlanchorelement htmlareaelement htmlaudioelement htmlbrelement htmlbaseelement htmlbodyelement htmlbuttonelement htmlcanvaselement htmldlistelement htmldataelement htmldatalistelement htmldetailselement htmldialogelement htmldirectoryelement htmldivelement htmlelement htmlembedelement htmlfieldsetelement htmlformelement htmlhrelement htmlheadelement htmlheadingelement htmlhtmlelement htmliframeelement htmlimageelement htmlinputelement htmllielement htmllabelelement htmllegendelement htmllinkelement htmlmapelement htmlmediaelement htmlmenuelement htmlmetaelement htmlmeterelement htmlmodelement htmlolistelement htmlobjectelement htmloptgroupelement htmloptionelement htmloutputelement htmlparagraphelement htmlparamelement htmlpictureelement htmlpr...
ProgressEvent - Web APIs
the progressevent interface represents events measuring progress of an underlying process, like an http request (for an xmlhttprequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="midd...
...ess of performing. when downloading a resource using http, this only represent the content itself, not headers and other overhead. methods also inherits methods from its parent event. progressevent.initprogressevent() initializes a progressevent created using the deprecated document.createevent("progressevent") method. ...
... methods also inherits methods from its parent event. progressevent.initprogressevent() initializes a progressevent created using the deprecated document.createevent("progressevent") method. examples the following example adds a progressevent to a new xmlhttprequest and uses it to display the status of the request. ...
... living standard ...
Using Service Workers - Web APIs
/flags and enable support for serviceworker; restart browser. microsoft edge: go to about:flags and tick enable service workers; restart browser. you’ll also need to serve your code via https — service workers are restricted to running across https for security reasons. github is therefore a good place to host experiments, as it supports https. in order to facilitate local development, localhost is considered a secure origin by browsers as well. basic architecture with service workers, the following steps are generally observed for basic set up: the service worker url is fetched and registered via serviceworkercontainer.register(). if successful, the service worker is executed in a serviceworkerglobalscope; this is basically a special kind of worker context, running off the main...
...ound this using .complete, but it’s still not foolproof, and what about multiple images? and, ummm, it’s still synchronous, so blocks the main thread. instead, we could build our own promise to handle this kind of case. ...
...e to handle this kind of case. (see our promises test example for the source code, or look at it running live.) note: a real service worker implementation would use caching and onfetch rather than the xmlhttprequest api. those features are not used here so that you can focus on understanding promises. ...
...re registered and update/remove them. when testing you can get around the https restriction by checking the "enable service workers over http (when toolbox is open)" option in the firefox developer tools settings. the "forget" button, available in firefox's customization options, can be used to clear service workers and their caches (bug 1252998). note: you may serve your app from http://localhost (e.g. using me@localhost:/my/app$ python -m simplehttpserver) for local development. see security considerations ...
Parsing and serializing XML - Developer guides
an existing dom tree into xml. in this article, we'll look at the objects provided by the web platform to make the common tasks of serializing and parsing xml easy. xmlserializer serializes dom trees, converting them into strings containing xml. domparser constructs a dom tree by parsing a string containing xml, returning a xmldocument or document as appropriate based on the input data. xmlhttprequest loads content from a url; xml content is returned as an xml document object with a dom tree built from the xml itself. xpath a technology for creating strings that contain addresses for specific portions of an xml document, and locating xml nodes based on those addresses. creating an xml document using one of the following approaches to create an xml document (which is an instance...
...ng a domparser: var smystring = '<a id="a"><b id="b">hey!</b></a>'; var oparser = new domparser(); var odom = oparser.parsefromstring(smystring, "application/xml"); // print the name of the root element or error message console.log(odom.documentelement.nodename == "parsererror" ? ...
... if the document is html, the code shown above will return a do...
...ml document given a document, you can serialize the document's dom tree back into xml using the xmlserializer.serializetostring() method. use the following approaches to serialize the contents of the xml document you created in the previous section. serializing dom trees to strings first, create a dom tree as described in how to create a dom tree. alternatively, use a dom tree obtained from xmlhttprequest. to serialize the dom tree doc into xml text, call xmlserializer.serializetostring(): var oserializer = new xmlserializer(); var sxml = oserializer.serializetostring(doc); serializing html documents if the dom you have is an html document, you can serialize using serializetostring(), but there is a simpler option: just use the element.innerhtml property (if you want just the descend...
Cross-domain Content Scripts - Archive of obsolete content
by default, content scripts don't have any cross-domain privileges. in particular, they can't: access content hosted in an iframe, if that content is served from a different domain make cross-domain xmlhttprequests however, you can enable these features for specific domains by adding them to your add-on's package.json under the "cross-domain-content" key, which itself lives under the "permissions" key: "permissions": { "cross-domain-content": ["http://example.org/", "http://example.com/"] } the domains listed must include the scheme and fully qualified domain name, and these must exactly match the domains serving the content - so in the example above, the content script will not be allowed to access content served from https://example.com/. wildcards are not allowed. this f...
...ntbyid("wikipedia"); var todaysfeaturedarticle = iframe.contentwindow.document.getelementbyid("mp-tfa"); self.postmessage(todaysfeaturedarticle.textcontent); for this to work, we need to add the "cross-domain-content" key to "package.json": "permissions": { "cross-domain-content": ["http://en.m.wikipedia.org/"] } the add-on should successfully retrieve the iframe's content. cross-domain xmlhttprequest the following add-on creates a panel whose content is the summary weather forecast for shetland. if you want to try it out, you'll need to register and get an api key. the "main.js": creates a panel whose content is supplied by "panel.html" and adds a content script "panel-script.js" to it sends the panel a "show" message when it is shown adds a button which shows the panel when ...
...ire("sdk/ui/button/action").actionbutton({ id: "get-forecast", label: "get the forecast", icon: "./icon-16.png", onclick: function() { forecast_panel.show(); } }); the "panel.html" just includes a <div> block for the forecast: <!doctype html> <!-- panel.html --> <html> <head></head> <body> <div id="forecast_summary"></div> </body> </html> the "panel-script.js" uses xmlhttprequest to fetch the latest forecast: // panel-script.js var url = "http://datapoint.metoffice.gov.uk/public/data/txt/wxfcs/regionalforecast/json/500?key=your-api-key"; self.port.on("show", function () { var request = new xmlhttprequest(); request.open("get", url, true); request.onload = function () { var jsonresponse = json.parse(request.responsetext); var summary = getsummary...
jpm - Archive of obsolete content
st this command packages the add-on as an xpi file then posts it to some url. jpm post it looks for a file called package.json in the current directory (or --addon-dir) and creates an xpi file with which to post to the --post-url. jpm post accepts the following options: --post-url url the url to post the extension to after creating an xpi. jpm post --post-url http://localhost:8888/ see using post and watchpost for more information. -v --verbose verbose operation: jpm post --post-url http://localhost:8888/ -v jpm watchpost this command packages the add-on as an xpi file then posts it to some url whenever a file in the current working directory changes. jpm watchpost creates an xpi whenever a file changes in the current wo...
... then posts it to some url whenever a file in the current working directory changes. jpm watchpost creates an xpi whenever a file changes in the current working directory (or --addon-dir) and posts that to the --post-url. jpm watchpost accepts the following options: --post-url url the url to post the extension to after creating an xpi. jpm watchpost --post-url http://localhost:8888/ see using post 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 ...
...nvoke it, it can be a little cumbersome if you are making very frequent changes to an add-on. an alternative development model is to use the extension auto-installer add-on: this listens for new xpi files on a specified port and installs them automatically. that way you can test new changes without needing to restart the browser: make a change to your add-on run jpm post --post-url http://localhost:8888/, to make an xpi and post it. you could even automate this workflow with a simple script. for example: jpm watchpost --post-url http://localhost:8888/ note that the logging level defined for the console is different when you use this method, compared to the logging level used when an add-on is run using jpm run. this means that if you want to see the output from console.log() message...
Creating a dynamic status bar extension - Archive of obsolete content
we want to update the stock information. it's called whenever the user clicks on the status bar panel, when our extension is first added to a browser window, and by the interval handler to periodically update the display. refreshinformation: function() { var httprequest = null; var fullurl = 'http://quote.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=goog'; // ... httprequest = new xmlhttprequest(); httprequest.open('get', fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } the httprequest variable will contain an xmlhttprequest object. this object is used to configure and run an http request on a web server, which we'll use to fetch the stock quote data. the fullurl variable is the complete url to use when requesting a stock quote. in this case,...
... we'll use to fetch the stock quote data. the fullurl variable is the complete url to use when requesting a stock quote. in this case, we're using yahoo's comma-separated values return to fetch easily-parsed stock quote data for google (ticker symbol goog). refreshinformation() embeds another function, inforeceived(), which we'll look at separately shortly. the first thing we do is create a new xmlhttprequest object to use for processing our request. we open the request, specifying that we wish to perform an http "get" command with the url fullurl. the true boolean value in the third parameter indicates that we want to process the request asynchronously. setting the httprequest.onload property to our inforeceived() function configures the request to call inforeceived() when the response is r...
...[6] + ' | ' + 'high: ' + fieldarray[7] + ' | ' + 'vol: ' + fieldarray[8]; } } the first thing we do here is get the status bar panel into the variable samplepanel by calling the document.getelementbyid() dom function. we need this so that we can make changes to the status bar panel itself. we then fetch the result returned by the web server into the variable output from the xmlhttprequest.responsetext property. the text we receive back from the server looks something like this: "goog",414.20,"5/1/2006","1:36pm",-3.74,417.85,419.44,412.19,4760215 we then parse the text. we use the split() string function to split the comma-separated value string into its individual parts, with each field in a separate element in the array fieldarray. at index 0 is the ticker symbol itse...
Enabling the behavior - retrieving tinderbox status - Archive of obsolete content
our mozilla extension now exists, but it doesn't do anything. to make it work we have to add javascript code that changes its status when the tinderbox status changes. the first step is to write a function that queries the tinderbox server and retrieves the current status. var gxmlhttprequest; function loadtinderboxstatus() { gxmlhttprequest = new xmlhttprequest(); gxmlhttprequest.onload = updatetinderboxstatus; gxmlhttprequest.open("get", "http://tinderbox.mozilla.org/seamonkey/panel.html"); gxmlhttprequest.send(null); } xmlhttprequest is an interface in mozilla for retrieving documents via http. although it is designed to retrieve xml content and parse it into a dom, it can retrieve (but not parse) other kinds of content as well. in this case we use it to retrieve an ht...
...o retrieve xml content and parse it into a dom, it can retrieve (but not parse) other kinds of content as well. in this case we use it to retrieve an html page containing a brief summary of the current tinderbox state. that document gets updated by the tinderbox server every time a build finishes. it displays a list of active tinderbox clients along with the result of their last build attempt. ...
... xmlhttprequest is easy to use in the simple case we have here. we use new to create a new instance of it, set the instance's onload property to updatetinderboxstatus(), the function we want to execute when the document finishes loading, call its open method with the type of http request we want to make and the url of the document to retrieve, and then call its send method to send the request. xmlhttprequest will retrieve the document located at the given url and call the updatetinderboxstatus() function when it is done. notice that we defined the instance of xmlhttprequest as a global variable. this is because we need to reference it in the updatetinderboxstatus() function as well as the current function, and we can't pass the object from one function to the other because the one doesn't ...
Uploading and Downloading Files - Archive of obsolete content
an be used to upload files to servers in various ways. the exact method depends on the type of upload that you wish to perform. http file upload some web sites allow one to upload a file. this is done by using an html <input> element using the file type from within a form. when the user selects a file, it can be uploaded to a server. this operation can also be performed via a script using the xmlhttprequest object. this is a common technique for uploading files as it is compatible with existing servers and formdata interface makes that task fairly simple. a formdata object will automatically generate request data with mime type multipart/form-data that existing servers can process. to add a file field to the data you use a file object that an extension can construct from file path. the fo...
... for uploading files as it is compatible with existing servers and formdata interface makes that task fairly simple. a formdata object will automatically generate request data with mime type multipart/form-data that existing servers can process. to add a file field to the data you use a file object that an extension can construct from file path. the formdata object can then simply be passed to xmlhttprequest: function upload(posturl, fieldname, filepath) { var formdata = new formdata(); formdata.append(fieldname, new file(filepath)); var req = new xmlhttprequest(); req.open("post", posturl); req.onload = function(event) { alert(event.target.responsetext); }; req.send(formdata); } http put you can also upload a file using an http put operation. this is simpler but it doesn't...
...request(); req.open("post", posturl); req.onload = function(event) { alert(event.target.responsetext); }; req.send(formdata); } http put you can also upload a file using an http put operation. this is simpler but it doesn't allow sending additional data and web servers usually need special configuration to support put operations. function uploadput(posturl, filepath) { var req = new xmlhttprequest(); req.open("put", posturl); req.setrequestheader("content-type", "text/plain"); req.onload = function(event) { alert(event.target.responsetext); } req.send(new file(filepath)); } in this example, a new input stream is created for a file, and is passed to the xmlhttprequest's send method. fetch upload please refer to uploading a file section inside the fetch article. downlo...
CommandLine - Archive of obsolete content
specific handlers with registering and unregistering functions in your command line handler service. this has the advantage to accumulate unhandled arguments until a specific handler is added. this approach has been used in songbird. example notice the changes since gecko 2.0 (component registration has moved into the manifest file). ...
...gistrar; const nsicommandline = components.interfaces.nsicommandline; const nsicommandlinehandler = components.interfaces.nsicommandlinehandler; const nsifactory = components.interfaces.nsifactory; const nsimodule = components.interfaces.nsimodule; const class_id = components.id("178cfbb6-503c-11dc-8314-0800200c9a66"); const class_name = "applicationnameclh"; const contract_id = "@example.com/applicationname/clh;1"; const cld_category = "m-applicationname"; var apphandler = { /* nsisupports */ queryinterface : function clh_qi(aiid) { if (aiid.equals(nsicommandlinehandler) || aiid.equals(nsifactory) || aiid.equals(nsisupports)) return this; throw components.results.ns_error_no_interface; }, /* nsicommandline...
....com/applicationname/clh;1"; const cld_category = "m-applicationname"; var apphandler = { /* nsisupports */ queryinterface : function clh_qi(aiid) { if (aiid.equals(nsicommandlinehandler) || aiid.equals(nsifactory) || aiid.equals(nsisupports)) return this; throw components.results.ns_error_no_interface; }, /* nsicommandlinehandler */ handle : function clh_handle(acmdline) { var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.notifyobservers(acmdline, "commandline-args-changed", null); }, helpinfo : " -test <value> a test attribute\n", /* nsifactory */ createinstance : function mdh_ci(aouter,...
Index - MDN Web Docs Glossary: Definitions of Web-related terms
...
...ap (simple object access protocol) is a protocol for transmitting data in xml format. firefox removed support for soap in 2008. 391 spa (single-page application) glossary, spa, single-page app an spa (single-page application) is a web app implemention that loads 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. 392 sql codingscripting, database, glossary, sql sql (structured query language) is a descriptive computer language designed for updating, retrieving, and calculating data in table-based databases. 393 sql injection glossary, security, sql, sql injection, webapp sql injection takes advantage of we...
...ges such as javascript, a wrapper is a function that is intended to call one or more other functions, sometimes purely for convenience, and sometimes adapting them to do a slightly different task in the process. 506 xforms codingscripting, glossary, obsolete, xforms xforms is a convention for building web forms and processing form data in the xml format. 507 xhr (xmlhttprequest) api, beginner, codingscripting, glossary, xmlhttprequest xmlhttprequest (xhr) is a javascript api to create ajax requests. its methods provide the ability to send network requests between the browser and a server. 508 xhtml codingscripting, glossary, xhtml xhtml is a term that was historically used to describe html documents written to conform with xml sy...
Getting started with Svelte - Learn web development
npm install npm run dev note: degit doesn't do any kind of magic — it just lets you download and unzip the latest version of a git repo's contents. this is much quicker than using git clone because it will not download all the history of the repo, or create a complete local clone. after running npm run dev, svelte will compile and build your application. it will start a local server at localhost:5000. svelte will watch for file updates, and automatically recompile and refresh the app for you when changes are made to the source files. your browser will display something like this: application structure the starter template comes with the following structure: moz-todo-svelte ├── readme.md ├── package.json ├── package-lock.json ├── rollup.config.js ├── ...
...x) { main { max-width: none; } } </style> we are applying a style to our <h1> element. what will happen other components with <h1> elements in them? in svelte, css inside a component's <style> block will be scoped only to that component. this works by adding a class to selected elements, which 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 us...
...<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 6 of app.svelte so that it reads like this: <h1>hello {name} from mdn!</h1> just save your changes and the app running at localhost:5000 will be automatically updated. a first look at svelte reactivity in the context of a ui framework, reactivity means that the framework can automatically update the dom when the state of any component is changed. in svelte, reactivity is triggered simply by assigning a new value to any top level variable in a component. for example, we could include a togglename() function in our app co...
Handling common JavaScript problems - Learn web development
49. if we look at the source code, the relevant code section is this: function showheroes(jsonobj) { let heroes = jsonobj['members']; for(i = 0; i < heroes.length; i++) { ... so the code falls over as soon as we try to access a property of jsonobj (which as you might expect, is supposed to be a json object). this is supposed to be fetched from an external .json file using the following xmlhttprequest call: let requesturl = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json'; let request = new xmlhttprequest(); request.open('get', requesturl); request.send(); let superheroes = request.response; populateheader(superheroes); showheroes(superheroes); but this fails. the console api you may already know what is wrong with this code, but let's explore it some ...
... the jsonobj variable is storing a text string, not a json object. exploring further down the call stack, click onload in the call stack section. the view will update to show the request.onload function in the center panel, and its scopes in the scopes section. if you expand the onload scope, you'll see that the superheroes variable is a text string too, not an object. this settles it — our xmlhttprequest call is returning the json as text, not json. we'd like you to try fixing this problem yourself. to give you a clue, you can either tell the xmlhttprequest object explicitly to return json format, or convert the returned text to json after the response arrives. if you get stuck, consult our fixed-ajax.html example. note: the debugger tab has many other useful features that we've not...
...r (basically an easier, nicer way of writing what you can already do using existing features), and some offer interesting new possibilities. for example: promises are a great new feature for performing asynchronous operations and making sure those operations are complete before code that relies on their results is used for something else. as an example, the fetch api (a modern equivalent to xmlhttprequest) uses promises to fetch resources across the network and make sure that the response has been returned before they are used (for example, displaying an image inside an <img> element). they are not supported in ie at all but are supported across all modern browsers. arrow functions provide a shorter, more convenient syntax for writing anonymous functions, which also has other advantages...
Setting up your own test automation environment - Learn web development
er.get('http://www.google.com'); note: see the webdriver class reference for details of the features in this section and the ones below it. you can use any url to point to your resource, including a file:// url to test a local document: driver.get('file:///users/chrismills/git/learning-area/tools-testing/cross-browser-testing/accessibility/fake-div-buttons.html'); or driver.get('http://localhost:8888/fake-div-buttons.html'); but it is better to use a remote server location so the code is more flexible — when you start using a remote server to run your tests (see later on), your code will break if you try to use local paths. add this line to the bottom of quick_test.js now: driver.get('http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/accessibility/native-key...
...e place, like in your home directory. if you've not already added the location to your path, do so now (see the setting up selenium in node section). run the standalone server by entering the following into a terminal on your server computer java -jar selenium-server-standalone-3.0.0.jar (update the .jar filename) so it matches exactly what file you've got. the server will run on http://localhost:4444/wd/hub — try going there now to see what you get. now we've got the server running, let's create a demo test that will run on the remote selenium server. create a copy of your google_test.js file, and call it google_test_remote.js; put it in your project directory. update the second code block (which starts with let driver = ...) like so let driver = new webdriver.builder() ...
...you get. now we've got the server running, let's create a demo test that will run on the remote selenium server. create a copy of your google_test.js file, and call it google_test_remote.js; put it in your project directory. update the second code block (which starts with let driver = ...) like so let driver = new webdriver.builder() .forbrowser('firefox') .usingserver('http://localhost:4444/wd/hub') .build(); run your test, and you should see it run as expected; this time however you will be runing it on the standalone server: node google_test_remote.js so this is pretty cool. we have tested this locally, but you could set this up on just about any server along with the relevant browser drivers, and then connect your scripts to it using the url you choose to exp...
IPDL Tutorial
messages can be sent from the parent to the child, init() and shutdown(). one message can be sent from the child to the parent, ready(). ipdl protocols start with the letter p. the file in which the protocol is declared must have a matching name, pplugin.ipdl. generated c++ code when pplugin.ipdl is compiled, the headers ppluginparent.h, and ppluginchild.h will be generated in the ipc/ipdl/_ipdlheaders/ directory of the build tree. the ppluginparent and ppluginchild classes are abstract classes that must be subclassed. each outgoing message is a c++ method which can be called. each incoming message is a pure-virtual c++ method which must be implemented: class ppluginparent { public: bool sendinit(const nscstring& pluginpath) { // generated code to send an init() message } bool...
... // in a .ipdl file include foo; synchronous and rpc messaging up until now, all the messages have been asynchronous. the message is sent, and the c++ method returns immediately.
... // in a .ipdl file include foo; synchronous and rpc messaging up until now, all the messages have been asynchronous. ...
Building NSS
0 build for a 32-bit environment/abi. this is the default. 1 build for a 64-bit environment/abi. this is recommended. use_asan 0 do not create an addresssanitizer build. this is the default. 1 create an addresssanitizer build. unit testing nss contains extensive unit tests. scripts to run these are found in the tests directory. run the standard suite by: host=localhost domsuf=localdomain use_64=1 nss/tests/all.sh unit test configuration nss tests are configured using environment variables. the scripts will attempt to infer values for host and domsuf, but can fail. replace localhost and localdomain with the hostname and domain suffix for your host. you need to be able to connect to $host.$domsuf. if you don't have a domain suffix you can add an entry to /e...
... remove the use_64=1 override if using a 32-bit build. test results running all tests can take a considerable amount of time. ...
... remove the use_64=1 override if using a 32-bit build. test results running all tests can take a considerable amount of time. test output is stored in tests_results/security/$host.$number/. the file results.html summarizes the results, output.log captures all the test output. ...
Places Developer Guide
the history service provides methods for adding, editing, deleting browser history. it's also the jump-off point for querying and searching the history and bookmarks collections. while nsinavhistory is the main interface for history, there are a couple of other interfaces available for legacy and context-specific uses: nsibrowserhistory - detailed page addition and removal methods nsiglobalhistory2 - simple page detection and addition nsiglobalhistory3 - for adding document redirects adding to history places provides a couple of interfaces for adding to, and editing the browsing history. the main interface is nsinavhistoryservice. other interfaces that provide specialized abilities are nsibrowserhistory and nsiglobalhistory. examples of the capabilities of each are provided below.
... url, with a page title and visited time // via nsibrowserhistory. ...
...tle and visited time // via nsibrowserhistory. var browserhistory = histsvc.queryinterface(ci.nsibrowserhistory); var oururi = uri("http://www.mozilla.com"); var pagetitle = "mozilla"; var visitdate = date.now() * 1000; // in microseconds browserhistory.addpagewithdetails(oururi, "mozilla", visitdate); // add a visit to a url, with extended behavior information // via nsiglobalhistory3. var globalhistory = cc["@mozilla.org/browser/global-history;2"]. getservice(ci.nsiglobalhistory2); var oururi = uri("http://www.mozilla.com"); var isredirect = false; var istoplevel = true; globalhistory.adduri(oururi, isredirect, istoplevel, referreruri); globalhistory.setpagetitle(oururi, "mozilla"); deleting from history // places deals in uris, so here's a helper for creating them. f...
Detailed XPCOM hashtable guide
structures are more efficient. mozilla's hashtable implementations mozilla has several hashtable implementations, which have been tested and, tuned, and hide the inner complexities of hashtable implementations: pldhash - low-level c api; stores keys and data in one large memory structure; uses the heap efficiently; client must declare an "entry class" and may not hold onto entry pointers. plhashtable - low-level c api; entry class pointers are constant; more efficient for large entry structures; often wastes memory making many small heap allocations. nsthashtable - low-level c++ wrapper around pldhash; generates callback functions and handles most casting automagically. client writes their own entry class which can include complex key and data types. nsdatahashtable/nsinterfacehasht...
... easily avoided. you must declare an entry struct type, deriving from pldhashentryhdr. this entry struct should contain whatever data you wish to store in the hashtable (any pointer or fixed-length data type). note: because of the double-hashing implementation, entries may move in memory when the hashtable is altered. if you need entry pointers to remain constant, you may want to consider using plhashtable instead. you must also initialize a pldhashtableops structure. this serves similarly to a vtable in c++, with pointers to appropriate user-defined functions that initialize, compare, and match entries. because pldhash does not know what datatype your key is, all functions that work with keys are declared using const void*, and your client code must cast these pointers to the appropriate ...
...id*, and your client code must cast these pointers to the appropriate type. pldhashtables can be allocated on the stack or the heap: when allocated on the stack, or as a c++ class member, the table must be initialized using pl_dhashtableinit, and finalized using pl_dhashtablefinish; when allocated on the heap, use pl_newdhashtable and pl_dhashtabledestroy to allocate and delete the table. plhashtable plhashtable is a part of nspr. the header file can be found at nsprpub/lib/ds/plhash.h. in general, pldhash is a better solution than plhashtable, because plhashtable makes many heap allocations. there are two situations where plhashtable may be preferable to pldhash: you need entry-pointers to remain constant. the entries stored in the table are very large (larger than 12 words). p...
nsIAppShellService
setoplevelwindow(in nsixulwindow awindow); obsolete since gecko 1.8 void createhiddenwindow(in nsiappshell aappshell); native code only! ...
...wheight the height to make the initial window(s) opened. return value true if a window was opened. createtoplevelwindow() this method creates a window, which will be initially invisible. nsixulwindow createtoplevelwindow( in nsixulwindow aparent, in nsiuri aurl, in boolean ashowwindow, in boolean aloaddefaultpage, in pruint32 achromemask, in long ainitialwidth, in long ainitialheight, in nsiappshell aappshell ); parameters aparent the parent window. can be null. aurl the contents of the new window. ashowwindow obsolete since gecko 1.8 the window remains invisible if pr_false. aloaddefaultpage obsolete since gecko 1.8 controls whether the window should try to load a default content page on its own. achromemask chrome flags affecting the kind of os border g...
...r the window should try to load a default content page on its own. achromemask chrome flags affecting the kind of os border given to the window. (see nsibrowserwindow for bit/flag definitions). ainitialwidth width, in pixels, of the window. width of window at creation. can be overridden by the "width" tag in the xul. set to ns_sizetocontent to force the window to wrap to its contents. ainitialheight height, in pixels, of the window. height of window at creation. can be overridden by the "height" tag in the xul. set to ns_sizetocontent to force the window to wrap to its contents. aappshell a widget "appshell" (event processor) to associate with the new window. return value returns the newly created window. destroyhiddenwindow() destroys a hidden window. void destroyhiddenwindow...
nsIAuthPrompt
this method puts up a text input dialog with ok and cancel buttons. boolean prompt( in wstring dialogtitle, in wstring text, in wstring passwordrealm, in pruint32 savepassword, in wstring defaulttext, out wstring result ); parameters dialogtitle the title of the dialog. text the text of the prompt message dialog box. passwordrealm the password realm. for example, ldap://localhost/dc=test. savepassword saving password option. one of the save_password_* constants defaulttext the default text for the text input dialog box. result the result of the dialog box, ok or cancel buttons. return value true for ok, false for cancel. promptpassword() this method puts up a password dialog with ok and cancel buttons. note: if a username is specified, the username should b...
...and cancel buttons. note: if a username is specified, the username should be escaped. boolean promptpassword( in wstring dialogtitle, in wstring text, in wstring passwordrealm, in pruint32 savepassword, inout wstring pwd ); parameters dialogtitle the title of the dialog. text the text of the prompt message dialog box. passwordrealm the password realm. for example, ldap://localhost/dc=test. if a username is specified (http://user@site.com) it will be used when matching existing logins or saving new ones. if no username is specified, only password-only logins will be matched or saved. savepassword saving password option. one of the save_password_* constants pwd the password entered by the user if ok was selected. return value true for ok, false for cancel. promptu...
... username/password dialog with ok and cancel buttons. boolean promptusernameandpassword( in wstring dialogtitle, in wstring text, in wstring passwordrealm, in pruint32 savepassword, inout wstring user, inout wstring pwd ); parameters dialogtitle the title of the dialog. text the text of the prompt message dialog box. passwordrealm the password realm. for example, ldap://localhost/dc=test. savepassword saving password option. one of the save_password_* constants user the username entered in the dialog. pwd the password entered by the user if ok was selected. return value true for ok, false for cancel. ...
Autoconfiguration in Thunderbird
e same machine as other web servers, but the web server must be configured to the content to any requested domain. you must use a virtual host that match all autoconfig.* domains of your customers. in apache terms, you can use a "ip-based virtual host". in the apache configuration files, that means something like: listen 10.2.3.4:80 (of course, you use a public ip address that you own) <virtualhost 10.2.3.4:80> #must be the first and only virtual host with this ip! documentroot /var/www/autoconfig/ servername autoconfig.hoster.com <directory /var/www/autoconfig> order allow,deny allow from all </directory> </virtualhost> place the configuration file at the url /mail/config-v1.1.xml on that host. all config files must be served as content-type: text/xml (or application...
...e the file will be ignored. also, they must use charset utf-8 (esp. if there are any non-ascii-characters). if you like to use name-based virtual hosts you probably don't want to setup the autoconfig subdomain for every domain of your customers. ...
...iterule in the default virtual host (on debian /etc/apache2/sites-enabled/000-default) to match all autoconfig.* subdomains: <virtualhost *:80> #must be the first virtual host serveradmin webmaster@hoster.com servername www documentroot /var/www rewriteengine on rewritecond %{http_host} ^autoconfig\. [nc] rewriterule ^/(.*) http://autoconfig.hoster.com/$1 [l,r=301,ne] #... </virtualhost> <virtualhost *:80> documentroot /var/www/autoconfig/ servername autoconfig.hoster.com <directory /var/www/autoconfig> order allow,deny allow from all </directory> </virtualhost> if you use nginx, you can easily add a subdomain to all your domains, which does the same as above. either, you can redirect them to a common hostname: server { listen 10.2.3.4:80; #use your ser...
BaseAudioContext.decodeAudioData() - Web APIs
the decoded audiobuffer is resampled to the audiocontext's sampling rate, then passed to a callback or promise. this is the preferred method of creating an audio source for web audio api from an audio track. this method only works on complete file data, not fragments of audio file data. ...
...k. this method only works on complete file data, not fragments of audio file data. syntax older callback syntax: baseaudiocontext.decodeaudiodata(arraybuffer, successcallback, errorcallback); newer promise-based syntax: promise<decodeddata> baseaudiocontext.decodeaudiodata(arraybuffer); parameters arraybuffer an arraybuffer containing the audio data to be decoded, usually grabbed from xmlhttprequest, windoworworkerglobalscope.fetch() or filereader. successcallback a callback function to be invoked when the decoding successfully finishes. the single argument to this callback is an audiobuffer representing the decodeddata (the decoded pcm audio data). usually you'll want to put the decoded data into an audiobuffersourcenode, from which it can be played and manipulated how you want.
...pre = document.queryselector('pre'); var myscript = document.queryselector('script'); var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); // use xhr to load an audio track, and // decodeaudiodata to decode it and stick it in a buffer. ...
Web-based protocol handlers - Web APIs
ocol handlers allow web-based applications to participate in the process too. this is becoming more important as more types of applications migrate to the web. in fact, there are many web-based email handling applications that could process a mailto link. registering setting up a web application as a protocol handler is not a difficult process. basically, the web application uses registerprotocolhandler() to register itself with the browser as a potential handler for a given protocol. for example: navigator.registerprotocolhandler("web+burger", "http://www.google.co.uk/?uri=%s", "burger handler"); where the parameters are: the protocol. the url template, used as the handler. the "%s" is replaced with the href of the ...
...ocol handler is already registered. therefore, it is a good idea to guard your call to register the protocol handler with a check to see if it is already registered, such as in the example below. ...
...tocol handler sample - handler</h1> <p>this web page is called when handling a <code>web+burger:</code> protocol action. the data sent:</p> <textarea> <?php echo(htmlspecialchars($value, ent_quotes, 'utf-8')); ?> </textarea> </body> </html> references http://www.w3.org/tr/2011/wd-html5-20110525/timers.html#custom-handlers see also window.navigator.registercontenthandler nsiprotocolhandler (xul only) registerprotocolhandler enhancing the federated web at mozilla webdev register a custom protocolhandler at google developers. ...
SubtleCrypto.importKey() - Web APIs
ybuffer-to-and-from-string */ function str2ab(str) { const buf = new arraybuffer(str.length); const bufview = new uint8array(buf); for (let i = 0, strlen = str.length; i < strlen; i++) { bufview[i] = str.charcodeat(i); } return buf; } const pemencodedkey = `-----begin private key----- miievqibadanbgkqhkig9w0baqefaascbkcwggsjageaaoibaqdd0tpv/du2vftjvxj1t/gxtk39snbvroaeb/jkzxae+xa0h+3lhzaqiqnmfacibsgifzuvegb+7tqxwqpolofr/r7mvgwcsk98jyrvtved8zmzyyitsy7m2hcasqafikyoouv5vzyre87/leyzzbpf3bqq4idaqu+k9hj5fkuu6rroeohsdnjc+vddqlschxvmolz9vtt+ok9j4/tolwr4cg8khdlburcby6gpclo3dpu09sw+6ctx2cx4mkxx6o/0mmdtmacr/vu50kdrmlefezyowpaehhmfywybtuzbipvizvp8wfcsknmbfi1s9a9pdbqnebwwhhx3/hsebt2bagmbaaecggeabei1p6nf6zs7mjlybdv+pfl5rjl2coqly6tovvzvblmkcppjyfunipdk2tk2i897zaxfhpdbikmllm2hq6jzqkb110oantpdg...
...vegb+7tqxwqpolofr/r7mvgwcsk98jyrvtved8zmzyyitsy7m2hcasqafikyoouv5vzyre87/leyzzbpf3bqq4idaqu+k9hj5fkuu6rroeohsdnjc+vddqlschxvmolz9vtt+ok9j4/tolwr4cg8khdlburcby6gpclo3dpu09sw+6ctx2cx4mkxx6o/0mmdtmacr/vu50kdrmlefezyowpaehhmfywybtuzbipvizvp8wfcsknmbfi1s9a9pdbqnebwwhhx3/hsebt2bagmbaaecggeabei1p6nf6zs7mjlybdv+pfl5rjl2coqly6tovvzvblmkcppjyfunipdk2tk2i897zaxfhpdbikmllm2hq6jzqkb110oantpdg0jxzmiihps32s1d/kilhjgff4hjd4nxp1l1dp8bupollorr2tym2x6dccgfw9lhtr8o03qp4hjn84vjgiwadyck83mgs4nrsnhkdiqynwx1ajkly51yek6rcrdmi0th2rxrrinoc35svv+apt2rkomgi52rwtesea1kzgfrxjq61rejif6p2vxecvhex6cwlx014lgk43z6q28p6hgeevefijyqcuea5du/myb/qsrscosxlxbqwqkbgqd1+fdc9zimrvi+km7nx2ckbn8rjrdmuh5sbxn2myjdrud8bynnzkcgkmgxvxsvjrbmvorby2txoiqudzkk5md3e5o/qzwpwqlgru8ueynpobax9nrgnfz7rzd+81vh5mfzixfuzouzv29izhu0oqyz9y75ehkldrernkwyoe5au...
... = 0, strlen = str.length; i < strlen; i++) { bufview[i] = str.charcodeat(i); } return buf; } const pemencodedkey = `-----begin public key----- miibijanbgkqhkig9w0baqefaaocaq8amiibcgkcaqeay3xo3u13dc+xojwqywojlcboq5fovy8llnqcjm1w1bftxihoajwohihuirmctv7dzx47tllmarskvtrjd0df92jx/xy20lz+dxp8yl5yuwafga3xko3lsjgeoex10nb8jfkmgsb7qiudtvvbbudfd5fwibmctacwwx7nyewwdb7a9cfxj7ejrdrdak3ux/tomlhfxvlqsl341tkcf4zqoz96rfpugpplofvn0x66cm1pqckdhzje6u5xge964zkkyuppsy6dcie4obhw4vdjgumlzv0z7ud010rlineugde2fqbfy/c+uwignpbpkkq+bv/uigs6dhqtcved5wgybqidaqab -----end public key-----`; function importrsakey(pem) { // fetch the part of the pem string between header and footer const pemheader = "-----begin public key-----"; const pemfooter = "-----end public key-----"; const pemconten...
Web Authentication API - Web APIs
associating a new asymmetric key pair credentials with an existing account. navigator.credentials.get() - when used with the publickey option, uses an existing set of credentials to authenticate to a service, either logging a user in or as a form of second-factor authentication. please note: both create() and get() require a secure context (e.g. - the server is 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...
...ope of the web authentication api. server sends challenge, user info, and relying party info - the server sends a challenge, user information, and relying party information to the javascript program. the protocol for communicating with the server is not specified and is outside of the scope of the web authentication api. typically, server communications would be rest over https (probably using xmlhttprequest or fetch), but they could also be soap, rfc 2549 or nearly any other protocol provided that the protocol is secure. the parameters received from the server will be passed to the create() call, typically with little or no modification and returns a promise that will resolve to a publickeycredential containing an authenticatorattestationresponse. note that it is absolutely critical that t...
...authentication request. the protocol and format of this request is outside of the scope of the web authentication api. server sends challenge - the server sends a challenge to the javascript program. the protocol for communicating with the server is not specified and is outside of the scope of the web authentication api. typically, server communications would be rest over https (probably using xmlhttprequest or fetch), but they could also be soap, rfc 2549 or nearly any other protocol provided that the protocol is secure. the parameters received from the server will be passed to the get() call, typically with little or no modification. note that it is absolutely critical that the challenge be a buffer of random information (at least 16 bytes) and it must be generated on the server in order ...
Using Web Workers - Web APIs
once created, a worker can send messages to the javascript code that created it by posting messages to an event handler specified by that code (and vice versa). this article provides a detailed introduction to using web workers. web workers api a worker is an object created using a constructor (e.g. ...
...tem of messages — both sides send their messages using the postmessage() method, and respond to messages via the onmessage event handler (the message is contained within the message event's data attribute.) the data is copied rather than shared. workers may, in turn, spawn new workers, as long as those workers are hosted within the same origin as the parent page. in addition, workers may use xmlhttprequest for network i/o, with the exception that the responsexml and channel attributes on xmlhttprequest always return null. dedicated workers as mentioned above, a dedicated worker is only accessible by the script that called it. in this section we'll discuss the javascript found in our basic dedicated worker example (run dedicated worker): this allows you to enter two numbers to be multipl...
...and want to use workers in extensions and have access to js-ctypes in your worker. see chromeworker for more details. audio worklet provide the ability for direct scripted audio processing to be done in a worklet (a lightweight version of worker) context. functions and interfaces available in workers you can use most standard javascript features inside a web worker, including: navigator xmlhttprequest array, date, math, and string windowtimers.settimeout and windowtimers.setinterval the main thing you can't do in a worker is directly affect the parent page. this includes manipulating the dom and using that page's objects. you have to do it indirectly, by sending a message back to the main script via dedicatedworkerglobalscope.postmessage, then actioning the changes from there. ...
Border-radius generator - CSS: Cascading Style Sheets
"> </div> <div id="radius-ui-sliders"> <div id="tlr" class="ui-input-slider" data-topic="top-left" data-unit=" px" data-sensivity="2"></div> <div id="tlw" class="ui-input-slider" data-topic="top-left-w" data-unit=" px" data-sensivity="2"></div> <div id="tlh" class="ui-input-slider" data-topic="top-left-h" data-unit=" px" data-sensivity="2"></div> <div id="trr" class="ui-input-slider" data-topic="top-right" data-unit=" px" data-sensivity="2"></div> <div id="trw" class="ui-input-slider" data-topic="top-right-w" data-unit=" px" data-sensi...
... data-unit=" px" data-sensivity="2"></div> <div id="blr" class="ui-input-slider" data-topic="bottom-left" data-unit=" px" data-sensivity="2"></div> <div id="blw" class="ui-input-slider" data-topic="bottom-left-w" data-unit=" px" data-sensivity="2"></div> <div id="blh" class="ui-input-slider" data-topic="bottom-left-h" data-unit=" px" data-sensivity="2"></div> </div> </div> </div> </div> <div id="controls" class="group section"> <div class="group section"> <div id="dimensions"> <div class="ui-input-slider" data-topic="width" data-info="width" ...
...order-bottom-left-radius: 100%; bottom: 0; } /* input sliders */ #preview .ui-input-slider { margin: 10px; position: absolute; z-index: 10; } #radius-ui-sliders { width: 100%; height: 100%; min-height: 75px; min-width: 150px; padding: 20px 50px; top: -20px; left: -50px; position: relative; } #tlr { top: -30px; left: -50px; display: none; } #tlw { top: -30px; left: 30px; } #tlh { top: 20px; left: -50px; } #trr { top: -30px; right: -50px; display: none; } #trw { top: -30px; right: 30px; } #trh { top: 20px; right: -50px; } #brr { bottom: -30px; right: -50px; display: none; } #brw { bottom: -30px; right: 30px; } #brh { bottom: 20px; right: -50px; } #blr { bottom: -30px; left: -50px; display: none; } #blw { bottom: -30px; left: 30px; } #blh { ...
<length> - CSS: Cascading Style Sheets
Web › CSS › length
. if used on the font-size property itself, it represents the inherited font-size of the element. ex represents the x-height of the element's font. on fonts with the "x" letter, this is generally the height of lowercase letters in the font; 1ex ≈ 0.5em in many fonts. ic equal to the used advance measure of the "水" (cjk water ideograph, u+6c34) glyph found in the font used to render it. ...
...when used on the font-size or line-height properties of the root element, it refers to the properties' initial value. ...
... result.style.width = inputelem.value; result.innerhtml = `<code>width: ${inputelem.value}</code>`; resultsdiv.appendchild(result); inputelem.value = ''; inputelem.focus(); }) result specifications specification status comment css values and units module level 4the definition of '<length>' in that specification. editor's draft adds the vi, vb, ic, lh, and rlh units. css values and units module level 3the definition of '<length>' in that specification. candidate recommendation adds the ch, rem, vw, vh, vmin, vmax, and q units. css level 2 (revision 1)the definition of '<length>' in that specification. recommendation explicit definition of the em, pt, pc, and px units. css level 1the definition of '<length...
Index - Developer guides
Web › Guide › Index
found 43 pages: # page tags and summary 1 developer guides api, guide, landing, web these articles provide how-to information to help make use of specific web technologies and apis. ...
...t a technology in itself, is a term coined in 2005 by jesse james garrett, that describes a "new" approach to using a number of existing technologies together 3 community ajax if you know of useful mailing lists, newsgroups, forums, or other communities related to ajax, please link to them here. 4 getting started ajax, api, advanced, javascript, webmechanics, xmlhttprequest this article guides you through the ajax basics and gives you some simple hands-on examples to get you started. 5 wai aria live regions/api support ajax, accessibility firefox 3 contains important improvements to the way the mozilla engine exposes live changes in a document. 6 audio and video delivery audio, guide, html, html5, media, video ...
...of powerful desktop systems as well as for handheld devices with less power. there are several tools available to check the performance of a website or blog. the most notable tools are listed below. 37 parsing and serializing xml ajax, add-ons, dom, dom parsing, document, extensions, guide, htmldocument, json, parsing, parsing xml, serializing, serializing xml, xml, xmldocument, xmlhttprequest in this article, we'll look at the objects provided by the web platform to make the common tasks of serializing and parsing xml easy. 38 printing dom, guide, needscontent, needsrelocation, printing there may be times in which your web site or application would like to improve the user's experience when printing content. there are a number of possible scenarios...
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
transformations through the xsltprocessor object. once instantiated, an xsltprocessor has an xsltprocessor.importstylesheet() method that takes as an argument the xslt stylesheet to be used in the transformation. the stylesheet has to be passed in as an xml document, which means that the .xsl file has to be loaded by the page before calling xsltprocessor.importstylesheet(). ...
...transformation. the stylesheet has to be passed in as an xml document, which means that the .xsl file has to be loaded by the page before calling xsltprocessor.importstylesheet(). this can be done via xmlhttprequest or xmldocument.load(). ...
...lesheet has to be passed in as an xml document, which means that the .xsl file has to be loaded by the page before calling xsltprocessor.importstylesheet(). this can be done via xmlhttprequest or xmldocument.load(). figure 1 : instantiating an xsltprocessor var xsltprocessor = new xsltprocessor(); // load the xsl file using synchronous (third param is set to false) xmlhttprequest var myxmlhttprequest = new xmlhttprequest(); myxmlhttprequest.open("get", "example.xsl", false); myxmlhttprequest.send(null); var xslref = myxmlhttprequest.responsexml; // finally import the .xsl xsltprocessor.importstylesheet(xslref); for the actual transformation, xsltprocessor requires an xml document, which is used in conjunction with the imported xsl file to produce the final result. the ...
Loading and running WebAssembly code - WebAssembly
of an exported memory: var i32 = new uint32array(obj.instance.exports.memory.buffer); // or access the elements of an exported table: var table = obj.instance.exports.table; console.log(table.get(0)()); }) note: for more information on how exporting from a webassembly module works, have a read of using the webassembly javascript api, and understanding webassembly text format. using xmlhttprequest xmlhttprequest is somewhat older than fetch, but can still be happily used to get a typed array. again, assuming our module is called simple.wasm: create a new xmlhttprequest() instance, and use its open() method to open a request, setting the request method to get, and declaring the path to the file we want to fetch. the key part of this is to set the response type to 'arraybuffer...
...ill be happily used to get a typed array. again, assuming our module is called simple.wasm: create a new xmlhttprequest() instance, and use its open() method to open a request, setting the request method to get, and declaring the path to the file we want to fetch. the key part of this is to set the response type to 'arraybuffer' using the responsetype property. next, send the request using xmlhttprequest.send(). we then use the onload event handler to invoke a function when the response has finished downloading — in this function we get the array buffer from the response property, and then feed that into our webassembly.instantiate() method as we did with fetch. ...
...fer' using the responsetype property. next, send the request using xmlhttprequest.send(). we then use the onload event handler to invoke a function when the response has finished downloading — in this function we get the array buffer from the response property, and then feed that into our webassembly.instantiate() method as we did with fetch. the final code looks like this: request = new xmlhttprequest(); request.open('get', 'simple.wasm'); request.responsetype = 'arraybuffer'; request.send(); request.onload = function() { var bytes = request.response; webassembly.instantiate(bytes, importobject).then(results => { results.instance.exports.exported_func(); }); }; note: you can see an example of this in action in xhr-wasm.html. ...
request - Archive of obsolete content
globals constructors request(options) this constructor creates a request object that can be used to make network requests. the constructor takes a single parameter options which is used to set several properties on the resulting request. ...
...t").request; var quijote = request({ url: "http://www.latin1files.org/quijote.txt", overridemimetype: "text/plain; charset=latin1", oncomplete: function (response) { console.log(response.text); } }); quijote.get(); anonymous boolean if true, the request will be sent without cookies or authentication headers. this option sets the mozanon property in the underlying xmlhttprequest object. defaults to false. request the request object is used to make get, head, post, put, or delete network requests. it is constructed with a url to which the request is sent. optionally the user may specify a collection of headers and content to send alongside the request and a callback which will be executed once the request completes. once a request object has been create...
Getting started (cfx) - Archive of obsolete content
nstaller add-on: this listens for new xpi files on a specified port and installs them automatically. that way you can test new changes without needing to restart the browser: make a change to your add-on run cfx xpi post the add-on to the port specified you could even automate this workflow with a simple script. for example: while true ; do cfx xpi ; wget --post-file=codesy.xpi http://localhost:8888/ ; sleep 5 ; done note that the logging level defined for the console is different when you use this method, compared to the logging level used when an add-on is run using cfx run. this means that if you want to see output from console.log() messages, you'll have to tweak a setting. see the documentation on logging levels for the details on this. another example using grunt and grunt-s...
...documentation on logging levels for the details on this. ...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
opening binary files listing 13 shows how to get a files contents as a bytestring (where 1 byte = an array of 8 bits). save a text ...
... opening binary files listing 13 shows how to get a files contents as a bytestring (where 1 byte = an array of 8 bits). save a text file containing only the ascii characters "xul" and put in the path to that file. runni...
JXON - Archive of obsolete content
mage="black_cardigan.jpg">black</color_swatch> </size> </catalog_item> </product> <script type="text/javascript"><![cdata[function matchwo(a,b) { if (a < b && a < 0) { return 1; } else { return 0; } }]]></script> </catalog> first, create a dom tree like the previous example as described in the how to create a dom tree article. if you have already have a dom tree from using xmlhttprequest, skip to the next paragraph. note: if you are using an instance of xmlhttprequest in order to retrieve your xml file, please use the yourrequest.responsexml property to get a parsed xml document. don't use yourrequest.responsetext! the algorithms proposed here (see: #1, #2, #3, #4) will consider only the following types of nodes and their attributes: document (only as function argu...
... jxon.build parameters document the xml document to be converted into json format. verbosity optional the verbosity level of convers...
Helper Apps (and a bit of Save As) - Archive of obsolete content
warning: the content of this article may be out of date. it was last updated in 2002. bird's eye view flow of control uriloader tries to find a content listener for the mime type in question. when this fails, uriloader asks an nsiexternalhelperappservice to handle the load. the nsexternalhelperappservice looks up the nsimimeinfo for the load and creates an nsihelperapplauncher to manage the load. the nsexternalapphandler (which implements nsihelperapplauncher) uses the nsimimeinfo and an nsihelperapplauncherdialog to decide what to do with the data. the nsexternalapphandler does whatever it decided to do. nsimimeinfo lookup look in built-in list which the user cannot override (types we handle internally). look in user preferences. ask the os: registry on wind...
...pphandler to let it know what the user picked saving to disk if a user decides to "save to disk", we just move/copy the temporary file over to the chosen location once the download completes. if an error occurs while we do this we delete the temp file and put up an error dialog. launching a helper application this is delegated to the nspiexternalapplauncher (also implemented by the nsexternalhelperapphandler): windows: launch either directly via nsiprocess or via the ::shellexecute() method depending on where the mimeinfo came from. last-ditch check for executable files here. mac: use the launchwithdoc() method on nsilocalfilemac. unix: launch directly via nsiprocess. security considerations multiple checks for whether a file is executable (on windows) to keep from launching suc...
Twitter - Archive of obsolete content
note: this page documents the jetpack prototype, which is no longer under active development. read the experiment report for what we learned from it and the blog post announcing the first sdk release for what we're up to next! jetpack's twitter library, jetpack.lib.twitter, is a very simple, lightweight layer on top of twitter's rest api. in fact it's hardly more than syntactic sugar for doing xmlhttprequests. to use this library, you therefore need to be familiar with twitter's own api. (it's easy!) methods each method in twitter's api maps to a method here. for example, the twitter method for tweeting, statuses/update, maps to jetpack.lib.twitter.statuses.update(). to call trends/current, use jetpack.lib.twitter.trends.current(). for search, jetpack.lib.twitter.search(). replace slashes w...
...wo special, optional properties: success and error. success is a function that's called when the request successfully completes, and error is a function called when it fails to complete. the library simply passes them to jquery.ajax(), and so they are called like so: success(data, textstatus) data is twitter's decoded json response. textstatus is a simple string describing the status. error(xmlhttprequest, textstatus, errorthrown) xmlhttprequest is the xhr used in the request. textstatus is a simple string describing the type of error. errorthrown is an exception object, if one was thrown. the examples below all use this first, simpler style. the second style will be familiar if you have used jquery.ajax() -- in fact the object is passed as-is (almost) to it. in other words, define a...
slideBar - Archive of obsolete content
idebar is a reinvention of the old sidebar features of browsers. they allow quick access to a wide range of both temporary and permanent information at the side of your browser window. when a slidebar feature is selected its contents will be revealed from behind the current webpage. it currently under development and lives in the future. ...
... its contents will be revealed from behind the current webpage. it currently under development and lives in the future. jetpack.future.import("slidebar"); methods append(iconurihtmlhtml/xmlurluriwidthintpersistboolautoreloadboolonclickfunctiononselectfunctiononreadyfunction)this is a list of options to specify modifications to your slidebar instance. ...
Plug-n-Hack Phase1 - Archive of obsolete content
anifest is published. the tool configures itself by serving an html document (we’ll call this the configuration document) to the browser. this can cause the browser to inspect the manifest and register the tool by firing a customevent with the type configuresectool and a properties object which specifies the url of the tool manifest. for example: var manifest = {"detail":{"url":"http://localhost:8080/manifest"}}; var evt = new customevent('configuresectool', manifest); it is suggested that browsers wishing to support pnh restrict handling of customevents such that they’re ignored where the event happens outside of user initiated actions. the configuration document should then listen for a number of other events: configuresectoolstarted - this notifies the document that the b...
...notifies the document that pnh support (perhaps previously unavailable, e.g. due to a missing addon) has been enabled. you can see an example of a configuration document in the zap pnh addon. there’s another (possibly out of date) example here. an example manifest (for owasp zap) is: { "toolname":"owasp zap", "protocolversion":"0.2", "features":{ "proxy":{ "pac":"http://localhost:8080/proxy.pac", "cacert":"http://localhost:8080/other/core/other/rootcert/" }, "commands":{ "prefix":"zap", "manifest":"http://localhost:8080/other/mitm/other/service/" } } } the top level manifest includes optional links to a proxy pac and a root ca certificate. it also optionally links to another manifest which describes the commands the browser can invoke. s...
URIs and URLs - Archive of obsolete content
ri scheme is represented by a protocol handler. sometimes a protocol handler represents more than one scheme. the protocol handler provides scheme specific information and methods to create new uris of the schemes it supports. one of the main necko goals is to provide a "plug able" protocol support. this means that it should be possible to add new protocols to necko just by implementing nsiprotocolhandler and nsichannel. it also might be necessary to implement a new urlparser for a new protocol but that might not be necessary because necko already provides uri implementations that can deal with a number of schemes, by implementing the generic urlparser defined in rfc 2396. nsiuri and nsiurl in a strict sense necko does only know urls, uris by the above definition are much too generic to be p...
...s 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 authority segment, like "http". noauthority these urls have no or a degenerated authority segment, like the "file" scheme. also this parser can identify drives if possible depending on the platform. standard it is not known if an authority segment exists or not, less syntax correction...
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
es, xul reference no summary! 43 buttonlabelcancel xul attributes, xul reference no summary! 44 buttonlabeldisclosure xul attributes, xul reference no summary! 45 buttonlabelextra1 xul attributes, xul reference no summary! 46 buttonlabelextra2 xul attributes, xul reference no summary! 47 buttonlabelhelp xul attributes, xul reference no summary! 48 buttonorient xul attributes, xul reference no summary! 49 buttonpack xul attributes, xul reference no summary! 50 buttons xul attributes, xul reference no summary! 51 checkstate xul attributes, xul reference no summary! 52 checkbox.src xul at...
... xul attributes, xul reference no summary! 96 disablechrome xul, xul attribute, xul reference no summary! 97 disableclose xul attributes, xul reference no summary! 98 disabled xul attributes, xul reference no summary! 99 disablefastfind xul, xul attribute, xul reference no summary! 100 disableglobalhistory no summary! 101 disablehistory no summary! 102 disablesecurity xul attributes, xul reference no summary! 103 dlgtype xul attributes, xul reference no summary! 104 dragging xul attributes, xul reference no summary! 105 drawintitlebar no summary! 106 droppedlinkhand...
Property - Archive of obsolete content
ordinal orient pack pagecount pageid pageincrement pageindex pagestep parentcontainer palette persist persistence placeholder pmindicator popup popupboxobject popupopen position predicate preferenceelements preferencepanes preferences priority radiogroup readonly readonly ref resource resultspopup scrollboxobject scrollincrement scrollheight scrollwidth searchbutton searchcount searchlabel searchparam searchsessions second secondleadingzero securityui selected selectedbrowser selectedcount selectedindex selecteditem selecteditems selectedpanel selectedtab selectionend selectionstart selstyle seltype sessioncount sessionhistory showcommentcolumn showpopup size smoothscroll ...
...hild dom:element.lastchild dom:element.lastelementchild dom:element.localname dom:element.namespaceuri dom:element.nextelementsibling dom:element.nextsibling dom:element.nodename dom:element.nodetype dom:element.nodevalue dom:element.ownerdocument dom:element.parentnode dom:element.prefix dom:element.previouselementsibling dom:element.previoussibling dom:element.scrollheight dom:element.scrollleft dom:element.scrolltop dom:element.scrollwidth dom:element.tagname dom:element.textcontent ...
XUL Structure - Archive of obsolete content
y of the features can be shared between both. however, there are some features that are specific to html, such as forms, and others which are specific to xul, such as overlays. since xul and html are handled in the same way, you can load both from either your local file system, from a web page, or from an extension or standalone xulrunner application. content from remote sources (e.g. http://localhost/~username/ ), regardless of whether they are html or xul or another document type, are limited in the type of operations they can perform, for security reasons. for this reason, mozilla provides a method of installing content locally and registering the installed files as part of its chrome system. this allows a special url form, called a chrome:// url, to be used. by accessing a file using a ...
...ed. both html and xul placed on a web site have no extra permissions; however both html and xul loaded through a chrome url have enhanced permissions. remote xul was disabled in firefox 8, so the following is of historic interest only. if you are going to use xul on a web site, you can just put the xul file on the web site as you would an html file, and then load its url in a browser http://localhost/xul.php. ensure that your web server is configured to send xul files with the content type of application/vnd.mozilla.xul+xml (eg with php header('content-type: application/vnd.mozilla.xul+xml');). this content type is how mozilla knows the difference between html and xul. mozilla does not use the file extension, unless reading files from the file system, but you should use the .xul extension ...
browser - Archive of obsolete content
refox web browser, or because you'd like to download the latest version of firefox? get firefox most of the properties and methods of the browser will rarely be used and can only be called from chrome urls. other urls will need to use the document and history objects to change the displayed document. ...
...sed to hold autocomplete results for the element. autoscroll type: boolean set to false to disable autoscroll for this browser. if this attribute is set to true or omitted, autoscroll will be enabled or depending on the user preference general.autoscroll. disablehistory type: boolean disables both session and global history for the docshell attached to the browser. disableglobalhistory type: boolean disables global history for the docshell attached to the browser while keeping session history active. disablesecurity type: boolean set this attribute to true to disable the security ui for this browser. omit this attribute off to enable it. droppedlinkhandler type: function this function is called when links are dropped to the browser element, with the fo...
dialog - Archive of obsolete content
ore information is available in the xul tutorial and dialogs and prompts (code snippets). ...
...el to appear on the "accept" button. buttonlabelcancel type: string the label to appear on the "cancel" button. buttonlabeldisclosure type: string the label to appear on the "disclosure" button. buttonlabelextra1 type: string the label to appear on the first extra button. buttonlabelextra2 type: string the label to appear on the second extra button. buttonlabelhelp type: string the label to appear on the "help" button. buttonorient type: string the value of the orient attribute for the box containing the buttons. buttonpack type: string the value of the pack attribute for the box containing the buttons. buttons type: comma-separated list of the values below a comma-separated list of buttons to appear in the dialog box. the butto...
Summary of Changes - Archive of obsolete content
rted by mozilla 1.5+ and is a perfect equivalent to innertext. ...
....5+ and is a perfect equivalent to innertext. ...
Collision detection - Game development
bject and the group. brick/ball collision detection the physics engine makes everything a lot easier — we just need to add two simple pieces of code. ...
...etween ball and bricks, as shown below: function update() { game.physics.arcade.collide(ball, paddle); game.physics.arcade.collide(ball, bricks, ballhitbrick); paddle.x = game.input.x || game.world.width*0.5; } the ball's position is calculated against the 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 def...
Randomizing gameplay - Game development
all is bouncing off the paddle at the same angle throughout the whole game. this means that every game is quite similar. to fix this and improve playability we should make the rebound angles more random, and in this article we'll look at how. ...
...improve playability we should make the rebound angles more random, and in this article we'll look at how. making rebounds more random we can change the ball's velocity depending on the exact spot it hits the paddle, by modifying the x velocity each time the ballhitpaddle() function is run using a line along the lines of the below. add this new line to your code now, and try it out. function ballhitpaddle(ball, paddle) { ball.animations.play('wobble'); ball.body.velocity.x = -1*5*(paddle.x-ball.x); } it's a little bit of magic — the new velocity is higher, the larger the distance between the center of the paddle and the place where the ball hits it. also, the direction (left or right) is determined by that value — if the ball hits the left side of the paddle it will bounce lef...
Win the game - Game development
« previousnext » this is the 12th step out of 16 of the gamedev phaser tutorial. you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson12.html. implementing winning in our game is quite easy: if you happen to destroy all the bricks, then you win. ...
...ousnext » this is the 12th step out of 16 of the gamedev phaser tutorial. you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson12.html. implementing winning in our game is quite easy: if you happen to destroy all the bricks, then you win. ...
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
var j; var xincludeparent = xinclude.parentnode; try { netscape.security.privilegemanager.enableprivilege('universalxpconnect universalbrowserread'); // necessary with file:///-located files trying to reach external sites if (href !== null) { var response, responsetype; var request = new xmlhttprequest(); request.open('get', href, false); request.setrequestheader('if-modified-since', 'thu, 1 jan 1970 00:00:00 gmt'); request.setrequestheader('cache-control', 'no-cache'); if (accept) { request.setrequestheader('accept', accept); } if (acceptlang...
...2]; } else { encodingtype = 'utf-8'; } // need to make a whole new request apparently since cannot convert the encoding after receiving it (to know what the encoding was) var request2 = new xmlhttprequest(); request2.overridemimetype('text/plain; charset='+encodingtype); request2.open('get', href, false); request2.setrequestheader('if-modified-since', 'thu, 1 jan 1970 00:00:00 gmt'); request2.setrequestheader('cache-control', 'no-cache'); ...
Index - Learn web development
, javascript, learn, webgl at this point, you should have a useful idea of the basics of graphics programming using canvas and webgl and what you can do with these apis, as well as a good idea of where to go for further information. have fun! 59 fetching data from the server api, article, beginner, codingscripting, fetch, json, javascript, learn, promises, server, xhr, xml, xmlhttprequest, data, request this article shows how to start working with both xhr and fetch to fetch data from the server. 60 introduction to web apis 3rd party, api, article, beginner, browser, codingscripting, learn, object, webapi, client-side at this point, you should have a good idea of what apis are, how they work, and what you can do with them in your javascript cod...
... this validation because it has no way to truly know what has really happened on the client-side. 324 sending forms through javascript advanced, example, forms, forms guide, guide, html, html forms, javascript, learn, security, web, web forms html forms can send an http request declaratively. but forms can also prepare an http request to send via javascript, for example via xmlhttprequest. this article explores such approaches. 325 styling web forms beginner, css, example, forms, guide, html, learn, web as you can see, as long as we want to build forms with just text fields and buttons, it's easy to style them using css. in the next article, we will see how to handle form widgets which fall into the "bad" and "ugly" categories. 326 test yo...
Choosing the right approach - Learn web development
ing with the result. this is the precursor to promises; it's not as efficient or flexible. use only when necessary. useful for... ...
...y. useful for... ...
Working with JSON - Learn web development
const header = document.queryselector('header'); const section = document.queryselector('section'); we have made our json data available on our github, at https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json. we are going to load it into our page, and use some nifty dom manipulation to display it, like this: obtaining the json to obtain the json, we use an api called xmlhttprequest (often called xhr). this is a very useful javascript object that allows us to make network requests to retrieve resources from a server via javascript (e.g. images, text, json, even html snippets), meaning that we can update small sections of content without having to reload the entire page. this has led to more responsive web pages, and sounds exciting, but it is beyond the scope of th...
...ting, but it is beyond the scope of this article to teach it in much more detail. to start with, we store the url of the json we want to retrieve in a variable. add the following at the bottom of your javascript code: let requesturl = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json'; to create a request, we need to create a new request object instance from the xmlhttprequest constructor, using the new keyword. add the following below your last line: let request = new xmlhttprequest(); now we need to open the request using the open() method. add the following line: request.open('get', requesturl); this takes at least two parameters — there are other optional parameters available. we only need the two mandatory ones for this simple example: ...
Getting started with Ember - Learn web development
sible. this goes some way towards fixing one of the major accessibility disadvantages of the default todomvc app. ...
...ilar to the following: build successful (190ms) – serving on http://localhost:4200/ slowest nodes (totaltime >= 5%) | total (avg) -----------------------------------------+----------- broccolimergetrees (17) | 35ms (2 ms) package /assets/vendor.js (1) | 13ms concat: vendor styles/assets/vend... (1) | 12ms the development server launches at http://localhost:4200, which you can visit in your browser to check out what your work looks like so far. if everything is working correctly, you should see a page like this: note: on windows systems without windows subsystem for linux (wsl), you will experience slower build-times overall compared to macos, linux, and windows with wsl. summary so far so good. we've got to the point where we can start b...
Ember app structure and componentization - Learn web development
es/application.hbs. this already exists, and its contents currently look like so: {{!-- the following component displays ember's default welcome message. --}} <welcomepage /> {{!-- feel free to remove this! --}} {{outlet}} <welcomepage /> is a component provided by an ember addon that renders the default welcome page we saw in the previous article, when we first navigated to our server at localhost:4200. however, we don't want this. instead, we want it to contain the todomvc app structure. to start with, delete the contents of application.hbs and replace them with the following: <section class="todoapp"> <h1>todos</h1> <input class="new-todo" aria-label="what needs to be done?" placeholder="what needs to be done?" autofocus > </section> note: aria-label provide...
... notice how the todo items both say "buy movie tickets" — this is because the same component is being invoked twice, and the todo text is hardcoded into it. we'll look at showing different todo items in the next article! summary great! everything looks as it should. we have successfully refactored our html int...
Getting started with React - Learn web development
oz-todo-react --use-npm create-react-app will display a number of messages in your terminal while it works; this is normal! this might take a few minutes, so now might be a good time to go make a cup of tea. when the process is complete, cd into the moz-todo-react directory and run the command npm start. the scripts installed by create-react-app will start being served at a local server at localhost:3000, and open the app in a new browser tab. your browser will display something like this: application structure create-react-app gives us everything we need to develop a react application. its initial file structure looks like this: moz-todo-react ├── readme.md ├── node_modules ├── package.json ├── package-lock.json ├── .gitignore ├── public │ ├...
...t would cause problems here in our code. a few other html attributes are written differently in jsx than they are in html too, for the same kind of reason. we'll cover them as we encounter them. take a moment to change the <p> tag on line 6 so that it reads "hello, world!", then save your file. you'll notice that this change is immediately rendered in the development server running at http://localhost:3000 in your browser. now delete the <a> tag and save; the "learn react" link will be gone. your app component should now look like this: function app() { return ( <div classname="app"> <header classname="app-header"> <img src={logo} classname="app-logo" alt="logo" /> <p> hello, world! </p> </header> </div> ); } export statements at...
Introducing a complete toolchain - Learn web development
nges in your code and automatically install your dependencies. this is nice because we don't have to flit back and forth between the code and the command line. to start parcel off in the background, go to your terminal and run the following command: npx parcel src/index.html you should see an output like this (once the dependencies have been installed): server running at http://localhost:1234 ✨ built in 129ms. parcel also installs the dependencies that we will use in our code, including react, react-dom, react-async-hook, date-fns, and format-number. this first run will therefore be longer than a typical run of parcel. note: if you run parcel on this project and are faced with an error that reads error: enoent: no such file or directory, stop the process using ctrl...
...react, react-dom, react-async-hook, date-fns, and format-number. this first run will therefore be longer than a typical run of parcel. note: if you run parcel on this project and are faced with an error that reads error: enoent: no such file or directory, stop the process using ctrl + c and then try re-running it. the server is now running on the url that was printed (in this case localhost:1234). go to this url in your browser and you will see the example app running! another clever trick parcel has up its sleeve is that any changes to your source code will now trigger an update in the browser. to try this out: load up the file src/components/app.js in your favorite text editor. search for the text "near misses", and replace it with something silly like "fl...
Using JavaScript code modules
via the statement: components.utils.import("resource://foo/bar.js"); programmatically adding aliases custom aliases to paths that can be represented as an nsilocalfile can be programmatically added as well. ...
...g aliases custom aliases to paths that can be represented as an nsilocalfile can be programmatically added as well. ...
PL_HashString
returns the hash number for the specified key. ...
... returns the hash number for the specified key. ...
PL_HashTableDestroy
description pl_hashtabledestroy frees all the entries in the table and the table itself. ...
... description pl_hashtabledestroy frees all the entries in the table and the table itself. ...
Index
wfpbjeembwga1ueaxmvq2vydglmawnhdgugqxv0ag9yaxr5mb4xdtew mdqyotixnty1ofoxdteymdqxodixnty1ofowotexmbuga1uechmorxhhbxbszsbe b21haw4xhjacbgnvbamtfunlcnrpzmljyxrlief1dghvcml0etccasiwdqyjkozi hvcnaqebbqadggepadccaqocggebao/bquli2kwqxfkmmmg93kn1sanzntxa/vlf tmrih3hqgjvr1ktiy9ag6cb7dskwmthp/+p4pucmql4zrsgt901qxkepyz2dymm2 rnelk+seuipiutozadhndiyse/yude8vqwj0vhcvl0w72qfucsq/wzt7fcrnuiui udewnopsun70glhcj/lvxl7k9bhyd4sq5czktwytfwliiwv+zy/fl6jgbgaqyqb2 bp4irmflogqsxgub1evwvdf1hagpfdspgmnepslg3/3dxn+hdjbz29eu8/xkzqeb 3v0ahkbu80zglllet2zx/wdirgjen9ymfgkfpcml+bvirsmh0vscaweaaaobqzcb qdafbgnvhsmegdawgbqatgxhqyrufkiztdp55bzlfr+tfzapbgnvhrmbaf8ebtad aqh/ma4ga1uddweb/wqeawibxjadbgnvhq4efgquae4mr0mkvhyigbxaeew2zra/ rrcwrqyikwybbquhaqeeota3mdugccsgaqufbzabhilodhrwoi8vbg9jywxob3n0 lmxvy2fszg9tywluojk...
...the keys generated for certificates are stored separately, in the key database. ...
nss tech note2
ose information, including template values, array values, etc. to enable this mode, set: nspr_log_modules=nss_mod_log:4 nspr_log_file=<logfile> the output format is the same as above, but with more information. ...
...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 i...
NSS tools : certutil
wfpbjeembwga1ueaxmvq2vydglmawnhdgugqxv0ag9yaxr5mb4xdtew mdqyotixnty1ofoxdteymdqxodixnty1ofowotexmbuga1uechmorxhhbxbszsbe b21haw4xhjacbgnvbamtfunlcnrpzmljyxrlief1dghvcml0etccasiwdqyjkozi hvcnaqebbqadggepadccaqocggebao/bquli2kwqxfkmmmg93kn1sanzntxa/vlf tmrih3hqgjvr1ktiy9ag6cb7dskwmthp/+p4pucmql4zrsgt901qxkepyz2dymm2 rnelk+seuipiutozadhndiyse/yude8vqwj0vhcvl0w72qfucsq/wzt7fcrnuiui udewnopsun70glhcj/lvxl7k9bhyd4sq5czktwytfwliiwv+zy/fl6jgbgaqyqb2 bp4irmflogqsxgub1evwvdf1hagpfdspgmnepslg3/3dxn+hdjbz29eu8/xkzqeb 3v0ahkbu80zglllet2zx/wdirgjen9ymfgkfpcml+bvirsmh0vscaweaaaobqzcb qdafbgnvhsmegdawgbqatgxhqyrufkiztdp55bzlfr+tfzapbgnvhrmbaf8ebtad aqh/ma4ga1uddweb/wqeawibxjadbgnvhq4efgquae4mr0mkvhyigbxaeew2zra/ rrcwrqyikwybbquhaqeeota3mdugccsgaqufbzabhilodhrwoi8vbg9jywxob3n0 lmxvy2fszg9tywluojk...
...the keys generated for certificates are stored separately, in the key data...
sslfnc.html
cket, ssl invokes it whenever ssl needs to know what certificate and private key (if any) to use to respond to a request for client authentication. ssl_handshakecallback sets up a callback function used by ssl to inform either a client application or a server application when the handshake is completed. syntax #include "ssl.h" secstatus ssl_handshakecallback( prfiledesc *fd, sslhandshakecallback cb, void *client_data); parameters this function has the following parameters: fd a pointer to the file descriptor for the ssl socket. cb a pointer to the application's callback function. client_data a pointer to the value of the client_data argument that was passed to ssl_handsh...
...data a pointer to the value of the client_data argument that was passed to ssl_handshakecallback. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to obtain the error code. description the callback function set by ssl_handshakecallback has the following prototype: typedef void (*sslhandshakecallback)( prfiledesc *fd, void *client_data); this callback function has the following parameters: fd a pointer to the file descriptor for the ssl socket. client_data a pointer supplied by the application that can be used to pass state information. can be null. see also ssl communication functions m...
certutil
wfpbjeembwga1ueaxmvq2vydglmawnhdgugqxv0ag9yaxr5mb4xdtew mdqyotixnty1ofoxdteymdqxodixnty1ofowotexmbuga1uechmorxhhbxbszsbe b21haw4xhjacbgnvbamtfunlcnrpzmljyxrlief1dghvcml0etccasiwdqyjkozi hvcnaqebbqadggepadccaqocggebao/bquli2kwqxfkmmmg93kn1sanzntxa/vlf tmrih3hqgjvr1ktiy9ag6cb7dskwmthp/+p4pucmql4zrsgt901qxkepyz2dymm2 rnelk+seuipiutozadhndiyse/yude8vqwj0vhcvl0w72qfucsq/wzt7fcrnuiui udewnopsun70glhcj/lvxl7k9bhyd4sq5czktwytfwliiwv+zy/fl6jgbgaqyqb2 bp4irmflogqsxgub1evwvdf1hagpfdspgmnepslg3/3dxn+hdjbz29eu8/xkzqeb 3v0ahkbu80zglllet2zx/wdirgjen9ymfgkfpcml+bvirsmh0vscaweaaaobqzcb qdafbgnvhsmegdawgbqatgxhqyrufkiztdp55bzlfr+tfzapbgnvhrmbaf8ebtad aqh/ma4ga1uddweb/wqeawibxjadbgnvhq4efgquae4mr0mkvhyigbxaeew2zra/ rrcwrqyikwybbquhaqeeota3mdugccsgaqufbzabhilodhrwoi8vbg9jywxob3n0 lmxvy2fszg9tywluojk...
...the keys generated for certificates are stored separately, in the key database. ...
Necko Interfaces Overview
warning: the content of this article may be out of date. it was last updated in 2001. nsiioservice central necko service manages protocol handlers thin layer over protocol handlers provides interface for creating uri objects from uri strings maps uri scheme to appropriate nsiprotocolhandler impl nsiuri (nsiurl, nsifileurl, nsistandardurl) represents an uri, with getters and setters for various uri parts (eg. scheme, host, path, ...) per protocol implementation necko provides uri impl's for common uri formats (see nsstandardurl, nssimpleuri) nsichannel : nsirequest represents a logical connection to the resource identified by a nsiuri per protocol implementation single use (ie. channel is used to download the resource once) download initiated via nsichannel:...
...on uri formats (see nsstandardurl, nssimpleuri) nsichannel : nsirequest represents a logical connection to the resource identified by a nsiuri per protocol implementation single use (ie. channel is used to download the resource once) download initiated via nsichannel::asyncopen method can be canceled via nsirequest::cancel method at anytime after invocation of asyncopen method nsiprotocolhandler a service that manages a protocol, identified by it's uri scheme (eg. http) maps uri string to nsiuri instance via newuri method creates nsichannel instance from nsiuri instance via newchannel method nsistreamlistener : nsirequestobserver implemented by the consumer of a nsichannel instance passed to nsichannel::asyncopen method nsirequestobserver::onstartrequest - notifies start ...
JSAPI User Guide
nd jsapi. what spidermonkey does the javascript engine compiles and executes scripts containing javascript statements and functions. the engine handles memory allocation for the objects needed to execute scripts, and it cleans up—garbage collects—objects it no longer needs. the word javascript may bring to mind features such as event handlers (like onclick), dom objects, window.open, and xmlhttprequest. but in mozilla, all of these features are actually provided by other components, not the spidermonkey engine itself. spidermonkey provides a few core javascript data types—numbers, strings, arrays, objects, and so on—and a few methods, such as array.push. it also makes it easy for each application to expose some of its own objects and functions to javascript code. browsers expose d...
... "[no filename]", (unsigned int) report->lineno, message); } int run(jscontext *cx) { // enter a request before running anything in the context. jsautorequest ar(cx); // create the global object and a new compartment. rootedobject global(cx); global = js_newglobalobject(cx, &globalclass, nullptr, js::dontfireonnewglobalhook); if (!global) return 1; // enter the new global object's compartment. jsautocompartment ac(cx, global); // populate the global object with the standard globals, like object and // array. if (!js_initstandardclasses(cx, global)) return 1; // your application code here. this may include jsapi calls to create your // own custom js objects and ru...
Feed content access API
o parse an rss or atom feed to receive notification when parsing is complete. nsifeedtextconstruct represents text values in a feed; includes functions that let you fetch the text as plain text or html. nsiscriptableunescapehtml a utility class that unescapes html strings. example: reading a feed from the web it's actually quite easy to read and parse a feed. use an xmlhttprequest to load the feed, then pass its string to an nsifeedprocessor to parse the feed. loading the feed and sending it to the parser is done using code similar to this: fetch: function(feedurl) { var httprequest = null; function inforeceived() { var data = httprequest.responsetext; var ioservice = components.classes['@mozilla.org/network/io-service;1'] ...
...howeve...
nsIBrowserHistory
toolkit/components/places/public/nsibrowserhistory.idlscriptable a browser-specific interface to global history. it adds functions used by the basic browser like, marking pages as typed in the url bar, and removing pages as from the history interface. inherits from: nsiglobalhistory2 last changed in gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) implemented by: @mozilla.org/browser/nav-history-service;1. to use this service, use: var browserhistory = components.classes["@mozilla.org/browser/nav-history-service;1"] .getservice(components.interfaces.nsibrowserhistory); method overview void addpagewithdetails(in nsiuri auri, in wstring atitle, in long long alastvisited); obsolete since gecko 15.0 void markpageasfollowedli...
...e as no longer being open (either by closing the window or tab, or by navigating away from that page). note: this method was an alias for moziplacesautocomplete.unregisteropenpage(), which still exists and can be used instead. void unregisteropenpage( in nsiuri auri ); parameters auri the page to unregister as an open page. see also places using the places history service nsiglobalhistory2 ...
nsIPushSubscription
key: string.fromc...
... key: string.fromcharcode.apply(null, btoa(subscription.getkey("p256dh"))), ...
nsISelectionController
; short getdisplayselection(); nsiselection getselection(in short type); void intralinemove(in boolean forward, in boolean extend); void linemove(in boolean forward, in boolean extend); void pagemove(in boolean forward, in boolean extend); void repaintselection(in short type); void scrollhorizontal(in boolean left); void scrollline(in boolean forward); void scrollpage(in boolean forward); void scrollselectionintoview(in short type, in short region, in short flags); void selectall(); void setcaretenabled(in boolean enabled); void setcaretreadonly(in boolean readonly); void...
...t point adjusted by the selection. void pagemove( in boolean forward, in boolean extend ); parameters forward forward or backward if pr_false extend should it collapse the selection or extend it? repaintselection() repaints the selection specified. void repaintselection( in short type ); parameters type specifies the selection to repaint. scrollhorizontal() will scroll left or right dependent on the boolean. void scrollhorizontal( in boolean left ); parameters left if true will scroll left. if not will scroll right. scrollline() will scroll line up or down dependent on the boolean. void scrollline( in boolean forward ); parameters forward scroll forward or backwards in selection. scrollpage() will scr...
Index - Firefox Developer Tools
der where the features you loved in firebug are available in the developer tools. the following list aims to help firebug users to find their way into the developer tools. 46 network monitor debugging, dev tools, firefox, guide, networking, tools, l10n:priority the network monitor shows you all the network requests firefox makes (for example, when it loads a page, or due to xmlhttprequests), how long each request takes, and details of each request. 47 inspecting web sockets javascript, network monitor, webapis, web socket inspector, web sockets since firefox 71, the network monitor has had the ability to inspect web socket connections. this article explores what functionality the web socket inspector makes available. 48 network monitor rec...
... sometimes you want to view a value in your code but you don't want to pause execution. rather than sprinkle console.log() statements throughout your code, you can use a special type of breakpoint, the logpoint. logpoints print a message to the console panel instead of pausing code execution. 135 set an xhr breakpoint debugger, debugging, javascript, xhr breakpoint an xhr (xmlhttprequest) breakpoint breaks code execution when an xhr request is dispatched so that you can examine the current state of the program. you can break on all requests or on those that include a specific url. to turn on the feature: 136 set event listener breakpoints debugger, dev tools, event debugging, event handler, event listener, javascript debugging, tools, breakpoint, events ...
Network request list - Firefox Developer Tools
timeline the request list also displays a timeline for the different parts of each request. each timeline is given a horizontal position in its row relative to the other network requests, so you can see the total time taken to load the page. for more details on the col...
...t hover over the item. select unblock url. now when you refresh the page, the item will once enabled. note: (starting in firefox 80) you can also block and unblock urls from the web console, using the :block and :unblock helper commands. these accept any string, and affect any url containing the string. filtering requests you can filter requests by content type, by whether they are xmlhttprequests or websocket requests, or by request properties. filter type how to apply content type use the buttons in the toolbar (html, css, js). xhr requests use the xhr button in the toolbar. websocket connections use the ws button in the toolbar. you can filter by plain text (in which case the text is used to find partial matches; entering "...
Background Tasks API - Web APIs
sh, providing the updatedisplay() function to be called to handle that work. updating the display the updatedisplay() function is responsible for drawing the contents of the progress box and the log. it's called by the browser when the dom is in a safe condition for us to apply changes during the process of rendering the next frame. ...
...we'll use that to determine if we should update the scroll position to ensure that the log stays at the end when we're done adding content to it. next, we update the progress and status information if any tasks h...
Beacon API - Web APIs
the beacon interface is used to schedule an asynchronous and non-blocking request to a web server. beacon requests use the http post method and requests typically do not require a response. requests are guaranteed to be initiated before a page is unloaded and they are run to completion, without requiring a blocking request (for example xmlhttprequest). example use cases of the beacon api are logging activity and sending analytics data to the server. example code of the interfaces described in this document is included in using the beacon api. why use beacon? the beacon interface addresses the needs of analytics and diagnostics code that typically attempts to send data to a web server before unloading the document. sending the data any sooner may result in a missed opportunity ...
... the needs of analytics and diagnostics code that typically attempts to send data to a web server before unloading the document. sending the data any sooner may result in a missed opportunity to gather data. however, ensuring that the data is sent during the unloading of a document is something that has traditionally been difficult for developers. user agents will typically ignore asynchronous xmlhttprequests made in an unload handler. to solve this problem, analytics and diagnostics code will typically make a synchronous xmlhttprequest in an unload or beforeunload handler to submit the data. the synchronous xmlhttprequest forces the browser to delay unloading the document, and makes the next navigation appear to be slower. there is nothing the next page can do to avoid this perception of p...
CSS numeric factory functions - Web APIs
css.turn() are methods that return cssunitvalues with the value being the numeric argument and the unit being the name of the method used. these functions create new numeric values less verbosely than using the cssunitvalue.cssunitvalue() constructor. ...
...thods that return cssunitvalues with the value being the numeric argument and the unit being the name of the method used. these functions create new numeric values less verbosely than using the cssunitvalue.cssunitvalue() constructor. ...
Determining the dimensions of elements - Web APIs
...
...ss of how much of it is currently visible, you need to use the element.scrollwidth and element.scrollheight properties. these return the width and height of the entire content of an element, even if only part of it is presently visible due to the use of scroll bars. for example, if a 600x400 pixel element is being displayed inside a 300x300 pixel scrollbox, scrollwidth will return 600 while scrollheight will return 400. ...
CanvasRenderingContext2D.drawImage() - Web APIs
yid('source'); image.addeventlistener('load', e => { ctx.drawimage(image, 33, 71, 104, 124, 21, 20, 87, 104); }); result understanding source element size the drawimage() method uses the source element's intrinsic size in css pixels when drawing. for example, if you load an image and specify the optional size parameters in its constructor, you will have to use the naturalwidth and naturalheight properties of the created instance to properly calculate things like crop and scale regions, rather than element.width and element.height. the same goes for videowidth and videoheight if the element is a <video> element, and so on. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const image = new image(...
.../ using optional size for image image.onload = drawimageactualsize; // draw when image has loaded // load an image of intrinsic size 300x227 in css pixels image.src = 'https://udn.realityripple.com/samples/db/f374e9c6fc.jpg'; function drawimageactualsize() { // use the intrinsic size of image in css pixels for the canvas element canvas.width = this.naturalwidth; canvas.height = this.naturalheight; // will draw the image as 300x227, ignoring the custom size of 60x45 // given in the constructor ctx.drawimage(this, 0, 0); // to use the custom size we'll have to specify the scale parameters // using the element's width and height properties - lets draw one // on top in the corner: ctx.drawimage(this, 0, 0, this.width, this.height); } result specifications sp...
Element - Web APIs
Web › API › Element
r(s) of the element (i.e. set using the part attribute), returned as a domtokenlist. element.prefix read only a domstring representing the namespace prefix of the element, or null if no prefix is specified. nondocumenttypechildnode.previouselementsibling read only is a element, the element immediately preceding the given one in the tree, or null if there is no sibling element. element.scrollheight read only returns a number representing the scroll view height of an element. element.scrollleft is a number representing the left scroll offset of the element. element.scrollleftmax read only returns a number representing the maximum left scroll offset possible for the element. element.scrolltop a number representing number of pixels the top of the document is scrolled vertically...
...om parsing and serializationthe definition of 'element' in that specification. working draft added the following properties: innerhtml, and outerhtml. added the following method: insertadjacenthtml(). css object model (cssom) view modulethe definition of 'element' in that specification. working draft added the following properties: scrolltop, scrollleft, scrollwidth, scrollheight, clienttop, clientleft, clientwidth, and clientheight. added the following methods: getclientrects(), getboundingclientrect(), scroll(), scrollby(), scrollto() and scrollintoview(). element traversal specificationthe definition of 'element' in that specification. obsolete added inheritance of the elementtraversal interface. domthe definition of 'element' in that s...
Using Fetch - Web APIs
fetch provides a better alternative that can be easily used by other technologies such as service workers. ...
...l try to intelligently determine the content type. a request will also automatically set a content-type header if none is set in the dictionary. feature detection fetch api support can be detected by checking for the existence of headers, request, response or fetch() on the window or worker scope. for example: if (window.fetch) { // run my fetch request here } else { // do something with xmlhttprequest? } polyfill to use fetch in unsupported browsers, there is a fetch polyfill available that recreates the functionality for non-supporting browsers. specifications specification status comment fetch living standard initial definition ...
FormData - Web APIs
Web › API › FormData
it uses the same format a form would use if the encoding type were set to "multipart/form-data". you can also pass it directly to the urlsearchparams constructor if you want to generate query parameters in the way a <form> would do if it were using simple get submission. ...
... an iterator allowing to go through all keys of the key/value pairs contained in this object. formdata.set() sets a new value for an existing key inside a formdata object, or adds the key/value if it does not already exist. formdata.values() returns an iterator allowing to go through all values contained in this object. specifications specification status comment xmlhttprequestthe definition of 'formdata' in that specification. living standard formdata defined in xhr spec ...
FormDataEvent - Web APIs
htmlformelement object after the entry list representing the form's data is constructed. this happens when the form is submitted, but can also be triggered by the invocation of a formdata() constructor. this allows a formdata object to be quickly obtained in response to a formdata event firing, rather than needing to put it together yourself when you wish to submit form data via a method like xmlhttprequest (see using formdata objects). constructor formdataevent() creates a new formdataevent object instance. properties inherits properties from its parent interface, event. formdataevent.formdata contains the formdata object representing the data contained in the form when the event was fired. methods inherits methods from its parent interface, event. examples // grab refere...
... living standard ...
HTMLFormElement - Web APIs
specifications specification status comment html living standardthe definition of 'htmlformelement' in that specification. living standard the following method has been added: requestautocomplete(). html5the definition of 'htmlfor...
... vehicles</legend> <p><label><input type="checkbox" name="vehicle" value="bike">i have a bike</label></p> <p><label><input type="checkbox" name="vehicle" value="car">i have a car</label></p> </fieldset> <p><button>submit</button></p> </form> </body> </html> submitting forms and uploading files using xmlhttprequest if you want to know how to serialize and submit a form using the xmlhttprequest api, please read this paragraph. specifications specification status comment html living standardthe definition of 'htmlformelement' in that specification. living standard the following method has been added: requestautocomplete(). html5the definition of 'htmlformelement' in that specification. recommendation the elements properties ret...
HTMLImageElement.naturalWidth - Web APIs
turalwidth property returns the intrinsic (natural), density-corrected width of the image in css pixels. this is the width the image is if drawn with nothing constraining its width; if you neither specify a width for the image nor place the image inside a container that limits or expressly specifies the image width, this is the number of css pixels wide the image will be. the corresponding naturalheight method returns the natural height of the image. syntax let naturalwidth = htmlimageelement.naturalwidth; value an integer value indicating the intrinsic width of the image, in css pixels. this is the width at which the image is naturally drawn when no constraint or specific value is established for the image. this natural width is corrected for the pixel density of the device on which it...
...he css above is that the style used for the container the image will be drawn in is 200px wide, and the image will be drawn to fill its width (100%). javascript let output = document.queryselector(".output"); let image = document.queryselector("img"); window.addeventlistener("load", event => { output.innerhtml += `natural size: ${image.naturalwidth} x ` + `${image.naturalheight} pixels<br>`; output.innerhtml += `displayed size: ${image.width} x ` + `${image.height} pixels`; }); the javascript code simply dumps the natural and as-displayed sizes into the <div> with the class output. this is done in response to the window's load event handler, in order to ensure that the image is available before attempting to examine its width and height. ...
HTMLImageElement - Web APIs
ponding <map> which contains <area> elements indicating the clickable areas in the image. the image must be contained within an <a> element; see the ismap page for details. htmlimageelement.loading a domstring providing a hint to the browser used to optimize loading the document by determining whether to load the image immediately (eager) or on an as-needed basis (lazy). htmlimageelement.naturalheight read only returns an integer value representing the intrinsic height of the image in css pixels, if it is available; else, it shows 0. this is the height the image would be if it were rendered at its natural full size. htmlimageelement.naturalwidth read only an integer value representing the intrinsic width of the image in css pixels, if it is available; otherwise, it will show 0. this ...
...efinition of 'htmlimageelement' in that specification. recommendation a constructor (with 2 optional parameters) has been added. the following properties are now obsolete: name, border, align, hspace, vspace, and longdesc. the following properties are now unsigned long, instead of long: height, and width. the following properties have been added: crossorigin, naturalwidth, naturalheight, and complete. document object model (dom) level 2 html specificationthe definition of 'htmlimgelement' in that specification. obsolete the lowsrc property has been removed. the following properties are now long, instead of domstring: height, width, hspace, and vspace. document object model (dom) level 1 specificationthe definition of 'htmlimgelement' in that spec...
HTMLTextAreaElement - Web APIs
er specifications. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: input event fires when the value of an <input>, <select>, or <textarea> element has been changed. ...
...er() or by assigning an event listener to the oneventname property of this interface: input event fires when the value of an <input>, <select>, or <textarea> element has been changed. ...
Ajax navigation example - Web APIs
ajaxerror(); } } closereq(); } function filterurl (surl, sviewmode) { return surl.replace(rsearch, "") + ("?" + surl.replace(rhost, "&").replace(rview, sviewmode ? ...
...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+diaaah+qqjcgaaacwaaaaaeaaqaaadnai63p5ojcegg4qmu7dmikrxqlfuydezigbmrvsaqhwctxxf7weyb4ag1xjihkmzsiukkhiaifkecqoaaaasaaaaabaaeaaaazyiujijk8pbyjdmlfyvbovjha70gu7xsujhmktwhpakzlo9hmaokwjz7rf8aypddzkpzbqfvwqa...
Using IndexedDB - Web APIs
nload and store in the local * indexeddb database. the resource behind this url is subjected to the * "same origin policy", thus for this method to work, the url must come from * the same origin as the web site/app this code is deployed on. ...
...licy", thus for this method to work, the url must come from * the same origin as the web site/app this code is deployed on. ...
MediaSource - Web APIs
list. mediasource.setliveseekablerange() sets the range that the user can seek to in the media element. static methods mediasource.istypesupported() returns a boolean value indicating if the given mime type is supported by the current user agent — this is, if it can successfully create sourcebuffer objects for that mime type. examples the following simple example loads a video with xmlhttprequest, playing it as soon as it can. this example was written by nick desaulniers and can be viewed live here (you can also download the source for further investigation.) var video = document.queryselector('video'); var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4...
... recommendation initial definition. ...
Navigator.sendBeacon() - Web APIs
lytics and diagnostics that send data to a server before the document is unloaded, where sending the data any sooner may miss some possible data collection. for example, which link the user clicked before navigating away and unloading the page. ensuring that data has been sent during the unloading of a document has traditionally been difficult, because user agents typically ignore asynchronous xmlhttprequests made in an unload handler. historically, this was addressed with some of the following workarounds to delay the page unload long enough to send data to some url: submitting the data with a blocking synchronous xmlhttprequest call in unload or beforeunload event handlers. creating an <img> element and setting its src in the unload handler. most user agents will delay the unload to ...
... creating a no-op loop for several seconds in the unload handler. all of these methods block unloading the document, which slows down the next navigation. there is nothing the next page can do to avoid this, so the new page seems slow, even though it's the previous page's fault. the following example shows theoretical analytics code that attempts to submit data to a server with a synchronous xmlhttprequest in an unload handler. this results in the next page load to be delayed. window.addeventlistener("unload", function logdata() { var xhr = new xmlhttprequest(); xhr.open("post", "/log", false); // third parameter of `false` means synchronous xhr.send(analyticsdata); }); this is what sendbeacon() replaces. with the sendbeacon() method, the data is transmitted asynchronously when t...
Pointer events - Web APIs
ing example shows a pointer capture being released (when a pointercancel event occurs. the browser does this automatically when a pointerup or pointercancel event occurs. ...
...</div> </body> </html> touch-action css property the touch-action css property is used to specify whether or not the browser should apply its default (native) touch behavior (such as zooming or panning) to a region. ...
Resource Timing API - Web APIs
the resource timing interfaces enable retrieving and analyzing detailed network timing data regarding the loading of an application's resource(s). an application can use the timing metrics to determine, for example, the length of time it takes to load a specific resource, such as an xmlhttprequest, <svg>, image, or script. the interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, dns lookup start and end times, request start, response start and end times, etc. the interface also includes other properties that provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. this document provides an overview of the resource timing interfaces. for more de...
...tent-codings. decodedbodysize returns the size (in octets) received from the fetch (http or cache) of the message body, after removing any applied content-codings. other properties the nexthopprotocol property returns the network protocol used to fetch the resource. the initiatortype property returns the type of resource that initiated the performance entry such as "css" for a css resource, "xmlhttprequest" for an xmlhttprequest and "img" for an image (such as a jpeg). if the current context is a worker, the workerstart property can be used to obtain a domhighrestimestamp when the worker was started. methods the resource timing api includes two methods that extend the performance interface. the clearresourcetimings() method removes all "resource" type performance entries from the brows...
SVGAElement - Web APIs
svgaelement.download see htmlanchorelement.download. svgaelement.href see htmlanchorelement.href. svgaelement.hreflang is a domstring that reflects the hreflang attribute, indicating the language of the linked resource. ...
..._self"; } else { console.log("sorry! ...
Migrating from webkitAudioContext - Web APIs
thod to complete its work, and no other part of your web page's code could execute in the mean time. because of these problems, this version of the createbuffer() method has been removed, and you should use the asynchronous decodeaudiodata() method instead. ...
...onsetype = "arraybuffer"; xhr.send(); xhr.onload = function() { var decodedbuffer = context.createbuffer(xhr.response, false); if (decodedbuffer) { // decoding was successful, do something useful with the audio buffer } else { alert("decoding the audio buffer failed"); } }; converting this code to use decodeaudiodata() is relatively simple, as can be seen below: var xhr = new xmlhttprequest(); xhr.open("get", "/path/to/audio.ogg", true); xhr.responsetype = "arraybuffer"; xhr.send(); xhr.onload = function() { context.decodeaudiodata(xhr.response, function onsuccess(decodedbuffer) { // decoding was successful, do something useful with the audio buffer }, function onfailure() { alert("decoding the audio buffer failed"); }); }; note that the decodeaudiodata() me...
Functions and classes available to Web Workers - Web APIs
no support (yes) no support filereadersync this api allows synchronous read of blob and file objects. this is an api that works only in workers. 8 (8) no support no support no support formdata formdata objects provide a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the xmlhttprequest send() method. ? (should be in 39 (39)) ? (yes) ? imagedata the underlying pixel data of an area of a canvas element. manipulating such data can be a complex task better suited to be delegated to a web worker. 25 (25) no support no support no support indexeddb database to store records holding simple values and hierarchical objects. 37 ...
... interface available to workers. 3.6 (1.9.2) 10.0 (yes) (yes) workernavigator the subset of the navigator interface available to workers. basic implementation (yes) appcodename, product, taintenabled(): 28 (28) online: 29 (29) navigatorlanguage: (yes) appname, appversion, online, platform, useragent: 10.0 other: no support (yes) (yes) xmlhttprequest creates and returns a new xmlhttprequest object; this mimics the behavior of the standard xmlhttprequest() constructor. note that the responsexml and channel attributes on xmlhttprequest always return null. basic: 3.5 (1.9.1) response and responsetype are available since 10 (10) timeout and ontimeout are available since 13 (13) (yes) (yes) (yes) ...
Web APIs
Web › API
ment htmlbrelement htmlbaseelement htmlbasefontelement htmlbodyelement htmlbuttonelement htmlcanvaselement htmlcollection htmlcontentelement htmldlistelement htmldataelement htmldatalistelement htmldetailselement htmldialogelement htmldivelement htmldocument htmlelement htmlembedelement htmlfieldsetelement htmlfontelement htmlformcontrolscollection htmlformelement htmlframesetelement htmlhrelement htmlheadelement htmlheadingelement htmlhtmlelement htmlhyperlinkelementutils htmliframeelement htmlimageelement htmlinputelement htmlisindexelement htmlkeygenelement htmllielement htmllabelelement htmllegendelement htmllinkelement htmlmapelement htmlmarqueeelement htmlmediaelement htmlmenuelement htmlmenuitemelement htmlmetaelement htmlmeterelement htmlmodelement htmlolistelemen...
...shaderprecisionformat webglsync webgltexture webgltransformfeedback webgluniformlocation webglvertexarrayobject webkitcssmatrix websocket wheelevent window windowclient windoweventhandlers windoworworkerglobalscope worker workerglobalscope workerlocation workernavigator worklet writablestream writablestreamdefaultcontroller writablestreamdefaultwriter x xdomainrequest xmldocument xmlhttprequest xmlhttprequesteventtarget xmlhttprequestresponsetype xmlserializer xpathevaluator xpathexception xpathexpression xpathnsresolver xpathresult xrboundedreferencespace xrenvironmentblendmode xreye xrframe xrframerequestcallback xrhandedness xrinputsource xrinputsourcearray xrinputsourceevent xrinputsourceeventinit xrinputsourceschangeevent xrinputsourceschangeeventinit xrpermissiondescri...
CSS values and units - CSS: Cascading Style Sheets
height of capital letters) of the element's font. ch average character advance of a narrow glyph in the element’s font, as represented by the “0” (zero, u+0030) glyph. ic average character advance of a full width glyph in the element’s font, as represented by the “水” (cjk water ideograph, u+6c34) glyph. rem font size of the root element. lh line height of the element. rlh line height of the root element. vw 1% of viewport's width. vh 1% of viewport's height. vi 1% of viewport's size in the root element's inline axis. vb 1% of viewport's size in the root element's block axis. vmin 1% of viewport's smaller dimension. vmax 1% of viewport's larger dim...
...and clamp() functions.) some legacy functional notations such as rgba() use commas, but generally commas are only used to separate items in a list. if a comma is used to separate arguments, white space is optional before and after the comma. specifications specification status comment css values and units module level 4 editor's draft adds the vi, vb, ic, cap, lh and rlh units. adds the min(), max() and clamp() functional notation adds toggle() css values and units module level 3 candidate recommendation adds calc(), ch, rem, vw, vw, vmin, vmax, q css color module level 4 working draft adds commaless syntaxes for the rgb(), rgba(), hsl(), and hsla() functions. allows alpha values in rgb() and hsl(), turning rgba() and...
Mozilla CSS extensions - CSS: Cascading Style Sheets
se currentcolor instead. ...
...ead. ...
attr() - CSS: Cascading Style Sheets
Web › CSS › attr
value. <fallback> the value to be used if the associated attribute is missing or contains an invalid value. if not set, css will use the default value defined for each <type-or-unit>. ...
... <fallback> the value to be used if the associated attribute is missing or contains an invalid value. if not set, css will use the default value defined for each <type-or-unit>. ...
<color> - CSS: Cascading Style Sheets
hat the mouse pointer is over (which would be threedface or buttonface when the mouse pointer is not over it). should be used with the -moz-buttonhovertext foreground color. -moz-buttonhovertext the text color of a button that the mouse pointer is over (which would be buttontext when the mouse pointer is not over it). should be used with the -moz-buttonhoverface background color. -moz-cellhighlight background color for selected item in a tree widget. should be used with the -moz-cellhighlighttext foreground color. see also -moz-html-cellhighlight. -moz-cellhighlighttext text color for a selected item in a tree. should be used with the -moz-cellhighlight background color. see also -moz-html-cellhighlighttext. -moz-combobox background color for combo-boxes. should be u...
... be used with the -moz-dialogtext foreground color. -moz-dialogtext text color for dialog boxes. should be used with the -moz-dialog background color. -moz-dragtargetzone -moz-eventreerow background color for even-numbered rows in a tree. should be used with the -moz-fieldtext foreground color. in gecko versions prior to 1.9, use -moz-field. see also -moz-oddtreerow. -moz-html-cellhighlight background color for highlighted item in html <select>s. should be used with the -moz-html-cellhighlighttext foreground color. prior to gecko 1.9, use -moz-cellhighlight. -moz-html-cellhighlighttext text color for highlighted items in html <select>s. should be used with the -moz-html-cellhighlight background color. prior to gecko 1.9, use -moz-cellhighlighttext. -moz-mac-acc...
HTML5 - Developer guides
Web › Guide › HTML › HTML5
aphics to the web by introducing an api that closely conforms to opengl es 2.0 that can be used in html5 <canvas> elements. svg an xml-based format of vectorial images that can directly be embedded in the html. performance and integration web workers allows delegation of javascript evaluation to background threads, allowing these activities to prevent slowing down interactive events. xmlhttprequest level 2 allows fetching asynchronously some parts of the page, allowing it to display dynamic content, varying according to the time and user actions. this is the technology behind ajax. jit-compiling javascript engines the new generation of javascript engines is much more powerful, leading to greater performance. history api allows the manipulation of the browser history. this is ...
...drag and drop api allows support for dragging and dropping items within and between web sites. this also provides a simpler api for use by extensions and mozilla-based applications. focus management in html the new html5 activeelement and hasfocus attributes are supported. web-based protocol handlers you can now register web applications as protocol handlers using the navigator.registerprotocolhandler() method. requestanimationframe allows control of animations rendering to obtain optimal performance. fullscreen api controls the usage of the whole screen for a web page or application, without the browser ui displayed. pointer lock api allows locking the pointer to the content, so games and similar applications don't lose focus when the pointer reaches the window limit. online and ...
<a>: The Anchor element - HTML: Hypertext Markup Language
Web › HTML › Element › a
href the url that the hyperlink points to. links are not restricted to http-based urls — they can use any url scheme supported by browsers: sections of a page with fragment urls pieces of media files with media fragments telephone numbers with tel: urls email addresses with mailto: urls while web browsers may not support other url schemes, web sites can with registerprotocolhandler() hreflang hints at the human language of the linked url. no built-in functionality. allowed values are the same as the global lang attribute. ping a space-separated list of urls. when the link is followed, the browser will send post requests with the body ping to the urls. typically for tracking. referrerpolicy how much of the referrer to send when following the link. see referr...
...cluding a subject or body, see email links or rfc 6068. linking to telephone numbers <a href="tel:+49.157.0156">+49 157 0156</a> <a href="tel:+1(555)5309">(555) 5309</a> tel: link behavior varies with device capabilities: cellular devices autodial the number. most operating systems have programs that can make calls, like skype or facetime. websites can make phone calls with registerprotocolhandler, such as web.skype.com. other behaviors include saving the number to contacts, or sending the number to another device. see rfc 3966 for syntax, additional features, and other details about the tel: url scheme. using the download attribute to save a <canvas> as a png to save a <canvas> element’s contents as an image, you can create a link with a download attribute and the canvas data...
Access-Control-Allow-Credentials - HTTP
request, this indicates whether or not the actual request can be made using credentials. note that simple get requests are not preflighted, and so if a request is made for a resource with credentials, if this header is not returned with the resource, the response is ignored by the browser and not returned to web content. the access-control-allow-credentials header works in conjunction with the xmlhttprequest.withcredentials property or with the credentials option in the request() constructor of the fetch api. for a cors request with credentials, in order for browsers to expose the response to frontend javascript code, both the server (using the access-control-allow-credentials header) and the client (by setting the credentials mode for the xhr, fetch, or ajax request) must indicate that the...
... header forbidden header name no syntax access-control-allow-credentials: true directives true the only valid value for this header is true (case-sensitive). if you don't need credentials, omit this header entirely (rather than setting its value to false). examples allow credentials: access-control-allow-credentials: true using xhr with credentials: var xhr = new xmlhttprequest(); xhr.open('get', 'http://example.com/', true); xhr.withcredentials = true; xhr.send(null); using fetch with credentials: fetch(url, { credentials: 'include' }) specifications specification status comment fetchthe definition of 'access-control-allow-credentials' in that specification. living standard initial definition ...
CSP: connect-src - HTTP
note: connect-src 'self' does not resolve to websocket schemas in all browsers, more info: https://github.com/w3c/webappsec-csp/issues/7 csp version 1 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. ...
...g whitespace. see unsafe inline script for an example. in csp 2.0, this applied only to inline scripts. csp 3.0 allows it in the case of script-src for external scripts. examples violation cases given this csp header: content-security-policy: connect-src https://example.com/ the following connections are blocked and won't load: <a ping="https://not-example.com"> <script> var xhr = new xmlhttprequest(); xhr.open('get', 'https://not-example.com/'); xhr.send(); var ws = new websocket("https://not-example.com/"); var es = new eventsource("https://not-example.com/"); navigator.sendbeacon("https://not-example.com/", { ... }); </script> specifications specification status comment content security policy level 3the definition of 'connect-src' in t...
HTTP Index - HTTP
Web › HTTP › Index
peculative side channel attacks as well as cross-site script inclusion attacks. cross-origin resource policy complements cross-origin read blocking (corb), which is a mechanism to prevent some cross-origin reads by default. 20 cross-origin resource sharing (cors) ajax, cors, cross-origin resource sharing, fetch, fetch api, http, http access controls, same-origin policy, security, xmlhttprequest, l10n:priority cross-origin resource sharing (cors) is a mechanism that uses additional http headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. 21 cors errors cors, errors, http, https, messages, same-origin, security, console, troubleshooting cross-origin resource sharing (cors) is a...
....}) and navigator.credentials.get({publickey: ...,...}). 143 feature-policy: speaker audio, directive, feature-policy, http, reference, speaker the http feature-policy header speaker directive controls whether the current document is allowed to play audio via any methods. 144 feature-policy: sync-xhr directive, feature policy, feature-policy, http, reference, xmlhttprequest the http feature-policy header sync-xhr directive controls whether the current document is allowed to make synchronous xmlhttprequest requests. 145 feature-policy: unoptimized-images directive, feature-policy, http, image, reference the http feature-policy header unoptimized-images directive controls whether the current document is allowed to download and disp...
Redirections in HTTP - HTTP
r) redirect that links to a page indicating that the action has been scheduled, and eventually informs about its progress, or allows to cancel it. configuring redirects in common servers apache redirects can be set either in the server config file or in the .htaccess of each directory. ...
...nd eventually informs about its progress, or allows to cancel it. configuring redirects in common servers apache redirects can be set either in the server config file or in the .htaccess of each directory. ...
Mixed content - Web security
a about the user, using mixed active content still provides the attacker with the opportunity to redirect the user to other http pages and steal http cookies from those sites. active content examples this section lists some types of http requests which are considered active content: <script> (src attribute) <link> (href attribute) (this includes css stylesheets) <iframe> (src attribute) xmlhttprequest requests fetch() requests all cases in css where a <url> value is used (@font-face, cursor, background-image, and so forth). <object> (data attribute) navigator.sendbeacon (url attribute) other resource types like web fonts and workers may be considered active mixed content, as they are in chrome. warnings in web console the firefox web console displays a mixed content warning m...
...safari does not allow any mixed content. ...
Understanding WebAssembly text format - WebAssembly
en the stack must contain exactly one f32 at the end. if there is no result type, the stack must be empty. our first function body as mentioned before, the function body is simply a list of instructions that are followed as the function is called. putting this together with what we have already learned, we can finally define a module containing our own simple function: (module (func (param $lhs i32) (param $rhs i32) (result i32) local.get $lhs local.get $rhs i32.add)) this function gets two parameters, adds them together, and returns the result. there are a lot more things that can be put inside function bodies, but we will start off simple for now, and you’ll see a lot more examples as you go along. for a full list of the available opcodes, consult the webassembly.org ...
...ded by a dollar sign, just after the func keyword: (func $add … ) now we need to add an export declaration — this looks like so: (export "add" (func $add)) here, add is the name the function will be identified by in javascript whereas $add picks out which webassembly function inside the module is being exported. so our final module (for now) looks like this: (module (func $add (param $lhs i32) (param $rhs i32) (result i32) local.get $lhs local.get $rhs i32.add) (export "add" (func $add)) ) if you want to follow along with the example, save the above our module into a file called add.wat, then convert it into a binary file called add.wasm using wabt (see converting webassembly text format to wasm for details). next, we’ll load our binary into a typed array called...
Content Scripts - Archive of obsolete content
cked",' + ' {detail:node.href});' + ' window.dispatchevent(event);' + '});' }); cross-domain content scripts by default, content scripts don't have any cross-domain privileges. in particular, they can't access content hosted in an iframe, if that content is served from a different domain, or make cross-domain xmlhttprequests. however, you can enable these features for specific domains by adding them to your add-on's package.json under the "cross-domain-content" key, which itself lives under the "permissions" key. see the article on cross-domain content scripts. ...
core/promise - Archive of obsolete content
will need to create a promise from scratch. add-on sdk's promise module provides an api for doing that. defer module exports defer function, which is where all promises ultimately come from. lets see the implementation of readasync that we used in several of the examples above: const { defer } = require('sdk/core/promise'); function readasync(url) { var deferred = defer(); let xhr = new xmlhttprequest(); xhr.open("get", url, true); xhr.onload = function() { deferred.resolve(xhr.responsetext); }; xhr.onerror = function(event) { deferred.reject(event); }; xhr.send(); return deferred.promise; } so defer returns an object that contains a promise and two resolve, reject functions that can be used to resolve / reject that promise. note: a promise can be rejected or ...
system/child_process - Archive of obsolete content
s don't: so when you specify a command you must pass in a complete path to the command or use the env option to set up the child process environment. ...
test/httpd - Archive of obsolete content
var { startserverasync } = require("sdk/test/httpd"); var srv = startserverasync(port, basepath); require("sdk/system/unload").when(function cleanup() { srv.stop(function() { // you should continue execution from this point. }) }); this starts a server in background (assuming you're running this code in an application that has an event loop, such as firefox). the server listens at http://localhost:port/ and serves files from the specified directory. you can serve static content or use sjs scripts, as described in documentation on developer.mozilla.org. you can also use nshttpserver to start the server manually: var { nshttpserver } = require("sdk/test/httpd"); var srv = new nshttpserver(); // further documentation on developer.mozilla.org see http server for unit tests for general in...
Low-Level APIs - Archive of obsolete content
es access to the local filesystem. io/text-streams provides streams for reading and writing text. lang/functional functional helper methods. lang/type functions for working with type detection. loader/cuddlefish the sdk's module loader. loader/sandbox create javascript sandboxes and execute scripts in them. net/url enables you to read content from a uri. net/xhr provides access to xmlhttprequest functionality. places/bookmarks create, modify, and retrieve bookmarks. places/favicon helper functions for working with favicons. places/history access the user's browsing history. platform/xpcom implement xpcom objects, factories, and services. preferences/event-target listen to changes to the preferences system in firefox. preferences/service access the preference...
package.json - Archive of obsolete content
t the add-on supports private browsing. if this value is not true or is omitted, then the add-on will not see any private windows or objects, such as tabs, that are associated with private windows. see the documentation for the private-browsing module. cross-domain-content: a list of domains for which content scripts are given cross-domain privileges to access content in iframes or to make xmlhttprequests. see the documentation for enabling cross-domain content scripts. multiprocess: a boolean value declaring whether this add-on is, or is not, compatible with multiprocess firefox. note the multiprocess permission is not supported by cfx. preferences an array of json objects that use the following keys: name,type, value, title, and description. th...
File I/O - Archive of obsolete content
fileuri(file); // url is a nsiuri; to get the string "file://...", see url.spec to get an nsifile from the 'file://' url, use nsifileurl: // url is a nsiuri; see nsiioservice::newuri for getting a string into a nsiuri. var file = url.queryinterface(components.interfaces.nsifileurl).file; // file is a nsifile to load from file://, http://, chrome://, resource:// and other urls directly, use xmlhttprequest or netutil.asyncfetch(). also note that generally you don't need to use nsifile::path. use nsifile directly wherever possible. an example below shows how you should save a path in user prefs. storing nsifile in preferences the following two snippets show the right way to store a file path in user preferences (more about preferences in mozilla): absolute path (nsifile) to store an a...
Post data to window - Archive of obsolete content
preprocessing post data the apostdata argument of the (global) loaduri(), opendialog(), and (tab)browser.loaduriwithflags() methods expects the post data in the form of an nsiinputstream (because they eventually call nsiwebnavigation.loaduri()) while post data can be created using nsimimeinputstream. ...
QuerySelector - Archive of obsolete content
ocument.queryselector, or following the jquery style of chaining by returning 'this' within each prototype method of $()): htmldocument.prototype.$ = function (selector) { // only for html return this.queryselector(selector); }; example: <h1>test!</h1> <script> htmldocument.prototype.$ = function (selector) { return this.queryselector(selector); }; alert(document.$('h1')); // [object htmlheadingelement] </script> xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; example: <label value="test!"/> <script type="text/javascript"><![cdata[ xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; alert(document.$('label')); // [object xulelement] ]]></script> document.prototyp...
Rosetta - Archive of obsolete content
xhr200.responsetext)); } ocompiled.text = oxhr200 ? "" : odicts[smimetype](oscript.text); obaton.parentnode.insertbefore(ocompiled, obaton); } function reqerror (oerror) { throw new urierror("the script " + oerror.target.src + " is not accessible."); } function reqsuccess () { createscript(this.refscript, this); } function getsource (oscript) { var oreq = new xmlhttprequest(); oreq.onload = reqsuccess; oreq.onerror = reqerror; oreq.refscript = oscript; oreq.open("get", oscript.src, true); oreq.send(null); } function parsescript (oscript) { if (oscript.hasattribute("type") && !rignoremimes.test(oscript.getattribute("type").tolowercase())) { oscript.hasattribute("src") ? getsource(oscript) : createscript(oscript); } }...
XML-related code snippets - Archive of obsolete content
how to create a dom tree using xmlhttprequest parsing and serializing xml using xpath jxon (lossless javascript xml object notation) xsl transforms xlink xinclude xml:id xml:base support in old browsers xpointer svg namespaces, or why http://www.mozilla.org/keymaster/gat...re.is.only.xul is at the top of every xul document. e4x ...
Displaying web content in an extension without security issues - Archive of obsolete content
parent document (remember, content documents have no access to the chrome documents above them) and consequently no privileges. so in the simplest case you would have: <iframe type="content" src="data:text/html,%3chtml%3e%3cbody%3e%3c/body%3e%3c/html%3e"/> but usually you don’t want to start with an empty document, you would rather want to load some template into the frame: var request = new xmlhttprequest(); request.open("get", "chrome://foo/content/template.html", false); request.send(null); frame.setattribute("src", "data:text/html," + encodeuricomponent(request.responsetext)); that way you can have the template in your extension but still strip it off all privileges when it is loaded in a frame. restricting what documents that contain untrusted data can do there are several restricti...
Downloading JSON and JavaScript in extensions - Archive of obsolete content
once the content has been downloaded, the extension authors proceed to use eval() to decode the string content into javascript objects. this practice is dangerous and will not, in fact, pass an amo review. so the extension will not be allowed to move out of the amo sandbox. the practice is dangerous because the decoded javascript has full chrome privileges and could perform some nasty actions. how could the javascript an extension downloads perform nasty actions? fairly easy if the webserver where the javascript is hosted were to be hijacked or compromised. ...
Jetpack Processes - Archive of obsolete content
ovide context for messages. either the browser or the jetpack implementation may create one. a handle keeps any arbitrary properties attached to it alive, but those properties are not transmitted across the process boundary. these arbitrary properties are the primary means through which context can be provided for messages; for instance, if the handle is meant to represent a network request, an xmlhttprequest instance can be attached to the handle on the chrome process. because a handle's existence crosses process boundaries and cross-process garbage collection does not exist, the lifetime of a handle needs to be controlled manually by code. by default, a handle is rooted in the javascript interpreter's garbage collector, meaning that even if a process throws it away, it will not be garbage ...
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
that’s in the same directory). open a command prompt and navigate to the directory containing gonzui. the next command will import the source code: gonzui-import.exe mozilla once the import process is complete, type the following command to launch the gonzui server: gonzui-server.exe now you can access gonzui from your web browser by typing the following into your location bar : http://localhost:46984 this lets you browse all packages, click on links to traverse them, and take traversed-link locations as search starting points (figure a). fixme: figure a: gonzui 1 - http://quicknote.mozdev.org 2 - http://www5f.biglobe.ne.jp/~t-susumu/ 3 - reverse-polish notation. a way to represent arithmetic formulas. for example, (1+2)*(3-4) would be represented in rpn as 1 2 + 3 4 - * it us...
Appendix A: Add-on Performance - Archive of obsolete content
he window, you should clean everything up in the unload event handler. even the unload event should be handled efficiently. even if it is not as important as other areas, firefox shutdown can also be slowed down because of add-ons. if there's anything you can unload before shutdown, or if there's anything you can do to unload things more efficiently, then it's important that you do. never use xmlhttprequest in synchronous mode. if your add-on needs to perform a heavy operation like sorting or a complex mathematical calculation, you should use dom workers to offload the work to other threads. ...
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
ction() { xulschoolchrome.browseroverlay.init(); }, false); then all we need is some persistent flag that ensures that the first run code is only run once. the best approach in this case is to use a preference, as explained in the handling preferences section. so, if we were to use fuel, we can do the following in the init function: init : function() { let firstrunpref = "extensions.xulschoolhello.firstrundone"; if (!application.prefs.getvalue(firstrunpref, false)) { application.prefs.setvalue(firstrunpref, true); // all the rest of the first run code goes here. } } in this case you would need to declare the first run preference in your default preferences file, with a default value of false. you should also change the preference value before you run any other first run c...
Appendix F: Monitoring DOM changes - Archive of obsolete content
or detecting dom modifications when feasible. often times, this must be used in combination with a slight delay, or even polling, via settimeout, for cases where the url change happens before the page is fully loaded. this method works particularly well with services like google instant, and the gawker family of sites. network listeners ajax-based page changes are almost universally tied to xmlhttprequests. these requests can be tracked from chrome code using a variety of methods, including web progress listeners, http observers, and content policies. while these are not exceptionally efficient (they run for every http request, and considerably more often for some methods), they work very well for certain applications pure css pure css can be more powerful than most people suspect. it ...
Setting Up a Development Environment - Archive of obsolete content
.manifest (deflated 50%) adding: content/browseroverlay.js (deflated 42%) adding: content/browseroverlay.xul (deflated 69%) adding: skin/browseroverlay.css (stored 0%) adding: locale/browseroverlay.dtd (deflated 52%) adding: locale/browseroverlay.properties (stored 0%) creating xpi file. done! build finished successfully. if you inspect the bin directory, you should see the xulschoolhello2.xpi file. if you run make again, you'll only see the last line of the build process. that is because make can tell that the file in the bin directory is up to date, and nothing needs to be done. making changes on source files will make make run the necessary steps to build the xpi again. you can clean up the bin directory by just running the following command (again, from the src directory...
XPCOM Objects - Archive of obsolete content
rver. the nsiobserver has a single method observe, so all you need to do is have an observe method in your object and you'll be ok. xulschool.prefobserver = { init: function() { this._prefservice = cc["@mozilla.org/preferences-service;1"].getservice(ci.nsiprefbranch2); // pass 'this' as if it implemented nsiobserver. this._prefservice.addobserver( "extensions.xulschoolhello.somepref", this, false); }, observe : function(asubject, atopic, adata) { // do stuff here. } }; finally, here's a table summarizing the types you will most likely encounter in xpcom interfaces, and how to handle them: js type idl types notes strings autf8string, string, wstring, char*, others historically there have been several string types in xp...
Performance best practices in extensions - Archive of obsolete content
the service isn't obtained until the first time it's used. look through the source for examples. many common services are already cached for you in services.jsm. use asynchronous i/o this cannot be stressed enough: never do synchronous i/o on the main thread. any kind of i/o on the main thread, be it disk or network i/o, can cause serious ui responsiveness issues. never use synchronous xmlhttprequests. netutils.jsm provides helpers for asynchronous reading and copying of files. never access a sqlite database synchronously. use the asynchronous api instead. performing sequential, asynchronous operations can often be greatly simplified using promises. avoid mouse movement events avoid using mouse event listeners, including mouseover, mouseout, mouseenter, mouseexit, and especial...
Adding preferences to an extension - Archive of obsolete content
we do this because since refreshinformation() is usually called as a callback from setinterval. in such cases this doesn't refer to the right object. s...
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
email address to set email account, which are not available by default in the environment variables). however i could be useful to get ldap values for firefox extra config, for example to set the default home page to the labeleduri ldap attribute of the user. firefox 22 omni.jar archive file became omni.ja since http://blog.ffextensionguru.com/2011/11/16/omni-jar-to-become-omni-ja/ [root@localhost firefox]# unzip -l /usr/lib/firefox/browser/omni.ja | grep defaults/pr warning [/usr/lib/firefox/browser/omni.ja]: 3598815 extra bytes at beginning or within zipfile (attempting to process anyway) error [/usr/lib/firefox/browser/omni.ja]: reported length of central directory is -3598815 bytes too long (atari stzip zipfile? j.h.holm zipsplit 1.1 zipfile?). compensating... 3850 0...
Same-origin policy for file: URIs - Archive of obsolete content
ories cannot be loaded this way, however. for example, if you have a file foo.html which accesses another file bar.html and you have navigated to it from the file index.html, the load will succeed only if bar.html is either in the same directory as index.html or in a directory contained within the same directory as index.html. this policy affects anything that does same-origin checks, including xmlhttprequest, xslt, and xbl. for cross-window dom access, each file is treated as a separate origin, with one exception: if a file is loaded from another file that would otherwise be able to load it following this same-origin policy, they are considered to have the same origin. this load can occur through a subframe, link, location set, call to window.open(), or the like. for example, if the file /...
Enabling the behavior - updating the status bar panel - Archive of obsolete content
in order for loadtinderboxstatus() to have any effect we need to define a matching updatetinderboxstatus() function. function updatetinderboxstatus() { var icon = document.getelementbyid('tinderbox-status'); if (gxmlhttprequest.responsetext.match("ee0000")) icon.setattribute("status", "busted"); else if (gxmlhttprequest.responsetext.match("ffaa00")) icon.setattribute("status", "testfailed"); else if (gxmlhttprequest.responsetext.match("11dd11")) icon.setattribute("status", "success"); else icon.setattribute("status", ""); } updatetinderboxstatus() retrieves a reference to the statusbarpanel element then searches through the retrieved html document (stored in the responsetext property of the xmlhttprequest instance) for one of several color references. the color...
Enabling the behavior - updating the status periodically - Archive of obsolete content
now that we have code to retrieve tinderbox status and update the icon, we need to run it periodically. function loadtinderboxstatus() { gxmlhttprequest = new xmlhttprequest(); gxmlhttprequest.onload = updatetinderboxstatus; gxmlhttprequest.open("get", "http://tinderbox.mozilla.org/seamonkey/panel.html"); gxmlhttprequest.send(null); window.settimeout(loadtinderboxstatus, 60000); } window.settimeout(loadtinderboxstatus, 1000); window.settimeout schedules functions to run at some future time. we use it inside the loadtinderboxstatus function to make that function run a second (1,000 milliseconds) after startup and a minute (60,000 milliseconds) after each invocation. this allows users to get relatively frequent updates about tinderbox without overloading the tinderbox server or ...
Dehydra Object Reference - Archive of obsolete content
owing properties are usually available: property type description .name string the function or variable name. .type type object the type of this function or variable. .isstatic boolean flag .isreturn boolean flag the variable is being returned. .isdecl boolean flag the variable is being declared (local variables only). .assign array of variable objects this variable is the lhs of an assignment. the value is an array of values that were assigned. .isfcall boolean flag the variable is being used as a function call. .arguments array of variable objects arguments used to make a function call. .parameters array of variable objects a function definition's parameter names and types .memberof aggregate type object indicates the aggregate type(class/struct) in the ...
Code snippets - Archive of obsolete content
.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsidomwindow); // obtain a reference to sync's tabs "engine." let tabsengine = weave.service.enginemanager.get("tabs"); // iterate over each client having data. for each (let client in tabsengine.getallclients()) { for each (let tab in client.tabs) { let url = tab.urlhistory[0]; // load the tab via the tabbed browser api. mainwindow.gbrowser.addtab(url); } } partially corrupt a server components.utils.import("resource://services-sync/main.js"); components.utils.import("resource://services-sync/resource.js"); function deletepath(path) { let resource = new resource(weave.service.storageurl + path); resource.setheader("x-confirm-delete", "1"); ...
HTTP Class Overview - Archive of obsolete content
warning: the content of this article may be out of date. it was last updated in 2002. this document provides an overview of the classes used by the mozilla http implementation. it's meant as a guide to developers wishing to understand or extend the mozilla http implementation. ...
Me - Archive of obsolete content
Archive › Mozilla › Jetpack › Meta › Me
ified after they are successfully installed. onfirstrun() accepts a callback which is called after installation. note that this mechanism is independent of the first-run page; in particular, the callback is not a load event listener or jquery ready callback. onfirstrun() may be called anywhere in your jetpack, but if it is called as the result of some asynchronous operation such as a timeout or xmlhttprequest, it is ignored. if you call it multiple times, all but the final call are ignored. funca function. it takes no paramenters. inside the function, this is the jetpack's content.function example jetpack.me.onfirstrun(function(){ jetpack.notifications.show("oh boy, i'm installed!");}); ...
Mozilla Application Framework in Detail - Archive of obsolete content
sive collection of macros that make your c++ implementations easy to write and extend. a special base class, <tt>nsisupports</tt>, that helps manage object lifetime and reference counting. sample component implementations you can extend and learn from. documentation. web services mozilla includes built-in support for popular web services standards xml-rpc, soap, and wsdl as well as a simple xmlhttprequest object similar to the one in ie. all services are available from javascript code, which allows even simple xul+js applications to take advantage of them. mozilla's xml-rpc support includes synchronous and asynchronous requesting and downloading of data from a server. its soap support is broad and includes.... mozilla has introductory support for wsdl... mozilla engineers have written an...
Mozilla Application Framework - Archive of obsolete content
y with built-in support for many common protocols and a well-defined plug-in interface for custom protocol handling so you can add the protocols you need. xpcom a simple, cross-platform component model with multiple language bindings and idl descriptions so you can plug your custom functionality into the framework and connect it with other components. web services built-in support for xmlhttprequest, xml-rpc, soap, and wsdl to enable mozilla-based application authors to take advantage of the exploding world of web services. xpinstall our cross-platform installer for trivial packaging and installation of your mozilla framework applications. and much much more... tools venkman a javascript debugger with support for breakpoints, conditional breakpoints, local variable insp...
New Skin Notes - Archive of obsolete content
every single place on the web, yet visited links use different styling on most sites. --nickolay 01:34, 31 aug 2005 (pdt) ok, so i'm asking just to change this color. --gandalf 04:55, 31 aug 2005 (pdt) fine, changed. --dria the default link color is to bright. it's less readable than the old one. i'd suggest to use the color from cavedish. -- gandalf that was my first thought, too. -- axelhecht ok, i'll tone the main link colour down a bit. --dria page title needs "development skin" removed. -- dria the skin looks nice, but the links on the right are too small. if this is going to be the default skin used by editors, they are unacceptably small. --nickolay 01:59, 25 aug 2005 (pdt) i'm planning on doing up a special skin for editors in the future (with the edit tools and such...
Remotely debugging Firefox for Metro - Archive of obsolete content
ging" in the settings tab. if you're using a version of firefox older than 27, you'll need to restart the browser for the setting to take effect. connecting on the desktop on the desktop, open the web developer menu and select "connect...". you'll see a page that looks like this: if you are running firefox for metro on the same computer with the default settings, use the default host (localhost) and port (6000), and press the "connect" button. if you are connecting to firefox for metro on a different computer or a different port, enter the appropriate hostname and port number and then press "connect." in the windows 8 (metro) browser next you'll see a dialog in firefox for metro asking you to confirm the connection. press the "ok" button to continue. tip: if the remote connectio...
Table Cellmap - Archive of obsolete content
argument aupdatezerospan to repair the cellmap if it encounters a empty cell (nsnull), by looking for a origin of a zero row- or colspan that spans the queried place in the cellmap. this can produce enormous costs once the cellmap contains large holes that are not caused by zero spans, this is at least a o2(n) algorithm. the following routines seem to be hot spots performance wise: nscellmap::colhasspanningcells nscellmap::rowhasspanningcells nscellmap::rowisspannedinto users of nscellmap::getdataat outside nscellmap.cpp the border collapse code relies on the cellmap. the collapsing of rows and columns uses the cellmap. and finally the line iterator methods which are used for arrow navigation through a table. original document information author(s): bernd mielke last updated ...
The life of an HTML HTTP request - Archive of obsolete content
loader to load (command "view") the specified url. [note: passes nswebshell.mobserver as nsistreamobserver and the webshell as nsicontentviewercontainer to the docloader.] (2) the document loader calls ns_openuri with the url to begin transfering the requested file. necko (the network library) checks the url scheme (the first part of the url, http: in this case) and locates the correct nsiprotocolhandler (in this case nshttphandler) and asks it for a nsichannel (nshttpchannel). the channel represents the connection to the server, and is the source of the html data stream. (3) when data is starting to come from the webserver the nsichannel calls the onstartrequest in the documenloader. now the channel knows the content type of the incoming data, so the documentloader can find an nsidocument...
URIScheme - Archive of obsolete content
443 (ssl) ftp:// by default, port 21 file:// : file:///etc/hosts on unix/linux, file:///c:/some/file.txt on windows. moz-icon://.ext?size=32 : you can replace ext by your some file extension like js, css, xul, xml, etc. and the size number by 1 to 127 mailto:emailaddress@domain.com about: chrome:// ... preferences see gecko.handlerservice.schemes.* scripting interface see nsiprotocolhandler to create a new protocol/scheme. about: about: about:config about:crashes about:mozilla about:plugins about:robots ... ...
Using gdb on wimpy computers - Archive of obsolete content
to see the conditions. there is absolutely no warranty for gdb. type "show warranty" for details. this gdb was configured as "i386-redhat-linux"... (gdb) b main breakpoint 1 at 0x804ec45: file nsapprunner.cpp, line 811. (gdb) r starting program: /home/blizzard/src/mozilla/mozilla/dist/bin/./mozilla-bin breakpoint 1, main (argc=1, argv=0xbffff894) at nsapprunner.cpp:811 811 installunixsignalhandlers(argv[0]); (gdb) set auto-solib-add 0 (gdb) c continuing. nsnativecomponentloader: autoregistering begins. [...] it's easy to define a function for gdb to do this for you automatically. you can add this function to the .gdbinit file in your home directory: def prun tbreak main run set auto-solib-add 0 end how do i load shared libraries? if you have turned off autom...
XML in Mozilla - Archive of obsolete content
old version of the w3c dom level 3 load & save module. mozilla currently implements only the load() method and the document.async property. ...
getLastError - Archive of obsolete content
u to defer checking for error codes each time you call addfile or adddirectory until the last addfile or adddirectory call. the getlasterror method does not return errors from methods that return objects, such as getfolder. example the following example calls getlasterror after a series of addfile calls: addfile("npplug", ...); addfile("/ms/shared/ctl3d.dll", ...); addfile("/nethelp/royalplug/royalhelp.html",...); err = getlasterror(); ...
Attribute (XUL) - Archive of obsolete content
autocompletesearch autocompletesearchparam autofill autofillaftermatch autoscroll beforeselected buttonaccesskeyaccept buttonaccesskeycancel buttonaccesskeydisclosure buttonaccesskeyextra1 buttonaccesskeyextra2 buttonaccesskeyhelp buttonalign buttondir buttondisabledaccept buttonlabelaccept buttonlabelcancel buttonlabeldisclosure buttonlabelextra1 buttonlabelextra2 buttonlabelhelp buttonorient buttonpack buttons checked checkstate clicktoscroll class closebutton closemenu coalesceduplicatearcs collapse collapsed color cols command commandupdater completedefaultindex container containment contentcontextmenu contenttooltip context contextmenu control crop curpos current currentset customindex customizable cycler datasources decimalplaces ...
Providing Command-Line Options - Archive of obsolete content
eneral-startup;1?type=myapp", _xpcom_categories: [{ category: "command-line-handler", // changeme: // category names are sorted alphabetically. typical command-line handlers use a // category that begins with the letter "m". ...
More Tree Features - Archive of obsolete content
reecol id="endtime" label="end time" flex="1" persist="width ordinal hidden" /> </treecols> <treechildren> <treeitem> <treerow> <treecell label="joshua granville" /> <treecell label="vancouver" /> <treecell label="7:06:00" /> <treecell label="9:10:26" /> </treerow> </treeitem> <treeitem> <treerow> <treecell label="robert valhalla" /> <treecell label="seattle" /> <treecell label="7:08:00" /> <treecell label="9:15:51" /> </treerow> </treeitem> </treechildren> </tree> three attributes of the columns must be persisted, the width attribute to save the column widths, the ordinal attribute which holds the position of the column, and the hidden attribute which holds whether the colu...
stack - Archive of obsolete content
Archive › Mozilla › XUL › stack
dth, both "left" and "right" must be set. in some case, setting the width or height this way may even be necessary because using the width/height attributes (eg, "width", "minwidth" and "maxwidth") inside a stack can sometimes produce unpredictable and undesireable results. more information is available in the xul tutorial. examples <stack> <hbox flex="1"> <image src="chrome://xulschoolhello/skin/stack-bg.png" flex="1"left="10"right="10" top="10" bottom="10"/> </hbox> <hbox> <!-- some content here. --> </hbox> </stack> in this example, the resulting width of the top-most hbox will be 400px (600px - 200px - 0) : <stack width="600"> <hbox flex="1"> <!-- content --> </hbox> <hbox left="0" right="200" > <!-- some content here. --> </hbox> </stack> at...
Make your xulrunner app match the system locale - Archive of obsolete content
n for someone using python, but the ideas should be adaptable. also, this may not be the proper way to do this and it may not work for you in all cases. please update if there are more correct ways to do this. the first step is to get the code we're about to write to run before any of the locale specific resources are loaded. democracy does this by creating a command line handler called democracyclh, and then creating a new object of our pybridge component. the code described lives in the pybridge component's onstartup method which gets called automatically. the second step is to figure out the system locale. to be finished later. then set the locale preference. the following is python code to set this preference. from xpcom import components ps_cls = components.classes["@mozilla.org/prefer...
Opening a Link in the Default Browser - Archive of obsolete content
work.protocol-handler.warn-external.https", false); pref("network.protocol-handler.warn-external.ftp", false); you can also check whether an external handler for a scheme exists. this is how you do it: var extps = components.classes["@mozilla.org/uriloader/external-protocol-service;1"] .getservice(components.interfaces.nsiexternalprotocolservice); if (extps.externalprotocolhandlerexists("http")) { // handler for http:// urls exists } link within an iframe to enable a link inside an html document that is the "src" of an iframe to be opened in the default browser, setting the preference: pref("network.protocol-handler.expose-all", false); seems to work. ...
Using SOAP in XULRunner 1.9 - Archive of obsolete content
: soapclient.contenttype + "; charset=\"" + soapclient.charset + "\"", < beforesend: function(req) { < req.setrequestheader("method", "post"); < req.setrequestheader("content-length", soapclient.contentlength); < req.setrequestheader("soapserver", soapclient.soapserver); < req.setrequestheader("soapaction", soapreq.action); < } < }); --- > var xhr = new xmlhttprequest(); > xhr.mozbackgroundrequest = true; > xhr.open('post', soapclient.proxy, true); > xhr.onreadystatechange = function() { > if (4 != xhr.readystate) { return; } > getresponse(xhr); > }; > var headers = { > 'method': 'post', > 'content-type': soapclient.contenttype + '; charset="' + > soapclient.charset + '"', > 'content-length': soapclient.content...
What XULRunner Provides - Archive of obsolete content
oal of xulrunner is to provide a solution for deploying xul applications (primarily firefox and thunderbird), as well as providing an embedding mechanism. ...
calIFileType - Archive of obsolete content
...
nsIContentPolicy - Archive of obsolete content
gh shouldload() as expected). shouldprocess() will get this for, for example <meta> refresh elements and http refresh headers. type_xbl 9 indicates an xbl binding request, triggered either by -moz-binding css property or the document.addbinding() method. type_ping 10 indicates a ping triggered by a click on an <a> element using the ping attribute. type_xmlhttprequest 11 indicates an xmlhttprequest. also used for document.load() type_object_subrequest 12 indicates a request by a plugin. type_dtd 13 indicates a dtd loaded by an xml document. type_font 14 indicates a font loaded via @font-face rule. type_media 15 indicates a video or audio load. type_websocket 16 indicates...
2006-11-10 - Archive of obsolete content
summary: mozilla.dev.apps.thunderbird - november 4-10, 2006 announcements none for this week. discussions violation of smtp protocol in thunderbird hector reports two bugs: thunderbird ignores the smtp protocol state machine by ignoring the 501 response codes. this has been filed as bug 360118. thunderbird doesn't seem to have an option to set the client domain name (elho/helo). this is already addressed in bug 244030. interfacing with thunderbird mark bannister is looking for directions on interfacing thunderbird with their project management database. guenter has provided some sample code using the 'mailto:' method. meetings calendar project weekly status meeting - 2006/11/08 17:00 utc (meeting notes) calendar project weekly qa chat - 2006/11/09 16:30 utc (mee...
2006-10-27 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - oct 21-27, 2006 announcements none during this week. discussions evalinsandbox and xmlhttprequest a discussion about writing something that calls a function defined by the page that the user is currently on chrome files and last modified date ways to retrieve the last modified date of a chrome file that may be in a jar or on the file system. meetings none during this week. ...
2006-11-10 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - oct 04-nov 10, 2006 announcements xptcall changes in process - ports owners needed if you maintain an xptcall port, you are needed to submit a patch to that bug 349002 with xptcall updates. discussions developing an extension like xmlhttprequest / nsidocument / mozilla_internal_api a discussion on how to develop an extension similar to xmlhttprequest but for a different protocol than http, emulating the asynchronous aspect. meetings none during this week. ...
2006-12-08 - Archive of obsolete content
, 2006 announcements none during this week. discussions xpcom cpp to js callback engaging discussion on a problem with trying to call back from c++ to a javascript object using an interface the developer created with an idl. however, the c++ call that's supposed to be invoking the method on the javascript object is returning with 0x80004005 (ns_error_failure). saving binary data from nsixmlhttprequest a discussion on how to use nsixmlhttprequest object to query data from a url in an extension implemented in javascript meetings none during this week. ...
SAX - Archive of obsolete content
handlers are available: interface purpose nsisaxcontenthandler receive notification of the logical content of a document (e.g. elements, attributes, whitespace, and processing instructions). nsisaxdtdhandler receive notification of basic dtd-related events. nsisaxerrorhandler receive notification of errors in the input stream. nsisaxlexicalhandler sax2 extension handler for lexical events (e.g. comment and cdata nodes, dtd declarations, and entities). an example implementation of the most commonly used content handler: function print(s) { dump(s + "\n"); } xmlreader.contenthandler = { // nsisaxcontenthandler startdocument: function() { print("startdocument"); }, enddocument: function() { print("enddocum...
Using Web Standards in your Web Pages - Archive of obsolete content
changes described in this article. the last section offers excellent and best references for those wishing to learn more about upgrading techniques presented in this article and more for those wishing to perfect their web pages. contents benefits of using web standards making your page using web standards - how to using the w3c dom developing cross browser and cross platform pages using xmlhttprequest summary of changes references original document information author(s): mike cowperthwaite, marcio galli, jim ley, ian oeschger, simon paquet, gérard talbot last updated date: may 29, 2008 copyright information: portions of this content are © 1998–2008 by individual mozilla.org contributors; content available under a creative commons license | details. ...
-ms-scroll-limit-y-max - Archive of obsolete content
the -ms-scroll-limit-y-max css property is a microsoft extension that specifies the maximum value for the element.scrolltop property. initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values auto the maximum value for the scrolltop property is equal to element.scrollheight. <length> the maximum value for the scrolltop property. formal syntax auto | <length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. the specified behavior of the -ms-scroll-limit-y-max property is only applicable at a mscontentzoomfactor of 1; the behavior of this property is undefined at other zoom factors. thi...
E4X - Archive of obsolete content
Archive › Web › E4X
nd therefore cannot contain explicit cdata sections). someone verify the above known bugs and limitations it is not currently possible to access a dom object through e4x (bug 270553). e4x doesn't support parsing xml declaration. <?xml version=...?>) (see bug 336551). you may get syntaxerror "xml is a reserved identifier" (despite the xml being in a string). ...
MSX Emulator (jsMSX) - Archive of obsolete content
o be used to tightly integrate existing msx programs in web page logic. how to help lots of work to optimize the performance and add msx 2.0, 2.0+ and turbor features are still necessary. version 1.0 will release an optimized javascript engine for msx 1.0. version 2.0, 3.0 and 4.0 will be compatible with msx 2.0, 2.0+ and turbor respectively. an uncompress javascript function able to read zip and lhz file streams is also necessary to load compressed rom files. if you think you'd like to participate, are just curious, or want to say hello, please have a look at the project and please drop a line to the project forum. external links view the online demo (requires firefox 2+) jsmsx project see also drawing graphics with canvas canvas tutorial jsc64 the 100% javascript / canvas commodore 64 e...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
s a sample javascript script which incorporates java classes to handle the database query. ...
Reference - Archive of obsolete content
eference/reorg. the right thing to do seems to be: move all the "... javascript 1.5 ..." pages to "... js ..." (no version number). make the pages document the latest version. each statement/function/object/operator/feature has a small note telling what version introduced that feature. perhaps a larger footnote if there are backwards-compatibility issues involved in using that feature. <hr> xmlhttprequest xmlhttprequest is a host object provided by the browser, not part of js core language. i reverted the addition of xhr to the reference. we should link to some dom vs. js article from the main page and global objects page at least. --nickolay 09:48, 31 january 2007 (pst) yes, it's not a "core" javascript object. let me try to add the links you suggested ... --davidcary 10:25, 31 january...
Troubleshooting XForms Forms - Archive of obsolete content
exceptions you can temporarily fix the problem by unchecking the turn cross-site post requests into data-less get requests check box. alternatively, for a long term fix you can enter an exception pattern in the anti-xss protection exceptions text area. if you are developing on your local machine using apache tomcat for example then add the following regular expression on a new line: ^http://localhost:8080/.* use the xforms buddy to view instance data the xforms buddy extension allows you to dynamically view model instance data while the xforms is running in the firefox browser. the home page for xfroms buddy is located at: xforms buddy using http proxy you can use the charles firefox extension to view your http session data including http header data. if all else fails ask the c...
Mozilla's DOCTYPE sniffing - Archive of obsolete content
er "-//w3c//dtd html 4.01 transitional//en", with a system identifier. the public identifier "-//w3c//dtd html 4.01 frameset//en", with a system identifier. quirks mode the following trigger quirks mode (this list needs to be comprehensive to ensure that pages already existing on the web trigger quirks mode): the following sites have been useful in preparing this list: w3c html validator, htmlhelp html validator. the absence of a doctype. an xml declaration (pseudo-pi) without a doctype (in other words, ignore the xml declaration and use the doctype). in 1.0 and 1.1alpha and earlier (but not in 1.0.1 or 1.1beta), the presence of an xml declaration triggered full standards mode. a doctype declaration that cannot be understood (e.g., no matching quote). the system identifier "http:/...
Introduction to game development for the Web - Game development
e blowing up monsters? this is the api for you. websockets the websocket api lets you connect your app or site to a server to transmit data back and forth in real-time. perfect for multiplayer gaming action, chat services, and so forth. web workers workers give you the ability to spawn background threads running their own javascript code, to take advantage of modern, multi-core processors. xmlhttprequest and file api the combination of xmlhttprequest and the file api lets you send and receive any kind of data you want (don't let the "xml" throw you!) from a web server. this is a great way to do anything from downloading new game levels and artwork to transmitting non-real-time game status information back and forth. ...
Audio for Web games - Game development
e. you can also apply filters or effects to music. is your character in a cave? increase the echo. maybe you have underwater scenes, during which you could apply a filter that muffles the sound. let's look at some web audio api techniques for dynamically adjusting music from its base tracks. loading your tracks with the web audio api you can load separate tracks and loops individually using xmlhttprequest or the fetch api, which means you can load them synchronously or in parallel. loading synchronously might mean parts of your music are ready earlier and you can start playing them while others load. either way you may want to synchronize tracks or loops. the web audio api contains the notion of an internal clock that starts ticking the moment you create an audio context. you'll need to...
Buttons - Game development
ping the paddle still before the game starts it works as expected, but we can still move the paddle when the game hasn't started yet, which looks a bit silly. to stop this, we can take advantage of the playing variable and make the paddle movable only when the game has started. to do that, adjust the update() function like so: function update() { game.physics.arcade.collide(ball, paddle, ballhitpaddle); game.physics.arcade.collide(ball, bricks, ballhitbrick); if(playing) { paddle.x = game.input.x || game.world.width*0.5; } } that way the paddle is immovable after everything is loaded and prepared, but before the start of the actual game. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand bette...
The score - Game development
last parameter looks very similar to css styling. in our case the score text will be blue, sized at 18 pixels, and use the arial font. updating the score when bricks are destroyed we will increase the number of points every time the ball hits a brick and update the scoretext to display the current score. this can be done using the settext() method — add the two new lines seen below to the ballhitbrick() function: function ballhitbrick(ball, brick) { brick.kill(); score += 10; scoretext.settext('points: '+score); } that's it for now — reload your index.html and check that the score updates on every brick hit. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps we no...
Visual-js game engine - Game development
ew script and save script if you have extra changes , open starter/run.js and you will found line : sys.script.load("scripts/new_script.js") ctrl+s use from menu run->choose browser for testing . - important safari not working at the moment chrome , firefox , opera tutorial - pencil (animation path) : how to use pencil tool to create path object . path object can be saved intro localhost , you can collect object and put it direct source code . file location : starter/templates/paths.js templetes are made from visual-js core also . see source code : paths.js see the pen visual js - pencil by visualjs game engine (@zlatnaspirala) on codepen. online demo examples at : https://jsfiddle.net/user/zlatnaspirala/fiddles/ demo slot mashine basic demo at : https://jsfiddle...
Visual typescript game engine - Game development
a connector is our account session used for login, register etc. implemented video chat based on webrtc protocol. - running rtc3 server is also easy : command 'npm run broadcaster' is not necessary for beginners. features come with broadcaster: multiplatform ...
Ajax - MDN Web Docs Glossary: Definitions of Web-related terms
ajax allows you to update parts of the dom of an html page instead without the need for a full page refresh. ajax also lets you work asynchronously, meaning your code continues to run while the targeted part of your web page is trying to reload (compared to synchronously, which blocks your code from running until that part of your page is done reloading). ...
Forbidden header name - MDN Web Docs Glossary: Definitions of Web-related terms
name of any http header that cannot be modified programmatically; specifically, an http request header name (in contrast with a forbidden response header name). modifying such headers is forbidden because the user agent retains full control over them. names starting with `sec-` are reserved for creating new headers safe from apis using fetch that grant developers control over headers, such as xmlhttprequest. forbidden header names start with proxy- or sec-, or are one of the following names: accept-charset accept-encoding access-control-request-headers access-control-request-method connection content-length cookie cookie2 date dnt expect feature-policy host keep-alive origin proxy- sec- referer te trailer transfer-encoding upgrade via note: the user-agent heade...
MVC - MDN Web Docs Glossary: Definitions of Web-related terms
very much like mvc, but mvc makes these components 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 ...
SPA (Single-page application) - MDN Web Docs Glossary: Definitions of Web-related terms
an spa (single-page application) is a web app implemention that loads 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 ...
Synchronous - MDN Web Docs Glossary: Definitions of Web-related terms
e). ...
MDN Web Docs Glossary: Definitions of Web-related terms
wai wcag web performance web server web standards webassembly webdav webextensions webgl webidl webkit webm webp webrtc websockets webvtt whatwg whitespace world wide web wrapper x xforms xhr (xmlhttprequest) xhtml xinclude xlink xml xpath xquery xslt other 404 502 alpn at-rule attack byte-order mark character set client cryptosystem debug digital signature execution flex-direction ...
CSS values and units - Learn web development
w. unit relative to em font size of the parent, in the case of typographical properties like font-size, and font size of the element itself, in the case of other properties like width. ex x-height of the element's font. ch the advance measure (width) of the glyph "0" of the element's font. rem font size of the root element. lh line height of the element. vw 1% of the viewport's width. vh 1% of the viewport's height. vmin 1% of the viewport's smaller dimension. vmax 1% of the viewport's larger dimension. exploring an example in the example below you can see how some relative and absolute length units behave. the first box has a width set in pixels. as an absolut...
Practical positioning examples - Learn web development
ng 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. to start with, we'd like you to make a local copy of the starting html file — info-box-start.html. save this somewhere sensible on your local computer, and open it up in your text editor. let's look at the html contained within the body: <sec...
Sending form data - Learn web development
above, which runs when the /hello url is navigated to. note: again, this code won't work if you just try to load it into a browser directly. python works a bit differently to php — to run this code locally you'll need to install python/pip, then install flask using pip3 install flask. at this point you should be able to run the example using python3 python-example.py, then navigating to localhost:5000 in your browser. other languages and frameworks there are many other server-side technologies you can use for form handling, including perl, java, .net, ruby, etc. just pick the one you like best. that said, it's worth noting that it's very uncommon to use these technologies directly because this can be tricky. it's more common to use one of the many high quality frameworks that make h...
Client-side web APIs - Learn web development
om the server another very common task in modern websites and applications is retrieving individual data items from the server to update sections of a webpage without having to load an entirely new page. this seemingly small detail has had a huge impact on the performance and behavior of sites. in this article, we'll explain the concept, and look at technologies that make it possible, such as xmlhttprequest and the fetch api. third party apis the apis we've covered so far are built into the browser, but not all apis are. many large websites and services such as google maps, twitter, facebook, paypal, etc. provide apis allowing developers to make use of their data (e.g. displaying your twitter stream on your blog) or services (e.g. displaying custom google maps on your site, or using face...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
this todo" checked={{ @todo.iscompleted }} {{ on 'change' (fn this.todos.togglecompletion @todo) }} > note: the above snippet uses a new ember-specific keyword — fn. fn allows for partial application, which is similar to bind, but it never changes the invocation context; this is equivalent to using bind with a null first argument. ...
Ember interactivity: Events, classes and state - Learn web development
e inside the headercomponent class via the todos object, using the @service decorator. add the following line just below the opening export... line: @service('todo-data') todos; now the placeholder alert(text); line can be replaced with a call to our new add() function. replace it with the following: this.todos.add(text); if we try this out in the todo app in our browser (npm start, go to localhost:4200), it will look like nothing happens after hitting the enter key (although the fact that the app builds without any errors is a good sign). using the ember inspector however, we can see that our todo was added: displaying our todos now that we know that we can create todos, there needs to be a way to swap out our static "buy movie tickets" todos with the todos we're actually creating. ...
Routing in Ember - Learn web development
o to the todomvc/app/templates/application.hbs file and replace <todolist /> with {{outlet}} next, in our index.hbs, completed.hbs, and active.hbs templates (also found in the templates directory) we can for now just enter the todolist component invocation. in each case, replace {{outlet}} with <todolist /> so at this point, if you try the app again and visit any of the three routes localhost:4200 localhost:4200/active localhost:4200/completed you'll see exactly the same thing. at each url, the template that corresponds to the specific path ("active", "completed", or "index"), will render the <todolist /> component. the location in the page where <todolist /> is rendered is determined by the {{ outlet }} inside the parent route, which in this case is application.hbs. so we have ...
Dynamic behavior in Svelte: working with variables and props - Learn web development
an easy way to test that this works is to add a reactive statement to log the contents of newtodoname. add this snippet at the end of the <script> section: $: console.log('newtodoname: ', newtodoname) note: as you may have noticed, reactive statements aren't limited to variable declarations. you can put any javascript expression after the $: sign. now try going back to localhost:5000, pressing ctrl + shift + k to open your browser console and typing something into the input field. you should see your entries logged. at this point, you can delete the reactive console.log() if you wish. next up we'll create a function to add the new todo — addtodo() — which will push a new todo object onto the todos array. add this to the bottom of your <script> block inside s...
Getting started with Vue - Learn web development
e cli adds a serve command to the project’s package.json file as an npm script, so you can easily run it. in your terminal, try running npm run serve (or yarn serve if you prefer yarn). your terminal should output something like the following: info starting development server... 98% after emitting copyplugin done compiled successfully in 18121ms app running at: - local: <http://localhost:8080/> - network: <http://192.168.1.9:8080/> note that the development build is not optimized. to create a production build, run npm run build. if you navigate to the “local” address in a new browser tab (this should be something like http://localhost:8080 as stated above, but may vary based on your setup), you should see your app. right now, it should contain a welcome message, a ...
Handling common accessibility problems - Learn web development
ty, for example, although making bootstrap a little more accessible by rhiana heath explores some of its issues (mainly related to color contrast), and looks at some solutions. regularly updated dynamic content can be a problem because screenreader users might miss it, especially if it updates unexpectedly. if you have a single-page app with a main content panel that is regularly updated using xmlhttprequest or fetch, a screenreader user might miss those updates. wai-aria do you need to use such complex functionality, or will plain old semantic html do instead? if you do need complexity, you should consider using wai-aria (accessible rich internet applications), a specification that provides semantics (in the form of new html attributes) for items such as complex form controls and updatin...
Gecko info for Windows accessibility vendors
role_row not supported. see the section intentional differences with ie role_cell html: <td> dhtml: role="wairole:gridcell" sets state_readonly in norm...
Creating MozSearch plugins
y difference is the root element and xml namespace. ...
Makefile - variables
ibname exports a list of exported header files and sources to install for external use. exports_namespaces exported package include directory: dist/include/${namespace} exports_${namespace} a list of exports/headers that should be copied into the exported namespace directory. extra_components nsdefaultclh.manifest, javascript xpcomm files extra_dso_libs extra_dso_ldopts extra_js_modules extra_pp_components xpcomm files to pre-process before installation. garbage a "clean target" macro containing a list of files to remove. garbage_dirs a "clean target" macro cont...
Limitations of chrome scripts
share any state with the same jsm loaded into a different process: so you can't use a jsm to share state between the chrome and content processes. if an add-on wants to use a jsm to share state in this way, it's best to load the jsm in the chrome process, and have frame scripts store and access the jsm's state by sending messages to the chrome process using the message manager. nsiprotocolhandler in multiprocess firefox, code which registers a custom protocol using nsiprotocolhandler must register the custom protocol in the child content process. if the custom protocol is registered only in the chrome process, no iframes or tabs will be able to load any resource from the custom procotol. the solution is to register the custom protocol in the content process. you can do this by...
HTMLIFrameElement.getContentDimensions()
syntax var instanceofdomrequest = instanceofhtmliframeelement.getcontentdimensions(); returns a domrequest for handling the dimensions request. its request.onsuccess handler handles the success case, and its request.onerror handler handles the failure case. ...
mozbrowserasyncscroll
<iframe>. left the scroll left position in css pixels of the document within the browser <iframe>. width the width in css pixels of the visible part of the document within the browser <iframe>. height the height in css pixels of the visible part of the document within the browser <iframe>. scrollwidth the total content width in css pixels of the document within the browser <iframe>. scrollheight the total content height in css pixels of the document within the browser <iframe>. note: top + height may be larger than scrollheight. this indicates that the content is over-scrolled, which occurs when the page "rubber-bands" after being scrolled all the way to the bottom. similarly, left + width may be greater than scrollwidth, and both left and top may be negative. note: for perfo...
ChromeWorker
callback version of chromeworker that features promises, see promiseworker. addons must use absolute urls to load their workers, and those urls have to be using a chrome:// or resource:// protocol (file:// is not accepted). addons that wish to use file:// urls must first register a resource replacement path, using code like this: var fileuri = services.io.newfileuri(file); services.io.getprotocolhandler('resource'). queryinterface(ci.nsiresprotocolhandler). setsubstitution('my-cool-addon', fileuri); var worker = new worker('resource://my-cool-addon/worker.js'); more references: you can use chromeworker from javascript code modules. see using workers in javascript code modules for details. you can use chromeworker modules in chromeworkers. see using web w...
MozScrolledAreaChanged
this event, introduced in gecko 1.9.2, is fired whenever either or both of these values change. ...
Overview of Mozilla embedding APIs
nt handler can be located. if no registered content handlers are available, the unknowncontenttypehandler is notified. the default implementation of this service displays a dialog box asking the user if the content should be saved to disk... contract-id: ns_iunknowncontenttypehandler_contractid implemented interfaces: nsiunknowncontenttypehandler helperapp launch dialog contract-id: ns_externalhelperappservice_contractid implemented interfaces: nsiexternalhelperappservice preferences service the preferences service provides access to persistent data stored within a user's profile directory. contract-id: ns_pref_contractid implemented interfaces: nsiprefservice nsiprefbranch related interfaces: nsipreflistener profile manager service contract-id: implemented interfaces: docu...
Creating a New Protocol
otocol and what lifetime issues that creates. if there is any doubt, ask on irc in the #content channel. building the new protocol to build the new protocol declaration and generate headers, make in ipc/ipdl: make -c objdir/ipc/ipdl if there are any protocol-level errors, the ipdl compiler will print the relevant error messages and stop. to view the generated headers, look in objdir/ipc/ipdl/_ipdlheaders . creating the implementation the c++ implementation inherits from the abstract ipdl-generated classes pnewprotocolparent and pnewprotocolchild. it must implement abstract methods for receiving the appropriate messages on each side. the method signatures can be read from the generated pnewprotocolparent.h and pnewprotocolchild.h headers. writing the tests protocols which are managed by pbro...
AddonScreenshot
thumbnailurl optional string the url of a thumbnail version of the screenshot. caption optional string the caption of the screenshot. width optional string the width of the screenshot. height optional string the height of the screenshot. thumbnailwidth optional string the thumbnailwidth of the screenshot. thumbnailheight optional string the thumbnailheight of the screenshot. ...
DownloadSummary
view on the contents of a downloadlist. a reference to a downloadsummary object can be obtained using the downloads.getsummary() function. method overview promise bindtolist(downloadlist alist); promise addview(object aview); promise removeview(object aview); properties attribute type description allhavestopped read only boolean indicates whether all the downloads are currently stopped. progresstotalbytes read only number indicates the total number of bytes to be transferred before completing all the downloads that are currently in progress. for downloads that do not have a known final size, the number of bytes currently transferred is...
Http.jsm
httprequest supports the following parameters: name meaning headers an array of headers postdata this can be: a string: send it as is an array of parameters: encode as form values null/undefined: no post data. method get, post or put (this is automatically set if postdata exists). onload a function handle to call when the load is complete, it takes two parameters: the responsetext and the xhr object. ...
OS.File for the main thread
ileuri, which accepts a string). after image loads it then draws it to canvas, makes it a blob, and uses filereader to turn it into arraybuffer(view), then uses os.file.writeatomic to save to disk. var img = new image(); img.onload = function() { var canvas = document.createelementns('http://www.w3.org/1999/xhtml', 'canvas'); canvas.width = img.naturalwidth; canvas.height = img.naturalheight; var ctx = canvas.getcontext('2d'); ctx.drawimage(img, 0, 0); (canvas.toblobhd || canvas.toblob).call(canvas, function(b) { var r = cc['@mozilla.org/files/filereader;1'].createinstance(ci.nsidomfilereader); //new filereader(); r.onloadend = function() { // r.result contains the arraybuffer. var writepath = os.path.join(os.constants.path.des...
WebRequest.jsm
sponse code. types resource types the resource type string identifies the kind of resource being fetched. it's used in two places: filtering requests by type, and as the type property of the argument passed to the listener. ...
JavaScript code modules
ionaries. downloadlastdir.jsm supplies the path to the directory into which the last download occurred. downloads.jsm provides a single entry point to interact with the downloading capabilities of the platform. fileutils.jsm provides helpers for dealing with files. geometry.jsm provides routines for performing basic geometric operations on points and rectangles. http.jsm a wrapper for xmlhttprequest that provides convenient and simplified api for dealing with http requests. jni.jsm abstracts the js-ctypes to provide an interface that allows javascript code to call code running in native jvms. iso8601dateutils.jsm provides routines to convert between javascript date objects and iso 8601 date strings. log.jsm (formerly log4moz) provides a log4j style api for logging, log messag...
Mozilla DOM Hacking Guide
sed as an argument to dom_classinfo_map_begin. a static array of pointers to objects of type nsiid is then declared. it is initialized explicitly with the dom_classinfo_map_entry macro (see below). there are two other similar macros: #define dom_classinfo_map_begin_no_primary_interface(_class) _dom_classinfo_map_begin(_class, nsnull, pr_true) this macro is used if the dom class (for example xmlhttprequest) does not have any interface, yet you want the xmlhttprequest object to be available from javascript. #define dom_classinfo_map_begin_no_class_if(_class, _interface) _dom_classinfo_map_begin(_class, &ns_get_iid(_interface), pr_false) this macro should be used for dom classes that have no "leaf" interface. for example, there is no htmlspanelement in the w3c dom specification. therefor...
Mozilla Web Services Security Model
em allows it. the type attribute the type attribute of the allow element can take the following values: any means that the allow element applies to all services that use web-scripts-access.xml for security checks. there may be more such such services in the future than there are now. this is the same as not having a type attribute. load [not implemented!] ability to load documents via xmlhttprequest or similar mechanisms. soap soap requests without verification headers soapv soap requests with verification headers the from attribute the from attribute on the allow element says which calling sites the allow element applies to. if there is no from attribute then the allow element applies to all sites. the from attribute otherwise gives a url to match, which may contain up to...
Mozilla Quirks Mode Behavior
d attribute sets the background url to empty only in quirks mode. the topmargin, bottommargin, leftmargin, and rightmargin attributes on body are supported only in quirks mode (bug 9258). obsolete since gecko 35 (firefox 35.0 / thunderbird 35.0 / seamonkey 2.32) (bug 95530) this quirk is now html5 conform and has been adopted in standards mode. the scrollleft, scrolltop, scrollwidth, and scrollheight properties are relative to body in quirks mode (instead of html) (bug 211030). html (1-7) and css (xx-small - xx-large) font sizes are calculated slightly differently (see bug 18136). the :hover and :active pseudo-classes will only be applied to links, and only if there is no other pseudo-class in the selector. to match other elements, the selector must include a tag name, id, class or at...
Profiling with the Firefox Profiler
e output is around 100 of mb. to add symbols to your build, you need to call ./scripts/profile-symbolicate.py available in b2g repository. $ gecko_objdir=<objdir> product_out=<objdir> target_tools_prefix= \ ./scripts/profile-symbolicate.py -o run.symb.cleo run.cleo clone cleopatra and start the server with ./run_webserver.sh. access cleopatra from your web browser by loading the page localhost:8000, and upload run.symb.cleo to render the profile with most of the symbol information. native stack vs. label stack the profiler periodically samples the stack of the selected threads in firefox and collects a stack trace. this stack trace is the combined stack of three different stacks: the native stack, the javascript stack, and the label stack. native stack the native stack is the r...
Patches and pushes
er/searchplugins. each plugin is stored as an xml file, with list.txt containing the names of each plugin. here is an example search plugin file using french yahoo. ...
PL_CompareStrings
if the two strings are equal, it returns 1. if the two strings are not equal, it returns 0. ...
PL_CompareValues
compares two void * values numerically. syntax #include <plhash.h> printn pl_comparevalues(const void *v1, const void *v2); description pl_comparevalues compares the two void * values v1 and v2 numerically, i.e., it returns the value of the expression v1 == v2. pl_comparevalues can be used as the comparator function for integer or pointer-valued key or entry value. ...
PL_HashTableAdd
key a pointer to the key for the entry to be added. value a pointer to the value for the entry to be added. returns a pointer to the new entry. description add a new entry with the specified key and value to the hash table. if an entry with the same key already exists in the table, the freeentry function is invoked with the ht_free_value flag. ...
PL_HashTableEnumerateEntries
f function to be applied to each entry. arg argument for function f. returns the number of entries enumerated. description the entries are enumerated in an unspecified order. ...
PL_HashTableLookup
key a pointer to the key for the entry to look up. returns the value of the entry with the specified key, or null if there is no such entry. description if there is no entry with the specified key, pl_hashtablelookup returns null. this means that one cannot tell whether a null return value means the entry does not exist or the value of the entry is null. ...
PL_HashTableRemove
key a pointer to the key for the entry to be removed. description if there is no entry in the table with the specified key, pl_hashtableremove returns pr_false. if the entry exists, pl_hashtableremove removes the entry from the table, invokes freeentry with the ht_free_entry flag to frees the entry, and returns pr_true. ...
NSS 3.21 release notes
trings. ...
NSS 3.35 release notes
ibutions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_35_rtm/src/ new in nss 3.35 new functionality tls 1.3 support has been updated to draft -23. this includes a large number of changes since 3.34, which supported only draft -18. see below for details. new types in sslt.h sslhandshaketype - the type of a tls handshake message. for the sslsignaturescheme enum, the enumerated values ssl_sig_rsa_pss_sha* are deprecated in response to a change in tls 1.3. please use the equivalent ssl_sig_rsa_pss_rsae_sha* for rsaencryption keys, or ssl_sig_rsa_pss_pss_sha* for pss keys. note that this release does not include support for the latter. notable changes in nss 3.35 ...
NSS sources building testing
r network's dns, this should work automatically. in other environments (for example in home networks), you could set the host and domsuf (for domain suffix) environment variables to tell the nss suite which hostname to use. as a test, it must 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...
Necko Architecture
ansport for each type of i/o. necko implements a file transport and a socket transport that the protocol implementations (channels) use to actually move bytes to and from. how do i add my own protocol handler? adding your own protocol handler is a straightforward process in necko. there are a minimum of two interfaces you need to implement in order to fit into the necko architecture: nsiprotocolhandler, and nsichannel. recall, that the ioservice will look up your protocol handler and ask it for a channel. after registering your protocol handler necko will use it to create channels for any uris it encounters that have the scheme your protocol handler registered for. please use existing protocol handler's for reference (the data: protocol handler is the simplest handler necko provides, http...
Proxies in Necko
proxies are implemented transparently to necko users. this means that callers can just create an nsichannel, not needing to worry about whether the channel will use a proxy or not the basic interfaces for proxies are: nsiproxyinfo, nsiprotocolproxyservice, and nsiproxiedprotocolhandler nsiproxyinfo is a simple helper which stores information about the type of the proxy, its host and its port. nsiioservice the decision whether to use a proxy is made in nsioservice::newchannelfromuri. it first asks the nsiprotocolproxyservice for an nsiproxyinfo. depending on the type of the proxy info, it either asks the http protocol handler or the protocol handler for the requested uri for a new channel with the nsiproxyinfo - if the channel supports nsiproxiedprotocolhandler. otherwise, the proxy i...
Pork Tools
caller1 { //case 1 nsresult rv; rv = getter(&var); ns_ensure_success(rv,rv); //case 2: naked call getter(&var); //case 3: nsresult decl nsresult rv2 = getter(&var); ns_ensure_success(rv2,rv2); } caller1 { // case 1 // figure out that rv was only used for the rewritten // outparam call + ns_ensure_success. ...
Hacking Tips
ger you can find the instructions to create the graph (tools v2 > 1. creating a tracelogging graph). note 1: when you are doing this from "file:///" you will probably get a security warning in the console. this is because firefox doesn't allow loading files from the harddisk using httprequest, even when the file loading the file is on the harddisk. there are two solutions. one is to create a localhost server and serving the files there. the simplest way to do this is to run python -m simplehttpserver from within the above directory. the other being disable this check in "about:config", by temporarily switching "security.fileuri.strict_origin_policy" to false note 2: the files can be very big and take a long time to load in the browser. therefore it might be good to reduce the logged file. ...
Index
rmonkey here, ptr represents the private member of js::mutablehandle<t>, typed with t *. 53 js::newfunctionfromspec jsapi reference, reference, référence(2), spidermonkey js::newfunctionfromspec creates a new function based on the given jsfunctionspec, *fs. id is the result of a successful call to propertyspecnametopermanentid(cx, fs->name, &id). 54 js::nullhandlevalue jsapi reference, reference, référence(2), spidermonkey js::nullhandlevalue is a js::handlevalue constant that represents the javascript value null. 55 js::nullvalue jsapi reference, reference, référence(2), spidermonkey js::nullvalue creates a js::value that represents the javascript value null. 56 js::numbervalue jsapi reference, refere...
JS::NullValue
this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value null. syntax js::value js::nullvalue(); description js::nullvalue creates a js::value that represents the javascript value null. see also mxr id search for js::nullvalue js::value js::nullhandlevalue ...
JS::TrueHandleValue
the js::value that represents the javascript value true. ...
JS::UndefinedHandleValue
this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value undefined. syntax const js::handlevalue js::undefinedhandlevalue; description js::undefinedhandlevalue is a js::handlevalue constant that represents the javascript value undefined. see also mxr id search for js::undefinedhandlevalue js::nullhandlevalue js::truehandlevalue js::falsehandlevalue bug 865969 ...
JS_SetFunctionCallback
state of execution. the call stack cannot be relied upon, because this callback may be invoked from the jit code when the stack frame and context are in an indeterminate state. description js_setfunctioncallback sets a c function to be called each time a javascript function is invoked or exits. fcb is a pointer to the c function to call. ...
JSAPI reference
added in spidermonkey 24 js::numbervalue added in spidermonkey 24 js::int32value added in spidermonkey 24 js::doublevalue added in spidermonkey 24 js::float32value added in spidermonkey 24 js::stringvalue added in spidermonkey 24 js::objectvalue added in spidermonkey 24 js::objectornullvalue added in spidermonkey 24 js::symbolvalue added in spidermonkey 38 js::value constants: js::nullhandlevalue added in spidermonkey 24 js::undefinedhandlevalue added in spidermonkey 24 js::truehandlevalue added in spidermonkey 38 js::falsehandlevalue added in spidermonkey 38 jsval constants: jsval_null obsolete since jsapi 42 jsval_void obsolete since jsapi 42 jsval_true obsolete since jsapi 42 jsval_false obsolete since jsapi 42 jsval_zero obsolete since jsapi 42 jsval_one obsolet...
JSDBGAPI
teinstackframe examining object properties typedef jspropertydesc jspd_enumerate jspd_readonly jspd_permanent jspd_alias jspd_argument jspd_variable jspd_exception jspd_error typedef jspropertydescarray js_propertyiterator js_getpropertydesc js_getpropertydescarray js_putpropertydescarray hooks js_setdebuggerhandler js_setsourcehandler js_setexecutehook js_setcallhook js_setobjecthook js_setthrowhook js_setdebugerrorhook js_setnewscripthook js_setdestroyscripthook js_getglobaldebughooks js_setcontextdebughooks memory usage js_getobjecttotalsize js_getfunctiontotalsize js_getscripttotalsize system objects js_issystemobject js_newsystemobject profiling these functions can be used to profile a spidermonkey application using the mac pr...
Web Replay
tween recording and replay, and the points where gcs occur, and the set of objects collected, may differ. this non-determinism is prevented from spreading too far with the following techniques: different pointer values can affect the internal layout of hash tables. to prevent this from having an effect on iteration order (and execution behavior) in the table, the main table classes (for now plhashtable and pldhashtable) are instrumented so that they always iterate over elements in the order they were added when recording or replaying. differing gc behavior can cause object finalizers to run at different times. to prevent this from having an effect on execution behavior, gc finalizers which can affect the recording are instrumented so that the finalizer action is performed at the same ...
ROLE_COLUMNHEADER
« gecko roles page represents a column header, providing a visual label for a column in a table. also refer to role_table. interfaces nsiaccessnode nsiaccessible mapped to at-spi: role_table atk: atk_role_column_header ua: nsaccessibilitygrouprole msaa/ia2: role_system_columnheader used by aria: colheader xul: <listheader/> html: <th> ...
Places utilities for JavaScript
.getservice(components.interfaces.nsinavbookmarksservice); with places utils all you need to write is: placesutils.bookmarks this should save on the number of references to the service that are needed, and can help clean up interfaces that are already fairly cluttered. there are currently 11 services defined in here. bookmarks nsinavbookmarksservice history nsinavhistoryservice globalhistory nsibrowserhistory livemarks nsilivemarkservice annotations nsiannotationservice favicons nsifaviconservice microsummaries nsimicrosummaryservice tagging nsitaggingservice rdf nsirdfservice ptm nsiplacestransactionsservice clipboard nsiclipboard urifixup nsiurifixup special places these are essentially references to the id's of special folders within places. they can sa...
Aggregating the In-Memory Datasource
implementation needs to forward nsirdfdatasource to the delegate3: ns_imethodimp myclass::queryinterface(refnsiid aiid, void** aresult) { ns_precondition(aresult != nsnull, "null ptr"); if (! ...
Components.utils.Sandbox
able as a global to code running in the sandbox. the exception is "-promise": the promise constructor is available by default for sandboxes, and you use this option to remove it from the sandbox. note that "-promise" is removed in firefox 37. ...
HOWTO
top of your js file which you want to run in xpcshell { // <https://developer.mozilla.org/en/xpconnect/xpcshell/howto> // <https://bugzilla.mozilla.org/show_bug.cgi?id=546628> let cc = components.classes; let ci = components.interfaces; // register resource://app/ uri let ios = cc["@mozilla.org/network/io-service;1"] .getservice(ci.nsiioservice); let reshandler = ios.getprotocolhandler("resource") .queryinterface(ci.nsiresprotocolhandler); let mozdir = cc["@mozilla.org/file/directory_service;1"] .getservice(ci.nsiproperties) .get("curprocd", ci.nsilocalfile); let mozdiruri = ios.newfileuri(mozdir); reshandler.setsubstitution("app", mozdiruri); // register chrome://* uris let cr = cc["@mozilla.org/chrome/chrome-registry;1"] .getservice(...
mozIThirdPartyUtil
nel. isthirdpartyuri() determine whether two uris are third party with respect to each other. this is determined by computing the base domain for both uris. if they can be determined, and the base domains match, the request is defined as first party. if it cannot be determined because one or both uris do not have a base domain (for instance, in the case of ip addresses, host aliases such as 'localhost', or a file:// uri), an exact string comparison on host is performed. for example, the uri "http://mail.google.com/" is not third party with respect to "http://images.google.com/", but "http://mail.yahoo.com/" and "http://192.168.1.1/" are. boolean isthirdpartyuri( in nsiuri afirsturi, in nsiuri aseconduri ); parameters afirsturi missing description aseconduri missing description return...
nsIAccessibilityService
rts aframe, in nsisupports abulletframe, in astring abullettext); nsiaccessible createhtmlcheckboxaccessible(in nsisupports aframe); nsiaccessible createhtmlcomboboxaccessible(in nsidomnode anode, in nsiweakreference apresshell); nsiaccessible createhtmlgenericaccessible(in nsisupports aframe); nsiaccessible createhtmlgenericaccessible(in nsisupports aframe); nsiaccessible createhtmlhraccessible(in nsisupports aframe); nsiaccessible createhtmlimageaccessible(in nsisupports aframe); nsiaccessible createhtmllabelaccessible(in nsisupports aframe); nsiaccessible createhtmllabelaccessible(in nsidomnode anode, in nsiweakreference apresshell); nsiaccessible createhtmlobjectframeaccessible(in nsobjectframe aframe); nsiaccessible createhtmlradiobuttonaccessible(in nsisup...
nsIAccessibleRole
a table that contains rows and columns of cells, and optionally, row headers and column headers. it is used for html:table, role="grid". also refer to the following roles: role_columnheader, role_rowheader, role_column, role_row, role_cell. role_columnheader 25 represents a column header, providing a visual label for a column in a table. it is used for xul tree column headers, html:th, role="colheader". also refer to role_table. role_rowheader 26 represents a row header, which provides a visual label for a table row. it is used for role="rowheader". also, see role_table. role_column 27 represents a column of cells within a table. also, see role_table. role_row 28 represents a row of cells within a table. also, see role_table. role_cell 29 represents a cell within a table. it is us...
nsIDOMNSHTMLDocument
omain domstring initially the host name of the document's url, but may be changed to the parent (but not top-level) domain in order to facilitate data exchange between documents from different sites in the same domain. embeds nsidomhtmlcollection equivalent to getelementsbytagname("embed") read only. fgcolor domstring same as body.text head nsidomhtmlheadelement returns the first child element of the html element that is a head element, or null if there is no html or head element. read only. height long the height of the body element. read only. obsolete since gecko 6.0 linkcolor domstring same as body.link plugins nsidomhtmlcollection same as embeds for compatibility with netscape 4.x read only.
nsIDocShell
ption kcharsetuninitialized 0 the character set has not yet been initialized. kcharsetfromweakdoctypedefault 1 kcharsetfromuserdefault 2 the user's default character set is being used. kcharsetfromdoctypedefault 3 the character set has been inferred from the doctype. all values from here upward are confident enough to be used for xmlhttprequest. kcharsetfromcache 4 the character set has been retrieved from the cache. kcharsetfromparentframe 5 the parent frame's character set is being used. kcharsetfromautodetection 6 the character set was automatically detected. kcharsetfromhintprevdoc 7 the character set was hinted by the previous document. kcharsetfrommetap...
nsIHttpServer
optional options. ...
nsIMsgFilterList
defined in comm-central/ mailnews/ base/ search/ public/ nsimsgfilterlist.idl attributes folder attribute nsimsgfolder nsimsgfilterlist::folder version readonly attribute short nsimsgfilterlist::version arbitraryheaders readonly attribute acstring nsimsgfilterlist::arbitraryheaders shoulddownloadallheaders readonly attribute boolean nsimsgfilterlist::shoulddownloadallheaders filtercount readonly attribute unsigned long nsimsgfilterlist::filtercount loggingenabled attribute boolean nsimsgfilterlist::loggingenabled defaultfile attribute nsilocalfile nsimsgfilterlist::defaultfile logstream attribute nsioutputstream nsimsgfilterlist::logstream logurl readonly attribute acstring nsimsgfilterlist::logurl methods getfilterat() nsimsgfilter nsimsgfilterlist::getfilterat (in unsign...
nsIMsgIncomingServer
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 set. realhostname acstring real hostname of the server (if server name is changed it is stored here) realusername acstring real username of the server (if username is changed it is stored here) redirectortype string obsolete since gecko 1.9 rememberpassword boolean retentionsettings nsimsgretentionsettings rootfolder nsimsgfolder rootmsgfolder nsimsgfolder read only. searchscope nsmsgsea...
nsISocketTransportService
instead. ahost specifies the target hostname or ip address literal of the peer for this socket. aport specifies the target port of the peer for this socket. aproxyinfo specifies the transport-layer proxy type to use. set to null if no proxy should be used. for more details on communicating information about proxies like socks (which are transparent to upper protocols), see nsiproxiedprotocolhandler , nsiprotocolproxyservice or proxies in necko. return value an nsisockettransport containing the sockettransport. init() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) void init(); parameters none. native code only! notifywhencanattachsocket if the number of sockets reaches the limit, then consumers can be notified when the number of sockets becomes le...
nsITraceableChannel
ister for the "http-on-examine-response" notification to track all http responses; skip redirects (responsestatus = 3xx on nsihttpchannel), since otherwise you may end up with two listeners registered for a channel; qi the channel passed as the "subject" to your observer to nsitraceablechannel, and replace the default nsistreamlistener (that passes the data to the original requester - e.g. to xmlhttprequest or to the browser tab that made the request) with your own implementation (see "implementing nsistreamlistener" below). after that your nsistreamlistener implementation will get the response data and will be able to pass the data on to the original nsistreamlistener (possibly modifying it). see nsitraceablechannel, intercept http traffic for a more detailed description with code samp...
Setting HTTP request headers
http is one of the core technologies behind the web. in addition to the actual content, some important information is passed with http headers for both http requests and responses. you can add your own http headers to any request the application makes, whether the request is initiated by your code explicitly opening an http channel, because of xmlhttprequest activity, an <img> element in content, or even from css. http channels when you deal with http requests and responses, typically you are doing this with an nsihttpchannel. the nsihttpchannel interface has a number of properties and methods, but the method that is of interest to us is setrequestheader. this method allows us to set an http request header. below is some sample code where we set an http header. // adds "x-hello: worl...
Mozilla
be reflected into gecko-internal code. working with windows in chrome code this article describes working with multiple windows in mozilla chrome code (xul applications and extensions). it contains tips and example code on opening new windows, finding an already opened window, and passing data between different windows. xmlhttprequest changes for gecko1.8 this document describes some of the changes that have been made to gecko's xmlhttprequest implementation since version 1.7 (i.e., the version of gecko that shipped with firefox 1.0). these changes only apply to xul extensions and xul applications. they do not apply to web applications. xpi c...
Set an XHR breakpoint - Firefox Developer Tools
you can break on all requests or on those that include a specific url. to turn on the feature: open the debugger click on "pause on any url" which acts as a wild card, causing the code to pause on any call, or, click the plus sign next to the xhr breakpoints header, enter the url in which you are interested, and press enter. note: if you enter a key word instead of a url, code execution will pause on any call to a url that contains that keyword. ...
Source map errors - Firefox Developer Tools
loading source maps for web extensions. see bug 1437937: webextensions doesn't find source maps for details. source-map-fehler: typeerror: networkerror when attempting to fetch resource. ressourcen-adresse: moz-extension://c7f0f003-4fcf-49fd-8ec0-c49361266581/background.js source-map-adresse: background.js.map the only workaround is to manually change the map url to a public one (http://localhost:1234/file.map.js) and start a local webserver at this port. ...
Migrating from Firebug - Firefox Developer Tools
spect object properties by clicking on an object logged within the console you can inspect the object's properties and methods within the dom panel. in the firefox devtools you can also inspect the objects. the difference is that they show the properties and methods within a side panel inside the web console. show network requests the console panel in firebug allows to log ajax requests (aka xmlhttprequests). this option is also available within the devtools web console via the net > xhr. furthermore, the web console even allows to display all other network requests via net > log. view json and xml structures to view json and xml responses of ajax requests, firebug has special tabs when expanding the request within the console panel. the devtools web console shows those structures direc...
Network Monitor - Firefox Developer Tools
opening the network monitor there are a few different ways to open the network monitor: press ctrl + shift + e ( command + option + e on a mac). select "network" from the web developer menu, (which is a submenu of the tools menu on os x and linux). click the wrench icon (), which is in the main toolbar or under the hamburger menu (), then select "network". the network monitor will appear at the bottom of the browser window. ...
Console messages - Firefox Developer Tools
save an export of all messages available in the display pane. message categories network network log messages are not shown by default. use the filtering feature to show them. network requests are logged with a line that looks like this: time the time the message was recorded. method the specific http request method. if the request was made as an xmlhttprequest, there's an additional "xhr" tag indicating this. if more information is available, a disclosure triangle lets you display it, in an embedded panel that is identical to the network monitor request details. uri the target uri. summary the http version, response code, and time taken to complete. clicking the response code takes you to the reference page fo...
Animation.oncancel - Web APIs
mation interface is the event handler for the cancel event. the cancel event can be triggered manually with animation.cancel() when the animation enters the "idle" play state from another state, such as when the animation is removed from an element before it finishes playing creating a new animation that is initially idle does not trigger a cancel event on the new animation. syntax var cancelhandler = animation.oncancel; animation.oncancel = cancelhandler; value a function to be executed when the animation is cancelled, or null if there is no cancel event handler. examples if this animation is canceled, remove its element. animation.oncancel = function() { animation.effect.target.remove(); }; specifications specification status comment web animationsthe...
AudioBufferSourceNode.loop - Web APIs
nction is used to decode an audio track and put it into an audiobuffersourcenode. buttons are provided to play and stop the audio playback, and a slider control is used to change the playbackrate property value on the fly. when the audio is played, it loops. ...
AudioBufferSourceNode.loopEnd - Web APIs
yback, the sound will play normally until it reaches the 25 second mark. then the current play position will loop back to the 20 second mark and continue playing until the 25 second mark, ad infinitum (or at least until stop() is called). for a full working example, see this code running live, or view the source. ...
AudioBufferSourceNode.loopStart - Web APIs
to the end, it loops, but you can control how long the loops last by altering loopstart and loopend. for example, if you set their values to 20 and 25, respectively, the audio will start to loop between 20 and 25 seconds in to the track. for a full working example, see this code running live, or view the source. ...
AudioBufferSourceNode.playbackRate - Web APIs
s used to change the playbackrate property value on the fly. you can run the example live (or view the source.) play the song and alter the playback rate for some fun results. ...
AudioProcessingEvent - Web APIs
eate audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with a buffersize of 4096 and a single input and output channel var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); // load in an audio track via xhr and decodeaudiodata function getdata() { request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function ...
BaseAudioContext.createConvolver() - Web APIs
rowd, so the reverb effect applied is really deep and echoey. for applied examples/information, check out our voice-change-o-matic demo (see app.js for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var convolver = audioctx.createconvolver(); ... ...
BaseAudioContext.createScriptProcessor() - Web APIs
eate audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with a buffersize of 4096 and a single input and output channel var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); // load in an audio track via xhr and decodeaudiodata function getdata() { request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function ...
BaseAudioContext - Web APIs
xt.createstereopanner() creates a stereopannernode, which can be used to apply stereo panning to an audio source. baseaudiocontext.createwaveshaper() creates a waveshapernode, which is used to implement non-linear distortion effects. baseaudiocontext.decodeaudiodata() asynchronously decodes audio file data contained in an arraybuffer. in this case, the arraybuffer is usually loaded from an xmlhttprequest's response attribute after setting the responsetype to arraybuffer. this method only works on complete files, not fragments of audio files. examples basic audio context declaration: const audiocontext = new audiocontext(); cross browser variant: const audiocontext = window.audiocontext || window.webkitaudiocontext; const audiocontext = new audiocontext(); const oscillatornode = a...
Using images - Web APIs
the scope of this tutorial to look at image pre-loading tactics, but you should keep that in mind. embedding an image via data: url another possible way to include images is via the data: url. data urls allow you to completely define an image as a base64 encoded string of characters directly in your code. var img = new image(); // create new img element img.src = 'data:image/gif;base64,r0lgodlhcwalaiaaaaaa3pn/zih5baeaaaealaaaaaalaasaaaiuha+hkcuo4lmnvindo7qyrixigbyaow=='; one advantage of data urls is that the resulting image is available immediately without another round trip to the server. another potential advantage is that it is also possible to encapsulate in one file all of your css, javascript, html, and images, making it more portable to other locations. some disadvantages of ...
ConvolverNode.buffer - Web APIs
te is null. syntax var audioctx = new audiocontext(); var convolver = audioctx.createconvolver(); convolver.buffer = myaudiobuffer; value an audiobuffer. example var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var convolver = audioctx.createconvolver(); ... ...
ConvolverNode.normalize - Web APIs
ffer attribute is set. syntax var audioctx = new audiocontext(); var convolver = audioctx.createconvolver(); convolver.normalize = false; value a boolean. example var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var convolver = audioctx.createconvolver(); ... ...
DOMParser - Web APIs
Web › API › DOMParser
you can perform the opposite operation—converting a dom tree into xml or html source—using the xmlserializer interface. in the case of an html document, you can also replace portions of the dom with new dom trees built from html by setting the value of the element.innerhtml and outerhtml properties. these properties can also be read to fetch html fragments corresponding to the corresponding dom subtree. ...
Document.head - Web APIs
Web › API › Document › head
example <!doctype html> <head id="my-document-head"> <title>example: using document.head</title> </head> <script> var thehead = document.head; console.log(thehead.id); // "my-document-head"; console.log( thehead === document.queryselector("head") ); // true </script> notes document.head is read-only. trying to assign a value to this property will fail silently or, in strict mode, throws a typeerror . ...
Document.height - Web APIs
Web › API › Document › height
orted. ...
Document.lastModified - Web APIs
athname; if (isfinite(nlastvisit)) { alert("this page has been changed!"); } } note: webkit returns the time string in utc; gecko and internet explorer return a time in the local timezone. (see: bug 4363 – document.lastmodified returns date in utc time, but should return it in local time) if you want to know whether an external page has changed, please read this paragraph about the xmlhttprequest() api. specifications specification status comment html living standardthe definition of 'document.lastmodified' in that specification. living standard ...
Document - Web APIs
Web › API › Document
ther the document is rendered in quirks or strict mode. document.contenttype read only returns the content-type from the mime header of the current document. document.doctyperead only returns the document type definition (dtd) of the current document. document.documentelementread only returns the element that is a direct child of the document. for html documents, this is normally the htmlhtmlelement object representing the document's <html> element. document.documenturiread only returns the document location as a string. document.embedsread only returns a list of the embedded <embed> elements within the current document. document.fonts returns the fontfaceset interface of the current document. document.formsread only returns a list of the <form> elements within the curre...
How to create a DOM tree - Web APIs
you can use dom trees to model data which isn't well-suited for rdf (or perhaps you just don't like rdf). another application is that, since xul is xml, the ui of your application can be dynamically manipulated, downloaded, uploaded, saved, loaded, converted, or transformed quite easily. ...
Event.eventPhase - Web APIs
Web › API › Event › eventPhase
nstants event phase constants these values describe which phase the event flow is currently being evaluated. constant value description event.none 0 no event is being processed at this time. event.capturing_phase 1 the event is being propagated through the target's ancestor objects. this process starts with the window, then document, then the htmlhtmlelement, and so on through the elements until the target's parent is reached. event listeners registered for capture mode when eventtarget.addeventlistener() was called are triggered during this phase. event.at_target 2 the event has arrived at the event's target. event listeners registered for this phase are called at this time. if event.bubbles is false, processing the event is...
EventTarget.addEventListener() - Web APIs
addeventlistener() works by adding a function or an object that implements eventlistener to the list of event listeners for the specified event type on the eventtarget on which it's called. ...
EventTarget - Web APIs
many event targets (including elements, documents, and windows) also support setting event handlers via onevent properties and attributes. ...
Fetch basic concepts - Web APIs
this article explains some of the basic concepts of the fetch api. note: this article will be added to over time. if you find a fetch concept that you feel needs explaining better, let someone know on the mdn discussion forum, or mdn web docs room on matrix. ...
Fetch API - Web APIs
Web › API › Fetch API
concepts and usage fetch provides a generic definition of request and response objects (and other things involved with network requests). ...
File - Web APIs
Web › API › File
re generally retrieved from a filelist object returned as a result of a user selecting files using the <input> element, from a drag and drop operation's datatransfer object, or from the mozgetasfile() api on an htmlcanvaselement. a file object is a specific kind of a blob, and can be used in any context that a blob can. in particular, filereader, url.createobjecturl(), createimagebitmap(), and xmlhttprequest.send() accept both blobs and files. see using files from web applications for more information and examples. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserve...
FileHandle API - Web APIs
ontent of the file is:'); console.log(this.result); } reading.onerror = function () { console.log('something goes wrong in the reading process: ' + this.error); } } file snapshot in many cases it can be handy to get a snapshot of the file. for example, there are many apis that expect blob or file objects such as filereader (which can be easier to use to read the whole file) or xmlhttprequest. it's possible to get a file object representing the current state of the file handled by the filehandle object by using the getfile method. such a file object is completely desynchronized from the original file, which means any change made to that object will never be reflected to the handled file as well as any change made to the handled file will never be pushed to the file object. ...
Introduction to the File and Directory Entries API - Web APIs
optional for your sanity. you want to know why your calls failed. at minimum, handle the errors to provide error messages, so you'll have an idea of what's going on. the file and directory entries api interacts with other apis the file and directory entries api is designed to be used with other apis and elements on the web platform. for example, you are likely to use one of the following: xmlhttprequest (such as the send() method for file and blob objects) drag and drop api web workers (for the synchronous version of the file and directory entries api) the input element (to programmatically obtain a list of files from the element) the file and directory entries api is case sensitive the filesystem api is case-sensitive, and case-preserving. restrictions for security reasons, b...
FormData() - Web APIs
Web › API › FormData › FormData
e="submit" value="submit!"> </form> note: only successful form controls are included in a formdata object, i.e. those with a name, not disabled and checked (radio buttons and checkboxes) or selected (one or more options within a select). let myform = document.getelementbyid('myform'); let formdata = new formdata(myform); specifications specification status comment xmlhttprequestthe definition of 'formdata()' in that specification. living standard initial definition ...
FormData.append() - Web APIs
Web › API › FormData › append
ti-file uploads because the resultant data structure is more conducive to looping. if the sent value is different than string or blob it will be automatically converted to string: formdata.append('name', true); formdata.append('name', 74); formdata.append('name', 'john'); formdata.getall('name'); // ["true", "74", "john"] specifications specification status comment xmlhttprequestthe definition of 'append()' in that specification. living standard initial definition ...
FormData.delete() - Web APIs
Web › API › FormData › delete
ete(name); parameters name the name of the key you want to delete. returns void. example the following line creates an empty formdata object and prepopulates it with key/value pairs from a form: var formdata = new formdata(myform); you can delete keys and their values using delete(): formdata.delete('username'); specifications specification status comment xmlhttprequestthe definition of 'delete()' in that specification. living standard ...
FormData.entries() - Web APIs
Web › API › FormData › entries
value returns an iterator. example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the key/value pairs for(var pair of formdata.entries()) { console.log(pair[0]+ ', '+ pair[1]); } the result is: key1, value1 key2, value2 specifications specification status comment xmlhttprequestthe definition of 'entries() (as iterator<>)' in that specification. living standard initial definition ...
FormData.get() - Web APIs
Web › API › FormData › get
living standard ...
FormData.getAll() - Web APIs
Web › API › FormData › getAll
living standard ...
FormData.has() - Web APIs
Web › API › FormData › has
living standard ...
FormData.keys() - Web APIs
Web › API › FormData › keys
web workers. syntax formdata.keys(); return value returns an iterator. example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the keys for (var key of formdata.keys()) { console.log(key); } the result is: key1 key2 specifications specification status comment xmlhttprequestthe definition of 'keys() (as iterator<>)' in that specification. living standard initial definition ...
FormData.set() - Web APIs
Web › API › FormData › set
living standard ...
FormData.values() - Web APIs
Web › API › FormData › values
syntax formdata.values(); return value returns an iterator. example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the values for (var value of formdata.values()) { console.log(value); } the result is: value1 value2 specifications specification status comment xmlhttprequestthe definition of 'values() (as iterator<>)' in that specification. living standard initial definition ...
FormDataEvent.formData - Web APIs
living standard ...
GlobalEventHandlers.onanimationcancel - Web APIs
events. an animationcancel event is sent when a css animation unexpectedly aborts, that is, any time it stops running without sending an animationend event. this can happen, for example, when the animation-name is changed such that the animation is removed, or when the animating node is hidden—either directly or because any of its containing nodes are hidden—using css. syntax var animcancelhandler = target.onanimationcancel; target.onanimationcancel = function value a function to be called when an animationcancel event occurs indicating that a css animation has begun on the target, where the target object is an html element (htmlelement), document (document), or window (window). the function receives as input a single parameter: an animationevent object describing the event which...
GlobalEventHandlers.onformdata - Web APIs
living standard ...
GlobalEventHandlers.onload - Web APIs
the load event fires when a given resource has loaded. syntax target.onload = functionref; value functionref is the handler function to be called when the window’s load event fires. ...
GlobalEventHandlers.onpointercancel - Web APIs
the onpointercancel property of the globaleventhandlers mixin is an eventhandler that processes pointercancel events. syntax targetelement.onpointercancel = cancelhandler; var cancelhandler = targetelement.onpointercancel; value cancelhandler the pointercancel event handler for element targetelement. example this example shows two ways to use onpointercancel to handle an element's pointercancel events. <html> <script> function cancelhandler(ev) { // process the pointercancel event } function init() { var el = document.getelementbyid('target1'); el.onpointercancel = cancelhandler; } </script> <body onload="init();"> <div id="target1"> touch me ... </div> <div id="target2" onpointercancel="cancelhandler(event)"> touch me ... </div> </body> </html> specifications ...
GlobalEventHandlers.ontouchcancel - Web APIs
the ontouchcancel property of the globaleventhandlers mixin is an eventhandler that processes touchcancel events. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var cancelhandler = someelement.ontouchcancel; return value cancelhandler the touchcancel event handler for element someelement. example this example shows two ways to use ontouchcancel to set an element's touchcancel event handler. <html> <script> function canceltouch(ev) { // process the event } function init() { let el = document.getelementbyid('target1'); el.ontouchcancel = canceltouch; } </script> <body onload="init();"> <div id="...
GlobalEventHandlers.ontransitioncancel - Web APIs
ioncancel events. the transitioncancel event is sent when a css transition is cancelled. the transition is cancelled when: the value of the transition-property property that applies to the target is changed the display property is set to "none". the transition is stopped before it has run to completion, e.g. by moving the mouse off a hover-transitioning element. syntax var transitioncancelhandler = target.ontransitioncancel; target.ontransitioncancel = function value a function to be called when a transitioncancel event occurs indicating that a css transition has been cancelled on the target, where the target object is an html element (htmlelement), document (document), or window (window). the function receives as input a single parameter: a transitionevent object describing the...
HTMLFormElement: formdata event - Web APIs
// construct a formdata object, which fires the formdata event new formdata(formelem); }); // formdata handler to retrieve data formelem.addeventlistener('formdata', (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr var request = new xmlhttprequest(); request.open("post", "/formhandler"); request.send(data); }); the onformdata version would look like this: formelem.onformdata = (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr var request = new xmlhttprequest(); req...
Image() - Web APIs
usage note the entire bitmap is loaded regardless of the sizes specified in the constructor. the size specified in the constructor is reflected through the properties htmlimageelement.width and htmlimageelement.height of the resulting instance. the intrinsic width and height of the image in css pixels are reflected through the properties htmlimageelement.naturalwidth and htmlimageelement.naturalheight. if no size is specified in the constructor both pairs of properties have the same values. examples var myimage = new image(100, 200); myimage.src = 'picture.jpg'; document.body.appendchild(myimage); this would be the equivalent of defining the following html tag inside the <body>: <img width="100" height="200" src="picture.jpg"> specifications specification status comm...
HTMLImageElement.height - Web APIs
the height of the image. the terms in which the height is defined depends on whether the image is being rendered to a visual medium or not. if the image is being rendered to a visual medium such as a screen or printer, the height is expressed in css pixels. otherwise, the image's height is represented using its natural (intrinsic) height, adjusted for the display density as indicated by naturalheight. example in this example, two different sizes are provided for an image of a clock using the srcset attribute. one is 200px wide and the other is 400px wide. further, the sizes attribute is provided to specify the width at which the image should be drawn given the viewport's width. html specifically, for viewports up to 400px wide, the image is drawn at a width of 200px; otherwise, it's...
HTMLTableElement.frame - Web APIs
is a string that indicates which of the table's exterior borders should be drawn. syntax htmltableelement.frame = framesides; var framesides = htmltableelement.frame; parameters framesides is a string whose value is one of the following values: void no sides. ...
HTMLTableElement - Web APIs
ent.cellspacing is a domstring containing the width in pixels of the horizontal and vertical separation between cells. it reflects the obsolete cellspacing attribute. htmltableelement.frame is a domstring containing the type of the external borders of the table. it reflects the obsolete frame attribute and can take one of the following values: "void", "above", "below", "hsides", "vsides", "lhs", "rhs", "box", or "border". htmltableelement.rules is a domstring containing the type of the internal borders of the table. it reflects the obsolete rules attribute and can take one of the following values: "none", "groups", "rows", "cols", or "all". htmltableelement.summary is a domstring containing a description of the purpose or the structure of the table. it reflects the obsolete su...
Working with the History API - Web APIs
html5 introduced the pushstate() and replacestate() methods for add and modifying history entries, respectively. these methods work in conjunction with the onpopstate event. adding and modifying history entries using pushstate() changes the referrer that gets used in the http header for xmlhttprequest objects created after you change the state. the referrer will be the url of the document whose window is this at the time of creation of the xmlhttprequest object. example of pushstate() method suppose http://mozilla.org/foo.html executes the following javascript: let stateobj = { foo: "bar", } history.pushstate(stateobj, "page 2", "bar.html") this will cause the url bar to display http://mozilla.org/bar.html, but won't cause the browser to load bar.html or even check that...
Basic concepts - Web APIs
e, or "retrieve" a value out of the database through synchronous means. instead, you "request" that a database operation happens. you get notified by a dom event when the operation finishes, and the type of event you get lets you know if the operation succeeded or failed. this sounds a little complicated at first, but there are sanity measures baked in. it's not that different from the way that xmlhttprequest works. indexeddb uses a lot of requests. requests are objects that receive the success or failure dom events that were mentioned previously. they have onsuccess and onerror properties, and you can call addeventlistener() and removeeventlistener() on them. they also have readystate, result, and errorcode properties that tell you the status of the request. the result property is par...
Key Values - Web APIs
"goback" the back button. keycode_back (4) "gohome" [1] the home button. returns the user to the phone's main screen (usually an application launcher). keycode_home (3) "headsethook" the headset hook key. this is typically actually a button on the headset which is used to hang up calls and play or pause media. qt::key_togglecallhangup (0x01100007) keycode_headsethook (79) "lastnumberredial" the redial button. redials the last-called number. qt::key_lastnumberredial (0x01100009) "notification" the notification key. keycode_notification (83) "mannermode" a button which cycles among the notification modes: silent, vibrate, ring, and so forth. ...
Location - Web APIs
Web › API › Location
rrent resource with the one at the provided url (redirects to the provided url). the difference from the assign() method and setting the href property is that after using replace() the current page will not be saved in session history, meaning the user won't be able to use the back button to navigate to it. location.tostring() returns a usvstring containing the whole url. it is a synonym for htmlhyperlinkelementutils.href, though it can't be used to modify the value. examples // create anchor element and use href property for the purpose of this example // a more correct alternative is to browse to the url and use document.location or window.location var url = document.createelement('a'); url.href = 'https://developer.mozilla.org:8080/search?q=url#search-results-close-container'; consol...
MediaDevices.getUserMedia() - Web APIs
s specification lays out a wide array of privacy 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 de...
MediaSource.endOfStream() - Web APIs
optional a domstring representing an error to throw when the end of the stream is reached. the possible values are: network: terminates playback and signals that a network error has occured. this can be used create a custom error handler related to media streams. for example, you might have a function that handles media chunk requests, separate from other network requests. when you make an xmlhttprequest call for a media chunk, and onabort or onerror triggers, you might want to call endofstream('network'), display a descriptive message in the ui, and maybe retry the network request immediately or wait until the network is back up (via some kind of polling.) decode: terminates playback and signals that a decoding error has occured. this can be used to indicate that a parsing error has ...
Navigation Timing API - Web APIs
ally been used to collect similar information, the navigation timing api can be much more accurate and reliable. this article currently describes navigation timing level 1. there is a specification for level 2, but it is not yet covered here. concepts and usage you can use the navigation timing api to gather performance data on the client side, which you can then transmit to a server using xmlhttprequest or other techniques. this api lets you measure data that was previously difficult to obtain, such as the amount of time needed to unload the previous page, how long domain lookups take, the total time spent executing the window's load handler, and so forth. interfaces performance the window.performance property returns a performance object. while this interface is defined by the h...
Navigator - Web APIs
Web › API › Navigator
eturns true if a call to navigator.share() would succeed. navigator.getusermedia() after having prompted the user for permission, returns the audio or video stream associated to a camera or microphone on the local computer. navigator.registercontenthandler() obsolete since gecko 59 allows web sites to register themselves as a possible handler for a given mime type. navigator.registerprotocolhandler() allows web sites to register themselves as a possible handler for a given protocol. navigator.requestmediakeysystemaccess() returns a promise for a mediakeysystemaccess object. navigator.sendbeacon() used to asynchronously transfer a small amount of data using http from the user agent to a web server. navigator.share() invokes the native sharing mechanism of the current platfor...
Online and offline events - Web APIs
references 'online/offline events' section from the whatwg web applications 1.0 specification the bug tracking online/offline events implementation in firefox and a follow-up a simple test case an explanation of online/offline events ...
NonDocumentTypeChildNode.nextElementSibling - Web APIs
console.log('siblings of div-01:'); while (el) { console.log(el.nodename); el = el.nextelementsibling; } </script> this example outputs the following into the console when it loads: siblings of div-01: div script polyfill for internet explorer 8 this property is unsupported prior to ie9, so the following snippet can be used to add support to ie8: // source: https://github.com/alhadis/snippets/blob/master/js/polyfills/ie8-child-elements.js if(!("nextelementsibling" in document.documentelement)){ object.defineproperty(element.prototype, "nextelementsibling", { get: function(){ var e = this.nextsibling; while(e && 1 !== e.nodetype) e = e.nextsibling; return e; } }); } polyfill for internet explorer ...
NonDocumentTypeChildNode.previousElementSibling - Web APIs
ame + '</li>'); el = el.previouselementsibling; } document.write('</ol>'); </script> this example outputs the following into the page when it loads: siblings of div-03 1. li 2. li 3. div 4. ...
OfflineAudioContext.startRendering() - Web APIs
fline-audio-context-promise github repo (see the source code too.) // define online and offline audio context var audioctx = new audiocontext(); var offlinectx = new offlineaudiocontext(2,44100*40,44100); source = offlinectx.createbuffersource(); // use xhr to load an audio track, and // decodeaudiodata to decode it and offlineaudiocontext to render it function getdata() { request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; source.connect(offlinectx.destination); source.start(); //source.loop = true; offlinectx.s...
OfflineAudioContext - Web APIs
fline-audio-context-promise github repo (see the source code too.) // define online and offline audio context var audioctx = new audiocontext(); var offlinectx = new offlineaudiocontext(2,44100*40,44100); source = offlinectx.createbuffersource(); // use xhr to load an audio track, and // decodeaudiodata to decode it and offlineaudiocontext to render it function getdata() { request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; source.connect(offlinectx.destination); source.start(); //source.loop = true; offlinectx.s...
PerformanceResourceTiming.initiatorType - Web APIs
the initiatortype read-only property is a string that represents the type of resource that initiated the performance event. the value of this string is as follows: if the initiator is a element, the property returns the element's localname. if the initiator is a css resource, the property returns "css". if the initiator is a xmlhttprequest object, the property returns "xmlhttprequest". if the initiator is a performancenavigationtiming object, the property returns an empty string (""). note: this feature is available in web workers. syntax resource.initiatortype; return value a string representing the type of resource that initiated the performance event, as specified above. example function print_performanceentries() { // use getentriesbytype() to just get the "resource" e...
PerformanceResourceTiming - Web APIs
the performanceresourcetiming interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources. an application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an xmlhttprequest, <svg>, image, or script. the interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, fetch start, dns lookup start and end times, response start and end times, etc.. additionally, the interface extends performanceentry with other properties which provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. <div id="interfacediagram" style="dis...
ProgressEvent() - Web APIs
elf, not headers and other overhead. it defaults to 0. total optional is an unsigned long long representing the total amount of work that the underlying process is in the progress of performing. when downloading a resource using http, this only represent the content itself, not headers and other overhead. it defaults to 0. specifications specification status comment xmlhttprequestthe definition of 'progressevent()' in that specification. living standard ...
ProgressEvent.lengthComputable - Web APIs
living standard ...
ProgressEvent.loaded - Web APIs
eger representing the amount of work already performed by the underlying process. the ratio of work done can be calculated with the property and progressevent.total. when downloading a resource using http, this only represent the part of the content itself, not headers and other overhead. syntax value = progressevent.loaded specifications specification status comment xmlhttprequestthe definition of 'progressevent.loaded' in that specification. living standard ...
ProgressEvent.total - Web APIs
living standard ...
PushManager.subscribe() - Web APIs
}, function(error) { // during development it often helps to log errors to the // console. in a production environment it might make sense to // also report information about errors back to the // application server. console.log(error); } ); }); responding to user gestures subscribe() calls should be done in response to a user...
PushManager - Web APIs
}, function(error) { // during development it often helps to log errors to the // console. in a production environment it might make sense to // also report information about errors back to the // application server. console.log(error); } ); }); specifications specification status comment push apithe de...
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
now we can begin to process the...
RequestDestination - Web APIs
the requestdestination enumerated type contains the permitted values for a request's destination. these string values indicate potential types of content that a request may try to retrieve. values "" the default value of destination is used for destinations that do not have their own value. navigator.sendbeacon(), eventsource, <a ping>, <area ping>, fetch(), xmlhttprequest, websocket, cache and more. "audio" the target is audio data. "audioworklet" the target is data being fetched for use by an audio worklet. "document" the target is a document (html or xml). "embed" the target is embedded content. "font" the target is a font. "image" the target is an image. "manifest" the target is a manifest. "object" the target is an object. "paintworklet" the target is a paint wor...
Using the Resource Timing API - Web APIs
the resource timing api provides a way to retrieve and analyze detailed network timing data regarding the loading of an application's resource(s). an application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource such as an xmlhttprequest, <svg>, image, script, etc.). the interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, fetch start, dns lookup start and end times, response start and end times, etc. the interface also includes other properties that provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. this document shows the use of resource timing interfaces. for more details abo...
Screen.height - Web APIs
Web › API › Screen › height
widgets such as taskbars or other special application windows that integrate with the os (e.g., the spinner player minimized to act like an additional toolbar on windows) may reduce the amount of space available to browser windows and other applications. ...
Screen - Web APIs
Web › API › Screen
en. note that browsers determine which screen to report as current by detecting which screen has the center of the browser window. properties screen.availtop specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features. screen.availleft returns the first available pixel available from the left side of the screen. screen.availheight specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the taskbar on windows. screen.availwidth returns the amount of horizontal space in pixels available to the window. screen.colordepth returns the color depth of the screen. screen.height returns the height of the screen in pixels. screen.l...
ScriptProcessorNode.bufferSize - Web APIs
eate audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with a buffersize of 4096 and a single input and output channel var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); // load in an audio track via xhr and decodeaudiodata function getdata() { request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function to ...
ScriptProcessorNode.onaudioprocess - Web APIs
eate audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with a buffersize of 4096 and a single input and output channel var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); // load in an audio track via xhr and decodeaudiodata function getdata() { request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function ...
ScriptProcessorNode - Web APIs
eate audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with a buffersize of 4096 and a single input and output channel var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); // load in an audio track via xhr and decodeaudiodata function getdata() { request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function to ...
ServiceWorkerRegistration.pushManager - Web APIs
}, function(error) { // during development it often helps to log errors to the // console. in a production environment it might make sense to // also report information about errors back to the // application server. console.log(error); } ); }); specifications specification status comment push apithe de...
SourceBuffer - Web APIs
recommendation initial definition. ...
WebGL2RenderingContext.texImage3D() - Web APIs
alpha components are read from the color buffer. gl.luminance: each color component is a luminance component, alpha is 1.0. gl.luminance_alpha: each component is a luminance/alpha component. gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rgui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb_aplha8 gl.rgb5_a1 gl.rgba4444 gl.rgba16f gl.rgba32f gl.rgba8ui width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. depth a glsizei specifying the depth of the texture. border a glint specifying the width of the border. must be 0. format a glenum specifying the format of the texel data. the correct combinations with interna...
WebGL2RenderingContext.texStorage2D() - Web APIs
re. gl.texture_cube_map: a cube-mapped texture. levels a glint specifying the number of texture levels. internalformat a glenum specifying the texture store format. possible values: gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rg8ui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb8_aplha8 gl.rgb5_a1 gl.rgba4 gl.rgba16f gl.rgba32f gl.rgba8ui unlike opengl 3.0, webgl 2 doesn't support the following etc2 and eac compressed texture formats (see section 5.37 in the webgl 2 spec). you might be able to enable them via the webgl_compressed_texture_etc extension, though. gl.compressed_r11_eac gl.compressed_signed_r11_eac gl.compressed_rg11_eac gl.compressed_signe...
WebGL2RenderingContext.texStorage3D() - Web APIs
l.texture_2d_array: a two-dimensional array texture. level a glint specifying the number of texture levels. internalformat a glenum specifying the texture store format. ...
WebGL2RenderingContext.texSubImage3D() - Web APIs
alpha components are read from the color buffer. gl.luminance: each color component is a luminance component, alpha is 1.0. gl.luminance_alpha: each component is a luminance/alpha component. gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rgui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb_aplha8 gl.rgb5_a1 gl.rgba4444 gl.rgba16f gl.rgba32f gl.rgba8ui type a glenum specifying the data type of the texel data. possible values: gl.unsigned_byte: 8 bits per channel for gl.rgba gl.unsigned_short_5_6_5: 5 red bits, 6 green bits, 5 blue bits. gl.unsigned_short_4_4_4_4: 4 red bits, 4 green bits, 4 blue bits, 4 alpha bits. gl.unsigned_short_5_5_5_1: 5 red bits, 5 green ...
WebGLRenderingContext.hint() - Web APIs
standard man page of the opengl api. ...
Lifetime of a WebRTC session - Web APIs
webrtc doesn’t live in a vacuum, there is likely other connectivity in play, so it makes sense to avoid having to add additional connection channels for signaling if an existing one can be used. in order to exchange signaling information, you can choose to send json objects back and forth over a websocket connection, or you could use xmpp or sip over an appropriate channel, or you could use xmlhttprequest over https with polling, or any other combination of technologies you can come up with. you could even use email as the signaling channel. it’s also worth noting that the channel for performing signaling doesn’t even need to be over the network. one peer can output a data object that can be printed out, physically carried (on foot or by carrier pigeon) to another device, entered in...
Signaling and video calling - Web APIs
as an intermediary to let two peers find and establish a connection while minimizing exposure of potentially private information as much as possible. how do we create this server and how does the signaling process actually work? first we need the signaling server itself. webrtc doesn't specify a transport mechanism for the signaling information. you can use anything you like, from websocket to xmlhttprequest to carrier pigeons to exchange the signaling information between the two peers. it's important to note that the server doesn't need to understand or interpret the signaling data content. although it's sdp, even this doesn't matter so much: the content of the message going through the signaling server is, in effect, a black box. what does matter is when the ice subsystem instructs you t...
WebSocket: error event - Web APIs
the error event is fired when a connection with a websocket has been closed due to an error (some data couldn't be sent for example). bubbles no cancelable no interface event event handler property onerror examples // create websocket connection const socket = new websocket('ws://localhost:8080'); // listen for possible errors socket.addeventlistener('error', function (event) { console.log('websocket error: ', event); }); specifications specification status html living standardthe definition of 'websocket error' in that specification. living standard ...
WebSocket: message event - Web APIs
the message event is fired when data is received through a websocket. bubbles no cancelable no interface messageevent event handler property onmessage examples // create websocket connection. const socket = new websocket('ws://localhost:8080'); // listen for messages socket.addeventlistener('message', function (event) { console.log('message from server ', event.data); }); specifications specification status html living standardthe definition of 'websocket message' in that specification. living standard ...
WebSocket: open event - Web APIs
the open event is fired when a connection with a websocket is opened. bubbles no cancelable no interface event event handler property onopen examples // create websocket connection. const socket = new websocket('ws://localhost:8080'); // connection opened socket.addeventlistener('open', (event) => { socket.send('hello server!'); }); specifications specification status html living standardthe definition of 'websocket open' in that specification. living standard ...
WebSocket - Web APIs
Web › API › WebSocket
en closed because of an error, such as when some data couldn't be sent. also available via the onerror property. message fired when data is received through a websocket. also available via the onmessage property. open fired when a connection with a websocket is opened. also available via the onopen property. examples // create websocket connection. const socket = new websocket('ws://localhost:8080'); // connection opened socket.addeventlistener('open', function (event) { socket.send('hello server!'); }); // listen for messages socket.addeventlistener('message', function (event) { console.log('message from server ', event.data); }); specifications specification status html living standardthe definition of 'websocket' in that specification. liv...
Starting up and shutting down a WebXR session - Web APIs
r improvements include updating the emulator to rename the xr interface to xrsystem, introduce support for squeeze (grip) input sources, and add support for the xrinputsource property profiles. context requirements a webxr compatible environment starts with a securely-loaded document. your document needs to either have been loaded from the local drive (such as by using an url such as http://localhost/...), or using https when loading the page. the javascript code must, likewise, have been loaded securely. if the document wasn't loaded securely, you won't get very far. the navigator.xr property doesn't even exist if the document wasn't loaded securely. this may also be the case if there simply is no compatible xr hardware available. either way, you need to be prepared for the lack of an xr...
Web Workers API - Web APIs
ystem of messages — both sides send their messages using the postmessage() method, and respond to messages via the onmessage event handler (the message is contained within the message event's data property). the data is copied rather than shared. workers may in turn spawn new workers, as long as those workers are hosted within the same origin as the parent page. in addition, workers may use xmlhttprequest for network i/o, with the exception that the responsexml and channel attributes on xmlhttprequest always return null. in addition to dedicated workers, there are other types of worker: shared workers are workers that can be utilized by multiple scripts running in different windows, iframes, etc., as long as they are in the same domain as the worker. they are a little more complex th...
Window.resizeTo() - Web APIs
Web › API › Window › resizeTo
ndow.resizeto(width, height) parameters width an integer representing the new outerwidth in pixels (including scroll bars, title bars, etc). height an integer value representing the new outerheight in pixels (including scroll bars, title bars, etc). example this function resizes the window so that it takes up one quarter of the available screen. see the screen.availwidth and screen.availheight properties. function quarter() { window.resizeto( window.screen.availwidth / 2, window.screen.availheight / 2 ); } specification specification status comment css object model (cssom) view modulethe definition of 'window.resizeto()' in that specification. working draft ...
Window.scrollMaxY - Web APIs
Web › API › Window › scrollMaxY
see also window.scrollmaxx and window.scrollto. specification this is not part of any specification. ...
WindowEventHandlers.onhashchange - Web APIs
syntax using an event handler: window.onhashchange = funcref; using an html event handler: <body onhashchange="funcref();"> using an event listener: to add an event listener, use addeventlistener(): window.addeventlistener("hashchange", funcref, false); parameters funcref a reference to a function. ...
Worker - Web APIs
Web › API › Worker
hich can send messages back to its creator. creating a worker is done by calling the worker("path/to/worker/script") constructor. workers may themselves spawn new workers, as long as those workers are hosted at the same origin as the parent page. (note: nested workers are not yet implemented in webkit). not all interfaces and functions are available to scripts inside a worker. workers may use xmlhttprequest for network communication, but its responsexml and channel attributes are always null. (fetch is also available, with no such restrictions.) in firefox extensions, if you want to use workers with access to js-ctypes, use chromeworker object instead. constructors worker() creates a dedicated web worker that executes the script at the specified url. this also works for blob urls. ...
XDomainRequest - Web APIs
this interface can send both get and post requests. syntax var xdr = new xdomainrequest(); returns a new xdomainrequest object, which can then be used to make and manage these requests. ...
XMLDocument.load() - Web APIs
Web › API › XMLDocument › load
document.load() is a part of an old version of the w3c dom level 3 load & save module. can be used with document.async to indicate whether the request is synchronous or asynchronous (the default). as of at least gecko 1.9, this no longer supports cross-site loading of documents (use xmlhttprequest or fetch() instead). examples var xmldoc = document.implementation.createdocument("", "test", null); function documentloaded (e) { alert(new xmlserializer().serializetostring(e.target)); // gives querydata.xml contents as string } xmldoc.addeventlistener("load", documentloaded, false); xmldoc.load('querydata.xml'); see also the load sample in the xml tests directory. (to test this functionality, create the files on your local disk or on a webserver rather than loading the load.html fil...
msCaching - Web APIs
Web › API › msCaching
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 mscaching read/write property specifies whether stream data downloaded using xmlhttprequestis cached to disk or not. this proprietary method is specific to internet explorer and microsoft edge. syntax cachestate = object.mscaching values type: domstring property value description auto disables caching for stream or ms-stream data. enabled enables caching for stream or ms-stream data. disabled disables caching for any data. see also m...
msCachingEnabled - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the mscachingenabled method gets the current caching state for an xmlhttprequest. this proprietary method is specific to internet explorer and microsoft edge. syntax var cachestate = xmlhttprequest.mscachingenabled(); parameters cachestate[out, retval] type = boolean. if true, xmlhttprequest is cached to disk. if false, it is not written to disk. return value type: boolean. if true, xmlhttprequest is cached to disk. if false, it is not written to disk. see also mscaching property microsof...
ARIA: cell role - Accessibility
or treegrid within a static tabular structure. using native html <td> elements, whenever possible, is strongly encouraged. each element with role="cell" must be nested in a container element with role="row". that row, in turn, can be nested within an element with role="rowgroup", and should be nested within a grid, table or treegrid. if a cell contains column or row header information, use the colheader or rowheader roles, respecitively. if the cell does not contain header information and is nested in a grid or treegrid, the role of gridcell may be more appropriate. a cell can contain a number of property attributes clarifying the cell's position within the tabular data structure, including aria-colindex, aria-colspan, aria-rowindex, and aria-rowspan. using the native html table elemen...
ARIA: form role - Accessibility
roperties 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</label> <input id="username" name="username" autocomplete="nickname" autocorrect="off" type="text"> <label for="email">email</label> <input id="email" name="email" autocomplete="email" autocapitalize="off" autocorrect="off" spellcheck="false" type="text"> <label for="co...
Linear-gradient Generator - CSS: Cascading Style Sheets
inputslidermanager.init();="" inputslidermanager.subscribe('point-position',="" k="0;" len="lg_axes.length;" len;="" lg_axes[i].shortcut.style.left="60" lg_axes[i].updateabsoluteposition();="" lg_axes[i].updateonresize();="" methods="" output="getelembyid('output');" output.children[index].children[1].textcontent="code;" output.children[index].style.height="output.children[index].children[1].scrollheight" output;="" point="" pre="" prefix)="" resizecontainer="function" resizecontainer()="" resizecontainer);="" resizecontainer,="" resizeend="function" resizeend()="" resizeend);="" return="" return;="" setaddaxisbutton();="" setaxisunit);="" setdeleteaxisbutton();="" setdeletebuttonstate="function" setdeletebuttonstate('disabled');="" setdeletebuttonstate(state)="" setdeletepointbutton="functi...
<dimension> - CSS: Cascading Style Sheets
Web › CSS › dimension
invalid dimensions 12 px the unit must come immediately after the number. 12"px" units are identifiers and therefore unquoted. 3sec the seconds unit is abbreviated "s" not "sec". specifications specification status comment css values and units module level 4the definition of '<dimension>' in that specification. editor's draft adds cap, ic, lh, rlh, vi, vb css values and units module level 3the definition of '<dimension>' in that specification. candidate recommendation adds ch, rem, vw, vw, vmin, vmax, q css level 2 (revision 1)the definition of '<dimension>' in that specification. recommendation defined under numbers and length css level 1the definition of '<dimension>' in that specification. ...
WAI ARIA Live Regions/API Support - Developer guides
other factors into account, such as the type of change, the size of the change, where the change occured, etc. this is a potential area for innovation in screen readers. most recent occurance user input? key presses yes mouse clicks yes mouse hovers no page load events no everything else, including focus changes, timer callbacks, xmlhttprequest callbacks, etc. are neutral. they are only counted as user input if the original reason they happened was because of user input. what should screen readers present? please read the live region section of the wai-aria screen reader implementor's guide. ...
Audio and Video Delivery - Developer guides
else if (myvideo.canplaytype('video/webm')) { myvideo.setattribute('src','videofile.webm'); } myvideo.width = 480; myvideo.height = 320; we set the source of the video depending on the type of video file the browser supports we then set the width and height of the video. ...
DOM onevent handlers - Developer guides
om the event object, you can leave out the event when calling onclick(). this continues until every handler has been called, unless one of the event handlers explicitly halts the processing of the event by calling stoppropagation() on the event object itself. non-element objects event handlers can also be set with properties on non-element objects that generate events, like window, document, xmlhttprequest, and others. for example, for the progress event on instances of xmlhttprequest: const xhr = new xmlhttprequest(); xhr.onprogress = function() { … }; html onevent attributes html elements have attributes named onevent which can be used to register a handler for an event directly within the html code. when the element is built from the html, the value of its onevent attributes are c...
Overview of events and handlers - Developer guides
although this list is currently incomplete. some notable events are: note: this list of events will need work to make relevant; that work is awaiting some global reorganization work on the documents. this will also need finding a good explanation of the eve...
Developer guides
idi algorithm is part of the unicode text standard. it describes how the browser should order characters while rendering unicode text. this guide covers the algorithm in general and how it applies to content you create—especially when you build properly localized and internationalized content. using formdata objects the formdata object lets you compile a set of key/value pairs to send using xmlhttprequest. it's primarily intended for sending form data, but can be used independently from forms to transmit keyed data. the transmission is in the same format that the form's submit() method would use to send the data if the form's encoding type were set to "multipart/form-data". user input and controls modern web user input goes beyond simple mouse and keyboard: think of touchscreens for ex...
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
mitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content; don't use a heading element as a child of the <hgroup> element — it is now deprecated. implicit aria role heading permitted aria roles tab, presentation or none dom interface htmlheadingelement attributes these elements only include the global attributes. the align attribute is obsolete; don't use it. usage notes heading information may be used by user agents, for example, to construct a table of contents for a document automatically. avoid using heading tags to resize text. instead, use the css font-size property. headings use size to indicate their relativ...
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
Web › HTML › Element › head
tag may be omitted if the first thing inside the <head> element is an element. the end tag may be omitted if the first thing following the <head> element is not a space character or a comment. permitted parents an <html> element, as its first child. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlheadelement attributes this element includes the global attributes. profile the uris of one or more metadata profiles, separated by white space. example <!doctype html> <html> <head> <title>document title</title> </head> </html> notes html5-compliant browsers automatically create a <head> element if its tags are omitted in the markup. this auto-creation is not guaranteed...
<hr>: The Thematic Break (Horizontal Rule) element - HTML: Hypertext Markup Language
Web › HTML › Element › hr
sing appropriate css. content categories flow content. permitted content none, it is an empty element. tag omission it must have start tag, but must not have an end tag. permitted parents any element that accepts flow content. implicit aria role separator permitted aria roles presentation or none dom interface htmlhrelement attributes this element's attributes include the global attributes. align sets the alignment of the rule on the page. if no value is specified, the default value is left. color sets the color of the rule through color name or hexadecimal value. noshade sets the rule to have no shading. size sets the height, in pixels, of the rule. width sets the length of the...
<html>: The HTML Document / Root element - HTML: Hypertext Markup Language
Web › HTML › Element › html
the start tag may be omitted if the first thing inside the <html> element is not a comment. the end tag may be omitted if the <html> element is not immediately followed by a comment. permitted parents none. this is the root element of a document. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlhtmlelement attributes this element includes the global attributes. manifest specifies the uri of a resource manifest indicating resources that should 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 ver...
<img>: The Image Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › img
auto: no preference. the browser may use its own heuristics to prioritize the image. high: the image is of high priority. low: the image is of low priority. intrinsicsize this attribute tells the browser to ignore the actual intrinsic size of the image and pretend it’s the size specified in the attribute. specifically, the image would raster at these dimensions and naturalwidth/naturalheight on images would return the values specified in this attribute. explainer, examples ismap this boolean attribute indicates that the image is part of a server-side map. if so, the coordinates where the user clicked on the image are sent to the server. note: this attribute is allowed only if the <img> element is a descendant of an <a> element with a valid href attribute. this gives users w...
<video>: The Video Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › video
ncoming from webrtc, and so forth), this value is +infinity. height the height of the video's display area, in css pixels (absolute values only; no percentages.) intrinsicsize this attribute tells the browser to ignore the actual intrinsic size of the image and pretend it’s the size specified in the attribute. specifically, the image would raster at these dimensions and naturalwidth/naturalheight on images would return the values specified in this attribute. explainer, examples loop a boolean attribute; if specified, the browser will automatically seek back to the start upon reaching the end of the video. muted a boolean attribute that indicates the default setting of the audio contained in the video. if set, the audio will be initially silenced. its default value is false, meani...
MIME types (IANA media types) - HTTP
t/form-data; boundary=aboundarystring (other headers associated with the multipart document as a whole) --aboundarystring content-disposition: form-data; name="myfile"; filename="img.jpg" content-type: image/jpeg (data) --aboundarystring content-disposition: form-data; name="myfield" (data) --aboundarystring (more subparts) --aboundarystring-- the following <form>: <form action="http://localhost:8000/" method="post" enctype="multipart/form-data"> <label>name: <input name="mytextfield" value="test"></label> <label><input type="checkbox" name="mycheckbox"> check</label> <label>upload file: <input type="file" name="myfile" value="test.txt"></label> <button>send the file</button> </form> will send this message: post / http/1.1 host: localhost:8000 user-agent: mozilla/5.0 (macint...
Reason: CORS header 'Access-Control-Allow-Origin' does not match 'xyz' - HTTP
at it's configured to include your origin in its access-control-allow-origin header, and that only one such header is included in responses. the header itself accepts a comma-delineated list of origins, so adding a new origin is not difficult. for example, in apache, add a line such as the following to the server's configuration (within the appropriate <directory>, <location>, <files>, or <virtualhost> section). the configuration is typically found in a .conf file (httpd.conf and apache.conf are common names for these), or in an .htaccess file. header set access-control-allow-origin 'origin-list' for nginx, the command to set up this header is: add_header 'access-control-allow-origin' 'origin-list' ...
Reason: CORS request did not succeed - HTTP
many cases, it is caused by a browser plugin (e.g. an ad blocker or privacy protector) blocking the request. other possible causes include: trying to access an https resource that has an invalid certificate will cause this error. trying to access an http resource from a page with an https origin will also cause this error. as of firefox 68, https pages are not permitted to access http://localhost, although this may be changed by bug 1488740. the server did not respond to the actual request (even if it responded to the preflight request). one scenario might be an http service being developed that panicked without returning any data. ...
Reason: expected ‘true’ in CORS header ‘Access-Control-Allow-Credentials’ - HTTP
‘true’ in cors header ‘access-control-allow-credentials’ what went wrong? the cors request requires that the server permit the use of credentials, but the server's access-control-allow-credentials header's value isn't set to true to enable their use. to fix this problem on the client side, revise the code to not request the use of credentials. if the request is being issued using xmlhttprequest, make sure you're not setting withcredentials to true. if using server-sent events, make sure eventsource.withcredentials is false (it's the default value). if using the fetch api, make sure request.credentials is "omit". to eliminate this error by changing the server's configuration, adjust the server's configuration to set the access-control-allow-credentials header's value to tru...
Reason: CORS header 'Access-Control-Allow-Origin' missing - HTTP
rigin header and use that value to set access-control-allow-origin, and must also set a vary: origin header to indicate that some headers are being set dynamically depending on the origin. the exact directive for setting headers depends on your web server. in apache, add a line such as the following to the server's configuration (within the appropriate <directory>, <location>, <files>, or <virtualhost> section). the configuration is typically found in a .conf file (httpd.conf and apache.conf are common names for these), or in an .htaccess file. header set access-control-allow-origin 'origin-list' for nginx, the command to set up this header is: add_header 'access-control-allow-origin' 'origin-list' ...
Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’ - HTTP
what went wrong? the cors request was attempted with the credentials flag set, but the server is configured using the wildcard ("*") as the value of access-control-allow-origin, which doesn't allow the use of credentials. to correct this problem on the client side, simply ensure that the credentials flag's value is false when issuing your cors request. if the request is being issued using xmlhttprequest, make sure you're not setting withcredentials to true. if using server-sent events, make sure eventsource.withcredentials is false (it's the default value). if using the fetch api, make sure request.credentials is "omit". if, instead, you need to adjust the server's behavior, you'll need to change the value of access-control-allow-origin to grant access to the origin from which the ...
Reason: CORS request not HTTP - HTTP
reason reason: cors request not http what went wrong? cors requests may only use the https url scheme, but the url specified by the request is of a different type. this often occurs if the url specifies a local file, using a file:/// url. to fix this problem, simply make sure you use https urls when issuing requests involving cors, such as xmlhttprequest, fetch apis, web fonts (@font-face), and webgl textures, and xsl stylesheets. local file security in firefox 68 when a user opened a page using a file:/// uri in firefox 67 and earlier, the origin of the page was defined as the directory from which the page was opened. resources in the same directory and its subdirectories were treated as having the same origin for purposes of the cors same-origin rule. in response to cve-2019-11730,...
Using Feature Policy - HTTP
e policies to specify the desired best practices, and rely on the browser to enforce the policies to prevent regressions. there are several policy-controlled features designed to represent functionality that can negatively impact the user experience. these features include: layout-inducing animations unoptimized (poorly compressed) images oversized images synchronous scripts synchronous xmlhttprequest unsized media to avoid breaking existing web content, the default for such policy-controlled features is to allow the functionality to be used by all origins. 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 p...
Feature Policy - HTTP
efault for such policy-controlled features is to allow the functionality to be used by all origins. best practices are then enforced by using policies that disable the policy-controlled features. for more details see "enforcing best practices for good user experiences". the features include: layout-inducing animations legacy image formats oversized images synchronous scripts synchronous xmlhttprequest unoptimized images unsized media granular control over certain features the web provides functionality and apis that may have privacy or security risks if abused. in some cases, you may wish to strictly limit how such functionality is used on a website. there are policy-controlled features to allow functionality to be enabled/disabled for specific origins or frames within a website...
Feature-Policy: sync-xhr - HTTP
syntax feature-policy: sync-xhr <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. ...
Feature-Policy - HTTP
rent document is allowed to play a video in a picture-in-picture mode via the corresponding api. publickey-credentials-get controls whether the current document is allowed to use the web authentication api to retreive already stored public-key credentials, i.e. via navigator.credentials.get({publickey: ..., ...}). sync-xhr controls whether the current document is allowed to make synchronous xmlhttprequest requests. usb controls whether the current document is allowed to use the webusb api. wake-lock controls whether the current document is allowed to use wake lock api to indicate that device should not enter power-saving mode. screen-wake-lock controls whether the current document is allowed to use screen wake lock api to indicate that device should not turn off or dim the screen. ...
Public-Key-Pins-Report-Only - HTTP
optional parameter is specified, this rule applies to all of the site's subdomains as well. report-uri="<uri>" pin validation failures are reported to the given url. this directive should be used with this header, otherwise this header will be a no-op. example public-key-pins-report-only: pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws="; pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6lhkmjahkhpgpwe="; includesubdomains; report-uri="https://www.example.org/hpkp-report" in this example, pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws=" pins the server's public key used in production. the second pin declaration pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6lhkmjahkhpgpwe=" also pins the backup key. this key pinning is also valid for all subdomains, which is told by the incl...
Public-Key-Pins - HTTP
optional if this optional parameter is specified, pin validation failures are reported to the given url. example hpkp has the potential to lock out users for a long time if used incorrectly! the use of backup certificates and/or pinning the ca certificate is recommended. public-key-pins: pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws="; pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6lhkmjahkhpgpwe="; max-age=5184000; includesubdomains; report-uri="https://www.example.org/hpkp-report" in this example, pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws=" pins the server's public key used in production. the second pin declaration pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6lhkmjahkhpgpwe=" also pins the backup key. max-age=5184000 tells the client to store this information ...
Set-Cookie - HTTP
cure and doesn't encrypt any information.) note: insecure sites (http:) can't set cookies with the secure attribute (since chrome 52 and firefox 52). httponly optional forbids javascript from accessing the cookie, for example, through the document.cookie property. note that a cookie that has been created with httponly will still be sent with javascript-initiated requests, e.g. when calling xmlhttprequest.send() or fetch(). this mitigates attacks against cross-site scripting (xss). samesite=<samesite-value> optional strict: the browser sends the cookie only for same-site requests (that is, requests originating from the same site that set the cookie). if the request originated from a different url than the current one, no cookies with the samesite=strict attribute are sent. lax: ...
POST - HTTP
Web › HTTP › Methods › POST
why this type is not suitable to use with binary data (use multipart/form-data instead) multipart/form-data: each value is sent as a block of data ("body part"), with a user agent-defined delimiter ("boundary") separating each part. the keys are given in the content-disposition header of each part. text/plain when the post request is sent via a method other than an html form — like via an xmlhttprequest — the body can take any type. as described in the http 1.1 specification, post is designed to allow a uniform method to cover the following functions: annotation of existing resources posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; adding a new user through a signup modal; providing a block of data, such as the result of submitting a...
An overview of HTTP - HTTP
Web › HTTP › Overview
onsist of the following elements: the version of the http protocol they follow. a status code, indicating if the request was successful, or not, and why. a status message, a non-authoritative short description of the status code. http headers, like those for requests. optionally, a body containing the fetched resource. apis based on http the most commonly used api based on http is the xmlhttprequest api, which can be used to exchange data between a user agent and a server. the modern fetch api provides the same features with a more powerful and flexible feature set. another api, server-sent events, is a one-way service that allows a server to send events to the client, using http as a transport mechanism. using the eventsource interface, the client opens a connection and establish...
Protocol upgrade mechanism - HTTP
fined in the websocket specification, so this does not provide security. instead, it helps to prevent non-websocket clients from inadvertently, or through misuse, requesting a websocket connection. in essence, then, this key simply confirms that "yes, i really mean to open a websocket connection." this header is automatically added by clients that choose to use it; it cannot be added using the xmlhttprequest.setrequestheader() method. sec-websocket-key: key key the key for this request to upgrade. the client adds this if it wishes to do so, and the server will include in the response a key of its own, which the client will validate before delivering the upgrade response to you. the server's response's sec-websocket-accept header will have a value computed based upon the specified key...
HTTP Public Key Pinning (HPKP) - HTTP
mand will extract the base64 encoded information for a website. openssl s_client -servername www.example.com -connect www.example.com:443 | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64 example hpkp header public-key-pins: pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws="; pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6lhkmjahkhpgpwe="; max-age=5184000; includesubdomains; report-uri="https://www.example.org/hpkp-report" in this example, pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws=" pins the server's public key used in production. the second pin declaration pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6lhkmjahkhpgpwe=" also pins the backup key. max-age=5184000 tells the client to store this information ...
A typical HTTP session - HTTP
Web › HTTP › Session
of a page to fetch contains both the domain name, and the port number, though the latter can be omitted if it is 80. see identifying resources on the web for more details. note: the client-server model does not allow the server to send data to the client without an explicit request for it. to work around this problem, web developers use several techniques: ping the server periodically via the xmlhttprequest, fetch apis, using the websockets api, or similar protocols. sending a client request once the connection is established, the user-agent can send the request (a user-agent is typically a web browser, but can be anything else, a crawler, for example). a client request consists of text directives, separated by crlf (carriage return, followed by line feed), divided into three blocks: ...
JavaScript data types and data structures - JavaScript
or string.concat(). beware of "stringly-typing" your code! it can be tempting to use strings to represent complex data. doing this comes with short-term benefits: it is easy to build complex strings with concatenation. strings are easy to debug (what you see printed is always what is in the string). strings are the common denominator of a lot of apis (input fields, local storage values, xmlhttprequest responses when using responsetext, etc.) and it can be tempting to only work with strings. with conventions, it is possible to represent any data structure in a string. this does not make it a good idea. for instance, with a separator, one could emulate a list (while a javascript array would be more suitable). unfortunately, when the separator is used in one of the "list" elements, th...
JavaScript technologies overview - JavaScript
an unordered list, to be <li> elements, as those represent list items. in general, it also forbids using elements and attributes that aren't defined in a standard. looking for the document object, window object, and the other dom elements? read the dom documentation. other notable apis the settimeout and setinterval functions were first specified on the window interface in html standard. xmlhttprequest makes it possible to send asynchronous http requests. the css object model abstract css rules as objects. webworkers allows parallel computation. websockets allows low-level bidirectional communication. canvas 2d context is a drawing api for <canvas>. ...
Array.prototype.every() - JavaScript
tostring.call(callbackfn) !== '[object function]') { throw new typeerror(); } // 5. if thisarg was supplied, let t be thisarg; else let t be undefined. if (arguments.length > 1) { t = thisarg; } // 6. let k be 0. k = 0; // 7. repeat, while k < len while (k < len) { var kvalue; // a. let pk be tostring(k). // this is implicit for lhs operands of the in operator // b. let kpresent be the result of calling the hasproperty internal // method of o with argument pk. // this step can be combined with c // c. if kpresent is true, then if (k in o) { var testresult; // i. let kvalue be the result of calling the get internal method // of o with argument pk. kvalue =...
Array.prototype.indexOf() - JavaScript
index | 0; // 6. if n >= len, return -1. if (n >= len) { return -1; } // 7. if n >= 0, then let k be n. // 8. else, n<0, let k be len - abs(n). // if k is less than 0, then let k be 0. k = math.max(n >= 0 ? n : len - math.abs(n), 0); // 9. repeat, while k < len for (; k < len; k++) { // a. let pk be tostring(k). // this is implicit for lhs operands of the in operator // b. let kpresent be the result of calling the // hasproperty internal method of o with argument pk. // this step can be combined with c // c. if kpresent is true, then // i. let elementk be the result of calling the get // internal method of o with the argument tostring(k). // ii. let same be the result of...
Array.prototype.map() - JavaScript
// 6. let a be a new array created as if by the expression new array(len) // where array is the standard built-in constructor with that name and // len is the value of len. a = new array(len); // 7. let k be 0 k = 0; // 8. repeat, while k < len while (k < len) { var kvalue, mappedvalue; // a. let pk be tostring(k). // this is implicit for lhs operands of the in operator // b. let kpresent be the result of calling the hasproperty internal // method of o with argument pk. // this step can be combined with c // c. if kpresent is true, then if (k in o) { // i. let kvalue be the result of calling the get internal // method of o with argument pk. kvalue = o[k]; // ii. ...
Object.freeze() - JavaScript
object itself and will prevent future property addition, removal or value re-assignment operations only on object. if the value of those properties are objects themselves, those objects are not frozen and may be the target of property addition, removal or value re-assignment operations. var employee = { name: "mayank", designation: "developer", address: { street: "rohini", city: "delhi" } }; object.freeze(employee); employee.name = "dummy"; // fails silently in non-strict mode employee.address.city = "noida"; // attributes of child object can be modified console.log(employee.address.city) // output: "noida" to make an object immutable, recursively freeze each property which is of type object (deep freeze). use the pattern on a case-by-case basis based on your design whe...
Promise() constructor - JavaScript
...
Promise - JavaScript
xample not available as your browser doesn't support the <code>promise<code> interface."; } this example is started by clicking the button. (you need a browser that supports promise. ) by clicking the button several times in a short amount of time, you'll even see the different promises being fulfilled one after another. loading an image with xhr another simple example using promise and xmlhttprequest to load an image is available at the mdn github js-examples repository. you can also see it in action. each step is commented and allows you to follow the promise and xhr architecture closely. specifications specification ecmascript (ecma-262)the definition of 'promise' in that specification. ...
encodeURI() - JavaScript
encodeuricomponent(), however, does encode these characters. encoding a lone high surrogate throws an urierror will be thrown if one attempts to encode a surrogate which is not part of a high-low pair, e.g., // high-low pair ok console.log(encodeuri('\ud800\udfff')); // lone...
Destructuring assignment - JavaScript
s you to unpack the parts out of this array easily, ignoring the full match if it is not needed. ...
import - JavaScript
ort('/modules/my-module.js') .then((module) => { // do something with the module. }); this form also supports the await keyword. let module = await import('/modules/my-module.js'); examples standard import the code below shows how to import from a secondary module to assist in processing an ajax json request. ...
JavaScript typed arrays - JavaScript
it is big-endian by default and can be set to little-endian in the getter/setter methods. web apis using typed arrays these are some examples of apis that make use of typed arrays; there are others, and more are being added all the time. filereader.prototype.readasarraybuffer() the filereader.prototype.readasarraybuffer() method starts reading the contents of the specified blob or file. xmlhttprequest.prototype.send() xmlhttprequest instances' send() method now supports typed arrays and arraybuffer objects as argument. imagedata.data is a uint8clampedarray representing a one-dimensional array containing the data in the rgba order, with integer values between 0 and 255 inclusive. examples using views with buffers first of all, we will need to create a buffer, here with a fixed ...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
tc. service workers are quite powerful as they can take control over network requests, modify them, serve custom responses retrieved from the cache, or synthesize responses completely. security because they are so powerful, service workers can only be executed in secure contexts (meaning https). if you want to experiment first before pushing your code to production, you can always test on a localhost or setup github pages — both support https. offline first the "offline first" — or "cache first" — pattern is the most popular strategy for serving content to the user. if a resource is cached and available offline, return it first before trying to download it from the server. if it isn’t in the cache already, download it and cache it for future usage. "progressive" in pwa when imp...
Mobile first - Progressive web apps (PWAs)
olo (you'll also need to get node.js too if you don't already have it) i then created my sample project using volo create myapp mozilla/mortar-app-stub this creates a sample project inside a directory called myapp. the app's code files are inside the www folder. volo has a number of useful commands available, of which we will just use a couple: volo server: starts a local web server at localhost:8080 and runs your app through it: great for easy testing. volo build: builds a minified code version of your app, ready for production deployment, in a www-built folder. volo build base=www-built: runs the built version through the server instead of the development version. built-in features of the mortar template mortar templates contain a number of built-in features. in this sample app...
Same-origin policy - Web security
ss its parent securely, you need to set document.domain to the same value in both the parent domain and the subdomain. this is necessary even if doing so is simply setting the parent domain back to its original value. failure to do this may result in permission errors. cross-origin network access the same-origin policy controls interactions between two different origins, such as when you use xmlhttprequest or an <img> element. these interactions are typically placed into three categories: cross-origin writes are typically allowed. examples are links, redirects, and form submissions. some http requests require preflight. cross-origin embedding is typically allowed. (examples are listed below.) cross-origin reads are typically disallowed, but read access is often leaked by embedding. f...
Features restricted to secure contexts - Web security
...
Secure contexts - Web security
n whether the new window is considered secure. that’s because the determination of whether or not a particular document is in a secure context is based only on considering it within the top-level browsing context with which it is associated — and not whether a non-secure context happened to be used to create it. locally-delivered resources such as those with http://127.0.0.1 urls, http://localhost urls (under certain conditions), and file:// urls are also considered to have been delivered securely. resources that are not local, to be considered secure, must meet the following criteria: must be served over https:// or wss:// urls the security properties of the network channel used to deliver the resource must not be considered deprecated feature detection pages can use feature de...
Introduction to using XPath in JavaScript - XPath
> <address street="1600 pennsylvania avenue" city="washington" country="usa"/> <phonenumber>202-456-1111</phonenumber> </person> <person> <name first="tony" last="blair" /> <address street="10 downing street" city="london" country="uk"/> <phonenumber>020 7925 0918</phonenumber> </person> </people> to make the contents of the xml document available within the extension, we create an xmlhttprequest object to load the document synchronously, the variable xmldoc will contain the document as an xmldocument object against which we can use the evaluate method javascript used in the extensions xul/js documents. var req = new xmlhttprequest(); req.open("get", "chrome://yourextension/content/peopledb.xml", false); req.send(null); var xmldoc = req.responsexml; var nsresolver = xmldo...
XPath snippets - XPath
atensresolver(xpe.documentelement); note however that creatensresolver should only be used if you are sure the namespace prefixes in the xpath expression match those in the document you want to query (and that no default namespace is being used (though see document.creatensresolver for a workaround)). otherwise, you have to provide your own implementation of xpathnsresolver. if you are using xmlhttprequest to read a local or remote xml file into a dom tree (as described in parsing and serializing xml), the first argument to evaluatexpath() should be req.responsexml. sample usage assume we have the following xml document (see also how to create a dom tree and parsing and serializing xml): example: an xml document to use with the custom evaluatexpath() utility function <?xml version="1...
Index - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Index
transformations through the xsltprocessor object. once instantiated, an xsltprocessor has an xsltprocessor.importstylesheet() method that takes as an argument the xslt stylesheet to be used in the transformation. the stylesheet has to be passed in as an xml document, which means that the .xsl file has to be loaded by the page before calling xsltprocessor.importstylesheet(). this can be done via xmlhttprequest or xmldocument.load(). 11 resources xslt no summary! 12 setting parameters xslt while running transformations using precoded .xsl and .xml files is quite useful, configuring the .xsl file from javascript may be even more useful. for example, javascript and xslt could be used to sort xml data and then display it. the sorting would have to alterna...
Advanced Example - XSLT: Extensible Stylesheet Language Transformations
// importnode is used to clone the n...
Index - WebAssembly
ide, javascript, webassembly, export, exported functions, exported wasm functions, wasm exported webassembly functions are how webassembly functions are represented in javascript. this article describes what they are in a little more detail. 8 index index, webassembly found 12 pages: 9 loading and running webassembly code fetch, javascript, webassembly, xmlhttprequest, bytecode to use webassembly in javascript, you first need to pull your module into memory before compilation/instantiation. this article provides a reference for the different mechanisms that can be used to fetch webassembly bytecode, as well as how to compile/instantiate then run it. 10 understanding webassembly text format functions, javascript, s-expressions, we...
Compiling from Rust to WebAssembly - WebAssembly
is is a demo, so it's ok for now. once it's loaded, it calls the greet function from that module, passing "webassembly" as a string. note how there's nothing special here, yet we're calling into rust code. as far as the javascript code can tell, this is just a normal module. we're done making files. let's give this a shot: $ npm install $ npm run serve this starts a web server. load http://localhost:8080 and an alert box appears on the screen, with hello, webassembly! in it. we've successfully called from javascript into rust, and from rust into javascript. conclusion this is the end of our tutorial; we hope you've found it useful. there's lots of exciting work going on in this space; if you'd like to help make it even better, check out the rust webassembly working group. ...