mozbrowsershowmodalprompt

  • Revision slug: Web/Reference/Events/mozbrowsershowmodalprompt
  • Revision title: mozbrowsershowmodalprompt
  • Revision id: 431987
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment

Revision Content

{{ non-standard_header() }}

The mozbrowsershowmodalprompt event is fired when the content of a browser {{HTMLElement("iframe")}} call the {{domxref("window.alert()")}}, {{domxref("window.confirm()")}} or {{domxref("window.prompt()")}} methods.

General info

Specification
Non standard
Interface
{{domxref("CustomEvent")}}
Bubbles
Yes
Cancelable
Yes
Target
{{HTMLElement("iframe")}}
Default Action
None

Properties

{{OpenEventProperties("The browser iframe")}}{{CustomEventProperties("Object","A custom object")}}{{CloseEventProperties()}}

Detail

The detail property is an anonymous JavaScript object with the following properties:

promptType
A string defining the type of the prompt. It can be alert, confirm or prompt.
title
A string representing the title of the prompt.
message
A string representing the value pass to the {{domxref("window.alert()")}}, {{domxref("window.confirm()")}} or {{domxref("window.prompt()")}} methods within the browser {{HTMLElement("iframe")}}'s content.
msg_name
A string representing the type of message. For that event, it's always showmodalprompt.
initialValue
A string representing the initial value for the {{domxref("window.prompt()")}} methods.
returnValue
A string representing the return value for the {{domxref("window.prompt()")}} methods.

Example

var browser = document.querySelector("iframe[mozbrowser]");

browser.addEventListener("mozbrowsershowmodalprompt", function( event ) {
  console.log("Asking for prompt:" + JSON.stringify(event.detail));
});
  • {{event("mozbrowserasyncscroll")}}
  • {{event("mozbrowserclose")}}
  • {{event("mozbrowsercontextmenu")}}
  • {{event("mozbrowsererror")}}
  • {{event("mozbrowsericonchange")}}
  • {{event("mozbrowserloadend")}}
  • {{event("mozbrowserloadstart")}}
  • {{event("mozbrowserlocationchange")}}
  • {{event("mozbrowseropenwindow")}}
  • {{event("mozbrowsersecuritychange")}}
  • {{event("mozbrowsertitlechange")}}
  • {{event("mozbrowserusernameandpasswordrequired")}}

See also

Revision Source

<p>{{ non-standard_header() }}</p>
<p>The <code>mozbrowsershowmodalprompt</code> event is fired when the content of a browser {{HTMLElement("iframe")}} call the {{domxref("window.alert()")}}, {{domxref("window.confirm()")}} or {{domxref("window.prompt()")}} methods.</p>
<h2 id="General_info">General info</h2>
<dl>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Specification</dt>
  <dd style="margin: 0 0 0 120px;">
    <em>Non standard</em></dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Interface</dt>
  <dd style="margin: 0 0 0 120px;">
    {{domxref("CustomEvent")}}</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Bubbles</dt>
  <dd style="margin: 0 0 0 120px;">
    Yes</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Cancelable</dt>
  <dd style="margin: 0 0 0 120px;">
    Yes</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Target</dt>
  <dd style="margin: 0 0 0 120px;">
    {{HTMLElement("iframe")}}</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Default Action</dt>
  <dd style="margin: 0 0 0 120px;">
    None</dd>
</dl>
<h2 id="Properties">Properties</h2>
<p>{{OpenEventProperties("The browser iframe")}}{{CustomEventProperties("Object","A custom object")}}{{CloseEventProperties()}}</p>
<h3 id="Detail">Detail</h3>
<p>The <code>detail</code> property is an anonymous JavaScript object with the following properties:</p>
<dl>
  <dt>
    <code>promptType</code></dt>
  <dd>
    A string defining the type of the prompt. It can be <code>alert</code>, <code>confirm</code> or <code>prompt</code>.</dd>
  <dt>
    <code>title</code></dt>
  <dd>
    A string representing the title of the prompt.</dd>
  <dt>
    <code>message</code></dt>
  <dd>
    A string representing the value pass to the {{domxref("window.alert()")}}, {{domxref("window.confirm()")}} or {{domxref("window.prompt()")}} methods within the browser {{HTMLElement("iframe")}}'s content.</dd>
  <dt>
    <code>msg_name</code></dt>
  <dd>
    A string representing the type of message. For that event, it's always <code>showmodalprompt</code>.</dd>
  <dt>
    <code>initialValue</code></dt>
  <dd>
    A string representing the initial value for the {{domxref("window.prompt()")}} methods.</dd>
  <dt>
    <code>returnValue</code></dt>
  <dd>
    A string representing the return value for the {{domxref("window.prompt()")}} methods.</dd>
</dl>
<h2 id="Example">Example</h2>
<pre class="brush:js;">
var browser = document.querySelector("iframe[mozbrowser]");

browser.addEventListener("mozbrowsershowmodalprompt", function( event ) {
  console.log("Asking for prompt:" + JSON.stringify(event.detail));
});</pre>
<h2 id="Related_Events">Related Events</h2>
<ul>
  <li>{{event("mozbrowserasyncscroll")}}</li>
  <li>{{event("mozbrowserclose")}}</li>
  <li>{{event("mozbrowsercontextmenu")}}</li>
  <li>{{event("mozbrowsererror")}}</li>
  <li>{{event("mozbrowsericonchange")}}</li>
  <li>{{event("mozbrowserloadend")}}</li>
  <li>{{event("mozbrowserloadstart")}}</li>
  <li>{{event("mozbrowserlocationchange")}}</li>
  <li>{{event("mozbrowseropenwindow")}}</li>
  <li>{{event("mozbrowsersecuritychange")}}</li>
  <li>{{event("mozbrowsertitlechange")}}</li>
  <li>{{event("mozbrowserusernameandpasswordrequired")}}</li>
</ul>
<h2 id="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/WebAPI/Browser" title="/en-US/docs/WebAPI/Browser">Using the Browser API</a></li>
</ul>
Revert to this revision