From e9c10ee7fb345eadf3cc47cab1913b708def3ae4 Mon Sep 17 00:00:00 2001 From: Craig Blaszczyk Date: Thu, 15 Sep 2022 17:30:13 +0100 Subject: [PATCH 01/10] chore: improve markdown conversion * add missing sidebar * remove "table.spectable.standard-table" classses * ensure all dd elements have content * ensure one dd element per dt element * remove unneeded brush class * add missing APIRef macro * replace syntaxbox class with js * remove nested em element inside of a note * remove unneeded float-right class * remove unneeded htmlScript:true class * add missing classes to pre blocks * replace incorrect classes in pre blocks * minor content edits * remove unused languages macro --- .../api/window/beforeunload_event/index.html | 10 +- files/es/web/api/window/blur_event/index.html | 8 +- .../window/cancelanimationframe/index.html | 5 +- files/es/web/api/window/close/index.html | 10 +- files/es/web/api/window/closed/index.html | 6 +- files/es/web/api/window/confirm/index.html | 4 +- .../api/window/devicepixelratio/index.html | 2 +- files/es/web/api/window/document/index.html | 4 +- .../es/web/api/window/error_event/index.html | 4 +- .../es/web/api/window/focus_event/index.html | 4 +- .../es/web/api/window/frameelement/index.html | 4 +- files/es/web/api/window/fullscreen/index.html | 2 +- .../api/window/getcomputedstyle/index.html | 5 +- .../es/web/api/window/getselection/index.html | 5 +- .../api/window/hashchange_event/index.html | 8 +- files/es/web/api/window/history/index.html | 4 +- files/es/web/api/window/index.html | 5 +- .../es/web/api/window/innerheight/index.html | 12 +- files/es/web/api/window/load_event/index.html | 8 +- .../es/web/api/window/localstorage/index.html | 10 +- files/es/web/api/window/location/index.html | 18 +- .../es/web/api/window/locationbar/index.html | 4 +- files/es/web/api/window/matchmedia/index.html | 4 +- files/es/web/api/window/menubar/index.html | 4 +- files/es/web/api/window/moveby/index.html | 4 +- files/es/web/api/window/navigator/index.html | 6 +- files/es/web/api/window/open/index.html | 166 ++++++------------ files/es/web/api/window/opener/index.html | 4 +- .../es/web/api/window/outerheight/index.html | 2 +- files/es/web/api/window/outerwidth/index.html | 2 +- .../web/api/window/popstate_event/index.html | 4 +- files/es/web/api/window/print/index.html | 6 +- files/es/web/api/window/prompt/index.html | 4 +- .../window/requestanimationframe/index.html | 7 +- .../api/window/requestidlecallback/index.html | 15 +- .../es/web/api/window/resize_event/index.html | 8 +- files/es/web/api/window/scroll/index.html | 6 +- files/es/web/api/window/scrollby/index.html | 8 +- files/es/web/api/window/scrollto/index.html | 4 +- files/es/web/api/window/scrollx/index.html | 8 +- files/es/web/api/window/scrolly/index.html | 8 +- .../web/api/window/sessionstorage/index.html | 6 +- .../web/api/window/showmodaldialog/index.html | 4 +- files/es/web/api/window/statusbar/index.html | 4 +- 44 files changed, 184 insertions(+), 242 deletions(-) diff --git a/files/es/web/api/window/beforeunload_event/index.html b/files/es/web/api/window/beforeunload_event/index.html index c19e913e169e2a..229cd01c13f0a8 100644 --- a/files/es/web/api/window/beforeunload_event/index.html +++ b/files/es/web/api/window/beforeunload_event/index.html @@ -4,14 +4,16 @@ translation_of: Web/API/Window/beforeunload_event original_slug: Web/Events/beforeunload --- -
El evento beforeunload es disparado cuando la ventana, el documento y sus recursos estan a punto de ser descargados. El documento todavia es visible y el evento todavia es cancelable en este punto.
+{{APIRef}} + +

El evento beforeunload es disparado cuando la ventana, el documento y sus recursos estan a punto de ser descargados. El documento todavia es visible y el evento todavia es cancelable en este punto.

Si es asignado un string a la propiedad del objeto Evento returnValue, una caja de dialogo aparece, preguntando al usuario que confirme que dejara la pagina(mirar el ejemplo de abajo). Algunos navegadores muestran el string devuelto en una caja de dialogos, otros muestran un mensaje fijo. Si no se provee ningun valor, el evento procede silenciosamente.

-

Nota:Para combatir pop-ups indeseados, los navegadores pueden no mostrar mensajes creados en manejadores del evento beforeunload a menos que se haya interactuado con la pagina, o incluso sin que se haya interactuado en nada con esta.

+

Nota: Para combatir pop-ups indeseados, los navegadores pueden no mostrar mensajes creados en manejadores del evento beforeunload a menos que se haya interactuado con la pagina, o incluso sin que se haya interactuado en nada con esta.

@@ -76,7 +78,7 @@

Propiedades

Ejemplos

-
window.addEventListener("beforeunload", function (event) {
+
window.addEventListener("beforeunload", function (event) {
   event.returnValue = "\o/";
 });
 
@@ -87,7 +89,7 @@ 

Ejemplos

Navegadores basados en WebKit no siguen las especificaciones para la caja de dialogos. Un ejemplo que funcione con distintos navegadores seria similar al siguiente:

-
window.addEventListener("beforeunload", function (e) {
+
window.addEventListener("beforeunload", function (e) {
   var confirmationMessage = "\o/";
 
   e.returnValue = confirmationMessage;     // Gecko, Trident, Chrome 34+
diff --git a/files/es/web/api/window/blur_event/index.html b/files/es/web/api/window/blur_event/index.html
index 2aa88e48f472e1..07ac19d0695249 100644
--- a/files/es/web/api/window/blur_event/index.html
+++ b/files/es/web/api/window/blur_event/index.html
@@ -10,19 +10,19 @@
 
 

Sintaxis

-
element.onblur = function;
+
element.onblur = function;
 
  • function es el nombre de una función definida por el usuario, sin el sufijo () ni ningún parámetro, o una declaración de función anónima, como:
-
element.onblur = function() { console.log("¡evento onblur detectado!"); };
+
element.onblur = function() { console.log("¡evento onblur detectado!"); };
 

Ejemplo

-
<html>
+
<html>
 
 <head>
 <title>ejemplo de evento onblur</title>
@@ -75,7 +75,7 @@ 

Notas

Especificación

-
+
diff --git a/files/es/web/api/window/cancelanimationframe/index.html b/files/es/web/api/window/cancelanimationframe/index.html index d1d41a7bbf3834..6e09164276b6fb 100644 --- a/files/es/web/api/window/cancelanimationframe/index.html +++ b/files/es/web/api/window/cancelanimationframe/index.html @@ -11,7 +11,7 @@

Resumen

Sintaxis

-
window.cancelAnimationFrame(requestID);
+
window.cancelAnimationFrame(requestID);
 
@@ -27,8 +27,7 @@

Parámetros

Ejemplos

-
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
-                            window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
+
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
 
 var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
 
diff --git a/files/es/web/api/window/close/index.html b/files/es/web/api/window/close/index.html
index 8f2d02c5eb680e..a4756b541450fb 100644
--- a/files/es/web/api/window/close/index.html
+++ b/files/es/web/api/window/close/index.html
@@ -11,14 +11,14 @@ 

Resumen

Sintaxis

-
window.close();
+
window.close();
 

Descripción

Cuando este método es llamado, la ventana referenciada es cerrada.

-

Este método solo se permite ser llamado por ventanas que fueron abiertas por un script utilizando el método {{domxref("window.open()")}}. Si la ventana no fue abierta por un script, el siguiente error aparece en la consola de JavaScript: Scripts may not close windows that were not opened by script.

+

Este método solo se permite ser llamado por ventanas que fueron abiertas por un script utilizando el método {{domxref("window.open()")}}. Si la ventana no fue abierta por un script, el siguiente error aparece en la consola de JavaScript: Scripts may not close windows that were not opened by script.

Ejemplos

@@ -26,7 +26,7 @@

-
<script type="text/javascript">
+
<script type="text/javascript">
 //Global var to store a reference to the opened window
 var openedWindow;
 
@@ -44,9 +44,9 @@ 

Cerrando la ventana actual

-

Cuando se llama al método del objeto window close() directamente, en vez de llamar a close() en una instancia de la ventana, el navegador cerrará la ventana que está en primer plano, independientemente si el script fue creado en la ventana o no. (Firefox 35.0.1: los scripts no pueden cerrar ventanas que ellos no han abierto)

+

Cuando se llama al método del objeto window close() directamente, en vez de llamar a close() en una instancia de la ventana, el navegador cerrará la ventana que está en primer plano, independientemente si el script fue creado en la ventana o no. (Firefox 35.0.1: los scripts no pueden cerrar ventanas que ellos no han abierto)

-
<script type="text/javascript">
+
<script type="text/javascript">
 function closeCurrentWindow()
 {
   window.close();
diff --git a/files/es/web/api/window/closed/index.html b/files/es/web/api/window/closed/index.html
index b5caf862f3803c..dbb982247fed97 100644
--- a/files/es/web/api/window/closed/index.html
+++ b/files/es/web/api/window/closed/index.html
@@ -17,7 +17,7 @@ 

Resumen

Syntax

-
isClosed = windowRef.closed;
+
isClosed = windowRef.closed;
 
@@ -36,7 +36,7 @@

Cambiar la UR

El siguiente ejemplo demuestra cómo una ventana emergente puede cambiar la URL de la ventana que la abrió. Antes de intentar cambiar la URL, verifica que la ventana actual tiene referencia a la ventana que la abrió usando la propiedad window.opener y que esa ventana no está cerrada:

-
// Verifica que opener existe y no esté cerrado
+
// Verifica que opener existe y no esté cerrado
 if (window.opener && !window.opener.closed) {
   window.opener.location.href = "http://www.mozilla.org";
 }
@@ -47,7 +47,7 @@

Actualizando una

En este ejemplo la función refreshPopupWindow() llama al método reload del objeto location de la ventana emergente para actualizar su información. Si la ventana emergente no ha sido abierta o el usuario la cerró una nueva ventana es abierta.

-
var popupWindow = null;
+
var popupWindow = null;
 
 function refreshPopupWindow() {
   if (popupWindow && !popupWindow.closed) {
diff --git a/files/es/web/api/window/confirm/index.html b/files/es/web/api/window/confirm/index.html
index afbe4845669094..90b01c86187ab7 100644
--- a/files/es/web/api/window/confirm/index.html
+++ b/files/es/web/api/window/confirm/index.html
@@ -9,7 +9,7 @@
 
 

Sintaxis

-
result = window.confirm(message);
+
result = window.confirm(message);
 
    @@ -19,7 +19,7 @@

    Sintaxis

    Ejemplo

    -
    if (window.confirm("Do you really want to leave?")) {
    +
    if (window.confirm("Do you really want to leave?")) {
       window.open("exit.html", "Thanks for Visiting!");
     }
     
    diff --git a/files/es/web/api/window/devicepixelratio/index.html b/files/es/web/api/window/devicepixelratio/index.html index b0d9a179ccb9eb..52f6abb71fe89f 100644 --- a/files/es/web/api/window/devicepixelratio/index.html +++ b/files/es/web/api/window/devicepixelratio/index.html @@ -11,7 +11,7 @@

    Sintaxis

    -
    value = window.devicePixelRatio;
    +
    value = window.devicePixelRatio;
     

    Especificación

    diff --git a/files/es/web/api/window/document/index.html b/files/es/web/api/window/document/index.html index d5c4d3ebe63c49..4613f1cb2e4453 100644 --- a/files/es/web/api/window/document/index.html +++ b/files/es/web/api/window/document/index.html @@ -13,7 +13,7 @@

    Resumen

    Sintaxis

    -
    doc = window.document
    +
    doc = window.document
     

    Parámetros

    @@ -24,7 +24,7 @@

    Parámetros

    Example

    -
    <!DOCTYPE html>
    +
    <!DOCTYPE html>
     <html>
     <head>
        <title>Hola, Mundo!</title>
    diff --git a/files/es/web/api/window/error_event/index.html b/files/es/web/api/window/error_event/index.html
    index 217611f8c568ee..424e3eef2fade7 100644
    --- a/files/es/web/api/window/error_event/index.html
    +++ b/files/es/web/api/window/error_event/index.html
    @@ -12,7 +12,7 @@
     
     

    Sintaxis

    -
    window.onerror = funcRef;
    +
    window.onerror = funcRef;
     

    Parámetros

    @@ -32,7 +32,7 @@

    Parámetros

    Ejemplos

    -
    // Example 1:
    +
    // Example 1:
     
     // Prevent error dialogs from displaying -which is the window's normal
     // behavior- by overriding the default event handler for error events that
    diff --git a/files/es/web/api/window/focus_event/index.html b/files/es/web/api/window/focus_event/index.html
    index 68b3e9f1790ffc..7ea1c0192644e1 100644
    --- a/files/es/web/api/window/focus_event/index.html
    +++ b/files/es/web/api/window/focus_event/index.html
    @@ -10,7 +10,7 @@
     
     

    Sintaxis

    -
    element.onfocus = event handling code
    +
    element.onfocus = event handling code
     

    Notas

    @@ -23,7 +23,7 @@

    Notas

    Especificaciones

    -

Especificación
+
diff --git a/files/es/web/api/window/frameelement/index.html b/files/es/web/api/window/frameelement/index.html index ff313a9fab68e0..bc0caed4731b84 100644 --- a/files/es/web/api/window/frameelement/index.html +++ b/files/es/web/api/window/frameelement/index.html @@ -9,7 +9,7 @@

Sintaxes

-
frameEl = window.frameElement;
+
frameEl = window.frameElement;
 
Specification
@@ -71,16 +73,16 @@

Propiedades

- + - +
The previous URL from which the window was navigated.
newURL {{readonlyInline}}newURL {{readonlyInline}} {{jsxref("String")}} The new URL to which the window is navigating.

En esta página se enlistan algunos scripts de ejemplo. Básicamente estos scripts revisan el location.hash en un intervalo regular. Aquí se muestra una versión que permite que solo un controlador sea ligado a la propiedad window.onhashchange:

-
;(function(window) {
+
;(function(window) {
 
   // salir si el navegador implementa el evento
   if ("onhashchange" in window) { return; }
diff --git a/files/es/web/api/window/history/index.html b/files/es/web/api/window/history/index.html
index 15492407681418..fb87b1181545c7 100644
--- a/files/es/web/api/window/history/index.html
+++ b/files/es/web/api/window/history/index.html
@@ -11,12 +11,12 @@
 
 

Sintaxis

-
var historyObj = window.history;
+
var historyObj = window.history;
 

Ejemplo

-
history.back();     // equivalente a hacer clic en el botón de regresar
+
history.back();     // equivalente a hacer clic en el botón de regresar
 history.go(-1);     // equivalente a history.back();
 
diff --git a/files/es/web/api/window/index.html b/files/es/web/api/window/index.html index 939c65367bf2aa..1e54f38e8d4ff5 100644 --- a/files/es/web/api/window/index.html +++ b/files/es/web/api/window/index.html @@ -124,7 +124,7 @@

Propiedades

{{domxref("Window.sessionStorage")}} {{readOnlyInline}}
Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.
{{domxref("SpeechSynthesisGetter.speechSynthesis")}} {{readOnlyInline}}
-
+
Returns a {{domxref("SpeechSynthesis")}} object, which is the entry point into using Web Speech API speech synthesis functionality.
{{domxref("Window.parent")}} {{readOnlyInline}}
Returns a reference to the parent of the current window or subframe.
{{domxref("Window.performance")}} {{readOnlyInline}}
@@ -179,8 +179,7 @@

Methods

{{domxref("EventTarget.addEventListener()")}}
Registra un controlador de eventos a un tipo de evento especifico en la ventana.
{{domxref("Window.alert()")}}
-
Muestra una pequeña ventana de alerta.
-
El estilo y posición de la ventana puede variar dependiendo de que navegador este usando.
+
Muestra una pequeña ventana de alerta. El estilo y posición de la ventana puede variar dependiendo de que navegador este usando.
{{domxref("WindowBase64.atob()")}}
Decodes a string of data which has been encoded using base-64 encoding.
{{domxref("Window.back()")}} {{Non-standard_inline}} {{obsolete_inline}}
diff --git a/files/es/web/api/window/innerheight/index.html b/files/es/web/api/window/innerheight/index.html index 5ce7500e7f1a6e..cb4bccd7b78e12 100644 --- a/files/es/web/api/window/innerheight/index.html +++ b/files/es/web/api/window/innerheight/index.html @@ -8,13 +8,15 @@ - Window translation_of: Web/API/Window/innerHeight --- -
//Propiedad solo lectura del objeto window.
+{{APIRef}} + +

Propiedad solo lectura del objeto window.

Representa la altura (en pixeles) del viewport

Sintaxis

-
var alturaDelViewport = window.innerHeight;
+
var alturaDelViewport = window.innerHeight;

Valor

@@ -22,7 +24,7 @@

Valor

La propiedad window.innerHeight es solo de lectura; Y no tiene un valor por defecto.

-

Notas .

+

Notas

La propiedad innerHeight es soportada por cualquier objeto de ventana. Pudiendo ejectutarse en un conjunto de marcos (<frameset> </frameset>). O en una ventana secundaria.

@@ -32,7 +34,7 @@

Asumiendo un frameset

-
var alturaViewport = window.innerHeight;
+
var alturaViewport = window.innerHeight;
 
 var alturaViewport = self.innerHeight;
 // self es window
@@ -40,7 +42,7 @@ 

Asumiendo un frameset

-

//otra forma de obtener la altura (aúnque, no del viewport, síno de la ventana), es usando la propiedad outerHeight, del objeto window.

+

otra forma de obtener la altura (aúnque, no del viewport, síno de la ventana), es usando la propiedad outerHeight, del objeto window.

Ejemplo (Grafica)

diff --git a/files/es/web/api/window/load_event/index.html b/files/es/web/api/window/load_event/index.html index 1b0a11234c2cc2..0641572adb4419 100644 --- a/files/es/web/api/window/load_event/index.html +++ b/files/es/web/api/window/load_event/index.html @@ -6,15 +6,17 @@ translation_of: Web/API/Window/load_event original_slug: Web/Events/load --- +

{{ APIRef }}

+

El evento load se dispara cuando un recurso y sus recursos dependientes han terminado de cargar.

Ejemplos

-

Window

+

Window

-
<script>
+
<script>
   window.addEventListener("load", function(event) {
     console.log("'Todos los recursos terminaron de cargar!");
   });
@@ -22,7 +24,7 @@ 

Window

Elemento script

-
<script>
+
<script>
   var script = document.createElement("script");
   script.addEventListener("load", function(event) {
     console.log("Script terminó de cargarse y ejecutarse");
diff --git a/files/es/web/api/window/localstorage/index.html b/files/es/web/api/window/localstorage/index.html
index ed3d1054aa6762..34dd09503c0627 100644
--- a/files/es/web/api/window/localstorage/index.html
+++ b/files/es/web/api/window/localstorage/index.html
@@ -22,7 +22,7 @@
 
 

Sintaxis

-
miStorage = window.localStorage;
+
miStorage = window.localStorage;

Valor

@@ -39,7 +39,7 @@

Ejemplo

El siguiente código accede al objeto local {{DOMxRef("Storage")}} actual y agrega un ítem al mismo usando {{DOMxRef("Storage.setItem()")}}.

-
localStorage.setItem('miGato', 'Juan');
+
localStorage.setItem('miGato', 'Juan');

Nota: Por favor ver el articulo Usando la Web Storage API para un ejemplo completo.

@@ -47,15 +47,15 @@

Ejemplo

La sintaxis para leer el ítem almacenado en localStorage es la siguiente:

-
var cat = localStorage.getItem('miGato');
+
var cat = localStorage.getItem('miGato');

La sintaxis para eliminar el ítem almacenado en localStorage es la siguiente:

-
localStorage.removeItem('miGato');
+
localStorage.removeItem('miGato');

La sintaxis para eliminar todos los ítems almacenados en localStorage es la siguiente:

-
// Elimina todos los elementos
+
// Elimina todos los elementos
 localStorage.clear();
 
diff --git a/files/es/web/api/window/location/index.html b/files/es/web/api/window/location/index.html index eb3caa6edd0e50..dc9231dce8704c 100644 --- a/files/es/web/api/window/location/index.html +++ b/files/es/web/api/window/location/index.html @@ -15,7 +15,7 @@

Sintaxis

-
var oldLocation = location;
+
var oldLocation = location;
 location = newLocation;
 
@@ -23,25 +23,25 @@

Ejemplos

Ejemplo básico

-
alert(location); // alerts "https://developer.mozilla.org/en-US/docs/Web/API/Window.location"
+
alert(location); // alerts "https://developer.mozilla.org/en-US/docs/Web/API/Window.location"

Ejemplo #1: Navegar a una nueva página

Cuando un nuevo valor es asignado a un objeto location, un documento será cargado usando la URL como si location.assing() fuera llamada con la URL modificada. Note que configuraciones de seguridad como CORS, esto puede ser prevenido cuando pase.

-
location.assign("http://www.mozilla.org"); // o
+
location.assign("http://www.mozilla.org"); // o
 location = "http://www.mozilla.org";
 

Ejemplo #2: Forzar la recarga de una página desde el servidor

-
location.reload(true);
+
location.reload(true);

Ejemplo #3

Considerando el siguiente ejemplo, el cual recargará la página usando el método replace() para insertar un valor de location.pathname dentro del hash:

-
function reloadPageWithHash() {
+
function reloadPageWithHash() {
   var initialPage = location.pathname;
   location.replace('http://example.com/#' + initialPage);
 }
@@ -51,7 +51,7 @@ 

Ejemplo #3

Ejemplo #4: Muestra las propiedades de la URL actual en una ventana emergente:

-
function showLoc() {
+
function showLoc() {
   var oLocation = location, aLog = ["Property (Typeof): Value", "location (" + (typeof oLocation) + "): " + oLocation ];
   for (var sProp in oLocation){
     aLog.push(sProp + " (" + (typeof oLocation[sProp]) + "): " +  (oLocation[sProp] || "n/a"));
@@ -64,7 +64,7 @@ 

Ejemplo #5: Enviar una cadena de caracteres de datos al servidor por modificar la propiedad search:

-
function sendData (sData) {
+
function sendData (sData) {
   location.search = sData;
 }
 
@@ -75,7 +75,7 @@ 

Ejemplo #6: Usando marcadores sin cambiar la propiedad hash:

-
<!doctype html>
+
<!doctype html>
 <html>
 <head>
 <meta charset="UTF-8"/>
@@ -135,7 +135,7 @@ 

Ejemplo #6: U

…De igual manera pero con un scroll animado:

-
var showBookmark = (function () {
+
var showBookmark = (function () {
   var  _useHash, _scrollX, _scrollY, _nodeX, _nodeY, _itFrame, _scrollId = -1, _bookMark,
        /*
        * nDuration: the duration in milliseconds of each frame
diff --git a/files/es/web/api/window/locationbar/index.html b/files/es/web/api/window/locationbar/index.html
index 80832c27a0f423..cb056fd141cbc8 100644
--- a/files/es/web/api/window/locationbar/index.html
+++ b/files/es/web/api/window/locationbar/index.html
@@ -13,14 +13,14 @@ 

Resumen

Sintaxis

-
objRef = window.locationbar
+
objRef = window.locationbar
 

Ejemplo

El siguiente ejemplo completo en HTML, muestra la forma en la que se utiliza la propiedad visible del objeto locationbar.

-
<!DOCTYPE html>
+
<!DOCTYPE html>
 <html lang="en">
 <head>
 <meta charset="UTF-8" />
diff --git a/files/es/web/api/window/matchmedia/index.html b/files/es/web/api/window/matchmedia/index.html
index de4ed1dee39758..a443825c408854 100644
--- a/files/es/web/api/window/matchmedia/index.html
+++ b/files/es/web/api/window/matchmedia/index.html
@@ -17,7 +17,7 @@
 
 

Sintaxis

-
mql = window.matchMedia(mediaQueryString)
+
mql = window.matchMedia(mediaQueryString)

Donde mediaQueryString es una cadena de texto que representa la media query de la que devolver un nuevo objeto {{domxref("MediaQueryList")}}.

@@ -25,7 +25,7 @@

Ejemplo

Este código le permite manejar las cosas de forma diferente cuando la ventana es muy estrecha.

-
if (window.matchMedia("(min-width: 400px)").matches) {
+
if (window.matchMedia("(min-width: 400px)").matches) {
   /* La pantalla tiene al menos 400 píxeles de ancho */
 } else {
   /* La pantalla tiene menos de 400 píxeles de ancho */
diff --git a/files/es/web/api/window/menubar/index.html b/files/es/web/api/window/menubar/index.html
index 4044836c82e0e0..9ed7626d3b5660 100644
--- a/files/es/web/api/window/menubar/index.html
+++ b/files/es/web/api/window/menubar/index.html
@@ -11,14 +11,14 @@ 

Resumen

Sintaxis

-
objRef = window.menubar
+
objRef = window.menubar
 

Ejemplo

El siguiente ejemplo HTML completo muestra la forma en que es utilizada la propiedad visible del objeto menubar.

-
<html>
+
<html>
 <head>
   <title>Various DOM Tests</title>
   <script>
diff --git a/files/es/web/api/window/moveby/index.html b/files/es/web/api/window/moveby/index.html
index 463ded8ee40faa..ff7b9b1a1f055c 100644
--- a/files/es/web/api/window/moveby/index.html
+++ b/files/es/web/api/window/moveby/index.html
@@ -11,7 +11,7 @@ 

Resumen

Sintaxis

-
window.moveBy(deltaX, deltaY)
+
window.moveBy(deltaX, deltaY)
 

Parametros

@@ -23,7 +23,7 @@

Parametros

Ejemplo

-
function budge() {
+
function budge() {
   moveBy(10, -10);
 }
diff --git a/files/es/web/api/window/navigator/index.html b/files/es/web/api/window/navigator/index.html index 00c9617213aafe..eaade8c80bcb0d 100644 --- a/files/es/web/api/window/navigator/index.html +++ b/files/es/web/api/window/navigator/index.html @@ -19,11 +19,11 @@ La propiedad de solo lectura Window.navigator es una referencia al objeto {{domxref("Navigator")}}, el cual puede ser utilizado para obtener información sobre la aplicación que está ejecutando el script.

Sintaxis

-
navigatorObject = window.navigator
+
navigatorObject = window.navigator

Ejemplos

Ejemplo #1: Detectar un navegador y retornar un string

-
var sBrowser, sUsrAg = navigator.userAgent;
+
var sBrowser, sUsrAg = navigator.userAgent;
 
 if(sUsrAg.indexOf("Chrome") > -1) {
     sBrowser = "Google Chrome";
@@ -39,7 +39,7 @@ 

Ejemplo #1: Detect alert("Usted está utilizando: " + sBrowser);

Ejemplo #2: Detectar un navegador y retornar un índice

-
function obtenerIdNavegador() {
+
function obtenerIdNavegador() {
     var
         aKeys = ["MSIE", "Firefox", "Safari", "Chrome", "Opera"],
         sUsrAg = navigator.userAgent, nIdx = aKeys.length - 1;
diff --git a/files/es/web/api/window/open/index.html b/files/es/web/api/window/open/index.html
index 148452c6c29543..62669d6399b5a7 100644
--- a/files/es/web/api/window/open/index.html
+++ b/files/es/web/api/window/open/index.html
@@ -9,15 +9,15 @@
 
 

Sintaxis

-
var referencia_objeto_window = window.open([url],[nombre_de_la_ventana],[configuracion_ventana]);
+
var referencia_objeto_window = window.open([url],[nombre_de_la_ventana],[configuracion_ventana]);

Parámetros

referencia_objeto_window
-
Una referencia de la ventana creada. La referencia puede ser usada para acceder a propiedades y métodos de la nueva ventana.
+
Una referencia de la ventana creada. La referencia puede ser usada para acceder a propiedades y métodos de la nueva ventana.
url (opcional)
-
La URL especifica que página se va cargar en la ventana creada. La URL puede ser una página web (http://www.ejemplo.com.co) o un documento que se encuentre en algun directorio de su PC (html, imagenes y demás). Si no se expecifica una URL, por defecto abrira la ventana en blanco
+
La URL especifica que página se va cargar en la ventana creada. La URL puede ser una página web (http://www.ejemplo.com.co) o un documento que se encuentre en algun directorio de su PC (html, imagenes y demás). Si no se expecifica una URL, por defecto abrira la ventana en blanco
nombre_de_la_ventana (opcional)
Un nombre para la nueva ventana. El nombre puede ser usado como el destino de enlaces y formularios usando el atributo de un elemento {{HTMLElement("a")}} ó {{HTMLElement("form")}}. El nombre no debe contener ningun caracter de espacio en blanco. Notese que nombre_de_la_ventana no especifica el titulo de la nueva ventana.
strWindowFeatures
@@ -26,13 +26,13 @@

Parámet

Descripción

-

El metodo open() crea una nueva ventana secundaria del navegador, similar a seleccionar Nueva ventana desde el menú archivo. El parámetro url especifica la URL a ser solicitada y cargada en la nueva ventana. Si url es una cadena de caracteres vacia, entonces se creará una nueva ventana en blanco (URL about:blank) con las barras de herramientas por defecto de la ventana principal.

+

El metodo open() crea una nueva ventana secundaria del navegador, similar a seleccionar Nueva ventana desde el menú archivo. El parámetro url especifica la URL a ser solicitada y cargada en la nueva ventana. Si url es una cadena de caracteres vacia, entonces se creará una nueva ventana en blanco (URL about:blank) con las barras de herramientas por defecto de la ventana principal.

Observe que las URLs no cargarán inmediatamente. Cuando window.open() retorna, la ventana siempre contiene about:blank. La solicitud de la URL es diferida y comienza luego de que el bloque actual se termine de ejecutar. La creación de la ventana y la carga de los recursos referenciados suceden de forma asíncrona.

Ejemplo

-
var objeto_window_referencia;
+
var objeto_window_referencia;
 var configuracion_ventana = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
 
 function abrir_Popup() {
@@ -47,7 +47,7 @@ 

Ejemplo

-
var windowObjectReference;
+
var windowObjectReference;
 
 function openRequestedPopup() {
   windowObjectReference = window.open(
@@ -68,7 +68,7 @@ 

Ejemplo

If the strWindowFeatures parameter is used, the features that are not listed will be disabled or removed (except titlebar and close which are by default yes).

-

Tip: If using the strWindowFeatures parameter, only list the features to be enabled or rendered; the others (except titlebar and close) will be disabled or removed.

+

If using the strWindowFeatures parameter, only list the features to be enabled or rendered; the others (except titlebar and close) will be disabled or removed.

Note that in some browsers, users can override the strWindowFeatures settings and enable (or prevent the disabling of) features.

@@ -79,47 +79,33 @@

Caracterí

Note on position and dimension error correction

-
{{bug(176320)}}
+
{{bug(176320)}}

Note on precedence

left
-
Specifies the distance the new window is placed from the left side of the work area for applications of the user's operating system to the leftmost border (resizing handle) of the browser window. The new window can not be initially positioned offscreen.
-
Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
+
Specifies the distance the new window is placed from the left side of the work area for applications of the user's operating system to the leftmost border (resizing handle) of the browser window. The new window can not be initially positioned offscreen. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
top
-
Specifies the distance the new window is placed from the top side of the work area for applications of the user's operating system to the topmost border (resizing handle) of the browser window. The new window can not be initially positioned offscreen.
-
Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
+
Specifies the distance the new window is placed from the top side of the work area for applications of the user's operating system to the topmost border (resizing handle) of the browser window. The new window can not be initially positioned offscreen. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
height
-
Specifies the height of the content area, viewing area of the new secondary window in pixels. The height value includes the height of the horizontal scrollbar if present. The minimum required value is 100.
-
Note on outerHeight versus height (or innerHeight)
-
Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
+
Specifies the height of the content area, viewing area of the new secondary window in pixels. The height value includes the height of the horizontal scrollbar if present. The minimum required value is 100. Note on outerHeight versus height (or innerHeight) Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
width
-
Specifies the width of the content area, viewing area of the new secondary window in pixels. The width value includes the width of the vertical scrollbar if present. The width value does not include the sidebar if it is expanded. The minimum required value is 100.
-
Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
+
Specifies the width of the content area, viewing area of the new secondary window in pixels. The width value includes the width of the vertical scrollbar if present. The width value does not include the sidebar if it is expanded. The minimum required value is 100. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
screenX
-
Deprecated. Same as left but only supported by Netscape and Mozilla-based browsers.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
Deprecated. Same as left but only supported by Netscape and Mozilla-based browsers. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
screenY
-
Deprecated. Same as top but only supported by Netscape and Mozilla-based browsers.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
Deprecated. Same as top but only supported by Netscape and Mozilla-based browsers. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
centerscreen
Centers the window in relation to its parent's size and position. Requires chrome=yes.
outerHeight
-
Specifies the height of the whole browser window in pixels. This outerHeight value includes any/all present toolbar, window horizontal scrollbar (if present) and top and bottom window resizing borders. Minimal required value is 100.
-
Note: since titlebar is always rendered, then requesting outerHeight=100 will make the innerHeight of the browser window under the minimal 100 pixels.
-
Note on outerHeight versus height (or innerHeight)
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
Specifies the height of the whole browser window in pixels. This outerHeight value includes any/all present toolbar, window horizontal scrollbar (if present) and top and bottom window resizing borders. Minimal required value is 100. Note: since titlebar is always rendered, then requesting outerHeight=100 will make the innerHeight of the browser window under the minimal 100 pixels. Note on outerHeight versus height (or innerHeight) Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
outerWidth
-
Specifies the width of the whole browser window in pixels. This outerWidth value includes the window vertical scrollbar (if present) and left and right window resizing borders.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
Specifies the width of the whole browser window in pixels. This outerWidth value includes the window vertical scrollbar (if present) and left and right window resizing borders. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
innerHeight
-
Same as height but only supported by Netscape and Mozilla-based browsers. Specifies the height of the content area, viewing area of the new secondary window in pixels. The innerHeight value includes the height of the horizontal scrollbar if present. Minimal required value is 100.
-
Note on outerHeight versus height (or innerHeight)
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
Same as height but only supported by Netscape and Mozilla-based browsers. Specifies the height of the content area, viewing area of the new secondary window in pixels. The innerHeight value includes the height of the horizontal scrollbar if present. Minimal required value is 100. Note on outerHeight versus height (or innerHeight) Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
innerWidth
-
Same as width but only supported by Netscape and Mozilla-based browsers. Specifies the width of the content area, viewing area of the new secondary window in pixels. The innerWidth value includes the width of the vertical scrollbar if present. The innerWidth value does not include the sidebar if it is expanded. Minimal required value is 100.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
Same as width but only supported by Netscape and Mozilla-based browsers. Specifies the width of the content area, viewing area of the new secondary window in pixels. The innerWidth value includes the width of the vertical scrollbar if present. The innerWidth value does not include the sidebar if it is expanded. Minimal required value is 100. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x

Barra de herramienta y características de chrome

@@ -129,27 +115,17 @@

Barra de
example "status=yes", "status=1" and "status" have identical results
menubar
-
If this feature is on, then the new secondary window renders the menubar.
-
Mozilla and Firefox users can force new windows to always render the menubar by setting dom.disable_window_open_feature.menubar to true in about:config or in their user.js file.
-
Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
If this feature is on, then the new secondary window renders the menubar. Mozilla and Firefox users can force new windows to always render the menubar by setting dom.disable_window_open_feature.menubar to true in about:config or in their user.js file. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
toolbar
-
If this feature is on, then the new secondary window renders the Navigation Toolbar (Back, Forward, Reload, Stop buttons). In addition to the Navigation Toolbar, Mozilla-based browsers will render the Tab Bar if it is visible, present in the parent window. (If this feature is set to no all toolbars in the window will be invisible, for example extension toolbars).
-
Mozilla and Firefox users can force new windows to always render the Navigation Toolbar by setting dom.disable_window_open_feature.toolbar to true in about:config or in their user.js file.
-
Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
If this feature is on, then the new secondary window renders the Navigation Toolbar (Back, Forward, Reload, Stop buttons). In addition to the Navigation Toolbar, Mozilla-based browsers will render the Tab Bar if it is visible, present in the parent window. (If this feature is set to no all toolbars in the window will be invisible, for example extension toolbars). Mozilla and Firefox users can force new windows to always render the Navigation Toolbar by setting dom.disable_window_open_feature.toolbar to true in about:config or in their user.js file. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
location
-
If this feature is on, then the new secondary window renders the Location bar in Mozilla-based browsers. MSIE 5+ and Opera 7.x renders the Address Bar.
-
Mozilla and Firefox users can force new windows to always render the location bar by setting dom.disable_window_open_feature.location to true in about:config or in their user.js file. {{Fx_minversion_note(3, "In Firefox 3, dom.disable_window_open_feature.location now defaults to true, forcing the presence of the Location Bar much like in IE7. See bug 337344 for more information.")}}
-
Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
+
If this feature is on, then the new secondary window renders the Location bar in Mozilla-based browsers. MSIE 5+ and Opera 7.x renders the Address Bar. Mozilla and Firefox users can force new windows to always render the location bar by setting dom.disable_window_open_feature.location to true in about:config or in their user.js file. {{Fx_minversion_note(3, "In Firefox 3, dom.disable_window_open_feature.location now defaults to true, forcing the presence of the Location Bar much like in IE7. See bug 337344 for more information.")}} Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
personalbar
-
If this feature is on, then the new secondary window renders the Personal Toolbar in Netscape 6.x, Netscape 7.x and Mozilla browser. It renders the Bookmarks Toolbar in Firefox. In addition to the Personal Toolbar, Mozilla browser will render the Site Navigation Bar if such toolbar is visible, present in the parent window.
-
Mozilla and Firefox users can force new windows to always render the Personal Toolbar/Bookmarks toolbar by setting dom.disable_window_open_feature.personalbar to true in about:config or in their user.js file.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
If this feature is on, then the new secondary window renders the Personal Toolbar in Netscape 6.x, Netscape 7.x and Mozilla browser. It renders the Bookmarks Toolbar in Firefox. In addition to the Personal Toolbar, Mozilla browser will render the Site Navigation Bar if such toolbar is visible, present in the parent window. Mozilla and Firefox users can force new windows to always render the Personal Toolbar/Bookmarks toolbar by setting dom.disable_window_open_feature.personalbar to true in about:config or in their user.js file. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
directories {{obsolete_inline("2")}}
Obsolete synonym of personalbar. In IE, it rendered the Links bar. Supported in Gecko up to 1.9.2 and in IE up to 6.
status
-
If this feature is on, then the new secondary window has a status bar. Users can force the rendering of status bar in all Mozilla-based browsers, in MSIE 6 SP2 (Note on status bar in XP SP2) and in Opera 6+. The default preference setting in recent Mozilla-based browser releases and in Firefox 1.0 is to force the presence of the status bar.
-
Note on status bar
-
Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
If this feature is on, then the new secondary window has a status bar. Users can force the rendering of status bar in all Mozilla-based browsers, in MSIE 6 SP2 (Note on status bar in XP SP2) and in Opera 6+. The default preference setting in recent Mozilla-based browser releases and in Firefox 1.0 is to force the presence of the status bar. Note on status bar Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x

@@ -159,48 +135,31 @@

Cara
attention {{NonStandardBadge}}
-
If this feature is specified, the window is able to open even if another application is already in the foreground. This feature is for Firefox OS applications only, and is currently restricted to certified applications. See {{SectionOnPage("/en-US/docs/Archive/B2G_OS/Firefox_OS_apps/App_permissions", "Internal (Certified) app permissions")}} for more information.
-
Supported in:
+
If this feature is specified, the window is able to open even if another application is already in the foreground. This feature is for Firefox OS applications only, and is currently restricted to certified applications. See {{SectionOnPage("/en-US/docs/Archive/B2G_OS/Firefox_OS_apps/App_permissions", "Internal (Certified) app permissions")}} for more information. Supported in:
dependent
-
If on, the new window is said to be dependent of its parent window. A dependent window closes when its parent window closes. A dependent window is minimized on the Windows task bar only when its parent window is minimized. On Windows platforms, a dependent window does not show on the task bar. A dependent window also stays in front of the parent window.
-
Dependent windows are not implemented on MacOS X, this option will be ignored.
-
The dependent feature is currently under revision to be removed ({{Bug(214867)}})
-
In MSIE 6, the nearest equivalent to this feature is the showModelessDialog() method.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
If on, the new window is said to be dependent of its parent window. A dependent window closes when its parent window closes. A dependent window is minimized on the Windows task bar only when its parent window is minimized. On Windows platforms, a dependent window does not show on the task bar. A dependent window also stays in front of the parent window. Dependent windows are not implemented on MacOS X, this option will be ignored. The dependent feature is currently under revision to be removed ({{Bug(214867)}}) In MSIE 6, the nearest equivalent to this feature is the showModelessDialog() method. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
minimizable
-
This setting can only apply to dialog windows; "minimizable" requires dialog=yes. If minimizable is on, the new dialog window will have a minimize system command icon in the titlebar and it will be minimizable. Any non-dialog window is always minimizable and minimizable=no will be ignored.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
This setting can only apply to dialog windows; "minimizable" requires dialog=yes. If minimizable is on, the new dialog window will have a minimize system command icon in the titlebar and it will be minimizable. Any non-dialog window is always minimizable and minimizable=no will be ignored. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
fullscreen
-
Do not use. Not implemented in Mozilla. There are no plans to implement this feature in Mozilla.
-
This feature no longer works in MSIE 6 SP2 the way it worked in MSIE 5.x. The Windows taskbar, as well as the titlebar and the status bar of the window are not visible, nor accessible when fullscreen is enabled in MSIE 5.x.
-
fullscreen always upsets users with large monitor screen or with dual monitor screen. Forcing fullscreen onto other users is also extremely unpopular and is considered an outright rude attempt to impose web author's viewing preferences onto users.
-
Note on fullscreen
-
Supported in: Internet Explorer 5+
-
fullscreen does not really work in MSIE 6 SP2.
+
Do not use. Not implemented in Mozilla. There are no plans to implement this feature in Mozilla. This feature no longer works in MSIE 6 SP2 the way it worked in MSIE 5.x. The Windows taskbar, as well as the titlebar and the status bar of the window are not visible, nor accessible when fullscreen is enabled in MSIE 5.x. fullscreen always upsets users with large monitor screen or with dual monitor screen. Forcing fullscreen onto other users is also extremely unpopular and is considered an outright rude attempt to impose web author's viewing preferences onto users. Note on fullscreen Supported in: Internet Explorer 5+ fullscreen does not really work in MSIE 6 SP2.
resizable
-
If this feature is on, the new secondary window will be resizable.
-
Note: Starting with version 1.4, Mozilla-based browsers have a window resizing grippy at the right end of the status bar, this ensures that users can resize the browser window even if the web author requested this secondary window to be non-resizable. In such case, the maximize/restore icon in the window's titlebar will be disabled and the window's borders won't allow resizing but the window will still be resizable via that grippy in the status bar. +
If this feature is on, the new secondary window will be resizable. Note: Starting with version 1.4, Mozilla-based browsers have a window resizing grippy at the right end of the status bar, this ensures that users can resize the browser window even if the web author requested this secondary window to be non-resizable. In such case, the maximize/restore icon in the window's titlebar will be disabled and the window's borders won't allow resizing but the window will still be resizable via that grippy in the status bar.

Starting with Firefox 3, secondary windows are always resizable ({{Bug(177838)}})

Tip: For accessibility reasons, it is strongly recommended to set this feature always on

-
-
Mozilla and Firefox users can force new windows to be easily resizable by setting
+ Mozilla and Firefox users can force new windows to be easily resizable by setting
dom.disable_window_open_feature.resizable
- to true in about:config or in their user.js file.
-
Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+ to true in about:config or in their user.js file. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
scrollbars
If this feature is on, the new secondary window will show horizontal and/or vertical scrollbar(s) if the document doesn't fit into the window's viewport.

Tip: For accessibility reasons, it is strongly encouraged to set this feature always on.

-
-
Mozilla and Firefox users can force this option to be always enabled for new windows by setting
+ Mozilla and Firefox users can force this option to be always enabled for new windows by setting
dom.disable_window_open_feature.scrollbars
- to true in about:config or in their user.js file.
-
Note on scrollbars
-
Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+ to true in about:config or in their user.js file. Note on scrollbars Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x

Características que requieren privilegios

@@ -209,49 +168,36 @@

Cara
chrome
-
Note: Starting with Mozilla 1.7/Firefox 0.9, this feature requires the UniversalBrowserWrite privilege ({{Bug(244965)}}). Without this privilege, it is ignored.
-
If on, the page is loaded as window's only content, without any of the browser's interface elements. There will be no context menu defined by default and none of the standard keyboard shortcuts will work. The page is supposed to provide a user interface of its own, usually this feature is used to open XUL documents (standard dialogs like the JavaScript Console are opened this way).
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
Note: Starting with Mozilla 1.7/Firefox 0.9, this feature requires the UniversalBrowserWrite privilege ({{Bug(244965)}}). Without this privilege, it is ignored. If on, the page is loaded as window's only content, without any of the browser's interface elements. There will be no context menu defined by default and none of the standard keyboard shortcuts will work. The page is supposed to provide a user interface of its own, usually this feature is used to open XUL documents (standard dialogs like the JavaScript Console are opened this way). Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
dialog
-
Note: Starting with Firefox 44, this feature can only be used with chrome privileges. If content attempts to toggle this feature, it will be ignored.
-
MenuSystemCommands.pngThe dialog feature removes all icons (restore, minimize, maximize) from the window's titlebar, leaving only the close button. Mozilla 1.2+ and Netscape 7.1 will render the other menu system commands (in FF 1.0 and in NS 7.0x, the command system menu is not identified with the Firefox/NS 7.0x icon on the left end of the titlebar: that's probably a bug. You can access the command system menu with a right-click on the titlebar). Dialog windows are windows which have no minimize system command icon and no maximize/restore down system command icon on the titlebar nor in correspondent menu item in the command system menu. They are said to be dialog because their normal, usual purpose is to only notify info and to be dismissed, closed. On Mac systems, dialog windows have a different window border and they may get turned into a sheet.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
Note: Starting with Firefox 44, this feature can only be used with chrome privileges. If content attempts to toggle this feature, it will be ignored. MenuSystemCommands.pngThe dialog feature removes all icons (restore, minimize, maximize) from the window's titlebar, leaving only the close button. Mozilla 1.2+ and Netscape 7.1 will render the other menu system commands (in FF 1.0 and in NS 7.0x, the command system menu is not identified with the Firefox/NS 7.0x icon on the left end of the titlebar: that's probably a bug. You can access the command system menu with a right-click on the titlebar). Dialog windows are windows which have no minimize system command icon and no maximize/restore down system command icon on the titlebar nor in correspondent menu item in the command system menu. They are said to be dialog because their normal, usual purpose is to only notify info and to be dismissed, closed. On Mac systems, dialog windows have a different window border and they may get turned into a sheet. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
modal
-
Note: Starting with Mozilla 1.2.1, this feature requires the UniversalBrowserWrite privilege ({{Bug(180048)}}). Without this privilege, it is ignored.
-
If on, the new window is said to be modal. The user cannot return to the main window until the modal window is closed. A typical modal window is created by the alert() function.
-
The exact behavior of modal windows depends on the platform and on the Mozilla release version. +
Note: Starting with Mozilla 1.2.1, this feature requires the UniversalBrowserWrite privilege ({{Bug(180048)}}). Without this privilege, it is ignored. If on, the new window is said to be modal. The user cannot return to the main window until the modal window is closed. A typical modal window is created by the alert() function. The exact behavior of modal windows depends on the platform and on the Mozilla release version.

Note: As of {{Gecko("1.9")}}, the Internet Explorer equivalent to this feature is the {{domxref("window.showModalDialog()")}} method. For compatibility reasons, it's now supported in Firefox. Note also that starting in {{Gecko("2.0")}}, you can use {{domxref("window.showModalDialog()")}} without UniversalBrowserWrite privileges.

-
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+ Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
titlebar
-
By default, all new secondary windows have a titlebar. If set to no or 0, this feature removes the titlebar from the new secondary window.
-
Mozilla and Firefox users can force new windows to always render the titlebar by setting
+
By default, all new secondary windows have a titlebar. If set to no or 0, this feature removes the titlebar from the new secondary window. Mozilla and Firefox users can force new windows to always render the titlebar by setting
dom.disable_window_open_feature.titlebar
- to true in about:config or in their user.js file.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+ to true in about:config or in their user.js file. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
alwaysRaised
-
If on, the new window will always be displayed on top of other browser windows, regardless of whether it is active or not.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
If on, the new window will always be displayed on top of other browser windows, regardless of whether it is active or not. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
alwaysLowered
-
If on, the new created window floats below, under its own parent when the parent window is not minimized. alwaysLowered windows are often referred as pop-under windows. The alwaysLowered window can not be on top of the parent but the parent window can be minimized. In NS 6.x, the alwaysLowered window has no minimize system command icon and no restore/maximize system command.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+
If on, the new created window floats below, under its own parent when the parent window is not minimized. alwaysLowered windows are often referred as pop-under windows. The alwaysLowered window can not be on top of the parent but the parent window can be minimized. In NS 6.x, the alwaysLowered window has no minimize system command icon and no restore/maximize system command. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
z-lock
Same as alwaysLowered.
close
-
When set to no or 0, this feature removes the system close command icon and system close menu item. It will only work for dialog windows (dialog feature set). close=no will override minimizable=yes.
-
Mozilla and Firefox users can force new windows to always have a close button by setting
+
When set to no or 0, this feature removes the system close command icon and system close menu item. It will only work for dialog windows (dialog feature set). close=no will override minimizable=yes. Mozilla and Firefox users can force new windows to always have a close button by setting
dom.disable_window_open_feature.close
- to true in about:config or in their user.js file.
-
Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
+ to true in about:config or in their user.js file. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x

The position and size feature elements require a number to be set. The toolbars and window functionalities can be set with a yes or no; you can use 1 instead of yes and 0 instead of no. The toolbar and functionality feature elements also accept the shorthand form: you can turn a feature on by simply listing the feature name in the features string. If you supply the features parameter, then the titlebar and close are still yes by default, but the other features which have a yes/no choice will be no by default and will be turned off.

Example:

-
var windowObjectReference; // global variable
+
var windowObjectReference; // global variable
 
 function openRequestedPopup() {
   windowObjectReference = window.open(
@@ -265,7 +211,7 @@ 

Cara

Buenas prácticas

-
<script type="text/javascript">
+
<script type="text/javascript">
 var windowObjectReference = null; // global variable
 
 function openFFPromotionPopup() {
@@ -310,7 +256,7 @@ 

Buenas prácticas

You can also parameterize the function to make it versatile, functional in more situations, therefore re-usable in scripts and webpages:

-
<script type="text/javascript">
+
<script type="text/javascript">
 var windowObjectReference = null; // global variable
 
 function openRequestedPopup(strUrl, strWindowName) {
@@ -335,7 +281,7 @@ 

Buenas prácticas

You can also make such function able to open only 1 secondary window and to reuse such single secondary window for other links in this manner:

-
<script type="text/javascript">
+
<script type="text/javascript">
 var windowObjectReference = null; // global variable
 var PreviousUrl; /* global variable which will store the
                     url currently in the secondary window */
@@ -382,8 +328,7 @@ 

FAQ

How can I prevent the confirmation message asking the user whether he wants to close the window?
-
You can not. New windows not opened by javascript can not as a rule be closed by JavaScript. The JavaScript Console in Mozilla-based browsers will report the warning message: "Scripts may not close windows that were not opened by script." Otherwise the history of URLs visited during the browser session would be lost.
-
More on the window.close() method
+
You can not. New windows not opened by javascript can not as a rule be closed by JavaScript. The JavaScript Console in Mozilla-based browsers will report the warning message: "Scripts may not close windows that were not opened by script." Otherwise the history of URLs visited during the browser session would be lost. More on the window.close() method
How can I bring back the window if it is minimized or behind another window?
First check for the existence of the window object reference of such window and if it exists and if it has not been closed, then use the focus() method. There is no other reliable way. You can examine an example explaining how to use the focus() method.
How do I force a maximized window?
@@ -391,13 +336,9 @@

FAQ

How do I turn off window resizability or remove toolbars?
You cannot force this. Users with Mozilla-based browsers have absolute control over window functionalities like resizability, scrollability and toolbars presence via user preferences in about:config. Since your users are the ones who are supposed to use such windows (and not you, being the web author), the best is to avoid interfering with their habits and preferences. We recommend to always set the resizability and scrollbars presence (if needed) to yes to insure accessibility to content and usability of windows. This is in the best interests of both the web author and the users.
How do I resize a window to fit its content?
-
You can not reliably because the users can prevent the window from being resized by unchecking the Edit/Preferences/Advanced/Scripts & Plug-ins/Allow Scripts to/ Move or resize existing windows checkbox in Mozilla or Tools/Options.../Content tab/Enable Javascript/Advanced button/Move or resize existing windows checkbox in Firefox or by setting dom.disable_window_move_resize to true in about:config or by editing accordingly their user.js file.
-
In general, users usually disable moving and resizing of existing windows because allowing authors' scripts to do so has been abused overwhelmingly in the past and the rare scripts that do not abuse such feature are often wrong, inaccurate when resizing the window. 99% of all those scripts disable window resizability and disable scrollbars when in fact they should enable both of these features to allow a cautious and sane fallback mechanism if their calculations are wrong.
-
The window method sizeToContent() is also disabled if the user unchecks the preference Move or resize existing windows checkbox. Moving and resizing a window remotely on the user's screen via script will very often annoy the users, will disorient the user, and will be wrong at best. The web author expects to have full control of (and can decide about) every position and size aspects of the users' browser window ... which is simply not true.
+
You can not reliably because the users can prevent the window from being resized by unchecking the Edit/Preferences/Advanced/Scripts & Plug-ins/Allow Scripts to/ Move or resize existing windows checkbox in Mozilla or Tools/Options.../Content tab/Enable Javascript/Advanced button/Move or resize existing windows checkbox in Firefox or by setting dom.disable_window_move_resize to true in about:config or by editing accordingly their user.js file. In general, users usually disable moving and resizing of existing windows because allowing authors' scripts to do so has been abused overwhelmingly in the past and the rare scripts that do not abuse such feature are often wrong, inaccurate when resizing the window. 99% of all those scripts disable window resizability and disable scrollbars when in fact they should enable both of these features to allow a cautious and sane fallback mechanism if their calculations are wrong. The window method sizeToContent() is also disabled if the user unchecks the preference Move or resize existing windows checkbox. Moving and resizing a window remotely on the user's screen via script will very often annoy the users, will disorient the user, and will be wrong at best. The web author expects to have full control of (and can decide about) every position and size aspects of the users' browser window ... which is simply not true.
How do I open a referenced resource of a link in a new tab? or in a specific tab?
-
To open a resource in a new tab see Tabbed browser. Some Code snippets are available. If you are using the SDK, tabs are handled a bit differently
-
K-meleon 1.1, a Mozilla-based browser, gives complete control and power to the user regarding how links are opened. Only the user can set his advanced preferences to do that. Some advanced extensions also give Mozilla and Firefox a lot of power over how referenced resources are loaded.
-
In a few years, the target property of the CSS3 hyperlink module may be implemented (if CSS3 Hyperlink module as it is right now is approved). And even if and when this happens, you can expect developers of browsers with tab-browsing to give the user entire veto power and full control over how links can open web pages. How to open a link should always be entirely under the control of the user.
+
To open a resource in a new tab see Tabbed browser. Some Code snippets are available. If you are using the SDK, tabs are handled a bit differently K-meleon 1.1, a Mozilla-based browser, gives complete control and power to the user regarding how links are opened. Only the user can set his advanced preferences to do that. Some advanced extensions also give Mozilla and Firefox a lot of power over how referenced resources are loaded. In a few years, the target property of the CSS3 hyperlink module may be implemented (if CSS3 Hyperlink module as it is right now is approved). And even if and when this happens, you can expect developers of browsers with tab-browsing to give the user entire veto power and full control over how links can open web pages. How to open a link should always be entirely under the control of the user.
How do I know whether a window I opened is still open?
You can test for the existence of the window object reference which is the returned value in case of success of the window.open() call and then verify that windowObjectReference.closed return value is false.
How can I tell when my window was blocked by a popup blocker?
@@ -405,8 +346,7 @@

FAQ

What is the JavaScript relationship between the main window and the secondary window?
The window.open() method gives a main window a reference to a secondary window; the opener property gives a secondary window a reference to its main window.
I can not access the properties of the new secondary window. I always get an error in the javascript console saying "Error: uncaught exception: Permission denied to get property <property_name or method_name>. Why is that?
-
It is because of the cross-domain script security restriction (also referred as the "Same Origin Policy"). A script loaded in a window (or frame) from a distinct origin (domain name) cannot get nor set properties of another window (or frame) or the properties of any of its HTML objects coming from another distinct origin (domain name). Therefore, before executing a script targeting a secondary window, the browser in the main window will verify that the secondary window has the same domain name.
-
More reading on the cross-domain script security restriction: http://www.mozilla.org/projects/secu...me-origin.html
+
It is because of the cross-domain script security restriction (also referred as the "Same Origin Policy"). A script loaded in a window (or frame) from a distinct origin (domain name) cannot get nor set properties of another window (or frame) or the properties of any of its HTML objects coming from another distinct origin (domain name). Therefore, before executing a script targeting a secondary window, the browser in the main window will verify that the secondary window has the same domain name. More reading on the cross-domain script security restriction: http://www.mozilla.org/projects/secu...me-origin.html

Problemas de usos

@@ -551,7 +491,7 @@

Nota sobre la precedencia<

In cases where left and screenX (and/or top and screenY) have conflicting values, then left and top have precedence over screenX and screenY respectively. If left and screenX (and/or top and screenY) are defined in the features list, then left (and/or top) will be honored and rendered. In the following example the new window will be positioned at 100 pixels from the left side of the work area for applications of the user's operating system, not at 200 pixels.

-
windowObjectReference = window.open(
+
windowObjectReference = window.open(
   "http://news.bbc.co.uk/",
   "BBCWorldNewsWindowName",
   "left=100,screenX=200,resizable,scrollbars,status"
@@ -561,7 +501,7 @@ 

Nota sobre la precedencia<

outerWidth has precedence over width and width has precedence over innerWidth. outerHeight has precedence over height and height has precedence over innerHeight. In the following example, Mozilla-browsers will create a new window with an outerWidth of 600 pixels wide and will ignore the request of a width of 500 pixels and will also ignore the request of an innerWidth of 400 pixels.

-
windowObjectReference = window.open(
+
windowObjectReference = window.open(
   "http://www.wwf.org/",
   "WWildlifeOrgWindowName",
   "outerWidth=600,width=500,innerWidth=400,resizable,scrollbars,status"
@@ -639,7 +579,7 @@ 

Note on refreshing vs. o

If the strWindowName parameter is omitted, a new window or tab is opened. If a window with the same name already exists, the existing window is refreshed.

-
//Always opens a new window/tab
+
//Always opens a new window/tab
 window.open("map.php");
 
 //Refreshes an existing window/tab that was opened with the same name, if one exists
diff --git a/files/es/web/api/window/opener/index.html b/files/es/web/api/window/opener/index.html
index efb0cf410ec2ed..8b788d3ae49215 100644
--- a/files/es/web/api/window/opener/index.html
+++ b/files/es/web/api/window/opener/index.html
@@ -11,12 +11,12 @@ 

Resumen

Sintaxis

-
objRef = window.opener;
+
objRef = window.opener;
 

Ejemplo

-
if (window.opener != indexWin) {
+
if (window.opener != indexWin) {
   referToTop(window.opener);
 }
 
diff --git a/files/es/web/api/window/outerheight/index.html b/files/es/web/api/window/outerheight/index.html index d7177d2b02b61a..a011295f312453 100644 --- a/files/es/web/api/window/outerheight/index.html +++ b/files/es/web/api/window/outerheight/index.html @@ -17,7 +17,7 @@

Sumario

Sintaxis

-
outWindowHeight = window.outerHeight;
+
outWindowHeight = window.outerHeight;
 

Al obtener, outWindowHeight contiene el alto de la ventana.

diff --git a/files/es/web/api/window/outerwidth/index.html b/files/es/web/api/window/outerwidth/index.html index c4ebf6e2b259c4..4aabe1b57ea280 100644 --- a/files/es/web/api/window/outerwidth/index.html +++ b/files/es/web/api/window/outerwidth/index.html @@ -13,7 +13,7 @@

Sumario

Sintaxis

-
outWindowWidth = window.outerWidth;
+
outWindowWidth = window.outerWidth;
 

Lo que retorna outWindowWidth es el ancho exterior del navegador.

diff --git a/files/es/web/api/window/popstate_event/index.html b/files/es/web/api/window/popstate_event/index.html index 720ed48b9b9c51..bdaf4ec8a6a279 100644 --- a/files/es/web/api/window/popstate_event/index.html +++ b/files/es/web/api/window/popstate_event/index.html @@ -16,7 +16,7 @@

Sintaxis

-
window.onpopstate = funcRef;
+
window.onpopstate = funcRef;
 
    @@ -27,7 +27,7 @@

    El evento popstate

    Por ejemplo, la página en http://example.com/example.html ejecutando el código siguiente, generará alertas como se indica.:

    -
    window.onpopstate = function(event) {
    +
    window.onpopstate = function(event) {
       alert("location: " + document.location + ", state: " + JSON.stringify(event.state));
     };
     
    diff --git a/files/es/web/api/window/print/index.html b/files/es/web/api/window/print/index.html
    index 6a49b486a415fc..ae85210666ca7d 100644
    --- a/files/es/web/api/window/print/index.html
    +++ b/files/es/web/api/window/print/index.html
    @@ -23,10 +23,10 @@ 

    Resumen

    Sintaxis

    -
    window.print()
    +
    window.print()
     
    -

    Notas

    +

    Notas

    Empezando con Chrome {{CompatChrome(46.0)}} este método esta bloqueado dentro de un {{htmlelement("iframe")}} a menos que el atributo del contenedor tenga el valor allow-modal.

    @@ -54,5 +54,3 @@

    Ver también

  • {{ domxref("window.onbeforeprint") }}
  • {{ domxref("window.onafterprint") }}
- -

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

diff --git a/files/es/web/api/window/prompt/index.html b/files/es/web/api/window/prompt/index.html index 7baf84c5368be8..7560c8d5ea60aa 100644 --- a/files/es/web/api/window/prompt/index.html +++ b/files/es/web/api/window/prompt/index.html @@ -12,7 +12,7 @@

Sintaxis

-
result = window.prompt(message, default);
+
result = window.prompt(message, default);
 
    @@ -23,7 +23,7 @@

    Sintaxis

    Ejemplo

    -
    var sign = prompt("What's your sign?");
    +
    var sign = prompt("What's your sign?");
     
     if (sign.toLowerCase() == "scorpio") {
       alert("Wow! I'm a Scorpio too!");
    diff --git a/files/es/web/api/window/requestanimationframe/index.html b/files/es/web/api/window/requestanimationframe/index.html
    index 662f7206ed087e..f33680555e6d49 100644
    --- a/files/es/web/api/window/requestanimationframe/index.html
    +++ b/files/es/web/api/window/requestanimationframe/index.html
    @@ -17,7 +17,7 @@
     
     

    Sintaxis

    -
    requestID = window.mozRequestAnimationFrame(callback);   // Firefox
    +
    requestID = window.mozRequestAnimationFrame(callback);   // Firefox
     window.msRequestAnimationFrame(callback);                // IE 10 PP2+
     window.webkitRequestAnimationFrame(callback[, element]); // Chrome/Webkit
     
    @@ -35,9 +35,8 @@

    Valor devuelto

    Ejemplo

    -
    (function() {
    -  var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
    -                              window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
    +
    (function() {
    +  var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
       window.requestAnimationFrame = requestAnimationFrame;
     })();
     
    diff --git a/files/es/web/api/window/requestidlecallback/index.html b/files/es/web/api/window/requestidlecallback/index.html
    index 4be0f21ae84d8f..9713d7090e2f2e 100644
    --- a/files/es/web/api/window/requestidlecallback/index.html
    +++ b/files/es/web/api/window/requestidlecallback/index.html
    @@ -9,7 +9,7 @@
     
     

    Sintaxis

    -
    var handle = window.requestIdleCallback(callback[, options])
    +
    var handle = window.requestIdleCallback(callback[, options])

    Valor devuelto

    @@ -26,14 +26,15 @@

    Parámetros

options {{optional_inline}}
+
+

Contiene parametros opcionales de configuración. Contiene la siguiente propiedad:

+ +
    +
  • timeout: Plazo para que el navegador ejecute la función callback. Valor en milisegundos.
  • +
+
-

Contiene parametros opcionales de configuración. Contiene la siguiente propiedad:

- -
    -
  • timeout: Plazo para que el navegador ejecute la función callback. Valor en milisegundos.
  • -
-

Ejemplos

diff --git a/files/es/web/api/window/resize_event/index.html b/files/es/web/api/window/resize_event/index.html index 67f8c2091ac544..82749c3888f495 100644 --- a/files/es/web/api/window/resize_event/index.html +++ b/files/es/web/api/window/resize_event/index.html @@ -14,7 +14,7 @@

Sintaxis

-
window.onresize = funcRef;
+
window.onresize = funcRef;
 

Parametros

@@ -25,10 +25,10 @@

Parametros

Ejemplo

-
window.onresize = doFunc;
+
window.onresize = doFunc;
 
-
<html>
+
<html>
 <head>
 
 <title>onresize test</title>
@@ -56,7 +56,7 @@ 

Notas

Especificación

- +
diff --git a/files/es/web/api/window/scroll/index.html b/files/es/web/api/window/scroll/index.html index 5c842a371cd6f2..73e6ce111c6154 100644 --- a/files/es/web/api/window/scroll/index.html +++ b/files/es/web/api/window/scroll/index.html @@ -14,7 +14,7 @@

Sintaxis

-
window.scroll(x-coord, y-coord)
+
window.scroll(x-coord, y-coord)
 window.scroll(options)
 
@@ -33,14 +33,14 @@

Parámetros

Ejemplo

-
<!-- poner el pixel 100º verticalmente en el tope superior de la ventana -->
+
<!-- poner el pixel 100º verticalmente en el tope superior de la ventana -->
 
 <button onClick="scroll(0, 100);">Clic para desplazarse hacia abajo 100 pixeles</button>
 

Utilizando options:

-
window.scroll({
+
window.scroll({
   top: 100,
   left: 100,
   behavior: 'smooth'
diff --git a/files/es/web/api/window/scrollby/index.html b/files/es/web/api/window/scrollby/index.html
index 0943eb2ce3762e..b39e4c8c66590a 100644
--- a/files/es/web/api/window/scrollby/index.html
+++ b/files/es/web/api/window/scrollby/index.html
@@ -18,7 +18,7 @@ 

Resumen

Sintaxis

-
window.scrollBy(X, Y);
+
window.scrollBy(X, Y);
 window.scrollBy(opciones)

Parámetros

@@ -45,17 +45,17 @@

Parámetros

Ejemplo

-
// Desplazarse la longitud de una página
+
// Desplazarse la longitud de una página
 window.scrollBy(0, window.innerHeight);
 

Para hacer scroll hacia arriba:

-
window.scrollBy(0, -window.innerHeight);
+
window.scrollBy(0, -window.innerHeight);

Utilizando opciones:

-
window.scrollBy({
+
window.scrollBy({
   top: 100,
   left: 100,
   behaviour: 'smooth'
diff --git a/files/es/web/api/window/scrollto/index.html b/files/es/web/api/window/scrollto/index.html
index e2940cd9ba784e..3cac8d1687d9a3 100644
--- a/files/es/web/api/window/scrollto/index.html
+++ b/files/es/web/api/window/scrollto/index.html
@@ -11,7 +11,7 @@ 

Resumen

Sintaxis

-
window.scrollTo(x-coord, y-coord)
+
window.scrollTo(x-coord, y-coord)

Parámetros

@@ -22,7 +22,7 @@

Parámetros

Ejemplo

-
window.scrollTo( 0, 1000 );
+
window.scrollTo( 0, 1000 );

Notas

diff --git a/files/es/web/api/window/scrollx/index.html b/files/es/web/api/window/scrollx/index.html index 034498e919a293..ab79aee6d98dbd 100644 --- a/files/es/web/api/window/scrollx/index.html +++ b/files/es/web/api/window/scrollx/index.html @@ -11,7 +11,7 @@

Resumen

Sintaxis

-
var x = window.scrollX;
+
var x = window.scrollX;

Parámetros

@@ -21,7 +21,7 @@

Parámetros

Ejemplo

-
// Si scrollX es mayor que 400, reinicia la posición de desplazxamiento al inicio supuerior-izquierdo del documento.
+
// Si scrollX es mayor que 400, reinicia la posición de desplazxamiento al inicio supuerior-izquierdo del documento.
 if (window.scrollX > 400) {
   window.scroll(0,0);
 }
@@ -30,11 +30,11 @@

Notas

La propiedad pageXOffset es un alias de la propiedad scrollX:

-
window.pageXOffset == window.scrollX; // siempre true
+
window.pageXOffset == window.scrollX; // siempre true

Para compatibilidad cruzada entre navegadores, use window.pageXOffset en lugar de window.scrollX. Adicionalmente, versiones más antiguas de Internet Explorer (< 9) no soportan ninguna de las dos propiedades y deben ser sorteadas examinando otras propiedade no estandar. Un ejemplo totalmente compatible:

-
var x = (window.pageXOffset !== undefined)
+
var x = (window.pageXOffset !== undefined)
   ? window.pageXOffset
   : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
 
diff --git a/files/es/web/api/window/scrolly/index.html b/files/es/web/api/window/scrolly/index.html
index 81b82757462fc6..4a5464d16a9f10 100644
--- a/files/es/web/api/window/scrolly/index.html
+++ b/files/es/web/api/window/scrolly/index.html
@@ -16,7 +16,7 @@ 

Sumario

Sintaxis

-
var y = window.scrollY;
+
var y = window.scrollY;
  • y es el número de píxeles que se han desplazado actualmente desde el extremo superior de la página.
  • @@ -24,7 +24,7 @@

    Sintaxis

    Ejemplo

    -
    // Asegurate de bajar a la segunda página
    +
    // Asegurate de bajar a la segunda página
     if (window.scrollY) {
       window.scroll(0, 0);  // Restablece la posición de desplazamiento en la parte superior izquierda del documento
     }
    @@ -37,11 +37,11 @@ 

    Notas

    La propiedad pageYOffset es un alias para la propiedad scrollY:

    -
    window.pageYOffset == window.scrollY; // Siempre verdadero
    +
    window.pageYOffset == window.scrollY; // Siempre verdadero

    Para compatibilidad entre navegadores, es recomendable usar window.pageYOffset en vez de window.scrollY. Adicionalmente, tener en cuenta que versiones más viejas de Internet Explorer (<9) no soportan del todo la propiedad y debe ser solucionado usando propiedades no estandarizadas . Un ejemplo totalmente compatible entre navegadores:

    -
    var supportPageOffset = window.pageXOffset !== undefined;
    +
    var supportPageOffset = window.pageXOffset !== undefined;
     var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");
     
     var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
    diff --git a/files/es/web/api/window/sessionstorage/index.html b/files/es/web/api/window/sessionstorage/index.html
    index 8cb5d9423ec43e..d88506535306e6 100644
    --- a/files/es/web/api/window/sessionstorage/index.html
    +++ b/files/es/web/api/window/sessionstorage/index.html
    @@ -14,7 +14,7 @@
     
     

    Sintaxis

    -
    // Almacena la información en sessionStorage
    +
    // Almacena la información en sessionStorage
     sessionStorage.setItem('key', 'value');
     
     // Obtiene la información almacenada desde sessionStorage
    @@ -28,11 +28,11 @@ 

    Ejemplo

    El siguiente código accede al objeto {{domxref("Storage")}} del la sesión actual del domino y le añade un elemento utilizando {{domxref("Storage.setItem()")}}.

    -
    sessionStorage.setItem('myCat', 'Tom');
    +
    sessionStorage.setItem('myCat', 'Tom');

    El siguiente ejemplo graba de forma automática el contenido de un campo de texto, y si el navegador es actualizado accidentalmente, restaura el contenido del campo de texto para no perder lo escrito.

    -
    // Obtiene el campo de texto que vamos a moniterear
    +
    // Obtiene el campo de texto que vamos a moniterear
     var field = document.getElementById("field");
     
     // Verificamos si tenemos algún valor auto guardado
    diff --git a/files/es/web/api/window/showmodaldialog/index.html b/files/es/web/api/window/showmodaldialog/index.html
    index a75286c3c65607..c108801aa8efd9 100644
    --- a/files/es/web/api/window/showmodaldialog/index.html
    +++ b/files/es/web/api/window/showmodaldialog/index.html
    @@ -8,7 +8,7 @@
     

    El método Window.showModalDialog() crea y visualiza una caja de diálogo modal, conteniendo el documento HTML especificado.

    -

    Esta prestación va a desaparecer. Por favor ajuste sus sitios Web y aplicaciones.

    +

    Esta prestación va a desaparecer. Por favor ajuste sus sitios Web y aplicaciones.

    El soporte ha sido eliminado en Chrome 37. Pero se añadió temporalmente un ajuste de Política Coporativa para rehabilitar showModalDialog. Este método showModalDialog() fue eliminado definitivamente en Chrome 43.

    @@ -17,7 +17,7 @@

    Sintaxis

    -
    valRetorno = window.showModalDialog(uri[, argumentos][, opciones]);
    +
    valRetorno = window.showModalDialog(uri[, argumentos][, opciones]);
     

    donde

    diff --git a/files/es/web/api/window/statusbar/index.html b/files/es/web/api/window/statusbar/index.html index 25fe8e833ad903..2e60d61988917d 100644 --- a/files/es/web/api/window/statusbar/index.html +++ b/files/es/web/api/window/statusbar/index.html @@ -11,14 +11,14 @@

    Resumen

    Sintaxis

    -
    objRef = window.statusbar
    +
    objRef = window.statusbar
     

    Ejemplo

    El siguiente ejemplo HTML muestra una forma de utilizar la propiedad visible de los diversos objetos de "bar", y tambien el cambio de privilegios nesesarios para escribir en la propiedad visible para cada una de las ventanas existentes.

    -
    <!DOCTYPE html>
    +
    <!DOCTYPE html>
     <html lang="en">
     <head>
     <meta charset="UTF-8" />
    
    From 7889462439a737d09c283e694528ff91d2f426c8 Mon Sep 17 00:00:00 2001
    From: Craig Blaszczyk 
    Date: Fri, 16 Sep 2022 16:50:00 +0100
    Subject: [PATCH 02/10] feat: convert web/api/window to markdown
    
    ---
     .../api/window/beforeunload_event/index.html  | 144 ----
     .../api/window/beforeunload_event/index.md    |  96 +++
     files/es/web/api/window/blur_event/index.html |  91 ---
     files/es/web/api/window/blur_event/index.md   |  81 +++
     .../window/cancelanimationframe/index.html    |  65 --
     .../api/window/cancelanimationframe/index.md  |  59 ++
     files/es/web/api/window/close/index.html      |  76 ---
     files/es/web/api/window/close/index.md        |  68 ++
     files/es/web/api/window/closed/index.html     |  65 --
     files/es/web/api/window/closed/index.md       |  66 ++
     files/es/web/api/window/confirm/index.html    |  64 --
     files/es/web/api/window/confirm/index.md      |  50 ++
     .../api/window/devicepixelratio/index.html    |  45 --
     .../web/api/window/devicepixelratio/index.md  |  31 +
     files/es/web/api/window/document/index.html   |  46 --
     files/es/web/api/window/document/index.md     |  45 ++
     .../es/web/api/window/error_event/index.html  |  66 --
     files/es/web/api/window/error_event/index.md  |  63 ++
     .../es/web/api/window/focus_event/index.html  |  43 --
     files/es/web/api/window/focus_event/index.md  |  33 +
     .../es/web/api/window/frameelement/index.html |  60 --
     files/es/web/api/window/frameelement/index.md |  43 ++
     files/es/web/api/window/fullscreen/index.html |  43 --
     files/es/web/api/window/fullscreen/index.md   |  41 ++
     .../api/window/getcomputedstyle/index.html    |  25 -
     .../web/api/window/getcomputedstyle/index.md  |  37 +
     .../es/web/api/window/getselection/index.html |  52 --
     files/es/web/api/window/getselection/index.md |  45 ++
     .../api/window/hashchange_event/index.html    | 142 ----
     .../web/api/window/hashchange_event/index.md  |  97 +++
     files/es/web/api/window/history/index.html    |  39 --
     files/es/web/api/window/history/index.md      |  37 +
     files/es/web/api/window/index.html            | 411 ------------
     files/es/web/api/window/index.md              | 397 +++++++++++
     .../es/web/api/window/innerheight/index.html  |  79 ---
     files/es/web/api/window/innerheight/index.md  |  64 ++
     files/es/web/api/window/load_event/index.html | 128 ----
     files/es/web/api/window/load_event/index.md   |  78 +++
     .../es/web/api/window/localstorage/index.html |  88 ---
     files/es/web/api/window/localstorage/index.md |  80 +++
     files/es/web/api/window/location/index.html   | 212 ------
     files/es/web/api/window/location/index.md     | 206 ++++++
     .../es/web/api/window/locationbar/index.html  |  66 --
     files/es/web/api/window/locationbar/index.md  |  47 ++
     files/es/web/api/window/matchmedia/index.html |  67 --
     files/es/web/api/window/matchmedia/index.md   |  56 ++
     files/es/web/api/window/menubar/index.html    |  42 --
     files/es/web/api/window/menubar/index.md      |  42 ++
     files/es/web/api/window/moveby/index.html     |  70 --
     files/es/web/api/window/moveby/index.md       |  52 ++
     files/es/web/api/window/navigator/index.html  |  60 --
     files/es/web/api/window/navigator/index.md    |  72 ++
     .../web/api/window/offline_event/index.html   |  70 --
     .../es/web/api/window/offline_event/index.md  |  41 ++
     files/es/web/api/window/open/index.html       | 601 -----------------
     files/es/web/api/window/open/index.md         | 634 ++++++++++++++++++
     files/es/web/api/window/opener/index.html     |  28 -
     files/es/web/api/window/opener/index.md       |  30 +
     .../es/web/api/window/outerheight/index.html  |  68 --
     files/es/web/api/window/outerheight/index.md  |  54 ++
     files/es/web/api/window/outerwidth/index.html |  55 --
     files/es/web/api/window/outerwidth/index.md   |  41 ++
     .../web/api/window/popstate_event/index.html  |  75 ---
     .../es/web/api/window/popstate_event/index.md |  56 ++
     files/es/web/api/window/print/index.html      |  56 --
     files/es/web/api/window/print/index.md        |  44 ++
     files/es/web/api/window/prompt/index.html     |  82 ---
     files/es/web/api/window/prompt/index.md       |  70 ++
     .../window/requestanimationframe/index.html   |  74 --
     .../api/window/requestanimationframe/index.md |  69 ++
     .../api/window/requestidlecallback/index.html |  77 ---
     .../api/window/requestidlecallback/index.md   |  55 ++
     .../es/web/api/window/resize_event/index.html |  72 --
     files/es/web/api/window/resize_event/index.md |  62 ++
     files/es/web/api/window/scroll/index.html     |  84 ---
     files/es/web/api/window/scroll/index.md       |  69 ++
     files/es/web/api/window/scrollby/index.html   |  85 ---
     files/es/web/api/window/scrollby/index.md     |  72 ++
     files/es/web/api/window/scrollto/index.html   |  50 --
     files/es/web/api/window/scrollto/index.md     |  39 ++
     files/es/web/api/window/scrollx/index.html    |  72 --
     files/es/web/api/window/scrollx/index.md      |  63 ++
     files/es/web/api/window/scrolly/index.html    |  61 --
     files/es/web/api/window/scrolly/index.md      |  62 ++
     .../web/api/window/sessionstorage/index.html  |  83 ---
     .../es/web/api/window/sessionstorage/index.md |  72 ++
     .../web/api/window/showmodaldialog/index.html |  95 ---
     .../web/api/window/showmodaldialog/index.md   |  61 ++
     files/es/web/api/window/statusbar/index.html  |  72 --
     files/es/web/api/window/statusbar/index.md    |  57 ++
     90 files changed, 3637 insertions(+), 4149 deletions(-)
     delete mode 100644 files/es/web/api/window/beforeunload_event/index.html
     create mode 100644 files/es/web/api/window/beforeunload_event/index.md
     delete mode 100644 files/es/web/api/window/blur_event/index.html
     create mode 100644 files/es/web/api/window/blur_event/index.md
     delete mode 100644 files/es/web/api/window/cancelanimationframe/index.html
     create mode 100644 files/es/web/api/window/cancelanimationframe/index.md
     delete mode 100644 files/es/web/api/window/close/index.html
     create mode 100644 files/es/web/api/window/close/index.md
     delete mode 100644 files/es/web/api/window/closed/index.html
     create mode 100644 files/es/web/api/window/closed/index.md
     delete mode 100644 files/es/web/api/window/confirm/index.html
     create mode 100644 files/es/web/api/window/confirm/index.md
     delete mode 100644 files/es/web/api/window/devicepixelratio/index.html
     create mode 100644 files/es/web/api/window/devicepixelratio/index.md
     delete mode 100644 files/es/web/api/window/document/index.html
     create mode 100644 files/es/web/api/window/document/index.md
     delete mode 100644 files/es/web/api/window/error_event/index.html
     create mode 100644 files/es/web/api/window/error_event/index.md
     delete mode 100644 files/es/web/api/window/focus_event/index.html
     create mode 100644 files/es/web/api/window/focus_event/index.md
     delete mode 100644 files/es/web/api/window/frameelement/index.html
     create mode 100644 files/es/web/api/window/frameelement/index.md
     delete mode 100644 files/es/web/api/window/fullscreen/index.html
     create mode 100644 files/es/web/api/window/fullscreen/index.md
     delete mode 100644 files/es/web/api/window/getcomputedstyle/index.html
     create mode 100644 files/es/web/api/window/getcomputedstyle/index.md
     delete mode 100644 files/es/web/api/window/getselection/index.html
     create mode 100644 files/es/web/api/window/getselection/index.md
     delete mode 100644 files/es/web/api/window/hashchange_event/index.html
     create mode 100644 files/es/web/api/window/hashchange_event/index.md
     delete mode 100644 files/es/web/api/window/history/index.html
     create mode 100644 files/es/web/api/window/history/index.md
     delete mode 100644 files/es/web/api/window/index.html
     create mode 100644 files/es/web/api/window/index.md
     delete mode 100644 files/es/web/api/window/innerheight/index.html
     create mode 100644 files/es/web/api/window/innerheight/index.md
     delete mode 100644 files/es/web/api/window/load_event/index.html
     create mode 100644 files/es/web/api/window/load_event/index.md
     delete mode 100644 files/es/web/api/window/localstorage/index.html
     create mode 100644 files/es/web/api/window/localstorage/index.md
     delete mode 100644 files/es/web/api/window/location/index.html
     create mode 100644 files/es/web/api/window/location/index.md
     delete mode 100644 files/es/web/api/window/locationbar/index.html
     create mode 100644 files/es/web/api/window/locationbar/index.md
     delete mode 100644 files/es/web/api/window/matchmedia/index.html
     create mode 100644 files/es/web/api/window/matchmedia/index.md
     delete mode 100644 files/es/web/api/window/menubar/index.html
     create mode 100644 files/es/web/api/window/menubar/index.md
     delete mode 100644 files/es/web/api/window/moveby/index.html
     create mode 100644 files/es/web/api/window/moveby/index.md
     delete mode 100644 files/es/web/api/window/navigator/index.html
     create mode 100644 files/es/web/api/window/navigator/index.md
     delete mode 100644 files/es/web/api/window/offline_event/index.html
     create mode 100644 files/es/web/api/window/offline_event/index.md
     delete mode 100644 files/es/web/api/window/open/index.html
     create mode 100644 files/es/web/api/window/open/index.md
     delete mode 100644 files/es/web/api/window/opener/index.html
     create mode 100644 files/es/web/api/window/opener/index.md
     delete mode 100644 files/es/web/api/window/outerheight/index.html
     create mode 100644 files/es/web/api/window/outerheight/index.md
     delete mode 100644 files/es/web/api/window/outerwidth/index.html
     create mode 100644 files/es/web/api/window/outerwidth/index.md
     delete mode 100644 files/es/web/api/window/popstate_event/index.html
     create mode 100644 files/es/web/api/window/popstate_event/index.md
     delete mode 100644 files/es/web/api/window/print/index.html
     create mode 100644 files/es/web/api/window/print/index.md
     delete mode 100644 files/es/web/api/window/prompt/index.html
     create mode 100644 files/es/web/api/window/prompt/index.md
     delete mode 100644 files/es/web/api/window/requestanimationframe/index.html
     create mode 100644 files/es/web/api/window/requestanimationframe/index.md
     delete mode 100644 files/es/web/api/window/requestidlecallback/index.html
     create mode 100644 files/es/web/api/window/requestidlecallback/index.md
     delete mode 100644 files/es/web/api/window/resize_event/index.html
     create mode 100644 files/es/web/api/window/resize_event/index.md
     delete mode 100644 files/es/web/api/window/scroll/index.html
     create mode 100644 files/es/web/api/window/scroll/index.md
     delete mode 100644 files/es/web/api/window/scrollby/index.html
     create mode 100644 files/es/web/api/window/scrollby/index.md
     delete mode 100644 files/es/web/api/window/scrollto/index.html
     create mode 100644 files/es/web/api/window/scrollto/index.md
     delete mode 100644 files/es/web/api/window/scrollx/index.html
     create mode 100644 files/es/web/api/window/scrollx/index.md
     delete mode 100644 files/es/web/api/window/scrolly/index.html
     create mode 100644 files/es/web/api/window/scrolly/index.md
     delete mode 100644 files/es/web/api/window/sessionstorage/index.html
     create mode 100644 files/es/web/api/window/sessionstorage/index.md
     delete mode 100644 files/es/web/api/window/showmodaldialog/index.html
     create mode 100644 files/es/web/api/window/showmodaldialog/index.md
     delete mode 100644 files/es/web/api/window/statusbar/index.html
     create mode 100644 files/es/web/api/window/statusbar/index.md
    
    diff --git a/files/es/web/api/window/beforeunload_event/index.html b/files/es/web/api/window/beforeunload_event/index.html
    deleted file mode 100644
    index 229cd01c13f0a8..00000000000000
    --- a/files/es/web/api/window/beforeunload_event/index.html
    +++ /dev/null
    @@ -1,144 +0,0 @@
    ----
    -title: beforeunload
    -slug: Web/API/Window/beforeunload_event
    -translation_of: Web/API/Window/beforeunload_event
    -original_slug: Web/Events/beforeunload
    ----
    -{{APIRef}}
    -
    -

    El evento beforeunload es disparado cuando la ventana, el documento y sus recursos estan a punto de ser descargados. El documento todavia es visible y el evento todavia es cancelable en este punto.

    - -
    - -

    Si es asignado un string a la propiedad del objeto Evento returnValue, una caja de dialogo aparece, preguntando al usuario que confirme que dejara la pagina(mirar el ejemplo de abajo). Algunos navegadores muestran el string devuelto en una caja de dialogos, otros muestran un mensaje fijo. Si no se provee ningun valor, el evento procede silenciosamente.

    - -
    -

    Nota: Para combatir pop-ups indeseados, los navegadores pueden no mostrar mensajes creados en manejadores del evento beforeunload a menos que se haya interactuado con la pagina, o incluso sin que se haya interactuado en nada con esta.

    -
    - -
Especificación
- - - - - - - - - - - - - - - - - - -
BurbujasNo
CancelableSi
Objetos de destinodefaultView
Interfaz{{domxref("Event")}}
- -

Propiedades

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropiedadTipoDescripcion
target {{readOnlyInline}}{{domxref("EventTarget")}}El evento objetivo(el objetivo superior en el arbol del DOM).
type {{readOnlyInline}}{{domxref("DOMString")}}El tipo de evento.
bubbles {{readOnlyInline}}{{jsxref("Boolean")}}El evento normalmente burbujea?
cancelable {{readOnlyInline}}{{jsxref("Boolean")}}Es posible cancelar el evento?
returnValue{{domxref("DOMString")}}El valor actual devuelto por el evento (el mensaje que se le mostrara al usuario).
- -

Ejemplos

- -
window.addEventListener("beforeunload", function (event) {
-  event.returnValue = "\o/";
-});
-
-// es equivalente a
-window.addEventListener("beforeunload", function (event) {
-  event.preventDefault();
-});
- -

Navegadores basados en WebKit no siguen las especificaciones para la caja de dialogos. Un ejemplo que funcione con distintos navegadores seria similar al siguiente:

- -
window.addEventListener("beforeunload", function (e) {
-  var confirmationMessage = "\o/";
-
-  e.returnValue = confirmationMessage;     // Gecko, Trident, Chrome 34+
-  return confirmationMessage;              // Gecko, WebKit, Chrome <34
-});
- -

Notas

- -

A partir del 25 de Mayo del 2011, la especificion HTML5 establece que llamadas a los metodos {{domxref("window.alert()")}}, {{domxref("window.confirm()")}}, y {{domxref("window.prompt()")}}pueden ser ignoradas durante este evento.Mire las especificaciones de HTML5 para mas detalles.

- -

Varios navegadores ignoran el resultado del evento y no le preguntan al usuario por confirmacion en absoluto. El documento siempre se descargara automaticamente. Firefox tiene un switch llamado dom.disable_beforeunload en about:config para habilitar este comportamiento.

- -

Usando este manejador de evento tu pagina previene que Firefox cambie el cache de la pagina a uno en memoria bfcache. Mire Usando el almacenamiento en cache Firefox 1.5 para detalles.

- -

Especificaciones

- - - - - - - - - - - - - - - - - - - - - -
EspecificacionEstadoComentario
{{SpecName("HTML WHATWG", "indices.html#event-beforeunload", "beforeunload")}}{{Spec2("HTML WHATWG")}}
{{SpecName("HTML5 W3C", "browsers.html#unloading-documents", "beforeunload")}}{{Spec2("HTML5 W3C")}}Definicion inicial
- -

Compatibilidad con navegadores

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

Mire tambien

- - diff --git a/files/es/web/api/window/beforeunload_event/index.md b/files/es/web/api/window/beforeunload_event/index.md new file mode 100644 index 00000000000000..2b4a7fc971e0e5 --- /dev/null +++ b/files/es/web/api/window/beforeunload_event/index.md @@ -0,0 +1,96 @@ +--- +title: beforeunload +slug: Web/API/Window/beforeunload_event +translation_of: Web/API/Window/beforeunload_event +original_slug: Web/Events/beforeunload +--- +{{APIRef}} + +El evento **beforeunload** es disparado cuando la ventana, el documento y sus recursos estan a punto de ser descargados. El documento todavia es visible y el evento todavia es cancelable en este punto. + +Si es asignado un string a la propiedad del objeto Evento returnValue, una caja de dialogo aparece, preguntando al usuario que confirme que dejara la pagina(mirar el ejemplo de abajo). Algunos navegadores muestran el string devuelto en una caja de dialogos, otros muestran un mensaje fijo. Si no se provee ningun valor, el evento procede silenciosamente. + +> **Nota:** Para combatir pop-ups indeseados, los navegadores pueden no mostrar mensajes creados en manejadores del evento beforeunload a menos que se haya interactuado con la pagina, o incluso sin que se haya interactuado en nada con esta. + + + + + + + + + + + + + + + + + + + + +
BurbujasNo
CancelableSi
Objetos de destinodefaultView
Interfaz{{domxref("Event")}}
+ +## Propiedades + +| Propiedad | Tipo | Descripcion | +| ------------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------- | +| `target` {{readOnlyInline}} | {{domxref("EventTarget")}} | El evento objetivo(el objetivo superior en el arbol del DOM). | +| `type` {{readOnlyInline}} | {{domxref("DOMString")}} | El tipo de evento. | +| `bubbles` {{readOnlyInline}} | {{jsxref("Boolean")}} | El evento normalmente burbujea? | +| `cancelable` {{readOnlyInline}} | {{jsxref("Boolean")}} | Es posible cancelar el evento? | +| `returnValue` | {{domxref("DOMString")}} | El valor actual devuelto por el evento (el mensaje que se le mostrara al usuario). | + +## Ejemplos + +```js +window.addEventListener("beforeunload", function (event) { + event.returnValue = "\o/"; +}); + +// es equivalente a +window.addEventListener("beforeunload", function (event) { + event.preventDefault(); +}); +``` + +Navegadores basados en WebKit no siguen las especificaciones para la caja de dialogos. Un ejemplo que funcione con distintos navegadores seria similar al siguiente: + +```js +window.addEventListener("beforeunload", function (e) { + var confirmationMessage = "\o/"; + + e.returnValue = confirmationMessage; // Gecko, Trident, Chrome 34+ + return confirmationMessage; // Gecko, WebKit, Chrome <34 +}); +``` + +## Notas + +A partir del 25 de Mayo del 2011, la especificion HTML5 establece que llamadas a los metodos {{domxref("window.alert()")}}, {{domxref("window.confirm()")}}, y {{domxref("window.prompt()")}}pueden ser ignoradas durante este evento.Mire las [especificaciones de HTML5](http://www.w3.org/TR/html5/webappapis.html#user-prompts) para mas detalles. + +Varios navegadores ignoran el resultado del evento y no le preguntan al usuario por confirmacion en absoluto. El documento siempre se descargara automaticamente. Firefox tiene un switch llamado dom.disable_beforeunload en about:config para habilitar este comportamiento. + +Usando este manejador de evento tu pagina previene que Firefox cambie el cache de la pagina a uno en memoria bfcache. Mire [Usando el almacenamiento en cache Firefox 1.5](en/Using_Firefox_1.5_caching) para detalles. + +## Especificaciones + +| Especificacion | Estado | Comentario | +| -------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------ | +| {{SpecName("HTML WHATWG", "indices.html#event-beforeunload", "beforeunload")}} | {{Spec2("HTML WHATWG")}} | | +| {{SpecName("HTML5 W3C", "browsers.html#unloading-documents", "beforeunload")}} | {{Spec2("HTML5 W3C")}} | Definicion inicial | + +## Compatibilidad con navegadores + +{{Compat("api.Window.beforeunload_event")}} + +## Mire tambien + +- {{Event("DOMContentLoaded")}} +- {{Event("readystatechange")}} +- {{Event("load")}} +- {{Event("unload")}} +- [Unloading Documents — Confirmacion para descargar un documento](http://www.whatwg.org/specs/web-apps/current-work/#prompt-to-unload-a-document) +- [Remover mensajes personalizados en dialogos onbeforeload despues de Chrome 51](https://developers.google.com/web/updates/2016/04/chrome-51-deprecations?hl=en#remove_custom_messages_in_onbeforeload_dialogs) diff --git a/files/es/web/api/window/blur_event/index.html b/files/es/web/api/window/blur_event/index.html deleted file mode 100644 index 07ac19d0695249..00000000000000 --- a/files/es/web/api/window/blur_event/index.html +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: GlobalEventHandlers.onblur -slug: Web/API/Window/blur_event -translation_of: Web/API/GlobalEventHandlers/onblur -original_slug: Web/API/GlobalEventHandlers/onblur ---- -
{{ApiRef("HTML DOM")}}
- -

La propiedad onblur retorna el código del manejador de evento onBlur, si existe, en el elemento actual.

- -

Sintaxis

- -
element.onblur = function;
-
- -
    -
  • function es el nombre de una función definida por el usuario, sin el sufijo () ni ningún parámetro, o una declaración de función anónima, como:
  • -
- -
element.onblur = function() { console.log("¡evento onblur detectado!"); };
-
- -

Ejemplo

- -
<html>
-
-<head>
-<title>ejemplo de evento onblur</title>
-
-<script type="text/javascript">
-
-var elem = null;
-
-function initElement()
-{
-  elem = document.getElementById("foo");
-  // NOTA: doEvent(); ó doEvent(param); no funcionará aquí.
-  // Debe ser una referencia a un nombre de función, no una llamada a función.
-  elem.onblur = doEvent;
-};
-
-function doEvent()
-{
-  elem.value = 'Bye-Bye';
-  console.log("¡Evento onblur detectado!")
-}
-</script>
-
-<style type="text/css">
-<!--
-#foo {
-border: solid blue 2px;
-}
--->
-</style>
-</head>
-
-<body onload="initElement();">
-<form>
-<input type="text" id="foo" value="Hola!" />
-</form>
-
-<p>Haga click en el elemento superior to darle el foco, luego click fuera del elemento.<br />
-Recarge la página desde la barra de navegación.</p>
-
-</body>
-</html>
-
- -

Notas

- -

El evento blur es generado cuando un elemento pierde el foco.

- -

A diferencia de MSIE --en el cual la mayoría de tipos de elementos reciben el evento blur-- la mayoría de elementos de los navegadores basados en Gecko NO funcionan con este evento.

- -

Especificación

- - - - - - - - - - - - - - -
EspecificaciónEstadoObservaciones
{{SpecName('HTML WHATWG','webappapis.html#handler-onblur','onblur')}}{{Spec2('HTML WHATWG')}}
diff --git a/files/es/web/api/window/blur_event/index.md b/files/es/web/api/window/blur_event/index.md new file mode 100644 index 00000000000000..108dc5db6780fb --- /dev/null +++ b/files/es/web/api/window/blur_event/index.md @@ -0,0 +1,81 @@ +--- +title: GlobalEventHandlers.onblur +slug: Web/API/Window/blur_event +translation_of: Web/API/GlobalEventHandlers/onblur +original_slug: Web/API/GlobalEventHandlers/onblur +--- +{{ApiRef("HTML DOM")}} + +La propiedad **onblur** retorna el código del manejador de evento onBlur, si existe, en el elemento actual. + +## Sintaxis + +```js +element.onblur = function; +``` + +- `function` es el nombre de una función definida por el usuario, sin el sufijo () ni ningún parámetro, o una declaración de función anónima, como: + +```js +element.onblur = function() { console.log("¡evento onblur detectado!"); }; +``` + +## Ejemplo + +```html + + + +ejemplo de evento onblur + + + + + + + +
+ +
+ +

Haga click en el elemento superior to darle el foco, luego click fuera del elemento.
+Recarge la página desde la barra de navegación.

+ + + +``` + +## Notas + +El evento blur es generado cuando un elemento pierde el foco. + +A diferencia de MSIE --en el cual la mayoría de tipos de elementos reciben el evento blur-- la mayoría de elementos de los navegadores basados en Gecko NO funcionan con este evento. + +## Especificación + +| Especificación | Estado | Observaciones | +| -------------------------------------------------------------------------------------------- | -------------------------------- | ------------- | +| {{SpecName('HTML WHATWG','webappapis.html#handler-onblur','onblur')}} | {{Spec2('HTML WHATWG')}} | | diff --git a/files/es/web/api/window/cancelanimationframe/index.html b/files/es/web/api/window/cancelanimationframe/index.html deleted file mode 100644 index 6e09164276b6fb..00000000000000 --- a/files/es/web/api/window/cancelanimationframe/index.html +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: window.cancelAnimationFrame() -slug: Web/API/Window/cancelAnimationFrame -translation_of: Web/API/Window/cancelAnimationFrame ---- -
{{APIRef}}{{SeeCompatTable}}
- -

Resumen

- -

Cancela la petición de animación previamente programada a través de {{domxref("window.requestAnimationFrame()")}}.

- -

Sintaxis

- -
window.cancelAnimationFrame(requestID);
-
- -
-

Nota: Antes de Firefox 23, la función es independiente del proveedor con el prefijo window.mozCancelAnimationFrame(). Consulte la tabla de compatibilidad, a continuación, para otras implementaciones de navegador.

-
- -

Parámetros

- -
-
ID de la petición
-
El valor del ID regresado por la llamada a {{domxref("window.requestAnimationFrame()")}} que solicitó una llamada de vuelta.
-
- -

Ejemplos

- -
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
-
-var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
-
-var start = window.mozAnimationStartTime;  // Only supported in FF. Other browsers can use something like Date.now().
-
-var myReq;
-
-function step(timestamp) {
-  var progress = timestamp - start;
-  d.style.left = Math.min(progress/10, 200) + "px";
-  if (progress < 2000) {
-    myReq = requestAnimationFrame(step);
-  }
-}
-myReq = requestAnimationFrame(step);
-
-window.cancelAnimationFrame(myReq);
-
- -

Compatibilidad de navegadores

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

Especificación

- -
    -
  • {{spec("http://www.w3.org/TR/animation-timing/#cancelAnimationFrame", "Timing control for script-based animations: cancelAnimationFrame", "WD")}}
  • -
- -

Ver también

- -
    -
  • {{domxref("window.mozAnimationStartTime")}}
  • -
  • {{domxref("window.requestAnimationFrame()")}}
  • -
diff --git a/files/es/web/api/window/cancelanimationframe/index.md b/files/es/web/api/window/cancelanimationframe/index.md new file mode 100644 index 00000000000000..35bf65792b8ffb --- /dev/null +++ b/files/es/web/api/window/cancelanimationframe/index.md @@ -0,0 +1,59 @@ +--- +title: window.cancelAnimationFrame() +slug: Web/API/Window/cancelAnimationFrame +translation_of: Web/API/Window/cancelAnimationFrame +--- +{{APIRef}}{{SeeCompatTable}} + +## Resumen + +Cancela la petición de animación previamente programada a través de {{domxref("window.requestAnimationFrame()")}}. + +## Sintaxis + +```js +window.cancelAnimationFrame(requestID); +``` + +> **Nota:** Antes de Firefox 23, la función es independiente del proveedor con el prefijo `window.mozCancelAnimationFrame()`. Consulte la tabla de compatibilidad, a continuación, para otras implementaciones de navegador. + +### Parámetros + +- `ID de la petición` + - : El valor del ID regresado por la llamada a {{domxref("window.requestAnimationFrame()")}} que solicitó una llamada de vuelta. + +## Ejemplos + +```js +var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; + +var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame; + +var start = window.mozAnimationStartTime; // Only supported in FF. Other browsers can use something like Date.now(). + +var myReq; + +function step(timestamp) { + var progress = timestamp - start; + d.style.left = Math.min(progress/10, 200) + "px"; + if (progress < 2000) { + myReq = requestAnimationFrame(step); + } +} +myReq = requestAnimationFrame(step); + +window.cancelAnimationFrame(myReq); +``` + +## Compatibilidad de navegadores + +{{Compat("api.Window.cancelAnimationFrame")}} + +## Especificación + +- {{spec("http://www.w3.org/TR/animation-timing/#cancelAnimationFrame", "Timing control for script-based animations: cancelAnimationFrame", "WD")}} + +## Ver también + +- {{domxref("window.mozAnimationStartTime")}} +- {{domxref("window.requestAnimationFrame()")}} diff --git a/files/es/web/api/window/close/index.html b/files/es/web/api/window/close/index.html deleted file mode 100644 index a4756b541450fb..00000000000000 --- a/files/es/web/api/window/close/index.html +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: Window.close() -slug: Web/API/Window/close -translation_of: Web/API/Window/close ---- -

{{ ApiRef() }}

- -

Resumen

- -

Cierra la ventana actual, o la ventana en la cual fue llamada.

- -

Sintaxis

- -
window.close();
-
- -

Descripción

- -

Cuando este método es llamado, la ventana referenciada es cerrada.

- -

Este método solo se permite ser llamado por ventanas que fueron abiertas por un script utilizando el método {{domxref("window.open()")}}. Si la ventana no fue abierta por un script, el siguiente error aparece en la consola de JavaScript: Scripts may not close windows that were not opened by script.

- -

Ejemplos

- -

Cerrar una ventana abierta con window.open()

- -

Este es un ejemplo que demuestra como utilizar este método para cerrar una ventana que fue abierta por un script llamando {{domxref("window.open()")}}.

- -
<script type="text/javascript">
-//Global var to store a reference to the opened window
-var openedWindow;
-
-function openWindow()
-{
-  openedWindow = window.open('moreinfo.htm');
-}
-
-function closeOpenedWindow()
-{
-  openedWindow.close();
-}
-</script>
-
- -

Cerrando la ventana actual

- -

Cuando se llama al método del objeto window close() directamente, en vez de llamar a close() en una instancia de la ventana, el navegador cerrará la ventana que está en primer plano, independientemente si el script fue creado en la ventana o no. (Firefox 35.0.1: los scripts no pueden cerrar ventanas que ellos no han abierto)

- -
<script type="text/javascript">
-function closeCurrentWindow()
-{
-  window.close();
-}
-</script>
-
- -

Especificación

- - - - - - - - - - - - - - -
EspecificaciónEstadoComentario
{{SpecName('HTML WHATWG', '#dom-window-close', 'window.close()')}}{{Spec2('HTML WHATWG')}}
- -

Referencia adicional

- -

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

diff --git a/files/es/web/api/window/close/index.md b/files/es/web/api/window/close/index.md new file mode 100644 index 00000000000000..c9c7528565a130 --- /dev/null +++ b/files/es/web/api/window/close/index.md @@ -0,0 +1,68 @@ +--- +title: Window.close() +slug: Web/API/Window/close +translation_of: Web/API/Window/close +--- +{{ ApiRef() }} + +## Resumen + +Cierra la ventana actual, o la ventana en la cual fue llamada. + +## Sintaxis + +```js +window.close(); +``` + +## Descripción + +Cuando este método es llamado, la ventana referenciada es cerrada. + +Este método solo se permite ser llamado por ventanas que fueron abiertas por un script utilizando el método {{domxref("window.open()")}}. Si la ventana no fue abierta por un script, el siguiente error aparece en la consola de JavaScript: Scripts may not close windows that were not opened by script. + +## Ejemplos + +### Cerrar una ventana abierta con window\.open() + +Este es un ejemplo que demuestra como utilizar este método para cerrar una ventana que fue abierta por un script llamando {{domxref("window.open()")}}. + +```html + +``` + +### Cerrando la ventana actual + +Cuando se llama al método del objeto window close() directamente, en vez de llamar a close() en una instancia de la ventana, el navegador cerrará la ventana que está en primer plano, independientemente si el script fue creado en la ventana o no. (Firefox 35.0.1: los scripts no pueden cerrar ventanas que ellos no han abierto) + +```html + +``` + +## Especificación + +| Especificación | Estado | Comentario | +| ---------------------------------------------------------------------------------------- | -------------------------------- | ---------- | +| {{SpecName('HTML WHATWG', '#dom-window-close', 'window.close()')}} | {{Spec2('HTML WHATWG')}} | | + +## Referencia adicional + +{{Compat("api.Window.close")}} diff --git a/files/es/web/api/window/closed/index.html b/files/es/web/api/window/closed/index.html deleted file mode 100644 index dbb982247fed97..00000000000000 --- a/files/es/web/api/window/closed/index.html +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: Window.closed -slug: Web/API/Window/closed -tags: - - API - - HTML DOM - - Propiedad - - Referencia - - Ventana -translation_of: Web/API/Window/closed ---- -
{{APIRef}}
- -

Resumen

- -

Esta propiedad de solo lectura indica si la ventana referenciada está cerrada o no.

- -

Syntax

- -
isClosed = windowRef.closed;
-
- -
-
isClosed
-
Booleano. Valores posibles: -
    -
  • true: La ventana ha sido cerrada.
  • -
  • false: La ventana está abierta.
  • -
-
-
- -

Ejemplos

- -

Cambiar la URL de una ventana desde una ventana emergente

- -

El siguiente ejemplo demuestra cómo una ventana emergente puede cambiar la URL de la ventana que la abrió. Antes de intentar cambiar la URL, verifica que la ventana actual tiene referencia a la ventana que la abrió usando la propiedad window.opener y que esa ventana no está cerrada:

- -
// Verifica que opener existe y no esté cerrado
-if (window.opener && !window.opener.closed) {
-  window.opener.location.href = "http://www.mozilla.org";
-}
- -

Nótese que las ventanas emergentes solo pueden acceder a la ventana que las abrió.

- -

Actualizando una ventana emergente abierta previamente

- -

En este ejemplo la función refreshPopupWindow() llama al método reload del objeto location de la ventana emergente para actualizar su información. Si la ventana emergente no ha sido abierta o el usuario la cerró una nueva ventana es abierta.

- -
var popupWindow = null;
-
-function refreshPopupWindow() {
-  if (popupWindow && !popupWindow.closed) {
-    // popupWindow está abierta, actualízala
-    popupWindow.location.reload(true);
-  } else {
-    // Abre una nueva ventana emergente
-    popupWindow = window.open("popup.html","dataWindow");
-  }
-}
-
- -

Especificación

- -

HTML5

diff --git a/files/es/web/api/window/closed/index.md b/files/es/web/api/window/closed/index.md new file mode 100644 index 00000000000000..24fa3592a08d4b --- /dev/null +++ b/files/es/web/api/window/closed/index.md @@ -0,0 +1,66 @@ +--- +title: Window.closed +slug: Web/API/Window/closed +tags: + - API + - HTML DOM + - Propiedad + - Referencia + - Ventana +translation_of: Web/API/Window/closed +--- +{{APIRef}} + +## Resumen + +Esta propiedad de solo lectura indica si la ventana referenciada está cerrada o no. + +## Syntax + +```js +isClosed = windowRef.closed; +``` + +- `isClosed` + + - : Booleano. Valores posibles: + + - `true`: La ventana ha sido cerrada. + - `false`: La ventana está abierta. + +## Ejemplos + +### Cambiar la URL de una ventana desde una ventana emergente + +El siguiente ejemplo demuestra cómo una ventana emergente puede cambiar la URL de la ventana que la abrió. Antes de intentar cambiar la URL, verifica que la ventana actual tiene referencia a la ventana que la abrió usando la propiedad [window.opener](/es/docs/DOM/window.opener) y que esa ventana no está cerrada: + +```js +// Verifica que opener existe y no esté cerrado +if (window.opener && !window.opener.closed) { + window.opener.location.href = "http://www.mozilla.org"; +} +``` + +Nótese que las ventanas emergentes solo pueden acceder a la ventana que las abrió. + +### Actualizando una ventana emergente abierta previamente + +En este ejemplo la función `refreshPopupWindow()` llama al método `reload` del objeto location de la ventana emergente para actualizar su información. Si la ventana emergente no ha sido abierta o el usuario la cerró una nueva ventana es abierta. + +```js +var popupWindow = null; + +function refreshPopupWindow() { + if (popupWindow && !popupWindow.closed) { + // popupWindow está abierta, actualízala + popupWindow.location.reload(true); + } else { + // Abre una nueva ventana emergente + popupWindow = window.open("popup.html","dataWindow"); + } +} +``` + +## Especificación + +HTML5 diff --git a/files/es/web/api/window/confirm/index.html b/files/es/web/api/window/confirm/index.html deleted file mode 100644 index 90b01c86187ab7..00000000000000 --- a/files/es/web/api/window/confirm/index.html +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: Window.confirm() -slug: Web/API/Window/confirm -translation_of: Web/API/Window/confirm ---- -
{{ApiRef("Window")}}
- -

El método Window.confirm() muestra una ventana de diálogo con un mensaje opcional y dos botones, Aceptar y Cancelar.

- -

Sintaxis

- -
result = window.confirm(message);
-
- -
    -
  • message es la cadena que se muestra opcionalmente en el diálogo.
  • -
  • result es un valor booleano indicando si se ha pulsado Aceptar o Cancelar (Aceptar devuelve true).
  • -
- -

Ejemplo

- -
if (window.confirm("Do you really want to leave?")) {
-  window.open("exit.html", "Thanks for Visiting!");
-}
-
- -

Da como resultado:

- -

firefox confirm
-

- -

Notas

- -

The following text is shared between this article, DOM:window.prompt and DOM:window.alert Las cajas de diálogo son ventanas modales - ello impide al usuario continuar accediendo al resto del interfaz del programa hasta que la ventana modal haya sido cerrada. Por esta razón no se debería usar en exceso funciones que creen cajas de diálogo (o ventanas modales). No obstante, hay muy buenas razones para evitar el uso de cajas de diálogo para confirmaciones.

- -

Los usuarios de Mozilla Chrome users (e.g. Firefox extensions) deberían usar métodos de nsIPromptService en vez de cajas de diálogo.

- -

A partir de la versión {{CompatChrome(46.0)}} de Chrome este método es bloqueado dentro de un {{htmlelement("iframe")}} a no ser que el atributo sandbox tenga el valor allow-modal.

- -

{{gecko_minversion_inline("23.0")}} El argumento es opcional y no requerido por la especificación.

- -

Especificación

- - - - - - - - - - - - - - -
EspecificaciónEstadoComentarios
{{SpecName('HTML5 Web application', '#dom-confirm', 'confirm()')}}{{Spec2('HTML5 Web application')}}Definición inicial.
- -

Ver también

- -
    -
  • {{domxref("window.alert","alert")}}
  • -
  • {{domxref("window.prompt","prompt")}}
  • -
diff --git a/files/es/web/api/window/confirm/index.md b/files/es/web/api/window/confirm/index.md new file mode 100644 index 00000000000000..de0363e89546ee --- /dev/null +++ b/files/es/web/api/window/confirm/index.md @@ -0,0 +1,50 @@ +--- +title: Window.confirm() +slug: Web/API/Window/confirm +translation_of: Web/API/Window/confirm +--- +{{ApiRef("Window")}} + +El método **`Window.confirm()`** muestra una ventana de diálogo con un mensaje opcional y dos botones, Aceptar y Cancelar. + +## Sintaxis + +```js +result = window.confirm(message); +``` + +- `message` es la cadena que se muestra opcionalmente en el diálogo. +- `result` es un valor booleano indicando si se ha pulsado Aceptar o Cancelar (Aceptar devuelve true). + +## Ejemplo + +```js +if (window.confirm("Do you really want to leave?")) { + window.open("exit.html", "Thanks for Visiting!"); +} +``` + +Da como resultado: + +![firefox confirm](https://mdn.mozillademos.org/files/7163/firefoxcomfirmdialog_zpsf00ec381.png) + +## Notas + +The following text is shared between this article, DOM:window\.prompt and DOM:window\.alert Las cajas de diálogo son ventanas modales - ello impide al usuario continuar accediendo al resto del interfaz del programa hasta que la ventana modal haya sido cerrada. Por esta razón no se debería usar en exceso funciones que creen cajas de diálogo (o ventanas modales). No obstante, hay muy buenas razones para [evitar el uso de cajas de diálogo para confirmaciones](http://alistapart.com/article/neveruseawarning). + +Los usuarios de [Mozilla Chrome](/en-US/Chrome "Chrome") users (e.g. Firefox extensions) deberían usar métodos de `nsIPromptService` en vez de cajas de diálogo. + +A partir de la versión {{CompatChrome(46.0)}} de Chrome este método es bloqueado dentro de un {{htmlelement("iframe")}} a no ser que el atributo sandbox tenga el valor `allow-modal`. + +{{gecko_minversion_inline("23.0")}} El argumento es opcional y no requerido por la especificación. + +## Especificación + +| Especificación | Estado | Comentarios | +| ---------------------------------------------------------------------------------------- | -------------------------------------------- | ------------------- | +| {{SpecName('HTML5 Web application', '#dom-confirm', 'confirm()')}} | {{Spec2('HTML5 Web application')}} | Definición inicial. | + +## Ver también + +- {{domxref("window.alert","alert")}} +- {{domxref("window.prompt","prompt")}} diff --git a/files/es/web/api/window/devicepixelratio/index.html b/files/es/web/api/window/devicepixelratio/index.html deleted file mode 100644 index 52f6abb71fe89f..00000000000000 --- a/files/es/web/api/window/devicepixelratio/index.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Window.devicePixelRatio -slug: Web/API/Window/devicePixelRatio -translation_of: Web/API/Window/devicePixelRatio ---- -

{{APIRef}}

- -

La propiedad de sólo-lectura Window.devicePixelRatio retorna la relación de tamaño (vertical) de un pixel físico en el dispositivo de visualización actual respecto del de un dispositivo de tamaño de pixel independiente (dips).

- -

No hay retrofunciones o eventos a escuchar cuando este valor cambia (por ejemplo, si usted arrastra la ventana entre displays con diferentes densidades de pixels).

- -

Sintaxis

- -
value = window.devicePixelRatio;
-
- -

Especificación

- - - - - - - - - - - - - - - - -
EspecificaciónEstadoObservaciones
{{SpecName("CSSOM View", "#dom-window-devicepixelratio", "Window.devicePixelRatio")}}{{Spec2("CSSOM View")}}Definición inicial
- -

Compatibilidad con navegadores

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

Ver también

- - diff --git a/files/es/web/api/window/devicepixelratio/index.md b/files/es/web/api/window/devicepixelratio/index.md new file mode 100644 index 00000000000000..3efc7ec75acadd --- /dev/null +++ b/files/es/web/api/window/devicepixelratio/index.md @@ -0,0 +1,31 @@ +--- +title: Window.devicePixelRatio +slug: Web/API/Window/devicePixelRatio +translation_of: Web/API/Window/devicePixelRatio +--- +{{APIRef}} + +La propiedad de sólo-lectura `Window.devicePixelRatio` retorna la relación de tamaño (vertical) de un pixel físico en el dispositivo de visualización actual respecto del de un dispositivo de tamaño de pixel independiente (dips). + +No hay retrofunciones o eventos a escuchar cuando este valor cambia (por ejemplo, si usted arrastra la ventana entre displays con diferentes densidades de pixels). + +## Sintaxis + +```js +value = window.devicePixelRatio; +``` + +## Especificación + +| Especificación | Estado | Observaciones | +| ---------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------ | +| {{SpecName("CSSOM View", "#dom-window-devicepixelratio", "Window.devicePixelRatio")}} | {{Spec2("CSSOM View")}} | Definición inicial | + +## Compatibilidad con navegadores + +{{Compat("api.Window.devicePixelRatio")}} + +## Ver también + +- [consultas de resolución de medio CSS](/es/docs/Web/CSS/@media/resolution) +- PPK hace alguna [iinvestigación en devicePixelRatio](http://www.quirksmode.org/blog/archives/2012/06/devicepixelrati.html) diff --git a/files/es/web/api/window/document/index.html b/files/es/web/api/window/document/index.html deleted file mode 100644 index 4613f1cb2e4453..00000000000000 --- a/files/es/web/api/window/document/index.html +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: Window.document -slug: Web/API/Window/document -translation_of: Web/API/Window/document ---- -
{{APIRef}}
- -

Resumen

- -

Retorna una referencia al documento contenido en la ventana.

- -
Nota: Firefox 3 altera la seguridad para los documentos entre ventanas, de modo que sólo el dominio desde el cual ha sido cargada una ventana puede acceder al documento. A pesar de que esto rompe el funcionamiento de algunos sitios existentes, es una modificación adoptada por Firefox 3 e Internet Explorer 7, que resulta en una mejora de seguridad.
- -

Sintaxis

- -
doc = window.document
-
- -

Parámetros

- -
    -
  • doc es una referencia al objeto del document.
  • -
- -

Example

- -
<!DOCTYPE html>
-<html>
-<head>
-   <title>Hola, Mundo!</title>
-</head>
-<body>
-
-<script type="text/javascript">
-   var doc = window.document;
-   console.log(doc.title); // Hola, Mundo!
-</script>
-
-</body>
-</html>
- -

Especificación

- - diff --git a/files/es/web/api/window/document/index.md b/files/es/web/api/window/document/index.md new file mode 100644 index 00000000000000..38c305d8295db0 --- /dev/null +++ b/files/es/web/api/window/document/index.md @@ -0,0 +1,45 @@ +--- +title: Window.document +slug: Web/API/Window/document +translation_of: Web/API/Window/document +--- +{{APIRef}} + +## Resumen + +Retorna una referencia al documento contenido en la ventana. + +> **Nota:** Firefox 3 altera la seguridad para los documentos entre ventanas, de modo que sólo el dominio desde el cual ha sido cargada una ventana puede acceder al documento. A pesar de que esto rompe el funcionamiento de algunos sitios existentes, es una modificación adoptada por Firefox 3 e Internet Explorer 7, que resulta en una mejora de seguridad. + +## Sintaxis + +```js +doc = window.document +``` + +### Parámetros + +- `doc` es una referencia al objeto del [document](/es/docs/DOM/document "DOM/document"). + +## Example + +```html + + + + Hola, Mundo! + + + + + + + +``` + +## Especificación + +- [HTML](http://www.whatwg.org/html/#the-window-object) diff --git a/files/es/web/api/window/error_event/index.html b/files/es/web/api/window/error_event/index.html deleted file mode 100644 index 424e3eef2fade7..00000000000000 --- a/files/es/web/api/window/error_event/index.html +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: GlobalEventHandlers.onerror -slug: Web/API/Window/error_event -translation_of: Web/API/GlobalEventHandlers/onerror -original_slug: Web/API/GlobalEventHandlers/onerror ---- -
{{ ApiRef("HTML DOM") }}
- -

Un manejador de eventos para errores en scripts en tiempo de ejecución.

- -

Note that some/many error events do not trigger window.onerror, you have to listen for them specifically.

- -

Sintaxis

- -
window.onerror = funcRef;
-
- -

Parámetros

- -
    -
  • funcRef es una referencia a una función. Cuando la función devuelva true, se prevendrá el disparado del manejador de eventos por defecto. Parámetros de la función: - -
      -
    • Mensaje de error (string)
    • -
    • Url en la que el error fue lanzado (string)
    • -
    • Número de línea en la que el error fue lanzado (number)
    • -
    • Dentro de la línea en la que el error ocurrió, número de columna correspondiente (number) {{gecko_minversion_inline("31.0")}}
    • -
    • Error Object (object) {{gecko_minversion_inline("31.0")}}
    • -
    -
  • -
- -

Ejemplos

- -
// Example 1:
-
-// Prevent error dialogs from displaying -which is the window's normal
-// behavior- by overriding the default event handler for error events that
-// go to the window.
-window.onerror = null;
-
-// Example 2:
-
-var gOldOnError = window.onerror;
-// Override previous handler.
-window.onerror = function myErrorHandler(errorMsg, url, lineNumber) {
-  if (gOldOnError)
-    // Call previous handler.
-    return gOldOnError(errorMsg, url, lineNumber);
-
-  // Just let default handler run.
-  return false;
-}
-
- -

Notas

- -

El evento de error es lanzado cuando ocurre un error en el script.

- -

Cuando se use el marcado html en línea (<body onerror="alert('an error occurred')>...), los argumentos son anónimos. Pueden ser referenciados usando desde arguments{{ mediawiki.external(0) }} hasta arguments{{ mediawiki.external(2) }}.

- -

No hay llamante Components.stack.caller que recuperar. (Vea bug 355430.)

- -

Especificación

- -

JavaScript 1.1

diff --git a/files/es/web/api/window/error_event/index.md b/files/es/web/api/window/error_event/index.md new file mode 100644 index 00000000000000..d65127d5d884cf --- /dev/null +++ b/files/es/web/api/window/error_event/index.md @@ -0,0 +1,63 @@ +--- +title: GlobalEventHandlers.onerror +slug: Web/API/Window/error_event +translation_of: Web/API/GlobalEventHandlers/onerror +original_slug: Web/API/GlobalEventHandlers/onerror +--- +{{ ApiRef("HTML DOM") }} + +Un manejador de eventos para errores en scripts en tiempo de ejecución. + +Note that some/many `error` events do not trigger `window.onerror`, you have to listen for them specifically. + +## Sintaxis + +```js +window.onerror = funcRef; +``` + +### Parámetros + +- `funcRef` es una referencia a una función. Cuando la función devuelva `true`, se prevendrá el disparado del manejador de eventos por defecto. Parámetros de la función: + + - Mensaje de error (string) + - Url en la que el error fue lanzado (string) + - Número de línea en la que el error fue lanzado (number) + - Dentro de la línea en la que el error ocurrió, número de columna correspondiente (number) {{gecko_minversion_inline("31.0")}} + - [Error Object](/es/docs/Web/JavaScript/Reference/Global_Objects/Error) (object) {{gecko_minversion_inline("31.0")}} + +## Ejemplos + +```js +// Example 1: + +// Prevent error dialogs from displaying -which is the window's normal +// behavior- by overriding the default event handler for error events that +// go to the window. +window.onerror = null; + +// Example 2: + +var gOldOnError = window.onerror; +// Override previous handler. +window.onerror = function myErrorHandler(errorMsg, url, lineNumber) { + if (gOldOnError) + // Call previous handler. + return gOldOnError(errorMsg, url, lineNumber); + + // Just let default handler run. + return false; +} +``` + +## Notas + +El evento de error es lanzado cuando ocurre un error en el script. + +Cuando se use el marcado html en línea (\ - -

La propiedad onfocus devuelve un manejador de eventos para el evento onFocus en el elemento actual.

- -

Sintaxis

- -
element.onfocus = event handling code
-
- -

Notas

- -

El evento focus se dispara cuando el usuario establece el foco en el elemento.

- -

Para que el evento onfocus se dispare en elementos que no sean inputs, los mismos deben establecerse con el atributo {{htmlattrxref("tabindex")}} (vea Building keyboard accessibility back in para mas detalles).

- -

A diferencia de MSIE, en que casi toda clase de elemento puede recibir el evento focus, en los navegadores Gecko en los que casi todos los elementos NO reciben este evento.

- -

Especificaciones

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG','webappapis.html#handler-onfocus','onfocus')}}{{Spec2('HTML WHATWG')}}
- -

Compatibilidad con los Navegadores

- -{{Compat("api.GlobalEventHandlers.onfocus")}} diff --git a/files/es/web/api/window/focus_event/index.md b/files/es/web/api/window/focus_event/index.md new file mode 100644 index 00000000000000..e5ff183b59a16b --- /dev/null +++ b/files/es/web/api/window/focus_event/index.md @@ -0,0 +1,33 @@ +--- +title: GlobalEventHandlers.onfocus +slug: Web/API/Window/focus_event +translation_of: Web/API/GlobalEventHandlers/onfocus +original_slug: Web/API/GlobalEventHandlers/onfocus +--- +{{ApiRef("HTML DOM")}} + +La propiedad **onfocus** devuelve un manejador de eventos para el evento onFocus en el elemento actual. + +## Sintaxis + +```js +element.onfocus = event handling code +``` + +## Notas + +El evento focus se dispara cuando el usuario establece el foco en el elemento. + +Para que el evento `onfocus` se dispare en elementos que no sean inputs, los mismos deben establecerse con el atributo {{htmlattrxref("tabindex")}} (vea [Building keyboard accessibility back in](/es/docs/Learn/Accessibility/HTML#Building_keyboard_accessibility_back_in) para mas detalles). + +A diferencia de MSIE, en que casi toda clase de elemento puede recibir el evento focus, en los navegadores Gecko en los que casi todos los elementos NO reciben este evento. + +## Especificaciones + +| Specification | Status | Comment | +| ------------------------------------------------------------------------------------------------ | -------------------------------- | ------- | +| {{SpecName('HTML WHATWG','webappapis.html#handler-onfocus','onfocus')}} | {{Spec2('HTML WHATWG')}} | | + +## Compatibilidad con los Navegadores + +{{Compat("api.GlobalEventHandlers.onfocus")}} diff --git a/files/es/web/api/window/frameelement/index.html b/files/es/web/api/window/frameelement/index.html deleted file mode 100644 index bc0caed4731b84..00000000000000 --- a/files/es/web/api/window/frameelement/index.html +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: Window.frameElement -slug: Web/API/Window/frameElement -translation_of: Web/API/Window/frameElement ---- -
{{ ApiRef }}
- -

Retorna el elemento (como es {{HTMLElement("iframe")}} ó {{HTMLElement("object")}}) en el cual la ventana está incrustada o null si el elemento es bien de nivel superior (top-level) o bien está inrustada en un documento con un origen de diferente; esto es, en situaciones de origen cruzado.

- -

Sintaxes

- -
frameEl = window.frameElement;
-
- -
    -
  • frame El es el elemento dentro del cual está empotrada la ventana. Si la ventana no está incrustada dentro de otro documento, o si el documento en el que está empotrada tiene un origen diferente (como procede de un dominio diferente), este valor será null.
  • -
- -
-

A pesar del nombre de esta propiedad, funciona para documentos empotrados en cualquier forma o método de incrustación, incluyendo {{HTMLElement("object")}}, {{HTMLElement("iframe")}}, or {{HTMLElement("embed")}}.

-
- -

Ejemplo

- -
var frameEl = window.frameElement;
-// Si estamos empotrados, cambia la URL de elemento contenedor to 'http://mozilla.org/'
-if (frameEl) {
-  frameEl.src = 'http://mozilla.org/';
-}
-
- -

Especificaciones

- - - - - - - - - - - - - - - - -
EspecificaciónEstadoObservaciones
{{ SpecName('HTML WHATWG', '#dom-frameelement', 'Window.frameElement') }}{{ Spec2('WebRTC 1.0') }}Especificación inicial.
- -

Compatibilidad con navegadores

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

Ver también

- -
    -
  • {{domxref("window.frames")}} retorna un objeto enumerable, listando los sub-frames directos de la ventana actual.
  • -
  • {{domxref("window.parent")}} retorna la ventana padre, la cual es la ventana que contiene el frameElement de la ventana hija.
  • -
diff --git a/files/es/web/api/window/frameelement/index.md b/files/es/web/api/window/frameelement/index.md new file mode 100644 index 00000000000000..f7e92c02422970 --- /dev/null +++ b/files/es/web/api/window/frameelement/index.md @@ -0,0 +1,43 @@ +--- +title: Window.frameElement +slug: Web/API/Window/frameElement +translation_of: Web/API/Window/frameElement +--- +{{ ApiRef }} + +Retorna el elemento (como es {{HTMLElement("iframe")}} ó {{HTMLElement("object")}}) en el cual la ventana está incrustada o `null` si el elemento es bien de nivel superior (top-level) o bien está inrustada en un documento con un origen de diferente; esto es, en situaciones de origen cruzado. + +## Sintaxes + +```js +frameEl = window.frameElement; +``` + +- `frame El` es el elemento dentro del cual está empotrada la ventana. Si la ventana no está incrustada dentro de otro documento, o si el documento en el que está empotrada tiene un origen diferente (como procede de un dominio diferente), este valor será `null`. + +> **Nota:** A pesar del nombre de esta propiedad, funciona para documentos empotrados en cualquier forma o método de incrustación, incluyendo {{HTMLElement("object")}}, {{HTMLElement("iframe")}}, or {{HTMLElement("embed")}}. + +## Ejemplo + +```js +var frameEl = window.frameElement; +// Si estamos empotrados, cambia la URL de elemento contenedor to 'http://mozilla.org/' +if (frameEl) { + frameEl.src = 'http://mozilla.org/'; +} +``` + +## Especificaciones + +| Especificación | Estado | Observaciones | +| ------------------------------------------------------------------------------------------------ | -------------------------------- | ----------------------- | +| {{ SpecName('HTML WHATWG', '#dom-frameelement', 'Window.frameElement') }} | {{ Spec2('WebRTC 1.0') }} | Especificación inicial. | + +## Compatibilidad con navegadores + +{{Compat("api.Window.frameElement")}} + +## Ver también + +- {{domxref("window.frames")}} retorna un objeto enumerable, listando los sub-frames directos de la ventana actual. +- {{domxref("window.parent")}} retorna la ventana padre, la cual es la ventana que contiene el `frameElement` de la ventana hija. diff --git a/files/es/web/api/window/fullscreen/index.html b/files/es/web/api/window/fullscreen/index.html deleted file mode 100644 index 5726127d5fb166..00000000000000 --- a/files/es/web/api/window/fullscreen/index.html +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: window.fullScreen -slug: Web/API/Window/fullScreen -tags: - - Referencia_DOM_de_Gecko - - páginas_a_traducir -translation_of: Web/API/Window/fullScreen ---- -
{{APIRef}}
- -

Resumen

- -

Esta propiedad indica si la ventana se presenta en modo de pantalla comleta o no. Su funcionamiento es sólo fiable a partir de Gecko 1.9 (Firefox 3), ver Notas más abajo.

- -

Sintaxis

- -
var isInFullScreen = windowRef.fullScreen;
-
- -


- Con privilegios chrome, el valor de esta propiedad se puede cambiar, de otra forma, es de sólo lectura. Ten en cuenta que si intentas cambiar el valor de esta propiedad sin tener privilegios chrome, no cambiará nada y la propiedad simplemente fallará. Esto se hace para evitar que los programas diseñados para Internet Explorer fallen.

- -

Valor devuelto

- -
-
isInFullScreen
-
Un valorbinario . Los valores posibles son:
-
- -
    -
  • true: (Cierto) la ventana esta en modo pantalla completa.
  • -
  • false: (Falso)la ventana NO esta en modo pantalla completa.
  • -
- -

Ejemplos

- -

Especificaciones

- -

DOM nivel 0. window.fullScreen no forma parte de ninguna especificación W3C.

- -

Notas

- -

El funcionamiento de esta propiedad es fiable sólo en Mozilla 1.9 (Firefox 3) y posteriores. Mozilla 1.8 y versiones anteriores manejan esta propiedad pero el valor devuelto es siempre false, aún cuando la ventana está en modo pantalla completa ({{ Bug(127013) }}).

diff --git a/files/es/web/api/window/fullscreen/index.md b/files/es/web/api/window/fullscreen/index.md new file mode 100644 index 00000000000000..8f88c40f29333d --- /dev/null +++ b/files/es/web/api/window/fullscreen/index.md @@ -0,0 +1,41 @@ +--- +title: window.fullScreen +slug: Web/API/Window/fullScreen +tags: + - Referencia_DOM_de_Gecko + - páginas_a_traducir +translation_of: Web/API/Window/fullScreen +--- +{{APIRef}} + +### Resumen + +Esta propiedad indica si la ventana se presenta en modo de pantalla comleta o no. Su funcionamiento es sólo fiable a partir de Gecko 1.9 (Firefox 3), ver Notas más abajo. + +### Sintaxis + +```js +var isInFullScreen = windowRef.fullScreen; +``` + +Con privilegios chrome, el valor de esta propiedad se puede cambiar, de otra forma, es de sólo lectura. Ten en cuenta que si intentas cambiar el valor de esta propiedad sin tener privilegios chrome, no cambiará nada y la propiedad simplemente fallará. Esto se hace para evitar que los programas diseñados para Internet Explorer fallen. + +### Valor devuelto + +- `isInFullScreen` + - : Un valor*binario* . Los valores posibles son: + + + +- `true`: (Cierto) la ventana esta en modo pantalla completa. +- `false`: (Falso)la ventana NO esta en modo pantalla completa. + +### Ejemplos + +### Especificaciones + +DOM nivel 0. `window.fullScreen` no forma parte de ninguna especificación W3C. + +### Notas + +El funcionamiento de esta propiedad es fiable sólo en Mozilla 1.9 (Firefox 3) y posteriores. Mozilla 1.8 y versiones anteriores manejan esta propiedad pero el valor devuelto es siempre `false`, aún cuando la ventana está en modo pantalla completa ({{ Bug(127013) }}). diff --git a/files/es/web/api/window/getcomputedstyle/index.html b/files/es/web/api/window/getcomputedstyle/index.html deleted file mode 100644 index ab8daf26086bb7..00000000000000 --- a/files/es/web/api/window/getcomputedstyle/index.html +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: Window.getComputedStyle -slug: Web/API/Window/getComputedStyle -translation_of: Web/API/Window/getComputedStyle ---- -

{{ ApiRef() }}

-

Resumen

-

Devuelve el estilo computado del elemento. Los estilos computados representan los valores finales computed (en) de las propiedades CSS del elemento.

-

Sintaxis

-
var style = window.getComputedStyle(element, pseudoElt);
-
-
    -
  • element es un element.
  • -
  • pseudoElt es una cadena que especifica el pseudo elemento a tratar. Debería ser una cadena vacia para la mayoría de los elementos element.
  • -
  • style es un objeto del tipo CSSStyleDeclaration .
  • -
-

Ejemplo

-
var element = document.getElementById(“elemId”);
-var style = document.defaultView.getComputedStyle(element, pseudoElt);
-
-

Descripción

-

El objeto devuelto es del mismo tipo que el objeto devuelto por la propiedad style del elemento, sin embargo ambos objetos tienen un propósito distinto. El objeto devuelto por getComputedStyle es de sólo lectura y puede usarse para inspeccionar el estilo del elemento (incluyendo los estilos de una etiqueta <style> o una hoja de estlo). El objeto elt.style debería usarse para establecerel estilo de un elemento específico.

-

El primer argumento debe ser un Element, no un nodo (como en #texto Node).

-

Especificación

-

DOM Level 2 Style: getComputedStyle

diff --git a/files/es/web/api/window/getcomputedstyle/index.md b/files/es/web/api/window/getcomputedstyle/index.md new file mode 100644 index 00000000000000..64b8fe2e5a04b8 --- /dev/null +++ b/files/es/web/api/window/getcomputedstyle/index.md @@ -0,0 +1,37 @@ +--- +title: Window.getComputedStyle +slug: Web/API/Window/getComputedStyle +translation_of: Web/API/Window/getComputedStyle +--- +{{ ApiRef() }} + +### Resumen + +Devuelve el estilo computado del elemento. Los estilos computados representan los valores finales [computed (en)](http://www.w3.org/TR/1998/REC-CSS2-19980512/cascade.html#computed-value) de las propiedades CSS del elemento. + +### Sintaxis + +```js +var style = window.getComputedStyle(element, pseudoElt); +``` + +- `element` es un [element](/es/DOM/element "en/DOM/element"). +- `pseudoElt` es una cadena que especifica el pseudo elemento a tratar. Debería ser una cadena vacia para la mayoría de los elementos element. +- `style` es un objeto del tipo [`CSSStyleDeclaration`](http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSview-getComputedStyle) . + +### Ejemplo + +```js +var element = document.getElementById(“elemId”); +var style = document.defaultView.getComputedStyle(element, pseudoElt); +``` + +### Descripción + +El objeto devuelto es del mismo tipo que el objeto devuelto por la propiedad [style](/es/DOM/element.style "es/DOM/element.style") del elemento, sin embargo ambos objetos tienen un propósito distinto. El objeto devuelto por `getComputedStyle` es de sólo lectura y puede usarse para inspeccionar el estilo del elemento (incluyendo los estilos de una etiqueta \ + + + +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ultrices dolor ac dolor imperdiet ullamcorper. Suspendisse quam libero, luctus auctor mollis sed, malesuada condimentum magna. Quisque in ante tellus, in placerat est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec a mi magna, quis mattis dolor. Etiam sit amet ligula quis urna auctor imperdiet nec faucibus ante. Mauris vel consectetur dolor. Nunc eget elit eget velit pulvinar fringilla consectetur aliquam purus. Curabitur convallis, justo posuere porta egestas, velit erat ornare tortor, non viverra justo diam eget arcu. Phasellus adipiscing fermentum nibh ac commodo. Nam turpis nunc, suscipit a hendrerit vitae, volutpat non ipsum.

+

Duis lobortis sapien quis nisl luctus porttitor. In tempor semper libero, eu tincidunt dolor eleifend sit amet. Ut nec velit in dolor tincidunt rhoncus non non diam. Morbi auctor ornare orci, non euismod felis gravida nec. Curabitur elementum nisi a eros rutrum nec blandit diam placerat. Aenean tincidunt risus ut nisi consectetur cursus. Ut vitae quam elit. Donec dignissim est in quam tempor consequat. Aliquam aliquam diam non felis convallis suscipit. Nulla facilisi. Donec lacus risus, dignissim et fringilla et, egestas vel eros. Duis malesuada accumsan dui, at fringilla mauris bibendum quis. Cras adipiscing ultricies fermentum. Praesent bibendum condimentum feugiat.

+

Go to bookmark #2 ]

+

Vivamus blandit massa ut metus mattis in fringilla lectus imperdiet. Proin ac ante a felis ornare vehicula. Fusce pellentesque lacus vitae eros convallis ut mollis magna pellentesque. Pellentesque placerat enim at lacus ultricies vitae facilisis nisi fringilla. In tincidunt tincidunt tincidunt. Nulla vitae tempor nisl. Etiam congue, elit vitae egestas mollis, ipsum nisi malesuada turpis, a volutpat arcu arcu id risus.

+

Nam faucibus, ligula eu fringilla pulvinar, lectus tellus iaculis nunc, vitae scelerisque metus leo non metus. Proin mattis lobortis lobortis. Quisque accumsan faucibus erat, vel varius tortor ultricies ac. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nec libero nunc. Nullam tortor nunc, elementum a consectetur et, ultrices eu orci. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a nisl eu sem vehicula egestas.

+

Aenean viverra varius mauris, sed elementum lacus interdum non. Phasellus sit amet lectus vitae eros egestas pellentesque fermentum eget magna. Quisque mauris nisl, gravida vitae placerat et, condimentum id metus. Nulla eu est dictum dolor pulvinar volutpat. Pellentesque vitae sollicitudin nunc. Donec neque magna, lobortis id egestas nec, sodales quis lectus. Fusce cursus sollicitudin porta. Suspendisse ut tortor in mauris tincidunt rhoncus. Maecenas tincidunt fermentum facilisis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

+

Suspendisse turpis nisl, consectetur in lacinia ut, ornare vel mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin non lectus eu turpis vulputate cursus. Mauris interdum tincidunt erat id pharetra. Nullam in libero elit, sed consequat lectus. Morbi odio nisi, porta vitae molestie ut, gravida ut nunc. Ut non est dui, id ullamcorper orci. Praesent vel elementum felis. Maecenas ornare, dui quis auctor hendrerit, turpis sem ullamcorper odio, in auctor magna metus quis leo. Morbi at odio ante.

+

Curabitur est ipsum, porta ac viverra faucibus, eleifend sed eros. In sit amet vehicula tortor. Vestibulum viverra pellentesque erat a elementum. Integer commodo ultricies lorem, eget tincidunt risus viverra et. In enim turpis, porttitor ac ornare et, suscipit sit amet nisl. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque vel ultrices nibh. Sed commodo aliquam aliquam. Nulla euismod, odio ut eleifend mollis, nisi dui gravida nibh, vitae laoreet turpis purus id ipsum. Donec convallis, velit non scelerisque bibendum, diam nulla auctor nunc, vel dictum risus ipsum sit amet est. Praesent ut nibh sit amet nibh congue pulvinar. Suspendisse dictum porttitor tempor.

+

Vestibulum dignissim erat vitae lectus auctor ac bibendum eros semper. Integer aliquet, leo non ornare faucibus, risus arcu tristique dolor, a aliquet massa mauris quis arcu. In porttitor, lectus ac semper egestas, ligula magna laoreet libero, eu commodo mauris odio id ante. In hac habitasse platea dictumst. In pretium erat diam, nec consequat eros. Praesent augue mi, consequat sed porttitor at, volutpat vitae eros. Sed pretium pharetra dapibus. Donec auctor interdum erat, lacinia molestie nibh commodo ut. Maecenas vestibulum vulputate felis, ut ullamcorper arcu faucibus in. Curabitur id arcu est. In semper mollis lorem at pellentesque. Sed lectus nisl, vestibulum id scelerisque eu, feugiat et tortor. Pellentesque porttitor facilisis ultricies.

+

Go to bookmark #1 | Go to bookmark #1 without using location.hash | Go to bookmark #3 ]

+

Phasellus tempus fringilla nunc, eget sagittis orci molestie vel. Nulla sollicitudin diam non quam iaculis ac porta justo venenatis. Quisque tellus urna, molestie vitae egestas sit amet, suscipit sed sem. Quisque nec lorem eu velit faucibus tristique ut ut dolor. Cras eu tortor ut libero placerat venenatis ut ut massa. Sed quis libero augue, et consequat libero. Morbi rutrum augue sed turpis elementum sed luctus nisl molestie. Aenean vitae purus risus, a semper nisl. Pellentesque malesuada, est id sagittis consequat, libero mauris tincidunt tellus, eu sagittis arcu purus rutrum eros. Quisque eget eleifend mi. Duis pharetra mi ac eros mattis lacinia rutrum ipsum varius.

+

Fusce cursus pulvinar aliquam. Duis justo enim, ornare vitae elementum sed, porta a quam. Aliquam eu enim eu libero mollis tempus. Morbi ornare aliquam posuere. Proin faucibus luctus libero, sed ultrices lorem sagittis et. Vestibulum malesuada, ante nec molestie vehicula, quam diam mollis ipsum, rhoncus posuere mauris lectus in eros. Nullam feugiat ultrices augue, ac sodales sem mollis in.

+

Here is the bookmark #3

+

Proin vitae sem non lorem pellentesque molestie. Nam tempus massa et turpis placerat sit amet sollicitudin orci sodales. Pellentesque enim enim, sagittis a lobortis ut, tempus sed arcu. Aliquam augue turpis, varius vel bibendum ut, aliquam at diam. Nam lobortis, dui eu hendrerit pellentesque, sem neque porttitor erat, non dapibus velit lectus in metus. Vestibulum sit amet felis enim. In quis est vitae nunc malesuada consequat nec nec sapien. Suspendisse aliquam massa placerat dui lacinia luctus sed vitae risus. Fusce tempus, neque id ultrices volutpat, mi urna auctor arcu, viverra semper libero sem vel enim. Mauris dictum, elit non placerat malesuada, libero elit euismod nibh, nec posuere massa arcu eu risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer urna velit, dapibus eget varius feugiat, pellentesque sit amet ligula. Maecenas nulla nisl, facilisis eu egestas scelerisque, mollis eget metus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi sed congue mi.

+

Fusce metus velit, pharetra at vestibulum nec, facilisis porttitor mi. Curabitur ligula sapien, fermentum vel porttitor id, rutrum sit amet magna. Sed sit amet sollicitudin turpis. Aenean luctus rhoncus dolor, et pulvinar ante egestas et. Donec ac massa orci, quis dapibus augue. Vivamus consectetur auctor pellentesque. Praesent vestibulum tincidunt ante sed consectetur. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce purus metus, imperdiet vitae iaculis convallis, bibendum vitae turpis.

+

Fusce aliquet molestie dolor, in ornare dui sodales nec. In molestie sollicitudin felis a porta. Mauris nec orci sit amet orci blandit tristique congue nec nunc. Praesent et tellus sollicitudin mauris accumsan fringilla. Morbi sodales, justo eu sollicitudin lacinia, lectus sapien ullamcorper eros, quis molestie urna elit bibendum risus. Proin eget tincidunt quam. Nam luctus commodo mauris, eu posuere nunc luctus non. Nulla facilisi. Vivamus eget leo rhoncus quam accumsan fringilla. Aliquam sit amet lorem est. Nullam vel tellus nibh, id imperdiet orci. Integer egestas leo eu turpis blandit scelerisque.

+

Etiam in blandit tellus. Integer sed varius quam. Vestibulum dapibus mi gravida arcu viverra blandit. Praesent tristique augue id sem adipiscing pellentesque. Sed sollicitudin, leo sed interdum elementum, nisi ante condimentum leo, eget ornare libero diam semper quam. Vivamus augue urna, porta eget ultrices et, dapibus ut ligula. Ut laoreet consequat faucibus. Praesent at lectus ut lectus malesuada mollis. Nam interdum adipiscing eros, nec sodales mi porta nec. Proin et quam vitae sem interdum aliquet. Proin vel odio at lacus vehicula aliquet.

+

Etiam placerat dui ut sem ornare vel vestibulum augue mattis. Sed semper malesuada mi, eu bibendum lacus lobortis nec. Etiam fringilla elementum risus, eget consequat urna laoreet nec. Etiam mollis quam non sem convallis vel consectetur lectus ullamcorper. Aenean mattis lacus quis ligula mattis eget vestibulum diam hendrerit. In non placerat mauris. Praesent faucibus nunc quis eros sagittis viverra. In hac habitasse platea dictumst. Suspendisse eget nisl erat, ac molestie massa. Praesent mollis vestibulum tincidunt. Fusce suscipit laoreet malesuada. Aliquam erat volutpat. Aliquam dictum elementum rhoncus. Praesent in est massa, pulvinar sodales nunc. Pellentesque gravida euismod mi ac convallis.

+

Mauris vel odio vel nulla facilisis lacinia. Aliquam ultrices est at leo blandit tincidunt. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse porttitor adipiscing facilisis. Duis cursus quam iaculis augue interdum porttitor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis vulputate magna ac metus pretium condimentum. In tempus, est eget vestibulum blandit, velit massa dignissim nisl, ut scelerisque lorem neque vel velit. Maecenas fermentum commodo viverra. Curabitur a nibh non velit aliquam cursus. Integer semper condimentum tortor a pellentesque. Pellentesque semper, nisl id porttitor vehicula, sem dui feugiat lacus, vitae consequat augue urna vel odio.

+

Vestibulum id neque nec turpis iaculis pulvinar et a massa. Vestibulum sed nibh vitae arcu eleifend egestas. Mauris fermentum ultrices blandit. Suspendisse vitae lorem libero. Aenean et pellentesque tellus. Morbi quis neque orci, eu dignissim dui. Fusce sollicitudin mauris ac arcu vestibulum imperdiet. Proin ultricies nisl sit amet enim imperdiet eu ornare dui tempus. Maecenas lobortis nisi a tortor vestibulum vel eleifend tellus vestibulum. Donec metus sapien, hendrerit a fermentum id, dictum quis libero.

+

Pellentesque a lorem nulla, in tempor justo. Duis odio nisl, dignissim sed consequat sit amet, hendrerit ac neque. Nunc ac augue nec massa tempor rhoncus. Nam feugiat, tellus a varius euismod, justo nisl faucibus velit, ut vulputate justo massa eu nibh. Sed bibendum urna quis magna facilisis in accumsan dolor malesuada. Morbi sit amet nunc risus, in faucibus sem. Nullam sollicitudin magna sed sem mollis id commodo libero condimentum. Duis eu massa et lacus semper molestie ut adipiscing sem.

+

Sed id nulla mi, eget suscipit eros. Aliquam tempus molestie rutrum. In quis varius elit. Nullam dignissim neque nec velit vulputate porttitor. Mauris ac ligula sit amet elit fermentum rhoncus. In tellus urna, pulvinar quis condimentum ut, porta nec justo. In hac habitasse platea dictumst. Proin volutpat elit id quam molestie ac commodo lacus sagittis. Quisque placerat, augue tempor placerat pulvinar, nisi nisi venenatis urna, eget convallis eros velit quis magna. Suspendisse volutpat iaculis quam, ut tristique lacus luctus quis.

+

Nullam commodo suscipit lacus non aliquet. Phasellus ac nisl lorem, sed facilisis ligula. Nam cursus lobortis placerat. Sed dui nisi, elementum eu sodales ac, placerat sit amet mauris. Pellentesque dapibus tellus ut ipsum aliquam eu auctor dui vehicula. Quisque ultrices laoreet erat, at ultrices tortor sodales non. Sed venenatis luctus magna, ultricies ultricies nunc fringilla eget. Praesent scelerisque urna vitae nibh tristique varius consequat neque luctus. Integer ornare, erat a porta tempus, velit justo fermentum elit, a fermentum metus nisi eu ipsum. Vivamus eget augue vel dui viverra adipiscing congue ut massa. Praesent vitae eros erat, pulvinar laoreet magna. Maecenas vestibulum mollis nunc in posuere. Pellentesque sit amet metus a turpis lobortis tempor eu vel tortor. Cras sodales eleifend interdum.

+ + +``` + +> **Nota:** La función showNode es también un ejemplo del uso del ciclo [`for`](/en/JavaScript/Reference/Statements/for "en/JavaScript/Reference/Statements/for") sin una sección de `statement`. En este caso **un punto y coma es siempre puesto inmediatamente después de la declaración de el ciclo.** + +…De igual manera pero con un scroll animado: + +```js +var showBookmark = (function () { + var _useHash, _scrollX, _scrollY, _nodeX, _nodeY, _itFrame, _scrollId = -1, _bookMark, + /* + * nDuration: the duration in milliseconds of each frame + * nFrames: number of frames for each scroll + */ + nDuration = 200, nFrames = 10; + + function _next () { + if (_itFrame > nFrames) { clearInterval(_scrollId); _scrollId = -1; return; } + _isBot = true; + document.documentElement.scrollTop = Math.round(_scrollY + (_nodeY - _scrollY) * _itFrame / nFrames); + document.documentElement.scrollLeft = Math.round(_scrollX + (_nodeX - _scrollX) * _itFrame / nFrames); + if (_useHash && _itFrame === nFrames) { location.hash = _bookMark; } + _itFrame++; + } + + function _chkOwner () { + if (_isBot) { _isBot = false; return; } + if (_scrollId > -1) { clearInterval(_scrollId); _scrollId = -1; } + } + + if (window.addEventListener) { window.addEventListener("scroll", _chkOwner, false); } + else if (window.attachEvent) { window.attachEvent("onscroll", _chkOwner); } + + return function (sBookmark, bUseHash) { + _scrollY = document.documentElement.scrollTop; + _scrollX = document.documentElement.scrollLeft; + _bookMark = sBookmark; + _useHash = arguments.length === 1 || bUseHash; + for ( + var nLeft = 0, nTop = 0, oNode = document.querySelector(sBookmark); + oNode; + nLeft += oNode.offsetLeft, nTop += oNode.offsetTop, oNode = oNode.offsetParent + ); + _nodeX = nLeft, _nodeY = nTop, _itFrame = 1; + if (_scrollId === -1) { _scrollId = setInterval(_next, Math.round(nDuration / nFrames)); } + }; +})(); +``` + +## Especificaciones + +| Specification | Status | Comment | +| ---------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------------------------------------ | +| {{SpecName('HTML WHATWG', "history.html#the-location-interface", "Window.location")}} | {{Spec2('HTML WHATWG')}} | No change from {{SpecName("HTML5 W3C")}}. | +| {{SpecName('HTML5 W3C', "browsers.html#the-location-interface", "Window.location")}} | {{Spec2('HTML5 W3C')}} | Initial definition. | + +## Compatibilidad entre navegadores + +{{Compat("api.Window.location")}} + +## Ver también + +- La interfaz de retorno de un valor, {{domxref("Location")}}. +- Información similar, pero agregando contexto del navegador, {{domxref("Document.location")}} +- [Manipulando el historial del navegador](/es/docs/DOM/Mozilla_event_reference/hashchange) +- [hashchange](/es/docs/DOM/Mozilla_event_reference/hashchange) diff --git a/files/es/web/api/window/locationbar/index.html b/files/es/web/api/window/locationbar/index.html deleted file mode 100644 index cb056fd141cbc8..00000000000000 --- a/files/es/web/api/window/locationbar/index.html +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: Window.locationbar -slug: Web/API/Window/locationbar -translation_of: Web/API/Window/locationbar ---- -
{{APIRef}}
- - - -

Devuelve el objeto locationbar, del cual se puede comprobar su visibilidad.

- -

Sintaxis

- -
objRef = window.locationbar
-
- -

Ejemplo

- -

El siguiente ejemplo completo en HTML, muestra la forma en la que se utiliza la propiedad visible del objeto locationbar.

- -
<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="UTF-8" />
-<title>Various DOM Tests</title>
-
-<script>
-var visible = window.locationbar.visible;
-</script>
-
-</head>
-<body>
-  <p>Various DOM Tests</p>
-</body>
-</html>
-
- -

Especificaciones

- - - - - - - - - - - - - - - - - - - -
EspecificaciónEstadoComentario
{{SpecName('HTML WHATWG', 'browsers.html#dom-window-locationbar', 'Window.locationbar')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5 W3C', 'browsers.html#dom-window-locationbar', 'Window.locationbar')}}{{Spec2('HTML5 W3C')}}
- -

Ver también

- -
    -
  • {{domxref("window.locationbar")}}, {{domxref("window.menubar")}}, {{domxref("window.personalbar")}}, {{domxref("window.scrollbars")}}, {{domxref("window.statusbar")}}, {{domxref("window.toolbar")}}
  • -
diff --git a/files/es/web/api/window/locationbar/index.md b/files/es/web/api/window/locationbar/index.md new file mode 100644 index 00000000000000..e0c5638f09b2f4 --- /dev/null +++ b/files/es/web/api/window/locationbar/index.md @@ -0,0 +1,47 @@ +--- +title: Window.locationbar +slug: Web/API/Window/locationbar +translation_of: Web/API/Window/locationbar +--- +{{APIRef}} + +Devuelve el objeto `locationbar`, del cual se puede comprobar su visibilidad. + +## Sintaxis + +```js +objRef = window.locationbar +``` + +## Ejemplo + +El siguiente ejemplo completo en HTML, muestra la forma en la que se utiliza la propiedad `visible `del objeto `locationbar.` + +```html + + + + +Various DOM Tests + + + + + +

Various DOM Tests

+ + +``` + +## Especificaciones + +| Especificación | Estado | Comentario | +| ------------------------------------------------------------------------------------------------------------------------ | -------------------------------- | ---------- | +| {{SpecName('HTML WHATWG', 'browsers.html#dom-window-locationbar', 'Window.locationbar')}} | {{Spec2('HTML WHATWG')}} | | +| {{SpecName('HTML5 W3C', 'browsers.html#dom-window-locationbar', 'Window.locationbar')}} | {{Spec2('HTML5 W3C')}} | | + +## Ver también + +- {{domxref("window.locationbar")}}, {{domxref("window.menubar")}}, {{domxref("window.personalbar")}}, {{domxref("window.scrollbars")}}, {{domxref("window.statusbar")}}, {{domxref("window.toolbar")}} diff --git a/files/es/web/api/window/matchmedia/index.html b/files/es/web/api/window/matchmedia/index.html deleted file mode 100644 index a443825c408854..00000000000000 --- a/files/es/web/api/window/matchmedia/index.html +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: Window.matchMedia() -slug: Web/API/Window/matchMedia -tags: - - API - - CSSOM View - - JavaScript - - Media Queries - - Referencia - - Window - - metodo -translation_of: Web/API/Window/matchMedia ---- -
{{APIRef}}
- -

El método Window.matchMedia() devuelve un nuevo objeto {{domxref("MediaQueryList")}} que representa los analizados de la media query indicada.

- -

Sintaxis

- -
mql = window.matchMedia(mediaQueryString)
- -

Donde mediaQueryString es una cadena de texto que representa la media query de la que devolver un nuevo objeto {{domxref("MediaQueryList")}}.

- -

Ejemplo

- -

Este código le permite manejar las cosas de forma diferente cuando la ventana es muy estrecha.

- -
if (window.matchMedia("(min-width: 400px)").matches) {
-  /* La pantalla tiene al menos 400 píxeles de ancho */
-} else {
-  /* La pantalla tiene menos de 400 píxeles de ancho */
-}
- -

Consulte Probando media queries para ver ejemplos adicionales.

- -

Especificaciones

- - - - - - - - - - - - - - - - -
EspecificaciónEstadoComentario
{{SpecName("CSSOM View", "#dom-window-matchmedia", "Window.matchMedia()")}}{{Spec2("CSSOM View")}}Definición initial
- -

Compatibilidad en navegadores

- -

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

- -

Ver también

- - diff --git a/files/es/web/api/window/matchmedia/index.md b/files/es/web/api/window/matchmedia/index.md new file mode 100644 index 00000000000000..818db116787c5c --- /dev/null +++ b/files/es/web/api/window/matchmedia/index.md @@ -0,0 +1,56 @@ +--- +title: Window.matchMedia() +slug: Web/API/Window/matchMedia +tags: + - API + - CSSOM View + - JavaScript + - Media Queries + - Referencia + - Window + - metodo +translation_of: Web/API/Window/matchMedia +--- +{{APIRef}} + +El método **`Window.matchMedia()`** devuelve un nuevo objeto {{domxref("MediaQueryList")}} que representa los analizados de la [media query](/es/docs/CSS/Media_queries "CSS/Media queries") indicada. + +## Sintaxis + +```js +mql = window.matchMedia(mediaQueryString) +``` + +Donde `mediaQueryString` es una cadena de texto que representa la media query de la que devolver un nuevo objeto {{domxref("MediaQueryList")}}. + +## Ejemplo + +Este código le permite manejar las cosas de forma diferente cuando la ventana es muy estrecha. + +```js +if (window.matchMedia("(min-width: 400px)").matches) { + /* La pantalla tiene al menos 400 píxeles de ancho */ +} else { + /* La pantalla tiene menos de 400 píxeles de ancho */ +} +``` + +Consulte [Probando media queries](/es/docs/DOM/Using_media_queries_from_code "CSS/Using media queries from code") para ver ejemplos adicionales. + +## Especificaciones + +| Especificación | Estado | Comentario | +| ---------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------ | +| {{SpecName("CSSOM View", "#dom-window-matchmedia", "Window.matchMedia()")}} | {{Spec2("CSSOM View")}} | Definición initial | + +## Compatibilidad en navegadores + +{{Compat("api.Window.matchMedia")}} + +## Ver también + +- [Media queries](/es/docs/CSS/Media_queries "CSS/Media queries") +- [Probando media queries](/es/docs/Web/Guide/CSS/probando_media_queries "CSS/Probando media queries +") +- {{domxref("MediaQueryList")}} +- {{domxref("MediaQueryListListener")}} diff --git a/files/es/web/api/window/menubar/index.html b/files/es/web/api/window/menubar/index.html deleted file mode 100644 index 9ed7626d3b5660..00000000000000 --- a/files/es/web/api/window/menubar/index.html +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: Window.menubar -slug: Web/API/Window/menubar -translation_of: Web/API/Window/menubar ---- -

{{ APIRef() }}

- -

Resumen

- -

Retorna el objeto menubar, cuya visibilidad puede ser examinada.

- -

Sintaxis

- -
objRef = window.menubar
-
- -

Ejemplo

- -

El siguiente ejemplo HTML completo muestra la forma en que es utilizada la propiedad visible del objeto menubar.

- -
<html>
-<head>
-  <title>Various DOM Tests</title>
-  <script>
-    var visible = window.menubar.visible;
-  </script>
-</head>
-<body>
-  <p>Various DOM Tests</p>
-</body>
-</html>
-
- -

Ver también:

- -

window.locationbar, window.personalbar, window.scrollbars, window.statusbar, window.toolbar

- -

- -

Especificación

- -

HTML5

diff --git a/files/es/web/api/window/menubar/index.md b/files/es/web/api/window/menubar/index.md new file mode 100644 index 00000000000000..6a30d929b1c803 --- /dev/null +++ b/files/es/web/api/window/menubar/index.md @@ -0,0 +1,42 @@ +--- +title: Window.menubar +slug: Web/API/Window/menubar +translation_of: Web/API/Window/menubar +--- +{{ APIRef() }} + +### Resumen + +Retorna el objeto **menubar**, cuya visibilidad puede ser examinada. + +### Sintaxis + +```js +objRef = window.menubar +``` + +### Ejemplo + +El siguiente ejemplo HTML completo muestra la forma en que es utilizada la propiedad visible del objeto menubar. + +```html + + + Various DOM Tests + + + +

Various DOM Tests

+ + +``` + +### Ver también: + +[window.locationbar](/en/DOM/window.locationbar "en/DOM/window.locationbar"),[ window.personalbar](/en/DOM/window.personalbar "en/DOM/window.personalbar"),[ window.scrollbars](/en/DOM/window.scrollbars "en/DOM/window.scrollbars"), [window.statusbar](/en/DOM/window.statusbar "en/DOM/window.statusbar"),[ window.toolbar](/en/DOM/window.toolbar "en/DOM/window.toolbar") + +### Especificación + +HTML5 diff --git a/files/es/web/api/window/moveby/index.html b/files/es/web/api/window/moveby/index.html deleted file mode 100644 index ff7b9b1a1f055c..00000000000000 --- a/files/es/web/api/window/moveby/index.html +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: Window.moveBy() -slug: Web/API/Window/moveBy -translation_of: Web/API/Window/moveBy ---- -
{{APIRef}}
- -

Resumen

- -

Mueve la actual ventana a consecuencia de una cantidad especificada.

- -

Sintaxis

- -
window.moveBy(deltaX, deltaY)
-
- -

Parametros

- -
    -
  • deltaX es la cantidad de pixeles a mover la ventana horizontalmente.
  • -
  • deltaY es la cantidad de pixeles a mover la ventana verticalmente.
  • -
- -

Ejemplo

- -
function budge() {
-  moveBy(10, -10);
-}
- -

Notes

- -

Puedes usar numeros negativos como parametros para esta función. Esta función realiza un movimiento relativo mientras que {{domxref("window.moveTo")}} hace un movimiento absoluto.

- -

Desde Firefox 7, no es posible para un sitio web mover una ventana en el navegador, deacuerdo con las siguientes reglas:

- -
    -
  1. No puedes mover una ventana o pestaña que no haya sido creada por window.open.
  2. -
  3. No puedes mover una ventana o pestaña cuando esta en una ventana con más de una sola pestaña.
  4. -
- -

Especificación

- - - - - - - - - - - - - - - - -
EspecificaciónEstadoComentario
{{ SpecName('CSSOM View', '#dom-window-moveby', 'window.moveBy()') }}{{ Spec2('CSSOM View') }}
- -

Compatilidad de Navegador

- - - -

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

- -

Ver también

- -
    -
  • {{domxref("window.moveTo")}}
  • -
diff --git a/files/es/web/api/window/moveby/index.md b/files/es/web/api/window/moveby/index.md new file mode 100644 index 00000000000000..1a0a85ab334861 --- /dev/null +++ b/files/es/web/api/window/moveby/index.md @@ -0,0 +1,52 @@ +--- +title: Window.moveBy() +slug: Web/API/Window/moveBy +translation_of: Web/API/Window/moveBy +--- +{{APIRef}} + +## Resumen + +Mueve la actual ventana a consecuencia de una cantidad especificada. + +## Sintaxis + +```js +window.moveBy(deltaX, deltaY) +``` + +### Parametros + +- `deltaX` es la cantidad de pixeles a mover la ventana horizontalmente. +- `deltaY` es la cantidad de pixeles a mover la ventana verticalmente. + +## Ejemplo + +```js +function budge() { + moveBy(10, -10); +} +``` + +## Notes + +Puedes usar numeros negativos como parametros para esta función. Esta función realiza un movimiento relativo mientras que {{domxref("window.moveTo")}} hace un movimiento absoluto. + +Desde Firefox 7, no es posible para un sitio web mover una ventana en el navegador, deacuerdo con las [siguientes reglas](https://bugzilla.mozilla.org/show_bug.cgi?id=565541#c24): + +1. No puedes mover una ventana o pestaña que no haya sido creada por window\.open. +2. No puedes mover una ventana o pestaña cuando esta en una ventana con más de una sola pestaña. + +## Especificación + +| Especificación | Estado | Comentario | +| -------------------------------------------------------------------------------------------- | -------------------------------- | ---------- | +| {{ SpecName('CSSOM View', '#dom-window-moveby', 'window.moveBy()') }} | {{ Spec2('CSSOM View') }} | | + +## Compatilidad de Navegador + +{{Compat("api.Window.moveBy")}} + +## Ver también + +- {{domxref("window.moveTo")}} diff --git a/files/es/web/api/window/navigator/index.html b/files/es/web/api/window/navigator/index.html deleted file mode 100644 index eaade8c80bcb0d..00000000000000 --- a/files/es/web/api/window/navigator/index.html +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: Window.navigator -slug: Web/API/Window/navigator -tags: - - API - - DOM - - DOM Reference - - HTML-DOM - - Property - - Reference - - WebAPI - - Window - - Window.navigator -translation_of: Web/API/Window/navigator ---- -
- {{ApiRef}}
-
- La propiedad de solo lectura Window.navigator es una referencia al objeto {{domxref("Navigator")}}, el cual puede ser utilizado para obtener información sobre la aplicación que está ejecutando el script.
-

-

Sintaxis

-
navigatorObject = window.navigator
-

-

Ejemplos

-

Ejemplo #1: Detectar un navegador y retornar un string

-
var sBrowser, sUsrAg = navigator.userAgent;
-
-if(sUsrAg.indexOf("Chrome") > -1) {
-    sBrowser = "Google Chrome";
-} else if (sUsrAg.indexOf("Safari") > -1) {
-    sBrowser = "Apple Safari";
-} else if (sUsrAg.indexOf("Opera") > -1) {
-    sBrowser = "Opera";
-} else if (sUsrAg.indexOf("Firefox") > -1) {
-    sBrowser = "Mozilla Firefox";
-} else if (sUsrAg.indexOf("MSIE") > -1) {
-    sBrowser = "Microsoft Internet Explorer";
-}
-
-alert("Usted está utilizando: " + sBrowser);
-

Ejemplo #2: Detectar un navegador y retornar un índice

-
function obtenerIdNavegador() {
-    var
-        aKeys = ["MSIE", "Firefox", "Safari", "Chrome", "Opera"],
-        sUsrAg = navigator.userAgent, nIdx = aKeys.length - 1;
-
-    for (nIdx; nIdx > -1 && sUsrAg.indexOf(aKeys[nIdx]) === -1; nIdx--);
-
-    return nIdx
-}
-
-console.log(obtenerIdNavegador());
-
-

Especificación

-
    -
  • {{SpecName("HTML5 W3C", "webappapis.html#the-navigator-object","window.navigator")}}
  • -
  • {{SpecName("HTML5.1", "webappapis.html#the-navigator-object", "window.navigator")}}
  • -
  • {{SpecName("HTML WHATWG", "timers.html#the-navigator-object", "window.navigator")}}
  • -
-

Vea además

diff --git a/files/es/web/api/window/navigator/index.md b/files/es/web/api/window/navigator/index.md new file mode 100644 index 00000000000000..30f24e80e7fb79 --- /dev/null +++ b/files/es/web/api/window/navigator/index.md @@ -0,0 +1,72 @@ +--- +title: Window.navigator +slug: Web/API/Window/navigator +tags: + - API + - DOM + - DOM Reference + - HTML-DOM + - Property + - Reference + - WebAPI + - Window + - Window.navigator +translation_of: Web/API/Window/navigator +--- +{{ApiRef}}La propiedad de solo lectura `Window.navigator `es una referencia al objeto {{domxref("Navigator")}}, el cual puede ser utilizado para obtener información sobre la aplicación que está ejecutando el script. + +## + +## Sintaxis + +```js +navigatorObject = window.navigator +``` + +## + +## Ejemplos + +### Ejemplo #1: Detectar un navegador y retornar un string + +```js +var sBrowser, sUsrAg = navigator.userAgent; + +if(sUsrAg.indexOf("Chrome") > -1) { + sBrowser = "Google Chrome"; +} else if (sUsrAg.indexOf("Safari") > -1) { + sBrowser = "Apple Safari"; +} else if (sUsrAg.indexOf("Opera") > -1) { + sBrowser = "Opera"; +} else if (sUsrAg.indexOf("Firefox") > -1) { + sBrowser = "Mozilla Firefox"; +} else if (sUsrAg.indexOf("MSIE") > -1) { + sBrowser = "Microsoft Internet Explorer"; +} + +alert("Usted está utilizando: " + sBrowser); +``` + +### Ejemplo #2: Detectar un navegador y retornar un índice + +```js +function obtenerIdNavegador() { + var + aKeys = ["MSIE", "Firefox", "Safari", "Chrome", "Opera"], + sUsrAg = navigator.userAgent, nIdx = aKeys.length - 1; + + for (nIdx; nIdx > -1 && sUsrAg.indexOf(aKeys[nIdx]) === -1; nIdx--); + + return nIdx +} + +console.log(obtenerIdNavegador()); +``` + +## Especificación + +- {{SpecName("HTML5 W3C", "webappapis.html#the-navigator-object","window.navigator")}} +- {{SpecName("HTML5.1", "webappapis.html#the-navigator-object", "window.navigator")}} +- {{SpecName("HTML WHATWG", "timers.html#the-navigator-object", "window.navigator")}} + +## Vea además diff --git a/files/es/web/api/window/offline_event/index.html b/files/es/web/api/window/offline_event/index.html deleted file mode 100644 index 3261cdcce83436..00000000000000 --- a/files/es/web/api/window/offline_event/index.html +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: Offline -slug: Web/API/Window/offline_event -tags: - - Event - - Evento - - Reference - - Referencia -translation_of: Web/API/Window/offline_event ---- -
{{APIRef}}
- -

El evento offline se activa cuando el navegador ha pierdido acceso a la red y el valor de navigator.onLine cambia a false.

- -

Información General

- -
-
Especificación
-
HTML5 Offline
-
Interfaz
-
Evento
-
Burbujas
-
No
-
Cancelable
-
No
-
Target
-
DefaultView (<window>)
-
Acción por Defecto
-
Ninguna
-
- -

Propiedades

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropiedadTipoDescripción
target {{readonlyInline}}{{domxref("EventTarget")}}Evento target (el objetivo más alto en el árbol DOM).
type {{readonlyInline}}{{domxref("DOMString")}}Tipo de evento.
bubbles {{readonlyInline}}{{jsxref("Boolean")}}Si el evento normalmente burbujea o no.
cancelable {{readonlyInline}}{{jsxref("Boolean")}}Si el evento normalmente es cancelable o no.
- -

Eventos Relacionados

- - diff --git a/files/es/web/api/window/offline_event/index.md b/files/es/web/api/window/offline_event/index.md new file mode 100644 index 00000000000000..ec7b058d903b54 --- /dev/null +++ b/files/es/web/api/window/offline_event/index.md @@ -0,0 +1,41 @@ +--- +title: Offline +slug: Web/API/Window/offline_event +tags: + - Event + - Evento + - Reference + - Referencia +translation_of: Web/API/Window/offline_event +--- +{{APIRef}} + +El evento **`offline`** se activa cuando el navegador ha pierdido acceso a la red y el valor de `navigator.onLine` cambia a `false`. + +## Información General + +- Especificación + - : [HTML5 Offline](http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#event-offline) +- Interfaz + - : Evento +- Burbujas + - : No +- Cancelable + - : No +- Target + - : DefaultView (``) +- Acción por Defecto + - : Ninguna + +## Propiedades + +| Propiedad | Tipo | Descripción | +| ------------------------------------- | ------------------------------------ | ----------------------------------------------------- | +| `target` {{readonlyInline}} | {{domxref("EventTarget")}} | Evento target (el objetivo más alto en el árbol DOM). | +| `type` {{readonlyInline}} | {{domxref("DOMString")}} | Tipo de evento. | +| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Si el evento normalmente burbujea o no. | +| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Si el evento normalmente es cancelable o no. | + +## Eventos Relacionados + +- [`online`](/es/docs/Mozilla_event_reference/online) diff --git a/files/es/web/api/window/open/index.html b/files/es/web/api/window/open/index.html deleted file mode 100644 index 62669d6399b5a7..00000000000000 --- a/files/es/web/api/window/open/index.html +++ /dev/null @@ -1,601 +0,0 @@ ---- -title: Window.open() -slug: Web/API/Window/open -translation_of: Web/API/Window/open ---- -

{{APIRef}}

- -

Carga un recurso en el contexto de un nuevo navegador (como una ventana) o uno que ya existe, dependiendo de los parametros.

- -

Sintaxis

- -
var referencia_objeto_window = window.open([url],[nombre_de_la_ventana],[configuracion_ventana]);
- -

Parámetros

- -
-
referencia_objeto_window
-
Una referencia de la ventana creada. La referencia puede ser usada para acceder a propiedades y métodos de la nueva ventana.
-
url (opcional)
-
La URL especifica que página se va cargar en la ventana creada. La URL puede ser una página web (http://www.ejemplo.com.co) o un documento que se encuentre en algun directorio de su PC (html, imagenes y demás). Si no se expecifica una URL, por defecto abrira la ventana en blanco
-
nombre_de_la_ventana (opcional)
-
Un nombre para la nueva ventana. El nombre puede ser usado como el destino de enlaces y formularios usando el atributo de un elemento {{HTMLElement("a")}} ó {{HTMLElement("form")}}. El nombre no debe contener ningun caracter de espacio en blanco. Notese que nombre_de_la_ventana no especifica el titulo de la nueva ventana.
-
strWindowFeatures
-
An optional parameter listing the features (size, position, scrollbars, etc.) of the new window as a string. The string must not contain any whitespace, and each feature name and its value must be separated by a comma. See Position and size features below for details.
-
- -

Descripción

- -

El metodo open() crea una nueva ventana secundaria del navegador, similar a seleccionar Nueva ventana desde el menú archivo. El parámetro url especifica la URL a ser solicitada y cargada en la nueva ventana. Si url es una cadena de caracteres vacia, entonces se creará una nueva ventana en blanco (URL about:blank) con las barras de herramientas por defecto de la ventana principal.

- -

Observe que las URLs no cargarán inmediatamente. Cuando window.open() retorna, la ventana siempre contiene about:blank. La solicitud de la URL es diferida y comienza luego de que el bloque actual se termine de ejecutar. La creación de la ventana y la carga de los recursos referenciados suceden de forma asíncrona.

- -

Ejemplo

- -
var objeto_window_referencia;
-var configuracion_ventana = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
-
-function abrir_Popup() {
-  objeto_window_referencia = window.open("http://www.cnn.com/", "Pagina_CNN", configuracion_ventana);
-}
-
-// Llamamos a la función
-
-abrir_Popup();
- - - - - -
var windowObjectReference;
-
-function openRequestedPopup() {
-  windowObjectReference = window.open(
-    "http://www.domainname.ext/path/ImageFile.png",
-    "DescriptiveWindowName",
-    "resizable,scrollbars,status"
-  );
-}
- -

If a window with the name strWindowName already exists, then strUrl is loaded into the existing window. In this case the return value of the method is the existing window and strWindowFeatures is ignored. Providing an empty string for strUrl is a way to get a reference to an open window by its name without changing the window's location. To open a new window on every call of window.open(), use the special value _blank for strWindowName.

- -

strWindowFeatures is an optional string containing a comma-separated list of requested features of the new window. After a window is opened, JavaScript can't be used to change the features. If strWindowName does not specify an existing window and the strWindowFeatures parameter is not provided (or if the strWindowFeatures parameter is an empty string), then the new secondary window will render the default toolbars of the main window.

- -

If the strWindowFeatures parameter is used and no size features are defined, then the new window dimensions will be the same as the dimensions of the most recently rendered window.

- -

If the strWindowFeatures parameter is used and if no position features are defined, then the left and top coordinates of the new window dimension will be 22 pixels from where the most recently rendered window was. An offset is universally implemented by browser manufacturers (it is 29 pixels in MSIE 6 SP2 with the default theme) and its purpose is to help users to notice new windows opening. If the most recently used window was maximized, then there is no offset: the new window will be maximized as well.

- -

If the strWindowFeatures parameter is used, the features that are not listed will be disabled or removed (except titlebar and close which are by default yes).

- -
-

If using the strWindowFeatures parameter, only list the features to be enabled or rendered; the others (except titlebar and close) will be disabled or removed.

- -

Note that in some browsers, users can override the strWindowFeatures settings and enable (or prevent the disabling of) features.

-
- -

Firefox Chrome Toolbars Illustration

- -

Características de posición y tamaño

- -

Note on position and dimension error correction

- -
{{bug(176320)}}
- -

Note on precedence

- -
-
left
-
Specifies the distance the new window is placed from the left side of the work area for applications of the user's operating system to the leftmost border (resizing handle) of the browser window. The new window can not be initially positioned offscreen. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
-
top
-
Specifies the distance the new window is placed from the top side of the work area for applications of the user's operating system to the topmost border (resizing handle) of the browser window. The new window can not be initially positioned offscreen. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
-
height
-
Specifies the height of the content area, viewing area of the new secondary window in pixels. The height value includes the height of the horizontal scrollbar if present. The minimum required value is 100. Note on outerHeight versus height (or innerHeight) Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
-
width
-
Specifies the width of the content area, viewing area of the new secondary window in pixels. The width value includes the width of the vertical scrollbar if present. The width value does not include the sidebar if it is expanded. The minimum required value is 100. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
-
screenX
-
Deprecated. Same as left but only supported by Netscape and Mozilla-based browsers. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
screenY
-
Deprecated. Same as top but only supported by Netscape and Mozilla-based browsers. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
centerscreen
-
Centers the window in relation to its parent's size and position. Requires chrome=yes.
-
outerHeight
-
Specifies the height of the whole browser window in pixels. This outerHeight value includes any/all present toolbar, window horizontal scrollbar (if present) and top and bottom window resizing borders. Minimal required value is 100. Note: since titlebar is always rendered, then requesting outerHeight=100 will make the innerHeight of the browser window under the minimal 100 pixels. Note on outerHeight versus height (or innerHeight) Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
outerWidth
-
Specifies the width of the whole browser window in pixels. This outerWidth value includes the window vertical scrollbar (if present) and left and right window resizing borders. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
innerHeight
-
Same as height but only supported by Netscape and Mozilla-based browsers. Specifies the height of the content area, viewing area of the new secondary window in pixels. The innerHeight value includes the height of the horizontal scrollbar if present. Minimal required value is 100. Note on outerHeight versus height (or innerHeight) Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
innerWidth
-
Same as width but only supported by Netscape and Mozilla-based browsers. Specifies the width of the content area, viewing area of the new secondary window in pixels. The innerWidth value includes the width of the vertical scrollbar if present. The innerWidth value does not include the sidebar if it is expanded. Minimal required value is 100. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
- -

Barra de herramienta y características de chrome

- -
-
NOTE: All features can be set to yes, 1 or just be present to be "on", set to no or 0 or in most cases just not present to be "off"
-
example "status=yes", "status=1" and "status" have identical results
-
-
menubar
-
If this feature is on, then the new secondary window renders the menubar. Mozilla and Firefox users can force new windows to always render the menubar by setting dom.disable_window_open_feature.menubar to true in about:config or in their user.js file. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
toolbar
-
If this feature is on, then the new secondary window renders the Navigation Toolbar (Back, Forward, Reload, Stop buttons). In addition to the Navigation Toolbar, Mozilla-based browsers will render the Tab Bar if it is visible, present in the parent window. (If this feature is set to no all toolbars in the window will be invisible, for example extension toolbars). Mozilla and Firefox users can force new windows to always render the Navigation Toolbar by setting dom.disable_window_open_feature.toolbar to true in about:config or in their user.js file. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
location
-
If this feature is on, then the new secondary window renders the Location bar in Mozilla-based browsers. MSIE 5+ and Opera 7.x renders the Address Bar. Mozilla and Firefox users can force new windows to always render the location bar by setting dom.disable_window_open_feature.location to true in about:config or in their user.js file. {{Fx_minversion_note(3, "In Firefox 3, dom.disable_window_open_feature.location now defaults to true, forcing the presence of the Location Bar much like in IE7. See bug 337344 for more information.")}} Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x, Opera 6+
-
personalbar
-
If this feature is on, then the new secondary window renders the Personal Toolbar in Netscape 6.x, Netscape 7.x and Mozilla browser. It renders the Bookmarks Toolbar in Firefox. In addition to the Personal Toolbar, Mozilla browser will render the Site Navigation Bar if such toolbar is visible, present in the parent window. Mozilla and Firefox users can force new windows to always render the Personal Toolbar/Bookmarks toolbar by setting dom.disable_window_open_feature.personalbar to true in about:config or in their user.js file. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
directories {{obsolete_inline("2")}}
-
Obsolete synonym of personalbar. In IE, it rendered the Links bar. Supported in Gecko up to 1.9.2 and in IE up to 6.
-
status
-
If this feature is on, then the new secondary window has a status bar. Users can force the rendering of status bar in all Mozilla-based browsers, in MSIE 6 SP2 (Note on status bar in XP SP2) and in Opera 6+. The default preference setting in recent Mozilla-based browser releases and in Firefox 1.0 is to force the presence of the status bar. Note on status bar Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
- - - -

Características de funcionalidad de window

- -
-
-
attention {{NonStandardBadge}}
-
If this feature is specified, the window is able to open even if another application is already in the foreground. This feature is for Firefox OS applications only, and is currently restricted to certified applications. See {{SectionOnPage("/en-US/docs/Archive/B2G_OS/Firefox_OS_apps/App_permissions", "Internal (Certified) app permissions")}} for more information. Supported in:
-
dependent
-
If on, the new window is said to be dependent of its parent window. A dependent window closes when its parent window closes. A dependent window is minimized on the Windows task bar only when its parent window is minimized. On Windows platforms, a dependent window does not show on the task bar. A dependent window also stays in front of the parent window. Dependent windows are not implemented on MacOS X, this option will be ignored. The dependent feature is currently under revision to be removed ({{Bug(214867)}}) In MSIE 6, the nearest equivalent to this feature is the showModelessDialog() method. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
minimizable
-
This setting can only apply to dialog windows; "minimizable" requires dialog=yes. If minimizable is on, the new dialog window will have a minimize system command icon in the titlebar and it will be minimizable. Any non-dialog window is always minimizable and minimizable=no will be ignored. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
fullscreen
-
Do not use. Not implemented in Mozilla. There are no plans to implement this feature in Mozilla. This feature no longer works in MSIE 6 SP2 the way it worked in MSIE 5.x. The Windows taskbar, as well as the titlebar and the status bar of the window are not visible, nor accessible when fullscreen is enabled in MSIE 5.x. fullscreen always upsets users with large monitor screen or with dual monitor screen. Forcing fullscreen onto other users is also extremely unpopular and is considered an outright rude attempt to impose web author's viewing preferences onto users. Note on fullscreen Supported in: Internet Explorer 5+ fullscreen does not really work in MSIE 6 SP2.
-
resizable
-
If this feature is on, the new secondary window will be resizable. Note: Starting with version 1.4, Mozilla-based browsers have a window resizing grippy at the right end of the status bar, this ensures that users can resize the browser window even if the web author requested this secondary window to be non-resizable. In such case, the maximize/restore icon in the window's titlebar will be disabled and the window's borders won't allow resizing but the window will still be resizable via that grippy in the status bar. -

Starting with Firefox 3, secondary windows are always resizable ({{Bug(177838)}})

- -
-

Tip: For accessibility reasons, it is strongly recommended to set this feature always on

-
- Mozilla and Firefox users can force new windows to be easily resizable by setting
- dom.disable_window_open_feature.resizable
- to true in about:config or in their user.js file. Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
scrollbars
-
If this feature is on, the new secondary window will show horizontal and/or vertical scrollbar(s) if the document doesn't fit into the window's viewport. -
-

Tip: For accessibility reasons, it is strongly encouraged to set this feature always on.

-
- Mozilla and Firefox users can force this option to be always enabled for new windows by setting
- dom.disable_window_open_feature.scrollbars
- to true in about:config or in their user.js file. Note on scrollbars Supported in: Internet Explorer 5+, Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
- -

Características que requieren privilegios

- -

The following features require the UniversalBrowserWrite privilege, otherwise they will be ignored. Chrome scripts have this privilege automatically, others have to request it from the PrivilegeManager.

- -
-
chrome
-
Note: Starting with Mozilla 1.7/Firefox 0.9, this feature requires the UniversalBrowserWrite privilege ({{Bug(244965)}}). Without this privilege, it is ignored. If on, the page is loaded as window's only content, without any of the browser's interface elements. There will be no context menu defined by default and none of the standard keyboard shortcuts will work. The page is supposed to provide a user interface of its own, usually this feature is used to open XUL documents (standard dialogs like the JavaScript Console are opened this way). Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
dialog
-
Note: Starting with Firefox 44, this feature can only be used with chrome privileges. If content attempts to toggle this feature, it will be ignored. MenuSystemCommands.pngThe dialog feature removes all icons (restore, minimize, maximize) from the window's titlebar, leaving only the close button. Mozilla 1.2+ and Netscape 7.1 will render the other menu system commands (in FF 1.0 and in NS 7.0x, the command system menu is not identified with the Firefox/NS 7.0x icon on the left end of the titlebar: that's probably a bug. You can access the command system menu with a right-click on the titlebar). Dialog windows are windows which have no minimize system command icon and no maximize/restore down system command icon on the titlebar nor in correspondent menu item in the command system menu. They are said to be dialog because their normal, usual purpose is to only notify info and to be dismissed, closed. On Mac systems, dialog windows have a different window border and they may get turned into a sheet. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
modal
-
Note: Starting with Mozilla 1.2.1, this feature requires the UniversalBrowserWrite privilege ({{Bug(180048)}}). Without this privilege, it is ignored. If on, the new window is said to be modal. The user cannot return to the main window until the modal window is closed. A typical modal window is created by the alert() function. The exact behavior of modal windows depends on the platform and on the Mozilla release version. -
-

Note: As of {{Gecko("1.9")}}, the Internet Explorer equivalent to this feature is the {{domxref("window.showModalDialog()")}} method. For compatibility reasons, it's now supported in Firefox. Note also that starting in {{Gecko("2.0")}}, you can use {{domxref("window.showModalDialog()")}} without UniversalBrowserWrite privileges.

-
- Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
titlebar
-
By default, all new secondary windows have a titlebar. If set to no or 0, this feature removes the titlebar from the new secondary window. Mozilla and Firefox users can force new windows to always render the titlebar by setting
- dom.disable_window_open_feature.titlebar
- to true in about:config or in their user.js file. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
alwaysRaised
-
If on, the new window will always be displayed on top of other browser windows, regardless of whether it is active or not. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
alwaysLowered
-
If on, the new created window floats below, under its own parent when the parent window is not minimized. alwaysLowered windows are often referred as pop-under windows. The alwaysLowered window can not be on top of the parent but the parent window can be minimized. In NS 6.x, the alwaysLowered window has no minimize system command icon and no restore/maximize system command. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
z-lock
-
Same as alwaysLowered.
-
close
-
When set to no or 0, this feature removes the system close command icon and system close menu item. It will only work for dialog windows (dialog feature set). close=no will override minimizable=yes. Mozilla and Firefox users can force new windows to always have a close button by setting
- dom.disable_window_open_feature.close
- to true in about:config or in their user.js file. Supported in: Netscape 6.x, Netscape 7.x, Mozilla 1.x, Firefox 1.x
-
- -

The position and size feature elements require a number to be set. The toolbars and window functionalities can be set with a yes or no; you can use 1 instead of yes and 0 instead of no. The toolbar and functionality feature elements also accept the shorthand form: you can turn a feature on by simply listing the feature name in the features string. If you supply the features parameter, then the titlebar and close are still yes by default, but the other features which have a yes/no choice will be no by default and will be turned off.

- -

Example:

- -
var windowObjectReference; // global variable
-
-function openRequestedPopup() {
-  windowObjectReference = window.open(
-    "http://www.domainname.ext/path/ImgFile.png",
-    "DescriptiveWindowName",
-    "width=420,height=230,resizable,scrollbars=yes,status=1"
-  );
-}
- -

In this example, the window will be resizable, it will render scrollbar(s) if needed, if the content overflows requested window dimensions and it will render the status bar. It will not render the menubar nor the location bar. Since the author knew about the size of the image (400 pixels wide and 200 pixels high), he added the margins applied to the root element in MSIE 6 which is 15 pixels for top margin, 15 pixels for the bottom margin, 10 pixels for the left margin and 10 pixels for the right margin.

- -

Buenas prácticas

- -
<script type="text/javascript">
-var windowObjectReference = null; // global variable
-
-function openFFPromotionPopup() {
-  if(windowObjectReference == null || windowObjectReference.closed)
-  /* if the pointer to the window object in memory does not exist
-     or if such pointer exists but the window was closed */
-
-  {
-    windowObjectReference = window.open("http://www.spreadfirefox.com/",
-   "PromoteFirefoxWindowName", "resizable,scrollbars,status");
-    /* then create it. The new window will be created and
-       will be brought on top of any other window. */
-  }
-  else
-  {
-    windowObjectReference.focus();
-    /* else the window reference must exist and the window
-       is not closed; therefore, we can bring it back on top of any other
-       window with the focus() method. There would be no need to re-create
-       the window or to reload the referenced resource. */
-  };
-}
-</script>
-
-(...)
-
-<p><a
- href="http://www.spreadfirefox.com/"
- target="PromoteFirefoxWindowName"
- onclick="openFFPromotionPopup(); return false;"
- title="This link will create a new window or will re-use an already opened one"
->Promote Firefox adoption</a></p>
-
- -

The above code solves a few usability problems related to links opening secondary window. The purpose of the return false in the code is to cancel default action of the link: if the onclick event handler is executed, then there is no need to execute the default action of the link. But if javascript support is disabled or non-existent on the user's browser, then the onclick event handler is ignored and the browser loads the referenced resource in the target frame or window that has the name "PromoteFirefoxWindowName". If no frame nor window has the name "PromoteFirefoxWindowName", then the browser will create a new window and will name it "PromoteFirefoxWindowName".

- -

More reading on the use of the target attribute:

- -

HTML 4.01 Target attribute specifications

- -

How do I create a link that opens a new window?

- -

You can also parameterize the function to make it versatile, functional in more situations, therefore re-usable in scripts and webpages:

- -
<script type="text/javascript">
-var windowObjectReference = null; // global variable
-
-function openRequestedPopup(strUrl, strWindowName) {
-  if(windowObjectReference == null || windowObjectReference.closed) {
-    windowObjectReference = window.open(strUrl, strWindowName,
-           "resizable,scrollbars,status");
-  } else {
-    windowObjectReference.focus();
-  };
-}
-</script>
-
-(...)
-
-<p><a
- href="http://www.spreadfirefox.com/"
- target="PromoteFirefoxWindow"
- onclick="openRequestedPopup(this.href, this.target); return false;"
- title="This link will create a new window or will re-use an already opened one"
->Promote Firefox adoption</a></p>
-
- -

You can also make such function able to open only 1 secondary window and to reuse such single secondary window for other links in this manner:

- -
<script type="text/javascript">
-var windowObjectReference = null; // global variable
-var PreviousUrl; /* global variable which will store the
-                    url currently in the secondary window */
-
-function openRequestedSinglePopup(strUrl) {
-  if(windowObjectReference == null || windowObjectReference.closed) {
-    windowObjectReference = window.open(strUrl, "SingleSecondaryWindowName",
-         "resizable,scrollbars,status");
-  } else if(PreviousUrl != strUrl) {
-    windowObjectReference = window.open(strUrl, "SingleSecondaryWindowName",
-      "resizable=yes,scrollbars=yes,status=yes");
-    /* if the resource to load is different,
-       then we load it in the already opened secondary window and then
-       we bring such window back on top/in front of its parent window. */
-    windowObjectReference.focus();
-  } else {
-    windowObjectReference.focus();
-  };
-
-  PreviousUrl = strUrl;
-  /* explanation: we store the current url in order to compare url
-     in the event of another call of this function. */
-}
-</script>
-
-(...)
-
-<p><a
- href="http://www.spreadfirefox.com/"
- target="SingleSecondaryWindowName"
- onclick="openRequestedSinglePopup(this.href); return false;"
- title="This link will create a new window or will re-use an already opened one"
->Promote Firefox adoption</a></p>
-
-<p><a
- href="http://www.mozilla.org/support/firefox/faq"
- target="SingleSecondaryWindowName"
- onclick="openRequestedSinglePopup(this.href); return false;"
- title="This link will create a new window or will re-use an already opened one"
->Firefox FAQ</a></p>
-
- -

FAQ

- -
-
How can I prevent the confirmation message asking the user whether he wants to close the window?
-
You can not. New windows not opened by javascript can not as a rule be closed by JavaScript. The JavaScript Console in Mozilla-based browsers will report the warning message: "Scripts may not close windows that were not opened by script." Otherwise the history of URLs visited during the browser session would be lost. More on the window.close() method
-
How can I bring back the window if it is minimized or behind another window?
-
First check for the existence of the window object reference of such window and if it exists and if it has not been closed, then use the focus() method. There is no other reliable way. You can examine an example explaining how to use the focus() method.
-
How do I force a maximized window?
-
You cannot. All browser manufacturers try to make the opening of new secondary windows noticed by users and noticeable by users to avoid confusion, to avoid disorienting users.
-
How do I turn off window resizability or remove toolbars?
-
You cannot force this. Users with Mozilla-based browsers have absolute control over window functionalities like resizability, scrollability and toolbars presence via user preferences in about:config. Since your users are the ones who are supposed to use such windows (and not you, being the web author), the best is to avoid interfering with their habits and preferences. We recommend to always set the resizability and scrollbars presence (if needed) to yes to insure accessibility to content and usability of windows. This is in the best interests of both the web author and the users.
-
How do I resize a window to fit its content?
-
You can not reliably because the users can prevent the window from being resized by unchecking the Edit/Preferences/Advanced/Scripts & Plug-ins/Allow Scripts to/ Move or resize existing windows checkbox in Mozilla or Tools/Options.../Content tab/Enable Javascript/Advanced button/Move or resize existing windows checkbox in Firefox or by setting dom.disable_window_move_resize to true in about:config or by editing accordingly their user.js file. In general, users usually disable moving and resizing of existing windows because allowing authors' scripts to do so has been abused overwhelmingly in the past and the rare scripts that do not abuse such feature are often wrong, inaccurate when resizing the window. 99% of all those scripts disable window resizability and disable scrollbars when in fact they should enable both of these features to allow a cautious and sane fallback mechanism if their calculations are wrong. The window method sizeToContent() is also disabled if the user unchecks the preference Move or resize existing windows checkbox. Moving and resizing a window remotely on the user's screen via script will very often annoy the users, will disorient the user, and will be wrong at best. The web author expects to have full control of (and can decide about) every position and size aspects of the users' browser window ... which is simply not true.
-
How do I open a referenced resource of a link in a new tab? or in a specific tab?
-
To open a resource in a new tab see Tabbed browser. Some Code snippets are available. If you are using the SDK, tabs are handled a bit differently K-meleon 1.1, a Mozilla-based browser, gives complete control and power to the user regarding how links are opened. Only the user can set his advanced preferences to do that. Some advanced extensions also give Mozilla and Firefox a lot of power over how referenced resources are loaded. In a few years, the target property of the CSS3 hyperlink module may be implemented (if CSS3 Hyperlink module as it is right now is approved). And even if and when this happens, you can expect developers of browsers with tab-browsing to give the user entire veto power and full control over how links can open web pages. How to open a link should always be entirely under the control of the user.
-
How do I know whether a window I opened is still open?
-
You can test for the existence of the window object reference which is the returned value in case of success of the window.open() call and then verify that windowObjectReference.closed return value is false.
-
How can I tell when my window was blocked by a popup blocker?
-
With the built-in popup blockers of Mozilla/Firefox and Internet Explorer 6 SP2, you have to check the return value of window.open(): it will be null if the window wasn't allowed to open. However, for most other popup blockers, there is no reliable way.
-
What is the JavaScript relationship between the main window and the secondary window?
-
The window.open() method gives a main window a reference to a secondary window; the opener property gives a secondary window a reference to its main window.
-
I can not access the properties of the new secondary window. I always get an error in the javascript console saying "Error: uncaught exception: Permission denied to get property <property_name or method_name>. Why is that?
-
It is because of the cross-domain script security restriction (also referred as the "Same Origin Policy"). A script loaded in a window (or frame) from a distinct origin (domain name) cannot get nor set properties of another window (or frame) or the properties of any of its HTML objects coming from another distinct origin (domain name). Therefore, before executing a script targeting a secondary window, the browser in the main window will verify that the secondary window has the same domain name. More reading on the cross-domain script security restriction: http://www.mozilla.org/projects/secu...me-origin.html
-
- -

Problemas de usos

- -

Avoid resorting to window.open()

- -

Generally speaking, it is preferable to avoid resorting to window.open() for several reasons:

- -
    -
  • All Mozilla-based browsers offer tab-browsing and this is the preferred mode of opening referenced resources (SDK)... not just in Mozilla-based browsers but in all other browsers offering tab-browsing. In other words, tab-capable browser users overall prefer opening new tabs than opening new windows in a majority of webpage situations. Tab-capable browsers have rapidly gained support and enthusiasm on internet in the last 3 years; this trend will not revert back. MSIE 7, released in October 2006, has full support for tab browsing.
  • -
  • There are now several Mozilla extensions (like Multizilla) and Firefox extensions (like Tabbrowser preferences), features, settings and advanced preferences based on tab-browsing and based on converting window.open() calls into opening tabs, based on neutralizing window.open() calls, in particular in neutralizing unrequested openings of new windows (often referred as blocking unrequested popups or as blocking script-initiated windows opening automatically). Such features found in extensions include opening a link in a new window or not, in the same window, in a new tab or not, in "background" or not. Coding carelessly to open new windows can no longer be assured of success, can not succeed by force and, if it does, it will annoy a majority of users.
  • -
  • New windows can have menubar missing, scrollbars missing, status bar missing, window resizability disabled, etc.; new tabs can not be missing those functionalities or toolbars (or at least, the toolbars which are present by default). Therefore, tab-browsing is preferred by a lot of users because the normal user-interface of the browser window they prefer is kept intact, remains stable.
  • -
  • Opening new windows, even with reduced features, uses considerably a lot of the user's system resources (cpu, RAM) and involves considerably a lot of coding in the source code (security management, memory management, various code branchings sometimes quite complex, window frame/chrome/toolbars building, window positioning and sizing, etc.). Opening new tabs is less demanding on the user's system resources (and faster to achieve) than opening new windows.
  • -
- - - -

If you want to offer to open a link in a new window, then follow tested and recommendable usability and accessibility guidelines:

- -

Never use this form of code for links: <a href="javascript:window.open(...)" ...>

- -

"javascript:" links break accessibility and usability of webpages in every browser.

- -
    -
  • "javascript:" pseudo-links become dysfunctional when javascript support is disabled or inexistent. Several corporations allow their employees to surf on the web but under strict security policies: no javascript enabled, no java, no activeX, no Flash. For various reasons (security, public access, text browsers, etc..), about 5% to 10% of users on the web surf with javascript disabled.
  • -
  • "javascript:" links will interfere with advanced features in tab-capable browsers: eg. middle-click on links, Ctrl+click on links, tab-browsing features in extensions, etc.
  • -
  • "javascript:" links will interfere with the process of indexing webpages by search engines.
  • -
  • "javascript:" links interfere with assistive technologies (e.g. voice browsers) and several web-aware applications (e.g. PDAs and mobile browsers).
  • -
  • "javascript:" links also interfere with "mouse gestures" features implemented in browsers.
  • -
  • Protocol scheme "javascript:" will be reported as an error by link validators and link checkers.
  • -
- -

Further reading:

- - - -

Never use <a href="#" onclick="window.open(...);">

- -

Such pseudo-link also breaks accessibility of links. Always use a real URL for the href attribute value so that if javascript support is disabled or inexistent or if the user agent does not support opening of secondary window (like MS-Web TV, text browsers, etc), then such user agents will still be able to load the referenced resource according to its default mode of opening/handling a referenced resource. This form of code also interferes with advanced features in tab-capable browsers: eg. middle-click on links, Ctrl+click on links, Ctrl+Enter on links, "mouse gestures" features.

- - - -

Identify links that will open new windows in a way that helps navigation for users by coding the title attribute of the link, by adding an icon at the end of the link or by coding the cursor accordingly.

- -

The purpose is to warn users in advance of context changes to minimize confusion on the user's part: changing the current window or popping up new windows can be very disorienting to users (Back toolbar button is disabled).

- -
-

"Users often don't notice that a new window has opened, especially if they are using a small monitor where the windows are maximized to fill up the screen. So a user who tries to return to the origin will be confused by a grayed out Back button."
- quote from The Top Ten New Mistakes of Web Design: 2. Opening New Browser Windows, Jakob Nielsen, May 1999

-
- -

When extreme changes in context are explicitly identified before they occur, then the users can determine if they wish to proceed or so they can be prepared for the change: not only they will not be confused or feel disoriented, but more experienced users can better decide how to open such links (in a new window or not, in the same window, in a new tab or not, in "background" or not).

- -

References

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Example "New Window" Icons & Cursors
New window icon from yahoo.comNew window icon from microsoft.comNew window icon from webaim.orgNew window icon from sun.com
New window icon from bbc.co.ukNew window icon from Accessible Internet SolutionsNew window icon from accessify.comNew window icon from webstyleguide.com
New window icon from an unknown sourceNew window icon from an unknown sourceNew window icon from an unknown sourceNew window icon from gtalbot.org
New window cursor from draig.deNew window cursor from mithgol.ru
- -

Always use the target attribute

- -

If javascript support is disabled or non-existent, then the user agent will create a secondary window accordingly or will render the referenced resource according to its handling of the target attribute: e.g. some user agents which can not create new windows, like MS Web TV, will fetch the referenced resource and append it at the end of the current document. The goal and the idea is to try to provide - not impose - to the user a way to open the referenced resource, a mode of opening the link. Your code should not interfere with the features of the browser at the disposal of the user and your code should not interfere with the final decision resting with the user.

- -

Do not use target="_blank"

- -

Always provide a meaningful name to your target attribute and try to reuse such target attribute in your page so that a click on another link may load the referenced resource in an already created and rendered window (therefore speeding up the process for the user) and therefore justifying the reason (and user system resources, time spent) for creating a secondary window in the first place. Using a single target attribute value and reusing it in links is much more user resources friendly as it only creates one single secondary window which is recycled. On the other hand, using "_blank" as the target attribute value will create several new and unnamed windows on the user's desktop which can not be recycled, reused. In any case, if your code is well done, it should not interfere with the user's final choice but rather merely offer him more choices, more ways to open links and more power to the tool he's using (a browser).

- -

Glosario

- -
-
Opener window, parent window, main window, first window
-
Terms often used to describe or to identify the same window. It is the window from which a new window will be created. It is the window on which the user clicked a link which lead to the creation of another, new window.
-
Sub-window, child window, secondary window, second window
-
Terms often used to describe or to identify the same window. It is the new window which was created.
-
Unrequested popup windows
-
Script-initiated windows opening automatically without the user's consent.
-
- -

Especificación

- - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'browsers.html#dom-open', 'Window.open()')}}{{Spec2('HTML WHATWG')}}
{{ SpecName('CSSOM View', '#the-features-argument-to-the-open()-method', 'The features argument to the open() method') }}{{ Spec2('CSSOM View') }}Defines the effect of the features argument
- -

Notas

- -

Nota sobre la precedencia

- -

In cases where left and screenX (and/or top and screenY) have conflicting values, then left and top have precedence over screenX and screenY respectively. If left and screenX (and/or top and screenY) are defined in the features list, then left (and/or top) will be honored and rendered. In the following example the new window will be positioned at 100 pixels from the left side of the work area for applications of the user's operating system, not at 200 pixels.

- -
windowObjectReference = window.open(
-  "http://news.bbc.co.uk/",
-  "BBCWorldNewsWindowName",
-  "left=100,screenX=200,resizable,scrollbars,status"
-);
- -

If left is set but top has no value and screenY has a value, then left and screenY will be the coordinate positioning values of the secondary window.

- -

outerWidth has precedence over width and width has precedence over innerWidth. outerHeight has precedence over height and height has precedence over innerHeight. In the following example, Mozilla-browsers will create a new window with an outerWidth of 600 pixels wide and will ignore the request of a width of 500 pixels and will also ignore the request of an innerWidth of 400 pixels.

- -
windowObjectReference = window.open(
-  "http://www.wwf.org/",
-  "WWildlifeOrgWindowName",
-  "outerWidth=600,width=500,innerWidth=400,resizable,scrollbars,status"
-);
- -

Note on position and dimension error correction

- -

Requested position and requested dimension values in the features list will not be honored and will be corrected if any of such requested value does not allow the entire browser window to be rendered within the work area for applications of the user's operating system. No part of the new window can be initially positioned offscreen. This is by default in all Mozilla-based browser releases.

- -

MSIE 6 SP2 has a similar error correction mechanism but it is not activated by default in all security levels: a security setting can disable such error correction mechanism.

- -

Note on scrollbars

- -

When content overflows window viewport dimensions, then scrollbar(s) (or some scrolling mechanism) are necessary to ensure that content can be accessed by users. Content can overflow window dimensions for several reasons which are outside the control of web authors:

- -
    -
  • user resizes the window
  • -
  • user increases the text size of fonts via View/Text Zoom (%) menuitem in Mozilla or View/Text Size/Increase or Decrease in Firefox
  • -
  • user sets a minimum font size for pages which is bigger than the font-size the web author requested. People over 40 years old or with particular viewing habit or reading preference often set a minimal font size in Mozilla-based browsers.
  • -
  • web author is not aware of default margin (and/or border and/or padding) values applying to root element or body node in various browsers and various browser versions
  • -
  • user uses an user stylesheet (userContent.css in Mozilla-based browsers) for his viewing habits which increases document box dimensions (margin, padding, default font size)
  • -
  • user can customize individually the size (height or width) of most toolbars via operating system settings. E.g. window resizing borders, height of browser titlebar, menubar, scrollbars, font size are entirely customizable by the user in Windows XP operating system. These toolbars dimensions can also be set via browser themes and skins or by operating system themes
  • -
  • web author is unaware that the user default browser window has custom toolbar(s) for specific purpose(s); e.g.: prefs bar, web developer bar, accessibility toolbar, popup blocking and search toolbar, multi-feature toolbar, etc.
  • -
  • user uses assistive technologies or add-on features which modify the operating system's work area for applications: e.g. MS-Magnifier
  • -
  • user repositions and/or resizes directly or indirectly the operating system's work area for applications: e.g. user resizes the Windows taskbar, user positions the Windows taskbar on the left side (arabic language based) or right side (Hebrew language), user has a permanent MS-Office quick launch toolbar, etc.
  • -
  • some operating system (Mac OS X) forces presence of toolbars which can then fool the web author's anticipations, calculations of the effective dimensions of the browser window
  • -
- -

Note on status bar

- -

You should assume that a large majority of users' browsers will have the status bar or that a large majority of users will want to force the status bar presence: best is to always set this feature to yes. Also, if you specifically request to remove the status bar, then Firefox users will not be able to view the Site Navigation toolbar if it is installed. In Mozilla and in Firefox, all windows with a status bar have a window resizing grippy at its right-most side. The status bar also provides info on http connection, hypertext resource location, download progress bar, encryption/secure connection info with SSL connection (displaying a yellow padlock icon), internet/security zone icons, privacy policy/cookie icon, etc. Removing the status bar usually removes a lot of functionality, features and information considered useful (and sometimes vital) by the users.

- -

Note on security issues of the status bar presence

- -

In MSIE 6 for XP SP2: For windows opened using window.open():

- -
-

"For windows opened using window.open():
- Expect the status bar to be present, and code for it. The status bar will be on by default and is 20-25 pixels in height. (...)"
- quote from Fine-Tune Your Web Site for Windows XP Service Pack 2, Browser Window Restrictions in XP SP2

-
- -
-

"(...) windows that are created using the window.open() method can be called by scripts and used to spoof a user interface or desktop or to hide malicious information or activity by sizing the window so that the status bar is not visible.
- Internet Explorer windows provide visible security information to the user to help them ascertain the source of the Web page and the security of the communication with that page. When these elements are not in view, the user might think they are on a more trusted page or interacting with a system process when they are actually interacting with a malicious host. (...)
- Script-initiated windows will be displayed fully, with the Internet Explorer title bar and status bar. (...)
- Script management of Internet Explorer status bar
- Detailed description
- Internet Explorer has been modified to not turn off the status bar for any windows. The status bar is always visible for all Internet Explorer windows. (...) Without this change, windows that are created using the window.open() method can be called by scripts and spoof a user interface or desktop or hide malicious information or activity by hiding important elements of the user interface from the user.
- The status bar is a security feature of Internet Explorer windows that provides Internet Explorer security zone information to the user. This zone cannot be spoofed (...)"
- quote from Changes to Functionality in Microsoft Windows XP Service Pack 2, Internet Explorer Window Restrictions

-
- -

Note on fullscreen

- -

In MSIE 6 for XP SP2:

- -
    -
  • "window.open() with fullscreen=yes will now result in a maximized window, not a kiosk mode window."
  • -
  • "The definition of the fullscreen=yes specification is changed to mean 'show the window as maximized,' which will keep the title bar, address bar, and status bar visible."
  • -
- -

References:

- - - -

Note on outerHeight versus height

- -

innerHeight vs outerHeight illustration

- -

Note on refreshing vs. opening a new window/tab

- -

If the strWindowName parameter is omitted, a new window or tab is opened. If a window with the same name already exists, the existing window is refreshed.

- -
//Always opens a new window/tab
-window.open("map.php");
-
-//Refreshes an existing window/tab that was opened with the same name, if one exists
-window.open("map.php", "BiggerMap");
- -

Tutoriales

- - - -

Referencias

- - diff --git a/files/es/web/api/window/open/index.md b/files/es/web/api/window/open/index.md new file mode 100644 index 00000000000000..045ce324d1ee19 --- /dev/null +++ b/files/es/web/api/window/open/index.md @@ -0,0 +1,634 @@ +--- +title: Window.open() +slug: Web/API/Window/open +translation_of: Web/API/Window/open +--- +{{APIRef}} + +Carga un recurso en el contexto de un nuevo navegador (como una ventana) o uno que ya existe, dependiendo de los parametros. + +## Sintaxis + +```js +var referencia_objeto_window = window.open([url],[nombre_de_la_ventana],[configuracion_ventana]); +``` + +## Parámetros + +- `referencia_objeto_window` + - : Una referencia de la ventana creada. La referencia puede ser usada para acceder a propiedades y métodos de la nueva ventana. +- `url (opcional)` + - : La **URL** especifica que página se va cargar en la ventana creada. La URL puede ser una página web **(http\://www\.ejemplo.com.co)** o un documento que se encuentre en algun directorio de su PC **(html, imagenes y demás).** Si no se expecifica una **URL**, por defecto abrira la ventana en blanco +- `nombre_de_la_ventana (opcional)` + - : Un nombre para la nueva ventana. El nombre puede ser usado como el destino de enlaces y formularios usando el atributo de un elemento {{HTMLElement("a")}} ó {{HTMLElement("form")}}. El nombre no debe contener ningun caracter de espacio en blanco. Notese que `nombre_de_la_ventana` **no** especifica el titulo de la nueva ventana. +- `strWindowFeatures` + - : An optional parameter listing the features (size, position, scrollbars, etc.) of the new window as a string. The string must not contain any whitespace, and each feature name and its value must be separated by a comma. See [Position and size features](#position_and_size_features) below for details. + +## Descripción + +El metodo `open()` crea una nueva ventana secundaria del navegador, similar a seleccionar Nueva ventana desde el menú archivo. El parámetro `url` especifica la URL a ser solicitada y cargada en la nueva ventana. Si `url` es una cadena de caracteres vacia, entonces se creará una nueva ventana en blanco (URL `about:blank`) con las barras de herramientas por defecto de la ventana principal. + +Observe que las URLs no cargarán inmediatamente. Cuando `window.open()` retorna, la ventana siempre contiene `about:blank`. La solicitud de la URL es diferida y comienza luego de que el bloque actual se termine de ejecutar. La creación de la ventana y la carga de los recursos referenciados suceden de forma asíncrona. + +## Ejemplo + +```js +var objeto_window_referencia; +var configuracion_ventana = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes"; + +function abrir_Popup() { + objeto_window_referencia = window.open("http://www.cnn.com/", "Pagina_CNN", configuracion_ventana); +} + +// Llamamos a la función + +abrir_Popup(); +``` + +```js +var windowObjectReference; + +function openRequestedPopup() { + windowObjectReference = window.open( + "http://www.domainname.ext/path/ImageFile.png", + "DescriptiveWindowName", + "resizable,scrollbars,status" + ); +} +``` + +If a window with the name `strWindowName` already exists, then `strUrl` is loaded into the _existing_ window. In this case the return value of the method is the existing window and `strWindowFeatures` is ignored. Providing an empty string for `strUrl` is a way to get a reference to an open window by its name without changing the window's location. To open a _new_ window on every call of `window.open()`, use the special value `_blank` for `strWindowName`. + +`strWindowFeatures` is an optional string containing a comma-separated list of requested features of the new window. After a window is opened, JavaScript can't be used to change the features. If `strWindowName` does not specify an existing window and the `strWindowFeatures` parameter is not provided (or if the `strWindowFeatures` parameter is an empty string), then the new secondary window will render the default toolbars of the main window. + +If the `strWindowFeatures` parameter is used and no size features are defined, then the new window dimensions will be the same as the dimensions of the most recently rendered window. + +If the `strWindowFeatures` parameter is used and if no position features are defined, then the left and top coordinates of the new window dimension will be 22 pixels from where the most recently rendered window was. An offset is universally implemented by browser manufacturers (it is 29 pixels in MSIE 6 SP2 with the default theme) and its purpose is to help users to notice new windows opening. If the most recently used window was maximized, then there is no offset: the new window will be maximized as well. + +**If the `strWindowFeatures` parameter is used, the features that are not listed will be disabled or removed** (except `titlebar` and `close` which are by default `yes`). + +> **Nota:** If using the `strWindowFeatures` parameter, only list the features to be enabled or rendered; the others (except `titlebar` and `close`) will be disabled or removed. +> +> Note that in some browsers, users can override the `strWindowFeatures` settings and enable (or prevent the disabling of) features. + +![Firefox Chrome Toolbars Illustration](/@api/deki/files/210/=FirefoxChromeToolbarsDescription7a.gif) + +### Características de posición y tamaño + +[Note on position and dimension error correction](#Note_on_position_and_dimension_error_correction) + +{{bug(176320)}} + +[Note on precedence](#Note_on_precedence) + +- left + - : Specifies the distance the new window is placed from the left side of the work area for applications of the user's operating system to the leftmost border (resizing handle) of the browser window. The new window can not be initially positioned offscreen. Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png), ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png), ![Opera 6+](/@api/deki/files/288/=Opera6.gif) +- top + - : Specifies the distance the new window is placed from the top side of the work area for applications of the user's operating system to the topmost border (resizing handle) of the browser window. The new window can not be initially positioned offscreen. Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png), ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png), ![Opera 6+](/@api/deki/files/288/=Opera6.gif) +- height + - : Specifies the height of the content area, viewing area of the new secondary window in pixels. The height value includes the height of the horizontal scrollbar if present. The minimum required value is 100. [Note on outerHeight versus height (or innerHeight)](#Note_on_outerHeight_versus_height) Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png), ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png), ![Opera 6+](/@api/deki/files/288/=Opera6.gif) +- width + - : Specifies the width of the content area, viewing area of the new secondary window in pixels. The width value includes the width of the vertical scrollbar if present. The width value does not include the sidebar if it is expanded. The minimum required value is 100. Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png), ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png), ![Opera 6+](/@api/deki/files/288/=Opera6.gif) +- screenX + - : Deprecated. Same as [left](#left) but only supported by Netscape and Mozilla-based browsers. Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- screenY + - : Deprecated. Same as [top](#topS) but only supported by Netscape and Mozilla-based browsers. Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- centerscreen + - : Centers the window in relation to its parent's size and position. Requires chrome=yes. +- outerHeight + - : Specifies the height of the whole browser window in pixels. This outerHeight value includes any/all present toolbar, window horizontal scrollbar (if present) and top and bottom window resizing borders. Minimal required value is 100. **Note**: since titlebar is always rendered, then requesting outerHeight=100 will make the innerHeight of the browser window under the minimal 100 pixels. [Note on outerHeight versus height (or innerHeight)](#Note_on_outerHeight_versus_height) Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- outerWidth + - : Specifies the width of the whole browser window in pixels. This outerWidth value includes the window vertical scrollbar (if present) and left and right window resizing borders. Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- innerHeight + - : Same as [height](#height) but only supported by Netscape and Mozilla-based browsers. Specifies the height of the content area, viewing area of the new secondary window in pixels. The _innerHeight_ value includes the height of the horizontal scrollbar if present. Minimal required value is 100. [Note on outerHeight versus height (or innerHeight)](#Note_on_outerHeight_versus_height) Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- innerWidth + - : Same as [width](#width) but only supported by Netscape and Mozilla-based browsers. Specifies the width of the content area, viewing area of the new secondary window in pixels. The innerWidth value includes the width of the vertical scrollbar if present. The innerWidth value does not include the sidebar if it is expanded. Minimal required value is 100. Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) + +### Barra de herramienta y características de chrome + +- NOTE: All features can be set to yes, 1 or just be present to be "on", set to _no_ or _0_ or in most cases just not present to be "off" + - : example "status=yes", "status=1" and "status" have identical results +- menubar + + - : If this feature is on, then the new secondary window renders the menubar. Mozilla and Firefox users can force new windows to always render the menubar by setting `dom.disable_window_open_feature.menubar` to _true_ in [about:config](http://support.mozilla.com/en-US/kb/Editing+configuration+files#about_config) or in their [user.js file](http://support.mozilla.com/en-US/kb/Editing+configuration+files#user_js). Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png), ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) + +- toolbar + - : If this feature is on, then the new secondary window renders the Navigation Toolbar (Back, Forward, Reload, Stop buttons). In addition to the Navigation Toolbar, Mozilla-based browsers will render the Tab Bar if it is visible, present in the parent window. (If this feature is set to _no_ all toolbars in the window will be invisible, for example extension toolbars). Mozilla and Firefox users can force new windows to always render the Navigation Toolbar by setting `dom.disable_window_open_feature.toolbar` to _true_ in [about:config](http://support.mozilla.com/en-US/kb/Editing+configuration+files#about_config) or in their [user.js file](http://support.mozilla.com/en-US/kb/Editing+configuration+files#user_js). Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png), ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- location + - : If this feature is on, then the new secondary window renders the Location bar in Mozilla-based browsers. MSIE 5+ and Opera 7.x renders the Address Bar. Mozilla and Firefox users can force new windows to always render the location bar by setting `dom.disable_window_open_feature.location` to _true_ in [about:config](http://support.mozilla.com/en-US/kb/Editing+configuration+files#about_config) or in their [user.js file](http://support.mozilla.com/en-US/kb/Editing+configuration+files#user_js). {{Fx_minversion_note(3, "In Firefox 3, dom.disable_window_open_feature.location now defaults to true, forcing the presence of the Location Bar much like in IE7. See bug 337344 for more information.")}} Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png), ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png), ![Opera 6+](/@api/deki/files/288/=Opera6.gif) +- personalbar + - : If this feature is on, then the new secondary window renders the Personal Toolbar in Netscape 6.x, Netscape 7.x and Mozilla browser. It renders the Bookmarks Toolbar in Firefox. In addition to the Personal Toolbar, Mozilla browser will render the Site Navigation Bar if such toolbar is visible, present in the parent window. Mozilla and Firefox users can force new windows to always render the Personal Toolbar/Bookmarks toolbar by setting `dom.disable_window_open_feature.personalbar` to _true_ in [about:config](http://support.mozilla.com/en-US/kb/Editing+configuration+files#about_config) or in their [user.js file](http://support.mozilla.com/en-US/kb/Editing+configuration+files#user_js). Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- directories {{obsolete_inline("2")}} + - : Obsolete synonym of personalbar. In IE, it rendered the Links bar. Supported in Gecko up to 1.9.2 and in IE up to 6. +- status + - : If this feature is on, then the new secondary window has a status bar. Users can force the rendering of status bar in all Mozilla-based browsers, in MSIE 6 SP2 ([Note on status bar in XP SP2](#Note_on_security_issues_of_the_status_bar_presence)) and in Opera 6+. The default preference setting in recent Mozilla-based browser releases and in Firefox 1.0 is to force the presence of the status bar. [Note on status bar](#Note_on_status_bar) Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png), ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) + +### Características de funcionalidad de window + +- attention {{NonStandardBadge}} + + - : If this feature is specified, the window is able to open even if another application is already in the foreground. This feature is for Firefox OS applications only, and is currently restricted to certified applications. See {{SectionOnPage("/en-US/docs/Archive/B2G_OS/Firefox_OS_apps/App_permissions", "Internal (Certified) app permissions")}} for more information. Supported in: ![](https://mdn.mozillademos.org/files/8003/firefox_os_logo_wordmark-75px.png) + +- dependent + - : If on, the new window is said to be dependent of its parent window. A dependent window closes when its parent window closes. A dependent window is minimized on the Windows task bar only when its parent window is minimized. On Windows platforms, a dependent window does not show on the task bar. A dependent window also stays in front of the parent window. Dependent windows are not implemented on MacOS X, this option will be ignored. The dependent feature is currently under revision to be removed ({{Bug(214867)}}) In MSIE 6, the nearest equivalent to this feature is the `showModelessDialog()` method. Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- minimizable + - : This setting can only apply to dialog windows; "minimizable" requires `dialog=yes`. If `minimizable` is on, the new dialog window will have a minimize system command icon in the titlebar and it will be minimizable. Any non-dialog window is always minimizable and `minimizable=no` will be ignored. Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- fullscreen + - : Do not use. Not implemented in Mozilla. There are no plans to implement this feature in Mozilla. This feature no longer works in MSIE 6 SP2 the way it worked in MSIE 5.x. The Windows taskbar, as well as the titlebar and the status bar of the window are not visible, nor accessible when fullscreen is enabled in MSIE 5.x. `fullscreen` always upsets users with large monitor screen or with dual monitor screen. Forcing `fullscreen` onto other users is also extremely unpopular and is considered an outright rude attempt to impose web author's viewing preferences onto users. [Note on fullscreen](#Note_on_fullscreen) Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png) `fullscreen` does not really work in MSIE 6 SP2. +- resizable + + - : If this feature is on, the new secondary window will be resizable. **Note**: Starting with version 1.4, Mozilla-based browsers have a window resizing grippy at the right end of the status bar, this ensures that users can resize the browser window even if the web author requested this secondary window to be non-resizable. In such case, the maximize/restore icon in the window's titlebar will be disabled and the window's borders won't allow resizing but the window will still be resizable via that grippy in the status bar. + + Starting with Firefox 3, secondary windows are always resizable ({{Bug(177838)}}) + + > **Nota:** **Tip**: For accessibility reasons, it is strongly recommended to set this feature always on + + Mozilla and Firefox users can force new windows to be easily resizable by setting + `dom.disable_window_open_feature.resizable` + to _true_ in [about:config](http://support.mozilla.com/en-US/kb/Editing+configuration+files#about_config) or in their [user.js file](http://support.mozilla.com/en-US/kb/Editing+configuration+files#user_js). Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png), ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) + +- scrollbars + + - : If this feature is on, the new secondary window will show horizontal and/or vertical scrollbar(s) if the document doesn't fit into the window's viewport. + + > **Nota:** **Tip**: For accessibility reasons, it is strongly encouraged to set this feature always on. + + Mozilla and Firefox users can force this option to be always enabled for new windows by setting + `dom.disable_window_open_feature.scrollbars` + to _true_ in [about:config](http://support.mozilla.com/en-US/kb/Editing+configuration+files#about_config) or in their [user.js file](http://support.mozilla.com/en-US/kb/Editing+configuration+files#user_js). [Note on scrollbars](#Note_on_scrollbars) Supported in: ![Internet Explorer 5+](/@api/deki/files/260/=MSIE_ico.png), ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) + +### Características que requieren privilegios + +The following features require the `UniversalBrowserWrite` privilege, otherwise they will be ignored. Chrome scripts have this privilege automatically, others have to request it from the PrivilegeManager. + +- chrome + - : **Note**: Starting with Mozilla 1.7/Firefox 0.9, this feature requires the `UniversalBrowserWrite` privilege ({{Bug(244965)}}). Without this privilege, it is ignored. If on, the page is loaded as window's only content, without any of the browser's interface elements. There will be no context menu defined by default and none of the standard keyboard shortcuts will work. The page is supposed to provide a user interface of its own, usually this feature is used to open XUL documents (standard dialogs like the JavaScript Console are opened this way). Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- dialog + - : **Note**: Starting with Firefox 44, this feature can only be used with chrome privileges. If content attempts to toggle this feature, it will be ignored. [![MenuSystemCommands.png](/@api/deki/files/268/=MenuSystemCommands.png?size=webview)](/@api/deki/files/268/=MenuSystemCommands.png "MenuSystemCommands.png")The `dialog` feature removes all icons (restore, minimize, maximize) from the window's titlebar, leaving only the close button. Mozilla 1.2+ and Netscape 7.1 will render the other menu system commands (in FF 1.0 and in NS 7.0x, the command system menu is not identified with the Firefox/NS 7.0x icon on the left end of the titlebar: that's probably a bug. You can access the command system menu with a right-click on the titlebar). Dialog windows are windows which have no minimize system command icon and no maximize/restore down system command icon on the titlebar nor in correspondent menu item in the command system menu. They are said to be dialog because their normal, usual purpose is to only notify info and to be dismissed, closed. On Mac systems, dialog windows have a different window border and they may get turned into a sheet. Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- modal + + - : **Note**: Starting with Mozilla 1.2.1, this feature requires the `UniversalBrowserWrite` privilege ({{Bug(180048)}}). Without this privilege, it is ignored. If on, the new window is said to be modal. The user cannot return to the main window until the modal window is closed. A typical modal window is created by the [alert() function](/es/docs/DOM/window.alert "DOM/window.alert"). The exact behavior of modal windows depends on the platform and on the Mozilla release version. + + > **Nota:** As of {{Gecko("1.9")}}, the Internet Explorer equivalent to this feature is the {{domxref("window.showModalDialog()")}} method. For compatibility reasons, it's now supported in Firefox. Note also that starting in {{Gecko("2.0")}}, you can use {{domxref("window.showModalDialog()")}} without UniversalBrowserWrite privileges. + + Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) + +- titlebar + - : By default, all new secondary windows have a titlebar. If set to _no or 0_, this feature removes the titlebar from the new secondary window. Mozilla and Firefox users can force new windows to always render the titlebar by setting + `dom.disable_window_open_feature.titlebar` + to _true_ in [about:config](http://support.mozilla.com/en-US/kb/Editing+configuration+files#about_config) or in their [user.js file](http://support.mozilla.com/en-US/kb/Editing+configuration+files#user_js). Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- alwaysRaised + - : If on, the new window will always be displayed on top of other browser windows, regardless of whether it is active or not. Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- alwaysLowered + - : If on, the new created window floats below, under its own parent when the parent window is not minimized. alwaysLowered windows are often referred as pop-under windows. The alwaysLowered window can not be on top of the parent but the parent window can be minimized. In NS 6.x, the alwaysLowered window has no minimize system command icon and no restore/maximize system command. Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) +- z-lock + - : Same as `alwaysLowered`. +- close + - : When set to _no or 0_, this feature removes the system close command icon and system close menu item. It will only work for dialog windows (`dialog` feature set). `close=no` will override `minimizable=yes`. Mozilla and Firefox users can force new windows to always have a close button by setting + `dom.disable_window_open_feature.close` + to _true_ in [about:config](http://support.mozilla.com/en-US/kb/Editing+configuration+files#about_config) or in their [user.js file](http://support.mozilla.com/en-US/kb/Editing+configuration+files#user_js). Supported in: ![Netscape 6.x](/@api/deki/files/785/=Ns6.gif), ![Netscape 7.x](/@api/deki/files/281/=NS7_ico4.gif), ![Mozilla 1.x](/@api/deki/files/277/=Mozilla1_ico.png), ![Firefox 1.x](/@api/deki/files/200/=FF1x.png) + +The position and size feature elements require a number to be set. The toolbars and window functionalities can be set with a _yes_ or _no_; you can use _1_ instead of _yes_ and _0_ instead of _no_. The toolbar and functionality feature elements also accept the shorthand form: you can turn a feature on by simply listing the feature name in the _features_ string. If you supply the _features_ parameter, then the `titlebar` and `close` are still _yes_ by default, but the other features which have a _yes_/_no_ choice will be _no_ by default and will be turned off. + +Example: + +```js +var windowObjectReference; // global variable + +function openRequestedPopup() { + windowObjectReference = window.open( + "http://www.domainname.ext/path/ImgFile.png", + "DescriptiveWindowName", + "width=420,height=230,resizable,scrollbars=yes,status=1" + ); +} +``` + +In this example, the window will be resizable, it will render scrollbar(s) if needed, if the content overflows requested window dimensions and it will render the status bar. It will not render the menubar nor the location bar. Since the author knew about the size of the image (400 pixels wide and 200 pixels high), he added the margins applied to the root element in MSIE 6 which is 15 pixels for top margin, 15 pixels for the bottom margin, 10 pixels for the left margin and 10 pixels for the right margin. + +## Buenas prácticas + +```js + + +(...) + +

Promote Firefox adoption

+``` + +The above code solves a few usability problems related to links opening secondary window. The purpose of the `return false` in the code is to cancel default action of the link: if the onclick event handler is executed, then there is no need to execute the default action of the link. But if javascript support is disabled or non-existent on the user's browser, then the onclick event handler is ignored and the browser loads the referenced resource in the target frame or window that has the name "PromoteFirefoxWindowName". If no frame nor window has the name "PromoteFirefoxWindowName", then the browser will create a new window and will name it "PromoteFirefoxWindowName". + +More reading on the use of the target attribute: + +[HTML 4.01 Target attribute specifications](http://www.w3.org/TR/html401/present/frames.html#h-16.3.2) + +[How do I create a link that opens a new window?](http://www.htmlhelp.com/faq/html/links.html#new-window) + +You can also parameterize the function to make it versatile, functional in more situations, therefore re-usable in scripts and webpages: + +```js + + +(...) + +

Promote Firefox adoption

+``` + +You can also make such function able to open only 1 secondary window and to reuse such single secondary window for other links in this manner: + +```js + + +(...) + +

Promote Firefox adoption

+ +

Firefox FAQ

+``` + +## FAQ + +- How can I prevent the confirmation message asking the user whether he wants to close the window? + - : You can not. **New windows not opened by javascript can not as a rule be closed by JavaScript.** The JavaScript Console in Mozilla-based browsers will report the warning message: `"Scripts may not close windows that were not opened by script."` Otherwise the history of URLs visited during the browser session would be lost. [More on the window.close()](/es/docs/DOM/window.close "DOM/window.close") method +- How can I bring back the window if it is minimized or behind another window? + - : First check for the existence of the window object reference of such window and if it exists and if it has not been closed, then use the [focus()](/es/docs/DOM/window.focus "DOM/window.focus") method. There is no other reliable way. You can examine an [example explaining how to use the focus() method](#Best_practices). +- How do I force a maximized window? + - : You cannot. All browser manufacturers try to make the opening of new secondary windows noticed by users and noticeable by users to avoid confusion, to avoid disorienting users. +- How do I turn off window resizability or remove toolbars? + - : You cannot force this. Users with Mozilla-based browsers have absolute control over window functionalities like resizability, scrollability and toolbars presence via user preferences in `about:config`. Since your users are the ones who are supposed to use such windows (and not you, being the web author), the best is to avoid interfering with their habits and preferences. We recommend to always set the resizability and scrollbars presence (if needed) to yes to insure accessibility to content and usability of windows. This is in the best interests of both the web author and the users. +- How do I resize a window to fit its content? + - : You can not reliably because the users can prevent the window from being resized by unchecking the `Edit/Preferences/Advanced/Scripts & Plug-ins/Allow Scripts to/ Move or resize existing windows` checkbox in Mozilla or `Tools/Options.../Content tab/Enable Javascript/Advanced button/Move or resize existing windows` checkbox in Firefox or by setting `dom.disable_window_move_resize` to _true_ in `about:config` or by editing accordingly their [user.js file](http://www.mozilla.org/support/firefox/edit#user). In general, users usually disable moving and resizing of existing windows because allowing authors' scripts to do so has been abused overwhelmingly in the past and the rare scripts that do not abuse such feature are often wrong, inaccurate when resizing the window. 99% of all those scripts disable window resizability and disable scrollbars when in fact they should enable both of these features to allow a cautious and sane fallback mechanism if their calculations are wrong. The window method [sizeToContent()](/es/docs/DOM/window.sizeToContent "DOM/window.sizeToContent") is also disabled if the user unchecks the preference `Move or resize existing windows` checkbox. Moving and resizing a window remotely on the user's screen via script will very often annoy the users, will disorient the user, and will be wrong at best. The web author expects to have full control of (and can decide about) every position and size aspects of the users' browser window ... which is simply not true. +- How do I open a referenced resource of a link in a new tab? or in a specific tab? + - : To open a resource in a new tab see [Tabbed browser](/es/docs/XUL/tabbrowser). Some [Code snippets](https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Tabbed_browser?redirectlocale=en-US&redirectslug=Code_snippets%2FTabbed_browser) are available. If you are using the SDK, tabs are [handled a bit differently](https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs) [K-meleon 1.1](http://kmeleon.sourceforge.net/), a Mozilla-based browser, gives complete control and power to the user regarding how links are opened. Only the user can set his advanced preferences to do that. Some advanced extensions also give Mozilla and Firefox a lot of power over how referenced resources are loaded. In a few years, the [target property of the CSS3 hyperlink module](http://www.w3.org/TR/2004/WD-css3-hyperlinks-20040224/#target0) may be implemented (if CSS3 Hyperlink module as it is right now is approved). And even if and when this happens, you can expect developers of browsers with tab-browsing to give the user entire veto power and full control over how links can open web pages. How to open a link should always be entirely under the control of the user. +- How do I know whether a window I opened is still open? + - : You can test for the existence of the window object reference which is the returned value in case of success of the window\.open() call and then verify that _w\_\_indowObjectReference_.closed return value is _false_. +- How can I tell when my window was blocked by a popup blocker? + - : With the built-in popup blockers of Mozilla/Firefox and Internet Explorer 6 SP2, you have to check the return value of `window.open()`: it will be _null_ if the window wasn't allowed to open. However, for most other popup blockers, there is no reliable way. +- What is the JavaScript relationship between the main window and the secondary window? + - : The `window.open()` method gives a main window a reference to a secondary window; the [opener](/es/docs/DOM/window.opener "DOM/window.opener") property gives a secondary window a reference to its main window. +- I can not access the properties of the new secondary window. I always get an error in the javascript console saying "Error: uncaught exception: Permission denied to get property \. Why is that? + - : It is because of the cross-domain script security restriction (also referred as the "Same Origin Policy"). A script loaded in a window (or frame) from a distinct origin (domain name) **cannot get nor set** properties of another window (or frame) or the properties of any of its HTML objects coming from another distinct origin (domain name). Therefore, before executing a script targeting a secondary window, the browser in the main window will verify that the secondary window has the same domain name. More reading on the cross-domain script security restriction: [http://www.mozilla.org/projects/secu...me-origin.html](http://www.mozilla.org/projects/security/components/same-origin.html) + +## Problemas de usos + +### Avoid resorting to `window.open()` + +Generally speaking, it is preferable to avoid resorting to window\.open() for several reasons: + +- All Mozilla-based browsers offer [tab-browsing](/es/docs/XUL/tabbrowser) and this is the preferred mode of [opening referenced resources](https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Tabbed_browser?redirectlocale=en-US&redirectslug=Code_snippets%2FTabbed_browser) ([SDK](https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs))... not just in Mozilla-based browsers but in all other browsers offering tab-browsing. In other words, tab-capable browser users overall prefer opening new tabs than opening new windows in a majority of webpage situations. Tab-capable browsers have rapidly gained support and enthusiasm on internet in the last 3 years; this trend will not revert back. MSIE 7, released in October 2006, has full support for tab browsing. +- There are now [several Mozilla extensions](https://addons.mozilla.org/seamonkey/browse/type:1/cat:48/sort:updated) (like Multizilla) and [Firefox extensions](https://addons.update.mozilla.org/firefox/browse/type:1/cat:14/sort:updated) (like [Tabbrowser preferences](https://addons.mozilla.org/firefox/addon/158)), features, settings and advanced preferences based on tab-browsing and based on converting window\.open() calls into opening tabs, based on neutralizing window\.open() calls, in particular in neutralizing unrequested openings of new windows (often referred as blocking unrequested popups or as blocking script-initiated windows opening automatically). Such features found in extensions include opening a link in a new window or not, in the same window, in a new tab or not, in "background" or not. Coding carelessly to open new windows can no longer be assured of success, can not succeed by force and, if it does, it will annoy a majority of users. +- New windows can have menubar missing, scrollbars missing, status bar missing, window resizability disabled, etc.; new tabs can not be missing those functionalities or toolbars (or at least, the toolbars which are present by default). Therefore, tab-browsing is preferred by a lot of users because the normal user-interface of the browser window they prefer is kept intact, remains stable. +- Opening new windows, even with reduced features, uses considerably a lot of the user's system resources (cpu, RAM) and involves considerably a lot of coding in the source code (security management, memory management, various code branchings sometimes quite complex, window frame/chrome/toolbars building, window positioning and sizing, etc.). Opening new tabs is less demanding on the user's system resources (and faster to achieve) than opening new windows. + +### Offer to open a link in a new window, using these guidelines + +If you want to offer to open a link in a new window, then follow tested and recommendable usability and accessibility guidelines: + +#### _Never_ use this form of code for links: `` + +"javascript:" links break accessibility and usability of webpages in every browser. + +- "javascript:" pseudo-links become dysfunctional when javascript support is disabled or inexistent. Several corporations allow their employees to surf on the web but under strict security policies: no javascript enabled, no java, no activeX, no Flash. For various reasons (security, public access, text browsers, etc..), about 5% to 10% of users on the web surf with javascript disabled. +- "javascript:" links will interfere with advanced features in tab-capable browsers: eg. middle-click on links, Ctrl+click on links, tab-browsing features in extensions, etc. +- "javascript:" links will interfere with the process of indexing webpages by search engines. +- "javascript:" links interfere with assistive technologies (e.g. voice browsers) and several web-aware applications (e.g. PDAs and mobile browsers). +- "javascript:" links also interfere with "mouse gestures" features implemented in browsers. +- Protocol scheme "javascript:" will be reported as an error by link validators and link checkers. + +**Further reading:** + +- [Top Ten Web-Design Mistakes of 2002](http://www.useit.com/alertbox/20021223.html), 6. JavaScript in Links, Jakob Nielsen, December 2002 +- [Links & JavaScript Living Together in Harmony](http://www.evolt.org/article/Links_and_JavaScript_Living_Together_in_Harmony/17/20938/), Jeff Howden, February 2002 +- [comp.lang.javascript newsgroup discussion FAQ on "javascript:" links](http://jibbering.com/faq/#FAQ4_24) + +#### Never use `` + +Such pseudo-link also breaks accessibility of links. **Always use a real URL for the href attribute value** so that if javascript support is disabled or inexistent or if the user agent does not support opening of secondary window (like MS-Web TV, text browsers, etc), then such user agents will still be able to load the referenced resource according to its default mode of opening/handling a referenced resource. This form of code also interferes with advanced features in tab-capable browsers: eg. middle-click on links, Ctrl+click on links, Ctrl+Enter on links, "mouse gestures" features. + +#### Always identify links which will create (or will re-use) a new, secondary window + +Identify links that will open new windows in a way that helps navigation for users by coding the title attribute of the link, by adding an icon at the end of the link or by coding the cursor accordingly. + +The purpose is to warn users in advance of context changes to minimize confusion on the user's part: changing the current window or popping up new windows can be very disorienting to users (Back toolbar button is disabled). + +> "Users often don't notice that a new window has opened, especially if they are using a small monitor where the windows are maximized to fill up the screen. So a user who tries to return to the origin will be confused by a grayed out _Back_ button." +> quote from [The Top Ten _New_ Mistakes of Web Design](http://www.useit.com/alertbox/990530.html): 2. Opening New Browser Windows, Jakob Nielsen, May 1999 + +When extreme changes in context are explicitly identified before they occur, then the users can determine if they wish to proceed or so they can be prepared for the change: not only they will not be confused or feel disoriented, but more experienced users can better decide how to open such links (in a new window or not, in the same window, in a new tab or not, in "background" or not). + +**References** + +- "If your link spawns a new window, or causes another windows to 'pop up' on your display, or move the focus of the system to a new FRAME or Window, then the nice thing to do is to tell the user that something like that will happen." [World Wide Web Consortium Accessibility Initiative regarding popups](http://www.w3.org/WAI/wcag-curric/sam77-0.htm) +- "Use link titles to provide users with a preview of where each link will take them, before they have clicked on it." [Ten Good Deeds in Web Design](http://www.useit.com/alertbox/991003.html), Jakob Nielsen, October 1999 +- [Using Link Titles to Help Users Predict Where They Are Going](http://www.useit.com/alertbox/980111.html), Jakob Nielsen, January 1998 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Example "New Window" Icons & Cursors +
+ New window icon from yahoo.com + + New window icon from microsoft.com + + New window icon from webaim.org + + New window icon from sun.com +
+ New window icon from bbc.co.uk + + New window icon from Accessible Internet Solutions + + New window icon from accessify.com + + New window icon from webstyleguide.com +
+ New window icon from an unknown source + + New window icon from an unknown source + + New window icon from an unknown source + + New window icon from gtalbot.org +
+ New window cursor from draig.de + + New window cursor from mithgol.ru +
+ +#### Always use the target attribute + +If javascript support is disabled or non-existent, then the user agent will create a secondary window accordingly or will render the referenced resource according to its handling of the target attribute: e.g. some user agents which can not create new windows, like MS Web TV, will fetch the referenced resource and append it at the end of the current document. The goal and the idea is to try to provide - **not impose** - to the user a way to open the referenced resource, a mode of opening the link. Your code should not interfere with the features of the browser at the disposal of the user and your code should not interfere with the final decision resting with the user. + +#### Do not use `target="_blank"` + +Always provide a meaningful name to your target attribute and try to reuse such target attribute in your page so that a click on another link may load the referenced resource in an already created and rendered window (therefore speeding up the process for the user) and therefore justifying the reason (and user system resources, time spent) for creating a secondary window in the first place. Using a single target attribute value and reusing it in links is much more user resources friendly as it only creates one single secondary window which is recycled. On the other hand, using "\_blank" as the target attribute value will create several new and unnamed windows on the user's desktop which can not be recycled, reused. In any case, if your code is well done, it should not interfere with the user's final choice but rather merely offer him more choices, more ways to open links and more power to the tool he's using (a browser). + +## Glosario + +- Opener window, parent window, main window, first window + - : Terms often used to describe or to identify the same window. It is the window from which a new window will be created. It is the window on which the user clicked a link which lead to the creation of another, new window. +- Sub-window, child window, secondary window, second window + - : Terms often used to describe or to identify the same window. It is the new window which was created. +- Unrequested popup windows + - : Script-initiated windows opening automatically without the user's consent. + +## Especificación + +| Specification | Status | Comment | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | --------------------------------------------- | +| {{SpecName('HTML WHATWG', 'browsers.html#dom-open', 'Window.open()')}} | {{Spec2('HTML WHATWG')}} | | +| {{ SpecName('CSSOM View', '#the-features-argument-to-the-open()-method', 'The features argument to the open() method') }} | {{ Spec2('CSSOM View') }} | Defines the effect of the `features` argument | + +## Notas + +### Nota sobre la precedencia + +In cases where `left` and `screenX` (and/or `top` and `screenY`) have conflicting values, then `left` and `top` have precedence over `screenX` and `screenY` respectively. If `left` and `screenX` (and/or `top` and `screenY`) are defined in the _features_ list, then `left` (and/or `top`) will be honored and rendered. In the following example the new window will be positioned at 100 pixels from the left side of the work area for applications of the user's operating system, not at 200 pixels. + +```js +windowObjectReference = window.open( + "http://news.bbc.co.uk/", + "BBCWorldNewsWindowName", + "left=100,screenX=200,resizable,scrollbars,status" +); +``` + +If left is set but top has no value and screenY has a value, then left and screenY will be the coordinate positioning values of the secondary window. + +outerWidth has precedence over width and width has precedence over innerWidth. outerHeight has precedence over height and height has precedence over innerHeight. In the following example, Mozilla-browsers will create a new window with an outerWidth of 600 pixels wide and will ignore the request of a width of 500 pixels and will also ignore the request of an innerWidth of 400 pixels. + +```js +windowObjectReference = window.open( + "http://www.wwf.org/", + "WWildlifeOrgWindowName", + "outerWidth=600,width=500,innerWidth=400,resizable,scrollbars,status" +); +``` + +### Note on position and dimension error correction + +Requested position and requested dimension values in the _features_ list will not be honored and **will be corrected** if any of such requested value does not allow the entire browser window to be rendered within the work area for applications of the user's operating system. **No part of the new window can be initially positioned offscreen. This is by default in all Mozilla-based browser releases.** + +[MSIE 6 SP2 has a similar error correction mechanism](http://msdn2.microsoft.com/en-us/library/ms997645.aspx#xpsp_topic5) but it is not activated by default in all security levels: a security setting can disable such error correction mechanism. + +### Note on scrollbars + +When content overflows window viewport dimensions, then scrollbar(s) (or some scrolling mechanism) are necessary to ensure that content can be accessed by users. Content can overflow window dimensions for several reasons which are outside the control of web authors: + +- user resizes the window +- user increases the text size of fonts via View/Text Zoom (%) menuitem in Mozilla or View/Text Size/Increase or Decrease in Firefox +- user sets a minimum font size for pages which is bigger than the font-size the web author requested. People over 40 years old or with particular viewing habit or reading preference often set a minimal font size in Mozilla-based browsers. +- web author is not aware of default margin (and/or border and/or padding) values applying to root element or body node in various browsers and various browser versions +- user uses an user stylesheet ([userContent.css in Mozilla-based browsers](http://www.mozilla.org/support/firefox/edit#content)) for his viewing habits which increases document box dimensions (margin, padding, default font size) +- user can customize individually the size (height or width) of most toolbars via operating system settings. E.g. window resizing borders, height of browser titlebar, menubar, scrollbars, font size are entirely customizable by the user in Windows XP operating system. These toolbars dimensions can also be set via browser themes and skins or by operating system themes +- web author is unaware that the user default browser window has custom toolbar(s) for specific purpose(s); e.g.: prefs bar, web developer bar, accessibility toolbar, popup blocking and search toolbar, multi-feature toolbar, etc. +- user uses assistive technologies or add-on features which modify the operating system's work area for applications: e.g. MS-Magnifier +- user repositions and/or resizes directly or indirectly the operating system's work area for applications: e.g. user resizes the Windows taskbar, user positions the Windows taskbar on the left side (arabic language based) or right side (Hebrew language), user has a permanent MS-Office quick launch toolbar, etc. +- some operating system (Mac OS X) forces presence of toolbars which can then fool the web author's anticipations, calculations of the effective dimensions of the browser window + +### Note on status bar + +You should assume that a large majority of users' browsers will have the status bar or that a large majority of users will want to force the status bar presence: best is to always set this feature to yes. Also, if you specifically request to remove the status bar, then Firefox users will not be able to view the Site Navigation toolbar if it is installed. In Mozilla and in Firefox, all windows with a status bar have a window resizing grippy at its right-most side. The status bar also provides info on http connection, hypertext resource location, download progress bar, encryption/secure connection info with SSL connection (displaying a yellow padlock icon), internet/security zone icons, privacy policy/cookie icon, etc. **Removing the status bar usually removes a lot of functionality, features and information considered useful (and sometimes vital) by the users.** + +### Note on security issues of the status bar presence + +In MSIE 6 for XP SP2: For windows opened using `window.open()`: + +> "For windows opened using window\.open(): +> Expect the status bar to be present, and code for it. **The status bar will be on by default** and is 20-25 pixels in height. (...)" +> quote from [Fine-Tune Your Web Site for Windows XP Service Pack 2, Browser Window Restrictions in XP SP2](http://msdn2.microsoft.com/en-us/library/ms997645.aspx#xpsp_topic5) + +> "(...) windows that are created using the window\.open() method can be called by scripts and used to spoof a user interface or desktop or to hide malicious information or activity by sizing the window so that the status bar is not visible. +> Internet Explorer windows provide visible security information to the user to help them ascertain the source of the Web page and the security of the communication with that page. When these elements are not in view, the user might think they are on a more trusted page or interacting with a system process when they are actually interacting with a malicious host. (...) +> **Script-initiated windows will be displayed fully, with the Internet Explorer title bar and status bar.** (...) +> Script management of Internet Explorer status bar +> Detailed description +> **Internet Explorer has been modified to not turn off the status bar for any windows. The status bar is always visible for all Internet Explorer windows.** (...) Without this change, windows that are created using the window\.open() method can be called by scripts and spoof a user interface or desktop or hide malicious information or activity by hiding important elements of the user interface from the user. +> The status bar is a security feature of Internet Explorer windows that provides Internet Explorer security zone information to the user. This zone cannot be spoofed (...)" +> quote from [Changes to Functionality in Microsoft Windows XP Service Pack 2, Internet Explorer Window Restrictions](http://technet.microsoft.com/en-us/library/bb457150.aspx#ECAA) + +### Note on fullscreen + +In MSIE 6 for XP SP2: + +- "window\.open() with fullscreen=yes will now result in a maximized window, not a kiosk mode window." +- "The definition of the fullscreen=yes specification is changed to mean 'show the window as maximized,' which will keep the title bar, address bar, and status bar visible." + +_References:_ + +- [Fine-Tune Your Web Site for Windows XP Service Pack 2](http://msdn2.microsoft.com/en-us/library/ms997645.aspx#xpsp_topic5) +- [Changes to Functionality in Microsoft Windows XP Service Pack 2, Script sizing of Internet Explorer windows](http://technet.microsoft.com/en-us/library/bb457150.aspx#ECAA) + +### Note on outerHeight versus height + +![innerHeight vs outerHeight illustration](/@api/deki/files/212/=FirefoxInnerVsOuterHeight.png) + +### Note on refreshing vs. opening a new window/tab + +If the `strWindowName` parameter is omitted, a new window or tab is opened. If a window with the same name already exists, the existing window is refreshed. + +```js +//Always opens a new window/tab +window.open("map.php"); + +//Refreshes an existing window/tab that was opened with the same name, if one exists +window.open("map.php", "BiggerMap"); +``` + +## Tutoriales + +- [JavaScript windows (tutorial)](http://www.infimum.dk/HTML/JSwindows.html) by Lasse Reichstein Nielsen +- [The perfect pop-up (tutorial)](http://accessify.com/features/tutorials/the-perfect-popup/) by Ian Lloyd +- [Popup windows and Firefox (interactive demos)](http://www.gtalbot.org/FirefoxSection/Popup/PopupAndFirefox.html) by Gérard Talbot + +## Referencias + +- [Links Want To Be Links](http://www.cs.tut.fi/~jkorpela/www/links.html) by Jukka K. Korpela +- [Links & JavaScript Living Together in Harmony](http://www.evolt.org/article/Links_and_JavaScript_Living_Together_in_Harmony/17/20938/) by Jeff Howden diff --git a/files/es/web/api/window/opener/index.html b/files/es/web/api/window/opener/index.html deleted file mode 100644 index 8b788d3ae49215..00000000000000 --- a/files/es/web/api/window/opener/index.html +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: Window.opener -slug: Web/API/Window/opener -translation_of: Web/API/Window/opener ---- -
{{APIRef}}
- -

Resumen

- -

Devuelve una referencia de, la ventana que abrió la ventana actuál.

- -

Sintaxis

- -
objRef = window.opener;
-
- -

Ejemplo

- -
if (window.opener != indexWin) {
-  referToTop(window.opener);
-}
-
- -

Notas

- -

Cuando una ventana es abierta desde otra utilizando "Window.open()", esta, mantiene una referencia a la primera mediante "window.opener". Si la ventana actuál no fué abierta, el metodo retorna NULL.

- -

El navegador de Windows Phone no soporta window.opener. Tampoco es soportado en Internet Explorer si la ventana nueva se encuentra en una zona de seguridad distinta.

diff --git a/files/es/web/api/window/opener/index.md b/files/es/web/api/window/opener/index.md new file mode 100644 index 00000000000000..18bf4a55979e96 --- /dev/null +++ b/files/es/web/api/window/opener/index.md @@ -0,0 +1,30 @@ +--- +title: Window.opener +slug: Web/API/Window/opener +translation_of: Web/API/Window/opener +--- +{{APIRef}} + +## Resumen + +Devuelve una referencia de, la ventana que abrió la ventana actuál. + +## Sintaxis + +```js +objRef = window.opener; +``` + +## Ejemplo + +```js +if (window.opener != indexWin) { + referToTop(window.opener); +} +``` + +## Notas + +Cuando una ventana es abierta desde otra utilizando "Window\.open()", esta, mantiene una referencia a la primera mediante "window\.opener". Si la ventana actuál no fué abierta, el metodo retorna NULL. + +El navegador de Windows Phone no soporta window\.opener. Tampoco es soportado en Internet Explorer si la ventana nueva se encuentra en una zona de seguridad distinta. diff --git a/files/es/web/api/window/outerheight/index.html b/files/es/web/api/window/outerheight/index.html deleted file mode 100644 index a011295f312453..00000000000000 --- a/files/es/web/api/window/outerheight/index.html +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Window.outerHeight -slug: Web/API/Window/outerHeight -tags: - - API - - Propiedad - - Referencia -translation_of: Web/API/Window/outerHeight ---- -
{{APIRef}}
- -

Sumario

- -

Window.outerHeight obtiene la altura en pixeles de toda la ventana del navegador. Representa el alto de toda la ventana, incluyendo la barra de notificaciones (si se encuentra) y los bordes.

- -

Esta propiedad es de sólo lectura, no tiene valor por defecto

- -

Sintaxis

- -
outWindowHeight = window.outerHeight;
-
- -

Al obtener, outWindowHeight contiene el alto de la ventana.

- -

Notas

- -

Para cambiar el tamaño de una ventana, ver {{domxref("window.resizeBy()")}} y {{domxref("window.resizeTo()")}}.

- -

Para obtener la altura interna de una ventana, por ejemplo, el alto de una página siendo desplegada, ver {{domxref("window.innerHeight")}}.

- -

Ejemplo gráfico

- -

La siguiente figura muestra la diferencia entre innerHeight y outerHeight.

- -

innerHeight vs outerHeight illustration

- -

Compatibilidad del navegador

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

Especificaciones

- - - - - - - - - - - - - - - - -
EspecificaciónEstadoComentario
{{ SpecName('CSSOM View', '#dom-window-outerheight', 'Window.outerHeight') }}{{ Spec2('CSSOM View') }}
- -

Ver también

- -
    -
  • {{domxref("window.innerHeight")}}
  • -
  • {{domxref("window.innerWidth")}}
  • -
  • {{domxref("window.outerWidth")}}
  • -
  • {{domxref("window.resizeBy()")}}
  • -
  • {{domxref("window.resizeTo()")}}
  • -
diff --git a/files/es/web/api/window/outerheight/index.md b/files/es/web/api/window/outerheight/index.md new file mode 100644 index 00000000000000..98e8a904b01090 --- /dev/null +++ b/files/es/web/api/window/outerheight/index.md @@ -0,0 +1,54 @@ +--- +title: Window.outerHeight +slug: Web/API/Window/outerHeight +tags: + - API + - Propiedad + - Referencia +translation_of: Web/API/Window/outerHeight +--- +{{APIRef}} + +## Sumario + +`Window.outerHeight `obtiene la altura en pixeles de toda la ventana del navegador. Representa el alto de toda la ventana, incluyendo la barra de notificaciones (si se encuentra) y los bordes. + +Esta propiedad es de sólo lectura, no tiene valor por defecto + +## Sintaxis + +```js +outWindowHeight = window.outerHeight; +``` + +Al obtener, `outWindowHeight` contiene el alto de la ventana. + +## Notas + +Para cambiar el tamaño de una ventana, ver {{domxref("window.resizeBy()")}} y {{domxref("window.resizeTo()")}}. + +Para obtener la altura interna de una ventana, por ejemplo, el alto de una página siendo desplegada, ver {{domxref("window.innerHeight")}}. + +### Ejemplo gráfico + +La siguiente figura muestra la diferencia entre `innerHeight `y `outerHeight`. + +![innerHeight vs outerHeight illustration](/@api/deki/files/213/=FirefoxInnerVsOuterHeight2.png) + +## Compatibilidad del navegador + +{{Compat("api.Window.outerHeight")}} + +## Especificaciones + +| Especificación | Estado | Comentario | +| -------------------------------------------------------------------------------------------------------- | -------------------------------- | ---------- | +| {{ SpecName('CSSOM View', '#dom-window-outerheight', 'Window.outerHeight') }} | {{ Spec2('CSSOM View') }} | | + +## Ver también + +- {{domxref("window.innerHeight")}} +- {{domxref("window.innerWidth")}} +- {{domxref("window.outerWidth")}} +- {{domxref("window.resizeBy()")}} +- {{domxref("window.resizeTo()")}} diff --git a/files/es/web/api/window/outerwidth/index.html b/files/es/web/api/window/outerwidth/index.html deleted file mode 100644 index 4aabe1b57ea280..00000000000000 --- a/files/es/web/api/window/outerwidth/index.html +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: Window.outerWidth -slug: Web/API/Window/outerWidth -translation_of: Web/API/Window/outerWidth ---- -
{{APIRef}}
- -

Sumario

- -

Window.outerWidth obtiene el ancho exterior del navegador. Representa el ancho total de la ventana incluyendo las barras laterales (si es expandida), interfaz grafíca y los de elementos para redimencionado de bordes.

- -

Esta propiedad es de sólo lectura; no tiene valores por default.

- -

Sintaxis

- -
outWindowWidth = window.outerWidth;
-
- -

Lo que retorna outWindowWidth es el ancho exterior del navegador.

- -

Notas

- -

Para cambiar el tamaño de la ventana, ver {{domxref("window.resizeBy()")}} y {{domxref("window.resizeTo()")}}.

- -

Para obtener el ancho exterior de la ventana, i.e. el ancho de la pagina desplegada, ver {{domxref("window.innerWidth")}}.

- -

Compatibilidad del navegador

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

Specificaciones

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{ SpecName('CSSOM View', '#dom-window-outerwidth', 'Window.outerWidth') }}{{ Spec2('CSSOM View') }}Initial definition.
- -

Ver también

- -
    -
  • {{domxref("window.outerHeight")}}, {{domxref("window.innerHeight")}}, {{domxref("window.innerWidth")}}
  • -
  • {{domxref("window.resizeBy()")}}, {{domxref("window.resizeTo()")}}
  • -
diff --git a/files/es/web/api/window/outerwidth/index.md b/files/es/web/api/window/outerwidth/index.md new file mode 100644 index 00000000000000..59cc7410b1be32 --- /dev/null +++ b/files/es/web/api/window/outerwidth/index.md @@ -0,0 +1,41 @@ +--- +title: Window.outerWidth +slug: Web/API/Window/outerWidth +translation_of: Web/API/Window/outerWidth +--- +{{APIRef}} + +## Sumario + +`Window.outerWidth` obtiene el ancho exterior del navegador. Representa el ancho total de la ventana incluyendo las barras laterales (si es expandida), interfaz grafíca y los de elementos para redimencionado de bordes. + +Esta propiedad es de sólo lectura; no tiene valores por default. + +## Sintaxis + +```js +outWindowWidth = window.outerWidth; +``` + +Lo que retorna `outWindowWidth` es el ancho exterior del navegador. + +## Notas + +Para cambiar el tamaño de la ventana, ver {{domxref("window.resizeBy()")}} y {{domxref("window.resizeTo()")}}. + +Para obtener el ancho exterior de la ventana, i.e. el ancho de la pagina desplegada, ver {{domxref("window.innerWidth")}}. + +## Compatibilidad del navegador + +{{Compat("api.Window.outerWidth")}} + +## Specificaciones + +| Specification | Status | Comment | +| ---------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------- | +| {{ SpecName('CSSOM View', '#dom-window-outerwidth', 'Window.outerWidth') }} | {{ Spec2('CSSOM View') }} | Initial definition. | + +## Ver también + +- {{domxref("window.outerHeight")}}, {{domxref("window.innerHeight")}}, {{domxref("window.innerWidth")}} +- {{domxref("window.resizeBy()")}}, {{domxref("window.resizeTo()")}} diff --git a/files/es/web/api/window/popstate_event/index.html b/files/es/web/api/window/popstate_event/index.html deleted file mode 100644 index bdaf4ec8a6a279..00000000000000 --- a/files/es/web/api/window/popstate_event/index.html +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: WindowEventHandlers.onpopstate -slug: Web/API/Window/popstate_event -translation_of: Web/API/WindowEventHandlers/onpopstate -original_slug: Web/API/WindowEventHandlers/onpopstate ---- -
{{APIRef}}
- -

La propiedad onpopstate del mixin {{domxref("WindowEventHandlers")}} es el {{event("Event_handlers", "event handler")}} para procesar eventos popstate de la ventana.

- -

Se envía un evento popstate a la ventana cada vez que la entrada activa de la historia cambia entre otra otras dos entradas del mismo documento. Si la entrada de la historia fue creada al llamar a history.pushState(), o fue afectada por una llamada a history.replaceState(), la propiedad state del evento popstate contendrá una copia del objeto de estado de la entrada de la hisotria.

- -
-

Nota: Llamar a history.pushState() o a history.replaceState() no dispararán un evento popstate. El evento popstate solamente se dispará realizando una acción de navegador, tal como pulsar el botón volver (o llamando a history.back() en JavaScript), mientras se navega entre dos entradas de la historia de un mismo documento.

-
- -

Sintaxis

- -
window.onpopstate = funcRef;
-
- -
    -
  • funcRef es una función manejadora (handler).
  • -
- -

El evento popstate

- -

Por ejemplo, la página en http://example.com/example.html ejecutando el código siguiente, generará alertas como se indica.:

- -
window.onpopstate = function(event) {
-  alert("location: " + document.location + ", state: " + JSON.stringify(event.state));
-};
-
-history.pushState({page: 1}, "title 1", "?page=1");
-history.pushState({page: 2}, "title 2", "?page=2");
-history.replaceState({page: 3}, "title 3", "?page=3");
-history.back(); // alerts "location: http://example.com/example.html?page=1, state: {"page":1}"
-history.back(); // alerts "location: http://example.com/example.html, state: null
-history.go(2);  // alerts "location: http://example.com/example.html?page=3, state: {"page":3}
-
- -

Tenga en cuenta que, a pesar de que la entrada original (para http://example.com/example.html) no tiene un objeto de estado asociado, el evento popstate se dispara igualemente cuando se activa la entrada después de la segunda llamada a history.back().

- -

Especificaciones

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'webappapis.html#handler-window-onpopstate', 'onpopstate')}}{{Spec2('HTML WHATWG')}}
- -

Compatibilidad con navegadores

- - - -

{{Compat("api.WindowEventHandlers.onpopstate")}}

- -

Vea también

- - diff --git a/files/es/web/api/window/popstate_event/index.md b/files/es/web/api/window/popstate_event/index.md new file mode 100644 index 00000000000000..5bb5a017a28612 --- /dev/null +++ b/files/es/web/api/window/popstate_event/index.md @@ -0,0 +1,56 @@ +--- +title: WindowEventHandlers.onpopstate +slug: Web/API/Window/popstate_event +translation_of: Web/API/WindowEventHandlers/onpopstate +original_slug: Web/API/WindowEventHandlers/onpopstate +--- +{{APIRef}} + +La propiedad **`onpopstate`** del [mixin](/es/docs/Glossary/Mixin) {{domxref("WindowEventHandlers")}} es el {{event("Event_handlers", "event handler")}} para procesar eventos [`popstate`](/en-US/docs/Web/API/Window/popstate_event) de la ventana. + +Se envía un evento `popstate` a la ventana cada vez que la entrada activa de la historia cambia entre otra otras dos entradas del mismo documento. Si la entrada de la historia fue creada al llamar a `history.pushState()`, o fue afectada por una llamada a `history.replaceState()`, la propiedad `state` del evento `popstate` contendrá una copia del objeto de estado de la entrada de la hisotria. + +> **Nota:** Llamar a `history.pushState()` o a `history.replaceState()` no dispararán un evento `popstate`. El evento `popstate` solamente se dispará realizando una acción de navegador, tal como pulsar el botón volver (o llamando a `history.back()` en JavaScript), mientras se navega entre dos entradas de la historia de un mismo documento. + +## Sintaxis + +```js +window.onpopstate = funcRef; +``` + +- `funcRef` es una función manejadora (handler). + +## El evento popstate + +Por ejemplo, la página en `http://example.com/example.html` ejecutando el código siguiente, generará alertas como se indica.: + +```js +window.onpopstate = function(event) { + alert("location: " + document.location + ", state: " + JSON.stringify(event.state)); +}; + +history.pushState({page: 1}, "title 1", "?page=1"); +history.pushState({page: 2}, "title 2", "?page=2"); +history.replaceState({page: 3}, "title 3", "?page=3"); +history.back(); // alerts "location: http://example.com/example.html?page=1, state: {"page":1}" +history.back(); // alerts "location: http://example.com/example.html, state: null +history.go(2); // alerts "location: http://example.com/example.html?page=3, state: {"page":3} +``` + +Tenga en cuenta que, a pesar de que la entrada original (para `http://example.com/example.html`) no tiene un objeto de estado asociado, el evento `popstate` se dispara igualemente cuando se activa la entrada después de la segunda llamada a `history.back()`. + +## Especificaciones + +| Specification | Status | Comment | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------- | +| {{SpecName('HTML WHATWG', 'webappapis.html#handler-window-onpopstate', 'onpopstate')}} | {{Spec2('HTML WHATWG')}} | | + +## Compatibilidad con navegadores + +{{Compat("api.WindowEventHandlers.onpopstate")}} + +## Vea también + +- {{domxref("window.history")}} +- [Manipulando la historia del navegador](/es/docs/Web/Guide/DOM/Manipulating_the_browser_history) +- [Ejemplo de navegación con Ajax](/es/docs/Web/Guide/DOM/Manipulating_the_browser_history/Example) diff --git a/files/es/web/api/window/print/index.html b/files/es/web/api/window/print/index.html deleted file mode 100644 index ae85210666ca7d..00000000000000 --- a/files/es/web/api/window/print/index.html +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: Window.print() -slug: Web/API/Window/print -tags: - - API - - Compatibilidad - - Compatibilidad en móviles - - DOM - - Referencia - - Window - - metodo -translation_of: Web/API/Window/print ---- -

{{ ApiRef() }}

- -

Abre el diálogo para imprimir el documento actual.

- -

En la mayoría de navegadores, este método bloquea mientras el díalogo de impresión esté abierto, sin embargo, en algunas versiones recientes de Safari podría retornar de inmediato.

- -

Resumen

- -

Abre el Diálogo de Impresión para imprimir el documento actual.

- -

Sintaxis

- -
window.print()
-
- -

Notas

- -

Empezando con Chrome {{CompatChrome(46.0)}} este método esta bloqueado dentro de un {{htmlelement("iframe")}} a menos que el atributo del contenedor tenga el valor allow-modal.

- -

Especificación

- - - - - - - - - - - - - - -
EspecificaciónEstatusComentario
{{SpecName('HTML5 Web application', '#dom-print', 'print()')}}{{Spec2('HTML5 Web application')}}Initial definition.
- -

Ver también

- -
    -
  • Impresión
  • -
  • {{ domxref("window.onbeforeprint") }}
  • -
  • {{ domxref("window.onafterprint") }}
  • -
diff --git a/files/es/web/api/window/print/index.md b/files/es/web/api/window/print/index.md new file mode 100644 index 00000000000000..9ef4b2a3cf845f --- /dev/null +++ b/files/es/web/api/window/print/index.md @@ -0,0 +1,44 @@ +--- +title: Window.print() +slug: Web/API/Window/print +tags: + - API + - Compatibilidad + - Compatibilidad en móviles + - DOM + - Referencia + - Window + - metodo +translation_of: Web/API/Window/print +--- +{{ ApiRef() }} + +Abre el diálogo para imprimir el documento actual. + +En la mayoría de navegadores, este método bloquea mientras el díalogo de impresión esté abierto, sin embargo, en algunas versiones recientes de Safari podría retornar de inmediato. + +## Resumen + +Abre el _Diálogo de Impresión_ para imprimir el documento actual. + +## Sintaxis + +```js +window.print() +``` + +## Notas + +Empezando con Chrome {{CompatChrome(46.0)}} este método esta bloqueado dentro de un {{htmlelement("iframe")}} a menos que el atributo del contenedor tenga el valor `allow-modal`. + +## Especificación + +| Especificación | Estatus | Comentario | +| ------------------------------------------------------------------------------------ | -------------------------------------------- | ------------------- | +| {{SpecName('HTML5 Web application', '#dom-print', 'print()')}} | {{Spec2('HTML5 Web application')}} | Initial definition. | + +## Ver también + +- [Impresión](/en/Printing "en/Printing") +- {{ domxref("window.onbeforeprint") }} +- {{ domxref("window.onafterprint") }} diff --git a/files/es/web/api/window/prompt/index.html b/files/es/web/api/window/prompt/index.html deleted file mode 100644 index 7560c8d5ea60aa..00000000000000 --- a/files/es/web/api/window/prompt/index.html +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: Window.prompt() -slug: Web/API/Window/prompt -tags: - - Referencia - - metodo -translation_of: Web/API/Window/prompt ---- -
{{ApiRef("Window")}}
- -

El método Window.prompt() muestra un diálogo con mensaje opcional, que solicita al usuario que introduzca un texto.

- -

Sintaxis

- -
result = window.prompt(message, default);
-
- -
    -
  • result es una cadena de texto que contiene el valor introducido por el usuario, o null.
  • -
  • message es una cadena de texto que se mostrará al usuario. Este parámetro es opcional y puede ser omitido si no se necesita mostrar nada en la ventana.
  • -
  • default es una cadena de texto que contiene el valor predeterminado para el texto de entrada. Es un parámetro opcional. Nótese que en Internet Explorer 7 y 8, si no se provee un valor para este parámetro, el valor predeterminado es "undefined".
  • -
- -

Ejemplo

- -
var sign = prompt("What's your sign?");
-
-if (sign.toLowerCase() == "scorpio") {
-  alert("Wow! I'm a Scorpio too!");
-}
-
-// there are many ways to use the prompt feature
-var sign = window.prompt(); // open the blank prompt window
-var sign = prompt();       //  open the blank prompt window
-var sign = window.prompt('Are you feeling lucky'); // open the window with Text "Are you feeling lucky"
-var sign = window.prompt('Are you feeling lucky', 'sure'); // open the window with Text "Are you feeling lucky" and default value "sure"
- -

Cuando el usuario hace clic en el botón OK, el valor introducido en el campo de texto es devuelto por el método. Si el usuario da clic al botón OK sin introducir algun texto, se devuelve una cadena vacía. Si el usuario presiona el botón Cancel, la función devuelve null.

- -

El ejemplo anterior muestra el siguiente cuadro de diálogo (en Chrome en OS X):

- -

prompt() dialog in Chrome on OS X

- -

Notas

- -

Un diálogo prompt contiene un cuadro de texto de una línea, un botón Cancel (Cancelar) un botón OK (Aceptar), y devuelve el texto (posiblemente vacío) que el usuario introdujo en el cuadro de texto.

- -

The following text is shared between this article, DOM:window.confirm and DOM:window.alertLos cuadros de diálogo son ventanas modales; previenen que el usuario acceda al resto de la interfaz del programa hasta que el cuadro de diálogo es cerrado. Por esta razón, no se debe abusar de cualquier función que crea un cuadro de diálogo (o ventana modal).

- -

Nótese que el resultado es una cadena de texto. Esto significa que a veces se deberá hacer una conversión al valor introducido por el usuario. Por ejemplo, si la respuesta debe ser un valor numérico, se debe hacer la conversión del valor a tipo Number. var aNumber = Number(window.prompt("Type a number", ""));

- -

Usuarios de Mozilla Chrome (p.ej. extensiones de Firefox) deben usar preferentemente métodos de nsIPromptService.

- -

A partir de Chrome {{CompatChrome(46.0)}} este método está bloqueado para los elementos {{htmlelement("iframe")}}, , a menos que su atributo sandbox tenga el valor allow-modal.

- -

En Safari, si el usuario presiona el botón Cancel, la función devuelve una cadena vacía. Por lo tanto, no se puede diferenciar si canceló o si mandó una cadena de texto vacía como valor del cuadro de texto.

- -

Esta función no tiene efecto en la versión Modern UI/Metro de Internet Explorer para Windows 8. No se muestra un diálogo al usuario, y siempre devuelve undefined. No está claro si esto es un bug o un comportamiento previsto. Las versiones de escritorio de IE sí implementan esta función

- -

Especificación

- - - - - - - - - - - - - - -
EspecificaciónEstadoComentarios
{{SpecName('HTML5 Web application', '#dom-prompt', 'prompt()')}}{{Spec2('HTML5 Web application')}}Definición inicial
- -

Véase también

- -
    -
  • {{domxref("window.alert", "alert")}}
  • -
  • {{domxref("window.confirm", "confirm")}}
  • -
diff --git a/files/es/web/api/window/prompt/index.md b/files/es/web/api/window/prompt/index.md new file mode 100644 index 00000000000000..9b3c044a342e00 --- /dev/null +++ b/files/es/web/api/window/prompt/index.md @@ -0,0 +1,70 @@ +--- +title: Window.prompt() +slug: Web/API/Window/prompt +tags: + - Referencia + - metodo +translation_of: Web/API/Window/prompt +--- +{{ApiRef("Window")}} + +El método `Window.prompt()` muestra un diálogo con mensaje opcional, que solicita al usuario que introduzca un texto. + +## Sintaxis + +```js +result = window.prompt(message, default); +``` + +- `result` es una cadena de texto que contiene el valor introducido por el usuario, o `null`. +- `message` es una cadena de texto que se mostrará al usuario. Este parámetro es opcional y puede ser omitido si no se necesita mostrar nada en la ventana. +- `default` es una cadena de texto que contiene el valor predeterminado para el texto de entrada. Es un parámetro opcional. Nótese que en Internet Explorer 7 y 8, si no se provee un valor para este parámetro, el valor predeterminado es `"undefined"`. + +## Ejemplo + +```js +var sign = prompt("What's your sign?"); + +if (sign.toLowerCase() == "scorpio") { + alert("Wow! I'm a Scorpio too!"); +} + +// there are many ways to use the prompt feature +var sign = window.prompt(); // open the blank prompt window +var sign = prompt(); // open the blank prompt window +var sign = window.prompt('Are you feeling lucky'); // open the window with Text "Are you feeling lucky" +var sign = window.prompt('Are you feeling lucky', 'sure'); // open the window with Text "Are you feeling lucky" and default value "sure" +``` + +Cuando el usuario hace clic en el botón OK, el valor introducido en el campo de texto es devuelto por el método. Si el usuario da clic al botón OK sin introducir algun texto, se devuelve una cadena vacía. Si el usuario presiona el botón Cancel, la función devuelve `null`. + +El ejemplo anterior muestra el siguiente cuadro de diálogo (en Chrome en OS X): + +[![prompt() dialog in Chrome on OS X](https://mdn.mozillademos.org/files/11303/prompt.png)](https://mdn.mozillademos.org/files/11303/prompt.png) + +## Notas + +Un diálogo prompt contiene un cuadro de texto de una línea, un botón Cancel (Cancelar) un botón OK (Aceptar), y devuelve el texto (posiblemente vacío) que el usuario introdujo en el cuadro de texto. + +The following text is shared between this article, DOM:window\.confirm and DOM:window\.alertLos cuadros de diálogo son ventanas modales; previenen que el usuario acceda al resto de la interfaz del programa hasta que el cuadro de diálogo es cerrado. Por esta razón, no se debe abusar de cualquier función que crea un cuadro de diálogo (o ventana modal). + +Nótese que el resultado es una cadena de texto. Esto significa que a veces se deberá hacer una conversión al valor introducido por el usuario. Por ejemplo, si la respuesta debe ser un valor numérico, se debe hacer la conversión del valor a tipo Number. var aNumber = Number(window\.prompt("Type a number", "")); + +Usuarios de [Mozilla Chrome](/en-US/Chrome "Chrome") (p.ej. extensiones de Firefox) deben usar preferentemente métodos de `nsIPromptService`. + +A partir de Chrome {{CompatChrome(46.0)}} este método está bloqueado para los elementos {{htmlelement("iframe")}}, , a menos que su atributo [sandbox](/es/docs/Web/HTML/Elemento/iframe#attr-sandbox) tenga el valor `allow-modal`. + +En Safari, si el usuario presiona el botón Cancel, la función devuelve una cadena vacía. Por lo tanto, no se puede diferenciar si canceló o si mandó una cadena de texto vacía como valor del cuadro de texto. + +Esta función no tiene efecto en la versión Modern UI/Metro de Internet Explorer para Windows 8. No se muestra un diálogo al usuario, y siempre devuelve `undefined`. No está claro si esto es un bug o un comportamiento previsto. Las versiones de escritorio de IE sí implementan esta función + +## Especificación + +| Especificación | Estado | Comentarios | +| ------------------------------------------------------------------------------------ | -------------------------------------------- | ------------------ | +| {{SpecName('HTML5 Web application', '#dom-prompt', 'prompt()')}} | {{Spec2('HTML5 Web application')}} | Definición inicial | + +## Véase también + +- {{domxref("window.alert", "alert")}} +- {{domxref("window.confirm", "confirm")}} diff --git a/files/es/web/api/window/requestanimationframe/index.html b/files/es/web/api/window/requestanimationframe/index.html deleted file mode 100644 index f33680555e6d49..00000000000000 --- a/files/es/web/api/window/requestanimationframe/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: Window.requestAnimationFrame() -slug: Web/API/Window/requestAnimationFrame -translation_of: Web/API/window/requestAnimationFrame ---- -
{{APIRef}}
- -
El método window.requestAnimationFrame informa al navegador que quieres realizar una animación y solicita que el navegador programe el repintado de la ventana para el próximo ciclo de animación. El método acepta como argumento una función a la que llamar antes de efectuar el repintado.
- - - -
Nota: Si no quieres que tu animación se detenga, debes asegurarte de llamar a su vez a requestAnimationFrame() desde tu callback.
- -

Debes llamar a este método cuando estés preparado para actualizar tu animación en la pantalla para pedir que se programe el repintado. Ésto puede suceder hasta 60 veces por segundo en pestañas en primer plano, pero se puede ver reducido a velocidades inferiores en pestañas en segundo plano.

- -

El método indicado como callback recibe un único argumento que indica el tiempo en el que está programado que se ejecute el ciclo de animación.

- -

Sintaxis

- -
requestID = window.mozRequestAnimationFrame(callback);   // Firefox
-window.msRequestAnimationFrame(callback);                // IE 10 PP2+
-window.webkitRequestAnimationFrame(callback[, element]); // Chrome/Webkit
-
- -

Parámetros

- -
-
callback
-
Parámetro que especifica la función a la cual llamar llegado el momento de actualizar tu animación para el próximo repintado.
-
- -

Valor devuelto

- -

Un valor entero long, es un entero de tipo long que identifica de manera exclusiva la entrada en la lista de callbacks. Es siempre un distinto de cero, pero no debes realizar ninguna otra suposición acerca de su valor. Puedes pasar este valor a {{ domxref("window.cancelAnimationFrame()") }} para cancelar la petición de actualización del callback.

- -

Ejemplo

- -
(function() {
-  var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
-  window.requestAnimationFrame = requestAnimationFrame;
-})();
-
-var start = null;
-var element = document.getElementById('SomeElementYouWantToAnimate');
-
-function step(timestamp) {
-  if (!start) start = timestamp;
-  var progress = timestamp - start;
-  element.style.transform = 'translateX(' + Math.min(progress / 10, 200) + 'px)';
-  if (progress < 2000) {
-    window.requestAnimationFrame(step);
-  }
-}
-
-window.requestAnimationFrame(step);
- -

Compatibilidad entre Navegadores

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

Especificaciones

- -

{{ spec("http://www.w3.org/TR/animation-timing/#requestAnimationFrame", "Timing control for script-based animations: requestAnimationFrame", "WD") }}

- -

Véase también

- - diff --git a/files/es/web/api/window/requestanimationframe/index.md b/files/es/web/api/window/requestanimationframe/index.md new file mode 100644 index 00000000000000..d328747ae88dcc --- /dev/null +++ b/files/es/web/api/window/requestanimationframe/index.md @@ -0,0 +1,69 @@ +--- +title: Window.requestAnimationFrame() +slug: Web/API/Window/requestAnimationFrame +translation_of: Web/API/window/requestAnimationFrame +--- +{{APIRef}}El método **`window.requestAnimationFrame`** informa al navegador que quieres realizar una animación y solicita que el navegador programe el repintado de la ventana para el próximo ciclo de animación. El método acepta como argumento una función a la que llamar antes de efectuar el repintado. + +> **Nota:** Si no quieres que tu animación se detenga, debes asegurarte de llamar a su vez a `requestAnimationFrame() `desde tu callback. + +Debes llamar a este método cuando estés preparado para actualizar tu animación en la pantalla para pedir que se programe el repintado. Ésto puede suceder hasta 60 veces por segundo en pestañas en primer plano, pero se puede ver reducido a velocidades inferiores en pestañas en segundo plano. + +El método indicado como callback recibe un único argumento que indica el tiempo en el que está programado que se ejecute el ciclo de animación. + +## Sintaxis + +```js +requestID = window.mozRequestAnimationFrame(callback); // Firefox +window.msRequestAnimationFrame(callback); // IE 10 PP2+ +window.webkitRequestAnimationFrame(callback[, element]); // Chrome/Webkit +``` + +### Parámetros + +- `callback` + - : Parámetro que especifica la función a la cual llamar llegado el momento de actualizar tu animación para el próximo repintado. + +### Valor devuelto + +Un valor entero `long`, es un entero de tipo long que identifica de manera exclusiva la entrada en la lista de callbacks. Es siempre un distinto de cero, pero no debes realizar ninguna otra suposición acerca de su valor. Puedes pasar este valor a {{ domxref("window.cancelAnimationFrame()") }} para cancelar la petición de actualización del callback. + +## Ejemplo + +```js +(function() { + var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; + window.requestAnimationFrame = requestAnimationFrame; +})(); + +var start = null; +var element = document.getElementById('SomeElementYouWantToAnimate'); + +function step(timestamp) { + if (!start) start = timestamp; + var progress = timestamp - start; + element.style.transform = 'translateX(' + Math.min(progress / 10, 200) + 'px)'; + if (progress < 2000) { + window.requestAnimationFrame(step); + } +} + +window.requestAnimationFrame(step); +``` + +## Compatibilidad entre Navegadores + +{{Compat("api.Window.requestAnimationFrame")}} + +## Especificaciones + +{{ spec("http://www.w3.org/TR/animation-timing/#requestAnimationFrame", "Timing control for script-based animations: requestAnimationFrame", "WD") }} + +## Véase también + +- {{ domxref("window.mozAnimationStartTime") }} +- {{ domxref("window.cancelAnimationFrame()") }} +- [mozRequestAnimationFrame](http://weblogs.mozillazine.org/roc/archives/2010/08/mozrequestanima.html) - Blog post +- [requestAnimationFrame for smart animating](http://paulirish.com/2011/requestanimationframe-for-smart-animating/) - Blog post +- [Animating with javascript: from setInterval to requestAnimationFrame](http://hacks.mozilla.org/2011/08/animating-with-javascript-from-setinterval-to-requestanimationframe/) - Blog post +- [Using PC Hardware more efficiently in HTML5: New Web Performance APIs, Part 1](http://blogs.msdn.com/b/ie/archive/2011/07/05/using-pc-hardware-more-efficiently-in-html5-new-web-performance-apis-part-1.aspx) - Blog post diff --git a/files/es/web/api/window/requestidlecallback/index.html b/files/es/web/api/window/requestidlecallback/index.html deleted file mode 100644 index 9713d7090e2f2e..00000000000000 --- a/files/es/web/api/window/requestidlecallback/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: requestIdleCallback -slug: Web/API/Window/requestIdleCallback -translation_of: Web/API/Window/requestIdleCallback ---- -
{{APIRef("HTML DOM")}}{{SeeCompatTable}}
- -

El método window.requestIdleCallback() encola la función que será ejecutada en periodos de inactividad del navegador permitiendo a los desarrolladores ejecutar en segundo plano tareas de baja prioridad del bucle de eventos, sin perjudicar la latencia de eventos principales como animaciones o respuestas a entradas. La funciones son ejecutadas normalmente en orden FIFO (primero en entrar primero en salir) salvo que se alcance el timeout definido de la función antes de que el navegador la ejecute.

- -

Sintaxis

- -
var handle = window.requestIdleCallback(callback[, options])
- -

Valor devuelto

- -

Un entero largo sin signo (unsigned long integer) que puede utilizarse para cancelar el callback a través del método {{domxref("Window.cancelIdleCallback()")}}.

- -

Parámetros

- -
-
callback
-
La referencia a la función que debe ser ejecutada en un futuro inmediato. La función callback toma un argumento con las siguientes propiedades: -
    -
  • timeRemaining: Referencia a un metodo que devuelve un {{domxref("DOMHighResTimeStamp")}}.
  • -
  • didTimeout: Booleano que se devuelve a false si el callback fue invocado por el navegador durante su inactividad, y true en otro caso (por ejemplo, si se definió timeout y expiró antes de que hubiera suficiente tiempo de inactividad).
  • -
-
-
options {{optional_inline}}
-
-

Contiene parametros opcionales de configuración. Contiene la siguiente propiedad:

- -
    -
  • timeout: Plazo para que el navegador ejecute la función callback. Valor en milisegundos.
  • -
-
-
- - - -

Ejemplos

- -

Ver ejemplo en el artículo Planificación Cooperativa de la API de Tareas en segundo plano.

- -

Especificaciones

- - - - - - - - - - - - - - - - -
-

Especificación

-
EstadoComentarios
{{SpecName('Background Tasks')}}{{Spec2('Background Tasks')}}Definición Inicial.
- -

Compatibilidad en Navegadores

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

Vease también

- -
    -
  • {{domxref("window.cancelIdleCallback()")}}
  • -
  • {{domxref("IdleDeadline")}}
  • -
  • {{domxref("window.setTimeout()")}}
  • -
  • {{domxref("window.setInterval()")}}
  • -
  • {{domxref("window.requestAnimationFrame")}}
  • -
diff --git a/files/es/web/api/window/requestidlecallback/index.md b/files/es/web/api/window/requestidlecallback/index.md new file mode 100644 index 00000000000000..4a879bab21edd2 --- /dev/null +++ b/files/es/web/api/window/requestidlecallback/index.md @@ -0,0 +1,55 @@ +--- +title: requestIdleCallback +slug: Web/API/Window/requestIdleCallback +translation_of: Web/API/Window/requestIdleCallback +--- +{{APIRef("HTML DOM")}}{{SeeCompatTable}} + +El método **`w`\*\***`indow.requestIdleCallback()`\*\* encola la función que será ejecutada en periodos de inactividad del navegador permitiendo a los desarrolladores ejecutar en segundo plano tareas de baja prioridad del bucle de eventos, sin perjudicar la latencia de eventos principales como animaciones o respuestas a entradas. La funciones son ejecutadas normalmente en orden FIFO (primero en entrar primero en salir) salvo que se alcance el timeout definido de la función antes de que el navegador la ejecute. + +## Sintaxis + +```js +var handle = window.requestIdleCallback(callback[, options]) +``` + +### Valor devuelto + +Un entero largo sin signo (unsigned long integer) que puede utilizarse para cancelar el callback a través del método {{domxref("Window.cancelIdleCallback()")}}. + +### Parámetros + +- `callback` + + - : La referencia a la función que debe ser ejecutada en un futuro inmediato. La función callback toma un argumento con las siguientes propiedades: + + - `timeRemaining`: Referencia a un metodo que devuelve un {{domxref("DOMHighResTimeStamp")}}. + - `didTimeout`: Booleano que se devuelve a false si el callback fue invocado por el navegador durante su inactividad, y true en otro caso (por ejemplo, si se definió timeout y expiró antes de que hubiera suficiente tiempo de inactividad). + +- `options` {{optional_inline}} + + - : Contiene parametros opcionales de configuración. Contiene la siguiente propiedad: + + - `timeout`: Plazo para que el navegador ejecute la función callback. Valor en milisegundos. + +## Ejemplos + +Ver [ejemplo](/es/docs/Web/API/Background_Tasks_API#Example) en el artículo [Planificación Cooperativa de la API de Tareas en segundo plano](/es/docs/Web/API/Background_Tasks_API). + +## Especificaciones + +| Especificación | Estado | Comentarios | +| -------------------------------------------- | ---------------------------------------- | ------------------- | +| {{SpecName('Background Tasks')}} | {{Spec2('Background Tasks')}} | Definición Inicial. | + +## Compatibilidad en Navegadores + +{{Compat("api.Window.requestIdleCallback")}} + +## Vease también + +- {{domxref("window.cancelIdleCallback()")}} +- {{domxref("IdleDeadline")}} +- {{domxref("window.setTimeout()")}} +- {{domxref("window.setInterval()")}} +- {{domxref("window.requestAnimationFrame")}} diff --git a/files/es/web/api/window/resize_event/index.html b/files/es/web/api/window/resize_event/index.html deleted file mode 100644 index 82749c3888f495..00000000000000 --- a/files/es/web/api/window/resize_event/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: GlobalEventHandlers.onresize -slug: Web/API/Window/resize_event -tags: - - API - - DOM - - Propiedad -translation_of: Web/API/GlobalEventHandlers/onresize -original_slug: Web/API/GlobalEventHandlers/onresize ---- -

{{ ApiRef() }}

- -

La propiedad GlobalEventHandlers.onresize contiene un {{event("Event_handlers", "event handler")}} desencadenado cuando un evento {{event("resize")}} es recibido.

- -

Sintaxis

- -
window.onresize = funcRef;
-
- -

Parametros

- -
    -
  • funcRef es una referencia a una función.
  • -
- -

Ejemplo

- -
window.onresize = doFunc;
-
- -
<html>
-<head>
-
-<title>onresize test</title>
-
-<script type="text/javascript">
-
-window.onresize = resize;
-
-function resize()
-{
- alert("resize event detected!");
-}
-</script>
-</head>
-
-<body>
-<p>Resize the browser window to fire the resize event.</p>
-</body>
-</html>
-
- -

Notas

- -

El evento resize es activado después de que la ventana ha sido redimensionada.

- -

Especificación

- - - - - - - - - - - - - - -
EspecificaciónStatusComentario
{{SpecName('HTML WHATWG','webappapis.html#handler-onresize','onresize')}}{{Spec2('HTML WHATWG')}}
diff --git a/files/es/web/api/window/resize_event/index.md b/files/es/web/api/window/resize_event/index.md new file mode 100644 index 00000000000000..ed6e2d754e37de --- /dev/null +++ b/files/es/web/api/window/resize_event/index.md @@ -0,0 +1,62 @@ +--- +title: GlobalEventHandlers.onresize +slug: Web/API/Window/resize_event +tags: + - API + - DOM + - Propiedad +translation_of: Web/API/GlobalEventHandlers/onresize +original_slug: Web/API/GlobalEventHandlers/onresize +--- +{{ ApiRef() }} + +La propiedad **GlobalEventHandlers.onresize** contiene un {{event("Event_handlers", "event handler")}} desencadenado cuando un evento {{event("resize")}} es recibido. + +## Sintaxis + +```js +window.onresize = funcRef; +``` + +### Parametros + +- `funcRef` es una referencia a una función. + +## Ejemplo + +```js +window.onresize = doFunc; +``` + +```html + + + +onresize test + + + + + +

Resize the browser window to fire the resize event.

+ + +``` + +## Notas + +El evento **resize** es activado después de que la ventana ha sido redimensionada. + +## Especificación + +| Especificación | Status | Comentario | +| ------------------------------------------------------------------------------------------------ | -------------------------------- | ---------- | +| {{SpecName('HTML WHATWG','webappapis.html#handler-onresize','onresize')}} | {{Spec2('HTML WHATWG')}} | | diff --git a/files/es/web/api/window/scroll/index.html b/files/es/web/api/window/scroll/index.html deleted file mode 100644 index 73e6ce111c6154..00000000000000 --- a/files/es/web/api/window/scroll/index.html +++ /dev/null @@ -1,84 +0,0 @@ ---- -title: Window.scroll() -slug: Web/API/Window/scroll -tags: - - API - - CSSOM View - - Referencia - - metodo -translation_of: Web/API/Window/scroll ---- -
{{APIRef}}
- -

El método Window.scroll() desplaza la ventana a un lugar particular en el documento.

- -

Sintaxis

- -
window.scroll(x-coord, y-coord)
-window.scroll(options)
-
- -

Parámetros

- -
    -
  • x-coord es la coordenada sobre el eje horizontal del documento del pixel que querés que se muestre en la parte superior izquierda.
  • -
  • y-coord es la coordenada sobre el eje vertical del documento del pixel que querés que se muestre en la parte superior izquierda.
  • -
- -

- o -

- -
    -
  • options es un diccionario {{domxref("ScrollToOptions")}}.
  • -
- -

Ejemplo

- -
<!-- poner el pixel 100º verticalmente en el tope superior de la ventana -->
-
-<button onClick="scroll(0, 100);">Clic para desplazarse hacia abajo 100 pixeles</button>
-
- -

Utilizando options:

- -
window.scroll({
-  top: 100,
-  left: 100,
-  behavior: 'smooth'
-});
- -

Notas

- -

{{domxref("Window.scrollTo()")}} es efectivamente idéntico a este método. Para desplazamiento relativo, mira {{domxref("Window.scrollBy()")}}, {{domxref("Window.scrollByLines()")}} y {{domxref("Window.scrollByPages()")}}.

- -

Para desplazarse sobre elementos, mira {{domxref("Element.scrollTop")}} y {{domxref("Element.scrollLeft")}}.

- -

Especificación

- - - - - - - - - - - - - - - - -
EspecificaciónEstadoComentario
{{ SpecName('CSSOM View', '#dom-window-scroll', 'window.scroll()') }}{{ Spec2('CSSOM View') }}Definición inicial.
- -

Compatibilidad en navegadores

- -

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

- -

Ver también

- -
    -
  • {{domxref("Window.scrollByLines()")}}
  • -
  • {{domxref("Window.scrollByPages()")}}
  • -
  • {{domxref("Element.scrollIntoView()")}}
  • -
diff --git a/files/es/web/api/window/scroll/index.md b/files/es/web/api/window/scroll/index.md new file mode 100644 index 00000000000000..6aefa71c101622 --- /dev/null +++ b/files/es/web/api/window/scroll/index.md @@ -0,0 +1,69 @@ +--- +title: Window.scroll() +slug: Web/API/Window/scroll +tags: + - API + - CSSOM View + - Referencia + - metodo +translation_of: Web/API/Window/scroll +--- +{{APIRef}} + +El método **`Window.scroll()`** desplaza la ventana a un lugar particular en el documento. + +## Sintaxis + +```js +window.scroll(x-coord, y-coord) +window.scroll(options) +``` + +### Parámetros + +- `x-coord` es la coordenada sobre el eje horizontal del documento del pixel que querés que se muestre en la parte superior izquierda. +- `y-coord` es la coordenada sobre el eje vertical del documento del pixel que querés que se muestre en la parte superior izquierda. + +\- o - + +- `options` es un diccionario {{domxref("ScrollToOptions")}}. + +## Ejemplo + +```html + + + +``` + +Utilizando `options`: + +```js +window.scroll({ + top: 100, + left: 100, + behavior: 'smooth' +}); +``` + +## Notas + +{{domxref("Window.scrollTo()")}} es efectivamente idéntico a este método. Para desplazamiento relativo, mira {{domxref("Window.scrollBy()")}}, {{domxref("Window.scrollByLines()")}} y {{domxref("Window.scrollByPages()")}}. + +Para desplazarse sobre elementos, mira {{domxref("Element.scrollTop")}} y {{domxref("Element.scrollLeft")}}. + +## Especificación + +| Especificación | Estado | Comentario | +| -------------------------------------------------------------------------------------------- | -------------------------------- | ------------------- | +| {{ SpecName('CSSOM View', '#dom-window-scroll', 'window.scroll()') }} | {{ Spec2('CSSOM View') }} | Definición inicial. | + +## Compatibilidad en navegadores + +{{Compat("api.Window.scroll")}} + +## Ver también + +- {{domxref("Window.scrollByLines()")}} +- {{domxref("Window.scrollByPages()")}} +- {{domxref("Element.scrollIntoView()")}} diff --git a/files/es/web/api/window/scrollby/index.html b/files/es/web/api/window/scrollby/index.html deleted file mode 100644 index b39e4c8c66590a..00000000000000 --- a/files/es/web/api/window/scrollby/index.html +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: Window.scrollBy() -slug: Web/API/Window/scrollBy -tags: - - API - - CSSOM View - - Método(2) - - NeedsCompatTable - - NeedsSpecTable - - Referencia -translation_of: Web/API/Window/scrollBy ---- -

{{ APIRef() }}

- -

Resumen

- -

Desplaza el documento el número de pixels proporcionados.

- -

Sintaxis

- -
window.scrollBy(X, Y);
-window.scrollBy(opciones)
- -

Parámetros

- -
    -
  • X es el número de pixels a desplazar horizontalmente.
  • -
  • Y es el número de pixels a desplazar verticalmente.
  • -
- -

Si X o Y son positivos, desplazarán la página hacia la derecha o hacia abajo respectivamente. Si son negativos, la desplazarán hacia la izquierda o hacia arriba respectivamente.

- -

- or -

- -
    -
  • opciones es un objeto con tres posibles propiedades: - -
      -
    • top, que es lo mismo que Y
    • -
    • left, que es lo mismo que X
    • -
    • behavior, que es un string cuyo valor puede ser smooth, instant, or auto. Por defecto el valor es auto
    • -
    -
  • -
- -

Ejemplo

- -
// Desplazarse la longitud de una página
-window.scrollBy(0, window.innerHeight);
-
- -

Para hacer scroll hacia arriba:

- -
window.scrollBy(0, -window.innerHeight);
- -

Utilizando opciones:

- -
window.scrollBy({
-  top: 100,
-  left: 100,
-  behaviour: 'smooth'
-})
- -

Notas

- -

window.scrollBy desplaza el documento una cantidad determinada, mientras que window.scroll lo hace hacia una posición absoluta en el documento. Vea también window.scrollByLines, window.scrollByPages

- -

Especificación

- - - - - - - - - - - - - - - - -
EspecificaciónEstadoComentarios
{{ SpecName('CSSOM View', '#dom-window-scrollby', 'window.scrollBy()') }}{{ Spec2('CSSOM View') }}Definición inicial.
diff --git a/files/es/web/api/window/scrollby/index.md b/files/es/web/api/window/scrollby/index.md new file mode 100644 index 00000000000000..2080b9d6332e79 --- /dev/null +++ b/files/es/web/api/window/scrollby/index.md @@ -0,0 +1,72 @@ +--- +title: Window.scrollBy() +slug: Web/API/Window/scrollBy +tags: + - API + - CSSOM View + - Método(2) + - NeedsCompatTable + - NeedsSpecTable + - Referencia +translation_of: Web/API/Window/scrollBy +--- +{{ APIRef() }} + +## Resumen + +Desplaza el documento el número de pixels proporcionados. + +## Sintaxis + +```js +window.scrollBy(X, Y); +window.scrollBy(opciones) +``` + +### Parámetros + +- `X` es el número de pixels a desplazar horizontalmente. +- `Y` es el número de pixels a desplazar verticalmente. + +Si X o Y son positivos, desplazarán la página hacia la derecha o hacia abajo respectivamente. Si son negativos, la desplazarán hacia la izquierda o hacia arriba respectivamente. + +\- or - + +- opciones es un objeto con tres posibles propiedades: + + - top, que es lo mismo que Y + - left, que es lo mismo que X + - behavior, que es un string cuyo valor puede ser smooth, instant, or auto. Por defecto el valor es auto + +## Ejemplo + +```js +// Desplazarse la longitud de una página +window.scrollBy(0, window.innerHeight); +``` + +Para hacer scroll hacia arriba: + +```js +window.scrollBy(0, -window.innerHeight); +``` + +Utilizando opciones: + +```js +window.scrollBy({ + top: 100, + left: 100, + behaviour: 'smooth' +}) +``` + +## Notas + +[window.scrollBy](/es/docs/DOM/Window.scrollBy) desplaza el documento una cantidad determinada, mientras que [window.scroll](/es/docs/DOM/Window.scroll) lo hace hacia una posición absoluta en el documento. Vea también [window.scrollByLines](/es/docs/DOM/Window.scrollByLines), [window.scrollByPages](/es/docs/DOM/Window.scrollByPages) + +## Especificación + +| Especificación | Estado | Comentarios | +| ------------------------------------------------------------------------------------------------ | -------------------------------- | ------------------- | +| {{ SpecName('CSSOM View', '#dom-window-scrollby', 'window.scrollBy()') }} | {{ Spec2('CSSOM View') }} | Definición inicial. | diff --git a/files/es/web/api/window/scrollto/index.html b/files/es/web/api/window/scrollto/index.html deleted file mode 100644 index 3cac8d1687d9a3..00000000000000 --- a/files/es/web/api/window/scrollto/index.html +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: Window.scrollTo() -slug: Web/API/Window/scrollTo -translation_of: Web/API/Window/scrollTo ---- -
{{ APIRef }}
- -

Resumen

- -

Desplaza el visor a un conjunto específico de coodenadas en el documento.

- -

Sintaxis

- -
window.scrollTo(x-coord, y-coord)
- -

Parámetros

- -
    -
  • x-coord es el pixel en el eje horizontal del documento que debe terminar posicionado en el extremo superior izquierdo.
  • -
  • y-coord es el pixel en el eje vertical del documento que debe terminar posicionado en el extremo superior izquierdo.
  • -
- -

Ejemplo

- -
window.scrollTo( 0, 1000 );
- -

Notas

- -

Esta función es en efecto la misma que window.scroll. Para desplazamiento relativo, ver window.scrollBy, window.scrollByLines, y window.scrollByPages.

- -

Para desplazar el visor dentro de elementos, ver Element.scrollTop and Element.scrollLeft.

- -

Especificaciones

- - - - - - - - - - - - - - - - -
EspecificaciónEstadoComentario
{{ SpecName('CSSOM View', '#dom-window-scroll', 'window.scroll()') }}{{ Spec2('CSSOM View') }}Definición inicial.
diff --git a/files/es/web/api/window/scrollto/index.md b/files/es/web/api/window/scrollto/index.md new file mode 100644 index 00000000000000..634586417c8bf5 --- /dev/null +++ b/files/es/web/api/window/scrollto/index.md @@ -0,0 +1,39 @@ +--- +title: Window.scrollTo() +slug: Web/API/Window/scrollTo +translation_of: Web/API/Window/scrollTo +--- +{{ APIRef }} + +## Resumen + +Desplaza el visor a un conjunto específico de coodenadas en el documento. + +## Sintaxis + +```js +window.scrollTo(x-coord, y-coord) +``` + +### Parámetros + +- `x-coord` es el pixel en el eje horizontal del documento que debe terminar posicionado en el extremo superior izquierdo. +- `y-coord` es el pixel en el eje vertical del documento que debe terminar posicionado en el extremo superior izquierdo. + +## Ejemplo + +```js +window.scrollTo( 0, 1000 ); +``` + +## Notas + +Esta función es en efecto la misma que [window.scroll](/es/docs/DOM/Window.scroll). Para desplazamiento relativo, ver [window.scrollBy](/es/docs/DOM/Window.scrollBy), [window.scrollByLines](/es/docs/DOM/Window.scrollByLines), y [window.scrollByPages](/es/docs/DOM/Window.scrollByPages). + +Para desplazar el visor dentro de elementos, ver [Element.scrollTop ](/es/docs/Web/API/Element/scrollTop)and [Element.scrollLeft](/es/docs/Web/API/Element/scrollLeft). + +## Especificaciones + +| Especificación | Estado | Comentario | +| -------------------------------------------------------------------------------------------- | -------------------------------- | ------------------- | +| {{ SpecName('CSSOM View', '#dom-window-scroll', 'window.scroll()') }} | {{ Spec2('CSSOM View') }} | Definición inicial. | diff --git a/files/es/web/api/window/scrollx/index.html b/files/es/web/api/window/scrollx/index.html deleted file mode 100644 index ab79aee6d98dbd..00000000000000 --- a/files/es/web/api/window/scrollx/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: Window.scrollX -slug: Web/API/Window/scrollX -translation_of: Web/API/Window/scrollX ---- -
{{ APIRef() }}
- -

Resumen

- -

Retorna el número de pixels que el documento ha sido desplazado horizontalmente.

- -

Sintaxis

- -
var x = window.scrollX;
- -

Parámetros

- -
    -
  • x será el número de pixels que el documento está desplazado actualmente desde la izquierda.
  • -
- -

Ejemplo

- -
// Si scrollX es mayor que 400, reinicia la posición de desplazxamiento al inicio supuerior-izquierdo del documento.
-if (window.scrollX > 400) {
-  window.scroll(0,0);
-}
- -

Notas

- -

La propiedad pageXOffset es un alias de la propiedad scrollX:

- -
window.pageXOffset == window.scrollX; // siempre true
- -

Para compatibilidad cruzada entre navegadores, use window.pageXOffset en lugar de window.scrollX. Adicionalmente, versiones más antiguas de Internet Explorer (< 9) no soportan ninguna de las dos propiedades y deben ser sorteadas examinando otras propiedade no estandar. Un ejemplo totalmente compatible:

- -
var x = (window.pageXOffset !== undefined)
-  ? window.pageXOffset
-  : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
-
-var y = (window.pageYOffset !== undefined)
-  ? window.pageYOffset
-  : (document.documentElement || document.body.parentNode || document.body).scrollTop;
- -

Especificación

- - - - - - - - - - - - - - - - -
EspecificaciónEstadoObservaciones
{{ SpecName('CSSOM View', '#dom-window-scrollx', 'window.scrollX') }}{{ Spec2('CSSOM View') }}
- -

Compatibilidad con navegadores

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

Ver también

- - diff --git a/files/es/web/api/window/scrollx/index.md b/files/es/web/api/window/scrollx/index.md new file mode 100644 index 00000000000000..87b2e63f37959c --- /dev/null +++ b/files/es/web/api/window/scrollx/index.md @@ -0,0 +1,63 @@ +--- +title: Window.scrollX +slug: Web/API/Window/scrollX +translation_of: Web/API/Window/scrollX +--- +{{ APIRef() }} + +## Resumen + +Retorna el número de pixels que el documento ha sido desplazado horizontalmente. + +## Sintaxis + +```js +var x = window.scrollX; +``` + +### Parámetros + +- x será el número de pixels que el documento está desplazado actualmente desde la izquierda. + +## Ejemplo + +```js +// Si scrollX es mayor que 400, reinicia la posición de desplazxamiento al inicio supuerior-izquierdo del documento. +if (window.scrollX > 400) { + window.scroll(0,0); +} +``` + +## Notas + +La propiedad `pageXOffset` es un alias de la propiedad `scrollX`: + +```js +window.pageXOffset == window.scrollX; // siempre true +``` + +Para compatibilidad cruzada entre navegadores, use `window.pageXOffset` en lugar de `window.scrollX`. **Adicionalmente**, versiones más antiguas de Internet Explorer (< 9) no soportan ninguna de las dos propiedades y deben ser sorteadas examinando otras propiedade no estandar. Un ejemplo totalmente compatible: + +```js +var x = (window.pageXOffset !== undefined) + ? window.pageXOffset + : (document.documentElement || document.body.parentNode || document.body).scrollLeft; + +var y = (window.pageYOffset !== undefined) + ? window.pageYOffset + : (document.documentElement || document.body.parentNode || document.body).scrollTop; +``` + +## Especificación + +| Especificación | Estado | Observaciones | +| -------------------------------------------------------------------------------------------- | -------------------------------- | ------------- | +| {{ SpecName('CSSOM View', '#dom-window-scrollx', 'window.scrollX') }} | {{ Spec2('CSSOM View') }} | | + +## Compatibilidad con navegadores + +{{Compat("api.Window.scrollX")}} + +## Ver también + +- [window.scrollY](/es/docs/DOM/window.scrollY "window.scrollX | Document Object Model (DOM) | MDN") diff --git a/files/es/web/api/window/scrolly/index.html b/files/es/web/api/window/scrolly/index.html deleted file mode 100644 index 4a5464d16a9f10..00000000000000 --- a/files/es/web/api/window/scrolly/index.html +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: Window.scrollY -slug: Web/API/Window/scrollY -tags: - - API - - Propiedad - - Rerencia - - Scroll Vertical -translation_of: Web/API/Window/scrollY ---- -
{{APIRef}}
- -

Sumario

- -

Retorna el número de píxeles que han sido desplazados en el documento mediante el scroll vertical.

- -

Sintaxis

- -
var y = window.scrollY;
- -
    -
  • y es el número de píxeles que se han desplazado actualmente desde el extremo superior de la página.
  • -
- -

Ejemplo

- -
// Asegurate de bajar a la segunda página
-if (window.scrollY) {
-  window.scroll(0, 0);  // Restablece la posición de desplazamiento en la parte superior izquierda del documento
-}
-
-window.scrollByPages(1);
- -

Notas

- -

Usa esta propiedad para verificar que al documento no se le ha hecho scroll, si estás usando funciones relativas de scroll como {{domxref("window.scrollBy")}}, {{domxref("window.scrollByLines")}}, o {{domxref("window.scrollByPages")}}.

- -

La propiedad pageYOffset es un alias para la propiedad scrollY:

- -
window.pageYOffset == window.scrollY; // Siempre verdadero
- -

Para compatibilidad entre navegadores, es recomendable usar window.pageYOffset en vez de window.scrollY. Adicionalmente, tener en cuenta que versiones más viejas de Internet Explorer (<9) no soportan del todo la propiedad y debe ser solucionado usando propiedades no estandarizadas . Un ejemplo totalmente compatible entre navegadores:

- -
var supportPageOffset = window.pageXOffset !== undefined;
-var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");
-
-var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
-var y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
-
- -

Especificación

- - - -

Ver también

- -
    -
  • {{domxref("window.scrollX")}}
  • -
diff --git a/files/es/web/api/window/scrolly/index.md b/files/es/web/api/window/scrolly/index.md new file mode 100644 index 00000000000000..eee07336e12005 --- /dev/null +++ b/files/es/web/api/window/scrolly/index.md @@ -0,0 +1,62 @@ +--- +title: Window.scrollY +slug: Web/API/Window/scrollY +tags: + - API + - Propiedad + - Rerencia + - Scroll Vertical +translation_of: Web/API/Window/scrollY +--- +{{APIRef}} + +## Sumario + +Retorna el número de píxeles que han sido desplazados en el documento mediante el scroll vertical. + +## Sintaxis + +```js +var y = window.scrollY; +``` + +- y es el número de píxeles que se han desplazado actualmente desde el extremo superior de la página. + +## Ejemplo + +```js +// Asegurate de bajar a la segunda página +if (window.scrollY) { + window.scroll(0, 0); // Restablece la posición de desplazamiento en la parte superior izquierda del documento +} + +window.scrollByPages(1); +``` + +## Notas + +Usa esta propiedad para verificar que al documento no se le ha hecho scroll, si estás usando funciones relativas de scroll como {{domxref("window.scrollBy")}}, {{domxref("window.scrollByLines")}}, o {{domxref("window.scrollByPages")}}. + +La propiedad `pageYOffset` es un alias para la propiedad `scrollY`: + +```js +window.pageYOffset == window.scrollY; // Siempre verdadero +``` + +Para compatibilidad entre navegadores, es recomendable usar window\.pageYOffset en vez de window\.scrollY. **Adicionalmente**, tener en cuenta que versiones más viejas de Internet Explorer (<9) no soportan del todo la propiedad y debe ser solucionado usando propiedades no estandarizadas . Un ejemplo totalmente compatible entre navegadores: + +```js +var supportPageOffset = window.pageXOffset !== undefined; +var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat"); + +var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft; +var y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop; +``` + +## Especificación + +- CSSOM View Module: [window.scrollY](http://dev.w3.org/csswg/cssom-view/#dom-window-scrolly) (Editor's Draft) + +## Ver también + +- {{domxref("window.scrollX")}} diff --git a/files/es/web/api/window/sessionstorage/index.html b/files/es/web/api/window/sessionstorage/index.html deleted file mode 100644 index d88506535306e6..00000000000000 --- a/files/es/web/api/window/sessionstorage/index.html +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: Window.sessionStorage -slug: Web/API/Window/sessionStorage -tags: - - Almacenaje - - Propiedad - - Referencia - - Sesion -translation_of: Web/API/Window/sessionStorage ---- -

{{APIRef()}}

- -

La propiedad sessionStorage permite acceder a un objeto {{domxref("Storage")}} asociado a la sesión actual. La propiedad sessionStorage es similar a localStorage, la única diferencia es que la información almacenada en localStorage no posee tiempo de expiración, por el contrario la información almacenada en sessionStorage es eliminada al finalizar la sesion de la página. La sesión de la página perdura mientras el navegador se encuentra abierto, y se mantiene por sobre las recargas y reaperturas de la página. Abrir una página en una nueva pestaña o ventana iniciará una nueva sesión, lo que difiere en la forma en que trabajan las cookies de sesión.

- -

Sintaxis

- -
// Almacena la información en sessionStorage
-sessionStorage.setItem('key', 'value');
-
-// Obtiene la información almacenada desde sessionStorage
-var data = sessionStorage.getItem('key');
- -

Valor

- -

Un objeto de tipo {{domxref("Storage")}}.

- -

Ejemplo

- -

El siguiente código accede al objeto {{domxref("Storage")}} del la sesión actual del domino y le añade un elemento utilizando {{domxref("Storage.setItem()")}}.

- -
sessionStorage.setItem('myCat', 'Tom');
- -

El siguiente ejemplo graba de forma automática el contenido de un campo de texto, y si el navegador es actualizado accidentalmente, restaura el contenido del campo de texto para no perder lo escrito.

- -
// Obtiene el campo de texto que vamos a moniterear
-var field = document.getElementById("field");
-
-// Verificamos si tenemos algún valor auto guardado
-// (esto solo ocurrirá si la página es recargada accidentalmente)
-if (sessionStorage.getItem("autosave")) {
-  // Restaura el contenido al campo de texto
-  field.value = sessionStorage.getItem("autosave");
-}
-
-// Espera por cambios en el campo de texto
-field.addEventListener("change", function() {
-  // Almacena el resultado en el objeto de almacenamiento de sesión
-  sessionStorage.setItem("autosave", field.value);
-});
- -

- -
-

Nota: Por favor diríjase al artículo Usando la API de Web Storage para un ejemplo completo.

-
- -

Especificaciones

- - - - - - - - - - - - - - -
EspecificaciónEstadoComentario
{{SpecName('Web Storage', '#the-sessionstorage-attribute', 'sessionStorage')}}{{Spec2('Web Storage')}}
- -

Compatibilidad con navegadores

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

Vea También

- - diff --git a/files/es/web/api/window/sessionstorage/index.md b/files/es/web/api/window/sessionstorage/index.md new file mode 100644 index 00000000000000..1d2f308b6418ce --- /dev/null +++ b/files/es/web/api/window/sessionstorage/index.md @@ -0,0 +1,72 @@ +--- +title: Window.sessionStorage +slug: Web/API/Window/sessionStorage +tags: + - Almacenaje + - Propiedad + - Referencia + - Sesion +translation_of: Web/API/Window/sessionStorage +--- +{{APIRef()}} + +La propiedad `sessionStorage` permite acceder a un objeto {{domxref("Storage")}} asociado a la sesión actual. La propiedad sessionStorage es similar a [`localStorage`](/es/docs/Web/API/Window.localStorage), la única diferencia es que la información almacenada en localStorage no posee tiempo de expiración, por el contrario la información almacenada en sessionStorage es eliminada al finalizar la sesion de la página. La sesión de la página perdura mientras el navegador se encuentra abierto, y se mantiene por sobre las recargas y reaperturas de la página. **Abrir una página en una nueva pestaña o ventana iniciará una nueva sesión**, lo que difiere en la forma en que trabajan las cookies de sesión**.** + +## Sintaxis + +```js +// Almacena la información en sessionStorage +sessionStorage.setItem('key', 'value'); + +// Obtiene la información almacenada desde sessionStorage +var data = sessionStorage.getItem('key'); +``` + +### Valor + +Un objeto de tipo {{domxref("Storage")}}. + +## Ejemplo + +El siguiente código accede al objeto {{domxref("Storage")}} del la sesión actual del domino y le añade un elemento utilizando {{domxref("Storage.setItem()")}}. + +```js +sessionStorage.setItem('myCat', 'Tom'); +``` + +El siguiente ejemplo graba de forma automática el contenido de un campo de texto, y si el navegador es actualizado accidentalmente, restaura el contenido del campo de texto para no perder lo escrito. + +```js +// Obtiene el campo de texto que vamos a moniterear +var field = document.getElementById("field"); + +// Verificamos si tenemos algún valor auto guardado +// (esto solo ocurrirá si la página es recargada accidentalmente) +if (sessionStorage.getItem("autosave")) { + // Restaura el contenido al campo de texto + field.value = sessionStorage.getItem("autosave"); +} + +// Espera por cambios en el campo de texto +field.addEventListener("change", function() { + // Almacena el resultado en el objeto de almacenamiento de sesión + sessionStorage.setItem("autosave", field.value); +}); +``` + +> **Nota:** Por favor diríjase al artículo [Usando la API de Web Storage](/es/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API) para un ejemplo completo. + +## Especificaciones + +| Especificación | Estado | Comentario | +| -------------------------------------------------------------------------------------------------------- | -------------------------------- | ---------- | +| {{SpecName('Web Storage', '#the-sessionstorage-attribute', 'sessionStorage')}} | {{Spec2('Web Storage')}} | | + +## Compatibilidad con navegadores + +{{Compat("api.Window.sessionStorage")}} + +## Vea También + +- [Usando la API de Web Storage](/es/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API) +- [Window.localStorage](/es/docs/Web/API/Window.localStorage) diff --git a/files/es/web/api/window/showmodaldialog/index.html b/files/es/web/api/window/showmodaldialog/index.html deleted file mode 100644 index c108801aa8efd9..00000000000000 --- a/files/es/web/api/window/showmodaldialog/index.html +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: Window.showModalDialog() -slug: Web/API/Window/showModalDialog -translation_of: Web/API/Window/showModalDialog ---- -
{{ deprecated_header() }}{{APIRef}}
- -

El método Window.showModalDialog() crea y visualiza una caja de diálogo modal, conteniendo el documento HTML especificado.

- -
-

Esta prestación va a desaparecer. Por favor ajuste sus sitios Web y aplicaciones.

- -

El soporte ha sido eliminado en Chrome 37. Pero se añadió temporalmente un ajuste de Política Coporativa para rehabilitar showModalDialog. Este método showModalDialog() fue eliminado definitivamente en Chrome 43.

- -

Mozilla ha anunciado que eliminará el soporte para este método ({{bug(981796)}}). Sin plazo específico, debería ser antes de Firefox 46. Esto quiere decir que la función estará fuera de uso sobre mediados de junio de 2016. Una revisión ESR podría soportarla aun por algunas meses más.

-
- -

Sintaxis

- -
valRetorno = window.showModalDialog(uri[, argumentos][, opciones]);
-
- -

donde

- -
    -
  • valRetorno es un valor indicando la propiedad returnValue establecida por la ventana del documento especificado por la uri.
  • -
  • uri is es la URI del documento a visualizar en la caja de diálogo.
  • -
  • argumentos es un parámetro adicional, que contiene valores que deberían ser pasados a la caja de diálogo; estos son puestos a disposición en el la propiedad window.dialogArguments del objeto window.
  • -
  • opciones es una cadena adicional que especifica ornamentaciones de ventana para la caja de diálogo, usando uno o más de los siguientes valores separados por punto y coma:
  • -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SintaxisDescripción
center: {on | off | yes | no | 1 | 0 }Si el valor de este argumento es on, yes, ó 1, la ventana de diálogo será centrada en el escritorio; en caso contrario será oculta. El valor por defecto es yes.
dialogheight: heightEspecifica la altura de la caja de diálogo; por defecto, el tamaño es especificado en pixels.
dialogleft: leftEspecifica la posición horizontal de la caja de diálogo respecto de la esquina superior izquierda del escritorio.
dialogwidth: widthEspecifica la anchura de la caja de diálogo; por defecto el tamaño es especificado en pixels.
dialogtop: topEspecifica la posición vertical de la caja de diálogo, respcto de la esquina superior izquierda del escritorio.
resizable: {on | off | yes | no | 1 | 0 }Si el valor de este argumentoes on, yes, ó 1, la ventana de diálogo podrá ser redimensionada por el usuario; en caso controario su tamaño será fijo. El valor por defecto es no.
scroll: {on | off | yes | no | 1 | 0 }Si el valor de este argumento es on, yes, ó 1, la ventana de diálogo tendrá barras de desplazamiento; en caso contrario su tamaño será fijo. El valor por defecto es no.
- -

{{Note("Firefox no implementa los argumentos dialogHide, edge, status, ó unadorned.")}}

- -

Compatibilidad con navegadores

- -

Introducido por Microsoft Internet Explorer 4. Soporte añadido a Firefox en Firefox 3 (desaconsejado en Fx 28), y a Safari en Safari 5.1. Ver WebKit bug 151885 para posible futura eliminación de Safari.

- -

Ejemplos

- -

Probar showModalDialog().

- -

Notas

- -

showModalDialog() está siendo estandarizado actualmente como parte de HTML5. El tercer argumento (para opciones adicionales) no está presente en la versión HTML5, y es (seguramente) ignorado por Safari and Chrome.

- -

Especificación

- - - -

Ver también

- - diff --git a/files/es/web/api/window/showmodaldialog/index.md b/files/es/web/api/window/showmodaldialog/index.md new file mode 100644 index 00000000000000..9d7a64fb8c887c --- /dev/null +++ b/files/es/web/api/window/showmodaldialog/index.md @@ -0,0 +1,61 @@ +--- +title: Window.showModalDialog() +slug: Web/API/Window/showModalDialog +translation_of: Web/API/Window/showModalDialog +--- +{{ deprecated_header() }}{{APIRef}} + +El método **`Window.showModalDialog()`** crea y visualiza una caja de diálogo modal, conteniendo el documento HTML especificado. + +> **Nota:** **Esta prestación va a desaparecer. Por favor ajuste sus sitios Web y aplicaciones.** +> +> El soporte ha sido eliminado en [Chrome 37](http://blog.chromium.org/2014/07/disabling-showmodaldialog.html). Pero se añadió temporalmente un [ajuste de Política Coporativa para rehabilitar showModalDialog](http://www.chromium.org/administrators/policy-list-3#EnableDeprecatedWebPlatformFeatures). Este método showModalDialog() fue eliminado definitivamente en Chrome 43. +> +> Mozilla ha anunciado que eliminará el soporte para este método ({{bug(981796)}}). Sin plazo específico, debería ser antes de Firefox 46. Esto quiere decir que la función estará fuera de uso sobre mediados de junio de 2016. Una revisión ESR podría soportarla aun por algunas meses más. + +## Sintaxis + +```js +valRetorno = window.showModalDialog(uri[, argumentos][, opciones]); +``` + +donde + +- `valRetorno` es un valor indicando la propiedad returnValue establecida por la ventana del documento especificado por la `uri`. +- `uri` is es la URI del documento a visualizar en la caja de diálogo. +- `argumentos` es un parámetro adicional, que contiene valores que deberían ser pasados a la caja de diálogo; estos son puestos a disposición en el la propiedad [`window.dialogArguments`](/en-US/docs/DOM/window.dialogArguments) del objeto [`window`](/en-US/docs/DOM/window). +- `opciones` es una cadena adicional que especifica ornamentaciones de ventana para la caja de diálogo, usando uno o más de los siguientes valores separados por punto y coma: + +| Sintaxis | Descripción | +| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `center: {on \| off \| yes \| no \| 1 \| 0 }` | Si el valor de este argumento es `on`, `yes`, ó 1, la ventana de diálogo será centrada en el escritorio; en caso contrario será oculta. El valor por defecto es `yes`. | +| `dialogheight: height` | Especifica la altura de la caja de diálogo; por defecto, el tamaño es especificado en pixels. | +| `dialogleft: left` | Especifica la posición horizontal de la caja de diálogo respecto de la esquina superior izquierda del escritorio. | +| `dialogwidth: width` | Especifica la anchura de la caja de diálogo; por defecto el tamaño es especificado en pixels. | +| `dialogtop: top` | Especifica la posición vertical de la caja de diálogo, respcto de la esquina superior izquierda del escritorio. | +| `resizable: {on \| off \| yes \| no \| 1 \| 0 }` | Si el valor de este argumentoes `on`, `yes`, ó 1, la ventana de diálogo podrá ser redimensionada por el usuario; en caso controario su tamaño será fijo. El valor por defecto es `no`. | +| `scroll: {on \| off \| yes \| no \| 1 \| 0 }` | Si el valor de este argumento es `on`, `yes`, ó 1, la ventana de diálogo tendrá barras de desplazamiento; en caso contrario su tamaño será fijo. El valor por defecto es `no`. | + +{{Note("Firefox no implementa los argumentos dialogHide, edge, status, ó unadorned.")}} + +## Compatibilidad con navegadores + +Introducido por Microsoft Internet Explorer 4. Soporte añadido a Firefox en Firefox 3 (desaconsejado en Fx 28), y a Safari en Safari 5.1. Ver [WebKit bug 151885](https://bugs.webkit.org/show_bug.cgi?id=151885) para posible futura eliminación de Safari. + +## Ejemplos + +[Probar `showModalDialog()`](/samples/domref/showModalDialog.html). + +## Notas + +`showModalDialog()` está siendo estandarizado actualmente como parte de HTML5. El tercer argumento (para opciones adicionales) no está presente en la versión HTML5, y es (seguramente) ignorado por Safari and Chrome. + +## Especificación + +- [MSDN page for `showModalDialog`]() +- [Diálogos HTML5 implementados usando documentos separados](http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dialogs-implemented-using-separate-documents) + +## Ver también + +- {{HTMLElement("dialog")}}, un sustituo para `window.showModalDialog()`. +- [showModalDialog Polyfill](https://github.com/niutech/showModalDialog) usando un {{HTMLElement("dialog")}} y [generadores](/es/docs/Web/JavaScript/Reference/Statements/function*) diff --git a/files/es/web/api/window/statusbar/index.html b/files/es/web/api/window/statusbar/index.html deleted file mode 100644 index 2e60d61988917d..00000000000000 --- a/files/es/web/api/window/statusbar/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: Window.statusbar -slug: Web/API/Window/statusbar -translation_of: Web/API/Window/statusbar ---- -
{{APIRef}}
- -

Resumen

- -

Retorna el objeto statusbar, la visibilidad se puede alternar en la ventana.

- -

Sintaxis

- -
objRef = window.statusbar
-
- -

Ejemplo

- -

El siguiente ejemplo HTML muestra una forma de utilizar la propiedad visible de los diversos objetos de "bar", y tambien el cambio de privilegios nesesarios para escribir en la propiedad visible para cada una de las ventanas existentes.

- -
<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="UTF-8" />
-<title>Various DOM Tests</title>
-
-<script>
-// cambia el estado de la barra en la ventana existente
-netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
-window.statusbar.visible=!window.statusbar.visible;
-</script>
-
-</head>
-<body>
-  <p>Various DOM Tests</p>
-</body>
-</html>
-
- -

Notas

- -

Al cargar la pagina del ejemplo anterior se muestra el siguiente cuadro de dialogo:

- -

Para alternar la visibilidad de las barras, debe de firmar sus scripts o abilitar los privilegios apropiados, como en el ejemplo anterior. Tenga en cuenta que cambiar la visibilidad de manera dinamica de las barras de herramientas puede cambiar el tamaño de la ventana de forma dramatica y afectando de manera significativa el rendimiento de su pagina.

- -

Especificaciones

- - - - - - - - - - - - - - - - - - - -
EspecificaciónEstadoComentario
{{SpecName('HTML WHATWG', 'browsers.html#dom-window-statusbar', 'Window.statusbar')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5 W3C', 'browsers.html#dom-window-statusbar', 'Window.statusbar')}}{{Spec2('HTML5 W3C')}}
- -

Ver tambien

- - diff --git a/files/es/web/api/window/statusbar/index.md b/files/es/web/api/window/statusbar/index.md new file mode 100644 index 00000000000000..3a0dfebf5b3546 --- /dev/null +++ b/files/es/web/api/window/statusbar/index.md @@ -0,0 +1,57 @@ +--- +title: Window.statusbar +slug: Web/API/Window/statusbar +translation_of: Web/API/Window/statusbar +--- +{{APIRef}} + +## Resumen + +Retorna el objeto statusbar, la visibilidad se puede alternar en la ventana. + +## Sintaxis + +```js +objRef = window.statusbar +``` + +## Ejemplo + +El siguiente ejemplo HTML muestra una forma de utilizar la propiedad visible de los diversos objetos de "bar", y tambien el cambio de privilegios nesesarios para escribir en la propiedad visible para cada una de las ventanas existentes. + +```html + + + + +Various DOM Tests + + + + + +

Various DOM Tests

+ + +``` + +## Notas + +Al cargar la pagina del ejemplo anterior se muestra el siguiente cuadro de dialogo:![](https://mdn.mozillademos.org/files/550/Modify_any_open_window_dialog.png) + +Para alternar la visibilidad de las barras, debe de firmar sus scripts o abilitar los privilegios apropiados, como en el ejemplo anterior. Tenga en cuenta que cambiar la visibilidad de manera dinamica de las barras de herramientas puede cambiar el tamaño de la ventana de forma dramatica y afectando de manera significativa el rendimiento de su pagina. + +## Especificaciones + +| Especificación | Estado | Comentario | +| ---------------------------------------------------------------------------------------------------------------- | -------------------------------- | ---------- | +| {{SpecName('HTML WHATWG', 'browsers.html#dom-window-statusbar', 'Window.statusbar')}} | {{Spec2('HTML WHATWG')}} | | +| {{SpecName('HTML5 W3C', 'browsers.html#dom-window-statusbar', 'Window.statusbar')}} | {{Spec2('HTML5 W3C')}} | | + +## Ver tambien + +- [window.locationbar](/es/docs/Web/API/Window.locationbar), [window.menubar](/es/docs/Web/API/Window.menubar), [window.personalbar](/es/docs/Web/API/Window.personalbar), [window.scrollbars](/es/docs/Web/API/Window.scrollbars), [window.toolbar](/es/docs/Web/API/Window.toolbar) From f455eb2688e96d0d6946b58fc3dbc3511b984350 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 19 Sep 2022 12:44:40 -0500 Subject: [PATCH 03/10] Update files/es/web/api/window/matchmedia/index.md --- files/es/web/api/window/matchmedia/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/es/web/api/window/matchmedia/index.md b/files/es/web/api/window/matchmedia/index.md index 818db116787c5c..fbcf8c46c5db9d 100644 --- a/files/es/web/api/window/matchmedia/index.md +++ b/files/es/web/api/window/matchmedia/index.md @@ -50,7 +50,7 @@ Consulte [Probando media queries](/es/docs/DOM/Using_media_queries_from_code "CS ## Ver también - [Media queries](/es/docs/CSS/Media_queries "CSS/Media queries") -- [Probando media queries](/es/docs/Web/Guide/CSS/probando_media_queries "CSS/Probando media queries +- [Probando media queries](/es/docs/Web/Guide/CSS/probando_media_queries) ") - {{domxref("MediaQueryList")}} - {{domxref("MediaQueryListListener")}} From a52c036178edaa5f49cfb39af291a9384ffcc32c Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 19 Sep 2022 13:05:05 -0500 Subject: [PATCH 04/10] Update files/es/web/api/window/prompt/index.md --- files/es/web/api/window/prompt/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/es/web/api/window/prompt/index.md b/files/es/web/api/window/prompt/index.md index 9b3c044a342e00..e96af762dd2d57 100644 --- a/files/es/web/api/window/prompt/index.md +++ b/files/es/web/api/window/prompt/index.md @@ -48,7 +48,7 @@ Un diálogo prompt contiene un cuadro de texto de una línea, un botón Cancel ( The following text is shared between this article, DOM:window\.confirm and DOM:window\.alertLos cuadros de diálogo son ventanas modales; previenen que el usuario acceda al resto de la interfaz del programa hasta que el cuadro de diálogo es cerrado. Por esta razón, no se debe abusar de cualquier función que crea un cuadro de diálogo (o ventana modal). -Nótese que el resultado es una cadena de texto. Esto significa que a veces se deberá hacer una conversión al valor introducido por el usuario. Por ejemplo, si la respuesta debe ser un valor numérico, se debe hacer la conversión del valor a tipo Number. var aNumber = Number(window\.prompt("Type a number", "")); +Nótese que el resultado es una cadena de texto. Esto significa que a veces se deberá hacer una conversión al valor introducido por el usuario. Por ejemplo, si la respuesta debe ser un valor numérico, se debe hacer la conversión del valor a tipo Number. `var aNumber = Number(window\.prompt("Type a number", ""))`; Usuarios de [Mozilla Chrome](/en-US/Chrome "Chrome") (p.ej. extensiones de Firefox) deben usar preferentemente métodos de `nsIPromptService`. From 94f9a7894db6532689e37e3ecf524f6a4298d55e Mon Sep 17 00:00:00 2001 From: Craig Blaszczyk Date: Tue, 20 Sep 2022 13:41:11 +0100 Subject: [PATCH 05/10] fix: remove hanging quote and bracket --- files/es/web/api/window/matchmedia/index.md | 1 - 1 file changed, 1 deletion(-) diff --git a/files/es/web/api/window/matchmedia/index.md b/files/es/web/api/window/matchmedia/index.md index fbcf8c46c5db9d..0179d15a77ac52 100644 --- a/files/es/web/api/window/matchmedia/index.md +++ b/files/es/web/api/window/matchmedia/index.md @@ -51,6 +51,5 @@ Consulte [Probando media queries](/es/docs/DOM/Using_media_queries_from_code "CS - [Media queries](/es/docs/CSS/Media_queries "CSS/Media queries") - [Probando media queries](/es/docs/Web/Guide/CSS/probando_media_queries) -") - {{domxref("MediaQueryList")}} - {{domxref("MediaQueryListListener")}} From e770723d064af01444231b5690d32439ee0016eb Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 20 Sep 2022 10:37:07 -0500 Subject: [PATCH 06/10] Update files/es/web/api/window/requestidlecallback/index.md --- files/es/web/api/window/requestidlecallback/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/es/web/api/window/requestidlecallback/index.md b/files/es/web/api/window/requestidlecallback/index.md index 4a879bab21edd2..35e666595ad058 100644 --- a/files/es/web/api/window/requestidlecallback/index.md +++ b/files/es/web/api/window/requestidlecallback/index.md @@ -5,7 +5,7 @@ translation_of: Web/API/Window/requestIdleCallback --- {{APIRef("HTML DOM")}}{{SeeCompatTable}} -El método **`w`\*\***`indow.requestIdleCallback()`\*\* encola la función que será ejecutada en periodos de inactividad del navegador permitiendo a los desarrolladores ejecutar en segundo plano tareas de baja prioridad del bucle de eventos, sin perjudicar la latencia de eventos principales como animaciones o respuestas a entradas. La funciones son ejecutadas normalmente en orden FIFO (primero en entrar primero en salir) salvo que se alcance el timeout definido de la función antes de que el navegador la ejecute. +El método **`window.requestIdleCallback()`** encola la función que será ejecutada en periodos de inactividad del navegador permitiendo a los desarrolladores ejecutar en segundo plano tareas de baja prioridad del bucle de eventos, sin perjudicar la latencia de eventos principales como animaciones o respuestas a entradas. La funciones son ejecutadas normalmente en orden FIFO (primero en entrar primero en salir) salvo que se alcance el timeout definido de la función antes de que el navegador la ejecute. ## Sintaxis From d30f2ed57c8cf83a2fb063696ac119574e42653d Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 20 Sep 2022 10:44:47 -0500 Subject: [PATCH 07/10] Update files/es/web/api/window/scrollby/index.md --- files/es/web/api/window/scrollby/index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/es/web/api/window/scrollby/index.md b/files/es/web/api/window/scrollby/index.md index 2080b9d6332e79..392c00df23268c 100644 --- a/files/es/web/api/window/scrollby/index.md +++ b/files/es/web/api/window/scrollby/index.md @@ -32,11 +32,11 @@ Si X o Y son positivos, desplazarán la página hacia la derecha o hacia abajo r \- or - -- opciones es un objeto con tres posibles propiedades: +- `opciones` es un objeto con tres posibles propiedades: - - top, que es lo mismo que Y - - left, que es lo mismo que X - - behavior, que es un string cuyo valor puede ser smooth, instant, or auto. Por defecto el valor es auto + - `top`, que es lo mismo que `Y` + - `left`, que es lo mismo que `X` + - `behavior`, que es un string cuyo valor puede ser smooth, instant, or auto. Por defecto el valor es `auto` ## Ejemplo From 04bba1d00f4ef60b2145a44799ae949f7c5decbe Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 20 Sep 2022 10:46:10 -0500 Subject: [PATCH 08/10] Update files/es/web/api/window/scrollx/index.md --- files/es/web/api/window/scrollx/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/es/web/api/window/scrollx/index.md b/files/es/web/api/window/scrollx/index.md index 87b2e63f37959c..92fe72db8f38b8 100644 --- a/files/es/web/api/window/scrollx/index.md +++ b/files/es/web/api/window/scrollx/index.md @@ -17,7 +17,7 @@ var x = window.scrollX; ### Parámetros -- x será el número de pixels que el documento está desplazado actualmente desde la izquierda. +- `x` será el número de pixels que el documento está desplazado actualmente desde la izquierda. ## Ejemplo From c3389e8c1a8b6531525e120479c15ef96c60d699 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 20 Sep 2022 10:47:10 -0500 Subject: [PATCH 09/10] Update files/es/web/api/window/scrolly/index.md --- files/es/web/api/window/scrolly/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/es/web/api/window/scrolly/index.md b/files/es/web/api/window/scrolly/index.md index eee07336e12005..d43976c132dcf6 100644 --- a/files/es/web/api/window/scrolly/index.md +++ b/files/es/web/api/window/scrolly/index.md @@ -20,7 +20,7 @@ Retorna el número de píxeles que han sido desplazados en el documento mediante var y = window.scrollY; ``` -- y es el número de píxeles que se han desplazado actualmente desde el extremo superior de la página. +- `y` es el número de píxeles que se han desplazado actualmente desde el extremo superior de la página. ## Ejemplo From 7efbcceaf03f0dace473429b013daea67fc94901 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 20 Sep 2022 10:59:33 -0500 Subject: [PATCH 10/10] Apply suggestions from code review --- files/es/web/api/window/sessionstorage/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/es/web/api/window/sessionstorage/index.md b/files/es/web/api/window/sessionstorage/index.md index 1d2f308b6418ce..74ebce91297981 100644 --- a/files/es/web/api/window/sessionstorage/index.md +++ b/files/es/web/api/window/sessionstorage/index.md @@ -10,7 +10,7 @@ translation_of: Web/API/Window/sessionStorage --- {{APIRef()}} -La propiedad `sessionStorage` permite acceder a un objeto {{domxref("Storage")}} asociado a la sesión actual. La propiedad sessionStorage es similar a [`localStorage`](/es/docs/Web/API/Window.localStorage), la única diferencia es que la información almacenada en localStorage no posee tiempo de expiración, por el contrario la información almacenada en sessionStorage es eliminada al finalizar la sesion de la página. La sesión de la página perdura mientras el navegador se encuentra abierto, y se mantiene por sobre las recargas y reaperturas de la página. **Abrir una página en una nueva pestaña o ventana iniciará una nueva sesión**, lo que difiere en la forma en que trabajan las cookies de sesión**.** +La propiedad `sessionStorage` permite acceder a un objeto {{domxref("Storage")}} asociado a la sesión actual. La propiedad sessionStorage es similar a [`localStorage`](/es/docs/Web/API/Window.localStorage), la única diferencia es que la información almacenada en localStorage no posee tiempo de expiración, por el contrario la información almacenada en sessionStorage es eliminada al finalizar la sesion de la página. La sesión de la página perdura mientras el navegador se encuentra abierto, y se mantiene por sobre las recargas y reaperturas de la página. **Abrir una página en una nueva pestaña o ventana iniciará una nueva sesión**, lo que difiere en la forma en que trabajan las cookies de sesión. ## Sintaxis