From 95aca4b4d8fa62815d4bd412fff1a364f842814a Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Thu, 29 Apr 2021 16:16:42 -0700 Subject: remove retired locales (#699) --- files/fi/web/api/aeskeygenparams/index.html | 48 -- files/fi/web/api/canvas_api/index.html | 74 --- files/fi/web/api/document_object_model/index.html | 92 ---- files/fi/web/api/index.html | 10 - files/fi/web/api/intersectionobserver/index.html | 87 ---- files/fi/web/api/navigator/battery/index.html | 138 ------ files/fi/web/api/navigator/buildid/index.html | 22 - files/fi/web/api/navigator/connection/index.html | 101 ---- .../fi/web/api/navigator/cookieenabled/index.html | 100 ---- files/fi/web/api/navigator/donottrack/index.html | 74 --- files/fi/web/api/navigator/oscpu/index.html | 71 --- files/fi/web/api/navigator/productsub/index.html | 30 -- files/fi/web/api/navigator/vendor/index.html | 25 - .../fi/web/api/navigatorid/appcodename/index.html | 24 - files/fi/web/api/navigatorid/appname/index.html | 28 -- files/fi/web/api/navigatorid/appversion/index.html | 33 -- files/fi/web/api/navigatorid/platform/index.html | 23 - files/fi/web/api/navigatorid/product/index.html | 37 -- files/fi/web/api/navigatorid/useragent/index.html | 43 -- .../web/api/navigatorlanguage/language/index.html | 83 ---- files/fi/web/api/navigatoronline/online/index.html | 102 ----- .../web/api/navigatorplugins/mimetypes/index.html | 23 - .../fi/web/api/navigatorplugins/plugins/index.html | 40 -- files/fi/web/api/webgl_api/index.html | 229 --------- files/fi/web/api/webvr_api/index.html | 250 ---------- .../api/webvr_api/using_the_webvr_api/index.html | 438 ------------------ files/fi/web/api/window/index.html | 509 --------------------- files/fi/web/api/window/navigator/index.html | 111 ----- 28 files changed, 2845 deletions(-) delete mode 100644 files/fi/web/api/aeskeygenparams/index.html delete mode 100644 files/fi/web/api/canvas_api/index.html delete mode 100644 files/fi/web/api/document_object_model/index.html delete mode 100644 files/fi/web/api/index.html delete mode 100644 files/fi/web/api/intersectionobserver/index.html delete mode 100644 files/fi/web/api/navigator/battery/index.html delete mode 100644 files/fi/web/api/navigator/buildid/index.html delete mode 100644 files/fi/web/api/navigator/connection/index.html delete mode 100644 files/fi/web/api/navigator/cookieenabled/index.html delete mode 100644 files/fi/web/api/navigator/donottrack/index.html delete mode 100644 files/fi/web/api/navigator/oscpu/index.html delete mode 100644 files/fi/web/api/navigator/productsub/index.html delete mode 100644 files/fi/web/api/navigator/vendor/index.html delete mode 100644 files/fi/web/api/navigatorid/appcodename/index.html delete mode 100644 files/fi/web/api/navigatorid/appname/index.html delete mode 100644 files/fi/web/api/navigatorid/appversion/index.html delete mode 100644 files/fi/web/api/navigatorid/platform/index.html delete mode 100644 files/fi/web/api/navigatorid/product/index.html delete mode 100644 files/fi/web/api/navigatorid/useragent/index.html delete mode 100644 files/fi/web/api/navigatorlanguage/language/index.html delete mode 100644 files/fi/web/api/navigatoronline/online/index.html delete mode 100644 files/fi/web/api/navigatorplugins/mimetypes/index.html delete mode 100644 files/fi/web/api/navigatorplugins/plugins/index.html delete mode 100644 files/fi/web/api/webgl_api/index.html delete mode 100644 files/fi/web/api/webvr_api/index.html delete mode 100644 files/fi/web/api/webvr_api/using_the_webvr_api/index.html delete mode 100644 files/fi/web/api/window/index.html delete mode 100644 files/fi/web/api/window/navigator/index.html (limited to 'files/fi/web/api') diff --git a/files/fi/web/api/aeskeygenparams/index.html b/files/fi/web/api/aeskeygenparams/index.html deleted file mode 100644 index 8e7efcc5d5..0000000000 --- a/files/fi/web/api/aeskeygenparams/index.html +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: AesKeyGenParams -slug: Web/API/AesKeyGenParams -translation_of: Web/API/AesKeyGenParams ---- -

{{ APIRef("Web Crypto API") }}AesKeyGenParams hakemisto Web Crypto API:sta edustaa objektia joka tulisi siirtää algorithm parametrina metodiin {{domxref("SubtleCrypto.generateKey()")}}, kun luodaan AES avainta: silloin kun algoritmiksi tunnistetaan joksikin seuraavista: AES-CBC, AES-CTR, AES-GCM, tai AES-KW.

- -

Ominaisuudet

- -
-
name
-
{{domxref("DOMString")}}. Tämän tulisi olla asetettuna joksikin seuraavista: AES-CBCAES-CTR, AES-GCM, ta AES-KW, riippuen siitä mitä algoritmia haluat käyttää.
-
length
-
-

Numero — generoitavan avaimen bittien pituus. Tämän täytyy olla jokin näistä: 128, 192, tai 256.

-
-
- -

Esimerkkejä

- -

Katso {{domxref("SubtleCrypto.generateKey()")}}:n esimerkit.

- -

Tekniset tiedot

- - - - - - - - - - - - - - -
MääritelmäTilaKommentti
{{ SpecName('Web Crypto API', '#dfn-AesKeyGenParams', 'SubtleCrypto.AesKeyGenParams') }}{{ Spec2('Web Crypto API') }} 
- -

Selainyhteensopivuus

- -

Selaimet jotka tukevat jotain AES-pohjaista algoritmia jota {{domxref("SubtleCrypto.generateKey()")}} metodi tukee.

- -

Katso myös

- - diff --git a/files/fi/web/api/canvas_api/index.html b/files/fi/web/api/canvas_api/index.html deleted file mode 100644 index 51e68b4840..0000000000 --- a/files/fi/web/api/canvas_api/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: Canvas -slug: Web/API/Canvas_API -translation_of: Web/API/Canvas_API -original_slug: HTML/Canvas ---- -

HTML5:een lisätty HTML {{HTMLElement("canvas")}}-elementti on elementti, jota voidaan käyttää grafiikan piirtämiseen skriptaamalla (tavallisesti JavaScript-kielellä). Sitä voidaan käyttää esimerkiksi diagrammojen piirtämiseen, valokuvayhdistelmien tekemiseen, animaatioiden luomiseen ja jopa ajantasaiseen video-käsittelyyn.

-

Mozilla-sovellukset saivat <canvas>-tuen Gecko 1.8-versiosta alkaen (toisin sanoen Firefox 1.5:stä lähtien). Elementin esitteli alunperin Apple OS X-käyttöjärjestelmä Dashboard- ja Safari-sovelluksissa. Internet Explorer tukee <canvas>:ia versiosta 9 lähtien; IE-selaimen aiemmissa versioissa webbisivulle voidaan tehokkaasti lisätä <canvas>-tuki Googlen Explorer Canvas-hankkeen skriptillä. Google Chrome ja Opera 9 tukevat myös <canvas>:ia.

-

WebGL käyttää myös <canvas>-elementtiä 3D-grafiikan laitteistokiihdytykseen webbisivuilla.

-
-
-

Dokumentaatio

-
-
- Spesifikaatio
-
- Elementti <canvas> on osa WhatWG Web applications 1.0 -spesifikaatiota, joka tunnetaan myös nimellä HTML5.
-
- Canvas-oppikurssi
-
- Laaja oppikurssi, joka kattaa sekä <canvas>-peruskäytön että sen edistyneemmät ominaisuudet.
-
- Koodikatkelma:Canvas
-
- Joitakin <canvas>:iin liittyviä koodikatkelmia.
-
- Canvas-esimerkkejä
-
- Muutama <canvas>-esittelyohjelma.
-
- DOM-objektien piirtäminen canvas-elementtiin
-
- Kuinka piirtää canvas-komponenttiin DOM-sisältö, kuten HTML-elementit.
-
- Perussädeheittäjä
-
- Canvasia käyttävä sädejäljitysanimaation esittelyohjelma.
-
- Canvas DOM -rajapinnat
-
- Canvas DOM -rajapinnat Gecko-alustalla.
-
-

Katso kaikkia...

-
-
-

Yhteisö

- -

Resurssit

- -

Kirjastot

-
    -
  • libCanvas on tehokas ja kevyt canvas-ympäristö
  • -
  • Processing.js on toiseen käyttöympäristöön siirretty Prosessin visualisointikieli
  • -
  • EaselJS on kirjasto, jossa on Flash-tyyppinen sovellusohjelmointirajapinta (API)
  • -
  • PlotKit on taulukko- ja grafiikkakirjasto
  • -
  • Rekapi on avainkehys-animaatioympäristön sovellusohjelmointirajapinta Canvasille
  • -
  • PhiloGL on WebGL-ympäristö datan visualisointiin, luovaan koodaukseen ja pelikehitykseen.
  • -
  • JavaScript InfoVis Toolkit luo vuorovaikutteisia 2D Canvas -datavisualisointeja webbiin.
  • -
  • Frame-Engine on sovellusten ja pelin kehitysympäristö
  • -
- - -
-
-
- {{HTML5ArticleTOC()}}
diff --git a/files/fi/web/api/document_object_model/index.html b/files/fi/web/api/document_object_model/index.html deleted file mode 100644 index 5997dd369e..0000000000 --- a/files/fi/web/api/document_object_model/index.html +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: Document Object Model (DOM) -slug: Web/API/Document_Object_Model -tags: - - DOM - - NeedsTranslation - - References - - TopicStub -translation_of: Web/API/Document_Object_Model -translation_of_original: DOM -original_slug: DOM ---- -
-
- Using the W3C DOM Level 1 Core
- Introduction to the W3C DOM.
-
-
-

The Document Object Model (DOM) is an API for HTML and XML documents. It provides a structural representation of the document, enabling you to modify its content and visual presentation by using a scripting language such as JavaScript.

-
-
-
-

Documentation about the DOM

-
-
- Gecko DOM Reference
-
- The Gecko Document Object Model Reference.
-
- About the Document Object Model
-
- A short introduction to the DOM.
-
- The DOM and JavaScript
-
- What is the DOM? What is JavaScript? How do I use them together on my web page? This document answers these questions and more.
-
- Using dynamic styling information
-
- How to obtain information on and manipulate styling via the DOM.
-
- DOM event reference
-
- Lists all the DOM events and their meanings.
-
- History API: Manipulating the browser history
-
- Demonstrates the HTML5-introduced DOM {{ domxref("window.history") }} object, allowing dynamic changes to the browser history.
-
- File API: Using files from web applications
-
- Describes the HTML5-introduced capability to select a local file and read data from it.
-
- Using the Page Visibility API
-
- Explains how to detect and use information about a web page being in the foreground or in the background.
-
- Fullscreen API: Using the fullscreen mode
-
- Describes how to set up a page that use the whole screen, without any browser UI around it.
-
- Determining the dimensions of elements
-
- How to figure out the right way to determine the dimensions of elements, given your needs.
-
- Dynamically modifying XUL-based user interface
-
- The basics of manipulating the XUL UI with DOM methods.
-
-

View All...

-
-
-

Getting help from the community

-

You need help on a DOM-related problem and can't find the solution in the documentation?

-
    -
  • Consult the dedicated Mozilla forum: {{ DiscussionList("dev-tech-dom", "mozilla.dev.tech.dom") }}
  • -
-

Tools easing working with the DOM

- -

View All...

- - -
-
-

 

diff --git a/files/fi/web/api/index.html b/files/fi/web/api/index.html deleted file mode 100644 index 98bda55ac9..0000000000 --- a/files/fi/web/api/index.html +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Web API Interfaces -slug: Web/API -tags: - - Web -translation_of: Web/API ---- -

When writing code for the Web using JavaScript, there are a great many APIs available. Below is a list of all the interfaces (that is, types of objects) that you may be able to use while developing your Web app or site.

- -
{{APIListAlpha}}
diff --git a/files/fi/web/api/intersectionobserver/index.html b/files/fi/web/api/intersectionobserver/index.html deleted file mode 100644 index e62bd8b216..0000000000 --- a/files/fi/web/api/intersectionobserver/index.html +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: IntersectionObserver -slug: Web/API/IntersectionObserver -translation_of: Web/API/IntersectionObserver ---- -
{{APIRef("Intersection Observer API")}}
- -

Intersection Observer API:n  rajapinta IntersectionObserver tarjoaa asynkronisen keinon tarkkailla muutoksia kohde-elementin ja sen esi-isäelementin tai ylätason dokumentin {{Glossary('viewport')}}:n kanssa. Näihin korkeamman tason DOM -elementteihin viitataan nimellä "root".

- -

Kun IntersectionObserver luodaan, se konfiguroidaan tarkkailemaan DOM-elementtien näkyvyyttä suhteessa root:tiin. Tätä konfiguraatiota ei voida muuttaa sen jälkeen, kun se on initialisoitu, eli käytännössä yhdellä instanssilla tarkkaillaan elementtien näkyvyyttä yhden root -tason elementin suhteen. Yhdellä IntersectionObserver:lla voidaan kuitenkin tarkkailla monen elementin näkyvyyttä tämän suhteen.

- -

Constructor

- -
-
{{domxref("IntersectionObserver.IntersectionObserver()")}}
-
Luo uuden IntersectionObserver -instanssin, joka suorittaa annetun "callback" -function kun se havaitsee, että kohde-elementin näkyvyys on ylittänyt annetun kynnyksen.
-
- -

Properties

- -
-
{{domxref("IntersectionObserver.root")}} {{readonlyinline}}
-
Tietty elementin esi-isä -elementti, jonka suhteen kohteen {{domxref("element")}} näkyvyyttä tarkkaillaan. Jos tätä ei erityiesti määritellä, käytetään koko dokumentin juuren viewport:ia.
-
{{domxref("IntersectionObserver.rootMargin")}} {{readonlyinline}}
-
An offset rectangle applied to the root's {{Glossary('bounding box')}} when calculating intersections, effectively shrinking or growing the root for calculation purposes. The value returned by this property may not be the same as the one specified when calling the constructor as it may be changed to match internal requirements. Each offset can be expressed in pixels (px) or as a percentage (%). The default is "0px 0px 0px 0px".
-
{{domxref("IntersectionObserver.thresholds")}} {{readonlyinline}}
-
A list of thresholds, sorted in increasing numeric order, where each threshold is a ratio of intersection area to bounding box area of an observed target. Notifications for a target are generated when any of the thresholds are crossed for that target. If no value was passed to the constructor, 0 is used.
-
- -

Methods

- -
-
{{domxref("IntersectionObserver.disconnect()")}}
-
Stops the IntersectionObserver object from observing any target.
-
{{domxref("IntersectionObserver.observe()")}}
-
Tells the IntersectionObserver a target element to observe.
-
{{domxref("IntersectionObserver.takeRecords()")}}
-
Returns an array of {{domxref("IntersectionObserverEntry")}} objects for all observed targets.
-
{{domxref("IntersectionObserver.unobserve()")}}
-
Tells the IntersectionObserver to stop observing a particular target element.
-
- -

Examples

- -
var intersectionObserver = new IntersectionObserver(function(entries) {
-  // If intersectionRatio is 0, the target is out of view
-  // and we do not need to do anything.
-  if (entries[0].intersectionRatio <= 0) return;
-
-  loadItems(10);
-  console.log('Loaded new items');
-});
-// start observing
-intersectionObserver.observe(document.querySelector('.scrollerFooter'));
- -

Specifications

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName("IntersectionObserver", "#intersection-observer-interface", "IntersectionObserver")}}{{Spec2('IntersectionObserver')}}
- -

Browser compatibility

- - - -

{{Compat("api.IntersectionObserver")}}

- -

See also

- - diff --git a/files/fi/web/api/navigator/battery/index.html b/files/fi/web/api/navigator/battery/index.html deleted file mode 100644 index a7c0268ed1..0000000000 --- a/files/fi/web/api/navigator/battery/index.html +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: window.navigator.battery -slug: Web/API/Navigator/battery -translation_of: Web/API/Navigator/battery -original_slug: DOM/window.navigator.battery ---- -

{{ ApiRef() }}

-

Battery Status API, useimmiten lyhennettynä Battery API, tarjoaa tietoa järjestelmän akun lataustasosta ja sallii sinulle ilmoitettavan muutaman akkutasomuutostapahtuman kautta. Tätä voitaisiin käyttää lataamaan vähemmän suoritinintensiiviset tehtävät sivustollasi, jos akkuvirta on vähissä ja tallentaa muutokset ennen akkuvirran loppumista, jotta estetään tietojen häviäminen.

-

Battery Status API laajentaa {{domxref("window.navigator")}}-objektin metodilla battery. Se määrittää myös muutamia uusia tapahtumia.

-

Attribuutit

-
-
- charging
-
- Kirjoitussuojattu. Boolean-arvo edustaa järjestelmän akun lataustilaa. Palauttaa arvon true, jos akkua ladataan, jos järjestelmän akun tila ei ole määriteltävissä, tai jos akkua ei ole liitetty järjestelmään. Palauttaa arvon false, jos akkua puretaan.
-
- chargingTime
-
- Kirjoitussuojattu. Double-arvo edustaa jäljellä olevaa sekuntimäärää siihen kun järjestelmän akku ladattu täyteen. Palauttaa arvon 0, jos akku on ladattu täyteen.
- Palauttaa positiivisen äärettämän arvon, jos akkua puretaan tai jos toteutus ei kykene ilmoittamaan jäljellä olevaa latausaikaa.
-
- dischargingTime
-
- Kirjoitussuojattu. Double-arvo edustaa jäljellä olevaa sekuntimäärää siihen kun järjestelmän akku on täysin purettu ja järjestelmä keskeytetään. Palauttaa positiivisen äärettömän arvon, jos akkua ladataan, jos toteutus ei kykene ilmoittamaan purkamisaikaa, tai jos järjestelmään ei ole liitetty akkua.
-
- level
-
- Kirjoitussuojattu. Double-arvo edustaa järjestelmän akun lataustasoa skaalalla 0 ... 1.0. Palauttaa arvon 0, jos akku on tyhjä ja järjestelmä on siirtymässä keskeytystilaan. Palauttaa arvon 1.0, jos akku on täynnä, jos toteutus ei kykene ilmoittamaan akun tasoa, tai jos akkua ei ole liitetty järjestelmään.
-
-

Tapahtumat

-
-
- chargingchange
-
- Laukeaa, kun akun lataustilaa päivitetään.
-
- chargingtimechange
-
- Laukeaa, kun akun latausaikaa päivitetään.
-
- dischargingtimechange
-
- Laukeaa, kun akun purkausaikaa päivitetään.
-
- levelchange
-
- Laukeaa, kun akun tasoa päivitetään.
-
-

Esimerkki

-

Katso myös esimerkkiä spesifikaatiossa.

-
var battery = navigator.battery || navigator.mozBattery || navigator.webkitBattery;
-
-function updateBatteryStatus() {
-  alert("Battery status: " + battery.level * 100 + " %");
-
-  if (battery.charging) {
-    alert("Battery is charging");
-  }
-}
-
-battery.addEventListener("chargingchange", updateBatteryStatus);
-battery.addEventListener("levelchange", updateBatteryStatus);
-updateBatteryStatus();
-
-

Spesifikaatiot

- - - - - - - - - - - - - - - -
SpesifikaatioTilaKommentti
{{SpecName('Battery API')}}{{Spec2('Battery API')}}Alustava spesifikaatio.
-

Selainyhteensopivuus

-

{{ CompatibilityTable() }}

-
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Perustuki20 {{ property_prefix("webkit") }}{{CompatGeckoDesktop("10")}} {{ property_prefix("moz") }} [1]
- {{CompatGeckoDesktop("16")}} (without prefix) [2]
{{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}
-
-
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Perustuki20 {{ property_prefix("webkit") }}{{CompatGeckoMobile("10")}} {{ property_prefix("moz") }} [1]
- {{CompatGeckoMobile("16")}} (without prefix) [2]
{{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}
-
-

Gecko-kommentit

-

[1] Disabled by default in Firefox 10.0, but can be enabled setting the preference dom.battery.enabled to true. Starting with Firefox 11.0, mozBattery is enabled by default.

-

[2] The Battery API is currently supported on Android, Windows, and Linux with UPower installed. Support for MacOS is available starting with Gecko 18.0 {{geckoRelease("18.0")}}.

-

Katso myös

- diff --git a/files/fi/web/api/navigator/buildid/index.html b/files/fi/web/api/navigator/buildid/index.html deleted file mode 100644 index 45d96d5d30..0000000000 --- a/files/fi/web/api/navigator/buildid/index.html +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: window.navigator.buildID -slug: Web/API/Navigator/buildID -translation_of: Web/API/Navigator/buildID -original_slug: DOM/window.navigator.buildID ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Palauttaa selaimen rakentamistunnisteen.

-

Syntaksi

-
buildID = navigator.buildID;
-
-

buildID on sovelluksen rakentamistunniste merkkijonona. Tämä rakentamistunniste on muotoa YYYYMMDDHH.

-

Esimerkki

-
dump(window.navigator.buildID);
-// prints "2006090803" to the console
-
-

Huomaa

-

Käytettävissä selaimessa Firefox 2 (Gecko 1.8.1) ja uudemmissa. Toteutettu kohteessa {{ Bug(345993) }}.

-

Spesifikaatio

-

Ei kuulu mihinkään standardiin.

-

{{ languages( { "ja": "ja/DOM/window.navigator.buildID", "zh-cn": "zh-cn/DOM/window.navigator.buildID", "pl": "pl/DOM/window.navigator.buildID" } ) }}

diff --git a/files/fi/web/api/navigator/connection/index.html b/files/fi/web/api/navigator/connection/index.html deleted file mode 100644 index db3485532a..0000000000 --- a/files/fi/web/api/navigator/connection/index.html +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: window.navigator.connection -slug: Web/API/Navigator/connection -translation_of: Web/API/Navigator/connection -original_slug: DOM/window.navigator.connection ---- -

{{ Apiref() }}

-

{{ SeeCompatTable() }}

-

Network Information API tarjoaa tietoa järjestelmän verkkoyhteydestä, kuten käyttäjän laitteen nykyisestä kaistanleveydestä tai onko yhteys mitattu. Tätä voitaisiin käyttää valitsemaan HD-sisältö tai LD-sisältö käyttäjän yhteyteen perustuen.

-

Attribuutit

-
-
- bandwidth
-
- Kirjoitussuojattu. Double-arvo edustaa arvioitua nykyisen yhteyden latauskaistanleveyttä (arvona MB/s). 0 jos käyttäjä ei ole parhaillaan verkkoyhteydessä ja infinity jos kaistanleveys on tuntematon.
-
- metered
-
- Kirjoitussuojattu. Boolean-arvo palauttaen true, jos yhteys on mitattu (esim.: pay-per-use).
-
-

Tapahtumat

-
-
- onchange
-
- Laukeaa, kun yhteys muuttuu.
-
-

Esimerkki

-
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
-
-function updateConnectionStatus() {
-  alert("Connection bandwidth: " + connection.bandwidth + " MB/s");
-  if (connection.metered) {
-    alert("The connection is metered!");
-  }
-}
-
-connection.addEventListener("change", updateConnectionStatus);
-updateConnectionStatus();
-
-

Selainyhteensopivuus

-

{{ CompatibilityTable() }}

-
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Perustuki20? {{ property_prefix("webkit") }}12.0 {{ property_prefix("moz") }} (katso kommentit){{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}
-
-
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Perustuki{{ CompatNo() }}12.0 {{ property_prefix("moz") }} (katso kommentit){{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}
-
-

Gecko-kommentit

- -

Spesifikaatio

- -

Katso myös

- diff --git a/files/fi/web/api/navigator/cookieenabled/index.html b/files/fi/web/api/navigator/cookieenabled/index.html deleted file mode 100644 index 505ac8fa2a..0000000000 --- a/files/fi/web/api/navigator/cookieenabled/index.html +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: Navigator.cookieEnabled -slug: Web/API/Navigator/cookieEnabled -tags: - - API - - DOM - - Ominaisuus -translation_of: Web/API/Navigator/cookieEnabled -original_slug: DOM/window.navigator.cookieEnabled ---- -

{{ ApiRef("HTML DOM") }}

- -

Palauttaa totuusarvon, joka osoittaa, ovatko evästeet käytössä vai eivät.

- -

Syntaksi

- -
var cookieEnabled = navigator.cookieEnabled;
-
- - - -

Esimerkki

- -
if (!navigator.cookieEnabled) {
-  // kerrotaan käyttäjälle, että evästeiden käyttöönotto tekee sivusta paljon hyödyllisemmän
-}
-
- -

Määrittelyt

- - - - - - - - - - - - - - - - -
MäärittelyTilaKommentti
{{SpecName("HTML WHATWG", "webappapis.html#dom-navigator-cookieenabled", "Navigator.cookieEnabled")}}{{Spec2("HTML WHATWG")}}Alkuperäinen määrittely
- -

Selainyhteensopivuus

- -

{{ CompatibilityTable() }}

- -
- - - - - - - - - - - - - - - - - - - -
OminaisuusChromeFirefox (Gecko)Internet ExplorerOperaSafari
Perustuki{{ CompatVersionUnknown() }}{{ CompatGeckoDesktop(1.0) }}{{ CompatVersionUnknown() }}[1]{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
-
- -
- - - - - - - - - - - - - - - - - - - -
OminaisuusAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Perustuki{{ CompatUnknown() }}{{ CompatGeckoMobile(1.0) }}[1]{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
-
- -

[1] Ennen Gecko 8.0:aa {{ geckoRelease("8.0") }}, window.navigator.cookieEnabled ilmoittaa väärän tuloksen, jos sivulle, jolle tarkistus suoritetaan, on asetettu sivustopoikkeus. Tämä on korjattu.

diff --git a/files/fi/web/api/navigator/donottrack/index.html b/files/fi/web/api/navigator/donottrack/index.html deleted file mode 100644 index a06787c3c9..0000000000 --- a/files/fi/web/api/navigator/donottrack/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: navigator.doNotTrack -slug: Web/API/Navigator/doNotTrack -translation_of: Web/API/Navigator/doNotTrack -original_slug: DOM/navigator.doNotTrack ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Palauttaa käyttäjän do-not-track -asetuksen. Tämä on "yes", jos käyttäjä on pyytänyt, että hänen vierailemiaan webbisivuja, sisältöä tai mainoksia ei seurata.

-

Syntaksi

-
dnt = navigator.doNotTrack;
-
-

Huomaa, että navigator.doNotTrack ei ole do-not-track -otsakkeessa lähetettävä arvo.  Kun the do-not-track otsake lähettää "1", navigator.doNotTrack on "yes".  Kun otsaketta ei ole asetettu, navigator.doNotTrack on "unspecified".  Kun otsake lähettää "0" (ei tueta nykyisin Firefoxissa), navigator.doNotTrack on "no".

-

Esimerkki

-
dump(window.navigator.doNotTrack);
-// tulostaa "yes" jos DNT ei ole käytössä; muussa tapauksessa tämä on "unspecified" Firefoxissa
-
-

Spesifikaatio

-

Tracking Preference Expression (Working Draft) perustuu tämän spesifikaation aikaisempaan versioon josssa navigator.doNotTrack on do-not-track -otsakkeessa lähetettävä arvo.

-

Katso myös

- -

Selainyhteensopivuus

-

{{CompatibilityTable() }}

-
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Perustuki{{ CompatUnknown() }}{{ CompatGeckoDesktop("9.0") }}9125.1 käyttöjärjestelmässä OS X 10.7
-
-
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Perustuki{{ CompatUnknown() }}{{ CompatGeckoMobile("9.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
-
- -

{{ languages( { "zh-cn": "zh-cn/DOM/navigator.doNotTrack" } ) }}

diff --git a/files/fi/web/api/navigator/oscpu/index.html b/files/fi/web/api/navigator/oscpu/index.html deleted file mode 100644 index 5377c0cb69..0000000000 --- a/files/fi/web/api/navigator/oscpu/index.html +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: window.navigator.oscpu -slug: Web/API/Navigator/oscpu -translation_of: Web/API/Navigator/oscpu -original_slug: DOM/window.navigator.oscpu ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Palauttaaa merkkijonon, joka identifioi nykyisen käyttäjärjestelmän.

-

Syntaksi

-
oscpuInfo = window.navigator.oscpu
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KäyttöjärjestelmäoscpuInfo-merkkijonomuoto
OS/2OS/2 Warp x (joko 3, 4 tai 4.5)
Windows CEWindowsCE 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-bitWindows NT x.y
Mac OS X (PPC build)PPC Mac OS X x.y
Mac OS X (i386/x64 build)Intel Mac OS X x.y
Linux 64-bit (32-bit build)Output of uname -s plus "i686 on x86_64"
LinuxOutput of uname -sm
-

1x.y viittaa käyttöjärjestelmän versioon

-

Esimerkki

-
function osInfo() {
-  alert(window.navigator.oscpu);
-}
-// palauttaa esimerkiksi: "Windows NT 6.0"
-
-

Kommentit

-

Jollei koodi ole etuoikeutettu (chrome tai ainakin on UniversalBrowserRead-etuoikeus), se voi saada general.oscpu.override-asetusarvon eikä todellista alustaa.

-

Spesifikaatio

-

{{ DOM0() }}

-

{{ languages( { "ja": "ja/DOM/window.navigator.oscpu", "zh-cn": "zh-cn/DOM/window.navigator.oscpu", "pl": "pl/DOM/window.navigator.oscpu" } ) }}

diff --git a/files/fi/web/api/navigator/productsub/index.html b/files/fi/web/api/navigator/productsub/index.html deleted file mode 100644 index eecbb2d1a8..0000000000 --- a/files/fi/web/api/navigator/productsub/index.html +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: window.navigator.productSub -slug: Web/API/Navigator/productSub -translation_of: Web/API/Navigator/productSub -original_slug: DOM/window.navigator.productSub ---- -
- {{ApiRef}} {{non-standard_header}}
-

Yhteenveto

-

productSub palauttaa nykyisen selaimen rakentamisnumeron.

-

Syntaksi

-
prodSub = window.navigator.productSub
- -

Esimerkki

-
<script>
-function prodsub() {
-  var dt = document.getElementById("d").childNodes[0];
-  dt.data = window.navigator.productSub;
-}
-</script>
-
-<button onclick="prodsub();">productSub</button>
-// palauttaa: 20010725
-

Kommentit

-

IE-selaimessa tämä ominaisuus palauttaa määrittelemättömän.

-

Apple Safari- ja Google Chrome-selaimissa tämä ominaisuus palauttaa aina 20030107.

-

Spesifikaatio

-

{{dom0}}

diff --git a/files/fi/web/api/navigator/vendor/index.html b/files/fi/web/api/navigator/vendor/index.html deleted file mode 100644 index 0a454d0cff..0000000000 --- a/files/fi/web/api/navigator/vendor/index.html +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: window.navigator.vendor -slug: Web/API/Navigator/vendor -translation_of: Web/API/Navigator/vendor -original_slug: DOM/window.navigator.vendor ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Palauttaa nykyisen selaimen selaintoimittajan nimen.

-

Syntaksi

-
venString = window.navigator.vendor
-
-

Parametrit

- -

Esimerkki

-
window.navigator.vendor
-// returns "Netscape6"
-
-

Kommentit

-

toimittaja on toinen userAgent-merkkijonon osa. Tuote ja toimittaja voivat olla erilaisia--kuten kun Netscape 6.1 käyttää Gecko-tuotetta tehdäkseen oman renderointinsa. Katso myös navigator.product, navigator.userAgent

-

Spesifikaatio

-

DOM Level 0. Ei ole spesifikaation osa.

-

{{ languages( { "ja": "ja/DOM/window.navigator.vendor" ,"zh-cn": "zh-cn/DOM/window.navigator.vendor" } ) }}

diff --git a/files/fi/web/api/navigatorid/appcodename/index.html b/files/fi/web/api/navigatorid/appcodename/index.html deleted file mode 100644 index 332f211f68..0000000000 --- a/files/fi/web/api/navigatorid/appcodename/index.html +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: window.navigator.appCodeName -slug: Web/API/NavigatorID/appCodeName -translation_of: Web/API/NavigatorID/appCodeName -original_slug: DOM/window.navigator.appCodeName ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Palauttaa nykyisen selaimen sisäisen "code"-nimen.

-

Syntaksi

-
codeName = window.navigator.appCodeName
-
-

Parametrit

- -

Esimerkki

-
dump(window.navigator.appCodeName);
-
-

Kommentit

-

Mozilla, Netscape 6, jad IE5 kaikki käyttävät sisäistä nimeä "Mozilla."

-

Spesifikaatio

-

DOM Level 0. Ei ole spesifikaation osa.

-

{{ languages( { "zh-cn": "zh-cn/DOM/window.navigator.appCodeName","ja": "ja/DOM/window.navigator.appCodeName", "pl": "pl/DOM/window.navigator.appCodeName" } ) }}

diff --git a/files/fi/web/api/navigatorid/appname/index.html b/files/fi/web/api/navigatorid/appname/index.html deleted file mode 100644 index b18bc0137a..0000000000 --- a/files/fi/web/api/navigatorid/appname/index.html +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: window.navigator.appName -slug: Web/API/NavigatorID/appName -translation_of: Web/API/NavigatorID/appName -original_slug: DOM/window.navigator.appName ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Palauttaa selaimen nimen. HTML5-spesifikaatio sallii kaikkien selainten myös palauttaa tässä "Netscape" yhteensopivuussyistä.

-
- Huomaa: Älä nojaa tähän ominaisuuteen oikean selainnimen palauttamiseksi. Gecko-perustaisissa selaimissa (kuten Firefox) ja WebKit-perustaisissa selaimissa (kuten Chrome ja Safari) palautettu arvo on "Netscape".
-

Syntaksi

-
appName = window.navigator.appName
-
-

Palautettu arvo

- -

Esimerkki

-
alert(window.navigator.appName);
-// shows the name of the browser
-
-

Spesifikaatio

- -

Tämä oli alunperin osa DOM-tasoa 0, mutta on sen jälkeen sisällytetty HTML5-spesifikaatioon.

-

{{ languages( { "ja": "ja/DOM/window.navigator.appName", "pl": "pl/DOM/window.navigator.appName", "zh-cn": "zh-cn/DOM/window.navigator.appName" } ) }}

diff --git a/files/fi/web/api/navigatorid/appversion/index.html b/files/fi/web/api/navigatorid/appversion/index.html deleted file mode 100644 index df3b54e42e..0000000000 --- a/files/fi/web/api/navigatorid/appversion/index.html +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: window.navigator.appVersion -slug: Web/API/NavigatorID/appVersion -translation_of: Web/API/NavigatorID/appVersion -original_slug: DOM/window.navigator.appVersion ---- -
- {{APIRef}}
-
-  
-
- Yhteenveto
-

Palauttaa selaimen version merkkijonona. Se voi olla joko pelkkä versionumero, kuten "5.0", tai versionumero, jota seuraa yksityiskohtaisempia tietoja. HTML5-spesifikaatio sallii myös kaikkien selainten palauttaa tässä "4.0" yhteensopivuussyistä.

-
- Huomaa: Älä nojaa tähän ominaisuuteen oikean selainversion palauttamiseksi. Gecko-perustaisissa selaimissa (kuten Firefox) ja WebKit-perustaisissa selaimissa (kuten Chrome ja Safari) palautettu arvo alkaa merkkiyhdistelmällä "5.0", jota seuraa alustatiedot. Opera 10 ja uudemmissa selaimissa palautettu versio ei myöskään täsmää oikeaan selainversioon.
-

Syntaksi

-
window.navigator.appVersion
-
-

Palautettu arvo

- -

Esimerkki

-
alert("Your browser version is reported as " + navigator.appVersion);
-
-

Kommentit

-

Ominaisuus window.navigator.userAgent voi myös ehkä sisältää versionumeron (esimerkki: "Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape 6/6.1"), mutta sinun tulisi olla tietoinen, kuinka helposti user agent -merkkijonoa voi muuttaa ja "huijata" muita selaimia, alustoja tai user agent -ohjelmia ja kuinka kavereita toimittajat itse ovat näiden ominaisuuksien kanssa.

-

Ominaisuuksia window.navigator.appVersion, window.navigator.appName ja window.navigator.userAgent on käytetty "selainnuuhkimis"-koodissa: skripteissä, jotka yrittävät havaita, minkälaista selainta käytät ja säätävät sivut sen mukaiseksi. Tämä johti nykyiseen tilanteeseen, joissa selainten on palautettava vääriä arvoja näissä ominaisuuksissa, jotta niitä ei voitaisi lukita ulos joiltakin webbisivustoilta.

-

Spesifikaatio

- -

Tämä oli alunperin osa DOM-taso 0:aa, mutta on sittemmin sisällytettty HTML5-spesifikaatioon.

diff --git a/files/fi/web/api/navigatorid/platform/index.html b/files/fi/web/api/navigatorid/platform/index.html deleted file mode 100644 index 2f42a46de9..0000000000 --- a/files/fi/web/api/navigatorid/platform/index.html +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: window.navigator.platform -slug: Web/API/NavigatorID/platform -translation_of: Web/API/NavigatorID/platform -original_slug: DOM/window.navigator.platform ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Palauttaa selaimen alustaa edustavan merkkijonon.

-

Syntaksi

-
platform = navigator.platform
-
-

platform on merkkijono, joka on yksi seuraavista arvoista: "Win32", "Linux i686", "MacPPC", "MacIntel", tai jokin muu.

-

Esimerkki

-
alert(navigator.platform);
-

Kommentit

-

Jollei koodisi ole etuoikeutettu (chrome tai vähintään UniversalBrowserRead-etuoikeus), se voi ehkä saada general.platform.override-asetusarvon eikä oikean alustan.

-

Spesifikaatio

- -

Tämä oli alunperin osa DOM Level 0-määrittelyä, mutta on sittemmin sisällytetty HTML5-spesifikaatioon.

-

{{ languages( {"ja": "ja/DOM/window.navigator.platform", "zh-cn": "zh-cn/DOM/window.navigator.platform", "pl": "pl/DOM/window.navigator.platform" } ) }}

diff --git a/files/fi/web/api/navigatorid/product/index.html b/files/fi/web/api/navigatorid/product/index.html deleted file mode 100644 index b5db62bed0..0000000000 --- a/files/fi/web/api/navigatorid/product/index.html +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: window.navigator.product -slug: Web/API/NavigatorID/product -translation_of: Web/API/NavigatorID/product -original_slug: DOM/window.navigator.product ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Tämä ominaisuus palauttaa nykyisen selaimen tuotenimen.

-
- Huomaa: Älä nojaa tähän ominaisuuteen oikean tuotenimen palauttamiseksi. Sekä Gecko- että WebKit-selaimet palauttavat "Gecko" tämän ominaisuuden arvona.
-

Syntaksi

-
productName = window.navigator.product
-
-

Palautettu arvo

- -

Esimerkki

-
<script>
-function prod() {
-  dt = document.getElementById("d");
-  dt.innerHTML = window.navigator.product;
-}
-</script>
-<button onclick="prod();">product</button>
-<div id="d"> </div>
-// palauttaa merkkijonon "Gecko"
-
-

Kommentit

-

Gecko-perustaisissa selaimissa product täsmää siihen osaan user agent -merkkijonoon, joka tulee heti alustan jälkeen. Esimerkiksi Netscape 6.1-selaimen user agent -merkkijonossa tuote on "Gecko" ja koko agent-merkkijono on seuraava: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape6/6.1.

-

WebKit-perustaisten selainten product-merkkijono palauttaa arvon "Gecko" vaikka koko user agent -merkkijonon heti alustan jälkeinen merkkijono on itse asiassa seuraava: (KHTML, like Gecko).

-

Spesifikaatio

-

DOM Level 0. Ei ole spesifikaation osa.

-
-  
-

{{ languages( { "ja": "ja/DOM/window.navigator.product", "pl": "pl/DOM/window.navigator.product" } ) }}

diff --git a/files/fi/web/api/navigatorid/useragent/index.html b/files/fi/web/api/navigatorid/useragent/index.html deleted file mode 100644 index 207aa5d82b..0000000000 --- a/files/fi/web/api/navigatorid/useragent/index.html +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: window.navigator.userAgent -slug: Web/API/NavigatorID/userAgent -translation_of: Web/API/NavigatorID/userAgent -original_slug: DOM/window.navigator.userAgent ---- -
- {{ApiRef}}
-

Yhteenveto

-

Palauttaa nykyisen selaimen user agent -merkkijonon.

-

Syntaksi

-
var ua = window.navigator.userAgent;
-
-

Arvo

-

ua tallentaa nykyisen selaimen user agent -merkkijonarvon.

-

Ominaisuus window.navigator.userAgent on read-write-arvo; sillä ei ole oletusarvoa.

-

Merkkijono user agent rakennetaan muotorakenteeseen, joka koostuu useasta tieto-osiosta. Jokainen näistä osista tulee muista navigator-ominaisuuksista, jotka käyttäjä voi myös asettaa. Gecko-perustaiset selaimet noudattavat seuraavaa rakennetta:

-
userAgent = appCodeName/appVersion number (Platform; Security; OS-or-CPU;
-Localization; rv: revision-version-number) product/productSub
-Application-Name Application-Name-version
-
-

Esimerkki

-
alert(window.navigator.userAgent)
-// alerts "Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape6/6.1"
-
-

Kommentit

-

Selaintunnistus, joka perustuu user agent -merkkijono havainnointiin epäluotetttava ja sitä ei suositella, koska käyttäjä voi asettaa user agent -merkkijonon. Esimerkiksi:

- -

Spesifikaatio

-

{{DOM0}}

-

Katso myös

- diff --git a/files/fi/web/api/navigatorlanguage/language/index.html b/files/fi/web/api/navigatorlanguage/language/index.html deleted file mode 100644 index 33479e29a4..0000000000 --- a/files/fi/web/api/navigatorlanguage/language/index.html +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: window.navigator.language -slug: Web/API/NavigatorLanguage/language -translation_of: Web/API/NavigatorLanguage/language -original_slug: DOM/window.navigator.language ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Palauttaa selaimen kieliversiota edustavan merkkijonon.

-

Syntaksi

-
lang = window.navigator.language
-
-

Parametrit

- -

Esimerkki

-
if ( window.navigator.language != "en" ) {
- doLangSelect(window.navigator.language);
-}
-
-

Selainyhteensopivuus

-

{{ CompatibilityTable() }}

-
- - - - - - - - - - - - - - - - - - - -
OminaisuusChromeFirefox (Gecko)Internet ExplorerOperaSafari
Perustuki -

{{ CompatVersionUnknown() }}

-

Selaimesta Chrome 0.3.154 alkaen tämä ominaisuus perustuu Accept-Language HTTP header-otsakkeen arvoon.

-
-

{{ CompatGeckoDesktop(1.0) }}

-

Ennen Gecko 2.0 {{ geckoRelease("2.0") }} -selainversiota tämän ominaisuuden arvo oli osa user agent -merkkijonoa, jonka {{ domxref("window.navigator.userAgent", "navigator.userAgent") }} ilmoitti.

-

Selaimesta Gecko 5.0 {{ geckoRelease("5.0") }} alkaen tämän ominaisuuden arvo perustuu Accept-Language HTTP header-otsakkeen arvoon.

-
-

{{ CompatNo() }}

-

Lähimmät käytettävissä olevat (ei-standardit) ominaisuudet ovat userLanguage ja browserLanguage.

-
{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
-
-
- - - - - - - - - - - - - - - - - - - -
OminaisuusAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Perustuki{{ CompatVersionUnknown() }}{{ CompatGeckoMobile(1.0) }} -

{{ CompatNo() }}

-

Lähimmät käytettävissä olevat (ei-standardit) ominaisuudet ovat userLanguage ja browserLanguage.

-
{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
-
-

Spesifikaatio

-

DOM Level 0. Ei ole spesifikaation osa.

-

{{ languages( { "ja": "ja/DOM/window.navigator.language","zh-cn": "zh-cn/DOM/window.navigator.language", "pl": "pl/DOM/window.navigator.language", "fi": "fi/DOM/window.navigator.language" } ) }}

diff --git a/files/fi/web/api/navigatoronline/online/index.html b/files/fi/web/api/navigatoronline/online/index.html deleted file mode 100644 index 04520c17a2..0000000000 --- a/files/fi/web/api/navigatoronline/online/index.html +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: window.navigator.onLine -slug: Web/API/NavigatorOnLine/onLine -translation_of: Web/API/NavigatorOnLine/onLine -original_slug: DOM/window.navigator.onLine ---- -
- {{ApiRef}}
-

Yhteenveto

-

Palauttaa selaimen verkkotilan. Ominaisuus palauttaa boolean-arvon, joka on true, kun verkkoyhteys on päällä ja false, kun selain toimii erillissovelluksena. Ominaisuus lähettää päivityksiä aina kun selaimen kyky yhdistyä verkkoon muuttuu. Päivitys tapahtuu, kun käyttäjä seuraa linkkiä tai kun skripti pyytää etäsivua. Esimerkiksi ominaisuuden pitäisi palauttaa false, kun käyttäjä napsauttaa linkkiä pian internet-yhteyden katkeamisen jälkeen.

-

Selaimet toteuttavat tätä ominaisuutta eri tavoin.

-

Chrome- ja Safari-selaimissa, jos selain ei kykene yhdistämään paikallisverkkoon (LAN) tai reitittimeen, se on erillissovellus; kaikki muut tilat palauttavat arvon true. Joten samalla kun voit otaksua, että selain on erillissovelluksena, kun sa palauttaa arvon false, et voi olettaa, että pääset internettiin, kun se palauttaa arvon true. Voisit saada vääriä positiivisia, sellaisissa tapauksissa, kun tietokone käyttää virtuaalisointiohjelmistoa, jolla on virtuaalisia ethernet-adaptereja, jotka ovat aina "yhdistettynä". Jos haluat todella määrittää selaimen verkkotilan, niin sinun olisi sikis kehitettävä muita keinoja tarkistamiseen. Lisäoppia varten katso HTML5 Rocks article, Working Off the Grid.

-

Firefox- ja Internet Explorer-selaimissa selaimen kytkeminen offline-tilaan lähettää arvon false. Kaikki muut tilat palauttavat arvon true.

-

Voit nähdä verkkotilan muutokset kuuntelemalla tapahtumia kohteissa window.onOnline ja window.onOffline.

-

Syntaksi

-
online = window.navigator.onLine;
-
-

online on boolean-arvo true tai false.

-

Esimerkki

-

Katso live-esimerkki.

-

Sen tarkistamiseksi, että oletko verkossa, kysele window.navigator.onLine, kuten seuraavassa esimerkissä:

-
if (navigator.onLine) {
-  alert('online')
-} else {
-  alert('offline');
-}
-

Verkkotila-arvojen muutosten näkemiseksi kuuntele (käyttäen addEventListener) tapatumia kohteessa window.onOnline ja window.onOffline, kuten seuraavassa esimerkissä:

-
window.addEventListener("offline", function(e) {alert("offline");})
-
-window.addEventListener("online", function(e) {alert("online");})
-
-

Selainyhteensopivuus

-

{{CompatibilityTable}}

-
- - - - - - - - - - - - - - - - - - - -
OminaisuusChrome**Firefox (Gecko)*Internet ExplorerOpera*Safari (WebKit)
Perustuki -

Windows: 11
- Mac: 14
- Chrome OS: 13
- Linux: Palauttaa aina arvon true

-

Historiaa varten katso crbug.com/7469

-
-

{{CompatNo}}
- {{bug("336359")}}
- {{bug("426932")}}
- {{bug("620472")}}

-

{{bug("654579")}}

-
8***{{CompatNo}}5.0.4
-
-
- - - - - - - - - - - - - - - - - - - -
OminaisuusAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
PerustukiAndroid 2.2 (Vika WebView-komponentissa, katso julkaisu 16760){{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
-

* Firefox 4, ja Opera 11.10 palauttaa arvon true, kun "Work Offline"-tila on pois käytöstä ja false, kun se on käytössä riippumatta todellisesta yhteydestä.

-

** Chrome-selaimen aiemmat versiot palattavat virheellisesti true kun selain ensin avataa, mutta se alkaa ilmoittaa oiken yhteysarvon ensimmäisen verkkotapahtuman jälkeen.

-

*** Selaimessa IE 8 "online"- ja "ofline"-tapahtumat nostettiin kohteessa document.body, selaimessa IE 9 - sekä kohteessa document.body että kohteessa window

-

Kommentit

-

Katso yksityiskohtaisempaa kuvausta tästä ominaisuudesta asiakirjasta Online/Offline Events‎ samoin kuin uusista offline-kohtaisista ominaisuuksista, jotka esiteltiin selaimessa Firefox 3.

-

Spesifikaatio

-

Kuvattu asiakirjassa HTML 5 Working draft

-

Katso myös

- diff --git a/files/fi/web/api/navigatorplugins/mimetypes/index.html b/files/fi/web/api/navigatorplugins/mimetypes/index.html deleted file mode 100644 index d5db235e4b..0000000000 --- a/files/fi/web/api/navigatorplugins/mimetypes/index.html +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: window.navigator.mimeTypes -slug: Web/API/NavigatorPlugins/mimeTypes -translation_of: Web/API/NavigatorPlugins/mimeTypes -original_slug: DOM/window.navigator.mimeTypes ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Palauttaa MimeTypeArray-objektin, joka sisältää MimeType-objektien luettelon, joka edustaa selaimen tunnistamia MIME-tyyppejä.

-

Syntaksi

-
mimeTypes = navigator.mimeTypes;
-
-

mimeTypes on MimeTypeArray-objekti, jolla on length-ominaisuus samoin kuin metodit item(index) ja namedItem(name).

-

Esimerkki

-
  alert(window.navigator.mimeTypes.item(0).description); // alerts "Mozilla Default Plug-in"
-
-

Kommentit

-

Nollanella elementillä mimeTypes-määrittelyssä ("Mozilla Default Plug-in" MimeType object) on *-ominaisuus type eikä tyypilinen MIME-muoto kuten "image/x-macpaint"

-

Spesifikaatio

-

{{ DOM0() }}

-
-  
-

{{ languages( { "ja": "ja/DOM/window.navigator.mimeTypes", "pl": "pl/DOM/window.navigator.mimeTypes" } ) }}

diff --git a/files/fi/web/api/navigatorplugins/plugins/index.html b/files/fi/web/api/navigatorplugins/plugins/index.html deleted file mode 100644 index 7a9f7bb0cc..0000000000 --- a/files/fi/web/api/navigatorplugins/plugins/index.html +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: window.navigator.plugins -slug: Web/API/NavigatorPlugins/plugins -translation_of: Web/API/NavigatorPlugins/plugins -original_slug: DOM/window.navigator.plugins ---- -

{{ ApiRef() }}

-

Yhteenveto

-

Palauttaa {{ domxref("PluginArray") }} -objektin, joka luettelee sovellukseen asennetut lisäosat.

-

Syntaksi

-
plugins = navigator.plugins;
-
-

plugins on PluginArray, sisältäen {{ domxref("Plugin") }} -objektit asennetuille lisäosille.

-

Palautettu arvo ei ole JavaScript-taulukko, vaan siinä on length-ominaisuus ja se tukee yksittäisten alkoiden lukemista käyttäen hakasulkuesitysmuotoa (plugins{{ mediawiki.external(2) }}), samoin kuin item(index)- ja namedItem("name")-metodien kautta.

-

Esimerkki

-

Seuraava esimerkki tulostaa tietoa asennetuista lisäosista ylemmän tason asiakirjaan. Huomaa Plugin-objektissa saatavilla olevat ominaisuudet: name, filename, description, ja version.

-

{{ gecko_minversion_note("1.9.2", "Ominaisuus version lisättiin selaimeen Gecko 1.9.2.") }}

-
<script type="text/javascript">
-   var L = navigator.plugins.length;
-   document.write(L.toString().bold() + " Plugin(s)".bold());
-   document.write("<br>");
-   document.write("Name | Filename | description".bold());
-   document.write("<br>");
-   for(var i=0; i<L; i++) {
-     document.write(navigator.plugins[i].name);
-     document.write(" | ");
-     document.write(navigator.plugins[i].filename);
-     document.write(" | ");
-     document.write(navigator.plugins[i].description);
-     document.write(" | ");
-     document.write(navigator.plugins[i].version);
-     document.write("<br>");
-   }
-</script>
-
-

Kommentit

-

Objekti {{ domxref("Plugin") }} paljastaa pienen käyttöliittymän, josta saa tietoa selaimeesi asennetuista eri lisäosista. Lisäosien luettelo on saatavissa myös kirjoittamalla about:plugins selaimen sijaintipalkkiin.

-

Spesifikaatio

-

{{ DOM0() }}

-

{{ languages( { "ja": "ja/DOM/window.navigator.plugins","zh-cn": "zh-cn/DOM/window.navigator.plugins", "pl": "pl/DOM/window.navigator.plugins" } ) }}

diff --git a/files/fi/web/api/webgl_api/index.html b/files/fi/web/api/webgl_api/index.html deleted file mode 100644 index e7153d4db5..0000000000 --- a/files/fi/web/api/webgl_api/index.html +++ /dev/null @@ -1,229 +0,0 @@ ---- -title: WebGL -slug: Web/API/WebGL_API -tags: - - WebGL -translation_of: Web/API/WebGL_API ---- -
{{WebGLSidebar}}
- -

WebGL tuo 3D-grafiikan Webbin esittelemällä sovellusohjelmointirajapinnan (API), joka on läheisesti yhteensovpiva HTML5 canvas-elementissä käytetttävän OpenGL ES 2.0 -määrittelyn kanssa. Tuki WebGL:lle on nykyisin Firefox 4+ -selaimissa, Google Chrome 9+ -selaimissa, Opera 12+ -selaimissa ja Safari 5.1+ -selaimissa.

- -
-
-

Kehitysaiheita

- -
-
Kuinka aloittaa WebGL-asennus
-
Kuinka asettaa WebGL-ympäristö.
-
Lisätään 2D-sisältöä WebGL-ympäristöön
-
Kuinka renderoidaan yksinkertaisia litteitä muotoja WebGL:tä käyttäen.
-
Varjostimien käyttäminen värien toteuttamisessa WebGL:ssä
-
Esittelee, kuinka lisätä väri varjoja käyttäviin muotoihin.
-
Objektien animointi WebGL:ssä
-
Näyttää kuin kiertää ja muuntaa objekteja yksinkertaisten animaatioiden luomiseksi.
-
3D-objektien luominen käyttäen WebGL:ää
-
Näyttää, kuinka luoda ja animoida 3D-objekti (tässä tapauskessa kuutio).
-
Using textures in WebGL
-
Demonstrates how to map textures onto the faces of an object.
-
Lighting in WebGL
-
How to simulate lighting effects in your WebGL context.
-
Animating textures in WebGL
-
Shows how to animate textures; in this case, by mapping an Ogg video onto the faces of a rotating cube.
-
Parhaimmat WebGL-käytännöt
-
Vihjeitä ja suosituksia WebGL-sisällön luomiseksi.
-
Cross-domain textures
-
Information about loading textures from domains other than the one from which your content was loaded.
-
Using extensions
-
How to use extensions that are available in WebGL.
-
-
- -
- - -
-
WebGL-spesifikaatio
-
WebGL-spesifikaatio.
-
Khronos WebGL site
-
The main web site for WebGL at the Khronos Group.
-
Learning WebGL
-
A site with tutorials on how to use WebGL.
-
The WebGL Cookbook
-
A web site with handy recipes for writing WebGL code.
-
Planet WebGL
-
A feed aggregator for people involved in the WebGL community.
-
ewgl-matrices
-
A blazing fast matrix library for WebGL
-
glMatrix
-
JavaScript Matrix and Vector library for High Performance WebGL apps
-
mjs
-
A JavaScript vector and matrix math library, optimized for WebGL usage.
-
Sylvester
-
An open source library for manipulating vectors and matrices. Not optimized for WebGL but extremely robust.
-
WebGL playground
-
An online tool for creating and sharing WebGL projects. Good for quick prototyping and experimenting.
-
-
-
- -

Browser compatibility

- -

{{CompatibilityTable()}}

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureFirefox (Gecko)ChromeInternet ExplorerOperaSafari
Basic support{{CompatGeckoDesktop("2.0")}}9{{CompatNo()}}125.1
Context nameexperimental-webglexperimental-webgln/aexperimental-webglexperimental-webgl
OES_texture_float{{CompatGeckoDesktop("6.0")}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
OES_standard_derivatives{{CompatGeckoDesktop("10.0")}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
EXT_texture_filter_anisotropic{{CompatGeckoDesktop("13.0")}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
WEBGL_compressed_texture_s3tc{{CompatGeckoDesktop("15.0")}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
drawingBufferWidth and drawingBufferHeight attributes{{CompatGeckoDesktop("9.0")}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureFirefox Mobile (Gecko)AndroidIE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
Context name{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
OES_texture_float{{CompatGeckoMobile("6.0")}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
OES_standard_derivatives{{CompatGeckoMobile("10.0")}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
EXT_texture_filter_anisotropic{{CompatGeckoMobile("13.0")}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
WEBGL_compressed_texture_s3tc{{CompatGeckoMobile("15.0")}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
drawingBufferWidth and drawingBufferHeight attributes{{CompatGeckoMobile("9.0")}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}{{CompatUnknown()}}
-
- -

Gecko notes

- -

WebGL debugging and testing

- -

Starting with Gecko 10.0 {{geckoRelease("10.0")}}, there are two preferences available which let you control the capabilities of WebGL for testing purposes:

- -
-
webgl.min_capability_mode
-
A Boolean property that, when true, enables a minimum capability mode. When in this mode, WebGL is configured to only support the bare minimum feature set and capabilities required by the WebGL specification. This lets you ensure that your WebGL code will work on any device or browser, regardless of their capabilities. This is false by default.
-
webgl.disable_extensions
-
A Boolean property that, when true, disables all WebGL extensions. This is false by default.
-
- -
{{HTML5ArticleTOC()}}
diff --git a/files/fi/web/api/webvr_api/index.html b/files/fi/web/api/webvr_api/index.html deleted file mode 100644 index e3b73598f2..0000000000 --- a/files/fi/web/api/webvr_api/index.html +++ /dev/null @@ -1,250 +0,0 @@ ---- -title: WebVR API -slug: Web/API/WebVR_API -tags: - - API - - Experimental - - Expérimental(2) - - Landing - - NeedsTranslation - - Reference - - Référence(2) - - TopicStub - - VR - - Virtual Reality - - WebVR -translation_of: Web/API/WebVR_API ---- -

{{SeeCompatTable}}{{APIRef("WebVR API")}}

- -

WebVR -rajapinta tarjoaa tuen VR-laitteiden — kuten Oculus Rift tai HTC Vive -silmikoiden — käyttämiseen webbisovelluksille, jolloin kehittäjät voivat muuttaa silmikolta saadun sijainti- ja liiketiedon 3D-skenessä liikkumistiedoksi. Tämä mahdollistaa useita kiinnostavia sovellusmahdollisuuksia aina virtuaalisista tuote-esittelyistä ja interaktiivisista treenisovelluksista immersiivisiin FPS-räiskintäpeleihin.

- -

Perusperiaatteet ja käyttö

- -

Metodi {{domxref("Navigator.getVRDisplays()")}} hakee kaikki tietokoneeseen liitetyt VR-laitteet; jokaista näistä vastaa {{domxref("VRDisplay")}} -tyyppinen objekti.

- -

Sketch of a person in a chair with wearing goggles labelled "Head mounted display (HMD)" facing a monitor with a webcam labelled "Position sensor"

- -

{{domxref("VRDisplay")}} on perusrajapinta WebVR API:in — sen ominaisuuksien ja metodien avulla voit esimerkiksi:

- - - -

Tyypillinen (yksinkertainen) WebVR-sovellus toimisi esimerkiksi näin:

- -
    -
  1. {{domxref("Navigator.getVRDisplays()")}} -metodilla haetaan viittaus VR-näyttöön.
  2. -
  3. {{domxref("VRDisplay.requestPresent()")}} -metodilla käynnistetään näyttäminen.
  4. -
  5. WebVR:n omalla versiolla {{domxref("VRDisplay.requestAnimationFrame()")}} -methodista suoritetaan sovelluksen renderöintisilmukkaa näytölle sopivalla virkistystaajuudella.
  6. -
  7. Renderöintisilmukassa haetaan ruudun näyttämiseen tarvittavat tiedot ({{domxref("VRDisplay.getFrameData()")}}) -metodilla, piirretään näytettävä skene kaksi kertaa — siis kerran molemmille silmille, ja sen jälkeen toimitetaan renderöity näkymä näytölle käyttäjälle näytettäväksi metodilla ({{domxref("VRDisplay.submitFrame()")}}).
  8. -
- -

Tämän lisäksi WebVR 1.1 lisää useita tapahtumia (event) {{domxref("Window")}} -objektiin, jolloin JavaScriptillä voidaan reagoida näytön tilan muutoksiin.

- -

Huom: APIn toiminnasta löytyy paljon lisätietoa artikkeleista Using the WebVR API ja WebVR Concepts.

- -

Ohjaimien käyttö: WebVR:n yhdistäminen Gamepad API:in

- -

Useissa WebVR-laitekokoonpanoissa silmikon mukana on käytettävissä erillinen ohjain. Ohjaimia voidaan käyttää WebVR-sovelluksissa Gamepad API:n kautta, ja erityisesti Gamepad Extensions API:n, joka lisää mukaan ohjaimen asentotiedon (controller pose), tuntoperusteiset laitteet (haptic actuators) ja muita vastaavia.

- -

Huom: Artikkeli Using VR controllers with WebVR selittää perusteet VR-ohjaimien käytöstä WebVR-sovelluksissa.

- -

WebVR rajapinnat

- -
-
{{domxref("VRDisplay")}}
-
Edustaa mitä tahnsa APIn tukemaa VR-laitetta. Siinä on mukana yleistiedot laittesta, kuten laitteen tunnisteet (ID) ja kuvaukset sekä metodit VR-skenen esittämisen käynnistämiseen, silmäparametrien ja näytön ominaisuuksien hakemiseen ja muut olennaiset toiminnat.
-
{{domxref("VRDisplayCapabilities")}}
-
Esittää {{domxref("VRDisplay")}}:n ominaisuudet — näillä voidaan testata, saako laitteelta esimerkiksi sijaintitietoa.
-
{{domxref("VRDisplayEvent")}}
-
Edustaa WebVR-kohtaisen tapahtuman tapahtumaobjektia (kts. {{anch("Window", "window object extensions")}} alempana).
-
{{domxref("VRFrameData")}}
-
Vastaa kaikkea tietoa, mitä yksittäisen VR-skenen ruudun renderöintiin tarvitaan; metodi {{domxref("VRDisplay.getFrameData()")}} hakee nämä tiedot.
-
{{domxref("VRPose")}}
-
Edustaa tietyllä ajanhetkellä vallitsevaa sijaintitietoa (johon kuuluvat suunta, sijainti, nopeus ja kiihtyvyys.)
-
{{domxref("VREyeParameters")}}
-
Tarjoaa pääsyn kaikkeen tietoon, joka tarvitaan skenen renderöintiin oikein kullekin silmälle, esimerkiksi näkökentän laajuuden.
-
{{domxref("VRFieldOfView")}}
-
Näkökenttätieto, joka on määritelty keskipisteestä katsottuna neljällä asteluvulla.
-
{{domxref("VRLayerInit")}}
-
Tämä on {{domxref("VRDisplay")}}-näytöllä esitettävä kuvan eräs taso (layer).
-
{{domxref("VRStageParameters")}}
-
Huoneskaalaa tukevien laitteiden kanssa käytettävissä sovelluksissa "näyttämöalueen" tiedot löytyvät tästä.
-
- -

Laajennukset muihin rajapintoihin

- -

WebVR API laajentaa joitakin API-rajapintoja lisäten seuraavat ominaisuudet.

- -

Gamepad

- -
-
{{domxref("Gamepad.displayId")}} {{readonlyInline}}
-
Palauttaa liitetyn {{domxref("VRDisplay")}} tunnisteen {{domxref("VRDisplay.displayId")}} — VRDisplay , jonka skeneä gamepad ohjaa.
-
- - - -
-
{{domxref("Navigator.activeVRDisplays")}} {{readonlyInline}}
-
Palauttaa taulukon, jossa on mukana jokainen {{domxref("VRDisplay")}}, joka esittää parhaillaan ({{domxref("VRDisplay.ispresenting")}} on true).
-
{{domxref("Navigator.getVRDisplays()")}}
-
Palauttaa promise-objektin, joka sisältää taulukon {{domxref("VRDisplay")}} objekteja, jotka vastaavat kaikkia tietokoneeseen liitettyjä VR-näyttöjä.
-
- -

Window-tapahtumat

- -
-
{{domxref("Window.onvrdisplaypresentchange")}}
-
Edustaa tapahtumankäsittelijää (event handler), joka suoritetaan, kun VR_näytön esittämistila muuttuu — esimerkiksi tilasta 'esittää' tilaan 'ei esitä' tai päinvastoin (kun tapahtuma {{event("vrdisplaypresentchange")}} signaloidaan).
-
{{domxref("Window.onvrdisplayconnect")}}
-
Tämä tapahtumankäsittelijä suoritetaan, kun yhteensopiva VR-näyttö on kytketty tietokoneeseen (tapahtuma {{event("vrdisplayconnect")}} ).
-
{{domxref("Window.onvrdisplaydisconnect")}}
-
Tämä tapahtumankäsittelijä suoritetaan, kun yhteensopiva VR-näyttö irrotetaan tietokoneesta (kun tapahtuma {{event("vrdisplaydisconnect")}} signaloidaan).
-
{{domxref("Window.onvrdisplayactivate")}}
-
Edustaa taphtumaa, joka suoritetaan, kun näyttö on valmis esittämään sisältöä (tapahtuma {{event("vrdisplayactivate")}} ),esimerkiksi kun silmikko aktivoituu virransäästötilasta tai puetaan päälle.
-
{{domxref("Window.onvrdisplaydeactivate")}}
-
Tämä tapahtumankäsittelijä suoritetaan, kun näytölle ei voi enää esittää sisältöä (kun tapahtuma {{event("vrdisplaydeactivate")}} signaloidaan), esimerkiksi syystä, että silmikkonäyttö on siirtynyt virransäästötilaan käyttämättömyyden vuoksi.
-
- -

Window:n tapahtumat, jotka eivät ole käytettävissä

- -

Seuraavat tapahtumat löytyvät APIn määrittelystä, mutta niiden toteutusta ei tunnu vielä löytyvän mistään selaimista.

- -
-
{{domxref("Window.onvrdisplayblur")}}
-
Edustaa tapahtumankäsittelijää, joka suoritetaan kun selain, käyttöjärjestelmä tai VR-laitteisto on keskeyttänyt esittämisen näytölle jostain syystä (tapahtuman {{event("vrdisplayblur")}} johdosta) — esimerkiksi käytettäessä järjestelmän valikkoa tai selainta. Tarkoitus on estää seurantaa tai VR-kokemuksen menetystä.
-
{{domxref("Window.onvrdisplayfocus")}}
-
Tämä tapahtumankäsittelijä suoritetaan, kun esittäminen näytöllä palautuu edellisen tapahtuman jälkeen (tapahtumasta {{event("vrdisplayfocus")}} ).
-
- -

Esimerkkejä

- -

Näiltä sivustoilta töydät useita esimerkkejä:

- - - -

Spesifikaatiot

- - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName("GamepadExtensions")}}{{Spec2("GamepadExtensions")}}Määrittää Experimental Gamepad extensions.
{{SpecName('WebVR 1.1')}}{{Spec2('WebVR 1.1')}}Alkuperäinen
- -

Selainyhteensopivuus

- -

{{CompatibilityTable}}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OminaisuusChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Perus{{CompatNo}}[1]{{CompatVersionUnknown}}{{CompatGeckoDesktop(55)}}[2]{{CompatNo}}{{CompatNo}}{{CompatNo}}
Gamepad -laajennukset{{CompatNo}}{{CompatNo}}{{CompatNo}}[4]{{CompatNo}}{{CompatNo}}{{CompatNo}}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari MobileChrome for AndroidSamsung Internet for GearVR
Basic support{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatVersionUnknown}}[3]{{CompatVersionUnknown}}
-  
Gamepad extensions{{CompatNo}}{{CompatNo}}{{CompatNo}}[4]{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
- -

[1] API käytettävissä (Available) kaikilla alustoilla lipulla, mutta tällä hetkellä toimii ainoastaan kokeellisessa työpöytäversiossa (experimental version of Chrome) (muut versiot eivät palauta yhtään laitetta metodia {{domxref("Navigator.getVRDisplays()")}} kutsuttaessa).

- -

[2] Tällä hetkellä ainoastaan Windows ja Mac OSX tuki on oletuksena päällä.

- -

[3] Nyt ainoastaan laitteella Google Daydream.

- -

[4] Päällä Firefox Nightly ja Beta -versioissa 55 ja uudempi. Käytetään valinnalla dom.gamepad-extensions.enabled.

- -

Katso myös

- - diff --git a/files/fi/web/api/webvr_api/using_the_webvr_api/index.html b/files/fi/web/api/webvr_api/using_the_webvr_api/index.html deleted file mode 100644 index b4cf17e315..0000000000 --- a/files/fi/web/api/webvr_api/using_the_webvr_api/index.html +++ /dev/null @@ -1,438 +0,0 @@ ---- -title: Using the WebVR API -slug: Web/API/WebVR_API/Using_the_WebVR_API -translation_of: Web/API/WebVR_API/Using_the_WebVR_API ---- -
{{APIRef("WebVR API")}}
- -

WebVR API on hieno lisä webkehittäjän työkaluihin. Sen avulla WebGL- näkymä (scene) voidaan esittää Oculus Riftin and HTC Viven tapaisissa VR-näytöissä. Mutta miten pääset alkuun VR appsien tekemiseen webbiin? Tämä juttu opastaa sinut perusteisiin.

- -
-

Huom: WebVR APIn vakain versio — 1.1 — on vasta implementoitu Firefox 55:een (Windowsin release-versio, Mac OS X :ssa vain 'Nightly'), ja sen saa myös Chrome:en käytettäessä Google Daydream -laitteistoa. Speksistä on myös tuoreempi versio — 2.0 — mutta se on kovin keskeneräinen. Lisätietoja viimeisimmästä speksistä löytyy linkistä WebVR Spec Version List.

-
- -

Aloitus

- -

Päästäksesi alkuun tarvitset:

- - - -

Kun laitteisto ja ohjelmistot on asennettu, voit testata, toimiiko kokoonpanosi WebVR:n kanssa tästä linkistä - simple A-Frame demo, ja näet, saadaanko näkymä näkyviin ja pääsetkö VR-moodiin oikean alareunan painikkeella.

- -

A-Frame on paras vaihtoehto päästä tekemään nopeasti WebVR-yhteensopivia 3D-näkymiä, ilman että tarvitsee ymmärtää rivikaupalla uutta JavaScript -koodia. Se ei kuitenkaan opeta, kuinka raaka WebVR API toimii ja siihen paneudummekin seuraavaksi.

- -

Demon esittely

- -

WebVR API :n toiminnan esdittelemiseksi tutustumme puhtaasti webgl:ää sisältävään esimerkkiimme, joka näyttää vähän tältä:

- -

- -
-

Huom: Demon lähdekoodi - source code - löytyy GitHubista ja livelinkki siihen on tässä: view it live.

-
- -
-

Huom: Ellei WebVR ei ala toimia selaimessa, varmista, että sitä ajetaan grafiikkakortin kautta. Esimerkiksi NVIDIA :lla sen omassa ohjauspaneelissa on pikavalikkovalinta Firefox, josta valitaan Run with graphics processor > High-performance NVIDIA processor.

-
- -

Demossa on kaikkien WebGL-demojen äiti — pyörivä  3D-kuutio. Toteutimme sen puhtaasti WebGL API :n koodilla. Tässä ei käsitellä perus JavaScriptiä tai WebGL:ää, vaan pelkästään WebVR osia.

- -

Demosta löytyy myös:

- - - -

Kun tutustut lähdekoodin päätiedostoon - main JavaScript file - löydät WebVR-osat koodista kommenttien "WebVR" tekstien avulla.

- -
-

Huom: JavaScriptin ja WebGL:n perusteista lisätietoja löytyy tutoriaaleista JavaScript learning material ja WebGL Tutorial.

-
- -

Miten se toimii?

- -

Tässä vaiheessa katsotaan koodin WebVR-osien toiminta.

- -

Tyypillinen (yksinkertainen) WebVR sovellus toimii näin:

- -
    -
  1. {{domxref("Navigator.getVRDisplays()")}} hakee viittauksen VR-näyttöösi.
  2. -
  3. {{domxref("VRDisplay.requestPresent()")}} :ä käytetään käynnistämään esittäminen VR-näytölle.
  4. -
  5. WebVR:n omaa {{domxref("VRDisplay.requestAnimationFrame()")}} -metodia käytetään suorittamaan sovelluksen renderöintisilmukkaa näytölle sopivalla virkistystaajuudella.
  6. -
  7. Renderöintisilmukassa haet ruudun näyttämiseen vaaditun datan ({{domxref("VRDisplay.getFrameData()")}}), piirrät näytettävän skenen kahdesti — molemmille silmille — ja toimitat renderöidyn näkymän näytölle käyttäjälle näytettäväksi metodilla ({{domxref("VRDisplay.submitFrame()")}}).
  8. -
- -

Alla olevissa kappaleissa tutustutaan webgl-demoihimme yksityiskohtaisemmin ja nähdään tarkemmin, missä edellä mainittuja ominaisuuksia käytetään.

- -

Aloitetaan muuttujilla

- -

Ensimmäinen esimerkki WebVR:n käytöstä näkyy alla olevassa koodissa:

- -
// WebVR variables
-
-var frameData = new VRFrameData();
-var vrDisplay;
-var btn = document.querySelector('.stop-start');
-var normalSceneFrame;
-var vrSceneFrame;
-
-var poseStatsBtn = document.querySelector('.pose-stats');
-var poseStatsSection = document.querySelector('section');
-poseStatsSection.style.visibility = 'hidden'; // hide it initially
-
-var posStats = document.querySelector('.pos');
-var orientStats = document.querySelector('.orient');
-var linVelStats = document.querySelector('.lin-vel');
-var linAccStats = document.querySelector('.lin-acc');
-var angVelStats = document.querySelector('.ang-vel');
-var angAccStats = document.querySelector('.ang-acc');
-var poseStatsDisplayed = false;
- -

Lyhyet selitykset ovat siis tarpeen:

- - - -

VR-näytön hakeminen

- -

Koodimme tärkeimpiä metodeja on start() — tämä suoritetaan, kun sivun body-osa on ladattu valmiiksi:

- -
// start
-//
-// Called when the body has loaded is created to get the ball rolling.
-
-document.body.onload = start;
- -

Aluksistart() hakee webbisivumme - our HTML - {{htmlelement("canvas")}} -osaan renderöitävään 3D-grafiikkaan tarvitun WebGL -ympäristön. Sitten tarkistetaan, että gl -ympäristö on käytettävissä — jos on, suoritetaan muutama metodi näytettävän skenen alustamiseksi.

- -
function start() {
-  canvas = document.getElementById("glcanvas");
-
-  initWebGL(canvas);      // Initialize the GL context
-
-  // WebGL setup code here
- -

Seuraavaksi aloitetaan varsinainen näyttöprosessi. Siinä asetetaan canvas-elementti näyttämään selaimen koko näytettävä ala ja suorittamalla renderöintisilmukka(drawScene()) ensimmäisen kerran. Tässä siis ei-WebVR osuus— se normaali renderöintisilmukka.

- -
    // draw the scene normally, without WebVR - for those who don't have it and want to see the scene in their browser
-
-    canvas.width = window.innerWidth;
-    canvas.height = window.innerHeight;
-    drawScene();
- -

Seuraavaksi tulee sitten ensimmäinen pala WebVR-koodia. Aluksi tarkistetaan, onko VR-näyttöjä edes käytettävissä {{domxref("Navigator.getVRDisplays")}}  — tästä alkaa API:n käyttö ja tämä on hyvä paikka WebVR:n ominaisuuksien tarkistamiseen. Koodilohkon lopussa (else -osassa) näkyy, että ellei sopivia näyttöjä ole, näytetään viesti, ettei selain tue WebVR 1.1 :ää.

- -
    // WebVR: Check to see if WebVR is supported
-    if(navigator.getVRDisplays) {
-      console.log('WebVR 1.1 supported');
- -

if() { ... } koodilohkossa suoritetaan {{domxref("Navigator.getVRDisplays()")}} metodi. Tämä palauttaa promise-olion, jonka sisältönä on lista tietokoneeseen kytketyistä VR-näytöistä. Se on tyhjä, ellei näyttöjä ole..

- -
      // Then get the displays attached to the computer
-      navigator.getVRDisplays().then(function(displays) {
- -

Promise-olion then() -lohkossa tarkistetaan, että listan pituus on suurempi kuin 0; näin ollessa asetetaan vrDisplay -muuttujamme arvoksi listan ensimmäisen -indeksistä 0 löytyvän - alkion arvo. vrDisplay sisältää nyt {{domxref("VRDisplay")}} olion, joka vastaa laitteeseen liitettyä näyttöä!

- -
        // If a display is available, use it to present the scene
-        if(displays.length > 0) {
-          vrDisplay = displays[0];
-          console.log('Display found');
- -
-

Huom: On epätavallista, että tietokoneeseen olisi kytketty useita VR-näyttöjä, joten tätä yksinkertaista demoa varten usean näytön vaihtoehtoa ei huomioida.

-
- -

VR-esityksen käynnistys ja pysäytys

- -

Nyt kun käytössä on {{domxref("VRDisplay")}} olio, sen avulla voidaan tehdä useita juttuja. Seuraavaksi haluamme käynnistää toiminnot WebGL-sisällön näyttämisen aloittamiseksi ja lopettamiseksi.

- -

Jatkaaksemme edellisestä koodilohkosta, lisäämme käynnistys/pysäytys -painikkeeseemme (btn) tapahtumankuuntelijan (event listener) — ja painiketta klikattaessa halutaan tarkistaa, joko esitys näytölle on käynnissä (toteutus tälle on hieman kökkö ja perustuu painikkeen tekstin, textContent, tutkimiseen).

- -

Ellei esitys näyttöön ole vielä käynnissä, käytetään {{domxref("VRDisplay.requestPresent()")}} -metodia pyytämään selainta käynnistämään esitys näytölle. Parametrinä metodille annetaan lista {{domxref("VRLayerInit")}} olioita, jotka vastaavat näytettäväksi haluttuja näyttötasoja.

- -

Koska tällä hetkellä on mahdollista esittää vain yksi näyttötaso, ja ainoa vaadittu olion jäsen on {{domxref("VRLayerInit.source")}} -ominaisuus (joka viittaa tuossa näyttötasossa näytettäväksi tarkoitettuun {{htmlelement("canvas")}} :iin; annetaan muille parametreille järkevät oletusarvot — kts. {{domxref("VRLayerInit.leftBounds", "leftBounds")}} ja {{domxref("VRLayerInit.rightBounds", "rightBounds")}})), parametri on yksinkertaisesti [{ source: canvas }].

- -

requestPresent() palauttaa promise-olion, joka saa sisällön, kun esittäminen käynnistyy onnistuneesti.

- -
          // Starting the presentation when the button is clicked: It can only be called in response to a user gesture
-          btn.addEventListener('click', function() {
-            if(btn.textContent === 'Start VR display') {
-              vrDisplay.requestPresent([{ source: canvas }]).then(function() {
-                console.log('Presenting to WebVR display');
- -

Nyt kun esittämispyyntö oli ok, halutaan seuraavaksi asettaa renderöintisisältö esitettäväksi VR-näytölle. Aivan ensimmäiseksi asetetaan canvas samankokoiseksi VR-näytön näyttöalueen kanssa. Tämä onnistuu hakemalla {{domxref("VREyeParameters")}} molemmille silmille käyttäen metodia {{domxref("VRDisplay.getEyeParameters()")}}.

- -

Sen jälkeen lasketaan yksinkertaisesti VR-näytön kokonaisala silmän ominaisuuksien {{domxref("VREyeParameters.renderWidth")}} ja {{domxref("VREyeParameters.renderHeight")}} avulla.

- -
                // Set the canvas size to the size of the vrDisplay viewport
-
-                var leftEye = vrDisplay.getEyeParameters('left');
-                var rightEye = vrDisplay.getEyeParameters('right');
-
-                canvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;
-                canvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);
- -

Seuraavaksi pysäytetään renderöintisilmukka {{domxref("Window.cancelAnimationFrame()", "cancel the animation loop")}}, joka aiemmin käynnistyi {{domxref("Window.requestAnimationFrame()")}} kutsulla drawScene() -metodista ja sen sijaan kutsutaandrawVRScene():ä. Tämä metodi renderöi saman skenen kuin aiempikin käyttäen nyt VR-kohtaisia temppuja. Tämän renderöintisilmukan hallinta on nyt vastaavalla WebVR-versiolla, {{domxref("VRDisplay.requestAnimationFrame")}} -metodilla.

- -
                // stop the normal presentation, and start the vr presentation
-                window.cancelAnimationFrame(normalSceneFrame);
-                drawVRScene();
- -

Lopuksi päivitetään painikkeen teksti, jolloin seuraavalla klikkauskerralla painike tuleekin pysäyttämään esityksen VR-näytöllä.

- -
                btn.textContent = 'Exit VR display';
-              });
- -


- VR-näytöllä esittämisen pysäyttämiseksi painikkeen seuraavalla klikkauksella kutsutaan {{domxref("VRDisplay.exitPresent()")}} -metodia. Painikkeen teksti vaihdetaan taas toiseksi ja requestAnimationFrame -kutsut vaihdetaan taas keskenään. Tästä näkyy, että käytetään metodia {{domxref("VRDisplay.cancelAnimationFrame")}} VR-renderöintisilmukan pysäyttämiseen ja normaalin skenen renderöinti käynnistyy drawScene()-metodilla.

- -
            } else {
-              vrDisplay.exitPresent();
-              console.log('Stopped presenting to WebVR display');
-
-              btn.textContent = 'Start VR display';
-
-              // Stop the VR presentation, and start the normal presentation
-              vrDisplay.cancelAnimationFrame(vrSceneFrame);
-              drawScene();
-            }
-          });
-        }
-      });
-    } else {
-      console.log('WebVR API not supported by this browser.');
-    }
-  }
-}
- -

Kun esittäminen käynnistyy, selaimessa näkyy stereoskooppinen näkymä:

- -

- -

Seuraavasta opitaan, miten stereonäkymä varsinaisesti tehdään.

- -

Miksi WebVR:llä on oma requestAnimationFrame()?

- -

Tämä on hyvä kysymys. Perussyy on sulava renderöinti VR-näytössä, joka saadaan aikaan käyttämällä VR-näytön omaa näytönpäivitysnopeutta eikä tietokoneen. VR-näytön päivitysnopeudet ovat tietokonetta suurempia, yleisesti jopa  90fps. Tämä poikkeaa tietokoneen peruspäivitysnopeudesta.

- -

Huomaa, että kun VR-näytössä ei esitetä, {{domxref("VRDisplay.requestAnimationFrame")}} toimii identtisesti {{domxref("Window.requestAnimationFrame")}}:n kanssa, joten halutessasi voisit käyttää vain yhtä renderöintisilmukkaa tekemämme sovelluksen kahden silmukan sijaan. Sovelluksessa käytetään kahta, koska VR-esityksen ollessa päällä halutaan tehdä hieman eri asioita kuin ilman sitä, ja nämä halutaan selkeyden vuoksi erottaa.

- -

Renderöinti ja näyttäminen

- -

Tässä vaiheessa on nähty kaikki koodi, mikä tarvitaan VR-laitteiston hakemiseen, skenen näyttöpyynnön lähettämiseen ja renderöintisilmukan käynnistämiseen. Seuraavaksi kurkataan renderöintisilmukan sisälle ja selitetään, miten sen WebVR-spesifiset osat toimivat.

- -

Aluksi tarkastellaan renderöintisilmukkametodin  — drawVRScene() määrittelyä. Ensimmäinen tehtävä on kutsua {{domxref("VRDisplay.requestAnimationFrame()")}} -metodia silmukan toiston jatkamiseksi ensimmäisen kutsukerran jälkeen (tämä tehtiin aiemmin koodissa, kun VR-näytölle esittäminen aloitettiin). Tämä metodikutsu asetetaan globaalin vrSceneFrame -muuttujan arvoksi, jotta silmukka saadaan keskeytettyä {{domxref("VRDisplay.cancelAnimationFrame()")}} -metodilla, kun VR-esitys loppuu.

- -
function drawVRScene() {
-  // WebVR: Request the next frame of the animation
-  vrSceneFrame = vrDisplay.requestAnimationFrame(drawVRScene);
- -

Seuraavaksi kutsutaan metodia {{domxref("VRDisplay.getFrameData()")}}, joka saa parametriksi muuttujanimen, johon ruudun tiedot halutaan. Tämähän alustettiin jo aiemmin nimellä  frameData. Metodin suorittamisen jälkeen tässä muuttujassa on tarpeelliset tiedot seuraavan ruudun renderöintiin VR -laitteelle pakattuna {{domxref("VRFrameData")}} -olioon. Mukana on tieto projektio- ja näkymämatriiseista, joiden avulla skene saadaan renderöityä oikein vasemmalle ja oikealle silmälle sekä ajantasainen {{domxref("VRPose")}} -olio, jossa on mm. VR-näytön suunta- ja sijaintitiedot.

- -

Tätä tulee kutsua joka ruudun kohdalla, jotta renderöity näkymä olisi ajantasainen.

- -
  // Populate frameData with the data of the next frame to display
-  vrDisplay.getFrameData(frameData);
- -

Seuraavaksi haetaan senhetkinen {{domxref("VRPose")}} ominaisuudesta {{domxref("VRFrameData.pose")}}, tallennetaan sijainti ja suunta myöhempää käyttöä varten ja lähetetään pose-tieto näytettäväksi sivun tilatietoruutuun, siis mikäli poseStatsDisplayed -muuttuja on saanut arvon true.

- -
  // You can get the position, orientation, etc. of the display from the current frame's pose
-
-  var curFramePose = frameData.pose;
-  var curPos = curFramePose.position;
-  var curOrient = curFramePose.orientation;
-  if(poseStatsDisplayed) {
-    displayPoseStats(curFramePose);
-  }
- -

  Seuraavaksi canvas:in sisältö tyhjennetään ennen uuden piirron aloittamista, jotta seuraava ruutu piirrettäisiin puhtaalle pohjalle, eikä aiempi ruutu olisi alla sotkemassa:

- -
  // Clear the canvas before we start drawing on it.
-
-  gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
- -

Nyt renderöidään molempien silmien näkymä. Aluksi tarvitaan projektion ja näkymän sijainti renderöintiä varten. Nämä ovat {{domxref("WebGLUniformLocation")}} -olioita, jotka on luotu {{domxref("WebGLRenderingContext.getUniformLocation()")}} -metodilla käyttäen parametreinä shader-ohjelman tunnusta ja nimitunnistetta.

- -
  // WebVR: Create the required projection and view matrix locations needed
-  // for passing into the uniformMatrix4fv methods below
-
-  var projectionMatrixLocation = gl.getUniformLocation(shaderProgram, "projMatrix");
-  var viewMatrixLocation = gl.getUniformLocation(shaderProgram, "viewMatrix");
- -

Seuraava renderöintivaihe sisältää:

- - - -
  // WebVR: Render the left eye’s view to the left half of the canvas
-  gl.viewport(0, 0, canvas.width * 0.5, canvas.height);
-  gl.uniformMatrix4fv(projectionMatrixLocation, false, frameData.leftProjectionMatrix);
-  gl.uniformMatrix4fv(viewMatrixLocation, false, frameData.leftViewMatrix);
-  drawGeometry();
- -

Ja sama oikealle silmälle:

- -
  // WebVR: Render the right eye’s view to the right half of the canvas
-  gl.viewport(canvas.width * 0.5, 0, canvas.width * 0.5, canvas.height);
-  gl.uniformMatrix4fv(projectionMatrixLocation, false, frameData.rightProjectionMatrix);
-  gl.uniformMatrix4fv(viewMatrixLocation, false, frameData.rightViewMatrix);
-  drawGeometry();
- -

Seuraavaksi määritelläändrawGeometry() funktio. Suurin osa siitä koostuu tavallisesta WebGL -koodista, jolla saadaan piirrettyä 3D-kuutio. WebVR-spesifisiä osia löytyy mvTranslate() jamvRotate() funktiokutsuista — ne välittävät matriisit WebGL-ohjelmalle, joka määrittää sen hetkiselle ruudulle kuution sijainnin ja kierron.

- -

Kuten huomaat, näitä arvoja muokataan {{domxref("VRPose")}} -oliolta saaduilla VR-näytön sijainti- (curPos) ja kiertotiedoilla (curOrient). Sen seurauksena esimerkiksi päätä vasemmalle käännettäessä kuvassa näkyvä kuutio siirtyy aivan odotetustikin oikealle, kun  x-sijaintitieto (curPos[0]) ja y-kiertotieto ([curOrient[1]) lisätään x-translaatioarvoon.

- -

Tämä on 'quick and dirty' -tapa käyttää VR pose-tietoa, mutta se näyttänee kuitenkin perusidean.

- -
  function drawGeometry() {
-    // Establish the perspective with which we want to view the
-    // scene. Our field of view is 45 degrees, with a width/height
-    // ratio of 640:480, and we only want to see objects between 0.1 units
-    // and 100 units away from the camera.
-
-    perspectiveMatrix = makePerspective(45, 640.0/480.0, 0.1, 100.0);
-
-    // Set the drawing position to the "identity" point, which is
-    // the center of the scene.
-
-    loadIdentity();
-
-    // Now move the drawing position a bit to where we want to start
-    // drawing the cube.
-
-    mvTranslate([
-                  0.0 - (curPos[0] * 25) + (curOrient[1] * 25),
-                  5.0 - (curPos[1] * 25) - (curOrient[0] * 25),
-                  -15.0 - (curPos[2] * 25)
-               ]);
-
-    // Save the current matrix, then rotate before we draw.
-
-    mvPushMatrix();
-    mvRotate(cubeRotation, [0.25, 0, 0.25 - curOrient[2] * 0.5]);
-
-    // Draw the cube by binding the array buffer to the cube's vertices
-    // array, setting attributes, and pushing it to GL.
-
-    gl.bindBuffer(gl.ARRAY_BUFFER, cubeVerticesBuffer);
-    gl.vertexAttribPointer(vertexPositionAttribute, 3, gl.FLOAT, false, 0, 0);
-
-    // Set the texture coordinates attribute for the vertices.
-
-    gl.bindBuffer(gl.ARRAY_BUFFER, cubeVerticesTextureCoordBuffer);
-    gl.vertexAttribPointer(textureCoordAttribute, 2, gl.FLOAT, false, 0, 0);
-
-    // Specify the texture to map onto the faces.
-
-    gl.activeTexture(gl.TEXTURE0);
-    gl.bindTexture(gl.TEXTURE_2D, cubeTexture);
-    gl.uniform1i(gl.getUniformLocation(shaderProgram, "uSampler"), 0);
-
-    // Draw the cube.
-
-    gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVerticesIndexBuffer);
-    setMatrixUniforms();
-    gl.drawElements(gl.TRIANGLES, 36, gl.UNSIGNED_SHORT, 0);
-
-    // Restore the original matrix
-
-    mvPopMatrix();
-  }
-
- -

Seuraava koodipalanen ei liity mitenkään WebVR:ään — siinä vain kierretään kuutiota joka ruudun osalta:

- -
  // Update the rotation for the next draw, if it's time to do so.
-
-  var currentTime = (new Date).getTime();
-  if (lastCubeUpdateTime) {
-    var delta = currentTime - lastCubeUpdateTime;
-
-    cubeRotation += (30 * delta) / 1000.0;
-  }
-
-  lastCubeUpdateTime = currentTime;
- -

Renderöintisilmukan viimeiseen osaan kuuluu {{domxref("VRDisplay.submitFrame()")}} -metodin kutsuminen — kaikki tarpeellinen on nyt tehty ja näyttö on renderöity {{htmlelement("canvas")}} :iin, tämä metodi sitten toimittaa ruudun VR-näytölle, jolloin se ruutu näkyy myös siinä.

- -
  // WebVR: Indicate that we are ready to present the rendered frame to the VR display
-  vrDisplay.submitFrame();
-}
- -

Pose (sijainti, kierto, ym.) -tiedon näyttäminen

- -

Tässä osassa tutustutaan displayPoseStats() -funktioon, joka näyttää kunkin ruudun päivitetyt pose-tiedot. Kyseinen funktio on melko yksinkertainen.

- -

Aluksi tallennetaan {{domxref("VRPose")}}-oliolta saadut kuusi ominaisuutta omiin muuttujiin — ne ovat tyyppiä {{domxref("Float32Array")}}.

- -
function displayPoseStats(pose) {
-  var pos = pose.position;
-  var orient = pose.orientation;
-  var linVel = pose.linearVelocity;
-  var linAcc = pose.linearAcceleration;
-  var angVel = pose.angularVelocity;
-  var angAcc = pose.angularAcceleration;
- -

Sitten tiedot kirjoitetaan tietolaatikkoon ja päivitetään ne joka ruudun kohdalla. Arvot on pyöristetty toFixed() -metodilla luettavuuden vuoksi.

- -

Huomaa ehtolause lineaarisen ja kulmakiihtyvyyden vektorien arvojen tarkastamisessa - siinä varmistetaan ennen näyttämistä, että arvot on tosiaan saatu luettua. Useimmilta VR-laitteistolta näitä arvoja ei vielä saada, joten ilman tarkistamista seuraisi virhetoiminta (ellei arvoja saada, vektorien arvoksi tulee null).

- -
  posStats.textContent = 'Position: x ' + pos[0].toFixed(3) + ', y ' + pos[1].toFixed(3) + ', z ' + pos[2].toFixed(3);
-  orientStats.textContent = 'Orientation: x ' + orient[0].toFixed(3) + ', y ' + orient[1].toFixed(3) + ', z ' + orient[2].toFixed(3);
-  linVelStats.textContent = 'Linear velocity: x ' + linVel[0].toFixed(3) + ', y ' + linVel[1].toFixed(3) + ', z ' + linVel[2].toFixed(3);
-  angVelStats.textContent = 'Angular velocity: x ' + angVel[0].toFixed(3) + ', y ' + angVel[1].toFixed(3) + ', z ' + angVel[2].toFixed(3);
-
-  if(linAcc) {
-    linAccStats.textContent = 'Linear acceleration: x ' + linAcc[0].toFixed(3) + ', y ' + linAcc[1].toFixed(3) + ', z ' + linAcc[2].toFixed(3);
-  } else {
-    linAccStats.textContent = 'Linear acceleration not reported';
-  }
-
-  if(angAcc) {
-    angAccStats.textContent = 'Angular acceleration: x ' + angAcc[0].toFixed(3) + ', y ' + angAcc[1].toFixed(3) + ', z ' + angAcc[2].toFixed(3);
-  } else {
-    angAccStats.textContent = 'Angular acceleration not reported';
-  }
-}
- -

WebVR -tapahtumat

- -

The WebVR spesifikaatiossa on määritetty useita liipaistavia tapahtumia (event), ja näin koodilla voidaan reagoida VR-näytön tilan muutoksiin (vrt. Window events). Esimerkiksi:

- - - -

Demossa on seuraava esimerkki tapahtumista:

- -
window.addEventListener('vrdisplaypresentchange', function(e) {
-  console.log('Display ' + e.display.displayId + ' presentation has changed. Reason given: ' + e.reason + '.');
-});
- -

Kuten näet {{domxref("VRDisplayEvent", "event object")}} tarjoaa kaksi hyödyllistä ominaisuutta — {{domxref("VRDisplayEvent.display")}}, joka viittaa {{domxref("VRDisplay")}} tapahtuman tuottajaan, ja {{domxref("VRDisplayEvent.reason")}}, jossa on selkokielinen syy tapahtumaan.

- -

Tämä on hyvin käyttökelpoinen tapahtuma; sitä voidaan käyttää huomaan yllättävä näytön irrotus, joka estäää tarpeettomat virheviestit ja kertoo tilanteen käyttäjälle. Googlen Webvr.info -esitysdemossa tapahtumaa käytetään suorittamaan onVRPresentChange() funktio, joka päivittää käyttöliittymän kontrollit tilannetta vastaaviksi ja muuttaa canvasin kokoa.

- -

Yhteenveto

- -

Tässä artikkelissa kerrottiin hyvin yksinkertaisen WebVR 1.1 sovelluksen tekemisestä, jonka avulla pääset alkuun sovellusten kehittämisessä.

diff --git a/files/fi/web/api/window/index.html b/files/fi/web/api/window/index.html deleted file mode 100644 index c9c96d5672..0000000000 --- a/files/fi/web/api/window/index.html +++ /dev/null @@ -1,509 +0,0 @@ ---- -title: Window -slug: Web/API/Window -tags: - - API - - DOM - - Interface - - JavaScript - - NeedsTranslation - - Reference - - Tab - - TopicStub - - Window -translation_of: Web/API/Window ---- -
{{APIRef("DOM")}}
- -

The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window. A window for a given document can be obtained using the {{domxref("document.defaultView")}} property.

- -

A global variable, window, representing the window in which the script is running, is exposed to JavaScript 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 {{Domxref("Window.resizeTo", "resizeTo()")}} and {{Domxref("Window.innerHeight", "innerHeight")}}. Generally, anything that can't reasonably pertain to a tab pertains to the window instead.

- -

{{InheritanceDiagram}}

- -

Properties

- -

This interface inherits properties from the {{domxref("EventTarget")}} interface and implements properties from the {{domxref("WindowOrWorkerGlobalScope")}} and {{domxref("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.

- -
-
{{domxref("Window.closed")}} {{Non-standard_inline}} {{readOnlyInline}}
-
This property indicates whether the current window is closed or not.
-
{{domxref("Window.console")}} {{ReadOnlyInline}}
-
Returns a reference to the console object which provides access to the browser's debugging console.
-
{{domxref("Window.content")}} and Window._content {{Non-standard_inline}} {{obsolete_inline}} {{ReadOnlyInline}}
-
Returns a reference to the content element in the current window. Since Firefox 57 (initially Nightly-only), both versions are only available from chrome (privileged) code, and not available to the web anymore.
-
{{domxref("Window.controllers")}} {{non-standard_inline}} {{ReadOnlyInline}}
-
Returns the XUL controller objects for the current chrome window.
-
{{domxref("Window.customElements")}} {{ReadOnlyInline}}
-
returns a reference to the {{domxref("CustomElementRegistry")}} object, which can be used to register new custom elements and get information about previously registered custom elements.
-
{{domxref("Window.crypto")}} {{readOnlyInline}}
-
Returns the browser crypto object.
-
{{domxref("Window.defaultStatus")}} {{Obsolete_inline("gecko23")}}
-
Gets/sets the status bar text for the given window.
-
{{domxref("Window.devicePixelRatio")}} {{non-standard_inline}} {{ReadOnlyInline}}
-
Returns the ratio between physical pixels and device independent pixels in the current display.
-
{{domxref("Window.dialogArguments")}} {{ReadOnlyInline}}
-
Gets the arguments passed to the window (if it's a dialog box) at the time {{domxref("window.showModalDialog()")}} was called. This is an {{Interface("nsIArray")}}.
-
{{domxref("Window.directories")}} {{obsolete_inline}}
-
Synonym of {{domxref("window.personalbar")}}
-
{{domxref("Window.document")}} {{ReadOnlyInline}}
-
Returns a reference to the document that the window contains.
-
{{domxref("Window.DOMMatrix")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMMatrix")}} object, which represents 4x4 matrices, suitable for 2D and 3D operations.
-
{{domxref("Window.DOMMatrixReadOnly")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMMatrixReadOnly")}} object, which represents 4x4 matrices, suitable for 2D and 3D operations.
-
{{domxref("Window.DOMPoint")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMPoint")}} object, which represents a 2D or 3D point in a coordinate system.
-
{{domxref("Window.DOMPointReadOnly")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMPointReadOnly")}} object, which represents a 2D or 3D point in a coordinate system.
-
{{domxref("Window.DOMQuad")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMQuad")}} object, which provides represents a quadrilaterial object, that is one having four corners and four sides.
-
{{domxref("Window.DOMRect")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMRect")}} object, which represents a rectangle.
-
{{domxref("Window.DOMRectReadOnly")}} {{readOnlyInline}} {{experimental_inline}}
-
Returns a reference to a {{domxref("DOMRectReadOnly")}} object, which represents a rectangle.
-
{{domxref("Window.event")}} {{ReadOnlyInline}}
-
Returns the current event, which is the event currently being handled by the JavaScript code's context, or undefined if no event is currently being handled. The {{domxref("Event")}} object passed directly to event handlers should be used instead whenever possible.
-
{{domxref("Window.frameElement")}} {{readOnlyInline}}
-
Returns the element in which the window is embedded, or null if the window is not embedded.
-
{{domxref("Window.frames")}} {{readOnlyInline}}
-
Returns an array of the subframes in the current window.
-
{{domxref("Window.fullScreen")}} {{gecko_minversion_inline("1.9")}}
-
This property indicates whether the window is displayed in full screen or not.
-
{{domxref("Window.globalStorage")}} {{gecko_minversion_inline("1.8.1")}} {{Non-standard_inline}} {{Obsolete_inline("gecko13")}}
-
Unsupported since Gecko 13 (Firefox 13). Use {{domxref("Window.localStorage")}} instead.
- Was: Multiple storage objects that are used for storing data across multiple pages.
-
{{domxref("Window.history")}} {{ReadOnlyInline}}
-
Returns a reference to the history object.
-
{{domxref("Window.innerHeight")}} {{readOnlyInline}}
-
Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
-
{{domxref("Window.innerWidth")}} {{readOnlyInline}}
-
Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.
-
{{domxref("Window.isSecureContext")}} {{experimental_inline}} {{readOnlyInline}}
-
Indicates whether a context is capable of using features that require secure contexts.
-
{{domxref("Window.length")}} {{readOnlyInline}}
-
Returns the number of frames in the window. See also {{domxref("window.frames")}}.
-
{{domxref("Window.location")}}
-
Gets/sets the location, or current URL, of the window object.
-
{{domxref("Window.locationbar")}} {{ReadOnlyInline}}
-
Returns the locationbar object, whose visibility can be toggled in the window.
-
{{domxref("Window.localStorage")}} {{readOnlyInline}} {{gecko_minversion_inline("1.9.1")}}
-
Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.
-
{{domxref("Window.menubar")}} {{ReadOnlyInline}}
-
Returns the menubar object, whose visibility can be toggled in the window.
-
{{domxref("Window.messageManager")}} {{gecko_minversion_inline("2.0")}}
-
Returns the message manager object for this window.
-
{{domxref("Window.mozAnimationStartTime")}} {{ReadOnlyInline}} {{gecko_minversion_inline("2.0")}} {{Deprecated_inline}}
-
The time in milliseconds since epoch at which the current animation cycle began. Use {{domxref("Animation.startTime")}} instead.
-
{{domxref("Window.mozInnerScreenX")}} {{ReadOnlyInline}} {{non-standard_inline}} {{gecko_minversion_inline("1.9.2")}}
-
Returns the horizontal (X) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel in {{interface("nsIDOMWindowUtils")}} for a conversion factor to adapt to screen pixels if needed.
-
{{domxref("Window.mozInnerScreenY")}} {{ReadOnlyInline}} {{non-standard_inline}} {{gecko_minversion_inline("1.9.2")}}
-
Returns the vertical (Y) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel for a conversion factor to adapt to screen pixels if needed.
-
{{domxref("Window.mozPaintCount")}} {{non-standard_inline}} {{ReadOnlyInline}} {{gecko_minversion_inline("2.0")}}
-
Returns the number of times the current document has been rendered to the screen in this window. This can be used to compute rendering performance.
-
{{domxref("Window.name")}}
-
Gets/sets the name of the window.
-
{{domxref("Window.navigator")}} {{readOnlyInline}}
-
Returns a reference to the navigator object.
-
{{domxref("Window.opener")}}
-
Returns a reference to the window that opened this current window.
-
{{domxref("Window.orientation")}} {{non-standard_inline}} {{deprecated_inline}} {{readOnlyInline}}
-
Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.
-
{{domxref("Window.outerHeight")}} {{readOnlyInline}}
-
Gets the height of the outside of the browser window.
-
{{domxref("Window.outerWidth")}} {{readOnlyInline}}
-
Gets the width of the outside of the browser window.
-
{{domxref("Window.scrollX","Window.pageXOffset")}} {{readOnlyInline}}
-
An alias for {{domxref("window.scrollX")}}.
-
{{domxref("Window.scrollY","Window.pageYOffset")}} {{readOnlyInline}}
-
An alias for {{domxref("window.scrollY")}}
-
{{domxref("Window.parent")}} {{readOnlyInline}}
-
Returns a reference to the parent of the current window or subframe.
-
{{domxref("Window.performance")}} {{readOnlyInline}}
-
Returns a {{domxref("Performance")}} object, which includes the {{domxref("Performance.timing", "timing")}} and {{domxref("Performance.navigation", "navigation")}} attributes, each of which is an object providing performance-related data. See also Using Navigation Timing for additional information and examples.
-
{{domxref("Window.personalbar")}} {{readOnlyInline}}
-
Returns the personalbar object, whose visibility can be toggled in the window.
-
{{domxref("Window.pkcs11")}} {{obsolete_inline(29)}}
-
Formerly provided access to install and remove PKCS11 modules.
-
{{domxref("Window.returnValue")}}
-
The return value to be returned to the function that called {{domxref("window.showModalDialog()")}} to display the window as a modal dialog.
-
{{domxref("Window.screen")}} {{readOnlyInline}}
-
Returns a reference to the screen object associated with the window.
- -
{{domxref("Window.screenX")}} {{readOnlyInline}}
-
Returns the horizontal distance of the left border of the user's browser from the left side of the screen.
-
{{domxref("Window.screenY")}} {{readOnlyInline}}
-
Returns the vertical distance of the top border of the user's browser from the top side of the screen.
-
{{domxref("Window.scrollbars")}} {{readOnlyInline}}
-
Returns the scrollbars object, whose visibility can be toggled in the window.
-
{{domxref("Window.scrollMaxX")}} {{non-standard_inline}} {{ReadOnlyInline}}
-
The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.
-
{{domxref("Window.scrollMaxY")}} {{non-standard_inline}} {{ReadOnlyInline}}
-
The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).
-
{{domxref("Window.scrollX")}} {{readOnlyInline}}
-
Returns the number of pixels that the document has already been scrolled horizontally.
-
{{domxref("Window.scrollY")}} {{readOnlyInline}}
-
Returns the number of pixels that the document has already been scrolled vertically.
-
{{domxref("Window.self")}} {{ReadOnlyInline}}
-
Returns an object reference to the window object itself.
-
{{domxref("Window.sessionStorage")}}
-
Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.
-
{{domxref("Window.sidebar")}} {{non-standard_inline}} {{ReadOnlyInline}}
-
Returns a reference to the window object of the sidebar.
-
{{domxref("Window.speechSynthesis")}} {{ReadOnlyInline}}
-
Returns a {{domxref("SpeechSynthesis")}} object, which is the entry point into using Web Speech API speech synthesis functionality.
-
{{domxref("Window.status")}}
-
Gets/sets the text in the statusbar at the bottom of the browser.
-
{{domxref("Window.statusbar")}} {{readOnlyInline}}
-
Returns the statusbar object, whose visibility can be toggled in the window.
-
{{domxref("Window.toolbar")}} {{readOnlyInline}}
-
Returns the toolbar object, whose visibility can be toggled in the window.
-
{{domxref("Window.top")}} {{readOnlyInline}}
-
Returns a reference to the topmost window in the window hierarchy. This property is read only.
-
{{domxref("Window.visualViewport")}} {{readOnlyInline}}
-
Returns a {{domxref("VisualViewport")}} object which represents the visual viewport for a given window.
-
{{domxref("Window.window")}} {{ReadOnlyInline}}
-
Returns a reference to the current window.
-
window[0], window[1], etc.
-
Returns a reference to the window object in the frames. See {{domxref("Window.frames")}} for more details.
-
- -

Properties implemented from elsewhere

- -
-
{{domxref("WindowOrWorkerGlobalScope.caches")}} {{readOnlyinline}}
-
Returns the {{domxref("CacheStorage")}} object associated with the current context. This object enables functionality such as storing assets for offline use, and generating custom responses to requests.
-
{{domxref("WindowOrWorkerGlobalScope.indexedDB")}} {{readonlyInline}}
-
Provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an {{domxref("IDBFactory")}} object.
-
{{domxref("WindowOrWorkerGlobalScope.isSecureContext")}} {{readOnlyinline}}
-
Returns a boolean indicating whether the current context is secure (true) or not (false).
-
{{domxref("WindowOrWorkerGlobalScope.origin")}} {{readOnlyinline}}
-
Returns the global object's origin, serialized as a string. (This does not yet appear to be implemented in any browser.)
-
- -

Methods

- -

This interface inherits methods from the {{domxref("EventTarget")}} interface and implements methods from {{domxref("WindowOrWorkerGlobalScope")}} and {{domxref("EventTarget")}}.

- -
-
{{domxref("Window.alert()")}}
-
Displays an alert dialog.
- -
{{domxref("Window.back()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Moves back one in the window history. This method is obsolete; you should instead use {{domxref("History.back", "window.history.back()")}}.
-
{{domxref("Window.blur()")}}
-
Sets focus away from the window.
-
{{domxref("Window.cancelAnimationFrame()")}} {{experimental_inline}}
-
Enables you to cancel a callback previously scheduled with {{domxref("Window.requestAnimationFrame")}}.
-
{{domxref("Window.cancelIdleCallback()")}} {{experimental_inline}}
-
Enables you to cancel a callback previously scheduled with {{domxref("Window.requestIdleCallback")}}.
-
{{domxref("Window.captureEvents()")}} {{Deprecated_inline}}
-
Registers the window to capture all events of the specified type.
-
{{domxref("Window.clearImmediate()")}}
-
Cancels the repeated execution set using setImmediate.
-
{{domxref("Window.close()")}}
-
Closes the current window.
-
{{domxref("Window.confirm()")}}
-
Displays a dialog with a message that the user needs to respond to.
-
{{domxref("Window.disableExternalCapture()")}} {{obsolete_inline(24)}}
-
{{todo("NeedsContents")}}
-
{{domxref("Window.dispatchEvent()")}}
-
Used to trigger an event.
-
{{domxref("Window.dump()")}} {{Non-standard_inline}}
-
Writes a message to the console.
-
{{domxref("Window.enableExternalCapture()")}} {{obsolete_inline(24)}}
-
{{todo("NeedsContents")}}
-
{{domxref("Window.find()")}}
-
Searches for a given string in a window.
-
{{domxref("Window.focus()")}}
-
Sets focus on the current window.
-
{{domxref("Window.forward()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Moves the window one document forward in the history. This method is obsolete; you should instead use {{domxref("History.forward", "window.history.forward()")}}.
-
{{domxref("Window.getAttention()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Flashes the application icon.
-
{{domxref("Window.getAttentionWithCycleCount()")}}
-
{{todo("NeedsContents")}}
-
{{domxref("Window.getComputedStyle()")}}
-
Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.
-
{{domxref("Window.getDefaultComputedStyle()")}} {{Non-standard_inline}}
-
Gets default computed style for the specified element, ignoring author stylesheets.
-
{{domxref("Window.getSelection()")}}
-
Returns the selection object representing the selected item(s).
-
{{domxref("Window.home()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Returns the browser to the home page.
-
{{domxref("Window.matchMedia()")}} {{gecko_minversion_inline("6.0")}}
-
Returns a {{domxref("MediaQueryList")}} object representing the specified media query string.
-
{{domxref("Window.maximize()")}}
-
{{todo("NeedsContents")}}
-
{{domxref("Window.minimize()")}} (top-level XUL windows only)
-
Minimizes the window.
-
{{domxref("Window.moveBy()")}}
-
Moves the current window by a specified amount.
-
{{domxref("Window.moveTo()")}}
-
Moves the window to the specified coordinates.
-
{{domxref("Window.open()")}}
-
Opens a new window.
-
{{domxref("Window.openDialog()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
Opens a new dialog window.
-
{{domxref("Window.postMessage()")}}
-
Provides a secure means for one window to send a string of data to another window, which need not be within the same domain as the first.
-
{{domxref("Window.print()")}}
-
Opens the Print Dialog to print the current document.
-
{{domxref("Window.prompt()")}}
-
Returns the text entered by the user in a prompt dialog.
-
{{domxref("Window.releaseEvents()")}} {{Non-standard_inline}} {{Deprecated_inline}}
-
Releases the window from trapping events of a specific type.
-
{{domxref("Window.requestAnimationFrame()")}} {{gecko_minversion_inline("2.0")}}
-
Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame.
-
{{domxref("Window.requestIdleCallback()")}}  {{experimental_inline}}
-
Enables the scheduling of tasks during a browser's idle periods.
-
{{domxref("Window.resizeBy()")}}
-
Resizes the current window by a certain amount.
-
{{domxref("Window.resizeTo()")}}
-
Dynamically resizes window.
-
{{domxref("Window.restore()")}} {{Non-standard_inline}} {{obsolete_inline}}
-
{{todo("NeedsContents")}}
-
{{domxref("Window.routeEvent()")}} {{obsolete_inline(24)}}
-
{{todo("NeedsContents")}}
-
{{domxref("Window.scroll()")}}
-
Scrolls the window to a particular place in the document.
-
{{domxref("Window.scrollBy()")}}
-
Scrolls the document in the window by the given amount.
-
{{domxref("Window.scrollByLines()")}} {{Non-standard_inline}}
-
Scrolls the document by the given number of lines.
-
{{domxref("Window.scrollByPages()")}} {{Non-standard_inline}}
-
Scrolls the current document by the specified number of pages.
-
{{domxref("Window.scrollTo()")}}
-
Scrolls to a particular set of coordinates in the document.
-
{{domxref("Window.setCursor()")}} {{Non-standard_inline}} (top-level XUL windows only)
-
Changes the cursor for the current window
-
{{domxref("Window.setImmediate()")}}
-
Executes a function after the browser has finished other heavy tasks
-
{{domxref("Window.setResizable()")}} {{Non-standard_inline}}
-
Toggles a user's ability to resize a window.
-
{{domxref("Window.sizeToContent()")}} {{Non-standard_inline}}
-
Sizes the window according to its content.
-
{{domxref("Window.stop()")}}
-
This method stops window loading.
-
{{domxref("Window.updateCommands()")}} {{Non-standard_inline}}
-
Updates the state of commands of the current chrome window (UI).
-
- -

Methods implemented from elsewhere

- -
-
{{domxref("EventTarget.addEventListener()")}}
-
Register an event handler to a specific event type on the window.
-
{{domxref("WindowOrWorkerGlobalScope.atob()")}}
-
Decodes a string of data which has been encoded using base-64 encoding.
-
{{domxref("WindowOrWorkerGlobalScope.btoa()")}}
-
Creates a base-64 encoded ASCII string from a string of binary data.
-
{{domxref("WindowOrWorkerGlobalScope.clearInterval()")}}
-
Cancels the repeated execution set using {{domxref("WindowOrWorkerGlobalScope.setInterval()")}}.
-
{{domxref("WindowOrWorkerGlobalScope.clearTimeout()")}}
-
Cancels the delayed execution set using {{domxref("WindowOrWorkerGlobalScope.setTimeout()")}}.
-
{{domxref("WindowOrWorkerGlobalScope.createImageBitmap()")}}
-
Accepts a variety of different image sources, and returns a {{domxref("Promise")}} which resolves to an {{domxref("ImageBitmap")}}. Optionally the source is cropped to the rectangle of pixels originating at (sx, sy) with width sw, and height sh.
-
{{domxref("WindowOrWorkerGlobalScope.fetch()")}}
-
Starts the process of fetching a resource from the network.
-
{{domxref("EventTarget.removeEventListener")}}
-
Removes an event listener from the window.
-
{{domxref("WindowOrWorkerGlobalScope.setInterval()")}}
-
Schedules a function to execute every time a given number of milliseconds elapses.
-
{{domxref("WindowOrWorkerGlobalScope.setTimeout()")}}
-
Schedules a function to execute in a given amount of time.
-
- -

Obsolete methods

- -
-
{{domxref("Window.showModalDialog()")}} {{obsolete_inline}}
-
Displays a modal dialog. This method was removed completely in Chrome 43, and Firefox 55.
-
- -

Event handlers

- -

These are properties of the window object that can be set to establish event handlers for the various things that can happen in the window that might be of interest.

- -

This interface inherits event handlers from the {{domxref("EventTarget")}} interface and implements event handlers from {{domxref("WindowEventHandlers")}}.

- -
-

Note: Starting in {{Gecko("9.0")}}, you can now use the syntax if ("onabort" in window) to determine whether or not a given event handler property exists. This is because event handler interfaces have been updated to be proper web IDL interfaces. See DOM event handlers for details.

-
- -
-
{{domxref("Window.onappinstalled")}}
-
Called when the page is installed as a webapp. See {{event('appinstalled')}} event.
-
{{domxref("Window.onbeforeinstallprompt")}}
-
An event handler property dispatched before a user is prompted to save a web site to a home screen on mobile.
-
{{domxref("Window.ondevicelight")}}
-
An event handler property for any ambient light levels changes
-
{{domxref("Window.ondevicemotion")}} {{gecko_minversion_inline("6.0")}}
-
Called if accelerometer detects a change (For mobile devices)
-
{{domxref("Window.ondeviceorientation")}} {{gecko_minversion_inline("6.0")}}
-
Called when the orientation is changed (For mobile devices)
-
{{domxref("Window.ondeviceorientationabsolute")}} {{non-standard_inline}} Chrome only
-
An event handler property for any device orientation changes.
-
{{domxref("Window.ondeviceproximity")}}
-
An event handler property for device proximity event
-
{{domxref("Window.ongamepadconnected")}}
-
Represents an event handler that will run when a gamepad is connected (when the {{event('gamepadconnected')}} event fires).
-
{{domxref("Window.ongamepaddisconnected")}}
-
Represents an event handler that will run when a gamepad is disconnected (when the {{event('gamepaddisconnected')}} event fires).
-
{{domxref("Window.onmozbeforepaint")}} {{gecko_minversion_inline("2.0")}}
-
An event handler property for the MozBeforePaint event, which is sent before repainting the window if the event has been requested by a call to the {{domxref("Window.mozRequestAnimationFrame()")}} method.
-
{{domxref("Window.onpaint")}}
-
An event handler property for paint events on the window.
-
{{domxref("Window.onrejectionhandled")}} {{experimental_inline}}
-
An event handler for handled {{jsxref("Promise")}} rejection events.
-
{{domxref("Window.onuserproximity")}}
-
An event handler property for user proximity events.
-
{{domxref("Window.onvrdisplayconnect")}}
-
Represents an event handler that will run when a compatible VR device has been connected to the computer (when the {{event("vrdisplayconnected")}} event fires).
-
{{domxref("Window.onvrdisplaydisconnect")}}
-
Represents an event handler that will run when a compatible VR device has been disconnected from the computer (when the {{event("vrdisplaydisconnected")}} event fires).
-
{{domxref("Window.onvrdisplayactivate")}}
-
Represents an event handler that will run when a display is able to be presented to (when the {{event("vrdisplayactivate")}} event fires), for example if an HMD has been moved to bring it out of standby, or woken up by being put on.
-
{{domxref("Window.onvrdisplaydeactivate")}}
-
Represents an event handler that will run when a display can no longer be presented to (when the {{event("vrdisplaydeactivate")}} event fires), for example if an HMD has gone into standby or sleep mode due to a period of inactivity.
-
{{domxref("Window.onvrdisplayblur")}}
-
Represents an event handler that will run when presentation to a display has been paused for some reason by the browser, OS, or VR hardware (when the {{event("vrdisplayblur")}} event fires) — for example, while the user is interacting with a system menu or browser, to prevent tracking or loss of experience.
-
{{domxref("Window.onvrdisplayfocus")}}
-
Represents an event handler that will run when presentation to a display has resumed after being blurred (when the {{event("vrdisplayfocus")}} event fires).
-
{{domxref("Window.onvrdisplaypresentchange")}}
-
represents an event handler that will run when the presenting state of a VR device changes — i.e. goes from presenting to not presenting, or vice versa (when the {{event("vrdisplaypresentchange")}} event fires).
-
- -

Event handlers implemented from elsewhere

- -
-
{{domxref("GlobalEventHandlers.onabort")}}
-
Called when the loading of a resource has been aborted, such as by a user canceling the load while it is still in progress
-
{{domxref("WindowEventHandlers.onafterprint")}}
-
Called when the print dialog box is closed. See {{event("afterprint")}} event.
-
{{domxref("WindowEventHandlers.onbeforeprint")}}
-
Called when the print dialog box is opened. See {{event("beforeprint")}} event.
-
{{domxref("WindowEventHandlers.onbeforeunload")}}
-
An event handler property for before-unload events on the window.
-
{{domxref("GlobalEventHandlers.onblur")}}
-
Called after the window loses focus, such as due to a popup.
-
{{domxref("GlobalEventHandlers.onchange")}}
-
An event handler property for change events on the window.
-
{{domxref("GlobalEventHandlers.onclick")}}
-
Called after the ANY mouse button is pressed & released
-
{{domxref("GlobalEventHandlers.ondblclick")}}
-
Called when a double click is made with ANY mouse button.
-
{{domxref("GlobalEventHandlers.onclose")}}
-
Called after the window is closed
-
{{domxref("GlobalEventHandlers.oncontextmenu")}}
-
Called when the RIGHT mouse button is pressed
-
{{domxref("GlobalEventHandlers.onerror")}}
-
Called when a resource fails to load OR when an error occurs at runtime. See {{event("error")}} event.
-
{{domxref("GlobalEventHandlers.onfocus")}}
-
Called after the window receives or regains focus. See {{event("focus")}} events.
-
{{domxref("WindowEventHandlers.onhashchange")}} {{gecko_minversion_inline("1.9.2")}}
-
An event handler property for {{event('hashchange')}} events on the window; called when the part of the URL after the hash mark ("#") changes.
-
{{domxref("GlobalEventHandlers.oninput")}}
-
Called when the value of an <input> element changes
-
{{domxref("GlobalEventHandlers.onkeydown")}}
-
Called when you begin pressing ANY key. See {{event("keydown")}} event.
-
{{domxref("GlobalEventHandlers.onkeypress")}}
-
Called when a key (except Shift, Fn, and CapsLock) is in pressed position. See {{event("keypress")}} event.
-
{{domxref("GlobalEventHandlers.onkeyup")}}
-
Called when you finish releasing ANY key. See {{event("keyup")}} event.
-
{{domxref("WindowEventHandlers.onlanguagechange")}}
-
An event handler property for {{event("languagechange")}} events on the window.
-
{{domxref("GlobalEventHandlers.onload")}}
-
Called after all resources and the DOM are fully loaded. WILL NOT get called when the page is loaded from cache, such as with back button.
-
{{domxref("WindowEventHandlers.onmessage")}}
-
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("message")}} event is raised.
-
{{domxref("GlobalEventHandlers.onmousedown")}}
-
Called when ANY mouse button is pressed.
-
{{domxref("GlobalEventHandlers.onmousemove")}}
-
Called continously when the mouse is moved inside the window.
-
{{domxref("GlobalEventHandlers.onmouseout")}}
-
Called when the pointer leaves the window.
-
{{domxref("GlobalEventHandlers.onmouseover")}}
-
Called when the pointer enters the window
-
{{domxref("GlobalEventHandlers.onmouseup")}}
-
Called when ANY mouse button is released
-
{{domxref("WindowEventHandlers.onoffline")}}
-
Called when network connection is lost. See {{event("offline")}} event.
-
{{domxref("WindowEventHandlers.ononline")}}
-
Called when network connection is established. See {{event("online")}} event.
-
{{domxref("WindowEventHandlers.onpagehide")}}
-
Called when the user navigates away from the page, before the onunload event. See {{event("pagehide")}} event.
-
{{domxref("WindowEventHandlers.onpageshow")}}
-
Called after all resources and the DOM are fully loaded. See {{event("pageshow")}} event.
-
{{domxref("WindowEventHandlers.onpopstate")}} {{gecko_minversion_inline("2.0")}}
-
Called when a back button is pressed.
-
{{domxref("GlobalEventHandlers.onreset")}}
-
Called when a form is reset
-
{{domxref("GlobalEventHandlers.onresize")}}
-
Called continuously as you are resizing the window.
-
{{domxref("GlobalEventHandlers.onscroll")}}
-
Called when the scroll bar is moved via ANY means. If the resource fully fits in the window, then this event cannot be invoked
-
{{domxref("GlobalEventHandlers.onwheel")}}
-
Called when the mouse wheel is rotated around any axis
-
{{domxref("GlobalEventHandlers.onselect")}}
-
Called after text in an input field is selected
-
{{domxref("GlobalEventHandlers.onselectionchange")}}
-
Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("selectionchange")}} event is raised.
-
{{domxref("WindowEventHandlers.onstorage")}}
-
Called when there is a change in session storage or local storage. See {{event("storage")}} event
-
{{domxref("GlobalEventHandlers.onsubmit")}}
-
Called when a form is submitted
-
{{domxref("WindowEventHandlers.onunhandledrejection")}} {{experimental_inline}}
-
An event handler for unhandled {{jsxref("Promise")}} rejection events.
-
{{domxref("WindowEventHandlers.onunload")}}
-
Called when the user navigates away from the page.
-
- -

Constructors

- -

See also the DOM Interfaces.

- -
-
{{domxref("DOMParser")}}
-
DOMParser can parse XML or HTML source stored in a string into a DOM DocumentDOMParser is specified in DOM Parsing and Serialization.
-
{{domxref("Window.GeckoActiveXObject")}}
-
{{todo("NeedsContents")}}
-
{{domxref("Image")}}
-
Used for creating an {{domxref("HTMLImageElement")}}.
-
{{domxref("Option")}}
-
Used for creating an {{domxref("HTMLOptionElement")}}
-
{{domxref("Window.QueryInterface")}}
-
{{todo("NeedsContents")}}
-
{{domxref("Window.StaticRange")}} {{experimental_inline}} {{readonlyinline}}
-
Returns a {{domxref('StaticRange.StaticRange','StaticRange()')}} constructor which creates a {{domxref('StaticRange')}} object.
-
{{domxref("Worker")}}
-
Used for creating a Web worker
-
{{domxref("Window.XMLSerializer")}}
-
{{todo("NeedsContents")}}
-
{{domxref("Window.XPCNativeWrapper")}}
-
{{todo("NeedsContents")}}
-
{{domxref("Window.XPCSafeJSObjectWrapper")}}
-
{{todo("NeedsContents")}}
-
- -

Interfaces

- -

See DOM Reference

- -

Browser compatibility

- - - -

{{Compat("api.Window")}}

- -

See also

- - diff --git a/files/fi/web/api/window/navigator/index.html b/files/fi/web/api/window/navigator/index.html deleted file mode 100644 index e06a2f0ef1..0000000000 --- a/files/fi/web/api/window/navigator/index.html +++ /dev/null @@ -1,111 +0,0 @@ ---- -title: window.navigator -slug: Web/API/Window/navigator -translation_of: Web/API/Window/navigator -original_slug: DOM/window.navigator ---- -
{{ApiRef}}
- -

Yhteenveto

- -

Palauttaa viitteen navigaattori-objektiin, jolta voidaan kysellä tietoja skriptiä suorittavasta sovelluksesta.

- -

Esimerkki

- -
-
alert("You're using " + navigator.appName);
-
-
- -

Ominaisuudet

- -
-
{{domxref("window.navigator.appCodeName", "navigator.appCodeName")}} {{non-standard_inline}}
-
Palauttaa nykyisen selaimen sisäisen "code"-nimen. Älä nojaa tähän ominaisuuteen oikean arvon palauttamiseksi.
-
{{domxref("window.navigator.appName", "navigator.appName")}}
-
Palauttaa selaimen virallisen nimen. Älä nojaa tähän ominaisuuteen oikean arvon palauttamiseksi.
-
{{domxref("window.navigator.appVersion", "navigator.appVersion")}}
-
Palauttaa selaimen version merkkijonona. Älä nojaa tähän ominaisuuteen oikean arvon palauttamiseksi.
-
{{domxref("window.navigator.battery", "navigator.battery")}} {{gecko_minversion_inline("10.0")}}
-
Palauttaa {{domxref("window.navigator.battery", "battery")}}-objektin, jota voit käyttää tietojen saamiseksi akun lataustilasta.
-
{{domxref("window.navigator.buildID", "navigator.buildID")}} {{non-standard_inline}}
-
Palauttaa selaimen rakentamistunnisteen (esim.: "2006090803")
-
{{domxref("window.navigator.connection", "navigator.connection")}}
-
Tarjoaa tietoa laitteen verkkoyhteydestä.
-
{{domxref("window.navigator.cookieEnabled", "navigator.cookieEnabled")}}
-
Palauttaa boolean-arvon, joka kertoo, että ovatko evästeet käytössä selaimessa vai eivät.
-
{{domxref("navigator.doNotTrack")}} {{non-standard_inline}}
-
Ilmoittaa käyttäjän do-not-track -asetuksen. Kun tämä arvo on "yes", webbisivustosi tai sovelluksesi ei pitäisi seurata käyttäjää.
-
{{domxref("navigator.id")}} {{non-standard_inline}}
-
Palauttaa {{domxref("window.navigator.id", "id")}}-objektin, jota voit käyttää BrowserID-tuen lisäämiseksi webbisivustollesi.
-
{{domxref("window.navigator.language", "navigator.language")}}
-
Palauttaa selaimen kieliversiota edustavan merkkijonon.
-
{{domxref("window.navigator.mimeTypes", "navigator.mimeTypes")}}
-
Palauttaa selaimen tukemien MIME-tyypien luettelon.
-
{{domxref("window.navigator.mozApps", "navigator.mozApps")}} {{non-standard_inline}}
-
Palauttaa {{domxref("window.navigator.mozApps", "Apps")}}-objektin, jota voit käyttää Open Web apps-sovellusten asentamiseen, hallinnointiin ja ohjaamiseen.
-
{{domxref("navigator.mozNotification")}} {{non-standard_inline}}
- {{domxref("navigator.webkitNotification")}}
-
Palauttaa {{domxref("navigator.mozNotification", "notification")}}-objektin, jota voit käyttää toimittamaan ilmoituksia käyttäjältä webbisovelluksellesi.
-
{{domxref("window.navigator.mozSms", "navigator.mozSms")}}  {{gecko_minversion_inline("12.0")}} {{non-standard_inline}}
-
Palauttaa {{domxref("SmsManager")}}-objektin, jota voit käyttää SMS-viestinnän hallinnointiin webbisovelluksessasi.
-
{{domxref("navigator.mozSocial")}} {{non-standard_inline}}
-
{{todo("NeedsText")}}
-
{{domxref("window.navigator.mozTelephony", "navigator.mozTelephony")}} {{non-standard_inline}}
-
Palauttaa {{domxref("Telephony")}}-objektin, jota voit käyttää luomaan ja hallinnoimaan puheluja.
-
{{domxref("window.navigator.onLine", "navigator.onLine")}}
-
Palauttaa boolean-arvon, joka osoittaa, että onko selaimesi verkkoyhteydessä vai ei.
-
{{domxref("window.navigator.oscpu", "navigator.oscpu")}}
-
Palauttaa nykyistä käyttäjärjestelmää edustavan merkkijonon.
-
{{domxref("window.navigator.platform", "navigator.platform")}}
-
Palauttaa selainalustaa edustavan merkkijonon.
-
{{domxref("window.navigator.plugins", "navigator.plugins")}}
-
Palauttaa selaimeen asennettujen lisäosien taulukon.
-
{{domxref("window.navigator.product", "navigator.product")}} {{non-standard_inline}}
-
Palauttaa nykyisen selaimen tuotenimen. (esim.: "Gecko")
-
{{domxref("window.navigator.productSub", "navigator.productSub")}} {{non-standard_inline}}
-
Palauttaa nykyisen selaimen rakennusnumeron (esim.: "20060909")
-
{{domxref("window.navigator.securitypolicy", "navigator.securitypolicy")}} {{non-standard_inline}}
-
Palauttaa tyhjän merkkijonon. Netscape 4.7x-selaimessa palauttaa merkkijonon "US & CA domestic policy" tai "Export policy".
-
{{domxref("window.navigator.standalone", "navigator.standalone")}} {{non-standard_inline}}
-
Palauttaa boolean-arvon, joka osoittaa, että suoritetaanko selainta erillistilassa. Käytettävissä vain Apple:n iOS Safari -selaimessa.
-
{{domxref("window.navigator.userAgent", "navigator.userAgent")}}
-
Palauttaa nykyisen selaimen user agent -merkkijonon.
-
{{domxref("window.navigator.vendor", "navigator.vendor")}} {{non-standard_inline}}
-
Palauttaa nykyisen selaimen toimittajanimen (esim.: "Netscape6")
-
{{domxref("window.navigator.vendorSub", "navigator.vendorSub")}} {{non-standard_inline}}
-
Palauttaa toimittajaversionumeron (esim.: "6.1")
-
navigator.webkitPointer {{non-standard_inline}}
-
Palauttaa PointerLock-objektin Mouse Lock API:a varten.
-
- -

Metodit

- -
-
{{domxref("window.navigator.javaEnabled", "navigator.javaEnabled")}}
-
Osoittaa, että onko tietokoneen selaimen Java käytössä vai ei.
-
{{domxref("window.navigator.mozIsLocallyAvailable", "navigator.mozIsLocallyAvailable")}} {{non-standard_inline}}
-
Sallii koodin tarkistaa verkkoa käyttämättä, että onko tietyssä URI-osoitteessa oleva asiakirja olemassa.
-
{{domxref("window.navigator.preference", "navigator.preference")}} {{obsolete_inline("2.0")}} {{non-standard_inline}}
-
Asettaa käyttäjäasetuksen. Tämä methodi on käytettävissä vain privileged-koodille ja on vanhentunut; sinun pitäisi käyttää sen sijasta XPCOM Preferences API:a.
-
{{domxref("window.navigator.registerContentHandler", "navigator.registerContentHandler")}}
-
Sallii webbisivuston rekisteröidä itsensä tietyn MIME-tyypin mahdollisena käsittelijänä.
-
{{domxref("navigator.registerProtocolHandler", "navigator.registerProtocolHandler")}}
-
Sallii webbisivuston rekisteröidä itsensä tietyn yhteyskäytännön mahdollisena käsittelijänä.
-
{{domxref("window.navigator.taintEnabled", "navigator.taintEnabled")}} {{deprecated_inline("1.7.8")}} {{obsolete_inline("9.0")}} {{non-standard_inline}}
-
Palauttaa arvon false. JavaScript taint/untaint -funktiot poistettu JavaScript 1.2:ssa.
-
{{domxref("window.navigator.vibrate", "navigator.vibrate()")}} {{gecko_minversion_inline("11.0")}}
-
Aiheuttaa värähtelyä laitteissa, jotka tukevat sitä. Ei tee mitään, jos värähtelytuki ei ole käytettävissä.
-
- -

Spesifikaatio

- - - -

Katso myös

- - -- cgit v1.2.3-54-g00ecf