aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/notification/onclick
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
commit1109132f09d75da9a28b649c7677bb6ce07c40c0 (patch)
tree0dd8b084480983cf9f9680e8aedb92782a921b13 /files/es/web/api/notification/onclick
parent4b1a9203c547c019fc5398082ae19a3f3d4c3efe (diff)
downloadtranslated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.gz
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.bz2
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.zip
initial commit
Diffstat (limited to 'files/es/web/api/notification/onclick')
-rw-r--r--files/es/web/api/notification/onclick/index.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/files/es/web/api/notification/onclick/index.html b/files/es/web/api/notification/onclick/index.html
new file mode 100644
index 0000000000..211947a1b8
--- /dev/null
+++ b/files/es/web/api/notification/onclick/index.html
@@ -0,0 +1,61 @@
+---
+title: Notification.onclick
+slug: Web/API/notification/onclick
+tags:
+ - API
+ - DOM
+ - Notifications
+ - Propiedad
+ - Referencia
+ - onclick
+translation_of: Web/API/Notification/onclick
+---
+<p>{{APIRef("Web Notifications")}}</p>
+
+<p>La propiedad <code>onclick</code> de la interfaz {{domxref("Notification")}} especifica un event listener para recibir eventos {{event("click")}}. Estos eventos ocurren cuando el usuario hace un click sobre el {{domxref("Notification")}} mostrado.</p>
+
+<h2 id="Syntax" name="Syntax">Sintaxis</h2>
+
+<pre class="eval">Notification.onclick = function(event) { ... };
+</pre>
+
+<p>El comportamiento por defecto es mover el foco al viewport del <a href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context">sitio de contexto</a> de dicha notificación. Si no deseas este comportamiento, puedes llamar <code><a href="/en-US/docs/Web/API/Event/preventDefault">preventDefault()</a></code> en el objeto del evento.</p>
+
+<h2 id="Ejemplos">Ejemplos</h2>
+
+<p>En el siguiente ejemplo, utilizamos un manejador <code>onclick</code> para abrir un sitio web en una nueva pestaña (especificado con la inclusión del parámetro <code>'_blank'</code>) una vez que la notifación es cliqueada.</p>
+
+<pre class="brush: js">notification.onclick = function(event) {
+ event.preventDefault(); // Previene al buscador de mover el foco a la pestaña del Notification
+ window.open('http://www.mozilla.org', '_blank');
+}</pre>
+
+<h2 id="Especificaciones">Especificaciones</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('Web Notifications','#dom-notification-onclick','onclick')}}</td>
+ <td>{{Spec2('Web Notifications')}}</td>
+ <td>Living standard.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidad_de_navegadores">Compatibilidad de navegadores</h2>
+
+<p>{{Page("/en-US/docs/Web/API/Notification","Browser compatibility")}}</p>
+
+<h2 id="Mira_también">Mira también</h2>
+
+<ul>
+ <li>{{domxref("Notification")}}</li>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API">Usando la API de Notifications</a></li>
+</ul>